@litelens/design-system 1.0.3
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 +129 -0
- package/dist/atoms/index.d.ts +215 -0
- package/dist/atoms/index.js +6 -0
- package/dist/chunk-3ZL7QROP.js +23 -0
- package/dist/chunk-7M2VOCYN.js +1 -0
- package/dist/chunk-7YPL4ZPM.js +41 -0
- package/dist/chunk-CPX26L4M.js +58 -0
- package/dist/chunk-FJE2X4E6.js +967 -0
- package/dist/chunk-GPI6G5NM.js +148 -0
- package/dist/chunk-NFJMUQY6.js +41 -0
- package/dist/chunk-NPDXDIXD.js +735 -0
- package/dist/chunk-OI5436K4.js +822 -0
- package/dist/chunk-QUNCRUSO.js +12 -0
- package/dist/chunk-TLJXC46A.js +1 -0
- package/dist/components/index.d.ts +254 -0
- package/dist/components/index.js +4 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +2 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +11 -0
- package/dist/libs/index.d.ts +48 -0
- package/dist/libs/index.js +4 -0
- package/dist/style.css +65 -0
- package/dist/styles.animation.css +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.palette.css +140 -0
- package/dist/styles.typography.css +57 -0
- package/dist/types/index.d.ts +55 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.js +2 -0
- package/package.json +88 -0
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
import { Button } from './chunk-NPDXDIXD.js';
|
|
2
|
+
import { useCopyToClipboard } from './chunk-3ZL7QROP.js';
|
|
3
|
+
import { SplitAndHighlightText } from './chunk-NFJMUQY6.js';
|
|
4
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, CopyIcon } from './chunk-7YPL4ZPM.js';
|
|
5
|
+
import { cn } from './chunk-QUNCRUSO.js';
|
|
6
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
import { Collapsible as Collapsible$1 } from '@base-ui/react/collapsible';
|
|
9
|
+
import { ContextMenu as ContextMenu$1 } from '@base-ui/react/context-menu';
|
|
10
|
+
import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
|
|
11
|
+
import { Select as Select$1 } from '@base-ui/react/select';
|
|
12
|
+
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
13
|
+
import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
14
|
+
import { useTheme } from 'next-themes';
|
|
15
|
+
import { Toaster as Toaster$1 } from 'sonner';
|
|
16
|
+
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
17
|
+
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
18
|
+
import { cva } from 'class-variance-authority';
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
|
|
21
|
+
var CHECKBOX_STATE_CLASSES = {
|
|
22
|
+
default: "",
|
|
23
|
+
error: "border-destructive aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
24
|
+
success: "border-success data-checked:border-success data-checked:bg-success",
|
|
25
|
+
warning: "border-warning data-checked:border-warning data-checked:bg-warning",
|
|
26
|
+
loading: "opacity-75 cursor-not-allowed"
|
|
27
|
+
};
|
|
28
|
+
function Checkbox({
|
|
29
|
+
className,
|
|
30
|
+
state = "default",
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
Checkbox$1.Root,
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "checkbox",
|
|
37
|
+
className: cn(
|
|
38
|
+
"border-input group-has-disabled/field:opacity-50 focus-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary transition-theme peer relative flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-[4px] border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
39
|
+
CHECKBOX_STATE_CLASSES[state],
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
...props,
|
|
43
|
+
children: /* @__PURE__ */ jsx(
|
|
44
|
+
Checkbox$1.Indicator,
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "checkbox-indicator",
|
|
47
|
+
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
48
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function Collapsible({ ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, { "data-slot": "collapsible", ...props });
|
|
56
|
+
}
|
|
57
|
+
function CollapsibleTrigger({ ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Trigger, { "data-slot": "collapsible-trigger", ...props });
|
|
59
|
+
}
|
|
60
|
+
function CollapsiblePanel({ className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
Collapsible$1.Panel,
|
|
63
|
+
{
|
|
64
|
+
"data-slot": "collapsible-panel",
|
|
65
|
+
className: cn(
|
|
66
|
+
"transition-height h-(--collapsible-panel-height) data-ending-style:h-0 data-starting-style:h-0 overflow-hidden",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function ContextMenu({ ...props }) {
|
|
74
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Root, { ...props });
|
|
75
|
+
}
|
|
76
|
+
function ContextMenuTrigger({ ...props }) {
|
|
77
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Trigger, { ...props });
|
|
78
|
+
}
|
|
79
|
+
function ContextMenuPortal({ ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { ...props });
|
|
81
|
+
}
|
|
82
|
+
function ContextMenuContent({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Positioner, { sideOffset: 4, children: /* @__PURE__ */ jsx(
|
|
84
|
+
ContextMenu$1.Popup,
|
|
85
|
+
{
|
|
86
|
+
className: cn(
|
|
87
|
+
"bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-overlay min-w-[8rem] rounded-lg p-1 text-sm shadow-md outline-none ring-1 duration-100",
|
|
88
|
+
className
|
|
89
|
+
),
|
|
90
|
+
...props
|
|
91
|
+
}
|
|
92
|
+
) }) });
|
|
93
|
+
}
|
|
94
|
+
function ContextMenuItem({ className, ...props }) {
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
ContextMenu$1.Item,
|
|
97
|
+
{
|
|
98
|
+
className: cn(
|
|
99
|
+
"focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 transition-theme relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
100
|
+
className
|
|
101
|
+
),
|
|
102
|
+
...props
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function ContextMenuSeparator({ className, ...props }) {
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
ContextMenu$1.Separator,
|
|
109
|
+
{
|
|
110
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
111
|
+
...props
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function Drawer({ ...props }) {
|
|
116
|
+
return /* @__PURE__ */ jsx(Drawer$1.Root, { "data-slot": "drawer", ...props });
|
|
117
|
+
}
|
|
118
|
+
function DrawerPortal({ ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
|
|
120
|
+
}
|
|
121
|
+
function DrawerViewport({ className, ...props }) {
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
Drawer$1.Viewport,
|
|
124
|
+
{
|
|
125
|
+
"data-slot": "drawer-viewport",
|
|
126
|
+
className: cn(
|
|
127
|
+
"z-overlay pointer-events-none fixed inset-0 flex flex-col items-stretch justify-end",
|
|
128
|
+
className
|
|
129
|
+
),
|
|
130
|
+
...props
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function DrawerPopup({ className, ...props }) {
|
|
135
|
+
return /* @__PURE__ */ jsx(
|
|
136
|
+
Drawer$1.Popup,
|
|
137
|
+
{
|
|
138
|
+
"data-slot": "drawer-popup",
|
|
139
|
+
className: cn(
|
|
140
|
+
"bg-background text-foreground data-ending-style:h-0 data-starting-style:h-0 pointer-events-auto flex w-full flex-col border-t shadow-[0_-4px_24px_rgba(0,0,0,0.15)] transition-[height] duration-150 ease-in-out",
|
|
141
|
+
className
|
|
142
|
+
),
|
|
143
|
+
...props
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
function DrawerContent({ className, ...props }) {
|
|
148
|
+
return /* @__PURE__ */ jsx(
|
|
149
|
+
Drawer$1.Content,
|
|
150
|
+
{
|
|
151
|
+
"data-slot": "drawer-content",
|
|
152
|
+
className: cn("flex min-h-0 flex-1 flex-col overflow-hidden", className),
|
|
153
|
+
...props
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
var Select = Select$1.Root;
|
|
158
|
+
function SelectGroup({ className, ...props }) {
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
Select$1.Group,
|
|
161
|
+
{
|
|
162
|
+
"data-slot": "select-group",
|
|
163
|
+
className: cn("scroll-my-1 p-1", className),
|
|
164
|
+
...props
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
function SelectValue({ className, ...props }) {
|
|
169
|
+
return /* @__PURE__ */ jsx(
|
|
170
|
+
Select$1.Value,
|
|
171
|
+
{
|
|
172
|
+
"data-slot": "select-value",
|
|
173
|
+
className: cn("flex flex-1 text-left", className),
|
|
174
|
+
...props
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
var SELECT_TRIGGER_STATE_CLASSES = {
|
|
179
|
+
default: "",
|
|
180
|
+
error: "border-destructive bg-destructive/5 dark:border-destructive/50 dark:bg-destructive/10",
|
|
181
|
+
success: "border-success bg-success/5 dark:border-success dark:bg-success/5",
|
|
182
|
+
warning: "border-warning bg-warning/5 dark:border-warning dark:bg-warning/5",
|
|
183
|
+
loading: "opacity-75 cursor-not-allowed"
|
|
184
|
+
};
|
|
185
|
+
function SelectTrigger({
|
|
186
|
+
className,
|
|
187
|
+
size = "default",
|
|
188
|
+
state = "default",
|
|
189
|
+
children,
|
|
190
|
+
...props
|
|
191
|
+
}) {
|
|
192
|
+
return /* @__PURE__ */ jsxs(
|
|
193
|
+
Select$1.Trigger,
|
|
194
|
+
{
|
|
195
|
+
"data-slot": "select-trigger",
|
|
196
|
+
"data-size": size,
|
|
197
|
+
className: cn(
|
|
198
|
+
"border-input focus-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 transition-theme disabled:bg-input/50 dark:disabled:bg-input/80 flex w-fit select-none items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border bg-transparent py-2 pl-2.5 pr-2 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
199
|
+
SELECT_TRIGGER_STATE_CLASSES[state],
|
|
200
|
+
"cursor-pointer",
|
|
201
|
+
className
|
|
202
|
+
),
|
|
203
|
+
...props,
|
|
204
|
+
children: [
|
|
205
|
+
children,
|
|
206
|
+
/* @__PURE__ */ jsx(
|
|
207
|
+
Select$1.Icon,
|
|
208
|
+
{
|
|
209
|
+
render: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4" })
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function SelectContent({
|
|
217
|
+
className,
|
|
218
|
+
positionerClassName,
|
|
219
|
+
children,
|
|
220
|
+
side = "bottom",
|
|
221
|
+
sideOffset = 4,
|
|
222
|
+
align = "center",
|
|
223
|
+
alignOffset = 0,
|
|
224
|
+
alignItemWithTrigger = true,
|
|
225
|
+
...props
|
|
226
|
+
}) {
|
|
227
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
228
|
+
Select$1.Positioner,
|
|
229
|
+
{
|
|
230
|
+
side,
|
|
231
|
+
sideOffset,
|
|
232
|
+
align,
|
|
233
|
+
alignOffset,
|
|
234
|
+
alignItemWithTrigger,
|
|
235
|
+
className: cn("z-overlay isolate", positionerClassName),
|
|
236
|
+
children: /* @__PURE__ */ jsxs(
|
|
237
|
+
Select$1.Popup,
|
|
238
|
+
{
|
|
239
|
+
"data-slot": "select-content",
|
|
240
|
+
"data-align-trigger": alignItemWithTrigger,
|
|
241
|
+
className: cn(
|
|
242
|
+
"max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-overlay relative isolate min-w-36 overflow-y-auto overflow-x-hidden rounded-lg shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none",
|
|
243
|
+
className
|
|
244
|
+
),
|
|
245
|
+
...props,
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
248
|
+
/* @__PURE__ */ jsx(Select$1.List, { children }),
|
|
249
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
) });
|
|
255
|
+
}
|
|
256
|
+
function SelectLabel({ className, ...props }) {
|
|
257
|
+
return /* @__PURE__ */ jsx(
|
|
258
|
+
Select$1.GroupLabel,
|
|
259
|
+
{
|
|
260
|
+
"data-slot": "select-label",
|
|
261
|
+
className: cn("text-muted-foreground px-1.5 py-1 text-xs", className),
|
|
262
|
+
...props
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function SelectItem({ className, children, ...props }) {
|
|
267
|
+
return /* @__PURE__ */ jsxs(
|
|
268
|
+
Select$1.Item,
|
|
269
|
+
{
|
|
270
|
+
"data-slot": "select-item",
|
|
271
|
+
className: cn(
|
|
272
|
+
"outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-pointer select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
273
|
+
className
|
|
274
|
+
),
|
|
275
|
+
...props,
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsx(Select$1.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children }),
|
|
278
|
+
/* @__PURE__ */ jsx(
|
|
279
|
+
Select$1.ItemIndicator,
|
|
280
|
+
{
|
|
281
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
|
|
282
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
function SelectSeparator({ className, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsx(
|
|
291
|
+
Select$1.Separator,
|
|
292
|
+
{
|
|
293
|
+
"data-slot": "select-separator",
|
|
294
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
295
|
+
...props
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
function SelectScrollUpButton({
|
|
300
|
+
className,
|
|
301
|
+
...props
|
|
302
|
+
}) {
|
|
303
|
+
return /* @__PURE__ */ jsx(
|
|
304
|
+
Select$1.ScrollUpArrow,
|
|
305
|
+
{
|
|
306
|
+
"data-slot": "select-scroll-up-button",
|
|
307
|
+
className: cn(
|
|
308
|
+
"bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
309
|
+
className
|
|
310
|
+
),
|
|
311
|
+
...props,
|
|
312
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
function SelectScrollDownButton({
|
|
317
|
+
className,
|
|
318
|
+
...props
|
|
319
|
+
}) {
|
|
320
|
+
return /* @__PURE__ */ jsx(
|
|
321
|
+
Select$1.ScrollDownArrow,
|
|
322
|
+
{
|
|
323
|
+
"data-slot": "select-scroll-down-button",
|
|
324
|
+
className: cn(
|
|
325
|
+
"bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
326
|
+
className
|
|
327
|
+
),
|
|
328
|
+
...props,
|
|
329
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
function Separator({ className, orientation = "horizontal", ...props }) {
|
|
334
|
+
return /* @__PURE__ */ jsx(
|
|
335
|
+
Separator$1,
|
|
336
|
+
{
|
|
337
|
+
"data-slot": "separator",
|
|
338
|
+
orientation,
|
|
339
|
+
className: cn(
|
|
340
|
+
"bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch shrink-0",
|
|
341
|
+
className
|
|
342
|
+
),
|
|
343
|
+
...props
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
function Slider({
|
|
348
|
+
className,
|
|
349
|
+
defaultValue,
|
|
350
|
+
value,
|
|
351
|
+
min = 0,
|
|
352
|
+
max = 100,
|
|
353
|
+
...props
|
|
354
|
+
}) {
|
|
355
|
+
const _values = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max];
|
|
356
|
+
return /* @__PURE__ */ jsx(
|
|
357
|
+
Slider$1.Root,
|
|
358
|
+
{
|
|
359
|
+
className: cn("data-horizontal:w-full data-vertical:h-full", className),
|
|
360
|
+
"data-slot": "slider",
|
|
361
|
+
defaultValue,
|
|
362
|
+
value,
|
|
363
|
+
min,
|
|
364
|
+
max,
|
|
365
|
+
thumbAlignment: "edge",
|
|
366
|
+
...props,
|
|
367
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Control, { className: "data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col relative flex w-full touch-none select-none items-center", children: [
|
|
368
|
+
/* @__PURE__ */ jsx(
|
|
369
|
+
Slider$1.Track,
|
|
370
|
+
{
|
|
371
|
+
"data-slot": "slider-track",
|
|
372
|
+
className: "bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1 relative grow select-none overflow-hidden rounded-full",
|
|
373
|
+
children: /* @__PURE__ */ jsx(
|
|
374
|
+
Slider$1.Indicator,
|
|
375
|
+
{
|
|
376
|
+
"data-slot": "slider-range",
|
|
377
|
+
className: "bg-primary data-horizontal:h-full data-vertical:w-full select-none"
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
|
|
383
|
+
Slider$1.Thumb,
|
|
384
|
+
{
|
|
385
|
+
"data-slot": "slider-thumb",
|
|
386
|
+
className: "border-ring ring-ring/75 hover:ring-3 focus-visible:ring-3 focus-visible:ring-ring focus-visible:outline-hidden active:ring-3 transition-focus relative block size-3 shrink-0 select-none rounded-full border bg-white after:absolute after:-inset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
387
|
+
},
|
|
388
|
+
_values[index]
|
|
389
|
+
))
|
|
390
|
+
] })
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
var Toaster = ({ ...props }) => {
|
|
395
|
+
const { theme = "system" } = useTheme();
|
|
396
|
+
return /* @__PURE__ */ jsx(
|
|
397
|
+
Toaster$1,
|
|
398
|
+
{
|
|
399
|
+
theme,
|
|
400
|
+
className: "toaster group",
|
|
401
|
+
icons: {
|
|
402
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
403
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
|
|
404
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" }),
|
|
405
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "text-destructive size-4" }),
|
|
406
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" })
|
|
407
|
+
},
|
|
408
|
+
style: {
|
|
409
|
+
"--normal-bg": "var(--popover)",
|
|
410
|
+
"--normal-text": "var(--popover-foreground)",
|
|
411
|
+
"--normal-border": "var(--border)",
|
|
412
|
+
"--border-radius": "var(--radius)",
|
|
413
|
+
"--error-bg": "color-mix(in oklch, var(--destructive) 15%, var(--popover))",
|
|
414
|
+
"--error-text": "var(--foreground)",
|
|
415
|
+
"--error-border": "var(--destructive)"
|
|
416
|
+
},
|
|
417
|
+
toastOptions: {
|
|
418
|
+
classNames: {
|
|
419
|
+
toast: "cn-toast"
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
...props
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
};
|
|
426
|
+
function Switch({
|
|
427
|
+
className,
|
|
428
|
+
size = "default",
|
|
429
|
+
...props
|
|
430
|
+
}) {
|
|
431
|
+
return /* @__PURE__ */ jsx(
|
|
432
|
+
Switch$1.Root,
|
|
433
|
+
{
|
|
434
|
+
"data-slot": "switch",
|
|
435
|
+
"data-size": size,
|
|
436
|
+
className: cn(
|
|
437
|
+
"group/switch focus-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50 transition-interactive peer relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[size=default]:h-[18.4px] data-[size=sm]:h-3.5 data-[size=default]:w-8 data-[size=sm]:w-6",
|
|
438
|
+
!!props.onCheckedChange && "cursor-pointer",
|
|
439
|
+
className
|
|
440
|
+
),
|
|
441
|
+
...props,
|
|
442
|
+
children: /* @__PURE__ */ jsx(
|
|
443
|
+
Switch$1.Thumb,
|
|
444
|
+
{
|
|
445
|
+
"data-slot": "switch-thumb",
|
|
446
|
+
className: "bg-background group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3"
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
453
|
+
return /* @__PURE__ */ jsx(
|
|
454
|
+
Tabs$1.Root,
|
|
455
|
+
{
|
|
456
|
+
"data-slot": "tabs",
|
|
457
|
+
"data-orientation": orientation,
|
|
458
|
+
className: cn(
|
|
459
|
+
"group/tabs data-horizontal:grid-rows-[auto_1fr] data-vertical:grid-cols-[auto_1fr] grid gap-2",
|
|
460
|
+
className
|
|
461
|
+
),
|
|
462
|
+
...props
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
var tabsListVariants = cva(
|
|
467
|
+
"group/tabs-list relative inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
|
468
|
+
{
|
|
469
|
+
variants: {
|
|
470
|
+
variant: {
|
|
471
|
+
default: "bg-muted",
|
|
472
|
+
line: "gap-1 bg-transparent"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
defaultVariants: {
|
|
476
|
+
variant: "default"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
function TabsList({
|
|
481
|
+
className,
|
|
482
|
+
variant = "default",
|
|
483
|
+
indicatorClassName,
|
|
484
|
+
children,
|
|
485
|
+
...props
|
|
486
|
+
}) {
|
|
487
|
+
return /* @__PURE__ */ jsxs(
|
|
488
|
+
Tabs$1.List,
|
|
489
|
+
{
|
|
490
|
+
"data-slot": "tabs-list",
|
|
491
|
+
"data-variant": variant,
|
|
492
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
493
|
+
...props,
|
|
494
|
+
children: [
|
|
495
|
+
children,
|
|
496
|
+
/* @__PURE__ */ jsx(TabsIndicator, { variant: variant ?? "default", className: indicatorClassName })
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
function TabsTrigger({ className, ...props }) {
|
|
502
|
+
return /* @__PURE__ */ jsx(
|
|
503
|
+
Tabs$1.Tab,
|
|
504
|
+
{
|
|
505
|
+
"data-slot": "tabs-trigger",
|
|
506
|
+
className: cn(
|
|
507
|
+
"text-foreground/60 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/75 focus-visible:outline-ring has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground transition-interactive relative z-10 inline-flex h-[calc(100%-1px)] flex-1 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent bg-transparent px-1.5 py-0.5 text-sm font-medium focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
508
|
+
"data-active:text-foreground dark:data-active:text-foreground",
|
|
509
|
+
className
|
|
510
|
+
),
|
|
511
|
+
...props
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
function TabsIndicator({ className, variant = "default", ...props }) {
|
|
516
|
+
return /* @__PURE__ */ jsx(
|
|
517
|
+
Tabs$1.Indicator,
|
|
518
|
+
{
|
|
519
|
+
"data-slot": "tabs-indicator",
|
|
520
|
+
className: cn(
|
|
521
|
+
"transition-interactive pointer-events-none absolute z-0",
|
|
522
|
+
variant === "line" ? cn(
|
|
523
|
+
"bg-primary",
|
|
524
|
+
"group-data-horizontal/tabs:bottom-0 group-data-horizontal/tabs:left-(--active-tab-left) group-data-horizontal/tabs:h-0.5 group-data-horizontal/tabs:w-(--active-tab-width)",
|
|
525
|
+
"group-data-vertical/tabs:right-0 group-data-vertical/tabs:top-(--active-tab-top) group-data-vertical/tabs:h-(--active-tab-height) group-data-vertical/tabs:w-0.5"
|
|
526
|
+
) : "left-(--active-tab-left) top-(--active-tab-top) h-(--active-tab-height) w-(--active-tab-width) bg-background dark:border-input dark:bg-input/30 rounded-md border border-transparent shadow-sm",
|
|
527
|
+
className
|
|
528
|
+
),
|
|
529
|
+
...props
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
function TabsContent({ className, ...props }) {
|
|
534
|
+
return /* @__PURE__ */ jsx(
|
|
535
|
+
Tabs$1.Panel,
|
|
536
|
+
{
|
|
537
|
+
"data-slot": "tabs-content",
|
|
538
|
+
className: cn(
|
|
539
|
+
"transition-fade data-ending-style:opacity-0 data-hidden:opacity-0 data-starting-style:opacity-0 group-data-horizontal/tabs:row-start-2 group-data-horizontal/tabs:col-start-1 group-data-vertical/tabs:col-start-2 group-data-vertical/tabs:row-start-1 min-h-0 min-w-0 flex-1 text-sm outline-none",
|
|
540
|
+
className
|
|
541
|
+
),
|
|
542
|
+
...props
|
|
543
|
+
}
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
var textareaVariants = cva(
|
|
547
|
+
// base classes shared across all variants:
|
|
548
|
+
"min-w-0 w-full outline-none transition-theme resize-none placeholder:text-muted-foreground",
|
|
549
|
+
{
|
|
550
|
+
variants: {
|
|
551
|
+
variant: {
|
|
552
|
+
default: "bg-transparent border border-input rounded-lg px-2.5 py-1 text-sm min-h-[80px] focus-ring disabled:bg-input/50 disabled:cursor-not-allowed disabled:opacity-50 dark:disabled:bg-input/80",
|
|
553
|
+
code: (
|
|
554
|
+
// only textarea-specific classes; the outer container is handled in the component
|
|
555
|
+
"flex-1 bg-transparent py-2 pl-3 font-mono text-xs text-zinc-200 disabled:cursor-default leading-[1.25rem]"
|
|
556
|
+
),
|
|
557
|
+
yaml: ""
|
|
558
|
+
},
|
|
559
|
+
state: {
|
|
560
|
+
default: "",
|
|
561
|
+
error: "border-destructive bg-destructive/5 dark:border-destructive/50 dark:bg-destructive/10",
|
|
562
|
+
success: "border-success bg-success/5 dark:border-success dark:bg-success/5",
|
|
563
|
+
warning: "border-warning bg-warning/5 dark:border-warning dark:bg-warning/5",
|
|
564
|
+
loading: "opacity-75 cursor-not-allowed"
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
defaultVariants: {
|
|
568
|
+
variant: "default",
|
|
569
|
+
state: "default"
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
var YC = {
|
|
574
|
+
bg: "#1e1e1e",
|
|
575
|
+
lineNum: "#858585",
|
|
576
|
+
lineNumBorder: "#303030",
|
|
577
|
+
comment: "#6a9955",
|
|
578
|
+
key: "#9cdcfe",
|
|
579
|
+
punct: "#d4d4d4",
|
|
580
|
+
string: "#ce9178",
|
|
581
|
+
bool: "#569cd6",
|
|
582
|
+
number: "#b5cea8",
|
|
583
|
+
default: "#d4d4d4"
|
|
584
|
+
};
|
|
585
|
+
var BOOLEAN_RE = /^(true|false|yes|no|null|~)$/i;
|
|
586
|
+
var NUMBER_RE = /^-?\d+(\.\d+)?(e[+-]?\d+)?$/i;
|
|
587
|
+
var ScalarValue = ({ raw, searchTerm, absoluteStart, activeMatchCharIdx }) => {
|
|
588
|
+
const trimmed = raw.trim();
|
|
589
|
+
const hl = /* @__PURE__ */ jsx(
|
|
590
|
+
SplitAndHighlightText,
|
|
591
|
+
{
|
|
592
|
+
text: raw,
|
|
593
|
+
term: searchTerm ?? "",
|
|
594
|
+
absoluteStart,
|
|
595
|
+
activeMatchCharIdx
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
if (!trimmed || /^[|>][+-]?$/.test(trimmed)) return /* @__PURE__ */ jsx("span", { style: { color: YC.punct }, children: hl });
|
|
599
|
+
if (trimmed.startsWith('"') || trimmed.startsWith("'"))
|
|
600
|
+
return /* @__PURE__ */ jsx("span", { style: { color: YC.string }, children: hl });
|
|
601
|
+
if (BOOLEAN_RE.test(trimmed)) return /* @__PURE__ */ jsx("span", { style: { color: YC.bool }, children: hl });
|
|
602
|
+
if (NUMBER_RE.test(trimmed)) return /* @__PURE__ */ jsx("span", { style: { color: YC.number }, children: hl });
|
|
603
|
+
return /* @__PURE__ */ jsx("span", { style: { color: YC.default }, children: hl });
|
|
604
|
+
};
|
|
605
|
+
var YamlValue = ({ raw, searchTerm, absoluteStart, activeMatchCharIdx }) => {
|
|
606
|
+
const trimmed = raw.trim();
|
|
607
|
+
if (!trimmed) {
|
|
608
|
+
return /* @__PURE__ */ jsx("span", { style: { color: YC.punct }, children: raw });
|
|
609
|
+
}
|
|
610
|
+
const isQuoted = trimmed.startsWith('"') || trimmed.startsWith("'");
|
|
611
|
+
if (!isQuoted) {
|
|
612
|
+
const commentIdx = raw.search(/\s+#/);
|
|
613
|
+
if (commentIdx !== -1) {
|
|
614
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
615
|
+
/* @__PURE__ */ jsx(
|
|
616
|
+
ScalarValue,
|
|
617
|
+
{
|
|
618
|
+
raw: raw.slice(0, commentIdx),
|
|
619
|
+
searchTerm,
|
|
620
|
+
absoluteStart,
|
|
621
|
+
activeMatchCharIdx
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
/* @__PURE__ */ jsx("span", { style: { color: YC.comment }, children: /* @__PURE__ */ jsx(
|
|
625
|
+
SplitAndHighlightText,
|
|
626
|
+
{
|
|
627
|
+
text: raw.slice(commentIdx),
|
|
628
|
+
term: searchTerm ?? "",
|
|
629
|
+
absoluteStart: absoluteStart !== void 0 ? absoluteStart + commentIdx : void 0,
|
|
630
|
+
activeMatchCharIdx
|
|
631
|
+
}
|
|
632
|
+
) })
|
|
633
|
+
] });
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return /* @__PURE__ */ jsx(
|
|
637
|
+
ScalarValue,
|
|
638
|
+
{
|
|
639
|
+
raw,
|
|
640
|
+
searchTerm,
|
|
641
|
+
absoluteStart,
|
|
642
|
+
activeMatchCharIdx
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
var YamlLine = ({ line, searchTerm, lineStart = 0, activeMatchCharIdx }) => {
|
|
647
|
+
const trimmed = line.trim();
|
|
648
|
+
if (!trimmed) {
|
|
649
|
+
return /* @__PURE__ */ jsx("span", { style: { color: YC.default }, children: " " });
|
|
650
|
+
}
|
|
651
|
+
if (trimmed.startsWith("#"))
|
|
652
|
+
return /* @__PURE__ */ jsx("span", { style: { color: YC.comment }, children: /* @__PURE__ */ jsx(
|
|
653
|
+
SplitAndHighlightText,
|
|
654
|
+
{
|
|
655
|
+
text: line,
|
|
656
|
+
term: searchTerm ?? "",
|
|
657
|
+
absoluteStart: lineStart,
|
|
658
|
+
activeMatchCharIdx
|
|
659
|
+
}
|
|
660
|
+
) });
|
|
661
|
+
const keyMatch = line.match(/^(\s*)([\w.-]+)(\s*:)(.*)$/);
|
|
662
|
+
if (keyMatch) {
|
|
663
|
+
const [, indent, key, colon, rest] = keyMatch;
|
|
664
|
+
const keyAbsStart = lineStart + indent.length;
|
|
665
|
+
const restAbsStart = keyAbsStart + key.length + colon.length;
|
|
666
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
667
|
+
/* @__PURE__ */ jsx("span", { style: { color: YC.default }, children: indent }),
|
|
668
|
+
/* @__PURE__ */ jsx("span", { style: { color: YC.key }, children: /* @__PURE__ */ jsx(
|
|
669
|
+
SplitAndHighlightText,
|
|
670
|
+
{
|
|
671
|
+
text: key,
|
|
672
|
+
term: searchTerm ?? "",
|
|
673
|
+
absoluteStart: keyAbsStart,
|
|
674
|
+
activeMatchCharIdx
|
|
675
|
+
}
|
|
676
|
+
) }),
|
|
677
|
+
/* @__PURE__ */ jsx("span", { style: { color: YC.punct }, children: colon }),
|
|
678
|
+
/* @__PURE__ */ jsx(
|
|
679
|
+
YamlValue,
|
|
680
|
+
{
|
|
681
|
+
raw: rest,
|
|
682
|
+
searchTerm,
|
|
683
|
+
absoluteStart: restAbsStart,
|
|
684
|
+
activeMatchCharIdx
|
|
685
|
+
}
|
|
686
|
+
)
|
|
687
|
+
] });
|
|
688
|
+
}
|
|
689
|
+
const arrayMatch = line.match(/^(\s*-\s?)(.*)$/);
|
|
690
|
+
if (arrayMatch) {
|
|
691
|
+
const [, prefix, rest] = arrayMatch;
|
|
692
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
693
|
+
/* @__PURE__ */ jsx("span", { style: { color: YC.punct }, children: prefix }),
|
|
694
|
+
/* @__PURE__ */ jsx(
|
|
695
|
+
YamlValue,
|
|
696
|
+
{
|
|
697
|
+
raw: rest,
|
|
698
|
+
searchTerm,
|
|
699
|
+
absoluteStart: lineStart + prefix.length,
|
|
700
|
+
activeMatchCharIdx
|
|
701
|
+
}
|
|
702
|
+
)
|
|
703
|
+
] });
|
|
704
|
+
}
|
|
705
|
+
return /* @__PURE__ */ jsx("span", { style: { color: YC.default }, children: /* @__PURE__ */ jsx(
|
|
706
|
+
SplitAndHighlightText,
|
|
707
|
+
{
|
|
708
|
+
text: line,
|
|
709
|
+
term: searchTerm ?? "",
|
|
710
|
+
absoluteStart: lineStart,
|
|
711
|
+
activeMatchCharIdx
|
|
712
|
+
}
|
|
713
|
+
) });
|
|
714
|
+
};
|
|
715
|
+
function TextareaYaml({
|
|
716
|
+
className,
|
|
717
|
+
value,
|
|
718
|
+
borderRounded = true,
|
|
719
|
+
editable = false,
|
|
720
|
+
onChange,
|
|
721
|
+
searchTerm,
|
|
722
|
+
activeMatchCharIdx,
|
|
723
|
+
"aria-label": ariaLabel = "YAML editor"
|
|
724
|
+
}) {
|
|
725
|
+
const text = typeof value === "string" ? value : "";
|
|
726
|
+
const lines = text.split("\n");
|
|
727
|
+
const gutterWidth = `${String(lines.length).length + 2}ch`;
|
|
728
|
+
const lineStarts = [];
|
|
729
|
+
let offset = 0;
|
|
730
|
+
for (const line of lines) {
|
|
731
|
+
lineStarts.push(offset);
|
|
732
|
+
offset += line.length + 1;
|
|
733
|
+
}
|
|
734
|
+
const { copiedValue: isCopied, copy } = useCopyToClipboard();
|
|
735
|
+
const highlightRef = React.useRef(null);
|
|
736
|
+
const gutterRef = React.useRef(null);
|
|
737
|
+
const syncScroll = (e) => {
|
|
738
|
+
const { scrollTop, scrollLeft } = e.currentTarget;
|
|
739
|
+
if (highlightRef.current) {
|
|
740
|
+
highlightRef.current.scrollTop = scrollTop;
|
|
741
|
+
highlightRef.current.scrollLeft = scrollLeft;
|
|
742
|
+
}
|
|
743
|
+
if (gutterRef.current) {
|
|
744
|
+
gutterRef.current.scrollTop = scrollTop;
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
const gutterLines = lines.map((_, i) => /* @__PURE__ */ jsx("div", { className: "leading-5", children: i + 1 }, `line-${i}`));
|
|
748
|
+
const gutterStyle = {
|
|
749
|
+
color: YC.lineNum,
|
|
750
|
+
borderRight: `1px solid ${YC.lineNumBorder}`,
|
|
751
|
+
width: gutterWidth,
|
|
752
|
+
minWidth: gutterWidth
|
|
753
|
+
};
|
|
754
|
+
const highlightRows = lines.map((line, i) => /* @__PURE__ */ jsx("div", { className: "whitespace-pre leading-5", children: /* @__PURE__ */ jsx(
|
|
755
|
+
YamlLine,
|
|
756
|
+
{
|
|
757
|
+
line,
|
|
758
|
+
searchTerm,
|
|
759
|
+
lineStart: lineStarts[i],
|
|
760
|
+
activeMatchCharIdx
|
|
761
|
+
}
|
|
762
|
+
) }, `${i}-${line}`));
|
|
763
|
+
return /* @__PURE__ */ jsxs(
|
|
764
|
+
"div",
|
|
765
|
+
{
|
|
766
|
+
className: cn(
|
|
767
|
+
"relative border font-mono text-xs",
|
|
768
|
+
editable && "h-full",
|
|
769
|
+
borderRounded && "rounded-md",
|
|
770
|
+
className
|
|
771
|
+
),
|
|
772
|
+
style: { backgroundColor: YC.bg },
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ jsx(
|
|
775
|
+
Button,
|
|
776
|
+
{
|
|
777
|
+
type: "button",
|
|
778
|
+
variant: "ghost",
|
|
779
|
+
size: "icon-sm",
|
|
780
|
+
className: "absolute right-1 top-1 z-10",
|
|
781
|
+
onClick: () => copy(text),
|
|
782
|
+
"aria-label": "Copy value",
|
|
783
|
+
children: isCopied ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-success h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(CopyIcon, { className: "h-3.5 w-3.5", style: { color: YC.lineNum } })
|
|
784
|
+
}
|
|
785
|
+
),
|
|
786
|
+
editable ? (
|
|
787
|
+
// Edit mode: textarea is the scroll source; gutter + highlight sync via onScroll
|
|
788
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full", children: [
|
|
789
|
+
/* @__PURE__ */ jsx(
|
|
790
|
+
"div",
|
|
791
|
+
{
|
|
792
|
+
ref: gutterRef,
|
|
793
|
+
className: "select-none overflow-hidden py-1 pl-2 pr-3 text-right font-mono text-xs leading-5",
|
|
794
|
+
style: gutterStyle,
|
|
795
|
+
children: gutterLines
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 overflow-hidden", children: [
|
|
799
|
+
/* @__PURE__ */ jsx(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
ref: highlightRef,
|
|
803
|
+
"aria-hidden": true,
|
|
804
|
+
className: "pointer-events-none absolute inset-0 overflow-hidden py-1 pl-4 pr-4",
|
|
805
|
+
children: highlightRows
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
/* @__PURE__ */ jsx(
|
|
809
|
+
"textarea",
|
|
810
|
+
{
|
|
811
|
+
value,
|
|
812
|
+
onChange: onChange ?? (() => {
|
|
813
|
+
}),
|
|
814
|
+
onScroll: syncScroll,
|
|
815
|
+
wrap: "off",
|
|
816
|
+
"data-yaml-editor": true,
|
|
817
|
+
"aria-label": ariaLabel,
|
|
818
|
+
className: "absolute inset-0 h-full w-full resize-none overflow-auto bg-transparent py-1 pl-4 pr-4 font-mono text-xs leading-5 outline-none",
|
|
819
|
+
style: { color: "transparent", caretColor: YC.default }
|
|
820
|
+
}
|
|
821
|
+
)
|
|
822
|
+
] })
|
|
823
|
+
] })
|
|
824
|
+
) : (
|
|
825
|
+
// Read-only mode: outer flex container scrolls everything together
|
|
826
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full overflow-auto", "data-yaml-scroll": true, children: [
|
|
827
|
+
/* @__PURE__ */ jsx(
|
|
828
|
+
"div",
|
|
829
|
+
{
|
|
830
|
+
className: "select-none py-1 pl-2 pr-3 text-right font-mono text-xs leading-5",
|
|
831
|
+
style: gutterStyle,
|
|
832
|
+
children: gutterLines
|
|
833
|
+
}
|
|
834
|
+
),
|
|
835
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 py-1", children: lines.map((line, i) => /* @__PURE__ */ jsx(
|
|
836
|
+
"div",
|
|
837
|
+
{
|
|
838
|
+
className: "whitespace-pre pl-4 pr-4 leading-5 hover:bg-white/5",
|
|
839
|
+
children: /* @__PURE__ */ jsx(
|
|
840
|
+
YamlLine,
|
|
841
|
+
{
|
|
842
|
+
line,
|
|
843
|
+
searchTerm,
|
|
844
|
+
lineStart: lineStarts[i],
|
|
845
|
+
activeMatchCharIdx
|
|
846
|
+
}
|
|
847
|
+
)
|
|
848
|
+
},
|
|
849
|
+
`${i}-${line}`
|
|
850
|
+
)) })
|
|
851
|
+
] })
|
|
852
|
+
)
|
|
853
|
+
]
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
function TextareaCode({
|
|
858
|
+
className,
|
|
859
|
+
value,
|
|
860
|
+
disabled,
|
|
861
|
+
borderRounded = true,
|
|
862
|
+
...props
|
|
863
|
+
}) {
|
|
864
|
+
const text = typeof value === "string" ? value : "";
|
|
865
|
+
const lines = text.split("\n");
|
|
866
|
+
const { copiedValue: isCopied, copy } = useCopyToClipboard();
|
|
867
|
+
return /* @__PURE__ */ jsxs(
|
|
868
|
+
"div",
|
|
869
|
+
{
|
|
870
|
+
className: cn(
|
|
871
|
+
"relative overflow-x-auto border border-zinc-800 bg-zinc-950",
|
|
872
|
+
borderRounded && "rounded-md",
|
|
873
|
+
className
|
|
874
|
+
),
|
|
875
|
+
children: [
|
|
876
|
+
/* @__PURE__ */ jsx(
|
|
877
|
+
Button,
|
|
878
|
+
{
|
|
879
|
+
type: "button",
|
|
880
|
+
variant: "ghost",
|
|
881
|
+
size: "icon-sm",
|
|
882
|
+
className: "absolute right-1 top-1 z-10",
|
|
883
|
+
onClick: () => copy(text),
|
|
884
|
+
"aria-label": "Copy value",
|
|
885
|
+
children: isCopied ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-success h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(CopyIcon, { className: "h-3.5 w-3.5" })
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
/* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
889
|
+
/* @__PURE__ */ jsx("div", { className: "select-none border-r border-zinc-800 py-2", children: lines.map((line, i) => /* @__PURE__ */ jsx(
|
|
890
|
+
"div",
|
|
891
|
+
{
|
|
892
|
+
className: "w-10 min-w-10 bg-zinc-950 pr-3 text-right font-mono text-xs leading-5 text-zinc-600",
|
|
893
|
+
children: i + 1
|
|
894
|
+
},
|
|
895
|
+
`${i}-${line}`
|
|
896
|
+
)) }),
|
|
897
|
+
disabled ? /* @__PURE__ */ jsx("pre", { className: "flex flex-1 flex-col py-2", children: lines.map((line, i) => /* @__PURE__ */ jsx("span", { className: "flex", children: /* @__PURE__ */ jsx("span", { className: "whitespace-pre pl-3 font-mono text-xs leading-5 text-zinc-200", children: line || " " }) }, `${i}-${line}`)) }) : /* @__PURE__ */ jsx(
|
|
898
|
+
"textarea",
|
|
899
|
+
{
|
|
900
|
+
value,
|
|
901
|
+
rows: lines.length,
|
|
902
|
+
wrap: "off",
|
|
903
|
+
className: cn(textareaVariants({ variant: "code" })),
|
|
904
|
+
...props
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
] })
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
function Textarea({
|
|
913
|
+
className,
|
|
914
|
+
variant = "default",
|
|
915
|
+
state = "default",
|
|
916
|
+
value,
|
|
917
|
+
borderRounded = true,
|
|
918
|
+
searchTerm,
|
|
919
|
+
activeMatchCharIdx,
|
|
920
|
+
editable,
|
|
921
|
+
onChange,
|
|
922
|
+
"aria-label": ariaLabel,
|
|
923
|
+
...props
|
|
924
|
+
}) {
|
|
925
|
+
if (variant === "code") {
|
|
926
|
+
return /* @__PURE__ */ jsx(
|
|
927
|
+
TextareaCode,
|
|
928
|
+
{
|
|
929
|
+
className,
|
|
930
|
+
value,
|
|
931
|
+
borderRounded,
|
|
932
|
+
"aria-label": ariaLabel,
|
|
933
|
+
...props
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
if (variant === "yaml") {
|
|
938
|
+
return /* @__PURE__ */ jsx(
|
|
939
|
+
TextareaYaml,
|
|
940
|
+
{
|
|
941
|
+
className,
|
|
942
|
+
value,
|
|
943
|
+
borderRounded,
|
|
944
|
+
editable,
|
|
945
|
+
onChange,
|
|
946
|
+
searchTerm,
|
|
947
|
+
activeMatchCharIdx,
|
|
948
|
+
"aria-label": ariaLabel
|
|
949
|
+
}
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
return /* @__PURE__ */ jsx(
|
|
953
|
+
"textarea",
|
|
954
|
+
{
|
|
955
|
+
value,
|
|
956
|
+
"aria-label": ariaLabel,
|
|
957
|
+
className: cn(
|
|
958
|
+
textareaVariants({ variant, state }),
|
|
959
|
+
!borderRounded && "rounded-none",
|
|
960
|
+
className
|
|
961
|
+
),
|
|
962
|
+
...props
|
|
963
|
+
}
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export { Checkbox, Collapsible, CollapsiblePanel, CollapsibleTrigger, ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuPortal, ContextMenuSeparator, ContextMenuTrigger, Drawer, DrawerContent, DrawerPopup, DrawerPortal, DrawerViewport, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, Switch, Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger, Textarea, Toaster, textareaVariants };
|