@kumix/ui 0.3.17 → 0.3.18

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 (173) hide show
  1. package/README.md +3 -2
  2. package/dist/components/agents/agent-activity/activity-row.js +1 -1
  3. package/dist/components/agents/agent-activity/index.js +1 -1
  4. package/dist/components/agents/agent-code.js +1 -1
  5. package/dist/components/agents/ai-sidebar.js +1 -1
  6. package/dist/components/agents/approval-card/index.js +1 -1
  7. package/dist/components/agents/citations.js +1 -1
  8. package/dist/components/agents/code-block.js +1 -1
  9. package/dist/components/agents/file-diff.js +1 -1
  10. package/dist/components/agents/image-generation.js +1 -1
  11. package/dist/components/agents/message-bubble.js +1 -1
  12. package/dist/components/agents/prompt-input.js +1 -1
  13. package/dist/components/agents/streaming-response.js +1 -1
  14. package/dist/components/agents/todo-list.js +1 -1
  15. package/dist/components/agents/tool-approval.js +1 -1
  16. package/dist/components/agents/tool-result.js +1 -1
  17. package/dist/components/custom/confirm-dialog.js +1 -1
  18. package/dist/components/motion/adaptive-stepper.js +1 -1
  19. package/dist/components/motion/animated-badge.js +1 -1
  20. package/dist/components/motion/animated-sidebar.js +1 -1
  21. package/dist/components/motion/animated-sidebar.js.map +1 -1
  22. package/dist/components/motion/animated-toast-stack.js +1 -1
  23. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  24. package/dist/components/motion/attachment-upload.js +1 -1
  25. package/dist/components/motion/attachment-upload.js.map +1 -1
  26. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  27. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  28. package/dist/components/motion/availability-scheduler/index.js +1 -1
  29. package/dist/components/motion/bloom-menu.js +1 -1
  30. package/dist/components/motion/bottom-sheet.js.map +1 -1
  31. package/dist/components/motion/bouncy-accordion.js +1 -1
  32. package/dist/components/motion/breadcrumb.d.ts +37 -0
  33. package/dist/components/motion/breadcrumb.d.ts.map +1 -0
  34. package/dist/components/motion/breadcrumb.js +259 -0
  35. package/dist/components/motion/breadcrumb.js.map +1 -0
  36. package/dist/components/motion/button/stateful.js +1 -1
  37. package/dist/components/motion/card-folder.js +1 -1
  38. package/dist/components/motion/center-morph-modal.js +1 -1
  39. package/dist/components/motion/color-selector.d.ts +28 -0
  40. package/dist/components/motion/color-selector.d.ts.map +1 -0
  41. package/dist/components/motion/color-selector.js +97 -0
  42. package/dist/components/motion/color-selector.js.map +1 -0
  43. package/dist/components/motion/combobox/list.js +1 -1
  44. package/dist/components/motion/combobox/trigger.js +1 -1
  45. package/dist/components/motion/command-palette.js +1 -1
  46. package/dist/components/motion/command-palette.js.map +1 -1
  47. package/dist/components/motion/context-menu.js +1 -1
  48. package/dist/components/motion/drawer.js.map +1 -1
  49. package/dist/components/motion/feedback-widget.js +1 -1
  50. package/dist/components/motion/file-tree.js +1 -1
  51. package/dist/components/motion/file-upload.js +1 -1
  52. package/dist/components/motion/infinite-masonry.js +1 -1
  53. package/dist/components/motion/morphing-modal.js.map +1 -1
  54. package/dist/components/motion/morphing-search.js +1 -1
  55. package/dist/components/motion/morphing-search.js.map +1 -1
  56. package/dist/components/motion/morphing-tabs.js +1 -1
  57. package/dist/components/motion/multi-select/list.js +1 -1
  58. package/dist/components/motion/multi-select/trigger.js +1 -1
  59. package/dist/components/motion/notification-stack.js +1 -1
  60. package/dist/components/motion/overflow-actions.js +1 -1
  61. package/dist/components/motion/popover-morph.d.ts +1 -1
  62. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  63. package/dist/components/motion/popover-morph.js +50 -22
  64. package/dist/components/motion/popover-morph.js.map +1 -1
  65. package/dist/components/motion/project-folder.js +1 -1
  66. package/dist/components/motion/project-folder.js.map +1 -1
  67. package/dist/components/motion/select-morph.js +1 -1
  68. package/dist/components/motion/select.js +1 -1
  69. package/dist/components/motion/signup-form.js +1 -1
  70. package/dist/components/motion/table/row-handle.js +1 -1
  71. package/dist/components/motion/table/table-header.js +1 -1
  72. package/dist/components/motion/tabs.js +1 -1
  73. package/dist/components/motion/theme-toggle.js +1 -1
  74. package/dist/components/motion/tooltip/positioner.d.ts +33 -0
  75. package/dist/components/motion/tooltip/positioner.d.ts.map +1 -0
  76. package/dist/components/motion/tooltip/positioner.js +3 -0
  77. package/dist/components/motion/tooltip-surface.d.ts +5 -4
  78. package/dist/components/motion/tooltip-surface.d.ts.map +1 -1
  79. package/dist/components/motion/tooltip-surface.js +22 -73
  80. package/dist/components/motion/tooltip-surface.js.map +1 -1
  81. package/dist/components/motion/tooltip.d.ts +3 -1
  82. package/dist/components/motion/tooltip.d.ts.map +1 -1
  83. package/dist/components/motion/tooltip.js +54 -103
  84. package/dist/components/motion/tooltip.js.map +1 -1
  85. package/dist/components/reui/alert.js +1 -1
  86. package/dist/components/reui/autocomplete.js +1 -1
  87. package/dist/components/reui/badge.d.ts +2 -2
  88. package/dist/components/reui/cascader/cascader-columns.js +1 -1
  89. package/dist/components/reui/cascader/cascader-footer.js +1 -1
  90. package/dist/components/reui/cascader/cascader-item.js +1 -1
  91. package/dist/components/reui/cascader/cascader-nav.js +1 -1
  92. package/dist/components/reui/cascader/cascader.js +1 -1
  93. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
  94. package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
  95. package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
  96. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
  97. package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
  98. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  99. package/dist/components/reui/date-selector.js +1 -1
  100. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
  101. package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
  102. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  103. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  104. package/dist/components/reui/filters/filters-advanced.js +1 -1
  105. package/dist/components/reui/filters/filters-builder.js +1 -1
  106. package/dist/components/reui/filters/filters-chip.js +1 -1
  107. package/dist/components/reui/filters/filters-editors.js +1 -1
  108. package/dist/components/reui/filters/filters.js +1 -1
  109. package/dist/components/reui/frame.d.ts +2 -2
  110. package/dist/components/reui/frame.js +1 -1
  111. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  112. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  113. package/dist/components/reui/gantt/gantt-view.js +1 -1
  114. package/dist/components/reui/icon-tile.d.ts +2 -2
  115. package/dist/components/reui/kanban.d.ts.map +1 -1
  116. package/dist/components/reui/kanban.js +30 -1
  117. package/dist/components/reui/kanban.js.map +1 -1
  118. package/dist/components/reui/number-field.js +1 -1
  119. package/dist/components/reui/phone-input.js +1 -1
  120. package/dist/components/reui/rating.js +1 -1
  121. package/dist/components/reui/tree.js +1 -1
  122. package/dist/components/ui/accordion.js +1 -1
  123. package/dist/components/ui/alert-dialog.js +1 -1
  124. package/dist/components/ui/alert.js +1 -1
  125. package/dist/components/ui/attachment.d.ts +2 -2
  126. package/dist/components/ui/attachment.js +1 -1
  127. package/dist/components/ui/badge.d.ts +1 -1
  128. package/dist/components/ui/breadcrumb.js +1 -1
  129. package/dist/components/ui/bubble.d.ts +1 -1
  130. package/dist/components/ui/bubble.js +1 -1
  131. package/dist/components/ui/button-group.d.ts +1 -1
  132. package/dist/components/ui/button-group.js +1 -1
  133. package/dist/components/ui/button.d.ts +2 -2
  134. package/dist/components/ui/button.js +1 -1
  135. package/dist/components/ui/calendar.js +1 -1
  136. package/dist/components/ui/carousel.js +1 -1
  137. package/dist/components/ui/checkbox.js +1 -1
  138. package/dist/components/ui/combobox.js +1 -1
  139. package/dist/components/ui/command.js +1 -1
  140. package/dist/components/ui/context-menu.js +1 -1
  141. package/dist/components/ui/dialog.js +1 -1
  142. package/dist/components/ui/dropdown-menu.js +1 -1
  143. package/dist/components/ui/empty.js +1 -1
  144. package/dist/components/ui/field.d.ts +1 -1
  145. package/dist/components/ui/field.js +1 -1
  146. package/dist/components/ui/input-group.d.ts +1 -1
  147. package/dist/components/ui/input-group.js +1 -1
  148. package/dist/components/ui/input-otp.js +1 -1
  149. package/dist/components/ui/item.d.ts +3 -3
  150. package/dist/components/ui/item.js +1 -1
  151. package/dist/components/ui/marker.d.ts +1 -1
  152. package/dist/components/ui/marker.js +1 -1
  153. package/dist/components/ui/menubar.js +1 -1
  154. package/dist/components/ui/message-scroller.js +1 -1
  155. package/dist/components/ui/native-select.js +1 -1
  156. package/dist/components/ui/navigation-menu.js +1 -1
  157. package/dist/components/ui/pagination.js +1 -1
  158. package/dist/components/ui/questionnaire.js +1 -1
  159. package/dist/components/ui/select.js +1 -1
  160. package/dist/components/ui/sheet.js +1 -1
  161. package/dist/components/ui/sidebar.d.ts +1 -1
  162. package/dist/components/ui/sidebar.js +1 -1
  163. package/dist/components/ui/spinner.js +1 -1
  164. package/dist/components/ui/tabs.d.ts +1 -1
  165. package/dist/components/ui/tabs.js +1 -1
  166. package/dist/components/ui/toast.js +1 -1
  167. package/dist/components/ui/toggle.d.ts +1 -1
  168. package/dist/components/ui/toggle.js +1 -1
  169. package/dist/{copy-menu-TIKvPaAZ.js → copy-menu-C5GaT4Z-.js} +2 -2
  170. package/dist/{copy-menu-TIKvPaAZ.js.map → copy-menu-C5GaT4Z-.js.map} +1 -1
  171. package/dist/positioner-3mCqiebN.js +204 -0
  172. package/dist/positioner-3mCqiebN.js.map +1 -0
  173. package/package.json +8 -3
@@ -0,0 +1,259 @@
1
+ "use client";
2
+ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
+ import { EASE_OUT, SPRING_LAYOUT } from "../../lib/ease.js";
4
+ import { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from "./popover-morph.js";
5
+ import { Children, forwardRef, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
6
+ import { cn } from "@kumix/utils";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { AnimatePresence, LayoutGroup, motion, useIsPresent, useReducedMotion } from "motion/react";
9
+ import { ChevronRight, Ellipsis } from "lucide-react";
10
+ //#region src/components/motion/breadcrumb.tsx
11
+ /** A navigation landmark. Keep it mounted while the route changes. */
12
+ function Breadcrumb({ className, children, ...props }) {
13
+ const id = useId();
14
+ return /* @__PURE__ */ jsx("nav", {
15
+ "aria-label": "Breadcrumb",
16
+ ...props,
17
+ className: cn("min-w-0", className),
18
+ children: /* @__PURE__ */ jsx(LayoutGroup, {
19
+ id,
20
+ children
21
+ })
22
+ });
23
+ }
24
+ /** Pass keyed BreadcrumbItems directly so entering and leaving routes animate. */
25
+ function BreadcrumbList({ className, children, maxItems = 4, overflowLabel = "Show hidden paths", ...props }) {
26
+ const items = Children.toArray(children);
27
+ const limit = Number.isFinite(maxItems) ? Math.max(3, Math.floor(maxItems)) : 4;
28
+ const collapse = maxItems !== Infinity && items.length > limit;
29
+ const tailCount = limit - 2;
30
+ const visible = collapse ? [
31
+ items[0],
32
+ /* @__PURE__ */ jsxs(BreadcrumbItem, { children: [/* @__PURE__ */ jsx(BreadcrumbSeparator, {}), /* @__PURE__ */ jsx(BreadcrumbEllipsis, {
33
+ label: overflowLabel,
34
+ children: items.slice(1, -tailCount)
35
+ })] }, "breadcrumb-overflow"),
36
+ ...items.slice(-tailCount)
37
+ ] : items;
38
+ return /* @__PURE__ */ jsx("ol", {
39
+ ...props,
40
+ className: cn("relative flex flex-wrap items-center gap-x-1 gap-y-1 text-sm", className),
41
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
42
+ initial: false,
43
+ mode: "popLayout",
44
+ children: visible
45
+ })
46
+ });
47
+ }
48
+ /** Use a stable route key; put its optional separator inside this item. */
49
+ const BreadcrumbItem = forwardRef(function BreadcrumbItem({ className, style, children, ...props }, ref) {
50
+ const reduce = useReducedMotion();
51
+ const present = useIsPresent();
52
+ const itemRef = useRef(null);
53
+ useLayoutEffect(() => {
54
+ const item = itemRef.current;
55
+ if (!item || !present) return;
56
+ const measure = () => {
57
+ item.style.setProperty("--breadcrumb-exit-width", `${item.getBoundingClientRect().width}px`);
58
+ };
59
+ measure();
60
+ const observer = new ResizeObserver(measure);
61
+ observer.observe(item);
62
+ return () => observer.disconnect();
63
+ }, [present]);
64
+ const hidden = {
65
+ opacity: 0,
66
+ y: reduce ? 0 : 6
67
+ };
68
+ return /* @__PURE__ */ jsx(motion.li, {
69
+ ref: (node) => {
70
+ itemRef.current = node;
71
+ if (typeof ref === "function") return ref(node);
72
+ if (ref) ref.current = node;
73
+ },
74
+ layout: reduce ? false : "position",
75
+ initial: hidden,
76
+ animate: {
77
+ opacity: 1,
78
+ y: 0
79
+ },
80
+ exit: hidden,
81
+ transition: {
82
+ duration: .2,
83
+ ease: EASE_OUT,
84
+ layout: SPRING_LAYOUT
85
+ },
86
+ ...props,
87
+ inert: !present,
88
+ "aria-hidden": !present || void 0,
89
+ style: {
90
+ ...style,
91
+ minWidth: present ? style?.minWidth : "var(--breadcrumb-exit-width)",
92
+ pointerEvents: present ? style?.pointerEvents : "none"
93
+ },
94
+ className: cn("relative inline-flex min-w-0 max-w-full items-center gap-1", className),
95
+ children
96
+ });
97
+ });
98
+ function BreadcrumbLink({ className, render, ...props }) {
99
+ const linkProps = {
100
+ ...props,
101
+ className: cn("inline-flex min-h-8 min-w-0 items-center gap-1.5 rounded-md px-2 font-medium text-muted-foreground transition-colors duration-150 hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&>svg]:size-3.5 [&>svg]:shrink-0", className)
102
+ };
103
+ return render ? render(linkProps) : /* @__PURE__ */ jsx("a", { ...linkProps });
104
+ }
105
+ function BreadcrumbPage({ className, children, ...props }) {
106
+ return /* @__PURE__ */ jsx("span", {
107
+ ...props,
108
+ "aria-current": "page",
109
+ className: cn("wrap-anywhere relative isolate inline-flex min-h-8 min-w-0 items-center gap-1.5 rounded-md px-2 font-medium text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&>svg]:size-3.5 [&>svg]:shrink-0", className),
110
+ children
111
+ });
112
+ }
113
+ /** Decorative separator, placed inside the following BreadcrumbItem. */
114
+ function BreadcrumbSeparator({ className, children, ...props }) {
115
+ return /* @__PURE__ */ jsx("span", {
116
+ ...props,
117
+ "aria-hidden": "true",
118
+ "data-breadcrumb-separator": "",
119
+ className: cn("inline-flex shrink-0 items-center text-muted-foreground/50 rtl:rotate-180 [&>svg]:size-3.5", className),
120
+ children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
121
+ });
122
+ }
123
+ /** Hover disclosure with click/touch toggle and keyboard access to ancestor links. */
124
+ function BreadcrumbEllipsis({ children, className, label = "Show hidden paths" }) {
125
+ const [open, setOpen] = useState(false);
126
+ const [placement, setPlacement] = useState({
127
+ align: "start",
128
+ side: "bottom",
129
+ width: 224
130
+ });
131
+ const canHover = useHoverCapable();
132
+ const present = useIsPresent();
133
+ const trigger = useRef(null);
134
+ const panel = useRef(null);
135
+ const focusOnOpen = useRef(false);
136
+ const closeTimer = useRef(null);
137
+ useLayoutEffect(() => {
138
+ if (!open) return;
139
+ const update = () => {
140
+ const rect = trigger.current?.getBoundingClientRect();
141
+ if (!rect) return;
142
+ const right = window.innerWidth - rect.left - 8;
143
+ const left = rect.right - 8;
144
+ const align = right < 224 && left > right ? "end" : "start";
145
+ const below = window.innerHeight - rect.bottom;
146
+ setPlacement({
147
+ align,
148
+ side: below < 280 && rect.top > below ? "top" : "bottom",
149
+ width: Math.max(32, Math.min(224, align === "start" ? right : left))
150
+ });
151
+ };
152
+ update();
153
+ window.addEventListener("resize", update);
154
+ return () => window.removeEventListener("resize", update);
155
+ }, [open]);
156
+ const cancelClose = () => {
157
+ if (closeTimer.current !== null) clearTimeout(closeTimer.current);
158
+ closeTimer.current = null;
159
+ };
160
+ const leave = () => {
161
+ cancelClose();
162
+ closeTimer.current = setTimeout(() => {
163
+ if (!panel.current?.contains(document.activeElement) && document.activeElement !== trigger.current) setOpen(false);
164
+ }, 160);
165
+ };
166
+ useEffect(() => () => {
167
+ if (closeTimer.current !== null) clearTimeout(closeTimer.current);
168
+ }, []);
169
+ useEffect(() => {
170
+ if (!open) return;
171
+ const onFocus = (event) => {
172
+ if (event.target instanceof Node && event.target !== trigger.current && !panel.current?.contains(event.target)) setOpen(false);
173
+ };
174
+ document.addEventListener("focusin", onFocus);
175
+ return () => document.removeEventListener("focusin", onFocus);
176
+ }, [open]);
177
+ return /* @__PURE__ */ jsx(MorphPopover, {
178
+ open: open && present,
179
+ onOpenChange: setOpen,
180
+ className: cn(className),
181
+ children: /* @__PURE__ */ jsxs("span", {
182
+ onPointerEnter: (event) => {
183
+ cancelClose();
184
+ if (canHover && event.pointerType === "mouse") {
185
+ focusOnOpen.current = false;
186
+ setOpen(true);
187
+ }
188
+ },
189
+ onPointerLeave: leave,
190
+ children: [/* @__PURE__ */ jsx(MorphPopoverTrigger, { children: /* @__PURE__ */ jsx("button", {
191
+ ref: trigger,
192
+ type: "button",
193
+ "aria-label": label,
194
+ className: "inline-flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
195
+ onClick: (event) => {
196
+ focusOnOpen.current = event.detail === 0;
197
+ },
198
+ onKeyDown: (event) => {
199
+ if (event.key === "ArrowDown") {
200
+ event.preventDefault();
201
+ focusOnOpen.current = true;
202
+ setOpen(true);
203
+ panel.current?.querySelector("a[href],button")?.focus();
204
+ }
205
+ },
206
+ children: /* @__PURE__ */ jsx(Ellipsis, {
207
+ "aria-hidden": "true",
208
+ className: "size-4"
209
+ })
210
+ }) }), /* @__PURE__ */ jsx(MorphPopoverContent, {
211
+ align: placement.align,
212
+ side: placement.side,
213
+ radius: 10,
214
+ sideOffset: 6,
215
+ className: "p-1.5",
216
+ children: /* @__PURE__ */ jsx(BreadcrumbOverflowPaths, {
217
+ ref: panel,
218
+ style: { width: placement.width - 14 },
219
+ focusOnOpen,
220
+ onPointerEnter: () => {
221
+ cancelClose();
222
+ setOpen(true);
223
+ },
224
+ onPointerLeave: leave,
225
+ onClick: (event) => {
226
+ if (event.target.closest("a[href]")) setOpen(false);
227
+ },
228
+ children
229
+ })
230
+ })]
231
+ })
232
+ });
233
+ }
234
+ function BreadcrumbOverflowPaths({ focusOnOpen, ref, ...props }) {
235
+ const localRef = useRef(null);
236
+ useLayoutEffect(() => {
237
+ if (!focusOnOpen.current) return;
238
+ const focus = () => localRef.current?.querySelector("a[href],button")?.focus();
239
+ focus();
240
+ const frame = requestAnimationFrame(() => {
241
+ focus();
242
+ focusOnOpen.current = false;
243
+ });
244
+ return () => cancelAnimationFrame(frame);
245
+ }, [focusOnOpen]);
246
+ return /* @__PURE__ */ jsx("ol", {
247
+ ...props,
248
+ ref: (node) => {
249
+ localRef.current = node;
250
+ if (typeof ref === "function") return ref(node);
251
+ if (ref) ref.current = node;
252
+ },
253
+ className: "[&_a]:wrap-anywhere flex max-h-64 flex-col gap-0.5 overflow-y-auto **:data-breadcrumb-separator:hidden [&>li]:w-full [&_a]:w-full [&_a]:py-1"
254
+ });
255
+ }
256
+ //#endregion
257
+ export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
258
+
259
+ //# sourceMappingURL=breadcrumb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumb.js","names":[],"sources":["../../../src/components/motion/breadcrumb.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n type ComponentPropsWithRef,\n forwardRef,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { ChevronRight, Ellipsis } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n LayoutGroup,\n motion,\n useIsPresent,\n useReducedMotion,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\nimport { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from \"./popover-morph\";\n\nexport type BreadcrumbProps = ComponentPropsWithRef<\"nav\">;\n\n/** A navigation landmark. Keep it mounted while the route changes. */\nexport function Breadcrumb({ className, children, ...props }: BreadcrumbProps) {\n const id = useId();\n return (\n <nav aria-label=\"Breadcrumb\" {...props} className={cn(\"min-w-0\", className)}>\n <LayoutGroup id={id}>{children}</LayoutGroup>\n </nav>\n );\n}\n\nexport type BreadcrumbListProps = ComponentPropsWithRef<\"ol\"> & {\n /** Maximum visible slots, including the ellipsis. Minimum 3; Infinity disables collapsing. */\n maxItems?: number;\n /** Accessible label for the hidden ancestor disclosure. */\n overflowLabel?: string;\n};\n\n/** Pass keyed BreadcrumbItems directly so entering and leaving routes animate. */\nexport function BreadcrumbList({\n className,\n children,\n maxItems = 4,\n overflowLabel = \"Show hidden paths\",\n ...props\n}: BreadcrumbListProps) {\n const items = Children.toArray(children);\n const limit = Number.isFinite(maxItems) ? Math.max(3, Math.floor(maxItems)) : 4;\n const collapse = maxItems !== Infinity && items.length > limit;\n const tailCount = limit - 2;\n const visible = collapse\n ? [\n items[0],\n <BreadcrumbItem key=\"breadcrumb-overflow\">\n <BreadcrumbSeparator />\n <BreadcrumbEllipsis label={overflowLabel}>\n {items.slice(1, -tailCount)}\n </BreadcrumbEllipsis>\n </BreadcrumbItem>,\n ...items.slice(-tailCount),\n ]\n : items;\n return (\n <ol\n {...props}\n className={cn(\"relative flex flex-wrap items-center gap-x-1 gap-y-1 text-sm\", className)}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {visible}\n </AnimatePresence>\n </ol>\n );\n}\n\nexport type BreadcrumbItemProps = HTMLMotionProps<\"li\">;\n\n/** Use a stable route key; put its optional separator inside this item. */\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, BreadcrumbItemProps>(\n function BreadcrumbItem({ className, style, children, ...props }, ref) {\n const reduce = useReducedMotion();\n const present = useIsPresent();\n const itemRef = useRef<HTMLLIElement>(null);\n useLayoutEffect(() => {\n const item = itemRef.current;\n if (!item || !present) return;\n const measure = () => {\n // popLayout snapshots offsetWidth (integer pixels). Retain the exact\n // width so a fractional-pixel loss cannot wrap the final character.\n item.style.setProperty(\n \"--breadcrumb-exit-width\",\n `${item.getBoundingClientRect().width}px`,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(item);\n return () => observer.disconnect();\n }, [present]);\n const hidden = { opacity: 0, y: reduce ? 0 : 6 };\n return (\n <motion.li\n ref={(node) => {\n itemRef.current = node;\n if (typeof ref === \"function\") return ref(node);\n if (ref) ref.current = node;\n }}\n layout={reduce ? false : \"position\"}\n initial={hidden}\n animate={{ opacity: 1, y: 0 }}\n exit={hidden}\n transition={{ duration: 0.2, ease: EASE_OUT, layout: SPRING_LAYOUT }}\n {...props}\n inert={!present}\n aria-hidden={!present || undefined}\n style={{\n ...style,\n minWidth: present ? style?.minWidth : \"var(--breadcrumb-exit-width)\",\n pointerEvents: present ? style?.pointerEvents : \"none\",\n }}\n className={cn(\"relative inline-flex min-w-0 max-w-full items-center gap-1\", className)}\n >\n {children}\n </motion.li>\n );\n },\n);\n\nexport type BreadcrumbLinkProps = ComponentPropsWithRef<\"a\"> & {\n /** Render your router's Link, spreading these props onto it. */\n render?: (props: ComponentPropsWithRef<\"a\">) => ReactElement;\n};\n\nexport function BreadcrumbLink({ className, render, ...props }: BreadcrumbLinkProps) {\n const linkProps = {\n ...props,\n className: cn(\n \"inline-flex min-h-8 min-w-0 items-center gap-1.5 rounded-md px-2 font-medium text-muted-foreground transition-colors duration-150 hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&>svg]:size-3.5 [&>svg]:shrink-0\",\n className,\n ),\n };\n return render ? render(linkProps) : <a {...linkProps} />;\n}\n\nexport type BreadcrumbPageProps = ComponentPropsWithRef<\"span\">;\n\nexport function BreadcrumbPage({ className, children, ...props }: BreadcrumbPageProps) {\n return (\n <span\n {...props}\n aria-current=\"page\"\n className={cn(\n \"wrap-anywhere relative isolate inline-flex min-h-8 min-w-0 items-center gap-1.5 rounded-md px-2 font-medium text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&>svg]:size-3.5 [&>svg]:shrink-0\",\n className,\n )}\n >\n {children}\n </span>\n );\n}\n\nexport type BreadcrumbSeparatorProps = ComponentPropsWithRef<\"span\">;\n\n/** Decorative separator, placed inside the following BreadcrumbItem. */\nexport function BreadcrumbSeparator({ className, children, ...props }: BreadcrumbSeparatorProps) {\n return (\n <span\n {...props}\n aria-hidden=\"true\"\n data-breadcrumb-separator=\"\"\n className={cn(\n \"inline-flex shrink-0 items-center text-muted-foreground/50 rtl:rotate-180 [&>svg]:size-3.5\",\n className,\n )}\n >\n {children ?? <ChevronRight />}\n </span>\n );\n}\n\nexport interface BreadcrumbEllipsisProps {\n /** Hidden BreadcrumbItems, in path order. */\n children: ReactNode;\n className?: string;\n label?: string;\n}\n\n/** Hover disclosure with click/touch toggle and keyboard access to ancestor links. */\nexport function BreadcrumbEllipsis({\n children,\n className,\n label = \"Show hidden paths\",\n}: BreadcrumbEllipsisProps) {\n const [open, setOpen] = useState(false);\n const [placement, setPlacement] = useState<{\n align: \"start\" | \"end\";\n side: \"top\" | \"bottom\";\n width: number;\n }>({ align: \"start\", side: \"bottom\", width: 224 });\n const canHover = useHoverCapable();\n const present = useIsPresent();\n const trigger = useRef<HTMLButtonElement>(null);\n const panel = useRef<HTMLOListElement>(null);\n const focusOnOpen = useRef(false);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useLayoutEffect(() => {\n if (!open) return;\n const update = () => {\n const rect = trigger.current?.getBoundingClientRect();\n if (!rect) return;\n const right = window.innerWidth - rect.left - 8;\n const left = rect.right - 8;\n const align = right < 224 && left > right ? \"end\" : \"start\";\n const below = window.innerHeight - rect.bottom;\n setPlacement({\n align,\n side: below < 280 && rect.top > below ? \"top\" : \"bottom\",\n width: Math.max(32, Math.min(224, align === \"start\" ? right : left)),\n });\n };\n update();\n window.addEventListener(\"resize\", update);\n return () => window.removeEventListener(\"resize\", update);\n }, [open]);\n\n const cancelClose = () => {\n if (closeTimer.current !== null) clearTimeout(closeTimer.current);\n closeTimer.current = null;\n };\n const leave = () => {\n cancelClose();\n // Allow the pointer to cross the gap between the trigger and portal.\n closeTimer.current = setTimeout(() => {\n if (\n !panel.current?.contains(document.activeElement) &&\n document.activeElement !== trigger.current\n )\n setOpen(false);\n }, 160);\n };\n useEffect(\n () => () => {\n if (closeTimer.current !== null) clearTimeout(closeTimer.current);\n },\n [],\n );\n\n useEffect(() => {\n if (!open) return;\n const onFocus = (event: FocusEvent) => {\n if (\n event.target instanceof Node &&\n event.target !== trigger.current &&\n !panel.current?.contains(event.target)\n )\n setOpen(false);\n };\n document.addEventListener(\"focusin\", onFocus);\n return () => document.removeEventListener(\"focusin\", onFocus);\n }, [open]);\n\n return (\n <MorphPopover open={open && present} onOpenChange={setOpen} className={cn(className)}>\n <span\n onPointerEnter={(event) => {\n cancelClose();\n if (canHover && event.pointerType === \"mouse\") {\n focusOnOpen.current = false;\n setOpen(true);\n }\n }}\n onPointerLeave={leave}\n >\n <MorphPopoverTrigger>\n <button\n ref={trigger}\n type=\"button\"\n aria-label={label}\n className=\"inline-flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(event) => {\n focusOnOpen.current = event.detail === 0;\n }}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n focusOnOpen.current = true;\n setOpen(true);\n panel.current?.querySelector<HTMLElement>(\"a[href],button\")?.focus();\n }\n }}\n >\n <Ellipsis aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </MorphPopoverTrigger>\n <MorphPopoverContent\n align={placement.align}\n side={placement.side}\n radius={10}\n sideOffset={6}\n className=\"p-1.5\"\n >\n <BreadcrumbOverflowPaths\n ref={panel}\n style={{ width: placement.width - 14 }}\n focusOnOpen={focusOnOpen}\n onPointerEnter={() => {\n cancelClose();\n setOpen(true);\n }}\n onPointerLeave={leave}\n onClick={(event) => {\n if ((event.target as Element).closest(\"a[href]\")) setOpen(false);\n }}\n >\n {children}\n </BreadcrumbOverflowPaths>\n </MorphPopoverContent>\n </span>\n </MorphPopover>\n );\n}\n\nfunction BreadcrumbOverflowPaths({\n focusOnOpen,\n ref,\n ...props\n}: ComponentPropsWithRef<\"ol\"> & { focusOnOpen: { current: boolean } }) {\n const localRef = useRef<HTMLOListElement>(null);\n useLayoutEffect(() => {\n if (!focusOnOpen.current) return;\n const focus = () => localRef.current?.querySelector<HTMLElement>(\"a[href],button\")?.focus();\n focus();\n // The portal becomes visible after its parent's layout measurement.\n const frame = requestAnimationFrame(() => {\n focus();\n focusOnOpen.current = false;\n });\n return () => cancelAnimationFrame(frame);\n }, [focusOnOpen]);\n return (\n <ol\n {...props}\n ref={(node) => {\n localRef.current = node;\n if (typeof ref === \"function\") return ref(node);\n if (ref) ref.current = node;\n }}\n className=\"[&_a]:wrap-anywhere flex max-h-64 flex-col gap-0.5 overflow-y-auto **:data-breadcrumb-separator:hidden [&>li]:w-full [&_a]:w-full [&_a]:py-1\"\n />\n );\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgB,WAAW,EAAE,WAAW,UAAU,GAAG,SAA0B;CAC7E,MAAM,KAAK,MAAM;CACjB,OACE,oBAAC,OAAD;EAAK,cAAW;EAAa,GAAI;EAAO,WAAW,GAAG,WAAW,SAAS;EACxE,UAAA,oBAAC,aAAD;GAAiB;GAAK;EAAsB,CAAA;CACzC,CAAA;AAET;;AAUA,SAAgB,eAAe,EAC7B,WACA,UACA,WAAW,GACX,gBAAgB,qBAChB,GAAG,SACmB;CACtB,MAAM,QAAQ,SAAS,QAAQ,QAAQ;CACvC,MAAM,QAAQ,OAAO,SAAS,QAAQ,IAAI,KAAK,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;GACN,YAAY,UAAU;EACxB,CAAC;EACD,aAAa,qBAAqB,KAAK;CACzC,GAAG,CAAC,WAAW,CAAC;CAChB,OACE,oBAAC,MAAD;EACE,GAAI;EACJ,MAAM,SAAS;GACb,SAAS,UAAU;GACnB,IAAI,OAAO,QAAQ,YAAY,OAAO,IAAI,IAAI;GAC9C,IAAI,KAAK,IAAI,UAAU;EACzB;EACA,WAAU;CACX,CAAA;AAEL"}
@@ -2,9 +2,9 @@
2
2
  import { EASE_OUT, SPRING_SWAP } from "../../../lib/ease.js";
3
3
  import { Button } from "./base.js";
4
4
  import { forwardRef, useLayoutEffect, useRef, useState } from "react";
5
- import { Check, Loader2, X } from "lucide-react";
6
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
6
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
+ import { Check, Loader2, X } from "lucide-react";
8
8
  //#region src/components/motion/button/stateful.tsx
9
9
  const CASCADE_STAGGER = .025;
10
10
  const ROLL_BLUR = "blur(6px)";
@@ -3,9 +3,9 @@ import { EASE_IN_OUT, EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ea
3
3
  import { DigitSwap } from "./digit-swap.js";
4
4
  import { useCallback, useEffect, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
- import { EllipsisVertical, Eye, EyeOff } from "lucide-react";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
8
7
  import { AnimatePresence, animate, motion, useMotionValue, useReducedMotion, useTransform } from "motion/react";
8
+ import { EllipsisVertical, Eye, EyeOff } from "lucide-react";
9
9
  //#region src/components/motion/card-folder.tsx
10
10
  const PURSE_MORPH_TRANSITION = {
11
11
  duration: .28,
@@ -3,9 +3,9 @@ import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { t as PresenceGate } from "../../presence-gate-BekdC4Bo.js";
4
4
  import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
- import { X } from "lucide-react";
7
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
+ import { X } from "lucide-react";
9
9
  import { createPortal } from "react-dom";
10
10
  //#region src/components/motion/center-morph-modal.tsx
11
11
  const CenterMorphModalContext = createContext(null);
@@ -0,0 +1,28 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ //#region src/components/motion/color-selector.d.ts
3
+ export interface ColorSelectorProps extends Omit<ComponentPropsWithRef<"fieldset">, "onChange" | "defaultValue"> {
4
+ value?: string;
5
+ defaultValue?: string;
6
+ onValueChange?: (value: string) => void;
7
+ /** The radio group name used in form submission. Generated when omitted. */
8
+ name?: string;
9
+ required?: boolean;
10
+ }
11
+ /** A single color choice. Give it a ColorSelectorLabel or an aria-label. */
12
+ export declare function ColorSelector({ value, defaultValue, onValueChange, name, disabled, required, form, className, children, ...props }: ColorSelectorProps): import("react").JSX.Element;
13
+ export type ColorSelectorLabelProps = ComponentPropsWithRef<"legend">;
14
+ export declare function ColorSelectorLabel({ className, ...props }: ColorSelectorLabelProps): import("react").JSX.Element;
15
+ export type ColorSelectorListProps = ComponentPropsWithRef<"div">;
16
+ export declare function ColorSelectorList({ className, ...props }: ColorSelectorListProps): import("react").JSX.Element;
17
+ export interface ColorSelectorItemProps extends Omit<ComponentPropsWithRef<"input">, "type" | "value" | "defaultValue" | "checked" | "defaultChecked" | "name" | "children" | "size"> {
18
+ value: string;
19
+ /** Any CSS color, including a custom property. */
20
+ color: string;
21
+ /** Accessible color name; selection never relies on color alone. */
22
+ label: string;
23
+ /** Applied to the visible swatch surface. */
24
+ className?: string;
25
+ }
26
+ export declare function ColorSelectorItem({ value, color, label, disabled, className, style, onChange, ...props }: ColorSelectorItemProps): import("react").JSX.Element;
27
+ //#endregion
28
+ //# sourceMappingURL=color-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-selector.d.ts","names":[],"sources":["../../../src/components/motion/color-selector.tsx"],"mappings":";;iBAmBiB,2BACP,KAAK;EACb;EACA;EACA,iBAAiB;;EAEjB;EACA;;;wBAIc,gBACd,OACA,cACA,eACA,MACA,UACA,UACA,MACA,WACA,aACG,SACF,qCAAkB,IAAA;YA+BT,0BAA0B;wBAEtB,qBAAqB,cAAc,SAAS,0CAAuB,IAAA;YASvE,yBAAyB;wBAErB,oBAAoB,cAAc,SAAS,yCAAsB,IAAA;iBAIhE,+BACP,KACN;EAGF;;EAEA;;EAEA;;EAEA;;wBAGc,oBACd,OACA,OACA,OACA,UACA,WACA,OACA,aACG,SACF,yCAAsB,IAAA"}
@@ -0,0 +1,97 @@
1
+ "use client";
2
+ import { SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
3
+ import { createContext, useContext, useId, useState } from "react";
4
+ import { cn } from "@kumix/utils";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { LayoutGroup, motion, useReducedMotion } from "motion/react";
7
+ //#region src/components/motion/color-selector.tsx
8
+ const ColorSelectorContext = createContext(null);
9
+ /** A single color choice. Give it a ColorSelectorLabel or an aria-label. */
10
+ function ColorSelector({ value, defaultValue = "", onValueChange, name, disabled = false, required = false, form, className, children, ...props }) {
11
+ const id = useId();
12
+ const [internal, setInternal] = useState(defaultValue);
13
+ const current = value ?? internal;
14
+ return /* @__PURE__ */ jsx(ColorSelectorContext.Provider, {
15
+ value: {
16
+ value: current,
17
+ select: (next) => {
18
+ if (next === current) return;
19
+ if (value === void 0) setInternal(next);
20
+ onValueChange?.(next);
21
+ },
22
+ name: name ?? id,
23
+ disabled,
24
+ required,
25
+ form
26
+ },
27
+ children: /* @__PURE__ */ jsx("fieldset", {
28
+ ...props,
29
+ disabled,
30
+ form,
31
+ className: cn("min-w-0 border-0 p-0", className),
32
+ children: /* @__PURE__ */ jsx(LayoutGroup, {
33
+ id,
34
+ children
35
+ })
36
+ })
37
+ });
38
+ }
39
+ function ColorSelectorLabel({ className, ...props }) {
40
+ return /* @__PURE__ */ jsx("legend", {
41
+ ...props,
42
+ className: cn("mb-3 p-0 font-medium text-muted-foreground text-sm", className)
43
+ });
44
+ }
45
+ function ColorSelectorList({ className, ...props }) {
46
+ return /* @__PURE__ */ jsx("div", {
47
+ ...props,
48
+ className: cn("flex flex-wrap items-center gap-3 p-1", className)
49
+ });
50
+ }
51
+ function ColorSelectorItem({ value, color, label, disabled = false, className, style, onChange, ...props }) {
52
+ const context = useContext(ColorSelectorContext);
53
+ const reduce = useReducedMotion();
54
+ if (!context) throw new Error("ColorSelectorItem must be used within ColorSelector");
55
+ const selected = context.value === value;
56
+ const unavailable = disabled || context.disabled;
57
+ return /* @__PURE__ */ jsxs(motion.label, {
58
+ tabIndex: -1,
59
+ whileTap: reduce || unavailable ? void 0 : { scale: .94 },
60
+ transition: SPRING_PRESS,
61
+ className: cn("relative inline-flex shrink-0 rounded-full", unavailable ? "cursor-not-allowed opacity-40" : "cursor-pointer"),
62
+ children: [/* @__PURE__ */ jsx("input", {
63
+ ...props,
64
+ type: "radio",
65
+ name: context.name,
66
+ value,
67
+ checked: selected,
68
+ disabled: unavailable,
69
+ required: context.required,
70
+ form: context.form,
71
+ "aria-label": label,
72
+ onChange: (event) => {
73
+ onChange?.(event);
74
+ if (!event.defaultPrevented) context.select(value);
75
+ },
76
+ className: "peer sr-only"
77
+ }), /* @__PURE__ */ jsxs("span", {
78
+ "aria-hidden": "true",
79
+ style,
80
+ className: cn("relative flex size-11 items-center justify-center rounded-full border border-foreground/10 bg-muted/60", "peer-focus-visible:outline-2 peer-focus-visible:outline-foreground peer-focus-visible:outline-offset-4", className),
81
+ children: [selected && /* @__PURE__ */ jsx(motion.span, {
82
+ layoutId: reduce ? void 0 : "color-selection",
83
+ initial: false,
84
+ transition: SPRING_LAYOUT,
85
+ className: "pointer-events-none absolute -inset-1 rounded-full border-2",
86
+ style: { borderColor: `color-mix(in srgb, ${color} 65%, transparent)` }
87
+ }), /* @__PURE__ */ jsx("span", {
88
+ className: "size-5 rounded-full border border-black/5",
89
+ style: { backgroundColor: color }
90
+ })]
91
+ })]
92
+ });
93
+ }
94
+ //#endregion
95
+ export { ColorSelector, ColorSelectorItem, ColorSelectorLabel, ColorSelectorList };
96
+
97
+ //# sourceMappingURL=color-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-selector.js","names":[],"sources":["../../../src/components/motion/color-selector.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentPropsWithRef, createContext, useContext, useId, useState } from \"react\";\nimport { LayoutGroup, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\n\ntype ColorSelectorContextValue = {\n value: string;\n select: (value: string) => void;\n name: string;\n disabled: boolean;\n required: boolean;\n form?: string;\n};\n\nconst ColorSelectorContext = createContext<ColorSelectorContextValue | null>(null);\n\nexport interface ColorSelectorProps\n extends Omit<ComponentPropsWithRef<\"fieldset\">, \"onChange\" | \"defaultValue\"> {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** The radio group name used in form submission. Generated when omitted. */\n name?: string;\n required?: boolean;\n}\n\n/** A single color choice. Give it a ColorSelectorLabel or an aria-label. */\nexport function ColorSelector({\n value,\n defaultValue = \"\",\n onValueChange,\n name,\n disabled = false,\n required = false,\n form,\n className,\n children,\n ...props\n}: ColorSelectorProps) {\n const id = useId();\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n return (\n <ColorSelectorContext.Provider\n value={{\n value: current,\n select: (next) => {\n if (next === current) return;\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n name: name ?? id,\n disabled,\n required,\n form,\n }}\n >\n <fieldset\n {...props}\n disabled={disabled}\n form={form}\n className={cn(\"min-w-0 border-0 p-0\", className)}\n >\n <LayoutGroup id={id}>{children}</LayoutGroup>\n </fieldset>\n </ColorSelectorContext.Provider>\n );\n}\n\nexport type ColorSelectorLabelProps = ComponentPropsWithRef<\"legend\">;\n\nexport function ColorSelectorLabel({ className, ...props }: ColorSelectorLabelProps) {\n return (\n <legend\n {...props}\n className={cn(\"mb-3 p-0 font-medium text-muted-foreground text-sm\", className)}\n />\n );\n}\n\nexport type ColorSelectorListProps = ComponentPropsWithRef<\"div\">;\n\nexport function ColorSelectorList({ className, ...props }: ColorSelectorListProps) {\n return <div {...props} className={cn(\"flex flex-wrap items-center gap-3 p-1\", className)} />;\n}\n\nexport interface ColorSelectorItemProps\n extends Omit<\n ComponentPropsWithRef<\"input\">,\n \"type\" | \"value\" | \"defaultValue\" | \"checked\" | \"defaultChecked\" | \"name\" | \"children\" | \"size\"\n > {\n value: string;\n /** Any CSS color, including a custom property. */\n color: string;\n /** Accessible color name; selection never relies on color alone. */\n label: string;\n /** Applied to the visible swatch surface. */\n className?: string;\n}\n\nexport function ColorSelectorItem({\n value,\n color,\n label,\n disabled = false,\n className,\n style,\n onChange,\n ...props\n}: ColorSelectorItemProps) {\n const context = useContext(ColorSelectorContext);\n const reduce = useReducedMotion();\n if (!context) throw new Error(\"ColorSelectorItem must be used within ColorSelector\");\n const selected = context.value === value;\n const unavailable = disabled || context.disabled;\n return (\n <motion.label\n tabIndex={-1}\n whileTap={reduce || unavailable ? undefined : { scale: 0.94 }}\n transition={SPRING_PRESS}\n className={cn(\n \"relative inline-flex shrink-0 rounded-full\",\n unavailable ? \"cursor-not-allowed opacity-40\" : \"cursor-pointer\",\n )}\n >\n <input\n {...props}\n type=\"radio\"\n name={context.name}\n value={value}\n checked={selected}\n disabled={unavailable}\n required={context.required}\n form={context.form}\n aria-label={label}\n onChange={(event) => {\n onChange?.(event);\n if (!event.defaultPrevented) context.select(value);\n }}\n className=\"peer sr-only\"\n />\n <span\n aria-hidden=\"true\"\n style={style}\n className={cn(\n \"relative flex size-11 items-center justify-center rounded-full border border-foreground/10 bg-muted/60\",\n \"peer-focus-visible:outline-2 peer-focus-visible:outline-foreground peer-focus-visible:outline-offset-4\",\n className,\n )}\n >\n {selected && (\n <motion.span\n layoutId={reduce ? undefined : \"color-selection\"}\n initial={false}\n transition={SPRING_LAYOUT}\n className=\"pointer-events-none absolute -inset-1 rounded-full border-2\"\n style={{ borderColor: `color-mix(in srgb, ${color} 65%, transparent)` }}\n />\n )}\n <span\n className=\"size-5 rounded-full border border-black/5\"\n style={{ backgroundColor: color }}\n />\n </span>\n </motion.label>\n );\n}\n"],"mappings":";;;;;;;AAiBA,MAAM,uBAAuB,cAAgD,IAAI;;AAajF,SAAgB,cAAc,EAC5B,OACA,eAAe,IACf,eACA,MACA,WAAW,OACX,WAAW,OACX,MACA,WACA,UACA,GAAG,SACkB;CACrB,MAAM,KAAK,MAAM;CACjB,MAAM,CAAC,UAAU,eAAe,SAAS,YAAY;CACrD,MAAM,UAAU,SAAS;CACzB,OACE,oBAAC,qBAAqB,UAAtB;EACE,OAAO;GACL,OAAO;GACP,SAAS,SAAS;IAChB,IAAI,SAAS,SAAS;IACtB,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;IACzC,gBAAgB,IAAI;GACtB;GACA,MAAM,QAAQ;GACd;GACA;GACA;EACF;EAEA,UAAA,oBAAC,YAAD;GACE,GAAI;GACM;GACJ;GACN,WAAW,GAAG,wBAAwB,SAAS;GAE/C,UAAA,oBAAC,aAAD;IAAiB;IAAK;GAAsB,CAAA;EACpC,CAAA;CACmB,CAAA;AAEnC;AAIA,SAAgB,mBAAmB,EAAE,WAAW,GAAG,SAAkC;CACnF,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,WAAW,GAAG,sDAAsD,SAAS;CAC9E,CAAA;AAEL;AAIA,SAAgB,kBAAkB,EAAE,WAAW,GAAG,SAAiC;CACjF,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAO,WAAW,GAAG,yCAAyC,SAAS;CAAI,CAAA;AAC7F;AAgBA,SAAgB,kBAAkB,EAChC,OACA,OACA,OACA,WAAW,OACX,WACA,OACA,UACA,GAAG,SACsB;CACzB,MAAM,UAAU,WAAW,oBAAoB;CAC/C,MAAM,SAAS,iBAAiB;CAChC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,qDAAqD;CACnF,MAAM,WAAW,QAAQ,UAAU;CACnC,MAAM,cAAc,YAAY,QAAQ;CACxC,OACE,qBAAC,OAAO,OAAR;EACE,UAAU;EACV,UAAU,UAAU,cAAc,KAAA,IAAY,EAAE,OAAO,IAAK;EAC5D,YAAY;EACZ,WAAW,GACT,8CACA,cAAc,kCAAkC,gBAClD;EAPF,UAAA,CASE,oBAAC,SAAD;GACE,GAAI;GACJ,MAAK;GACL,MAAM,QAAQ;GACP;GACP,SAAS;GACT,UAAU;GACV,UAAU,QAAQ;GAClB,MAAM,QAAQ;GACd,cAAY;GACZ,WAAW,UAAU;IACnB,WAAW,KAAK;IAChB,IAAI,CAAC,MAAM,kBAAkB,QAAQ,OAAO,KAAK;GACnD;GACA,WAAU;EACX,CAAA,GACD,qBAAC,QAAD;GACE,eAAY;GACL;GACP,WAAW,GACT,0GACA,0GACA,SACF;GAPF,UAAA,CASG,YACC,oBAAC,OAAO,MAAR;IACE,UAAU,SAAS,KAAA,IAAY;IAC/B,SAAS;IACT,YAAY;IACZ,WAAU;IACV,OAAO,EAAE,aAAa,sBAAsB,MAAM,oBAAoB;GACvE,CAAA,GAEH,oBAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,MAAM;GACjC,CAAA,CACG;EACM,CAAA,CAAA;;AAElB"}
@@ -3,9 +3,9 @@ import { EASE_OUT, SPRING_LAYOUT } from "../../../lib/ease.js";
3
3
  import { ComboboxGroupContext, useComboboxContext } from "./context.js";
4
4
  import { useContext, useId, useLayoutEffect, useMemo, useRef } from "react";
5
5
  import { cn } from "@kumix/utils";
6
- import { Check } from "lucide-react";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
8
7
  import { motion } from "motion/react";
8
+ import { Check } from "lucide-react";
9
9
  //#region src/components/motion/combobox/list.tsx
10
10
  function ComboboxList({ children, ariaLabel = "Options", className }) {
11
11
  const context = useComboboxContext("ComboboxList");
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { mergeRefs, useComboboxContext } from "./context.js";
3
3
  import { cn } from "@kumix/utils";
4
- import { ChevronsUpDown, Search } from "lucide-react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { ChevronsUpDown, Search } from "lucide-react";
6
6
  //#region src/components/motion/combobox/trigger.tsx
7
7
  function ComboboxTrigger({ children, className }) {
8
8
  const context = useComboboxContext("ComboboxTrigger");
@@ -7,9 +7,9 @@ import { EASE_OUT } from "../../lib/ease.js";
7
7
  import { t as PresenceGate } from "../../presence-gate-BekdC4Bo.js";
8
8
  import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
9
9
  import { cn } from "@kumix/utils";
10
- import { Search } from "lucide-react";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
12
11
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
12
+ import { Search } from "lucide-react";
13
13
  import { createPortal } from "react-dom";
14
14
  //#region src/components/motion/command-palette.tsx
15
15
  const PANEL_SPRING = {
@@ -1 +1 @@
1
- {"version":3,"file":"command-palette.js","names":[],"sources":["../../../src/components/motion/command-palette.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { type LucideIcon, Search } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useOnOpen } from \"../../hooks/use-on-open\";\nimport { useRowCursor } from \"../../hooks/use-row-cursor\";\nimport { useTouchCapable } from \"../../hooks/use-touch-capable\";\nimport { searchCommands } from \"../../lib/command-search\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\n\nexport type CommandItem = {\n id: string;\n label: string;\n group?: string;\n hint?: string;\n keywords?: string[];\n icon?: LucideIcon;\n badge?: ReactNode;\n onSelect: () => void;\n};\n\nexport interface CommandPaletteProps {\n items: CommandItem[];\n /** Opens with Cmd/Ctrl + this key. Default: \"k\" */\n shortcut?: string;\n placeholder?: string;\n emptyMessage?: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n// Opened via a keyboard shortcut many times a day — entrance must read as\n// instant. Tight spring, even faster exit.\nconst PANEL_SPRING = {\n type: \"spring\",\n stiffness: 560,\n damping: 40,\n mass: 0.5,\n} as const;\n\nexport function CommandPalette({\n items,\n shortcut = \"k\",\n placeholder = \"Type a command or search…\",\n emptyMessage = \"No results found.\",\n open: controlledOpen,\n onOpenChange,\n}: CommandPaletteProps) {\n const [internalOpen, setInternalOpen] = useState(false);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n const setOpen = useCallback(\n (v: boolean) => {\n if (!controlled) setInternalOpen(v);\n onOpenChange?.(v);\n },\n [controlled, onOpenChange],\n );\n\n const [query, setQuery] = useState(\"\");\n // Portal target only exists client-side; render nothing during SSR/hydration.\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n const uid = useId();\n const reduce = useReducedMotion();\n const canTouch = useTouchCapable();\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === shortcut.toLowerCase()) {\n e.preventDefault();\n setOpen(!open);\n return;\n }\n if (e.key === \"Escape\" && open) {\n e.preventDefault();\n setOpen(false);\n }\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [open, shortcut, setOpen]);\n\n useEffect(() => {\n if (!open) return;\n const root = document.documentElement;\n const previousRootOverflow = root.style.overflow;\n const previousBodyOverflow = document.body.style.overflow;\n root.style.overflow = \"hidden\";\n document.body.style.overflow = \"hidden\";\n return () => {\n root.style.overflow = previousRootOverflow;\n document.body.style.overflow = previousBodyOverflow;\n };\n }, [open]);\n\n const filtered = useMemo(() => searchCommands(items, query), [items, query]);\n\n // Reserve the icon column only when at least one item brings an icon, so\n // icon-less lists don't render a dead gap before every label.\n const hasIcons = useMemo(() => items.some((it) => it.icon), [items]);\n\n const grouped = useMemo(() => {\n const map = new Map<string, CommandItem[]>();\n filtered.forEach((it) => {\n const g = it.group ?? \"Results\";\n const groupItems = map.get(g) ?? [];\n groupItems.push(it);\n map.set(g, groupItems);\n });\n return Array.from(map.entries());\n }, [filtered]);\n\n // Grouping reorders the list, so the rendered order is not the filtered\n // order whenever two groups interleave. Everything that has to agree on\n // \"which row\" — the highlight, the ids, Enter, the scroll — reads this one\n // array, so they cannot drift apart.\n const rows = useMemo(() => grouped.flatMap(([, list]) => list), [grouped]);\n\n const { activeIndex: active, moveTo, moveActive } = useRowCursor(rows, query);\n\n // Clearing the query would drop the cursor on its own, but only if it had\n // changed; `moveTo(null)` covers reopening on an already-empty query.\n useOnOpen(open, () => {\n setQuery(\"\");\n moveTo(null);\n });\n\n useEffect(() => {\n if (!open) return;\n const frame = requestAnimationFrame(() => inputRef.current?.focus());\n return () => cancelAnimationFrame(frame);\n }, [open]);\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveActive(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveActive(-1);\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const it = rows[active];\n if (it) {\n it.onSelect();\n setOpen(false);\n }\n }\n };\n\n useEffect(() => {\n if (!open) return;\n const el = listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${active}\"]`);\n el?.scrollIntoView({ block: \"nearest\" });\n }, [active, open]);\n\n if (!mounted) return null;\n\n // Portaled to <body> so ancestors with transforms, filters, or fixed\n // positioning can't trap the overlay in their stacking context, and mounted\n // only while open. The chrome is two fixed siblings rather than one wrapper:\n // the backdrop spans the viewport edges but carries the scrim colour, and the\n // layer positioning the panel is inset off every edge. Both hang off\n // `PresenceGate`, so interaction releases in the same commit that starts the\n // exit rather than when it ends — `open` is already false for those frames.\n // See tests/fixed-overlay-edge-sampling.test.tsx.\n return createPortal(\n <AnimatePresence initial={false}>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close command palette\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{\n opacity: 0,\n transition: { duration: 0.12, ease: EASE_OUT },\n }}\n transition={{ duration: 0.18, ease: EASE_OUT }}\n {...gate}\n onClick={() => setOpen(false)}\n className=\"pointer-events-auto fixed inset-0 z-100 bg-background/5 [-webkit-backdrop-filter:blur(12px)_saturate(140%)] [backdrop-filter:blur(12px)_saturate(140%)]\"\n />\n )}\n </PresenceGate>\n ) : null}\n\n {open ? (\n <PresenceGate key=\"panel-layer\">\n {({ isPresent, gate }) => (\n // The layer itself never takes pointer events, so it carries\n // `inert` alone rather than the gate's pointer-events value.\n <div\n inert={!isPresent}\n className=\"pointer-events-none fixed inset-x-4 top-[18vh] bottom-4 z-100 flex items-start justify-center\"\n >\n <motion.div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command palette\"\n initial={{\n opacity: 0,\n y: reduce ? 0 : -8,\n scale: reduce ? 1 : 0.97,\n }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{\n opacity: 0,\n y: reduce ? 0 : -8,\n scale: reduce ? 1 : 0.97,\n transition: { duration: 0.12, ease: EASE_OUT },\n }}\n transition={reduce ? { duration: 0.1 } : PANEL_SPRING}\n {...gate}\n onKeyDown={onKeyDown}\n className=\"pointer-events-auto w-full max-w-xl overflow-hidden rounded-2xl border border-border bg-card shadow-2xl will-change-transform\"\n >\n <div className=\"flex items-center gap-3 border-border border-b px-4\">\n <Search className=\"h-4 w-4 text-muted-foreground\" />\n <input\n ref={inputRef}\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={placeholder}\n role=\"combobox\"\n // The field only exists while the palette is open.\n aria-expanded=\"true\"\n aria-controls={`${uid}-list`}\n aria-activedescendant={rows.length > 0 ? `${uid}-opt-${active}` : undefined}\n aria-autocomplete=\"list\"\n className={cn(\n \"h-12 flex-1 bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground\",\n // The palette focuses this field the moment it opens, and iOS\n // zooms the page in on a focused field under 16px: the fixed\n // overlay is magnified off-center — clipped leading edge, half\n // an icon column — and the zoom outlives the palette. 16px on\n // touch keeps the page at scale 1; pointer devices keep 14px.\n canTouch && \"text-base\",\n )}\n />\n <kbd className=\"hidden rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground sm:inline-block\">\n ESC\n </kbd>\n </div>\n <div\n ref={listRef}\n id={`${uid}-list`}\n role=\"listbox\"\n aria-label=\"Commands\"\n className=\"max-h-[60vh] overflow-y-auto overscroll-contain p-2 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\"\n >\n {rows.length === 0 ? (\n <div className=\"p-8 text-center text-muted-foreground text-sm\">\n {emptyMessage}\n </div>\n ) : (\n grouped.map(([group, list]) => (\n <div key={group} className=\"mb-1 last:mb-0\">\n <div\n aria-hidden\n className=\"px-2 py-1.5 font-semibold text-[10px] text-muted-foreground uppercase tracking-wider\"\n >\n {group}\n </div>\n {list.map((it) => {\n // `rows` holds these very objects, in render order.\n const idx = rows.indexOf(it);\n const isActive = idx === active;\n const Icon = it.icon;\n return (\n <button\n key={it.id}\n type=\"button\"\n id={`${uid}-opt-${idx}`}\n role=\"option\"\n aria-selected={isActive}\n data-index={idx}\n onMouseEnter={() => moveTo(it.id)}\n onClick={() => {\n it.onSelect();\n setOpen(false);\n }}\n className={cn(\n \"relative isolate flex w-full items-center gap-3 rounded-md px-2 py-2 text-left text-sm transition-colors\",\n isActive ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {isActive ? (\n <motion.span\n layoutId={`${uid}-active`}\n className=\"absolute inset-0 z-0 rounded-md bg-muted/60\"\n transition={\n reduce\n ? { duration: 0 }\n : // Tracks rapid arrow-key navigation — keep it tighter\n // than SPRING_LAYOUT so it never lags the active row.\n {\n type: \"spring\",\n stiffness: 480,\n damping: 38,\n }\n }\n />\n ) : null}\n {Icon ? (\n <Icon className=\"relative z-10 h-4 w-4\" />\n ) : hasIcons ? (\n <span className=\"relative z-10 h-4 w-4\" />\n ) : null}\n <span className=\"relative z-10 flex-1 truncate\">{it.label}</span>\n {it.badge ? (\n <span className=\"relative z-10 shrink-0\">{it.badge}</span>\n ) : null}\n {it.hint ? (\n <kbd className=\"relative z-10 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground\">\n {it.hint}\n </kbd>\n ) : null}\n </button>\n );\n })}\n </div>\n ))\n )}\n </div>\n </motion.div>\n </div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,eAAe;CACnB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,SAAgB,eAAe,EAC7B,OACA,WAAW,KACX,cAAc,6BACd,eAAe,qBACf,MAAM,gBACN,gBACsB;CACtB,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,aAAa,mBAAmB,KAAA;CACtC,MAAM,OAAO,aAAa,iBAAiB;CAC3C,MAAM,UAAU,aACb,MAAe;EACd,IAAI,CAAC,YAAY,gBAAgB,CAAC;EAClC,eAAe,CAAC;CAClB,GACA,CAAC,YAAY,YAAY,CAC3B;CAEA,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CAErC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,gBAAgB,WAAW,IAAI,GAAG,CAAC,CAAC;CACpC,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,UAAU,OAAuB,IA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AAO,GAAG;OAChB,OACE,qBAAC,UAAD;QAEE,MAAK;QACL,IAAI,GAAG,IAAI,OAAO;QAClB,MAAK;QACL,iBAAe;QACf,cAAY;QACZ,oBAAoB,OAAO,GAAG,EAAE;QAChC,eAAe;SACb,GAAG,SAAS;SACZ,QAAQ,KAAK;QACf;QACA,WAAW,GACT,4GACA,WAAW,oBAAoB,uBACjC;QAfF,UAAA;SAiBG,WACC,oBAAC,OAAO,MAAR;UACE,UAAU,GAAG,IAAI;UACjB,WAAU;UACV,YACE,SACI,EAAE,UAAU,EAAE,IAGd;WACE,MAAM;WACN,WAAW;WACX,SAAS;UACX;SAEP,CAAA,IACC;SACH,OACC,oBAAC,MAAD,EAAM,WAAU,wBAAyB,CAAA,IACvC,WACF,oBAAC,QAAD,EAAM,WAAU,wBAAyB,CAAA,IACvC;SACJ,oBAAC,QAAD;UAAM,WAAU;UAAiC,UAAA,GAAG;SAAY,CAAA;SAC/D,GAAG,QACF,oBAAC,QAAD;UAAM,WAAU;UAA0B,UAAA,GAAG;SAAY,CAAA,IACvD;SACH,GAAG,OACF,oBAAC,OAAD;UAAK,WAAU;UACZ,UAAA,GAAG;SACD,CAAA,IACH;QACE;OA/CD,GAAA,GAAG,EA+CF;MAEZ,CAAC,CACE;KAhEK,GAAA,KAgEL,CACN;IAEA,CAAA,CACK;;EACT,CAAA,EAEK,GA5II,aA4IJ,IACZ,IACW;CACjB,CAAA,GAAA,SAAS,IACX;AACF"}
1
+ {"version":3,"file":"command-palette.js","names":[],"sources":["../../../src/components/motion/command-palette.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { type LucideIcon, Search } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useOnOpen } from \"../../hooks/use-on-open\";\nimport { useRowCursor } from \"../../hooks/use-row-cursor\";\nimport { useTouchCapable } from \"../../hooks/use-touch-capable\";\nimport { searchCommands } from \"../../lib/command-search\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\n\nexport type CommandItem = {\n id: string;\n label: string;\n group?: string;\n hint?: string;\n keywords?: string[];\n icon?: LucideIcon;\n badge?: ReactNode;\n onSelect: () => void;\n};\n\nexport interface CommandPaletteProps {\n items: CommandItem[];\n /** Opens with Cmd/Ctrl + this key. Default: \"k\" */\n shortcut?: string;\n placeholder?: string;\n emptyMessage?: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n// Opened via a keyboard shortcut many times a day — entrance must read as\n// instant. Tight spring, even faster exit.\nconst PANEL_SPRING = {\n type: \"spring\",\n stiffness: 560,\n damping: 40,\n mass: 0.5,\n} as const;\n\nexport function CommandPalette({\n items,\n shortcut = \"k\",\n placeholder = \"Type a command or search…\",\n emptyMessage = \"No results found.\",\n open: controlledOpen,\n onOpenChange,\n}: CommandPaletteProps) {\n const [internalOpen, setInternalOpen] = useState(false);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n const setOpen = useCallback(\n (v: boolean) => {\n if (!controlled) setInternalOpen(v);\n onOpenChange?.(v);\n },\n [controlled, onOpenChange],\n );\n\n const [query, setQuery] = useState(\"\");\n // Portal target only exists client-side; render nothing during SSR/hydration.\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n const uid = useId();\n const reduce = useReducedMotion();\n const canTouch = useTouchCapable();\n const inputRef = useRef<HTMLInputElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === shortcut.toLowerCase()) {\n e.preventDefault();\n setOpen(!open);\n return;\n }\n if (e.key === \"Escape\" && open) {\n e.preventDefault();\n setOpen(false);\n }\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [open, shortcut, setOpen]);\n\n useEffect(() => {\n if (!open) return;\n const root = document.documentElement;\n const previousRootOverflow = root.style.overflow;\n const previousBodyOverflow = document.body.style.overflow;\n root.style.overflow = \"hidden\";\n document.body.style.overflow = \"hidden\";\n return () => {\n root.style.overflow = previousRootOverflow;\n document.body.style.overflow = previousBodyOverflow;\n };\n }, [open]);\n\n const filtered = useMemo(() => searchCommands(items, query), [items, query]);\n\n // Reserve the icon column only when at least one item brings an icon, so\n // icon-less lists don't render a dead gap before every label.\n const hasIcons = useMemo(() => items.some((it) => it.icon), [items]);\n\n const grouped = useMemo(() => {\n const map = new Map<string, CommandItem[]>();\n filtered.forEach((it) => {\n const g = it.group ?? \"Results\";\n const groupItems = map.get(g) ?? [];\n groupItems.push(it);\n map.set(g, groupItems);\n });\n return Array.from(map.entries());\n }, [filtered]);\n\n // Grouping reorders the list, so the rendered order is not the filtered\n // order whenever two groups interleave. Everything that has to agree on\n // \"which row\" — the highlight, the ids, Enter, the scroll — reads this one\n // array, so they cannot drift apart.\n const rows = useMemo(() => grouped.flatMap(([, list]) => list), [grouped]);\n\n const { activeIndex: active, moveTo, moveActive } = useRowCursor(rows, query);\n\n // Clearing the query would drop the cursor on its own, but only if it had\n // changed; `moveTo(null)` covers reopening on an already-empty query.\n useOnOpen(open, () => {\n setQuery(\"\");\n moveTo(null);\n });\n\n useEffect(() => {\n if (!open) return;\n const frame = requestAnimationFrame(() => inputRef.current?.focus());\n return () => cancelAnimationFrame(frame);\n }, [open]);\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveActive(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveActive(-1);\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n const it = rows[active];\n if (it) {\n it.onSelect();\n setOpen(false);\n }\n }\n };\n\n useEffect(() => {\n if (!open) return;\n const el = listRef.current?.querySelector<HTMLButtonElement>(`[data-index=\"${active}\"]`);\n el?.scrollIntoView({ block: \"nearest\" });\n }, [active, open]);\n\n if (!mounted) return null;\n\n // Portaled to <body> so ancestors with transforms, filters, or fixed\n // positioning can't trap the overlay in their stacking context, and mounted\n // only while open. The chrome is two fixed siblings rather than one wrapper:\n // the backdrop spans the viewport edges but carries the scrim colour, and the\n // layer positioning the panel is inset off every edge. Both hang off\n // `PresenceGate`, so interaction releases in the same commit that starts the\n // exit rather than when it ends — `open` is already false for those frames.\n return createPortal(\n <AnimatePresence initial={false}>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close command palette\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{\n opacity: 0,\n transition: { duration: 0.12, ease: EASE_OUT },\n }}\n transition={{ duration: 0.18, ease: EASE_OUT }}\n {...gate}\n onClick={() => setOpen(false)}\n className=\"pointer-events-auto fixed inset-0 z-100 bg-background/5 [-webkit-backdrop-filter:blur(12px)_saturate(140%)] [backdrop-filter:blur(12px)_saturate(140%)]\"\n />\n )}\n </PresenceGate>\n ) : null}\n\n {open ? (\n <PresenceGate key=\"panel-layer\">\n {({ isPresent, gate }) => (\n // The layer itself never takes pointer events, so it carries\n // `inert` alone rather than the gate's pointer-events value.\n <div\n inert={!isPresent}\n className=\"pointer-events-none fixed inset-x-4 top-[18vh] bottom-4 z-100 flex items-start justify-center\"\n >\n <motion.div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command palette\"\n initial={{\n opacity: 0,\n y: reduce ? 0 : -8,\n scale: reduce ? 1 : 0.97,\n }}\n animate={{ opacity: 1, y: 0, scale: 1 }}\n exit={{\n opacity: 0,\n y: reduce ? 0 : -8,\n scale: reduce ? 1 : 0.97,\n transition: { duration: 0.12, ease: EASE_OUT },\n }}\n transition={reduce ? { duration: 0.1 } : PANEL_SPRING}\n {...gate}\n onKeyDown={onKeyDown}\n className=\"pointer-events-auto w-full max-w-xl overflow-hidden rounded-2xl border border-border bg-card shadow-2xl will-change-transform\"\n >\n <div className=\"flex items-center gap-3 border-border border-b px-4\">\n <Search className=\"h-4 w-4 text-muted-foreground\" />\n <input\n ref={inputRef}\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={placeholder}\n role=\"combobox\"\n // The field only exists while the palette is open.\n aria-expanded=\"true\"\n aria-controls={`${uid}-list`}\n aria-activedescendant={rows.length > 0 ? `${uid}-opt-${active}` : undefined}\n aria-autocomplete=\"list\"\n className={cn(\n \"h-12 flex-1 bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground\",\n // The palette focuses this field the moment it opens, and iOS\n // zooms the page in on a focused field under 16px: the fixed\n // overlay is magnified off-center — clipped leading edge, half\n // an icon column — and the zoom outlives the palette. 16px on\n // touch keeps the page at scale 1; pointer devices keep 14px.\n canTouch && \"text-base\",\n )}\n />\n <kbd className=\"hidden rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground sm:inline-block\">\n ESC\n </kbd>\n </div>\n <div\n ref={listRef}\n id={`${uid}-list`}\n role=\"listbox\"\n aria-label=\"Commands\"\n className=\"max-h-[60vh] overflow-y-auto overscroll-contain p-2 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\"\n >\n {rows.length === 0 ? (\n <div className=\"p-8 text-center text-muted-foreground text-sm\">\n {emptyMessage}\n </div>\n ) : (\n grouped.map(([group, list]) => (\n <div key={group} className=\"mb-1 last:mb-0\">\n <div\n aria-hidden\n className=\"px-2 py-1.5 font-semibold text-[10px] text-muted-foreground uppercase tracking-wider\"\n >\n {group}\n </div>\n {list.map((it) => {\n // `rows` holds these very objects, in render order.\n const idx = rows.indexOf(it);\n const isActive = idx === active;\n const Icon = it.icon;\n return (\n <button\n key={it.id}\n type=\"button\"\n id={`${uid}-opt-${idx}`}\n role=\"option\"\n aria-selected={isActive}\n data-index={idx}\n onMouseEnter={() => moveTo(it.id)}\n onClick={() => {\n it.onSelect();\n setOpen(false);\n }}\n className={cn(\n \"relative isolate flex w-full items-center gap-3 rounded-md px-2 py-2 text-left text-sm transition-colors\",\n isActive ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {isActive ? (\n <motion.span\n layoutId={`${uid}-active`}\n className=\"absolute inset-0 z-0 rounded-md bg-muted/60\"\n transition={\n reduce\n ? { duration: 0 }\n : // Tracks rapid arrow-key navigation — keep it tighter\n // than SPRING_LAYOUT so it never lags the active row.\n {\n type: \"spring\",\n stiffness: 480,\n damping: 38,\n }\n }\n />\n ) : null}\n {Icon ? (\n <Icon className=\"relative z-10 h-4 w-4\" />\n ) : hasIcons ? (\n <span className=\"relative z-10 h-4 w-4\" />\n ) : null}\n <span className=\"relative z-10 flex-1 truncate\">{it.label}</span>\n {it.badge ? (\n <span className=\"relative z-10 shrink-0\">{it.badge}</span>\n ) : null}\n {it.hint ? (\n <kbd className=\"relative z-10 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground\">\n {it.hint}\n </kbd>\n ) : null}\n </button>\n );\n })}\n </div>\n ))\n )}\n </div>\n </motion.div>\n </div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,eAAe;CACnB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,SAAgB,eAAe,EAC7B,OACA,WAAW,KACX,cAAc,6BACd,eAAe,qBACf,MAAM,gBACN,gBACsB;CACtB,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,aAAa,mBAAmB,KAAA;CACtC,MAAM,OAAO,aAAa,iBAAiB;CAC3C,MAAM,UAAU,aACb,MAAe;EACd,IAAI,CAAC,YAAY,gBAAgB,CAAC;EAClC,eAAe,CAAC;CAClB,GACA,CAAC,YAAY,YAAY,CAC3B;CAEA,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CAErC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CA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U;MAA3B,UAAA,CACE,oBAAC,OAAD;OACE,eAAA;OACA,WAAU;OAET,UAAA;MACE,CAAA,GACJ,KAAK,KAAK,OAAO;OAEhB,MAAM,MAAM,KAAK,QAAQ,EAAE;OAC3B,MAAM,WAAW,QAAQ;OACzB,MAAM,OAAO,GAAG;OAChB,OACE,qBAAC,UAAD;QAEE,MAAK;QACL,IAAI,GAAG,IAAI,OAAO;QAClB,MAAK;QACL,iBAAe;QACf,cAAY;QACZ,oBAAoB,OAAO,GAAG,EAAE;QAChC,eAAe;SACb,GAAG,SAAS;SACZ,QAAQ,KAAK;QACf;QACA,WAAW,GACT,4GACA,WAAW,oBAAoB,uBACjC;QAfF,UAAA;SAiBG,WACC,oBAAC,OAAO,MAAR;UACE,UAAU,GAAG,IAAI;UACjB,WAAU;UACV,YACE,SACI,EAAE,UAAU,EAAE,IAGd;WACE,MAAM;WACN,WAAW;WACX,SAAS;UACX;SAEP,CAAA,IACC;SACH,OACC,oBAAC,MAAD,EAAM,WAAU,wBAAyB,CAAA,IACvC,WACF,oBAAC,QAAD,EAAM,WAAU,wBAAyB,CAAA,IACvC;SACJ,oBAAC,QAAD;UAAM,WAAU;UAAiC,UAAA,GAAG;SAAY,CAAA;SAC/D,GAAG,QACF,oBAAC,QAAD;UAAM,WAAU;UAA0B,UAAA,GAAG;SAAY,CAAA,IACvD;SACH,GAAG,OACF,oBAAC,OAAD;UAAK,WAAU;UACZ,UAAA,GAAG;SACD,CAAA,IACH;QACE;OA/CD,GAAA,GAAG,EA+CF;MAEZ,CAAC,CACE;KAhEK,GAAA,KAgEL,CACN;IAEA,CAAA,CACK;;EACT,CAAA,EAEK,GA5II,aA4IJ,IACZ,IACW;CACjB,CAAA,GAAA,SAAS,IACX;AACF"}
@@ -3,9 +3,9 @@ import { TOUCH_GESTURE_CONTENT_CLASS, holdSelection } from "../../lib/touch.js";
3
3
  import { EASE_OUT, SPRING_LAYOUT, SPRING_PANEL } from "../../lib/ease.js";
4
4
  import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
- import { Check } from "lucide-react";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
8
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
+ import { Check } from "lucide-react";
9
9
  import { createPortal } from "react-dom";
10
10
  //#region src/components/motion/context-menu.tsx
11
11
  const VIEWPORT_PADDING = 8;