@orangecheck/design 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88 -0
- package/dist/components.d.mts +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.js +14 -0
- package/dist/components.js.map +1 -0
- package/dist/components.mjs +3 -0
- package/dist/components.mjs.map +1 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1588 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1488 -0
- package/dist/index.mjs.map +1 -0
- package/dist/primitives.d.mts +205 -0
- package/dist/primitives.d.ts +205 -0
- package/dist/primitives.js +1235 -0
- package/dist/primitives.js.map +1 -0
- package/dist/primitives.mjs +1147 -0
- package/dist/primitives.mjs.map +1 -0
- package/dist/styles/theme.css +482 -0
- package/dist/styles/themes/aurora.css +129 -0
- package/dist/styles/themes/midnight.css +105 -0
- package/dist/styles/themes/orangecheck.css +128 -0
- package/dist/styles/themes/phosphor.css +104 -0
- package/dist/styles/themes.css +11 -0
- package/dist/styles.css +20 -0
- package/dist/tokens.d.mts +41 -0
- package/dist/tokens.d.ts +41 -0
- package/dist/tokens.js +266 -0
- package/dist/tokens.js.map +1 -0
- package/dist/tokens.mjs +254 -0
- package/dist/tokens.mjs.map +1 -0
- package/package.json +116 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1488 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import * as React2 from 'react';
|
|
4
|
+
import { createContext, useState, useRef, useEffect, useCallback, useMemo, useContext } from 'react';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
import { useTheme } from 'next-themes';
|
|
7
|
+
import { ChevronDown, Palette, Check, Sun, Moon, X, XIcon, AlertTriangle, Pencil, ChevronLeft, ChevronRight, ChevronDownIcon, CheckIcon, ChevronUpIcon } from 'lucide-react';
|
|
8
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
10
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
11
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
12
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
13
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
14
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
15
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
16
|
+
import { Toaster as Toaster$1 } from 'sonner';
|
|
17
|
+
import * as ui_star from '@orangecheck/ui';
|
|
18
|
+
|
|
19
|
+
var __defProp = Object.defineProperty;
|
|
20
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
21
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
22
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
36
|
+
|
|
37
|
+
// src/index.ts
|
|
38
|
+
var src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
Accordion: () => Accordion,
|
|
41
|
+
AccordionContent: () => AccordionContent,
|
|
42
|
+
AccordionItem: () => AccordionItem,
|
|
43
|
+
AccordionTrigger: () => AccordionTrigger,
|
|
44
|
+
Alert: () => Alert,
|
|
45
|
+
AlertDescription: () => AlertDescription,
|
|
46
|
+
AlertTitle: () => AlertTitle,
|
|
47
|
+
AlertWithAction: () => AlertWithAction,
|
|
48
|
+
AlertWithCountdown: () => AlertWithCountdown,
|
|
49
|
+
Badge: () => Badge,
|
|
50
|
+
Button: () => Button,
|
|
51
|
+
ConfirmHost: () => ConfirmHost,
|
|
52
|
+
DEFAULT_OC_THEME: () => DEFAULT_OC_THEME,
|
|
53
|
+
Dialog: () => Dialog,
|
|
54
|
+
DialogClose: () => DialogClose,
|
|
55
|
+
DialogContent: () => DialogContent,
|
|
56
|
+
DialogDescription: () => DialogDescription,
|
|
57
|
+
DialogFooter: () => DialogFooter,
|
|
58
|
+
DialogHeader: () => DialogHeader,
|
|
59
|
+
DialogOverlay: () => DialogOverlay,
|
|
60
|
+
DialogPortal: () => DialogPortal,
|
|
61
|
+
DialogTitle: () => DialogTitle,
|
|
62
|
+
DialogTrigger: () => DialogTrigger,
|
|
63
|
+
ErrorBoundary: () => ErrorBoundary,
|
|
64
|
+
Input: () => Input,
|
|
65
|
+
Label: () => Label,
|
|
66
|
+
Modal: () => Modal,
|
|
67
|
+
OC_SKIN_COOKIE: () => OC_SKIN_COOKIE,
|
|
68
|
+
OC_THEMES: () => OC_THEMES,
|
|
69
|
+
OcThemeBridge: () => OcThemeBridge,
|
|
70
|
+
OcThemePicker: () => OcThemePicker,
|
|
71
|
+
OcThemeProvider: () => OcThemeProvider,
|
|
72
|
+
Pagination: () => Pagination,
|
|
73
|
+
Popover: () => Popover,
|
|
74
|
+
PopoverAnchor: () => PopoverAnchor,
|
|
75
|
+
PopoverContent: () => PopoverContent,
|
|
76
|
+
PopoverTrigger: () => PopoverTrigger,
|
|
77
|
+
PromptHost: () => PromptHost,
|
|
78
|
+
Select: () => Select,
|
|
79
|
+
SelectContent: () => SelectContent,
|
|
80
|
+
SelectGroup: () => SelectGroup,
|
|
81
|
+
SelectItem: () => SelectItem,
|
|
82
|
+
SelectLabel: () => SelectLabel,
|
|
83
|
+
SelectScrollDownButton: () => SelectScrollDownButton,
|
|
84
|
+
SelectScrollUpButton: () => SelectScrollUpButton,
|
|
85
|
+
SelectSeparator: () => SelectSeparator,
|
|
86
|
+
SelectTrigger: () => SelectTrigger,
|
|
87
|
+
SelectValue: () => SelectValue,
|
|
88
|
+
Separator: () => Separator,
|
|
89
|
+
Sheet: () => Sheet,
|
|
90
|
+
SheetContent: () => SheetContent,
|
|
91
|
+
SheetDescription: () => SheetDescription,
|
|
92
|
+
SheetHeader: () => SheetHeader,
|
|
93
|
+
SheetOverlay: () => SheetOverlay,
|
|
94
|
+
SheetPortal: () => SheetPortal,
|
|
95
|
+
SheetTitle: () => SheetTitle,
|
|
96
|
+
SheetTrigger: () => SheetTrigger,
|
|
97
|
+
Skeleton: () => Skeleton,
|
|
98
|
+
Textarea: () => Textarea,
|
|
99
|
+
ThemeToggle: () => ThemeToggle,
|
|
100
|
+
ThemeToggleLink: () => ThemeToggleLink,
|
|
101
|
+
Toaster: () => Toaster,
|
|
102
|
+
Working: () => Working,
|
|
103
|
+
WorkingPanel: () => WorkingPanel,
|
|
104
|
+
badgeVariants: () => badgeVariants,
|
|
105
|
+
buttonVariants: () => buttonVariants,
|
|
106
|
+
cn: () => cn,
|
|
107
|
+
confirm: () => confirm,
|
|
108
|
+
getOcThemeInitScript: () => getOcThemeInitScript,
|
|
109
|
+
isKnownTheme: () => isKnownTheme,
|
|
110
|
+
prompt: () => prompt,
|
|
111
|
+
resolveTheme: () => resolveTheme,
|
|
112
|
+
useOcSkin: () => useOcSkin
|
|
113
|
+
});
|
|
114
|
+
function cn(...inputs) {
|
|
115
|
+
return twMerge(clsx(inputs));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/tokens/themes.ts
|
|
119
|
+
var OC_THEMES = [
|
|
120
|
+
{
|
|
121
|
+
id: "orangecheck",
|
|
122
|
+
label: "orangecheck",
|
|
123
|
+
description: "the default \u2014 Bitcoin-orange, sharp 0.25rem corners, Inter + JetBrains Mono"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "midnight",
|
|
127
|
+
label: "midnight",
|
|
128
|
+
description: "indigo on slate, softer rounded 0.625rem corners, Manrope sans \u2014 calmer, SaaS-ier"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: "phosphor",
|
|
132
|
+
label: "phosphor",
|
|
133
|
+
description: "CRT terminal green, hard 0.125rem corners, fully monospace \u2014 far from orange"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "aurora",
|
|
137
|
+
label: "aurora",
|
|
138
|
+
description: "cool teal, generous 0.75rem corners, soft elevation \u2014 flips the flat ethos"
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
var DEFAULT_OC_THEME = "orangecheck";
|
|
142
|
+
function isKnownTheme(id) {
|
|
143
|
+
return !!id && OC_THEMES.some((t) => t.id === id);
|
|
144
|
+
}
|
|
145
|
+
function resolveTheme(id) {
|
|
146
|
+
return isKnownTheme(id) ? id : DEFAULT_OC_THEME;
|
|
147
|
+
}
|
|
148
|
+
var OC_SKIN_COOKIE = "oc_skin";
|
|
149
|
+
var ONE_YEAR = 60 * 60 * 24 * 365;
|
|
150
|
+
var ATTR = "data-oc-theme";
|
|
151
|
+
function readSkinCookie() {
|
|
152
|
+
if (typeof document === "undefined") return null;
|
|
153
|
+
const prefix = `${OC_SKIN_COOKIE}=`;
|
|
154
|
+
for (const part of document.cookie.split(";")) {
|
|
155
|
+
const trimmed = part.trim();
|
|
156
|
+
if (trimmed.startsWith(prefix)) {
|
|
157
|
+
const v = decodeURIComponent(trimmed.slice(prefix.length));
|
|
158
|
+
return v.length > 0 ? v : null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
function writeSkinCookie(value) {
|
|
164
|
+
if (typeof document === "undefined") return;
|
|
165
|
+
const isLocal = location.hostname === "localhost" || location.hostname === "127.0.0.1";
|
|
166
|
+
const parts = [
|
|
167
|
+
`${OC_SKIN_COOKIE}=${encodeURIComponent(value)}`,
|
|
168
|
+
"Path=/",
|
|
169
|
+
`Max-Age=${ONE_YEAR}`,
|
|
170
|
+
"SameSite=Lax"
|
|
171
|
+
];
|
|
172
|
+
if (!isLocal) {
|
|
173
|
+
parts.push("Domain=.ochk.io");
|
|
174
|
+
parts.push("Secure");
|
|
175
|
+
}
|
|
176
|
+
document.cookie = parts.join("; ");
|
|
177
|
+
}
|
|
178
|
+
function applyAttr(skin) {
|
|
179
|
+
if (typeof document === "undefined") return;
|
|
180
|
+
document.documentElement.setAttribute(ATTR, skin);
|
|
181
|
+
}
|
|
182
|
+
var OcSkinContext = createContext(null);
|
|
183
|
+
function OcThemeProvider({ children, defaultSkin = DEFAULT_OC_THEME }) {
|
|
184
|
+
const [skin, setSkinState] = useState(() => resolveTheme(defaultSkin));
|
|
185
|
+
const hydratedRef = useRef(false);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (hydratedRef.current) return;
|
|
188
|
+
hydratedRef.current = true;
|
|
189
|
+
const fromCookie = resolveTheme(readSkinCookie() ?? defaultSkin);
|
|
190
|
+
applyAttr(fromCookie);
|
|
191
|
+
setSkinState(fromCookie);
|
|
192
|
+
}, [defaultSkin]);
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
function sync() {
|
|
195
|
+
const fromCookie = resolveTheme(readSkinCookie() ?? skin);
|
|
196
|
+
if (fromCookie !== skin) {
|
|
197
|
+
applyAttr(fromCookie);
|
|
198
|
+
setSkinState(fromCookie);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
window.addEventListener("focus", sync);
|
|
202
|
+
document.addEventListener("visibilitychange", sync);
|
|
203
|
+
return () => {
|
|
204
|
+
window.removeEventListener("focus", sync);
|
|
205
|
+
document.removeEventListener("visibilitychange", sync);
|
|
206
|
+
};
|
|
207
|
+
}, [skin]);
|
|
208
|
+
const setSkin = useCallback((id) => {
|
|
209
|
+
const next = resolveTheme(id);
|
|
210
|
+
applyAttr(next);
|
|
211
|
+
writeSkinCookie(next);
|
|
212
|
+
setSkinState(next);
|
|
213
|
+
}, []);
|
|
214
|
+
const value = useMemo(
|
|
215
|
+
() => ({ skin, setSkin, themes: OC_THEMES }),
|
|
216
|
+
[skin, setSkin]
|
|
217
|
+
);
|
|
218
|
+
return /* @__PURE__ */ jsx(OcSkinContext.Provider, { value, children });
|
|
219
|
+
}
|
|
220
|
+
function useOcSkin() {
|
|
221
|
+
const ctx = useContext(OcSkinContext);
|
|
222
|
+
if (!ctx) {
|
|
223
|
+
throw new Error("useOcSkin must be used within <OcThemeProvider>");
|
|
224
|
+
}
|
|
225
|
+
return ctx;
|
|
226
|
+
}
|
|
227
|
+
function getOcThemeInitScript(defaultSkin = DEFAULT_OC_THEME) {
|
|
228
|
+
return `(function(){try{var m=document.cookie.match(/(?:^|; )${OC_SKIN_COOKIE}=([^;]*)/);var s=m?decodeURIComponent(m[1]):'${defaultSkin}';if(!s){s='${defaultSkin}';}document.documentElement.setAttribute('${ATTR}',s);}catch(e){document.documentElement.setAttribute('${ATTR}','${defaultSkin}');}})();`;
|
|
229
|
+
}
|
|
230
|
+
var COOKIE = "oc_theme";
|
|
231
|
+
var ALLOWED = /* @__PURE__ */ new Set(["light", "dark", "system"]);
|
|
232
|
+
var ONE_YEAR2 = 60 * 60 * 24 * 365;
|
|
233
|
+
function readCookie(name) {
|
|
234
|
+
if (typeof document === "undefined") return null;
|
|
235
|
+
const prefix = `${name}=`;
|
|
236
|
+
for (const part of document.cookie.split(";")) {
|
|
237
|
+
const trimmed = part.trim();
|
|
238
|
+
if (trimmed.startsWith(prefix)) {
|
|
239
|
+
const v = decodeURIComponent(trimmed.slice(prefix.length));
|
|
240
|
+
return v.length > 0 ? v : null;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
function writeCookie(value) {
|
|
246
|
+
if (typeof document === "undefined") return;
|
|
247
|
+
if (!ALLOWED.has(value)) return;
|
|
248
|
+
const isLocal = location.hostname === "localhost" || location.hostname === "127.0.0.1";
|
|
249
|
+
const parts = [
|
|
250
|
+
`${COOKIE}=${encodeURIComponent(value)}`,
|
|
251
|
+
"Path=/",
|
|
252
|
+
`Max-Age=${ONE_YEAR2}`,
|
|
253
|
+
"SameSite=Lax"
|
|
254
|
+
];
|
|
255
|
+
if (!isLocal) {
|
|
256
|
+
parts.push("Domain=.ochk.io");
|
|
257
|
+
parts.push("Secure");
|
|
258
|
+
}
|
|
259
|
+
document.cookie = parts.join("; ");
|
|
260
|
+
}
|
|
261
|
+
function OcThemeBridge() {
|
|
262
|
+
const { theme, setTheme } = useTheme();
|
|
263
|
+
const hydratedRef = useRef(false);
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
if (hydratedRef.current) return;
|
|
266
|
+
hydratedRef.current = true;
|
|
267
|
+
const cookieValue = readCookie(COOKIE);
|
|
268
|
+
if (cookieValue && ALLOWED.has(cookieValue) && cookieValue !== theme) {
|
|
269
|
+
setTheme(cookieValue);
|
|
270
|
+
}
|
|
271
|
+
}, [theme, setTheme]);
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
if (!hydratedRef.current) return;
|
|
274
|
+
if (!theme) return;
|
|
275
|
+
writeCookie(theme);
|
|
276
|
+
}, [theme]);
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
function OcThemePicker({ className, triggerClassName, popoverClassName }) {
|
|
280
|
+
const { skin, setSkin, themes } = useOcSkin();
|
|
281
|
+
const [open, setOpen] = useState(false);
|
|
282
|
+
const rootRef = useRef(null);
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
if (!open) return;
|
|
285
|
+
function onDown(e) {
|
|
286
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
287
|
+
}
|
|
288
|
+
function onKey(e) {
|
|
289
|
+
if (e.key === "Escape") setOpen(false);
|
|
290
|
+
}
|
|
291
|
+
document.addEventListener("mousedown", onDown);
|
|
292
|
+
document.addEventListener("keydown", onKey);
|
|
293
|
+
return () => {
|
|
294
|
+
document.removeEventListener("mousedown", onDown);
|
|
295
|
+
document.removeEventListener("keydown", onKey);
|
|
296
|
+
};
|
|
297
|
+
}, [open]);
|
|
298
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative", className), children: [
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
type: "button",
|
|
303
|
+
"aria-label": "choose theme",
|
|
304
|
+
"aria-haspopup": "menu",
|
|
305
|
+
"aria-expanded": open,
|
|
306
|
+
title: "choose theme",
|
|
307
|
+
onClick: () => setOpen((v) => !v),
|
|
308
|
+
className: cn(
|
|
309
|
+
"text-muted-foreground hover:text-foreground inline-flex size-9 items-center justify-center rounded-md transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
310
|
+
triggerClassName
|
|
311
|
+
),
|
|
312
|
+
children: /* @__PURE__ */ jsx(Palette, { className: "size-4", "aria-hidden": true })
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
open && /* @__PURE__ */ jsxs(
|
|
316
|
+
"div",
|
|
317
|
+
{
|
|
318
|
+
role: "menu",
|
|
319
|
+
className: cn(
|
|
320
|
+
"bg-popover text-popover-foreground absolute right-0 z-50 mt-2 w-64 overflow-hidden rounded-md border shadow-md",
|
|
321
|
+
popoverClassName
|
|
322
|
+
),
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ jsx("div", { className: "label-mono text-muted-foreground px-3 pt-3 pb-1", children: "theme" }),
|
|
325
|
+
/* @__PURE__ */ jsx("ul", { className: "pb-1", children: themes.map((t) => {
|
|
326
|
+
const active = t.id === skin;
|
|
327
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
type: "button",
|
|
331
|
+
role: "menuitemradio",
|
|
332
|
+
"aria-checked": active,
|
|
333
|
+
onClick: () => {
|
|
334
|
+
setSkin(t.id);
|
|
335
|
+
setOpen(false);
|
|
336
|
+
},
|
|
337
|
+
className: cn(
|
|
338
|
+
"hover:bg-accent hover:text-accent-foreground flex w-full items-start gap-2 px-3 py-2 text-left transition-colors",
|
|
339
|
+
active && "text-foreground"
|
|
340
|
+
),
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 size-4 shrink-0", children: active && /* @__PURE__ */ jsx(Check, { className: "size-4 text-primary", "aria-hidden": true }) }),
|
|
343
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
344
|
+
/* @__PURE__ */ jsx("span", { className: "block text-sm font-medium", children: t.label }),
|
|
345
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground block text-xs leading-snug", children: t.description })
|
|
346
|
+
] })
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
) }, t.id);
|
|
350
|
+
}) })
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
] });
|
|
355
|
+
}
|
|
356
|
+
var buttonVariants = cva(
|
|
357
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
358
|
+
{
|
|
359
|
+
variants: {
|
|
360
|
+
variant: {
|
|
361
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
362
|
+
destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white",
|
|
363
|
+
outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
|
|
364
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
365
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
366
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
367
|
+
},
|
|
368
|
+
size: {
|
|
369
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
370
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
371
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
372
|
+
icon: "size-9"
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
defaultVariants: {
|
|
376
|
+
variant: "default",
|
|
377
|
+
size: "default"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
function Button({
|
|
382
|
+
className,
|
|
383
|
+
variant,
|
|
384
|
+
size,
|
|
385
|
+
asChild = false,
|
|
386
|
+
...props
|
|
387
|
+
}) {
|
|
388
|
+
const Comp = asChild ? Slot : "button";
|
|
389
|
+
return /* @__PURE__ */ jsx(
|
|
390
|
+
Comp,
|
|
391
|
+
{
|
|
392
|
+
"data-slot": "button",
|
|
393
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
394
|
+
...props
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
var badgeVariants = cva(
|
|
399
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-md border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",
|
|
400
|
+
{
|
|
401
|
+
variants: {
|
|
402
|
+
variant: {
|
|
403
|
+
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",
|
|
404
|
+
secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",
|
|
405
|
+
destructive: "bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90 border-transparent",
|
|
406
|
+
warning: "bg-warning text-warning-foreground [a&]:hover:bg-warning/90 border-transparent",
|
|
407
|
+
success: "bg-success text-success-foreground [a&]:hover:bg-success/90 border-transparent",
|
|
408
|
+
info: "bg-info text-info-foreground [a&]:hover:bg-info/90 border-transparent",
|
|
409
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
defaultVariants: { variant: "default" }
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
function Badge({
|
|
416
|
+
className,
|
|
417
|
+
variant,
|
|
418
|
+
asChild = false,
|
|
419
|
+
...props
|
|
420
|
+
}) {
|
|
421
|
+
const Comp = asChild ? Slot : "span";
|
|
422
|
+
return /* @__PURE__ */ jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props });
|
|
423
|
+
}
|
|
424
|
+
function Input({ className, type, ...props }) {
|
|
425
|
+
return /* @__PURE__ */ jsx(
|
|
426
|
+
"input",
|
|
427
|
+
{
|
|
428
|
+
type,
|
|
429
|
+
"data-slot": "input",
|
|
430
|
+
className: cn(
|
|
431
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input bg-input/30 hover:bg-input/50 dark:bg-input/30 dark:hover:bg-input/50 h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base shadow-xs transition-[color,box-shadow,background-color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
432
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
433
|
+
"aria-invalid:ring-brand/25 dark:aria-invalid:ring-brand/35 aria-invalid:border-brand",
|
|
434
|
+
className
|
|
435
|
+
),
|
|
436
|
+
...props
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
function Label({ className, ...props }) {
|
|
441
|
+
return /* @__PURE__ */ jsx(
|
|
442
|
+
LabelPrimitive.Root,
|
|
443
|
+
{
|
|
444
|
+
"data-slot": "label",
|
|
445
|
+
className: cn(
|
|
446
|
+
"flex select-none items-center gap-2 text-sm font-medium leading-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
447
|
+
className
|
|
448
|
+
),
|
|
449
|
+
...props
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
var alertVariants = cva(
|
|
454
|
+
"relative grid w-full grid-cols-[0_1fr] items-start gap-x-0 gap-y-0.5 rounded-md border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
455
|
+
{
|
|
456
|
+
variants: {
|
|
457
|
+
variant: {
|
|
458
|
+
default: "bg-card text-card-foreground",
|
|
459
|
+
destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
460
|
+
success: "text-success bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-success/90",
|
|
461
|
+
warning: "text-warning bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-warning/90"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
defaultVariants: { variant: "default" }
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
function Alert({
|
|
468
|
+
className,
|
|
469
|
+
variant,
|
|
470
|
+
...props
|
|
471
|
+
}) {
|
|
472
|
+
return /* @__PURE__ */ jsx(
|
|
473
|
+
"div",
|
|
474
|
+
{
|
|
475
|
+
"data-slot": "alert",
|
|
476
|
+
role: "alert",
|
|
477
|
+
className: cn(alertVariants({ variant }), className),
|
|
478
|
+
...props
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
function AlertTitle({ className, ...props }) {
|
|
483
|
+
return /* @__PURE__ */ jsx(
|
|
484
|
+
"div",
|
|
485
|
+
{
|
|
486
|
+
"data-slot": "alert-title",
|
|
487
|
+
className: cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className),
|
|
488
|
+
...props
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
function AlertDescription({ className, ...props }) {
|
|
493
|
+
return /* @__PURE__ */ jsx(
|
|
494
|
+
"div",
|
|
495
|
+
{
|
|
496
|
+
"data-slot": "alert-description",
|
|
497
|
+
className: cn(
|
|
498
|
+
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
499
|
+
className
|
|
500
|
+
),
|
|
501
|
+
...props
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
function AlertWithAction({
|
|
506
|
+
variant = "default",
|
|
507
|
+
icon: Icon2,
|
|
508
|
+
title,
|
|
509
|
+
description,
|
|
510
|
+
actionLabel,
|
|
511
|
+
onAction,
|
|
512
|
+
actionVariant = "outline",
|
|
513
|
+
actionIcon,
|
|
514
|
+
actionDisabled,
|
|
515
|
+
actionContent,
|
|
516
|
+
className
|
|
517
|
+
}) {
|
|
518
|
+
return /* @__PURE__ */ jsxs(Alert, { variant, className, children: [
|
|
519
|
+
Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4" }),
|
|
520
|
+
title && /* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
|
521
|
+
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
522
|
+
description,
|
|
523
|
+
(actionLabel || actionContent) && /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
524
|
+
actionContent,
|
|
525
|
+
actionLabel && onAction && /* @__PURE__ */ jsxs(
|
|
526
|
+
Button,
|
|
527
|
+
{
|
|
528
|
+
size: "sm",
|
|
529
|
+
variant: actionVariant,
|
|
530
|
+
onClick: onAction,
|
|
531
|
+
disabled: actionDisabled,
|
|
532
|
+
className: cn(!actionContent && "ml-auto"),
|
|
533
|
+
children: [
|
|
534
|
+
actionIcon,
|
|
535
|
+
actionLabel
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
)
|
|
539
|
+
] })
|
|
540
|
+
] })
|
|
541
|
+
] });
|
|
542
|
+
}
|
|
543
|
+
function AlertWithCountdown({
|
|
544
|
+
variant = "default",
|
|
545
|
+
icon: Icon2,
|
|
546
|
+
title,
|
|
547
|
+
description,
|
|
548
|
+
countdown,
|
|
549
|
+
countdownLabel,
|
|
550
|
+
countdownIcon,
|
|
551
|
+
actionLabel = "Check Now",
|
|
552
|
+
onAction,
|
|
553
|
+
actionIcon,
|
|
554
|
+
actionDisabled,
|
|
555
|
+
className
|
|
556
|
+
}) {
|
|
557
|
+
const label = countdownLabel ? countdownLabel.replace("{countdown}", countdown.toString()) : `Rechecking in ${countdown} second${countdown !== 1 ? "s" : ""}...`;
|
|
558
|
+
return /* @__PURE__ */ jsxs(Alert, { variant, className, children: [
|
|
559
|
+
Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4" }),
|
|
560
|
+
title && /* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
|
561
|
+
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
562
|
+
description,
|
|
563
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2 text-sm", children: [
|
|
564
|
+
countdownIcon,
|
|
565
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
566
|
+
onAction && /* @__PURE__ */ jsxs(
|
|
567
|
+
Button,
|
|
568
|
+
{
|
|
569
|
+
size: "sm",
|
|
570
|
+
variant: "outline",
|
|
571
|
+
onClick: onAction,
|
|
572
|
+
disabled: actionDisabled,
|
|
573
|
+
className: "ml-auto",
|
|
574
|
+
children: [
|
|
575
|
+
actionIcon,
|
|
576
|
+
actionLabel
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
)
|
|
580
|
+
] })
|
|
581
|
+
] })
|
|
582
|
+
] });
|
|
583
|
+
}
|
|
584
|
+
function Textarea({ className, ...props }) {
|
|
585
|
+
return /* @__PURE__ */ jsx(
|
|
586
|
+
"textarea",
|
|
587
|
+
{
|
|
588
|
+
"data-slot": "textarea",
|
|
589
|
+
className: cn(
|
|
590
|
+
"placeholder:text-muted-foreground border-input bg-input/30 hover:bg-input/50 dark:bg-input/30 dark:hover:bg-input/50 w-full min-w-0 rounded-md border px-3 py-2 font-mono text-xs leading-relaxed shadow-xs transition-[color,box-shadow,background-color] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
591
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
592
|
+
className
|
|
593
|
+
),
|
|
594
|
+
...props
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
function ThemeToggle({ className }) {
|
|
599
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
600
|
+
const [mounted, setMounted] = useState(false);
|
|
601
|
+
useEffect(() => setMounted(true), []);
|
|
602
|
+
const isDark = resolvedTheme === "dark";
|
|
603
|
+
return /* @__PURE__ */ jsx(
|
|
604
|
+
Button,
|
|
605
|
+
{
|
|
606
|
+
variant: "ghost",
|
|
607
|
+
size: "icon",
|
|
608
|
+
"aria-label": isDark ? "Switch to light mode" : "Switch to dark mode",
|
|
609
|
+
title: isDark ? "Switch to light mode" : "Switch to dark mode",
|
|
610
|
+
onClick: () => setTheme(isDark ? "light" : "dark"),
|
|
611
|
+
className: cn("text-muted-foreground hover:text-foreground", className),
|
|
612
|
+
children: !mounted ? /* @__PURE__ */ jsx("span", { className: "block size-4" }) : isDark ? /* @__PURE__ */ jsx(Sun, { className: "size-4" }) : /* @__PURE__ */ jsx(Moon, { className: "size-4" })
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
function ThemeToggleLink() {
|
|
617
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
618
|
+
const [mounted, setMounted] = useState(false);
|
|
619
|
+
useEffect(() => setMounted(true), []);
|
|
620
|
+
const isDark = mounted && resolvedTheme === "dark";
|
|
621
|
+
return /* @__PURE__ */ jsxs(
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
type: "button",
|
|
625
|
+
onClick: () => setTheme(isDark ? "light" : "dark"),
|
|
626
|
+
className: "hover:text-foreground flex w-full items-center justify-between px-2 py-2 text-left text-xs tracking-wide uppercase transition-colors",
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ jsxs("span", { className: "tracking-wide lowercase", children: [
|
|
629
|
+
"> ",
|
|
630
|
+
mounted ? isDark ? "light mode" : "dark mode" : "theme"
|
|
631
|
+
] }),
|
|
632
|
+
mounted && (isDark ? /* @__PURE__ */ jsx(Sun, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Moon, { className: "size-3.5" }))
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
function Working({ text, size = "md", progress, className }) {
|
|
638
|
+
const isSmall = size === "sm";
|
|
639
|
+
return /* @__PURE__ */ jsxs(
|
|
640
|
+
"span",
|
|
641
|
+
{
|
|
642
|
+
"aria-live": "polite",
|
|
643
|
+
className: cn(
|
|
644
|
+
"inline-flex items-center gap-2 font-mono",
|
|
645
|
+
isSmall ? "text-[11px]" : "text-xs",
|
|
646
|
+
"text-muted-foreground",
|
|
647
|
+
className
|
|
648
|
+
),
|
|
649
|
+
children: [
|
|
650
|
+
/* @__PURE__ */ jsxs("span", { className: "oc-working-cursor", "aria-hidden": true, children: [
|
|
651
|
+
/* @__PURE__ */ jsx("span", { className: "oc-working-dot", style: { animationDelay: "0ms" }, children: "\xB7" }),
|
|
652
|
+
/* @__PURE__ */ jsx("span", { className: "oc-working-dot", style: { animationDelay: "140ms" }, children: "\xB7" }),
|
|
653
|
+
/* @__PURE__ */ jsx("span", { className: "oc-working-dot", style: { animationDelay: "280ms" }, children: "\xB7" })
|
|
654
|
+
] }),
|
|
655
|
+
/* @__PURE__ */ jsxs("span", { className: "oc-working-text", children: [
|
|
656
|
+
text,
|
|
657
|
+
progress && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/60 ml-1.5", children: [
|
|
658
|
+
"[",
|
|
659
|
+
progress,
|
|
660
|
+
"]"
|
|
661
|
+
] })
|
|
662
|
+
] })
|
|
663
|
+
]
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
function WorkingPanel({ text, progress }) {
|
|
668
|
+
return /* @__PURE__ */ jsxs("div", { className: "terminal", children: [
|
|
669
|
+
/* @__PURE__ */ jsxs("div", { className: "terminal-title", children: [
|
|
670
|
+
/* @__PURE__ */ jsx("span", { className: "terminal-dot" }),
|
|
671
|
+
/* @__PURE__ */ jsx("span", { className: "terminal-dot" }),
|
|
672
|
+
/* @__PURE__ */ jsx("span", { className: "terminal-dot" }),
|
|
673
|
+
/* @__PURE__ */ jsx("span", { className: "ml-2", children: "in progress" })
|
|
674
|
+
] }),
|
|
675
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 p-5", children: /* @__PURE__ */ jsx(Working, { text, ...progress ? { progress } : {} }) })
|
|
676
|
+
] });
|
|
677
|
+
}
|
|
678
|
+
var ErrorBoundary = class extends React2.Component {
|
|
679
|
+
constructor() {
|
|
680
|
+
super(...arguments);
|
|
681
|
+
this.state = { error: null };
|
|
682
|
+
this.reset = () => this.setState({ error: null });
|
|
683
|
+
}
|
|
684
|
+
static getDerivedStateFromError(error) {
|
|
685
|
+
return { error };
|
|
686
|
+
}
|
|
687
|
+
componentDidCatch(error, info) {
|
|
688
|
+
console.error("[ErrorBoundary]", error, info);
|
|
689
|
+
}
|
|
690
|
+
render() {
|
|
691
|
+
if (this.state.error) {
|
|
692
|
+
if (this.props.fallback) {
|
|
693
|
+
return this.props.fallback(this.state.error, this.reset);
|
|
694
|
+
}
|
|
695
|
+
return /* @__PURE__ */ jsx("div", { className: "container py-16", children: /* @__PURE__ */ jsxs("div", { className: "terminal", children: [
|
|
696
|
+
/* @__PURE__ */ jsx("div", { className: "terminal-title", children: /* @__PURE__ */ jsx("span", { className: "text-destructive flex items-center gap-1.5", children: "! fatal" }) }),
|
|
697
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3 p-5 font-mono text-xs leading-relaxed", children: [
|
|
698
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
699
|
+
/* @__PURE__ */ jsxs("span", { className: "text-destructive", children: [
|
|
700
|
+
"> ",
|
|
701
|
+
"err:"
|
|
702
|
+
] }),
|
|
703
|
+
" ",
|
|
704
|
+
this.state.error.message || "unknown error"
|
|
705
|
+
] }),
|
|
706
|
+
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground", children: [
|
|
707
|
+
"> ",
|
|
708
|
+
"this page crashed. reload to recover."
|
|
709
|
+
] }),
|
|
710
|
+
/* @__PURE__ */ jsx(
|
|
711
|
+
"button",
|
|
712
|
+
{
|
|
713
|
+
type: "button",
|
|
714
|
+
onClick: this.reset,
|
|
715
|
+
className: "bg-primary text-primary-foreground hover:bg-primary/90 mt-2 inline-flex items-center justify-center gap-2 rounded-md px-4 py-2 font-mono text-xs tracking-widest uppercase",
|
|
716
|
+
children: "retry"
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
] })
|
|
720
|
+
] }) });
|
|
721
|
+
}
|
|
722
|
+
return this.props.children;
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
function Skeleton({ className }) {
|
|
726
|
+
return /* @__PURE__ */ jsx("div", { className: cn("bg-muted/40 animate-pulse rounded-sm", className) });
|
|
727
|
+
}
|
|
728
|
+
function Separator({
|
|
729
|
+
className,
|
|
730
|
+
orientation = "horizontal",
|
|
731
|
+
decorative = true,
|
|
732
|
+
...props
|
|
733
|
+
}) {
|
|
734
|
+
return /* @__PURE__ */ jsx(
|
|
735
|
+
SeparatorPrimitive.Root,
|
|
736
|
+
{
|
|
737
|
+
"data-slot": "separator",
|
|
738
|
+
decorative,
|
|
739
|
+
orientation,
|
|
740
|
+
className: cn(
|
|
741
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
742
|
+
className
|
|
743
|
+
),
|
|
744
|
+
...props
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
function Sheet(props) {
|
|
749
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
750
|
+
}
|
|
751
|
+
function SheetTrigger(props) {
|
|
752
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
753
|
+
}
|
|
754
|
+
function SheetPortal(props) {
|
|
755
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
756
|
+
}
|
|
757
|
+
function SheetOverlay({ className, ...props }) {
|
|
758
|
+
return /* @__PURE__ */ jsx(
|
|
759
|
+
DialogPrimitive.Overlay,
|
|
760
|
+
{
|
|
761
|
+
"data-slot": "sheet-overlay",
|
|
762
|
+
className: cn(
|
|
763
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
764
|
+
className
|
|
765
|
+
),
|
|
766
|
+
...props
|
|
767
|
+
}
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
function SheetContent({
|
|
771
|
+
className,
|
|
772
|
+
children,
|
|
773
|
+
side = "right",
|
|
774
|
+
...props
|
|
775
|
+
}) {
|
|
776
|
+
const sideClasses = {
|
|
777
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
778
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
779
|
+
top: "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
780
|
+
bottom: "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"
|
|
781
|
+
};
|
|
782
|
+
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
783
|
+
/* @__PURE__ */ jsx(SheetOverlay, {}),
|
|
784
|
+
/* @__PURE__ */ jsxs(
|
|
785
|
+
DialogPrimitive.Content,
|
|
786
|
+
{
|
|
787
|
+
"data-slot": "sheet-content",
|
|
788
|
+
className: cn(
|
|
789
|
+
"bg-background fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=closed]:animate-out data-[state=open]:duration-500 data-[state=open]:animate-in",
|
|
790
|
+
sideClasses[side],
|
|
791
|
+
className
|
|
792
|
+
),
|
|
793
|
+
...props,
|
|
794
|
+
children: [
|
|
795
|
+
children,
|
|
796
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
797
|
+
/* @__PURE__ */ jsx(X, { className: "size-4" }),
|
|
798
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
799
|
+
] })
|
|
800
|
+
]
|
|
801
|
+
}
|
|
802
|
+
)
|
|
803
|
+
] });
|
|
804
|
+
}
|
|
805
|
+
function SheetHeader({ className, ...props }) {
|
|
806
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "sheet-header", className: cn("flex flex-col gap-1.5 p-4", className), ...props });
|
|
807
|
+
}
|
|
808
|
+
function SheetTitle({ className, ...props }) {
|
|
809
|
+
return /* @__PURE__ */ jsx(
|
|
810
|
+
DialogPrimitive.Title,
|
|
811
|
+
{
|
|
812
|
+
"data-slot": "sheet-title",
|
|
813
|
+
className: cn("text-foreground font-semibold", className),
|
|
814
|
+
...props
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
function SheetDescription({
|
|
819
|
+
className,
|
|
820
|
+
...props
|
|
821
|
+
}) {
|
|
822
|
+
return /* @__PURE__ */ jsx(
|
|
823
|
+
DialogPrimitive.Description,
|
|
824
|
+
{
|
|
825
|
+
"data-slot": "sheet-description",
|
|
826
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
827
|
+
...props
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
}
|
|
831
|
+
function Dialog({ ...props }) {
|
|
832
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
833
|
+
}
|
|
834
|
+
function DialogTrigger({ ...props }) {
|
|
835
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
836
|
+
}
|
|
837
|
+
function DialogPortal({ ...props }) {
|
|
838
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
839
|
+
}
|
|
840
|
+
function DialogClose({ ...props }) {
|
|
841
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
842
|
+
}
|
|
843
|
+
function DialogOverlay({
|
|
844
|
+
className,
|
|
845
|
+
...props
|
|
846
|
+
}) {
|
|
847
|
+
return /* @__PURE__ */ jsx(
|
|
848
|
+
DialogPrimitive.Overlay,
|
|
849
|
+
{
|
|
850
|
+
"data-slot": "dialog-overlay",
|
|
851
|
+
className: cn(
|
|
852
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
853
|
+
className
|
|
854
|
+
),
|
|
855
|
+
...props
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
function DialogContent({
|
|
860
|
+
className,
|
|
861
|
+
children,
|
|
862
|
+
showCloseButton = true,
|
|
863
|
+
...props
|
|
864
|
+
}) {
|
|
865
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
866
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
867
|
+
/* @__PURE__ */ jsxs(
|
|
868
|
+
DialogPrimitive.Content,
|
|
869
|
+
{
|
|
870
|
+
"data-slot": "dialog-content",
|
|
871
|
+
className: cn(
|
|
872
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
873
|
+
className
|
|
874
|
+
),
|
|
875
|
+
...props,
|
|
876
|
+
children: [
|
|
877
|
+
children,
|
|
878
|
+
showCloseButton && /* @__PURE__ */ jsxs(
|
|
879
|
+
DialogPrimitive.Close,
|
|
880
|
+
{
|
|
881
|
+
"data-slot": "dialog-close",
|
|
882
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
883
|
+
children: [
|
|
884
|
+
/* @__PURE__ */ jsx(XIcon, {}),
|
|
885
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
]
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
] });
|
|
893
|
+
}
|
|
894
|
+
function DialogHeader({ className, ...props }) {
|
|
895
|
+
return /* @__PURE__ */ jsx(
|
|
896
|
+
"div",
|
|
897
|
+
{
|
|
898
|
+
"data-slot": "dialog-header",
|
|
899
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
900
|
+
...props
|
|
901
|
+
}
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
function DialogFooter({ className, ...props }) {
|
|
905
|
+
return /* @__PURE__ */ jsx(
|
|
906
|
+
"div",
|
|
907
|
+
{
|
|
908
|
+
"data-slot": "dialog-footer",
|
|
909
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
910
|
+
...props
|
|
911
|
+
}
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
function DialogTitle({ className, ...props }) {
|
|
915
|
+
return /* @__PURE__ */ jsx(
|
|
916
|
+
DialogPrimitive.Title,
|
|
917
|
+
{
|
|
918
|
+
"data-slot": "dialog-title",
|
|
919
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
920
|
+
...props
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
function DialogDescription({
|
|
925
|
+
className,
|
|
926
|
+
...props
|
|
927
|
+
}) {
|
|
928
|
+
return /* @__PURE__ */ jsx(
|
|
929
|
+
DialogPrimitive.Description,
|
|
930
|
+
{
|
|
931
|
+
"data-slot": "dialog-description",
|
|
932
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
933
|
+
...props
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
var NODE_ENV = globalThis.process?.env?.NODE_ENV;
|
|
938
|
+
var pending = null;
|
|
939
|
+
var notifyHost = null;
|
|
940
|
+
var hostMountCount = 0;
|
|
941
|
+
function confirm(opts) {
|
|
942
|
+
return new Promise((resolve) => {
|
|
943
|
+
pending = { ...opts, resolve };
|
|
944
|
+
if (notifyHost) {
|
|
945
|
+
notifyHost();
|
|
946
|
+
} else if (NODE_ENV !== "production") {
|
|
947
|
+
console.warn("[ConfirmDialog] confirm() called but no <ConfirmHost /> is mounted");
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
function ConfirmHost() {
|
|
952
|
+
const [state, setState] = useState(null);
|
|
953
|
+
const submittingRef = useRef(false);
|
|
954
|
+
useEffect(() => {
|
|
955
|
+
hostMountCount += 1;
|
|
956
|
+
if (hostMountCount > 1 && NODE_ENV !== "production") {
|
|
957
|
+
console.warn(
|
|
958
|
+
"[ConfirmDialog] multiple <ConfirmHost /> instances mounted \u2014 the last one wins"
|
|
959
|
+
);
|
|
960
|
+
}
|
|
961
|
+
notifyHost = () => setState(pending);
|
|
962
|
+
if (pending) setState(pending);
|
|
963
|
+
return () => {
|
|
964
|
+
hostMountCount -= 1;
|
|
965
|
+
notifyHost = null;
|
|
966
|
+
};
|
|
967
|
+
}, []);
|
|
968
|
+
const close = useCallback(
|
|
969
|
+
(ok) => {
|
|
970
|
+
if (submittingRef.current) return;
|
|
971
|
+
submittingRef.current = true;
|
|
972
|
+
state?.resolve(ok);
|
|
973
|
+
pending = null;
|
|
974
|
+
setState(null);
|
|
975
|
+
requestAnimationFrame(() => {
|
|
976
|
+
submittingRef.current = false;
|
|
977
|
+
});
|
|
978
|
+
},
|
|
979
|
+
[state]
|
|
980
|
+
);
|
|
981
|
+
if (!state) return null;
|
|
982
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open: true, onOpenChange: (open) => !open && close(false), children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
983
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm" }),
|
|
984
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Content, { className: "bg-card border-border fixed top-1/2 left-1/2 z-50 w-[90vw] max-w-md -translate-x-1/2 -translate-y-1/2 border shadow-lg outline-none", children: [
|
|
985
|
+
/* @__PURE__ */ jsx("div", { className: "terminal-title", children: /* @__PURE__ */ jsxs(
|
|
986
|
+
"span",
|
|
987
|
+
{
|
|
988
|
+
className: "flex items-center gap-1.5 " + (state.destructive ? "text-destructive" : "text-primary"),
|
|
989
|
+
children: [
|
|
990
|
+
/* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5" }),
|
|
991
|
+
state.title
|
|
992
|
+
]
|
|
993
|
+
}
|
|
994
|
+
) }),
|
|
995
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 p-4 sm:p-5", children: [
|
|
996
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "sr-only", children: state.title }),
|
|
997
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Description, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground font-mono text-xs leading-relaxed whitespace-pre-wrap", children: state.message }) }),
|
|
998
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [
|
|
999
|
+
/* @__PURE__ */ jsx(
|
|
1000
|
+
Button,
|
|
1001
|
+
{
|
|
1002
|
+
variant: "outline",
|
|
1003
|
+
onClick: () => close(false),
|
|
1004
|
+
className: "font-mono text-[11px] tracking-widest uppercase",
|
|
1005
|
+
children: state.cancelLabel ?? "cancel"
|
|
1006
|
+
}
|
|
1007
|
+
),
|
|
1008
|
+
/* @__PURE__ */ jsx(
|
|
1009
|
+
Button,
|
|
1010
|
+
{
|
|
1011
|
+
onClick: () => close(true),
|
|
1012
|
+
className: "font-display tracking-wide uppercase " + (state.destructive ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : ""),
|
|
1013
|
+
children: state.confirmLabel ?? "confirm"
|
|
1014
|
+
}
|
|
1015
|
+
)
|
|
1016
|
+
] })
|
|
1017
|
+
] })
|
|
1018
|
+
] })
|
|
1019
|
+
] }) });
|
|
1020
|
+
}
|
|
1021
|
+
var NODE_ENV2 = globalThis.process?.env?.NODE_ENV;
|
|
1022
|
+
var pending2 = null;
|
|
1023
|
+
var notifyHost2 = null;
|
|
1024
|
+
var hostMountCount2 = 0;
|
|
1025
|
+
function prompt(opts) {
|
|
1026
|
+
return new Promise((resolve) => {
|
|
1027
|
+
pending2 = { ...opts, resolve };
|
|
1028
|
+
if (notifyHost2) {
|
|
1029
|
+
notifyHost2();
|
|
1030
|
+
} else if (NODE_ENV2 !== "production") {
|
|
1031
|
+
console.warn("[PromptDialog] prompt() called but no <PromptHost /> is mounted");
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
function PromptHost() {
|
|
1036
|
+
const [state, setState] = useState(null);
|
|
1037
|
+
const [value, setValue] = useState("");
|
|
1038
|
+
const [confirmValue, setConfirmValue] = useState("");
|
|
1039
|
+
const [error, setError] = useState(null);
|
|
1040
|
+
const submittingRef = useRef(false);
|
|
1041
|
+
useEffect(() => {
|
|
1042
|
+
hostMountCount2 += 1;
|
|
1043
|
+
if (hostMountCount2 > 1 && NODE_ENV2 !== "production") {
|
|
1044
|
+
console.warn("[PromptDialog] multiple <PromptHost /> instances mounted");
|
|
1045
|
+
}
|
|
1046
|
+
notifyHost2 = () => {
|
|
1047
|
+
setValue(pending2?.defaultValue ?? "");
|
|
1048
|
+
setConfirmValue("");
|
|
1049
|
+
setError(null);
|
|
1050
|
+
setState(pending2);
|
|
1051
|
+
};
|
|
1052
|
+
if (pending2) notifyHost2();
|
|
1053
|
+
return () => {
|
|
1054
|
+
hostMountCount2 -= 1;
|
|
1055
|
+
notifyHost2 = null;
|
|
1056
|
+
};
|
|
1057
|
+
}, []);
|
|
1058
|
+
const close = useCallback(
|
|
1059
|
+
(result) => {
|
|
1060
|
+
if (submittingRef.current) return;
|
|
1061
|
+
submittingRef.current = true;
|
|
1062
|
+
state?.resolve(result);
|
|
1063
|
+
pending2 = null;
|
|
1064
|
+
setState(null);
|
|
1065
|
+
requestAnimationFrame(() => {
|
|
1066
|
+
submittingRef.current = false;
|
|
1067
|
+
});
|
|
1068
|
+
},
|
|
1069
|
+
[state]
|
|
1070
|
+
);
|
|
1071
|
+
const submit = useCallback(() => {
|
|
1072
|
+
if (!state) return;
|
|
1073
|
+
const v = value;
|
|
1074
|
+
if (state.minLength && v.length < state.minLength) {
|
|
1075
|
+
setError(`must be at least ${state.minLength} characters`);
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
if (state.confirmField && v !== confirmValue) {
|
|
1079
|
+
setError("the two entries do not match");
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
if (state.validate) {
|
|
1083
|
+
const msg = state.validate(v);
|
|
1084
|
+
if (msg) {
|
|
1085
|
+
setError(msg);
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
close(v);
|
|
1090
|
+
}, [state, value, confirmValue, close]);
|
|
1091
|
+
if (!state) return null;
|
|
1092
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open: true, onOpenChange: (open) => !open && close(null), children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
1093
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm" }),
|
|
1094
|
+
/* @__PURE__ */ jsxs(
|
|
1095
|
+
DialogPrimitive.Content,
|
|
1096
|
+
{
|
|
1097
|
+
className: "bg-card border-border fixed top-1/2 left-1/2 z-50 w-[90vw] max-w-md -translate-x-1/2 -translate-y-1/2 border shadow-lg outline-none",
|
|
1098
|
+
onKeyDown: (e) => {
|
|
1099
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1100
|
+
e.preventDefault();
|
|
1101
|
+
submit();
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
children: [
|
|
1105
|
+
/* @__PURE__ */ jsx("div", { className: "terminal-title", children: /* @__PURE__ */ jsxs("span", { className: "text-primary flex items-center gap-1.5", children: [
|
|
1106
|
+
/* @__PURE__ */ jsx(Pencil, { className: "size-3.5" }),
|
|
1107
|
+
state.title
|
|
1108
|
+
] }) }),
|
|
1109
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 p-4 sm:p-5", children: [
|
|
1110
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "sr-only", children: state.title }),
|
|
1111
|
+
state.message && /* @__PURE__ */ jsx(DialogPrimitive.Description, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground font-mono text-xs leading-relaxed whitespace-pre-wrap", children: state.message }) }),
|
|
1112
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1113
|
+
state.label && /* @__PURE__ */ jsx(Label, { children: state.label }),
|
|
1114
|
+
/* @__PURE__ */ jsx(
|
|
1115
|
+
Input,
|
|
1116
|
+
{
|
|
1117
|
+
autoFocus: true,
|
|
1118
|
+
type: state.secret ? "password" : "text",
|
|
1119
|
+
value,
|
|
1120
|
+
onChange: (e) => {
|
|
1121
|
+
setValue(e.target.value);
|
|
1122
|
+
setError(null);
|
|
1123
|
+
},
|
|
1124
|
+
placeholder: state.placeholder,
|
|
1125
|
+
autoComplete: "off",
|
|
1126
|
+
spellCheck: false,
|
|
1127
|
+
className: (state.label ? "mt-2 " : "") + (state.secret ? "font-mono" : "")
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1130
|
+
] }),
|
|
1131
|
+
state.confirmField && /* @__PURE__ */ jsxs("div", { children: [
|
|
1132
|
+
/* @__PURE__ */ jsx(Label, { children: "confirm" }),
|
|
1133
|
+
/* @__PURE__ */ jsx(
|
|
1134
|
+
Input,
|
|
1135
|
+
{
|
|
1136
|
+
type: state.secret ? "password" : "text",
|
|
1137
|
+
value: confirmValue,
|
|
1138
|
+
onChange: (e) => {
|
|
1139
|
+
setConfirmValue(e.target.value);
|
|
1140
|
+
setError(null);
|
|
1141
|
+
},
|
|
1142
|
+
placeholder: "re-enter to confirm",
|
|
1143
|
+
autoComplete: "off",
|
|
1144
|
+
spellCheck: false,
|
|
1145
|
+
className: "mt-2 " + (state.secret ? "font-mono" : "")
|
|
1146
|
+
}
|
|
1147
|
+
)
|
|
1148
|
+
] }),
|
|
1149
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-destructive font-mono text-xs", children: error }),
|
|
1150
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [
|
|
1151
|
+
/* @__PURE__ */ jsx(
|
|
1152
|
+
Button,
|
|
1153
|
+
{
|
|
1154
|
+
variant: "outline",
|
|
1155
|
+
onClick: () => close(null),
|
|
1156
|
+
className: "font-mono text-[11px] tracking-widest uppercase",
|
|
1157
|
+
children: state.cancelLabel ?? "cancel"
|
|
1158
|
+
}
|
|
1159
|
+
),
|
|
1160
|
+
/* @__PURE__ */ jsx(Button, { onClick: submit, className: "font-display tracking-wide uppercase", children: state.confirmLabel ?? "ok" })
|
|
1161
|
+
] })
|
|
1162
|
+
] })
|
|
1163
|
+
]
|
|
1164
|
+
}
|
|
1165
|
+
)
|
|
1166
|
+
] }) });
|
|
1167
|
+
}
|
|
1168
|
+
function Modal({ open, onOpenChange, title, subtitle, children, actions, width = "wide" }) {
|
|
1169
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
|
|
1170
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "bg-background/80 fixed inset-0 z-[100] backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
|
|
1171
|
+
/* @__PURE__ */ jsxs(
|
|
1172
|
+
DialogPrimitive.Content,
|
|
1173
|
+
{
|
|
1174
|
+
className: cn(
|
|
1175
|
+
"terminal fixed top-[5vh] left-1/2 z-[110] flex max-h-[90vh] -translate-x-1/2 flex-col overflow-hidden rounded-sm border",
|
|
1176
|
+
width === "wide" ? "w-[95vw] max-w-screen-2xl" : "w-[80vw] max-w-3xl",
|
|
1177
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
|
|
1178
|
+
),
|
|
1179
|
+
children: [
|
|
1180
|
+
/* @__PURE__ */ jsxs("div", { className: "terminal-title flex shrink-0 items-center justify-between gap-3", children: [
|
|
1181
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1182
|
+
/* @__PURE__ */ jsx("span", { className: "terminal-dot", "aria-hidden": true }),
|
|
1183
|
+
/* @__PURE__ */ jsx("span", { className: "terminal-dot opacity-70", "aria-hidden": true }),
|
|
1184
|
+
/* @__PURE__ */ jsx("span", { className: "terminal-dot opacity-50", "aria-hidden": true }),
|
|
1185
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "ml-2 truncate", children: title }),
|
|
1186
|
+
subtitle && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/70 ml-1 truncate text-[10px] normal-case tracking-normal", children: [
|
|
1187
|
+
"\xB7 ",
|
|
1188
|
+
subtitle
|
|
1189
|
+
] })
|
|
1190
|
+
] }),
|
|
1191
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1192
|
+
actions,
|
|
1193
|
+
/* @__PURE__ */ jsx(
|
|
1194
|
+
DialogPrimitive.Close,
|
|
1195
|
+
{
|
|
1196
|
+
"aria-label": "close",
|
|
1197
|
+
className: "text-muted-foreground hover:text-foreground inline-flex h-6 w-6 items-center justify-center rounded-sm",
|
|
1198
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
1199
|
+
}
|
|
1200
|
+
)
|
|
1201
|
+
] })
|
|
1202
|
+
] }),
|
|
1203
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4 sm:p-6", children })
|
|
1204
|
+
]
|
|
1205
|
+
}
|
|
1206
|
+
)
|
|
1207
|
+
] }) });
|
|
1208
|
+
}
|
|
1209
|
+
function Pagination({ page, pageSize, total, onPage, className }) {
|
|
1210
|
+
if (total <= pageSize) return null;
|
|
1211
|
+
const start = page * pageSize;
|
|
1212
|
+
const shown = Math.max(0, Math.min(pageSize, total - start));
|
|
1213
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between " + (className ?? "mt-3"), children: [
|
|
1214
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/70 font-mono text-[10px]", children: [
|
|
1215
|
+
start + 1,
|
|
1216
|
+
"\u2013",
|
|
1217
|
+
start + shown,
|
|
1218
|
+
" of ",
|
|
1219
|
+
total
|
|
1220
|
+
] }),
|
|
1221
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1222
|
+
/* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: () => onPage(page - 1), disabled: page === 0, children: [
|
|
1223
|
+
/* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
|
|
1224
|
+
" prev"
|
|
1225
|
+
] }),
|
|
1226
|
+
/* @__PURE__ */ jsxs(
|
|
1227
|
+
Button,
|
|
1228
|
+
{
|
|
1229
|
+
variant: "outline",
|
|
1230
|
+
size: "sm",
|
|
1231
|
+
onClick: () => onPage(page + 1),
|
|
1232
|
+
disabled: start + pageSize >= total,
|
|
1233
|
+
children: [
|
|
1234
|
+
"next ",
|
|
1235
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
|
|
1236
|
+
]
|
|
1237
|
+
}
|
|
1238
|
+
)
|
|
1239
|
+
] })
|
|
1240
|
+
] });
|
|
1241
|
+
}
|
|
1242
|
+
function Popover({ ...props }) {
|
|
1243
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
1244
|
+
}
|
|
1245
|
+
function PopoverTrigger({ ...props }) {
|
|
1246
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
1247
|
+
}
|
|
1248
|
+
function PopoverContent({
|
|
1249
|
+
className,
|
|
1250
|
+
align = "center",
|
|
1251
|
+
sideOffset = 4,
|
|
1252
|
+
...props
|
|
1253
|
+
}) {
|
|
1254
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
1255
|
+
PopoverPrimitive.Content,
|
|
1256
|
+
{
|
|
1257
|
+
"data-slot": "popover-content",
|
|
1258
|
+
align,
|
|
1259
|
+
sideOffset,
|
|
1260
|
+
className: cn(
|
|
1261
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
1262
|
+
className
|
|
1263
|
+
),
|
|
1264
|
+
...props
|
|
1265
|
+
}
|
|
1266
|
+
) });
|
|
1267
|
+
}
|
|
1268
|
+
function PopoverAnchor({ ...props }) {
|
|
1269
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
1270
|
+
}
|
|
1271
|
+
var Accordion = AccordionPrimitive.Root;
|
|
1272
|
+
var AccordionItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Item, { ref, className: cn("border-b", className), ...props }));
|
|
1273
|
+
AccordionItem.displayName = "AccordionItem";
|
|
1274
|
+
var AccordionTrigger = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
1275
|
+
AccordionPrimitive.Trigger,
|
|
1276
|
+
{
|
|
1277
|
+
ref,
|
|
1278
|
+
className: cn(
|
|
1279
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
1280
|
+
className
|
|
1281
|
+
),
|
|
1282
|
+
...props,
|
|
1283
|
+
children: [
|
|
1284
|
+
children,
|
|
1285
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 shrink-0 transition-transform duration-200" })
|
|
1286
|
+
]
|
|
1287
|
+
}
|
|
1288
|
+
) }));
|
|
1289
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
1290
|
+
var AccordionContent = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1291
|
+
AccordionPrimitive.Content,
|
|
1292
|
+
{
|
|
1293
|
+
ref,
|
|
1294
|
+
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all",
|
|
1295
|
+
...props,
|
|
1296
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
|
|
1297
|
+
}
|
|
1298
|
+
));
|
|
1299
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
1300
|
+
function Select({ ...props }) {
|
|
1301
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
1302
|
+
}
|
|
1303
|
+
function SelectGroup({ ...props }) {
|
|
1304
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
1305
|
+
}
|
|
1306
|
+
function SelectValue({ ...props }) {
|
|
1307
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
1308
|
+
}
|
|
1309
|
+
function SelectTrigger({
|
|
1310
|
+
className,
|
|
1311
|
+
size = "default",
|
|
1312
|
+
children,
|
|
1313
|
+
...props
|
|
1314
|
+
}) {
|
|
1315
|
+
return /* @__PURE__ */ jsxs(
|
|
1316
|
+
SelectPrimitive.Trigger,
|
|
1317
|
+
{
|
|
1318
|
+
"data-slot": "select-trigger",
|
|
1319
|
+
"data-size": size,
|
|
1320
|
+
className: cn(
|
|
1321
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive bg-input/30 hover:bg-input/50 dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow,background-color] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1322
|
+
className
|
|
1323
|
+
),
|
|
1324
|
+
...props,
|
|
1325
|
+
children: [
|
|
1326
|
+
children,
|
|
1327
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
function SelectContent({
|
|
1333
|
+
className,
|
|
1334
|
+
children,
|
|
1335
|
+
position = "popper",
|
|
1336
|
+
...props
|
|
1337
|
+
}) {
|
|
1338
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1339
|
+
SelectPrimitive.Content,
|
|
1340
|
+
{
|
|
1341
|
+
"data-slot": "select-content",
|
|
1342
|
+
className: cn(
|
|
1343
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 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 shadow-md",
|
|
1344
|
+
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",
|
|
1345
|
+
className
|
|
1346
|
+
),
|
|
1347
|
+
position,
|
|
1348
|
+
...props,
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1351
|
+
/* @__PURE__ */ jsx(
|
|
1352
|
+
SelectPrimitive.Viewport,
|
|
1353
|
+
{
|
|
1354
|
+
className: cn(
|
|
1355
|
+
"p-1",
|
|
1356
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
1357
|
+
),
|
|
1358
|
+
children
|
|
1359
|
+
}
|
|
1360
|
+
),
|
|
1361
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
1362
|
+
]
|
|
1363
|
+
}
|
|
1364
|
+
) });
|
|
1365
|
+
}
|
|
1366
|
+
function SelectLabel({ className, ...props }) {
|
|
1367
|
+
return /* @__PURE__ */ jsx(
|
|
1368
|
+
SelectPrimitive.Label,
|
|
1369
|
+
{
|
|
1370
|
+
"data-slot": "select-label",
|
|
1371
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
1372
|
+
...props
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
function SelectItem({
|
|
1377
|
+
className,
|
|
1378
|
+
children,
|
|
1379
|
+
...props
|
|
1380
|
+
}) {
|
|
1381
|
+
return /* @__PURE__ */ jsxs(
|
|
1382
|
+
SelectPrimitive.Item,
|
|
1383
|
+
{
|
|
1384
|
+
"data-slot": "select-item",
|
|
1385
|
+
className: cn(
|
|
1386
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
1387
|
+
className
|
|
1388
|
+
),
|
|
1389
|
+
...props,
|
|
1390
|
+
children: [
|
|
1391
|
+
/* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
|
|
1392
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
1393
|
+
]
|
|
1394
|
+
}
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1397
|
+
function SelectSeparator({
|
|
1398
|
+
className,
|
|
1399
|
+
...props
|
|
1400
|
+
}) {
|
|
1401
|
+
return /* @__PURE__ */ jsx(
|
|
1402
|
+
SelectPrimitive.Separator,
|
|
1403
|
+
{
|
|
1404
|
+
"data-slot": "select-separator",
|
|
1405
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
1406
|
+
...props
|
|
1407
|
+
}
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1410
|
+
function SelectScrollUpButton({
|
|
1411
|
+
className,
|
|
1412
|
+
...props
|
|
1413
|
+
}) {
|
|
1414
|
+
return /* @__PURE__ */ jsx(
|
|
1415
|
+
SelectPrimitive.ScrollUpButton,
|
|
1416
|
+
{
|
|
1417
|
+
"data-slot": "select-scroll-up-button",
|
|
1418
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1419
|
+
...props,
|
|
1420
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
|
|
1421
|
+
}
|
|
1422
|
+
);
|
|
1423
|
+
}
|
|
1424
|
+
function SelectScrollDownButton({
|
|
1425
|
+
className,
|
|
1426
|
+
...props
|
|
1427
|
+
}) {
|
|
1428
|
+
return /* @__PURE__ */ jsx(
|
|
1429
|
+
SelectPrimitive.ScrollDownButton,
|
|
1430
|
+
{
|
|
1431
|
+
"data-slot": "select-scroll-down-button",
|
|
1432
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1433
|
+
...props,
|
|
1434
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
1435
|
+
}
|
|
1436
|
+
);
|
|
1437
|
+
}
|
|
1438
|
+
var Toaster = ({ ...props }) => {
|
|
1439
|
+
const { theme = "system" } = useTheme();
|
|
1440
|
+
return /* @__PURE__ */ jsx(
|
|
1441
|
+
Toaster$1,
|
|
1442
|
+
{
|
|
1443
|
+
theme,
|
|
1444
|
+
className: "toaster group",
|
|
1445
|
+
toastOptions: {
|
|
1446
|
+
classNames: {
|
|
1447
|
+
toast: "group toast group-[.toaster]:bg-card group-[.toaster]:text-card-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
1448
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
1449
|
+
actionButton: "group-[.toast]:bg-foreground group-[.toast]:text-background",
|
|
1450
|
+
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
|
1451
|
+
error: "group-[.toaster]:!bg-card group-[.toaster]:!text-foreground group-[.toaster]:!border-border",
|
|
1452
|
+
success: "group-[.toaster]:!bg-card group-[.toaster]:!text-foreground group-[.toaster]:!border-border",
|
|
1453
|
+
warning: "group-[.toaster]:!bg-card group-[.toaster]:!text-foreground group-[.toaster]:!border-border",
|
|
1454
|
+
info: "group-[.toaster]:!bg-card group-[.toaster]:!text-muted-foreground group-[.toaster]:!border-border"
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
style: {
|
|
1458
|
+
"--normal-bg": "var(--card)",
|
|
1459
|
+
"--normal-text": "var(--card-foreground)",
|
|
1460
|
+
"--normal-border": "var(--border)",
|
|
1461
|
+
"--error-bg": "var(--card)",
|
|
1462
|
+
"--error-text": "var(--foreground)",
|
|
1463
|
+
"--error-border": "var(--border)",
|
|
1464
|
+
"--success-bg": "var(--card)",
|
|
1465
|
+
"--success-text": "var(--foreground)",
|
|
1466
|
+
"--success-border": "var(--border)",
|
|
1467
|
+
"--warning-bg": "var(--card)",
|
|
1468
|
+
"--warning-text": "var(--foreground)",
|
|
1469
|
+
"--warning-border": "var(--border)",
|
|
1470
|
+
"--info-bg": "var(--card)",
|
|
1471
|
+
"--info-text": "var(--muted-foreground)",
|
|
1472
|
+
"--info-border": "var(--border)"
|
|
1473
|
+
},
|
|
1474
|
+
...props
|
|
1475
|
+
}
|
|
1476
|
+
);
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
// src/components/index.ts
|
|
1480
|
+
var components_exports = {};
|
|
1481
|
+
__reExport(components_exports, ui_star);
|
|
1482
|
+
|
|
1483
|
+
// src/index.ts
|
|
1484
|
+
__reExport(src_exports, components_exports);
|
|
1485
|
+
|
|
1486
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithCountdown, Badge, Button, ConfirmHost, DEFAULT_OC_THEME, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, Input, Label, Modal, OC_SKIN_COOKIE, OC_THEMES, OcThemeBridge, OcThemePicker, OcThemeProvider, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Working, WorkingPanel, badgeVariants, buttonVariants, cn, confirm, getOcThemeInitScript, isKnownTheme, prompt, resolveTheme, useOcSkin };
|
|
1487
|
+
//# sourceMappingURL=index.mjs.map
|
|
1488
|
+
//# sourceMappingURL=index.mjs.map
|