@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,484 @@
1
+ import {
2
+ SizeProvider
3
+ } from "./components-vb033rns.js";
4
+ import {
5
+ useIcon
6
+ } from "./components-m5br529r.js";
7
+ import {
8
+ FluidHoverHighlight
9
+ } from "./components-r22vtgqc.js";
10
+ import {
11
+ useFluidHover,
12
+ useRegisterFluidHoverItem
13
+ } from "./components-e46kf6cp.js";
14
+ import {
15
+ useShape
16
+ } from "./components-7zp99w5d.js";
17
+ import {
18
+ useSize
19
+ } from "./components-x3rz4cyn.js";
20
+ import {
21
+ cn
22
+ } from "./components-0f0as45n.js";
23
+
24
+ // components/card/index.tsx
25
+ import {
26
+ Children,
27
+ cloneElement,
28
+ createContext,
29
+ forwardRef,
30
+ isValidElement,
31
+ useContext,
32
+ useMemo,
33
+ useRef
34
+ } from "react";
35
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
36
+ var CardGroupContext = createContext(null);
37
+ var CardContext = createContext({
38
+ emphasized: false,
39
+ orientation: "card",
40
+ clickable: false,
41
+ hasImage: false
42
+ });
43
+ var CardGroup = forwardRef(({
44
+ orientation = "card",
45
+ columns = 1,
46
+ border = "none",
47
+ separated = false,
48
+ fluidHover = true,
49
+ className,
50
+ children,
51
+ ...props
52
+ }, ref) => {
53
+ const containerRef = useRef(null);
54
+ const shape = useShape();
55
+ const axis = columns > 1 ? "xy" : "y";
56
+ const hover = useFluidHover(containerRef, { axis, gapClick: { maxDistance: 16 } });
57
+ const { activeIndex, handlers, registerItem } = hover;
58
+ const childArray = Children.toArray(children).filter(isValidElement);
59
+ const count = childArray.length;
60
+ const indexed = childArray.map((child, i) => cloneElement(child, { index: i }));
61
+ const selectedIndex = childArray.findIndex((child) => child.props.selected);
62
+ const outlined = border === "outlined";
63
+ const divided = !separated;
64
+ const contextValue = useMemo(() => ({
65
+ registerItem,
66
+ activeIndex,
67
+ selectedIndex,
68
+ orientation,
69
+ columns,
70
+ count,
71
+ separated,
72
+ divided,
73
+ outlined
74
+ }), [registerItem, activeIndex, selectedIndex, orientation, columns, count, separated, divided, outlined]);
75
+ return /* @__PURE__ */ jsx(CardGroupContext.Provider, {
76
+ value: contextValue,
77
+ children: /* @__PURE__ */ jsxs("div", {
78
+ ref: (node) => {
79
+ containerRef.current = node;
80
+ if (typeof ref === "function")
81
+ ref(node);
82
+ else if (ref)
83
+ ref.current = node;
84
+ },
85
+ ...props,
86
+ "data-slot": "card-group",
87
+ "data-orientation": orientation,
88
+ className: cn("relative grid", outlined && !separated && `border border-border/60 overflow-hidden ${shape.container}`, separated ? "gap-2" : "gap-0", className),
89
+ style: {
90
+ gridTemplateColumns: `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`
91
+ },
92
+ onMouseEnter: fluidHover ? handlers.onMouseEnter : undefined,
93
+ onMouseMove: fluidHover ? handlers.onMouseMove : undefined,
94
+ onMouseLeave: fluidHover ? handlers.onMouseLeave : undefined,
95
+ onClick: fluidHover ? handlers.onClick : undefined,
96
+ children: [
97
+ /* @__PURE__ */ jsx(FluidHoverHighlight, {
98
+ hover,
99
+ hidden: !fluidHover,
100
+ className: cn("z-0", shape.container)
101
+ }),
102
+ indexed
103
+ ]
104
+ })
105
+ });
106
+ });
107
+ CardGroup.displayName = "CardGroup";
108
+ var Card = forwardRef(({
109
+ onClick,
110
+ href,
111
+ external,
112
+ label,
113
+ selected = false,
114
+ disabled = false,
115
+ dismissible = false,
116
+ dismissOnHover = true,
117
+ onDismiss,
118
+ size,
119
+ index,
120
+ className,
121
+ children,
122
+ ...props
123
+ }, ref) => {
124
+ const internalRef = useRef(null);
125
+ const shape = useShape();
126
+ const sizeClasses = useSize(size);
127
+ const compact = sizeClasses.variant === "compact";
128
+ const group = useContext(CardGroupContext);
129
+ const XIcon = useIcon("x");
130
+ const orientation = group?.orientation ?? "card";
131
+ const columns = group?.columns ?? 1;
132
+ const count = group?.count ?? 1;
133
+ const separated = group?.separated ?? true;
134
+ const divided = group?.divided ?? false;
135
+ const outlined = group?.outlined ?? false;
136
+ const activeIndex = group?.activeIndex ?? null;
137
+ const selectedIndex = group?.selectedIndex ?? -1;
138
+ const registerItem = href || onClick ? group?.registerItem : undefined;
139
+ useRegisterFluidHoverItem(registerItem, index, internalRef);
140
+ const col = index !== undefined ? index % columns : 0;
141
+ const hasBelow = index !== undefined && index + columns < count;
142
+ const hasRight = index !== undefined && col < columns - 1 && index + 1 < count;
143
+ const self = index ?? -1;
144
+ const touchesBelow = (i) => i === self || i === self + columns;
145
+ const touchesRight = (i) => i === self || i === self + 1;
146
+ const showBottom = divided && hasBelow && !(touchesBelow(activeIndex ?? -1) || touchesBelow(selectedIndex));
147
+ const showRight = divided && hasRight && !(touchesRight(activeIndex ?? -1) || touchesRight(selectedIndex));
148
+ const isInline = orientation === "inline";
149
+ const isCardImage = (child) => isValidElement(child) && (child.type === CardImage || child.type?.displayName === "CardImage");
150
+ const hasImage = Children.toArray(children).some(isCardImage);
151
+ const inlineImage = isInline && hasImage;
152
+ const clickable = !!href || !!onClick;
153
+ const emphasized = selected;
154
+ const tileShape = !group ? cn(shape.container, "overflow-hidden") : separated && outlined ? cn(shape.container, "overflow-hidden border border-border/60") : "";
155
+ const overlay = clickable && !disabled ? href ? /* @__PURE__ */ jsx("a", {
156
+ href,
157
+ onClick,
158
+ target: external ? "_blank" : undefined,
159
+ rel: external ? "noopener noreferrer" : undefined,
160
+ "aria-label": label,
161
+ className: "absolute inset-0 z-20 outline-none focus-visible:ring-1 focus-visible:ring-focus-ring rounded-[inherit]"
162
+ }) : /* @__PURE__ */ jsx("button", {
163
+ type: "button",
164
+ onClick,
165
+ "aria-label": label,
166
+ "aria-pressed": selected || undefined,
167
+ className: "absolute inset-0 z-20 outline-none focus-visible:ring-1 focus-visible:ring-focus-ring rounded-[inherit]"
168
+ }) : null;
169
+ const cardContext = useMemo(() => ({ emphasized, orientation, clickable, hasImage }), [emphasized, orientation, clickable, hasImage]);
170
+ let body = children;
171
+ if (inlineImage) {
172
+ const parts = Children.toArray(children);
173
+ const image = parts.find(isCardImage);
174
+ const rest = parts.filter((part) => part !== image);
175
+ body = /* @__PURE__ */ jsxs(Fragment, {
176
+ children: [
177
+ image,
178
+ /* @__PURE__ */ jsx("div", {
179
+ className: cn("flex min-w-0 flex-1 flex-col justify-center gap-2", compact ? "py-2.5 pr-3" : "py-3.5 pr-4"),
180
+ children: rest
181
+ })
182
+ ]
183
+ });
184
+ }
185
+ const card = /* @__PURE__ */ jsx(CardContext.Provider, {
186
+ value: cardContext,
187
+ children: /* @__PURE__ */ jsxs("div", {
188
+ ref: (node) => {
189
+ internalRef.current = node;
190
+ if (typeof ref === "function")
191
+ ref(node);
192
+ else if (ref)
193
+ ref.current = node;
194
+ },
195
+ "data-slot": "card",
196
+ "data-fluid-hover-index": index,
197
+ "data-selected": selected || undefined,
198
+ "data-orientation": orientation,
199
+ "aria-disabled": disabled || undefined,
200
+ className: cn("group/card relative z-10 min-w-0 min-h-[60px]", inlineImage ? cn("flex flex-row items-center", compact ? "gap-2.5" : "gap-3") : isInline ? cn("flex flex-row items-center", compact ? "gap-2.5 pl-3" : "gap-3 pl-4") : cn("flex flex-col", compact ? "pb-3" : "pb-4"), !group && clickable && !disabled && "transition-colors duration-fast hover:bg-hover", dismissible && isInline && (dismissOnHover ? "[&:hover_[data-slot=card-header]]:pr-10 [&:focus-within_[data-slot=card-header]]:pr-10" : "[&_[data-slot=card-header]]:pr-10"), tileShape, disabled && "opacity-50 pointer-events-none", className),
201
+ ...props,
202
+ children: [
203
+ selected && /* @__PURE__ */ jsx("span", {
204
+ "aria-hidden": true,
205
+ className: cn("absolute inset-0 -z-10 bg-active pointer-events-none", shape.container)
206
+ }),
207
+ showBottom && /* @__PURE__ */ jsx("span", {
208
+ "aria-hidden": true,
209
+ className: "absolute inset-x-0 bottom-0 h-px bg-border/60 pointer-events-none -z-10"
210
+ }),
211
+ showRight && /* @__PURE__ */ jsx("span", {
212
+ "aria-hidden": true,
213
+ className: cn("absolute top-0 right-0 w-px bg-border/60 pointer-events-none -z-10", showBottom ? "bottom-px" : "bottom-0")
214
+ }),
215
+ overlay,
216
+ body,
217
+ dismissible && /* @__PURE__ */ jsx("button", {
218
+ type: "button",
219
+ onClick: onDismiss,
220
+ "aria-label": "Dismiss",
221
+ className: cn("absolute right-2 top-2 z-30 flex h-7 w-7 items-center justify-center text-muted-foreground hover:text-foreground cursor-pointer outline-none transition-colors duration-fast focus-visible:ring-1 focus-visible:ring-focus-ring", hasImage ? "bg-card/70 backdrop-blur-sm hover:bg-card" : "hover:bg-hover", dismissOnHover && "pointer-events-none opacity-0 transition-opacity duration-fast group-hover/card:pointer-events-auto group-hover/card:opacity-100 group-focus-within/card:pointer-events-auto group-focus-within/card:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100", shape.button),
222
+ children: /* @__PURE__ */ jsx(XIcon, {
223
+ size: compact ? 13 : 15,
224
+ strokeWidth: 1.5
225
+ })
226
+ })
227
+ ]
228
+ })
229
+ });
230
+ return size ? /* @__PURE__ */ jsx(SizeProvider, {
231
+ size,
232
+ children: card
233
+ }) : card;
234
+ });
235
+ Card.displayName = "Card";
236
+ var CardHeader = forwardRef(({ className, ...props }, ref) => {
237
+ const { orientation, hasImage } = useContext(CardContext);
238
+ const inlineImage = orientation === "inline" && hasImage;
239
+ const sizeClasses = useSize();
240
+ const compact = sizeClasses.variant === "compact";
241
+ return /* @__PURE__ */ jsx("div", {
242
+ ref,
243
+ "data-slot": "card-header",
244
+ className: cn("grid auto-rows-min items-start gap-1 has-data-[slot=card-action]:grid-cols-[1fr_auto]", inlineImage ? "min-w-0" : orientation === "inline" ? cn("min-w-0 flex-1", compact ? "py-2.5" : "py-3.5") : compact ? "px-3 pt-3" : "px-4 pt-4", className),
245
+ ...props
246
+ });
247
+ });
248
+ CardHeader.displayName = "CardHeader";
249
+ var CardTitle = forwardRef(({ className, children, ...props }, ref) => {
250
+ const { emphasized, orientation } = useContext(CardContext);
251
+ const sizeClasses = useSize();
252
+ const compact = sizeClasses.variant === "compact";
253
+ const trim = orientation === "inline" ? "[text-box:trim-both_cap_alphabetic]" : "";
254
+ return /* @__PURE__ */ jsxs("span", {
255
+ ref,
256
+ "data-slot": "card-title",
257
+ className: cn("inline-grid grid-cols-[minmax(0,1fr)] leading-snug", compact ? "text-subtitle-compact" : "text-subtitle", className),
258
+ ...props,
259
+ children: [
260
+ /* @__PURE__ */ jsx("span", {
261
+ className: cn("col-start-1 row-start-1 invisible min-w-0 overflow-hidden text-ellipsis", trim, "weight-semibold"),
262
+ "aria-hidden": "true",
263
+ children
264
+ }),
265
+ /* @__PURE__ */ jsx("span", {
266
+ className: cn("col-start-1 row-start-1 min-w-0 overflow-hidden text-ellipsis text-foreground transition-[font-variation-settings] duration-fast", trim, emphasized ? "weight-semibold" : "weight-normal"),
267
+ children
268
+ })
269
+ ]
270
+ });
271
+ });
272
+ CardTitle.displayName = "CardTitle";
273
+ var CardDescription = forwardRef(({ className, ...props }, ref) => {
274
+ const sizeClasses = useSize();
275
+ const compact = sizeClasses.variant === "compact";
276
+ return /* @__PURE__ */ jsx("p", {
277
+ ref,
278
+ "data-slot": "card-description",
279
+ className: cn("leading-normal text-muted-foreground", compact ? "text-subtitle-compact" : "text-subtitle", className),
280
+ ...props
281
+ });
282
+ });
283
+ CardDescription.displayName = "CardDescription";
284
+ var CardAction = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
285
+ ref,
286
+ "data-slot": "card-action",
287
+ className: cn("relative z-30 col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
288
+ ...props
289
+ }));
290
+ CardAction.displayName = "CardAction";
291
+ var CardContent = forwardRef(({ className, ...props }, ref) => {
292
+ const { orientation } = useContext(CardContext);
293
+ const sizeClasses = useSize();
294
+ const compact = sizeClasses.variant === "compact";
295
+ return /* @__PURE__ */ jsx("div", {
296
+ ref,
297
+ "data-slot": "card-content",
298
+ className: cn(orientation === "inline" ? "" : compact ? "px-3 pt-2.5" : "px-4 pt-3", className),
299
+ ...props
300
+ });
301
+ });
302
+ CardContent.displayName = "CardContent";
303
+ var CardFooter = forwardRef(({ className, ...props }, ref) => {
304
+ const { orientation, hasImage } = useContext(CardContext);
305
+ const inlineImage = orientation === "inline" && hasImage;
306
+ const sizeClasses = useSize();
307
+ const compact = sizeClasses.variant === "compact";
308
+ return /* @__PURE__ */ jsx("div", {
309
+ ref,
310
+ "data-slot": "card-footer",
311
+ className: cn("relative z-30 flex items-center gap-1", inlineImage ? "flex-wrap" : orientation === "inline" ? cn("shrink-0 ml-auto", compact ? "pr-3" : "pr-4") : cn("flex-wrap", compact ? "px-3 pt-2.5" : "px-4 pt-3"), className),
312
+ ...props
313
+ });
314
+ });
315
+ CardFooter.displayName = "CardFooter";
316
+ function CardMedia({ logo, logoAlt, icon: Icon, size = 22, className }) {
317
+ const { orientation } = useContext(CardContext);
318
+ const shape = useShape();
319
+ const sizeClasses = useSize();
320
+ const compact = sizeClasses.variant === "compact";
321
+ const wrap = cn(orientation === "inline" ? "" : "mb-2", className);
322
+ if (logo) {
323
+ const logos = Array.isArray(logo) ? logo : [logo];
324
+ return /* @__PURE__ */ jsx("span", {
325
+ "data-slot": "card-media",
326
+ className: cn("inline-flex items-center gap-1.5 shrink-0", wrap),
327
+ children: logos.map((src, i) => /* @__PURE__ */ jsxs("span", {
328
+ className: "inline-flex items-center gap-1.5",
329
+ children: [
330
+ i > 0 && /* @__PURE__ */ jsx("span", {
331
+ "aria-hidden": true,
332
+ className: "w-2 h-px bg-border"
333
+ }),
334
+ /* @__PURE__ */ jsx("img", {
335
+ src,
336
+ alt: logoAlt ?? "",
337
+ width: size,
338
+ height: size,
339
+ className: cn("object-contain", shape.bg),
340
+ style: { width: size, height: size }
341
+ })
342
+ ]
343
+ }, i))
344
+ });
345
+ }
346
+ if (Icon) {
347
+ return /* @__PURE__ */ jsx("span", {
348
+ "data-slot": "card-media",
349
+ className: cn("inline-flex items-center justify-center shrink-0 size-8 bg-hover", shape.bg, wrap),
350
+ children: /* @__PURE__ */ jsx(Icon, {
351
+ size: compact ? 16 : 18,
352
+ strokeWidth: 1.5,
353
+ className: "text-muted-foreground"
354
+ })
355
+ });
356
+ }
357
+ return null;
358
+ }
359
+ function CardImage({ src, alt, className }) {
360
+ const { orientation } = useContext(CardContext);
361
+ return /* @__PURE__ */ jsx("img", {
362
+ src,
363
+ alt: alt ?? "",
364
+ "data-slot": "card-image",
365
+ className: cn("object-cover rounded-xs", orientation === "inline" ? "size-40 shrink-0" : "w-full aspect-[16/9]", className)
366
+ });
367
+ }
368
+ CardImage.displayName = "CardImage";
369
+ var CardEyebrow = forwardRef(({ className, ...props }, ref) => {
370
+ const compact = useSize().variant === "compact";
371
+ return /* @__PURE__ */ jsx("span", {
372
+ ref,
373
+ "data-slot": "card-eyebrow",
374
+ className: cn(compact ? "text-caption-compact" : "text-caption", "uppercase tracking-wide text-muted-foreground", "weight-semibold", className),
375
+ ...props
376
+ });
377
+ });
378
+ CardEyebrow.displayName = "CardEyebrow";
379
+ function CardFeature({ icon: Icon, title, description }) {
380
+ const sizeClasses = useSize();
381
+ const compact = sizeClasses.variant === "compact";
382
+ return /* @__PURE__ */ jsxs("div", {
383
+ "data-slot": "card-feature",
384
+ className: cn("flex items-start", sizeClasses.gap),
385
+ children: [
386
+ Icon && /* @__PURE__ */ jsx(Icon, {
387
+ size: sizeClasses.icon,
388
+ strokeWidth: 1.5,
389
+ className: "mt-0.5 shrink-0 text-muted-foreground"
390
+ }),
391
+ /* @__PURE__ */ jsxs("div", {
392
+ className: "flex flex-col gap-0.5 min-w-0",
393
+ children: [
394
+ /* @__PURE__ */ jsx("span", {
395
+ className: cn("text-foreground [text-box:trim-both_cap_alphabetic]", sizeClasses.text, "weight-medium"),
396
+ children: title
397
+ }),
398
+ description && /* @__PURE__ */ jsx("span", {
399
+ className: cn("leading-relaxed text-muted-foreground", compact ? "text-caption-compact" : "text-caption"),
400
+ children: description
401
+ })
402
+ ]
403
+ })
404
+ ]
405
+ });
406
+ }
407
+ var CARD_BUTTON_VARIANTS = {
408
+ primary: "bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80",
409
+ secondary: "bg-accent text-foreground hover:bg-accent/80 active:bg-accent",
410
+ ghost: "text-muted-foreground hover:text-foreground hover:bg-hover active:bg-active",
411
+ link: "text-foreground underline-offset-4 hover:underline !px-0 !h-auto"
412
+ };
413
+ function CardButton({
414
+ children,
415
+ onClick,
416
+ href,
417
+ variant = "ghost",
418
+ icon: Icon,
419
+ iconPosition,
420
+ external = false,
421
+ disabled = false
422
+ }) {
423
+ const shape = useShape();
424
+ const ArrowRight = useIcon("arrow-right");
425
+ const sizeClasses = useSize();
426
+ const compact = sizeClasses.variant === "compact";
427
+ const position = iconPosition ?? (external ? "end" : "start");
428
+ const glyph = Icon ? /* @__PURE__ */ jsx(Icon, {
429
+ size: compact ? 12 : 14,
430
+ strokeWidth: 1.5,
431
+ className: "shrink-0 transition-[stroke-width] duration-fast group-hover/action:stroke-[2]"
432
+ }) : null;
433
+ const externalGlyph = external ? /* @__PURE__ */ jsx(ArrowRight, {
434
+ size: 13,
435
+ strokeWidth: 1.5,
436
+ className: "shrink-0 -rotate-45 transition-[stroke-width] duration-fast group-hover/action:stroke-[2]"
437
+ }) : null;
438
+ const inner = /* @__PURE__ */ jsxs(Fragment, {
439
+ children: [
440
+ position === "start" && glyph,
441
+ /* @__PURE__ */ jsx("span", {
442
+ className: "[text-box:trim-both_cap_alphabetic]",
443
+ children
444
+ }),
445
+ position === "end" && glyph,
446
+ externalGlyph
447
+ ]
448
+ });
449
+ const classes = cn("group/action relative z-30 inline-flex items-center justify-center gap-1.5 h-7 px-2.5 cursor-pointer outline-none", compact ? "text-caption-compact" : "text-caption", "weight-medium", "transition-colors duration-fast", "focus-visible:ring-1 focus-visible:ring-focus-ring", "disabled:opacity-50 disabled:pointer-events-none", shape.button, CARD_BUTTON_VARIANTS[variant]);
450
+ if (href) {
451
+ return /* @__PURE__ */ jsx("a", {
452
+ href,
453
+ onClick,
454
+ target: external ? "_blank" : undefined,
455
+ rel: external ? "noopener noreferrer" : undefined,
456
+ className: classes,
457
+ children: inner
458
+ });
459
+ }
460
+ return /* @__PURE__ */ jsx("button", {
461
+ type: "button",
462
+ onClick,
463
+ disabled,
464
+ className: classes,
465
+ children: inner
466
+ });
467
+ }
468
+ Object.assign(Card, {
469
+ Group: CardGroup,
470
+ Header: CardHeader,
471
+ Title: CardTitle,
472
+ Description: CardDescription,
473
+ Action: CardAction,
474
+ Content: CardContent,
475
+ Footer: CardFooter,
476
+ Media: CardMedia,
477
+ Image: CardImage,
478
+ Eyebrow: CardEyebrow,
479
+ Feature: CardFeature,
480
+ Button: CardButton
481
+ });
482
+ var card_default = Card;
483
+
484
+ export { CardGroup, Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter, CardMedia, CardImage, CardEyebrow, CardFeature, CardButton, card_default };
@@ -0,0 +1,63 @@
1
+ import {
2
+ scroll_area_default
3
+ } from "./components-ed7cmssr.js";
4
+ import {
5
+ SURFACE_BG,
6
+ useSurface
7
+ } from "./components-csxz9f52.js";
8
+ import {
9
+ cn
10
+ } from "./components-0f0as45n.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 Code({
44
+ children,
45
+ language = "tsx",
46
+ className
47
+ }) {
48
+ const level = Math.min(useSurface() + 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: cn("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 { Code };