my-you-eye 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.
- package/LICENSE +201 -0
- package/README.md +109 -0
- package/dist/index.d.ts +519 -0
- package/dist/index.js +2225 -0
- package/package.json +68 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2225 @@
|
|
|
1
|
+
// src/lib/cn.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
function cn(...inputs) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// src/ui/spinner/Spinner.tsx
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
var spinnerVariants = cva("animate-spin rounded-full border-2 border-current border-t-transparent", {
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
sm: "size-4",
|
|
16
|
+
md: "size-6",
|
|
17
|
+
lg: "size-8"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: "md"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var Spinner = forwardRef(
|
|
25
|
+
({ className, size, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
role: "status",
|
|
30
|
+
"aria-label": "Loading",
|
|
31
|
+
className: cn(spinnerVariants({ size }), className),
|
|
32
|
+
...props,
|
|
33
|
+
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading..." })
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
Spinner.displayName = "Spinner";
|
|
38
|
+
|
|
39
|
+
// src/ui/button/Button.tsx
|
|
40
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
41
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
42
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
43
|
+
var buttonVariants = cva2(
|
|
44
|
+
"inline-flex items-center justify-center gap-inline rounded-ui font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
45
|
+
{
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
primary: "bg-primary text-primary-fg hover:bg-primary/90",
|
|
49
|
+
secondary: "bg-secondary text-secondary-fg hover:bg-secondary/80",
|
|
50
|
+
ghost: "text-fg hover:bg-secondary",
|
|
51
|
+
danger: "bg-danger text-primary-fg hover:bg-danger/90"
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
sm: "h-8 px-3 text-xs",
|
|
55
|
+
md: "h-10 px-4 text-sm",
|
|
56
|
+
lg: "h-12 px-6 text-base"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: "primary",
|
|
61
|
+
size: "md"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
var Button = forwardRef2(
|
|
66
|
+
({ className, variant, size, loading, disabled, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
ref,
|
|
70
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
71
|
+
disabled: disabled || loading,
|
|
72
|
+
...props,
|
|
73
|
+
children: [
|
|
74
|
+
loading && /* @__PURE__ */ jsx2(Spinner, { size: "sm" }),
|
|
75
|
+
children
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
Button.displayName = "Button";
|
|
81
|
+
|
|
82
|
+
// src/ui/input/Input.tsx
|
|
83
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
84
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
85
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
86
|
+
var inputVariants = cva3(
|
|
87
|
+
"flex w-full rounded-ui border bg-bg px-3 py-2 text-sm ring-offset-bg placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
88
|
+
{
|
|
89
|
+
variants: {
|
|
90
|
+
variant: {
|
|
91
|
+
default: "border-border",
|
|
92
|
+
filled: "border-transparent bg-secondary"
|
|
93
|
+
},
|
|
94
|
+
size: {
|
|
95
|
+
sm: "h-8 text-xs",
|
|
96
|
+
md: "h-10 text-sm"
|
|
97
|
+
},
|
|
98
|
+
invalid: {
|
|
99
|
+
true: "border-danger ring-danger/30"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
defaultVariants: {
|
|
103
|
+
variant: "default",
|
|
104
|
+
size: "md"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
var Input = forwardRef3(
|
|
109
|
+
({ className, variant, size, invalid, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
110
|
+
"input",
|
|
111
|
+
{
|
|
112
|
+
ref,
|
|
113
|
+
className: cn(inputVariants({ variant, size, invalid }), className),
|
|
114
|
+
...props
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
Input.displayName = "Input";
|
|
119
|
+
|
|
120
|
+
// src/ui/label/Label.tsx
|
|
121
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
122
|
+
import { Root } from "@radix-ui/react-label";
|
|
123
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
124
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
125
|
+
var labelVariants = cva4(
|
|
126
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
127
|
+
);
|
|
128
|
+
var Label = forwardRef4(
|
|
129
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx4(Root, { ref, className: cn(labelVariants(), className), ...props })
|
|
130
|
+
);
|
|
131
|
+
Label.displayName = "Label";
|
|
132
|
+
|
|
133
|
+
// src/ui/card/Card.tsx
|
|
134
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
135
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
136
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
137
|
+
var cardVariants = cva5("rounded-ui bg-bg text-fg", {
|
|
138
|
+
variants: {
|
|
139
|
+
variant: {
|
|
140
|
+
default: "border border-border",
|
|
141
|
+
outlined: "border-2 border-border",
|
|
142
|
+
elevated: "border border-border shadow-lg"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
defaultVariants: {
|
|
146
|
+
variant: "default"
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
var Card = forwardRef5(
|
|
150
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx5("div", { ref, className: cn(cardVariants({ variant }), className), ...props })
|
|
151
|
+
);
|
|
152
|
+
Card.displayName = "Card";
|
|
153
|
+
|
|
154
|
+
// src/ui/card/CardHeader.tsx
|
|
155
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
156
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
157
|
+
var CardHeader = forwardRef6(
|
|
158
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", { ref, className: cn("flex flex-col gap-1.5 p-6", className), ...props })
|
|
159
|
+
);
|
|
160
|
+
CardHeader.displayName = "CardHeader";
|
|
161
|
+
|
|
162
|
+
// src/ui/card/CardTitle.tsx
|
|
163
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
164
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
165
|
+
var CardTitle = forwardRef7(
|
|
166
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx7("h3", { ref, className: cn("text-lg font-semibold leading-tight", className), ...props })
|
|
167
|
+
);
|
|
168
|
+
CardTitle.displayName = "CardTitle";
|
|
169
|
+
|
|
170
|
+
// src/ui/card/CardContent.tsx
|
|
171
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
172
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
173
|
+
var CardContent = forwardRef8(
|
|
174
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
175
|
+
);
|
|
176
|
+
CardContent.displayName = "CardContent";
|
|
177
|
+
|
|
178
|
+
// src/ui/card/CardFooter.tsx
|
|
179
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
180
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
181
|
+
var CardFooter = forwardRef9(
|
|
182
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx9("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
183
|
+
);
|
|
184
|
+
CardFooter.displayName = "CardFooter";
|
|
185
|
+
|
|
186
|
+
// src/ui/badge/Badge.tsx
|
|
187
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
188
|
+
import { cva as cva6 } from "class-variance-authority";
|
|
189
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
190
|
+
var badgeVariants = cva6(
|
|
191
|
+
"inline-flex items-center rounded-ui-sm px-2.5 py-0.5 text-xs font-medium",
|
|
192
|
+
{
|
|
193
|
+
variants: {
|
|
194
|
+
variant: {
|
|
195
|
+
neutral: ["text-secondary-fg", "bg-secondary/60"],
|
|
196
|
+
primary: ["text-primary", "bg-primary/15"],
|
|
197
|
+
success: ["text-success", "bg-success/15"],
|
|
198
|
+
warning: ["text-warning", "bg-warning/15"],
|
|
199
|
+
danger: ["text-danger", "bg-danger/15"]
|
|
200
|
+
},
|
|
201
|
+
style: {
|
|
202
|
+
solid: "",
|
|
203
|
+
soft: ""
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
compoundVariants: [
|
|
207
|
+
{
|
|
208
|
+
style: "solid",
|
|
209
|
+
variant: "neutral",
|
|
210
|
+
className: "bg-secondary text-secondary-fg"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
style: "solid",
|
|
214
|
+
variant: "primary",
|
|
215
|
+
className: "bg-primary text-primary-fg"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
style: "solid",
|
|
219
|
+
variant: "success",
|
|
220
|
+
className: "bg-success text-bg"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
style: "solid",
|
|
224
|
+
variant: "warning",
|
|
225
|
+
className: "bg-warning text-bg"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
style: "solid",
|
|
229
|
+
variant: "danger",
|
|
230
|
+
className: "bg-danger text-primary-fg"
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
defaultVariants: {
|
|
234
|
+
variant: "neutral",
|
|
235
|
+
style: "solid"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
var Badge = forwardRef10(
|
|
240
|
+
({ className, variant, style, ...props }, ref) => /* @__PURE__ */ jsx10("span", { ref, className: cn(badgeVariants({ variant, style }), className), ...props })
|
|
241
|
+
);
|
|
242
|
+
Badge.displayName = "Badge";
|
|
243
|
+
|
|
244
|
+
// src/ui/alert/Alert.tsx
|
|
245
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
246
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
247
|
+
import { jsx as jsx11, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
248
|
+
var alertVariants = cva7(
|
|
249
|
+
"relative w-full rounded-ui border p-panel",
|
|
250
|
+
{
|
|
251
|
+
variants: {
|
|
252
|
+
variant: {
|
|
253
|
+
info: "border-primary/20 bg-primary/5 text-primary",
|
|
254
|
+
success: "border-success/20 bg-success/5 text-success",
|
|
255
|
+
warning: "border-warning/20 bg-warning/5 text-warning",
|
|
256
|
+
danger: "border-danger/20 bg-danger/5 text-danger"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
defaultVariants: {
|
|
260
|
+
variant: "info"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
var Alert = forwardRef11(
|
|
265
|
+
({ className, variant, title, icon, children, ...props }, ref) => /* @__PURE__ */ jsx11("div", { ref, role: "alert", className: cn(alertVariants({ variant }), className), ...props, children: /* @__PURE__ */ jsxs2("div", { className: "flex gap-stack", children: [
|
|
266
|
+
icon && /* @__PURE__ */ jsx11("span", { className: "mt-0.5 shrink-0", children: icon }),
|
|
267
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-tight", children: [
|
|
268
|
+
title && /* @__PURE__ */ jsx11("h5", { className: "text-sm font-semibold", children: title }),
|
|
269
|
+
/* @__PURE__ */ jsx11("div", { className: "text-sm", children })
|
|
270
|
+
] })
|
|
271
|
+
] }) })
|
|
272
|
+
);
|
|
273
|
+
Alert.displayName = "Alert";
|
|
274
|
+
|
|
275
|
+
// src/ui/checkbox/Checkbox.tsx
|
|
276
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
277
|
+
import { Root as Root2, Indicator } from "@radix-ui/react-checkbox";
|
|
278
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
279
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
280
|
+
var checkboxVariants = cva8(
|
|
281
|
+
"peer shrink-0 rounded-ui-sm border border-border bg-bg ring-offset-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-fg data-[state=checked]:border-primary",
|
|
282
|
+
{
|
|
283
|
+
variants: {
|
|
284
|
+
size: {
|
|
285
|
+
sm: "size-4",
|
|
286
|
+
md: "size-5"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
defaultVariants: {
|
|
290
|
+
size: "md"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
var Checkbox = forwardRef12(
|
|
295
|
+
({ className, size, ...props }, ref) => /* @__PURE__ */ jsx12(Root2, { ref, className: cn(checkboxVariants({ size }), className), ...props, children: /* @__PURE__ */ jsx12(Indicator, { className: "flex items-center justify-center text-current", children: /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 12 12", className: "size-3 fill-current", children: /* @__PURE__ */ jsx12("path", { d: "M3 6l2 2 4-4", stroke: "currentColor", strokeWidth: "2", fill: "none" }) }) }) })
|
|
296
|
+
);
|
|
297
|
+
Checkbox.displayName = "Checkbox";
|
|
298
|
+
|
|
299
|
+
// src/ui/radio-group/RadioGroup.tsx
|
|
300
|
+
import { forwardRef as forwardRef13 } from "react";
|
|
301
|
+
import { Root as Root3, Item, Indicator as Indicator2 } from "@radix-ui/react-radio-group";
|
|
302
|
+
import { cva as cva9 } from "class-variance-authority";
|
|
303
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
304
|
+
var radioVariants = cva9(
|
|
305
|
+
"aspect-square size-4 rounded-full border border-border bg-bg ring-offset-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary"
|
|
306
|
+
);
|
|
307
|
+
var RadioGroup = forwardRef13(
|
|
308
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx13(Root3, { ref, className: cn("grid gap-inline", className), ...props })
|
|
309
|
+
);
|
|
310
|
+
RadioGroup.displayName = "RadioGroup";
|
|
311
|
+
var RadioGroupItem = forwardRef13(
|
|
312
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx13(Item, { ref, className: cn(radioVariants(), className), ...props, children: /* @__PURE__ */ jsx13(Indicator2, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx13("span", { className: "size-2 rounded-full bg-primary" }) }) })
|
|
313
|
+
);
|
|
314
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
315
|
+
|
|
316
|
+
// src/ui/switch/Switch.tsx
|
|
317
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
318
|
+
import { Root as Root4, Thumb } from "@radix-ui/react-switch";
|
|
319
|
+
import { cva as cva10 } from "class-variance-authority";
|
|
320
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
321
|
+
var switchVariants = cva10(
|
|
322
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent bg-secondary ring-offset-bg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary",
|
|
323
|
+
{
|
|
324
|
+
variants: {
|
|
325
|
+
size: {
|
|
326
|
+
sm: "h-5 w-9",
|
|
327
|
+
md: "h-6 w-11"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
defaultVariants: {
|
|
331
|
+
size: "md"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
var thumbVariants = cva10(
|
|
336
|
+
"pointer-events-none block rounded-full bg-bg shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-full",
|
|
337
|
+
{
|
|
338
|
+
variants: {
|
|
339
|
+
size: {
|
|
340
|
+
sm: "size-4",
|
|
341
|
+
md: "size-5"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
defaultVariants: {
|
|
345
|
+
size: "md"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
var Switch = forwardRef14(
|
|
350
|
+
({ className, size, ...props }, ref) => /* @__PURE__ */ jsx14(Root4, { ref, className: cn(switchVariants({ size }), className), ...props, children: /* @__PURE__ */ jsx14(Thumb, { className: cn(thumbVariants({ size })) }) })
|
|
351
|
+
);
|
|
352
|
+
Switch.displayName = "Switch";
|
|
353
|
+
|
|
354
|
+
// src/ui/textarea/Textarea.tsx
|
|
355
|
+
import { forwardRef as forwardRef15, useRef, useEffect, useCallback } from "react";
|
|
356
|
+
import { cva as cva11 } from "class-variance-authority";
|
|
357
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
358
|
+
var textareaVariants = cva11(
|
|
359
|
+
"flex w-full rounded-ui border bg-bg px-3 py-2 text-sm ring-offset-bg placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
360
|
+
{
|
|
361
|
+
variants: {
|
|
362
|
+
variant: {
|
|
363
|
+
default: "border-border",
|
|
364
|
+
filled: "border-transparent bg-secondary"
|
|
365
|
+
},
|
|
366
|
+
invalid: {
|
|
367
|
+
true: "border-danger ring-danger/30"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
defaultVariants: {
|
|
371
|
+
variant: "default"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
var Textarea = forwardRef15(
|
|
376
|
+
({ className, variant, invalid, autoResize, ...props }, ref) => {
|
|
377
|
+
const internalRef = useRef(null);
|
|
378
|
+
const setRef = useCallback(
|
|
379
|
+
(node) => {
|
|
380
|
+
internalRef.current = node;
|
|
381
|
+
if (typeof ref === "function") ref(node);
|
|
382
|
+
else if (ref) ref.current = node;
|
|
383
|
+
},
|
|
384
|
+
[ref]
|
|
385
|
+
);
|
|
386
|
+
useEffect(() => {
|
|
387
|
+
if (!autoResize || !internalRef.current) return;
|
|
388
|
+
const el = internalRef.current;
|
|
389
|
+
el.style.height = "auto";
|
|
390
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
391
|
+
}, [autoResize]);
|
|
392
|
+
return /* @__PURE__ */ jsx15(
|
|
393
|
+
"textarea",
|
|
394
|
+
{
|
|
395
|
+
ref: setRef,
|
|
396
|
+
className: cn(textareaVariants({ variant, invalid }), "min-h-[80px]", className),
|
|
397
|
+
...props
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
Textarea.displayName = "Textarea";
|
|
403
|
+
|
|
404
|
+
// src/ui/select/Select.tsx
|
|
405
|
+
import { forwardRef as forwardRef16 } from "react";
|
|
406
|
+
import {
|
|
407
|
+
Root as Root5,
|
|
408
|
+
Trigger,
|
|
409
|
+
Value,
|
|
410
|
+
Icon,
|
|
411
|
+
Content,
|
|
412
|
+
Viewport,
|
|
413
|
+
Item as Item2,
|
|
414
|
+
ItemText,
|
|
415
|
+
ItemIndicator
|
|
416
|
+
} from "@radix-ui/react-select";
|
|
417
|
+
import { cva as cva12 } from "class-variance-authority";
|
|
418
|
+
import { jsx as jsx16, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
419
|
+
var triggerVariants = cva12(
|
|
420
|
+
"flex w-full items-center justify-between rounded-ui border bg-bg px-3 py-2 text-sm ring-offset-bg placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted",
|
|
421
|
+
{
|
|
422
|
+
variants: {
|
|
423
|
+
size: {
|
|
424
|
+
sm: "h-8 text-xs",
|
|
425
|
+
md: "h-10 text-sm"
|
|
426
|
+
},
|
|
427
|
+
invalid: {
|
|
428
|
+
true: "border-danger ring-danger/30"
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
defaultVariants: {
|
|
432
|
+
size: "md"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
var SelectTrigger = forwardRef16(
|
|
437
|
+
({ className, size, invalid, children, ...props }, ref) => /* @__PURE__ */ jsxs3(Trigger, { ref, className: cn(triggerVariants({ size, invalid }), className), ...props, children: [
|
|
438
|
+
children,
|
|
439
|
+
/* @__PURE__ */ jsx16(Icon, { className: "ml-2 shrink-0 opacity-50", children: /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 8 8", className: "size-3 fill-current", children: /* @__PURE__ */ jsx16("path", { d: "M0 2l4 4 4-4" }) }) })
|
|
440
|
+
] })
|
|
441
|
+
);
|
|
442
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
443
|
+
var SelectContent = forwardRef16(
|
|
444
|
+
({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
445
|
+
Content,
|
|
446
|
+
{
|
|
447
|
+
ref,
|
|
448
|
+
position,
|
|
449
|
+
className: cn(
|
|
450
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-ui border border-border bg-bg text-fg shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
451
|
+
className
|
|
452
|
+
),
|
|
453
|
+
...props,
|
|
454
|
+
children: /* @__PURE__ */ jsx16(Viewport, { className: "p-1", children })
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
);
|
|
458
|
+
SelectContent.displayName = "SelectContent";
|
|
459
|
+
var SelectItem = forwardRef16(
|
|
460
|
+
({ className, children, showIndicator = true, ...props }, ref) => /* @__PURE__ */ jsxs3(
|
|
461
|
+
Item2,
|
|
462
|
+
{
|
|
463
|
+
ref,
|
|
464
|
+
className: cn(
|
|
465
|
+
"relative flex w-full cursor-default select-none items-center rounded-ui-sm py-1.5 pr-2 text-sm outline-none focus:bg-secondary focus:text-secondary-fg data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
466
|
+
showIndicator ? "pl-8" : "pl-2",
|
|
467
|
+
className
|
|
468
|
+
),
|
|
469
|
+
...props,
|
|
470
|
+
children: [
|
|
471
|
+
showIndicator && /* @__PURE__ */ jsx16("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx16(ItemIndicator, { children: /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 8 8", className: "size-3 fill-current", children: /* @__PURE__ */ jsx16("path", { d: "M1 4l2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) }) }),
|
|
472
|
+
/* @__PURE__ */ jsx16(ItemText, { children })
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
);
|
|
477
|
+
SelectItem.displayName = "SelectItem";
|
|
478
|
+
|
|
479
|
+
// src/ui/patterns/form-field/FormField.tsx
|
|
480
|
+
import { forwardRef as forwardRef17, useId } from "react";
|
|
481
|
+
import { jsx as jsx17, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
482
|
+
var FormField = forwardRef17(
|
|
483
|
+
({ label, error, hint, required, className, children, ...props }, ref) => {
|
|
484
|
+
const id = useId();
|
|
485
|
+
return /* @__PURE__ */ jsxs4("div", { ref, className: cn("flex flex-col gap-1.5", className), ...props, children: [
|
|
486
|
+
/* @__PURE__ */ jsxs4(Label, { htmlFor: id, children: [
|
|
487
|
+
label,
|
|
488
|
+
required && /* @__PURE__ */ jsx17("span", { className: "ml-1 text-danger", children: "*" })
|
|
489
|
+
] }),
|
|
490
|
+
children,
|
|
491
|
+
hint && !error && /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted", children: hint }),
|
|
492
|
+
error && /* @__PURE__ */ jsx17("p", { className: "text-xs text-danger", children: error })
|
|
493
|
+
] });
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
FormField.displayName = "FormField";
|
|
497
|
+
|
|
498
|
+
// src/ui/dialog/Dialog.tsx
|
|
499
|
+
import { forwardRef as forwardRef18 } from "react";
|
|
500
|
+
import { Root as Root6, Trigger as Trigger2, Portal, Overlay, Content as Content2, Title, Description, Close } from "@radix-ui/react-dialog";
|
|
501
|
+
import { cva as cva13 } from "class-variance-authority";
|
|
502
|
+
import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
503
|
+
var dialogOverlay = "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out";
|
|
504
|
+
var dialogContentVariants = cva13(
|
|
505
|
+
"fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-ui bg-bg p-6 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
506
|
+
{
|
|
507
|
+
variants: {
|
|
508
|
+
size: {
|
|
509
|
+
sm: "max-w-sm",
|
|
510
|
+
md: "max-w-md",
|
|
511
|
+
lg: "max-w-lg"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
defaultVariants: {
|
|
515
|
+
size: "md"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
var DialogContent = forwardRef18(
|
|
520
|
+
({ className, size, children, ...props }, ref) => /* @__PURE__ */ jsxs5(Portal, { children: [
|
|
521
|
+
/* @__PURE__ */ jsx18(Overlay, { className: dialogOverlay }),
|
|
522
|
+
/* @__PURE__ */ jsxs5(Content2, { ref, className: cn(dialogContentVariants({ size }), className), ...props, children: [
|
|
523
|
+
children,
|
|
524
|
+
/* @__PURE__ */ jsx18(Close, { className: "absolute right-panel top-panel rounded-ui-sm opacity-70 hover:opacity-100", children: /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 15 15", className: "size-4 fill-current", children: /* @__PURE__ */ jsx18("path", { d: "M2 2l11 11M13 2L2 13", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) })
|
|
525
|
+
] })
|
|
526
|
+
] })
|
|
527
|
+
);
|
|
528
|
+
DialogContent.displayName = "DialogContent";
|
|
529
|
+
var DialogHeader = forwardRef18(
|
|
530
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx18("div", { ref, className: cn("flex flex-col gap-1.5 mb-4", className), ...props })
|
|
531
|
+
);
|
|
532
|
+
DialogHeader.displayName = "DialogHeader";
|
|
533
|
+
var DialogTitle = forwardRef18(
|
|
534
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx18(Title, { ref, className: cn("text-lg font-semibold leading-tight", className), ...props })
|
|
535
|
+
);
|
|
536
|
+
DialogTitle.displayName = "DialogTitle";
|
|
537
|
+
var DialogDescription = forwardRef18(
|
|
538
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx18(Description, { ref, className: cn("text-sm text-muted", className), ...props })
|
|
539
|
+
);
|
|
540
|
+
DialogDescription.displayName = "DialogDescription";
|
|
541
|
+
var DialogFooter = forwardRef18(
|
|
542
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx18("div", { ref, className: cn("flex items-center justify-end gap-inline mt-6", className), ...props })
|
|
543
|
+
);
|
|
544
|
+
DialogFooter.displayName = "DialogFooter";
|
|
545
|
+
|
|
546
|
+
// src/ui/tooltip/Tooltip.tsx
|
|
547
|
+
import { forwardRef as forwardRef19 } from "react";
|
|
548
|
+
import { Provider, Root as Root7, Trigger as Trigger3, Portal as Portal2, Content as Content3 } from "@radix-ui/react-tooltip";
|
|
549
|
+
import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
550
|
+
var TooltipProvider = Provider;
|
|
551
|
+
var Tooltip = ({ content, side = "top", children }) => /* @__PURE__ */ jsxs6(Root7, { children: [
|
|
552
|
+
/* @__PURE__ */ jsx19(Trigger3, { asChild: true, children }),
|
|
553
|
+
/* @__PURE__ */ jsx19(Portal2, { children: /* @__PURE__ */ jsx19(
|
|
554
|
+
Content3,
|
|
555
|
+
{
|
|
556
|
+
side,
|
|
557
|
+
sideOffset: 4,
|
|
558
|
+
className: cn(
|
|
559
|
+
"z-50 overflow-hidden rounded-ui-sm bg-bg text-fg border border-border px-2.5 py-1 text-xs shadow-lg",
|
|
560
|
+
"data-[state=delayed-open]:animate-in data-[state=closed]:animate-out"
|
|
561
|
+
),
|
|
562
|
+
children: content
|
|
563
|
+
}
|
|
564
|
+
) })
|
|
565
|
+
] });
|
|
566
|
+
var TooltipContent = forwardRef19(
|
|
567
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx19(
|
|
568
|
+
Content3,
|
|
569
|
+
{
|
|
570
|
+
ref,
|
|
571
|
+
sideOffset: 4,
|
|
572
|
+
className: cn(
|
|
573
|
+
"z-50 overflow-hidden rounded-ui-sm bg-bg text-fg border border-border px-2.5 py-1 text-xs shadow-lg",
|
|
574
|
+
"data-[state=delayed-open]:animate-in data-[state=closed]:animate-out",
|
|
575
|
+
className
|
|
576
|
+
),
|
|
577
|
+
...props
|
|
578
|
+
}
|
|
579
|
+
)
|
|
580
|
+
);
|
|
581
|
+
TooltipContent.displayName = "TooltipContent";
|
|
582
|
+
|
|
583
|
+
// src/ui/dropdown-menu/DropdownMenu.tsx
|
|
584
|
+
import { forwardRef as forwardRef20 } from "react";
|
|
585
|
+
import {
|
|
586
|
+
Root as Root8,
|
|
587
|
+
Trigger as Trigger4,
|
|
588
|
+
Portal as Portal3,
|
|
589
|
+
Content as Content4,
|
|
590
|
+
Item as Item3,
|
|
591
|
+
Separator,
|
|
592
|
+
Label as Label2
|
|
593
|
+
} from "@radix-ui/react-dropdown-menu";
|
|
594
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
595
|
+
var DropdownMenuContent = forwardRef20(
|
|
596
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20(Portal3, { children: /* @__PURE__ */ jsx20(
|
|
597
|
+
Content4,
|
|
598
|
+
{
|
|
599
|
+
ref,
|
|
600
|
+
sideOffset: 4,
|
|
601
|
+
className: cn(
|
|
602
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-ui border border-border bg-bg p-1 shadow-lg",
|
|
603
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
604
|
+
className
|
|
605
|
+
),
|
|
606
|
+
...props
|
|
607
|
+
}
|
|
608
|
+
) })
|
|
609
|
+
);
|
|
610
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
611
|
+
var DropdownMenuItem = forwardRef20(
|
|
612
|
+
({ className, destructive, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
613
|
+
Item3,
|
|
614
|
+
{
|
|
615
|
+
ref,
|
|
616
|
+
className: cn(
|
|
617
|
+
"relative flex cursor-default select-none items-center rounded-ui-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
618
|
+
destructive ? "text-danger focus:bg-danger/10" : "text-fg focus:bg-secondary focus:text-secondary-fg",
|
|
619
|
+
className
|
|
620
|
+
),
|
|
621
|
+
...props
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
);
|
|
625
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
626
|
+
var DropdownMenuSeparator = forwardRef20(
|
|
627
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20(Separator, { ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props })
|
|
628
|
+
);
|
|
629
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
630
|
+
var DropdownMenuLabel = forwardRef20(
|
|
631
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx20(Label2, { ref, className: cn("px-2 py-1.5 text-xs font-semibold text-muted", className), ...props })
|
|
632
|
+
);
|
|
633
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
634
|
+
|
|
635
|
+
// src/ui/popover/Popover.tsx
|
|
636
|
+
import { forwardRef as forwardRef21 } from "react";
|
|
637
|
+
import { Root as Root9, Trigger as Trigger5, Portal as Portal4, Content as Content5, Close as Close2 } from "@radix-ui/react-popover";
|
|
638
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
639
|
+
var PopoverContent = forwardRef21(
|
|
640
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx21(Portal4, { children: /* @__PURE__ */ jsx21(
|
|
641
|
+
Content5,
|
|
642
|
+
{
|
|
643
|
+
ref,
|
|
644
|
+
sideOffset: 4,
|
|
645
|
+
className: cn(
|
|
646
|
+
"z-50 w-72 rounded-ui border border-border bg-bg p-panel shadow-lg outline-none",
|
|
647
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
648
|
+
className
|
|
649
|
+
),
|
|
650
|
+
...props
|
|
651
|
+
}
|
|
652
|
+
) })
|
|
653
|
+
);
|
|
654
|
+
PopoverContent.displayName = "PopoverContent";
|
|
655
|
+
|
|
656
|
+
// src/ui/toast/Toast.tsx
|
|
657
|
+
import { forwardRef as forwardRef22, useCallback as useCallback2, useState, createContext, useContext } from "react";
|
|
658
|
+
import {
|
|
659
|
+
Provider as Provider2,
|
|
660
|
+
Root as Root10,
|
|
661
|
+
Title as Title2,
|
|
662
|
+
Description as Description2,
|
|
663
|
+
Close as Close3,
|
|
664
|
+
Viewport as Viewport2
|
|
665
|
+
} from "@radix-ui/react-toast";
|
|
666
|
+
import { cva as cva14 } from "class-variance-authority";
|
|
667
|
+
import { jsx as jsx22, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
668
|
+
var toastVariants = cva14(
|
|
669
|
+
"group pointer-events-auto relative flex w-full items-center justify-between gap-stack rounded-ui border p-panel shadow-lg data-[swipe=end]:animate-out data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0",
|
|
670
|
+
{
|
|
671
|
+
variants: {
|
|
672
|
+
variant: {
|
|
673
|
+
default: "border-border bg-bg text-fg",
|
|
674
|
+
success: "border-success/30 bg-success/10 text-success",
|
|
675
|
+
danger: "border-danger/30 bg-danger/10 text-danger"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
defaultVariants: {
|
|
679
|
+
variant: "default"
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
var ToastContext = createContext(null);
|
|
684
|
+
function useToast() {
|
|
685
|
+
const ctx = useContext(ToastContext);
|
|
686
|
+
if (!ctx) throw new Error("useToast must be used within <Toaster />");
|
|
687
|
+
return ctx;
|
|
688
|
+
}
|
|
689
|
+
var ToastItem = forwardRef22(
|
|
690
|
+
({ title, description, variant = "default", ...props }, ref) => /* @__PURE__ */ jsxs7(
|
|
691
|
+
Root10,
|
|
692
|
+
{
|
|
693
|
+
ref,
|
|
694
|
+
className: cn(toastVariants({ variant })),
|
|
695
|
+
...props,
|
|
696
|
+
children: [
|
|
697
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
698
|
+
title && /* @__PURE__ */ jsx22(Title2, { className: "text-sm font-semibold", children: title }),
|
|
699
|
+
description && /* @__PURE__ */ jsx22(Description2, { className: "text-sm opacity-90", children: description })
|
|
700
|
+
] }),
|
|
701
|
+
/* @__PURE__ */ jsx22(Close3, { className: "shrink-0 opacity-dim hover:opacity-100", children: /* @__PURE__ */ jsx22("svg", { viewBox: "0 0 15 15", className: "size-4 fill-current", children: /* @__PURE__ */ jsx22("path", { d: "M2 2l11 11M13 2L2 13", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) })
|
|
702
|
+
]
|
|
703
|
+
}
|
|
704
|
+
)
|
|
705
|
+
);
|
|
706
|
+
ToastItem.displayName = "ToastItem";
|
|
707
|
+
function Toaster({ children }) {
|
|
708
|
+
const [toasts, setToasts] = useState([]);
|
|
709
|
+
const toast = useCallback2(
|
|
710
|
+
(data) => {
|
|
711
|
+
const id = Math.random().toString(36).slice(2);
|
|
712
|
+
setToasts((prev) => [...prev, { ...data, id }]);
|
|
713
|
+
setTimeout(() => {
|
|
714
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
715
|
+
}, 5e3);
|
|
716
|
+
},
|
|
717
|
+
[]
|
|
718
|
+
);
|
|
719
|
+
return /* @__PURE__ */ jsxs7(ToastContext.Provider, { value: { toast }, children: [
|
|
720
|
+
children,
|
|
721
|
+
/* @__PURE__ */ jsxs7(Provider2, { children: [
|
|
722
|
+
toasts.map((t) => /* @__PURE__ */ jsx22(ToastItem, { ...t }, t.id)),
|
|
723
|
+
/* @__PURE__ */ jsx22(Viewport2, { className: "fixed bottom-panel right-panel z-[100] flex flex-col gap-inline w-full max-w-sm" })
|
|
724
|
+
] })
|
|
725
|
+
] });
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// src/ui/patterns/confirm-dialog/ConfirmDialog.tsx
|
|
729
|
+
import { jsx as jsx23, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
730
|
+
function ConfirmDialog({
|
|
731
|
+
title,
|
|
732
|
+
description,
|
|
733
|
+
confirmLabel = "Confirm",
|
|
734
|
+
destructive,
|
|
735
|
+
onConfirm,
|
|
736
|
+
trigger,
|
|
737
|
+
open,
|
|
738
|
+
onOpenChange
|
|
739
|
+
}) {
|
|
740
|
+
return /* @__PURE__ */ jsxs8(Root6, { open, onOpenChange, children: [
|
|
741
|
+
trigger && /* @__PURE__ */ jsx23(Trigger2, { asChild: true, children: trigger }),
|
|
742
|
+
/* @__PURE__ */ jsxs8(DialogContent, { size: "sm", children: [
|
|
743
|
+
/* @__PURE__ */ jsxs8(DialogHeader, { children: [
|
|
744
|
+
/* @__PURE__ */ jsx23(DialogTitle, { children: title }),
|
|
745
|
+
description && /* @__PURE__ */ jsx23(DialogDescription, { children: description })
|
|
746
|
+
] }),
|
|
747
|
+
/* @__PURE__ */ jsxs8(DialogFooter, { children: [
|
|
748
|
+
/* @__PURE__ */ jsx23(Close, { asChild: true, children: /* @__PURE__ */ jsx23(Button, { variant: "ghost", children: "Cancel" }) }),
|
|
749
|
+
/* @__PURE__ */ jsx23(Button, { variant: destructive ? "danger" : "primary", onClick: onConfirm, children: confirmLabel })
|
|
750
|
+
] })
|
|
751
|
+
] })
|
|
752
|
+
] });
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// src/ui/tabs/Tabs.tsx
|
|
756
|
+
import { forwardRef as forwardRef23 } from "react";
|
|
757
|
+
import { Root as Root11, List, Trigger as Trigger6, Content as Content6 } from "@radix-ui/react-tabs";
|
|
758
|
+
import { cva as cva15 } from "class-variance-authority";
|
|
759
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
760
|
+
var tabsListVariants = cva15("inline-flex items-center", {
|
|
761
|
+
variants: {
|
|
762
|
+
variant: {
|
|
763
|
+
underline: "border-b border-border gap-0",
|
|
764
|
+
pills: "gap-1"
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
defaultVariants: {
|
|
768
|
+
variant: "underline"
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
var tabsTriggerVariants = cva15(
|
|
772
|
+
"inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-bg transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
773
|
+
{
|
|
774
|
+
variants: {
|
|
775
|
+
variant: {
|
|
776
|
+
underline: "border-b-2 border-transparent px-3 py-2 -mb-px data-[state=active]:border-primary data-[state=active]:text-primary",
|
|
777
|
+
pills: "rounded-ui-sm px-3 py-1.5 data-[state=active]:bg-primary data-[state=active]:text-primary-fg"
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
defaultVariants: {
|
|
781
|
+
variant: "underline"
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
);
|
|
785
|
+
var Tabs = Root11;
|
|
786
|
+
var TabsList = forwardRef23(
|
|
787
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx24(List, { ref, className: cn(tabsListVariants({ variant }), className), ...props })
|
|
788
|
+
);
|
|
789
|
+
TabsList.displayName = "TabsList";
|
|
790
|
+
var TabsTrigger = forwardRef23(
|
|
791
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx24(Trigger6, { ref, className: cn(tabsTriggerVariants({ variant }), className), ...props })
|
|
792
|
+
);
|
|
793
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
794
|
+
var TabsContent = forwardRef23(
|
|
795
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx24(Content6, { ref, className: cn("mt-2 ring-offset-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), ...props })
|
|
796
|
+
);
|
|
797
|
+
TabsContent.displayName = "TabsContent";
|
|
798
|
+
|
|
799
|
+
// src/ui/breadcrumbs/Breadcrumbs.tsx
|
|
800
|
+
import { forwardRef as forwardRef24 } from "react";
|
|
801
|
+
import { jsx as jsx25, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
802
|
+
var Breadcrumbs = forwardRef24(
|
|
803
|
+
({ items, separator = "/", className, ...props }, ref) => /* @__PURE__ */ jsx25("nav", { ref, "aria-label": "Breadcrumb", className: cn("flex items-center gap-tight text-sm", className), ...props, children: /* @__PURE__ */ jsx25("ol", { className: "flex items-center gap-tight", children: items.map((item, i) => {
|
|
804
|
+
const isLast = i === items.length - 1;
|
|
805
|
+
return /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-tight", children: [
|
|
806
|
+
i > 0 && /* @__PURE__ */ jsx25("span", { className: "text-muted", children: separator }),
|
|
807
|
+
item.href && !isLast ? /* @__PURE__ */ jsx25("a", { href: item.href, className: "text-muted hover:text-fg transition-colors", children: item.label }) : /* @__PURE__ */ jsx25("span", { className: isLast ? "text-fg font-medium" : "text-muted", children: item.label })
|
|
808
|
+
] }, i);
|
|
809
|
+
}) }) })
|
|
810
|
+
);
|
|
811
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
812
|
+
|
|
813
|
+
// src/ui/pagination/Pagination.tsx
|
|
814
|
+
import { forwardRef as forwardRef25 } from "react";
|
|
815
|
+
import { jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
816
|
+
function getPageNumbers(current, total) {
|
|
817
|
+
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
818
|
+
const pages = [];
|
|
819
|
+
if (current <= 3) {
|
|
820
|
+
pages.push(1, 2, 3, "...", total);
|
|
821
|
+
} else if (current >= total - 2) {
|
|
822
|
+
pages.push(1, "...", total - 2, total - 1, total);
|
|
823
|
+
} else {
|
|
824
|
+
pages.push(1, "...", current - 1, current, current + 1, "...", total);
|
|
825
|
+
}
|
|
826
|
+
return pages;
|
|
827
|
+
}
|
|
828
|
+
var Pagination = forwardRef25(
|
|
829
|
+
({ currentPage, totalPages, onPageChange, className, ...props }, ref) => /* @__PURE__ */ jsxs10("nav", { ref, "aria-label": "Pagination", className: cn("flex items-center gap-tight", className), ...props, children: [
|
|
830
|
+
/* @__PURE__ */ jsx26(
|
|
831
|
+
Button,
|
|
832
|
+
{
|
|
833
|
+
variant: "ghost",
|
|
834
|
+
size: "sm",
|
|
835
|
+
disabled: currentPage <= 1,
|
|
836
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
837
|
+
children: "Prev"
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
getPageNumbers(currentPage, totalPages).map(
|
|
841
|
+
(page, i) => page === "..." ? /* @__PURE__ */ jsx26("span", { className: "px-2 text-muted text-sm", children: "..." }, `ellipsis-${i}`) : /* @__PURE__ */ jsx26(
|
|
842
|
+
Button,
|
|
843
|
+
{
|
|
844
|
+
variant: page === currentPage ? "primary" : "ghost",
|
|
845
|
+
size: "sm",
|
|
846
|
+
onClick: () => onPageChange(page),
|
|
847
|
+
children: page
|
|
848
|
+
},
|
|
849
|
+
page
|
|
850
|
+
)
|
|
851
|
+
),
|
|
852
|
+
/* @__PURE__ */ jsx26(
|
|
853
|
+
Button,
|
|
854
|
+
{
|
|
855
|
+
variant: "ghost",
|
|
856
|
+
size: "sm",
|
|
857
|
+
disabled: currentPage >= totalPages,
|
|
858
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
859
|
+
children: "Next"
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
] })
|
|
863
|
+
);
|
|
864
|
+
Pagination.displayName = "Pagination";
|
|
865
|
+
|
|
866
|
+
// src/ui/avatar/Avatar.tsx
|
|
867
|
+
import { forwardRef as forwardRef26 } from "react";
|
|
868
|
+
import { Root as Root12, Image, Fallback } from "@radix-ui/react-avatar";
|
|
869
|
+
import { cva as cva16 } from "class-variance-authority";
|
|
870
|
+
import { jsx as jsx27, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
871
|
+
var avatarVariants = cva16(
|
|
872
|
+
"relative flex shrink-0 overflow-hidden rounded-full",
|
|
873
|
+
{
|
|
874
|
+
variants: {
|
|
875
|
+
size: {
|
|
876
|
+
sm: "size-8",
|
|
877
|
+
md: "size-10",
|
|
878
|
+
lg: "size-12"
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
defaultVariants: {
|
|
882
|
+
size: "md"
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
);
|
|
886
|
+
var fallbackVariants = cva16(
|
|
887
|
+
"flex size-full items-center justify-center rounded-full bg-secondary text-secondary-fg font-medium",
|
|
888
|
+
{
|
|
889
|
+
variants: {
|
|
890
|
+
size: {
|
|
891
|
+
sm: "text-xs",
|
|
892
|
+
md: "text-sm",
|
|
893
|
+
lg: "text-base"
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
defaultVariants: {
|
|
897
|
+
size: "md"
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
);
|
|
901
|
+
var Avatar = forwardRef26(
|
|
902
|
+
({ className, size, src, alt, fallback, ...props }, ref) => /* @__PURE__ */ jsxs11(Root12, { ref, className: cn(avatarVariants({ size }), className), ...props, children: [
|
|
903
|
+
src && /* @__PURE__ */ jsx27(Image, { src, alt, className: "size-full object-cover" }),
|
|
904
|
+
/* @__PURE__ */ jsx27(Fallback, { className: cn(fallbackVariants({ size })), children: fallback.slice(0, 2).toUpperCase() })
|
|
905
|
+
] })
|
|
906
|
+
);
|
|
907
|
+
Avatar.displayName = "Avatar";
|
|
908
|
+
|
|
909
|
+
// src/ui/skeleton/Skeleton.tsx
|
|
910
|
+
import { forwardRef as forwardRef27 } from "react";
|
|
911
|
+
import { cva as cva17 } from "class-variance-authority";
|
|
912
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
913
|
+
var skeletonVariants = cva17("animate-pulse bg-secondary", {
|
|
914
|
+
variants: {
|
|
915
|
+
shape: {
|
|
916
|
+
text: "h-4 w-full rounded-ui-sm",
|
|
917
|
+
circle: "rounded-full",
|
|
918
|
+
rect: "rounded-ui"
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
defaultVariants: {
|
|
922
|
+
shape: "text"
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
var Skeleton = forwardRef27(
|
|
926
|
+
({ className, shape, width, height, style, ...props }, ref) => /* @__PURE__ */ jsx28(
|
|
927
|
+
"div",
|
|
928
|
+
{
|
|
929
|
+
ref,
|
|
930
|
+
className: cn(skeletonVariants({ shape }), className),
|
|
931
|
+
style: { width, height, ...style },
|
|
932
|
+
...props
|
|
933
|
+
}
|
|
934
|
+
)
|
|
935
|
+
);
|
|
936
|
+
Skeleton.displayName = "Skeleton";
|
|
937
|
+
|
|
938
|
+
// src/ui/empty-state/EmptyState.tsx
|
|
939
|
+
import { forwardRef as forwardRef28 } from "react";
|
|
940
|
+
import { jsx as jsx29, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
941
|
+
var EmptyState = forwardRef28(
|
|
942
|
+
({ icon, title, description, action, className, ...props }, ref) => /* @__PURE__ */ jsxs12(
|
|
943
|
+
"div",
|
|
944
|
+
{
|
|
945
|
+
ref,
|
|
946
|
+
className: cn("flex flex-col items-center justify-center py-12 text-center", className),
|
|
947
|
+
...props,
|
|
948
|
+
children: [
|
|
949
|
+
icon && /* @__PURE__ */ jsx29("div", { className: "mb-4 text-muted", children: icon }),
|
|
950
|
+
/* @__PURE__ */ jsx29("h3", { className: "text-lg font-semibold", children: title }),
|
|
951
|
+
description && /* @__PURE__ */ jsx29("p", { className: "mt-1 text-sm text-muted max-w-sm", children: description }),
|
|
952
|
+
action && /* @__PURE__ */ jsx29("div", { className: "mt-4", children: action })
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
)
|
|
956
|
+
);
|
|
957
|
+
EmptyState.displayName = "EmptyState";
|
|
958
|
+
|
|
959
|
+
// src/ui/table/Table.tsx
|
|
960
|
+
import { forwardRef as forwardRef29 } from "react";
|
|
961
|
+
import { cva as cva18 } from "class-variance-authority";
|
|
962
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
963
|
+
var tableVariants = cva18("w-full caption-bottom text-sm", {
|
|
964
|
+
variants: {
|
|
965
|
+
variant: {
|
|
966
|
+
default: "",
|
|
967
|
+
striped: " [&_tbody_tr:nth-child(odd)]:bg-secondary/50"
|
|
968
|
+
},
|
|
969
|
+
density: {
|
|
970
|
+
compact: "",
|
|
971
|
+
normal: ""
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
defaultVariants: {
|
|
975
|
+
variant: "default",
|
|
976
|
+
density: "normal"
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
var Table = forwardRef29(
|
|
980
|
+
({ className, variant, density, ...props }, ref) => /* @__PURE__ */ jsx30("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx30("table", { ref, className: cn(tableVariants({ variant, density }), className), ...props }) })
|
|
981
|
+
);
|
|
982
|
+
Table.displayName = "Table";
|
|
983
|
+
|
|
984
|
+
// src/ui/table/TableHeader.tsx
|
|
985
|
+
import { forwardRef as forwardRef30 } from "react";
|
|
986
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
987
|
+
var TableHeader = forwardRef30(
|
|
988
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx31("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
|
|
989
|
+
);
|
|
990
|
+
TableHeader.displayName = "TableHeader";
|
|
991
|
+
|
|
992
|
+
// src/ui/table/TableBody.tsx
|
|
993
|
+
import { forwardRef as forwardRef31 } from "react";
|
|
994
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
995
|
+
var TableBody = forwardRef31(
|
|
996
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx32("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props })
|
|
997
|
+
);
|
|
998
|
+
TableBody.displayName = "TableBody";
|
|
999
|
+
|
|
1000
|
+
// src/ui/table/TableRow.tsx
|
|
1001
|
+
import { forwardRef as forwardRef32 } from "react";
|
|
1002
|
+
import { cva as cva19 } from "class-variance-authority";
|
|
1003
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1004
|
+
var rowVariants = cva19("border-b transition-colors hover:bg-secondary/50 data-[state=selected]:bg-secondary", {
|
|
1005
|
+
variants: {
|
|
1006
|
+
density: {
|
|
1007
|
+
compact: "",
|
|
1008
|
+
normal: ""
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
defaultVariants: {
|
|
1012
|
+
density: "normal"
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
var TableRow = forwardRef32(
|
|
1016
|
+
({ className, density, ...props }, ref) => /* @__PURE__ */ jsx33("tr", { ref, className: cn(rowVariants({ density }), className), ...props })
|
|
1017
|
+
);
|
|
1018
|
+
TableRow.displayName = "TableRow";
|
|
1019
|
+
|
|
1020
|
+
// src/ui/table/TableHead.tsx
|
|
1021
|
+
import { forwardRef as forwardRef33 } from "react";
|
|
1022
|
+
import { cva as cva20 } from "class-variance-authority";
|
|
1023
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1024
|
+
var headVariants = cva20("text-left font-medium text-muted", {
|
|
1025
|
+
variants: {
|
|
1026
|
+
density: {
|
|
1027
|
+
compact: "h-8 px-2 text-xs",
|
|
1028
|
+
normal: "h-10 px-3 text-sm"
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
defaultVariants: {
|
|
1032
|
+
density: "normal"
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
var TableHead = forwardRef33(
|
|
1036
|
+
({ className, density, ...props }, ref) => /* @__PURE__ */ jsx34("th", { ref, className: cn(headVariants({ density }), className), ...props })
|
|
1037
|
+
);
|
|
1038
|
+
TableHead.displayName = "TableHead";
|
|
1039
|
+
|
|
1040
|
+
// src/ui/table/TableCell.tsx
|
|
1041
|
+
import { forwardRef as forwardRef34 } from "react";
|
|
1042
|
+
import { cva as cva21 } from "class-variance-authority";
|
|
1043
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1044
|
+
var cellVariants = cva21("", {
|
|
1045
|
+
variants: {
|
|
1046
|
+
density: {
|
|
1047
|
+
compact: "p-2 text-xs",
|
|
1048
|
+
normal: "p-3 text-sm"
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
defaultVariants: {
|
|
1052
|
+
density: "normal"
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
var TableCell = forwardRef34(
|
|
1056
|
+
({ className, density, ...props }, ref) => /* @__PURE__ */ jsx35("td", { ref, className: cn(cellVariants({ density }), className), ...props })
|
|
1057
|
+
);
|
|
1058
|
+
TableCell.displayName = "TableCell";
|
|
1059
|
+
|
|
1060
|
+
// src/ui/patterns/page-shell/PageShell.tsx
|
|
1061
|
+
import { forwardRef as forwardRef35 } from "react";
|
|
1062
|
+
import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1063
|
+
var PageShell = forwardRef35(
|
|
1064
|
+
({ title, description, actions, children, className, ...props }, ref) => /* @__PURE__ */ jsxs13("div", { ref, className: cn("flex flex-col gap-6", className), ...props, children: [
|
|
1065
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-tight sm:flex-row sm:items-center sm:justify-between", children: [
|
|
1066
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1067
|
+
/* @__PURE__ */ jsx36("h1", { className: "text-2xl font-bold", children: title }),
|
|
1068
|
+
description && /* @__PURE__ */ jsx36("p", { className: "text-sm text-muted mt-1", children: description })
|
|
1069
|
+
] }),
|
|
1070
|
+
actions && /* @__PURE__ */ jsx36("div", { className: "flex items-center gap-inline mt-2 sm:mt-0", children: actions })
|
|
1071
|
+
] }),
|
|
1072
|
+
/* @__PURE__ */ jsx36("div", { children })
|
|
1073
|
+
] })
|
|
1074
|
+
);
|
|
1075
|
+
PageShell.displayName = "PageShell";
|
|
1076
|
+
|
|
1077
|
+
// src/ui/patterns/toolbar/Toolbar.tsx
|
|
1078
|
+
import { forwardRef as forwardRef36 } from "react";
|
|
1079
|
+
import { jsx as jsx37, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1080
|
+
var Toolbar = forwardRef36(
|
|
1081
|
+
({ search, filters, actions, className, ...props }, ref) => /* @__PURE__ */ jsxs14(
|
|
1082
|
+
"div",
|
|
1083
|
+
{
|
|
1084
|
+
ref,
|
|
1085
|
+
className: cn("flex flex-col gap-stack sm:flex-row sm:items-center sm:justify-between", className),
|
|
1086
|
+
...props,
|
|
1087
|
+
children: [
|
|
1088
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-inline sm:flex-row sm:items-center sm:gap-stack", children: [
|
|
1089
|
+
search && /* @__PURE__ */ jsx37("div", { className: "w-full sm:w-auto", children: search }),
|
|
1090
|
+
filters && /* @__PURE__ */ jsx37("div", { className: "flex items-center gap-inline", children: filters })
|
|
1091
|
+
] }),
|
|
1092
|
+
actions && /* @__PURE__ */ jsx37("div", { className: "flex items-center gap-inline", children: actions })
|
|
1093
|
+
]
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
);
|
|
1097
|
+
Toolbar.displayName = "Toolbar";
|
|
1098
|
+
|
|
1099
|
+
// src/ui/patterns/stat-card/StatCard.tsx
|
|
1100
|
+
import { forwardRef as forwardRef37 } from "react";
|
|
1101
|
+
import { jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1102
|
+
var StatCard = forwardRef37(
|
|
1103
|
+
({ label, value, delta, icon, className, ...props }, ref) => /* @__PURE__ */ jsx38(Card, { ref, className: cn(className), ...props, children: /* @__PURE__ */ jsx38(CardContent, { className: "pt-4", children: /* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between", children: [
|
|
1104
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
1105
|
+
/* @__PURE__ */ jsx38("p", { className: "text-sm text-muted", children: label }),
|
|
1106
|
+
/* @__PURE__ */ jsx38("p", { className: "text-2xl font-bold", children: value }),
|
|
1107
|
+
delta && /* @__PURE__ */ jsxs15("p", { className: "flex items-center gap-1 text-sm", children: [
|
|
1108
|
+
/* @__PURE__ */ jsxs15(
|
|
1109
|
+
Badge,
|
|
1110
|
+
{
|
|
1111
|
+
variant: delta.direction === "up" ? "success" : "danger",
|
|
1112
|
+
style: "soft",
|
|
1113
|
+
children: [
|
|
1114
|
+
delta.direction === "up" ? "\u2191" : "\u2193",
|
|
1115
|
+
" ",
|
|
1116
|
+
delta.value
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
),
|
|
1120
|
+
delta.label && /* @__PURE__ */ jsx38("span", { className: "text-muted", children: delta.label })
|
|
1121
|
+
] })
|
|
1122
|
+
] }),
|
|
1123
|
+
icon && /* @__PURE__ */ jsx38("div", { className: "text-muted", children: icon })
|
|
1124
|
+
] }) }) })
|
|
1125
|
+
);
|
|
1126
|
+
StatCard.displayName = "StatCard";
|
|
1127
|
+
|
|
1128
|
+
// src/ui/separator/Separator.tsx
|
|
1129
|
+
import { forwardRef as forwardRef38 } from "react";
|
|
1130
|
+
import { cva as cva22 } from "class-variance-authority";
|
|
1131
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
1132
|
+
var separatorVariants = cva22("shrink-0 bg-border", {
|
|
1133
|
+
variants: {
|
|
1134
|
+
orientation: {
|
|
1135
|
+
horizontal: "h-px w-full",
|
|
1136
|
+
vertical: "h-full w-px"
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
defaultVariants: {
|
|
1140
|
+
orientation: "horizontal"
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
var Separator2 = forwardRef38(
|
|
1144
|
+
({ className, orientation, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
1145
|
+
"div",
|
|
1146
|
+
{
|
|
1147
|
+
ref,
|
|
1148
|
+
role: "separator",
|
|
1149
|
+
"aria-orientation": orientation === "vertical" ? "vertical" : void 0,
|
|
1150
|
+
className: cn(separatorVariants({ orientation }), className),
|
|
1151
|
+
...props
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1154
|
+
);
|
|
1155
|
+
Separator2.displayName = "Separator";
|
|
1156
|
+
|
|
1157
|
+
// src/ui/progress/Progress.tsx
|
|
1158
|
+
import { forwardRef as forwardRef39 } from "react";
|
|
1159
|
+
import { cva as cva23 } from "class-variance-authority";
|
|
1160
|
+
import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1161
|
+
var barVariants = cva23("h-full rounded-full transition-all duration-300", {
|
|
1162
|
+
variants: {
|
|
1163
|
+
variant: {
|
|
1164
|
+
default: "bg-primary",
|
|
1165
|
+
success: "bg-success",
|
|
1166
|
+
warning: "bg-warning",
|
|
1167
|
+
danger: "bg-danger"
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
defaultVariants: {
|
|
1171
|
+
variant: "default"
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
var Progress = forwardRef39(
|
|
1175
|
+
({ value, variant, label, className, ...props }, ref) => /* @__PURE__ */ jsxs16("div", { className: cn("flex flex-col gap-tight", className), ...props, children: [
|
|
1176
|
+
label && /* @__PURE__ */ jsxs16("div", { className: "flex justify-between text-xs", children: [
|
|
1177
|
+
/* @__PURE__ */ jsx40("span", { className: "text-muted", children: label }),
|
|
1178
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-fg font-medium", children: [
|
|
1179
|
+
Math.round(value),
|
|
1180
|
+
"%"
|
|
1181
|
+
] })
|
|
1182
|
+
] }),
|
|
1183
|
+
/* @__PURE__ */ jsx40("div", { ref, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": 100, className: "h-2 w-full overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsx40(
|
|
1184
|
+
"div",
|
|
1185
|
+
{
|
|
1186
|
+
className: cn(barVariants({ variant })),
|
|
1187
|
+
style: { width: `${Math.min(100, Math.max(0, value))}%` }
|
|
1188
|
+
}
|
|
1189
|
+
) })
|
|
1190
|
+
] })
|
|
1191
|
+
);
|
|
1192
|
+
Progress.displayName = "Progress";
|
|
1193
|
+
|
|
1194
|
+
// src/ui/status-dot/StatusDot.tsx
|
|
1195
|
+
import { forwardRef as forwardRef40 } from "react";
|
|
1196
|
+
import { cva as cva24 } from "class-variance-authority";
|
|
1197
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
1198
|
+
var statusDotVariants = cva24("inline-block shrink-0 rounded-full", {
|
|
1199
|
+
variants: {
|
|
1200
|
+
variant: {
|
|
1201
|
+
neutral: "bg-muted",
|
|
1202
|
+
success: "bg-success",
|
|
1203
|
+
warning: "bg-warning",
|
|
1204
|
+
danger: "bg-danger",
|
|
1205
|
+
info: "bg-primary"
|
|
1206
|
+
},
|
|
1207
|
+
size: {
|
|
1208
|
+
sm: "size-2",
|
|
1209
|
+
md: "size-3"
|
|
1210
|
+
}
|
|
1211
|
+
},
|
|
1212
|
+
defaultVariants: {
|
|
1213
|
+
variant: "neutral",
|
|
1214
|
+
size: "md"
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
var StatusDot = forwardRef40(
|
|
1218
|
+
({ className, variant, size, pulse, ...props }, ref) => /* @__PURE__ */ jsx41(
|
|
1219
|
+
"span",
|
|
1220
|
+
{
|
|
1221
|
+
ref,
|
|
1222
|
+
className: cn(
|
|
1223
|
+
statusDotVariants({ variant, size }),
|
|
1224
|
+
pulse && "animate-pulse",
|
|
1225
|
+
className
|
|
1226
|
+
),
|
|
1227
|
+
...props
|
|
1228
|
+
}
|
|
1229
|
+
)
|
|
1230
|
+
);
|
|
1231
|
+
StatusDot.displayName = "StatusDot";
|
|
1232
|
+
|
|
1233
|
+
// src/ui/kbd/Kbd.tsx
|
|
1234
|
+
import { forwardRef as forwardRef41 } from "react";
|
|
1235
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
1236
|
+
var Kbd = forwardRef41(
|
|
1237
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx42(
|
|
1238
|
+
"kbd",
|
|
1239
|
+
{
|
|
1240
|
+
ref,
|
|
1241
|
+
className: cn(
|
|
1242
|
+
"inline-flex items-center justify-center rounded-ui-sm border border-border bg-secondary px-1.5 py-0.5 text-xs font-mono text-muted shadow-card",
|
|
1243
|
+
className
|
|
1244
|
+
),
|
|
1245
|
+
...props
|
|
1246
|
+
}
|
|
1247
|
+
)
|
|
1248
|
+
);
|
|
1249
|
+
Kbd.displayName = "Kbd";
|
|
1250
|
+
|
|
1251
|
+
// src/ui/code-block/CodeBlock.tsx
|
|
1252
|
+
import { forwardRef as forwardRef42, useState as useState2, useCallback as useCallback3 } from "react";
|
|
1253
|
+
import { cva as cva25 } from "class-variance-authority";
|
|
1254
|
+
import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1255
|
+
var codeBlockVariants = cva25(
|
|
1256
|
+
"group relative overflow-hidden rounded-ui border border-border bg-secondary text-sm",
|
|
1257
|
+
{
|
|
1258
|
+
variants: {
|
|
1259
|
+
variant: {
|
|
1260
|
+
default: "",
|
|
1261
|
+
elevated: "shadow-card"
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
defaultVariants: {
|
|
1265
|
+
variant: "default"
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
);
|
|
1269
|
+
var CodeBlock = forwardRef42(
|
|
1270
|
+
({ className, variant, code, language, header, wrap = true, ...props }, ref) => {
|
|
1271
|
+
const [copied, setCopied] = useState2(false);
|
|
1272
|
+
const copy = useCallback3(() => {
|
|
1273
|
+
navigator.clipboard.writeText(code).then(() => {
|
|
1274
|
+
setCopied(true);
|
|
1275
|
+
setTimeout(() => setCopied(false), 1500);
|
|
1276
|
+
});
|
|
1277
|
+
}, [code]);
|
|
1278
|
+
return /* @__PURE__ */ jsxs17("div", { className: cn(codeBlockVariants({ variant }), className), children: [
|
|
1279
|
+
(header || language) && /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between px-compact-x py-compact-y border-b border-border text-xs text-muted", children: [
|
|
1280
|
+
/* @__PURE__ */ jsx43("span", { children: header }),
|
|
1281
|
+
language && /* @__PURE__ */ jsx43("span", { className: "font-mono uppercase", children: language })
|
|
1282
|
+
] }),
|
|
1283
|
+
/* @__PURE__ */ jsx43(
|
|
1284
|
+
"button",
|
|
1285
|
+
{
|
|
1286
|
+
type: "button",
|
|
1287
|
+
onClick: copy,
|
|
1288
|
+
className: "absolute top-1.5 right-1.5 z-10 size-7 rounded-ui-sm flex items-center justify-center bg-bg/80 hover:bg-bg border border-border opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
|
|
1289
|
+
title: "Copy code",
|
|
1290
|
+
children: copied ? /* @__PURE__ */ jsx43("svg", { viewBox: "0 0 12 12", className: "size-3.5 fill-success", children: /* @__PURE__ */ jsx43("path", { d: "M2 6l3 3 5-5", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) : /* @__PURE__ */ jsxs17("svg", { viewBox: "0 0 12 12", className: "size-3.5 fill-muted", children: [
|
|
1291
|
+
/* @__PURE__ */ jsx43("path", { d: "M3 1h6l2 2v6a1 1 0 01-1 1H3a1 1 0 01-1-1V2a1 1 0 011-1zm0 1v7h7V3.5L8.5 2H3z" }),
|
|
1292
|
+
/* @__PURE__ */ jsx43("path", { d: "M2 4H1v6a1 1 0 001 1h6v-1" })
|
|
1293
|
+
] })
|
|
1294
|
+
}
|
|
1295
|
+
),
|
|
1296
|
+
/* @__PURE__ */ jsx43(
|
|
1297
|
+
"pre",
|
|
1298
|
+
{
|
|
1299
|
+
ref,
|
|
1300
|
+
className: cn("p-panel text-xs leading-relaxed overflow-x-auto", wrap && "whitespace-pre-wrap"),
|
|
1301
|
+
...props,
|
|
1302
|
+
children: /* @__PURE__ */ jsx43("code", { children: code })
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
] });
|
|
1306
|
+
}
|
|
1307
|
+
);
|
|
1308
|
+
CodeBlock.displayName = "CodeBlock";
|
|
1309
|
+
|
|
1310
|
+
// src/ui/cell-value/CellValue.tsx
|
|
1311
|
+
import { jsx as jsx44, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1312
|
+
function BooleanDisplay({ value }) {
|
|
1313
|
+
const truthy = Boolean(value);
|
|
1314
|
+
return /* @__PURE__ */ jsx44("span", { className: cn("inline-flex items-center", truthy ? "text-success" : "text-muted"), children: truthy ? /* @__PURE__ */ jsx44("svg", { viewBox: "0 0 12 12", className: "size-icon fill-current", children: /* @__PURE__ */ jsx44("path", { d: "M2 6l3 3 5-5", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) : /* @__PURE__ */ jsx44("svg", { viewBox: "0 0 12 12", className: "size-icon fill-current", children: /* @__PURE__ */ jsx44("path", { d: "M2 2l8 8M10 2L2 10", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) });
|
|
1315
|
+
}
|
|
1316
|
+
function JsonDisplay({ value }) {
|
|
1317
|
+
const str = JSON.stringify(value, null, 2);
|
|
1318
|
+
const preview = str.length > 50 ? str.slice(0, 50) + "\u2026" : str;
|
|
1319
|
+
return /* @__PURE__ */ jsxs18(Root9, { children: [
|
|
1320
|
+
/* @__PURE__ */ jsx44(Trigger5, { className: "font-mono text-xs cursor-pointer hover:text-primary transition-colors max-w-[120px] inline-block truncate align-middle", children: preview }),
|
|
1321
|
+
/* @__PURE__ */ jsx44(PopoverContent, { side: "bottom", align: "start", className: "max-w-md p-0 overflow-hidden", children: /* @__PURE__ */ jsx44(CodeBlock, { code: str }) })
|
|
1322
|
+
] });
|
|
1323
|
+
}
|
|
1324
|
+
function applyReplacements(str, replacements) {
|
|
1325
|
+
if (!replacements || replacements.length === 0) return str;
|
|
1326
|
+
let result = str;
|
|
1327
|
+
for (const r of replacements) {
|
|
1328
|
+
result = result.replaceAll(r.pattern, r.label);
|
|
1329
|
+
}
|
|
1330
|
+
return result;
|
|
1331
|
+
}
|
|
1332
|
+
function CellValue({
|
|
1333
|
+
type = "text",
|
|
1334
|
+
value,
|
|
1335
|
+
badgeVariant,
|
|
1336
|
+
badgeStyle,
|
|
1337
|
+
statusVariant,
|
|
1338
|
+
statusPulse,
|
|
1339
|
+
replacements
|
|
1340
|
+
}) {
|
|
1341
|
+
if (value === null || value === void 0 || type === "null") {
|
|
1342
|
+
return /* @__PURE__ */ jsx44("span", { className: "text-muted", children: "\u2014" });
|
|
1343
|
+
}
|
|
1344
|
+
switch (type) {
|
|
1345
|
+
case "boolean":
|
|
1346
|
+
return /* @__PURE__ */ jsx44(BooleanDisplay, { value });
|
|
1347
|
+
case "email":
|
|
1348
|
+
return /* @__PURE__ */ jsx44(
|
|
1349
|
+
"a",
|
|
1350
|
+
{
|
|
1351
|
+
href: `mailto:${String(value)}`,
|
|
1352
|
+
className: "text-primary hover:underline",
|
|
1353
|
+
children: String(value)
|
|
1354
|
+
}
|
|
1355
|
+
);
|
|
1356
|
+
case "url":
|
|
1357
|
+
return /* @__PURE__ */ jsxs18(
|
|
1358
|
+
"a",
|
|
1359
|
+
{
|
|
1360
|
+
href: String(value),
|
|
1361
|
+
target: "_blank",
|
|
1362
|
+
rel: "noopener noreferrer",
|
|
1363
|
+
className: "inline-flex items-center gap-tight text-primary hover:underline",
|
|
1364
|
+
children: [
|
|
1365
|
+
applyReplacements(String(value), replacements),
|
|
1366
|
+
/* @__PURE__ */ jsx44("svg", { viewBox: "0 0 12 12", className: "size-icon-sm shrink-0 fill-current opacity-dim", children: /* @__PURE__ */ jsx44("path", { d: "M2 2h3v1H3v6h6V7h1v3H2V2zm4 0h4v4H9V4.5L6.5 7 6 6.5 8.5 4H6V2z" }) })
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
);
|
|
1370
|
+
case "json":
|
|
1371
|
+
return /* @__PURE__ */ jsx44(JsonDisplay, { value });
|
|
1372
|
+
case "badge":
|
|
1373
|
+
return /* @__PURE__ */ jsx44(Badge, { variant: badgeVariant ?? "neutral", style: badgeStyle ?? "solid", children: String(value) });
|
|
1374
|
+
case "status":
|
|
1375
|
+
return /* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
1376
|
+
/* @__PURE__ */ jsx44(StatusDot, { variant: statusVariant ?? "neutral", size: "sm", pulse: statusPulse }),
|
|
1377
|
+
/* @__PURE__ */ jsx44("span", { children: String(value) })
|
|
1378
|
+
] });
|
|
1379
|
+
default:
|
|
1380
|
+
return /* @__PURE__ */ jsx44("span", { children: String(value) });
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// src/ui/canvas/Canvas.tsx
|
|
1385
|
+
import { forwardRef as forwardRef43, useRef as useRef2, useState as useState3, useCallback as useCallback4, useEffect as useEffect2 } from "react";
|
|
1386
|
+
import { jsx as jsx45, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1387
|
+
var btn = "inline-flex items-center justify-center size-7 rounded-ui-sm border border-border bg-bg text-xs text-fg hover:bg-secondary cursor-pointer";
|
|
1388
|
+
var Canvas = forwardRef43(
|
|
1389
|
+
({ className, gridSize = 20, initialZoom = 1, minZoom = 0.25, maxZoom = 3, zoomStep = 0.1, children, style, ...props }, ref) => {
|
|
1390
|
+
const containerRef = useRef2(null);
|
|
1391
|
+
const [offset, setOffset] = useState3({ x: 0, y: 0 });
|
|
1392
|
+
const [zoom, setZoom] = useState3(initialZoom);
|
|
1393
|
+
const dragging = useRef2(false);
|
|
1394
|
+
const dragStart = useRef2({ x: 0, y: 0 });
|
|
1395
|
+
const dragOffset = useRef2({ x: 0, y: 0 });
|
|
1396
|
+
const handleMouseDown = useCallback4((e) => {
|
|
1397
|
+
if (e.button !== 0) return;
|
|
1398
|
+
dragging.current = true;
|
|
1399
|
+
dragStart.current = { x: e.clientX, y: e.clientY };
|
|
1400
|
+
dragOffset.current = { x: offset.x, y: offset.y };
|
|
1401
|
+
}, [offset]);
|
|
1402
|
+
const handleMouseMove = useCallback4((e) => {
|
|
1403
|
+
if (!dragging.current) return;
|
|
1404
|
+
setOffset({
|
|
1405
|
+
x: dragOffset.current.x + (e.clientX - dragStart.current.x),
|
|
1406
|
+
y: dragOffset.current.y + (e.clientY - dragStart.current.y)
|
|
1407
|
+
});
|
|
1408
|
+
}, []);
|
|
1409
|
+
const handleMouseUp = useCallback4(() => {
|
|
1410
|
+
dragging.current = false;
|
|
1411
|
+
}, []);
|
|
1412
|
+
const handleWheel = useCallback4((e) => {
|
|
1413
|
+
if (!e.ctrlKey && !e.metaKey) return;
|
|
1414
|
+
e.preventDefault();
|
|
1415
|
+
setZoom((z) => {
|
|
1416
|
+
const next = e.deltaY < 0 ? z + zoomStep : z - zoomStep;
|
|
1417
|
+
return Math.min(maxZoom, Math.max(minZoom, Math.round(next * 10) / 10));
|
|
1418
|
+
});
|
|
1419
|
+
}, [minZoom, maxZoom, zoomStep]);
|
|
1420
|
+
useEffect2(() => {
|
|
1421
|
+
const el = containerRef.current;
|
|
1422
|
+
if (!el) return;
|
|
1423
|
+
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
1424
|
+
return () => el.removeEventListener("wheel", handleWheel);
|
|
1425
|
+
}, [handleWheel]);
|
|
1426
|
+
const zoomIn = () => setZoom((z) => Math.min(maxZoom, Math.round((z + zoomStep) * 10) / 10));
|
|
1427
|
+
const zoomOut = () => setZoom((z) => Math.max(minZoom, Math.round((z - zoomStep) * 10) / 10));
|
|
1428
|
+
const resetView = () => {
|
|
1429
|
+
setOffset({ x: 0, y: 0 });
|
|
1430
|
+
setZoom(1);
|
|
1431
|
+
};
|
|
1432
|
+
const scaledGrid = gridSize * zoom;
|
|
1433
|
+
const bgPos = `${offset.x}px ${offset.y}px`;
|
|
1434
|
+
return /* @__PURE__ */ jsxs19(
|
|
1435
|
+
"div",
|
|
1436
|
+
{
|
|
1437
|
+
ref: (node) => {
|
|
1438
|
+
containerRef.current = node;
|
|
1439
|
+
if (typeof ref === "function") ref(node);
|
|
1440
|
+
else if (ref) ref.current = node;
|
|
1441
|
+
},
|
|
1442
|
+
className: cn("relative overflow-hidden bg-bg select-none", className),
|
|
1443
|
+
style,
|
|
1444
|
+
...props,
|
|
1445
|
+
children: [
|
|
1446
|
+
/* @__PURE__ */ jsx45(
|
|
1447
|
+
"div",
|
|
1448
|
+
{
|
|
1449
|
+
className: "absolute inset-0",
|
|
1450
|
+
style: {
|
|
1451
|
+
backgroundImage: "radial-gradient(circle,var(--color-border)_1.5px,transparent_1.5px)",
|
|
1452
|
+
backgroundSize: `${scaledGrid}px ${scaledGrid}px`,
|
|
1453
|
+
backgroundPosition: bgPos
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
),
|
|
1457
|
+
/* @__PURE__ */ jsx45(
|
|
1458
|
+
"div",
|
|
1459
|
+
{
|
|
1460
|
+
className: "absolute inset-0",
|
|
1461
|
+
onMouseDown: handleMouseDown,
|
|
1462
|
+
onMouseMove: handleMouseMove,
|
|
1463
|
+
onMouseUp: handleMouseUp,
|
|
1464
|
+
onMouseLeave: handleMouseUp,
|
|
1465
|
+
style: { transform: `translate(${offset.x}px, ${offset.y}px) scale(${zoom})`, transformOrigin: "0 0" },
|
|
1466
|
+
children
|
|
1467
|
+
}
|
|
1468
|
+
),
|
|
1469
|
+
/* @__PURE__ */ jsxs19("div", { className: "absolute bottom-3 right-3 flex items-center gap-0.5 rounded-ui border border-border bg-bg p-0.5 shadow-card z-10", children: [
|
|
1470
|
+
/* @__PURE__ */ jsx45("button", { type: "button", className: btn, onClick: zoomOut, title: "Zoom out", children: "\u2212" }),
|
|
1471
|
+
/* @__PURE__ */ jsxs19("button", { type: "button", className: cn(btn, "w-auto px-2 font-mono"), onClick: resetView, title: "Reset view", children: [
|
|
1472
|
+
Math.round(zoom * 100),
|
|
1473
|
+
"%"
|
|
1474
|
+
] }),
|
|
1475
|
+
/* @__PURE__ */ jsx45("button", { type: "button", className: btn, onClick: zoomIn, title: "Zoom in", children: "+" })
|
|
1476
|
+
] })
|
|
1477
|
+
]
|
|
1478
|
+
}
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1481
|
+
);
|
|
1482
|
+
Canvas.displayName = "Canvas";
|
|
1483
|
+
|
|
1484
|
+
// src/ui/graph-node/GraphNode.tsx
|
|
1485
|
+
import { forwardRef as forwardRef44 } from "react";
|
|
1486
|
+
import { cva as cva26 } from "class-variance-authority";
|
|
1487
|
+
import { jsx as jsx46, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1488
|
+
var graphNodeVariants = cva26(
|
|
1489
|
+
"absolute flex flex-col rounded-ui border bg-bg shadow-card min-w-[160px]",
|
|
1490
|
+
{
|
|
1491
|
+
variants: {
|
|
1492
|
+
variant: {
|
|
1493
|
+
default: "border-border",
|
|
1494
|
+
selected: "border-primary ring-2 ring-primary/20",
|
|
1495
|
+
muted: "border-border opacity-dim"
|
|
1496
|
+
}
|
|
1497
|
+
},
|
|
1498
|
+
defaultVariants: {
|
|
1499
|
+
variant: "default"
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
);
|
|
1503
|
+
var GraphNode = forwardRef44(
|
|
1504
|
+
({ className, variant, x, y, header, accent, ports, footer, rows, children, style, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
1505
|
+
"div",
|
|
1506
|
+
{
|
|
1507
|
+
ref,
|
|
1508
|
+
className: cn(graphNodeVariants({ variant }), className),
|
|
1509
|
+
style: { left: x, top: y, ...style },
|
|
1510
|
+
...props,
|
|
1511
|
+
children: [
|
|
1512
|
+
accent && /* @__PURE__ */ jsx46("div", { className: "h-1 shrink-0 rounded-t-ui bg-primary" }),
|
|
1513
|
+
header && /* @__PURE__ */ jsx46("div", { className: "flex items-center px-3 py-2 border-b border-border", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-inline flex-1 min-w-0", children: [
|
|
1514
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex gap-0.5", children: [
|
|
1515
|
+
/* @__PURE__ */ jsx46("span", { className: "size-1.5 rounded-full bg-muted" }),
|
|
1516
|
+
/* @__PURE__ */ jsx46("span", { className: "size-1.5 rounded-full bg-muted" }),
|
|
1517
|
+
/* @__PURE__ */ jsx46("span", { className: "size-1.5 rounded-full bg-muted" })
|
|
1518
|
+
] }),
|
|
1519
|
+
/* @__PURE__ */ jsx46("span", { className: "text-xs font-semibold truncate", children: header })
|
|
1520
|
+
] }) }),
|
|
1521
|
+
ports && ports.length > 0 && /* @__PURE__ */ jsx46("div", { className: "absolute inset-0 pointer-events-none", children: ports.map((p, i) => /* @__PURE__ */ jsxs20(
|
|
1522
|
+
"div",
|
|
1523
|
+
{
|
|
1524
|
+
className: cn(
|
|
1525
|
+
"absolute flex items-center gap-1.5 pointer-events-auto whitespace-nowrap",
|
|
1526
|
+
p.side === "left" ? "right-full flex-row-reverse mr-1.5" : "left-full flex-row ml-1.5",
|
|
1527
|
+
"top-1/2 -translate-y-1/2"
|
|
1528
|
+
),
|
|
1529
|
+
children: [
|
|
1530
|
+
/* @__PURE__ */ jsx46(
|
|
1531
|
+
"div",
|
|
1532
|
+
{
|
|
1533
|
+
className: cn(
|
|
1534
|
+
"size-3 rounded-full border-2 bg-bg transition-colors shrink-0",
|
|
1535
|
+
p.state === "connected" ? "border-primary bg-primary" : "border-muted",
|
|
1536
|
+
p.state === "highlighted" && "border-primary ring-2 ring-primary/30"
|
|
1537
|
+
)
|
|
1538
|
+
}
|
|
1539
|
+
),
|
|
1540
|
+
p.label && /* @__PURE__ */ jsx46("span", { className: "text-xs text-muted", children: p.label })
|
|
1541
|
+
]
|
|
1542
|
+
},
|
|
1543
|
+
i
|
|
1544
|
+
)) }),
|
|
1545
|
+
rows && rows.length > 0 && /* @__PURE__ */ jsx46("div", { className: "divide-y divide-border/50", children: rows.map((row, i) => /* @__PURE__ */ jsxs20("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 px-3 py-1.5 text-xs items-center", children: [
|
|
1546
|
+
/* @__PURE__ */ jsx46("span", { className: "text-muted truncate", children: row.label }),
|
|
1547
|
+
/* @__PURE__ */ jsx46("span", { className: "text-fg text-right", children: row.value })
|
|
1548
|
+
] }, i)) }),
|
|
1549
|
+
!rows && children && /* @__PURE__ */ jsx46("div", { className: "px-3 py-2 text-xs", children }),
|
|
1550
|
+
footer && /* @__PURE__ */ jsx46("div", { className: "px-3 py-1.5 border-t border-border text-xs text-muted", children: footer })
|
|
1551
|
+
]
|
|
1552
|
+
}
|
|
1553
|
+
)
|
|
1554
|
+
);
|
|
1555
|
+
GraphNode.displayName = "GraphNode";
|
|
1556
|
+
|
|
1557
|
+
// src/ui/port/Port.tsx
|
|
1558
|
+
import { forwardRef as forwardRef45 } from "react";
|
|
1559
|
+
import { cva as cva27 } from "class-variance-authority";
|
|
1560
|
+
import { jsx as jsx47, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1561
|
+
var portVariants = cva27(
|
|
1562
|
+
"size-3 rounded-full border-2 bg-bg transition-colors",
|
|
1563
|
+
{
|
|
1564
|
+
variants: {
|
|
1565
|
+
side: {
|
|
1566
|
+
in: "",
|
|
1567
|
+
out: ""
|
|
1568
|
+
},
|
|
1569
|
+
state: {
|
|
1570
|
+
default: "border-muted",
|
|
1571
|
+
connected: "border-primary bg-primary",
|
|
1572
|
+
highlighted: "border-primary ring-2 ring-primary/30"
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
defaultVariants: {
|
|
1576
|
+
side: "in",
|
|
1577
|
+
state: "default"
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
);
|
|
1581
|
+
var Port = forwardRef45(
|
|
1582
|
+
({ className, side, state, label, ...props }, ref) => /* @__PURE__ */ jsxs21("div", { ref, className: cn("relative flex items-center gap-2", side === "in" ? "flex-row" : "flex-row-reverse"), children: [
|
|
1583
|
+
/* @__PURE__ */ jsx47("div", { className: cn(portVariants({ side, state }), className), ...props }),
|
|
1584
|
+
label && /* @__PURE__ */ jsx47("span", { className: "text-xs text-muted", children: label })
|
|
1585
|
+
] })
|
|
1586
|
+
);
|
|
1587
|
+
Port.displayName = "Port";
|
|
1588
|
+
|
|
1589
|
+
// src/ui/typography/Typography.tsx
|
|
1590
|
+
import { forwardRef as forwardRef46 } from "react";
|
|
1591
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
1592
|
+
var Typography = forwardRef46(
|
|
1593
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx48("div", { ref, className: cn("space-y-4", className), ...props, children })
|
|
1594
|
+
);
|
|
1595
|
+
Typography.displayName = "Typography";
|
|
1596
|
+
|
|
1597
|
+
// src/ui/tree-view/TreeView.tsx
|
|
1598
|
+
import { useState as useState4 } from "react";
|
|
1599
|
+
import { cva as cva28 } from "class-variance-authority";
|
|
1600
|
+
import { jsx as jsx49, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1601
|
+
var treeVariants = cva28("", {
|
|
1602
|
+
variants: {
|
|
1603
|
+
variant: {
|
|
1604
|
+
default: "space-y-0.5",
|
|
1605
|
+
condensed: "space-y-0"
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
defaultVariants: {
|
|
1609
|
+
variant: "default"
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
function Chevron({ expanded }) {
|
|
1613
|
+
return /* @__PURE__ */ jsx49(
|
|
1614
|
+
"svg",
|
|
1615
|
+
{
|
|
1616
|
+
viewBox: "0 0 12 12",
|
|
1617
|
+
className: cn("size-3 fill-current text-muted transition-transform", expanded && "rotate-90"),
|
|
1618
|
+
children: /* @__PURE__ */ jsx49("path", { d: "M4 2l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", fill: "none" })
|
|
1619
|
+
}
|
|
1620
|
+
);
|
|
1621
|
+
}
|
|
1622
|
+
function TreeItem({
|
|
1623
|
+
node,
|
|
1624
|
+
depth,
|
|
1625
|
+
variant,
|
|
1626
|
+
indent,
|
|
1627
|
+
replacements
|
|
1628
|
+
}) {
|
|
1629
|
+
const [collapsed, setCollapsed] = useState4(node.defaultCollapsed ?? true);
|
|
1630
|
+
const hasChildren = node.children && node.children.length > 0;
|
|
1631
|
+
return /* @__PURE__ */ jsxs22("li", { className: cn(variant === "condensed" ? "py-0" : "py-0.5"), children: [
|
|
1632
|
+
/* @__PURE__ */ jsxs22(
|
|
1633
|
+
"div",
|
|
1634
|
+
{
|
|
1635
|
+
className: cn(
|
|
1636
|
+
"flex items-center gap-1 rounded-ui-sm px-1 py-0.5 hover:bg-secondary cursor-pointer"
|
|
1637
|
+
),
|
|
1638
|
+
style: { paddingLeft: `${depth * indent + 4}px` },
|
|
1639
|
+
onClick: () => hasChildren && setCollapsed(!collapsed),
|
|
1640
|
+
children: [
|
|
1641
|
+
hasChildren ? /* @__PURE__ */ jsx49(Chevron, { expanded: !collapsed }) : /* @__PURE__ */ jsx49("span", { className: "size-3 shrink-0" }),
|
|
1642
|
+
node.icon && /* @__PURE__ */ jsx49("span", { className: "shrink-0", children: node.icon }),
|
|
1643
|
+
/* @__PURE__ */ jsx49("span", { className: "text-xs truncate flex-1", children: node.label }),
|
|
1644
|
+
node.value && /* @__PURE__ */ jsx49("span", { className: "shrink-0", children: /* @__PURE__ */ jsx49(CellValue, { ...node.value, replacements }) })
|
|
1645
|
+
]
|
|
1646
|
+
}
|
|
1647
|
+
),
|
|
1648
|
+
hasChildren && !collapsed && /* @__PURE__ */ jsx49("ul", { className: "list-none m-0 p-0", children: node.children.map((child) => /* @__PURE__ */ jsx49(
|
|
1649
|
+
TreeItem,
|
|
1650
|
+
{
|
|
1651
|
+
node: child,
|
|
1652
|
+
depth: depth + 1,
|
|
1653
|
+
variant,
|
|
1654
|
+
indent,
|
|
1655
|
+
replacements
|
|
1656
|
+
},
|
|
1657
|
+
child.id
|
|
1658
|
+
)) })
|
|
1659
|
+
] });
|
|
1660
|
+
}
|
|
1661
|
+
function TreeView({ data, variant = "default", indent = 16, replacements }) {
|
|
1662
|
+
const v = variant ?? "default";
|
|
1663
|
+
return /* @__PURE__ */ jsx49("ul", { className: cn(treeVariants({ variant: v }), "list-none m-0 p-0"), children: data.map((node) => /* @__PURE__ */ jsx49(
|
|
1664
|
+
TreeItem,
|
|
1665
|
+
{
|
|
1666
|
+
node,
|
|
1667
|
+
depth: 0,
|
|
1668
|
+
variant: v,
|
|
1669
|
+
indent,
|
|
1670
|
+
replacements
|
|
1671
|
+
},
|
|
1672
|
+
node.id
|
|
1673
|
+
)) });
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
// src/ui/combobox/Combobox.tsx
|
|
1677
|
+
import { useState as useState5, useMemo, useRef as useRef3 } from "react";
|
|
1678
|
+
import { jsx as jsx50, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1679
|
+
function Combobox({
|
|
1680
|
+
options,
|
|
1681
|
+
value,
|
|
1682
|
+
onChange,
|
|
1683
|
+
placeholder = "Search...",
|
|
1684
|
+
emptyText = "No results found",
|
|
1685
|
+
className,
|
|
1686
|
+
disabled
|
|
1687
|
+
}) {
|
|
1688
|
+
const [open, setOpen] = useState5(false);
|
|
1689
|
+
const [query, setQuery] = useState5("");
|
|
1690
|
+
const inputRef = useRef3(null);
|
|
1691
|
+
const filtered = useMemo(
|
|
1692
|
+
() => options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase())),
|
|
1693
|
+
[options, query]
|
|
1694
|
+
);
|
|
1695
|
+
const selectedLabel = options.find((o) => o.value === value)?.label ?? "";
|
|
1696
|
+
return /* @__PURE__ */ jsxs23(Root9, { open, onOpenChange: (v) => {
|
|
1697
|
+
setOpen(v);
|
|
1698
|
+
if (!v) setQuery("");
|
|
1699
|
+
}, children: [
|
|
1700
|
+
/* @__PURE__ */ jsx50(Trigger5, { asChild: true, children: /* @__PURE__ */ jsxs23(
|
|
1701
|
+
"button",
|
|
1702
|
+
{
|
|
1703
|
+
type: "button",
|
|
1704
|
+
role: "combobox",
|
|
1705
|
+
disabled,
|
|
1706
|
+
className: cn(
|
|
1707
|
+
"flex w-full items-center justify-between rounded-ui border border-border bg-bg px-3 py-2 text-sm text-left ring-offset-bg",
|
|
1708
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1709
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1710
|
+
!selectedLabel && "text-muted",
|
|
1711
|
+
className
|
|
1712
|
+
),
|
|
1713
|
+
onClick: () => {
|
|
1714
|
+
setOpen(true);
|
|
1715
|
+
setTimeout(() => inputRef.current?.focus(), 0);
|
|
1716
|
+
},
|
|
1717
|
+
children: [
|
|
1718
|
+
selectedLabel || placeholder,
|
|
1719
|
+
/* @__PURE__ */ jsx50("svg", { viewBox: "0 0 8 8", className: "size-3 shrink-0 fill-current opacity-dim", children: /* @__PURE__ */ jsx50("path", { d: "M0 2l4 4 4-4" }) })
|
|
1720
|
+
]
|
|
1721
|
+
}
|
|
1722
|
+
) }),
|
|
1723
|
+
/* @__PURE__ */ jsxs23(
|
|
1724
|
+
PopoverContent,
|
|
1725
|
+
{
|
|
1726
|
+
side: "bottom",
|
|
1727
|
+
align: "start",
|
|
1728
|
+
className: "w-[var(--radix-popover-trigger-width)] p-0 overflow-hidden",
|
|
1729
|
+
children: [
|
|
1730
|
+
/* @__PURE__ */ jsx50("div", { className: "border-b border-border", children: /* @__PURE__ */ jsx50(
|
|
1731
|
+
Input,
|
|
1732
|
+
{
|
|
1733
|
+
ref: inputRef,
|
|
1734
|
+
value: query,
|
|
1735
|
+
onChange: (e) => setQuery(e.target.value),
|
|
1736
|
+
placeholder,
|
|
1737
|
+
variant: "filled",
|
|
1738
|
+
className: "border-0 rounded-none ring-0 focus-visible:ring-0"
|
|
1739
|
+
}
|
|
1740
|
+
) }),
|
|
1741
|
+
/* @__PURE__ */ jsx50("div", { className: "max-h-60 overflow-y-auto p-1", children: filtered.length === 0 ? /* @__PURE__ */ jsx50("p", { className: "px-2 py-4 text-sm text-muted text-center", children: emptyText }) : filtered.map((option) => /* @__PURE__ */ jsx50(
|
|
1742
|
+
"button",
|
|
1743
|
+
{
|
|
1744
|
+
type: "button",
|
|
1745
|
+
className: cn(
|
|
1746
|
+
"w-full text-left px-2 py-1.5 rounded-ui-sm text-sm hover:bg-secondary focus:bg-secondary outline-none",
|
|
1747
|
+
option.value === value && "bg-primary/10 text-primary font-medium"
|
|
1748
|
+
),
|
|
1749
|
+
onClick: () => {
|
|
1750
|
+
onChange?.(option.value);
|
|
1751
|
+
setOpen(false);
|
|
1752
|
+
setQuery("");
|
|
1753
|
+
},
|
|
1754
|
+
children: option.label
|
|
1755
|
+
},
|
|
1756
|
+
option.value
|
|
1757
|
+
)) })
|
|
1758
|
+
]
|
|
1759
|
+
}
|
|
1760
|
+
)
|
|
1761
|
+
] });
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
// src/ui/command-palette/CommandPalette.tsx
|
|
1765
|
+
import { useState as useState6, useMemo as useMemo2, useRef as useRef4, useEffect as useEffect3, useCallback as useCallback5 } from "react";
|
|
1766
|
+
import { jsx as jsx51, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1767
|
+
function CommandPalette({
|
|
1768
|
+
open,
|
|
1769
|
+
onOpenChange,
|
|
1770
|
+
actions,
|
|
1771
|
+
onSelect,
|
|
1772
|
+
placeholder = "Search commands...",
|
|
1773
|
+
emptyText = "No results found",
|
|
1774
|
+
groups
|
|
1775
|
+
}) {
|
|
1776
|
+
const [query, setQuery] = useState6("");
|
|
1777
|
+
const [activeIdx, setActiveIdx] = useState6(0);
|
|
1778
|
+
const inputRef = useRef4(null);
|
|
1779
|
+
const filtered = useMemo2(
|
|
1780
|
+
() => actions.filter((a) => {
|
|
1781
|
+
const q = query.toLowerCase();
|
|
1782
|
+
return a.label.toLowerCase().includes(q) || a.keywords && a.keywords.some((k) => k.toLowerCase().includes(q));
|
|
1783
|
+
}),
|
|
1784
|
+
[actions, query]
|
|
1785
|
+
);
|
|
1786
|
+
const groupedFiltered = useMemo2(() => {
|
|
1787
|
+
if (!groups) return null;
|
|
1788
|
+
const filteredIds = new Set(filtered.map((a) => a.id));
|
|
1789
|
+
return groups.map((g) => ({
|
|
1790
|
+
...g,
|
|
1791
|
+
actions: g.actionIds.map((id) => actions.find((a) => a.id === id)).filter((a) => a && filteredIds.has(a.id))
|
|
1792
|
+
})).filter((g) => g.actions.length > 0);
|
|
1793
|
+
}, [groups, filtered, actions]);
|
|
1794
|
+
useEffect3(() => {
|
|
1795
|
+
if (open) {
|
|
1796
|
+
setQuery("");
|
|
1797
|
+
setActiveIdx(0);
|
|
1798
|
+
setTimeout(() => inputRef.current?.focus(), 0);
|
|
1799
|
+
}
|
|
1800
|
+
}, [open]);
|
|
1801
|
+
const handleKeyDown = useCallback5(
|
|
1802
|
+
(e) => {
|
|
1803
|
+
if (e.key === "ArrowDown") {
|
|
1804
|
+
e.preventDefault();
|
|
1805
|
+
setActiveIdx((i) => Math.min(i + 1, filtered.length - 1));
|
|
1806
|
+
} else if (e.key === "ArrowUp") {
|
|
1807
|
+
e.preventDefault();
|
|
1808
|
+
setActiveIdx((i) => Math.max(i - 1, 0));
|
|
1809
|
+
} else if (e.key === "Enter" && filtered[activeIdx]) {
|
|
1810
|
+
e.preventDefault();
|
|
1811
|
+
onSelect(filtered[activeIdx]);
|
|
1812
|
+
onOpenChange(false);
|
|
1813
|
+
} else if (e.key === "Escape") {
|
|
1814
|
+
onOpenChange(false);
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
[filtered, activeIdx, onSelect, onOpenChange]
|
|
1818
|
+
);
|
|
1819
|
+
const flatItems = groupedFiltered ? groupedFiltered.flatMap((g) => g.actions) : filtered;
|
|
1820
|
+
return /* @__PURE__ */ jsx51(Root6, { open, onOpenChange, children: /* @__PURE__ */ jsxs24(DialogContent, { size: "lg", className: "p-0 overflow-hidden gap-0", children: [
|
|
1821
|
+
/* @__PURE__ */ jsx51("div", { className: "border-b border-border", children: /* @__PURE__ */ jsx51(
|
|
1822
|
+
"input",
|
|
1823
|
+
{
|
|
1824
|
+
ref: inputRef,
|
|
1825
|
+
value: query,
|
|
1826
|
+
onChange: (e) => {
|
|
1827
|
+
setQuery(e.target.value);
|
|
1828
|
+
setActiveIdx(0);
|
|
1829
|
+
},
|
|
1830
|
+
onKeyDown: handleKeyDown,
|
|
1831
|
+
placeholder,
|
|
1832
|
+
className: "w-full bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted"
|
|
1833
|
+
}
|
|
1834
|
+
) }),
|
|
1835
|
+
/* @__PURE__ */ jsx51("div", { className: "max-h-80 overflow-y-auto p-2", onKeyDown: handleKeyDown, children: flatItems.length === 0 ? /* @__PURE__ */ jsx51("p", { className: "px-2 py-8 text-sm text-muted text-center", children: emptyText }) : groupedFiltered ? groupedFiltered.map((group) => /* @__PURE__ */ jsxs24("div", { children: [
|
|
1836
|
+
/* @__PURE__ */ jsx51("p", { className: "px-2 py-1 text-xs font-semibold text-muted uppercase tracking-wider", children: group.label }),
|
|
1837
|
+
group.actions.map((action) => {
|
|
1838
|
+
const idx = flatItems.indexOf(action);
|
|
1839
|
+
return /* @__PURE__ */ jsx51(
|
|
1840
|
+
CommandItem,
|
|
1841
|
+
{
|
|
1842
|
+
action,
|
|
1843
|
+
active: idx === activeIdx,
|
|
1844
|
+
onSelect: () => {
|
|
1845
|
+
onSelect(action);
|
|
1846
|
+
onOpenChange(false);
|
|
1847
|
+
},
|
|
1848
|
+
onMouseEnter: () => setActiveIdx(idx)
|
|
1849
|
+
},
|
|
1850
|
+
action.id
|
|
1851
|
+
);
|
|
1852
|
+
})
|
|
1853
|
+
] }, group.label)) : filtered.map((action, idx) => /* @__PURE__ */ jsx51(
|
|
1854
|
+
CommandItem,
|
|
1855
|
+
{
|
|
1856
|
+
action,
|
|
1857
|
+
active: idx === activeIdx,
|
|
1858
|
+
onSelect: () => {
|
|
1859
|
+
onSelect(action);
|
|
1860
|
+
onOpenChange(false);
|
|
1861
|
+
},
|
|
1862
|
+
onMouseEnter: () => setActiveIdx(idx)
|
|
1863
|
+
},
|
|
1864
|
+
action.id
|
|
1865
|
+
)) })
|
|
1866
|
+
] }) });
|
|
1867
|
+
}
|
|
1868
|
+
function CommandItem({
|
|
1869
|
+
action,
|
|
1870
|
+
active,
|
|
1871
|
+
onSelect,
|
|
1872
|
+
onMouseEnter
|
|
1873
|
+
}) {
|
|
1874
|
+
return /* @__PURE__ */ jsxs24(
|
|
1875
|
+
"button",
|
|
1876
|
+
{
|
|
1877
|
+
type: "button",
|
|
1878
|
+
className: cn(
|
|
1879
|
+
"flex w-full items-center gap-3 rounded-ui-sm px-2 py-1.5 text-sm text-left",
|
|
1880
|
+
active ? "bg-secondary text-secondary-fg" : "text-fg"
|
|
1881
|
+
),
|
|
1882
|
+
onClick: onSelect,
|
|
1883
|
+
onMouseEnter,
|
|
1884
|
+
children: [
|
|
1885
|
+
action.icon && /* @__PURE__ */ jsx51("span", { className: "shrink-0 size-4 text-muted", children: action.icon }),
|
|
1886
|
+
/* @__PURE__ */ jsx51("span", { className: "flex-1 truncate", children: action.label }),
|
|
1887
|
+
action.shortcut && /* @__PURE__ */ jsx51("span", { className: "shrink-0 text-xs text-muted", children: action.shortcut })
|
|
1888
|
+
]
|
|
1889
|
+
}
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
// src/ui/drawer/Drawer.tsx
|
|
1894
|
+
import { forwardRef as forwardRef47 } from "react";
|
|
1895
|
+
import { Root as Root13, Trigger as Trigger7, Portal as Portal5, Overlay as Overlay2, Content as Content7, Title as Title3, Description as Description3, Close as Close4 } from "@radix-ui/react-dialog";
|
|
1896
|
+
import { cva as cva29 } from "class-variance-authority";
|
|
1897
|
+
import { jsx as jsx52, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1898
|
+
var drawerOverlay = "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out";
|
|
1899
|
+
var drawerContentVariants = cva29(
|
|
1900
|
+
"fixed z-50 flex flex-col bg-bg shadow-lg transition-transform duration-200",
|
|
1901
|
+
{
|
|
1902
|
+
variants: {
|
|
1903
|
+
side: {
|
|
1904
|
+
left: "left-0 top-0 bottom-0 data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full",
|
|
1905
|
+
right: "right-0 top-0 bottom-0 data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full"
|
|
1906
|
+
},
|
|
1907
|
+
size: {
|
|
1908
|
+
sm: "w-72",
|
|
1909
|
+
md: "w-96",
|
|
1910
|
+
lg: "w-[480px]"
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
defaultVariants: {
|
|
1914
|
+
side: "right",
|
|
1915
|
+
size: "md"
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
);
|
|
1919
|
+
var DrawerContent = forwardRef47(
|
|
1920
|
+
({ className, side, size, children, ...props }, ref) => /* @__PURE__ */ jsxs25(Portal5, { children: [
|
|
1921
|
+
/* @__PURE__ */ jsx52(Overlay2, { className: drawerOverlay }),
|
|
1922
|
+
/* @__PURE__ */ jsxs25(Content7, { ref, className: cn(drawerContentVariants({ side, size }), className), ...props, children: [
|
|
1923
|
+
children,
|
|
1924
|
+
/* @__PURE__ */ jsx52(Close4, { className: "absolute right-panel top-panel rounded-ui-sm opacity-70 hover:opacity-100", children: /* @__PURE__ */ jsx52("svg", { viewBox: "0 0 15 15", className: "size-4 fill-current", children: /* @__PURE__ */ jsx52("path", { d: "M2 2l11 11M13 2L2 13", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }) })
|
|
1925
|
+
] })
|
|
1926
|
+
] })
|
|
1927
|
+
);
|
|
1928
|
+
DrawerContent.displayName = "DrawerContent";
|
|
1929
|
+
var DrawerHeader = forwardRef47(
|
|
1930
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx52("div", { ref, className: cn("flex flex-col gap-1.5 p-panel border-b border-border", className), ...props })
|
|
1931
|
+
);
|
|
1932
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
1933
|
+
var DrawerTitle = forwardRef47(
|
|
1934
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx52(Title3, { ref, className: cn("text-lg font-semibold leading-tight", className), ...props })
|
|
1935
|
+
);
|
|
1936
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
1937
|
+
var DrawerDescription = forwardRef47(
|
|
1938
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx52(Description3, { ref, className: cn("text-sm text-muted", className), ...props })
|
|
1939
|
+
);
|
|
1940
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
1941
|
+
var DrawerBody = forwardRef47(
|
|
1942
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx52("div", { ref, className: cn("flex-1 overflow-y-auto p-panel", className), ...props })
|
|
1943
|
+
);
|
|
1944
|
+
DrawerBody.displayName = "DrawerBody";
|
|
1945
|
+
var DrawerFooter = forwardRef47(
|
|
1946
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx52("div", { ref, className: cn("flex items-center justify-end gap-inline p-panel border-t border-border", className), ...props })
|
|
1947
|
+
);
|
|
1948
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
1949
|
+
|
|
1950
|
+
// src/ui/data-list/DataList.tsx
|
|
1951
|
+
import { forwardRef as forwardRef48 } from "react";
|
|
1952
|
+
import { cva as cva30 } from "class-variance-authority";
|
|
1953
|
+
import { jsx as jsx53, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1954
|
+
var dataListVariants = cva30("divide-y divide-border", {
|
|
1955
|
+
variants: {
|
|
1956
|
+
variant: {
|
|
1957
|
+
default: "",
|
|
1958
|
+
compact: ""
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
defaultVariants: {
|
|
1962
|
+
variant: "default"
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
var DataList = forwardRef48(
|
|
1966
|
+
({ className, variant, items, replacements, ...props }, ref) => /* @__PURE__ */ jsx53(
|
|
1967
|
+
"dl",
|
|
1968
|
+
{
|
|
1969
|
+
ref,
|
|
1970
|
+
className: cn(dataListVariants({ variant }), className),
|
|
1971
|
+
...props,
|
|
1972
|
+
children: items.map((item, i) => /* @__PURE__ */ jsxs26(
|
|
1973
|
+
"div",
|
|
1974
|
+
{
|
|
1975
|
+
className: cn(
|
|
1976
|
+
"flex items-center justify-between gap-4",
|
|
1977
|
+
variant === "compact" ? "py-1 px-2" : "py-2 px-3"
|
|
1978
|
+
),
|
|
1979
|
+
children: [
|
|
1980
|
+
/* @__PURE__ */ jsxs26("dt", { className: "flex items-center gap-2 text-sm text-muted", children: [
|
|
1981
|
+
item.icon && /* @__PURE__ */ jsx53("span", { className: "shrink-0", children: item.icon }),
|
|
1982
|
+
item.label
|
|
1983
|
+
] }),
|
|
1984
|
+
/* @__PURE__ */ jsx53("dd", { className: "text-sm text-fg font-medium shrink-0", children: item.value !== void 0 ? /* @__PURE__ */ jsx53(
|
|
1985
|
+
CellValue,
|
|
1986
|
+
{
|
|
1987
|
+
type: item.type ?? "text",
|
|
1988
|
+
value: item.value,
|
|
1989
|
+
badgeVariant: item.badgeVariant,
|
|
1990
|
+
badgeStyle: item.badgeStyle,
|
|
1991
|
+
statusVariant: item.statusVariant,
|
|
1992
|
+
statusPulse: item.statusPulse,
|
|
1993
|
+
replacements
|
|
1994
|
+
}
|
|
1995
|
+
) : /* @__PURE__ */ jsx53("span", { className: "text-muted", children: "\u2014" }) })
|
|
1996
|
+
]
|
|
1997
|
+
},
|
|
1998
|
+
i
|
|
1999
|
+
))
|
|
2000
|
+
}
|
|
2001
|
+
)
|
|
2002
|
+
);
|
|
2003
|
+
DataList.displayName = "DataList";
|
|
2004
|
+
|
|
2005
|
+
// src/ui/slider/Slider.tsx
|
|
2006
|
+
import { forwardRef as forwardRef49 } from "react";
|
|
2007
|
+
import { jsx as jsx54, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2008
|
+
var Slider = forwardRef49(
|
|
2009
|
+
({ className, label, showValue, value, min = 0, max = 100, step = 1, ...props }, ref) => /* @__PURE__ */ jsxs27("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
2010
|
+
(label || showValue) && /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
2011
|
+
label && /* @__PURE__ */ jsx54("span", { className: "text-sm text-fg", children: label }),
|
|
2012
|
+
showValue && /* @__PURE__ */ jsx54("span", { className: "text-sm text-muted font-mono", children: String(value ?? 0) })
|
|
2013
|
+
] }),
|
|
2014
|
+
/* @__PURE__ */ jsx54(
|
|
2015
|
+
"input",
|
|
2016
|
+
{
|
|
2017
|
+
ref,
|
|
2018
|
+
type: "range",
|
|
2019
|
+
value,
|
|
2020
|
+
min,
|
|
2021
|
+
max,
|
|
2022
|
+
step,
|
|
2023
|
+
className: "w-full h-2 rounded-full bg-secondary appearance-none cursor-pointer accent-primary [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-primary [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-bg [&::-webkit-slider-thumb]:shadow-card",
|
|
2024
|
+
...props
|
|
2025
|
+
}
|
|
2026
|
+
)
|
|
2027
|
+
] })
|
|
2028
|
+
);
|
|
2029
|
+
Slider.displayName = "Slider";
|
|
2030
|
+
|
|
2031
|
+
// src/ui/markdown/Markdown.tsx
|
|
2032
|
+
import { useMemo as useMemo3 } from "react";
|
|
2033
|
+
import { Fragment, jsx as jsx55 } from "react/jsx-runtime";
|
|
2034
|
+
function escapeHtml(text) {
|
|
2035
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2036
|
+
}
|
|
2037
|
+
function renderInline(text) {
|
|
2038
|
+
const parts = [];
|
|
2039
|
+
const regex = /(`[^`]+`)|(\*\*(.+?)\*\*)|(\*(.+?)\*)|(\[([^\]]+)\]\(([^)]+)\))/g;
|
|
2040
|
+
let lastIndex = 0;
|
|
2041
|
+
let match;
|
|
2042
|
+
while ((match = regex.exec(text)) !== null) {
|
|
2043
|
+
if (match.index > lastIndex) {
|
|
2044
|
+
parts.push(escapeHtml(text.slice(lastIndex, match.index)));
|
|
2045
|
+
}
|
|
2046
|
+
if (match[1]) {
|
|
2047
|
+
parts.push(/* @__PURE__ */ jsx55("code", { className: "rounded-ui-sm bg-secondary px-1 py-0.5 text-xs font-mono", children: match[1].slice(1, -1) }, match.index));
|
|
2048
|
+
} else if (match[3]) {
|
|
2049
|
+
parts.push(/* @__PURE__ */ jsx55("strong", { children: escapeHtml(match[3]) }, match.index));
|
|
2050
|
+
} else if (match[5]) {
|
|
2051
|
+
parts.push(/* @__PURE__ */ jsx55("em", { children: escapeHtml(match[5]) }, match.index));
|
|
2052
|
+
} else if (match[7]) {
|
|
2053
|
+
parts.push(/* @__PURE__ */ jsx55("a", { href: match[8], className: "text-primary hover:underline", children: escapeHtml(match[7]) }, match.index));
|
|
2054
|
+
}
|
|
2055
|
+
lastIndex = match.index + match[0].length;
|
|
2056
|
+
}
|
|
2057
|
+
if (lastIndex < text.length) {
|
|
2058
|
+
parts.push(escapeHtml(text.slice(lastIndex)));
|
|
2059
|
+
}
|
|
2060
|
+
return parts.length === 1 ? parts[0] : parts.length > 1 ? /* @__PURE__ */ jsx55(Fragment, { children: parts }) : "";
|
|
2061
|
+
}
|
|
2062
|
+
function parseBlocks(content) {
|
|
2063
|
+
const lines = content.split("\n");
|
|
2064
|
+
const blocks = [];
|
|
2065
|
+
let i = 0;
|
|
2066
|
+
while (i < lines.length) {
|
|
2067
|
+
const line = lines[i];
|
|
2068
|
+
if (line === "") {
|
|
2069
|
+
i++;
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
2072
|
+
const heading = line.match(/^(#{1,6})\s+(.+)/);
|
|
2073
|
+
if (heading) {
|
|
2074
|
+
blocks.push({ type: "heading", level: heading[1].length, text: heading[2] });
|
|
2075
|
+
i++;
|
|
2076
|
+
continue;
|
|
2077
|
+
}
|
|
2078
|
+
if (line.startsWith("```")) {
|
|
2079
|
+
const codeLines = [];
|
|
2080
|
+
i++;
|
|
2081
|
+
while (i < lines.length && !lines[i].startsWith("```")) {
|
|
2082
|
+
codeLines.push(lines[i]);
|
|
2083
|
+
i++;
|
|
2084
|
+
}
|
|
2085
|
+
i++;
|
|
2086
|
+
blocks.push({ type: "code", code: codeLines.join("\n") });
|
|
2087
|
+
continue;
|
|
2088
|
+
}
|
|
2089
|
+
const listItem = line.match(/^[-*]\s+(.+)/);
|
|
2090
|
+
if (listItem) {
|
|
2091
|
+
const items = [listItem[1]];
|
|
2092
|
+
i++;
|
|
2093
|
+
while (i < lines.length) {
|
|
2094
|
+
const next = lines[i].match(/^[-*]\s+(.+)/);
|
|
2095
|
+
if (next) {
|
|
2096
|
+
items.push(next[1]);
|
|
2097
|
+
i++;
|
|
2098
|
+
} else break;
|
|
2099
|
+
}
|
|
2100
|
+
blocks.push({ type: "list", items });
|
|
2101
|
+
continue;
|
|
2102
|
+
}
|
|
2103
|
+
const paraLines = [line];
|
|
2104
|
+
i++;
|
|
2105
|
+
while (i < lines.length && lines[i] !== "") {
|
|
2106
|
+
paraLines.push(lines[i]);
|
|
2107
|
+
i++;
|
|
2108
|
+
}
|
|
2109
|
+
blocks.push({ type: "paragraph", text: paraLines.join(" ") });
|
|
2110
|
+
}
|
|
2111
|
+
return blocks;
|
|
2112
|
+
}
|
|
2113
|
+
function Markdown({ content, className, ...props }) {
|
|
2114
|
+
const blocks = useMemo3(() => parseBlocks(content), [content]);
|
|
2115
|
+
return /* @__PURE__ */ jsx55("div", { className: cn("space-y-3", className), ...props, children: blocks.map((block, i) => {
|
|
2116
|
+
switch (block.type) {
|
|
2117
|
+
case "heading": {
|
|
2118
|
+
const sizes = ["", "text-lg", "text-base", "text-sm", "text-xs", "text-xs"];
|
|
2119
|
+
const cls = cn(sizes[block.level - 1] ?? "text-base", "font-semibold text-fg");
|
|
2120
|
+
const h = block.level;
|
|
2121
|
+
return h === 1 ? /* @__PURE__ */ jsx55("h1", { className: cls, children: renderInline(block.text) }, i) : h === 2 ? /* @__PURE__ */ jsx55("h2", { className: cls, children: renderInline(block.text) }, i) : h === 3 ? /* @__PURE__ */ jsx55("h3", { className: cls, children: renderInline(block.text) }, i) : h === 4 ? /* @__PURE__ */ jsx55("h4", { className: cls, children: renderInline(block.text) }, i) : h === 5 ? /* @__PURE__ */ jsx55("h5", { className: cls, children: renderInline(block.text) }, i) : /* @__PURE__ */ jsx55("h6", { className: cls, children: renderInline(block.text) }, i);
|
|
2122
|
+
}
|
|
2123
|
+
case "paragraph":
|
|
2124
|
+
return /* @__PURE__ */ jsx55("p", { className: "text-sm leading-relaxed text-fg", children: renderInline(block.text) }, i);
|
|
2125
|
+
case "list":
|
|
2126
|
+
return /* @__PURE__ */ jsx55("ul", { className: "list-disc pl-5 space-y-0.5", children: block.items.map((item, j) => /* @__PURE__ */ jsx55("li", { className: "text-sm text-fg", children: renderInline(item) }, j)) }, i);
|
|
2127
|
+
case "code":
|
|
2128
|
+
return /* @__PURE__ */ jsx55(CodeBlock, { code: block.code }, i);
|
|
2129
|
+
default:
|
|
2130
|
+
return null;
|
|
2131
|
+
}
|
|
2132
|
+
}) });
|
|
2133
|
+
}
|
|
2134
|
+
export {
|
|
2135
|
+
Alert,
|
|
2136
|
+
Avatar,
|
|
2137
|
+
Badge,
|
|
2138
|
+
Breadcrumbs,
|
|
2139
|
+
Button,
|
|
2140
|
+
Canvas,
|
|
2141
|
+
Card,
|
|
2142
|
+
CardContent,
|
|
2143
|
+
CardFooter,
|
|
2144
|
+
CardHeader,
|
|
2145
|
+
CardTitle,
|
|
2146
|
+
CellValue,
|
|
2147
|
+
Checkbox,
|
|
2148
|
+
CodeBlock,
|
|
2149
|
+
Combobox,
|
|
2150
|
+
CommandPalette,
|
|
2151
|
+
ConfirmDialog,
|
|
2152
|
+
DataList,
|
|
2153
|
+
Root6 as Dialog,
|
|
2154
|
+
Close as DialogClose,
|
|
2155
|
+
DialogContent,
|
|
2156
|
+
DialogDescription,
|
|
2157
|
+
DialogFooter,
|
|
2158
|
+
DialogHeader,
|
|
2159
|
+
DialogTitle,
|
|
2160
|
+
Trigger2 as DialogTrigger,
|
|
2161
|
+
Root13 as Drawer,
|
|
2162
|
+
DrawerBody,
|
|
2163
|
+
Close4 as DrawerClose,
|
|
2164
|
+
DrawerContent,
|
|
2165
|
+
DrawerDescription,
|
|
2166
|
+
DrawerFooter,
|
|
2167
|
+
DrawerHeader,
|
|
2168
|
+
DrawerTitle,
|
|
2169
|
+
Trigger7 as DrawerTrigger,
|
|
2170
|
+
Root8 as DropdownMenu,
|
|
2171
|
+
DropdownMenuContent,
|
|
2172
|
+
DropdownMenuItem,
|
|
2173
|
+
DropdownMenuLabel,
|
|
2174
|
+
DropdownMenuSeparator,
|
|
2175
|
+
Trigger4 as DropdownMenuTrigger,
|
|
2176
|
+
EmptyState,
|
|
2177
|
+
FormField,
|
|
2178
|
+
GraphNode,
|
|
2179
|
+
Input,
|
|
2180
|
+
Kbd,
|
|
2181
|
+
Label,
|
|
2182
|
+
Markdown,
|
|
2183
|
+
PageShell,
|
|
2184
|
+
Pagination,
|
|
2185
|
+
Root9 as Popover,
|
|
2186
|
+
Close2 as PopoverClose,
|
|
2187
|
+
PopoverContent,
|
|
2188
|
+
Trigger5 as PopoverTrigger,
|
|
2189
|
+
Port,
|
|
2190
|
+
Progress,
|
|
2191
|
+
RadioGroup,
|
|
2192
|
+
RadioGroupItem,
|
|
2193
|
+
Root5 as Select,
|
|
2194
|
+
SelectContent,
|
|
2195
|
+
SelectItem,
|
|
2196
|
+
SelectTrigger,
|
|
2197
|
+
Value as SelectValue,
|
|
2198
|
+
Separator2 as Separator,
|
|
2199
|
+
Skeleton,
|
|
2200
|
+
Slider,
|
|
2201
|
+
Spinner,
|
|
2202
|
+
StatCard,
|
|
2203
|
+
StatusDot,
|
|
2204
|
+
Switch,
|
|
2205
|
+
Table,
|
|
2206
|
+
TableBody,
|
|
2207
|
+
TableCell,
|
|
2208
|
+
TableHead,
|
|
2209
|
+
TableHeader,
|
|
2210
|
+
TableRow,
|
|
2211
|
+
Tabs,
|
|
2212
|
+
TabsContent,
|
|
2213
|
+
TabsList,
|
|
2214
|
+
TabsTrigger,
|
|
2215
|
+
Textarea,
|
|
2216
|
+
Toaster,
|
|
2217
|
+
Toolbar,
|
|
2218
|
+
Tooltip,
|
|
2219
|
+
TooltipContent,
|
|
2220
|
+
TooltipProvider,
|
|
2221
|
+
TreeView,
|
|
2222
|
+
Typography,
|
|
2223
|
+
cn,
|
|
2224
|
+
useToast
|
|
2225
|
+
};
|