@kornorg/design-system 0.7.1 → 0.8.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/README.md +12 -6
- package/dist/index.d.ts +87 -103
- package/dist/index.mjs +405 -579
- package/dist/themes/cobalt.css +2 -2
- package/dist/themes/gestplate.css +2 -2
- package/dist/themes/modern-neutral.css +2 -2
- package/dist/themes/spartan.css +2 -2
- package/dist/themes/sprout.css +2 -2
- package/dist/themes/warm.css +2 -2
- package/dist/tokens.d.ts +135 -159
- package/dist/tokens.mjs +130 -84
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,638 +1,464 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cva } from
|
|
3
|
-
import { clsx } from
|
|
4
|
-
import { twMerge } from
|
|
5
|
-
import { jsx, jsxs
|
|
6
|
-
import {
|
|
7
|
-
import { Check,
|
|
8
|
-
import * as React from
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Avatar as Avatar$1, Checkbox as Checkbox$1, Dialog as Dialog$1, Label as Label$1, Select as Select$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1 } from "radix-ui";
|
|
7
|
+
import { Check, ChevronDown, Monitor, Moon, Sun, X } from "lucide-react";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
// src/lib/utils.ts
|
|
10
|
+
/**
|
|
11
|
+
* Merge class names with Tailwind-aware conflict resolution.
|
|
12
|
+
* Later classes win when utilities collide (e.g. `cn("p-2", "p-4")` → `"p-4"`).
|
|
13
|
+
*/
|
|
11
14
|
function cn(...inputs) {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
variant: "default"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
15
|
+
return twMerge(clsx(inputs));
|
|
16
|
+
}
|
|
17
|
+
// src/components/ui/alert.tsx
|
|
18
|
+
const alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:size-4 [&>svg~*]:pl-7", {
|
|
19
|
+
variants: { variant: {
|
|
20
|
+
default: "bg-card text-card-foreground",
|
|
21
|
+
destructive: "border-destructive/50 text-destructive [&>svg]:text-destructive bg-destructive/5",
|
|
22
|
+
success: "border-success/50 text-success [&>svg]:text-success bg-success/5",
|
|
23
|
+
warning: "border-warning/60 text-warning [&>svg]:text-warning bg-warning/5"
|
|
24
|
+
} },
|
|
25
|
+
defaultVariants: { variant: "default" }
|
|
26
|
+
});
|
|
30
27
|
function Alert({ className, variant, ...props }) {
|
|
31
|
-
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
role: "alert",
|
|
30
|
+
className: cn(alertVariants({ variant }), className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
32
33
|
}
|
|
33
34
|
function AlertTitle({ className, ...props }) {
|
|
34
|
-
|
|
35
|
+
return /* @__PURE__ */ jsx("h5", {
|
|
36
|
+
className: cn("mb-1 font-medium leading-none tracking-tight", className),
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
35
39
|
}
|
|
36
40
|
function AlertDescription({ className, ...props }) {
|
|
37
|
-
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: cn("text-sm [&_p]:leading-relaxed opacity-90", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
38
45
|
}
|
|
46
|
+
// src/components/ui/avatar.tsx
|
|
39
47
|
function Avatar({ className, ...props }) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
var badgeVariants = cva(
|
|
70
|
-
"inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors [&_svg]:size-3",
|
|
71
|
-
{
|
|
72
|
-
variants: {
|
|
73
|
-
variant: {
|
|
74
|
-
default: "border-transparent bg-primary text-primary-foreground",
|
|
75
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
76
|
-
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
77
|
-
success: "border-transparent bg-success text-success-foreground",
|
|
78
|
-
warning: "border-transparent bg-warning text-warning-foreground",
|
|
79
|
-
outline: "border-border text-foreground"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
defaultVariants: {
|
|
83
|
-
variant: "default"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
);
|
|
48
|
+
return /* @__PURE__ */ jsx(Avatar$1.Root, {
|
|
49
|
+
className: cn("relative flex size-9 shrink-0 overflow-hidden rounded-full", className),
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function AvatarImage({ className, ...props }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(Avatar$1.Image, {
|
|
55
|
+
className: cn("aspect-square size-full", className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function AvatarFallback({ className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx(Avatar$1.Fallback, {
|
|
61
|
+
className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm font-medium text-muted-foreground", className),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// src/components/ui/badge.tsx
|
|
66
|
+
const badgeVariants = cva("inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors [&_svg]:size-3", {
|
|
67
|
+
variants: { variant: {
|
|
68
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
69
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
70
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
71
|
+
success: "border-transparent bg-success text-success-foreground",
|
|
72
|
+
warning: "border-transparent bg-warning text-warning-foreground",
|
|
73
|
+
outline: "border-border text-foreground"
|
|
74
|
+
} },
|
|
75
|
+
defaultVariants: { variant: "default" }
|
|
76
|
+
});
|
|
87
77
|
function Badge({ className, variant, ...props }) {
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
78
|
+
return /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: cn(badgeVariants({ variant }), className),
|
|
80
|
+
...props
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// src/components/ui/button.tsx
|
|
84
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
85
|
+
variants: {
|
|
86
|
+
variant: {
|
|
87
|
+
primary: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
88
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
89
|
+
destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",
|
|
90
|
+
outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
91
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
92
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
93
|
+
},
|
|
94
|
+
size: {
|
|
95
|
+
sm: "h-8 px-3 text-xs",
|
|
96
|
+
md: "h-9 px-4",
|
|
97
|
+
lg: "h-10 px-6 text-base",
|
|
98
|
+
icon: "size-9"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: {
|
|
102
|
+
variant: "primary",
|
|
103
|
+
size: "md"
|
|
104
|
+
}
|
|
105
|
+
});
|
|
115
106
|
function Button({ className, variant, size, asChild = false, ...props }) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
107
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
108
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
109
|
+
className: cn(buttonVariants({
|
|
110
|
+
variant,
|
|
111
|
+
size,
|
|
112
|
+
className
|
|
113
|
+
})),
|
|
114
|
+
...props
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// src/components/ui/card.tsx
|
|
119
118
|
function Card({ className, ...props }) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"rounded-xl border border-border bg-card text-card-foreground shadow-sm",
|
|
125
|
-
className
|
|
126
|
-
),
|
|
127
|
-
...props
|
|
128
|
-
}
|
|
129
|
-
);
|
|
119
|
+
return /* @__PURE__ */ jsx("div", {
|
|
120
|
+
className: cn("rounded-xl border border-border bg-card text-card-foreground shadow-sm", className),
|
|
121
|
+
...props
|
|
122
|
+
});
|
|
130
123
|
}
|
|
131
124
|
function CardHeader({ className, ...props }) {
|
|
132
|
-
|
|
125
|
+
return /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: cn("flex flex-col gap-1.5 p-6", className),
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
133
129
|
}
|
|
134
130
|
function CardTitle({ className, ...props }) {
|
|
135
|
-
|
|
131
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
132
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
133
|
+
...props
|
|
134
|
+
});
|
|
136
135
|
}
|
|
137
136
|
function CardDescription({ className, ...props }) {
|
|
138
|
-
|
|
137
|
+
return /* @__PURE__ */ jsx("p", {
|
|
138
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
139
141
|
}
|
|
140
142
|
function CardContent({ className, ...props }) {
|
|
141
|
-
|
|
143
|
+
return /* @__PURE__ */ jsx("div", {
|
|
144
|
+
className: cn("p-6 pt-0", className),
|
|
145
|
+
...props
|
|
146
|
+
});
|
|
142
147
|
}
|
|
143
148
|
function CardFooter({ className, ...props }) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
),
|
|
183
|
-
/* @__PURE__ */ jsxs(
|
|
184
|
-
Dialog$1.Content,
|
|
185
|
-
{
|
|
186
|
-
className: cn(
|
|
187
|
-
"fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-card p-6 shadow-lg",
|
|
188
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
189
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
190
|
-
className
|
|
191
|
-
),
|
|
192
|
-
...props,
|
|
193
|
-
children: [
|
|
194
|
-
children,
|
|
195
|
-
/* @__PURE__ */ jsxs(
|
|
196
|
-
Dialog$1.Close,
|
|
197
|
-
{
|
|
198
|
-
className: cn(
|
|
199
|
-
"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100",
|
|
200
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
201
|
-
),
|
|
202
|
-
children: [
|
|
203
|
-
/* @__PURE__ */ jsx(X, { className: "size-4" }),
|
|
204
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
)
|
|
211
|
-
] });
|
|
149
|
+
return /* @__PURE__ */ jsx("div", {
|
|
150
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
151
|
+
...props
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// src/components/ui/checkbox.tsx
|
|
155
|
+
function Checkbox({ className, ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
157
|
+
className: cn("peer size-4 shrink-0 rounded-sm border border-input shadow-xs transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", className),
|
|
158
|
+
...props,
|
|
159
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
|
|
160
|
+
className: "flex items-center justify-center text-current",
|
|
161
|
+
children: /* @__PURE__ */ jsx(Check, {
|
|
162
|
+
className: "size-3.5",
|
|
163
|
+
strokeWidth: 3
|
|
164
|
+
})
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// src/components/ui/dialog.tsx
|
|
169
|
+
const Dialog = Dialog$1.Root;
|
|
170
|
+
const DialogTrigger = Dialog$1.Trigger;
|
|
171
|
+
const DialogClose = Dialog$1.Close;
|
|
172
|
+
function DialogContent({ className, children, ...props }) {
|
|
173
|
+
return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [/* @__PURE__ */ jsx(Dialog$1.Overlay, { className: cn("fixed inset-0 z-50 bg-overlay", "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0") }), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
174
|
+
className: cn("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-card p-6 shadow-lg", "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className),
|
|
175
|
+
...props,
|
|
176
|
+
children: [children, /* @__PURE__ */ jsxs(Dialog$1.Close, {
|
|
177
|
+
className: cn("absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),
|
|
178
|
+
children: [/* @__PURE__ */ jsx(X, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
179
|
+
className: "sr-only",
|
|
180
|
+
children: "Close"
|
|
181
|
+
})]
|
|
182
|
+
})]
|
|
183
|
+
})] });
|
|
212
184
|
}
|
|
213
185
|
function DialogHeader({ className, ...props }) {
|
|
214
|
-
|
|
186
|
+
return /* @__PURE__ */ jsx("div", {
|
|
187
|
+
className: cn("flex flex-col gap-1.5 text-center sm:text-left", className),
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
215
190
|
}
|
|
216
191
|
function DialogFooter({ className, ...props }) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
function DialogDescription({
|
|
238
|
-
className,
|
|
239
|
-
...props
|
|
240
|
-
}) {
|
|
241
|
-
return /* @__PURE__ */ jsx(
|
|
242
|
-
Dialog$1.Description,
|
|
243
|
-
{
|
|
244
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
245
|
-
...props
|
|
246
|
-
}
|
|
247
|
-
);
|
|
248
|
-
}
|
|
192
|
+
return /* @__PURE__ */ jsx("div", {
|
|
193
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
194
|
+
...props
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function DialogTitle({ className, ...props }) {
|
|
198
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
199
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
200
|
+
...props
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function DialogDescription({ className, ...props }) {
|
|
204
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
205
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
206
|
+
...props
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
// src/components/ui/input.tsx
|
|
249
210
|
function Input({ className, type, ...props }) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-xs transition-colors",
|
|
256
|
-
"placeholder:text-muted-foreground",
|
|
257
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
258
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
259
|
-
"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
|
|
260
|
-
"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/30",
|
|
261
|
-
className
|
|
262
|
-
),
|
|
263
|
-
...props
|
|
264
|
-
}
|
|
265
|
-
);
|
|
211
|
+
return /* @__PURE__ */ jsx("input", {
|
|
212
|
+
type,
|
|
213
|
+
className: cn("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-xs transition-colors", "placeholder:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground", "aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/30", className),
|
|
214
|
+
...props
|
|
215
|
+
});
|
|
266
216
|
}
|
|
217
|
+
// src/components/ui/label.tsx
|
|
267
218
|
function Label({ className, ...props }) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
position,
|
|
316
|
-
className: cn(
|
|
317
|
-
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
|
|
318
|
-
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
319
|
-
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
320
|
-
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
321
|
-
className
|
|
322
|
-
),
|
|
323
|
-
...props,
|
|
324
|
-
children: /* @__PURE__ */ jsx(
|
|
325
|
-
Select$1.Viewport,
|
|
326
|
-
{
|
|
327
|
-
className: cn(
|
|
328
|
-
"p-1",
|
|
329
|
-
position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)]"
|
|
330
|
-
),
|
|
331
|
-
children
|
|
332
|
-
}
|
|
333
|
-
)
|
|
334
|
-
}
|
|
335
|
-
) });
|
|
336
|
-
}
|
|
337
|
-
function SelectLabel({
|
|
338
|
-
className,
|
|
339
|
-
...props
|
|
340
|
-
}) {
|
|
341
|
-
return /* @__PURE__ */ jsx(
|
|
342
|
-
Select$1.Label,
|
|
343
|
-
{
|
|
344
|
-
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
|
|
345
|
-
...props
|
|
346
|
-
}
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
function SelectItem({
|
|
350
|
-
className,
|
|
351
|
-
children,
|
|
352
|
-
...props
|
|
353
|
-
}) {
|
|
354
|
-
return /* @__PURE__ */ jsxs(
|
|
355
|
-
Select$1.Item,
|
|
356
|
-
{
|
|
357
|
-
className: cn(
|
|
358
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none",
|
|
359
|
-
"focus:bg-accent focus:text-accent-foreground",
|
|
360
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
361
|
-
className
|
|
362
|
-
),
|
|
363
|
-
...props,
|
|
364
|
-
children: [
|
|
365
|
-
/* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4" }) }) }),
|
|
366
|
-
/* @__PURE__ */ jsx(Select$1.ItemText, { children })
|
|
367
|
-
]
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
}
|
|
219
|
+
return /* @__PURE__ */ jsx(Label$1.Root, {
|
|
220
|
+
className: cn("text-sm font-medium leading-none select-none", "peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className),
|
|
221
|
+
...props
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
// src/components/ui/select.tsx
|
|
225
|
+
const Select = Select$1.Root;
|
|
226
|
+
const SelectGroup = Select$1.Group;
|
|
227
|
+
const SelectValue = Select$1.Value;
|
|
228
|
+
function SelectTrigger({ className, children, ...props }) {
|
|
229
|
+
return /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
230
|
+
className: cn("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs transition-colors", "data-[placeholder]:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
231
|
+
...props,
|
|
232
|
+
children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
233
|
+
asChild: true,
|
|
234
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 opacity-50" })
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function SelectContent({ className, children, position = "popper", ...props }) {
|
|
239
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Content, {
|
|
240
|
+
position,
|
|
241
|
+
className: cn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md", "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1", className),
|
|
242
|
+
...props,
|
|
243
|
+
children: /* @__PURE__ */ jsx(Select$1.Viewport, {
|
|
244
|
+
className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
245
|
+
children
|
|
246
|
+
})
|
|
247
|
+
}) });
|
|
248
|
+
}
|
|
249
|
+
function SelectLabel({ className, ...props }) {
|
|
250
|
+
return /* @__PURE__ */ jsx(Select$1.Label, {
|
|
251
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
|
|
252
|
+
...props
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function SelectItem({ className, children, ...props }) {
|
|
256
|
+
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
257
|
+
className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none", "focus:bg-accent focus:text-accent-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
258
|
+
...props,
|
|
259
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
260
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
261
|
+
children: /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4" }) })
|
|
262
|
+
}), /* @__PURE__ */ jsx(Select$1.ItemText, { children })]
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// src/components/ui/switch.tsx
|
|
371
266
|
function Switch({ className, ...props }) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
378
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
379
|
-
"data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
380
|
-
className
|
|
381
|
-
),
|
|
382
|
-
...props,
|
|
383
|
-
children: /* @__PURE__ */ jsx(
|
|
384
|
-
Switch$1.Thumb,
|
|
385
|
-
{
|
|
386
|
-
className: cn(
|
|
387
|
-
"pointer-events-none block size-4 rounded-full bg-background shadow-sm transition-transform",
|
|
388
|
-
"data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
389
|
-
)
|
|
390
|
-
}
|
|
391
|
-
)
|
|
392
|
-
}
|
|
393
|
-
);
|
|
267
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
268
|
+
className: cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className),
|
|
269
|
+
...props,
|
|
270
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, { className: cn("pointer-events-none block size-4 rounded-full bg-background shadow-sm transition-transform", "data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") })
|
|
271
|
+
});
|
|
394
272
|
}
|
|
273
|
+
// src/components/ui/table.tsx
|
|
395
274
|
function Table({ className, ...props }) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
className: "relative w-full overflow-x-auto",
|
|
407
|
-
tabIndex: 0,
|
|
408
|
-
role: "region",
|
|
409
|
-
"aria-label": "Scrollable table",
|
|
410
|
-
children: /* @__PURE__ */ jsx("table", { className: cn("w-full caption-bottom text-sm", className), ...props })
|
|
411
|
-
}
|
|
412
|
-
)
|
|
413
|
-
);
|
|
275
|
+
return /* @__PURE__ */ jsx("div", {
|
|
276
|
+
className: "relative w-full overflow-x-auto",
|
|
277
|
+
tabIndex: 0,
|
|
278
|
+
role: "region",
|
|
279
|
+
"aria-label": "Scrollable table",
|
|
280
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
281
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
282
|
+
...props
|
|
283
|
+
})
|
|
284
|
+
});
|
|
414
285
|
}
|
|
415
286
|
function TableHeader({ className, ...props }) {
|
|
416
|
-
|
|
287
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
288
|
+
className: cn("[&_tr]:border-b", className),
|
|
289
|
+
...props
|
|
290
|
+
});
|
|
417
291
|
}
|
|
418
292
|
function TableBody({ className, ...props }) {
|
|
419
|
-
|
|
293
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
294
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
295
|
+
...props
|
|
296
|
+
});
|
|
420
297
|
}
|
|
421
298
|
function TableFooter({ className, ...props }) {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
...props
|
|
427
|
-
}
|
|
428
|
-
);
|
|
299
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
300
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
301
|
+
...props
|
|
302
|
+
});
|
|
429
303
|
}
|
|
430
304
|
function TableRow({ className, ...props }) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
436
|
-
className
|
|
437
|
-
),
|
|
438
|
-
...props
|
|
439
|
-
}
|
|
440
|
-
);
|
|
305
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
306
|
+
className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
307
|
+
...props
|
|
308
|
+
});
|
|
441
309
|
}
|
|
442
310
|
function TableHead({ className, ...props }) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
"h-10 px-3 text-left align-middle font-medium text-muted-foreground",
|
|
448
|
-
className
|
|
449
|
-
),
|
|
450
|
-
...props
|
|
451
|
-
}
|
|
452
|
-
);
|
|
311
|
+
return /* @__PURE__ */ jsx("th", {
|
|
312
|
+
className: cn("h-10 px-3 text-left align-middle font-medium text-muted-foreground", className),
|
|
313
|
+
...props
|
|
314
|
+
});
|
|
453
315
|
}
|
|
454
316
|
function TableCell({ className, ...props }) {
|
|
455
|
-
|
|
317
|
+
return /* @__PURE__ */ jsx("td", {
|
|
318
|
+
className: cn("p-3 align-middle", className),
|
|
319
|
+
...props
|
|
320
|
+
});
|
|
456
321
|
}
|
|
457
322
|
function TableCaption({ className, ...props }) {
|
|
458
|
-
|
|
323
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
324
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
325
|
+
...props
|
|
326
|
+
});
|
|
459
327
|
}
|
|
460
|
-
|
|
328
|
+
// src/components/ui/tabs.tsx
|
|
329
|
+
const Tabs = Tabs$1.Root;
|
|
461
330
|
function TabsList({ className, ...props }) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
function
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
className: cn(
|
|
481
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all",
|
|
482
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
483
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
484
|
-
"data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
485
|
-
className
|
|
486
|
-
),
|
|
487
|
-
...props
|
|
488
|
-
}
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
function TabsContent({
|
|
492
|
-
className,
|
|
493
|
-
...props
|
|
494
|
-
}) {
|
|
495
|
-
return /* @__PURE__ */ jsx(
|
|
496
|
-
Tabs$1.Content,
|
|
497
|
-
{
|
|
498
|
-
className: cn(
|
|
499
|
-
"mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
500
|
-
className
|
|
501
|
-
),
|
|
502
|
-
...props
|
|
503
|
-
}
|
|
504
|
-
);
|
|
505
|
-
}
|
|
331
|
+
return /* @__PURE__ */ jsx(Tabs$1.List, {
|
|
332
|
+
className: cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground", className),
|
|
333
|
+
...props
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
function TabsTrigger({ className, ...props }) {
|
|
337
|
+
return /* @__PURE__ */ jsx(Tabs$1.Trigger, {
|
|
338
|
+
className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50", "data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm", className),
|
|
339
|
+
...props
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
function TabsContent({ className, ...props }) {
|
|
343
|
+
return /* @__PURE__ */ jsx(Tabs$1.Content, {
|
|
344
|
+
className: cn("mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
|
|
345
|
+
...props
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// src/components/ui/textarea.tsx
|
|
506
349
|
function Textarea({ className, ...props }) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/30",
|
|
516
|
-
className
|
|
517
|
-
),
|
|
518
|
-
...props
|
|
519
|
-
}
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
var THEME_STORAGE_KEY = "theme";
|
|
350
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
351
|
+
className: cn("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs transition-colors", "placeholder:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/30", className),
|
|
352
|
+
...props
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// src/components/ui/theme-toggle.tsx
|
|
356
|
+
/** localStorage key shared by <ThemeScript /> and <ThemeToggle /> unless overridden. */
|
|
357
|
+
const THEME_STORAGE_KEY = "theme";
|
|
523
358
|
function prefersDark() {
|
|
524
|
-
|
|
359
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
525
360
|
}
|
|
526
361
|
function resolveMode(mode) {
|
|
527
|
-
|
|
528
|
-
|
|
362
|
+
if (mode !== "system") return mode;
|
|
363
|
+
return prefersDark() ? "dark" : "light";
|
|
529
364
|
}
|
|
530
365
|
function applyMode(mode) {
|
|
531
|
-
|
|
366
|
+
document.documentElement.classList.toggle("dark", resolveMode(mode) === "dark");
|
|
532
367
|
}
|
|
533
368
|
function readMode(storageKey) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
369
|
+
try {
|
|
370
|
+
const stored = localStorage.getItem(storageKey);
|
|
371
|
+
if (stored === "light" || stored === "dark" || stored === "system") return stored;
|
|
372
|
+
} catch {}
|
|
373
|
+
return "system";
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Read and change the current mode. `resolvedTheme` is undefined until mounted,
|
|
377
|
+
* because the concrete appearance is only knowable in the browser.
|
|
378
|
+
*/
|
|
541
379
|
function useTheme(storageKey = THEME_STORAGE_KEY) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
380
|
+
const [theme, setThemeState] = React.useState("system");
|
|
381
|
+
const [mounted, setMounted] = React.useState(false);
|
|
382
|
+
React.useEffect(() => {
|
|
383
|
+
setThemeState(readMode(storageKey));
|
|
384
|
+
setMounted(true);
|
|
385
|
+
}, [storageKey]);
|
|
386
|
+
React.useEffect(() => {
|
|
387
|
+
if (theme !== "system") return;
|
|
388
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
389
|
+
const onChange = () => applyMode("system");
|
|
390
|
+
mq.addEventListener("change", onChange);
|
|
391
|
+
return () => mq.removeEventListener("change", onChange);
|
|
392
|
+
}, [theme]);
|
|
393
|
+
const setTheme = React.useCallback((next) => {
|
|
394
|
+
setThemeState(next);
|
|
395
|
+
applyMode(next);
|
|
396
|
+
try {
|
|
397
|
+
localStorage.setItem(storageKey, next);
|
|
398
|
+
} catch {}
|
|
399
|
+
}, [storageKey]);
|
|
400
|
+
return {
|
|
401
|
+
theme,
|
|
402
|
+
resolvedTheme: mounted ? resolveMode(theme) : void 0,
|
|
403
|
+
setTheme,
|
|
404
|
+
mounted
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Blocking inline script that sets the `dark` class before first paint. Render
|
|
409
|
+
* it inside <head> (in Next's App Router: directly in the root layout's <head>),
|
|
410
|
+
* and add `suppressHydrationWarning` to <html> since the class it writes is not
|
|
411
|
+
* present in the server-rendered markup.
|
|
412
|
+
*/
|
|
573
413
|
function ThemeScript({ storageKey = THEME_STORAGE_KEY }) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
625
|
-
Tooltip$1.Content,
|
|
626
|
-
{
|
|
627
|
-
sideOffset,
|
|
628
|
-
className: cn(
|
|
629
|
-
"z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background shadow-md",
|
|
630
|
-
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
631
|
-
className
|
|
632
|
-
),
|
|
633
|
-
...props
|
|
634
|
-
}
|
|
635
|
-
) });
|
|
636
|
-
}
|
|
637
|
-
|
|
414
|
+
const js = `(function(){try{var s=localStorage.getItem(${JSON.stringify(storageKey)});var d=s==="dark"||((s===null||s==="system")&&window.matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.classList.toggle("dark",d)}catch(e){}})()`;
|
|
415
|
+
return /* @__PURE__ */ jsx("script", {
|
|
416
|
+
suppressHydrationWarning: true,
|
|
417
|
+
dangerouslySetInnerHTML: { __html: js }
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Icon button that switches mode. The sun/moon glyphs are chosen in CSS off the
|
|
422
|
+
* `dark` class rather than from state, so the first paint is correct and there
|
|
423
|
+
* is nothing for hydration to mismatch on.
|
|
424
|
+
*/
|
|
425
|
+
function ThemeToggle({ withSystem = false, storageKey, variant = "outline", size = "icon", className, ...props }) {
|
|
426
|
+
const { theme, setTheme, mounted } = useTheme(storageKey);
|
|
427
|
+
function handleClick() {
|
|
428
|
+
if (!withSystem) {
|
|
429
|
+
const isDark = document.documentElement.classList.contains("dark");
|
|
430
|
+
setTheme(isDark ? "light" : "dark");
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
setTheme(theme === "light" ? "dark" : theme === "dark" ? "system" : "light");
|
|
434
|
+
}
|
|
435
|
+
const followingSystem = mounted && withSystem && theme === "system";
|
|
436
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
437
|
+
variant,
|
|
438
|
+
size,
|
|
439
|
+
className: cn(className),
|
|
440
|
+
onClick: handleClick,
|
|
441
|
+
"aria-label": "Toggle theme",
|
|
442
|
+
title: "Toggle theme",
|
|
443
|
+
...props,
|
|
444
|
+
children: followingSystem ? /* @__PURE__ */ jsx(Monitor, { "aria-hidden": "true" }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Sun, {
|
|
445
|
+
className: "dark:hidden",
|
|
446
|
+
"aria-hidden": "true"
|
|
447
|
+
}), /* @__PURE__ */ jsx(Moon, {
|
|
448
|
+
className: "hidden dark:block",
|
|
449
|
+
"aria-hidden": "true"
|
|
450
|
+
})] })
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
// src/components/ui/tooltip.tsx
|
|
454
|
+
const TooltipProvider = Tooltip$1.Provider;
|
|
455
|
+
const Tooltip = Tooltip$1.Root;
|
|
456
|
+
const TooltipTrigger = Tooltip$1.Trigger;
|
|
457
|
+
function TooltipContent({ className, sideOffset = 4, ...props }) {
|
|
458
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Content, {
|
|
459
|
+
sideOffset,
|
|
460
|
+
className: cn("z-50 overflow-hidden rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background shadow-md", "animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className),
|
|
461
|
+
...props
|
|
462
|
+
}) });
|
|
463
|
+
}
|
|
638
464
|
export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Input, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, Switch, THEME_STORAGE_KEY, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeScript, ThemeToggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, useTheme };
|