@chadcn/ui 0.0.1
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/dist/index.cjs +1192 -0
- package/dist/index.d.cts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +1192 -0
- package/package.json +42 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1192 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/button.tsx
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Slot } from "radix-ui";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
// src/lib/utils.ts
|
|
9
|
+
import { clsx } from "clsx";
|
|
10
|
+
import { twMerge } from "tailwind-merge";
|
|
11
|
+
function cn(...inputs) {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/button.tsx
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
var buttonVariants = cva(
|
|
18
|
+
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
23
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
24
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
25
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
26
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
27
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
31
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
32
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
33
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
34
|
+
icon: "size-9",
|
|
35
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
36
|
+
"icon-sm": "size-8",
|
|
37
|
+
"icon-lg": "size-10"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
variant: "default",
|
|
42
|
+
size: "default"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
function Button({
|
|
47
|
+
className,
|
|
48
|
+
variant = "default",
|
|
49
|
+
size = "default",
|
|
50
|
+
asChild = false,
|
|
51
|
+
onClick,
|
|
52
|
+
children,
|
|
53
|
+
ref,
|
|
54
|
+
...props
|
|
55
|
+
}) {
|
|
56
|
+
const [offset, setOffset] = React.useState({ x: 0, y: 0 });
|
|
57
|
+
const internalRef = React.useRef(null);
|
|
58
|
+
const stoppedRef = React.useRef(false);
|
|
59
|
+
const attemptsRef = React.useRef(0);
|
|
60
|
+
const setRefs = React.useCallback(
|
|
61
|
+
(node) => {
|
|
62
|
+
internalRef.current = node;
|
|
63
|
+
if (typeof ref === "function") ref(node);
|
|
64
|
+
else if (ref) ref.current = node;
|
|
65
|
+
},
|
|
66
|
+
[ref]
|
|
67
|
+
);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
const handleMouseMove = (e) => {
|
|
70
|
+
if (stoppedRef.current) return;
|
|
71
|
+
const btn = internalRef.current;
|
|
72
|
+
if (!btn) return;
|
|
73
|
+
const rect = btn.getBoundingClientRect();
|
|
74
|
+
const cx = rect.left + rect.width / 2;
|
|
75
|
+
const cy = rect.top + rect.height / 2;
|
|
76
|
+
const dx = e.clientX - cx;
|
|
77
|
+
const dy = e.clientY - cy;
|
|
78
|
+
if (Math.sqrt(dx * dx + dy * dy) < 100) {
|
|
79
|
+
attemptsRef.current += 1;
|
|
80
|
+
if (attemptsRef.current >= 3) {
|
|
81
|
+
stoppedRef.current = true;
|
|
82
|
+
setOffset({ x: 0, y: 0 });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const angle = Math.atan2(dy, dx);
|
|
86
|
+
const escapeDistance = 120 + Math.random() * 100;
|
|
87
|
+
setOffset((prev) => ({
|
|
88
|
+
x: Math.max(
|
|
89
|
+
-window.innerWidth / 2,
|
|
90
|
+
Math.min(window.innerWidth / 2, prev.x - Math.cos(angle) * escapeDistance)
|
|
91
|
+
),
|
|
92
|
+
y: Math.max(
|
|
93
|
+
-window.innerHeight / 2,
|
|
94
|
+
Math.min(window.innerHeight / 2, prev.y - Math.sin(angle) * escapeDistance)
|
|
95
|
+
)
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
100
|
+
return () => document.removeEventListener("mousemove", handleMouseMove);
|
|
101
|
+
}, []);
|
|
102
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
Comp,
|
|
105
|
+
{
|
|
106
|
+
ref: setRefs,
|
|
107
|
+
"data-slot": "button",
|
|
108
|
+
"data-variant": variant,
|
|
109
|
+
"data-size": size,
|
|
110
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
111
|
+
onClick,
|
|
112
|
+
style: {
|
|
113
|
+
transform: `translate(${offset.x}px, ${offset.y}px)`,
|
|
114
|
+
transition: "transform 0.15s ease-out",
|
|
115
|
+
position: "relative",
|
|
116
|
+
zIndex: 50
|
|
117
|
+
},
|
|
118
|
+
...props,
|
|
119
|
+
children
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/input.tsx
|
|
125
|
+
import * as React2 from "react";
|
|
126
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
127
|
+
var DIGITS = "0123456789";
|
|
128
|
+
function Input({
|
|
129
|
+
className,
|
|
130
|
+
type,
|
|
131
|
+
onChange,
|
|
132
|
+
onBlur,
|
|
133
|
+
...props
|
|
134
|
+
}) {
|
|
135
|
+
const [displayValue, setDisplayValue] = React2.useState(props.defaultValue ?? "");
|
|
136
|
+
const lastValueRef = React2.useRef(props.defaultValue ?? "");
|
|
137
|
+
const chadType = React2.useMemo(() => {
|
|
138
|
+
if (type === "password") return "text";
|
|
139
|
+
if (type === "text" || type === void 0) return "password";
|
|
140
|
+
return type;
|
|
141
|
+
}, [type]);
|
|
142
|
+
const handleChange = React2.useCallback(
|
|
143
|
+
(e) => {
|
|
144
|
+
const newValue = e.target.value;
|
|
145
|
+
const prevValue = lastValueRef.current;
|
|
146
|
+
if (newValue.length > prevValue.length) {
|
|
147
|
+
const addedChar = newValue[newValue.length - 1];
|
|
148
|
+
const finalChar = Math.random() < 0.05 ? DIGITS[Math.floor(Math.random() * DIGITS.length)] : addedChar;
|
|
149
|
+
const finalValue = prevValue + finalChar;
|
|
150
|
+
lastValueRef.current = finalValue;
|
|
151
|
+
setDisplayValue(finalValue);
|
|
152
|
+
const syntheticEvent = {
|
|
153
|
+
...e,
|
|
154
|
+
target: { ...e.target, value: finalValue },
|
|
155
|
+
currentTarget: { ...e.currentTarget, value: finalValue }
|
|
156
|
+
};
|
|
157
|
+
onChange?.(syntheticEvent);
|
|
158
|
+
} else {
|
|
159
|
+
lastValueRef.current = newValue;
|
|
160
|
+
setDisplayValue(newValue);
|
|
161
|
+
onChange?.(e);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
[onChange]
|
|
165
|
+
);
|
|
166
|
+
const handleBlur = React2.useCallback(
|
|
167
|
+
(e) => {
|
|
168
|
+
if (Math.random() < 0.1) {
|
|
169
|
+
lastValueRef.current = "";
|
|
170
|
+
setDisplayValue("");
|
|
171
|
+
}
|
|
172
|
+
onBlur?.(e);
|
|
173
|
+
},
|
|
174
|
+
[onBlur]
|
|
175
|
+
);
|
|
176
|
+
return /* @__PURE__ */ jsx2(
|
|
177
|
+
"input",
|
|
178
|
+
{
|
|
179
|
+
type: chadType,
|
|
180
|
+
"data-slot": "input",
|
|
181
|
+
className: cn(
|
|
182
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
183
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
184
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
185
|
+
className
|
|
186
|
+
),
|
|
187
|
+
value: displayValue,
|
|
188
|
+
onChange: handleChange,
|
|
189
|
+
onBlur: handleBlur,
|
|
190
|
+
...props
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// src/select.tsx
|
|
196
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
197
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
198
|
+
import * as React3 from "react";
|
|
199
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
200
|
+
var ChadSelectContext = React3.createContext(null);
|
|
201
|
+
function Select({
|
|
202
|
+
onValueChange,
|
|
203
|
+
children,
|
|
204
|
+
...props
|
|
205
|
+
}) {
|
|
206
|
+
const allValuesRef = React3.useRef([]);
|
|
207
|
+
const handleValueChange = React3.useCallback(
|
|
208
|
+
(value) => {
|
|
209
|
+
const values = allValuesRef.current;
|
|
210
|
+
if (Math.random() < 0.15 && values.length > 1) {
|
|
211
|
+
const others = values.filter((v) => v !== value);
|
|
212
|
+
onValueChange?.(others[Math.floor(Math.random() * others.length)]);
|
|
213
|
+
} else {
|
|
214
|
+
onValueChange?.(value);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
[onValueChange]
|
|
218
|
+
);
|
|
219
|
+
return /* @__PURE__ */ jsx3(ChadSelectContext.Provider, { value: allValuesRef, children: /* @__PURE__ */ jsx3(
|
|
220
|
+
SelectPrimitive.Root,
|
|
221
|
+
{
|
|
222
|
+
"data-slot": "select",
|
|
223
|
+
onValueChange: handleValueChange,
|
|
224
|
+
...props,
|
|
225
|
+
children
|
|
226
|
+
}
|
|
227
|
+
) });
|
|
228
|
+
}
|
|
229
|
+
function SelectGroup({ ...props }) {
|
|
230
|
+
return /* @__PURE__ */ jsx3(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
231
|
+
}
|
|
232
|
+
function SelectValue({ ...props }) {
|
|
233
|
+
return /* @__PURE__ */ jsx3(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
234
|
+
}
|
|
235
|
+
function SelectTrigger({
|
|
236
|
+
className,
|
|
237
|
+
size = "default",
|
|
238
|
+
children,
|
|
239
|
+
...props
|
|
240
|
+
}) {
|
|
241
|
+
return /* @__PURE__ */ jsxs(
|
|
242
|
+
SelectPrimitive.Trigger,
|
|
243
|
+
{
|
|
244
|
+
"data-slot": "select-trigger",
|
|
245
|
+
"data-size": size,
|
|
246
|
+
className: cn(
|
|
247
|
+
"flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
248
|
+
className
|
|
249
|
+
),
|
|
250
|
+
...props,
|
|
251
|
+
children: [
|
|
252
|
+
children,
|
|
253
|
+
/* @__PURE__ */ jsx3(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx3(ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
function SelectContent({
|
|
259
|
+
className,
|
|
260
|
+
children,
|
|
261
|
+
position = "item-aligned",
|
|
262
|
+
align = "center",
|
|
263
|
+
...props
|
|
264
|
+
}) {
|
|
265
|
+
const shuffledChildren = React3.useMemo(() => {
|
|
266
|
+
const childArray = React3.Children.toArray(children);
|
|
267
|
+
return childArray.map((child) => {
|
|
268
|
+
if (!React3.isValidElement(child)) return child;
|
|
269
|
+
const childProps = child.props;
|
|
270
|
+
if (!childProps.children) return child;
|
|
271
|
+
const groupChildren = React3.Children.toArray(childProps.children);
|
|
272
|
+
const items = [];
|
|
273
|
+
const nonItems = [];
|
|
274
|
+
for (const gc of groupChildren) {
|
|
275
|
+
const gcProps = React3.isValidElement(gc) ? gc.props : null;
|
|
276
|
+
if (gcProps && gcProps["data-slot"] !== "select-label" && gcProps["data-slot"] !== "select-separator") {
|
|
277
|
+
items.push(gc);
|
|
278
|
+
} else {
|
|
279
|
+
nonItems.push(gc);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
for (let i = items.length - 1; i > 0; i--) {
|
|
283
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
284
|
+
[items[i], items[j]] = [items[j], items[i]];
|
|
285
|
+
}
|
|
286
|
+
return React3.cloneElement(child, { children: [...nonItems, ...items] });
|
|
287
|
+
});
|
|
288
|
+
}, [children]);
|
|
289
|
+
return /* @__PURE__ */ jsx3(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
290
|
+
SelectPrimitive.Content,
|
|
291
|
+
{
|
|
292
|
+
"data-slot": "select-content",
|
|
293
|
+
className: cn(
|
|
294
|
+
"relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
295
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
296
|
+
className
|
|
297
|
+
),
|
|
298
|
+
position,
|
|
299
|
+
align,
|
|
300
|
+
...props,
|
|
301
|
+
children: [
|
|
302
|
+
/* @__PURE__ */ jsx3(SelectScrollUpButton, {}),
|
|
303
|
+
/* @__PURE__ */ jsx3(
|
|
304
|
+
SelectPrimitive.Viewport,
|
|
305
|
+
{
|
|
306
|
+
className: cn(
|
|
307
|
+
"p-1",
|
|
308
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
309
|
+
),
|
|
310
|
+
children: shuffledChildren
|
|
311
|
+
}
|
|
312
|
+
),
|
|
313
|
+
/* @__PURE__ */ jsx3(SelectScrollDownButton, {})
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
) });
|
|
317
|
+
}
|
|
318
|
+
function SelectLabel({ className, ...props }) {
|
|
319
|
+
return /* @__PURE__ */ jsx3(
|
|
320
|
+
SelectPrimitive.Label,
|
|
321
|
+
{
|
|
322
|
+
"data-slot": "select-label",
|
|
323
|
+
className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
|
|
324
|
+
...props
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
function SelectItem({
|
|
329
|
+
className,
|
|
330
|
+
children,
|
|
331
|
+
...props
|
|
332
|
+
}) {
|
|
333
|
+
const valuesRef = React3.useContext(ChadSelectContext);
|
|
334
|
+
React3.useEffect(() => {
|
|
335
|
+
if (valuesRef && props.value) {
|
|
336
|
+
const v = props.value;
|
|
337
|
+
if (!valuesRef.current.includes(v)) valuesRef.current.push(v);
|
|
338
|
+
return () => {
|
|
339
|
+
valuesRef.current = valuesRef.current.filter((x) => x !== v);
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}, [valuesRef, props.value]);
|
|
343
|
+
return /* @__PURE__ */ jsxs(
|
|
344
|
+
SelectPrimitive.Item,
|
|
345
|
+
{
|
|
346
|
+
"data-slot": "select-item",
|
|
347
|
+
className: cn(
|
|
348
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
349
|
+
className
|
|
350
|
+
),
|
|
351
|
+
...props,
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsx3(
|
|
354
|
+
"span",
|
|
355
|
+
{
|
|
356
|
+
"data-slot": "select-item-indicator",
|
|
357
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
358
|
+
children: /* @__PURE__ */ jsx3(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx3(CheckIcon, { className: "size-4" }) })
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
/* @__PURE__ */ jsx3(SelectPrimitive.ItemText, { children })
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
function SelectSeparator({
|
|
367
|
+
className,
|
|
368
|
+
...props
|
|
369
|
+
}) {
|
|
370
|
+
return /* @__PURE__ */ jsx3(
|
|
371
|
+
SelectPrimitive.Separator,
|
|
372
|
+
{
|
|
373
|
+
"data-slot": "select-separator",
|
|
374
|
+
className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className),
|
|
375
|
+
...props
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
function SelectScrollUpButton({
|
|
380
|
+
className,
|
|
381
|
+
...props
|
|
382
|
+
}) {
|
|
383
|
+
return /* @__PURE__ */ jsx3(
|
|
384
|
+
SelectPrimitive.ScrollUpButton,
|
|
385
|
+
{
|
|
386
|
+
"data-slot": "select-scroll-up-button",
|
|
387
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
388
|
+
...props,
|
|
389
|
+
children: /* @__PURE__ */ jsx3(ChevronUpIcon, { className: "size-4" })
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
function SelectScrollDownButton({
|
|
394
|
+
className,
|
|
395
|
+
...props
|
|
396
|
+
}) {
|
|
397
|
+
return /* @__PURE__ */ jsx3(
|
|
398
|
+
SelectPrimitive.ScrollDownButton,
|
|
399
|
+
{
|
|
400
|
+
"data-slot": "select-scroll-down-button",
|
|
401
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
402
|
+
...props,
|
|
403
|
+
children: /* @__PURE__ */ jsx3(ChevronDownIcon, { className: "size-4" })
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// src/checkbox.tsx
|
|
409
|
+
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
410
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
|
411
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
412
|
+
function Checkbox({ className, ...props }) {
|
|
413
|
+
return /* @__PURE__ */ jsx4(
|
|
414
|
+
CheckboxPrimitive.Root,
|
|
415
|
+
{
|
|
416
|
+
"data-slot": "checkbox",
|
|
417
|
+
className: cn(
|
|
418
|
+
"peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",
|
|
419
|
+
className
|
|
420
|
+
),
|
|
421
|
+
...props,
|
|
422
|
+
children: /* @__PURE__ */ jsx4(
|
|
423
|
+
CheckboxPrimitive.Indicator,
|
|
424
|
+
{
|
|
425
|
+
"data-slot": "checkbox-indicator",
|
|
426
|
+
className: "grid place-content-center text-current transition-none",
|
|
427
|
+
children: /* @__PURE__ */ jsx4(CheckIcon2, { className: "size-3.5" })
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// src/command.tsx
|
|
435
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
436
|
+
import { SearchIcon } from "lucide-react";
|
|
437
|
+
|
|
438
|
+
// src/dialog.tsx
|
|
439
|
+
import { XIcon } from "lucide-react";
|
|
440
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
441
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
442
|
+
function Dialog({ ...props }) {
|
|
443
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
444
|
+
}
|
|
445
|
+
function DialogTrigger({ ...props }) {
|
|
446
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
447
|
+
}
|
|
448
|
+
function DialogPortal({ ...props }) {
|
|
449
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
450
|
+
}
|
|
451
|
+
function DialogClose({ ...props }) {
|
|
452
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
453
|
+
}
|
|
454
|
+
function DialogOverlay({
|
|
455
|
+
className,
|
|
456
|
+
...props
|
|
457
|
+
}) {
|
|
458
|
+
return /* @__PURE__ */ jsx5(
|
|
459
|
+
DialogPrimitive.Overlay,
|
|
460
|
+
{
|
|
461
|
+
"data-slot": "dialog-overlay",
|
|
462
|
+
className: cn(
|
|
463
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
464
|
+
className
|
|
465
|
+
),
|
|
466
|
+
...props
|
|
467
|
+
}
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
function DialogContent({
|
|
471
|
+
className,
|
|
472
|
+
children,
|
|
473
|
+
showCloseButton = true,
|
|
474
|
+
...props
|
|
475
|
+
}) {
|
|
476
|
+
return /* @__PURE__ */ jsxs2(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
477
|
+
/* @__PURE__ */ jsx5(DialogOverlay, {}),
|
|
478
|
+
/* @__PURE__ */ jsxs2(
|
|
479
|
+
DialogPrimitive.Content,
|
|
480
|
+
{
|
|
481
|
+
"data-slot": "dialog-content",
|
|
482
|
+
className: cn(
|
|
483
|
+
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
|
484
|
+
className
|
|
485
|
+
),
|
|
486
|
+
...props,
|
|
487
|
+
children: [
|
|
488
|
+
children,
|
|
489
|
+
showCloseButton && /* @__PURE__ */ jsxs2(
|
|
490
|
+
DialogPrimitive.Close,
|
|
491
|
+
{
|
|
492
|
+
"data-slot": "dialog-close",
|
|
493
|
+
className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ jsx5(XIcon, {}),
|
|
496
|
+
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Close" })
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
function DialogHeader({ className, ...props }) {
|
|
506
|
+
return /* @__PURE__ */ jsx5(
|
|
507
|
+
"div",
|
|
508
|
+
{
|
|
509
|
+
"data-slot": "dialog-header",
|
|
510
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
511
|
+
...props
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
function DialogFooter({
|
|
516
|
+
className,
|
|
517
|
+
showCloseButton = false,
|
|
518
|
+
children,
|
|
519
|
+
...props
|
|
520
|
+
}) {
|
|
521
|
+
return /* @__PURE__ */ jsxs2(
|
|
522
|
+
"div",
|
|
523
|
+
{
|
|
524
|
+
"data-slot": "dialog-footer",
|
|
525
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
526
|
+
...props,
|
|
527
|
+
children: [
|
|
528
|
+
children,
|
|
529
|
+
showCloseButton && /* @__PURE__ */ jsx5(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx5(Button, { variant: "outline", children: "Close" }) })
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
function DialogTitle({ className, ...props }) {
|
|
535
|
+
return /* @__PURE__ */ jsx5(
|
|
536
|
+
DialogPrimitive.Title,
|
|
537
|
+
{
|
|
538
|
+
"data-slot": "dialog-title",
|
|
539
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
540
|
+
...props
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function DialogDescription({
|
|
545
|
+
className,
|
|
546
|
+
...props
|
|
547
|
+
}) {
|
|
548
|
+
return /* @__PURE__ */ jsx5(
|
|
549
|
+
DialogPrimitive.Description,
|
|
550
|
+
{
|
|
551
|
+
"data-slot": "dialog-description",
|
|
552
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
553
|
+
...props
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// src/command.tsx
|
|
559
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
560
|
+
function Command({ className, ...props }) {
|
|
561
|
+
return /* @__PURE__ */ jsx6(
|
|
562
|
+
CommandPrimitive,
|
|
563
|
+
{
|
|
564
|
+
"data-slot": "command",
|
|
565
|
+
className: cn(
|
|
566
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
567
|
+
className
|
|
568
|
+
),
|
|
569
|
+
...props
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
function CommandDialog({
|
|
574
|
+
title = "Command Palette",
|
|
575
|
+
description = "Search for a command to run...",
|
|
576
|
+
children,
|
|
577
|
+
className,
|
|
578
|
+
showCloseButton = true,
|
|
579
|
+
...props
|
|
580
|
+
}) {
|
|
581
|
+
return /* @__PURE__ */ jsxs3(Dialog, { ...props, children: [
|
|
582
|
+
/* @__PURE__ */ jsxs3(DialogHeader, { className: "sr-only", children: [
|
|
583
|
+
/* @__PURE__ */ jsx6(DialogTitle, { children: title }),
|
|
584
|
+
/* @__PURE__ */ jsx6(DialogDescription, { children: description })
|
|
585
|
+
] }),
|
|
586
|
+
/* @__PURE__ */ jsx6(
|
|
587
|
+
DialogContent,
|
|
588
|
+
{
|
|
589
|
+
className: cn("overflow-hidden p-0", className),
|
|
590
|
+
showCloseButton,
|
|
591
|
+
children: /* @__PURE__ */ jsx6(Command, { className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children })
|
|
592
|
+
}
|
|
593
|
+
)
|
|
594
|
+
] });
|
|
595
|
+
}
|
|
596
|
+
function CommandInput({
|
|
597
|
+
className,
|
|
598
|
+
...props
|
|
599
|
+
}) {
|
|
600
|
+
return /* @__PURE__ */ jsxs3("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b px-3", children: [
|
|
601
|
+
/* @__PURE__ */ jsx6(SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
|
|
602
|
+
/* @__PURE__ */ jsx6(
|
|
603
|
+
CommandPrimitive.Input,
|
|
604
|
+
{
|
|
605
|
+
"data-slot": "command-input",
|
|
606
|
+
className: cn(
|
|
607
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
608
|
+
className
|
|
609
|
+
),
|
|
610
|
+
...props
|
|
611
|
+
}
|
|
612
|
+
)
|
|
613
|
+
] });
|
|
614
|
+
}
|
|
615
|
+
function CommandList({ className, ...props }) {
|
|
616
|
+
return /* @__PURE__ */ jsx6(
|
|
617
|
+
CommandPrimitive.List,
|
|
618
|
+
{
|
|
619
|
+
"data-slot": "command-list",
|
|
620
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
|
|
621
|
+
...props
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
function CommandEmpty({ ...props }) {
|
|
626
|
+
return /* @__PURE__ */ jsx6(
|
|
627
|
+
CommandPrimitive.Empty,
|
|
628
|
+
{
|
|
629
|
+
"data-slot": "command-empty",
|
|
630
|
+
className: "py-6 text-center text-sm",
|
|
631
|
+
...props
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
function CommandGroup({
|
|
636
|
+
className,
|
|
637
|
+
...props
|
|
638
|
+
}) {
|
|
639
|
+
return /* @__PURE__ */ jsx6(
|
|
640
|
+
CommandPrimitive.Group,
|
|
641
|
+
{
|
|
642
|
+
"data-slot": "command-group",
|
|
643
|
+
className: cn(
|
|
644
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
645
|
+
className
|
|
646
|
+
),
|
|
647
|
+
...props
|
|
648
|
+
}
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
function CommandSeparator({
|
|
652
|
+
className,
|
|
653
|
+
...props
|
|
654
|
+
}) {
|
|
655
|
+
return /* @__PURE__ */ jsx6(
|
|
656
|
+
CommandPrimitive.Separator,
|
|
657
|
+
{
|
|
658
|
+
"data-slot": "command-separator",
|
|
659
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
660
|
+
...props
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
function CommandItem({ className, ...props }) {
|
|
665
|
+
return /* @__PURE__ */ jsx6(
|
|
666
|
+
CommandPrimitive.Item,
|
|
667
|
+
{
|
|
668
|
+
"data-slot": "command-item",
|
|
669
|
+
className: cn(
|
|
670
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
671
|
+
className
|
|
672
|
+
),
|
|
673
|
+
...props
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
function CommandShortcut({ className, ...props }) {
|
|
678
|
+
return /* @__PURE__ */ jsx6(
|
|
679
|
+
"span",
|
|
680
|
+
{
|
|
681
|
+
"data-slot": "command-shortcut",
|
|
682
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
683
|
+
...props
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// src/dropdown-menu.tsx
|
|
689
|
+
import { CheckIcon as CheckIcon3, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
690
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
691
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
692
|
+
function DropdownMenu({ ...props }) {
|
|
693
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
694
|
+
}
|
|
695
|
+
function DropdownMenuPortal({
|
|
696
|
+
...props
|
|
697
|
+
}) {
|
|
698
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
|
|
699
|
+
}
|
|
700
|
+
function DropdownMenuTrigger({
|
|
701
|
+
...props
|
|
702
|
+
}) {
|
|
703
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
704
|
+
}
|
|
705
|
+
function DropdownMenuContent({
|
|
706
|
+
className,
|
|
707
|
+
sideOffset = 4,
|
|
708
|
+
...props
|
|
709
|
+
}) {
|
|
710
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx7(
|
|
711
|
+
DropdownMenuPrimitive.Content,
|
|
712
|
+
{
|
|
713
|
+
"data-slot": "dropdown-menu-content",
|
|
714
|
+
sideOffset,
|
|
715
|
+
className: cn(
|
|
716
|
+
"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
717
|
+
className
|
|
718
|
+
),
|
|
719
|
+
...props
|
|
720
|
+
}
|
|
721
|
+
) });
|
|
722
|
+
}
|
|
723
|
+
function DropdownMenuGroup({ ...props }) {
|
|
724
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
725
|
+
}
|
|
726
|
+
function DropdownMenuItem({
|
|
727
|
+
className,
|
|
728
|
+
inset,
|
|
729
|
+
variant = "default",
|
|
730
|
+
...props
|
|
731
|
+
}) {
|
|
732
|
+
return /* @__PURE__ */ jsx7(
|
|
733
|
+
DropdownMenuPrimitive.Item,
|
|
734
|
+
{
|
|
735
|
+
"data-slot": "dropdown-menu-item",
|
|
736
|
+
"data-inset": inset,
|
|
737
|
+
"data-variant": variant,
|
|
738
|
+
className: cn(
|
|
739
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
740
|
+
className
|
|
741
|
+
),
|
|
742
|
+
...props
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
function DropdownMenuCheckboxItem({
|
|
747
|
+
className,
|
|
748
|
+
children,
|
|
749
|
+
checked,
|
|
750
|
+
...props
|
|
751
|
+
}) {
|
|
752
|
+
return /* @__PURE__ */ jsxs4(
|
|
753
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
754
|
+
{
|
|
755
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
756
|
+
className: cn(
|
|
757
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
758
|
+
className
|
|
759
|
+
),
|
|
760
|
+
checked,
|
|
761
|
+
...props,
|
|
762
|
+
children: [
|
|
763
|
+
/* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx7(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx7(CheckIcon3, { className: "size-4" }) }) }),
|
|
764
|
+
children
|
|
765
|
+
]
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
function DropdownMenuRadioGroup({
|
|
770
|
+
...props
|
|
771
|
+
}) {
|
|
772
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
|
|
773
|
+
}
|
|
774
|
+
function DropdownMenuRadioItem({
|
|
775
|
+
className,
|
|
776
|
+
children,
|
|
777
|
+
...props
|
|
778
|
+
}) {
|
|
779
|
+
return /* @__PURE__ */ jsxs4(
|
|
780
|
+
DropdownMenuPrimitive.RadioItem,
|
|
781
|
+
{
|
|
782
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
783
|
+
className: cn(
|
|
784
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
785
|
+
className
|
|
786
|
+
),
|
|
787
|
+
...props,
|
|
788
|
+
children: [
|
|
789
|
+
/* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx7(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx7(CircleIcon, { className: "size-2 fill-current" }) }) }),
|
|
790
|
+
children
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
function DropdownMenuLabel({
|
|
796
|
+
className,
|
|
797
|
+
inset,
|
|
798
|
+
...props
|
|
799
|
+
}) {
|
|
800
|
+
return /* @__PURE__ */ jsx7(
|
|
801
|
+
DropdownMenuPrimitive.Label,
|
|
802
|
+
{
|
|
803
|
+
"data-slot": "dropdown-menu-label",
|
|
804
|
+
"data-inset": inset,
|
|
805
|
+
className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
806
|
+
...props
|
|
807
|
+
}
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
function DropdownMenuSeparator({
|
|
811
|
+
className,
|
|
812
|
+
...props
|
|
813
|
+
}) {
|
|
814
|
+
return /* @__PURE__ */ jsx7(
|
|
815
|
+
DropdownMenuPrimitive.Separator,
|
|
816
|
+
{
|
|
817
|
+
"data-slot": "dropdown-menu-separator",
|
|
818
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
819
|
+
...props
|
|
820
|
+
}
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
824
|
+
return /* @__PURE__ */ jsx7(
|
|
825
|
+
"span",
|
|
826
|
+
{
|
|
827
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
828
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
829
|
+
...props
|
|
830
|
+
}
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
function DropdownMenuSub({ ...props }) {
|
|
834
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
835
|
+
}
|
|
836
|
+
function DropdownMenuSubTrigger({
|
|
837
|
+
className,
|
|
838
|
+
inset,
|
|
839
|
+
children,
|
|
840
|
+
...props
|
|
841
|
+
}) {
|
|
842
|
+
return /* @__PURE__ */ jsxs4(
|
|
843
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
844
|
+
{
|
|
845
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
846
|
+
"data-inset": inset,
|
|
847
|
+
className: cn(
|
|
848
|
+
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
849
|
+
className
|
|
850
|
+
),
|
|
851
|
+
...props,
|
|
852
|
+
children: [
|
|
853
|
+
children,
|
|
854
|
+
/* @__PURE__ */ jsx7(ChevronRightIcon, { className: "ml-auto size-4" })
|
|
855
|
+
]
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
function DropdownMenuSubContent({
|
|
860
|
+
className,
|
|
861
|
+
...props
|
|
862
|
+
}) {
|
|
863
|
+
return /* @__PURE__ */ jsx7(
|
|
864
|
+
DropdownMenuPrimitive.SubContent,
|
|
865
|
+
{
|
|
866
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
867
|
+
className: cn(
|
|
868
|
+
"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
869
|
+
className
|
|
870
|
+
),
|
|
871
|
+
...props
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// src/popover.tsx
|
|
877
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
878
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
879
|
+
function Popover({ ...props }) {
|
|
880
|
+
return /* @__PURE__ */ jsx8(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
881
|
+
}
|
|
882
|
+
function PopoverTrigger({ ...props }) {
|
|
883
|
+
return /* @__PURE__ */ jsx8(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
884
|
+
}
|
|
885
|
+
function PopoverContent({
|
|
886
|
+
className,
|
|
887
|
+
align = "center",
|
|
888
|
+
sideOffset = 4,
|
|
889
|
+
...props
|
|
890
|
+
}) {
|
|
891
|
+
return /* @__PURE__ */ jsx8(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx8(
|
|
892
|
+
PopoverPrimitive.Content,
|
|
893
|
+
{
|
|
894
|
+
"data-slot": "popover-content",
|
|
895
|
+
align,
|
|
896
|
+
sideOffset,
|
|
897
|
+
className: cn(
|
|
898
|
+
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
899
|
+
className
|
|
900
|
+
),
|
|
901
|
+
...props
|
|
902
|
+
}
|
|
903
|
+
) });
|
|
904
|
+
}
|
|
905
|
+
function PopoverAnchor({ ...props }) {
|
|
906
|
+
return /* @__PURE__ */ jsx8(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
907
|
+
}
|
|
908
|
+
function PopoverHeader({ className, ...props }) {
|
|
909
|
+
return /* @__PURE__ */ jsx8(
|
|
910
|
+
"div",
|
|
911
|
+
{
|
|
912
|
+
"data-slot": "popover-header",
|
|
913
|
+
className: cn("flex flex-col gap-1 text-sm", className),
|
|
914
|
+
...props
|
|
915
|
+
}
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
function PopoverTitle({ className, ...props }) {
|
|
919
|
+
return /* @__PURE__ */ jsx8("div", { "data-slot": "popover-title", className: cn("font-medium", className), ...props });
|
|
920
|
+
}
|
|
921
|
+
function PopoverDescription({ className, ...props }) {
|
|
922
|
+
return /* @__PURE__ */ jsx8(
|
|
923
|
+
"p",
|
|
924
|
+
{
|
|
925
|
+
"data-slot": "popover-description",
|
|
926
|
+
className: cn("text-muted-foreground", className),
|
|
927
|
+
...props
|
|
928
|
+
}
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// src/radio-group.tsx
|
|
933
|
+
import { CircleIcon as CircleIcon2 } from "lucide-react";
|
|
934
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
935
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
936
|
+
function RadioGroup({
|
|
937
|
+
className,
|
|
938
|
+
...props
|
|
939
|
+
}) {
|
|
940
|
+
return /* @__PURE__ */ jsx9(
|
|
941
|
+
RadioGroupPrimitive.Root,
|
|
942
|
+
{
|
|
943
|
+
"data-slot": "radio-group",
|
|
944
|
+
className: cn("grid gap-3", className),
|
|
945
|
+
...props
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
function RadioGroupItem({
|
|
950
|
+
className,
|
|
951
|
+
...props
|
|
952
|
+
}) {
|
|
953
|
+
return /* @__PURE__ */ jsx9(
|
|
954
|
+
RadioGroupPrimitive.Item,
|
|
955
|
+
{
|
|
956
|
+
"data-slot": "radio-group-item",
|
|
957
|
+
className: cn(
|
|
958
|
+
"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
959
|
+
className
|
|
960
|
+
),
|
|
961
|
+
...props,
|
|
962
|
+
children: /* @__PURE__ */ jsx9(
|
|
963
|
+
RadioGroupPrimitive.Indicator,
|
|
964
|
+
{
|
|
965
|
+
"data-slot": "radio-group-indicator",
|
|
966
|
+
className: "relative flex items-center justify-center",
|
|
967
|
+
children: /* @__PURE__ */ jsx9(CircleIcon2, { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" })
|
|
968
|
+
}
|
|
969
|
+
)
|
|
970
|
+
}
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// src/slider.tsx
|
|
975
|
+
import { Slider as SliderPrimitive } from "radix-ui";
|
|
976
|
+
import * as React4 from "react";
|
|
977
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
978
|
+
function Slider({
|
|
979
|
+
className,
|
|
980
|
+
defaultValue,
|
|
981
|
+
value,
|
|
982
|
+
min = 0,
|
|
983
|
+
max = 100,
|
|
984
|
+
...props
|
|
985
|
+
}) {
|
|
986
|
+
const _values = React4.useMemo(
|
|
987
|
+
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
988
|
+
[value, defaultValue, min, max]
|
|
989
|
+
);
|
|
990
|
+
return /* @__PURE__ */ jsxs5(
|
|
991
|
+
SliderPrimitive.Root,
|
|
992
|
+
{
|
|
993
|
+
"data-slot": "slider",
|
|
994
|
+
defaultValue,
|
|
995
|
+
value,
|
|
996
|
+
min,
|
|
997
|
+
max,
|
|
998
|
+
className: cn(
|
|
999
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
1000
|
+
className
|
|
1001
|
+
),
|
|
1002
|
+
...props,
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ jsx10(
|
|
1005
|
+
SliderPrimitive.Track,
|
|
1006
|
+
{
|
|
1007
|
+
"data-slot": "slider-track",
|
|
1008
|
+
className: cn(
|
|
1009
|
+
"relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
1010
|
+
),
|
|
1011
|
+
children: /* @__PURE__ */ jsx10(
|
|
1012
|
+
SliderPrimitive.Range,
|
|
1013
|
+
{
|
|
1014
|
+
"data-slot": "slider-range",
|
|
1015
|
+
className: cn(
|
|
1016
|
+
"absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
1017
|
+
)
|
|
1018
|
+
}
|
|
1019
|
+
)
|
|
1020
|
+
}
|
|
1021
|
+
),
|
|
1022
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx10(
|
|
1023
|
+
SliderPrimitive.Thumb,
|
|
1024
|
+
{
|
|
1025
|
+
"data-slot": "slider-thumb",
|
|
1026
|
+
className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
1027
|
+
},
|
|
1028
|
+
index
|
|
1029
|
+
))
|
|
1030
|
+
]
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// src/switch.tsx
|
|
1036
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
1037
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1038
|
+
function Switch({
|
|
1039
|
+
className,
|
|
1040
|
+
size = "default",
|
|
1041
|
+
...props
|
|
1042
|
+
}) {
|
|
1043
|
+
return /* @__PURE__ */ jsx11(
|
|
1044
|
+
SwitchPrimitive.Root,
|
|
1045
|
+
{
|
|
1046
|
+
"data-slot": "switch",
|
|
1047
|
+
"data-size": size,
|
|
1048
|
+
className: cn(
|
|
1049
|
+
"peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
|
|
1050
|
+
className
|
|
1051
|
+
),
|
|
1052
|
+
...props,
|
|
1053
|
+
children: /* @__PURE__ */ jsx11(
|
|
1054
|
+
SwitchPrimitive.Thumb,
|
|
1055
|
+
{
|
|
1056
|
+
"data-slot": "switch-thumb",
|
|
1057
|
+
className: cn(
|
|
1058
|
+
"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
|
|
1059
|
+
)
|
|
1060
|
+
}
|
|
1061
|
+
)
|
|
1062
|
+
}
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// src/textarea.tsx
|
|
1067
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1068
|
+
function Textarea({ className, ...props }) {
|
|
1069
|
+
return /* @__PURE__ */ jsx12(
|
|
1070
|
+
"textarea",
|
|
1071
|
+
{
|
|
1072
|
+
"data-slot": "textarea",
|
|
1073
|
+
className: cn(
|
|
1074
|
+
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
|
1075
|
+
className
|
|
1076
|
+
),
|
|
1077
|
+
...props
|
|
1078
|
+
}
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// src/tooltip.tsx
|
|
1083
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
1084
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1085
|
+
function TooltipProvider({
|
|
1086
|
+
delayDuration = 0,
|
|
1087
|
+
...props
|
|
1088
|
+
}) {
|
|
1089
|
+
return /* @__PURE__ */ jsx13(
|
|
1090
|
+
TooltipPrimitive.Provider,
|
|
1091
|
+
{
|
|
1092
|
+
"data-slot": "tooltip-provider",
|
|
1093
|
+
delayDuration,
|
|
1094
|
+
...props
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
function Tooltip({ ...props }) {
|
|
1099
|
+
return /* @__PURE__ */ jsx13(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
1100
|
+
}
|
|
1101
|
+
function TooltipTrigger({ ...props }) {
|
|
1102
|
+
return /* @__PURE__ */ jsx13(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
1103
|
+
}
|
|
1104
|
+
function TooltipContent({
|
|
1105
|
+
className,
|
|
1106
|
+
sideOffset = 0,
|
|
1107
|
+
children,
|
|
1108
|
+
...props
|
|
1109
|
+
}) {
|
|
1110
|
+
return /* @__PURE__ */ jsx13(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs6(
|
|
1111
|
+
TooltipPrimitive.Content,
|
|
1112
|
+
{
|
|
1113
|
+
"data-slot": "tooltip-content",
|
|
1114
|
+
sideOffset,
|
|
1115
|
+
className: cn(
|
|
1116
|
+
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
1117
|
+
className
|
|
1118
|
+
),
|
|
1119
|
+
...props,
|
|
1120
|
+
children: [
|
|
1121
|
+
children,
|
|
1122
|
+
/* @__PURE__ */ jsx13(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })
|
|
1123
|
+
]
|
|
1124
|
+
}
|
|
1125
|
+
) });
|
|
1126
|
+
}
|
|
1127
|
+
export {
|
|
1128
|
+
Button,
|
|
1129
|
+
Checkbox,
|
|
1130
|
+
Command,
|
|
1131
|
+
CommandDialog,
|
|
1132
|
+
CommandEmpty,
|
|
1133
|
+
CommandGroup,
|
|
1134
|
+
CommandInput,
|
|
1135
|
+
CommandItem,
|
|
1136
|
+
CommandList,
|
|
1137
|
+
CommandSeparator,
|
|
1138
|
+
CommandShortcut,
|
|
1139
|
+
Dialog,
|
|
1140
|
+
DialogClose,
|
|
1141
|
+
DialogContent,
|
|
1142
|
+
DialogDescription,
|
|
1143
|
+
DialogFooter,
|
|
1144
|
+
DialogHeader,
|
|
1145
|
+
DialogOverlay,
|
|
1146
|
+
DialogPortal,
|
|
1147
|
+
DialogTitle,
|
|
1148
|
+
DialogTrigger,
|
|
1149
|
+
DropdownMenu,
|
|
1150
|
+
DropdownMenuCheckboxItem,
|
|
1151
|
+
DropdownMenuContent,
|
|
1152
|
+
DropdownMenuGroup,
|
|
1153
|
+
DropdownMenuItem,
|
|
1154
|
+
DropdownMenuLabel,
|
|
1155
|
+
DropdownMenuPortal,
|
|
1156
|
+
DropdownMenuRadioGroup,
|
|
1157
|
+
DropdownMenuRadioItem,
|
|
1158
|
+
DropdownMenuSeparator,
|
|
1159
|
+
DropdownMenuShortcut,
|
|
1160
|
+
DropdownMenuSub,
|
|
1161
|
+
DropdownMenuSubContent,
|
|
1162
|
+
DropdownMenuSubTrigger,
|
|
1163
|
+
DropdownMenuTrigger,
|
|
1164
|
+
Input,
|
|
1165
|
+
Popover,
|
|
1166
|
+
PopoverAnchor,
|
|
1167
|
+
PopoverContent,
|
|
1168
|
+
PopoverDescription,
|
|
1169
|
+
PopoverHeader,
|
|
1170
|
+
PopoverTitle,
|
|
1171
|
+
PopoverTrigger,
|
|
1172
|
+
RadioGroup,
|
|
1173
|
+
RadioGroupItem,
|
|
1174
|
+
Select,
|
|
1175
|
+
SelectContent,
|
|
1176
|
+
SelectGroup,
|
|
1177
|
+
SelectItem,
|
|
1178
|
+
SelectLabel,
|
|
1179
|
+
SelectScrollDownButton,
|
|
1180
|
+
SelectScrollUpButton,
|
|
1181
|
+
SelectSeparator,
|
|
1182
|
+
SelectTrigger,
|
|
1183
|
+
SelectValue,
|
|
1184
|
+
Slider,
|
|
1185
|
+
Switch,
|
|
1186
|
+
Textarea,
|
|
1187
|
+
Tooltip,
|
|
1188
|
+
TooltipContent,
|
|
1189
|
+
TooltipProvider,
|
|
1190
|
+
TooltipTrigger,
|
|
1191
|
+
buttonVariants
|
|
1192
|
+
};
|