@justanarthur/modo-ui 0.0.0-stage → 0.1.0

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 (172) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.beui +21 -0
  3. package/LICENSE.fluid-functionalism +21 -0
  4. package/LICENSE.motion-primitives +21 -0
  5. package/LICENSE.sileo +21 -0
  6. package/README.md +608 -2
  7. package/dist/base.css +994 -0
  8. package/dist/blocks/sidebar-app/index.d.ts +34 -0
  9. package/dist/blocks/sidebar-app/index.js +34 -0
  10. package/dist/components/badge/index.d.ts +59 -0
  11. package/dist/components/badge/index.js +18 -0
  12. package/dist/components/button/index.d.ts +59 -0
  13. package/dist/components/button/index.js +16 -0
  14. package/dist/components/card/index.d.ts +141 -0
  15. package/dist/components/card/index.js +44 -0
  16. package/dist/components/inputs/checkbox-group/index.d.ts +50 -0
  17. package/dist/components/inputs/checkbox-group/index.js +23 -0
  18. package/dist/components/inputs/color-picker/index.d.ts +137 -0
  19. package/dist/components/inputs/color-picker/index.js +37 -0
  20. package/dist/components/inputs/combobox/index.d.ts +161 -0
  21. package/dist/components/inputs/combobox/index.js +41 -0
  22. package/dist/components/inputs/date-time/calendar/index.d.ts +45 -0
  23. package/dist/components/inputs/date-time/calendar/index.js +20 -0
  24. package/dist/components/inputs/date-time/date-picker/index.d.ts +82 -0
  25. package/dist/components/inputs/date-time/date-picker/index.js +34 -0
  26. package/dist/components/inputs/date-time/date-range-picker/index.d.ts +64 -0
  27. package/dist/components/inputs/date-time/date-range-picker/index.js +33 -0
  28. package/dist/components/inputs/date-time/duration-picker/index.d.ts +57 -0
  29. package/dist/components/inputs/date-time/duration-picker/index.js +33 -0
  30. package/dist/components/inputs/date-time/month-picker/index.d.ts +57 -0
  31. package/dist/components/inputs/date-time/month-picker/index.js +32 -0
  32. package/dist/components/inputs/date-time/time-picker/index.d.ts +59 -0
  33. package/dist/components/inputs/date-time/time-picker/index.js +33 -0
  34. package/dist/components/inputs/input/index.d.ts +84 -0
  35. package/dist/components/inputs/input/index.js +20 -0
  36. package/dist/components/inputs/input-copy/index.d.ts +44 -0
  37. package/dist/components/inputs/input-copy/index.js +18 -0
  38. package/dist/components/inputs/input-message/index.d.ts +125 -0
  39. package/dist/components/inputs/input-message/index.js +27 -0
  40. package/dist/components/inputs/radio-group/index.d.ts +58 -0
  41. package/dist/components/inputs/radio-group/index.js +22 -0
  42. package/dist/components/inputs/search/index.d.ts +83 -0
  43. package/dist/components/inputs/search/index.js +28 -0
  44. package/dist/components/inputs/select/index.d.ts +105 -0
  45. package/dist/components/inputs/select/index.js +37 -0
  46. package/dist/components/inputs/slider/index.d.ts +108 -0
  47. package/dist/components/inputs/slider/index.js +16 -0
  48. package/dist/components/inputs/switch/index.d.ts +43 -0
  49. package/dist/components/inputs/switch/index.js +16 -0
  50. package/dist/components/navigation/accordion/index.d.ts +117 -0
  51. package/dist/components/navigation/accordion/index.js +30 -0
  52. package/dist/components/navigation/sidebar/index.d.ts +388 -0
  53. package/dist/components/navigation/sidebar/index.js +101 -0
  54. package/dist/components/navigation/tabs/index.d.ts +70 -0
  55. package/dist/components/navigation/tabs/index.js +25 -0
  56. package/dist/components/navigation/tabs-subtle/index.d.ts +73 -0
  57. package/dist/components/navigation/tabs-subtle/index.js +23 -0
  58. package/dist/components/overlays/alert-dialog/index.d.ts +67 -0
  59. package/dist/components/overlays/alert-dialog/index.js +24 -0
  60. package/dist/components/overlays/command/index.d.ts +121 -0
  61. package/dist/components/overlays/command/index.js +39 -0
  62. package/dist/components/overlays/context-menu/index.d.ts +97 -0
  63. package/dist/components/overlays/context-menu/index.js +32 -0
  64. package/dist/components/overlays/dialog/index.d.ts +130 -0
  65. package/dist/components/overlays/dialog/index.js +39 -0
  66. package/dist/components/overlays/dropdown/index.d.ts +222 -0
  67. package/dist/components/overlays/dropdown/index.js +47 -0
  68. package/dist/components/overlays/popover/index.d.ts +87 -0
  69. package/dist/components/overlays/popover/index.js +28 -0
  70. package/dist/components/overlays/preview-card/index.d.ts +75 -0
  71. package/dist/components/overlays/preview-card/index.js +21 -0
  72. package/dist/components/overlays/sheet/index.d.ts +67 -0
  73. package/dist/components/overlays/sheet/index.js +26 -0
  74. package/dist/components/overlays/toast/index.d.ts +107 -0
  75. package/dist/components/overlays/toast/index.js +23 -0
  76. package/dist/components/overlays/tooltip/index.d.ts +75 -0
  77. package/dist/components/overlays/tooltip/index.js +19 -0
  78. package/dist/components/table/index.d.ts +44 -0
  79. package/dist/components/table/index.js +28 -0
  80. package/dist/components/thinking-indicator/index.d.ts +32 -0
  81. package/dist/components/thinking-indicator/index.js +15 -0
  82. package/dist/index.d.ts +3926 -0
  83. package/dist/index.js +513 -0
  84. package/dist/preset.d.ts +104 -0
  85. package/dist/preset.js +124 -0
  86. package/dist/primitives/code/index.d.ts +23 -0
  87. package/dist/primitives/code/index.js +12 -0
  88. package/dist/primitives/craft/index.d.ts +31 -0
  89. package/dist/primitives/craft/index.js +13 -0
  90. package/dist/primitives/fluid-hover/index.d.ts +233 -0
  91. package/dist/primitives/fluid-hover/index.js +27 -0
  92. package/dist/primitives/morph/index.d.ts +127 -0
  93. package/dist/primitives/morph/index.js +21 -0
  94. package/dist/primitives/motion/index.d.ts +115 -0
  95. package/dist/primitives/motion/index.js +20 -0
  96. package/dist/primitives/scroll-area/index.d.ts +41 -0
  97. package/dist/primitives/scroll-area/index.js +13 -0
  98. package/dist/primitives/sizes/index.d.ts +128 -0
  99. package/dist/primitives/sizes/index.js +22 -0
  100. package/dist/primitives/surface/index.d.ts +69 -0
  101. package/dist/primitives/surface/index.js +18 -0
  102. package/dist/shared/components-0f0as45n.js +17 -0
  103. package/dist/shared/components-40j34hdb.js +986 -0
  104. package/dist/shared/components-4hh0gm0v.js +292 -0
  105. package/dist/shared/components-4xxddc44.js +15 -0
  106. package/dist/shared/components-4xxtggzp.js +110 -0
  107. package/dist/shared/components-54nf2x99.js +293 -0
  108. package/dist/shared/components-5pkcfprd.js +232 -0
  109. package/dist/shared/components-5vxtcp88.js +9 -0
  110. package/dist/shared/components-5zry9te1.js +152 -0
  111. package/dist/shared/components-61ckf42z.js +220 -0
  112. package/dist/shared/components-6hzwfmfd.js +58 -0
  113. package/dist/shared/components-6phwsry6.js +361 -0
  114. package/dist/shared/components-6t6nr33r.js +86 -0
  115. package/dist/shared/components-6y1th6k4.js +111 -0
  116. package/dist/shared/components-74c20v2f.js +32 -0
  117. package/dist/shared/components-7cqq1sqy.js +193 -0
  118. package/dist/shared/components-7gv95yfy.js +496 -0
  119. package/dist/shared/components-7nww01w4.js +375 -0
  120. package/dist/shared/components-7zp99w5d.js +62 -0
  121. package/dist/shared/components-8hk9ve3r.js +1200 -0
  122. package/dist/shared/components-8hzbsfbd.js +123 -0
  123. package/dist/shared/components-9p8s8n5q.js +171 -0
  124. package/dist/shared/components-aaq3yk4f.js +304 -0
  125. package/dist/shared/components-bf2d9k02.js +484 -0
  126. package/dist/shared/components-bkvb6nem.js +63 -0
  127. package/dist/shared/components-brnzrp2t.js +262 -0
  128. package/dist/shared/components-csxz9f52.js +42 -0
  129. package/dist/shared/components-de8xsm9y.js +22 -0
  130. package/dist/shared/components-dg0w8g5p.js +26 -0
  131. package/dist/shared/components-dphg9gjr.js +42 -0
  132. package/dist/shared/components-e46kf6cp.js +298 -0
  133. package/dist/shared/components-ed7cmssr.js +105 -0
  134. package/dist/shared/components-ess3ch6w.js +137 -0
  135. package/dist/shared/components-gjfrycb5.js +984 -0
  136. package/dist/shared/components-gndm6am4.js +128 -0
  137. package/dist/shared/components-hjkrv00c.js +191 -0
  138. package/dist/shared/components-hzfp4tjb.js +270 -0
  139. package/dist/shared/components-j65qt1mq.js +719 -0
  140. package/dist/shared/components-jw16snbn.js +19 -0
  141. package/dist/shared/components-jxgznftn.js +146 -0
  142. package/dist/shared/components-kf2ehztc.js +216 -0
  143. package/dist/shared/components-kpbcms10.js +9 -0
  144. package/dist/shared/components-m5br529r.js +141 -0
  145. package/dist/shared/components-nn6xezy2.js +1828 -0
  146. package/dist/shared/components-nnnd2xef.js +9 -0
  147. package/dist/shared/components-p2vmyfe1.js +345 -0
  148. package/dist/shared/components-peg09pzs.js +79 -0
  149. package/dist/shared/components-r22vtgqc.js +45 -0
  150. package/dist/shared/components-r2gke5p6.js +1759 -0
  151. package/dist/shared/components-r43mqnd6.js +160 -0
  152. package/dist/shared/components-r4jt6hgd.js +58 -0
  153. package/dist/shared/components-rc63qsy6.js +159 -0
  154. package/dist/shared/components-s3yfvfkr.js +149 -0
  155. package/dist/shared/components-s5pkbjx1.js +445 -0
  156. package/dist/shared/components-tad5h7ta.js +346 -0
  157. package/dist/shared/components-taxmgbnh.js +120 -0
  158. package/dist/shared/components-tm88ghva.js +215 -0
  159. package/dist/shared/components-v7es8aan.js +144 -0
  160. package/dist/shared/components-vb033rns.js +28 -0
  161. package/dist/shared/components-vc1k7yv2.js +30 -0
  162. package/dist/shared/components-vktws5r6.js +667 -0
  163. package/dist/shared/components-x2xyckd5.js +198 -0
  164. package/dist/shared/components-x3rz4cyn.js +61 -0
  165. package/dist/shared/components-xszag63d.js +141 -0
  166. package/dist/shared/components-y3cqdrgy.js +291 -0
  167. package/dist/shared/components-zvb11ker.js +288 -0
  168. package/dist/shared/components-zx2hr57f.js +124 -0
  169. package/dist/styles.css +1949 -0
  170. package/dist/tailwind.css +219 -0
  171. package/dist/tokens.css +345 -0
  172. package/package.json +102 -3
@@ -0,0 +1,496 @@
1
+ import {
2
+ SizeProvider
3
+ } from "./components-vb033rns.js";
4
+ import {
5
+ POPUP_NAV_KEYS,
6
+ isDisabledRow,
7
+ popupScrollAreaClass,
8
+ popupViewportClass
9
+ } from "./components-jw16snbn.js";
10
+ import {
11
+ ScrollArea
12
+ } from "./components-ed7cmssr.js";
13
+ import {
14
+ SURFACE_BG,
15
+ SURFACE_SHADOW,
16
+ SurfaceProvider,
17
+ useSurface
18
+ } from "./components-csxz9f52.js";
19
+ import {
20
+ MorphSurface
21
+ } from "./components-jxgznftn.js";
22
+ import {
23
+ FluidHoverHighlight
24
+ } from "./components-r22vtgqc.js";
25
+ import {
26
+ useFluidHover,
27
+ useRegisterFluidHoverItem
28
+ } from "./components-e46kf6cp.js";
29
+ import {
30
+ shapeMap,
31
+ useShape
32
+ } from "./components-7zp99w5d.js";
33
+ import {
34
+ inPlaceOffset,
35
+ opensInPlace,
36
+ useMorph,
37
+ useMorphOrigin
38
+ } from "./components-7nww01w4.js";
39
+ import {
40
+ spring
41
+ } from "./components-vc1k7yv2.js";
42
+ import {
43
+ useSize
44
+ } from "./components-x3rz4cyn.js";
45
+ import {
46
+ cn
47
+ } from "./components-0f0as45n.js";
48
+
49
+ // components/inputs/select/index.tsx
50
+ import { Select as SelectPrimitive } from "@base-ui/react/select";
51
+ import { cva } from "class-variance-authority";
52
+ import { AnimatePresence, motion } from "motion/react";
53
+ import {
54
+ Children,
55
+ createContext,
56
+ forwardRef,
57
+ isValidElement,
58
+ useCallback as useCallback2,
59
+ useContext,
60
+ useEffect as useEffect2,
61
+ useImperativeHandle,
62
+ useMemo,
63
+ useRef as useRef2,
64
+ useState
65
+ } from "react";
66
+
67
+ // lib/use-keyboard-nav-gate.ts
68
+ import { useCallback, useEffect, useRef } from "react";
69
+ function useKeyboardNavGate(open) {
70
+ const keyboardNavRef = useRef(false);
71
+ useEffect(() => {
72
+ if (!open)
73
+ return;
74
+ const active = document.activeElement;
75
+ keyboardNavRef.current = active instanceof HTMLElement && active.matches(":focus-visible");
76
+ }, [open]);
77
+ const trackKeyboardNav = useCallback((e) => {
78
+ if (POPUP_NAV_KEYS.includes(e.key))
79
+ keyboardNavRef.current = true;
80
+ }, []);
81
+ return { keyboardNavRef, trackKeyboardNav };
82
+ }
83
+
84
+ // components/inputs/select/index.tsx
85
+ import { jsx, jsxs } from "react/jsx-runtime";
86
+ var selectionAckMs = 300;
87
+ var SelectContext = createContext(null);
88
+ function useSelectContext() {
89
+ const ctx = useContext(SelectContext);
90
+ if (!ctx)
91
+ throw new Error("Select compound components must be inside <Select>");
92
+ return ctx;
93
+ }
94
+ var SelectContentContext = createContext(null);
95
+ var popupShape = shapeMap.rounded;
96
+ function collectSelectItems(node, out = []) {
97
+ Children.forEach(node, (child) => {
98
+ if (!isValidElement(child))
99
+ return;
100
+ const props = child.props;
101
+ if (typeof props.value === "string") {
102
+ out.push({
103
+ value: props.value,
104
+ label: typeof props.children === "string" ? props.children : props.value
105
+ });
106
+ } else if (props.children) {
107
+ collectSelectItems(props.children, out);
108
+ }
109
+ });
110
+ return out;
111
+ }
112
+ function Select({ children, value, defaultValue, onValueChange, disabled = false, name, required, size }) {
113
+ const [internalValue, setInternalValue] = useState(defaultValue ?? "");
114
+ const [open, setOpen] = useState(false);
115
+ const { origin, capture } = useMorphOrigin();
116
+ const currentValue = value !== undefined ? value : internalValue;
117
+ const items = useMemo(() => collectSelectItems(children), [children]);
118
+ const handleValueChange = useCallback2((next) => {
119
+ const v = next ?? "";
120
+ if (value === undefined)
121
+ setInternalValue(v);
122
+ onValueChange?.(v);
123
+ }, [value, onValueChange]);
124
+ const ackTimeoutRef = useRef2(null);
125
+ const cancelAckClose = useCallback2(() => {
126
+ if (ackTimeoutRef.current !== null) {
127
+ clearTimeout(ackTimeoutRef.current);
128
+ ackTimeoutRef.current = null;
129
+ }
130
+ }, []);
131
+ useEffect2(() => cancelAckClose, [cancelAckClose]);
132
+ const handleOpenChange = useCallback2((nextOpen, eventDetails) => {
133
+ if (nextOpen)
134
+ capture(eventDetails);
135
+ if (!nextOpen && eventDetails.reason === "item-press") {
136
+ cancelAckClose();
137
+ ackTimeoutRef.current = window.setTimeout(() => {
138
+ ackTimeoutRef.current = null;
139
+ setOpen(false);
140
+ }, selectionAckMs);
141
+ return;
142
+ }
143
+ cancelAckClose();
144
+ setOpen(nextOpen);
145
+ }, [cancelAckClose, capture]);
146
+ const ctx = useMemo(() => ({ value: currentValue, open, origin }), [currentValue, open, origin]);
147
+ const root = /* @__PURE__ */ jsx(SelectContext.Provider, {
148
+ value: ctx,
149
+ children: /* @__PURE__ */ jsx(SelectPrimitive.Root, {
150
+ value: currentValue === "" ? null : currentValue,
151
+ onValueChange: handleValueChange,
152
+ open,
153
+ onOpenChange: handleOpenChange,
154
+ items,
155
+ disabled,
156
+ name,
157
+ required,
158
+ modal: false,
159
+ children
160
+ })
161
+ });
162
+ return size ? /* @__PURE__ */ jsx(SizeProvider, {
163
+ size,
164
+ children: root
165
+ }) : root;
166
+ }
167
+ Select.displayName = "Select";
168
+ var triggerVariants = cva([
169
+ "group inline-flex items-center justify-between outline-none cursor-pointer",
170
+ "transition-all duration-fast",
171
+ "disabled:opacity-50 disabled:pointer-events-none",
172
+ "focus-visible:ring-1 focus-visible:ring-focus-ring"
173
+ ], {
174
+ variants: {
175
+ variant: {
176
+ bordered: "border border-border bg-transparent text-foreground hover:bg-hover",
177
+ borderless: "border border-transparent bg-transparent text-foreground hover:bg-hover"
178
+ }
179
+ },
180
+ defaultVariants: {
181
+ variant: "bordered"
182
+ }
183
+ });
184
+ var SelectTrigger = forwardRef(({ className, variant, icon: Icon, placeholder = "Select…", error, size, ...props }, ref) => {
185
+ const shape = useShape();
186
+ const sizeClasses = useSize(size);
187
+ const compact = sizeClasses.variant === "compact";
188
+ return /* @__PURE__ */ jsxs("div", {
189
+ className: "flex flex-col gap-1",
190
+ children: [
191
+ /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
192
+ ref,
193
+ "aria-invalid": !!error || undefined,
194
+ className: cn(triggerVariants({ variant }), sizeClasses.control, sizeClasses.text, sizeClasses.px, sizeClasses.gap, compact ? "min-w-[128px]" : "min-w-[160px]", shape.input, error && "border-destructive/50 hover:border-destructive/50", className),
195
+ ...props,
196
+ children: [
197
+ /* @__PURE__ */ jsxs("span", {
198
+ className: cn("flex items-center min-w-0 flex-1", sizeClasses.gap),
199
+ children: [
200
+ Icon && /* @__PURE__ */ jsx(Icon, {
201
+ size: sizeClasses.icon,
202
+ strokeWidth: 1.5,
203
+ className: "shrink-0 text-muted-foreground transition-[color,stroke-width] duration-fast group-hover:text-foreground group-hover:stroke-[2]"
204
+ }),
205
+ /* @__PURE__ */ jsx(SelectPrimitive.Value, {
206
+ placeholder,
207
+ className: "min-w-0 flex-1 text-left truncate [text-box:trim-both_cap_alphabetic] py-1 -my-1 data-[placeholder]:text-muted-foreground"
208
+ })
209
+ ]
210
+ }),
211
+ /* @__PURE__ */ jsx("svg", {
212
+ width: sizeClasses.icon,
213
+ height: sizeClasses.icon,
214
+ viewBox: "0 0 24 24",
215
+ fill: "none",
216
+ stroke: "currentColor",
217
+ strokeWidth: 2,
218
+ strokeLinecap: "round",
219
+ strokeLinejoin: "round",
220
+ className: "shrink-0 text-muted-foreground transition-colors duration-fast group-hover:text-foreground",
221
+ children: /* @__PURE__ */ jsx("path", {
222
+ d: "M6 9l6 6 6-6"
223
+ })
224
+ })
225
+ ]
226
+ }),
227
+ error && /* @__PURE__ */ jsx("span", {
228
+ className: "text-caption text-destructive pl-3",
229
+ children: error
230
+ })
231
+ ]
232
+ });
233
+ });
234
+ SelectTrigger.displayName = "SelectTrigger";
235
+ var SelectContent = forwardRef(({ from, effect, hideSource, tier = "moderate", className, children }, ref) => {
236
+ const { open, value, origin } = useSelectContext();
237
+ const morph = useMorph(open, origin, { from, effect, hideSource, tier });
238
+ useImperativeHandle(ref, () => morph.popup, [morph.popup]);
239
+ const level = Math.min(useSurface() + 2, 8);
240
+ const shape = popupShape;
241
+ const containerRef = useRef2(null);
242
+ const hover = useFluidHover(containerRef, { isItemDisabled: isDisabledRow });
243
+ const { activeIndex, setActiveIndex, itemRects, isMeasured, handlers, registerItem, remeasure } = hover;
244
+ const [focusedIndex, setFocusedIndex] = useState(null);
245
+ const { keyboardNavRef, trackKeyboardNav } = useKeyboardNavGate(open);
246
+ const [checkedIndex, setCheckedIndex] = useState(undefined);
247
+ useEffect2(() => {
248
+ if (!open)
249
+ return;
250
+ remeasure();
251
+ }, [open, remeasure]);
252
+ useEffect2(() => {
253
+ if (!open)
254
+ return;
255
+ let inner;
256
+ const outer = requestAnimationFrame(() => {
257
+ inner = requestAnimationFrame(() => {
258
+ const container = containerRef.current;
259
+ if (container) {
260
+ const items = Array.from(container.querySelectorAll("[data-fluid-hover-index]"));
261
+ const idx = items.findIndex((el) => el.getAttribute("data-value") === value);
262
+ setCheckedIndex(idx !== -1 ? idx : undefined);
263
+ }
264
+ });
265
+ });
266
+ return () => {
267
+ cancelAnimationFrame(outer);
268
+ cancelAnimationFrame(inner);
269
+ };
270
+ }, [open, value]);
271
+ useEffect2(() => {
272
+ if (open)
273
+ return;
274
+ setCheckedIndex(undefined);
275
+ setActiveIndex(null);
276
+ setFocusedIndex(null);
277
+ }, [open, setActiveIndex]);
278
+ const checkedRect = isMeasured && checkedIndex != null ? itemRects[checkedIndex] : null;
279
+ const focusRect = isMeasured && focusedIndex !== null ? itemRects[focusedIndex] : null;
280
+ const contentCtx = useMemo(() => ({ registerItem, activeIndex, checkedIndex }), [registerItem, activeIndex, checkedIndex]);
281
+ return /* @__PURE__ */ jsx(SelectPrimitive.Portal, {
282
+ children: /* @__PURE__ */ jsx(SelectPrimitive.Positioner, {
283
+ side: "bottom",
284
+ align: "start",
285
+ sideOffset: opensInPlace({ effect, hideSource }) ? inPlaceOffset : 6,
286
+ alignItemWithTrigger: false,
287
+ className: "z-50 outline-none",
288
+ children: /* @__PURE__ */ jsx(SelectContentContext.Provider, {
289
+ value: contentCtx,
290
+ children: /* @__PURE__ */ jsx(SelectPrimitive.Popup, {
291
+ ref: morph.popupRef,
292
+ onKeyDownCapture: trackKeyboardNav,
293
+ onMouseEnter: () => {
294
+ handlers.onMouseEnter();
295
+ setFocusedIndex(null);
296
+ },
297
+ onMouseMove: handlers.onMouseMove,
298
+ onMouseLeave: handlers.onMouseLeave,
299
+ onClick: handlers.onClick,
300
+ onFocus: (e) => {
301
+ const indexAttr = e.target.closest("[data-fluid-hover-index]")?.getAttribute("data-fluid-hover-index");
302
+ if (indexAttr != null) {
303
+ const idx = Number(indexAttr);
304
+ setActiveIndex(idx);
305
+ setFocusedIndex(keyboardNavRef.current && e.target.matches(":focus-visible") ? idx : null);
306
+ }
307
+ },
308
+ onBlur: (e) => {
309
+ if (e.currentTarget.contains(e.relatedTarget))
310
+ return;
311
+ setFocusedIndex(null);
312
+ setActiveIndex(null);
313
+ },
314
+ className: "relative select-none outline-none",
315
+ children: /* @__PURE__ */ jsx(SurfaceProvider, {
316
+ value: level,
317
+ children: /* @__PURE__ */ jsx(MorphSurface, {
318
+ morph,
319
+ bg: SURFACE_BG[level],
320
+ shadow: SURFACE_SHADOW[3],
321
+ radius: shape.container,
322
+ className: cn(`flex flex-col min-w-[var(--anchor-width)] max-h-[min(300px,var(--available-height))] overflow-hidden ${shape.container}`, className),
323
+ children: /* @__PURE__ */ jsx(ScrollArea, {
324
+ className: popupScrollAreaClass,
325
+ viewportClassName: cn(popupViewportClass, "scroll-fade"),
326
+ children: /* @__PURE__ */ jsxs("div", {
327
+ ref: containerRef,
328
+ className: "relative flex flex-col p-1",
329
+ children: [
330
+ open && /* @__PURE__ */ jsx(AnimatePresence, {
331
+ children: checkedRect && /* @__PURE__ */ jsx(motion.div, {
332
+ className: `absolute ${shape.bg} bg-active pointer-events-none`,
333
+ initial: false,
334
+ animate: {
335
+ top: checkedRect.top,
336
+ left: checkedRect.left,
337
+ width: checkedRect.width,
338
+ height: checkedRect.height,
339
+ opacity: 1
340
+ },
341
+ exit: { opacity: 0, transition: spring.moderate.exit },
342
+ transition: {
343
+ ...spring.moderate,
344
+ opacity: { duration: spring.fast.duration }
345
+ }
346
+ })
347
+ }),
348
+ /* @__PURE__ */ jsx(FluidHoverHighlight, {
349
+ hover,
350
+ hidden: !open,
351
+ className: shape.bg
352
+ }),
353
+ open && /* @__PURE__ */ jsx(AnimatePresence, {
354
+ children: focusRect && /* @__PURE__ */ jsx(motion.div, {
355
+ className: `absolute ${shape.focusRing} pointer-events-none z-20 border border-focus-ring`,
356
+ initial: false,
357
+ animate: {
358
+ left: focusRect.left - 2,
359
+ top: focusRect.top - 2,
360
+ width: focusRect.width + 4,
361
+ height: focusRect.height + 4
362
+ },
363
+ exit: { opacity: 0, transition: spring.fast.exit },
364
+ transition: {
365
+ ...spring.fast,
366
+ opacity: { duration: spring.fast.duration }
367
+ }
368
+ })
369
+ }),
370
+ children
371
+ ]
372
+ })
373
+ })
374
+ })
375
+ })
376
+ })
377
+ })
378
+ })
379
+ });
380
+ });
381
+ SelectContent.displayName = "SelectContent";
382
+ var SelectItem = forwardRef(({ className, children, icon: Icon, value, index, disabled = false, ...props }, ref) => {
383
+ const selectCtx = useSelectContext();
384
+ const contentCtx = useContext(SelectContentContext);
385
+ const internalRef = useRef2(null);
386
+ const shape = popupShape;
387
+ const sizeClasses = useSize();
388
+ const compact = sizeClasses.variant === "compact";
389
+ const hasMounted = useRef2(false);
390
+ useEffect2(() => {
391
+ hasMounted.current = true;
392
+ }, []);
393
+ const registerItem = contentCtx?.registerItem;
394
+ useRegisterFluidHoverItem(registerItem, index, internalRef);
395
+ const isActive = contentCtx?.activeIndex === index;
396
+ const isChecked = selectCtx.value === value;
397
+ const skipAnimation = !hasMounted.current;
398
+ return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
399
+ value,
400
+ disabled,
401
+ label: typeof children === "string" ? children : undefined,
402
+ render: /* @__PURE__ */ jsx("div", {
403
+ ref: (node) => {
404
+ internalRef.current = node;
405
+ if (typeof ref === "function")
406
+ ref(node);
407
+ else if (ref)
408
+ ref.current = node;
409
+ },
410
+ "data-fluid-hover-index": index,
411
+ "data-value": value,
412
+ className: cn(`relative z-10 flex ${sizeClasses.control} shrink-0 items-center ${sizeClasses.gap} ${shape.item} ${sizeClasses.itemPx} ${sizeClasses.text} cursor-pointer outline-none select-none`, "transition-[color] duration-fast", isActive || isChecked ? "text-foreground" : "text-muted-foreground", disabled && "opacity-50 pointer-events-none", className),
413
+ ...props
414
+ }),
415
+ children: [
416
+ Icon && /* @__PURE__ */ jsx(Icon, {
417
+ size: sizeClasses.icon,
418
+ strokeWidth: isActive || isChecked ? 2 : 1.5,
419
+ className: "shrink-0 transition-[color,stroke-width] duration-fast"
420
+ }),
421
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, {
422
+ render: /* @__PURE__ */ jsx("span", {
423
+ className: "flex-1 min-w-0 truncate [text-box:trim-both_cap_alphabetic] py-1 -my-1"
424
+ }),
425
+ children
426
+ }),
427
+ /* @__PURE__ */ jsx("span", {
428
+ "aria-hidden": true,
429
+ className: cn("shrink-0", compact ? "w-3.5 h-3.5" : "w-4 h-4"),
430
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
431
+ children: isChecked && /* @__PURE__ */ jsx(motion.svg, {
432
+ width: sizeClasses.icon,
433
+ height: sizeClasses.icon,
434
+ viewBox: "0 0 24 24",
435
+ fill: "none",
436
+ stroke: "currentColor",
437
+ strokeWidth: 2,
438
+ strokeLinecap: "round",
439
+ strokeLinejoin: "round",
440
+ className: "text-foreground",
441
+ initial: { opacity: 1 },
442
+ animate: { opacity: 1 },
443
+ exit: { opacity: 1 },
444
+ children: /* @__PURE__ */ jsx(motion.path, {
445
+ d: "M4 12L9 17L20 6",
446
+ initial: { pathLength: skipAnimation ? 1 : 0 },
447
+ animate: {
448
+ pathLength: 1,
449
+ transition: { duration: spring.fast.duration, ease: "easeOut" }
450
+ },
451
+ exit: {
452
+ pathLength: 0,
453
+ transition: { duration: 0.04, ease: "easeIn" }
454
+ }
455
+ })
456
+ }, "check")
457
+ })
458
+ })
459
+ ]
460
+ });
461
+ });
462
+ SelectItem.displayName = "SelectItem";
463
+ function SelectGroup({ children, className, ...props }) {
464
+ return /* @__PURE__ */ jsx("div", {
465
+ role: "group",
466
+ className,
467
+ ...props,
468
+ children
469
+ });
470
+ }
471
+ SelectGroup.displayName = "SelectGroup";
472
+ var SelectLabel = forwardRef(({ className, ...props }, ref) => {
473
+ const compact = useSize().variant === "compact";
474
+ return /* @__PURE__ */ jsx("div", {
475
+ ref,
476
+ className: cn("px-2 py-1.5 shrink-0 text-muted-foreground", compact ? "text-caption-compact" : "text-caption", className),
477
+ ...props
478
+ });
479
+ });
480
+ SelectLabel.displayName = "SelectLabel";
481
+ var SelectSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
482
+ ref,
483
+ role: "separator",
484
+ className: cn("my-1 -mx-1 h-px shrink-0 bg-border/60", className),
485
+ ...props
486
+ }));
487
+ SelectSeparator.displayName = "SelectSeparator";
488
+ Select.Trigger = SelectTrigger;
489
+ Select.Content = SelectContent;
490
+ Select.Item = SelectItem;
491
+ Select.Group = SelectGroup;
492
+ Select.Label = SelectLabel;
493
+ Select.Separator = SelectSeparator;
494
+ var select_default = Select;
495
+
496
+ export { Select, triggerVariants, SelectTrigger, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, select_default };