@justanarthur/modo-ui 0.0.0-stage → 0.2.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 (171) 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 +31 -0
  10. package/dist/components/badge/index.d.ts +59 -0
  11. package/dist/components/badge/index.js +16 -0
  12. package/dist/components/button/index.d.ts +59 -0
  13. package/dist/components/button/index.js +14 -0
  14. package/dist/components/card/index.d.ts +141 -0
  15. package/dist/components/card/index.js +42 -0
  16. package/dist/components/inputs/checkbox-group/index.d.ts +50 -0
  17. package/dist/components/inputs/checkbox-group/index.js +21 -0
  18. package/dist/components/inputs/color-picker/index.d.ts +137 -0
  19. package/dist/components/inputs/color-picker/index.js +35 -0
  20. package/dist/components/inputs/combobox/index.d.ts +161 -0
  21. package/dist/components/inputs/combobox/index.js +38 -0
  22. package/dist/components/inputs/date-time/calendar/index.d.ts +45 -0
  23. package/dist/components/inputs/date-time/calendar/index.js +18 -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 +32 -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 +31 -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 +31 -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 +30 -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 +31 -0
  34. package/dist/components/inputs/input/index.d.ts +84 -0
  35. package/dist/components/inputs/input/index.js +19 -0
  36. package/dist/components/inputs/input-copy/index.d.ts +44 -0
  37. package/dist/components/inputs/input-copy/index.js +16 -0
  38. package/dist/components/inputs/input-message/index.d.ts +125 -0
  39. package/dist/components/inputs/input-message/index.js +25 -0
  40. package/dist/components/inputs/radio-group/index.d.ts +58 -0
  41. package/dist/components/inputs/radio-group/index.js +20 -0
  42. package/dist/components/inputs/search/index.d.ts +83 -0
  43. package/dist/components/inputs/search/index.js +25 -0
  44. package/dist/components/inputs/select/index.d.ts +105 -0
  45. package/dist/components/inputs/select/index.js +34 -0
  46. package/dist/components/inputs/slider/index.d.ts +108 -0
  47. package/dist/components/inputs/slider/index.js +14 -0
  48. package/dist/components/inputs/switch/index.d.ts +43 -0
  49. package/dist/components/inputs/switch/index.js +14 -0
  50. package/dist/components/navigation/accordion/index.d.ts +117 -0
  51. package/dist/components/navigation/accordion/index.js +28 -0
  52. package/dist/components/navigation/sidebar/index.d.ts +388 -0
  53. package/dist/components/navigation/sidebar/index.js +99 -0
  54. package/dist/components/navigation/tabs/index.d.ts +70 -0
  55. package/dist/components/navigation/tabs/index.js +23 -0
  56. package/dist/components/navigation/tabs-subtle/index.d.ts +73 -0
  57. package/dist/components/navigation/tabs-subtle/index.js +21 -0
  58. package/dist/components/overlays/alert-dialog/index.d.ts +67 -0
  59. package/dist/components/overlays/alert-dialog/index.js +22 -0
  60. package/dist/components/overlays/command/index.d.ts +121 -0
  61. package/dist/components/overlays/command/index.js +36 -0
  62. package/dist/components/overlays/context-menu/index.d.ts +97 -0
  63. package/dist/components/overlays/context-menu/index.js +29 -0
  64. package/dist/components/overlays/dialog/index.d.ts +130 -0
  65. package/dist/components/overlays/dialog/index.js +37 -0
  66. package/dist/components/overlays/dropdown/index.d.ts +222 -0
  67. package/dist/components/overlays/dropdown/index.js +44 -0
  68. package/dist/components/overlays/popover/index.d.ts +87 -0
  69. package/dist/components/overlays/popover/index.js +26 -0
  70. package/dist/components/overlays/preview-card/index.d.ts +75 -0
  71. package/dist/components/overlays/preview-card/index.js +19 -0
  72. package/dist/components/overlays/sheet/index.d.ts +67 -0
  73. package/dist/components/overlays/sheet/index.js +24 -0
  74. package/dist/components/overlays/toast/index.d.ts +107 -0
  75. package/dist/components/overlays/toast/index.js +21 -0
  76. package/dist/components/overlays/tooltip/index.d.ts +75 -0
  77. package/dist/components/overlays/tooltip/index.js +17 -0
  78. package/dist/components/table/index.d.ts +44 -0
  79. package/dist/components/table/index.js +26 -0
  80. package/dist/components/thinking-indicator/index.d.ts +32 -0
  81. package/dist/components/thinking-indicator/index.js +13 -0
  82. package/dist/index.d.ts +3926 -0
  83. package/dist/index.js +511 -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 +11 -0
  88. package/dist/primitives/craft/index.d.ts +31 -0
  89. package/dist/primitives/craft/index.js +11 -0
  90. package/dist/primitives/fluid-hover/index.d.ts +233 -0
  91. package/dist/primitives/fluid-hover/index.js +25 -0
  92. package/dist/primitives/morph/index.d.ts +127 -0
  93. package/dist/primitives/morph/index.js +19 -0
  94. package/dist/primitives/motion/index.d.ts +115 -0
  95. package/dist/primitives/motion/index.js +19 -0
  96. package/dist/primitives/scroll-area/index.d.ts +41 -0
  97. package/dist/primitives/scroll-area/index.js +12 -0
  98. package/dist/primitives/sizes/index.d.ts +128 -0
  99. package/dist/primitives/sizes/index.js +21 -0
  100. package/dist/primitives/surface/index.d.ts +69 -0
  101. package/dist/primitives/surface/index.js +17 -0
  102. package/dist/shared/components-0ke6xada.js +123 -0
  103. package/dist/shared/components-0q0sqfh4.js +146 -0
  104. package/dist/shared/components-0sn7ypjw.js +61 -0
  105. package/dist/shared/components-1j9791sn.js +345 -0
  106. package/dist/shared/components-1rfwbyyc.js +361 -0
  107. package/dist/shared/components-1v7rxytx.js +30 -0
  108. package/dist/shared/components-1xekx2hx.js +215 -0
  109. package/dist/shared/components-39jq9va1.js +86 -0
  110. package/dist/shared/components-3gae8nta.js +719 -0
  111. package/dist/shared/components-3k8xpnpq.js +1759 -0
  112. package/dist/shared/components-3ky44908.js +9 -0
  113. package/dist/shared/components-3mkepka5.js +111 -0
  114. package/dist/shared/components-3wk0w46f.js +667 -0
  115. package/dist/shared/components-4cnjmgex.js +124 -0
  116. package/dist/shared/components-59efxjd9.js +298 -0
  117. package/dist/shared/components-5xc2j8jz.js +159 -0
  118. package/dist/shared/components-62ybc7t2.js +496 -0
  119. package/dist/shared/components-66mv71kx.js +262 -0
  120. package/dist/shared/components-7ans7ce5.js +120 -0
  121. package/dist/shared/components-7btqt08d.js +270 -0
  122. package/dist/shared/components-7r3etddy.js +171 -0
  123. package/dist/shared/components-7x9kawxv.js +152 -0
  124. package/dist/shared/components-8fpr3s4p.js +292 -0
  125. package/dist/shared/components-9jvzzvt1.js +198 -0
  126. package/dist/shared/components-apdwtweq.js +484 -0
  127. package/dist/shared/components-asr5pg50.js +191 -0
  128. package/dist/shared/components-b2wyq2cq.js +232 -0
  129. package/dist/shared/components-c6s6b43g.js +15 -0
  130. package/dist/shared/components-ca2c898n.js +1828 -0
  131. package/dist/shared/components-cbxjn9p8.js +141 -0
  132. package/dist/shared/components-chacnk61.js +216 -0
  133. package/dist/shared/components-cv16mryv.js +62 -0
  134. package/dist/shared/components-ez65vtbq.js +110 -0
  135. package/dist/shared/components-ezxhrmer.js +17 -0
  136. package/dist/shared/components-gc5vtq2f.js +149 -0
  137. package/dist/shared/components-gf5s6ap9.js +42 -0
  138. package/dist/shared/components-gvr9w41t.js +193 -0
  139. package/dist/shared/components-h2dpcwgc.js +137 -0
  140. package/dist/shared/components-hawvy2qz.js +105 -0
  141. package/dist/shared/components-hqeq3w9q.js +375 -0
  142. package/dist/shared/components-jjw69c4c.js +28 -0
  143. package/dist/shared/components-jwst3vtj.js +346 -0
  144. package/dist/shared/components-kvr7f9hy.js +45 -0
  145. package/dist/shared/components-men63rwj.js +9 -0
  146. package/dist/shared/components-mhd39z7x.js +22 -0
  147. package/dist/shared/components-n7mjr357.js +26 -0
  148. package/dist/shared/components-ng72k97e.js +128 -0
  149. package/dist/shared/components-nh8tma1n.js +986 -0
  150. package/dist/shared/components-njzgqdwy.js +445 -0
  151. package/dist/shared/components-ny774h8p.js +293 -0
  152. package/dist/shared/components-q4daerx0.js +58 -0
  153. package/dist/shared/components-q5xj5c16.js +79 -0
  154. package/dist/shared/components-rr7a6ja9.js +160 -0
  155. package/dist/shared/components-s2bz1xpk.js +63 -0
  156. package/dist/shared/components-tqvarbfv.js +288 -0
  157. package/dist/shared/components-v6xp325t.js +304 -0
  158. package/dist/shared/components-v7wtz8hk.js +144 -0
  159. package/dist/shared/components-vc7vq5nz.js +32 -0
  160. package/dist/shared/components-vfbhxf5r.js +58 -0
  161. package/dist/shared/components-vynjtrk6.js +19 -0
  162. package/dist/shared/components-wvp1m52g.js +1200 -0
  163. package/dist/shared/components-yh3kwdhr.js +981 -0
  164. package/dist/shared/components-ytb2tefr.js +291 -0
  165. package/dist/shared/components-zfnmn5d4.js +220 -0
  166. package/dist/shared/components-zrkzcayz.js +141 -0
  167. package/dist/shared/components-zx6b6yby.js +42 -0
  168. package/dist/styles.css +1949 -0
  169. package/dist/tailwind.css +219 -0
  170. package/dist/tokens.css +345 -0
  171. package/package.json +103 -4
@@ -0,0 +1,291 @@
1
+ import {
2
+ cn2
3
+ } from "./components-ezxhrmer.js";
4
+ import {
5
+ FluidHoverHighlight2
6
+ } from "./components-kvr7f9hy.js";
7
+ import {
8
+ useShape
9
+ } from "./components-cv16mryv.js";
10
+ import {
11
+ useSize2
12
+ } from "./components-0sn7ypjw.js";
13
+ import {
14
+ useControllableState
15
+ } from "./components-n7mjr357.js";
16
+ import {
17
+ useFluidHover2,
18
+ useRegisterFluidHoverItem2
19
+ } from "./components-59efxjd9.js";
20
+ import {
21
+ useSelectionRuns,
22
+ useMergeSplitBlocks,
23
+ SelectionBackgrounds
24
+ } from "./components-5xc2j8jz.js";
25
+ import {
26
+ SizeProvider2
27
+ } from "./components-jjw69c4c.js";
28
+ import {
29
+ spring2
30
+ } from "./components-1v7rxytx.js";
31
+
32
+ // components/inputs/checkbox-group/index.tsx
33
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
34
+ import { AnimatePresence, motion } from "motion/react";
35
+ import {
36
+ createContext,
37
+ forwardRef,
38
+ useCallback,
39
+ useContext,
40
+ useEffect,
41
+ useRef,
42
+ useState
43
+ } from "react";
44
+ import { jsx, jsxs } from "react/jsx-runtime";
45
+ var CheckboxGroupContext = createContext(null);
46
+ function useCheckboxGroup() {
47
+ const ctx = useContext(CheckboxGroupContext);
48
+ if (!ctx)
49
+ throw new Error("useCheckboxGroup must be used within a CheckboxGroup");
50
+ return ctx;
51
+ }
52
+ var CheckboxGroup2 = forwardRef(({
53
+ children,
54
+ checkedIndices: checkedIndicesProp,
55
+ defaultCheckedIndices,
56
+ onCheckedIndicesChange,
57
+ size,
58
+ className,
59
+ ...props
60
+ }, ref) => {
61
+ const containerRef = useRef(null);
62
+ const [checkedIndices, setCheckedIndices] = useControllableState(checkedIndicesProp, new Set(defaultCheckedIndices), onCheckedIndicesChange);
63
+ const setItemChecked = useCallback((index, checked) => {
64
+ setCheckedIndices((prev) => {
65
+ if (prev.has(index) === checked)
66
+ return prev;
67
+ const next = new Set(prev);
68
+ if (checked)
69
+ next.add(index);
70
+ else
71
+ next.delete(index);
72
+ return next;
73
+ });
74
+ }, [setCheckedIndices]);
75
+ const hover = useFluidHover2(containerRef);
76
+ const { activeIndex, setActiveIndex, itemRects, handlers, registerItem } = hover;
77
+ const checkedGroups = useSelectionRuns([...checkedIndices]);
78
+ const [focusedIndex, setFocusedIndex] = useState(null);
79
+ const focusRect = focusedIndex !== null ? itemRects[focusedIndex] : null;
80
+ const shape = useShape();
81
+ const blocks = useMergeSplitBlocks(checkedGroups, itemRects, shape.mergedRadius);
82
+ const group = /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, {
83
+ value: { registerItem, activeIndex, checkedIndices, setItemChecked },
84
+ children: /* @__PURE__ */ jsxs("div", {
85
+ ref: (node) => {
86
+ containerRef.current = node;
87
+ if (typeof ref === "function")
88
+ ref(node);
89
+ else if (ref)
90
+ ref.current = node;
91
+ },
92
+ onMouseEnter: handlers.onMouseEnter,
93
+ onMouseMove: handlers.onMouseMove,
94
+ onMouseLeave: handlers.onMouseLeave,
95
+ onClick: handlers.onClick,
96
+ onFocus: (e) => {
97
+ const indexAttr = e.target.closest("[data-fluid-hover-index]")?.getAttribute("data-fluid-hover-index");
98
+ if (indexAttr != null) {
99
+ const idx = Number(indexAttr);
100
+ setActiveIndex(idx);
101
+ setFocusedIndex(e.target.matches(":focus-visible") ? idx : null);
102
+ }
103
+ },
104
+ onBlur: (e) => {
105
+ if (containerRef.current?.contains(e.relatedTarget))
106
+ return;
107
+ setFocusedIndex(null);
108
+ setActiveIndex(null);
109
+ },
110
+ onKeyDown: (e) => {
111
+ const items = Array.from(containerRef.current?.querySelectorAll("[data-fluid-hover-index]") ?? []);
112
+ const currentIdx = items.indexOf(e.target);
113
+ if (currentIdx === -1)
114
+ return;
115
+ if (["ArrowDown", "ArrowUp"].includes(e.key)) {
116
+ e.preventDefault();
117
+ const next = e.key === "ArrowDown" ? (currentIdx + 1) % items.length : (currentIdx - 1 + items.length) % items.length;
118
+ items[next]?.focus();
119
+ } else if (e.key === "Home") {
120
+ e.preventDefault();
121
+ items[0]?.focus();
122
+ } else if (e.key === "End") {
123
+ e.preventDefault();
124
+ items[items.length - 1]?.focus();
125
+ }
126
+ },
127
+ role: "group",
128
+ className: cn2("relative flex flex-col w-72 max-w-full select-none", className),
129
+ ...props,
130
+ children: [
131
+ /* @__PURE__ */ jsx(SelectionBackgrounds, {
132
+ blocks
133
+ }),
134
+ /* @__PURE__ */ jsx(FluidHoverHighlight2, {
135
+ hover,
136
+ className: shape.bg
137
+ }),
138
+ /* @__PURE__ */ jsx(AnimatePresence, {
139
+ children: focusRect && /* @__PURE__ */ jsx(motion.div, {
140
+ className: `absolute ${shape.focusRing} pointer-events-none z-20 border border-focus-ring`,
141
+ initial: false,
142
+ animate: {
143
+ left: focusRect.left - 2,
144
+ top: focusRect.top - 2,
145
+ width: focusRect.width + 4,
146
+ height: focusRect.height + 4
147
+ },
148
+ exit: { opacity: 0, transition: spring2.fast.exit },
149
+ transition: {
150
+ ...spring2.fast,
151
+ opacity: { duration: spring2.fast.duration }
152
+ }
153
+ })
154
+ }),
155
+ children
156
+ ]
157
+ })
158
+ });
159
+ return size ? /* @__PURE__ */ jsx(SizeProvider2, {
160
+ size,
161
+ children: group
162
+ }) : group;
163
+ });
164
+ CheckboxGroup2.displayName = "CheckboxGroup";
165
+ var CheckboxItem2 = forwardRef(({ label, index, checked: checkedProp, onToggle: onToggleProp, className, ...props }, ref) => {
166
+ const internalRef = useRef(null);
167
+ const hasMounted = useRef(false);
168
+ const { registerItem, activeIndex, checkedIndices, setItemChecked } = useCheckboxGroup();
169
+ const checked = checkedProp ?? checkedIndices.has(index);
170
+ const onToggle = () => {
171
+ onToggleProp?.();
172
+ setItemChecked(index, !checked);
173
+ };
174
+ useRegisterFluidHoverItem2(registerItem, index, internalRef);
175
+ useEffect(() => {
176
+ hasMounted.current = true;
177
+ }, []);
178
+ const isActive = activeIndex === index;
179
+ const skipAnimation = !hasMounted.current;
180
+ const shape = useShape();
181
+ const sizeClasses = useSize2();
182
+ const compact = sizeClasses.variant === "compact";
183
+ return /* @__PURE__ */ jsxs("div", {
184
+ ref: (node) => {
185
+ internalRef.current = node;
186
+ if (typeof ref === "function")
187
+ ref(node);
188
+ else if (ref)
189
+ ref.current = node;
190
+ },
191
+ "data-fluid-hover-index": index,
192
+ tabIndex: 0,
193
+ role: "checkbox",
194
+ "aria-checked": checked,
195
+ "aria-label": label,
196
+ onClick: onToggle,
197
+ onMouseDown: (e) => {
198
+ const interactive = e.target.closest('button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
199
+ if (interactive && interactive !== e.currentTarget)
200
+ return;
201
+ e.preventDefault();
202
+ e.currentTarget.focus();
203
+ },
204
+ onKeyDown: (e) => {
205
+ if (e.key === " " || e.key === "Enter") {
206
+ e.preventDefault();
207
+ onToggle();
208
+ }
209
+ },
210
+ className: cn2(`relative z-10 flex ${sizeClasses.control} items-center ${sizeClasses.gap} ${shape.item} ${sizeClasses.px} cursor-pointer outline-none`, className),
211
+ ...props,
212
+ children: [
213
+ /* @__PURE__ */ jsxs(CheckboxPrimitive.Root, {
214
+ checked,
215
+ onCheckedChange: () => onToggle(),
216
+ tabIndex: -1,
217
+ "aria-hidden": true,
218
+ className: cn2("relative shrink-0 appearance-none bg-transparent p-0 border-0 outline-none cursor-pointer", compact ? "w-[14px] h-[14px]" : "w-[16px] h-[16px]"),
219
+ onClick: (e) => e.stopPropagation(),
220
+ children: [
221
+ /* @__PURE__ */ jsx("div", {
222
+ className: cn2("absolute inset-0 border-solid transition-all duration-fast", compact ? "rounded-sm" : "rounded-box", checked ? "border-[1.5px] border-transparent" : isActive ? "border-[1.5px] border-control" : "border-[1.5px] border-border")
223
+ }),
224
+ /* @__PURE__ */ jsx(AnimatePresence, {
225
+ children: checked && /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
226
+ keepMounted: true,
227
+ render: (indicatorProps) => {
228
+ const {
229
+ style: _s,
230
+ onDrag: _onDrag,
231
+ onDragStart: _onDragStart,
232
+ onDragEnd: _onDragEnd,
233
+ onAnimationStart: _onAnimationStart,
234
+ onAnimationEnd: _onAnimationEnd,
235
+ onAnimationIteration: _onAnimationIteration,
236
+ ...rest
237
+ } = indicatorProps;
238
+ return /* @__PURE__ */ jsx(motion.svg, {
239
+ ...rest,
240
+ width: compact ? 16 : 18,
241
+ height: compact ? 16 : 18,
242
+ viewBox: "0 0 24 24",
243
+ fill: "none",
244
+ stroke: "currentColor",
245
+ strokeWidth: 2,
246
+ strokeLinecap: "round",
247
+ strokeLinejoin: "round",
248
+ className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-foreground",
249
+ initial: { opacity: 1 },
250
+ animate: { opacity: 1 },
251
+ exit: { opacity: 1 },
252
+ children: /* @__PURE__ */ jsx(motion.path, {
253
+ d: "M6 12L10 16L18 8",
254
+ initial: { pathLength: skipAnimation ? 1 : 0 },
255
+ animate: {
256
+ pathLength: 1,
257
+ transition: { duration: spring2.fast.duration, ease: "easeOut" }
258
+ },
259
+ exit: {
260
+ pathLength: 0,
261
+ transition: { duration: 0.04, ease: "easeIn" }
262
+ }
263
+ })
264
+ });
265
+ }
266
+ })
267
+ })
268
+ ]
269
+ }),
270
+ /* @__PURE__ */ jsxs("span", {
271
+ className: cn2("inline-grid", sizeClasses.text),
272
+ children: [
273
+ /* @__PURE__ */ jsx("span", {
274
+ className: "col-start-1 row-start-1 invisible [text-box:trim-both_cap_alphabetic] weight-semibold",
275
+ "aria-hidden": "true",
276
+ children: label
277
+ }),
278
+ /* @__PURE__ */ jsx("span", {
279
+ className: cn2("col-start-1 row-start-1 transition-[color,font-variation-settings] duration-fast [text-box:trim-both_cap_alphabetic]", checked || isActive ? "text-foreground" : "text-muted-foreground", checked ? "weight-semibold" : "weight-normal"),
280
+ children: label
281
+ })
282
+ ]
283
+ })
284
+ ]
285
+ });
286
+ });
287
+ CheckboxItem2.displayName = "CheckboxItem";
288
+ Object.assign(CheckboxGroup2, { Item: CheckboxItem2 });
289
+ var checkbox_group_default = CheckboxGroup2;
290
+
291
+ export { CheckboxGroup2, CheckboxItem2, checkbox_group_default };
@@ -0,0 +1,220 @@
1
+ import {
2
+ useIcon
3
+ } from "./components-zrkzcayz.js";
4
+ import {
5
+ MorphPartScope,
6
+ MorphSurface
7
+ } from "./components-0q0sqfh4.js";
8
+ import {
9
+ useMorphOrigin,
10
+ useMorph
11
+ } from "./components-hqeq3w9q.js";
12
+ import {
13
+ cn2
14
+ } from "./components-ezxhrmer.js";
15
+ import {
16
+ useShape
17
+ } from "./components-cv16mryv.js";
18
+ import {
19
+ useSizeVariant2,
20
+ useSize2
21
+ } from "./components-0sn7ypjw.js";
22
+ import {
23
+ slotRender
24
+ } from "./components-3ky44908.js";
25
+ import {
26
+ SURFACE_BG,
27
+ SURFACE_SHADOW,
28
+ useSurface2,
29
+ SurfaceProvider2
30
+ } from "./components-zx6b6yby.js";
31
+ import {
32
+ useControllableState
33
+ } from "./components-n7mjr357.js";
34
+ import {
35
+ Button2
36
+ } from "./components-b2wyq2cq.js";
37
+
38
+ // components/overlays/dialog/index.tsx
39
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
40
+ import { motion } from "motion/react";
41
+ import {
42
+ createContext,
43
+ forwardRef,
44
+ useContext,
45
+ useId,
46
+ useImperativeHandle,
47
+ useMemo
48
+ } from "react";
49
+ import { jsx, jsxs } from "react/jsx-runtime";
50
+ var DIALOG_OFFSET = 4;
51
+ var DialogContext = createContext({
52
+ open: false,
53
+ origin: { current: {} }
54
+ });
55
+ var useDialogState2 = () => useContext(DialogContext);
56
+ var DialogTrigger2 = forwardRef(({ render, asChild, children, ...props }, ref) => {
57
+ const el = slotRender(render, asChild, children);
58
+ return el ? /* @__PURE__ */ jsx(DialogPrimitive.Trigger, {
59
+ ref,
60
+ render: el,
61
+ ...props
62
+ }) : /* @__PURE__ */ jsx(DialogPrimitive.Trigger, {
63
+ ref,
64
+ ...props,
65
+ children
66
+ });
67
+ });
68
+ DialogTrigger2.displayName = "DialogTrigger";
69
+ var DialogClose2 = forwardRef(({ render, asChild, children, ...props }, ref) => {
70
+ const el = slotRender(render, asChild, children);
71
+ return el ? /* @__PURE__ */ jsx(DialogPrimitive.Close, {
72
+ ref,
73
+ render: el,
74
+ ...props
75
+ }) : /* @__PURE__ */ jsx(DialogPrimitive.Close, {
76
+ ref,
77
+ ...props,
78
+ children
79
+ });
80
+ });
81
+ DialogClose2.displayName = "DialogClose";
82
+ var DialogContent2 = forwardRef(({
83
+ className,
84
+ children,
85
+ size = "sm",
86
+ container,
87
+ showCloseButton = true,
88
+ position = "center",
89
+ from,
90
+ effect,
91
+ hideSource,
92
+ tier,
93
+ ...props
94
+ }, ref) => {
95
+ const XIcon = useIcon("x");
96
+ const shape = useShape();
97
+ const substrate = useSurface2();
98
+ const dialogLevel = Math.min(substrate + DIALOG_OFFSET, 8);
99
+ const compact = useSize2().variant === "compact";
100
+ const { open, origin } = useDialogState2();
101
+ const morph = useMorph(open, origin, { from, effect, hideSource, tier });
102
+ useImperativeHandle(ref, () => morph.popup, [morph.popup]);
103
+ return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, {
104
+ container: container ?? undefined,
105
+ children: [
106
+ /* @__PURE__ */ jsx(DialogPrimitive.Backdrop, {
107
+ render: /* @__PURE__ */ jsx(motion.div, {
108
+ style: { opacity: morph.progress }
109
+ }),
110
+ className: cn2(container ? "absolute" : "fixed", "inset-0 z-50 bg-scrim")
111
+ }),
112
+ /* @__PURE__ */ jsx(DialogPrimitive.Popup, {
113
+ ref: morph.popupRef,
114
+ ...props,
115
+ className: cn2(container ? "absolute" : "fixed", "left-1/2 z-50 w-[calc(100%-2rem)] -translate-x-1/2 focus:outline-none", position === "top" ? "top-[12dvh]" : "top-1/2 -translate-y-1/2", size === "sm" && (compact ? "max-w-[360px]" : "max-w-[400px]"), size === "lg" && (compact ? "max-w-[480px]" : "max-w-[540px]"), size === "xl" && (compact ? "max-w-[800px]" : "max-w-[880px]")),
116
+ children: /* @__PURE__ */ jsx(SurfaceProvider2, {
117
+ value: dialogLevel,
118
+ children: /* @__PURE__ */ jsxs(MorphSurface, {
119
+ morph,
120
+ bg: SURFACE_BG[dialogLevel],
121
+ shadow: SURFACE_SHADOW[dialogLevel],
122
+ radius: shape.container,
123
+ className: cn2("p-6", className),
124
+ children: [
125
+ children,
126
+ showCloseButton && /* @__PURE__ */ jsx(DialogPrimitive.Close, {
127
+ render: /* @__PURE__ */ jsxs(Button2, {
128
+ variant: "ghost",
129
+ size: "icon-sm",
130
+ className: "absolute right-3 top-3",
131
+ children: [
132
+ /* @__PURE__ */ jsx(XIcon, {}),
133
+ /* @__PURE__ */ jsx("span", {
134
+ className: "sr-only",
135
+ children: "Close"
136
+ })
137
+ ]
138
+ })
139
+ })
140
+ ]
141
+ })
142
+ })
143
+ })
144
+ ]
145
+ });
146
+ });
147
+ DialogContent2.displayName = "DialogContent";
148
+ function DialogHeader2({ className, ...props }) {
149
+ return /* @__PURE__ */ jsx("div", {
150
+ className: cn2("flex flex-col gap-1.5 mb-4", className),
151
+ ...props
152
+ });
153
+ }
154
+ function DialogFooter2({ className, ...props }) {
155
+ return /* @__PURE__ */ jsx("div", {
156
+ className: cn2("flex justify-end gap-2 mt-6", className),
157
+ ...props
158
+ });
159
+ }
160
+ var DialogTitle2 = forwardRef(({ className, ...props }, ref) => {
161
+ const compact = useSizeVariant2() === "compact";
162
+ return /* @__PURE__ */ jsx(DialogPrimitive.Title, {
163
+ ref,
164
+ className: cn2(compact ? "text-title-compact" : "text-title", "weight-bold text-foreground leading-tight", className),
165
+ ...props
166
+ });
167
+ });
168
+ DialogTitle2.displayName = "DialogTitle";
169
+ var DialogDescription2 = forwardRef(({ className, ...props }, ref) => {
170
+ const compact = useSizeVariant2() === "compact";
171
+ return /* @__PURE__ */ jsx(DialogPrimitive.Description, {
172
+ ref,
173
+ className: cn2(compact ? "text-body-compact" : "text-body", "text-muted-foreground", className),
174
+ ...props
175
+ });
176
+ });
177
+ DialogDescription2.displayName = "DialogDescription";
178
+ function DialogState2({ open, defaultOpen = false, onOpenChange, children }) {
179
+ const [current, setCurrent] = useControllableState(open, defaultOpen, onOpenChange);
180
+ const { origin, capture } = useMorphOrigin();
181
+ const id = useId();
182
+ const ctx = useMemo(() => ({ open: current, origin }), [current, origin]);
183
+ const parts = useMemo(() => ({ id, open: current }), [id, current]);
184
+ return /* @__PURE__ */ jsx(DialogContext.Provider, {
185
+ value: ctx,
186
+ children: /* @__PURE__ */ jsx(MorphPartScope.Provider, {
187
+ value: parts,
188
+ children: children({
189
+ open: current,
190
+ onOpenChange: (next, details) => {
191
+ if (next)
192
+ capture(details);
193
+ setCurrent(next);
194
+ }
195
+ })
196
+ })
197
+ });
198
+ }
199
+ function Dialog2({ children, open, defaultOpen, onOpenChange, modal }) {
200
+ return /* @__PURE__ */ jsx(DialogState2, {
201
+ open,
202
+ defaultOpen,
203
+ onOpenChange,
204
+ children: (root) => /* @__PURE__ */ jsx(DialogPrimitive.Root, {
205
+ ...root,
206
+ modal,
207
+ children
208
+ })
209
+ });
210
+ }
211
+ Dialog2.Trigger = DialogTrigger2;
212
+ Dialog2.Content = DialogContent2;
213
+ Dialog2.Header = DialogHeader2;
214
+ Dialog2.Footer = DialogFooter2;
215
+ Dialog2.Title = DialogTitle2;
216
+ Dialog2.Description = DialogDescription2;
217
+ Dialog2.Close = DialogClose2;
218
+ var dialog_default = Dialog2;
219
+
220
+ export { useDialogState2, DialogTrigger2, DialogClose2, DialogContent2, DialogHeader2, DialogFooter2, DialogTitle2, DialogDescription2, DialogState2, Dialog2, dialog_default };
@@ -0,0 +1,141 @@
1
+ // lib/icon-context.tsx
2
+ import {
3
+ ArrowDown,
4
+ ArrowLeft,
5
+ ArrowRight,
6
+ ArrowUp,
7
+ Bell,
8
+ Brain,
9
+ Calendar,
10
+ Check,
11
+ ChevronDown,
12
+ ChevronRight,
13
+ ChevronsUpDown,
14
+ Circle,
15
+ Clock,
16
+ Copy,
17
+ CornerDownLeft,
18
+ CornerDownRight,
19
+ Dot,
20
+ Ellipsis,
21
+ EllipsisVertical,
22
+ Folder,
23
+ Globe,
24
+ Heart,
25
+ Home,
26
+ ImageIcon,
27
+ Inbox,
28
+ Lightbulb,
29
+ Link,
30
+ Loader,
31
+ Lock,
32
+ Mail,
33
+ Menu,
34
+ MessageCircle,
35
+ Monitor,
36
+ Moon,
37
+ Paintbrush,
38
+ Palette,
39
+ PanelLeft,
40
+ PanelLeftDashed,
41
+ PanelRight,
42
+ PanelRightDashed,
43
+ Pause,
44
+ Pencil,
45
+ Pipette,
46
+ Play,
47
+ Plus,
48
+ RectangleHorizontal,
49
+ Rocket,
50
+ RotateCcw,
51
+ Scaling,
52
+ Search,
53
+ Settings,
54
+ Shield,
55
+ SkipForward,
56
+ SlidersHorizontal,
57
+ SquareLibrary,
58
+ Star,
59
+ Sun,
60
+ User,
61
+ Users,
62
+ X
63
+ } from "lucide-react";
64
+ import { createContext, useContext, useMemo } from "react";
65
+ import { jsx } from "react/jsx-runtime";
66
+ var defaultIcons = {
67
+ "chevron-right": ChevronRight,
68
+ "chevron-down": ChevronDown,
69
+ pipette: Pipette,
70
+ x: X,
71
+ copy: Copy,
72
+ menu: Menu,
73
+ dot: Dot,
74
+ monitor: Monitor,
75
+ sun: Sun,
76
+ moon: Moon,
77
+ "rectangle-horizontal": RectangleHorizontal,
78
+ circle: Circle,
79
+ "square-library": SquareLibrary,
80
+ clock: Clock,
81
+ star: Star,
82
+ settings: Settings,
83
+ plus: Plus,
84
+ "arrow-left": ArrowLeft,
85
+ "arrow-right": ArrowRight,
86
+ "arrow-up": ArrowUp,
87
+ "arrow-down": ArrowDown,
88
+ search: Search,
89
+ loader: Loader,
90
+ users: Users,
91
+ lock: Lock,
92
+ mail: Mail,
93
+ bell: Bell,
94
+ shield: Shield,
95
+ palette: Palette,
96
+ lightbulb: Lightbulb,
97
+ rocket: Rocket,
98
+ heart: Heart,
99
+ paintbrush: Paintbrush,
100
+ brain: Brain,
101
+ globe: Globe,
102
+ user: User,
103
+ image: ImageIcon,
104
+ link: Link,
105
+ check: Check,
106
+ "rotate-ccw": RotateCcw,
107
+ play: Play,
108
+ pause: Pause,
109
+ home: Home,
110
+ "message-circle": MessageCircle,
111
+ inbox: Inbox,
112
+ pencil: Pencil,
113
+ scaling: Scaling,
114
+ "skip-forward": SkipForward,
115
+ "corner-down-right": CornerDownRight,
116
+ "corner-down-left": CornerDownLeft,
117
+ "panel-left": PanelLeft,
118
+ "panel-left-dashed": PanelLeftDashed,
119
+ "panel-right": PanelRight,
120
+ "panel-right-dashed": PanelRightDashed,
121
+ "chevrons-up-down": ChevronsUpDown,
122
+ "more-horizontal": Ellipsis,
123
+ "more-vertical": EllipsisVertical,
124
+ calendar: Calendar,
125
+ folder: Folder,
126
+ "sliders-horizontal": SlidersHorizontal
127
+ };
128
+ var IconContext = createContext(null);
129
+ function useIcon(name) {
130
+ const icons = useContext(IconContext);
131
+ return (icons ?? defaultIcons)[name];
132
+ }
133
+ function IconProvider2({ children, icons }) {
134
+ const value = useMemo(() => ({ ...defaultIcons, ...icons }), [icons]);
135
+ return /* @__PURE__ */ jsx(IconContext.Provider, {
136
+ value,
137
+ children
138
+ });
139
+ }
140
+
141
+ export { useIcon, IconProvider2 };
@@ -0,0 +1,42 @@
1
+ // lib/surface-classes.ts
2
+ var SURFACE_BG = {
3
+ 1: "bg-surface-1",
4
+ 2: "bg-surface-2",
5
+ 3: "bg-surface-3",
6
+ 4: "bg-surface-4",
7
+ 5: "bg-surface-5",
8
+ 6: "bg-surface-6",
9
+ 7: "bg-surface-7",
10
+ 8: "bg-surface-8"
11
+ };
12
+ var SURFACE_SHADOW = {
13
+ 1: "shadow-surface-1",
14
+ 2: "shadow-surface-2",
15
+ 3: "shadow-surface-3",
16
+ 4: "shadow-surface-4",
17
+ 5: "shadow-surface-5",
18
+ 6: "shadow-surface-6",
19
+ 7: "shadow-surface-7",
20
+ 8: "shadow-surface-8"
21
+ };
22
+ function surfaceClasses2(bgLevel, shadowLevel = bgLevel) {
23
+ const bg = Math.round(Math.max(1, Math.min(8, bgLevel)));
24
+ const shadow = Math.round(Math.max(1, Math.min(8, shadowLevel)));
25
+ return `${SURFACE_BG[bg]} ${SURFACE_SHADOW[shadow]}`;
26
+ }
27
+
28
+ // lib/surface-context.tsx
29
+ import { createContext, useContext } from "react";
30
+ import { jsx } from "react/jsx-runtime";
31
+ var SurfaceContext = createContext(1);
32
+ function useSurface2() {
33
+ return useContext(SurfaceContext);
34
+ }
35
+ function SurfaceProvider2({ value, children }) {
36
+ return /* @__PURE__ */ jsx(SurfaceContext.Provider, {
37
+ value: Math.max(1, Math.min(8, value)),
38
+ children
39
+ });
40
+ }
41
+
42
+ export { SURFACE_BG, SURFACE_SHADOW, surfaceClasses2, useSurface2, SurfaceProvider2 };