@kumix/ui 0.3.4 → 0.3.6

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 (75) hide show
  1. package/dist/components/agents/agent-activity/activity-row.d.ts +1 -1
  2. package/dist/components/agents/agent-activity/index.d.ts +2 -2
  3. package/dist/components/agents/agent-activity/index.d.ts.map +1 -1
  4. package/dist/components/agents/agent-activity/index.js +9 -3
  5. package/dist/components/agents/agent-activity/index.js.map +1 -1
  6. package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
  7. package/dist/components/agents/loading-states/reasoning-text.js +7 -39
  8. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  9. package/dist/components/motion/action-swap.d.ts.map +1 -1
  10. package/dist/components/motion/action-swap.js +11 -16
  11. package/dist/components/motion/action-swap.js.map +1 -1
  12. package/dist/components/motion/bottom-sheet.js +25 -7
  13. package/dist/components/motion/bottom-sheet.js.map +1 -1
  14. package/dist/components/motion/combobox/content.d.ts +16 -0
  15. package/dist/components/motion/combobox/content.d.ts.map +1 -0
  16. package/dist/components/motion/combobox/content.js +91 -0
  17. package/dist/components/motion/combobox/content.js.map +1 -0
  18. package/dist/components/motion/combobox/context.d.ts +63 -0
  19. package/dist/components/motion/combobox/context.d.ts.map +1 -0
  20. package/dist/components/motion/combobox/context.js +235 -0
  21. package/dist/components/motion/combobox/context.js.map +1 -0
  22. package/dist/components/motion/combobox/list.d.ts +40 -0
  23. package/dist/components/motion/combobox/list.d.ts.map +1 -0
  24. package/dist/components/motion/combobox/list.js +143 -0
  25. package/dist/components/motion/combobox/list.js.map +1 -0
  26. package/dist/components/motion/combobox/trigger.d.ts +21 -0
  27. package/dist/components/motion/combobox/trigger.d.ts.map +1 -0
  28. package/dist/components/motion/combobox/trigger.js +115 -0
  29. package/dist/components/motion/combobox/trigger.js.map +1 -0
  30. package/dist/components/motion/combobox.d.ts +5 -0
  31. package/dist/components/motion/combobox.js +6 -0
  32. package/dist/components/motion/popover.d.ts.map +1 -1
  33. package/dist/components/motion/popover.js +22 -25
  34. package/dist/components/motion/popover.js.map +1 -1
  35. package/dist/components/motion/project-folder.d.ts +27 -0
  36. package/dist/components/motion/project-folder.d.ts.map +1 -0
  37. package/dist/components/motion/project-folder.js +310 -0
  38. package/dist/components/motion/project-folder.js.map +1 -0
  39. package/dist/components/motion/tabs.d.ts.map +1 -1
  40. package/dist/components/motion/tabs.js +2 -0
  41. package/dist/components/motion/tabs.js.map +1 -1
  42. package/dist/components/motion/text-scramble.d.ts +17 -0
  43. package/dist/components/motion/text-scramble.d.ts.map +1 -0
  44. package/dist/components/motion/text-scramble.js +64 -0
  45. package/dist/components/motion/text-scramble.js.map +1 -0
  46. package/dist/components/reui/alert.d.ts +1 -1
  47. package/dist/components/reui/autocomplete.d.ts +1 -1
  48. package/dist/components/reui/badge.d.ts +2 -2
  49. package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
  50. package/dist/components/reui/date-selector.js +1 -1
  51. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  52. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  53. package/dist/components/reui/filters.js +3 -3
  54. package/dist/components/reui/frame.d.ts +2 -2
  55. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  56. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  57. package/dist/components/reui/gantt/gantt-view.js +3 -3
  58. package/dist/components/reui/icon-tile.d.ts +2 -2
  59. package/dist/components/reui/number-field.d.ts +3 -3
  60. package/dist/components/reui/phone-input.js +1 -1
  61. package/dist/components/reui/rating.d.ts +1 -1
  62. package/dist/components/ui/attachment.d.ts +2 -2
  63. package/dist/components/ui/badge.d.ts +1 -1
  64. package/dist/components/ui/bubble.d.ts +1 -1
  65. package/dist/components/ui/button-group.d.ts +1 -1
  66. package/dist/components/ui/button.d.ts +2 -2
  67. package/dist/components/ui/field.d.ts +1 -1
  68. package/dist/components/ui/item.d.ts +2 -2
  69. package/dist/components/ui/sidebar.d.ts +2 -2
  70. package/dist/components/ui/sidebar.js +2 -2
  71. package/dist/components/ui/tabs.d.ts +1 -1
  72. package/dist/components/ui/toggle.d.ts +2 -2
  73. package/dist/{types-j36vVGtZ.d.ts → types-kSZH1k8K.d.ts} +11 -1
  74. package/dist/{types-j36vVGtZ.d.ts.map → types-kSZH1k8K.d.ts.map} +1 -1
  75. package/package.json +4 -4
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ import { t as usePopoverPortalPosition } from "../../../popover-position-BUqYCq8X.js";
3
+ import { useComboboxContext } from "./context.js";
4
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
5
+ import { cn } from "@kumix/utils";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { motion } from "motion/react";
8
+ import { createPortal } from "react-dom";
9
+ //#region src/components/motion/combobox/content.tsx
10
+ const COMBOBOX_MORPH = {
11
+ type: "spring",
12
+ duration: .5,
13
+ bounce: .22
14
+ };
15
+ const VIEWPORT_PADDING = 8;
16
+ function ComboboxContent({ children, side = "bottom", align = "start", sideOffset = 6, avoidCollisions = true, className }) {
17
+ const context = useComboboxContext("ComboboxContent");
18
+ const measureRef = useRef(null);
19
+ const [portalReady, setPortalReady] = useState(false);
20
+ const [actualSide, setActualSide] = useState(side);
21
+ const [morphReady, setMorphReady] = useState(false);
22
+ const layout = usePopoverPortalPosition(context.triggerRef, measureRef, portalReady);
23
+ useEffect(() => setPortalReady(true), []);
24
+ useLayoutEffect(() => {
25
+ if (!portalReady) return;
26
+ const readyFrame = requestAnimationFrame(() => setMorphReady(true));
27
+ return () => cancelAnimationFrame(readyFrame);
28
+ }, [portalReady]);
29
+ useLayoutEffect(() => {
30
+ if (!context.open || !layout) return;
31
+ if (!avoidCollisions) {
32
+ setActualSide(side);
33
+ return;
34
+ }
35
+ const below = window.innerHeight - (layout.trigger.top + layout.trigger.height);
36
+ const above = layout.trigger.top;
37
+ if (side === "bottom" && below < layout.content.height + sideOffset && above > below) setActualSide("top");
38
+ else if (side === "top" && above < layout.content.height + sideOffset && below > above) setActualSide("bottom");
39
+ else setActualSide(side);
40
+ }, [
41
+ avoidCollisions,
42
+ context.open,
43
+ layout,
44
+ side,
45
+ sideOffset
46
+ ]);
47
+ if (!portalReady) return null;
48
+ const triggerLeft = layout?.trigger.left ?? 0;
49
+ const triggerWidth = layout?.trigger.width ?? 0;
50
+ const contentWidth = layout?.content.width ?? triggerWidth;
51
+ const desiredLeft = align === "end" ? triggerLeft + triggerWidth - contentWidth : align === "center" ? triggerLeft + (triggerWidth - contentWidth) / 2 : triggerLeft;
52
+ const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - contentWidth - VIEWPORT_PADDING);
53
+ const left = Math.min(Math.max(desiredLeft, VIEWPORT_PADDING), maxLeft);
54
+ const surfaceHeight = layout?.content.height ?? 0;
55
+ return createPortal(/* @__PURE__ */ jsx(motion.div, {
56
+ ref: context.contentRef,
57
+ "data-combobox-content": "",
58
+ "data-side": actualSide,
59
+ "aria-hidden": !context.open,
60
+ inert: !context.open,
61
+ initial: false,
62
+ animate: {
63
+ height: context.open ? surfaceHeight : 0,
64
+ opacity: context.open ? 1 : 0,
65
+ y: context.open ? actualSide === "bottom" ? sideOffset : -sideOffset : 0
66
+ },
67
+ transition: context.reduce || !morphReady ? { duration: 0 } : COMBOBOX_MORPH,
68
+ style: {
69
+ left,
70
+ top: actualSide === "bottom" && layout ? layout.trigger.top + layout.trigger.height : void 0,
71
+ bottom: actualSide === "top" && layout ? window.innerHeight - layout.trigger.top : void 0,
72
+ minWidth: triggerWidth,
73
+ pointerEvents: context.open ? "auto" : "none",
74
+ transformOrigin: actualSide === "bottom" ? "top" : "bottom",
75
+ visibility: layout ? "visible" : "hidden",
76
+ "--combobox-trigger-width": `${triggerWidth}px`
77
+ },
78
+ className: cn("fixed z-[9999] w-(--combobox-trigger-width) overflow-hidden rounded-xl border border-border bg-background text-popover-foreground outline-none will-change-[height,transform]", className),
79
+ children: /* @__PURE__ */ jsx(motion.div, {
80
+ ref: measureRef,
81
+ initial: false,
82
+ animate: { opacity: context.open ? 1 : 0 },
83
+ transition: context.reduce || !morphReady ? { duration: 0 } : COMBOBOX_MORPH,
84
+ children
85
+ })
86
+ }), document.body);
87
+ }
88
+ //#endregion
89
+ export { ComboboxContent };
90
+
91
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","names":[],"sources":["../../../../src/components/motion/combobox/content.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { motion, type Transition } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { usePopoverPortalPosition } from \"../popover-position\";\nimport { useComboboxContext } from \"./context\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"center\" | \"end\";\n\n// The panel uses one weighted spring for both directions, so opening and\n// closing travel through the same detached geometry.\nconst COMBOBOX_MORPH: Transition = {\n type: \"spring\",\n duration: 0.5,\n bounce: 0.22,\n};\nconst VIEWPORT_PADDING = 8;\n\nexport interface ComboboxContentProps {\n children: ReactNode;\n side?: Side;\n align?: Align;\n sideOffset?: number;\n avoidCollisions?: boolean;\n className?: string;\n}\n\nexport function ComboboxContent({\n children,\n side = \"bottom\",\n align = \"start\",\n sideOffset = 6,\n avoidCollisions = true,\n className,\n}: ComboboxContentProps) {\n const context = useComboboxContext(\"ComboboxContent\");\n const measureRef = useRef<HTMLDivElement>(null);\n const [portalReady, setPortalReady] = useState(false);\n const [actualSide, setActualSide] = useState<Side>(side);\n const [morphReady, setMorphReady] = useState(false);\n const layout = usePopoverPortalPosition(context.triggerRef, measureRef, portalReady);\n\n useEffect(() => setPortalReady(true), []);\n useLayoutEffect(() => {\n if (!portalReady) return;\n const readyFrame = requestAnimationFrame(() => setMorphReady(true));\n return () => cancelAnimationFrame(readyFrame);\n }, [portalReady]);\n\n useLayoutEffect(() => {\n // Preserve the resolved side during exit, so top panels close upward.\n if (!context.open || !layout) return;\n if (!avoidCollisions) {\n setActualSide(side);\n return;\n }\n const below = window.innerHeight - (layout.trigger.top + layout.trigger.height);\n const above = layout.trigger.top;\n if (side === \"bottom\" && below < layout.content.height + sideOffset && above > below)\n setActualSide(\"top\");\n else if (side === \"top\" && above < layout.content.height + sideOffset && below > above)\n setActualSide(\"bottom\");\n else setActualSide(side);\n }, [avoidCollisions, context.open, layout, side, sideOffset]);\n\n if (!portalReady) return null;\n\n const triggerLeft = layout?.trigger.left ?? 0;\n const triggerWidth = layout?.trigger.width ?? 0;\n const contentWidth = layout?.content.width ?? triggerWidth;\n const desiredLeft =\n align === \"end\"\n ? triggerLeft + triggerWidth - contentWidth\n : align === \"center\"\n ? triggerLeft + (triggerWidth - contentWidth) / 2\n : triggerLeft;\n const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - contentWidth - VIEWPORT_PADDING);\n const left = Math.min(Math.max(desiredLeft, VIEWPORT_PADDING), maxLeft);\n const surfaceHeight = layout?.content.height ?? 0;\n\n return createPortal(\n <motion.div\n ref={context.contentRef}\n data-combobox-content=\"\"\n data-side={actualSide}\n aria-hidden={!context.open}\n inert={!context.open}\n initial={false}\n animate={{\n height: context.open ? surfaceHeight : 0,\n opacity: context.open ? 1 : 0,\n y: context.open ? (actualSide === \"bottom\" ? sideOffset : -sideOffset) : 0,\n }}\n transition={context.reduce || !morphReady ? { duration: 0 } : COMBOBOX_MORPH}\n style={\n {\n left,\n top:\n actualSide === \"bottom\" && layout\n ? layout.trigger.top + layout.trigger.height\n : undefined,\n bottom:\n actualSide === \"top\" && layout ? window.innerHeight - layout.trigger.top : undefined,\n minWidth: triggerWidth,\n pointerEvents: context.open ? \"auto\" : \"none\",\n transformOrigin: actualSide === \"bottom\" ? \"top\" : \"bottom\",\n visibility: layout ? \"visible\" : \"hidden\",\n \"--combobox-trigger-width\": `${triggerWidth}px`,\n } as CSSProperties\n }\n className={cn(\n \"fixed z-[9999] w-(--combobox-trigger-width) overflow-hidden rounded-xl border border-border bg-background text-popover-foreground outline-none will-change-[height,transform]\",\n className,\n )}\n >\n <motion.div\n ref={measureRef}\n initial={false}\n animate={{ opacity: context.open ? 1 : 0 }}\n transition={context.reduce || !morphReady ? { duration: 0 } : COMBOBOX_MORPH}\n >\n {children}\n </motion.div>\n </motion.div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,iBAA6B;CACjC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AACA,MAAM,mBAAmB;AAWzB,SAAgB,gBAAgB,EAC9B,UACA,OAAO,UACP,QAAQ,SACR,aAAa,GACb,kBAAkB,MAClB,aACuB;CACvB,MAAM,UAAU,mBAAmB,iBAAiB;CACpD,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CACpD,MAAM,CAAC,YAAY,iBAAiB,SAAe,IAAI;CACvD,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,SAAS,yBAAyB,QAAQ,YAAY,YAAY,WAAW;CAEnF,gBAAgB,eAAe,IAAI,GAAG,CAAC,CAAC;CACxC,sBAAsB;EACpB,IAAI,CAAC,aAAa;EAClB,MAAM,aAAa,4BAA4B,cAAc,IAAI,CAAC;EAClE,aAAa,qBAAqB,UAAU;CAC9C,GAAG,CAAC,WAAW,CAAC;CAEhB,sBAAsB;EAEpB,IAAI,CAAC,QAAQ,QAAQ,CAAC,QAAQ;EAC9B,IAAI,CAAC,iBAAiB;GACpB,cAAc,IAAI;GAClB;EACF;EACA,MAAM,QAAQ,OAAO,eAAe,OAAO,QAAQ,MAAM,OAAO,QAAQ;EACxE,MAAM,QAAQ,OAAO,QAAQ;EAC7B,IAAI,SAAS,YAAY,QAAQ,OAAO,QAAQ,SAAS,cAAc,QAAQ,OAC7E,cAAc,KAAK;OAChB,IAAI,SAAS,SAAS,QAAQ,OAAO,QAAQ,SAAS,cAAc,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AS;GACT,SAAS,EAAE,SAAS,QAAQ,OAAO,IAAI,EAAE;GACzC,YAAY,QAAQ,UAAU,CAAC,aAAa,EAAE,UAAU,EAAE,IAAI;GAE7D;EACS,CAAA;CACF,CAAA,GACZ,SAAS,IACX;AACF"}
@@ -0,0 +1,63 @@
1
+ import { MutableRefObject, ReactNode, Ref } from "react";
2
+ //#region src/components/motion/combobox/context.d.ts
3
+ type RegisteredItem = {
4
+ value: string;
5
+ label: string;
6
+ keywords: string[];
7
+ disabled: boolean;
8
+ groupId: string | null;
9
+ id: string;
10
+ ref: MutableRefObject<HTMLButtonElement | null>;
11
+ };
12
+ type ComboboxFilter = (value: string, query: string, keywords: string[]) => boolean;
13
+ type ComboboxContextValue = {
14
+ open: boolean;
15
+ setOpen: (open: boolean, restoreFocus?: boolean) => void;
16
+ value: string | undefined;
17
+ select: (value: string) => void;
18
+ query: string;
19
+ setQuery: (query: string) => void;
20
+ activeValue: string | null;
21
+ setActiveValue: (value: string | null) => void;
22
+ moveActive: (direction: 1 | -1 | "first" | "last") => void;
23
+ selectActive: () => void;
24
+ registerItem: (item: RegisteredItem) => void;
25
+ unregisterItem: (value: string) => void;
26
+ labelFor: (value: string | undefined) => string | undefined;
27
+ isVisible: (value: string) => boolean;
28
+ hasVisibleItems: (groupId: string) => boolean;
29
+ visibleCount: number;
30
+ activeItemId: string | undefined;
31
+ triggerId: string;
32
+ listId: string;
33
+ inputId: string;
34
+ disabled: boolean;
35
+ reduce: boolean;
36
+ triggerRef: MutableRefObject<HTMLDivElement | null>;
37
+ contentRef: MutableRefObject<HTMLDivElement | null>;
38
+ inputRef: MutableRefObject<HTMLInputElement | null>;
39
+ activeLayoutId: string;
40
+ };
41
+ declare const ComboboxContext: import("react").Context<ComboboxContextValue | null>;
42
+ declare const ComboboxGroupContext: import("react").Context<string | null>;
43
+ declare function useComboboxContext(component: string): ComboboxContextValue;
44
+ declare function mergeRefs<T>(...refs: Array<Ref<T> | undefined>): (node: T | null) => void;
45
+ interface ComboboxProps {
46
+ children: ReactNode;
47
+ value?: string;
48
+ defaultValue?: string;
49
+ onValueChange?: (value: string) => void;
50
+ open?: boolean;
51
+ defaultOpen?: boolean;
52
+ onOpenChange?: (open: boolean) => void;
53
+ query?: string;
54
+ defaultQuery?: string;
55
+ onQueryChange?: (query: string) => void;
56
+ filter?: ComboboxFilter;
57
+ disabled?: boolean;
58
+ className?: string;
59
+ }
60
+ declare function Combobox({ children, value: controlledValue, defaultValue, onValueChange, open: controlledOpen, defaultOpen, onOpenChange, query: controlledQuery, defaultQuery, onQueryChange, filter, disabled, className }: ComboboxProps): import("react").JSX.Element;
61
+ //#endregion
62
+ export { Combobox, ComboboxContext, ComboboxContextValue, ComboboxFilter, ComboboxGroupContext, ComboboxProps, RegisteredItem, mergeRefs, useComboboxContext };
63
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","names":[],"sources":["../../../../src/components/motion/combobox/context.tsx"],"mappings":";;KAmBY;EACV;EACA;EACA;EACA;EACA;EACA;EACA,KAAK,iBAAiB;;KAGZ,kBAAkB,eAAe,eAAe;KAehD;EACV;EACA,UAAU,eAAe;EACzB;EACA,SAAS;EACT;EACA,WAAW;EACX;EACA,iBAAiB;EACjB,aAAa;EACb;EACA,eAAe,MAAM;EACrB,iBAAiB;EACjB,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,iBAAiB;EAC7B,YAAY,iBAAiB;EAC7B,UAAU,iBAAiB;EAC3B;;cAGW,iCAAe,QAAA;cACf,sCAAoB;iBAEjB,mBAAmB,oBAAiB;iBAMpC,UAAU,MAAM,MAAM,MAAM,IAAI,mBACtC,MAAM;UAQC;EACf,UAAU;EACV;EACA;EACA,iBAAiB;EACjB;EACA;EACA,gBAAgB;EAChB;EACA;EACA,iBAAiB;EACjB,SAAS;EACT;EACA;;iBAGc,WACd,UACA,OAAO,iBACP,cACA,eACA,MAAM,gBACN,aACA,cACA,OAAO,iBACP,cACA,eACA,QACA,UACA,aACC,gCAAa,IAAA"}
@@ -0,0 +1,235 @@
1
+ "use client";
2
+ import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
3
+ import { cn } from "@kumix/utils";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useReducedMotion } from "motion/react";
6
+ //#region src/components/motion/combobox/context.tsx
7
+ const defaultFilter = (value, query, keywords) => {
8
+ const needle = query.trim().toLocaleLowerCase();
9
+ if (!needle) return true;
10
+ const haystack = [value, ...keywords].join(" ").toLocaleLowerCase();
11
+ let queryIndex = 0;
12
+ for (const character of haystack) {
13
+ if (character === needle[queryIndex]) queryIndex += 1;
14
+ if (queryIndex === needle.length) return true;
15
+ }
16
+ return false;
17
+ };
18
+ const ComboboxContext = createContext(null);
19
+ const ComboboxGroupContext = createContext(null);
20
+ function useComboboxContext(component) {
21
+ const context = useContext(ComboboxContext);
22
+ if (!context) throw new Error(`${component} must be used within <Combobox>`);
23
+ return context;
24
+ }
25
+ function mergeRefs(...refs) {
26
+ return (node) => {
27
+ for (const ref of refs) if (typeof ref === "function") ref(node);
28
+ else if (ref && typeof ref === "object") ref.current = node;
29
+ };
30
+ }
31
+ function Combobox({ children, value: controlledValue, defaultValue, onValueChange, open: controlledOpen, defaultOpen = false, onOpenChange, query: controlledQuery, defaultQuery = "", onQueryChange, filter = defaultFilter, disabled = false, className }) {
32
+ const reduce = useReducedMotion() ?? false;
33
+ const baseId = useId();
34
+ const rootRef = useRef(null);
35
+ const triggerRef = useRef(null);
36
+ const contentRef = useRef(null);
37
+ const inputRef = useRef(null);
38
+ const [internalValue, setInternalValue] = useState(defaultValue);
39
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
40
+ const [internalQuery, setInternalQuery] = useState(defaultQuery);
41
+ const [activeValue, setActiveValue] = useState(null);
42
+ const [items, setItems] = useState(/* @__PURE__ */ new Map());
43
+ const valueControlled = controlledValue !== void 0;
44
+ const openControlled = controlledOpen !== void 0;
45
+ const queryControlled = controlledQuery !== void 0;
46
+ const value = valueControlled ? controlledValue : internalValue;
47
+ const open = openControlled ? controlledOpen : internalOpen;
48
+ const query = queryControlled ? controlledQuery : internalQuery;
49
+ const updateQuery = useCallback((next) => {
50
+ if (!queryControlled) setInternalQuery(next);
51
+ onQueryChange?.(next);
52
+ }, [onQueryChange, queryControlled]);
53
+ const updateOpen = useCallback((next, restoreFocus = false) => {
54
+ if (disabled && next) return;
55
+ if (!openControlled) setInternalOpen(next);
56
+ onOpenChange?.(next);
57
+ if (!next) updateQuery("");
58
+ if (restoreFocus) requestAnimationFrame(() => inputRef.current?.focus({ preventScroll: true }));
59
+ }, [
60
+ disabled,
61
+ onOpenChange,
62
+ openControlled,
63
+ updateQuery
64
+ ]);
65
+ const registerItem = useCallback((item) => {
66
+ setItems((current) => {
67
+ const existing = current.get(item.value);
68
+ if (existing?.label === item.label && existing.disabled === item.disabled && existing.id === item.id && existing.ref === item.ref && existing.groupId === item.groupId && existing.keywords.join("\0") === item.keywords.join("\0")) return current;
69
+ const next = new Map(current);
70
+ next.set(item.value, item);
71
+ return next;
72
+ });
73
+ }, []);
74
+ const unregisterItem = useCallback((itemValue) => {
75
+ setItems((current) => {
76
+ if (!current.has(itemValue)) return current;
77
+ const next = new Map(current);
78
+ next.delete(itemValue);
79
+ return next;
80
+ });
81
+ }, []);
82
+ const visibleItems = useMemo(() => Array.from(items.values()).filter((item) => filter(item.value, query, [item.label, ...item.keywords])), [
83
+ filter,
84
+ items,
85
+ query
86
+ ]);
87
+ const enabledVisibleItems = useMemo(() => visibleItems.filter((item) => !item.disabled), [visibleItems]);
88
+ const visibleValues = useMemo(() => new Set(visibleItems.map((item) => item.value)), [visibleItems]);
89
+ const visibleGroupIds = useMemo(() => new Set(visibleItems.map((item) => item.groupId)), [visibleItems]);
90
+ const select = useCallback((next) => {
91
+ if (items.get(next)?.disabled) return;
92
+ if (!valueControlled) setInternalValue(next);
93
+ onValueChange?.(next);
94
+ updateOpen(false, true);
95
+ }, [
96
+ items,
97
+ onValueChange,
98
+ updateOpen,
99
+ valueControlled
100
+ ]);
101
+ const moveActive = useCallback((direction) => {
102
+ if (!enabledVisibleItems.length) {
103
+ setActiveValue(null);
104
+ return;
105
+ }
106
+ if (direction === "first") {
107
+ setActiveValue(enabledVisibleItems[0].value);
108
+ return;
109
+ }
110
+ if (direction === "last") {
111
+ setActiveValue(enabledVisibleItems.at(-1)?.value ?? null);
112
+ return;
113
+ }
114
+ const currentIndex = enabledVisibleItems.findIndex((item) => item.value === activeValue);
115
+ const nextIndex = currentIndex < 0 ? direction === 1 ? 0 : enabledVisibleItems.length - 1 : (currentIndex + direction + enabledVisibleItems.length) % enabledVisibleItems.length;
116
+ setActiveValue(enabledVisibleItems[nextIndex].value);
117
+ }, [activeValue, enabledVisibleItems]);
118
+ const selectActive = useCallback(() => {
119
+ if (activeValue) select(activeValue);
120
+ }, [activeValue, select]);
121
+ useEffect(() => {
122
+ if (!open) return;
123
+ const selectedVisible = value && visibleValues.has(value) ? value : null;
124
+ const activeVisible = activeValue && visibleValues.has(activeValue) ? activeValue : null;
125
+ setActiveValue(activeVisible ?? selectedVisible ?? enabledVisibleItems[0]?.value ?? null);
126
+ }, [
127
+ activeValue,
128
+ enabledVisibleItems,
129
+ open,
130
+ value,
131
+ visibleValues
132
+ ]);
133
+ useEffect(() => {
134
+ if (!open) return;
135
+ requestAnimationFrame(() => inputRef.current?.focus({ preventScroll: true }));
136
+ }, [open]);
137
+ useEffect(() => {
138
+ if (!activeValue || !open) return;
139
+ const item = items.get(activeValue)?.ref.current;
140
+ const list = item?.closest("[role='listbox']");
141
+ if (!item || !list) return;
142
+ const itemRect = item.getBoundingClientRect();
143
+ const listRect = list.getBoundingClientRect();
144
+ if (itemRect.top < listRect.top) list.scrollTop -= listRect.top - itemRect.top;
145
+ else if (itemRect.bottom > listRect.bottom) list.scrollTop += itemRect.bottom - listRect.bottom;
146
+ }, [
147
+ activeValue,
148
+ items,
149
+ open
150
+ ]);
151
+ useEffect(() => {
152
+ if (!open) return;
153
+ const isInside = (target) => rootRef.current?.contains(target) || contentRef.current?.contains(target);
154
+ const onPointerDown = (event) => {
155
+ if (!isInside(event.target)) updateOpen(false);
156
+ };
157
+ const onFocusIn = (event) => {
158
+ if (!isInside(event.target)) updateOpen(false);
159
+ };
160
+ const onKeyDown = (event) => {
161
+ if (event.key !== "Escape") return;
162
+ event.preventDefault();
163
+ updateOpen(false, true);
164
+ };
165
+ window.addEventListener("pointerdown", onPointerDown);
166
+ window.addEventListener("focusin", onFocusIn);
167
+ window.addEventListener("keydown", onKeyDown);
168
+ return () => {
169
+ window.removeEventListener("pointerdown", onPointerDown);
170
+ window.removeEventListener("focusin", onFocusIn);
171
+ window.removeEventListener("keydown", onKeyDown);
172
+ };
173
+ }, [open, updateOpen]);
174
+ const activeItem = activeValue ? items.get(activeValue) : void 0;
175
+ const context = useMemo(() => ({
176
+ open,
177
+ setOpen: updateOpen,
178
+ value,
179
+ select,
180
+ query,
181
+ setQuery: updateQuery,
182
+ activeValue,
183
+ setActiveValue,
184
+ moveActive,
185
+ selectActive,
186
+ registerItem,
187
+ unregisterItem,
188
+ labelFor: (itemValue) => itemValue === void 0 ? void 0 : items.get(itemValue)?.label,
189
+ isVisible: (itemValue) => !query.trim() || visibleValues.has(itemValue),
190
+ hasVisibleItems: (groupId) => visibleGroupIds.has(groupId),
191
+ visibleCount: visibleItems.length,
192
+ activeItemId: activeItem?.id,
193
+ triggerId: `${baseId}-trigger`,
194
+ listId: `${baseId}-list`,
195
+ inputId: `${baseId}-input`,
196
+ disabled,
197
+ reduce,
198
+ triggerRef,
199
+ contentRef,
200
+ inputRef,
201
+ activeLayoutId: `${baseId}-active`
202
+ }), [
203
+ activeItem?.id,
204
+ activeValue,
205
+ baseId,
206
+ disabled,
207
+ items,
208
+ moveActive,
209
+ open,
210
+ query,
211
+ reduce,
212
+ registerItem,
213
+ select,
214
+ selectActive,
215
+ unregisterItem,
216
+ updateOpen,
217
+ updateQuery,
218
+ value,
219
+ visibleItems.length,
220
+ visibleGroupIds,
221
+ visibleValues
222
+ ]);
223
+ return /* @__PURE__ */ jsx(ComboboxContext.Provider, {
224
+ value: context,
225
+ children: /* @__PURE__ */ jsx("div", {
226
+ ref: rootRef,
227
+ className: cn("relative w-full", className),
228
+ children
229
+ })
230
+ });
231
+ }
232
+ //#endregion
233
+ export { Combobox, ComboboxContext, ComboboxGroupContext, mergeRefs, useComboboxContext };
234
+
235
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","names":[],"sources":["../../../../src/components/motion/combobox/context.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type MutableRefObject,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport type RegisteredItem = {\n value: string;\n label: string;\n keywords: string[];\n disabled: boolean;\n groupId: string | null;\n id: string;\n ref: MutableRefObject<HTMLButtonElement | null>;\n};\n\nexport type ComboboxFilter = (value: string, query: string, keywords: string[]) => boolean;\n\nconst defaultFilter: ComboboxFilter = (value, query, keywords) => {\n const needle = query.trim().toLocaleLowerCase();\n if (!needle) return true;\n\n const haystack = [value, ...keywords].join(\" \").toLocaleLowerCase();\n let queryIndex = 0;\n for (const character of haystack) {\n if (character === needle[queryIndex]) queryIndex += 1;\n if (queryIndex === needle.length) return true;\n }\n return false;\n};\n\nexport type ComboboxContextValue = {\n open: boolean;\n setOpen: (open: boolean, restoreFocus?: boolean) => void;\n value: string | undefined;\n select: (value: string) => void;\n query: string;\n setQuery: (query: string) => void;\n activeValue: string | null;\n setActiveValue: (value: string | null) => void;\n moveActive: (direction: 1 | -1 | \"first\" | \"last\") => void;\n selectActive: () => void;\n registerItem: (item: RegisteredItem) => void;\n unregisterItem: (value: string) => void;\n labelFor: (value: string | undefined) => string | undefined;\n isVisible: (value: string) => boolean;\n hasVisibleItems: (groupId: string) => boolean;\n visibleCount: number;\n activeItemId: string | undefined;\n triggerId: string;\n listId: string;\n inputId: string;\n disabled: boolean;\n reduce: boolean;\n triggerRef: MutableRefObject<HTMLDivElement | null>;\n contentRef: MutableRefObject<HTMLDivElement | null>;\n inputRef: MutableRefObject<HTMLInputElement | null>;\n activeLayoutId: string;\n};\n\nexport const ComboboxContext = createContext<ComboboxContextValue | null>(null);\nexport const ComboboxGroupContext = createContext<string | null>(null);\n\nexport function useComboboxContext(component: string) {\n const context = useContext(ComboboxContext);\n if (!context) throw new Error(`${component} must be used within <Combobox>`);\n return context;\n}\n\nexport function mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\") (ref as MutableRefObject<T | null>).current = node;\n }\n };\n}\n\nexport interface ComboboxProps {\n children: ReactNode;\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n query?: string;\n defaultQuery?: string;\n onQueryChange?: (query: string) => void;\n filter?: ComboboxFilter;\n disabled?: boolean;\n className?: string;\n}\n\nexport function Combobox({\n children,\n value: controlledValue,\n defaultValue,\n onValueChange,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n query: controlledQuery,\n defaultQuery = \"\",\n onQueryChange,\n filter = defaultFilter,\n disabled = false,\n className,\n}: ComboboxProps) {\n const reduce = useReducedMotion() ?? false;\n const baseId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const [internalValue, setInternalValue] = useState(defaultValue);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalQuery, setInternalQuery] = useState(defaultQuery);\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const [items, setItems] = useState<Map<string, RegisteredItem>>(new Map());\n\n const valueControlled = controlledValue !== undefined;\n const openControlled = controlledOpen !== undefined;\n const queryControlled = controlledQuery !== undefined;\n const value = valueControlled ? controlledValue : internalValue;\n const open = openControlled ? controlledOpen : internalOpen;\n const query = queryControlled ? controlledQuery : internalQuery;\n\n const updateQuery = useCallback(\n (next: string) => {\n if (!queryControlled) setInternalQuery(next);\n onQueryChange?.(next);\n },\n [onQueryChange, queryControlled],\n );\n\n const updateOpen = useCallback(\n (next: boolean, restoreFocus = false) => {\n if (disabled && next) return;\n if (!openControlled) setInternalOpen(next);\n onOpenChange?.(next);\n if (!next) updateQuery(\"\");\n if (restoreFocus)\n requestAnimationFrame(() => inputRef.current?.focus({ preventScroll: true }));\n },\n [disabled, onOpenChange, openControlled, updateQuery],\n );\n\n const registerItem = useCallback((item: RegisteredItem) => {\n setItems((current) => {\n const existing = current.get(item.value);\n if (\n existing?.label === item.label &&\n existing.disabled === item.disabled &&\n existing.id === item.id &&\n existing.ref === item.ref &&\n existing.groupId === item.groupId &&\n existing.keywords.join(\"\\u0000\") === item.keywords.join(\"\\u0000\")\n ) {\n return current;\n }\n const next = new Map(current);\n next.set(item.value, item);\n return next;\n });\n }, []);\n\n const unregisterItem = useCallback((itemValue: string) => {\n setItems((current) => {\n if (!current.has(itemValue)) return current;\n const next = new Map(current);\n next.delete(itemValue);\n return next;\n });\n }, []);\n\n const visibleItems = useMemo(\n () =>\n Array.from(items.values()).filter((item) =>\n filter(item.value, query, [item.label, ...item.keywords]),\n ),\n [filter, items, query],\n );\n const enabledVisibleItems = useMemo(\n () => visibleItems.filter((item) => !item.disabled),\n [visibleItems],\n );\n const visibleValues = useMemo(\n () => new Set(visibleItems.map((item) => item.value)),\n [visibleItems],\n );\n const visibleGroupIds = useMemo(\n () => new Set(visibleItems.map((item) => item.groupId)),\n [visibleItems],\n );\n\n const select = useCallback(\n (next: string) => {\n if (items.get(next)?.disabled) return;\n if (!valueControlled) setInternalValue(next);\n onValueChange?.(next);\n updateOpen(false, true);\n },\n [items, onValueChange, updateOpen, valueControlled],\n );\n\n const moveActive = useCallback(\n (direction: 1 | -1 | \"first\" | \"last\") => {\n if (!enabledVisibleItems.length) {\n setActiveValue(null);\n return;\n }\n if (direction === \"first\") {\n setActiveValue(enabledVisibleItems[0].value);\n return;\n }\n if (direction === \"last\") {\n setActiveValue(enabledVisibleItems.at(-1)?.value ?? null);\n return;\n }\n\n const currentIndex = enabledVisibleItems.findIndex((item) => item.value === activeValue);\n const nextIndex =\n currentIndex < 0\n ? direction === 1\n ? 0\n : enabledVisibleItems.length - 1\n : (currentIndex + direction + enabledVisibleItems.length) % enabledVisibleItems.length;\n setActiveValue(enabledVisibleItems[nextIndex].value);\n },\n [activeValue, enabledVisibleItems],\n );\n\n const selectActive = useCallback(() => {\n if (activeValue) select(activeValue);\n }, [activeValue, select]);\n\n useEffect(() => {\n if (!open) return;\n const selectedVisible = value && visibleValues.has(value) ? value : null;\n const activeVisible = activeValue && visibleValues.has(activeValue) ? activeValue : null;\n setActiveValue(activeVisible ?? selectedVisible ?? enabledVisibleItems[0]?.value ?? null);\n }, [activeValue, enabledVisibleItems, open, value, visibleValues]);\n\n useEffect(() => {\n if (!open) return;\n requestAnimationFrame(() => inputRef.current?.focus({ preventScroll: true }));\n }, [open]);\n\n useEffect(() => {\n if (!activeValue || !open) return;\n const item = items.get(activeValue)?.ref.current;\n const list = item?.closest<HTMLElement>(\"[role='listbox']\");\n if (!item || !list) return;\n const itemRect = item.getBoundingClientRect();\n const listRect = list.getBoundingClientRect();\n if (itemRect.top < listRect.top) list.scrollTop -= listRect.top - itemRect.top;\n else if (itemRect.bottom > listRect.bottom) list.scrollTop += itemRect.bottom - listRect.bottom;\n }, [activeValue, items, open]);\n\n useEffect(() => {\n if (!open) return;\n const isInside = (target: Node) =>\n rootRef.current?.contains(target) || contentRef.current?.contains(target);\n const onPointerDown = (event: PointerEvent) => {\n if (!isInside(event.target as Node)) updateOpen(false);\n };\n const onFocusIn = (event: FocusEvent) => {\n if (!isInside(event.target as Node)) updateOpen(false);\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n updateOpen(false, true);\n };\n window.addEventListener(\"pointerdown\", onPointerDown);\n window.addEventListener(\"focusin\", onFocusIn);\n window.addEventListener(\"keydown\", onKeyDown);\n return () => {\n window.removeEventListener(\"pointerdown\", onPointerDown);\n window.removeEventListener(\"focusin\", onFocusIn);\n window.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [open, updateOpen]);\n\n const activeItem = activeValue ? items.get(activeValue) : undefined;\n const context = useMemo<ComboboxContextValue>(\n () => ({\n open,\n setOpen: updateOpen,\n value,\n select,\n query,\n setQuery: updateQuery,\n activeValue,\n setActiveValue,\n moveActive,\n selectActive,\n registerItem,\n unregisterItem,\n labelFor: (itemValue) => (itemValue === undefined ? undefined : items.get(itemValue)?.label),\n isVisible: (itemValue) => !query.trim() || visibleValues.has(itemValue),\n hasVisibleItems: (groupId) => visibleGroupIds.has(groupId),\n visibleCount: visibleItems.length,\n activeItemId: activeItem?.id,\n triggerId: `${baseId}-trigger`,\n listId: `${baseId}-list`,\n inputId: `${baseId}-input`,\n disabled,\n reduce,\n triggerRef,\n contentRef,\n inputRef,\n activeLayoutId: `${baseId}-active`,\n }),\n [\n activeItem?.id,\n activeValue,\n baseId,\n disabled,\n items,\n moveActive,\n open,\n query,\n reduce,\n registerItem,\n select,\n selectActive,\n unregisterItem,\n updateOpen,\n updateQuery,\n value,\n visibleItems.length,\n visibleGroupIds,\n visibleValues,\n ],\n );\n\n return (\n <ComboboxContext.Provider value={context}>\n <div ref={rootRef} className={cn(\"relative w-full\", className)}>\n {children}\n </div>\n </ComboboxContext.Provider>\n );\n}\n"],"mappings":";;;;;;AA+BA,MAAM,iBAAiC,OAAO,OAAO,aAAa;CAChE,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,kBAAkB;CAC9C,IAAI,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B,WAAW,OAAO,IAAI;EACxB;EACA,OAAO,iBAAiB,eAAe,aAAa;EACpD,OAAO,iBAAiB,WAAW,SAAS;EAC5C,OAAO,iBAAiB,WAAW,SAAS;EAC5C,aAAa;GACX,OAAO,oBAAoB,eAAe,aAAa;GACvD,OAAO,oBAAoB,WAAW,SAAS;GAC/C,OAAO,oBAAoB,WAAW,SAAS;EACjD;CACF,GAAG,CAAC,MAAM,UAAU,CAAC;CAErB,MAAM,aAAa,cAAc,MAAM,IAAI,WAAW,IAAI,KAAA;CAC1D,MAAM,UAAU,eACP;EACL;EACA,SAAS;EACT;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA,WAAW,cAAe,cAAc,KAAA,IAAY,KAAA,IAAY,MAAM,IAAI,SAAS,CAAC,EAAE;EACtF,YAAY,cAAc,CAAC,MAAM,KAAK,KAAK,cAAc,IAAI,SAAS;EACtE,kBAAkB,YAAY,gBAAgB,IAAI,OAAO;EACzD,cAAc,aAAa;EAC3B,cAAc,YAAY;EAC1B,WAAW,GAAG,OAAO;EACrB,QAAQ,GAAG,OAAO;EAClB,SAAS,GAAG,OAAO;EACnB;EACA;EACA;EACA;EACA;EACA,gBAAgB,GAAG,OAAO;CAC5B,IACA;EACE,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;EACb;EACA;CACF,CACF;CAEA,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;EAC/B,UAAA,oBAAC,OAAD;GAAK,KAAK;GAAS,WAAW,GAAG,mBAAmB,SAAS;GAC1D;EACE,CAAA;CACmB,CAAA;AAE9B"}
@@ -0,0 +1,40 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/components/motion/combobox/list.d.ts
3
+ interface ComboboxListProps {
4
+ children: ReactNode;
5
+ ariaLabel?: string;
6
+ className?: string;
7
+ }
8
+ declare function ComboboxList({ children, ariaLabel, className }: ComboboxListProps): import("react").JSX.Element;
9
+ interface ComboboxGroupProps {
10
+ children: ReactNode;
11
+ className?: string;
12
+ }
13
+ declare function ComboboxGroup({ children, className }: ComboboxGroupProps): import("react").JSX.Element;
14
+ interface ComboboxLabelProps {
15
+ children: ReactNode;
16
+ className?: string;
17
+ }
18
+ declare function ComboboxLabel({ children, className }: ComboboxLabelProps): import("react").JSX.Element;
19
+ interface ComboboxItemProps {
20
+ value: string;
21
+ children: ReactNode;
22
+ textValue?: string;
23
+ keywords?: string[];
24
+ disabled?: boolean;
25
+ onSelect?: (value: string) => void;
26
+ className?: string;
27
+ }
28
+ declare function ComboboxItem({ value, children, textValue, keywords, disabled, onSelect, className }: ComboboxItemProps): import("react").JSX.Element | null;
29
+ interface ComboboxEmptyProps {
30
+ children?: ReactNode;
31
+ className?: string;
32
+ }
33
+ declare function ComboboxEmpty({ children, className }: ComboboxEmptyProps): import("react").JSX.Element | null;
34
+ interface ComboboxSeparatorProps {
35
+ className?: string;
36
+ }
37
+ declare function ComboboxSeparator({ className }: ComboboxSeparatorProps): import("react").JSX.Element;
38
+ //#endregion
39
+ export { ComboboxEmpty, ComboboxEmptyProps, ComboboxGroup, ComboboxGroupProps, ComboboxItem, ComboboxItemProps, ComboboxLabel, ComboboxLabelProps, ComboboxList, ComboboxListProps, ComboboxSeparator, ComboboxSeparatorProps };
40
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","names":[],"sources":["../../../../src/components/motion/combobox/list.tsx"],"mappings":";;UAUiB;EACf,UAAU;EACV;EACA;;iBAGc,eAAe,UAAU,WAAuB,aAAa,oCAAiB,IAAA;UAiB7E;EACf,UAAU;EACV;;iBAGc,gBAAgB,UAAU,aAAa,qCAAkB,IAAA;UAexD;EACf,UAAU;EACV;;iBAGc,gBAAgB,UAAU,aAAa,qCAAkB,IAAA;UAaxD;EACf;EACA,UAAU;EACV;EACA;EACA;EACA,YAAY;EACZ;;iBAGc,eACd,OACA,UACA,WACA,UACA,UACA,UACA,aACC,oCAAiB,IAAA;UAoFH;EACf,WAAW;EACX;;iBAGc,gBAAgB,UAAgC,aAAa,qCAAkB,IAAA;UAa9E;EACf;;iBAGc,oBAAoB,aAAa,yCAAsB,IAAA"}
@@ -0,0 +1,143 @@
1
+ "use client";
2
+ import { EASE_OUT, SPRING_LAYOUT } from "../../../lib/ease.js";
3
+ import { ComboboxGroupContext, useComboboxContext } from "./context.js";
4
+ import { useContext, useId, useLayoutEffect, useMemo, useRef } from "react";
5
+ import { cn } from "@kumix/utils";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { motion } from "motion/react";
8
+ import { Check } from "lucide-react";
9
+ //#region src/components/motion/combobox/list.tsx
10
+ function ComboboxList({ children, ariaLabel = "Options", className }) {
11
+ const context = useComboboxContext("ComboboxList");
12
+ return /* @__PURE__ */ jsx("div", {
13
+ id: context.listId,
14
+ role: "listbox",
15
+ "aria-label": ariaLabel,
16
+ className: cn("scrollbar-none relative isolate max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", className),
17
+ children
18
+ });
19
+ }
20
+ function ComboboxGroup({ children, className }) {
21
+ const context = useComboboxContext("ComboboxGroup");
22
+ const groupId = useId();
23
+ return /* @__PURE__ */ jsx(ComboboxGroupContext.Provider, {
24
+ value: groupId,
25
+ children: /* @__PURE__ */ jsx("fieldset", {
26
+ hidden: !context.hasVisibleItems(groupId),
27
+ className: cn("m-0 min-w-0 border-0 p-0 py-0.5", className),
28
+ children
29
+ })
30
+ });
31
+ }
32
+ function ComboboxLabel({ children, className }) {
33
+ const groupId = useContext(ComboboxGroupContext);
34
+ const labelClassName = cn("w-full px-2 py-1.5 font-medium text-[0.68rem] text-muted-foreground uppercase tracking-[0.12em]", className);
35
+ return groupId ? /* @__PURE__ */ jsx("legend", {
36
+ className: labelClassName,
37
+ children
38
+ }) : /* @__PURE__ */ jsx("div", {
39
+ className: labelClassName,
40
+ children
41
+ });
42
+ }
43
+ function ComboboxItem({ value, children, textValue, keywords = [], disabled = false, onSelect, className }) {
44
+ const context = useComboboxContext("ComboboxItem");
45
+ const groupId = useContext(ComboboxGroupContext);
46
+ const id = useId();
47
+ const itemRef = useRef(null);
48
+ const label = textValue ?? (typeof children === "string" ? children : value);
49
+ const visible = context.isVisible(value);
50
+ const active = context.activeValue === value;
51
+ const selected = context.value === value;
52
+ const keywordKey = keywords.join("\0");
53
+ const normalizedKeywords = useMemo(() => keywordKey ? keywordKey.split("\0") : [], [keywordKey]);
54
+ const { registerItem, unregisterItem } = context;
55
+ useLayoutEffect(() => {
56
+ registerItem({
57
+ value,
58
+ label,
59
+ keywords: normalizedKeywords,
60
+ disabled,
61
+ groupId,
62
+ id,
63
+ ref: itemRef
64
+ });
65
+ return () => unregisterItem(value);
66
+ }, [
67
+ disabled,
68
+ groupId,
69
+ id,
70
+ label,
71
+ normalizedKeywords,
72
+ registerItem,
73
+ unregisterItem,
74
+ value
75
+ ]);
76
+ if (!visible) return null;
77
+ return /* @__PURE__ */ jsxs("button", {
78
+ ref: itemRef,
79
+ id,
80
+ type: "button",
81
+ role: "option",
82
+ "aria-selected": selected,
83
+ disabled,
84
+ tabIndex: -1,
85
+ "data-combobox-item": "",
86
+ "data-active": active || void 0,
87
+ "data-selected": selected || void 0,
88
+ onPointerMove: () => {
89
+ if (!disabled) context.setActiveValue(value);
90
+ },
91
+ onPointerDown: (event) => event.preventDefault(),
92
+ onClick: () => {
93
+ if (disabled) return;
94
+ onSelect?.(value);
95
+ context.select(value);
96
+ },
97
+ className: cn("relative flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150", active ? "text-foreground" : "text-muted-foreground", "disabled:pointer-events-none disabled:opacity-45", className),
98
+ children: [
99
+ active ? /* @__PURE__ */ jsx(motion.span, {
100
+ "aria-hidden": true,
101
+ layoutId: context.activeLayoutId,
102
+ className: "absolute inset-0 -z-10 rounded-lg bg-muted",
103
+ transition: context.reduce ? { duration: 0 } : SPRING_LAYOUT
104
+ }) : null,
105
+ /* @__PURE__ */ jsx("span", {
106
+ className: "min-w-0 flex-1",
107
+ children
108
+ }),
109
+ /* @__PURE__ */ jsx(motion.span, {
110
+ "aria-hidden": true,
111
+ initial: false,
112
+ animate: {
113
+ opacity: selected ? 1 : 0,
114
+ transform: selected ? "scale(1)" : "scale(0.82)"
115
+ },
116
+ transition: context.reduce ? { duration: 0 } : {
117
+ duration: .14,
118
+ ease: EASE_OUT
119
+ },
120
+ className: "grid size-5 shrink-0 place-items-center text-foreground",
121
+ children: /* @__PURE__ */ jsx(Check, { className: "size-4" })
122
+ })
123
+ ]
124
+ });
125
+ }
126
+ function ComboboxEmpty({ children = "No options found.", className }) {
127
+ if (useComboboxContext("ComboboxEmpty").visibleCount > 0) return null;
128
+ return /* @__PURE__ */ jsx("div", {
129
+ role: "status",
130
+ className: cn("px-3 py-8 text-center text-muted-foreground text-sm", className),
131
+ children
132
+ });
133
+ }
134
+ function ComboboxSeparator({ className }) {
135
+ return /* @__PURE__ */ jsx("div", {
136
+ "aria-hidden": true,
137
+ className: cn("-mx-1 my-1 h-px bg-border", className)
138
+ });
139
+ }
140
+ //#endregion
141
+ export { ComboboxEmpty, ComboboxGroup, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator };
142
+
143
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","names":[],"sources":["../../../../src/components/motion/combobox/list.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useContext, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../../lib/ease\";\nimport { ComboboxGroupContext, useComboboxContext } from \"./context\";\n\nexport interface ComboboxListProps {\n children: ReactNode;\n ariaLabel?: string;\n className?: string;\n}\n\nexport function ComboboxList({ children, ariaLabel = \"Options\", className }: ComboboxListProps) {\n const context = useComboboxContext(\"ComboboxList\");\n return (\n <div\n id={context.listId}\n role=\"listbox\"\n aria-label={ariaLabel}\n className={cn(\n \"scrollbar-none relative isolate max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface ComboboxGroupProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function ComboboxGroup({ children, className }: ComboboxGroupProps) {\n const context = useComboboxContext(\"ComboboxGroup\");\n const groupId = useId();\n return (\n <ComboboxGroupContext.Provider value={groupId}>\n <fieldset\n hidden={!context.hasVisibleItems(groupId)}\n className={cn(\"m-0 min-w-0 border-0 p-0 py-0.5\", className)}\n >\n {children}\n </fieldset>\n </ComboboxGroupContext.Provider>\n );\n}\n\nexport interface ComboboxLabelProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function ComboboxLabel({ children, className }: ComboboxLabelProps) {\n const groupId = useContext(ComboboxGroupContext);\n const labelClassName = cn(\n \"w-full px-2 py-1.5 font-medium text-[0.68rem] text-muted-foreground uppercase tracking-[0.12em]\",\n className,\n );\n return groupId ? (\n <legend className={labelClassName}>{children}</legend>\n ) : (\n <div className={labelClassName}>{children}</div>\n );\n}\n\nexport interface ComboboxItemProps {\n value: string;\n children: ReactNode;\n textValue?: string;\n keywords?: string[];\n disabled?: boolean;\n onSelect?: (value: string) => void;\n className?: string;\n}\n\nexport function ComboboxItem({\n value,\n children,\n textValue,\n keywords = [],\n disabled = false,\n onSelect,\n className,\n}: ComboboxItemProps) {\n const context = useComboboxContext(\"ComboboxItem\");\n const groupId = useContext(ComboboxGroupContext);\n const id = useId();\n const itemRef = useRef<HTMLButtonElement>(null);\n const label = textValue ?? (typeof children === \"string\" ? children : value);\n const visible = context.isVisible(value);\n const active = context.activeValue === value;\n const selected = context.value === value;\n const keywordKey = keywords.join(\"\\u0000\");\n const normalizedKeywords = useMemo(\n () => (keywordKey ? keywordKey.split(\"\\u0000\") : []),\n [keywordKey],\n );\n const { registerItem, unregisterItem } = context;\n\n useLayoutEffect(() => {\n registerItem({\n value,\n label,\n keywords: normalizedKeywords,\n disabled,\n groupId,\n id,\n ref: itemRef,\n });\n return () => unregisterItem(value);\n }, [disabled, groupId, id, label, normalizedKeywords, registerItem, unregisterItem, value]);\n\n if (!visible) return null;\n\n return (\n <button\n ref={itemRef}\n id={id}\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n disabled={disabled}\n tabIndex={-1}\n data-combobox-item=\"\"\n data-active={active || undefined}\n data-selected={selected || undefined}\n onPointerMove={() => {\n if (!disabled) context.setActiveValue(value);\n }}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n if (disabled) return;\n onSelect?.(value);\n context.select(value);\n }}\n className={cn(\n \"relative flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n \"disabled:pointer-events-none disabled:opacity-45\",\n className,\n )}\n >\n {active ? (\n <motion.span\n aria-hidden\n layoutId={context.activeLayoutId}\n className=\"absolute inset-0 -z-10 rounded-lg bg-muted\"\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n />\n ) : null}\n <span className=\"min-w-0 flex-1\">{children}</span>\n <motion.span\n aria-hidden\n initial={false}\n animate={{\n opacity: selected ? 1 : 0,\n transform: selected ? \"scale(1)\" : \"scale(0.82)\",\n }}\n transition={context.reduce ? { duration: 0 } : { duration: 0.14, ease: EASE_OUT }}\n className=\"grid size-5 shrink-0 place-items-center text-foreground\"\n >\n <Check className=\"size-4\" />\n </motion.span>\n </button>\n );\n}\n\nexport interface ComboboxEmptyProps {\n children?: ReactNode;\n className?: string;\n}\n\nexport function ComboboxEmpty({ children = \"No options found.\", className }: ComboboxEmptyProps) {\n const context = useComboboxContext(\"ComboboxEmpty\");\n if (context.visibleCount > 0) return null;\n return (\n <div\n role=\"status\"\n className={cn(\"px-3 py-8 text-center text-muted-foreground text-sm\", className)}\n >\n {children}\n </div>\n );\n}\n\nexport interface ComboboxSeparatorProps {\n className?: string;\n}\n\nexport function ComboboxSeparator({ className }: ComboboxSeparatorProps) {\n return <div aria-hidden className={cn(\"-mx-1 my-1 h-px bg-border\", className)} />;\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgB,aAAa,EAAE,UAAU,YAAY,WAAW,aAAgC;CAC9F,MAAM,UAAU,mBAAmB,cAAc;CACjD,OACE,oBAAC,OAAD;EACE,IAAI,QAAQ;EACZ,MAAK;EACL,cAAY;EACZ,WAAW,GACT,6IACA,SACF;EAEC;CACE,CAAA;AAET;AAOA,SAAgB,cAAc,EAAE,UAAU,aAAiC;CACzE,MAAM,UAAU,mBAAmB,eAAe;CAClD,MAAM,UAAU,MAAM;CACtB,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;EACpC,UAAA,oBAAC,YAAD;GACE,QAAQ,CAAC,QAAQ,gBAAgB,OAAO;GACxC,WAAW,GAAG,mCAAmC,SAAS;GAEzD;EACO,CAAA;CACmB,CAAA;AAEnC;AAOA,SAAgB,cAAc,EAAE,UAAU,aAAiC;CACzE,MAAM,UAAU,WAAW,oBAAoB;CAC/C,MAAM,iBAAiB,GACrB,mGACA,SACF;CACA,OAAO,UACL,oBAAC,UAAD;EAAQ,WAAW;EAAiB;CAAiB,CAAA,IAErD,oBAAC,OAAD;EAAK,WAAW;EAAiB;CAAc,CAAA;AAEnD;AAYA,SAAgB,aAAa,EAC3B,OACA,UACA,WACA,WAAW,CAAC,GACZ,WAAW,OACX,UACA,aACoB;CACpB,MAAM,UAAU,mBAAmB,cAAc;CACjD,MAAM,UAAU,WAAW,oBAAoB;CAC/C,MAAM,KAAK,MAAM;CACjB,MAAM,UAAU,OAA0B,IAAI;CAC9C,MAAM,QAAQ,cAAc,OAAO,aAAa,WAAW,WAAW;CACtE,MAAM,UAAU,QAAQ,UAAU,KAAK;CACvC,MAAM,SAAS,QAAQ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