@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,293 @@
1
+ import {
2
+ cn2
3
+ } from "./components-ezxhrmer.js";
4
+ import {
5
+ GooIndicator
6
+ } from "./components-chacnk61.js";
7
+ import {
8
+ FluidHoverHighlight2
9
+ } from "./components-kvr7f9hy.js";
10
+ import {
11
+ useShape
12
+ } from "./components-cv16mryv.js";
13
+ import {
14
+ useSize2
15
+ } from "./components-0sn7ypjw.js";
16
+ import {
17
+ useControllableState
18
+ } from "./components-n7mjr357.js";
19
+ import {
20
+ useFluidHover2,
21
+ useRegisterFluidHoverItem2
22
+ } from "./components-59efxjd9.js";
23
+ import {
24
+ SizeProvider2
25
+ } from "./components-jjw69c4c.js";
26
+ import {
27
+ spring2
28
+ } from "./components-1v7rxytx.js";
29
+
30
+ // components/inputs/radio-group/index.tsx
31
+ import { Radio as RadioPrimitive } from "@base-ui/react/radio";
32
+ import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
33
+ import { AnimatePresence, motion } from "motion/react";
34
+ import {
35
+ Children,
36
+ createContext,
37
+ forwardRef,
38
+ isValidElement,
39
+ useContext,
40
+ useEffect,
41
+ useRef,
42
+ useState
43
+ } from "react";
44
+ import { jsx, jsxs } from "react/jsx-runtime";
45
+ var RadioGroupContext = createContext(null);
46
+ function useRadioGroupContext() {
47
+ const ctx = useContext(RadioGroupContext);
48
+ if (!ctx)
49
+ throw new Error("useRadioGroup must be used within a RadioGroup");
50
+ return ctx;
51
+ }
52
+ var RadioGroup2 = forwardRef(({
53
+ children,
54
+ selectedIndex: selectedIndexProp,
55
+ defaultSelectedIndex,
56
+ onSelectedIndexChange,
57
+ value: valueProp,
58
+ defaultValue,
59
+ onValueChange: onValueChangeProp,
60
+ size,
61
+ className,
62
+ ...props
63
+ }, ref) => {
64
+ const [selectedIndex, selectIndex] = useControllableState(selectedIndexProp, defaultSelectedIndex, onSelectedIndexChange);
65
+ const [value, onValueChange] = useControllableState(valueProp, defaultValue, onValueChangeProp);
66
+ const containerRef = useRef(null);
67
+ const childValues = Children.toArray(children).filter(isValidElement).map((child) => child.props.value);
68
+ const hover = useFluidHover2(containerRef);
69
+ const { activeIndex, setActiveIndex, itemRects, handlers, registerItem } = hover;
70
+ const [focusedIndex, setFocusedIndex] = useState(null);
71
+ const resolvedSelectedIndex = value !== undefined ? childValues.findIndex((childValue) => childValue === value) : selectedIndex ?? -1;
72
+ const hasSelection = resolvedSelectedIndex >= 0 || Children.toArray(children).filter(isValidElement).some((child) => child.props.selected === true);
73
+ const focusRect = focusedIndex !== null ? itemRects[focusedIndex] : null;
74
+ const selectedRect = resolvedSelectedIndex >= 0 ? itemRects[resolvedSelectedIndex] : null;
75
+ const shape = useShape();
76
+ const content = /* @__PURE__ */ jsxs("div", {
77
+ ref: (node) => {
78
+ containerRef.current = node;
79
+ if (typeof ref === "function")
80
+ ref(node);
81
+ else if (ref)
82
+ ref.current = node;
83
+ },
84
+ onMouseEnter: handlers.onMouseEnter,
85
+ onMouseMove: handlers.onMouseMove,
86
+ onMouseLeave: handlers.onMouseLeave,
87
+ onClick: handlers.onClick,
88
+ onFocus: (e) => {
89
+ const indexAttr = e.target.closest("[data-fluid-hover-index]")?.getAttribute("data-fluid-hover-index");
90
+ if (indexAttr != null) {
91
+ const idx = Number(indexAttr);
92
+ setActiveIndex(idx);
93
+ setFocusedIndex(e.target.matches(":focus-visible") ? idx : null);
94
+ }
95
+ },
96
+ onBlur: (e) => {
97
+ if (containerRef.current?.contains(e.relatedTarget))
98
+ return;
99
+ setFocusedIndex(null);
100
+ setActiveIndex(null);
101
+ },
102
+ onKeyDown: (e) => {
103
+ const items = Array.from(containerRef.current?.querySelectorAll("[data-fluid-hover-index]") ?? []);
104
+ const currentIdx = items.indexOf(e.target);
105
+ if (currentIdx === -1)
106
+ return;
107
+ const preventBaseUI = e.preventBaseUIHandler;
108
+ if (["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft"].includes(e.key)) {
109
+ e.preventDefault();
110
+ preventBaseUI?.();
111
+ const next = ["ArrowDown", "ArrowRight"].includes(e.key) ? (currentIdx + 1) % items.length : (currentIdx - 1 + items.length) % items.length;
112
+ items[next]?.focus();
113
+ items[next]?.click();
114
+ } else if (e.key === "Home") {
115
+ e.preventDefault();
116
+ preventBaseUI?.();
117
+ items[0]?.focus();
118
+ items[0]?.click();
119
+ } else if (e.key === "End") {
120
+ e.preventDefault();
121
+ preventBaseUI?.();
122
+ items[items.length - 1]?.focus();
123
+ items[items.length - 1]?.click();
124
+ }
125
+ },
126
+ role: "radiogroup",
127
+ className: cn2("relative flex flex-col w-72 max-w-full select-none", className),
128
+ ...props,
129
+ children: [
130
+ selectedRect && /* @__PURE__ */ jsx(GooIndicator, {
131
+ rect: selectedRect,
132
+ className: cn2("bg-active", shape.bg)
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
+ const withSize = (node) => size ? /* @__PURE__ */ jsx(SizeProvider2, {
159
+ size,
160
+ children: node
161
+ }) : node;
162
+ if (value !== undefined) {
163
+ return withSize(/* @__PURE__ */ jsx(RadioGroupContext.Provider, {
164
+ value: {
165
+ registerItem,
166
+ activeIndex,
167
+ selectedIndex: resolvedSelectedIndex >= 0 ? resolvedSelectedIndex : null,
168
+ selectedValue: value,
169
+ onValueChange,
170
+ hasSelection,
171
+ selectIndex
172
+ },
173
+ children: /* @__PURE__ */ jsx(RadioGroupPrimitive, {
174
+ value,
175
+ onValueChange: (v) => onValueChange(v),
176
+ render: content
177
+ })
178
+ }));
179
+ }
180
+ return withSize(/* @__PURE__ */ jsx(RadioGroupContext.Provider, {
181
+ value: {
182
+ registerItem,
183
+ activeIndex,
184
+ selectedIndex: selectedIndex ?? null,
185
+ hasSelection,
186
+ selectIndex
187
+ },
188
+ children: content
189
+ }));
190
+ });
191
+ RadioGroup2.displayName = "RadioGroup";
192
+ var RadioItem2 = forwardRef(({ label, index, selected, onSelect, value, className, ...props }, ref) => {
193
+ const internalRef = useRef(null);
194
+ const hasMounted = useRef(false);
195
+ const { registerItem, activeIndex, selectedIndex, selectedValue, onValueChange, hasSelection, selectIndex } = useRadioGroupContext();
196
+ useRegisterFluidHoverItem2(registerItem, index, internalRef);
197
+ useEffect(() => {
198
+ hasMounted.current = true;
199
+ }, []);
200
+ const isActive = activeIndex === index;
201
+ const skipAnimation = !hasMounted.current;
202
+ const shape = useShape();
203
+ const sizeClasses = useSize2();
204
+ const compact = sizeClasses.variant === "compact";
205
+ const isSelected = value !== undefined && selectedValue !== undefined ? selectedValue === value : selected ?? selectedIndex === index;
206
+ const handleSelect = () => {
207
+ if (value !== undefined) {
208
+ onValueChange?.(value);
209
+ }
210
+ onSelect?.();
211
+ selectIndex(index);
212
+ };
213
+ return /* @__PURE__ */ jsxs("div", {
214
+ ref: (node) => {
215
+ internalRef.current = node;
216
+ if (typeof ref === "function")
217
+ ref(node);
218
+ else if (ref)
219
+ ref.current = node;
220
+ },
221
+ "data-fluid-hover-index": index,
222
+ tabIndex: isSelected ? 0 : !hasSelection && index === 0 ? 0 : -1,
223
+ role: "radio",
224
+ "aria-checked": isSelected,
225
+ "aria-label": label,
226
+ onClick: handleSelect,
227
+ onMouseDown: (e) => {
228
+ const interactive = e.target.closest('button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
229
+ if (interactive && interactive !== e.currentTarget)
230
+ return;
231
+ e.preventDefault();
232
+ e.currentTarget.focus();
233
+ },
234
+ onKeyDown: (e) => {
235
+ if (e.key === " " || e.key === "Enter") {
236
+ e.preventDefault();
237
+ handleSelect();
238
+ }
239
+ },
240
+ className: cn2(`relative z-10 flex ${sizeClasses.control} items-center ${sizeClasses.gap} ${shape.item} ${sizeClasses.px} cursor-pointer outline-none`, className),
241
+ ...props,
242
+ children: [
243
+ /* @__PURE__ */ jsxs("div", {
244
+ className: cn2("relative shrink-0", compact ? "w-[14px] h-[14px]" : "w-[16px] h-[16px]"),
245
+ children: [
246
+ /* @__PURE__ */ jsx("div", {
247
+ className: cn2("absolute inset-0 rounded-full border-solid transition-all duration-fast", isSelected ? "border-[1.5px] border-transparent" : isActive ? "border-[1.5px] border-control" : "border-[1.5px] border-border")
248
+ }),
249
+ /* @__PURE__ */ jsx(AnimatePresence, {
250
+ children: isSelected && /* @__PURE__ */ jsx(motion.div, {
251
+ className: "absolute inset-0 flex items-center justify-center",
252
+ initial: {
253
+ opacity: skipAnimation ? 1 : 0,
254
+ scale: skipAnimation ? 1 : 0.3
255
+ },
256
+ animate: { opacity: 1, scale: 1 },
257
+ exit: { opacity: 0, scale: 0.3, transition: { duration: 0.04 } },
258
+ transition: spring2.fast,
259
+ children: /* @__PURE__ */ jsx("div", {
260
+ className: cn2("rounded-full bg-foreground", compact ? "w-[7px] h-[7px]" : "w-[8px] h-[8px]")
261
+ })
262
+ })
263
+ })
264
+ ]
265
+ }),
266
+ /* @__PURE__ */ jsxs("span", {
267
+ className: cn2("inline-grid", sizeClasses.text),
268
+ children: [
269
+ /* @__PURE__ */ jsx("span", {
270
+ className: "col-start-1 row-start-1 invisible [text-box:trim-both_cap_alphabetic] weight-semibold",
271
+ "aria-hidden": "true",
272
+ children: label
273
+ }),
274
+ /* @__PURE__ */ jsx("span", {
275
+ className: cn2("col-start-1 row-start-1 transition-[color,font-variation-settings] duration-fast [text-box:trim-both_cap_alphabetic]", isSelected || isActive ? "text-foreground" : "text-muted-foreground", isSelected ? "weight-semibold" : "weight-normal"),
276
+ children: label
277
+ })
278
+ ]
279
+ }),
280
+ value !== undefined && /* @__PURE__ */ jsx(RadioPrimitive.Root, {
281
+ value,
282
+ className: "sr-only",
283
+ tabIndex: -1,
284
+ "aria-hidden": true
285
+ })
286
+ ]
287
+ });
288
+ });
289
+ RadioItem2.displayName = "RadioItem";
290
+ Object.assign(RadioGroup2, { Item: RadioItem2 });
291
+ var radio_group_default = RadioGroup2;
292
+
293
+ export { RadioGroup2, RadioItem2, radio_group_default };
@@ -0,0 +1,58 @@
1
+ import {
2
+ fieldLabel,
3
+ ScrollColumn
4
+ } from "./components-9jvzzvt1.js";
5
+ import {
6
+ cn2
7
+ } from "./components-ezxhrmer.js";
8
+
9
+ // components/inputs/date-time/time-columns.tsx
10
+ import { format } from "date-fns";
11
+ import { useMemo } from "react";
12
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
13
+ var pad = (n) => String(n).padStart(2, "0");
14
+ function TimeColumns({
15
+ value,
16
+ onValueChange,
17
+ hourCycle,
18
+ minuteStep,
19
+ locale,
20
+ orientation,
21
+ fill = false
22
+ }) {
23
+ const twelve = hourCycle === "h12" || hourCycle === "h11";
24
+ const hours = value?.hours ?? null;
25
+ const minutes = value?.minutes ?? 0;
26
+ const hourOptions = useMemo(() => Array.from({ length: 24 }, (_, h) => ({
27
+ value: h,
28
+ label: twelve ? format(new Date(2000, 0, 1, h), hourCycle === "h11" ? "K a" : "h a", { locale }) : pad(h)
29
+ })), [twelve, hourCycle, locale]);
30
+ const minuteOptions = useMemo(() => Array.from({ length: Math.ceil(60 / minuteStep) }, (_, i) => ({
31
+ value: i * minuteStep,
32
+ label: pad(i * minuteStep)
33
+ })), [minuteStep]);
34
+ const vertical = orientation === "vertical";
35
+ const width = (fixed) => !vertical ? "w-full" : fill ? "min-w-0 flex-1" : cn2("shrink-0", fixed);
36
+ return /* @__PURE__ */ jsxs(Fragment, {
37
+ children: [
38
+ /* @__PURE__ */ jsx(ScrollColumn, {
39
+ label: fieldLabel(locale, "hour"),
40
+ options: hourOptions,
41
+ value: hours,
42
+ onValueChange: (h) => onValueChange({ hours: h, minutes }),
43
+ orientation,
44
+ className: width(twelve ? "w-15" : "w-12")
45
+ }),
46
+ /* @__PURE__ */ jsx(ScrollColumn, {
47
+ label: fieldLabel(locale, "minute"),
48
+ options: minuteOptions,
49
+ value: hours === null ? null : minutes,
50
+ onValueChange: (m) => onValueChange({ hours: hours ?? 0, minutes: m }),
51
+ orientation,
52
+ className: width("w-12")
53
+ })
54
+ ]
55
+ });
56
+ }
57
+
58
+ export { pad, TimeColumns };
@@ -0,0 +1,79 @@
1
+ import {
2
+ cn2
3
+ } from "./components-ezxhrmer.js";
4
+ import {
5
+ button_default
6
+ } from "./components-b2wyq2cq.js";
7
+ import {
8
+ useControllableState
9
+ } from "./components-n7mjr357.js";
10
+ import {
11
+ spring2
12
+ } from "./components-1v7rxytx.js";
13
+
14
+ // primitives/motion/index.tsx
15
+ import { MotionConfig, motion } from "motion/react";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ function Motion2({
18
+ tier = "moderate",
19
+ show,
20
+ defaultShow = true,
21
+ onShowChange,
22
+ sameExit = false,
23
+ reducedMotion = "user",
24
+ className,
25
+ children
26
+ }) {
27
+ const [shown, setShown] = useControllableState(show, defaultShow, onShowChange);
28
+ const enter = spring2[tier];
29
+ const leave = sameExit ? enter : enter.exit;
30
+ return /* @__PURE__ */ jsx(MotionConfig, {
31
+ reducedMotion,
32
+ children: /* @__PURE__ */ jsxs("div", {
33
+ className: cn2("flex flex-col items-center gap-3", className),
34
+ children: [
35
+ /* @__PURE__ */ jsx(motion.div, {
36
+ initial: false,
37
+ "aria-hidden": shown ? undefined : true,
38
+ animate: shown ? { opacity: 1, scale: 1, y: 0, visibility: "visible", transition: enter } : {
39
+ opacity: 0,
40
+ scale: 0.95,
41
+ y: 6,
42
+ visibility: "visible",
43
+ transition: leave,
44
+ transitionEnd: { visibility: "hidden" }
45
+ },
46
+ children
47
+ }),
48
+ /* @__PURE__ */ jsxs("div", {
49
+ className: "flex flex-wrap items-center justify-center gap-x-2 gap-y-1",
50
+ children: [
51
+ /* @__PURE__ */ jsx(button_default, {
52
+ variant: "tertiary",
53
+ size: "compact",
54
+ "aria-pressed": shown,
55
+ "aria-label": `${shown ? "Hide" : "Show"} (spring.${tier})`,
56
+ onClick: () => setShown((v) => !v),
57
+ children: shown ? "Hide" : "Show"
58
+ }),
59
+ /* @__PURE__ */ jsxs("span", {
60
+ className: "font-mono text-caption-compact text-muted-foreground",
61
+ children: [
62
+ "spring.",
63
+ tier,
64
+ " ",
65
+ enter.duration,
66
+ "s",
67
+ enter.bounce ? ` bounce ${enter.bounce}` : "",
68
+ " · exit ",
69
+ leave.duration,
70
+ "s"
71
+ ]
72
+ })
73
+ ]
74
+ })
75
+ ]
76
+ })
77
+ });
78
+ }
79
+ export { Motion2 };
@@ -0,0 +1,160 @@
1
+ import {
2
+ MorphSurface
3
+ } from "./components-0q0sqfh4.js";
4
+ import {
5
+ useMorph
6
+ } from "./components-hqeq3w9q.js";
7
+ import {
8
+ cn2
9
+ } from "./components-ezxhrmer.js";
10
+ import {
11
+ useShape
12
+ } from "./components-cv16mryv.js";
13
+ import {
14
+ SURFACE_BG,
15
+ SURFACE_SHADOW,
16
+ useSurface2,
17
+ SurfaceProvider2
18
+ } from "./components-zx6b6yby.js";
19
+ import {
20
+ useDialogState2,
21
+ DialogTrigger2,
22
+ DialogClose2,
23
+ DialogHeader2,
24
+ DialogFooter2,
25
+ DialogTitle2,
26
+ DialogDescription2,
27
+ DialogState2
28
+ } from "./components-zfnmn5d4.js";
29
+
30
+ // components/overlays/sheet/index.tsx
31
+ import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer";
32
+ import { motion } from "motion/react";
33
+ import {
34
+ createContext,
35
+ forwardRef,
36
+ useContext,
37
+ useImperativeHandle,
38
+ useState
39
+ } from "react";
40
+ import { jsx, jsxs } from "react/jsx-runtime";
41
+ var SheetContext = createContext({ side: "bottom", swiped: false });
42
+ var SWIPE = {
43
+ top: "up",
44
+ right: "right",
45
+ bottom: "down",
46
+ left: "left"
47
+ };
48
+ var PLACEMENT = {
49
+ top: "inset-x-2 top-2 mx-auto max-w-[36rem] max-h-[calc(100dvh-4rem)]",
50
+ bottom: "inset-x-2 bottom-2 mx-auto max-w-[36rem] max-h-[calc(100dvh-4rem)]",
51
+ left: "inset-y-2 left-2 w-[min(24rem,calc(100%-1rem))]",
52
+ right: "inset-y-2 right-2 w-[min(24rem,calc(100%-1rem))]"
53
+ };
54
+ var DRAWER_OFFSET = 4;
55
+ var INDENT_RADIUS = { pill: "data-[active]:rounded-3xl", rounded: "data-[active]:rounded-xl" };
56
+ var SheetContent2 = forwardRef(({ from, effect, hideSource, tier, container, className, children, ...props }, ref) => {
57
+ const { side, swiped } = useContext(SheetContext);
58
+ const { open, origin } = useDialogState2();
59
+ const morph = useMorph(open, origin, {
60
+ from: from ?? side,
61
+ effect,
62
+ hideSource,
63
+ tier,
64
+ exit: swiped ? { effect: "slide", from: side } : undefined
65
+ });
66
+ useImperativeHandle(ref, () => morph.popup, [morph.popup]);
67
+ const shape = useShape();
68
+ const level = Math.min(useSurface2() + DRAWER_OFFSET, 8);
69
+ const edge = side === "top" || side === "bottom";
70
+ return /* @__PURE__ */ jsxs(DrawerPrimitive.Portal, {
71
+ container: container ?? undefined,
72
+ children: [
73
+ /* @__PURE__ */ jsx(DrawerPrimitive.Backdrop, {
74
+ render: /* @__PURE__ */ jsx(motion.div, {
75
+ style: { opacity: morph.progress }
76
+ }),
77
+ className: cn2(container ? "absolute" : "fixed", "inset-0 z-50 bg-scrim")
78
+ }),
79
+ /* @__PURE__ */ jsx(DrawerPrimitive.Viewport, {
80
+ className: cn2(container ? "absolute" : "fixed", "inset-0 z-50"),
81
+ children: /* @__PURE__ */ jsx(DrawerPrimitive.Popup, {
82
+ ref: morph.popupRef,
83
+ ...props,
84
+ className: cn2("absolute flex flex-col focus:outline-none", PLACEMENT[side], "[transform:translate(var(--drawer-swipe-movement-x),calc(var(--drawer-snap-point-offset)_+_var(--drawer-swipe-movement-y)))]", "transition-[transform] duration-slow"),
85
+ children: /* @__PURE__ */ jsx(SurfaceProvider2, {
86
+ value: level,
87
+ children: /* @__PURE__ */ jsxs(MorphSurface, {
88
+ morph,
89
+ bg: SURFACE_BG[level],
90
+ shadow: SURFACE_SHADOW[level],
91
+ radius: shape.container,
92
+ className: cn2("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-6", edge && "pt-3", className),
93
+ children: [
94
+ edge && /* @__PURE__ */ jsx("div", {
95
+ "aria-hidden": true,
96
+ className: "mx-auto h-1 w-10 shrink-0 rounded-full bg-overlay/16"
97
+ }),
98
+ children
99
+ ]
100
+ })
101
+ })
102
+ })
103
+ })
104
+ ]
105
+ });
106
+ });
107
+ SheetContent2.displayName = "SheetContent";
108
+ var SheetIndent2 = forwardRef(({ className, ...props }, ref) => {
109
+ const shape = useShape();
110
+ return /* @__PURE__ */ jsx(DrawerPrimitive.Indent, {
111
+ ref,
112
+ className: cn2("origin-top transition-[transform] duration-slow data-[active]:scale-[0.96] data-[active]:overflow-hidden", INDENT_RADIUS[shape.variant], className),
113
+ ...props
114
+ });
115
+ });
116
+ SheetIndent2.displayName = "SheetIndent";
117
+ function Sheet2({
118
+ children,
119
+ open,
120
+ defaultOpen,
121
+ onOpenChange,
122
+ side = "bottom",
123
+ snapPoints,
124
+ defaultSnapPoint,
125
+ modal = true
126
+ }) {
127
+ const [swiped, setSwiped] = useState(false);
128
+ return /* @__PURE__ */ jsx(SheetContext.Provider, {
129
+ value: { side, swiped },
130
+ children: /* @__PURE__ */ jsx(DialogState2, {
131
+ open,
132
+ defaultOpen,
133
+ onOpenChange,
134
+ children: (root) => /* @__PURE__ */ jsx(DrawerPrimitive.Root, {
135
+ open: root.open,
136
+ onOpenChange: (next, details) => {
137
+ setSwiped(!next && details.reason === "swipe");
138
+ root.onOpenChange(next, details);
139
+ },
140
+ swipeDirection: SWIPE[side],
141
+ snapPoints,
142
+ defaultSnapPoint,
143
+ modal,
144
+ children
145
+ })
146
+ })
147
+ });
148
+ }
149
+ Sheet2.Trigger = DialogTrigger2;
150
+ Sheet2.Content = SheetContent2;
151
+ Sheet2.Header = DialogHeader2;
152
+ Sheet2.Footer = DialogFooter2;
153
+ Sheet2.Title = DialogTitle2;
154
+ Sheet2.Description = DialogDescription2;
155
+ Sheet2.Close = DialogClose2;
156
+ Sheet2.Provider = DrawerPrimitive.Provider;
157
+ Sheet2.Indent = SheetIndent2;
158
+ var sheet_default = Sheet2;
159
+
160
+ export { SheetContent2, SheetIndent2, Sheet2, sheet_default };
@@ -0,0 +1,63 @@
1
+ import {
2
+ SURFACE_BG,
3
+ useSurface2
4
+ } from "./components-zx6b6yby.js";
5
+ import {
6
+ cn2
7
+ } from "./components-ezxhrmer.js";
8
+ import {
9
+ scroll_area_default
10
+ } from "./components-hawvy2qz.js";
11
+
12
+ // primitives/code/index.tsx
13
+ import { Fragment } from "react";
14
+ import { parse } from "sugar-high/core";
15
+ import { lang, languages } from "sugar-high/lang";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ var TOKEN_CLASS = {
18
+ keyword: "text-syntax-keyword",
19
+ string: "text-syntax-string",
20
+ class: "text-syntax-class",
21
+ entity: "text-syntax-entity",
22
+ property: "text-syntax-property",
23
+ comment: "text-syntax-comment italic",
24
+ identifier: "text-syntax-identifier",
25
+ jsxliterals: "text-syntax-jsx",
26
+ sign: "text-syntax-sign",
27
+ break: "",
28
+ space: ""
29
+ };
30
+ function highlight(source, language) {
31
+ const config = languages.find((l) => l.id === language)?.config;
32
+ return parse(source, config).lines.map((line) => /* @__PURE__ */ jsxs(Fragment, {
33
+ children: [
34
+ line.index > 0 && `
35
+ `,
36
+ line.tokens.map((t, i) => /* @__PURE__ */ jsx("span", {
37
+ className: TOKEN_CLASS[t.type],
38
+ children: t.value
39
+ }, i))
40
+ ]
41
+ }, line.index));
42
+ }
43
+ function Code2({
44
+ children,
45
+ language = "tsx",
46
+ className
47
+ }) {
48
+ const level = Math.min(useSurface2() + 1, 8);
49
+ const source = children.trim();
50
+ const id = lang(language);
51
+ return /* @__PURE__ */ jsx(scroll_area_default, {
52
+ orientation: "horizontal",
53
+ viewportClassName: "scroll-fade-x",
54
+ className: cn2("rounded-xl", SURFACE_BG[level], className),
55
+ children: /* @__PURE__ */ jsx("pre", {
56
+ className: "m-0 w-max min-w-full p-4 font-mono text-caption leading-relaxed text-foreground",
57
+ children: /* @__PURE__ */ jsx("code", {
58
+ children: id && id !== "plaintext" ? highlight(source, id) : source
59
+ })
60
+ })
61
+ });
62
+ }
63
+ export { Code2 };