@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.
Files changed (186) hide show
  1. package/README.md +26 -25
  2. package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
  3. package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
  4. package/dist/components/agents/ai-sidebar.js +3 -5
  5. package/dist/components/agents/ai-sidebar.js.map +1 -1
  6. package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
  7. package/dist/components/motion/animated-sidebar.js +12 -3
  8. package/dist/components/motion/animated-sidebar.js.map +1 -1
  9. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  10. package/dist/components/motion/attachment-upload.js +9 -5
  11. package/dist/components/motion/attachment-upload.js.map +1 -1
  12. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  13. package/dist/components/motion/bottom-sheet.js +77 -74
  14. package/dist/components/motion/bottom-sheet.js.map +1 -1
  15. package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
  16. package/dist/components/motion/center-morph-modal.js +82 -88
  17. package/dist/components/motion/center-morph-modal.js.map +1 -1
  18. package/dist/components/motion/combobox/content.js +1 -1
  19. package/dist/components/motion/combobox/context.d.ts +6 -0
  20. package/dist/components/motion/combobox/context.d.ts.map +1 -1
  21. package/dist/components/motion/combobox/context.js +1 -233
  22. package/dist/components/motion/combobox/list.js +1 -1
  23. package/dist/components/motion/combobox/trigger.js +7 -8
  24. package/dist/components/motion/combobox/trigger.js.map +1 -1
  25. package/dist/components/motion/combobox.js +1 -1
  26. package/dist/components/motion/command-palette.d.ts.map +1 -1
  27. package/dist/components/motion/command-palette.js +62 -45
  28. package/dist/components/motion/command-palette.js.map +1 -1
  29. package/dist/components/motion/drawer.d.ts.map +1 -1
  30. package/dist/components/motion/drawer.js +30 -30
  31. package/dist/components/motion/drawer.js.map +1 -1
  32. package/dist/components/motion/loader.js +20 -22
  33. package/dist/components/motion/loader.js.map +1 -1
  34. package/dist/components/motion/morphing-modal.d.ts.map +1 -1
  35. package/dist/components/motion/morphing-modal.js +83 -83
  36. package/dist/components/motion/morphing-modal.js.map +1 -1
  37. package/dist/components/motion/morphing-search.d.ts +28 -0
  38. package/dist/components/motion/morphing-search.d.ts.map +1 -0
  39. package/dist/components/motion/morphing-search.js +422 -0
  40. package/dist/components/motion/morphing-search.js.map +1 -0
  41. package/dist/components/motion/project-folder.js +20 -20
  42. package/dist/components/motion/project-folder.js.map +1 -1
  43. package/dist/components/reui/alert.d.ts +1 -1
  44. package/dist/components/reui/badge.d.ts +1 -1
  45. package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
  46. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
  47. package/dist/components/reui/cascader/cascader-async.js +549 -0
  48. package/dist/components/reui/cascader/cascader-async.js.map +1 -0
  49. package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
  50. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
  51. package/dist/components/reui/cascader/cascader-columns.js +135 -0
  52. package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
  53. package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
  54. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
  55. package/dist/components/reui/cascader/cascader-context.js +59 -0
  56. package/dist/components/reui/cascader/cascader-context.js.map +1 -0
  57. package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
  58. package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
  59. package/dist/components/reui/cascader/cascader-footer.js +456 -0
  60. package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
  61. package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
  62. package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
  63. package/dist/components/reui/cascader/cascader-i18n.js +68 -0
  64. package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
  65. package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
  66. package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
  67. package/dist/components/reui/cascader/cascader-item.js +530 -0
  68. package/dist/components/reui/cascader/cascader-item.js.map +1 -0
  69. package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
  70. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
  71. package/dist/components/reui/cascader/cascader-lib.js +576 -0
  72. package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
  73. package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
  74. package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
  75. package/dist/components/reui/cascader/cascader-nav.js +312 -0
  76. package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
  77. package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
  78. package/dist/components/reui/cascader/cascader-types.js +2 -0
  79. package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
  80. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
  81. package/dist/components/reui/cascader/cascader-virtual.js +240 -0
  82. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
  83. package/dist/components/reui/cascader/cascader.d.ts +322 -0
  84. package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
  85. package/dist/components/reui/cascader/cascader.js +1459 -0
  86. package/dist/components/reui/cascader/cascader.js.map +1 -0
  87. package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
  88. package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
  89. package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
  90. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  91. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  92. package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
  93. package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
  94. package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
  95. package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
  96. package/dist/components/reui/filters/filters-advanced.js +1191 -0
  97. package/dist/components/reui/filters/filters-advanced.js.map +1 -0
  98. package/dist/components/reui/filters/filters-builder.d.ts +43 -0
  99. package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
  100. package/dist/components/reui/filters/filters-builder.js +152 -0
  101. package/dist/components/reui/filters/filters-builder.js.map +1 -0
  102. package/dist/components/reui/filters/filters-chip.d.ts +79 -0
  103. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
  104. package/dist/components/reui/filters/filters-chip.js +553 -0
  105. package/dist/components/reui/filters/filters-chip.js.map +1 -0
  106. package/dist/components/reui/filters/filters-context.d.ts +290 -0
  107. package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
  108. package/dist/components/reui/filters/filters-context.js +277 -0
  109. package/dist/components/reui/filters/filters-context.js.map +1 -0
  110. package/dist/components/reui/filters/filters-date.d.ts +43 -0
  111. package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
  112. package/dist/components/reui/filters/filters-date.js +143 -0
  113. package/dist/components/reui/filters/filters-date.js.map +1 -0
  114. package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
  115. package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
  116. package/dist/components/reui/filters/filters-dnd.js +454 -0
  117. package/dist/components/reui/filters/filters-dnd.js.map +1 -0
  118. package/dist/components/reui/filters/filters-draft.d.ts +2 -0
  119. package/dist/components/reui/filters/filters-draft.js +128 -0
  120. package/dist/components/reui/filters/filters-draft.js.map +1 -0
  121. package/dist/components/reui/filters/filters-editors.d.ts +91 -0
  122. package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
  123. package/dist/components/reui/filters/filters-editors.js +773 -0
  124. package/dist/components/reui/filters/filters-editors.js.map +1 -0
  125. package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
  126. package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
  127. package/dist/components/reui/filters/filters-i18n.js +127 -0
  128. package/dist/components/reui/filters/filters-i18n.js.map +1 -0
  129. package/dist/components/reui/filters/filters-lib.d.ts +171 -0
  130. package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
  131. package/dist/components/reui/filters/filters-lib.js +336 -0
  132. package/dist/components/reui/filters/filters-lib.js.map +1 -0
  133. package/dist/components/reui/filters/filters-operators.d.ts +49 -0
  134. package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
  135. package/dist/components/reui/filters/filters-operators.js +300 -0
  136. package/dist/components/reui/filters/filters-operators.js.map +1 -0
  137. package/dist/components/reui/filters/filters-query.d.ts +132 -0
  138. package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
  139. package/dist/components/reui/filters/filters-query.js +476 -0
  140. package/dist/components/reui/filters/filters-query.js.map +1 -0
  141. package/dist/components/reui/filters/filters-types.d.ts +452 -0
  142. package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
  143. package/dist/components/reui/filters/filters-types.js +2 -0
  144. package/dist/components/reui/filters/filters.d.ts +114 -0
  145. package/dist/components/reui/filters/filters.d.ts.map +1 -0
  146. package/dist/components/reui/filters/filters.js +638 -0
  147. package/dist/components/reui/filters/filters.js.map +1 -0
  148. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  149. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  150. package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
  151. package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
  152. package/dist/components/reui/gantt/gantt-view.js +1 -1
  153. package/dist/components/ui/button.d.ts +1 -1
  154. package/dist/components/ui/checkbox.js +1 -1
  155. package/dist/components/ui/checkbox.js.map +1 -1
  156. package/dist/components/ui/field.js +2 -2
  157. package/dist/components/ui/field.js.map +1 -1
  158. package/dist/components/ui/radio-group.js +1 -1
  159. package/dist/components/ui/radio-group.js.map +1 -1
  160. package/dist/components/ui/sidebar.js +1 -1
  161. package/dist/components/ui/switch.js +1 -1
  162. package/dist/components/ui/switch.js.map +1 -1
  163. package/dist/context-BizvUNZv.js +298 -0
  164. package/dist/context-BizvUNZv.js.map +1 -0
  165. package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
  166. package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
  167. package/dist/hooks/use-on-open.d.ts +18 -0
  168. package/dist/hooks/use-on-open.d.ts.map +1 -0
  169. package/dist/hooks/use-on-open.js +27 -0
  170. package/dist/hooks/use-on-open.js.map +1 -0
  171. package/dist/hooks/use-row-cursor.d.ts +39 -0
  172. package/dist/hooks/use-row-cursor.d.ts.map +1 -0
  173. package/dist/hooks/use-row-cursor.js +77 -0
  174. package/dist/hooks/use-row-cursor.js.map +1 -0
  175. package/dist/lib/text-shimmer.d.ts +2 -2
  176. package/dist/lib/text-shimmer.d.ts.map +1 -1
  177. package/dist/lib/text-shimmer.js +2 -2
  178. package/dist/lib/text-shimmer.js.map +1 -1
  179. package/dist/presence-gate-BekdC4Bo.js +24 -0
  180. package/dist/presence-gate-BekdC4Bo.js.map +1 -0
  181. package/package.json +11 -11
  182. package/dist/components/motion/combobox/context.js.map +0 -1
  183. package/dist/components/reui/filters.d.ts +0 -176
  184. package/dist/components/reui/filters.d.ts.map +0 -1
  185. package/dist/components/reui/filters.js +0 -1223
  186. package/dist/components/reui/filters.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ import { i as CascaderCollapse, p as CascaderNode, v as CascaderValueDisplay } from "../../../cascader-types-BnH6wYD-.js";
2
+ import * as React$1 from "react";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ import { Combobox } from "@base-ui/react";
5
+ //#region src/components/reui/cascader/cascader-nav.d.ts
6
+ type CascaderNavProps = useRender.ComponentProps<"div">;
7
+ /**
8
+ * Header: back control, search input, and the separator under them. The
9
+ * breadcrumb belongs with the list below: it describes the rows, not the field.
10
+ */
11
+ declare function CascaderNav({ className, ...props }: CascaderNavProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
12
+ interface CascaderBackProps extends Omit<useRender.ComponentProps<"button">, "children"> {
13
+ children?: React$1.ReactNode;
14
+ }
15
+ /** Pops one level. Renders nothing at the root, so no dead header space. */
16
+ declare function CascaderBack({ className, children, ...props }: CascaderBackProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | null;
17
+ interface CascaderBreadcrumbProps extends Omit<useRender.ComponentProps<"nav">, "children"> {
18
+ /** Maximum visible node segments before the middle collapses. */
19
+ maxSegments?: number;
20
+ collapse?: CascaderCollapse;
21
+ /** Clicking a segment navigates back to that level. Defaults to true. */
22
+ interactive?: boolean;
23
+ }
24
+ /**
25
+ * Compact trail of the current level AND its ancestors, collapsed by the same
26
+ * helper as `CascaderValue` so panel and trigger cannot disagree. The current
27
+ * level IS the last crumb: dropping it read as a rendering bug, a trail naming
28
+ * only the places you are not.
29
+ */
30
+ declare function CascaderBreadcrumb({ className, maxSegments, collapse, interactive, ...props }: CascaderBreadcrumbProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | null;
31
+ interface CascaderInputProps extends Combobox.Input.Props {
32
+ /** Renders the back control inline, before the field. Defaults to true. */
33
+ showBack?: boolean;
34
+ }
35
+ /**
36
+ * Search field. MUST render inside the positioner: only there does Base UI skip
37
+ * the refill from the committed selection that would fight every level swap.
38
+ */
39
+ declare function CascaderInput({ className, showBack, placeholder, onKeyDown, "aria-describedby": ariaDescribedBy, ...props }: CascaderInputProps): React$1.JSX.Element;
40
+ interface CascaderValueProps extends Omit<useRender.ComponentProps<"span">, "children"> {
41
+ /** `path` shows the full trail, `leaf` only the node, `count` only a total. */
42
+ display?: CascaderValueDisplay;
43
+ maxSegments?: number;
44
+ collapse?: CascaderCollapse;
45
+ separator?: React$1.ReactNode;
46
+ /** Renders the selected node's icon before the trail. */
47
+ showIcon?: boolean;
48
+ placeholder?: React$1.ReactNode;
49
+ /** Replaces the whole rendering. Receives the resolved selection and path. */
50
+ children?: (selected: CascaderNode[], path: CascaderNode[]) => React$1.ReactNode;
51
+ }
52
+ /**
53
+ * Trigger display. Defaults to the collapsed selection path rather than a bare
54
+ * leaf label, which in a nested picker is frequently ambiguous.
55
+ */
56
+ declare function CascaderValue({ className, display, maxSegments, collapse, separator, showIcon, placeholder, children, ...props }: CascaderValueProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
57
+ //#endregion
58
+ export { CascaderBack, CascaderBackProps, CascaderBreadcrumb, CascaderBreadcrumbProps, CascaderInput, CascaderInputProps, CascaderNav, CascaderNavProps, CascaderValue, CascaderValueProps };
59
+ //# sourceMappingURL=cascader-nav.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-nav.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-nav.tsx"],"mappings":";;;;;KAgCY,mBAAmB,UAAU;;;;;iBAMhC,cAAc,cAAc,SAAS,mBAAgB,QAAA,+BAAA,QAAA;UAsB7C,0BAA0B,KAAK,UAAU;EACxD,WAAW,QAAM;;;iBAIV,eAAe,WAAW,aAAa,SAAS,oBAAiB,QAAA,+BAAA,QAAA;UAmCzD,gCAAgC,KAAK,UAAU;;EAE9D;EACA,WAAW;;EAEX;;;;;;;;iBASO,qBACP,WACA,aACA,UACA,gBACG,SACF,0BAAuB,QAAA,+BAAA,QAAA;UAqFT,2BAA2B,SAAkB,MAAM;;EAElE;;;;;;iBAUO,gBACP,WACA,UACA,aACA,+BACoB,oBACjB,SACF,qBAAkB,QAAA,IAAA;UA+OJ,2BAA2B,KAAK,UAAU;;EAEzD,UAAU;EACV;EACA,WAAW;EACX,YAAY,QAAM;;EAElB;EACA,cAAc,QAAM;;EAEpB,YAAY,UAAU,gBAAgB,MAAM,mBAAmB,QAAM;;;;;;iBAO9D,gBACP,WACA,SACA,aACA,UACA,WACA,UACA,aACA,aACG,SACF,qBAAkB,QAAA,+BAAA,QAAA"}
@@ -0,0 +1,312 @@
1
+ "use client";
2
+ import { useCascaderActions, useCascaderState } from "./cascader-context.js";
3
+ import { collapseCascaderPath, getCascaderFooterStops, getCascaderPath, isCascaderRtl } from "./cascader-lib.js";
4
+ import { resolveCascaderSearchLabel } from "./cascader-i18n.js";
5
+ import * as React$1 from "react";
6
+ import { cn } from "@kumix/utils";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
9
+ import { mergeProps } from "@base-ui/react/merge-props";
10
+ import { useRender } from "@base-ui/react/use-render";
11
+ import { Combobox } from "@base-ui/react";
12
+ import { useDirection } from "@base-ui/react/direction-provider";
13
+ //#region src/components/reui/cascader/cascader-nav.tsx
14
+ function PathChevron() {
15
+ return /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-3 shrink-0 opacity-50 rtl:-scale-x-100" });
16
+ }
17
+ /**
18
+ * Header: back control, search input, and the separator under them. The
19
+ * breadcrumb belongs with the list below: it describes the rows, not the field.
20
+ */
21
+ function CascaderNav({ className, ...props }) {
22
+ const defaultProps = {
23
+ "data-slot": "cascader-nav",
24
+ className: cn("flex shrink-0 flex-col gap-1 border-border/60 border-b px-1.5 py-1", className)
25
+ };
26
+ return useRender({
27
+ defaultTagName: "div",
28
+ render: props.render,
29
+ props: mergeProps(defaultProps, props)
30
+ });
31
+ }
32
+ /** Pops one level. Renders nothing at the root, so no dead header space. */
33
+ function CascaderBack({ className, children, ...props }) {
34
+ const { popLevel, labels, mode } = useCascaderActions();
35
+ const { path } = useCascaderState();
36
+ const hidden = mode !== "drill" || path.length === 0;
37
+ const defaultProps = {
38
+ "data-slot": "cascader-back",
39
+ type: "button",
40
+ "aria-label": labels.back,
41
+ onClick: () => popLevel(),
42
+ className: cn("flex shrink-0 items-center justify-center rounded-md text-muted-foreground outline-hidden transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring/50", "size-6", className),
43
+ children: children ?? /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-4 rtl:-scale-x-100" })
44
+ };
45
+ const element = useRender({
46
+ defaultTagName: "button",
47
+ render: props.render,
48
+ props: mergeProps(defaultProps, props)
49
+ });
50
+ return hidden ? null : element;
51
+ }
52
+ /**
53
+ * Compact trail of the current level AND its ancestors, collapsed by the same
54
+ * helper as `CascaderValue` so panel and trigger cannot disagree. The current
55
+ * level IS the last crumb: dropping it read as a rendering bug, a trail naming
56
+ * only the places you are not.
57
+ */
58
+ function CascaderBreadcrumb({ className, maxSegments = 3, collapse = "middle", interactive = true, ...props }) {
59
+ const { goToDepth, mode, labels } = useCascaderActions();
60
+ const { path, index } = useCascaderState();
61
+ const nodes = path.map((value) => index.byValue.get(value)).filter(Boolean);
62
+ const segments = collapseCascaderPath(nodes, {
63
+ maxSegments,
64
+ collapse
65
+ });
66
+ const currentValue = nodes.length ? nodes[nodes.length - 1].value : null;
67
+ const hidden = mode !== "drill" || nodes.length === 0;
68
+ const goTo = (node) => {
69
+ const depth = path.indexOf(node.value);
70
+ if (depth < 0) return;
71
+ goToDepth(depth + 1);
72
+ };
73
+ const defaultProps = {
74
+ "data-slot": "cascader-breadcrumb",
75
+ "aria-label": labels.breadcrumbLabel,
76
+ className: cn("flex min-w-0 shrink-0 items-center gap-0.5 pt-1.5 pb-0.5 text-muted-foreground text-xs", "px-2.5", className),
77
+ children: segments.map((segment, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [i > 0 ? /* @__PURE__ */ jsx(PathChevron, {}) : null, segment.type === "ellipsis" ? /* @__PURE__ */ jsx("span", {
78
+ "data-slot": "cascader-breadcrumb-ellipsis",
79
+ title: segment.hidden.map((n) => n.label).join(` ${labels.pathSeparator} `),
80
+ className: "shrink-0",
81
+ children: "…"
82
+ }) : interactive && segment.node.value !== currentValue ? /* @__PURE__ */ jsx("button", {
83
+ type: "button",
84
+ "data-slot": "cascader-breadcrumb-item",
85
+ onClick: () => goTo(segment.node),
86
+ className: "max-w-32 truncate rounded-sm outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",
87
+ children: segment.node.label
88
+ }) : /* @__PURE__ */ jsx("span", {
89
+ "data-slot": "cascader-breadcrumb-item",
90
+ ...segment.node.value === currentValue ? { "aria-current": "page" } : null,
91
+ className: cn("max-w-32 truncate", segment.node.value === currentValue && "font-medium text-foreground"),
92
+ children: segment.node.label
93
+ })] }, segment.type === "node" ? segment.node.value : `gap-${i}`))
94
+ };
95
+ const element = useRender({
96
+ defaultTagName: "nav",
97
+ render: props.render,
98
+ props: mergeProps(defaultProps, props)
99
+ });
100
+ return hidden ? null : element;
101
+ }
102
+ /**
103
+ * Search field. MUST render inside the positioner: only there does Base UI skip
104
+ * the refill from the committed selection that would fight every level swap.
105
+ */
106
+ function CascaderInput({ className, showBack = true, placeholder, onKeyDown, "aria-describedby": ariaDescribedBy, ...props }) {
107
+ const { labels, popLevel, mode, getHighlighted, isBranch, navigate, index, toggleExpanded, inline, invalid, baseId } = useCascaderActions();
108
+ const direction = useDirection();
109
+ const { currentParent, query, path, renderedItems, treeRows } = useCascaderState();
110
+ const resolvedPlaceholder = placeholder ?? resolveCascaderSearchLabel(labels, currentParent?.label);
111
+ const backVisible = showBack && mode === "drill" && path.length > 0;
112
+ const hintId = `${baseId}-hint`;
113
+ const listId = `${baseId}-column-${mode === "columns" ? path.length : 0}`;
114
+ const hintRef = React$1.useRef(null);
115
+ const [hintDir, setHintDir] = React$1.useState("ltr");
116
+ React$1.useLayoutEffect(() => {
117
+ const hint = hintRef.current;
118
+ if (!hint) return;
119
+ setHintDir(isCascaderRtl(hint, direction) ? "rtl" : "ltr");
120
+ }, [direction]);
121
+ /**
122
+ * Moves the highlight to `targetIndex` in `treeRows`. Base UI has no
123
+ * imperative setter (`actionsRef` is `{ unmount }`), so the move is arrow
124
+ * presses, sound only because `useListNavigation` fires `onItemHighlighted`
125
+ * SYNCHRONOUSLY per keydown. A press that fails to close the gap ends it.
126
+ */
127
+ const moveHighlightTo = (field, targetIndex) => {
128
+ const rowIndex = () => {
129
+ const highlighted = getHighlighted();
130
+ if (!highlighted) return -1;
131
+ return treeRows.findIndex((row) => row.node.value === highlighted.value);
132
+ };
133
+ let current = rowIndex();
134
+ for (let step = 0; step < treeRows.length; step += 1) {
135
+ if (current === -1 || current === targetIndex) return;
136
+ const key = current > targetIndex ? "ArrowUp" : "ArrowDown";
137
+ field.dispatchEvent(new KeyboardEvent("keydown", {
138
+ key,
139
+ bubbles: true,
140
+ cancelable: true
141
+ }));
142
+ const next = rowIndex();
143
+ if (next === -1 || !(key === "ArrowUp" ? next < current && next >= targetIndex : next > current && next <= targetIndex)) return;
144
+ current = next;
145
+ }
146
+ };
147
+ /**
148
+ * The tree pattern's two level keys; Base UI leaves both alone (list
149
+ * navigation is vertical-only, the chip handler no-ops without
150
+ * `Combobox.Chips`). Passed in rather than hardcoded because RTL swaps them:
151
+ * APG defines them as "toward the children", not as a physical arrow.
152
+ */
153
+ const handleTreeKeyDown = (event, field, caretAtStart, caretAtEnd, forwardKey, backKey) => {
154
+ const forward = event.key === forwardKey;
155
+ if (!forward && event.key !== backKey) return;
156
+ if (forward ? !caretAtEnd : !caretAtStart) return;
157
+ const highlighted = getHighlighted();
158
+ if (!highlighted) return;
159
+ const rowIndex = treeRows.findIndex((row) => row.node.value === highlighted.value);
160
+ if (rowIndex < 0) return;
161
+ const row = treeRows[rowIndex];
162
+ if (forward) {
163
+ if (!row.branch) return;
164
+ event.preventDefault();
165
+ if (!row.expanded) {
166
+ navigate(row.node);
167
+ return;
168
+ }
169
+ const child = treeRows[rowIndex + 1];
170
+ if (child && child.depth === row.depth + 1) moveHighlightTo(field, rowIndex + 1);
171
+ return;
172
+ }
173
+ if (row.branch && row.expanded) {
174
+ event.preventDefault();
175
+ toggleExpanded(row.node.value);
176
+ return;
177
+ }
178
+ const parentValue = index.parentOf.get(row.node.value);
179
+ if (!parentValue) return;
180
+ const parentIndex = treeRows.findIndex((entry) => entry.node.value === parentValue);
181
+ if (parentIndex < 0) return;
182
+ event.preventDefault();
183
+ moveHighlightTo(field, parentIndex);
184
+ };
185
+ const handleKeyDown = (event) => {
186
+ onKeyDown?.(event);
187
+ if (event.defaultPrevented) return;
188
+ const field = event.currentTarget;
189
+ const caretAtStart = field.selectionStart === 0 && field.selectionEnd === 0;
190
+ const caretAtEnd = field.selectionStart === query.length && field.selectionEnd === query.length;
191
+ if (event.key === "ArrowDown" && !event.altKey) {
192
+ const rowCount = mode === "tree" ? treeRows.length : renderedItems.length;
193
+ const lastValue = mode === "tree" ? treeRows[rowCount - 1]?.node.value : renderedItems[rowCount - 1]?.value;
194
+ const highlighted = getHighlighted();
195
+ if (rowCount === 0 || highlighted != null && highlighted.value === lastValue) {
196
+ const panel = field.closest("[data-slot=\"cascader-panel\"]");
197
+ const stop = panel ? getCascaderFooterStops(panel)[0] : void 0;
198
+ if (stop) {
199
+ event.preventDefault();
200
+ stop.focus();
201
+ return;
202
+ }
203
+ }
204
+ }
205
+ const rtl = isCascaderRtl(field, direction);
206
+ const forwardKey = rtl ? "ArrowLeft" : "ArrowRight";
207
+ const backKey = rtl ? "ArrowRight" : "ArrowLeft";
208
+ if (mode === "tree") {
209
+ handleTreeKeyDown(event, field, caretAtStart, caretAtEnd, forwardKey, backKey);
210
+ return;
211
+ }
212
+ if (event.key === forwardKey && caretAtEnd) {
213
+ const highlighted = getHighlighted();
214
+ if (highlighted && isBranch(highlighted)) {
215
+ event.preventDefault();
216
+ navigate(highlighted);
217
+ return;
218
+ }
219
+ }
220
+ if (event.key === backKey && caretAtStart || event.key === "Backspace" && query.length === 0) {
221
+ if (path.length > 0) {
222
+ event.preventDefault();
223
+ popLevel();
224
+ }
225
+ }
226
+ };
227
+ return /* @__PURE__ */ jsxs("div", {
228
+ "data-slot": "cascader-input-row",
229
+ className: cn("flex shrink-0 items-center gap-1", "h-8"),
230
+ children: [
231
+ showBack ? /* @__PURE__ */ jsx(CascaderBack, {}) : null,
232
+ /* @__PURE__ */ jsx(Combobox.Input, {
233
+ "data-slot": "cascader-input",
234
+ placeholder: resolvedPlaceholder,
235
+ onKeyDown: handleKeyDown,
236
+ "aria-describedby": [ariaDescribedBy, hintId].filter(Boolean).join(" "),
237
+ ...mode === "tree" ? { "aria-haspopup": "tree" } : null,
238
+ ...inline ? {
239
+ "aria-expanded": true,
240
+ "aria-controls": listId
241
+ } : null,
242
+ ...invalid ? {
243
+ "aria-invalid": true,
244
+ "data-invalid": ""
245
+ } : null,
246
+ className: cn("h-full w-full min-w-0 flex-1 bg-transparent px-1.5 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", backVisible && "ps-0", className),
247
+ ...props
248
+ }),
249
+ /* @__PURE__ */ jsx("span", {
250
+ id: hintId,
251
+ ref: hintRef,
252
+ className: "sr-only",
253
+ children: labels.keyboardHint(mode, hintDir)
254
+ })
255
+ ]
256
+ });
257
+ }
258
+ /**
259
+ * Trigger display. Defaults to the collapsed selection path rather than a bare
260
+ * leaf label, which in a nested picker is frequently ambiguous.
261
+ */
262
+ function CascaderValue({ className, display = "path", maxSegments = 3, collapse = "middle", separator, showIcon = true, placeholder, children, ...props }) {
263
+ const { labels, multiple, resolveNode } = useCascaderActions();
264
+ const { index, selectedValues } = useCascaderState();
265
+ const selected = selectedValues.map(resolveNode);
266
+ const resolvedPath = selectedValues.length === 1 ? getCascaderPath(index, selectedValues[0]) : [];
267
+ const path = resolvedPath.length > 0 ? resolvedPath : selected.length === 1 ? selected : [];
268
+ let content;
269
+ if (children) content = children(selected, path);
270
+ else if (selectedValues.length === 0) content = /* @__PURE__ */ jsx("span", {
271
+ className: "truncate text-muted-foreground",
272
+ children: placeholder
273
+ });
274
+ else if (display === "count" || multiple && selectedValues.length > 1) content = labels.selectedCount(selectedValues.length);
275
+ else {
276
+ const leaf = path[path.length - 1] ?? selected[0];
277
+ const segments = display === "leaf" ? [{
278
+ type: "node",
279
+ node: leaf
280
+ }] : collapseCascaderPath(path, {
281
+ maxSegments,
282
+ collapse
283
+ });
284
+ content = /* @__PURE__ */ jsxs(Fragment$1, { children: [showIcon && leaf?.icon ? /* @__PURE__ */ jsx("span", {
285
+ "data-slot": "cascader-value-icon",
286
+ className: "flex shrink-0 items-center text-muted-foreground",
287
+ children: leaf.icon
288
+ }) : null, segments.map((segment, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [i > 0 ? separator ?? /* @__PURE__ */ jsx(PathChevron, {}) : null, segment.type === "ellipsis" ? /* @__PURE__ */ jsx("span", {
289
+ "data-slot": "cascader-value-ellipsis",
290
+ title: segment.hidden.map((n) => n.label).join(` ${labels.pathSeparator} `),
291
+ className: "shrink-0 text-muted-foreground",
292
+ children: "…"
293
+ }) : /* @__PURE__ */ jsx("span", {
294
+ className: cn("truncate", i < segments.length - 1 && "text-muted-foreground"),
295
+ children: segment.node?.label
296
+ })] }, segment.type === "node" ? segment.node.value : `gap-${i}`))] });
297
+ }
298
+ const defaultProps = {
299
+ "data-slot": "cascader-value",
300
+ className: cn("flex min-w-0 items-center gap-1 truncate", className),
301
+ children: content
302
+ };
303
+ return useRender({
304
+ defaultTagName: "span",
305
+ render: props.render,
306
+ props: mergeProps(defaultProps, props)
307
+ });
308
+ }
309
+ //#endregion
310
+ export { CascaderBack, CascaderBreadcrumb, CascaderInput, CascaderNav, CascaderValue };
311
+
312
+ //# sourceMappingURL=cascader-nav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-nav.js","names":["React","ComboboxPrimitive"],"sources":["../../../../src/components/reui/cascader/cascader-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react\";\nimport { useDirection } from \"@base-ui/react/direction-provider\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useCascaderActions, useCascaderState } from \"./cascader-context\";\nimport { resolveCascaderSearchLabel } from \"./cascader-i18n\";\nimport {\n collapseCascaderPath,\n getCascaderFooterStops,\n getCascaderPath,\n isCascaderRtl,\n} from \"./cascader-lib\";\nimport type { CascaderCollapse, CascaderNode, CascaderValueDisplay } from \"./cascader-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Separator */\n/* -------------------------------------------------------------------------- */\n\nfunction PathChevron() {\n return <ChevronRightIcon className=\"size-3 shrink-0 opacity-50 rtl:-scale-x-100\" />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Nav */\n/* -------------------------------------------------------------------------- */\n\nexport type CascaderNavProps = useRender.ComponentProps<\"div\">;\n\n/**\n * Header: back control, search input, and the separator under them. The\n * breadcrumb belongs with the list below: it describes the rows, not the field.\n */\nfunction CascaderNav({ className, ...props }: CascaderNavProps) {\n const defaultProps = {\n \"data-slot\": \"cascader-nav\",\n className: cn(\n // `py-1`, not `py-1.5`: the row inside sets its own per-style height, so\n // even padding read too tall. 6px beside the field, 4px above and below.\n \"flex shrink-0 flex-col gap-1 border-border/60 border-b px-1.5 py-1\",\n className,\n ),\n };\n\n return useRender({\n defaultTagName: \"div\",\n render: props.render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Back */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderBackProps extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: React.ReactNode;\n}\n\n/** Pops one level. Renders nothing at the root, so no dead header space. */\nfunction CascaderBack({ className, children, ...props }: CascaderBackProps) {\n const { popLevel, labels, mode } = useCascaderActions();\n const { path } = useCascaderState();\n\n // Checked after `useRender`, never before it: an early return would change\n // the hook count between the root level and any deeper one.\n const hidden = mode !== \"drill\" || path.length === 0;\n\n const defaultProps = {\n \"data-slot\": \"cascader-back\",\n type: \"button\" as const,\n \"aria-label\": labels.back,\n onClick: () => popLevel(),\n className: cn(\n \"flex shrink-0 items-center justify-center rounded-md text-muted-foreground outline-hidden transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring/50\",\n // A notch under the row height: an affordance, not a second field.\n \"size-6\",\n className,\n ),\n children: children ?? <ChevronLeftIcon className=\"size-4 rtl:-scale-x-100\" />,\n };\n\n const element = useRender({\n defaultTagName: \"button\",\n render: props.render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n return hidden ? null : element;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Breadcrumb */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderBreadcrumbProps extends Omit<useRender.ComponentProps<\"nav\">, \"children\"> {\n /** Maximum visible node segments before the middle collapses. */\n maxSegments?: number;\n collapse?: CascaderCollapse;\n /** Clicking a segment navigates back to that level. Defaults to true. */\n interactive?: boolean;\n}\n\n/**\n * Compact trail of the current level AND its ancestors, collapsed by the same\n * helper as `CascaderValue` so panel and trigger cannot disagree. The current\n * level IS the last crumb: dropping it read as a rendering bug, a trail naming\n * only the places you are not.\n */\nfunction CascaderBreadcrumb({\n className,\n maxSegments = 3,\n collapse = \"middle\",\n interactive = true,\n ...props\n}: CascaderBreadcrumbProps) {\n const { goToDepth, mode, labels } = useCascaderActions();\n const { path, index } = useCascaderState();\n\n // The WHOLE path, current level included; unresolvable entries drop out.\n const nodes = path.map((value) => index.byValue.get(value)).filter(Boolean) as CascaderNode[];\n const segments = collapseCascaderPath(nodes, { maxSegments, collapse });\n // `collapseCascaderPath` never collapses the last node away, so this is\n // always the final segment - derived rather than assumed, so a `collapse`\n // mode that ever changes that cannot mark an ancestor as the current page.\n const currentValue = nodes.length ? nodes[nodes.length - 1].value : null;\n\n // See `CascaderBack`: the hide check must not short-circuit past `useRender`.\n const hidden = mode !== \"drill\" || nodes.length === 0;\n\n const goTo = (node: CascaderNode) => {\n const depth = path.indexOf(node.value);\n if (depth < 0) return;\n // `goToDepth`, not a bare `setPath`: it reports `reason: \"breadcrumb\"`,\n // clears the query and drops any pending navigation.\n goToDepth(depth + 1);\n };\n\n const defaultProps = {\n \"data-slot\": \"cascader-breadcrumb\",\n \"aria-label\": labels.breadcrumbLabel,\n className: cn(\n \"flex min-w-0 shrink-0 items-center gap-0.5 pt-1.5 pb-0.5 text-muted-foreground text-xs\",\n // Lines up with the ROWS, not the header: each style's list padding plus\n // its row inset. vega/mira/rhea `p-1`+`pl-2`, nova `p-1`+`pl-1.5`, maia\n // `p-1`+`pl-3`, lyra `pl-2`, luma/sera `p-1.5`+`pl-3`, per style-*.css.\n \"px-2.5\",\n className,\n ),\n children: segments.map((segment, i) => (\n <React.Fragment key={segment.type === \"node\" ? segment.node.value : `gap-${i}`}>\n {i > 0 ? <PathChevron /> : null}\n {segment.type === \"ellipsis\" ? (\n <span\n data-slot=\"cascader-breadcrumb-ellipsis\"\n title={segment.hidden.map((n) => n.label).join(` ${labels.pathSeparator} `)}\n className=\"shrink-0\"\n >\n &hellip;\n </span>\n ) : interactive && segment.node.value !== currentValue ? (\n <button\n type=\"button\"\n data-slot=\"cascader-breadcrumb-item\"\n onClick={() => goTo(segment.node)}\n className=\"max-w-32 truncate rounded-sm outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50\"\n >\n {segment.node.label}\n </button>\n ) : (\n <span\n data-slot=\"cascader-breadcrumb-item\"\n /* The level on screen: a span because it goes nowhere, plus\n `aria-current=\"page\"` so it is not read as one of a flat list. */\n {...(segment.node.value === currentValue ? { \"aria-current\": \"page\" as const } : null)}\n className={cn(\n \"max-w-32 truncate\",\n segment.node.value === currentValue && \"font-medium text-foreground\",\n )}\n >\n {segment.node.label}\n </span>\n )}\n </React.Fragment>\n )),\n };\n\n const element = useRender({\n defaultTagName: \"nav\",\n render: props.render,\n props: mergeProps<\"nav\">(defaultProps, props),\n });\n\n return hidden ? null : element;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderInputProps extends ComboboxPrimitive.Input.Props {\n /** Renders the back control inline, before the field. Defaults to true. */\n showBack?: boolean;\n}\n\n/** Base UI hands its input handlers an event carrying the veto hook. */\ntype CascaderInputKeyEvent = Parameters<NonNullable<ComboboxPrimitive.Input.Props[\"onKeyDown\"]>>[0];\n\n/**\n * Search field. MUST render inside the positioner: only there does Base UI skip\n * the refill from the committed selection that would fight every level swap.\n */\nfunction CascaderInput({\n className,\n showBack = true,\n placeholder,\n onKeyDown,\n \"aria-describedby\": ariaDescribedBy,\n ...props\n}: CascaderInputProps) {\n const {\n labels,\n popLevel,\n mode,\n getHighlighted,\n isBranch,\n navigate,\n index,\n toggleExpanded,\n inline,\n invalid,\n baseId,\n } = useCascaderActions();\n const direction = useDirection();\n const { currentParent, query, path, renderedItems, treeRows } = useCascaderState();\n\n const resolvedPlaceholder =\n placeholder ?? resolveCascaderSearchLabel(labels, currentParent?.label);\n\n // Not `showBack`: `CascaderBack` renders nothing at the root or outside\n // drill mode, where the field's own leading `px-1.5` is wanted. Beside the\n // button it stacks with the row's `gap-1` into a 10px hole, hence `ps-0`.\n const backVisible = showBack && mode === \"drill\" && path.length > 0;\n\n const hintId = `${baseId}-hint`;\n // Base UI names no list while inline; columns mode moves the real listbox to\n // the deepest panel, which is the `path.length` one.\n const listId = `${baseId}-column-${mode === \"columns\" ? path.length : 0}`;\n\n // The direction the HINT is worded for. `handleKeyDown` re-reads\n // `isCascaderRtl` per keystroke; this is text on screen before any key, so\n // the same check runs once against the mounted DOM (on the hint span, so no\n // second ref into Base UI's input). SSR renders the \"ltr\" default and\n // corrects on hydration. `direction` is the only dep: a `dir` attribute and\n // the stylesheet are declarations, not state, so nothing to resubscribe to.\n const hintRef = React.useRef<HTMLSpanElement>(null);\n const [hintDir, setHintDir] = React.useState<\"ltr\" | \"rtl\">(\"ltr\");\n React.useLayoutEffect(() => {\n const hint = hintRef.current;\n if (!hint) return;\n setHintDir(isCascaderRtl(hint, direction) ? \"rtl\" : \"ltr\");\n }, [direction]);\n\n /**\n * Moves the highlight to `targetIndex` in `treeRows`. Base UI has no\n * imperative setter (`actionsRef` is `{ unmount }`), so the move is arrow\n * presses, sound only because `useListNavigation` fires `onItemHighlighted`\n * SYNCHRONOUSLY per keydown. A press that fails to close the gap ends it.\n */\n const moveHighlightTo = (field: HTMLInputElement, targetIndex: number) => {\n const rowIndex = () => {\n const highlighted = getHighlighted();\n if (!highlighted) return -1;\n return treeRows.findIndex((row) => row.node.value === highlighted.value);\n };\n\n let current = rowIndex();\n for (let step = 0; step < treeRows.length; step += 1) {\n if (current === -1 || current === targetIndex) return;\n const key = current > targetIndex ? \"ArrowUp\" : \"ArrowDown\";\n field.dispatchEvent(new KeyboardEvent(\"keydown\", { key, bubbles: true, cancelable: true }));\n const next = rowIndex();\n const progressed =\n key === \"ArrowUp\"\n ? next < current && next >= targetIndex\n : next > current && next <= targetIndex;\n if (next === -1 || !progressed) return;\n current = next;\n }\n };\n\n /**\n * The tree pattern's two level keys; Base UI leaves both alone (list\n * navigation is vertical-only, the chip handler no-ops without\n * `Combobox.Chips`). Passed in rather than hardcoded because RTL swaps them:\n * APG defines them as \"toward the children\", not as a physical arrow.\n */\n const handleTreeKeyDown = (\n event: CascaderInputKeyEvent,\n field: HTMLInputElement,\n caretAtStart: boolean,\n caretAtEnd: boolean,\n forwardKey: \"ArrowLeft\" | \"ArrowRight\",\n backKey: \"ArrowLeft\" | \"ArrowRight\",\n ) => {\n const forward = event.key === forwardKey;\n if (!forward && event.key !== backKey) return;\n if (forward ? !caretAtEnd : !caretAtStart) return;\n\n const highlighted = getHighlighted();\n if (!highlighted) return;\n const rowIndex = treeRows.findIndex((row) => row.node.value === highlighted.value);\n if (rowIndex < 0) return;\n const row = treeRows[rowIndex];\n\n if (forward) {\n if (!row.branch) return;\n event.preventDefault();\n if (!row.expanded) {\n // `navigate`, not `toggleExpanded`: it waits for an unloaded branch's\n // children, so the keyboard path in matches the expander.\n navigate(row.node);\n return;\n }\n // `flattenCascaderTree` emits children right after their parent, so the\n // first child is the next row. The depth check covers an empty branch.\n const child = treeRows[rowIndex + 1];\n if (child && child.depth === row.depth + 1) {\n moveHighlightTo(field, rowIndex + 1);\n }\n return;\n }\n\n if (row.branch && row.expanded) {\n event.preventDefault();\n toggleExpanded(row.node.value);\n return;\n }\n\n const parentValue = index.parentOf.get(row.node.value);\n if (!parentValue) return;\n const parentIndex = treeRows.findIndex((entry) => entry.node.value === parentValue);\n if (parentIndex < 0) return;\n event.preventDefault();\n moveHighlightTo(field, parentIndex);\n };\n\n const handleKeyDown = (event: CascaderInputKeyEvent) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n\n const field = event.currentTarget;\n const caretAtStart = field.selectionStart === 0 && field.selectionEnd === 0;\n const caretAtEnd = field.selectionStart === query.length && field.selectionEnd === query.length;\n\n // ArrowDown at the END of the list hands real focus to the pinned footer,\n // the key a combobox is actually navigated with; Tab still works and still\n // skips the scroll area. An EMPTY list hands off at once, and the footer\n // owns the way back. Counted from state, so a windowed list still answers.\n if (event.key === \"ArrowDown\" && !event.altKey) {\n const rowCount = mode === \"tree\" ? treeRows.length : renderedItems.length;\n const lastValue =\n mode === \"tree\" ? treeRows[rowCount - 1]?.node.value : renderedItems[rowCount - 1]?.value;\n const highlighted = getHighlighted();\n const atEnd = rowCount === 0 || (highlighted != null && highlighted.value === lastValue);\n if (atEnd) {\n const panel = field.closest<HTMLElement>('[data-slot=\"cascader-panel\"]');\n const stop = panel ? getCascaderFooterStops(panel)[0] : undefined;\n if (stop) {\n event.preventDefault();\n // Base UI's handler is deliberately NOT vetoed: its wrap's first\n // press CLEARS the highlight, so no stale row stays active behind the\n // focused command, and the emptied highlight completes the ring.\n stop.focus();\n return;\n }\n }\n }\n\n // The level keys are LOGICAL, not physical: in RTL, ArrowLeft opens a\n // branch and ArrowRight goes back. They act only at the caret edge, and\n // those guards do NOT mirror: `selectionStart === 0` is the logical start.\n const rtl = isCascaderRtl(field, direction);\n const forwardKey = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backKey = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n if (mode === \"tree\") {\n handleTreeKeyDown(event, field, caretAtStart, caretAtEnd, forwardKey, backKey);\n return;\n }\n\n if (event.key === forwardKey && caretAtEnd) {\n const highlighted = getHighlighted();\n if (highlighted && isBranch(highlighted)) {\n event.preventDefault();\n navigate(highlighted);\n return;\n }\n }\n\n // Backspace on an empty query pops a level too, so the keyboard way out of\n // a level is symmetric with typing into it.\n if (\n (event.key === backKey && caretAtStart) ||\n (event.key === \"Backspace\" && query.length === 0)\n ) {\n if (path.length > 0) {\n event.preventDefault();\n popLevel();\n }\n }\n };\n\n return (\n <div\n data-slot=\"cascader-input-row\"\n className={cn(\n \"flex shrink-0 items-center gap-1\",\n /* Each style sizes a combobox search field only as a DIRECT child of\n the popup; this row is nested, so the ladder is mirrored here rather\n than hardcoding one height for all eight styles. */\n \"h-8\",\n )}\n >\n {showBack ? <CascaderBack /> : null}\n <ComboboxPrimitive.Input\n data-slot=\"cascader-input\"\n placeholder={resolvedPlaceholder}\n onKeyDown={handleKeyDown}\n /* Nothing on screen says the level keys exist. */\n aria-describedby={[ariaDescribedBy, hintId].filter(Boolean).join(\" \")}\n /* Conditional: an explicit `undefined` deletes Base UI's own value. */\n {...(mode === \"tree\" ? { \"aria-haspopup\": \"tree\" as const } : null)}\n /* Base UI omits BOTH `aria-expanded` and `aria-controls` while inline,\n and an embedded panel is permanently expanded, so supply both. */\n {...(inline ? { \"aria-expanded\": true, \"aria-controls\": listId } : null)}\n /* No trigger to carry the invalid state in the `inline` case. */\n {...(invalid ? { \"aria-invalid\": true, \"data-invalid\": \"\" } : null)}\n className={cn(\n \"h-full w-full min-w-0 flex-1 bg-transparent px-1.5 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n backVisible && \"ps-0\",\n className,\n )}\n {...props}\n />\n <span id={hintId} ref={hintRef} className=\"sr-only\">\n {/* `hintDir`, not `direction`: the context alone misses an RTL app that\n uses a `dir` attribute instead of `DirectionProvider`. */}\n {labels.keyboardHint(mode, hintDir)}\n </span>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Value */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderValueProps extends Omit<useRender.ComponentProps<\"span\">, \"children\"> {\n /** `path` shows the full trail, `leaf` only the node, `count` only a total. */\n display?: CascaderValueDisplay;\n maxSegments?: number;\n collapse?: CascaderCollapse;\n separator?: React.ReactNode;\n /** Renders the selected node's icon before the trail. */\n showIcon?: boolean;\n placeholder?: React.ReactNode;\n /** Replaces the whole rendering. Receives the resolved selection and path. */\n children?: (selected: CascaderNode[], path: CascaderNode[]) => React.ReactNode;\n}\n\n/**\n * Trigger display. Defaults to the collapsed selection path rather than a bare\n * leaf label, which in a nested picker is frequently ambiguous.\n */\nfunction CascaderValue({\n className,\n display = \"path\",\n maxSegments = 3,\n collapse = \"middle\",\n separator,\n showIcon = true,\n placeholder,\n children,\n ...props\n}: CascaderValueProps) {\n const { labels, multiple, resolveNode } = useCascaderActions();\n const { index, selectedValues } = useCascaderState();\n\n // `resolveNode`, not `index.byValue`: a selection missing from `items` (async\n // children, a removed item) must still render a label, not an empty trigger.\n const selected = selectedValues.map(resolveNode);\n\n const resolvedPath = selectedValues.length === 1 ? getCascaderPath(index, selectedValues[0]) : [];\n // No ancestor chain: fall back to the node so `display=\"path\"` shows a leaf.\n const path = resolvedPath.length > 0 ? resolvedPath : selected.length === 1 ? selected : [];\n\n let content: React.ReactNode;\n\n if (children) {\n content = children(selected, path);\n } else if (selectedValues.length === 0) {\n content = <span className=\"truncate text-muted-foreground\">{placeholder}</span>;\n } else if (display === \"count\" || (multiple && selectedValues.length > 1)) {\n content = labels.selectedCount(selectedValues.length);\n } else {\n const leaf = path[path.length - 1] ?? selected[0];\n const segments =\n display === \"leaf\"\n ? [{ type: \"node\" as const, node: leaf }]\n : collapseCascaderPath(path, { maxSegments, collapse });\n\n content = (\n <>\n {showIcon && leaf?.icon ? (\n <span\n data-slot=\"cascader-value-icon\"\n className=\"flex shrink-0 items-center text-muted-foreground\"\n >\n {leaf.icon}\n </span>\n ) : null}\n {segments.map((segment, i) => (\n <React.Fragment key={segment.type === \"node\" ? segment.node.value : `gap-${i}`}>\n {i > 0 ? (separator ?? <PathChevron />) : null}\n {segment.type === \"ellipsis\" ? (\n <span\n data-slot=\"cascader-value-ellipsis\"\n title={segment.hidden.map((n) => n.label).join(` ${labels.pathSeparator} `)}\n className=\"shrink-0 text-muted-foreground\"\n >\n &hellip;\n </span>\n ) : (\n <span className={cn(\"truncate\", i < segments.length - 1 && \"text-muted-foreground\")}>\n {segment.node?.label}\n </span>\n )}\n </React.Fragment>\n ))}\n </>\n );\n }\n\n const defaultProps = {\n \"data-slot\": \"cascader-value\",\n className: cn(\"flex min-w-0 items-center gap-1 truncate\", className),\n children: content,\n };\n\n return useRender({\n defaultTagName: \"span\",\n render: props.render,\n props: mergeProps<\"span\">(defaultProps, props),\n });\n}\n\nexport { CascaderBack, CascaderBreadcrumb, CascaderInput, CascaderNav, CascaderValue };\n"],"mappings":";;;;;;;;;;;;;AAwBA,SAAS,cAAc;CACrB,OAAO,oBAAC,kBAAD,EAAkB,WAAU,8CAA+C,CAAA;AACpF;;;;;AAYA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;CAC9D,MAAM,eAAe;EACnB,aAAa;EACb,WAAW,GAGT,sEACA,SACF;CACF;CAEA,OAAO,UAAU;EACf,gBAAgB;EAChB,QAAQ,MAAM;EACd,OAAO,WAAkB,cAAc,KAAK;CAC9C,CAAC;AACH;;AAWA,SAAS,aAAa,EAAE,WAAW,UAAU,GAAG,SAA4B;CAC1E,MAAM,EAAE,UAAU,QAAQ,SAAS,mBAAmB;CACtD,MAAM,EAAE,SAAS,iBAAiB;CAIlC,MAAM,SAAS,SAAS,WAAW,KAAK,WAAW;CAEnD,MAAM,eAAe;EACnB,aAAa;EACb,MAAM;EACN,cAAc,OAAO;EACrB,eAAe,SAAS;EACxB,WAAW,GACT,4MAEA,UACA,SACF;EACA,UAAU,YAAY,oBAAC,iBAAD,EAAiB,WAAU,0BAA2B,CAAA;CAC9E;CAEA,MAAM,UAAU,UAAU;EACxB,gBAAgB;EAChB,QAAQ,MAAM;EACd,OAAO,WAAqB,cAAc,K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EAAK,CAAC,IACtC,qBAAqB,MAAM;GAAE;GAAa;EAAS,CAAC;EAE1D,UACE,qBAAA,YAAA,EAAA,UAAA,CACG,YAAY,MAAM,OACjB,oBAAC,QAAD;GACE,aAAU;GACV,WAAU;GAET,UAAA,KAAK;EACF,CAAA,IACJ,MACH,SAAS,KAAK,SAAS,MACtB,qBAACD,QAAM,UAAP,EAAA,UAAA,CACG,IAAI,IAAK,aAAa,oBAAC,aAAD,CAAc,CAAA,IAAK,MACzC,QAAQ,SAAS,aAChB,oBAAC,QAAD;GACE,aAAU;GACV,OAAO,QAAQ,OAAO,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,KAAK,IAAI,OAAO,cAAc,EAAE;GAC1E,WAAU;GACX,UAAA;EAEK,CAAA,IAEN,oBAAC,QAAD;GAAM,WAAW,GAAG,YAAY,IAAI,SAAS,SAAS,KAAK,uBAAuB;GAC/E,UAAA,QAAQ,MAAM;EACX,CAAA,CAEM,EAAA,GAfK,QAAQ,SAAS,SAAS,QAAQ,KAAK,QAAQ,OAAO,GAe3D,CACjB,CACD,EAAA,CAAA;CAEN;CAEA,MAAM,eAAe;EACnB,aAAa;EACb,WAAW,GAAG,4CAA4C,SAAS;EACnE,UAAU;CACZ;CAEA,OAAO,UAAU;EACf,gBAAgB;EAChB,QAAQ,MAAM;EACd,OAAO,WAAmB,cAAc,KAAK;CAC/C,CAAC;AACH"}
@@ -0,0 +1,2 @@
1
+ import { _ as CascaderSelectable, a as CascaderFlatNode, c as CascaderLoadContext, d as CascaderLoadState, f as CascaderMode, g as CascaderSearchScope, h as CascaderSearchContext, i as CascaderCollapse, l as CascaderLoadReason, m as CascaderPathSegment, n as CascaderChangeDetails, o as CascaderIndex, p as CascaderNode, r as CascaderChangeReason, s as CascaderLabels, t as CascaderActionItem, u as CascaderLoadResult, v as CascaderValueDisplay } from "../../../cascader-types-BnH6wYD-.js";
2
+ export { CascaderActionItem, CascaderChangeDetails, CascaderChangeReason, CascaderCollapse, CascaderFlatNode, CascaderIndex, CascaderLabels, CascaderLoadContext, CascaderLoadReason, CascaderLoadResult, CascaderLoadState, CascaderMode, CascaderNode, CascaderPathSegment, CascaderSearchContext, CascaderSearchScope, CascaderSelectable, CascaderValueDisplay };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export {};
@@ -0,0 +1,65 @@
1
+ import { CascaderColumn } from "./cascader-context.js";
2
+ import * as React$1 from "react";
3
+ import { Virtualizer } from "@tanstack/react-virtual";
4
+ //#region src/components/reui/cascader/cascader-virtual.d.ts
5
+ /**
6
+ * Windowing for the cascader, in its own file so the primitive's own install
7
+ * never pulls `@tanstack/react-virtual` in. Base UI forces three rules:
8
+ *
9
+ * 1. A windowed row MUST carry an explicit `index`; the fallback
10
+ * `findItemIndex` is O(n) per row and returns `-1` on the frame a level swap
11
+ * renders empty, dangling `aria-activedescendant`.
12
+ * 2. That index is DESTRUCTIVE while unvirtualized (`useCompositeListItem`
13
+ * skips registration, `CompositeList` truncates `elementsRef` to zero and
14
+ * the first arrow key highlights nothing), so rows stay plain until the root
15
+ * flips `virtualized`, gated inside `CascaderItem`.
16
+ * 3. No `Combobox.Collection` and no FUNCTION CHILD on `Combobox.List`, which
17
+ * implicitly wraps one in a Collection: a Collection renders every filtered
18
+ * item.
19
+ */
20
+ interface UseCascaderVirtualizerOptions {
21
+ count: number;
22
+ getScrollElement: () => HTMLElement | null;
23
+ estimateSize?: number;
24
+ overscan?: number;
25
+ /** Key rows by node value, never by index: a tree expand shifts every index. */
26
+ getItemKey: (index: number) => string | number;
27
+ /** Render index of the highlighted row, or `-1`. Pinned into the window. */
28
+ activeIndex?: number;
29
+ }
30
+ type CascaderVirtualizer = Virtualizer<HTMLElement, HTMLElement>;
31
+ /**
32
+ * The cascader's virtualizer: TanStack plus the highlight pinning and
33
+ * scroll-into-view a combobox list needs. `activeIndex` is clamped here, not by
34
+ * the caller: emitted from a layout effect, it can be one commit ahead of a
35
+ * level that just shrank and would otherwise scroll to a row that is gone.
36
+ */
37
+ declare function useCascaderVirtualizer({ count, getScrollElement, estimateSize, overscan, getItemKey, activeIndex }: UseCascaderVirtualizerOptions): CascaderVirtualizer;
38
+ interface CascaderVirtualItemsProps {
39
+ /** Row height before measurement. Defaults to the root `estimateRowSize`. */
40
+ estimateSize?: number;
41
+ /** Rows rendered beyond each edge. Defaults to the root `overscan`. */
42
+ overscan?: number;
43
+ }
44
+ /**
45
+ * Windowed replacement for `CascaderItems`, dropped inside `CascaderList`. The
46
+ * registration is a LAYOUT effect because the root derives `virtualized` from
47
+ * it and the flip has to land before the browser paints. Until the root has
48
+ * seen it, this renders exactly what `CascaderItems` does, so no frame carries
49
+ * indexed rows while Base UI still owns the composite list.
50
+ */
51
+ declare function CascaderVirtualItems(props: CascaderVirtualItemsProps): React$1.JSX.Element;
52
+ interface CascaderVirtualColumnProps extends CascaderVirtualItemsProps {
53
+ column: CascaderColumn;
54
+ }
55
+ /**
56
+ * Windowed replacement for one Miller column, passed through the
57
+ * `CascaderColumns` render slot. One virtualizer PER COLUMN, since columns
58
+ * scroll independently, and only the deepest is Base UI's listbox: the trail
59
+ * behind is `as="button"` rows outside Base UI, so it windows on its own row
60
+ * count rather than waiting for the root to flip.
61
+ */
62
+ declare function CascaderVirtualColumn({ column, estimateSize, overscan }: CascaderVirtualColumnProps): React$1.JSX.Element;
63
+ //#endregion
64
+ export { CascaderVirtualColumn, CascaderVirtualColumnProps, CascaderVirtualItems, CascaderVirtualItemsProps, CascaderVirtualizer, UseCascaderVirtualizerOptions, useCascaderVirtualizer };
65
+ //# sourceMappingURL=cascader-virtual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-virtual.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;UAmCiB;EACf;EACA,wBAAwB;EACxB;EACA;;EAEA,aAAa;;EAEb;;KAGU,sBAAsB,YAAY,aAAa;;;;;;;iBAQ3C,yBACd,OACA,kBACA,cACA,UACA,YACA,eACC,gCAAgC;UAuHlB;;EAEf;;EAEA;;;;;;;;;iBAUO,qBAAqB,OAAO,4BAAyB,QAAA,IAAA;UA2F7C,mCAAmC;EAClD,QAAQ;;;;;;;;;iBAUD,wBAAwB,QAAQ,cAAc,YAAY,6BAA0B,QAAA,IAAA"}