@kumix/ui 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/components/motion/adaptive-stepper.d.ts +32 -0
- package/dist/components/motion/adaptive-stepper.d.ts.map +1 -0
- package/dist/components/motion/adaptive-stepper.js +302 -0
- package/dist/components/motion/adaptive-stepper.js.map +1 -0
- package/dist/components/motion/combobox/content.js +1 -1
- package/dist/components/motion/combobox/context.js +216 -1
- package/dist/components/motion/combobox/context.js.map +1 -0
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +1 -1
- package/dist/components/motion/combobox.js +1 -1
- package/dist/components/motion/input.d.ts +2 -0
- package/dist/components/motion/input.d.ts.map +1 -1
- package/dist/components/motion/input.js +28 -25
- package/dist/components/motion/input.js.map +1 -1
- package/dist/components/motion/liquid.d.ts +30 -0
- package/dist/components/motion/liquid.d.ts.map +1 -0
- package/dist/components/motion/liquid.js +248 -0
- package/dist/components/motion/liquid.js.map +1 -0
- package/dist/components/motion/multi-select/content.d.ts +16 -0
- package/dist/components/motion/multi-select/content.d.ts.map +1 -0
- package/dist/components/motion/multi-select/content.js +91 -0
- package/dist/components/motion/multi-select/content.js.map +1 -0
- package/dist/components/motion/multi-select/context.d.ts +64 -0
- package/dist/components/motion/multi-select/context.d.ts.map +1 -0
- package/dist/{context-BizvUNZv.js → components/motion/multi-select/context.js} +44 -114
- package/dist/components/motion/multi-select/context.js.map +1 -0
- package/dist/components/motion/multi-select/index.d.ts +5 -0
- package/dist/components/motion/multi-select/index.js +6 -0
- package/dist/components/motion/multi-select/list.d.ts +40 -0
- package/dist/components/motion/multi-select/list.d.ts.map +1 -0
- package/dist/components/motion/multi-select/list.js +144 -0
- package/dist/components/motion/multi-select/list.js.map +1 -0
- package/dist/components/motion/multi-select/trigger.d.ts +22 -0
- package/dist/components/motion/multi-select/trigger.d.ts.map +1 -0
- package/dist/components/motion/multi-select/trigger.js +185 -0
- package/dist/components/motion/multi-select/trigger.js.map +1 -0
- package/dist/components/motion/signup-form.js +6 -2
- package/dist/components/motion/signup-form.js.map +1 -1
- package/dist/components/motion/table/index.js.map +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts +117 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1554 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +6 -4
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +10 -7
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +3 -2
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-i18n.d.ts +2 -0
- package/dist/components/reui/data-grid/data-grid-i18n.js +53 -0
- package/dist/components/reui/data-grid/data-grid-i18n.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js +14 -8
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +3 -3
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +6 -4
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +2 -2
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +17 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +146 -50
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +23 -4
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +215 -68
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +276 -6
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +150 -15
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.js.map +1 -1
- package/dist/components/reui/filters/filters.d.ts.map +1 -1
- package/dist/components/reui/filters/filters.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/message-scroller.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/data-grid-i18n-52UUYPbr.d.ts +66 -0
- package/dist/data-grid-i18n-52UUYPbr.d.ts.map +1 -0
- package/dist/use-active-option-CmX6Z-4S.js +86 -0
- package/dist/use-active-option-CmX6Z-4S.js.map +1 -0
- package/package.json +5 -5
- package/dist/context-BizvUNZv.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters-chip.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n ArrowLeftRightIcon,\n ChevronRightIcon,\n CopyIcon,\n CornerDownRightIcon,\n EllipsisVerticalIcon,\n LayersIcon,\n SlidersHorizontalIcon,\n Trash2Icon,\n XIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { ButtonGroup, ButtonGroupText } from \"../../ui/button-group\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterReorderable,\n} from \"./filters-context\";\nimport { FilterMenu, useFilterOptions, useFilterValueResolution } from \"./filters-editors\";\nimport {\n collapseFilterPath,\n FILTER_MENU_CLASS,\n FILTER_MENU_LABEL_CLASS,\n formatFilterPath,\n getFilterField,\n getFilterFieldChain,\n} from \"./filters-lib\";\nimport {\n coerceFilterValue,\n getFilterArity,\n getFilterOperator,\n operatorTakesValue,\n visibleFilterOperators,\n} from \"./filters-operators\";\nimport { findFilterNode, isFilterGroup } from \"./filters-query\";\nimport type {\n FilterEditorProps,\n FilterField,\n FilterGroupNode,\n FilterOperator,\n FilterRule,\n} from \"./filters-types\";\n\n/** Which part of the chip a pointer or key is aimed at. No `field`: the chip's\n * attribute segment is display only, and only the builder re-picks one. */\ntype ChipSegment = \"operator\" | \"value\" | \"menu\";\n\n/** The ref half of `autoFocusProps`: a CALLBACK ref, the one shape an editor\n * can spread onto any element without a cast, and a no-op here. */\nconst noopAutoFocusRef: React.RefCallback<HTMLElement> = () => {};\n\nfunction defaultValueDisplay<V>(\n value: V | undefined,\n operator: FilterOperator | undefined,\n resolveOption: (value: string) => { label: string } | undefined,\n labels: ReturnType<typeof useFilterActions>[\"labels\"],\n // The field's own word for \"no value yet\", which a generic label cannot beat.\n fieldPlaceholder?: string,\n /** Whether the value is PICKED rather than typed: a select's search prompt\n * and \"enter text...\" both give way to `labels.selectPlaceholder`. */\n optionBacked?: boolean,\n): string {\n const emptyLabel = optionBacked\n ? labels.selectPlaceholder\n : (fieldPlaceholder ?? labels.valuePlaceholder);\n if (value === undefined || value === null || value === \"\") {\n return emptyLabel;\n }\n\n if (getFilterArity(operator) === \"range\" && Array.isArray(value)) {\n const [from, to] = value as unknown[];\n return labels.valueRange(String(from ?? \"\"), String(to ?? \"\"));\n }\n\n if (Array.isArray(value)) {\n const values = value as string[];\n if (values.length === 0) return emptyLabel;\n if (values.length === 1) {\n return resolveOption(values[0])?.label ?? String(values[0]);\n }\n return labels.valueCount(values.length);\n }\n\n if (typeof value === \"boolean\") return value ? \"True\" : \"False\";\n\n return resolveOption(String(value))?.label ?? String(value);\n}\n\n/** The same display with the option's own icon in front. A status filter reads\n * as its colour before its word, so dropping the swatch the picker showed\n * makes the chip harder to scan than the list it came from. */\nfunction valueWithIcon<V>(\n value: V | undefined,\n text: string,\n resolveOption: (value: string) => { icon?: React.ReactNode } | undefined,\n): React.ReactNode {\n const single =\n value === undefined || value === null || Array.isArray(value)\n ? Array.isArray(value) && value.length === 1\n ? String(value[0])\n : null\n : String(value);\n const icon = single ? resolveOption(single)?.icon : null;\n if (!icon) return text;\n return (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {text}\n </span>\n );\n}\n\n/** The glyph between two ancestors in a nested attribute path, a chevron\n * because the `pathSeparator` string read as loud as the names it parts.\n * DECORATIVE: `aria-hidden`, and the plain string is still what\n * `formatFilterPath` joins for the chip's accessible name and `title`. */\nfunction FilterPathSeparator() {\n return (\n <ChevronRightIcon\n aria-hidden=\"true\"\n data-slot=\"filter-path-separator\"\n className=\"mx-[3px] inline-block size-3 shrink-0 self-center align-[calc(0.3635em-0.375rem)] text-muted-foreground\"\n />\n );\n}\n\n/** The elided run of a collapsed path, with the FULL path behind it. THE\n * TOOLTIP IS NOT THE ACCESSIBLE ROUTE: it is hover and focus, so the segment\n * is `aria-hidden` and the whole path stays in the control's NAME. The host's\n * own `title` is dropped while collapsed (`pathCollapsed`) or both fire. */\nfunction FilterPathEllipsis({ full }: { full: string }) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n aria-hidden=\"true\"\n data-slot=\"filter-path-ellipsis\"\n /* A path SEGMENT with no air of its own: the chevron's margin\n is all that parts a name from the next, and this used to STACK\n an `mx` on it. Plain inline, no `vertical-align`: `middle` sat\n the dots 1.7px low and inline-block grew the run to 21.17px. */\n className=\"shrink-0 self-center text-muted-foreground\"\n >\n ...\n </span>\n }\n />\n <TooltipContent>{full}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** Everything a rule needs in order to be READ, in either chrome. */\nexport interface FilterRuleDisplay {\n pathText: string;\n pathLabel: React.ReactNode;\n /** Whether `pathLabel` shows fewer names than the path has, so the cell's\n * own `title` can step aside for the ellipsis segment's tooltip. */\n pathCollapsed: boolean;\n operatorLabel: string;\n valueLabel: React.ReactNode;\n /** The same value as PLAIN TEXT, for an accessible name. Never scraped from\n * the `renderValue` node: whatever text survives inside avatars and a count\n * badge announces \"plus one\" for two people. Kept separate from\n * `valueLabel`, not derived from it: a React node has no honest text to\n * read back. A field whose values do not stringify supplies `valueText`\n * itself, or the built-in fallback says \"[object Object]\" to exactly the\n * audience the visible display is hiding it from. */\n valueText: string;\n /** The same value with any collapsed COUNT spelled out. \"3 selected\" cannot\n * be recovered from, which is fine while the editor opens and not once\n * locked, so the control carries this as `title` and, locked, as its name. */\n valueFullText: string;\n valueEmpty: boolean;\n}\n\n/** How one rule reads, resolved once and shared by both chromes, so a consumer\n * `renderValue`, the field's own and the built-in cannot disagree. */\nexport function useFilterRuleDisplay<V, O>(\n rule: FilterRule<V>,\n field: FilterField<V, O> | undefined,\n operator: FilterOperator | undefined,\n): FilterRuleDisplay {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n // Lazily: a label needs no options until an editor actually opens.\n const optionsState = useFilterOptions<V, O>(field, false);\n\n const values =\n rule.value === undefined || rule.value === null\n ? []\n : Array.isArray(rule.value)\n ? (rule.value as unknown[])\n : [rule.value];\n\n // Saved views: values the loader has never returned are resolved through the\n // field's own `resolveValues`, so a restored chip reads \"John Doe\", not an id.\n useFilterValueResolution(field, values);\n\n const pathText = formatFilterPath(actions.index, rule.path, actions.labels.pathSeparator);\n\n const chain = getFilterFieldChain(actions.index, rule.path);\n // The CASCADER's collapser, from the actions context rather than per host, so\n // a deep path reads the same on a chip and in a builder row.\n const segments = collapseFilterPath(chain, {\n maxSegments: actions.maxPathSegments,\n collapse: actions.pathCollapse,\n });\n const pathCollapsed = segments.some((segment) => segment.type === \"ellipsis\");\n const pathLabel = chain.length\n ? segments.map((segment, index) => (\n <React.Fragment\n /* Positional, because a field id is unique among its SIBLINGS only:\n \"Company > Team > Company\" is a legal path and its two ids collide. */\n key={segment.type === \"field\" ? `${index}:${segment.field.id}` : `${index}:ellipsis`}\n >\n {index > 0 ? <FilterPathSeparator /> : null}\n {segment.type === \"field\" ? (\n <span>{segment.field.label}</span>\n ) : (\n <FilterPathEllipsis full={pathText} />\n )}\n </React.Fragment>\n ))\n : pathText;\n\n const operatorLabel = operator\n ? rule.negated\n ? actions.labels.negated(operator.label)\n : operator.label\n : rule.operator || actions.labels.selectCondition;\n\n const valueEmpty =\n rule.value === undefined ||\n rule.value === null ||\n rule.value === (\"\" as unknown as V) ||\n values.length === 0;\n\n if (!field) {\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel: \"\",\n valueText: \"\",\n valueFullText: \"\",\n valueEmpty,\n };\n }\n\n const valueContext = {\n value: rule.value,\n values,\n field,\n operator: operator ?? { value: rule.operator, label: rule.operator },\n // Resolved, not empty: a custom display needs the option behind each value.\n options: values\n .map((entry) => optionsState.resolve(String(entry)))\n .filter(Boolean) as NonNullable<ReturnType<typeof optionsState.resolve>>[],\n labels: actions.labels,\n };\n\n // Computed even when a custom display replaces it: this is the string the\n // accessible name is built from. `field.valueText` overrides it.\n const valueText = field.valueText\n ? field.valueText(valueContext)\n : defaultValueDisplay(\n rule.value,\n operator,\n optionsState.resolve,\n actions.labels,\n field.placeholder,\n // Option-backed by the FIELD, not the operator: `is any of` is\n // multi-value on a plain text field too, and that one is typed into.\n field.type === \"select\" ||\n field.type === \"multiselect\" ||\n Boolean(field.options?.length) ||\n Boolean(field.loadOptions),\n );\n\n const valueLabel = render.renderValue\n ? render.renderValue(valueContext)\n : field.renderValue\n ? field.renderValue(valueContext)\n : valueWithIcon(rule.value, valueText, optionsState.resolve);\n\n // The list behind the count, or the same text again. Multi-value only: a\n // RANGE also stores an array but already spells both ends out (\"10 to 99\").\n const valueFullText =\n field.valueText ||\n !Array.isArray(rule.value) ||\n getFilterArity(operator) === \"range\" ||\n values.length < 2\n ? valueText\n : actions.labels.valueDetail(\n valueText,\n values.map((entry) => optionsState.resolve(String(entry))?.label ?? String(entry)),\n );\n\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n };\n}\n\ninterface FilterValueEditorProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator;\n /** Whether the surface holding it is showing. Gates the option service. */\n open: boolean;\n onClose: () => void;\n}\n\n/** The value editor - draft, option service, commit - with NO surface of its\n * own, so surface and wiring can be replaced independently. The draft lives\n * here, so a text filter dispatches once on commit, not once per keystroke. */\nfunction FilterValueEditor<V, O>({\n rule,\n field,\n operator,\n open,\n onClose,\n}: FilterValueEditorProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const [draft, setDraft] = React.useState<V | undefined>(rule.value);\n\n React.useEffect(() => {\n if (open) setDraft(rule.value);\n }, [open, rule.value]);\n\n const options = useFilterOptions<V, O>(field, open);\n // A LOOKUP, not a definition: every result is a module-level built-in or the\n // consumer's own component, so the editor is never remounted mid-edit.\n const editor = React.useMemo(\n () => actions.resolveEditor(field, operator),\n [actions, field, operator],\n );\n\n if (!editor) return null;\n\n const editorProps: FilterEditorProps<V, O> = {\n field,\n operator,\n value: draft,\n onValueChange: (next) => setDraft(next as V),\n host: \"amend\",\n autoFocusProps: {\n ref: noopAutoFocusRef,\n autoFocus: true,\n },\n commit: (next, commitOptions) => {\n actions.updateRule(rule.id, {\n value: (next === undefined ? draft : next) as V,\n });\n // A multi-select commits per toggle and asks to stay put; others dismiss.\n if (commitOptions?.close === false) return;\n onClose();\n },\n cancel: onClose,\n // The same as cancel, honestly: `back` means something only to a `create`\n // host.\n back: onClose,\n options,\n labels: actions.labels,\n };\n\n // `createElement` rather than JSX: the component comes out of a lookup, so\n // `<Editor />` trips `react-hooks/static-components`. The fragment keeps the\n // props object, which carries a ref, from looking like a ref read in render.\n return <>{React.createElement(editor, editorProps)}</>;\n}\n\n/** One step of the flow, released when the panel that owes it has LEFT THE\n * DOM: both popovers keep portal content mounted through the exit transition,\n * so this unmount IS that moment and nothing is timed. `onRelease` is used AS\n * the cleanup, so an unmemoized callback fires its step early. */\nfunction FilterStepHandoff({ onRelease }: { onRelease: () => void }) {\n React.useEffect(() => onRelease, [onRelease]);\n return null;\n}\n\n/** The value host: the editor in a popover anchored to the value segment, and\n * BOTH routes end here. The operator popover used to draw the editor itself,\n * so a handed-off panel sat a segment's width left of a second press. */\nexport interface FilterValuePopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator | undefined;\n /** The element that opens it, WITH its own children: a chip segment must be\n * a direct child of its `ButtonGroup` for the pill to fuse. */\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterValuePopover<V, O>({\n rule,\n field,\n operator,\n trigger,\n className,\n}: FilterValuePopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"value\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n\n // The last step of the flow as well as the amend route; by now the condition\n // menu has UNMOUNTED (see `FilterStepHandoff`). CONSUMED as it is honoured,\n // or Escape closes the editor and this effect reopens it in the same frame.\n // The `set` stays OUTSIDE the `locked` guard on purpose: a handoff nobody\n // spends sits armed until some later chip spends it, and a chip that opened\n // because a DIFFERENT chip was arrowed onto is worse than one that opened\n // nothing.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n // Nothing to open, but the trigger still renders so the value keeps its\n // place, and it wears the bar's state: that hangs on the TRIGGER below,\n // which this path never reaches, so the segment used to look live.\n if (!operator || !actions.resolveEditor(field, operator)) {\n return React.cloneElement(trigger as React.ReactElement<Record<string, unknown>>, {\n disabled: actions.disabled,\n ...filterReadOnlyProps(actions),\n });\n }\n\n return (\n // REFUSES to open while locked rather than leaving it to the trigger: an\n // `aria-disabled` control that still opens an editor is one that lied.\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n setOpen(next);\n }}\n >\n {/* The trigger IS the segment, never a wrapper. `ButtonGroup` fuses\n DIRECT children only (`*:data-slot:rounded-r-none`,\n `[&>[data-slot]~[data-slot]]:border-l-0`), so a nested one keeps its\n own border and the chip reads as separate badges. */}\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent align=\"start\" className={cn(\"w-auto p-0\", className)}>\n <FilterValueEditor<V, O>\n rule={rule}\n field={field}\n operator={operator}\n open={open}\n onClose={() => {\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/* A chip's ATTRIBUTE is fixed once the chip exists: no field popover here. A\n new field invalidates the operator and the value, so \"amending\" threw both\n away. The builder keeps its picker, where a row reads as a form. */\n\n/** The condition menu, and the step after it. The list is the cascader run\n * flat: the old hand-rolled one marked the keyboard HIGHLIGHT with\n * `aria-selected` and had no Home, End or typeahead. It HANDS OFF to the\n * value popover once its own panel has left the DOM; advancing in place\n * anchored the editor to the CONDITION segment and doubled up in the row. */\nexport interface FilterOperatorPopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterOperatorPopover<V, O>({\n rule,\n field,\n trigger,\n className,\n}: FilterOperatorPopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"operator\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n /** Whether the close this panel is going through IS the step being handed\n * on. A ref, so it survives the render that closes the popover. Every OPEN\n * clears it, so an Escape or an outside press finds it already lowered and\n * spends nothing; `release` leaves it standing because one twin asks again\n * later: Radix reads it from `onCloseAutoFocus`, a macrotask after the\n * unmount. Clearing it in `release` would break that twin only. */\n const handoff = React.useRef(false);\n const operators = actions.resolveOperators(field);\n\n // Memoized because the array IS the menu's identity: the cascader rebuilds\n // its index per `items` identity, so a fresh array rebuilds it per keystroke.\n const items = React.useMemo(\n () =>\n visibleFilterOperators(operators).map((entry) => ({\n value: entry.value,\n label: entry.label,\n })),\n [operators],\n );\n\n // Opened by the root the moment the chip is created. CONSUMED here, or the\n // handoff re-opens the menu on the frame Escape closes it. Consumed even\n // while locked, for the reason on the value popover's copy.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n handoff.current = false;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n const close = () => {\n handoff.current = false;\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n };\n\n /** The parked step, spent on the frame this panel stops existing. Memoized\n * on nothing that changes, and load bearing: `FilterStepHandoff` uses this\n * AS its cleanup, so a new identity mid-flow fires the step too early. */\n const release = React.useCallback(() => {\n if (!handoff.current) return;\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: true });\n }, [focusStore, rule.id]);\n\n // The chip going away takes its step with it: React destroys a deleted\n // subtree top down, so this runs before the panel's own cleanup.\n React.useEffect(\n () => () => {\n handoff.current = false;\n },\n [],\n );\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n /* Escape, an outside press, a second press: none is the step being\n taken, so none may spend it. RETIRED ON OPEN, not on close, and that\n is a twin difference: in Radix an item choice dismisses through here\n too, so retiring on close wiped the request before the unmount. */\n if (next) handoff.current = false;\n setOpen(next);\n }}\n >\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent\n align=\"start\"\n /* Base UI restores focus to the trigger as this panel closes, which\n lands on the condition segment AFTER the value editor has opened and\n focused its input, so a keyboard user is dropped back a step and\n cannot reach the value at all. Suppressed only while the handoff is\n up; a function because Base UI resolves it at close time, which is\n when the ref is accurate. Radix runs the same guard through\n `onCloseAutoFocus`. */\n finalFocus={() => !handoff.current}\n /* `w-auto` with a FLOOR: a catalog sizes to its longest label, and a\n boolean field's \"is\" and \"is not\" would read as a scrap of paper. */\n className={cn(\"w-auto min-w-40 p-0\", className)}\n >\n {/* INSIDE the panel deliberately: only a child of the content is\n unmounted by the exit transition rather than by the close. */}\n <FilterStepHandoff onRelease={release} />\n <FilterMenu\n items={items}\n selected={rule.operator ? [rule.operator] : []}\n onSelectionChange={(values) => {\n const value = values[0];\n /* Deselecting the committed operator is a step back rather than a\n choice, so pressing the current row simply closes. */\n if (value === undefined) {\n close();\n return;\n }\n const chosen = getFilterOperator(operators, value);\n /* BUILDING versus AMENDING, the same fork the advanced row draws\n at its field step. A rule reaches this menu with no operator\n exactly once, while it is being added, and only then is the\n value the step after this one. Re-picking the condition on a\n rule that already has one is an edit of that one cell: it\n commits and closes, and the user opens the value themselves. */\n const building = !rule.operator;\n actions.updateRule(rule.id, {\n operator: value,\n /* The value moves with the operator: \"is\" to \"is any of\" would\n leave a bare string where every reader expects an array. */\n value: coerceFilterValue(\n rule.value,\n getFilterOperator(operators, rule.operator),\n chosen,\n ) as V,\n });\n if (building && operatorTakesValue(chosen)) {\n /* PARKED, not opened: `release` hands the row to its value\n surface once this panel has unmounted. */\n handoff.current = true;\n setOpen(false);\n return;\n }\n close();\n }}\n labels={actions.labels}\n ariaLabel={field.label}\n searchPlaceholder={actions.labels.searchOperators}\n /* No visible search field: a CLOSED enum of six to ten labels, all\n on screen. Still RENDERED, visually hidden, because it owns focus\n and `aria-activedescendant`: arrows, Home, End and typeahead. */\n searchable={false}\n /* Taller than a value list on purpose: the operator set is CLOSED, so\n all of it fits and the height buys the whole catalog. A value list\n is open ended and would only push its own footer off the screen. */\n maxHeight={320}\n /* Deliberately unpinned: one selected operator in a short list, so\n lifting it would lose the catalog's declared reading order. */\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The keyboard path to a CROSS-GROUP move: Alt+Arrow reorders within the\n * owning group only and Wrap creates a NEW group, so the drag layer's\n * cross-group move had no keyboard parity. Numbered in document order. */\nexport function FilterMoveToMenuItems({ nodeId }: { nodeId: string }) {\n const actions = useFilterActions();\n // A menu ITEM takes the native word: both twins already make `disabled`\n // roving-focusable and `aria-disabled`.\n const reorderable = useFilterReorderable();\n const locked = isFilterLocked(actions);\n // Read at render time: the menu's content mounts when the menu opens, so\n // this is the tree the user is looking at.\n const query = actions.getQuery();\n const found = findFilterNode(query, nodeId);\n if (!found?.parent) return null;\n\n const destinations: { id: string; label: string; size: number }[] = [];\n if (found.parent.id !== query.id) {\n destinations.push({\n id: query.id,\n label: actions.labels.moveToTopLevel,\n size: query.rules.length,\n });\n }\n\n let position = 0;\n // `inside` suppresses the PUSH and not the walk, so the numbering stays\n // document order rather than renumbering every group after this one. Counted\n // before the exclusions for the same reason: the current parent is not\n // offered but still holds its number, so the numbering is stable whichever\n // row's menu is open.\n const visit = (group: FilterGroupNode<unknown>, inside: boolean) => {\n for (const child of group.rules) {\n if (!isFilterGroup(child)) continue;\n position += 1;\n // Itself and everything under it: `moveFilterNodeTo` already refuses that\n // move - it would detach the subtree and leave a cycle - so offering it\n // would be a menu row that quietly does nothing.\n const within = inside || child.id === nodeId;\n if (!within && child.id !== found.parent!.id) {\n destinations.push({\n id: child.id,\n label: actions.labels.moveToGroup(position),\n size: child.rules.length,\n });\n }\n visit(child, within);\n }\n };\n visit(query, false);\n\n if (destinations.length === 0) return null;\n\n // The THIRD route into a move, gated on the same switch as the grip and\n // Alt+Arrow: ungated, a builder that draws no handle still reordered here.\n if (!reorderable) return null;\n\n return (\n <>\n {destinations.map((destination) => (\n <DropdownMenuItem\n key={destination.id}\n disabled={locked}\n onClick={() => actions.moveNodeTo(nodeId, destination.id, destination.size)}\n >\n {/* A bend into the destination: movement, not duplication or nesting. */}\n <CornerDownRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{destination.label}</span>\n </DropdownMenuItem>\n ))}\n </>\n );\n}\n\n/** The per-rule actions, without the trigger: the chip's kebab and a builder\n * row's kebab act on the same rule. `allowGrouping` is the CHROME's answer;\n * \"Convert to advanced filter\" is the CONSUMER's, and hides itself there. */\nexport function FilterRuleMenuItems({\n ruleId,\n /** Offer \"Wrap in condition group\". Off for the chip row, which cannot draw\n * a group; on in the builder, the only way to nest without dragging. */\n allowGrouping = false,\n}: {\n ruleId: string;\n allowGrouping?: boolean;\n}) {\n const actions = useFilterActions();\n // Gated here as well as at the trigger, because this is EXPORTED: a consumer\n // composing their own menu gets rows that say they are unavailable.\n const locked = isFilterLocked(actions);\n return (\n /* Every row leads with an icon. `IconPlaceholder` because the source ships\n under five icon sets; no size class, because each style already sizes an\n unsized svg in a menu row; `aria-hidden`, the label IS the name. */\n <>\n <DropdownMenuItem disabled={locked} onClick={() => actions.duplicateNode(ruleId)}>\n <CopyIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.duplicate}</span>\n </DropdownMenuItem>\n <DropdownMenuItem disabled={locked} onClick={() => actions.negateRule(ruleId)}>\n {/* Two arrows swapping: negation flips to the declared inverse. */}\n <ArrowLeftRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.negate}</span>\n </DropdownMenuItem>\n {allowGrouping ? (\n <DropdownMenuItem disabled={locked} onClick={() => actions.wrapNodeInGroup(ruleId)}>\n {/* Layers: braces read as grouping in only three of the five sets. */}\n <LayersIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.wrapInGroup}</span>\n </DropdownMenuItem>\n ) : null}\n {allowGrouping ? <FilterMoveToMenuItems nodeId={ruleId} /> : null}\n {/* OPTIONAL, and gated on both halves of \"would this do anything\": the\n handler is the consumer's opt-in, and an already-advanced bar has\n nothing to convert. NOT gated on `locked`: it changes no query, is\n handed no mutator, and the shipped kebab will not open while locked. */}\n {actions.convertToAdvanced && actions.variant !== \"advanced\" ? (\n <DropdownMenuItem onClick={() => actions.convertToAdvanced?.()}>\n {/* Sliders: the one \"advanced settings\" glyph in all five sets. */}\n <SlidersHorizontalIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.convertToAdvanced}</span>\n </DropdownMenuItem>\n ) : null}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={locked}\n onClick={() => actions.removeNode(ruleId)}\n >\n {/* No colour: the destructive variant already paints the row's svgs. */}\n <Trash2Icon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.remove}</span>\n </DropdownMenuItem>\n </>\n );\n}\n\nexport interface FilterChipProps<V = unknown> {\n rule: FilterRule<V>;\n index: number;\n}\n\n/** One filter, as a chip. Memoization means something here: the actions\n * context is stable, the focus store is subscribed to a boolean and the query\n * shares structure, so editing one filter of forty re-renders one chip. */\nfunction FilterChipImpl<V, O>({ rule, index }: FilterChipProps<V>) {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n const focusStore = useFilterFocusStore();\n const focused = useFilterChipFocused(rule.id);\n const noFocus = useFilterFocusEmpty();\n const locked = isFilterLocked(actions);\n // THE CHIP'S HEIGHT, by way of the one button in it that has one:\n // `ButtonGroup` is `items-stretch` and no style gives a text segment a\n // height, so the kebab's rung is the pill's. The RADIUS survives because\n // every style whose `icon-sm` rounds differently re-pins it in a group.\n const sizes = filterControlSizes(actions);\n // The kebab is CONTROLLED so it can refuse to open: every mutating row\n // behind it is gated. That puts \"Convert to advanced filter\" out of reach\n // while locked; a consumer-composed menu still draws it.\n const [menuOpen, setMenuOpen] = React.useState(false);\n // Exactly one chip is in the tab order at a time. Before anything has been\n // focused that is the first chip, so Tab reaches the row in one press.\n const isTabStop = focused || (noFocus && index === 0);\n\n const field = getFilterField(actions.index, rule.path);\n const operators = field ? actions.resolveOperators(field) : [];\n const operator = getFilterOperator(operators, rule.operator);\n\n const {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n } = useFilterRuleDisplay<V, O>(rule, field, operator);\n\n if (!field) {\n // A rule pointing at a field the schema no longer has. Dropping it loses a\n // saved view's data; rendering nothing leaves an invisible condition still\n // filtering. It carries the SAME roving wiring as a real chip: `data-slot`\n // alone joined the arrow-key query with no `tabIndex` to land on.\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n data-unknown=\"\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(rule.path.join(actions.labels.pathSeparator))}\n data-focused={focused || undefined}\n data-rule-id={rule.id}\n data-index={index}\n tabIndex={isTabStop ? 0 : -1}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n >\n <ButtonGroupText className=\"bg-background text-muted-foreground dark:bg-input/30\">\n {rule.path.join(actions.labels.pathSeparator)}\n </ButtonGroupText>\n <Button\n variant=\"outline\"\n size={sizes.icon}\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.remove}\n /* It had no gate at all, so the one chip whose whole purpose is to be\n removed could be removed from a bar that refuses every other edit. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.removeNode(rule.id)}\n >\n <XIcon />\n </Button>\n </ButtonGroup>\n );\n }\n\n if (render.renderChip) return <>{render.renderChip(rule)}</>;\n\n const focusSegment = (segment: ChipSegment) =>\n focusStore.set({ id: rule.id, segment, autoOpen: false });\n\n // A rule with no condition yet, KEPT rather than removed (see\n // `isFilterRuleComplete`), so it has to read as unfinished. Through WORDS:\n // the dashed outline it replaces degraded to an underline under sera.\n const incomplete = !rule.operator;\n\n // The same test the value segment renders under, so the name matches the\n // chip: `valueText` alone appended a placeholder to valueless conditions.\n const hasValue = Boolean(rule.operator) && operatorTakesValue(operator);\n\n // The value's spoken form in the chip's NAME: a name is not a prompt, so\n // \"Description contains enter text...\" becomes \"no value\".\n const valueName = valueEmpty && !field.valueText ? actions.labels.noValue : valueText;\n\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(\n `${pathText} ${operatorLabel}${hasValue ? ` ${valueName}` : \"\"}`.trim() +\n (incomplete ? `, ${actions.labels.incomplete}` : \"\"),\n )}\n data-focused={focused || undefined}\n data-incomplete={incomplete || undefined}\n data-rule-id={rule.id}\n tabIndex={isTabStop ? 0 : -1}\n className={cn(\n /* Sera is an underline style, so the boxed segments are normalised to\n its bottom-border-only look or the chip reads as a mix of both. */\n \"\",\n )}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n data-index={index}\n >\n {/* DISPLAY ONLY: a div, not a button, not a tab stop, no popover. The\n attribute is fixed for the life of the chip. */}\n <ButtonGroupText\n /* Dropped while the path is collapsed: the ellipsis inside carries the\n same sentence as a tooltip, and the two would stack. */\n title={pathCollapsed ? undefined : pathText}\n className=\"cursor-default gap-1.5 bg-background dark:bg-input/30\"\n >\n {field.icon}\n {/* Zero gap INSIDE the path, so the separator's own margin is the only\n air around a chevron; `gap-1.5` used to stack 6px a side on it. */}\n <span className=\"flex items-center\">{pathLabel}</span>\n </ButtonGroupText>\n\n <FilterOperatorPopover\n rule={rule}\n field={field}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n /* The operator is connective tissue between the field and the\n value, so it reads quieter than either - unless it is still\n the prompt \"Select condition\", the one thing to act on. */\n incomplete ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"operator\")}\n >\n {operatorLabel}\n </ButtonGroupText>\n }\n />\n\n {/* No condition, no value: `getFilterArity(undefined)` defaults to \"one\",\n so testing the operator alone renders a stray value segment. */}\n {hasValue ? (\n <FilterValuePopover\n rule={rule}\n field={field}\n operator={operator}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n /* Named explicitly rather than by its contents: avatars or a\n \"+2\" badge, and \"plus two\" says nothing about two people. It\n grows to the whole list when the editor cannot be opened,\n since locked it must carry what a press no longer reveals. */\n aria-label={locked ? valueFullText : valueText}\n /* The pointer's route to the same thing, and only when there is\n more to say than the segment already says. */\n title={valueFullText === valueText ? undefined : valueFullText}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n valueEmpty && \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"value\")}\n >\n {valueLabel}\n </ButtonGroupText>\n }\n />\n ) : null}\n\n <DropdownMenu\n open={menuOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setMenuOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"outline\"\n size={sizes.icon}\n /* The same surface the three text segments force. Styles whose\n outline button is transparent in dark (sera, luma, rhea) left\n the kebab as a notch in an otherwise filled pill. */\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.chipMenu(field.label)}\n onPointerDown={() => focusSegment(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n {/* The SAME sizing the builder's menus use, from one constant: a menu\n that cuts \"Convert to group\" in one chrome is one defect twice. */}\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n <FilterRuleMenuItems ruleId={rule.id} />\n </DropdownMenuContent>\n </DropdownMenu>\n </ButtonGroup>\n );\n}\n\nexport const FilterChip = React.memo(FilterChipImpl) as typeof FilterChipImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,MAAM,yBAAyD,CAAC;AAEhE,SAAS,oBACP,OACA,UACA,eACA,QAEA,kBAGA,cACQ;CACR,MAAM,aAAa,eACf,OAAO,oBACN,oBAAoB,OAAO;CAChC,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IACrD,OAAO;CAGT,IAAI,eAAe,QAAQ,MAAM,WAAW,MAAM,QAAQ,KAAK,GAAG;EAChE,MAAM,CAAC,MAAM,MAAM;EACnB,OAAO,OAAO,WAAW,OAAO,QAAQ,EAAE,GAAG,OAAO,MAAM,EAAE,CAAC;CAC/D;CAEA,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,SAAS;EACf,IAAI,OAAO,WAAW,GAAG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AAQ,QAAQ;KACpB,YAAY,IAAI;IAClB;IALF,UAAA,CAOE,oBAAC,qBAAD;KACE,UAAU,QAAQ;KAClB,GAAI,oBAAoB,OAAO;KAC/B,QACE,oBAAC,QAAD;MACE,SAAQ;MACR,MAAM,MAAM;MAIZ,WAAU;MACV,cAAY,QAAQ,OAAO,SAAS,MAAM,KAAK;MAC/C,qBAAqB,aAAa,MAAM;KACzC,CAAA;KAGH,UAAA,oBAAC,sBAAD,CAAuB,CAAA;IACJ,CAAA,GAGrB,oBAAC,qBAAD;KAAqB,OAAM;KAAM,WAAW,GAAG,mBAAmB,QAAQ,aAAa;KACrF,UAAA,oBAAC,qBAAD,EAAqB,QAAQ,KAAK,GAAK,CAAA;IACpB,CAAA,CACT;;EACH;;AAEjB;AAEA,MAAa,aAAaA,QAAM,KAAK,cAAc"}
|
|
1
|
+
{"version":3,"file":"filters-chip.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n ArrowLeftRightIcon,\n ChevronRightIcon,\n CopyIcon,\n CornerDownRightIcon,\n EllipsisVerticalIcon,\n LayersIcon,\n SlidersHorizontalIcon,\n Trash2Icon,\n XIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { ButtonGroup, ButtonGroupText } from \"../../ui/button-group\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterReorderable,\n} from \"./filters-context\";\nimport { FilterMenu, useFilterOptions, useFilterValueResolution } from \"./filters-editors\";\nimport {\n collapseFilterPath,\n FILTER_MENU_CLASS,\n FILTER_MENU_LABEL_CLASS,\n formatFilterPath,\n getFilterField,\n getFilterFieldChain,\n} from \"./filters-lib\";\nimport {\n coerceFilterValue,\n getFilterArity,\n getFilterOperator,\n operatorTakesValue,\n visibleFilterOperators,\n} from \"./filters-operators\";\nimport { findFilterNode, isFilterGroup } from \"./filters-query\";\nimport type {\n FilterEditorProps,\n FilterField,\n FilterGroupNode,\n FilterOperator,\n FilterRule,\n} from \"./filters-types\";\n\n/** Which part of the chip a pointer or key is aimed at. No `field`: the chip's\n * attribute segment is display only, and only the builder re-picks one. */\ntype ChipSegment = \"operator\" | \"value\" | \"menu\";\n\n/** The ref half of `autoFocusProps`: a CALLBACK ref, the one shape an editor\n * can spread onto any element without a cast, and a no-op here. */\nconst noopAutoFocusRef: React.RefCallback<HTMLElement> = () => {};\n\nfunction defaultValueDisplay<V>(\n value: V | undefined,\n operator: FilterOperator | undefined,\n resolveOption: (value: string) => { label: string } | undefined,\n labels: ReturnType<typeof useFilterActions>[\"labels\"],\n // The field's own word for \"no value yet\", which a generic label cannot beat.\n fieldPlaceholder?: string,\n /** Whether the value is PICKED rather than typed: a select's search prompt\n * and \"enter text...\" both give way to `labels.selectPlaceholder`. */\n optionBacked?: boolean,\n): string {\n const emptyLabel = optionBacked\n ? labels.selectPlaceholder\n : (fieldPlaceholder ?? labels.valuePlaceholder);\n if (value === undefined || value === null || value === \"\") {\n return emptyLabel;\n }\n\n if (getFilterArity(operator) === \"range\" && Array.isArray(value)) {\n const [from, to] = value as unknown[];\n return labels.valueRange(String(from ?? \"\"), String(to ?? \"\"));\n }\n\n if (Array.isArray(value)) {\n const values = value as string[];\n if (values.length === 0) return emptyLabel;\n if (values.length === 1) {\n return resolveOption(values[0])?.label ?? String(values[0]);\n }\n return labels.valueCount(values.length);\n }\n\n if (typeof value === \"boolean\") return value ? \"True\" : \"False\";\n\n return resolveOption(String(value))?.label ?? String(value);\n}\n\n/** The same display with the option's own icon in front. A status filter reads\n * as its colour before its word, so dropping the swatch the picker showed\n * makes the chip harder to scan than the list it came from. */\nfunction valueWithIcon<V>(\n value: V | undefined,\n text: string,\n resolveOption: (value: string) => { icon?: React.ReactNode } | undefined,\n): React.ReactNode {\n const single =\n value === undefined || value === null || Array.isArray(value)\n ? Array.isArray(value) && value.length === 1\n ? String(value[0])\n : null\n : String(value);\n const icon = single ? resolveOption(single)?.icon : null;\n if (!icon) return text;\n return (\n <span className=\"flex items-center gap-1.5\">\n {icon}\n {text}\n </span>\n );\n}\n\n/** The glyph between two ancestors in a nested attribute path, a chevron\n * because the `pathSeparator` string read as loud as the names it parts.\n * DECORATIVE: `aria-hidden`, and the plain string is still what\n * `formatFilterPath` joins for the chip's accessible name and `title`. */\nfunction FilterPathSeparator() {\n return (\n <ChevronRightIcon\n aria-hidden=\"true\"\n data-slot=\"filter-path-separator\"\n className=\"mx-[3px] inline-block size-3 shrink-0 self-center align-[calc(0.3635em-0.375rem)] text-muted-foreground\"\n />\n );\n}\n\n/** The elided run of a collapsed path, with the FULL path behind it. THE\n * TOOLTIP IS NOT THE ACCESSIBLE ROUTE: it is hover and focus, so the segment\n * is `aria-hidden` and the whole path stays in the control's NAME. The host's\n * own `title` is dropped while collapsed (`pathCollapsed`) or both fire. */\nfunction FilterPathEllipsis({ full }: { full: string }) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n aria-hidden=\"true\"\n data-slot=\"filter-path-ellipsis\"\n /* A path SEGMENT with no air of its own: the chevron's margin\n is all that parts a name from the next, and this used to STACK\n an `mx` on it. Plain inline, no `vertical-align`: `middle` sat\n the dots 1.7px low and inline-block grew the run to 21.17px. */\n className=\"shrink-0 self-center text-muted-foreground\"\n >\n ...\n </span>\n }\n />\n <TooltipContent>{full}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** Everything a rule needs in order to be READ, in either chrome. */\nexport interface FilterRuleDisplay {\n pathText: string;\n pathLabel: React.ReactNode;\n /** Whether `pathLabel` shows fewer names than the path has, so the cell's\n * own `title` can step aside for the ellipsis segment's tooltip. */\n pathCollapsed: boolean;\n operatorLabel: string;\n valueLabel: React.ReactNode;\n /** The same value as PLAIN TEXT, for an accessible name. Never scraped from\n * the `renderValue` node: whatever text survives inside avatars and a count\n * badge announces \"plus one\" for two people. Kept separate from\n * `valueLabel`, not derived from it: a React node has no honest text to\n * read back. A field whose values do not stringify supplies `valueText`\n * itself, or the built-in fallback says \"[object Object]\" to exactly the\n * audience the visible display is hiding it from. */\n valueText: string;\n /** The same value with any collapsed COUNT spelled out. \"3 selected\" cannot\n * be recovered from, which is fine while the editor opens and not once\n * locked, so the control carries this as `title` and, locked, as its name. */\n valueFullText: string;\n valueEmpty: boolean;\n}\n\n/** How one rule reads, resolved once and shared by both chromes, so a consumer\n * `renderValue`, the field's own and the built-in cannot disagree. */\nexport function useFilterRuleDisplay<V, O>(\n rule: FilterRule<V>,\n field: FilterField<V, O> | undefined,\n operator: FilterOperator | undefined,\n): FilterRuleDisplay {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n // Lazily: a label needs no options until an editor actually opens.\n const optionsState = useFilterOptions<V, O>(field, false);\n\n const values =\n rule.value === undefined || rule.value === null\n ? []\n : Array.isArray(rule.value)\n ? (rule.value as unknown[])\n : [rule.value];\n\n // Saved views: values the loader has never returned are resolved through the\n // field's own `resolveValues`, so a restored chip reads \"John Doe\", not an id.\n useFilterValueResolution(field, values);\n\n const pathText = formatFilterPath(actions.index, rule.path, actions.labels.pathSeparator);\n\n const chain = getFilterFieldChain(actions.index, rule.path);\n // The CASCADER's collapser, from the actions context rather than per host, so\n // a deep path reads the same on a chip and in a builder row.\n const segments = collapseFilterPath(chain, {\n maxSegments: actions.maxPathSegments,\n collapse: actions.pathCollapse,\n });\n const pathCollapsed = segments.some((segment) => segment.type === \"ellipsis\");\n const pathLabel = chain.length\n ? segments.map((segment, index) => (\n <React.Fragment\n /* Positional, because a field id is unique among its SIBLINGS only:\n\"Company > Team > Company\" is a legal path and its two ids collide. */\n key={segment.type === \"field\" ? `${index}:${segment.field.id}` : `${index}:ellipsis`}\n >\n {index > 0 ? <FilterPathSeparator /> : null}\n {segment.type === \"field\" ? (\n <span>{segment.field.label}</span>\n ) : (\n <FilterPathEllipsis full={pathText} />\n )}\n </React.Fragment>\n ))\n : pathText;\n\n const operatorLabel = operator\n ? rule.negated\n ? actions.labels.negated(operator.label)\n : operator.label\n : rule.operator || actions.labels.selectCondition;\n\n const valueEmpty =\n rule.value === undefined ||\n rule.value === null ||\n rule.value === (\"\" as unknown as V) ||\n values.length === 0;\n\n if (!field) {\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel: \"\",\n valueText: \"\",\n valueFullText: \"\",\n valueEmpty,\n };\n }\n\n const valueContext = {\n value: rule.value,\n values,\n field,\n operator: operator ?? { value: rule.operator, label: rule.operator },\n // Resolved, not empty: a custom display needs the option behind each value.\n options: values\n .map((entry) => optionsState.resolve(String(entry)))\n .filter(Boolean) as NonNullable<ReturnType<typeof optionsState.resolve>>[],\n labels: actions.labels,\n };\n\n // Computed even when a custom display replaces it: this is the string the\n // accessible name is built from. `field.valueText` overrides it.\n const valueText = field.valueText\n ? field.valueText(valueContext)\n : defaultValueDisplay(\n rule.value,\n operator,\n optionsState.resolve,\n actions.labels,\n field.placeholder,\n // Option-backed by the FIELD, not the operator: `is any of` is\n // multi-value on a plain text field too, and that one is typed into.\n field.type === \"select\" ||\n field.type === \"multiselect\" ||\n Boolean(field.options?.length) ||\n Boolean(field.loadOptions),\n );\n\n const valueLabel = render.renderValue\n ? render.renderValue(valueContext)\n : field.renderValue\n ? field.renderValue(valueContext)\n : valueWithIcon(rule.value, valueText, optionsState.resolve);\n\n // The list behind the count, or the same text again. Multi-value only: a\n // RANGE also stores an array but already spells both ends out (\"10 to 99\").\n const valueFullText =\n field.valueText ||\n !Array.isArray(rule.value) ||\n getFilterArity(operator) === \"range\" ||\n values.length < 2\n ? valueText\n : actions.labels.valueDetail(\n valueText,\n values.map((entry) => optionsState.resolve(String(entry))?.label ?? String(entry)),\n );\n\n return {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n };\n}\n\ninterface FilterValueEditorProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator;\n /** Whether the surface holding it is showing. Gates the option service. */\n open: boolean;\n onClose: () => void;\n}\n\n/** The value editor - draft, option service, commit - with NO surface of its\n * own, so surface and wiring can be replaced independently. The draft lives\n * here, so a text filter dispatches once on commit, not once per keystroke. */\nfunction FilterValueEditor<V, O>({\n rule,\n field,\n operator,\n open,\n onClose,\n}: FilterValueEditorProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const [draft, setDraft] = React.useState<V | undefined>(rule.value);\n\n React.useEffect(() => {\n if (open) setDraft(rule.value);\n }, [open, rule.value]);\n\n const options = useFilterOptions<V, O>(field, open);\n // A LOOKUP, not a definition: every result is a module-level built-in or the\n // consumer's own component, so the editor is never remounted mid-edit.\n const editor = React.useMemo(\n () => actions.resolveEditor(field, operator),\n [actions, field, operator],\n );\n\n if (!editor) return null;\n\n const editorProps: FilterEditorProps<V, O> = {\n field,\n operator,\n value: draft,\n onValueChange: (next) => setDraft(next as V),\n host: \"amend\",\n autoFocusProps: {\n ref: noopAutoFocusRef,\n autoFocus: true,\n },\n commit: (next, commitOptions) => {\n actions.updateRule(rule.id, {\n value: (next === undefined ? draft : next) as V,\n });\n // A multi-select commits per toggle and asks to stay put; others dismiss.\n if (commitOptions?.close === false) return;\n onClose();\n },\n cancel: onClose,\n // The same as cancel, honestly: `back` means something only to a `create`\n // host.\n back: onClose,\n options,\n labels: actions.labels,\n };\n\n // `createElement` rather than JSX: the component comes out of a lookup, so\n // `<Editor />` trips `react-hooks/static-components`. The fragment keeps the\n // props object, which carries a ref, from looking like a ref read in render.\n return <>{React.createElement(editor, editorProps)}</>;\n}\n\n/** One step of the flow, released when the panel that owes it has LEFT THE\n * DOM: both popovers keep portal content mounted through the exit transition,\n * so this unmount IS that moment and nothing is timed. `onRelease` is used AS\n * the cleanup, so an unmemoized callback fires its step early. */\nfunction FilterStepHandoff({ onRelease }: { onRelease: () => void }) {\n React.useEffect(() => onRelease, [onRelease]);\n return null;\n}\n\n/** The value host: the editor in a popover anchored to the value segment, and\n * BOTH routes end here. The operator popover used to draw the editor itself,\n * so a handed-off panel sat a segment's width left of a second press. */\nexport interface FilterValuePopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n operator: FilterOperator | undefined;\n /** The element that opens it, WITH its own children: a chip segment must be\n * a direct child of its `ButtonGroup` for the pill to fuse. */\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterValuePopover<V, O>({\n rule,\n field,\n operator,\n trigger,\n className,\n}: FilterValuePopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"value\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n\n // The last step of the flow as well as the amend route; by now the condition\n // menu has UNMOUNTED (see `FilterStepHandoff`). CONSUMED as it is honoured,\n // or Escape closes the editor and this effect reopens it in the same frame.\n // The `set` stays OUTSIDE the `locked` guard on purpose: a handoff nobody\n // spends sits armed until some later chip spends it, and a chip that opened\n // because a DIFFERENT chip was arrowed onto is worse than one that opened\n // nothing.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n // Nothing to open, but the trigger still renders so the value keeps its\n // place, and it wears the bar's state: that hangs on the TRIGGER below,\n // which this path never reaches, so the segment used to look live.\n if (!operator || !actions.resolveEditor(field, operator)) {\n return React.cloneElement(trigger as React.ReactElement<Record<string, unknown>>, {\n disabled: actions.disabled,\n ...filterReadOnlyProps(actions),\n });\n }\n\n return (\n // REFUSES to open while locked rather than leaving it to the trigger: an\n // `aria-disabled` control that still opens an editor is one that lied.\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n setOpen(next);\n }}\n >\n {/* The trigger IS the segment, never a wrapper. `ButtonGroup` fuses\n DIRECT children only (`*:data-slot:rounded-r-none`,\n `[&>[data-slot]~[data-slot]]:border-l-0`), so a nested one keeps its\n own border and the chip reads as separate badges. */}\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent align=\"start\" className={cn(\"w-auto p-0\", className)}>\n <FilterValueEditor<V, O>\n rule={rule}\n field={field}\n operator={operator}\n open={open}\n onClose={() => {\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/* A chip's ATTRIBUTE is fixed once the chip exists: no field popover here. A\n new field invalidates the operator and the value, so \"amending\" threw both\n away. The builder keeps its picker, where a row reads as a form. */\n\n/** The condition menu, and the step after it. The list is the cascader run\n * flat: the old hand-rolled one marked the keyboard HIGHLIGHT with\n * `aria-selected` and had no Home, End or typeahead. It HANDS OFF to the\n * value popover once its own panel has left the DOM; advancing in place\n * anchored the editor to the CONDITION segment and doubled up in the row. */\nexport interface FilterOperatorPopoverProps<V = unknown, O = unknown> {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n trigger: React.ReactElement;\n className?: string;\n}\n\nexport function FilterOperatorPopover<V, O>({\n rule,\n field,\n trigger,\n className,\n}: FilterOperatorPopoverProps<V, O>) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"operator\";\n const [open, setOpen] = React.useState(false);\n const locked = isFilterLocked(actions);\n /** Whether the close this panel is going through IS the step being handed\n * on. A ref, so it survives the render that closes the popover. Every OPEN\n * clears it, so an Escape or an outside press finds it already lowered and\n * spends nothing; `release` leaves it standing because one twin asks again\n * later: Radix reads it from `onCloseAutoFocus`, a macrotask after the\n * unmount. Clearing it in `release` would break that twin only. */\n const handoff = React.useRef(false);\n const operators = actions.resolveOperators(field);\n\n // Memoized because the array IS the menu's identity: the cascader rebuilds\n // its index per `items` identity, so a fresh array rebuilds it per keystroke.\n const items = React.useMemo(\n () =>\n visibleFilterOperators(operators).map((entry) => ({\n value: entry.value,\n label: entry.label,\n })),\n [operators],\n );\n\n // Opened by the root the moment the chip is created. CONSUMED here, or the\n // handoff re-opens the menu on the frame Escape closes it. Consumed even\n // while locked, for the reason on the value popover's copy.\n React.useEffect(() => {\n if (!autoOpen || open) return;\n handoff.current = false;\n if (!locked) setOpen(true);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n }, [autoOpen, open, focusStore, rule.id, locked]);\n\n const close = () => {\n handoff.current = false;\n setOpen(false);\n focusStore.set({ id: rule.id, segment: \"operator\", autoOpen: false });\n };\n\n /** The parked step, spent on the frame this panel stops existing. Memoized\n * on nothing that changes, and load bearing: `FilterStepHandoff` uses this\n * AS its cleanup, so a new identity mid-flow fires the step too early. */\n const release = React.useCallback(() => {\n if (!handoff.current) return;\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: true });\n }, [focusStore, rule.id]);\n\n // The chip going away takes its step with it: React destroys a deleted\n // subtree top down, so this runs before the panel's own cleanup.\n React.useEffect(\n () => () => {\n handoff.current = false;\n },\n [],\n );\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n /* Escape, an outside press, a second press: none is the step being\n taken, so none may spend it. RETIRED ON OPEN, not on close, and that\n is a twin difference: in Radix an item choice dismisses through here\n too, so retiring on close wiped the request before the unmount. */\n if (next) handoff.current = false;\n setOpen(next);\n }}\n >\n <PopoverTrigger\n render={trigger}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n />\n <PopoverContent\n align=\"start\"\n /* Base UI restores focus to the trigger as this panel closes, which\n lands on the condition segment AFTER the value editor has opened and\n focused its input, so a keyboard user is dropped back a step and\n cannot reach the value at all. Suppressed only while the handoff is\n up; a function because Base UI resolves it at close time, which is\n when the ref is accurate. Radix runs the same guard through\n `onCloseAutoFocus`. */\n finalFocus={() => !handoff.current}\n /* `w-auto` with a FLOOR: a catalog sizes to its longest label, and a\n boolean field's \"is\" and \"is not\" would read as a scrap of paper. */\n className={cn(\"w-auto min-w-40 p-0\", className)}\n >\n {/* INSIDE the panel deliberately: only a child of the content is\n unmounted by the exit transition rather than by the close. */}\n <FilterStepHandoff onRelease={release} />\n <FilterMenu\n items={items}\n selected={rule.operator ? [rule.operator] : []}\n onSelectionChange={(values) => {\n const value = values[0];\n /* Deselecting the committed operator is a step back rather than a\n choice, so pressing the current row simply closes. */\n if (value === undefined) {\n close();\n return;\n }\n const chosen = getFilterOperator(operators, value);\n /* BUILDING versus AMENDING, the same fork the advanced row draws\n at its field step. A rule reaches this menu with no operator\n exactly once, while it is being added, and only then is the\n value the step after this one. Re-picking the condition on a\n rule that already has one is an edit of that one cell: it\n commits and closes, and the user opens the value themselves. */\n const building = !rule.operator;\n actions.updateRule(rule.id, {\n operator: value,\n /* The value moves with the operator: \"is\" to \"is any of\" would\n leave a bare string where every reader expects an array. */\n value: coerceFilterValue(\n rule.value,\n getFilterOperator(operators, rule.operator),\n chosen,\n ) as V,\n });\n if (building && operatorTakesValue(chosen)) {\n /* PARKED, not opened: `release` hands the row to its value\n surface once this panel has unmounted. */\n handoff.current = true;\n setOpen(false);\n return;\n }\n close();\n }}\n labels={actions.labels}\n ariaLabel={field.label}\n searchPlaceholder={actions.labels.searchOperators}\n /* No visible search field: a CLOSED enum of six to ten labels, all\n on screen. Still RENDERED, visually hidden, because it owns focus\n and `aria-activedescendant`: arrows, Home, End and typeahead. */\n searchable={false}\n /* Taller than a value list on purpose: the operator set is CLOSED, so\n all of it fits and the height buys the whole catalog. A value list\n is open ended and would only push its own footer off the screen. */\n maxHeight={320}\n /* Deliberately unpinned: one selected operator in a short list, so\nlifting it would lose the catalog's declared reading order. */\n />\n </PopoverContent>\n </Popover>\n );\n}\n\n/** The keyboard path to a CROSS-GROUP move: Alt+Arrow reorders within the\n * owning group only and Wrap creates a NEW group, so the drag layer's\n * cross-group move had no keyboard parity. Numbered in document order. */\nexport function FilterMoveToMenuItems({ nodeId }: { nodeId: string }) {\n const actions = useFilterActions();\n // A menu ITEM takes the native word: both twins already make `disabled`\n // roving-focusable and `aria-disabled`.\n const reorderable = useFilterReorderable();\n const locked = isFilterLocked(actions);\n // Read at render time: the menu's content mounts when the menu opens, so\n // this is the tree the user is looking at.\n const query = actions.getQuery();\n const found = findFilterNode(query, nodeId);\n if (!found?.parent) return null;\n\n const destinations: { id: string; label: string; size: number }[] = [];\n if (found.parent.id !== query.id) {\n destinations.push({\n id: query.id,\n label: actions.labels.moveToTopLevel,\n size: query.rules.length,\n });\n }\n\n let position = 0;\n // `inside` suppresses the PUSH and not the walk, so the numbering stays\n // document order rather than renumbering every group after this one. Counted\n // before the exclusions for the same reason: the current parent is not\n // offered but still holds its number, so the numbering is stable whichever\n // row's menu is open.\n const visit = (group: FilterGroupNode<unknown>, inside: boolean) => {\n for (const child of group.rules) {\n if (!isFilterGroup(child)) continue;\n position += 1;\n // Itself and everything under it: `moveFilterNodeTo` already refuses that\n // move - it would detach the subtree and leave a cycle - so offering it\n // would be a menu row that quietly does nothing.\n const within = inside || child.id === nodeId;\n if (!within && child.id !== found.parent!.id) {\n destinations.push({\n id: child.id,\n label: actions.labels.moveToGroup(position),\n size: child.rules.length,\n });\n }\n visit(child, within);\n }\n };\n visit(query, false);\n\n if (destinations.length === 0) return null;\n\n // The THIRD route into a move, gated on the same switch as the grip and\n // Alt+Arrow: ungated, a builder that draws no handle still reordered here.\n if (!reorderable) return null;\n\n return (\n <>\n {destinations.map((destination) => (\n <DropdownMenuItem\n key={destination.id}\n disabled={locked}\n onClick={() => actions.moveNodeTo(nodeId, destination.id, destination.size)}\n >\n {/* A bend into the destination: movement, not duplication or nesting. */}\n <CornerDownRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{destination.label}</span>\n </DropdownMenuItem>\n ))}\n </>\n );\n}\n\n/** The per-rule actions, without the trigger: the chip's kebab and a builder\n * row's kebab act on the same rule. `allowGrouping` is the CHROME's answer;\n * \"Convert to advanced filter\" is the CONSUMER's, and hides itself there. */\nexport function FilterRuleMenuItems({\n ruleId,\n /** Offer \"Wrap in condition group\". Off for the chip row, which cannot draw\n * a group; on in the builder, the only way to nest without dragging. */\n allowGrouping = false,\n}: {\n ruleId: string;\n allowGrouping?: boolean;\n}) {\n const actions = useFilterActions();\n // Gated here as well as at the trigger, because this is EXPORTED: a consumer\n // composing their own menu gets rows that say they are unavailable.\n const locked = isFilterLocked(actions);\n return (\n /* Every row leads with an icon. `IconPlaceholder` because the source ships\n under five icon sets; no size class, because each style already sizes an\n unsized svg in a menu row; `aria-hidden`, the label IS the name. */\n <>\n <DropdownMenuItem disabled={locked} onClick={() => actions.duplicateNode(ruleId)}>\n <CopyIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.duplicate}</span>\n </DropdownMenuItem>\n <DropdownMenuItem disabled={locked} onClick={() => actions.negateRule(ruleId)}>\n {/* Two arrows swapping: negation flips to the declared inverse. */}\n <ArrowLeftRightIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.negate}</span>\n </DropdownMenuItem>\n {allowGrouping ? (\n <DropdownMenuItem disabled={locked} onClick={() => actions.wrapNodeInGroup(ruleId)}>\n {/* Layers: braces read as grouping in only three of the five sets. */}\n <LayersIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.wrapInGroup}</span>\n </DropdownMenuItem>\n ) : null}\n {allowGrouping ? <FilterMoveToMenuItems nodeId={ruleId} /> : null}\n {/* OPTIONAL, and gated on both halves of \"would this do anything\": the\n handler is the consumer's opt-in, and an already-advanced bar has\n nothing to convert. NOT gated on `locked`: it changes no query, is\n handed no mutator, and the shipped kebab will not open while locked. */}\n {actions.convertToAdvanced && actions.variant !== \"advanced\" ? (\n <DropdownMenuItem onClick={() => actions.convertToAdvanced?.()}>\n {/* Sliders: the one \"advanced settings\" glyph in all five sets. */}\n <SlidersHorizontalIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.convertToAdvanced}</span>\n </DropdownMenuItem>\n ) : null}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={locked}\n onClick={() => actions.removeNode(ruleId)}\n >\n {/* No colour: the destructive variant already paints the row's svgs. */}\n <Trash2Icon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.remove}</span>\n </DropdownMenuItem>\n </>\n );\n}\n\nexport interface FilterChipProps<V = unknown> {\n rule: FilterRule<V>;\n index: number;\n}\n\n/** One filter, as a chip. Memoization means something here: the actions\n * context is stable, the focus store is subscribed to a boolean and the query\n * shares structure, so editing one filter of forty re-renders one chip. */\nfunction FilterChipImpl<V, O>({ rule, index }: FilterChipProps<V>) {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n const focusStore = useFilterFocusStore();\n const focused = useFilterChipFocused(rule.id);\n const noFocus = useFilterFocusEmpty();\n const locked = isFilterLocked(actions);\n // THE CHIP'S HEIGHT, by way of the one button in it that has one:\n // `ButtonGroup` is `items-stretch` and no style gives a text segment a\n // height, so the kebab's rung is the pill's. The RADIUS survives because\n // every style whose `icon-sm` rounds differently re-pins it in a group.\n const sizes = filterControlSizes(actions);\n // The kebab is CONTROLLED so it can refuse to open: every mutating row\n // behind it is gated. That puts \"Convert to advanced filter\" out of reach\n // while locked; a consumer-composed menu still draws it.\n const [menuOpen, setMenuOpen] = React.useState(false);\n // Exactly one chip is in the tab order at a time. Before anything has been\n // focused that is the first chip, so Tab reaches the row in one press.\n const isTabStop = focused || (noFocus && index === 0);\n\n const field = getFilterField(actions.index, rule.path);\n const operators = field ? actions.resolveOperators(field) : [];\n const operator = getFilterOperator(operators, rule.operator);\n\n const {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n } = useFilterRuleDisplay<V, O>(rule, field, operator);\n\n if (!field) {\n // A rule pointing at a field the schema no longer has. Dropping it loses a\n // saved view's data; rendering nothing leaves an invisible condition still\n // filtering. It carries the SAME roving wiring as a real chip: `data-slot`\n // alone joined the arrow-key query with no `tabIndex` to land on.\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n data-unknown=\"\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(rule.path.join(actions.labels.pathSeparator))}\n data-focused={focused || undefined}\n data-rule-id={rule.id}\n data-index={index}\n tabIndex={isTabStop ? 0 : -1}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n >\n <ButtonGroupText className=\"bg-background text-muted-foreground dark:bg-input/30\">\n {rule.path.join(actions.labels.pathSeparator)}\n </ButtonGroupText>\n <Button\n variant=\"outline\"\n size={sizes.icon}\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.remove}\n /* It had no gate at all, so the one chip whose whole purpose is to be\n removed could be removed from a bar that refuses every other edit. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.removeNode(rule.id)}\n >\n <XIcon />\n </Button>\n </ButtonGroup>\n );\n }\n\n if (render.renderChip) return <>{render.renderChip(rule)}</>;\n\n const focusSegment = (segment: ChipSegment) =>\n focusStore.set({ id: rule.id, segment, autoOpen: false });\n\n // A rule with no condition yet, KEPT rather than removed (see\n // `isFilterRuleComplete`), so it has to read as unfinished. Through WORDS:\n // the dashed outline it replaces degraded to an underline under sera.\n const incomplete = !rule.operator;\n\n // The same test the value segment renders under, so the name matches the\n // chip: `valueText` alone appended a placeholder to valueless conditions.\n const hasValue = Boolean(rule.operator) && operatorTakesValue(operator);\n\n // The value's spoken form in the chip's NAME: a name is not a prompt, so\n // \"Description contains enter text...\" becomes \"no value\".\n const valueName = valueEmpty && !field.valueText ? actions.labels.noValue : valueText;\n\n return (\n <ButtonGroup\n data-slot=\"filter-chip\"\n role=\"group\"\n aria-label={actions.labels.filterLabel(\n `${pathText} ${operatorLabel}${hasValue ? ` ${valueName}` : \"\"}`.trim() +\n (incomplete ? `, ${actions.labels.incomplete}` : \"\"),\n )}\n data-focused={focused || undefined}\n data-incomplete={incomplete || undefined}\n data-rule-id={rule.id}\n tabIndex={isTabStop ? 0 : -1}\n className={cn(\n /* Sera is an underline style, so the boxed segments are normalised to\n its bottom-border-only look or the chip reads as a mix of both. */\n \"\",\n )}\n onFocusCapture={() => {\n if (!focused) focusStore.set({ id: rule.id, segment: null, autoOpen: false });\n }}\n data-index={index}\n >\n {/* DISPLAY ONLY: a div, not a button, not a tab stop, no popover. The\n attribute is fixed for the life of the chip. */}\n <ButtonGroupText\n /* Dropped while the path is collapsed: the ellipsis inside carries the\n same sentence as a tooltip, and the two would stack. */\n title={pathCollapsed ? undefined : pathText}\n className=\"cursor-default gap-1.5 bg-background dark:bg-input/30\"\n >\n {field.icon}\n {/* Zero gap INSIDE the path, so the separator's own margin is the only\n air around a chevron; `gap-1.5` used to stack 6px a side on it. */}\n <span className=\"flex items-center\">{pathLabel}</span>\n </ButtonGroupText>\n\n <FilterOperatorPopover\n rule={rule}\n field={field}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n /* The operator is connective tissue between the field and the\n value, so it reads quieter than either - unless it is still\n the prompt \"Select condition\", the one thing to act on. */\n incomplete ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"operator\")}\n >\n {operatorLabel}\n </ButtonGroupText>\n }\n />\n\n {/* No condition, no value: `getFilterArity(undefined)` defaults to \"one\",\n so testing the operator alone renders a stray value segment. */}\n {hasValue ? (\n <FilterValuePopover\n rule={rule}\n field={field}\n operator={operator}\n trigger={\n <ButtonGroupText\n render={<button type=\"button\" />}\n /* Named explicitly rather than by its contents: avatars or a\n \"+2\" badge, and \"plus two\" says nothing about two people. It\n grows to the whole list when the editor cannot be opened,\n since locked it must carry what a press no longer reveals. */\n aria-label={locked ? valueFullText : valueText}\n /* The pointer's route to the same thing, and only when there is\n more to say than the segment already says. */\n title={valueFullText === valueText ? undefined : valueFullText}\n className={cn(\n \"cursor-default bg-background hover:bg-accent dark:bg-input/30\",\n valueEmpty && \"text-muted-foreground\",\n )}\n onPointerDown={() => focusSegment(\"value\")}\n >\n {valueLabel}\n </ButtonGroupText>\n }\n />\n ) : null}\n\n <DropdownMenu\n open={menuOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setMenuOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"outline\"\n size={sizes.icon}\n /* The same surface the three text segments force. Styles whose\n outline button is transparent in dark (sera, luma, rhea) left\n the kebab as a notch in an otherwise filled pill. */\n className=\"bg-background dark:bg-input/30\"\n aria-label={actions.labels.chipMenu(field.label)}\n onPointerDown={() => focusSegment(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n {/* The SAME sizing the builder's menus use, from one constant: a menu\n that cuts \"Convert to group\" in one chrome is one defect twice. */}\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n <FilterRuleMenuItems ruleId={rule.id} />\n </DropdownMenuContent>\n </DropdownMenu>\n </ButtonGroup>\n );\n}\n\nexport const FilterChip = React.memo(FilterChipImpl) as typeof FilterChipImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,MAAM,yBAAyD,CAAC;AAEhE,SAAS,oBACP,OACA,UACA,eACA,QAEA,kBAGA,cACQ;CACR,MAAM,aAA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ACA;EACA;;;;;;;;;;EAWA,uBACE,OAAO,YAAY,IACnB,SAAS,oBAAoB,GAAG;;;;;EAOlC;;;;;EAMA;EACA;;;;;;EAOA,eAAe;;;;;EAKf;;EAGA,UAAU,QAAM;;EAEhB;EAEA,eAAe,SAAS,0BAA0B,GAAG,OAAO,QAAM;EAClE,cAAc,MAAM,WAAW,OAAO,QAAM;;;;;EAK5C,eAAe,SAAS,4BAA4B,QAAM;EAE1D;EACA,WAAW,QAAM;;iBAGH,QAAQ,aAAa,eACnC,QACA,OAAO,iBACP,cACA,eACA,QAAQ,YACR,gBAAgB,oBAChB,SAAS,aACT,SACA,cACA,eACA,aACA,MACA,UACA,UACA,qBACA,qBACA,eACA,sBACA,cACA,iBACA,SACA,WACA,aACA,YACA,aACA,WACA,YACC,aAAa,GAAG,KAAE,QAAA,IAAA;
|
|
1
|
+
{"version":3,"file":"filters.d.ts","names":[],"sources":["../../../../src/components/reui/filters/filters.tsx"],"mappings":";;;;;;;;;;;;UAqJiB,aAAa,aAAa;;EAEzC,QAAQ,YAAY,GAAG;EAEvB,QAAQ,YAAY;EACpB,eAAe,YAAY;EAC3B,iBAAiB,OAAO,YAAY,IAAI,SAAS,oBAAoB,GAAG;EAExE,SAAS,QAAQ;;EAEjB,iBAAiB;;EAEjB,UAAU;;;;;;EAOV;;EAEA;;;;;EAKA;;;;;;;EAOA;;;;;;;;EASA;EACA;EACA;;;;;;;;;;EAWA,uBACE,OAAO,YAAY,IACnB,SAAS,oBAAoB,GAAG;;;;;EAOlC;;;;;EAMA;EACA;;;;;;EAOA,eAAe;;;;;EAKf;;EAGA,UAAU,QAAM;;EAEhB;EAEA,eAAe,SAAS,0BAA0B,GAAG,OAAO,QAAM;EAClE,cAAc,MAAM,WAAW,OAAO,QAAM;;;;;EAK5C,eAAe,SAAS,4BAA4B,QAAM;EAE1D;EACA,WAAW,QAAM;;iBAGH,QAAQ,aAAa,eACnC,QACA,OAAO,iBACP,cACA,eACA,QAAQ,YACR,gBAAgB,oBAChB,SAAS,aACT,SACA,cACA,eACA,aACA,MACA,UACA,UACA,qBACA,qBACA,eACA,sBACA,cACA,iBACA,SACA,WACA,aACA,YACA,aACA,WACA,YACC,aAAa,GAAG,KAAE,QAAA,IAAA;UAuoBJ;EACf,UAAU,QAAM;EAChB;EACA;;;;;;;iBAQc,aAAa,SAAS,WAAW,aAAa,kBAAe,QAAA,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,qBAAqB,IAAI,+BAA+B;CAC5D,UAAU,EAKR,MAAM;EACJ,IAAI;EACJ,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAMD,SAAS,qBACP,YACA,qBACA,UACA;CACA,MAAM,eAAe,eAAe,KAAA;CACpC,MAAM,CAAC,UAAU,eAAeA,QAAM,eAC9B,uBAAuB,kBAAqB,CACpD;CAEA,MAAM,QAAQ,eAAe,aAAa;CAC1C,MAAM,WAAWA,QAAM,OAAO,KAAK;CACnC,QAAM,gBAAgB;EACpB,SAAS,UAAU;CACrB,CAAC;CAYD,OAAO;EAAE;EAAO;EAAU,UAVTA,QAAM,aACpB,MAAsB,YAAuC;GAC5D,IAAI,SAAS,SAAS,SAAS;GAC/B,SAAS,UAAU;GACnB,IAAI,CAAC,cAAc,YAAY,IAAI;GACnC,WAAW,MAAM,OAAO;EAC1B,GACA,CAAC,cAAc,QAAQ,CAGQ;CAAE;AACrC;AA4G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AAA;GAgBE,oBAAC,OAAD;IACE,MAAK;IACL,cAAY,QAAQ,OAAO;IAC3B,oBAAiB;IAGjB,GAAK,QAAQ,WAAW,EAAE,oBAAoB,QAAQ,OAAO,SAAS,IAAI;IAC1E,WAAW,GAAG,mBAAmB,EAAE,MAAM,MAAM,OAAO,CAAC,CAAC;IAC7C;IAEV,UAAA,MAAM,KAAK,MAAM,UAChB,oBAAC,YAAD;KAAgC;KAAa;IAAQ,GAApC,KAAK,EAA+B,CACtD;GACE,CAAA;GAEL,oBAAC,gBAAD,EAAyB,QAAU,CAAA;GAElC,aAAa,YAAY,IAGxB,oBAAC,QAAD;IACE,SAAQ;IAER,MAAM,MAAM;IACZ,WAAU;IAGV,UAAU,QAAQ;IAClB,GAAI,oBAAoB,OAAO;IAC/B,eAAe,QAAQ,WAAW;IAEjC,UAAA,QAAQ,OAAO;GACV,CAAA,IACN;GAKJ,oBAAC,OAAD;IAAK,aAAU;IAAS,MAAK;IAAS,WAAU;IAC9C,UAAA,oBAAC,QAAD,EAAA,UAA6B,aAAmB,GAArC,eAAqC;GAC7C,CAAA;EACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,qBAAqB,IAAI,+BAA+B;CAC5D,UAAU,EAKR,MAAM;EACJ,IAAI;EACJ,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAMD,SAAS,qBACP,YACA,qBACA,UACA;CACA,MAAM,eAAe,eAAe,KAAA;CACpC,MAAM,CAAC,UAAU,e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BAAkB,QAAQ,iBAAiB,KAAK,GAAG,KAAK,QAAQ;GACjF,MAAM,UAAU,KAAK,YAAY,mBAAmB,QAAQ,IAAI,UAAU;GAC1E,WAAW,IAAI;IAAE,IAAI;IAAQ;IAAS,UAAU;GAAK,CAAC;EACxD;CACF;CAEA,OACE,qBAAC,OAAD;EACE,KAAK;EACL,aAAU;EACV,cAAY,MAAM,WAAW,KAAK,KAAA;EAElC,iBAAe,QAAQ,YAAY,KAAA;EACnC,WAAW,GAGT,mBAAmB,EAAE,MAAM,MAAM,OAAO,CAAC,GAGzC,MAAM,WAAW,KAAK,SACtB,SACF;EAdF,UAAA;GAgBE,oBAAC,OAAD;IACE,MAAK;IACL,cAAY,QAAQ,OAAO;IAC3B,oBAAiB;IAGjB,GAAK,QAAQ,WAAW,EAAE,oBAAoB,QAAQ,OAAO,SAAS,IAAI;IAC1E,WAAW,GAAG,mBAAmB,EAAE,MAAM,MAAM,OAAO,CAAC,CAAC;IAC7C;IAEV,UAAA,MAAM,KAAK,MAAM,UAChB,oBAAC,YAAD;KAAgC;KAAa;IAAQ,GAApC,KAAK,EAA+B,CACtD;GACE,CAAA;GAEL,oBAAC,gBAAD,EAAyB,QAAU,CAAA;GAElC,aAAa,YAAY,IAGxB,oBAAC,QAAD;IACE,SAAQ;IAER,MAAM,MAAM;IACZ,WAAU;IAGV,UAAU,QAAQ;IAClB,GAAI,oBAAoB,OAAO;IAC/B,eAAe,QAAQ,WAAW;IAEjC,UAAA,QAAQ,OAAO;GACV,CAAA,IACN;GAKJ,oBAAC,OAAD;IAAK,aAAU;IAAS,MAAK;IAAS,WAAU;IAC9C,UAAA,oBAAC,QAAD,EAAA,UAA6B,aAAmB,GAArC,eAAqC;GAC7C,CAAA;EACF;;AAET"}
|
|
@@ -22,7 +22,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
22
22
|
* default to `text-primary`; override it to recolor without touching internals.
|
|
23
23
|
*/
|
|
24
24
|
declare const iconTileVariants: (props?: ({
|
|
25
|
-
variant?: "
|
|
25
|
+
variant?: "soft" | "solid" | "outline" | "elevated" | "frame" | null | undefined;
|
|
26
26
|
size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
|
|
27
27
|
radius?: "default" | "full" | null | undefined;
|
|
28
28
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
//#region src/components/ui/badge.d.ts
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "link" | "outline" | "ghost" | "destructive" | "secondary" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
//#endregion
|
|
@@ -4,7 +4,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
4
4
|
//#region src/components/ui/bubble.d.ts
|
|
5
5
|
declare function BubbleGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
6
6
|
declare const bubbleVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "outline" | "ghost" | "
|
|
7
|
+
variant?: "default" | "outline" | "ghost" | "destructive" | "secondary" | "muted" | "tinted" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
declare function Bubble({ variant, align, className, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
10
10
|
align?: "start" | "end";
|
|
@@ -2,7 +2,7 @@ import { Button as Button$1 } from "@base-ui/react/button";
|
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
//#region src/components/ui/button.d.ts
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "link" | "outline" | "ghost" | "destructive" | "secondary" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | "lg" | "xs" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|