@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,293 @@
1
+ import {
2
+ SizeProvider
3
+ } from "./components-vb033rns.js";
4
+ import {
5
+ FluidHoverHighlight
6
+ } from "./components-r22vtgqc.js";
7
+ import {
8
+ useFluidHover,
9
+ useRegisterFluidHoverItem
10
+ } from "./components-e46kf6cp.js";
11
+ import {
12
+ useShape
13
+ } from "./components-7zp99w5d.js";
14
+ import {
15
+ useControllableState
16
+ } from "./components-dg0w8g5p.js";
17
+ import {
18
+ GooIndicator
19
+ } from "./components-kf2ehztc.js";
20
+ import {
21
+ spring
22
+ } from "./components-vc1k7yv2.js";
23
+ import {
24
+ useSize
25
+ } from "./components-x3rz4cyn.js";
26
+ import {
27
+ cn
28
+ } from "./components-0f0as45n.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 RadioGroup = 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 = useFluidHover(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: cn("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: cn("bg-active", shape.bg)
133
+ }),
134
+ /* @__PURE__ */ jsx(FluidHoverHighlight, {
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: spring.fast.exit },
149
+ transition: {
150
+ ...spring.fast,
151
+ opacity: { duration: spring.fast.duration }
152
+ }
153
+ })
154
+ }),
155
+ children
156
+ ]
157
+ });
158
+ const withSize = (node) => size ? /* @__PURE__ */ jsx(SizeProvider, {
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
+ RadioGroup.displayName = "RadioGroup";
192
+ var RadioItem = 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
+ useRegisterFluidHoverItem(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 = useSize();
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: cn(`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: cn("relative shrink-0", compact ? "w-[14px] h-[14px]" : "w-[16px] h-[16px]"),
245
+ children: [
246
+ /* @__PURE__ */ jsx("div", {
247
+ className: cn("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: spring.fast,
259
+ children: /* @__PURE__ */ jsx("div", {
260
+ className: cn("rounded-full bg-foreground", compact ? "w-[7px] h-[7px]" : "w-[8px] h-[8px]")
261
+ })
262
+ })
263
+ })
264
+ ]
265
+ }),
266
+ /* @__PURE__ */ jsxs("span", {
267
+ className: cn("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: cn("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
+ RadioItem.displayName = "RadioItem";
290
+ Object.assign(RadioGroup, { Item: RadioItem });
291
+ var radio_group_default = RadioGroup;
292
+
293
+ export { RadioGroup, RadioItem, radio_group_default };
@@ -0,0 +1,232 @@
1
+ import {
2
+ useShape
3
+ } from "./components-7zp99w5d.js";
4
+ import {
5
+ useReduceMotion
6
+ } from "./components-nnnd2xef.js";
7
+ import {
8
+ spring
9
+ } from "./components-vc1k7yv2.js";
10
+ import {
11
+ useSizeVariant
12
+ } from "./components-x3rz4cyn.js";
13
+ import {
14
+ cn
15
+ } from "./components-0f0as45n.js";
16
+
17
+ // components/button/index.tsx
18
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
19
+ import { cva } from "class-variance-authority";
20
+ import { AnimatePresence, animate, motion, useMotionValue } from "motion/react";
21
+ import {
22
+ cloneElement,
23
+ forwardRef,
24
+ isValidElement,
25
+ useLayoutEffect,
26
+ useRef
27
+ } from "react";
28
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
29
+ var buttonVariants = cva([
30
+ "group relative isolate inline-flex items-center justify-center outline-none cursor-pointer",
31
+ "transition-[color,opacity] duration-fast",
32
+ "disabled:opacity-50 disabled:pointer-events-none",
33
+ "focus-visible:ring-1 focus-visible:ring-focus-ring"
34
+ ], {
35
+ variants: {
36
+ variant: {
37
+ primary: "text-background",
38
+ secondary: "text-foreground",
39
+ tertiary: "text-foreground",
40
+ ghost: "text-muted-foreground hover:text-foreground"
41
+ },
42
+ size: {
43
+ default: "h-9 px-4 text-body gap-1.5",
44
+ compact: "h-7 px-3 text-body-compact gap-1",
45
+ icon: "h-9 w-9 p-0 [&_svg]:h-4 [&_svg]:w-4",
46
+ "icon-compact": "h-7 w-7 p-0 [&_svg]:h-3.5 [&_svg]:w-3.5"
47
+ },
48
+ iconLeft: { true: "" },
49
+ iconRight: { true: "" }
50
+ },
51
+ compoundVariants: [
52
+ { size: "compact", iconLeft: true, className: "pl-2" },
53
+ { size: "default", iconLeft: true, className: "pl-3" },
54
+ { size: "compact", iconRight: true, className: "pr-2" },
55
+ { size: "default", iconRight: true, className: "pr-3" }
56
+ ],
57
+ defaultVariants: {
58
+ variant: "primary",
59
+ size: "default"
60
+ }
61
+ });
62
+ var legacySizeAliases = {
63
+ sm: "compact",
64
+ md: "default",
65
+ lg: "default",
66
+ "icon-sm": "icon-compact",
67
+ "icon-lg": "icon"
68
+ };
69
+ var bgVariants = {
70
+ primary: "[--btn-bg:var(--foreground)] group-hover:[--btn-bg:color-mix(in_oklab,var(--foreground)_90%,var(--background))] group-active:[--btn-bg:color-mix(in_oklab,var(--foreground)_80%,var(--background))] bg-[var(--btn-bg)] shadow-[0_0_0_1px_var(--btn-bg)] group-active:shadow-[0_0_0_0px_var(--btn-bg)]",
71
+ secondary: "[--btn-bg:var(--accent)] group-hover:[--btn-bg:color-mix(in_oklab,var(--accent)_80%,var(--background))] group-active:[--btn-bg:var(--accent)] bg-[var(--btn-bg)] shadow-[0_0_0_1px_var(--btn-bg)] group-active:shadow-[0_0_0_0px_var(--btn-bg)]",
72
+ tertiary: "bg-transparent shadow-[0_0_0_1px_var(--border),inset_0_0_0_0px_var(--border)] group-hover:bg-hover group-active:bg-active group-active:shadow-[0_0_0_0px_var(--border),inset_0_0_0_1px_var(--border)]",
73
+ ghost: "bg-transparent shadow-[0_0_0_1px_transparent] group-hover:bg-hover group-hover:shadow-[0_0_0_1px_var(--hover)] group-active:bg-active group-active:shadow-[0_0_0_0px_var(--active)]"
74
+ };
75
+ var activeBgVariants = {
76
+ primary: "[--btn-bg:color-mix(in_oklab,var(--foreground)_80%,var(--background))] bg-[var(--btn-bg)] shadow-[0_0_0_1px_var(--btn-bg)] group-active:shadow-[0_0_0_0px_var(--btn-bg)]",
77
+ secondary: "[--btn-bg:var(--accent)] bg-[var(--btn-bg)] shadow-[0_0_0_1px_var(--btn-bg)] group-active:shadow-[0_0_0_0px_var(--btn-bg)]",
78
+ tertiary: "bg-active shadow-[0_0_0_1px_var(--border),inset_0_0_0_0px_var(--border)] group-active:shadow-[0_0_0_0px_var(--border),inset_0_0_0_1px_var(--border)]",
79
+ ghost: "bg-active shadow-[0_0_0_1px_var(--active)] group-active:shadow-[0_0_0_0px_var(--active)]"
80
+ };
81
+ var { exit: _exit, ...enter } = spring.moderate;
82
+ function useLoadingMorph(loading) {
83
+ const surface = useRef(null);
84
+ const progress = useMotionValue(loading ? 1 : 0);
85
+ const reduced = useReduceMotion();
86
+ useLayoutEffect(() => {
87
+ const el = surface.current;
88
+ const root = el?.parentElement;
89
+ if (!el || !root || !loading && progress.get() === 0)
90
+ return;
91
+ const height = root.offsetHeight;
92
+ const circle = height / 2 - 1;
93
+ const rest = Math.min(Number.parseFloat(getComputedStyle(root).borderTopLeftRadius) || 0, circle);
94
+ const render = (p) => {
95
+ const side = `calc(${50 * p}% + ${1 - height / 2 * p}px)`;
96
+ el.style.left = side;
97
+ el.style.right = side;
98
+ el.style.borderRadius = `${rest + (circle - rest) * p}px`;
99
+ };
100
+ const settle = () => el.removeAttribute("style");
101
+ const target = loading ? 1 : 0;
102
+ if (reduced || progress.get() === target) {
103
+ progress.jump(target);
104
+ return loading ? render(1) : settle();
105
+ }
106
+ const controls = animate(progress, target, {
107
+ ...enter,
108
+ onUpdate: render,
109
+ onComplete: loading ? undefined : settle
110
+ });
111
+ return () => controls.stop();
112
+ }, [loading, reduced]);
113
+ return surface;
114
+ }
115
+ var Button = forwardRef(({
116
+ className,
117
+ variant,
118
+ size,
119
+ asChild = false,
120
+ loading = false,
121
+ leadingIcon: LeadingIcon,
122
+ trailingIcon: TrailingIcon,
123
+ active = false,
124
+ disabled,
125
+ children,
126
+ style,
127
+ ...props
128
+ }, ref) => {
129
+ const asChildElement = asChild && isValidElement(children) ? children : null;
130
+ const label = asChildElement ? asChildElement.props.children : children;
131
+ const contextSize = useSizeVariant();
132
+ const resolvedSize = size ? legacySizeAliases[size] ?? size : contextSize === "compact" ? "compact" : "default";
133
+ const isIconOnly = resolvedSize === "icon" || resolvedSize === "icon-compact";
134
+ const isCompact = resolvedSize === "compact" || resolvedSize === "icon-compact";
135
+ const iconSize = isCompact ? 14 : 16;
136
+ const spinnerSizeClass = isCompact ? "h-7 w-7" : "h-9 w-9";
137
+ const shape = useShape();
138
+ const bgClass = active ? activeBgVariants[variant ?? "primary"] : bgVariants[variant ?? "primary"];
139
+ const surface = useLoadingMorph(loading);
140
+ const internals = /* @__PURE__ */ jsxs(Fragment, {
141
+ children: [
142
+ /* @__PURE__ */ jsx("span", {
143
+ ref: surface,
144
+ "aria-hidden": true,
145
+ className: cn("absolute inset-px rounded-[inherit] transition-[box-shadow,background-color] [transition-duration:180ms,80ms] [transition-timing-function:cubic-bezier(0.23,1,0.32,1),ease] group-active:[transition-duration:80ms,80ms]", bgClass)
146
+ }),
147
+ /* @__PURE__ */ jsx(motion.span, {
148
+ className: "relative inline-flex items-center justify-center gap-[inherit]",
149
+ initial: false,
150
+ animate: { opacity: loading ? 0 : 1 },
151
+ transition: loading ? spring.fast.exit : enter,
152
+ children: isIconOnly ? /* @__PURE__ */ jsx("span", {
153
+ className: "[&_svg]:stroke-[1.5] [&_svg]:transition-[stroke-width] [&_svg]:duration-fast group-hover:[&_svg]:stroke-[2]",
154
+ children: label
155
+ }) : /* @__PURE__ */ jsxs(Fragment, {
156
+ children: [
157
+ LeadingIcon && /* @__PURE__ */ jsx(LeadingIcon, {
158
+ size: iconSize,
159
+ strokeWidth: 1.5,
160
+ className: "transition-[stroke-width] duration-fast group-hover:stroke-[2]"
161
+ }),
162
+ /* @__PURE__ */ jsx("span", {
163
+ className: "[text-box:trim-both_cap_alphabetic]",
164
+ children: label
165
+ }),
166
+ TrailingIcon && /* @__PURE__ */ jsx(TrailingIcon, {
167
+ size: iconSize,
168
+ strokeWidth: 1.5,
169
+ className: "transition-[stroke-width] duration-fast group-hover:stroke-[2]"
170
+ })
171
+ ]
172
+ })
173
+ }),
174
+ /* @__PURE__ */ jsx(AnimatePresence, {
175
+ initial: false,
176
+ children: loading && /* @__PURE__ */ jsx(motion.span, {
177
+ "aria-hidden": true,
178
+ className: "absolute inset-0 flex items-center justify-center",
179
+ initial: { opacity: 0, scale: 0.6 },
180
+ animate: { opacity: 1, scale: 1 },
181
+ exit: { opacity: 0, scale: 0.6, transition: spring.fast.exit },
182
+ transition: enter,
183
+ children: /* @__PURE__ */ jsx("svg", {
184
+ className: spinnerSizeClass,
185
+ viewBox: "0 0 24 24",
186
+ fill: "none",
187
+ children: /* @__PURE__ */ jsx("path", {
188
+ d: "M 12 12 C 14 8.5 19 8.5 19 12 C 19 15.5 14 15.5 12 12 C 10 8.5 5 8.5 5 12 C 5 15.5 10 15.5 12 12 Z",
189
+ stroke: "currentColor",
190
+ strokeWidth: "1.125",
191
+ strokeLinecap: "round",
192
+ pathLength: "100",
193
+ style: {
194
+ strokeDasharray: "15 85",
195
+ animation: "spinner-move 2s linear infinite, spinner-dash 4s ease-in-out infinite"
196
+ }
197
+ })
198
+ })
199
+ }, "spinner")
200
+ })
201
+ ]
202
+ });
203
+ const rootClassName = cn(buttonVariants({
204
+ variant,
205
+ size: resolvedSize,
206
+ iconLeft: !isIconOnly && !!LeadingIcon,
207
+ iconRight: !isIconOnly && !!TrailingIcon
208
+ }), shape.button, className);
209
+ if (asChildElement) {
210
+ const childProps = asChildElement.props;
211
+ return cloneElement(asChildElement, {
212
+ ...props,
213
+ ref,
214
+ "aria-busy": loading || undefined,
215
+ className: cn(rootClassName, childProps.className),
216
+ style: { ...style, ...childProps.style }
217
+ }, internals);
218
+ }
219
+ return /* @__PURE__ */ jsx(ButtonPrimitive, {
220
+ ref,
221
+ className: rootClassName,
222
+ disabled: disabled || loading,
223
+ "aria-busy": loading || undefined,
224
+ style,
225
+ ...props,
226
+ children: internals
227
+ });
228
+ });
229
+ Button.displayName = "Button";
230
+ var button_default = Button;
231
+
232
+ export { buttonVariants, Button, button_default };
@@ -0,0 +1,9 @@
1
+ // lib/slot.ts
2
+ import { isValidElement } from "react";
3
+ function slotRender(render, asChild, children) {
4
+ if (render)
5
+ return render;
6
+ return asChild && isValidElement(children) ? children : undefined;
7
+ }
8
+
9
+ export { slotRender };
@@ -0,0 +1,152 @@
1
+ import {
2
+ GooFilter
3
+ } from "./components-jxgznftn.js";
4
+ import {
5
+ GOO_BLUR_RATIO
6
+ } from "./components-7nww01w4.js";
7
+ import {
8
+ useReduceMotion
9
+ } from "./components-nnnd2xef.js";
10
+ import {
11
+ spring
12
+ } from "./components-vc1k7yv2.js";
13
+ import {
14
+ useSize
15
+ } from "./components-x3rz4cyn.js";
16
+ import {
17
+ cn
18
+ } from "./components-0f0as45n.js";
19
+
20
+ // components/thinking-indicator/index.tsx
21
+ import { AnimatePresence, motion } from "motion/react";
22
+ import { forwardRef, useEffect, useId, useState } from "react";
23
+ import { jsx, jsxs } from "react/jsx-runtime";
24
+ var circleA = "M 12 8 C 14.21 8 16 9.79 16 12 C 16 14.21 14.21 16 12 16 C 9.79 16 8 14.21 8 12 C 8 9.79 9.79 8 12 8 Z";
25
+ var infinity = "M 12 12 C 14 8.5 19 8.5 19 12 C 19 15.5 14 15.5 12 12 C 10 8.5 5 8.5 5 12 C 5 15.5 10 15.5 12 12 Z";
26
+ var circleB = "M 12 16 C 14.21 16 16 14.21 16 12 C 16 9.79 14.21 8 12 8 C 9.79 8 8 9.79 8 12 C 8 14.21 9.79 16 12 16 Z";
27
+ var words = ["Thinking", "Moonwalking", "Planning", "Refining"];
28
+ var DOTS = {
29
+ default: { box: "h-5 w-[26px]", dot: "size-1.5", radius: 3, gap: 10 },
30
+ compact: { box: "h-[18px] w-[23px]", dot: "size-[5px]", radius: 2.5, gap: 9 }
31
+ };
32
+ var MERGED = Math.sqrt(3);
33
+ function GooDots({ step, still }) {
34
+ const gooId = `thinking-goo-${useId().replace(/:/g, "")}`;
35
+ const { box, dot, radius, gap } = DOTS[step];
36
+ const loop = { duration: spring.slow.duration * 8, ease: "easeInOut", repeat: Infinity };
37
+ return /* @__PURE__ */ jsxs("span", {
38
+ "aria-hidden": true,
39
+ className: cn("relative shrink-0", box),
40
+ children: [
41
+ /* @__PURE__ */ jsx(GooFilter, {
42
+ id: gooId,
43
+ blur: radius * GOO_BLUR_RATIO
44
+ }),
45
+ /* @__PURE__ */ jsx("span", {
46
+ className: "absolute inset-0 flex items-center justify-center",
47
+ style: { filter: `url(#${gooId})` },
48
+ children: [-1, 0, 1].map((side) => /* @__PURE__ */ jsx(motion.span, {
49
+ className: cn("absolute rounded-full bg-muted-foreground", dot),
50
+ animate: still ? { x: side * gap } : side ? { x: [side * gap, 0, side * gap] } : { scale: [1, MERGED, 1] },
51
+ transition: still ? { duration: 0 } : loop
52
+ }, side))
53
+ })
54
+ ]
55
+ });
56
+ }
57
+ var ThinkingIndicator = forwardRef(({ className, variant = "shimmer", showIcon = true, size, ...props }, ref) => {
58
+ const step = useSize(size).variant;
59
+ const compactStep = step === "compact";
60
+ const [index, setIndex] = useState(0);
61
+ const reduceMotion = useReduceMotion();
62
+ const label = variant === "goo" ? "text-muted-foreground" : "shimmer-text";
63
+ useEffect(() => {
64
+ if (reduceMotion)
65
+ return;
66
+ const interval = setInterval(() => {
67
+ setIndex((i) => (i + 1) % words.length);
68
+ }, 4000);
69
+ return () => clearInterval(interval);
70
+ }, [reduceMotion]);
71
+ return /* @__PURE__ */ jsxs("div", {
72
+ ref,
73
+ role: "status",
74
+ className: cn("flex items-center gap-2 px-3 py-2", className),
75
+ ...props,
76
+ children: [
77
+ /* @__PURE__ */ jsx("span", {
78
+ className: "sr-only",
79
+ children: "Thinking…"
80
+ }),
81
+ showIcon && variant === "goo" && /* @__PURE__ */ jsx(GooDots, {
82
+ step,
83
+ still: reduceMotion
84
+ }),
85
+ showIcon && variant === "shimmer" && /* @__PURE__ */ jsx(motion.svg, {
86
+ "aria-hidden": true,
87
+ width: compactStep ? 18 : 20,
88
+ height: compactStep ? 18 : 20,
89
+ viewBox: "0 0 24 24",
90
+ fill: "none",
91
+ stroke: "currentColor",
92
+ strokeWidth: 1.5,
93
+ strokeLinecap: "round",
94
+ strokeLinejoin: "round",
95
+ className: "text-muted-foreground shrink-0",
96
+ children: reduceMotion ? /* @__PURE__ */ jsx("path", {
97
+ d: infinity
98
+ }) : /* @__PURE__ */ jsx(motion.path, {
99
+ d: circleA,
100
+ initial: { d: circleA },
101
+ animate: {
102
+ d: [circleA, infinity, circleB, infinity, circleA]
103
+ },
104
+ transition: {
105
+ d: {
106
+ duration: 6,
107
+ ease: "easeInOut",
108
+ repeat: Infinity,
109
+ times: [0, 0.25, 0.5, 0.75, 1]
110
+ }
111
+ }
112
+ })
113
+ }),
114
+ /* @__PURE__ */ jsxs("span", {
115
+ "aria-hidden": "true",
116
+ className: cn("inline-grid overflow-hidden", compactStep ? "text-body-compact" : "text-body", "weight-medium"),
117
+ children: [
118
+ /* @__PURE__ */ jsx("span", {
119
+ className: cn("col-start-1 row-start-1 invisible", label),
120
+ children: words.reduce((a, b) => a.length >= b.length ? a : b)
121
+ }),
122
+ reduceMotion ? /* @__PURE__ */ jsx("span", {
123
+ className: cn("col-start-1 row-start-1", label),
124
+ children: words[0]
125
+ }) : /* @__PURE__ */ jsx(AnimatePresence, {
126
+ mode: "popLayout",
127
+ initial: false,
128
+ children: /* @__PURE__ */ jsx(motion.span, {
129
+ className: cn("col-start-1 row-start-1", label),
130
+ initial: { y: "80%", opacity: 0 },
131
+ animate: {
132
+ y: 0,
133
+ opacity: 1,
134
+ transition: { duration: spring.slow.duration, ease: [0.4, 0, 0.2, 1] }
135
+ },
136
+ exit: {
137
+ y: "-80%",
138
+ opacity: 0,
139
+ transition: { duration: spring.slow.exit.duration, ease: [0.4, 0, 0.2, 1] }
140
+ },
141
+ children: words[index]
142
+ }, words[index])
143
+ })
144
+ ]
145
+ })
146
+ ]
147
+ });
148
+ });
149
+ ThinkingIndicator.displayName = "ThinkingIndicator";
150
+ var thinking_indicator_default = ThinkingIndicator;
151
+
152
+ export { ThinkingIndicator, thinking_indicator_default };