/** * represents a group of rules with a logical combinator (AND/OR). * groups can contain both rules and nested groups, forming a tree structure. */ export interface RuleGroupType { id: string; combinator: 'and' | 'or'; rules: RuleOrGroup[]; not?: boolean; disabled?: boolean; } /** * represents a single rule/condition in the query. */ export interface RuleType { id: string; field: string; operator: string; value: any; valueSource?: 'value' | 'field'; disabled?: boolean; /** Wwether the rule passes validation (undefined = not yet validated) */ valid?: boolean; /** validation error message if valid is false */ validationError?: string; } /** * union type for items that can appear in a rule group */ export type RuleOrGroup = RuleType | RuleGroupType; /** * type guard to check if an item is a RuleGroupType */ export declare function isRuleGroup(item: RuleOrGroup): item is RuleGroupType; /** * type guard to check if an item is a RuleType */ export declare function isRule(item: RuleOrGroup): item is RuleType; /** * configuration for a queryable field. */ export interface QueryField { name: string; label: string; dataType: FieldDataType; operators?: QueryOperator[]; values?: QueryOption[]; defaultOperator?: string; defaultValue?: any; placeholder?: string; validator?: (rule: RuleType) => boolean | string; /** Makes the field required */ required?: boolean; /** Minimum value for number/slider fields */ min?: number; /** Maximum value for number/slider fields */ max?: number; /** Step increment for number/slider fields */ step?: number; /** RegEx pattern for text fields */ pattern?: string; /** Minimum character length for text fields */ minLength?: number; /** Maximum character length for text fields */ maxLength?: number; /** Minimum date for date/datetime fields */ minDate?: string | number | Date; /** Maximum date for date/datetime fields */ maxDate?: string | number | Date; /** Minimum time for time fields */ minTime?: string | number | Date; /** Maximum time for time fields */ maxTime?: string | number | Date; } /** * supported field data types */ export type FieldDataType = 'text' | 'number' | 'date' | 'datetime' | 'time' | 'boolean' | 'select' | 'radio' | 'slider'; /** * configuration for an operator. */ export interface QueryOperator { name: string; label: string; valueCount?: 'none' | 'single'; } /** * generic option used for dropdowns (fields, operators, values). */ export interface QueryOption { value: string; label: string; } /** * configuration options for the query builder component. */ export interface QueryBuilderConfig { fields: QueryField[]; combinators?: QueryOption[]; showCloneButtons?: boolean; showLockButtons?: boolean; maxDepth?: number; disableDragAndDrop?: boolean; } /** * event detail for query change events. */ export interface QueryChangeEventDetail { /** The updated query */ query: RuleGroupType; } /** * event detail for rule/group actions. */ export interface QueryActionEventDetail { action: 'add-rule' | 'add-group' | 'remove' | 'clone' | 'lock' | 'unlock'; path: number[]; item?: RuleOrGroup; } /** * size options for the query builder components. * uses the short format (xs, sm, md, lg) which maps to: * - inputs/dropdowns/pickers: xs, sm, md, lg * - buttons: extra-small, small, medium, large */ export type QueryBuilderSize = 'xs' | 'sm' | 'md' | 'lg'; /** * button size format used by kyn-button component. */ export type ButtonSize = 'extra-small' | 'small' | 'medium' | 'large'; /** * maps QueryBuilderSize to ButtonSize. */ export declare const sizeToButtonSize: Record; //# sourceMappingURL=types.d.ts.map