@kumix/ui 0.3.7 → 0.3.9
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 +26 -25
- package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
- package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
- package/dist/components/agents/ai-sidebar.js +3 -5
- package/dist/components/agents/ai-sidebar.js.map +1 -1
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +12 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +9 -5
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +77 -74
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
- package/dist/components/motion/center-morph-modal.js +82 -88
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/combobox/content.js +1 -1
- package/dist/components/motion/combobox/context.d.ts +6 -0
- package/dist/components/motion/combobox/context.d.ts.map +1 -1
- package/dist/components/motion/combobox/context.js +1 -233
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +7 -8
- package/dist/components/motion/combobox/trigger.js.map +1 -1
- package/dist/components/motion/combobox.js +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +62 -45
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +30 -30
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/loader.js +20 -22
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +83 -83
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.d.ts +28 -0
- package/dist/components/motion/morphing-search.d.ts.map +1 -0
- package/dist/components/motion/morphing-search.js +422 -0
- package/dist/components/motion/morphing-search.js.map +1 -0
- package/dist/components/motion/project-folder.js +20 -20
- package/dist/components/motion/project-folder.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 +90 -0
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-async.js +549 -0
- package/dist/components/reui/cascader/cascader-async.js.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.js +135 -0
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
- package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-context.js +59 -0
- package/dist/components/reui/cascader/cascader-context.js.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.js +456 -0
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.js +68 -0
- package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
- package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
- package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-item.js +530 -0
- package/dist/components/reui/cascader/cascader-item.js.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.js +576 -0
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.js +312 -0
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
- package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
- package/dist/components/reui/cascader/cascader-types.js +2 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-virtual.js +240 -0
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
- package/dist/components/reui/cascader/cascader.d.ts +322 -0
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader.js +1459 -0
- package/dist/components/reui/cascader/cascader.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
- package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1191 -0
- package/dist/components/reui/filters/filters-advanced.js.map +1 -0
- package/dist/components/reui/filters/filters-builder.d.ts +43 -0
- package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-builder.js +152 -0
- package/dist/components/reui/filters/filters-builder.js.map +1 -0
- package/dist/components/reui/filters/filters-chip.d.ts +79 -0
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-chip.js +553 -0
- package/dist/components/reui/filters/filters-chip.js.map +1 -0
- package/dist/components/reui/filters/filters-context.d.ts +290 -0
- package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-context.js +277 -0
- package/dist/components/reui/filters/filters-context.js.map +1 -0
- package/dist/components/reui/filters/filters-date.d.ts +43 -0
- package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-date.js +143 -0
- package/dist/components/reui/filters/filters-date.js.map +1 -0
- package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
- package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-dnd.js +454 -0
- package/dist/components/reui/filters/filters-dnd.js.map +1 -0
- package/dist/components/reui/filters/filters-draft.d.ts +2 -0
- package/dist/components/reui/filters/filters-draft.js +128 -0
- package/dist/components/reui/filters/filters-draft.js.map +1 -0
- package/dist/components/reui/filters/filters-editors.d.ts +91 -0
- package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-editors.js +773 -0
- package/dist/components/reui/filters/filters-editors.js.map +1 -0
- package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
- package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-i18n.js +127 -0
- package/dist/components/reui/filters/filters-i18n.js.map +1 -0
- package/dist/components/reui/filters/filters-lib.d.ts +171 -0
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-lib.js +336 -0
- package/dist/components/reui/filters/filters-lib.js.map +1 -0
- package/dist/components/reui/filters/filters-operators.d.ts +49 -0
- package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-operators.js +300 -0
- package/dist/components/reui/filters/filters-operators.js.map +1 -0
- package/dist/components/reui/filters/filters-query.d.ts +132 -0
- package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-query.js +476 -0
- package/dist/components/reui/filters/filters-query.js.map +1 -0
- package/dist/components/reui/filters/filters-types.d.ts +452 -0
- package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-types.js +2 -0
- package/dist/components/reui/filters/filters.d.ts +114 -0
- package/dist/components/reui/filters/filters.d.ts.map +1 -0
- package/dist/components/reui/filters/filters.js +638 -0
- package/dist/components/reui/filters/filters.js.map +1 -0
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/field.js +2 -2
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/context-BizvUNZv.js +298 -0
- package/dist/context-BizvUNZv.js.map +1 -0
- package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
- package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
- package/dist/hooks/use-on-open.d.ts +18 -0
- package/dist/hooks/use-on-open.d.ts.map +1 -0
- package/dist/hooks/use-on-open.js +27 -0
- package/dist/hooks/use-on-open.js.map +1 -0
- package/dist/hooks/use-row-cursor.d.ts +39 -0
- package/dist/hooks/use-row-cursor.d.ts.map +1 -0
- package/dist/hooks/use-row-cursor.js +77 -0
- package/dist/hooks/use-row-cursor.js.map +1 -0
- package/dist/lib/text-shimmer.d.ts +2 -2
- package/dist/lib/text-shimmer.d.ts.map +1 -1
- package/dist/lib/text-shimmer.js +2 -2
- package/dist/lib/text-shimmer.js.map +1 -1
- package/dist/presence-gate-BekdC4Bo.js +24 -0
- package/dist/presence-gate-BekdC4Bo.js.map +1 -0
- package/package.json +11 -11
- package/dist/components/motion/combobox/context.js.map +0 -1
- package/dist/components/reui/filters.d.ts +0 -176
- package/dist/components/reui/filters.d.ts.map +0 -1
- package/dist/components/reui/filters.js +0 -1223
- package/dist/components/reui/filters.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cascader-item.js","names":["React","ComboboxPrimitive"],"sources":["../../../../src/components/reui/cascader/cascader-item.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport {\n CheckIcon,\n ChevronRightIcon,\n LoaderCircleIcon,\n MinusIcon,\n RotateCwIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Spinner } from \"../../ui/spinner\";\nimport { useCascaderActions, useCascaderRender, useCascaderState } from \"./cascader-context\";\nimport {\n getCascaderCount,\n getCascaderMoreParent,\n getCascaderPath,\n isCascaderMoreNode,\n} from \"./cascader-lib\";\nimport type { CascaderLoadState, CascaderNode } from \"./cascader-types\";\n\n// Base UI extends its synthetic events with a handler-veto escape hatch.\ntype VetoableEvent = { preventBaseUIHandler?: () => void };\n\n/** A row press. The veto hook is optional: an `as=\"button\"` row is outside Base\n * UI's listbox and gets a plain React event. */\nexport type CascaderRowEvent = React.MouseEvent<HTMLElement> & VetoableEvent;\n\n// Each style's inline inset, as a variable: a row and its absolutely positioned\n// check have to land on the same number, in LOGICAL properties. These eight\n// numbers MIRROR the shared style sheets; keep them in step with\n// `registry/styles/style-*.css`.\nconst ROW_INSET_CLASS = \"[--cascader-row-inset:6px]\";\n\n// Both insets equal, for a row with no check. `!` because a consumer may not\n// import the sheets into `layer(base)`, where the class would win on order.\nconst ROW_FLUSH_CLASS = \"ps-[var(--cascader-row-inset,8px)]! pe-[var(--cascader-row-inset,8px)]!\";\n\n// The same start inset plus room for the check. A flat `pr-8` is wrong in five\n// of the eight styles: 4px of slack in nova, 8px short in maia, luma and sera,\n// and no gutter at all in mira, whose check then overlaps its own label.\nconst ROW_GUTTER_CLASS =\n \"ps-[var(--cascader-row-inset,8px)]! pe-[calc(var(--cascader-row-inset,8px)*2_+_16px)]!\";\n\n// The check's box, inset to match the row's. A physical `right-2` neither\n// mirrors under RTL nor tracks the style's inset; `right-auto` comes with the\n// logical `end-*`, because width + `left` + `right` is over-constrained.\nconst INDICATOR_CLASS =\n \"pointer-events-none absolute flex items-center justify-center size-4 end-[var(--cascader-row-inset,8px)]! rtl:right-auto!\";\n\n// The row's type, gap, radius and icon size per style. No horizontal padding:\n// every row pairs this with `ROW_FLUSH_CLASS` or `ROW_GUTTER_CLASS`.\nconst ROW_THEME_CLASS =\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 rounded-md py-1\";\n\n/**\n * The row's gap and type, per style, held apart from the rest of the theme.\n *\n * A row that pins its own gap or text size takes `ROW_SHELL_CLASS` and leaves\n * these out, because a `style-<name>:` utility is emitted AFTER the plain one\n * it would have to lose to. Not receiving the token beats overriding it with\n * `!`, which a consumer then has to fight in turn.\n */\nconst ROW_GAP_CLASS = \"gap-2\";\n\nconst ROW_TEXT_CLASS = \"text-sm\";\n\nconst ROW_SHELL_CLASS = `${ROW_THEME_CLASS} relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 ${ROW_INSET_CLASS}`;\n\nconst ROW_CLASS = `${ROW_SHELL_CLASS} ${ROW_GAP_CLASS} ${ROW_TEXT_CLASS}`;\n\nconst CASCADER_ACTION_INSET_CLASS = `${ROW_INSET_CLASS} ${ROW_FLUSH_CLASS}`;\n\n/** A footer COMMAND: the row theme, so it cannot drift from the list, plus the\n * hover and `focus-visible` fills a plain button never gets. Fills, never a\n * ring: a ring under rows that all paint with a fill read as a different\n * widget bolted on. `focus-visible`, not `focus`, so a pointer press does not\n * leave a command painted as if it were still hovered. Disabled keys off\n * `aria-disabled`, not `:disabled`, to keep it FOCUSABLE: a footer whose only\n * row is disabled has no tab stop. */\nexport const CASCADER_ACTION_CLASS = `${ROW_SHELL_CLASS} ${ROW_TEXT_CLASS} ${ROW_FLUSH_CLASS} hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground cursor-pointer gap-2 transition-colors aria-disabled:pointer-events-none aria-disabled:opacity-50`;\n\n// The box around the affordances that are not the row. 20px around a 16px icon,\n// the outer 2px cancelled at the call site; 24px would set the row height.\nconst AFFORDANCE_BOX_CLASS = \"flex size-5 shrink-0 items-center justify-center rounded-sm\";\n\n// What makes an affordance read as pressable on an already highlighted row. Not\n// `hover:bg-accent`: the row is `bg-accent` under the pointer, so the chip would\n// be invisible. `!` and `**:` for the `CHECKBOX_MARK_CLASS` reason.\nconst AFFORDANCE_HOVER_CLASS =\n \"transition-[background-color,box-shadow,color] hover:bg-background hover:text-foreground! hover:**:text-foreground! hover:shadow-xs\";\n\n// The selection MARK's colour, pinned so nothing can repaint it: every row\n// carries a DESCENDANT highlight rule, and a mark is STATE. Pinned TWICE\n// because icon sets draw with `fill`/`stroke=\"currentColor\"`, which the\n// `<path>` inherits and resolves against the PATH's own `color`. Both halves\n// are asserted in `cascader-behavior.test.tsx`.\nconst CHECKBOX_MARK_CLASS = \"text-primary-foreground! **:text-primary-foreground!\";\nconst INDICATOR_MARK_CLASS = \"text-foreground! **:text-foreground!\";\n\n// Milliseconds the pointer must rest on a branch row before\n// `expandTrigger=\"hover\"` drills in: long enough that a pointer crossing the\n// column on its way elsewhere opens nothing, short enough to read as immediate.\nconst CASCADER_HOVER_EXPAND_DELAY = 150;\n\nexport interface CascaderItemProps\n extends Omit<\n ComboboxPrimitive.Item.Props,\n \"value\" | \"children\" | \"className\" | \"style\" | \"onClick\" | \"onMouseUp\"\n > {\n /** No state callback: the row merges `className` and `style` itself. */\n className?: string;\n style?: React.CSSProperties;\n onClick?: (event: CascaderRowEvent) => void;\n onMouseUp?: (event: CascaderRowEvent) => void;\n node: CascaderNode;\n /** Explicit render index. Required while virtualized and DELIBERATELY IGNORED\n * otherwise: it self-registers the row and breaks `aria-activedescendant`. */\n index?: number;\n /** Indentation depth. Drives `--cascader-indent` in tree mode. */\n depth?: number;\n /** Renders the ancestor chain under the label, for deep-search results. */\n showPath?: boolean;\n /** `option` renders a real `Combobox.Item`; `button` renders identical markup\n * outside the listbox, for the ancestor columns in columns mode. */\n as?: \"option\" | \"button\";\n /** Tree mode: this row is an expanded branch. */\n expanded?: boolean;\n /** Indent each depth by this many pixels. Tree mode only. */\n indent?: number;\n /** Whether the node has children. Defaults to the cascader's own answer, as do\n * the three below: callers pass them because they already hold the level,\n * which keeps a memoised row off the volatile context. */\n branch?: boolean;\n /** Whether the node may be committed. Defaults to the cascader's own answer. */\n selectable?: boolean;\n /** Whether the node is currently selected. Defaults to the cascader's answer. */\n selected?: boolean;\n /** Some but not all of the loaded subtree selected. `cascade` only. */\n indeterminate?: boolean;\n /** Selected nodes below this one, at any depth. Drives the trailing count. */\n selectedCount?: number;\n /** Paging row only: a request for this level is in flight. */\n loading?: boolean;\n /** Paging row only: this level's last request failed. */\n error?: boolean;\n /** Branch row only: this node's OWN children are being fetched. The chevron\n * (or, in tree mode, the expander) becomes a spinner IN PLACE, in the same\n * 16px box: no skeleton row appears below, nothing reflows. */\n childrenLoading?: boolean;\n /** Branch row only: the last fetch of this node's children failed. The same\n * box becomes the retry. The press path is unchanged: it goes through\n * `navigate`, which refires the failed level rather than moving. */\n childrenError?: boolean;\n children?: React.ReactNode;\n}\n\n/** One row. Branch presses navigate instead of selecting, vetoed here with\n * `preventBaseUIHandler()` on `onClick` (Enter too) and on `onMouseUp`. */\nconst CascaderItem = React.memo(function CascaderItem({\n node,\n index,\n depth,\n showPath = false,\n as = \"option\",\n expanded,\n indent = 16,\n branch: branchProp,\n selectable: selectableProp,\n selected: selectedProp,\n indeterminate: indeterminateProp,\n selectedCount: selectedCountProp,\n loading,\n error,\n childrenLoading = false,\n childrenError = false,\n className,\n children,\n onClick,\n onMouseUp,\n style,\n ...props\n}: CascaderItemProps) {\n // The ACTIONS context only: the state context republishes on every keystroke.\n const {\n index: treeIndex,\n mode,\n labels,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n selectedDescendantCount,\n multiple,\n branchesSelectable,\n indicator: indicatorEnabled,\n expandTrigger = \"click\",\n navigate,\n navigateAt,\n toggleExpanded,\n commit,\n virtualized,\n loadMore,\n retryLevel,\n } = useCascaderActions();\n // Render props come from an always-current context, or a closure goes stale.\n const { renderItem, renderLabel } = useCascaderRender();\n\n const branch = branchProp ?? isBranch(node);\n const selectable = selectableProp ?? isSelectable(node);\n const selected = selectedProp ?? isSelected(node);\n // A selected node is never also partially selected (a dash in a filled box).\n const indeterminate = !selected && (indeterminateProp ?? isIndeterminate(node));\n const count = branch ? getCascaderCount(treeIndex, node) : 0;\n const nodeDepth = depth ?? treeIndex.depthOf.get(node.value) ?? 0;\n\n // O(1): the cascader publishes a map of selected-descendant counts, because a\n // row walking its own subtree is `rows x descendants`, paid every keystroke.\n const selectedDescendants = branch ? (selectedCountProp ?? selectedDescendantCount(node)) : 0;\n // `multiple` only: with a single selection the trigger, the breadcrumb and\n // the leaf's own check already say where it is, so swapping a branch's real\n // child total (\"24\") for a permanent \"1\" would trade a useful number away.\n const showsSelectedCount = multiple && selectedDescendants > 0;\n const trailingCount = showsSelectedCount ? selectedDescendants : count;\n // Shown selected or not: suppressing it under a checked branch read as data\n // loss, and the row's TWO trailing columns mean the count never has to share\n // a slot with the check.\n const showCount = trailingCount > 0;\n\n // Where a multi-select tree puts its checkbox: at the HEAD of the row, since a\n // trailing box does not follow the label stagger. Per-LIST, never per-row, or\n // the labels below an unselectable row step back out.\n const leadingCheckbox = mode === \"tree\" && multiple;\n\n // Whether this row draws a MARK, and so whether it reserves the gutter one\n // needs. `|| multiple` is the scope of the opt-out: a checkbox is the\n // selection CONTROL, so `indicator={false}` is a no-op in multi-select.\n const showsIndicator = indicatorEnabled || multiple;\n\n const veto = React.useCallback((event: VetoableEvent) => {\n event.preventBaseUIHandler?.();\n }, []);\n\n const handleClick = React.useCallback(\n (event: CascaderRowEvent) => {\n onClick?.(event);\n if (node.disabled) return;\n if (branch && !selectable) {\n veto(event);\n navigate(node);\n }\n },\n [onClick, node, branch, selectable, veto, navigate],\n );\n\n const handleMouseUp = React.useCallback(\n (event: CascaderRowEvent) => {\n onMouseUp?.(event);\n if (node.disabled) return;\n if (branch && !selectable) veto(event);\n },\n [onMouseUp, node, branch, selectable, veto],\n );\n\n // The tree expander's own press. With `selectable=\"any\"` the row press\n // commits, and under `cascade` that selected a whole subtree while the row\n // stayed collapsed, so expanding needs its own target. `stopPropagation`\n // before the veto, so Base UI's handler never runs, and no role: nesting\n // one in `role=\"option\"` fails axe. `navigate` fetches BEFORE it opens.\n const handleExpanderClick = React.useCallback(\n (event: CascaderRowEvent) => {\n event.stopPropagation();\n veto(event);\n if (node.disabled) return;\n if (expanded) toggleExpanded(node.value);\n else navigate(node);\n },\n [veto, node, expanded, toggleExpanded, navigate],\n );\n\n const handleExpanderMouseUp = React.useCallback(\n (event: CascaderRowEvent) => {\n // Base UI treats a drag-select mouseup as a commit; this is not one.\n event.stopPropagation();\n veto(event);\n },\n [veto],\n );\n\n const handleChevronClick = React.useCallback(\n (event: CascaderRowEvent) => {\n event.stopPropagation();\n veto(event);\n if (node.disabled) return;\n // `navigate` falls through to `pushLevel`, which APPENDS: right in the\n // deepest column, but from an ancestor column it duplicated the level and\n // corrupted the path. `navigateAt` rebuilds the trail from this depth.\n if (as === \"button\") navigateAt(node, depth ?? 0);\n else navigate(node);\n },\n [veto, node, as, navigateAt, depth, navigate],\n );\n\n const handleChevronMouseUp = React.useCallback((event: CascaderRowEvent) => veto(event), [veto]);\n\n // Keeps focus in the search field: Base UI prevents the mousedown default for\n // option rows, and focusing a `tabindex=\"-1\"` trail row kills every key.\n const handleButtonMouseDown = React.useCallback((event: React.MouseEvent<HTMLElement>) => {\n event.preventDefault();\n }, []);\n\n const handleButtonClick = React.useCallback(\n (event: CascaderRowEvent) => {\n onClick?.(event);\n if (node.disabled) return;\n if (branch && !selectable) {\n // Button rows only exist in the columns trail, where `depth` is the\n // column's own depth, so navigating replaces the trail from here.\n navigateAt(node, depth ?? 0);\n return;\n }\n if (selectable) commit(node);\n },\n [onClick, node, branch, selectable, navigateAt, depth, commit],\n );\n\n // The paging row's press, never a selection, whatever `selectable` says.\n const handleMoreClick = React.useCallback(\n (event: CascaderRowEvent) => {\n onClick?.(event);\n veto(event);\n const parent = getCascaderMoreParent(node);\n if (parent == null) return;\n if (error) retryLevel(parent);\n else if (!loading) loadMore(parent);\n },\n [onClick, veto, node, error, loading, retryLevel, loadMore],\n );\n\n // `expandTrigger=\"hover\"`: resting on a BRANCH row in the ACTIVE column drills\n // in after a delay. The deepest column of columns mode only, and it never\n // commits, so a pointer crossing the panel cannot change the value.\n const hoverNavigates =\n expandTrigger === \"hover\" && mode === \"columns\" && as === \"option\" && branch && !node.disabled;\n const hoverTimerRef = React.useRef<number | null>(null);\n\n const cancelHoverNavigate = React.useCallback(() => {\n if (hoverTimerRef.current == null) return;\n window.clearTimeout(hoverTimerRef.current);\n hoverTimerRef.current = null;\n }, []);\n\n const handleHoverPointerEnter = React.useCallback(() => {\n cancelHoverNavigate();\n hoverTimerRef.current = window.setTimeout(() => {\n hoverTimerRef.current = null;\n navigate(node);\n }, CASCADER_HOVER_EXPAND_DELAY);\n }, [cancelHoverNavigate, navigate, node]);\n\n // Drilling in demotes this column to the trail WITHOUT unmounting the row, so\n // a pending timer has to die or it fires `navigate` from an inactive column.\n React.useEffect(() => {\n if (!hoverNavigates) cancelHoverNavigate();\n }, [hoverNavigates, cancelHoverNavigate]);\n React.useEffect(() => cancelHoverNavigate, [cancelHoverNavigate]);\n\n /* ------------------------------- paging row ------------------------------ */\n\n if (isCascaderMoreNode(node)) {\n const text = error\n ? labels.error\n : loading\n ? node.count\n ? labels.loadingMore\n : labels.loading\n : labels.loadMore;\n\n const moreStyle =\n mode === \"tree\" && nodeDepth > 0\n ? ({\n ...style,\n \"--cascader-indent\": `${nodeDepth * indent}px`,\n } as React.CSSProperties)\n : style;\n\n const moreShared = {\n \"data-slot\": \"cascader-item\",\n \"data-more\": \"\",\n \"data-state\": error ? \"error\" : loading ? \"loading\" : \"idle\",\n \"data-depth\": nodeDepth,\n style: moreStyle,\n className: cn(\n ROW_SHELL_CLASS,\n ROW_FLUSH_CLASS,\n \"justify-center gap-1.5 text-muted-foreground text-xs\",\n !error && !loading && \"hover:text-foreground\",\n mode === \"tree\" && \"ps-[calc(var(--cascader-row-inset,8px)_+_var(--cascader-indent,0px))]!\",\n className,\n ),\n };\n\n const moreBody = children ?? (\n <>\n {loading ? <LoaderCircleIcon className=\"size-3.5 animate-spin\" aria-hidden /> : null}\n <span>{text}</span>\n {/* TEXT, not a button: a focusable element inside a `role=\"option\"`\n row is a `nested-interactive` violation. */}\n {error ? <span className=\"font-medium text-foreground\">{labels.retry}</span> : null}\n </>\n );\n\n if (as === \"button\") {\n const buttonProps = { ...(props as React.ComponentProps<\"button\">) };\n delete buttonProps[\"aria-setsize\"];\n delete buttonProps[\"aria-posinset\"];\n delete buttonProps[\"aria-level\"];\n\n return (\n <button\n type=\"button\"\n {...moreShared}\n tabIndex={-1}\n onClick={handleMoreClick}\n {...buttonProps}\n >\n {moreBody}\n </button>\n );\n }\n\n return (\n <ComboboxPrimitive.Item\n {...moreShared}\n value={node}\n {...(virtualized && index != null ? { index } : null)}\n {...(mode === \"tree\" ? { role: \"treeitem\" as const, \"aria-level\": nodeDepth + 1 } : null)}\n onClick={handleMoreClick}\n onMouseUp={veto}\n {...props}\n >\n {moreBody}\n </ComboboxPrimitive.Item>\n );\n }\n\n const itemState = {\n branch,\n selected,\n disabled: !!node.disabled,\n depth: nodeDepth,\n count,\n path: showPath ? getCascaderPath(treeIndex, node.value).slice(0, -1) : [],\n };\n\n const custom = renderItem?.(node, itemState);\n const customLabel = renderLabel?.(node, itemState);\n\n // What the markup cannot say: a branch would announce \"Person 24\", a naked\n // number. Trail rows are outside the listbox, so they need words for state.\n const srDetails = [\n branch ? labels.itemCount(count) : null,\n showsSelectedCount ? labels.selectedCount(selectedDescendants) : null,\n branch && mode !== \"tree\" ? labels.branchAffordance : null,\n as === \"button\" && selected ? labels.selectedState : null,\n // Option rows say this with `aria-checked=\"mixed\"`; `role=\"button\"` allows\n // neither that nor `aria-selected`, so a trail row says it in words.\n as === \"button\" && indeterminate ? labels.partiallySelectedState : null,\n ]\n .filter(Boolean)\n .map((detail) => `, ${detail}`)\n .join(\"\");\n\n // Extracted because tree mode renders it INLINE at the head of the row. It\n // reads `data-selected` off the ROW, so it also works on the trail rows.\n const checkbox = (\n <span\n data-slot=\"cascader-item-checkbox\"\n className=\"flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input in-data-indeterminate:border-primary in-data-selected:border-primary in-data-indeterminate:bg-primary in-data-selected:bg-primary in-data-indeterminate:text-primary-foreground in-data-selected:text-primary-foreground transition-colors\"\n >\n {/* Colour declared ON THE ICON with `!`; see `CHECKBOX_MARK_CLASS`. */}\n {indeterminate ? (\n <MinusIcon data-slot=\"cascader-item-dash\" className={cn(CHECKBOX_MARK_CLASS, \"size-3\")} />\n ) : (\n <CheckIcon\n data-slot=\"cascader-item-tick\"\n className={cn(CHECKBOX_MARK_CLASS, \"size-3 in-data-selected:opacity-100 opacity-0\")}\n />\n )}\n </span>\n );\n\n const indicator = (\n <>\n {multiple ? (\n checkbox\n ) : (\n <CheckIcon\n data-slot=\"cascader-item-check\"\n className={cn(\"pointer-events-none\", INDICATOR_MARK_CLASS)}\n />\n )}\n </>\n );\n\n const body = custom ?? children ?? (\n <>\n {/* Tree mode expands in place, so the branch marker leads the row. */}\n {mode === \"tree\" && branch ? (\n <span\n data-slot=\"cascader-item-expander\"\n /* Pure affordance: the row itself carries `aria-expanded`. */\n aria-hidden=\"true\"\n data-state={childrenError ? \"error\" : childrenLoading ? \"loading\" : \"idle\"}\n onClick={handleExpanderClick}\n onMouseUp={handleExpanderMouseUp}\n className={cn(\n \"-ms-0.5\",\n childrenError ? \"text-destructive\" : \"text-muted-foreground\",\n AFFORDANCE_BOX_CLASS,\n AFFORDANCE_HOVER_CLASS,\n childrenLoading && \"pointer-events-none\",\n )}\n >\n {childrenLoading ? (\n <Spinner aria-hidden=\"true\" className=\"size-4\" />\n ) : childrenError ? (\n <RotateCwIcon className=\"size-4\" />\n ) : (\n <ChevronRightIcon\n className={cn(\n \"size-4 transition-transform\",\n /* Collapsed it points INTO the level, so it mirrors; expanded\n it points DOWN, the same in both writing modes, so the mirror\n has to come off or `scaleX(-1)` composed with `rotate(90deg)`\n lands it pointing up. `rtl:rotate-90` beside `rotate-90` was\n a no-op that only looked like it handled this. */\n expanded ? \"rotate-90\" : \"rtl:-scale-x-100\",\n )}\n />\n )}\n </span>\n ) : mode === \"tree\" ? (\n // A LEAF's expander slot, reserved and empty: without it a leaf's label\n // started 28px off its sibling branches' and read as one level up.\n <span\n data-slot=\"cascader-item-expander-spacer\"\n aria-hidden=\"true\"\n className={cn(\"-ms-0.5\", AFFORDANCE_BOX_CLASS)}\n />\n ) : null}\n\n {/* Tree + multi-select: the box leads the row, and an unselectable row\n still reserves its width. */}\n {leadingCheckbox ? (\n selectable ? (\n checkbox\n ) : (\n <span\n data-slot=\"cascader-item-checkbox-spacer\"\n aria-hidden=\"true\"\n className=\"size-4 shrink-0\"\n />\n )\n ) : null}\n\n {node.icon ? (\n <span\n data-slot=\"cascader-item-icon\"\n className=\"flex shrink-0 items-center justify-center text-muted-foreground\"\n >\n {node.icon}\n </span>\n ) : null}\n\n {/* The row box is sized for pieces side by side; this one stacks, so it\n restates the gap: 8px reads as a paragraph break, not a subtitle. */}\n <span className=\"flex min-w-0 flex-1 flex-col items-start gap-0.5\">\n {customLabel ?? (\n <>\n <span className=\"w-full truncate text-start\">{node.label}</span>\n {node.description ? (\n <span\n data-slot=\"cascader-item-description\"\n className=\"w-full truncate text-start text-muted-foreground text-xs\"\n >\n {node.description}\n </span>\n ) : null}\n </>\n )}\n {showPath ? <CascaderItemPath node={node} /> : null}\n </span>\n\n {/* The count is a bare number, and nothing else says a branch opens. */}\n {srDetails ? (\n <span data-slot=\"cascader-item-details\" className=\"sr-only\">\n {srDetails}\n </span>\n ) : null}\n\n {/* Tree mode expands in place, so it has no drill-in chevron. */}\n {branch && mode !== \"tree\" ? (\n <span\n data-slot=\"cascader-item-trailing\"\n aria-hidden=\"true\"\n className=\"ms-auto flex shrink-0 items-center gap-1 text-muted-foreground text-xs tabular-nums\"\n >\n {showCount ? (\n <span\n data-slot=\"cascader-item-count\"\n /* The marker a consumer (and a test) reads to tell the two\n numbers apart without matching on a colour class. */\n {...(showsSelectedCount ? { \"data-selected-count\": \"\" } : null)}\n className={cn(showsSelectedCount && \"text-primary!\")}\n >\n {trailingCount}\n </span>\n ) : null}\n {/* ONLY the chevron is the drill target: sharing a hit area with the count made a number pressable. */}\n {/** biome-ignore lint/a11y/useKeyWithClickEvents: <> */}\n <span\n data-slot=\"cascader-item-chevron\"\n data-state={childrenError ? \"error\" : childrenLoading ? \"loading\" : \"idle\"}\n onClick={selectable ? handleChevronClick : undefined}\n onMouseUp={selectable ? handleChevronMouseUp : undefined}\n onMouseDown={as === \"button\" ? handleButtonMouseDown : undefined}\n className={cn(\n /* Cancels the box's outer slack, so the icon keeps its column. */\n \"-me-0.5\",\n AFFORDANCE_BOX_CLASS,\n selectable && AFFORDANCE_HOVER_CLASS,\n childrenError && \"text-destructive\",\n childrenLoading && \"pointer-events-none\",\n )}\n >\n {childrenLoading ? (\n <Spinner aria-hidden=\"true\" className=\"size-4\" />\n ) : childrenError ? (\n <RotateCwIcon className=\"size-4\" />\n ) : (\n <ChevronRightIcon className=\"size-4 rtl:-scale-x-100\" />\n )}\n </span>\n </span>\n ) : null}\n\n {branch && mode === \"tree\" && showCount ? (\n <span\n data-slot=\"cascader-item-count\"\n {...(showsSelectedCount ? { \"data-selected-count\": \"\" } : null)}\n /* The count is spoken by the sr-only details span instead. */\n aria-hidden=\"true\"\n className={cn(\n \"ms-auto shrink-0 text-muted-foreground text-xs tabular-nums\",\n showsSelectedCount && \"text-primary!\",\n )}\n >\n {trailingCount}\n </span>\n ) : null}\n\n {/* No trailing indicator when a tree's box led the row, or when\n `indicator={false}` opted out. See `showsIndicator`. */}\n {selectable && !leadingCheckbox && showsIndicator ? (\n as === \"button\" ? (\n // No ItemIndicator outside Base UI: `data-selected` drives it.\n (multiple || selected) && (\n <span data-slot=\"cascader-item-indicator\" className={INDICATOR_CLASS}>\n {indicator}\n </span>\n )\n ) : (\n <ComboboxPrimitive.ItemIndicator\n /* Kept mounted for a partial selection too: the row is not\n selected, so Base UI would unmount the box the dash lives in. */\n keepMounted={multiple || indeterminate}\n render={<span data-slot=\"cascader-item-indicator\" className={INDICATOR_CLASS} />}\n >\n {indicator}\n </ComboboxPrimitive.ItemIndicator>\n )\n ) : null}\n </>\n );\n\n const rowStyle =\n mode === \"tree\" && nodeDepth > 0\n ? ({\n ...style,\n \"--cascader-indent\": `${nodeDepth * indent}px`,\n } as React.CSSProperties)\n : style;\n\n const shared = {\n \"data-slot\": \"cascader-item\",\n \"data-branch\": branch || undefined,\n \"data-selected\": selected || undefined,\n \"data-indeterminate\": indeterminate || undefined,\n \"data-depth\": nodeDepth,\n \"data-expanded\": expanded || undefined,\n // No `aria-level`: `role=\"option\"` allows only `aria-selected`,\n // `aria-checked`, `aria-posinset` and `aria-setsize`, and a `role=\"button\"`\n // trail row allows none of the four. Only tree mode has a role that takes a\n // level, and it adds one below.\n style: rowStyle,\n className: cn(\n ROW_CLASS,\n /* Three separate reasons to hand the check gutter back. A multi-select\n tree's box leads the row, so the gutter would be 24px of dead space;\n `indicator={false}` drops the check, and keeping the gutter would park\n the count and the chevron one gutter in from an edge nothing sits on;\n and for branches the question is per-LIST, not per-row, because the old\n `branch && !selectable` put neighbouring chevrons on 24px and 6px in\n nova. One `pe-*` is emitted either way, so nothing here depends on\n class-merge order. */\n leadingCheckbox || !showsIndicator || (branch && !branchesSelectable)\n ? ROW_FLUSH_CLASS\n : ROW_GUTTER_CLASS,\n /* ADDED to the style's own inset, never substituted: replacing it put\n depth 0 at 12px and depth 1 at 16px in maia, luma and sera, a 4px step.\n `_+_` because Tailwind's parser splits on whitespace. */\n mode === \"tree\" && \"ps-[calc(var(--cascader-row-inset,8px)_+_var(--cascader-indent,0px))]!\",\n className,\n ),\n };\n\n if (as === \"button\") {\n const buttonProps = { ...(props as React.ComponentProps<\"button\">) };\n // `role=\"button\"` allows none of these, so they are dropped, not passed.\n delete buttonProps[\"aria-setsize\"];\n delete buttonProps[\"aria-posinset\"];\n delete buttonProps[\"aria-level\"];\n\n return (\n <button\n type=\"button\"\n {...shared}\n /* Focus stays in the search input; the trail uses ArrowLeft. */\n tabIndex={-1}\n disabled={node.disabled}\n aria-disabled={node.disabled || undefined}\n onClick={handleButtonClick}\n onMouseDown={handleButtonMouseDown}\n {...buttonProps}\n >\n {body}\n </button>\n );\n }\n\n return (\n <ComboboxPrimitive.Item\n {...shared}\n value={node}\n /* THE one gate for the explicit index: supply one outside virtualized mode\n and the first arrow key leaves `aria-activedescendant` pointing at\n nothing. */\n {...(virtualized && index != null ? { index } : null)}\n disabled={node.disabled}\n /* Conditional spread, never `role={... : undefined}`: `mergeProps`\n iterates own keys, so `undefined` would delete `role=\"option\"`. */\n {...(mode === \"tree\"\n ? {\n role: \"treeitem\" as const,\n \"aria-level\": nodeDepth + 1,\n ...(branch ? { \"aria-expanded\": !!expanded } : null),\n }\n : branch\n ? { \"aria-haspopup\": \"listbox\" as const }\n : null)}\n /* Only ever `mixed`: a selected row already says so with `aria-selected`,\n and two selection attributes on one row is noise. */\n {...(indeterminate ? { \"aria-checked\": \"mixed\" as const } : null)}\n {...(hoverNavigates\n ? {\n onPointerEnter: handleHoverPointerEnter,\n onPointerLeave: cancelHoverNavigate,\n }\n : null)}\n onClick={handleClick}\n onMouseUp={handleMouseUp}\n {...props}\n >\n {body}\n </ComboboxPrimitive.Item>\n );\n});\n\n/** Ancestor chain under a deep-search result: \"Name\" alone is ambiguous. */\nfunction CascaderItemPath({ node }: { node: CascaderNode }) {\n const { index, labels } = useCascaderActions();\n const ancestors = getCascaderPath(index, node.value).slice(0, -1);\n if (!ancestors.length) return null;\n\n return (\n <span\n data-slot=\"cascader-item-path\"\n className=\"flex w-full items-center gap-0.5 truncate text-start text-muted-foreground text-xs\"\n >\n {ancestors.map((ancestor, i) => (\n <React.Fragment key={ancestor.value}>\n {i > 0 ? <span aria-hidden=\"true\">{labels.pathSeparator}</span> : null}\n <span className=\"truncate\">{ancestor.label}</span>\n </React.Fragment>\n ))}\n </span>\n );\n}\n\n/** Every load-derived prop a row needs. A PAGING row reports the level it\n * belongs to, a BRANCH row the level it OWNS; mutually exclusive, so one call\n * answers both. Exported because a memoised row cannot read them itself. */\nexport function getCascaderMoreProps(\n node: CascaderNode,\n loadStates: ReadonlyMap<string, CascaderLoadState>,\n): {\n loading: boolean;\n error: boolean;\n childrenLoading: boolean;\n childrenError: boolean;\n} {\n const parent = getCascaderMoreParent(node);\n if (parent == null) {\n const own = loadStates.get(node.value);\n return {\n loading: false,\n error: false,\n childrenLoading: !!own?.loading,\n childrenError: !!own?.error,\n };\n }\n const state = loadStates.get(parent);\n return {\n loading: !!state?.loading,\n error: !!state?.error,\n childrenLoading: false,\n childrenError: false,\n };\n}\n\nexport interface CascaderItemsProps {\n /** Replaces the default row for every item. */\n children?: (node: CascaderNode, index: number) => React.ReactNode;\n}\n\n/** Whatever the active view is: the current level, the deepest column, or the\n * flattened tree rows. Lives here so `cascader.tsx` never imports a row\n * component, which would cycle with the context. `index` is deliberately not\n * passed; see `CascaderItemProps`. */\nfunction CascaderItems({ children }: CascaderItemsProps) {\n const { mode, isBranch, isSelectable, isSelected, isIndeterminate } = useCascaderActions();\n const { renderedItems, deepResults, treeRows, loadStates } = useCascaderState();\n const showPath = deepResults !== null;\n\n // Answered once here, as plain booleans, so `React.memo` can skip a row.\n if (mode === \"tree\") {\n return (\n <>\n {treeRows.map((row, i) =>\n children ? (\n <React.Fragment key={row.node.value}>{children(row.node, i)}</React.Fragment>\n ) : (\n <CascaderItem\n key={row.node.value}\n node={row.node}\n depth={row.depth}\n expanded={row.expanded}\n branch={row.branch}\n selectable={isSelectable(row.node)}\n selected={isSelected(row.node)}\n indeterminate={isIndeterminate(row.node)}\n {...getCascaderMoreProps(row.node, loadStates)}\n aria-setsize={row.setSize}\n aria-posinset={row.posInSet}\n />\n ),\n )}\n </>\n );\n }\n\n return (\n <>\n {renderedItems.map((node, i) =>\n children ? (\n <React.Fragment key={node.value}>{children(node, i)}</React.Fragment>\n ) : (\n <CascaderItem\n key={node.value}\n node={node}\n showPath={showPath}\n branch={isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n aria-setsize={renderedItems.length}\n aria-posinset={i + 1}\n />\n ),\n )}\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Group / Label / Separator */\n/* -------------------------------------------------------------------------- */\n\n// Whether a `CascaderLabel` has a group to name: Base UI's `Combobox.GroupLabel`\n// THROWS when there is none, and a heading is useful outside a group.\nconst CascaderGroupContext = React.createContext(false);\n\n// A heading over a run of rows. All eight styles are spelled out because the\n// type is not uniform (sera is uppercase), and the inset is the row's own.\nconst CASCADER_LABEL_CLASS = `text-muted-foreground text-xs py-1.5 ${CASCADER_ACTION_INSET_CLASS} block truncate`;\n\n// A rule between two runs. The inline margin is not the combobox separator's:\n// that cancels the container's padding with a per-style number, wrong in a\n// footer and 4px too much in lyra. `--cascader-list-pad` reaches the edge.\nconst CASCADER_SEPARATOR_CLASS =\n \"h-px bg-border my-1 mx-[calc(var(--cascader-list-pad,4px)*-1)]! shrink-0\";\n\nexport interface CascaderGroupProps extends Omit<ComboboxPrimitive.Group.Props, \"className\"> {\n /** Base UI also accepts a state callback here; the group has no state. */\n className?: string;\n}\n\n/** A run of related rows, named by the `CascaderLabel` inside it: the group is\n * `role=\"group\"` and Base UI points its `aria-labelledby` at the label, where a\n * heading alone inside a listbox is dropped from the accessibility tree.\n * Grouping is composition, not data: `CascaderItems` renders one flat run per\n * level, so its indices line up with `listRef`. */\nfunction CascaderGroup({ className, ...props }: CascaderGroupProps) {\n return (\n <CascaderGroupContext.Provider value={true}>\n <ComboboxPrimitive.Group\n data-slot=\"cascader-group\"\n className={cn(\"flex flex-col\", className)}\n {...props}\n />\n </CascaderGroupContext.Provider>\n );\n}\n\nexport interface CascaderLabelProps\n extends Omit<ComboboxPrimitive.GroupLabel.Props, \"className\" | \"style\"> {\n /** No state callback; outside a group this is not a Base UI part at all. */\n className?: string;\n style?: React.CSSProperties;\n}\n\n/** Inside a group: the real thing, with the id association Base UI wires up. */\nfunction CascaderGroupLabel({ className, ...props }: CascaderLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"cascader-label\"\n className={cn(CASCADER_LABEL_CLASS, className)}\n {...props}\n />\n );\n}\n\n// Outside a group: the same heading as a plain element. A separate component\n// rather than a branch, so the hook count cannot change when a label moves in.\nfunction CascaderPlainLabel({ className, ...props }: CascaderLabelProps) {\n const defaultProps = {\n \"data-slot\": \"cascader-label\",\n className: cn(CASCADER_LABEL_CLASS, className),\n };\n\n return useRender({\n defaultTagName: \"div\",\n render: props.render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\n/** A heading. Inside `CascaderGroup` it is the group's accessible name; outside\n * one (the footer flyout is a menu, not a listbox) it is decoration only. */\nfunction CascaderLabel(props: CascaderLabelProps) {\n const grouped = React.useContext(CascaderGroupContext);\n return grouped ? <CascaderGroupLabel {...props} /> : <CascaderPlainLabel {...props} />;\n}\n\nexport interface CascaderSeparatorProps\n extends Omit<ComboboxPrimitive.Separator.Props, \"className\"> {\n /** Base UI also accepts a state callback here; only the orientation varies. */\n className?: string;\n}\n\n/** Decorative on purpose: Base UI's separator is `role=\"separator\"`, which a\n * `listbox` may not own, and a run that needs separating for a screen reader\n * needs a `CascaderGroup`, not a line. A consumer can pass the role back. */\nfunction CascaderSeparator({ className, ...props }: CascaderSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"cascader-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(CASCADER_SEPARATOR_CLASS, className)}\n {...props}\n />\n );\n}\n\nexport { CascaderGroup, CascaderItem, CascaderItems, CascaderLabel, CascaderSeparator };\n"],"mappings":";;;;;;;;;;;;AAoCA,MAAM,kBAAkB;AAIxB,MAAM,kBAAkB;AAKxB,MAAM,mBACJ;AAKF,MAAM,kBACJ;AAIF,MAAM,kBACJ;;;;;;;;;AAUF,MAAM,gBAAgB;AAEtB,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB,GAAG,gBAAgB,uLAAuL;AAElO,MAAM,YAAY,GAAG,gBAAgB,GAAG,cAAc,GAAG;AAEzD,MAAM,8BAA8B,GAAG,gBAAgB,GAAG;;;;;;;;AAS1D,MAAa,wBAAwB,GAAG,gBAAgB,GAAG,eAAe,GAAG,gBAAgB;AAI7F,MAAM,uBAAuB;AAK7B,MAAM,yBACJ;AAOF,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAK7B,MAAM,8BAA8B;;;AAwDpC,MAAM,eAAeA,QAAM,KAAK,SAAS,aAAa,EACpD,MACA,OACA,OACA,WAAW,OACX,KAAK,UACL,UACA,SAAS,IACT,QAAQ,YACR,YAAY,gBACZ,UAAU,cACV,eAAe,mBACf,eAAe,mBACf,SACA,OACA,kBAAkB,OAClB,gBAAgB,OAChB,WACA,UACA,SACA,WACA,OACA,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AC,oBAAD,EAAoB,GAAI,MAAQ,CAAA,IAAI,oBAAC,oBAAD,EAAoB,GAAI,MAAQ,CAAA;AACvF;;;;AAWA,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;CAC1E,OACE,oBAACC,SAAkB,WAAnB;EACE,aAAU;EACV,MAAK;EACL,eAAY;EACZ,WAAW,GAAG,0BAA0B,SAAS;EACjD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { _ as CascaderSelectable, a as CascaderFlatNode, i as CascaderCollapse, m as CascaderPathSegment, o as CascaderIndex, p as CascaderNode } from "../../../cascader-types-BnH6wYD-.js";
|
|
2
|
+
//#region src/components/reui/cascader/cascader-lib.d.ts
|
|
3
|
+
/** Root level key in `childrenOf`. NUL-prefixed so no real value collides. */
|
|
4
|
+
declare const CASCADER_ROOT_KEY = "\0root";
|
|
5
|
+
/**
|
|
6
|
+
* Paging pseudo-node prefix. Written as an escape sequence, not a raw 0x00
|
|
7
|
+
* byte: a literal NUL makes this module read as binary and `grep -I` skips it.
|
|
8
|
+
*/
|
|
9
|
+
declare const CASCADER_MORE_PREFIX = "\0more:";
|
|
10
|
+
/**
|
|
11
|
+
* The four scroll classes. In the lib because `cascader-columns.tsx` needs them
|
|
12
|
+
* too and must not import `cascader.tsx`. Shell > bound > scrollport > rows.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The bound. `min()` over an undefined custom property is an INVALID
|
|
16
|
+
* declaration that drops the whole max-height, hence the `100vh` fallback: an
|
|
17
|
+
* inline panel has no positioner, so no `--available-height`. `24rem` is the
|
|
18
|
+
* default cap, so the common case sets no variable at all.
|
|
19
|
+
*/
|
|
20
|
+
declare const CASCADER_LIST_HEIGHT_CLASS = "max-h-[min(var(--available-height,100vh),var(--cascader-max-height,24rem))]";
|
|
21
|
+
/**
|
|
22
|
+
* Each style's list padding: rows take it as `padding`, the scrollport as
|
|
23
|
+
* `scroll-padding` floored at 4px so lyra's `0` does not strand a row.
|
|
24
|
+
* Mirrored per style from `registry/styles/style-*.css`; keep them in step.
|
|
25
|
+
*/
|
|
26
|
+
declare const CASCADER_LIST_PAD_CLASS = "[--cascader-list-pad:4px]";
|
|
27
|
+
/** The scrollport: a `max-h-*` on the ScrollArea ROOT bounds nothing. */
|
|
28
|
+
declare const CASCADER_SCROLL_CLASS = "size-full min-h-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain **:data-[slot=scroll-area-viewport]:scroll-py-[max(var(--cascader-list-pad,4px),4px)]";
|
|
29
|
+
/** The rows' box; `data-empty:p-0` keeps an empty state from double inset. */
|
|
30
|
+
declare const CASCADER_ROWS_CLASS = "p-(--cascader-list-pad,4px) data-empty:p-0";
|
|
31
|
+
/** The footer's own stops; an `aria-disabled` command still counts as one. */
|
|
32
|
+
declare function getCascaderFooterStops(scope: HTMLElement): HTMLElement[];
|
|
33
|
+
/** Where Tab lands, or `null` to let the browser out: focus is never trapped. */
|
|
34
|
+
declare function getCascaderTabTarget(panel: HTMLElement, from: Element | null, backwards: boolean): HTMLElement | null;
|
|
35
|
+
/**
|
|
36
|
+
* The writing direction at `element`. `DirectionProvider` may only vote yes:
|
|
37
|
+
* unmounted it answers `"ltr"`, which would override a real `<html dir="rtl">`.
|
|
38
|
+
*/
|
|
39
|
+
declare function isCascaderRtl(element: Element, provided: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The paging row as a REAL node, not a DOM-only row after the list: every index
|
|
42
|
+
* Base UI hands out indexes the RENDERED array, so a DOM-only row shifts them.
|
|
43
|
+
*/
|
|
44
|
+
declare function createCascaderMoreNode<T = unknown>(parentKey: string, loadedCount?: number): CascaderNode<T>;
|
|
45
|
+
declare function isCascaderMoreNode<T>(node: CascaderNode<T>): boolean;
|
|
46
|
+
/** The level key a paging pseudo-node belongs to, or `null` for a real node. */
|
|
47
|
+
declare function getCascaderMoreParent<T>(node: CascaderNode<T>): string | null;
|
|
48
|
+
/** Either input shape into one index. Cycle-guarded depths; first wins. */
|
|
49
|
+
declare function buildCascaderIndex<T = unknown>(items: readonly CascaderNode<T>[] | undefined, getParent?: (node: CascaderNode<T>) => string | null | undefined): CascaderIndex<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Folds loaded pages into an index built from `items`, so a re-render with a
|
|
52
|
+
* new `items` array keeps what the user drilled into. Static `items` wins;
|
|
53
|
+
* `detached` is `byValue` ONLY, or deep search doubles it and `childrenOf` lies.
|
|
54
|
+
*/
|
|
55
|
+
declare function mergeCascaderIndex<T = unknown>(base: CascaderIndex<T>, pages: ReadonlyMap<string, readonly CascaderNode<T>[]>, detached?: ReadonlyMap<string, CascaderNode<T>>): CascaderIndex<T>;
|
|
56
|
+
/** Children of `parent`, or the root level when `parent` is nullish. */
|
|
57
|
+
declare function getCascaderChildren<T>(index: CascaderIndex<T>, parent?: string | null): CascaderNode<T>[];
|
|
58
|
+
/** A branch has known children, or `hasChildren` for an unfetched level. */
|
|
59
|
+
declare function isCascaderBranch<T>(index: CascaderIndex<T>, node: CascaderNode<T>): boolean;
|
|
60
|
+
/** Trailing count for the default row. Explicit `count` wins over the tree. */
|
|
61
|
+
declare function getCascaderCount<T>(index: CascaderIndex<T>, node: CascaderNode<T>): number;
|
|
62
|
+
/** Whether a node may be committed as a selection. */
|
|
63
|
+
declare function isCascaderSelectable<T>(index: CascaderIndex<T>, node: CascaderNode<T>, selectable: CascaderSelectable<T>): boolean;
|
|
64
|
+
/** Ancestor chain for `value`, root first. Empty while async data loads. */
|
|
65
|
+
declare function getCascaderPath<T>(index: CascaderIndex<T>, value: string | null | undefined): CascaderNode<T>[];
|
|
66
|
+
/**
|
|
67
|
+
* `toLocaleLowerCase`, not `toLowerCase`: the invariant mapping turns Turkish
|
|
68
|
+
* "I" into "i" not "ı", so "ışık" would never match "IŞIK". Both sides fold here.
|
|
69
|
+
*/
|
|
70
|
+
declare function foldCascaderText(text: string): string;
|
|
71
|
+
/** Folds once so callers can hoist the cost out of a per-node loop. */
|
|
72
|
+
declare function normalizeCascaderQuery(query: string): string;
|
|
73
|
+
/** Case-insensitive substring over label and keywords; pre-fold the query. */
|
|
74
|
+
declare function matchesCascaderQuery<T>(node: CascaderNode<T>, normalized: string): boolean;
|
|
75
|
+
/** Filters one level in place-order. Returns the input when the query is empty. */
|
|
76
|
+
declare function filterCascaderLevel<T>(nodes: readonly CascaderNode<T>[], query: string, matches?: (node: CascaderNode<T>, normalized: string) => boolean): CascaderNode<T>[];
|
|
77
|
+
/** Searches every node, optionally under `within`, in one pass over `all`. */
|
|
78
|
+
declare function searchCascaderDeep<T>(index: CascaderIndex<T>, query: string, options?: {
|
|
79
|
+
within?: string | null;
|
|
80
|
+
limit?: number;
|
|
81
|
+
matches?: (node: CascaderNode<T>, normalized: string) => boolean;
|
|
82
|
+
}): CascaderNode<T>[];
|
|
83
|
+
/**
|
|
84
|
+
* Flattens the tree into tree mode's visible rows. A `sentinels` paging row
|
|
85
|
+
* COUNTS as a sibling in `aria-setsize`: it holds an index of its own.
|
|
86
|
+
*/
|
|
87
|
+
declare function flattenCascaderTree<T>(index: CascaderIndex<T>, expanded: ReadonlySet<string>, sentinels?: ReadonlySet<string>): CascaderFlatNode<T>[];
|
|
88
|
+
/** Shortens a path; the ellipsis segment still carries the hidden nodes. */
|
|
89
|
+
declare function collapseCascaderPath<T>(path: readonly CascaderNode<T>[], options?: {
|
|
90
|
+
maxSegments?: number;
|
|
91
|
+
collapse?: CascaderCollapse;
|
|
92
|
+
}): CascaderPathSegment<T>[];
|
|
93
|
+
/**
|
|
94
|
+
* Every LOADED node under `value`, root first. Reaching an unfetched descendant
|
|
95
|
+
* would mean a network request per level of the subtree on every selection.
|
|
96
|
+
*/
|
|
97
|
+
declare function collectCascaderSubtree<T>(index: CascaderIndex<T>, value: string): CascaderNode<T>[];
|
|
98
|
+
/**
|
|
99
|
+
* Toggles `value` with its loaded subtree, then reconciles ancestors. One flat
|
|
100
|
+
* array, no hidden "checked" state: a branch is in the selection exactly when
|
|
101
|
+
* every selectable loaded child of it is, which keeps a row's checked state an
|
|
102
|
+
* O(1) lookup. Nodes `isSelectable` rejects are skipped down AND ignored up,
|
|
103
|
+
* the pressed node excepted.
|
|
104
|
+
*/
|
|
105
|
+
declare function applyCascadeSelection<T>(index: CascaderIndex<T>, selected: readonly string[], value: string, select: boolean, isSelectable?: (node: CascaderNode<T>) => boolean): string[];
|
|
106
|
+
/**
|
|
107
|
+
* How many selected nodes each value has BELOW it, itself excluded. Walks UP
|
|
108
|
+
* from each selection: a per-row subtree scan would be quadratic and re-paid.
|
|
109
|
+
*/
|
|
110
|
+
declare function getCascaderSelectedDescendants<T>(index: CascaderIndex<T>, selected: readonly string[]): Map<string, number>;
|
|
111
|
+
/** The PARTIALLY selected values, read off counts the caller already holds. */
|
|
112
|
+
declare function getCascaderIndeterminateFrom(counts: ReadonlyMap<string, number>, selected: readonly string[]): Set<string>;
|
|
113
|
+
/** The one-call form; the root uses the two halves above and its own counts. */
|
|
114
|
+
declare function getCascaderIndeterminate<T>(index: CascaderIndex<T>, selected: readonly string[]): Set<string>;
|
|
115
|
+
/** How `getCascaderCheckedValues` condenses a full-closure selection. */
|
|
116
|
+
type CascaderCheckedStrategy = "all" | "parent" | "child";
|
|
117
|
+
/**
|
|
118
|
+
* The cascade selection under a reporting strategy. DERIVED OUTPUT ONLY: the
|
|
119
|
+
* STORED value stays the full closure, which keeps a checked state an O(1)
|
|
120
|
+
* lookup. `"all"` is the closure; `"parent"` drops a value whose parent is
|
|
121
|
+
* selected; `"child"` drops one with a selected child.
|
|
122
|
+
*/
|
|
123
|
+
declare function getCascaderCheckedValues<T>(index: CascaderIndex<T>, selected: readonly string[], strategy: CascaderCheckedStrategy): readonly string[];
|
|
124
|
+
/** Values in `nodes` whose label collides, so the chip must show its path. */
|
|
125
|
+
declare function findAmbiguousCascaderLabels<T>(nodes: readonly CascaderNode<T>[]): Set<string>;
|
|
126
|
+
/** Warns once per `key`, never in production, never by throwing. */
|
|
127
|
+
declare function warnCascaderOnce(key: string, message: string): void;
|
|
128
|
+
/** Empties the ledger. Tests only; a warning is meant to be seen once. */
|
|
129
|
+
declare function resetCascaderWarnings(): void;
|
|
130
|
+
/** What a dev-time scan of the consumer's `items` found wrong with it. */
|
|
131
|
+
interface CascaderDataIssues {
|
|
132
|
+
/** Values appearing more than once. First wins, so a duplicate drops a row. */
|
|
133
|
+
duplicates: string[];
|
|
134
|
+
/** Values on a `getParent` cycle. Depth is clamped, so the tree reads wrong. */
|
|
135
|
+
cycles: string[];
|
|
136
|
+
}
|
|
137
|
+
/** Dev-time scan, kept out of `buildCascaderIndex` so the build stays hot. */
|
|
138
|
+
declare function findCascaderDataIssues<T>(items: readonly CascaderNode<T>[] | undefined, getParent?: (node: CascaderNode<T>) => string | null | undefined): CascaderDataIssues;
|
|
139
|
+
//#endregion
|
|
140
|
+
export { CASCADER_LIST_HEIGHT_CLASS, CASCADER_LIST_PAD_CLASS, CASCADER_MORE_PREFIX, CASCADER_ROOT_KEY, CASCADER_ROWS_CLASS, CASCADER_SCROLL_CLASS, CascaderCheckedStrategy, CascaderDataIssues, applyCascadeSelection, buildCascaderIndex, collapseCascaderPath, collectCascaderSubtree, createCascaderMoreNode, filterCascaderLevel, findAmbiguousCascaderLabels, findCascaderDataIssues, flattenCascaderTree, foldCascaderText, getCascaderCheckedValues, getCascaderChildren, getCascaderCount, getCascaderFooterStops, getCascaderIndeterminate, getCascaderIndeterminateFrom, getCascaderMoreParent, getCascaderPath, getCascaderSelectedDescendants, getCascaderTabTarget, isCascaderBranch, isCascaderMoreNode, isCascaderRtl, isCascaderSelectable, matchesCascaderQuery, mergeCascaderIndex, normalizeCascaderQuery, resetCascaderWarnings, searchCascaderDeep, warnCascaderOnce };
|
|
141
|
+
//# sourceMappingURL=cascader-lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cascader-lib.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-lib.tsx"],"m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