ruler-components 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +458 -0
- package/dist/index.d.ts +458 -0
- package/dist/index.js +3618 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3467 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +21 -2
- package/AGENTS.md +0 -9
- package/CLAUDE.md +0 -1
- package/app/docs/[slug]/page.tsx +0 -147
- package/app/docs/layout.tsx +0 -26
- package/app/docs/page.tsx +0 -148
- package/app/favicon.ico +0 -0
- package/app/globals.css +0 -168
- package/app/icon.png +0 -0
- package/app/layout.tsx +0 -90
- package/app/opengraph-image.tsx +0 -10
- package/app/page.tsx +0 -34
- package/app/twitter-image.tsx +0 -10
- package/components/docs/accordion-doc-page.tsx +0 -352
- package/components/docs/alert-doc-page.tsx +0 -293
- package/components/docs/allinput-doc-page.tsx +0 -183
- package/components/docs/avatar-doc-page.tsx +0 -424
- package/components/docs/badge-doc-page.tsx +0 -363
- package/components/docs/button-doc-page.tsx +0 -406
- package/components/docs/card-doc-page.tsx +0 -364
- package/components/docs/checkbox-doc-page.tsx +0 -277
- package/components/docs/colors-doc-page.tsx +0 -430
- package/components/docs/dialog-doc-page.tsx +0 -364
- package/components/docs/docs-footer.tsx +0 -11
- package/components/docs/docs-mobile-menu-bar.tsx +0 -22
- package/components/docs/docs-mobile-nav-context.tsx +0 -27
- package/components/docs/docs-page.tsx +0 -263
- package/components/docs/docs-search.tsx +0 -303
- package/components/docs/docs-sidebar.tsx +0 -165
- package/components/docs/docs-topbar.tsx +0 -32
- package/components/docs/dropdown-doc-page.tsx +0 -522
- package/components/docs/getting-started-doc-page.tsx +0 -205
- package/components/docs/label-doc-page.tsx +0 -173
- package/components/docs/loaders-doc-page.tsx +0 -244
- package/components/docs/menu-doc-page.tsx +0 -373
- package/components/docs/modal-doc-page.tsx +0 -436
- package/components/docs/next-steps.tsx +0 -53
- package/components/docs/pagination-doc-page.tsx +0 -316
- package/components/docs/progress-doc-page.tsx +0 -387
- package/components/docs/radio-doc-page.tsx +0 -270
- package/components/docs/skeleton-doc-page.tsx +0 -230
- package/components/docs/stepper-doc-page.tsx +0 -309
- package/components/docs/switch-doc-page.tsx +0 -264
- package/components/docs/table-doc-page.tsx +0 -689
- package/components/docs/tabs-doc-page.tsx +0 -359
- package/components/docs/theming-doc-page.tsx +0 -243
- package/components/docs/tooltip-doc-page.tsx +0 -357
- package/components/docs/usage-section.tsx +0 -21
- package/components/icons/discord.tsx +0 -9
- package/components/icons/github.tsx +0 -9
- package/components/icons/x.tsx +0 -9
- package/components/installation-section.tsx +0 -34
- package/components/landing/feature-highlights.tsx +0 -105
- package/components/landing/footer-strip.tsx +0 -45
- package/components/landing/hero-card.tsx +0 -14
- package/components/landing/hero-spotlight.tsx +0 -126
- package/components/landing/hero.tsx +0 -64
- package/components/landing/navbar.tsx +0 -44
- package/components/landing/quick-start-section.tsx +0 -59
- package/components/landing/site-footer.tsx +0 -55
- package/components/theme-provider.tsx +0 -60
- package/components/ui/accordion.tsx +0 -174
- package/components/ui/alert.tsx +0 -103
- package/components/ui/allinput.tsx +0 -210
- package/components/ui/avatar.tsx +0 -179
- package/components/ui/badge.tsx +0 -52
- package/components/ui/button.tsx +0 -75
- package/components/ui/card.tsx +0 -105
- package/components/ui/checkbox.tsx +0 -130
- package/components/ui/code-block.tsx +0 -60
- package/components/ui/data-table.tsx +0 -235
- package/components/ui/dialog.tsx +0 -173
- package/components/ui/dropdown.tsx +0 -78
- package/components/ui/feature-card.tsx +0 -38
- package/components/ui/input.tsx +0 -44
- package/components/ui/label.tsx +0 -110
- package/components/ui/loaders.tsx +0 -139
- package/components/ui/menu.tsx +0 -118
- package/components/ui/modal.tsx +0 -399
- package/components/ui/package-manager-tabs.tsx +0 -40
- package/components/ui/pagination.tsx +0 -200
- package/components/ui/progress.tsx +0 -134
- package/components/ui/radio.tsx +0 -262
- package/components/ui/skeleton.tsx +0 -102
- package/components/ui/steppers.tsx +0 -309
- package/components/ui/switch.tsx +0 -153
- package/components/ui/table.tsx +0 -58
- package/components/ui/tabs.tsx +0 -166
- package/components/ui/theme-toggle.tsx +0 -60
- package/components/ui/tooltip.tsx +0 -238
- package/data/color-palette.ts +0 -35
- package/data/docs-nav.ts +0 -84
- package/eslint.config.mjs +0 -18
- package/index.ts +0 -8
- package/lib/cn.ts +0 -4
- package/lib/color.ts +0 -85
- package/lib/og-image.tsx +0 -138
- package/lib/theme.ts +0 -33
- package/next.config.ts +0 -7
- package/postcss.config.mjs +0 -7
- package/public/dark.png +0 -0
- package/public/dark1.png +0 -0
- package/public/dark2.png +0 -0
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/light.png +0 -0
- package/public/light1.png +0 -0
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/video/hero-demo.mp4 +0 -0
- package/public/window.svg +0 -1
- package/tsconfig.json +0 -34
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3467 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// components/ui/accordion.tsx
|
|
35
|
+
import { createContext, useContext, useState, useRef, useLayoutEffect, useId } from "react";
|
|
36
|
+
import { Plus, ChevronDown, ChevronRight } from "lucide-react";
|
|
37
|
+
|
|
38
|
+
// lib/cn.ts
|
|
39
|
+
import { clsx } from "clsx";
|
|
40
|
+
import { twMerge } from "tailwind-merge";
|
|
41
|
+
var cn = (...inputs) => twMerge(clsx(inputs));
|
|
42
|
+
|
|
43
|
+
// components/ui/accordion.tsx
|
|
44
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
45
|
+
var AccordionContext = createContext(null);
|
|
46
|
+
function useAccordionContext() {
|
|
47
|
+
const ctx = useContext(AccordionContext);
|
|
48
|
+
if (!ctx) throw new Error("Accordion components must be used inside Accordion");
|
|
49
|
+
return ctx;
|
|
50
|
+
}
|
|
51
|
+
var EASE = { transitionTimingFunction: "cubic-bezier(0.16,1,0.3,1)" };
|
|
52
|
+
function Accordion({ children, defaultValue = null, className = "" }) {
|
|
53
|
+
const [openValue, setOpenValue] = useState(defaultValue);
|
|
54
|
+
const toggle = (value) => setOpenValue((current) => current === value ? null : value);
|
|
55
|
+
return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: { openValue, toggle }, children: /* @__PURE__ */ jsx("div", { className, children }) });
|
|
56
|
+
}
|
|
57
|
+
function AccordionItem({ value, title, children, variant = "plus" }) {
|
|
58
|
+
const { openValue, toggle } = useAccordionContext();
|
|
59
|
+
const isOpen = openValue === value;
|
|
60
|
+
const contentRef = useRef(null);
|
|
61
|
+
const [height, setHeight] = useState(0);
|
|
62
|
+
const panelId = useId();
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
if (!contentRef.current) return;
|
|
65
|
+
setHeight(isOpen ? contentRef.current.scrollHeight : 0);
|
|
66
|
+
}, [isOpen]);
|
|
67
|
+
if (variant === "chevron") {
|
|
68
|
+
return /* @__PURE__ */ jsxs("div", { className: "border-b border-zinc-200 dark:border-zinc-800 last:border-0", children: [
|
|
69
|
+
/* @__PURE__ */ jsxs(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
onClick: () => toggle(value),
|
|
74
|
+
"aria-expanded": isOpen,
|
|
75
|
+
"aria-controls": panelId,
|
|
76
|
+
className: "group flex w-full items-center justify-between rounded-lg py-5 text-left outline-none transition-colors duration-200 hover:bg-zinc-50 focus-visible:ring-2 focus-visible:ring-zinc-900/15 dark:hover:bg-zinc-900/40 dark:focus-visible:ring-white/20",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
className: cn(
|
|
82
|
+
"text-[15px] font-medium transition-colors duration-200",
|
|
83
|
+
isOpen ? "text-zinc-900 dark:text-white" : "text-zinc-600 group-hover:text-zinc-900 dark:text-zinc-400 dark:group-hover:text-zinc-200"
|
|
84
|
+
),
|
|
85
|
+
children: title
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
ChevronDown,
|
|
90
|
+
{
|
|
91
|
+
size: 18,
|
|
92
|
+
style: EASE,
|
|
93
|
+
className: cn(
|
|
94
|
+
"shrink-0 text-zinc-400 transition-transform duration-300 group-hover:text-zinc-600 dark:group-hover:text-zinc-300",
|
|
95
|
+
isOpen && "rotate-180 text-zinc-900 dark:text-white"
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx("div", { style: __spreadProps(__spreadValues({}, EASE), { height }), className: "overflow-hidden transition-[height] duration-300", children: /* @__PURE__ */ jsx("div", { id: panelId, ref: contentRef, className: "pb-5 text-sm leading-relaxed text-zinc-500 dark:text-zinc-400", children }) })
|
|
103
|
+
] });
|
|
104
|
+
}
|
|
105
|
+
return /* @__PURE__ */ jsxs("div", { className: "border-b border-zinc-200 dark:border-zinc-800 last:border-0", children: [
|
|
106
|
+
/* @__PURE__ */ jsxs(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: () => toggle(value),
|
|
111
|
+
"aria-expanded": isOpen,
|
|
112
|
+
"aria-controls": panelId,
|
|
113
|
+
className: "group flex w-full items-center gap-3 rounded-lg py-4 text-left outline-none transition-colors duration-200 hover:bg-zinc-50 focus-visible:ring-2 focus-visible:ring-zinc-900/15 dark:hover:bg-zinc-900/40 dark:focus-visible:ring-white/20",
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
"span",
|
|
117
|
+
{
|
|
118
|
+
style: EASE,
|
|
119
|
+
className: cn(
|
|
120
|
+
"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border transition-all duration-300",
|
|
121
|
+
isOpen ? "border-zinc-900 bg-zinc-900 text-white shadow-sm dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-900" : "border-zinc-300 text-zinc-400 group-hover:border-zinc-400 group-hover:text-zinc-500 dark:border-zinc-700 dark:group-hover:border-zinc-600"
|
|
122
|
+
),
|
|
123
|
+
children: /* @__PURE__ */ jsx(Plus, { size: 12, style: EASE, className: cn("transition-transform duration-300", isOpen && "rotate-45") })
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
"span",
|
|
128
|
+
{
|
|
129
|
+
className: cn(
|
|
130
|
+
"text-[15px] font-medium transition-colors duration-200",
|
|
131
|
+
isOpen ? "text-zinc-900 dark:text-zinc-100" : "text-zinc-600 group-hover:text-zinc-900 dark:text-zinc-400 dark:group-hover:text-zinc-200"
|
|
132
|
+
),
|
|
133
|
+
children: title
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsx("div", { style: __spreadProps(__spreadValues({}, EASE), { height }), className: "overflow-hidden transition-[height] duration-300", children: /* @__PURE__ */ jsx("div", { id: panelId, ref: contentRef, className: "pb-4 pl-9 text-sm leading-relaxed text-zinc-500 dark:text-zinc-400", children }) })
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
function AccordionNested({ title, children, level = 0 }) {
|
|
143
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
144
|
+
const contentRef = useRef(null);
|
|
145
|
+
const [height, setHeight] = useState(0);
|
|
146
|
+
const panelId = useId();
|
|
147
|
+
useLayoutEffect(() => {
|
|
148
|
+
if (!contentRef.current) return;
|
|
149
|
+
setHeight(isOpen ? contentRef.current.scrollHeight : 0);
|
|
150
|
+
}, [isOpen, children]);
|
|
151
|
+
return /* @__PURE__ */ jsxs("div", { className: "border-b border-zinc-100 dark:border-zinc-800 last:border-0", children: [
|
|
152
|
+
/* @__PURE__ */ jsxs(
|
|
153
|
+
"button",
|
|
154
|
+
{
|
|
155
|
+
type: "button",
|
|
156
|
+
onClick: () => setIsOpen(!isOpen),
|
|
157
|
+
"aria-expanded": isOpen,
|
|
158
|
+
"aria-controls": panelId,
|
|
159
|
+
className: "group flex w-full items-center gap-2.5 rounded-lg py-3.5 text-left outline-none transition-colors duration-200 hover:bg-zinc-50 focus-visible:ring-2 focus-visible:ring-zinc-900/15 dark:hover:bg-zinc-900/40 dark:focus-visible:ring-white/20",
|
|
160
|
+
style: { paddingLeft: `${level * 1.5}rem` },
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx(
|
|
163
|
+
ChevronRight,
|
|
164
|
+
{
|
|
165
|
+
size: 15,
|
|
166
|
+
style: EASE,
|
|
167
|
+
className: cn(
|
|
168
|
+
"shrink-0 text-zinc-400 transition-transform duration-300 group-hover:text-zinc-600 dark:group-hover:text-zinc-300",
|
|
169
|
+
isOpen && "rotate-90 text-zinc-600 dark:text-zinc-300"
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsx("span", { className: "text-[15px] font-medium text-zinc-900 dark:text-zinc-100", children: title })
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ jsx("div", { style: __spreadProps(__spreadValues({}, EASE), { height }), className: "overflow-hidden transition-[height] duration-300", children: /* @__PURE__ */ jsx("div", { id: panelId, ref: contentRef, className: "flex flex-col", children }) })
|
|
178
|
+
] });
|
|
179
|
+
}
|
|
180
|
+
function AccordionLink({ title, level = 0 }) {
|
|
181
|
+
return /* @__PURE__ */ jsx("div", { className: "border-b border-zinc-100 dark:border-zinc-800 last:border-0", children: /* @__PURE__ */ jsx(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
className: "cursor-pointer rounded-lg py-3.5 text-[15px] font-medium text-zinc-600 transition-colors duration-200 hover:bg-zinc-50 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-900/40 dark:hover:text-zinc-100",
|
|
185
|
+
style: { paddingLeft: `${level * 1.5 + 1.5625}rem` },
|
|
186
|
+
children: title
|
|
187
|
+
}
|
|
188
|
+
) });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// components/ui/alert.tsx
|
|
192
|
+
import React2 from "react";
|
|
193
|
+
import { CheckCircle2, TriangleAlert, Info, XCircle, X } from "lucide-react";
|
|
194
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
195
|
+
var Alert = React2.forwardRef(
|
|
196
|
+
(_a, ref) => {
|
|
197
|
+
var _b = _a, { className = "", variant = "info", title, description, dismissible, onDismiss, action, children } = _b, props = __objRest(_b, ["className", "variant", "title", "description", "dismissible", "onDismiss", "action", "children"]);
|
|
198
|
+
const configs = {
|
|
199
|
+
info: {
|
|
200
|
+
bar: "bg-[#0070BA]",
|
|
201
|
+
icon: /* @__PURE__ */ jsx2(Info, { className: "h-5 w-5 text-[#0070BA] shrink-0" })
|
|
202
|
+
},
|
|
203
|
+
success: {
|
|
204
|
+
bar: "bg-[#28A745]",
|
|
205
|
+
icon: /* @__PURE__ */ jsx2(CheckCircle2, { className: "h-5 w-5 text-[#28A745] shrink-0" })
|
|
206
|
+
},
|
|
207
|
+
warning: {
|
|
208
|
+
bar: "bg-[#E58E00]",
|
|
209
|
+
icon: /* @__PURE__ */ jsx2(TriangleAlert, { className: "h-5 w-5 text-[#E58E00] shrink-0" })
|
|
210
|
+
},
|
|
211
|
+
error: {
|
|
212
|
+
bar: "bg-[#D93025]",
|
|
213
|
+
icon: /* @__PURE__ */ jsx2(XCircle, { className: "h-5 w-5 text-[#D93025] shrink-0" })
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const current = configs[variant];
|
|
217
|
+
return /* @__PURE__ */ jsxs2(
|
|
218
|
+
"div",
|
|
219
|
+
__spreadProps(__spreadValues({
|
|
220
|
+
ref,
|
|
221
|
+
className: `relative flex w-full min-h-[64px] items-center gap-2.5 rounded-lg border border-gray-200 bg-white px-3 py-2.5 shadow-[0_3px_12px_rgba(0,0,0,0.03)] dark:border-zinc-800 dark:bg-zinc-900 dark:shadow-none ${className}`
|
|
222
|
+
}, props), {
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx2(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
className: `absolute left-0 top-0 w-16 h-1 ${current.bar} rounded-tl-lg`,
|
|
228
|
+
style: {
|
|
229
|
+
clipPath: "polygon(0 0, 100% 0, 92% 100%, 0 100%)"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ jsx2("div", { className: "shrink-0 flex items-center justify-center", children: current.icon }),
|
|
234
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 min-w-0", children: [
|
|
235
|
+
title && /* @__PURE__ */ jsx2("h5", { className: "text-[13px] font-semibold tracking-tight text-zinc-900 dark:text-white leading-tight", children: title }),
|
|
236
|
+
description && /* @__PURE__ */ jsx2("p", { className: "mt-0.5 text-[11px] font-medium text-zinc-500 dark:text-zinc-300 leading-tight", children: description }),
|
|
237
|
+
children
|
|
238
|
+
] }),
|
|
239
|
+
action && /* @__PURE__ */ jsx2("div", { className: `shrink-0 ml-auto ${dismissible || onDismiss ? "mr-5" : ""}`, children: action }),
|
|
240
|
+
(dismissible || onDismiss) && /* @__PURE__ */ jsx2(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
onClick: onDismiss,
|
|
244
|
+
className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-400 hover:text-zinc-600 dark:text-zinc-500 dark:hover:text-zinc-200 transition-colors",
|
|
245
|
+
children: /* @__PURE__ */ jsx2(X, { className: "h-3.5 w-3.5 stroke-[3]" })
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
]
|
|
249
|
+
})
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
Alert.displayName = "Alert";
|
|
254
|
+
|
|
255
|
+
// components/ui/allinput.tsx
|
|
256
|
+
import { useState as useState2 } from "react";
|
|
257
|
+
import { Search, Eye, EyeOff, Check } from "lucide-react";
|
|
258
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
259
|
+
var fieldText = "text-sm text-zinc-900 outline-none transition-all duration-150 placeholder:text-zinc-400 dark:text-zinc-100 dark:placeholder:text-zinc-500";
|
|
260
|
+
var fieldSurface = "border-zinc-200 hover:border-zinc-300 focus:border-zinc-900 focus:ring-4 focus:ring-zinc-900/5 dark:border-zinc-800 dark:hover:border-zinc-700 dark:focus:border-zinc-400 dark:focus:ring-zinc-300/10";
|
|
261
|
+
var InputStandard = (_a) => {
|
|
262
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
263
|
+
return /* @__PURE__ */ jsx3(
|
|
264
|
+
"input",
|
|
265
|
+
__spreadProps(__spreadValues({}, props), {
|
|
266
|
+
className: cn("w-full rounded-xl border bg-white px-4 py-2.5 dark:bg-zinc-900", fieldText, fieldSurface, className)
|
|
267
|
+
})
|
|
268
|
+
);
|
|
269
|
+
};
|
|
270
|
+
var InputFilled = (_a) => {
|
|
271
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
272
|
+
return /* @__PURE__ */ jsx3(
|
|
273
|
+
"input",
|
|
274
|
+
__spreadProps(__spreadValues({}, props), {
|
|
275
|
+
className: cn(
|
|
276
|
+
"w-full rounded-xl border border-transparent bg-zinc-100 px-4 py-3 hover:bg-zinc-200/70 focus:border-zinc-900 focus:bg-white focus:ring-4 focus:ring-zinc-900/5 dark:bg-zinc-800 dark:hover:bg-zinc-700/70 dark:focus:border-zinc-400 dark:focus:bg-zinc-900 dark:focus:ring-zinc-300/10",
|
|
277
|
+
fieldText,
|
|
278
|
+
className
|
|
279
|
+
)
|
|
280
|
+
})
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
var InputUnderline = (_a) => {
|
|
284
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
285
|
+
return /* @__PURE__ */ jsxs3("div", { className: "group relative", children: [
|
|
286
|
+
/* @__PURE__ */ jsx3(
|
|
287
|
+
"input",
|
|
288
|
+
__spreadProps(__spreadValues({}, props), {
|
|
289
|
+
className: cn(
|
|
290
|
+
"w-full border-b border-zinc-200 bg-transparent py-2 focus:border-zinc-900 dark:border-zinc-700 dark:focus:border-white",
|
|
291
|
+
fieldText,
|
|
292
|
+
className
|
|
293
|
+
)
|
|
294
|
+
})
|
|
295
|
+
),
|
|
296
|
+
/* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-0 h-[2px] w-0 bg-zinc-900 transition-all duration-300 group-focus-within:w-full dark:bg-white" })
|
|
297
|
+
] });
|
|
298
|
+
};
|
|
299
|
+
var InputFloating = (_a) => {
|
|
300
|
+
var _b = _a, {
|
|
301
|
+
label,
|
|
302
|
+
className
|
|
303
|
+
} = _b, props = __objRest(_b, [
|
|
304
|
+
"label",
|
|
305
|
+
"className"
|
|
306
|
+
]);
|
|
307
|
+
const [value, setValue] = useState2("");
|
|
308
|
+
const filled = Boolean(value || props.defaultValue);
|
|
309
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative pt-4", children: [
|
|
310
|
+
/* @__PURE__ */ jsx3(
|
|
311
|
+
"input",
|
|
312
|
+
__spreadProps(__spreadValues({}, props), {
|
|
313
|
+
onChange: (e) => {
|
|
314
|
+
var _a2;
|
|
315
|
+
setValue(e.target.value);
|
|
316
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, e);
|
|
317
|
+
},
|
|
318
|
+
className: cn(
|
|
319
|
+
"peer w-full border-b-2 border-zinc-200 bg-transparent py-2 focus:border-zinc-900 dark:border-zinc-700 dark:focus:border-white",
|
|
320
|
+
fieldText,
|
|
321
|
+
className
|
|
322
|
+
)
|
|
323
|
+
})
|
|
324
|
+
),
|
|
325
|
+
/* @__PURE__ */ jsx3(
|
|
326
|
+
"label",
|
|
327
|
+
{
|
|
328
|
+
className: cn(
|
|
329
|
+
"absolute left-0 transition-all duration-200",
|
|
330
|
+
filled ? "-top-1 text-xs font-bold text-zinc-900 dark:text-white" : "top-5 text-sm text-zinc-400 peer-focus:-top-1 peer-focus:text-xs peer-focus:font-bold peer-focus:text-zinc-900 dark:peer-focus:text-white"
|
|
331
|
+
),
|
|
332
|
+
children: label
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] });
|
|
336
|
+
};
|
|
337
|
+
var InputSearch = (_a) => {
|
|
338
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
339
|
+
return /* @__PURE__ */ jsxs3("div", { className: "group relative", children: [
|
|
340
|
+
/* @__PURE__ */ jsx3(
|
|
341
|
+
Search,
|
|
342
|
+
{
|
|
343
|
+
size: 16,
|
|
344
|
+
className: "absolute left-4 top-1/2 -translate-y-1/2 text-zinc-400 transition-colors group-focus-within:text-zinc-900 dark:group-focus-within:text-white"
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ jsx3(
|
|
348
|
+
"input",
|
|
349
|
+
__spreadProps(__spreadValues({}, props), {
|
|
350
|
+
type: "text",
|
|
351
|
+
className: cn(
|
|
352
|
+
"w-full rounded-full border bg-zinc-50 py-2.5 pl-11 pr-4 focus:bg-white dark:bg-zinc-900 dark:focus:bg-zinc-950",
|
|
353
|
+
fieldText,
|
|
354
|
+
fieldSurface,
|
|
355
|
+
className
|
|
356
|
+
)
|
|
357
|
+
})
|
|
358
|
+
)
|
|
359
|
+
] });
|
|
360
|
+
};
|
|
361
|
+
var InputPassword = (_a) => {
|
|
362
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
363
|
+
const [show, setShow] = useState2(false);
|
|
364
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
365
|
+
/* @__PURE__ */ jsx3(
|
|
366
|
+
"input",
|
|
367
|
+
__spreadProps(__spreadValues({}, props), {
|
|
368
|
+
type: show ? "text" : "password",
|
|
369
|
+
className: cn("w-full rounded-xl border bg-white px-4 py-2.5 pr-11 dark:bg-zinc-900", fieldText, fieldSurface, className)
|
|
370
|
+
})
|
|
371
|
+
),
|
|
372
|
+
/* @__PURE__ */ jsx3(
|
|
373
|
+
"button",
|
|
374
|
+
{
|
|
375
|
+
type: "button",
|
|
376
|
+
onClick: () => setShow(!show),
|
|
377
|
+
"aria-label": show ? "Hide password" : "Show password",
|
|
378
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-zinc-400 transition-colors hover:text-zinc-900 dark:hover:text-white",
|
|
379
|
+
children: show ? /* @__PURE__ */ jsx3(EyeOff, { size: 18 }) : /* @__PURE__ */ jsx3(Eye, { size: 18 })
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] });
|
|
383
|
+
};
|
|
384
|
+
var InputAddon = (_a) => {
|
|
385
|
+
var _b = _a, {
|
|
386
|
+
prefix,
|
|
387
|
+
suffix,
|
|
388
|
+
className
|
|
389
|
+
} = _b, props = __objRest(_b, [
|
|
390
|
+
"prefix",
|
|
391
|
+
"suffix",
|
|
392
|
+
"className"
|
|
393
|
+
]);
|
|
394
|
+
return /* @__PURE__ */ jsxs3(
|
|
395
|
+
"div",
|
|
396
|
+
{
|
|
397
|
+
className: cn(
|
|
398
|
+
"flex w-full overflow-hidden rounded-xl border border-zinc-200 bg-white transition-all focus-within:border-zinc-900 focus-within:ring-4 focus-within:ring-zinc-900/5 dark:border-zinc-800 dark:bg-zinc-900 dark:focus-within:border-zinc-400 dark:focus-within:ring-zinc-300/10",
|
|
399
|
+
className
|
|
400
|
+
),
|
|
401
|
+
children: [
|
|
402
|
+
prefix && /* @__PURE__ */ jsx3("span", { className: "flex items-center border-r border-zinc-200 bg-zinc-50 px-3 text-sm font-medium text-zinc-500 dark:border-zinc-800 dark:bg-zinc-800 dark:text-zinc-400", children: prefix }),
|
|
403
|
+
/* @__PURE__ */ jsx3("input", __spreadProps(__spreadValues({}, props), { className: cn("flex-1 bg-transparent px-4 py-2.5", fieldText) })),
|
|
404
|
+
suffix && /* @__PURE__ */ jsx3("span", { className: "flex items-center border-l border-zinc-200 bg-zinc-50 px-3 text-sm font-medium text-zinc-500 dark:border-zinc-800 dark:bg-zinc-800 dark:text-zinc-400", children: suffix })
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
};
|
|
409
|
+
var InputIcon = (_a) => {
|
|
410
|
+
var _b = _a, {
|
|
411
|
+
icon: Icon,
|
|
412
|
+
position = "left",
|
|
413
|
+
className
|
|
414
|
+
} = _b, props = __objRest(_b, [
|
|
415
|
+
"icon",
|
|
416
|
+
"position",
|
|
417
|
+
"className"
|
|
418
|
+
]);
|
|
419
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
420
|
+
/* @__PURE__ */ jsx3(
|
|
421
|
+
"div",
|
|
422
|
+
{
|
|
423
|
+
className: cn(
|
|
424
|
+
"pointer-events-none absolute top-1/2 -translate-y-1/2 text-zinc-400",
|
|
425
|
+
position === "left" ? "left-3.5" : "right-3.5"
|
|
426
|
+
),
|
|
427
|
+
children: /* @__PURE__ */ jsx3(Icon, { size: 18, strokeWidth: 1.5 })
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
/* @__PURE__ */ jsx3(
|
|
431
|
+
"input",
|
|
432
|
+
__spreadProps(__spreadValues({}, props), {
|
|
433
|
+
className: cn(
|
|
434
|
+
"w-full rounded-xl border bg-white py-2.5 shadow-sm dark:bg-zinc-900",
|
|
435
|
+
position === "left" ? "pl-10 pr-4" : "pl-4 pr-10",
|
|
436
|
+
fieldText,
|
|
437
|
+
fieldSurface,
|
|
438
|
+
className
|
|
439
|
+
)
|
|
440
|
+
})
|
|
441
|
+
)
|
|
442
|
+
] });
|
|
443
|
+
};
|
|
444
|
+
var InputOTP = () => /* @__PURE__ */ jsx3("div", { className: "flex gap-2.5", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx3(
|
|
445
|
+
"input",
|
|
446
|
+
{
|
|
447
|
+
maxLength: 1,
|
|
448
|
+
"aria-label": `Digit ${i}`,
|
|
449
|
+
className: "h-12 w-12 rounded-xl border-2 border-zinc-200 bg-white text-center text-lg font-bold text-zinc-900 outline-none transition-all focus:border-zinc-900 focus:ring-4 focus:ring-zinc-900/5 dark:border-zinc-800 dark:bg-zinc-900 dark:text-white dark:focus:border-zinc-400 dark:focus:ring-zinc-300/10"
|
|
450
|
+
},
|
|
451
|
+
i
|
|
452
|
+
)) });
|
|
453
|
+
var InputAutocomplete = (_a) => {
|
|
454
|
+
var _b = _a, {
|
|
455
|
+
suggestions,
|
|
456
|
+
className
|
|
457
|
+
} = _b, props = __objRest(_b, [
|
|
458
|
+
"suggestions",
|
|
459
|
+
"className"
|
|
460
|
+
]);
|
|
461
|
+
return /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
462
|
+
/* @__PURE__ */ jsx3(
|
|
463
|
+
"input",
|
|
464
|
+
__spreadProps(__spreadValues({}, props), {
|
|
465
|
+
className: cn("w-full rounded-xl border bg-white px-4 py-2.5 dark:bg-zinc-900", fieldText, fieldSurface, className)
|
|
466
|
+
})
|
|
467
|
+
),
|
|
468
|
+
/* @__PURE__ */ jsx3("div", { className: "absolute top-[calc(100%+0.5rem)] z-50 w-full rounded-xl border border-zinc-200 bg-white p-1 shadow-xl dark:border-zinc-800 dark:bg-zinc-900", children: suggestions.map((s) => /* @__PURE__ */ jsxs3(
|
|
469
|
+
"div",
|
|
470
|
+
{
|
|
471
|
+
className: "flex cursor-pointer items-center justify-between rounded-lg px-3 py-2 text-sm text-zinc-700 hover:bg-zinc-50 dark:text-zinc-200 dark:hover:bg-zinc-800",
|
|
472
|
+
children: [
|
|
473
|
+
s,
|
|
474
|
+
" ",
|
|
475
|
+
/* @__PURE__ */ jsx3(Check, { size: 14, className: "text-zinc-400" })
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
s
|
|
479
|
+
)) })
|
|
480
|
+
] });
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
// components/ui/avatar.tsx
|
|
484
|
+
import * as React4 from "react";
|
|
485
|
+
import { cva } from "class-variance-authority";
|
|
486
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
487
|
+
var AVATAR_GRADIENTS = [
|
|
488
|
+
"from-violet-500 to-indigo-600",
|
|
489
|
+
"from-sky-500 to-blue-600",
|
|
490
|
+
"from-emerald-500 to-teal-600",
|
|
491
|
+
"from-amber-500 to-orange-500",
|
|
492
|
+
"from-rose-500 to-pink-600",
|
|
493
|
+
"from-fuchsia-500 to-purple-600",
|
|
494
|
+
"from-cyan-500 to-blue-500",
|
|
495
|
+
"from-lime-500 to-emerald-600"
|
|
496
|
+
];
|
|
497
|
+
var avatarVariants = cva(
|
|
498
|
+
[
|
|
499
|
+
"relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full",
|
|
500
|
+
"ring-1 ring-zinc-900/5 shadow-sm shadow-zinc-900/10",
|
|
501
|
+
"dark:ring-white/10 dark:shadow-black/30"
|
|
502
|
+
],
|
|
503
|
+
{
|
|
504
|
+
variants: {
|
|
505
|
+
size: {
|
|
506
|
+
sm: "h-8 w-8 text-[10px]",
|
|
507
|
+
md: "h-10 w-10 text-xs",
|
|
508
|
+
lg: "h-12 w-12 text-sm",
|
|
509
|
+
xl: "h-16 w-16 text-base"
|
|
510
|
+
},
|
|
511
|
+
variant: {
|
|
512
|
+
default: "",
|
|
513
|
+
outline: "ring-2 ring-white dark:ring-zinc-950"
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
defaultVariants: {
|
|
517
|
+
size: "md",
|
|
518
|
+
variant: "default"
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
var statusVariants = cva(
|
|
523
|
+
[
|
|
524
|
+
"absolute rounded-full ring-2 ring-white dark:ring-zinc-950",
|
|
525
|
+
"shadow-sm"
|
|
526
|
+
],
|
|
527
|
+
{
|
|
528
|
+
variants: {
|
|
529
|
+
status: {
|
|
530
|
+
online: "bg-emerald-500",
|
|
531
|
+
offline: "bg-zinc-400 dark:bg-zinc-500",
|
|
532
|
+
busy: "bg-amber-500"
|
|
533
|
+
},
|
|
534
|
+
size: {
|
|
535
|
+
sm: "bottom-0 right-0 h-2 w-2",
|
|
536
|
+
md: "bottom-0 right-0 h-2.5 w-2.5",
|
|
537
|
+
lg: "bottom-0.5 right-0.5 h-2.5 w-2.5",
|
|
538
|
+
xl: "bottom-1 right-1 h-3 w-3"
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
function getInitials(name) {
|
|
544
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
545
|
+
if (parts.length === 0) return "?";
|
|
546
|
+
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
|
547
|
+
return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
|
|
548
|
+
}
|
|
549
|
+
function getGradientFromName(name) {
|
|
550
|
+
let hash = 0;
|
|
551
|
+
for (let i = 0; i < name.length; i += 1) {
|
|
552
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
553
|
+
}
|
|
554
|
+
return AVATAR_GRADIENTS[Math.abs(hash) % AVATAR_GRADIENTS.length];
|
|
555
|
+
}
|
|
556
|
+
var Avatar = React4.forwardRef(
|
|
557
|
+
(_a, ref) => {
|
|
558
|
+
var _b = _a, { className, size, variant, src, alt, name, status, children } = _b, props = __objRest(_b, ["className", "size", "variant", "src", "alt", "name", "status", "children"]);
|
|
559
|
+
var _a2;
|
|
560
|
+
const [imageError, setImageError] = React4.useState(false);
|
|
561
|
+
const showImage = src && !imageError;
|
|
562
|
+
const fallbackText = name ? getInitials(name) : children;
|
|
563
|
+
const gradient = name ? getGradientFromName(name) : "from-zinc-400 to-zinc-500";
|
|
564
|
+
return /* @__PURE__ */ jsxs4(
|
|
565
|
+
"span",
|
|
566
|
+
__spreadProps(__spreadValues({
|
|
567
|
+
ref,
|
|
568
|
+
className: cn(avatarVariants({ size, variant }), className)
|
|
569
|
+
}, props), {
|
|
570
|
+
children: [
|
|
571
|
+
showImage ? (
|
|
572
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
573
|
+
/* @__PURE__ */ jsx4(
|
|
574
|
+
"img",
|
|
575
|
+
{
|
|
576
|
+
src,
|
|
577
|
+
alt: (_a2 = alt != null ? alt : name) != null ? _a2 : "Avatar",
|
|
578
|
+
className: "h-full w-full object-cover",
|
|
579
|
+
onError: () => setImageError(true)
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
) : /* @__PURE__ */ jsx4(
|
|
583
|
+
"span",
|
|
584
|
+
{
|
|
585
|
+
className: cn(
|
|
586
|
+
"flex h-full w-full items-center justify-center bg-gradient-to-br font-semibold uppercase tracking-tight text-white",
|
|
587
|
+
gradient
|
|
588
|
+
),
|
|
589
|
+
children: fallbackText != null ? fallbackText : "?"
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
status && /* @__PURE__ */ jsx4(
|
|
593
|
+
"span",
|
|
594
|
+
{
|
|
595
|
+
className: cn(statusVariants({ status, size })),
|
|
596
|
+
"aria-hidden": true
|
|
597
|
+
}
|
|
598
|
+
)
|
|
599
|
+
]
|
|
600
|
+
})
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
Avatar.displayName = "Avatar";
|
|
605
|
+
function AvatarGroup(_a) {
|
|
606
|
+
var _b = _a, {
|
|
607
|
+
className,
|
|
608
|
+
max = 5,
|
|
609
|
+
size = "md",
|
|
610
|
+
children
|
|
611
|
+
} = _b, props = __objRest(_b, [
|
|
612
|
+
"className",
|
|
613
|
+
"max",
|
|
614
|
+
"size",
|
|
615
|
+
"children"
|
|
616
|
+
]);
|
|
617
|
+
const avatars = React4.Children.toArray(children).filter(React4.isValidElement);
|
|
618
|
+
const visible = avatars.slice(0, max);
|
|
619
|
+
const remaining = avatars.length - visible.length;
|
|
620
|
+
return /* @__PURE__ */ jsxs4("div", __spreadProps(__spreadValues({ className: cn("flex items-center", className) }, props), { children: [
|
|
621
|
+
visible.map((child, index) => /* @__PURE__ */ jsx4(
|
|
622
|
+
"div",
|
|
623
|
+
{
|
|
624
|
+
className: cn(
|
|
625
|
+
"relative transition-transform duration-200 hover:z-10 hover:scale-110",
|
|
626
|
+
index > 0 && "-ml-3"
|
|
627
|
+
),
|
|
628
|
+
children: child
|
|
629
|
+
},
|
|
630
|
+
index
|
|
631
|
+
)),
|
|
632
|
+
remaining > 0 && /* @__PURE__ */ jsx4(
|
|
633
|
+
"span",
|
|
634
|
+
{
|
|
635
|
+
className: cn(
|
|
636
|
+
"-ml-3",
|
|
637
|
+
avatarVariants({ variant: "outline", size }),
|
|
638
|
+
"bg-zinc-100 text-zinc-600 ring-2 ring-white dark:bg-zinc-800 dark:text-zinc-200 dark:ring-zinc-950"
|
|
639
|
+
),
|
|
640
|
+
children: /* @__PURE__ */ jsxs4("span", { className: "flex h-full w-full items-center justify-center text-[10px] font-semibold", children: [
|
|
641
|
+
"+",
|
|
642
|
+
remaining
|
|
643
|
+
] })
|
|
644
|
+
}
|
|
645
|
+
)
|
|
646
|
+
] }));
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// components/ui/badge.tsx
|
|
650
|
+
import * as React5 from "react";
|
|
651
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
652
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
653
|
+
var badgeVariants = cva2(
|
|
654
|
+
"inline-flex items-center gap-1 rounded-md font-medium transition-colors",
|
|
655
|
+
{
|
|
656
|
+
variants: {
|
|
657
|
+
variant: {
|
|
658
|
+
default: "bg-zinc-100 text-zinc-700 dark:bg-zinc-800 dark:text-zinc-200",
|
|
659
|
+
info: "bg-[#0070BA]/10 text-[#0070BA] dark:bg-[#0070BA]/20 dark:text-[#4DA3E0]",
|
|
660
|
+
success: "bg-[#28A745]/10 text-[#28A745] dark:bg-[#28A745]/20 dark:text-[#5CC975]",
|
|
661
|
+
warning: "bg-[#E58E00]/10 text-[#E58E00] dark:bg-[#E58E00]/20 dark:text-[#F5B84A]",
|
|
662
|
+
error: "bg-[#D93025]/10 text-[#D93025] dark:bg-[#D93025]/20 dark:text-[#F06B62]",
|
|
663
|
+
outline: "border border-zinc-200 bg-transparent text-zinc-700 dark:border-zinc-700 dark:text-zinc-300"
|
|
664
|
+
},
|
|
665
|
+
size: {
|
|
666
|
+
sm: "px-1.5 py-0.5 text-[10px]",
|
|
667
|
+
md: "px-2 py-0.5 text-[11px]",
|
|
668
|
+
lg: "px-2.5 py-1 text-xs"
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
defaultVariants: {
|
|
672
|
+
variant: "default",
|
|
673
|
+
size: "md"
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
var Badge = React5.forwardRef(
|
|
678
|
+
(_a, ref) => {
|
|
679
|
+
var _b = _a, { className, variant, size } = _b, props = __objRest(_b, ["className", "variant", "size"]);
|
|
680
|
+
return /* @__PURE__ */ jsx5(
|
|
681
|
+
"span",
|
|
682
|
+
__spreadValues({
|
|
683
|
+
ref,
|
|
684
|
+
className: cn(badgeVariants({ variant, size }), className)
|
|
685
|
+
}, props)
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
);
|
|
689
|
+
Badge.displayName = "Badge";
|
|
690
|
+
|
|
691
|
+
// components/ui/button.tsx
|
|
692
|
+
import * as React6 from "react";
|
|
693
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
694
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
695
|
+
var buttonVariants = cva3(
|
|
696
|
+
[
|
|
697
|
+
"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-xl",
|
|
698
|
+
"text-sm font-medium tracking-tight",
|
|
699
|
+
"transition-[color,background-color,border-color,box-shadow,transform] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
700
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-900/15 focus-visible:ring-offset-2 focus-visible:ring-offset-white",
|
|
701
|
+
"active:scale-[0.97] active:transition-[transform] active:duration-100",
|
|
702
|
+
"disabled:pointer-events-none disabled:opacity-40 disabled:shadow-none disabled:active:scale-100",
|
|
703
|
+
"dark:focus-visible:ring-white/20 dark:focus-visible:ring-offset-zinc-950",
|
|
704
|
+
"select-none"
|
|
705
|
+
],
|
|
706
|
+
{
|
|
707
|
+
variants: {
|
|
708
|
+
variant: {
|
|
709
|
+
primary: [
|
|
710
|
+
"bg-zinc-900 text-white",
|
|
711
|
+
"shadow-[0_1px_2px_rgba(0,0,0,0.06),0_4px_12px_rgba(0,0,0,0.08)]",
|
|
712
|
+
"hover:bg-zinc-800 hover:-translate-y-0.5",
|
|
713
|
+
"hover:shadow-[0_2px_4px_rgba(0,0,0,0.06),0_8px_20px_rgba(0,0,0,0.12)]",
|
|
714
|
+
"dark:bg-zinc-100 dark:text-zinc-900",
|
|
715
|
+
"dark:shadow-[0_1px_2px_rgba(255,255,255,0.06),0_4px_16px_rgba(0,0,0,0.35)]",
|
|
716
|
+
"dark:hover:bg-white dark:hover:shadow-[0_2px_8px_rgba(0,0,0,0.25),0_8px_24px_rgba(0,0,0,0.2)]"
|
|
717
|
+
],
|
|
718
|
+
white: [
|
|
719
|
+
"border border-zinc-200/80 bg-white text-zinc-900",
|
|
720
|
+
"shadow-[0_1px_2px_rgba(0,0,0,0.04),0_4px_12px_rgba(0,0,0,0.06)]",
|
|
721
|
+
"hover:border-zinc-300 hover:bg-zinc-50 hover:-translate-y-0.5",
|
|
722
|
+
"hover:shadow-[0_2px_4px_rgba(0,0,0,0.04),0_8px_20px_rgba(0,0,0,0.1)]"
|
|
723
|
+
],
|
|
724
|
+
outline: [
|
|
725
|
+
"border border-zinc-200 bg-white/70 text-zinc-700 backdrop-blur-sm",
|
|
726
|
+
"shadow-[0_1px_2px_rgba(0,0,0,0.03)]",
|
|
727
|
+
"hover:border-zinc-300 hover:bg-white hover:text-zinc-900 hover:-translate-y-0.5",
|
|
728
|
+
"hover:shadow-[0_2px_8px_rgba(0,0,0,0.06)]",
|
|
729
|
+
"dark:border-zinc-700 dark:bg-zinc-900/40 dark:text-zinc-200 dark:shadow-none",
|
|
730
|
+
"dark:hover:border-zinc-500 dark:hover:bg-zinc-800/80 dark:hover:text-white"
|
|
731
|
+
],
|
|
732
|
+
ghost: [
|
|
733
|
+
"text-zinc-600",
|
|
734
|
+
"hover:bg-zinc-100/90 hover:text-zinc-900",
|
|
735
|
+
"dark:text-zinc-400 dark:hover:bg-zinc-800/70 dark:hover:text-zinc-100"
|
|
736
|
+
]
|
|
737
|
+
},
|
|
738
|
+
size: {
|
|
739
|
+
sm: "h-8 gap-1.5 rounded-lg px-3.5 text-xs",
|
|
740
|
+
md: "h-10 px-4",
|
|
741
|
+
lg: "h-11 px-5 text-[15px]"
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
defaultVariants: { variant: "primary", size: "md" }
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
var Button = React6.forwardRef(
|
|
748
|
+
(_a, ref) => {
|
|
749
|
+
var _b = _a, { className, variant, size } = _b, props = __objRest(_b, ["className", "variant", "size"]);
|
|
750
|
+
return /* @__PURE__ */ jsx6(
|
|
751
|
+
"button",
|
|
752
|
+
__spreadValues({
|
|
753
|
+
ref,
|
|
754
|
+
className: cn(buttonVariants({ variant, size }), className)
|
|
755
|
+
}, props)
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
);
|
|
759
|
+
Button.displayName = "Button";
|
|
760
|
+
|
|
761
|
+
// components/ui/card.tsx
|
|
762
|
+
import * as React7 from "react";
|
|
763
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
764
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
765
|
+
var cardVariants = cva4(
|
|
766
|
+
"rounded-2xl border bg-white text-zinc-900 transition-all duration-200 dark:bg-zinc-900 dark:text-zinc-100",
|
|
767
|
+
{
|
|
768
|
+
variants: {
|
|
769
|
+
variant: {
|
|
770
|
+
default: "border-zinc-200/70 shadow-[0_2px_8px_rgba(0,0,0,0.06)] dark:border-zinc-800/80 dark:shadow-[0_2px_8px_rgba(0,0,0,0.25)]",
|
|
771
|
+
outline: "border-zinc-200 shadow-none dark:border-zinc-800",
|
|
772
|
+
elevated: "border-zinc-200 shadow-[0_8px_30px_rgba(0,0,0,0.08)] dark:border-zinc-800 dark:shadow-[0_8px_30px_rgba(0,0,0,0.35)]",
|
|
773
|
+
interactive: "cursor-pointer border-zinc-200/70 shadow-[0_2px_8px_rgba(0,0,0,0.06)] hover:-translate-y-0.5 hover:border-zinc-300 hover:shadow-[0_8px_24px_rgba(0,0,0,0.1)] dark:border-zinc-800/80 dark:shadow-[0_2px_8px_rgba(0,0,0,0.25)] dark:hover:border-zinc-700 dark:hover:shadow-[0_8px_24px_rgba(0,0,0,0.4)]"
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
defaultVariants: { variant: "default" }
|
|
777
|
+
}
|
|
778
|
+
);
|
|
779
|
+
var Card = React7.forwardRef(
|
|
780
|
+
(_a, ref) => {
|
|
781
|
+
var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
|
|
782
|
+
return /* @__PURE__ */ jsx7(
|
|
783
|
+
"div",
|
|
784
|
+
__spreadValues({
|
|
785
|
+
ref,
|
|
786
|
+
className: cn(cardVariants({ variant }), className)
|
|
787
|
+
}, props)
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
);
|
|
791
|
+
Card.displayName = "Card";
|
|
792
|
+
var CardHeader = React7.forwardRef((_a, ref) => {
|
|
793
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
794
|
+
return /* @__PURE__ */ jsx7(
|
|
795
|
+
"div",
|
|
796
|
+
__spreadValues({
|
|
797
|
+
ref,
|
|
798
|
+
className: cn("flex flex-col gap-1.5 p-6", className)
|
|
799
|
+
}, props)
|
|
800
|
+
);
|
|
801
|
+
});
|
|
802
|
+
CardHeader.displayName = "CardHeader";
|
|
803
|
+
var CardTitle = React7.forwardRef((_a, ref) => {
|
|
804
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
805
|
+
return /* @__PURE__ */ jsx7(
|
|
806
|
+
"h3",
|
|
807
|
+
__spreadValues({
|
|
808
|
+
ref,
|
|
809
|
+
className: cn("text-base font-semibold leading-none tracking-tight text-zinc-900 dark:text-white", className)
|
|
810
|
+
}, props)
|
|
811
|
+
);
|
|
812
|
+
});
|
|
813
|
+
CardTitle.displayName = "CardTitle";
|
|
814
|
+
var CardDescription = React7.forwardRef((_a, ref) => {
|
|
815
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
816
|
+
return /* @__PURE__ */ jsx7(
|
|
817
|
+
"p",
|
|
818
|
+
__spreadValues({
|
|
819
|
+
ref,
|
|
820
|
+
className: cn("text-sm leading-relaxed text-zinc-500 dark:text-zinc-400", className)
|
|
821
|
+
}, props)
|
|
822
|
+
);
|
|
823
|
+
});
|
|
824
|
+
CardDescription.displayName = "CardDescription";
|
|
825
|
+
var CardContent = React7.forwardRef((_a, ref) => {
|
|
826
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
827
|
+
return /* @__PURE__ */ jsx7("div", __spreadValues({ ref, className: cn("px-6 pb-6 pt-0", className) }, props));
|
|
828
|
+
});
|
|
829
|
+
CardContent.displayName = "CardContent";
|
|
830
|
+
var CardFooter = React7.forwardRef((_a, ref) => {
|
|
831
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
832
|
+
return /* @__PURE__ */ jsx7(
|
|
833
|
+
"div",
|
|
834
|
+
__spreadValues({
|
|
835
|
+
ref,
|
|
836
|
+
className: cn(
|
|
837
|
+
"flex items-center gap-2 border-t border-zinc-100 bg-zinc-50/60 px-6 py-4 dark:border-zinc-800 dark:bg-zinc-800/30",
|
|
838
|
+
className
|
|
839
|
+
)
|
|
840
|
+
}, props)
|
|
841
|
+
);
|
|
842
|
+
});
|
|
843
|
+
CardFooter.displayName = "CardFooter";
|
|
844
|
+
|
|
845
|
+
// components/ui/checkbox.tsx
|
|
846
|
+
import * as React8 from "react";
|
|
847
|
+
import { Check as Check2 } from "lucide-react";
|
|
848
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
849
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
850
|
+
var checkboxControlVariants = cva5(
|
|
851
|
+
[
|
|
852
|
+
"pointer-events-none relative flex shrink-0 items-center justify-center rounded-[3px] border-2 bg-white transition-all duration-200",
|
|
853
|
+
"border-zinc-500 group-hover:border-zinc-700",
|
|
854
|
+
"peer-checked:border-zinc-900 peer-checked:bg-zinc-900",
|
|
855
|
+
"peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-zinc-900/30 peer-focus-visible:ring-offset-2",
|
|
856
|
+
"peer-disabled:border-zinc-300 peer-disabled:bg-zinc-100",
|
|
857
|
+
"peer-disabled:peer-checked:border-zinc-300 peer-disabled:peer-checked:bg-zinc-300",
|
|
858
|
+
"dark:border-zinc-500 dark:bg-zinc-900 dark:group-hover:border-zinc-400",
|
|
859
|
+
"dark:peer-checked:border-zinc-100 dark:peer-checked:bg-zinc-100",
|
|
860
|
+
"dark:peer-disabled:border-zinc-700 dark:peer-disabled:bg-zinc-800",
|
|
861
|
+
"dark:peer-disabled:peer-checked:border-zinc-600 dark:peer-disabled:peer-checked:bg-zinc-600",
|
|
862
|
+
"peer-checked:[&_svg]:scale-100 peer-checked:[&_svg]:opacity-100"
|
|
863
|
+
],
|
|
864
|
+
{
|
|
865
|
+
variants: {
|
|
866
|
+
size: {
|
|
867
|
+
sm: "h-4 w-4 [&_svg]:h-2.5 [&_svg]:w-2.5",
|
|
868
|
+
md: "h-[18px] w-[18px] [&_svg]:h-3 [&_svg]:w-3",
|
|
869
|
+
lg: "h-5 w-5 [&_svg]:h-3.5 [&_svg]:w-3.5"
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
defaultVariants: { size: "md" }
|
|
873
|
+
}
|
|
874
|
+
);
|
|
875
|
+
var checkboxWrapperVariants = cva5("group flex w-full transition-colors duration-150", {
|
|
876
|
+
variants: {
|
|
877
|
+
variant: {
|
|
878
|
+
inline: "gap-3",
|
|
879
|
+
card: [
|
|
880
|
+
"gap-3 rounded-lg border border-zinc-200 bg-white px-3.5 py-3",
|
|
881
|
+
"hover:border-zinc-300 hover:bg-zinc-50/80",
|
|
882
|
+
"has-[:checked]:border-zinc-900",
|
|
883
|
+
"dark:border-zinc-800 dark:bg-zinc-900 dark:hover:border-zinc-700 dark:hover:bg-zinc-900/50",
|
|
884
|
+
"dark:has-[:checked]:border-zinc-500"
|
|
885
|
+
]
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
defaultVariants: { variant: "inline" }
|
|
889
|
+
});
|
|
890
|
+
var Checkbox = React8.forwardRef(
|
|
891
|
+
(_a, ref) => {
|
|
892
|
+
var _b = _a, {
|
|
893
|
+
className,
|
|
894
|
+
size,
|
|
895
|
+
variant = "inline",
|
|
896
|
+
label,
|
|
897
|
+
description,
|
|
898
|
+
disabled,
|
|
899
|
+
id
|
|
900
|
+
} = _b, props = __objRest(_b, [
|
|
901
|
+
"className",
|
|
902
|
+
"size",
|
|
903
|
+
"variant",
|
|
904
|
+
"label",
|
|
905
|
+
"description",
|
|
906
|
+
"disabled",
|
|
907
|
+
"id"
|
|
908
|
+
]);
|
|
909
|
+
const generatedId = React8.useId();
|
|
910
|
+
const inputId = id != null ? id : generatedId;
|
|
911
|
+
const resolvedVariant = variant === "card" || description ? "card" : "inline";
|
|
912
|
+
const alignStart = resolvedVariant === "card" || Boolean(description);
|
|
913
|
+
return /* @__PURE__ */ jsxs5(
|
|
914
|
+
"label",
|
|
915
|
+
{
|
|
916
|
+
htmlFor: inputId,
|
|
917
|
+
className: cn(
|
|
918
|
+
checkboxWrapperVariants({ variant: resolvedVariant }),
|
|
919
|
+
alignStart ? "items-start" : "items-center",
|
|
920
|
+
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
921
|
+
className
|
|
922
|
+
),
|
|
923
|
+
children: [
|
|
924
|
+
/* @__PURE__ */ jsxs5(
|
|
925
|
+
"span",
|
|
926
|
+
{
|
|
927
|
+
className: cn(
|
|
928
|
+
"relative flex shrink-0 items-center justify-center p-2.5 -m-2.5",
|
|
929
|
+
alignStart ? "mt-0.5" : void 0
|
|
930
|
+
),
|
|
931
|
+
children: [
|
|
932
|
+
/* @__PURE__ */ jsx8(
|
|
933
|
+
"input",
|
|
934
|
+
__spreadValues({
|
|
935
|
+
ref,
|
|
936
|
+
id: inputId,
|
|
937
|
+
type: "checkbox",
|
|
938
|
+
disabled,
|
|
939
|
+
className: "peer absolute inset-0 z-10 cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
940
|
+
}, props)
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ jsx8(
|
|
943
|
+
"span",
|
|
944
|
+
{
|
|
945
|
+
"aria-hidden": true,
|
|
946
|
+
className: "pointer-events-none absolute inset-0 rounded-full bg-zinc-900/0 transition-colors duration-200 group-hover:bg-zinc-900/[0.08] group-active:bg-zinc-900/[0.12] peer-disabled:group-hover:bg-transparent dark:group-hover:bg-white/[0.08] dark:group-active:bg-white/[0.12]"
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ jsx8("span", { className: checkboxControlVariants({ size }), children: /* @__PURE__ */ jsx8(
|
|
950
|
+
Check2,
|
|
951
|
+
{
|
|
952
|
+
className: "text-white opacity-0 transition-all duration-200 dark:text-zinc-900",
|
|
953
|
+
strokeWidth: 3
|
|
954
|
+
}
|
|
955
|
+
) })
|
|
956
|
+
]
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
(label || description) && /* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
960
|
+
label && /* @__PURE__ */ jsx8("span", { className: "text-sm leading-snug text-zinc-800 dark:text-zinc-100", children: label }),
|
|
961
|
+
description && /* @__PURE__ */ jsx8("span", { className: "text-xs leading-relaxed text-zinc-500 dark:text-zinc-400", children: description })
|
|
962
|
+
] })
|
|
963
|
+
]
|
|
964
|
+
}
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
);
|
|
968
|
+
Checkbox.displayName = "Checkbox";
|
|
969
|
+
|
|
970
|
+
// components/ui/code-block.tsx
|
|
971
|
+
import { useState as useState4 } from "react";
|
|
972
|
+
import { Check as Check3, Copy } from "lucide-react";
|
|
973
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
974
|
+
function CodeBlock({
|
|
975
|
+
code,
|
|
976
|
+
filename,
|
|
977
|
+
className
|
|
978
|
+
}) {
|
|
979
|
+
const [copied, setCopied] = useState4(false);
|
|
980
|
+
const onCopy = async () => {
|
|
981
|
+
await navigator.clipboard.writeText(code);
|
|
982
|
+
setCopied(true);
|
|
983
|
+
setTimeout(() => setCopied(false), 1500);
|
|
984
|
+
};
|
|
985
|
+
const copyButton = /* @__PURE__ */ jsx9(
|
|
986
|
+
"button",
|
|
987
|
+
{
|
|
988
|
+
type: "button",
|
|
989
|
+
onClick: onCopy,
|
|
990
|
+
"aria-label": "Copy code",
|
|
991
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-white/10 hover:text-zinc-200",
|
|
992
|
+
children: copied ? /* @__PURE__ */ jsx9(Check3, { className: "h-3.5 w-3.5 text-white" }) : /* @__PURE__ */ jsx9(Copy, { className: "h-3.5 w-3.5" })
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
return /* @__PURE__ */ jsxs6(
|
|
996
|
+
"div",
|
|
997
|
+
{
|
|
998
|
+
className: cn(
|
|
999
|
+
"group relative overflow-x-auto rounded-xl bg-zinc-900 ring-1 ring-white/10",
|
|
1000
|
+
className
|
|
1001
|
+
),
|
|
1002
|
+
children: [
|
|
1003
|
+
filename ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between border-b border-white/10 px-4 py-2.5", children: [
|
|
1004
|
+
/* @__PURE__ */ jsx9("span", { className: "font-mono text-xs text-zinc-500", children: filename }),
|
|
1005
|
+
copyButton
|
|
1006
|
+
] }) : null,
|
|
1007
|
+
/* @__PURE__ */ jsx9("pre", { className: cn("max-w-full overflow-x-auto px-4 py-3.5 text-[13px] leading-relaxed text-zinc-100", !filename && "pr-12"), children: /* @__PURE__ */ jsx9("code", { className: "font-mono", children: code }) }),
|
|
1008
|
+
filename ? null : /* @__PURE__ */ jsx9("div", { className: "absolute right-3 top-3", children: copyButton })
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// components/ui/data-table.tsx
|
|
1015
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
1016
|
+
import { ArrowDown, ArrowUp, ArrowUpDown as ArrowUpDown2, Filter as Filter2, Search as Search3, X as X3 } from "lucide-react";
|
|
1017
|
+
|
|
1018
|
+
// components/ui/input.tsx
|
|
1019
|
+
import * as React9 from "react";
|
|
1020
|
+
import { cva as cva6 } from "class-variance-authority";
|
|
1021
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1022
|
+
var inputVariants = cva6(
|
|
1023
|
+
"flex w-full rounded-xl border bg-white px-3.5 text-sm text-zinc-900 outline-none transition-all duration-150 placeholder:text-zinc-400 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-zinc-900 dark:text-zinc-100 dark:placeholder:text-zinc-500",
|
|
1024
|
+
{
|
|
1025
|
+
variants: {
|
|
1026
|
+
size: {
|
|
1027
|
+
sm: "h-8 text-xs",
|
|
1028
|
+
md: "h-10 text-sm",
|
|
1029
|
+
lg: "h-11 text-base"
|
|
1030
|
+
},
|
|
1031
|
+
state: {
|
|
1032
|
+
default: "border-zinc-200 hover:border-zinc-300 focus:border-zinc-900 focus:ring-2 focus:ring-zinc-900/10 dark:border-zinc-800 dark:hover:border-zinc-700 dark:focus:border-zinc-400 dark:focus:ring-zinc-400/15",
|
|
1033
|
+
error: "border-red-400 focus:border-red-500 focus:ring-2 focus:ring-red-500/15 dark:border-red-500/60 dark:focus:border-red-400"
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
defaultVariants: {
|
|
1037
|
+
size: "md",
|
|
1038
|
+
state: "default"
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
var Input = React9.forwardRef(
|
|
1043
|
+
(_a, ref) => {
|
|
1044
|
+
var _b = _a, { className, size, state, type = "text" } = _b, props = __objRest(_b, ["className", "size", "state", "type"]);
|
|
1045
|
+
return /* @__PURE__ */ jsx10(
|
|
1046
|
+
"input",
|
|
1047
|
+
__spreadValues({
|
|
1048
|
+
ref,
|
|
1049
|
+
type,
|
|
1050
|
+
className: cn(inputVariants({ size, state }), className)
|
|
1051
|
+
}, props)
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
Input.displayName = "Input";
|
|
1056
|
+
|
|
1057
|
+
// components/ui/pagination.tsx
|
|
1058
|
+
import * as React10 from "react";
|
|
1059
|
+
import { ChevronLeft, ChevronRight as ChevronRight2, MoreHorizontal } from "lucide-react";
|
|
1060
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1061
|
+
function getPageList(current, total, siblingCount) {
|
|
1062
|
+
const totalSlots = siblingCount * 2 + 5;
|
|
1063
|
+
if (total <= totalSlots) return Array.from({ length: total }, (_, i) => i + 1);
|
|
1064
|
+
const left = Math.max(current - siblingCount, 1);
|
|
1065
|
+
const right = Math.min(current + siblingCount, total);
|
|
1066
|
+
const pages = [1];
|
|
1067
|
+
if (left > 2) pages.push("...");
|
|
1068
|
+
for (let p = Math.max(left, 2); p <= Math.min(right, total - 1); p++) pages.push(p);
|
|
1069
|
+
if (right < total - 1) pages.push("...");
|
|
1070
|
+
if (total > 1) pages.push(total);
|
|
1071
|
+
return pages;
|
|
1072
|
+
}
|
|
1073
|
+
var navTransition = "transition-[color,background-color,border-color,box-shadow,transform,opacity,width] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]";
|
|
1074
|
+
var popIn = "animate-[pagination-pop_220ms_cubic-bezier(0.16,1,0.3,1)]";
|
|
1075
|
+
var focusRing = "focus-visible:ring-offset-white dark:focus-visible:ring-offset-zinc-900";
|
|
1076
|
+
var WIDTH_CLASSES = {
|
|
1077
|
+
small: "w-max max-w-full",
|
|
1078
|
+
half: "w-full min-w-0 sm:w-1/2 sm:min-w-max sm:max-w-full",
|
|
1079
|
+
full: "w-full min-w-0"
|
|
1080
|
+
};
|
|
1081
|
+
var BUTTON_SIZE = 32;
|
|
1082
|
+
var GAP = 4;
|
|
1083
|
+
function Pagination({
|
|
1084
|
+
page,
|
|
1085
|
+
totalPages,
|
|
1086
|
+
onPageChange,
|
|
1087
|
+
siblingCount = 1,
|
|
1088
|
+
variant = "default",
|
|
1089
|
+
size = "small",
|
|
1090
|
+
className
|
|
1091
|
+
}) {
|
|
1092
|
+
const clampedTotal = Math.max(1, totalPages);
|
|
1093
|
+
const current = Math.min(Math.max(page, 1), clampedTotal);
|
|
1094
|
+
const goTo = (p) => onPageChange(Math.min(Math.max(p, 1), clampedTotal));
|
|
1095
|
+
const pages = React10.useMemo(
|
|
1096
|
+
() => getPageList(current, clampedTotal, siblingCount),
|
|
1097
|
+
[current, clampedTotal, siblingCount]
|
|
1098
|
+
);
|
|
1099
|
+
const maxSlots = Math.min(clampedTotal, siblingCount * 2 + 5);
|
|
1100
|
+
const trackMinWidth = maxSlots * BUTTON_SIZE + (maxSlots - 1) * GAP;
|
|
1101
|
+
const trackRef = React10.useRef(null);
|
|
1102
|
+
const prevRectsRef = React10.useRef(/* @__PURE__ */ new Map());
|
|
1103
|
+
React10.useLayoutEffect(() => {
|
|
1104
|
+
const track = trackRef.current;
|
|
1105
|
+
if (!track) return;
|
|
1106
|
+
const prevRects = prevRectsRef.current;
|
|
1107
|
+
const nextRects = /* @__PURE__ */ new Map();
|
|
1108
|
+
track.querySelectorAll("[data-flip-key]").forEach((el) => {
|
|
1109
|
+
const key = el.dataset.flipKey;
|
|
1110
|
+
const rect = el.getBoundingClientRect();
|
|
1111
|
+
nextRects.set(key, rect);
|
|
1112
|
+
const prev = prevRects.get(key);
|
|
1113
|
+
if (!prev) return;
|
|
1114
|
+
const dx = prev.left - rect.left;
|
|
1115
|
+
if (Math.abs(dx) < 0.5) return;
|
|
1116
|
+
el.style.transition = "none";
|
|
1117
|
+
el.style.transform = `translateX(${dx}px)`;
|
|
1118
|
+
el.getBoundingClientRect();
|
|
1119
|
+
requestAnimationFrame(() => {
|
|
1120
|
+
el.style.transition = "transform 220ms cubic-bezier(0.16,1,0.3,1)";
|
|
1121
|
+
el.style.transform = "";
|
|
1122
|
+
});
|
|
1123
|
+
});
|
|
1124
|
+
prevRectsRef.current = nextRects;
|
|
1125
|
+
}, [pages]);
|
|
1126
|
+
if (variant === "simple") {
|
|
1127
|
+
return /* @__PURE__ */ jsxs7(
|
|
1128
|
+
"nav",
|
|
1129
|
+
{
|
|
1130
|
+
"aria-label": "Pagination",
|
|
1131
|
+
className: cn(
|
|
1132
|
+
"flex items-center justify-between gap-2 overflow-x-auto rounded-full border border-zinc-200/70 bg-white p-1.5 shadow-[0_2px_8px_rgba(0,0,0,0.06)] transition-[width] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] dark:border-zinc-800/80 dark:bg-zinc-900 dark:shadow-[0_2px_8px_rgba(0,0,0,0.25)]",
|
|
1133
|
+
WIDTH_CLASSES[size],
|
|
1134
|
+
className
|
|
1135
|
+
),
|
|
1136
|
+
children: [
|
|
1137
|
+
/* @__PURE__ */ jsxs7(Button, { variant: "ghost", size: "sm", className: cn("rounded-full", navTransition, focusRing), disabled: current <= 1, onClick: () => goTo(current - 1), children: [
|
|
1138
|
+
/* @__PURE__ */ jsx11(ChevronLeft, { size: 15 }),
|
|
1139
|
+
"Previous"
|
|
1140
|
+
] }),
|
|
1141
|
+
/* @__PURE__ */ jsxs7("p", { className: "min-w-[6.5rem] text-center text-xs tabular-nums text-zinc-500 dark:text-zinc-400", children: [
|
|
1142
|
+
"Page ",
|
|
1143
|
+
current,
|
|
1144
|
+
" of ",
|
|
1145
|
+
clampedTotal
|
|
1146
|
+
] }),
|
|
1147
|
+
/* @__PURE__ */ jsxs7(Button, { variant: "ghost", size: "sm", className: cn("rounded-full", navTransition, focusRing), disabled: current >= clampedTotal, onClick: () => goTo(current + 1), children: [
|
|
1148
|
+
"Next",
|
|
1149
|
+
/* @__PURE__ */ jsx11(ChevronRight2, { size: 15 })
|
|
1150
|
+
] })
|
|
1151
|
+
]
|
|
1152
|
+
}
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
return /* @__PURE__ */ jsxs7(
|
|
1156
|
+
"nav",
|
|
1157
|
+
{
|
|
1158
|
+
"aria-label": "Pagination",
|
|
1159
|
+
className: cn(
|
|
1160
|
+
"flex items-center gap-1 overflow-x-auto rounded-full border border-zinc-200/70 bg-white p-1 shadow-[0_2px_8px_rgba(0,0,0,0.06)] transition-[width] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] dark:border-zinc-800/80 dark:bg-zinc-900 dark:shadow-[0_2px_8px_rgba(0,0,0,0.25)]",
|
|
1161
|
+
WIDTH_CLASSES[size],
|
|
1162
|
+
className
|
|
1163
|
+
),
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ jsx11(
|
|
1166
|
+
Button,
|
|
1167
|
+
{
|
|
1168
|
+
variant: "ghost",
|
|
1169
|
+
size: "sm",
|
|
1170
|
+
className: cn("h-8 w-8 shrink-0 rounded-full p-0", navTransition, focusRing),
|
|
1171
|
+
disabled: current <= 1,
|
|
1172
|
+
onClick: () => goTo(current - 1),
|
|
1173
|
+
"aria-label": "Previous page",
|
|
1174
|
+
children: /* @__PURE__ */ jsx11(ChevronLeft, { size: 15 })
|
|
1175
|
+
}
|
|
1176
|
+
),
|
|
1177
|
+
/* @__PURE__ */ jsx11(
|
|
1178
|
+
"div",
|
|
1179
|
+
{
|
|
1180
|
+
ref: trackRef,
|
|
1181
|
+
className: "flex min-w-0 flex-1 items-center justify-center gap-1",
|
|
1182
|
+
style: size === "small" ? { minWidth: trackMinWidth } : void 0,
|
|
1183
|
+
children: pages.map(
|
|
1184
|
+
(p, i) => p === "..." ? /* @__PURE__ */ jsx11(
|
|
1185
|
+
"span",
|
|
1186
|
+
{
|
|
1187
|
+
"data-flip-key": `e-${i}`,
|
|
1188
|
+
className: cn("flex h-8 w-8 shrink-0 items-center justify-center text-zinc-400", popIn),
|
|
1189
|
+
"aria-hidden": "true",
|
|
1190
|
+
children: /* @__PURE__ */ jsx11(MoreHorizontal, { size: 15 })
|
|
1191
|
+
},
|
|
1192
|
+
`ellipsis-${i}`
|
|
1193
|
+
) : /* @__PURE__ */ jsx11(
|
|
1194
|
+
"button",
|
|
1195
|
+
{
|
|
1196
|
+
type: "button",
|
|
1197
|
+
"data-flip-key": `p-${p}`,
|
|
1198
|
+
onClick: () => goTo(p),
|
|
1199
|
+
"aria-current": current === p ? "page" : void 0,
|
|
1200
|
+
"aria-label": `Page ${p}`,
|
|
1201
|
+
className: cn(
|
|
1202
|
+
"h-8 w-8 shrink-0 cursor-pointer rounded-full text-sm font-medium tabular-nums outline-none",
|
|
1203
|
+
"focus-visible:ring-2 focus-visible:ring-zinc-900/15 focus-visible:ring-offset-2 dark:focus-visible:ring-white/20",
|
|
1204
|
+
"active:scale-90 active:transition-transform active:duration-100",
|
|
1205
|
+
navTransition,
|
|
1206
|
+
popIn,
|
|
1207
|
+
focusRing,
|
|
1208
|
+
current === p ? "bg-zinc-900 text-white shadow-[0_2px_6px_rgba(0,0,0,0.3)] dark:bg-white dark:text-zinc-900 dark:shadow-[0_2px_6px_rgba(0,0,0,0.5)]" : "text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-100"
|
|
1209
|
+
),
|
|
1210
|
+
children: p
|
|
1211
|
+
},
|
|
1212
|
+
p
|
|
1213
|
+
)
|
|
1214
|
+
)
|
|
1215
|
+
}
|
|
1216
|
+
),
|
|
1217
|
+
/* @__PURE__ */ jsx11(
|
|
1218
|
+
Button,
|
|
1219
|
+
{
|
|
1220
|
+
variant: "ghost",
|
|
1221
|
+
size: "sm",
|
|
1222
|
+
className: cn("h-8 w-8 shrink-0 rounded-full p-0", navTransition, focusRing),
|
|
1223
|
+
disabled: current >= clampedTotal,
|
|
1224
|
+
onClick: () => goTo(current + 1),
|
|
1225
|
+
"aria-label": "Next page",
|
|
1226
|
+
children: /* @__PURE__ */ jsx11(ChevronRight2, { size: 15 })
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1229
|
+
]
|
|
1230
|
+
}
|
|
1231
|
+
);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
// components/ui/table.tsx
|
|
1235
|
+
import { useState as useState5 } from "react";
|
|
1236
|
+
import { ChevronDown as ChevronDown2, ChevronUp } from "lucide-react";
|
|
1237
|
+
import { Fragment, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1238
|
+
function Table(_a) {
|
|
1239
|
+
var _b = _a, { children, className = "" } = _b, props = __objRest(_b, ["children", "className"]);
|
|
1240
|
+
return /* @__PURE__ */ jsx12("div", { className: "w-full overflow-auto", children: /* @__PURE__ */ jsx12("table", __spreadProps(__spreadValues({ className: `w-full caption-bottom text-sm ${className}` }, props), { children })) });
|
|
1241
|
+
}
|
|
1242
|
+
function TableHeader(_a) {
|
|
1243
|
+
var _b = _a, { children, className = "" } = _b, props = __objRest(_b, ["children", "className"]);
|
|
1244
|
+
return /* @__PURE__ */ jsx12("thead", __spreadProps(__spreadValues({ className: `border-b border-zinc-200 bg-zinc-50/50 dark:border-zinc-800 dark:bg-zinc-900/50 ${className}` }, props), { children }));
|
|
1245
|
+
}
|
|
1246
|
+
function TableBody(_a) {
|
|
1247
|
+
var _b = _a, { children, className = "" } = _b, props = __objRest(_b, ["children", "className"]);
|
|
1248
|
+
return /* @__PURE__ */ jsx12("tbody", __spreadProps(__spreadValues({ className: `divide-y divide-zinc-200 dark:divide-zinc-800 ${className}` }, props), { children }));
|
|
1249
|
+
}
|
|
1250
|
+
function TableRow(_a) {
|
|
1251
|
+
var _b = _a, { children, className = "" } = _b, props = __objRest(_b, ["children", "className"]);
|
|
1252
|
+
return /* @__PURE__ */ jsx12("tr", __spreadProps(__spreadValues({ className: `transition-colors hover:bg-zinc-50/50 dark:hover:bg-zinc-900/50 ${className}` }, props), { children }));
|
|
1253
|
+
}
|
|
1254
|
+
function TableHead(_a) {
|
|
1255
|
+
var _b = _a, { children, className = "" } = _b, props = __objRest(_b, ["children", "className"]);
|
|
1256
|
+
return /* @__PURE__ */ jsx12("th", __spreadProps(__spreadValues({ className: `h-12 px-4 text-left align-middle font-semibold text-zinc-500 dark:text-zinc-400 uppercase text-[11px] tracking-wider ${className}` }, props), { children }));
|
|
1257
|
+
}
|
|
1258
|
+
function TableCell(_a) {
|
|
1259
|
+
var _b = _a, { children, className = "" } = _b, props = __objRest(_b, ["children", "className"]);
|
|
1260
|
+
return /* @__PURE__ */ jsx12("td", __spreadProps(__spreadValues({ className: `p-4 align-middle text-zinc-700 dark:text-zinc-300 ${className}` }, props), { children }));
|
|
1261
|
+
}
|
|
1262
|
+
function ExpandableRow({ title, details, children, colSpan = 10 }) {
|
|
1263
|
+
const [isExpanded, setIsExpanded] = useState5(false);
|
|
1264
|
+
return /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1265
|
+
/* @__PURE__ */ jsxs8(TableRow, { className: "cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
|
|
1266
|
+
/* @__PURE__ */ jsx12(TableCell, { className: "w-10 text-zinc-400", children: isExpanded ? /* @__PURE__ */ jsx12(ChevronUp, { size: 16 }) : /* @__PURE__ */ jsx12(ChevronDown2, { size: 16 }) }),
|
|
1267
|
+
children
|
|
1268
|
+
] }),
|
|
1269
|
+
isExpanded && /* @__PURE__ */ jsx12("tr", { className: "bg-zinc-50/30 dark:bg-zinc-900/30", children: /* @__PURE__ */ jsx12(TableCell, { colSpan, className: "p-6 border-l-2 border-zinc-900 dark:border-white", children: details }) })
|
|
1270
|
+
] });
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
// components/ui/dropdown.tsx
|
|
1274
|
+
import React12, { useState as useState6, useRef as useRef3, useEffect } from "react";
|
|
1275
|
+
import { Check as Check4 } from "lucide-react";
|
|
1276
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1277
|
+
function Dropdown({ children }) {
|
|
1278
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1279
|
+
const containerRef = useRef3(null);
|
|
1280
|
+
useEffect(() => {
|
|
1281
|
+
const handleClickOutside = (e) => {
|
|
1282
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) setIsOpen(false);
|
|
1283
|
+
};
|
|
1284
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1285
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1286
|
+
}, []);
|
|
1287
|
+
useEffect(() => {
|
|
1288
|
+
if (!isOpen) return;
|
|
1289
|
+
const handleKeyDown = (e) => {
|
|
1290
|
+
if (e.key === "Escape") setIsOpen(false);
|
|
1291
|
+
};
|
|
1292
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1293
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
1294
|
+
}, [isOpen]);
|
|
1295
|
+
return /* @__PURE__ */ jsx13("div", { className: "relative inline-block text-left", ref: containerRef, children: React12.Children.map(children, (child) => {
|
|
1296
|
+
if (React12.isValidElement(child)) {
|
|
1297
|
+
return React12.cloneElement(child, { isOpen, setIsOpen });
|
|
1298
|
+
}
|
|
1299
|
+
return child;
|
|
1300
|
+
}) });
|
|
1301
|
+
}
|
|
1302
|
+
function DropdownTrigger({ children, isOpen, setIsOpen }) {
|
|
1303
|
+
return React12.cloneElement(children, {
|
|
1304
|
+
onClick: () => setIsOpen(!isOpen),
|
|
1305
|
+
"aria-haspopup": "menu",
|
|
1306
|
+
"aria-expanded": isOpen,
|
|
1307
|
+
className: `${children.props.className} ${isOpen ? "ring-2 ring-zinc-200 dark:ring-zinc-800" : ""}`
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
function DropdownContent({ children, isOpen, className = "", align = "left" }) {
|
|
1311
|
+
if (!isOpen) return null;
|
|
1312
|
+
const alignClass = align === "right" ? "right-0" : "left-0";
|
|
1313
|
+
return /* @__PURE__ */ jsx13("div", { role: "menu", className: `absolute ${alignClass} z-50 mt-2 w-56 origin-top-right rounded-lg border border-zinc-200 bg-white p-1 shadow-xl outline-none dark:border-zinc-800 dark:bg-zinc-950 ${className} animate-in fade-in zoom-in-95 duration-200`, children });
|
|
1314
|
+
}
|
|
1315
|
+
function DropdownItem({ label, icon: Icon, selected, onClick, className = "", variant = "default" }) {
|
|
1316
|
+
const baseClass = "flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors outline-none cursor-pointer";
|
|
1317
|
+
const variantClass = variant === "destructive" ? "text-red-600 hover:bg-red-50 dark:hover:bg-red-950/30" : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-900";
|
|
1318
|
+
return /* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", className: `${baseClass} ${variantClass} ${className}`, onClick, children: [
|
|
1319
|
+
Icon && /* @__PURE__ */ jsx13(Icon, { size: 16, className: "opacity-70" }),
|
|
1320
|
+
/* @__PURE__ */ jsx13("span", { className: "flex-1", children: label }),
|
|
1321
|
+
selected && /* @__PURE__ */ jsx13(Check4, { size: 14, className: "text-zinc-900 dark:text-white" })
|
|
1322
|
+
] });
|
|
1323
|
+
}
|
|
1324
|
+
function DropdownLabel({ children }) {
|
|
1325
|
+
return /* @__PURE__ */ jsx13("div", { className: "px-3 py-2 text-[11px] font-bold uppercase tracking-wider text-zinc-400", children });
|
|
1326
|
+
}
|
|
1327
|
+
function DropdownDivider() {
|
|
1328
|
+
return /* @__PURE__ */ jsx13("div", { role: "separator", className: "my-1 h-px bg-zinc-100 dark:bg-zinc-800" });
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// components/ui/data-table.tsx
|
|
1332
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1333
|
+
function DataTable({
|
|
1334
|
+
data,
|
|
1335
|
+
columns,
|
|
1336
|
+
searchPlaceholder = "Search...",
|
|
1337
|
+
pageSize = 5,
|
|
1338
|
+
className
|
|
1339
|
+
}) {
|
|
1340
|
+
const [search, setSearch] = useState7("");
|
|
1341
|
+
const [sortKey, setSortKey] = useState7(null);
|
|
1342
|
+
const [sortDir, setSortDir] = useState7(null);
|
|
1343
|
+
const [activeFilters, setActiveFilters] = useState7({});
|
|
1344
|
+
const [page, setPage] = useState7(1);
|
|
1345
|
+
const getValue = (row, col) => col.accessor ? col.accessor(row) : row[col.key];
|
|
1346
|
+
const filterableColumns = columns.filter((c) => {
|
|
1347
|
+
var _a;
|
|
1348
|
+
return (_a = c.filterOptions) == null ? void 0 : _a.length;
|
|
1349
|
+
});
|
|
1350
|
+
const activeFilterCount = Object.values(activeFilters).filter(Boolean).length;
|
|
1351
|
+
const filtered = useMemo2(() => {
|
|
1352
|
+
let rows = data;
|
|
1353
|
+
if (search.trim()) {
|
|
1354
|
+
const q = search.trim().toLowerCase();
|
|
1355
|
+
rows = rows.filter((row) => columns.some((col) => {
|
|
1356
|
+
var _a;
|
|
1357
|
+
return String((_a = getValue(row, col)) != null ? _a : "").toLowerCase().includes(q);
|
|
1358
|
+
}));
|
|
1359
|
+
}
|
|
1360
|
+
Object.entries(activeFilters).forEach(([key, value]) => {
|
|
1361
|
+
if (!value) return;
|
|
1362
|
+
const col = columns.find((c) => c.key === key);
|
|
1363
|
+
if (!col) return;
|
|
1364
|
+
rows = rows.filter((row) => String(getValue(row, col)) === value);
|
|
1365
|
+
});
|
|
1366
|
+
return rows;
|
|
1367
|
+
}, [data, search, activeFilters]);
|
|
1368
|
+
const sorted = useMemo2(() => {
|
|
1369
|
+
if (!sortKey || !sortDir) return filtered;
|
|
1370
|
+
const col = columns.find((c) => c.key === sortKey);
|
|
1371
|
+
if (!col) return filtered;
|
|
1372
|
+
return [...filtered].sort((a, b) => {
|
|
1373
|
+
const av = getValue(a, col);
|
|
1374
|
+
const bv = getValue(b, col);
|
|
1375
|
+
if (typeof av === "number" && typeof bv === "number") return sortDir === "asc" ? av - bv : bv - av;
|
|
1376
|
+
return sortDir === "asc" ? String(av).localeCompare(String(bv)) : String(bv).localeCompare(String(av));
|
|
1377
|
+
});
|
|
1378
|
+
}, [filtered, sortKey, sortDir]);
|
|
1379
|
+
const totalPages = Math.max(1, Math.ceil(sorted.length / pageSize));
|
|
1380
|
+
const currentPage = Math.min(page, totalPages);
|
|
1381
|
+
const paged = sorted.slice((currentPage - 1) * pageSize, currentPage * pageSize);
|
|
1382
|
+
const handleSort = (col) => {
|
|
1383
|
+
if (!col.sortable) return;
|
|
1384
|
+
if (sortKey !== col.key) {
|
|
1385
|
+
setSortKey(col.key);
|
|
1386
|
+
setSortDir("asc");
|
|
1387
|
+
} else if (sortDir === "asc") {
|
|
1388
|
+
setSortDir("desc");
|
|
1389
|
+
} else {
|
|
1390
|
+
setSortKey(null);
|
|
1391
|
+
setSortDir(null);
|
|
1392
|
+
}
|
|
1393
|
+
setPage(1);
|
|
1394
|
+
};
|
|
1395
|
+
const clearAll = () => {
|
|
1396
|
+
setSearch("");
|
|
1397
|
+
setActiveFilters({});
|
|
1398
|
+
setPage(1);
|
|
1399
|
+
};
|
|
1400
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn("w-full", className), children: [
|
|
1401
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-3 pb-4 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
1402
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative w-full sm:max-w-xs", children: [
|
|
1403
|
+
/* @__PURE__ */ jsx14(Search3, { size: 15, className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-zinc-400" }),
|
|
1404
|
+
/* @__PURE__ */ jsx14(
|
|
1405
|
+
Input,
|
|
1406
|
+
{
|
|
1407
|
+
value: search,
|
|
1408
|
+
onChange: (e) => {
|
|
1409
|
+
setSearch(e.target.value);
|
|
1410
|
+
setPage(1);
|
|
1411
|
+
},
|
|
1412
|
+
placeholder: searchPlaceholder,
|
|
1413
|
+
className: "pl-9"
|
|
1414
|
+
}
|
|
1415
|
+
)
|
|
1416
|
+
] }),
|
|
1417
|
+
(filterableColumns.length > 0 || activeFilterCount > 0) && /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1418
|
+
filterableColumns.map((col) => /* @__PURE__ */ jsxs10(Dropdown, { children: [
|
|
1419
|
+
/* @__PURE__ */ jsx14(DropdownTrigger, { children: /* @__PURE__ */ jsxs10(
|
|
1420
|
+
Button,
|
|
1421
|
+
{
|
|
1422
|
+
variant: "outline",
|
|
1423
|
+
size: "sm",
|
|
1424
|
+
className: cn(activeFilters[col.key] && "border-zinc-900 text-zinc-900 dark:border-zinc-100 dark:text-white"),
|
|
1425
|
+
children: [
|
|
1426
|
+
/* @__PURE__ */ jsx14(Filter2, { size: 13 }),
|
|
1427
|
+
activeFilters[col.key] || col.header
|
|
1428
|
+
]
|
|
1429
|
+
}
|
|
1430
|
+
) }),
|
|
1431
|
+
/* @__PURE__ */ jsxs10(DropdownContent, { align: "right", children: [
|
|
1432
|
+
/* @__PURE__ */ jsxs10(DropdownLabel, { children: [
|
|
1433
|
+
"Filter by ",
|
|
1434
|
+
col.header
|
|
1435
|
+
] }),
|
|
1436
|
+
/* @__PURE__ */ jsx14(DropdownItem, { label: "All", selected: !activeFilters[col.key], onClick: () => setActiveFilters((f) => __spreadProps(__spreadValues({}, f), { [col.key]: "" })) }),
|
|
1437
|
+
/* @__PURE__ */ jsx14(DropdownDivider, {}),
|
|
1438
|
+
col.filterOptions.map((opt) => /* @__PURE__ */ jsx14(
|
|
1439
|
+
DropdownItem,
|
|
1440
|
+
{
|
|
1441
|
+
label: opt,
|
|
1442
|
+
selected: activeFilters[col.key] === opt,
|
|
1443
|
+
onClick: () => {
|
|
1444
|
+
setActiveFilters((f) => __spreadProps(__spreadValues({}, f), { [col.key]: opt }));
|
|
1445
|
+
setPage(1);
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
opt
|
|
1449
|
+
))
|
|
1450
|
+
] })
|
|
1451
|
+
] }, col.key)),
|
|
1452
|
+
(activeFilterCount > 0 || search) && /* @__PURE__ */ jsxs10(Button, { variant: "ghost", size: "sm", onClick: clearAll, children: [
|
|
1453
|
+
/* @__PURE__ */ jsx14(X3, { size: 13 }),
|
|
1454
|
+
"Clear"
|
|
1455
|
+
] })
|
|
1456
|
+
] })
|
|
1457
|
+
] }),
|
|
1458
|
+
/* @__PURE__ */ jsx14("div", { className: "overflow-hidden rounded-xl border border-zinc-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs10(Table, { children: [
|
|
1459
|
+
/* @__PURE__ */ jsx14(TableHeader, { children: /* @__PURE__ */ jsx14(TableRow, { children: columns.map((col) => /* @__PURE__ */ jsx14(
|
|
1460
|
+
TableHead,
|
|
1461
|
+
{
|
|
1462
|
+
onClick: () => handleSort(col),
|
|
1463
|
+
className: cn(
|
|
1464
|
+
col.align === "right" && "text-right",
|
|
1465
|
+
col.align === "center" && "text-center",
|
|
1466
|
+
col.sortable && "cursor-pointer select-none hover:text-zinc-700 dark:hover:text-zinc-200",
|
|
1467
|
+
col.className
|
|
1468
|
+
),
|
|
1469
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1470
|
+
"span",
|
|
1471
|
+
{
|
|
1472
|
+
className: cn(
|
|
1473
|
+
"inline-flex items-center gap-1",
|
|
1474
|
+
col.align === "right" && "flex-row-reverse",
|
|
1475
|
+
col.align === "center" && "justify-center"
|
|
1476
|
+
),
|
|
1477
|
+
children: [
|
|
1478
|
+
col.header,
|
|
1479
|
+
col.sortable && (sortKey === col.key ? sortDir === "asc" ? /* @__PURE__ */ jsx14(ArrowUp, { size: 12 }) : /* @__PURE__ */ jsx14(ArrowDown, { size: 12 }) : /* @__PURE__ */ jsx14(ArrowUpDown2, { size: 12, className: "opacity-30" }))
|
|
1480
|
+
]
|
|
1481
|
+
}
|
|
1482
|
+
)
|
|
1483
|
+
},
|
|
1484
|
+
col.key
|
|
1485
|
+
)) }) }),
|
|
1486
|
+
/* @__PURE__ */ jsx14(TableBody, { children: paged.length === 0 ? /* @__PURE__ */ jsx14(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx14(TableCell, { colSpan: columns.length, className: "py-10 text-center text-zinc-400", children: "No results found." }) }) : paged.map((row, i) => /* @__PURE__ */ jsx14(TableRow, { children: columns.map((col) => {
|
|
1487
|
+
var _a;
|
|
1488
|
+
return /* @__PURE__ */ jsx14(TableCell, { className: cn(col.align === "right" && "text-right", col.align === "center" && "text-center", col.className), children: col.render ? col.render(row) : String((_a = getValue(row, col)) != null ? _a : "") }, col.key);
|
|
1489
|
+
}) }, i)) })
|
|
1490
|
+
] }) }),
|
|
1491
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col-reverse items-center justify-between gap-3 pt-4 sm:flex-row", children: [
|
|
1492
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: sorted.length === 0 ? "0 results" : `Showing ${(currentPage - 1) * pageSize + 1}\u2013${Math.min(currentPage * pageSize, sorted.length)} of ${sorted.length}` }),
|
|
1493
|
+
/* @__PURE__ */ jsx14(Pagination, { page: currentPage, totalPages, onPageChange: setPage })
|
|
1494
|
+
] })
|
|
1495
|
+
] });
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// components/ui/dialog.tsx
|
|
1499
|
+
import React14, { createContext as createContext2, useContext as useContext2, useState as useState8, useEffect as useEffect2 } from "react";
|
|
1500
|
+
import { createPortal } from "react-dom";
|
|
1501
|
+
import { User as User2, Plus as Plus2 } from "lucide-react";
|
|
1502
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1503
|
+
var DialogContext = createContext2(null);
|
|
1504
|
+
function Dialog({ children, open, onOpenChange }) {
|
|
1505
|
+
const [isOpenState, setIsOpenState] = useState8(false);
|
|
1506
|
+
const isOpen = open !== void 0 ? open : isOpenState;
|
|
1507
|
+
const setIsOpen = onOpenChange || setIsOpenState;
|
|
1508
|
+
useEffect2(() => {
|
|
1509
|
+
if (isOpen) document.body.style.overflow = "hidden";
|
|
1510
|
+
else document.body.style.overflow = "unset";
|
|
1511
|
+
return () => {
|
|
1512
|
+
document.body.style.overflow = "unset";
|
|
1513
|
+
};
|
|
1514
|
+
}, [isOpen]);
|
|
1515
|
+
return /* @__PURE__ */ jsx15(DialogContext.Provider, { value: { isOpen, setIsOpen }, children });
|
|
1516
|
+
}
|
|
1517
|
+
function DialogTrigger({ children }) {
|
|
1518
|
+
const { setIsOpen } = useContext2(DialogContext);
|
|
1519
|
+
return React14.cloneElement(children, {
|
|
1520
|
+
onClick: (e) => {
|
|
1521
|
+
var _a;
|
|
1522
|
+
if ((_a = children.props) == null ? void 0 : _a.onClick) children.props.onClick(e);
|
|
1523
|
+
setIsOpen(true);
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
function DialogContent({ children, className = "" }) {
|
|
1528
|
+
const { isOpen, setIsOpen } = useContext2(DialogContext);
|
|
1529
|
+
const [visible, setVisible] = useState8(false);
|
|
1530
|
+
useEffect2(() => {
|
|
1531
|
+
if (!isOpen) {
|
|
1532
|
+
setVisible(false);
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
const frame = requestAnimationFrame(() => setVisible(true));
|
|
1536
|
+
return () => cancelAnimationFrame(frame);
|
|
1537
|
+
}, [isOpen]);
|
|
1538
|
+
useEffect2(() => {
|
|
1539
|
+
if (!isOpen) return;
|
|
1540
|
+
const handleKeyDown = (e) => {
|
|
1541
|
+
if (e.key === "Escape") setIsOpen(false);
|
|
1542
|
+
};
|
|
1543
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1544
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1545
|
+
}, [isOpen, setIsOpen]);
|
|
1546
|
+
if (!isOpen) return null;
|
|
1547
|
+
return createPortal(
|
|
1548
|
+
/* @__PURE__ */ jsxs11("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
1549
|
+
/* @__PURE__ */ jsx15(
|
|
1550
|
+
"div",
|
|
1551
|
+
{
|
|
1552
|
+
className: cn(
|
|
1553
|
+
"fixed inset-0 bg-zinc-900/45 backdrop-blur-[2px] transition-opacity duration-200 ease-out dark:bg-black/65",
|
|
1554
|
+
visible ? "opacity-100" : "opacity-0"
|
|
1555
|
+
),
|
|
1556
|
+
onClick: () => setIsOpen(false),
|
|
1557
|
+
"aria-hidden": true
|
|
1558
|
+
}
|
|
1559
|
+
),
|
|
1560
|
+
/* @__PURE__ */ jsx15(
|
|
1561
|
+
"div",
|
|
1562
|
+
{
|
|
1563
|
+
role: "dialog",
|
|
1564
|
+
"aria-modal": "true",
|
|
1565
|
+
onClick: (e) => e.stopPropagation(),
|
|
1566
|
+
className: cn(
|
|
1567
|
+
"relative z-10 w-full max-w-md rounded-2xl border border-zinc-200/90 bg-white p-6 text-zinc-900",
|
|
1568
|
+
"shadow-[0_20px_60px_rgba(0,0,0,0.12),0_0_0_1px_rgba(0,0,0,0.04)]",
|
|
1569
|
+
"dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100",
|
|
1570
|
+
"dark:shadow-[0_20px_60px_rgba(0,0,0,0.5),0_0_0_1px_rgba(255,255,255,0.06)]",
|
|
1571
|
+
"transition-[opacity,transform] duration-200 ease-out",
|
|
1572
|
+
visible ? "translate-y-0 scale-100 opacity-100" : "translate-y-1 scale-[0.97] opacity-0",
|
|
1573
|
+
className
|
|
1574
|
+
),
|
|
1575
|
+
children
|
|
1576
|
+
}
|
|
1577
|
+
)
|
|
1578
|
+
] }),
|
|
1579
|
+
document.body
|
|
1580
|
+
);
|
|
1581
|
+
}
|
|
1582
|
+
function DialogHeader({ title, description }) {
|
|
1583
|
+
return /* @__PURE__ */ jsxs11("div", { className: "mb-5", children: [
|
|
1584
|
+
title && /* @__PURE__ */ jsx15("h2", { className: "text-[17px] font-semibold leading-snug tracking-tight text-zinc-900 dark:text-white", children: title }),
|
|
1585
|
+
description && /* @__PURE__ */ jsx15("p", { className: "mt-2 text-[14px] leading-relaxed text-zinc-500 dark:text-zinc-400", children: description })
|
|
1586
|
+
] });
|
|
1587
|
+
}
|
|
1588
|
+
function DialogFooter({ children }) {
|
|
1589
|
+
return /* @__PURE__ */ jsx15("div", { className: "mt-6 flex items-center justify-end gap-1", children });
|
|
1590
|
+
}
|
|
1591
|
+
function DialogAction({ label, onClick, variant = "primary" }) {
|
|
1592
|
+
const { setIsOpen } = useContext2(DialogContext);
|
|
1593
|
+
const handleClick = () => {
|
|
1594
|
+
if (onClick) onClick();
|
|
1595
|
+
setIsOpen(false);
|
|
1596
|
+
};
|
|
1597
|
+
const colorClass = variant === "destructive" ? "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10" : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-200 dark:hover:bg-zinc-800";
|
|
1598
|
+
return /* @__PURE__ */ jsx15(
|
|
1599
|
+
"button",
|
|
1600
|
+
{
|
|
1601
|
+
onClick: handleClick,
|
|
1602
|
+
className: cn(
|
|
1603
|
+
"rounded-lg px-3.5 py-2 text-[13px] font-semibold tracking-tight outline-none transition-colors duration-150",
|
|
1604
|
+
"focus-visible:ring-2 focus-visible:ring-zinc-900/15 dark:focus-visible:ring-white/20",
|
|
1605
|
+
colorClass
|
|
1606
|
+
),
|
|
1607
|
+
children: label
|
|
1608
|
+
}
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
function DialogItem({
|
|
1612
|
+
label,
|
|
1613
|
+
icon,
|
|
1614
|
+
onClick,
|
|
1615
|
+
variant = "account"
|
|
1616
|
+
}) {
|
|
1617
|
+
const { setIsOpen } = useContext2(DialogContext);
|
|
1618
|
+
const handleClick = () => {
|
|
1619
|
+
if (onClick) onClick();
|
|
1620
|
+
setIsOpen(false);
|
|
1621
|
+
};
|
|
1622
|
+
const iconBg = variant === "account" ? "bg-[#0070BA]/10 dark:bg-[#0070BA]/20" : "bg-zinc-100 dark:bg-zinc-800";
|
|
1623
|
+
const iconColor = variant === "account" ? "text-[#0070BA] dark:text-[#4DA3E0]" : "text-zinc-500 dark:text-zinc-400";
|
|
1624
|
+
return /* @__PURE__ */ jsxs11(
|
|
1625
|
+
"button",
|
|
1626
|
+
{
|
|
1627
|
+
onClick: handleClick,
|
|
1628
|
+
className: "flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left outline-none transition-colors duration-150 hover:bg-zinc-50 dark:hover:bg-zinc-900/60",
|
|
1629
|
+
children: [
|
|
1630
|
+
/* @__PURE__ */ jsx15("div", { className: cn("flex h-9 w-9 shrink-0 items-center justify-center rounded-full", iconBg, iconColor), children: icon || (variant === "account" ? /* @__PURE__ */ jsx15(User2, { size: 18 }) : /* @__PURE__ */ jsx15(Plus2, { size: 18 })) }),
|
|
1631
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[14px] font-medium text-zinc-900 dark:text-white", children: label })
|
|
1632
|
+
]
|
|
1633
|
+
}
|
|
1634
|
+
);
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// components/ui/feature-card.tsx
|
|
1638
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1639
|
+
function FeatureCard({
|
|
1640
|
+
icon: Icon,
|
|
1641
|
+
title,
|
|
1642
|
+
description,
|
|
1643
|
+
variant = "plain"
|
|
1644
|
+
}) {
|
|
1645
|
+
return /* @__PURE__ */ jsxs12(
|
|
1646
|
+
"div",
|
|
1647
|
+
{
|
|
1648
|
+
className: cn(
|
|
1649
|
+
variant === "bordered" && "rounded-xl border border-zinc-200 p-5 dark:border-zinc-800"
|
|
1650
|
+
),
|
|
1651
|
+
children: [
|
|
1652
|
+
/* @__PURE__ */ jsx16(
|
|
1653
|
+
"div",
|
|
1654
|
+
{
|
|
1655
|
+
className: cn(
|
|
1656
|
+
"mb-4 flex h-11 w-11 items-center justify-center rounded-2xl border",
|
|
1657
|
+
variant === "bordered" ? "border-zinc-200 bg-zinc-50 text-zinc-900 dark:border-white/10 dark:bg-white/[0.06] dark:text-zinc-100" : "border-zinc-800 bg-zinc-900 text-white dark:border-zinc-200 dark:bg-white dark:text-zinc-900"
|
|
1658
|
+
),
|
|
1659
|
+
children: /* @__PURE__ */ jsx16(Icon, { className: "h-5 w-5" })
|
|
1660
|
+
}
|
|
1661
|
+
),
|
|
1662
|
+
/* @__PURE__ */ jsx16("h3", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-50", children: title }),
|
|
1663
|
+
/* @__PURE__ */ jsx16("p", { className: "mt-1 text-sm text-zinc-500 dark:text-zinc-400", children: description })
|
|
1664
|
+
]
|
|
1665
|
+
}
|
|
1666
|
+
);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
// components/ui/label.tsx
|
|
1670
|
+
import * as React15 from "react";
|
|
1671
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
1672
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1673
|
+
var labelVariants = cva7(
|
|
1674
|
+
"inline-flex items-center gap-1 font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
1675
|
+
{
|
|
1676
|
+
variants: {
|
|
1677
|
+
variant: {
|
|
1678
|
+
default: "text-zinc-800 dark:text-zinc-100",
|
|
1679
|
+
muted: "text-zinc-500 dark:text-zinc-400"
|
|
1680
|
+
},
|
|
1681
|
+
size: {
|
|
1682
|
+
sm: "text-xs",
|
|
1683
|
+
md: "text-sm",
|
|
1684
|
+
lg: "text-[15px]"
|
|
1685
|
+
}
|
|
1686
|
+
},
|
|
1687
|
+
defaultVariants: {
|
|
1688
|
+
variant: "default",
|
|
1689
|
+
size: "md"
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
var Label = React15.forwardRef(
|
|
1694
|
+
(_a, ref) => {
|
|
1695
|
+
var _b = _a, { className, variant, size, required, optional, hint, error, children } = _b, props = __objRest(_b, ["className", "variant", "size", "required", "optional", "hint", "error", "children"]);
|
|
1696
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex w-full flex-col gap-1.5", children: [
|
|
1697
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1698
|
+
/* @__PURE__ */ jsxs13(
|
|
1699
|
+
"label",
|
|
1700
|
+
__spreadProps(__spreadValues({
|
|
1701
|
+
ref,
|
|
1702
|
+
className: cn(labelVariants({ variant, size }), className)
|
|
1703
|
+
}, props), {
|
|
1704
|
+
children: [
|
|
1705
|
+
children,
|
|
1706
|
+
required && /* @__PURE__ */ jsx17("span", { className: "text-red-500", "aria-label": "required", children: "*" })
|
|
1707
|
+
]
|
|
1708
|
+
})
|
|
1709
|
+
),
|
|
1710
|
+
optional && /* @__PURE__ */ jsx17("span", { className: "text-xs text-zinc-400 dark:text-zinc-500", children: "Optional" })
|
|
1711
|
+
] }),
|
|
1712
|
+
hint && !error && /* @__PURE__ */ jsx17("p", { className: "text-xs leading-relaxed text-zinc-500 dark:text-zinc-400", children: hint }),
|
|
1713
|
+
error && /* @__PURE__ */ jsx17("p", { className: "text-xs leading-relaxed text-red-500 dark:text-red-400", role: "alert", children: error })
|
|
1714
|
+
] });
|
|
1715
|
+
}
|
|
1716
|
+
);
|
|
1717
|
+
Label.displayName = "Label";
|
|
1718
|
+
function Field(_a) {
|
|
1719
|
+
var _b = _a, {
|
|
1720
|
+
className,
|
|
1721
|
+
label,
|
|
1722
|
+
htmlFor,
|
|
1723
|
+
required,
|
|
1724
|
+
optional,
|
|
1725
|
+
hint,
|
|
1726
|
+
error,
|
|
1727
|
+
labelSize = "md",
|
|
1728
|
+
children
|
|
1729
|
+
} = _b, props = __objRest(_b, [
|
|
1730
|
+
"className",
|
|
1731
|
+
"label",
|
|
1732
|
+
"htmlFor",
|
|
1733
|
+
"required",
|
|
1734
|
+
"optional",
|
|
1735
|
+
"hint",
|
|
1736
|
+
"error",
|
|
1737
|
+
"labelSize",
|
|
1738
|
+
"children"
|
|
1739
|
+
]);
|
|
1740
|
+
return /* @__PURE__ */ jsxs13("div", __spreadProps(__spreadValues({ className: cn("flex w-full flex-col gap-2", className) }, props), { children: [
|
|
1741
|
+
/* @__PURE__ */ jsx17(
|
|
1742
|
+
Label,
|
|
1743
|
+
{
|
|
1744
|
+
htmlFor,
|
|
1745
|
+
required,
|
|
1746
|
+
optional,
|
|
1747
|
+
hint,
|
|
1748
|
+
error,
|
|
1749
|
+
size: labelSize,
|
|
1750
|
+
children: label
|
|
1751
|
+
}
|
|
1752
|
+
),
|
|
1753
|
+
children
|
|
1754
|
+
] }));
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
// components/ui/loaders.tsx
|
|
1758
|
+
import { Sparkles } from "lucide-react";
|
|
1759
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1760
|
+
var LoaderStyles = () => /* @__PURE__ */ jsx18("style", { dangerouslySetInnerHTML: { __html: `
|
|
1761
|
+
@keyframes shimmer { 100% { transform: translateX(100%); } }
|
|
1762
|
+
@keyframes progressLoad { 0% { transform: scaleX(0); } 50% { transform: scaleX(0.5); } 100% { transform: scaleX(1); } }
|
|
1763
|
+
@keyframes morphShape { 0%, 100% { border-radius: 8px; transform: rotate(0deg); } 50% { border-radius: 50%; transform: rotate(180deg); } }
|
|
1764
|
+
@keyframes blurReveal { 0% { filter: blur(10px); opacity: 0; transform: translateY(10px); } 100% { filter: blur(0); opacity: 1; transform: translateY(0); } }
|
|
1765
|
+
@keyframes spinDots { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
|
|
1766
|
+
@keyframes squareMove { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.6); opacity: 0.4; } }
|
|
1767
|
+
@keyframes loadBarMove { 0% { left: -100%; } 100% { left: 100%; } }
|
|
1768
|
+
` } });
|
|
1769
|
+
var SkeletonShimmer = ({ className }) => /* @__PURE__ */ jsxs14("div", { className: cn("relative overflow-hidden rounded-md bg-zinc-100 dark:bg-zinc-800", className), children: [
|
|
1770
|
+
/* @__PURE__ */ jsx18(LoaderStyles, {}),
|
|
1771
|
+
/* @__PURE__ */ jsx18("div", { className: "absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/40 to-transparent dark:via-white/5", style: { animation: "shimmer 2s infinite" } })
|
|
1772
|
+
] });
|
|
1773
|
+
var ProgressRing = () => /* @__PURE__ */ jsxs14("svg", { className: "h-10 w-10 animate-spin text-zinc-900 dark:text-white", viewBox: "0 0 32 32", children: [
|
|
1774
|
+
/* @__PURE__ */ jsx18("circle", { className: "opacity-10", cx: "16", cy: "16", r: "14", stroke: "currentColor", strokeWidth: "3", fill: "none" }),
|
|
1775
|
+
/* @__PURE__ */ jsx18("path", { className: "opacity-100", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", d: "M16 2 A14 14 0 0 1 30 16" })
|
|
1776
|
+
] });
|
|
1777
|
+
var SpinnerGradient = () => /* @__PURE__ */ jsx18("div", { className: "h-10 w-10 rounded-full border-4 border-zinc-100 dark:border-zinc-800 border-t-zinc-900 dark:border-t-white animate-spin" });
|
|
1778
|
+
var SpinnerDots = () => /* @__PURE__ */ jsx18("div", { className: "relative h-10 w-10", children: [...Array(8)].map((_, i) => /* @__PURE__ */ jsx18("div", { className: "absolute top-0 left-0 w-full h-full", style: { transform: `rotate(${i * 45}deg)` }, children: /* @__PURE__ */ jsx18("div", { className: "h-2 w-2 rounded-full bg-zinc-900 dark:bg-white", style: { animation: "spinDots 1s linear infinite", animationDelay: `${i * 0.12}s` } }) }, i)) });
|
|
1779
|
+
var HalfCircles = () => /* @__PURE__ */ jsx18("div", { className: "relative h-10 w-10 border-4 border-transparent border-t-zinc-900 dark:border-t-white rounded-full animate-spin", children: /* @__PURE__ */ jsx18("div", { className: "absolute inset-0 border-4 border-transparent border-b-zinc-400 rounded-full opacity-50" }) });
|
|
1780
|
+
var SquaresLoader = () => /* @__PURE__ */ jsxs14("div", { className: "flex gap-1.5", children: [
|
|
1781
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-4 bg-zinc-900 dark:bg-white", style: { animation: "squareMove 1s ease-in-out infinite" } }),
|
|
1782
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-4 bg-zinc-300 dark:bg-zinc-700", style: { animation: "squareMove 1s ease-in-out infinite", animationDelay: "0.2s" } })
|
|
1783
|
+
] });
|
|
1784
|
+
var LoadBar = () => /* @__PURE__ */ jsx18("div", { className: "relative h-4 w-12 overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800", children: /* @__PURE__ */ jsx18("div", { className: "absolute top-0 h-full w-6 rounded-full bg-zinc-900 dark:bg-white", style: { animation: "loadBarMove 1.5s linear infinite" } }) });
|
|
1785
|
+
var PulseLoader = () => /* @__PURE__ */ jsxs14("div", { className: "relative h-10 w-10 flex items-center justify-center", children: [
|
|
1786
|
+
/* @__PURE__ */ jsx18("div", { className: "absolute h-full w-full animate-ping rounded-full bg-zinc-900/20 dark:bg-white/20" }),
|
|
1787
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-4 rounded-full bg-zinc-900 dark:bg-white" })
|
|
1788
|
+
] });
|
|
1789
|
+
var DotWave = () => /* @__PURE__ */ jsx18("div", { className: "flex gap-1.5", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx18("div", { className: "h-2 w-2 animate-bounce rounded-full bg-zinc-900 dark:bg-white", style: { animationDelay: `${i * 0.15}s` } }, i)) });
|
|
1790
|
+
var ThreeDots = () => /* @__PURE__ */ jsx18("div", { className: "flex gap-1", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx18("div", { className: "h-1.5 w-1.5 rounded-full bg-zinc-400 animate-pulse", style: { animationDelay: `${i * 0.2}s` } }, i)) });
|
|
1791
|
+
var TypingIndicator = () => /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1.5 px-4 py-2 bg-zinc-100 dark:bg-zinc-800 rounded-2xl w-fit", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx18("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-zinc-400", style: { animationDelay: `${i * 0.2}s` } }, i)) });
|
|
1792
|
+
var ProgressBar = () => /* @__PURE__ */ jsxs14("div", { className: "h-1.5 w-full max-w-[200px] overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800", children: [
|
|
1793
|
+
/* @__PURE__ */ jsx18(LoaderStyles, {}),
|
|
1794
|
+
/* @__PURE__ */ jsx18("div", { className: "h-full w-full origin-left bg-zinc-900 dark:bg-white", style: { animation: "progressLoad 1.5s ease-in-out infinite" } })
|
|
1795
|
+
] });
|
|
1796
|
+
var MorphingLoader = () => /* @__PURE__ */ jsx18("div", { className: "h-10 w-10 bg-zinc-900 dark:bg-white", style: { animation: "morphShape 3s linear infinite" } });
|
|
1797
|
+
var OrbitLoader = () => /* @__PURE__ */ jsxs14("div", { className: "relative flex h-12 w-12 items-center justify-center", children: [
|
|
1798
|
+
/* @__PURE__ */ jsx18("div", { className: "h-2 w-2 rounded-full bg-zinc-900 dark:bg-white" }),
|
|
1799
|
+
/* @__PURE__ */ jsx18("div", { className: "absolute h-full w-full animate-spin", children: /* @__PURE__ */ jsx18("div", { className: "h-2 w-2 rounded-full bg-zinc-400" }) })
|
|
1800
|
+
] });
|
|
1801
|
+
var BlurReveal = ({ children }) => /* @__PURE__ */ jsx18("div", { style: { animation: "blurReveal 1s ease-out forwards" }, children });
|
|
1802
|
+
var AILoader = ({ text = "Thinking..." }) => /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-4", children: [
|
|
1803
|
+
/* @__PURE__ */ jsxs14("div", { className: "relative flex h-12 w-12 items-center justify-center", children: [
|
|
1804
|
+
/* @__PURE__ */ jsx18("div", { className: "absolute h-full w-full animate-spin rounded-full border-2 border-zinc-200 border-t-zinc-900 dark:border-zinc-800 dark:border-t-white" }),
|
|
1805
|
+
/* @__PURE__ */ jsx18(Sparkles, { className: "h-5 w-5 animate-pulse text-zinc-900 dark:text-white" })
|
|
1806
|
+
] }),
|
|
1807
|
+
/* @__PURE__ */ jsx18("span", { className: "text-[10px] font-bold uppercase tracking-widest text-zinc-400 animate-pulse", children: text })
|
|
1808
|
+
] });
|
|
1809
|
+
|
|
1810
|
+
// components/ui/menu.tsx
|
|
1811
|
+
import * as React16 from "react";
|
|
1812
|
+
import { Check as Check5 } from "lucide-react";
|
|
1813
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
1814
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1815
|
+
var menuVariants = cva8(
|
|
1816
|
+
"w-56 rounded-lg p-1 outline-none",
|
|
1817
|
+
{
|
|
1818
|
+
variants: {
|
|
1819
|
+
variant: {
|
|
1820
|
+
default: "border border-zinc-200 bg-white shadow-xl dark:border-zinc-800 dark:bg-zinc-950",
|
|
1821
|
+
ghost: "bg-transparent"
|
|
1822
|
+
}
|
|
1823
|
+
},
|
|
1824
|
+
defaultVariants: { variant: "default" }
|
|
1825
|
+
}
|
|
1826
|
+
);
|
|
1827
|
+
var Menu = React16.forwardRef(
|
|
1828
|
+
(_a, ref) => {
|
|
1829
|
+
var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
|
|
1830
|
+
return /* @__PURE__ */ jsx19(
|
|
1831
|
+
"div",
|
|
1832
|
+
__spreadValues({
|
|
1833
|
+
ref,
|
|
1834
|
+
role: "menu",
|
|
1835
|
+
className: cn(menuVariants({ variant }), className)
|
|
1836
|
+
}, props)
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
);
|
|
1840
|
+
Menu.displayName = "Menu";
|
|
1841
|
+
var menuItemVariants = cva8(
|
|
1842
|
+
[
|
|
1843
|
+
"flex w-full cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-left text-sm outline-none transition-colors",
|
|
1844
|
+
"focus-visible:bg-zinc-100 dark:focus-visible:bg-zinc-900",
|
|
1845
|
+
"disabled:pointer-events-none disabled:opacity-40"
|
|
1846
|
+
],
|
|
1847
|
+
{
|
|
1848
|
+
variants: {
|
|
1849
|
+
variant: {
|
|
1850
|
+
default: "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-900",
|
|
1851
|
+
destructive: "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/30"
|
|
1852
|
+
}
|
|
1853
|
+
},
|
|
1854
|
+
defaultVariants: { variant: "default" }
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1857
|
+
var MenuItem = React16.forwardRef(
|
|
1858
|
+
(_a, ref) => {
|
|
1859
|
+
var _b = _a, { className, variant, label, icon: Icon, shortcut, selected, disabled } = _b, props = __objRest(_b, ["className", "variant", "label", "icon", "shortcut", "selected", "disabled"]);
|
|
1860
|
+
return /* @__PURE__ */ jsxs15(
|
|
1861
|
+
"button",
|
|
1862
|
+
__spreadProps(__spreadValues({
|
|
1863
|
+
ref,
|
|
1864
|
+
type: "button",
|
|
1865
|
+
role: "menuitem",
|
|
1866
|
+
disabled,
|
|
1867
|
+
className: cn(menuItemVariants({ variant }), className)
|
|
1868
|
+
}, props), {
|
|
1869
|
+
children: [
|
|
1870
|
+
Icon && /* @__PURE__ */ jsx19(Icon, { className: "h-4 w-4 shrink-0 opacity-70" }),
|
|
1871
|
+
/* @__PURE__ */ jsx19("span", { className: "flex-1 truncate", children: label }),
|
|
1872
|
+
shortcut && /* @__PURE__ */ jsx19("span", { className: "shrink-0 text-xs tracking-wide text-zinc-400 dark:text-zinc-500", children: shortcut }),
|
|
1873
|
+
selected && /* @__PURE__ */ jsx19(Check5, { className: "h-3.5 w-3.5 shrink-0 text-zinc-900 dark:text-white" })
|
|
1874
|
+
]
|
|
1875
|
+
})
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
);
|
|
1879
|
+
MenuItem.displayName = "MenuItem";
|
|
1880
|
+
var MenuLabel = React16.forwardRef((_a, ref) => {
|
|
1881
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1882
|
+
return /* @__PURE__ */ jsx19(
|
|
1883
|
+
"div",
|
|
1884
|
+
__spreadValues({
|
|
1885
|
+
ref,
|
|
1886
|
+
className: cn(
|
|
1887
|
+
"px-3 py-2 text-[11px] font-bold uppercase tracking-wider text-zinc-400 dark:text-zinc-500",
|
|
1888
|
+
className
|
|
1889
|
+
)
|
|
1890
|
+
}, props)
|
|
1891
|
+
);
|
|
1892
|
+
});
|
|
1893
|
+
MenuLabel.displayName = "MenuLabel";
|
|
1894
|
+
var MenuDivider = React16.forwardRef((_a, ref) => {
|
|
1895
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1896
|
+
return /* @__PURE__ */ jsx19(
|
|
1897
|
+
"div",
|
|
1898
|
+
__spreadValues({
|
|
1899
|
+
ref,
|
|
1900
|
+
role: "separator",
|
|
1901
|
+
className: cn("my-1 h-px bg-zinc-100 dark:bg-zinc-800", className)
|
|
1902
|
+
}, props)
|
|
1903
|
+
);
|
|
1904
|
+
});
|
|
1905
|
+
MenuDivider.displayName = "MenuDivider";
|
|
1906
|
+
|
|
1907
|
+
// components/ui/modal.tsx
|
|
1908
|
+
import * as React17 from "react";
|
|
1909
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
1910
|
+
import { cva as cva9 } from "class-variance-authority";
|
|
1911
|
+
import { X as X4 } from "lucide-react";
|
|
1912
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1913
|
+
var modalContentVariants = cva9(
|
|
1914
|
+
[
|
|
1915
|
+
"relative z-10 flex w-full flex-col overflow-hidden rounded-2xl",
|
|
1916
|
+
"border border-zinc-200/90 bg-white text-zinc-900",
|
|
1917
|
+
"shadow-[0_20px_60px_rgba(0,0,0,0.12),0_0_0_1px_rgba(0,0,0,0.04)]",
|
|
1918
|
+
"dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100",
|
|
1919
|
+
"dark:shadow-[0_20px_60px_rgba(0,0,0,0.45),0_0_0_1px_rgba(255,255,255,0.06)]",
|
|
1920
|
+
"transition-[opacity,transform] duration-200 ease-out"
|
|
1921
|
+
],
|
|
1922
|
+
{
|
|
1923
|
+
variants: {
|
|
1924
|
+
size: {
|
|
1925
|
+
sm: "max-w-[400px]",
|
|
1926
|
+
md: "max-w-[440px]",
|
|
1927
|
+
lg: "max-w-lg",
|
|
1928
|
+
xl: "max-w-xl"
|
|
1929
|
+
},
|
|
1930
|
+
visible: {
|
|
1931
|
+
true: "opacity-100 scale-100",
|
|
1932
|
+
false: "opacity-0 scale-[0.97]"
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
defaultVariants: { size: "md", visible: false }
|
|
1936
|
+
}
|
|
1937
|
+
);
|
|
1938
|
+
var overlayVariants = cva9(
|
|
1939
|
+
[
|
|
1940
|
+
"absolute inset-0 bg-zinc-900/45",
|
|
1941
|
+
"transition-opacity duration-200 ease-out",
|
|
1942
|
+
"dark:bg-black/65"
|
|
1943
|
+
],
|
|
1944
|
+
{
|
|
1945
|
+
variants: {
|
|
1946
|
+
visible: {
|
|
1947
|
+
true: "opacity-100",
|
|
1948
|
+
false: "opacity-0"
|
|
1949
|
+
}
|
|
1950
|
+
},
|
|
1951
|
+
defaultVariants: { visible: false }
|
|
1952
|
+
}
|
|
1953
|
+
);
|
|
1954
|
+
var ModalContext = React17.createContext(null);
|
|
1955
|
+
var ModalContentContext = React17.createContext(null);
|
|
1956
|
+
function useModalContext() {
|
|
1957
|
+
const context = React17.useContext(ModalContext);
|
|
1958
|
+
if (!context) {
|
|
1959
|
+
throw new Error("Modal components must be used within Modal");
|
|
1960
|
+
}
|
|
1961
|
+
return context;
|
|
1962
|
+
}
|
|
1963
|
+
function useModalContentContext() {
|
|
1964
|
+
const context = React17.useContext(ModalContentContext);
|
|
1965
|
+
if (!context) {
|
|
1966
|
+
throw new Error("Modal subcomponents must be used within ModalContent");
|
|
1967
|
+
}
|
|
1968
|
+
return context;
|
|
1969
|
+
}
|
|
1970
|
+
function Modal({
|
|
1971
|
+
open: controlledOpen,
|
|
1972
|
+
onOpenChange,
|
|
1973
|
+
defaultOpen = false,
|
|
1974
|
+
children
|
|
1975
|
+
}) {
|
|
1976
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React17.useState(defaultOpen);
|
|
1977
|
+
const open = controlledOpen != null ? controlledOpen : uncontrolledOpen;
|
|
1978
|
+
const handleOpenChange = React17.useCallback(
|
|
1979
|
+
(next) => {
|
|
1980
|
+
if (controlledOpen === void 0) {
|
|
1981
|
+
setUncontrolledOpen(next);
|
|
1982
|
+
}
|
|
1983
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
1984
|
+
},
|
|
1985
|
+
[controlledOpen, onOpenChange]
|
|
1986
|
+
);
|
|
1987
|
+
return /* @__PURE__ */ jsx20(ModalContext.Provider, { value: { open, onOpenChange: handleOpenChange }, children });
|
|
1988
|
+
}
|
|
1989
|
+
function ModalTrigger(_a) {
|
|
1990
|
+
var _b = _a, { asChild, children, onClick } = _b, props = __objRest(_b, ["asChild", "children", "onClick"]);
|
|
1991
|
+
const { onOpenChange } = useModalContext();
|
|
1992
|
+
const handleOpen = (event) => {
|
|
1993
|
+
onClick == null ? void 0 : onClick(event);
|
|
1994
|
+
if (!event.defaultPrevented) {
|
|
1995
|
+
onOpenChange(true);
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
if (asChild && React17.isValidElement(children)) {
|
|
1999
|
+
const child = children;
|
|
2000
|
+
return React17.cloneElement(child, {
|
|
2001
|
+
onClick: (event) => {
|
|
2002
|
+
var _a2, _b2;
|
|
2003
|
+
(_b2 = (_a2 = child.props).onClick) == null ? void 0 : _b2.call(_a2, event);
|
|
2004
|
+
if (!event.defaultPrevented) {
|
|
2005
|
+
onOpenChange(true);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
return /* @__PURE__ */ jsx20("button", __spreadProps(__spreadValues({ type: "button", onClick: handleOpen }, props), { children }));
|
|
2011
|
+
}
|
|
2012
|
+
function ModalContent(_a) {
|
|
2013
|
+
var _b = _a, {
|
|
2014
|
+
className,
|
|
2015
|
+
size,
|
|
2016
|
+
showCloseButton = true,
|
|
2017
|
+
onClose,
|
|
2018
|
+
children
|
|
2019
|
+
} = _b, props = __objRest(_b, [
|
|
2020
|
+
"className",
|
|
2021
|
+
"size",
|
|
2022
|
+
"showCloseButton",
|
|
2023
|
+
"onClose",
|
|
2024
|
+
"children"
|
|
2025
|
+
]);
|
|
2026
|
+
const { open, onOpenChange } = useModalContext();
|
|
2027
|
+
const [mounted, setMounted] = React17.useState(false);
|
|
2028
|
+
const [visible, setVisible] = React17.useState(false);
|
|
2029
|
+
const contentRef = React17.useRef(null);
|
|
2030
|
+
const titleId = React17.useId();
|
|
2031
|
+
const descriptionId = React17.useId();
|
|
2032
|
+
React17.useEffect(() => setMounted(true), []);
|
|
2033
|
+
React17.useEffect(() => {
|
|
2034
|
+
if (!open) {
|
|
2035
|
+
setVisible(false);
|
|
2036
|
+
document.body.style.overflow = "";
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
document.body.style.overflow = "hidden";
|
|
2040
|
+
const frame = requestAnimationFrame(() => setVisible(true));
|
|
2041
|
+
return () => {
|
|
2042
|
+
cancelAnimationFrame(frame);
|
|
2043
|
+
document.body.style.overflow = "";
|
|
2044
|
+
};
|
|
2045
|
+
}, [open]);
|
|
2046
|
+
const close = React17.useCallback(() => {
|
|
2047
|
+
onClose == null ? void 0 : onClose();
|
|
2048
|
+
onOpenChange(false);
|
|
2049
|
+
}, [onClose, onOpenChange]);
|
|
2050
|
+
React17.useEffect(() => {
|
|
2051
|
+
if (!open) return;
|
|
2052
|
+
const handleKeyDown = (event) => {
|
|
2053
|
+
if (event.key === "Escape") close();
|
|
2054
|
+
};
|
|
2055
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
2056
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
2057
|
+
}, [open, close]);
|
|
2058
|
+
React17.useEffect(() => {
|
|
2059
|
+
if (!open || !contentRef.current) return;
|
|
2060
|
+
const focusable = contentRef.current.querySelector(
|
|
2061
|
+
"button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])"
|
|
2062
|
+
);
|
|
2063
|
+
focusable == null ? void 0 : focusable.focus();
|
|
2064
|
+
}, [open, visible]);
|
|
2065
|
+
if (!mounted || !open) return null;
|
|
2066
|
+
const node = /* @__PURE__ */ jsxs16("div", { className: "fixed inset-0 z-[100] isolate flex items-center justify-center p-4 sm:p-6", children: [
|
|
2067
|
+
/* @__PURE__ */ jsx20(
|
|
2068
|
+
"div",
|
|
2069
|
+
{
|
|
2070
|
+
className: overlayVariants({ visible }),
|
|
2071
|
+
onClick: close,
|
|
2072
|
+
"aria-hidden": true
|
|
2073
|
+
}
|
|
2074
|
+
),
|
|
2075
|
+
/* @__PURE__ */ jsxs16(
|
|
2076
|
+
"div",
|
|
2077
|
+
__spreadProps(__spreadValues({
|
|
2078
|
+
ref: contentRef,
|
|
2079
|
+
role: "dialog",
|
|
2080
|
+
"aria-modal": "true",
|
|
2081
|
+
"aria-labelledby": titleId,
|
|
2082
|
+
"aria-describedby": descriptionId,
|
|
2083
|
+
className: cn(modalContentVariants({ size, visible }), className),
|
|
2084
|
+
onClick: (e) => e.stopPropagation()
|
|
2085
|
+
}, props), {
|
|
2086
|
+
children: [
|
|
2087
|
+
showCloseButton && /* @__PURE__ */ jsx20(
|
|
2088
|
+
"button",
|
|
2089
|
+
{
|
|
2090
|
+
type: "button",
|
|
2091
|
+
onClick: close,
|
|
2092
|
+
className: "absolute right-4 top-4 z-10 inline-flex h-8 w-8 items-center justify-center rounded-lg text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-200",
|
|
2093
|
+
"aria-label": "Close",
|
|
2094
|
+
children: /* @__PURE__ */ jsx20(X4, { className: "h-4 w-4", strokeWidth: 2 })
|
|
2095
|
+
}
|
|
2096
|
+
),
|
|
2097
|
+
/* @__PURE__ */ jsx20(ModalContentContext.Provider, { value: { titleId, descriptionId, close }, children })
|
|
2098
|
+
]
|
|
2099
|
+
})
|
|
2100
|
+
)
|
|
2101
|
+
] });
|
|
2102
|
+
return createPortal2(node, document.body);
|
|
2103
|
+
}
|
|
2104
|
+
function ModalHeader(_a) {
|
|
2105
|
+
var _b = _a, {
|
|
2106
|
+
className
|
|
2107
|
+
} = _b, props = __objRest(_b, [
|
|
2108
|
+
"className"
|
|
2109
|
+
]);
|
|
2110
|
+
return /* @__PURE__ */ jsx20(
|
|
2111
|
+
"div",
|
|
2112
|
+
__spreadValues({
|
|
2113
|
+
className: cn("space-y-1 px-6 pt-6 pr-12", className)
|
|
2114
|
+
}, props)
|
|
2115
|
+
);
|
|
2116
|
+
}
|
|
2117
|
+
function ModalTitle(_a) {
|
|
2118
|
+
var _b = _a, {
|
|
2119
|
+
className
|
|
2120
|
+
} = _b, props = __objRest(_b, [
|
|
2121
|
+
"className"
|
|
2122
|
+
]);
|
|
2123
|
+
const { titleId } = useModalContentContext();
|
|
2124
|
+
return /* @__PURE__ */ jsx20(
|
|
2125
|
+
"h2",
|
|
2126
|
+
__spreadValues({
|
|
2127
|
+
id: titleId,
|
|
2128
|
+
className: cn(
|
|
2129
|
+
"text-[15px] font-semibold leading-snug tracking-tight text-zinc-900 dark:text-white",
|
|
2130
|
+
className
|
|
2131
|
+
)
|
|
2132
|
+
}, props)
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2135
|
+
function ModalDescription(_a) {
|
|
2136
|
+
var _b = _a, {
|
|
2137
|
+
className
|
|
2138
|
+
} = _b, props = __objRest(_b, [
|
|
2139
|
+
"className"
|
|
2140
|
+
]);
|
|
2141
|
+
const { descriptionId } = useModalContentContext();
|
|
2142
|
+
return /* @__PURE__ */ jsx20(
|
|
2143
|
+
"p",
|
|
2144
|
+
__spreadValues({
|
|
2145
|
+
id: descriptionId,
|
|
2146
|
+
className: cn(
|
|
2147
|
+
"text-[13px] leading-relaxed text-zinc-500 dark:text-zinc-400",
|
|
2148
|
+
className
|
|
2149
|
+
)
|
|
2150
|
+
}, props)
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
function ModalBody(_a) {
|
|
2154
|
+
var _b = _a, {
|
|
2155
|
+
className
|
|
2156
|
+
} = _b, props = __objRest(_b, [
|
|
2157
|
+
"className"
|
|
2158
|
+
]);
|
|
2159
|
+
return /* @__PURE__ */ jsx20(
|
|
2160
|
+
"div",
|
|
2161
|
+
__spreadValues({
|
|
2162
|
+
className: cn("space-y-4 px-6 pt-5 pb-6", className)
|
|
2163
|
+
}, props)
|
|
2164
|
+
);
|
|
2165
|
+
}
|
|
2166
|
+
function ModalFooter(_a) {
|
|
2167
|
+
var _b = _a, {
|
|
2168
|
+
className
|
|
2169
|
+
} = _b, props = __objRest(_b, [
|
|
2170
|
+
"className"
|
|
2171
|
+
]);
|
|
2172
|
+
return /* @__PURE__ */ jsx20(
|
|
2173
|
+
"div",
|
|
2174
|
+
__spreadValues({
|
|
2175
|
+
className: cn(
|
|
2176
|
+
"flex items-center justify-end gap-2 border-t border-zinc-200/90 px-6 py-4 dark:border-zinc-800",
|
|
2177
|
+
className
|
|
2178
|
+
)
|
|
2179
|
+
}, props)
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
function ModalOption(_a) {
|
|
2183
|
+
var _b = _a, {
|
|
2184
|
+
className,
|
|
2185
|
+
icon,
|
|
2186
|
+
title,
|
|
2187
|
+
description
|
|
2188
|
+
} = _b, props = __objRest(_b, [
|
|
2189
|
+
"className",
|
|
2190
|
+
"icon",
|
|
2191
|
+
"title",
|
|
2192
|
+
"description"
|
|
2193
|
+
]);
|
|
2194
|
+
return /* @__PURE__ */ jsxs16(
|
|
2195
|
+
"div",
|
|
2196
|
+
__spreadProps(__spreadValues({
|
|
2197
|
+
className: cn(
|
|
2198
|
+
"flex gap-3 rounded-xl border border-zinc-200 bg-zinc-50/70 p-3.5",
|
|
2199
|
+
"dark:border-zinc-800 dark:bg-zinc-900/60",
|
|
2200
|
+
className
|
|
2201
|
+
)
|
|
2202
|
+
}, props), {
|
|
2203
|
+
children: [
|
|
2204
|
+
icon && /* @__PURE__ */ jsx20(
|
|
2205
|
+
"div",
|
|
2206
|
+
{
|
|
2207
|
+
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-white text-zinc-500 shadow-sm ring-1 ring-zinc-200/80 dark:bg-zinc-950 dark:text-zinc-400 dark:ring-zinc-700",
|
|
2208
|
+
children: icon
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0", children: [
|
|
2212
|
+
/* @__PURE__ */ jsx20("p", { className: "text-sm font-medium text-zinc-900 dark:text-white", children: title }),
|
|
2213
|
+
description && /* @__PURE__ */ jsx20("p", { className: "mt-0.5 text-xs leading-relaxed text-zinc-500 dark:text-zinc-400", children: description })
|
|
2214
|
+
] })
|
|
2215
|
+
]
|
|
2216
|
+
})
|
|
2217
|
+
);
|
|
2218
|
+
}
|
|
2219
|
+
function ModalClose(_a) {
|
|
2220
|
+
var _b = _a, { asChild, children, onClick } = _b, props = __objRest(_b, ["asChild", "children", "onClick"]);
|
|
2221
|
+
const { close } = useModalContentContext();
|
|
2222
|
+
if (asChild && React17.isValidElement(children)) {
|
|
2223
|
+
return React17.cloneElement(
|
|
2224
|
+
children,
|
|
2225
|
+
{
|
|
2226
|
+
onClick: (event) => {
|
|
2227
|
+
var _a2, _b2;
|
|
2228
|
+
(_b2 = (_a2 = children.props).onClick) == null ? void 0 : _b2.call(
|
|
2229
|
+
_a2,
|
|
2230
|
+
event
|
|
2231
|
+
);
|
|
2232
|
+
close();
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
return /* @__PURE__ */ jsx20(
|
|
2238
|
+
"button",
|
|
2239
|
+
__spreadProps(__spreadValues({
|
|
2240
|
+
type: "button",
|
|
2241
|
+
onClick: (e) => {
|
|
2242
|
+
onClick == null ? void 0 : onClick(e);
|
|
2243
|
+
close();
|
|
2244
|
+
}
|
|
2245
|
+
}, props), {
|
|
2246
|
+
children
|
|
2247
|
+
})
|
|
2248
|
+
);
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
// components/ui/progress.tsx
|
|
2252
|
+
import * as React18 from "react";
|
|
2253
|
+
import { cva as cva10 } from "class-variance-authority";
|
|
2254
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2255
|
+
var progressTrackVariants = cva10(
|
|
2256
|
+
"relative w-full overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800/70",
|
|
2257
|
+
{
|
|
2258
|
+
variants: {
|
|
2259
|
+
size: {
|
|
2260
|
+
sm: "h-1",
|
|
2261
|
+
md: "h-1.5",
|
|
2262
|
+
lg: "h-2"
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
defaultVariants: { size: "md" }
|
|
2266
|
+
}
|
|
2267
|
+
);
|
|
2268
|
+
var progressIndicatorVariants = cva10(
|
|
2269
|
+
"h-full rounded-full transition-[width] duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]",
|
|
2270
|
+
{
|
|
2271
|
+
variants: {
|
|
2272
|
+
variant: {
|
|
2273
|
+
default: "bg-zinc-900 dark:bg-zinc-100",
|
|
2274
|
+
success: "bg-[#28A745] dark:bg-[#5CC975]",
|
|
2275
|
+
warning: "bg-[#E58E00] dark:bg-[#F5B84A]",
|
|
2276
|
+
error: "bg-[#D93025] dark:bg-[#F06B62]"
|
|
2277
|
+
}
|
|
2278
|
+
},
|
|
2279
|
+
defaultVariants: { variant: "default" }
|
|
2280
|
+
}
|
|
2281
|
+
);
|
|
2282
|
+
var valuePillVariants = cva10(
|
|
2283
|
+
"inline-flex min-w-[2.25rem] items-center justify-end text-[11px] font-medium tabular-nums text-zinc-400 dark:text-zinc-500",
|
|
2284
|
+
{
|
|
2285
|
+
variants: {
|
|
2286
|
+
variant: {
|
|
2287
|
+
default: "",
|
|
2288
|
+
success: "",
|
|
2289
|
+
warning: "",
|
|
2290
|
+
error: ""
|
|
2291
|
+
}
|
|
2292
|
+
},
|
|
2293
|
+
defaultVariants: { variant: "default" }
|
|
2294
|
+
}
|
|
2295
|
+
);
|
|
2296
|
+
var Progress = React18.forwardRef(
|
|
2297
|
+
(_a, ref) => {
|
|
2298
|
+
var _b = _a, {
|
|
2299
|
+
className,
|
|
2300
|
+
value = 0,
|
|
2301
|
+
max = 100,
|
|
2302
|
+
variant,
|
|
2303
|
+
size,
|
|
2304
|
+
label,
|
|
2305
|
+
showValue = false,
|
|
2306
|
+
indeterminate = false,
|
|
2307
|
+
disabled = false
|
|
2308
|
+
} = _b, props = __objRest(_b, [
|
|
2309
|
+
"className",
|
|
2310
|
+
"value",
|
|
2311
|
+
"max",
|
|
2312
|
+
"variant",
|
|
2313
|
+
"size",
|
|
2314
|
+
"label",
|
|
2315
|
+
"showValue",
|
|
2316
|
+
"indeterminate",
|
|
2317
|
+
"disabled"
|
|
2318
|
+
]);
|
|
2319
|
+
const clamped = Math.min(max, Math.max(0, value));
|
|
2320
|
+
const percentage = max > 0 ? Math.round(clamped / max * 100) : 0;
|
|
2321
|
+
return /* @__PURE__ */ jsxs17(
|
|
2322
|
+
"div",
|
|
2323
|
+
{
|
|
2324
|
+
className: cn(
|
|
2325
|
+
"flex w-full flex-col gap-2.5",
|
|
2326
|
+
disabled && "pointer-events-none opacity-50",
|
|
2327
|
+
className
|
|
2328
|
+
),
|
|
2329
|
+
children: [
|
|
2330
|
+
(label || showValue) && /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2331
|
+
label && /* @__PURE__ */ jsx21("span", { className: "text-sm text-zinc-600 dark:text-zinc-300", children: label }),
|
|
2332
|
+
showValue && !indeterminate && /* @__PURE__ */ jsxs17("span", { className: cn(valuePillVariants({ variant })), children: [
|
|
2333
|
+
percentage,
|
|
2334
|
+
"%"
|
|
2335
|
+
] })
|
|
2336
|
+
] }),
|
|
2337
|
+
/* @__PURE__ */ jsx21(
|
|
2338
|
+
"div",
|
|
2339
|
+
__spreadProps(__spreadValues({
|
|
2340
|
+
ref,
|
|
2341
|
+
role: "progressbar",
|
|
2342
|
+
"aria-valuemin": 0,
|
|
2343
|
+
"aria-valuemax": max,
|
|
2344
|
+
"aria-valuenow": indeterminate || disabled ? void 0 : clamped,
|
|
2345
|
+
"aria-label": label,
|
|
2346
|
+
"aria-valuetext": indeterminate ? "Loading" : `${percentage}%`,
|
|
2347
|
+
"aria-disabled": disabled || void 0,
|
|
2348
|
+
className: cn(progressTrackVariants({ size }))
|
|
2349
|
+
}, props), {
|
|
2350
|
+
children: indeterminate ? /* @__PURE__ */ jsx21(
|
|
2351
|
+
"div",
|
|
2352
|
+
{
|
|
2353
|
+
className: cn(
|
|
2354
|
+
progressIndicatorVariants({ variant }),
|
|
2355
|
+
"w-[40%] animate-[progress-indeterminate_1.5s_ease-in-out_infinite]"
|
|
2356
|
+
)
|
|
2357
|
+
}
|
|
2358
|
+
) : /* @__PURE__ */ jsx21(
|
|
2359
|
+
"div",
|
|
2360
|
+
{
|
|
2361
|
+
className: cn(progressIndicatorVariants({ variant })),
|
|
2362
|
+
style: { width: `${percentage}%` }
|
|
2363
|
+
}
|
|
2364
|
+
)
|
|
2365
|
+
})
|
|
2366
|
+
)
|
|
2367
|
+
]
|
|
2368
|
+
}
|
|
2369
|
+
);
|
|
2370
|
+
}
|
|
2371
|
+
);
|
|
2372
|
+
Progress.displayName = "Progress";
|
|
2373
|
+
|
|
2374
|
+
// components/ui/radio.tsx
|
|
2375
|
+
import * as React19 from "react";
|
|
2376
|
+
import { cva as cva11 } from "class-variance-authority";
|
|
2377
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2378
|
+
var radioControlVariants = cva11(
|
|
2379
|
+
[
|
|
2380
|
+
"pointer-events-none relative flex shrink-0 items-center justify-center rounded-full border-2 bg-transparent transition-all duration-200",
|
|
2381
|
+
"border-zinc-500 group-hover:border-zinc-700",
|
|
2382
|
+
"peer-checked:border-zinc-900",
|
|
2383
|
+
"peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-zinc-900/30 peer-focus-visible:ring-offset-2",
|
|
2384
|
+
"peer-disabled:border-zinc-300",
|
|
2385
|
+
"peer-disabled:peer-checked:border-zinc-300",
|
|
2386
|
+
"dark:border-zinc-500 dark:group-hover:border-zinc-400",
|
|
2387
|
+
"dark:peer-checked:border-zinc-100",
|
|
2388
|
+
"dark:peer-disabled:border-zinc-600 dark:peer-disabled:peer-checked:border-zinc-600",
|
|
2389
|
+
"peer-checked:[&_.radio-dot]:scale-100 peer-checked:[&_.radio-dot]:opacity-100",
|
|
2390
|
+
"peer-disabled:peer-checked:[&_.radio-dot]:bg-zinc-300",
|
|
2391
|
+
"dark:peer-disabled:peer-checked:[&_.radio-dot]:bg-zinc-600"
|
|
2392
|
+
],
|
|
2393
|
+
{
|
|
2394
|
+
variants: {
|
|
2395
|
+
size: {
|
|
2396
|
+
sm: "h-4 w-4 [&_.radio-dot]:h-1.5 [&_.radio-dot]:w-1.5",
|
|
2397
|
+
md: "h-5 w-5 [&_.radio-dot]:h-2.5 [&_.radio-dot]:w-2.5",
|
|
2398
|
+
lg: "h-6 w-6 [&_.radio-dot]:h-3 [&_.radio-dot]:w-3"
|
|
2399
|
+
}
|
|
2400
|
+
},
|
|
2401
|
+
defaultVariants: { size: "md" }
|
|
2402
|
+
}
|
|
2403
|
+
);
|
|
2404
|
+
var radioWrapperVariants = cva11("group relative flex w-full transition-colors duration-150", {
|
|
2405
|
+
variants: {
|
|
2406
|
+
variant: {
|
|
2407
|
+
inline: "gap-3",
|
|
2408
|
+
card: [
|
|
2409
|
+
"gap-3.5 rounded-lg border border-zinc-200 bg-white px-4 py-3.5",
|
|
2410
|
+
"hover:border-zinc-300 hover:bg-zinc-50/80",
|
|
2411
|
+
"has-[:checked]:border-zinc-900",
|
|
2412
|
+
"dark:border-zinc-800 dark:bg-zinc-900 dark:hover:border-zinc-700",
|
|
2413
|
+
"dark:has-[:checked]:border-zinc-500"
|
|
2414
|
+
]
|
|
2415
|
+
}
|
|
2416
|
+
},
|
|
2417
|
+
defaultVariants: { variant: "inline" }
|
|
2418
|
+
});
|
|
2419
|
+
var RadioGroupContext = React19.createContext(
|
|
2420
|
+
null
|
|
2421
|
+
);
|
|
2422
|
+
var RadioGroup = React19.forwardRef(
|
|
2423
|
+
(_a, ref) => {
|
|
2424
|
+
var _b = _a, {
|
|
2425
|
+
className,
|
|
2426
|
+
name,
|
|
2427
|
+
value: controlledValue,
|
|
2428
|
+
defaultValue,
|
|
2429
|
+
onValueChange,
|
|
2430
|
+
size = "md",
|
|
2431
|
+
variant = "inline",
|
|
2432
|
+
appearance = "default",
|
|
2433
|
+
disabled,
|
|
2434
|
+
orientation = "vertical",
|
|
2435
|
+
children
|
|
2436
|
+
} = _b, props = __objRest(_b, [
|
|
2437
|
+
"className",
|
|
2438
|
+
"name",
|
|
2439
|
+
"value",
|
|
2440
|
+
"defaultValue",
|
|
2441
|
+
"onValueChange",
|
|
2442
|
+
"size",
|
|
2443
|
+
"variant",
|
|
2444
|
+
"appearance",
|
|
2445
|
+
"disabled",
|
|
2446
|
+
"orientation",
|
|
2447
|
+
"children"
|
|
2448
|
+
]);
|
|
2449
|
+
const [uncontrolledValue, setUncontrolledValue] = React19.useState(
|
|
2450
|
+
defaultValue != null ? defaultValue : ""
|
|
2451
|
+
);
|
|
2452
|
+
const value = controlledValue != null ? controlledValue : uncontrolledValue;
|
|
2453
|
+
const handleValueChange = (next) => {
|
|
2454
|
+
if (controlledValue === void 0) {
|
|
2455
|
+
setUncontrolledValue(next);
|
|
2456
|
+
}
|
|
2457
|
+
onValueChange == null ? void 0 : onValueChange(next);
|
|
2458
|
+
};
|
|
2459
|
+
return /* @__PURE__ */ jsx22(
|
|
2460
|
+
RadioGroupContext.Provider,
|
|
2461
|
+
{
|
|
2462
|
+
value: { name, value, onValueChange: handleValueChange, size, variant, appearance, disabled },
|
|
2463
|
+
children: /* @__PURE__ */ jsx22(
|
|
2464
|
+
"div",
|
|
2465
|
+
__spreadProps(__spreadValues({
|
|
2466
|
+
ref,
|
|
2467
|
+
role: "radiogroup",
|
|
2468
|
+
className: cn(
|
|
2469
|
+
"flex",
|
|
2470
|
+
appearance === "segmented" ? "inline-flex w-fit gap-0.5 rounded-lg border border-zinc-200 p-0.5 dark:border-zinc-800" : variant === "card" ? "gap-2.5" : "gap-2.5",
|
|
2471
|
+
orientation === "vertical" ? "flex-col" : "flex-row flex-wrap",
|
|
2472
|
+
className
|
|
2473
|
+
)
|
|
2474
|
+
}, props), {
|
|
2475
|
+
children
|
|
2476
|
+
})
|
|
2477
|
+
)
|
|
2478
|
+
}
|
|
2479
|
+
);
|
|
2480
|
+
}
|
|
2481
|
+
);
|
|
2482
|
+
RadioGroup.displayName = "RadioGroup";
|
|
2483
|
+
var Radio = React19.forwardRef(
|
|
2484
|
+
(_a, ref) => {
|
|
2485
|
+
var _b = _a, {
|
|
2486
|
+
className,
|
|
2487
|
+
size: sizeProp,
|
|
2488
|
+
variant: variantProp,
|
|
2489
|
+
value,
|
|
2490
|
+
label,
|
|
2491
|
+
description,
|
|
2492
|
+
disabled: disabledProp,
|
|
2493
|
+
id,
|
|
2494
|
+
onChange,
|
|
2495
|
+
checked: checkedProp
|
|
2496
|
+
} = _b, inputProps = __objRest(_b, [
|
|
2497
|
+
"className",
|
|
2498
|
+
"size",
|
|
2499
|
+
"variant",
|
|
2500
|
+
"value",
|
|
2501
|
+
"label",
|
|
2502
|
+
"description",
|
|
2503
|
+
"disabled",
|
|
2504
|
+
"id",
|
|
2505
|
+
"onChange",
|
|
2506
|
+
"checked"
|
|
2507
|
+
]);
|
|
2508
|
+
var _a2, _b2, _c;
|
|
2509
|
+
const context = React19.useContext(RadioGroupContext);
|
|
2510
|
+
const generatedId = React19.useId();
|
|
2511
|
+
const inputId = id != null ? id : generatedId;
|
|
2512
|
+
const size = (_a2 = sizeProp != null ? sizeProp : context == null ? void 0 : context.size) != null ? _a2 : "md";
|
|
2513
|
+
const groupVariant = (_b2 = variantProp != null ? variantProp : context == null ? void 0 : context.variant) != null ? _b2 : "inline";
|
|
2514
|
+
const appearance = (_c = context == null ? void 0 : context.appearance) != null ? _c : "default";
|
|
2515
|
+
const resolvedVariant = appearance === "segmented" ? "inline" : groupVariant === "card" || description ? "card" : "inline";
|
|
2516
|
+
const disabled = disabledProp != null ? disabledProp : context == null ? void 0 : context.disabled;
|
|
2517
|
+
const isControlled = context !== null || checkedProp !== void 0;
|
|
2518
|
+
const checked = context ? context.value === value : checkedProp;
|
|
2519
|
+
const alignStart = resolvedVariant === "card" || Boolean(description);
|
|
2520
|
+
const input = /* @__PURE__ */ jsx22(
|
|
2521
|
+
"input",
|
|
2522
|
+
__spreadProps(__spreadValues({}, inputProps), {
|
|
2523
|
+
ref,
|
|
2524
|
+
id: inputId,
|
|
2525
|
+
type: "radio",
|
|
2526
|
+
name: context == null ? void 0 : context.name,
|
|
2527
|
+
value,
|
|
2528
|
+
disabled,
|
|
2529
|
+
checked: isControlled ? checked : void 0,
|
|
2530
|
+
defaultChecked: !isControlled ? checkedProp : void 0,
|
|
2531
|
+
onChange: (event) => {
|
|
2532
|
+
var _a3;
|
|
2533
|
+
onChange == null ? void 0 : onChange(event);
|
|
2534
|
+
if (event.target.checked) {
|
|
2535
|
+
(_a3 = context == null ? void 0 : context.onValueChange) == null ? void 0 : _a3.call(context, value);
|
|
2536
|
+
}
|
|
2537
|
+
},
|
|
2538
|
+
className: "peer absolute inset-0 z-10 cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
2539
|
+
})
|
|
2540
|
+
);
|
|
2541
|
+
return /* @__PURE__ */ jsxs18(
|
|
2542
|
+
"label",
|
|
2543
|
+
{
|
|
2544
|
+
htmlFor: inputId,
|
|
2545
|
+
className: cn(
|
|
2546
|
+
appearance === "segmented" ? "relative inline-flex items-center rounded-md px-3 py-1.5 text-sm font-medium text-zinc-600 transition-colors duration-150 has-[:checked]:bg-zinc-900 has-[:checked]:text-white dark:text-zinc-400 dark:has-[:checked]:bg-zinc-100 dark:has-[:checked]:text-zinc-900" : radioWrapperVariants({ variant: resolvedVariant }),
|
|
2547
|
+
appearance === "segmented" ? "items-center" : alignStart ? "items-start" : "items-center",
|
|
2548
|
+
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
2549
|
+
className
|
|
2550
|
+
),
|
|
2551
|
+
children: [
|
|
2552
|
+
appearance === "segmented" ? input : /* @__PURE__ */ jsxs18(
|
|
2553
|
+
"span",
|
|
2554
|
+
{
|
|
2555
|
+
className: cn(
|
|
2556
|
+
"relative flex shrink-0 items-center justify-center p-2.5 -m-2.5",
|
|
2557
|
+
alignStart ? "-mt-[3px]" : void 0
|
|
2558
|
+
),
|
|
2559
|
+
children: [
|
|
2560
|
+
input,
|
|
2561
|
+
/* @__PURE__ */ jsx22(
|
|
2562
|
+
"span",
|
|
2563
|
+
{
|
|
2564
|
+
"aria-hidden": true,
|
|
2565
|
+
className: "pointer-events-none absolute inset-0 rounded-full bg-zinc-900/0 transition-colors duration-200 group-hover:bg-zinc-900/[0.08] group-active:bg-zinc-900/[0.12] peer-disabled:group-hover:bg-transparent dark:group-hover:bg-white/[0.08] dark:group-active:bg-white/[0.12]"
|
|
2566
|
+
}
|
|
2567
|
+
),
|
|
2568
|
+
/* @__PURE__ */ jsx22("span", { className: radioControlVariants({ size }), children: /* @__PURE__ */ jsx22("span", { className: "radio-dot scale-0 rounded-full bg-zinc-900 opacity-0 transition-all duration-200 dark:bg-zinc-100" }) })
|
|
2569
|
+
]
|
|
2570
|
+
}
|
|
2571
|
+
),
|
|
2572
|
+
(label || description) && /* @__PURE__ */ jsxs18(
|
|
2573
|
+
"span",
|
|
2574
|
+
{
|
|
2575
|
+
className: cn(
|
|
2576
|
+
"flex min-w-0 flex-col",
|
|
2577
|
+
appearance === "segmented" ? "gap-0" : "flex-1 gap-0.5"
|
|
2578
|
+
),
|
|
2579
|
+
children: [
|
|
2580
|
+
label && /* @__PURE__ */ jsx22(
|
|
2581
|
+
"span",
|
|
2582
|
+
{
|
|
2583
|
+
className: cn(
|
|
2584
|
+
appearance === "segmented" ? "leading-none" : cn(
|
|
2585
|
+
"text-sm leading-snug text-zinc-800 dark:text-zinc-100",
|
|
2586
|
+
size === "sm" && "text-xs",
|
|
2587
|
+
size === "md" && "text-sm",
|
|
2588
|
+
size === "lg" && "text-base"
|
|
2589
|
+
)
|
|
2590
|
+
),
|
|
2591
|
+
children: label
|
|
2592
|
+
}
|
|
2593
|
+
),
|
|
2594
|
+
description && /* @__PURE__ */ jsx22("span", { className: "text-xs leading-relaxed text-zinc-500 dark:text-zinc-400", children: description })
|
|
2595
|
+
]
|
|
2596
|
+
}
|
|
2597
|
+
)
|
|
2598
|
+
]
|
|
2599
|
+
}
|
|
2600
|
+
);
|
|
2601
|
+
}
|
|
2602
|
+
);
|
|
2603
|
+
Radio.displayName = "Radio";
|
|
2604
|
+
|
|
2605
|
+
// components/ui/skeleton.tsx
|
|
2606
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2607
|
+
var SkeletonBar = ({ className }) => /* @__PURE__ */ jsx23("div", { className: `animate-pulse rounded bg-zinc-200 dark:bg-zinc-800 ${className}` });
|
|
2608
|
+
function AccordionSkeletonPlus({ count = 3 }) {
|
|
2609
|
+
return /* @__PURE__ */ jsx23("div", { className: "w-full", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-3 py-4 border-b border-zinc-100 dark:border-zinc-800 last:border-0", children: [
|
|
2610
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-5 w-5 rounded-full shrink-0" }),
|
|
2611
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-2/3" })
|
|
2612
|
+
] }, i)) });
|
|
2613
|
+
}
|
|
2614
|
+
function AccordionSkeletonChevron({ count = 3 }) {
|
|
2615
|
+
return /* @__PURE__ */ jsx23("div", { className: "w-full", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between py-5 border-b border-zinc-100 dark:border-zinc-800 last:border-0", children: [
|
|
2616
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-1/2" }),
|
|
2617
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-4 rounded-sm shrink-0" })
|
|
2618
|
+
] }, i)) });
|
|
2619
|
+
}
|
|
2620
|
+
function CardSkeletonGrid({ count = 3 }) {
|
|
2621
|
+
return /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 w-full", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3", children: [
|
|
2622
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "aspect-video w-full rounded-md" }),
|
|
2623
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-full" }),
|
|
2624
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-[60%]" })
|
|
2625
|
+
] }, i)) });
|
|
2626
|
+
}
|
|
2627
|
+
function ListSkeleton({ count = 3 }) {
|
|
2628
|
+
return /* @__PURE__ */ jsx23("div", { className: "w-full space-y-4", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-4 p-4 border border-zinc-100 dark:border-zinc-800 rounded-lg bg-white dark:bg-zinc-900/50", children: [
|
|
2629
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-3", children: [
|
|
2630
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-10 w-10 rounded-full shrink-0" }),
|
|
2631
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
|
|
2632
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-3 w-24" }),
|
|
2633
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-3 w-40" })
|
|
2634
|
+
] })
|
|
2635
|
+
] }),
|
|
2636
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2 mt-1", children: [
|
|
2637
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-3 w-full" }),
|
|
2638
|
+
/* @__PURE__ */ jsx23(SkeletonBar, { className: "h-3 w-[92%]" })
|
|
2639
|
+
] })
|
|
2640
|
+
] }, i)) });
|
|
2641
|
+
}
|
|
2642
|
+
function TableSkeleton({ count = 5 }) {
|
|
2643
|
+
return /* @__PURE__ */ jsx23("div", { className: "w-full overflow-hidden rounded-lg border border-zinc-100 dark:border-zinc-800", children: /* @__PURE__ */ jsx23("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs19("table", { className: "w-full text-sm text-left", children: [
|
|
2644
|
+
/* @__PURE__ */ jsx23("thead", { className: "bg-zinc-50/50 dark:bg-zinc-900/50 border-b border-zinc-100 dark:border-zinc-800 text-zinc-500", children: /* @__PURE__ */ jsxs19("tr", { children: [
|
|
2645
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Id" }),
|
|
2646
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Image" }),
|
|
2647
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Name" }),
|
|
2648
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Category" }),
|
|
2649
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Price" }),
|
|
2650
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Stock" }),
|
|
2651
|
+
/* @__PURE__ */ jsx23("th", { className: "px-4 py-3 font-medium", children: "Description" })
|
|
2652
|
+
] }) }),
|
|
2653
|
+
/* @__PURE__ */ jsx23("tbody", { className: "divide-y divide-zinc-100 dark:divide-zinc-800", children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs19("tr", { children: [
|
|
2654
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-8" }) }),
|
|
2655
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-8 w-12 rounded" }) }),
|
|
2656
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-24" }) }),
|
|
2657
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-20" }) }),
|
|
2658
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-12" }) }),
|
|
2659
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-12" }) }),
|
|
2660
|
+
/* @__PURE__ */ jsx23("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx23(SkeletonBar, { className: "h-4 w-48" }) })
|
|
2661
|
+
] }, i)) })
|
|
2662
|
+
] }) }) });
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
// components/ui/steppers.tsx
|
|
2666
|
+
import React20 from "react";
|
|
2667
|
+
import { motion } from "framer-motion";
|
|
2668
|
+
import { Check as Check6 } from "lucide-react";
|
|
2669
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2670
|
+
function getTone(i, currentStep) {
|
|
2671
|
+
if (i < currentStep) return "done";
|
|
2672
|
+
if (i === currentStep) return "current";
|
|
2673
|
+
return "upcoming";
|
|
2674
|
+
}
|
|
2675
|
+
var NODE_TONE = {
|
|
2676
|
+
done: "border-zinc-900 bg-zinc-900 text-white dark:bg-white dark:text-zinc-900 dark:border-white",
|
|
2677
|
+
current: "border-zinc-900 bg-zinc-900 text-white dark:border-white dark:bg-white dark:text-zinc-900",
|
|
2678
|
+
upcoming: "border-zinc-200 bg-white text-zinc-400 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-600"
|
|
2679
|
+
};
|
|
2680
|
+
var TEXT_TONE = {
|
|
2681
|
+
done: "text-zinc-900 dark:text-zinc-100",
|
|
2682
|
+
current: "text-zinc-900 dark:text-white",
|
|
2683
|
+
upcoming: "text-zinc-400 dark:text-zinc-600"
|
|
2684
|
+
};
|
|
2685
|
+
function HorizontalStepper({ steps, currentStep, className }) {
|
|
2686
|
+
return /* @__PURE__ */ jsx24("nav", { "aria-label": "Progress", className: cn("flex w-full items-start pb-8", className), children: steps.map((step, i) => {
|
|
2687
|
+
const tone = getTone(i, currentStep);
|
|
2688
|
+
return /* @__PURE__ */ jsxs20(React20.Fragment, { children: [
|
|
2689
|
+
/* @__PURE__ */ jsxs20("div", { className: "relative flex flex-col items-center", children: [
|
|
2690
|
+
/* @__PURE__ */ jsx24(
|
|
2691
|
+
"div",
|
|
2692
|
+
{
|
|
2693
|
+
"aria-current": tone === "current" ? "step" : void 0,
|
|
2694
|
+
className: cn(
|
|
2695
|
+
"z-10 flex h-10 w-10 items-center justify-center rounded-full border-2 text-sm font-bold shadow-sm transition-all duration-300",
|
|
2696
|
+
NODE_TONE[tone]
|
|
2697
|
+
),
|
|
2698
|
+
children: tone === "done" ? /* @__PURE__ */ jsx24(Check6, { size: 18, strokeWidth: 3 }) : /* @__PURE__ */ jsx24("span", { children: i + 1 })
|
|
2699
|
+
}
|
|
2700
|
+
),
|
|
2701
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute top-12 w-24 text-center", children: /* @__PURE__ */ jsx24("span", { className: cn("text-[10px] font-black uppercase tracking-tighter transition-colors duration-300", TEXT_TONE[tone]), children: step.title }) })
|
|
2702
|
+
] }),
|
|
2703
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx24("div", { className: "relative mx-2 mt-5 h-0.5 flex-1 shrink-0 rounded-full bg-zinc-100 dark:bg-zinc-800", children: /* @__PURE__ */ jsx24(
|
|
2704
|
+
motion.div,
|
|
2705
|
+
{
|
|
2706
|
+
initial: false,
|
|
2707
|
+
animate: { width: i < currentStep ? "100%" : "0%" },
|
|
2708
|
+
className: "absolute h-full rounded-full bg-zinc-900 dark:bg-white",
|
|
2709
|
+
transition: { duration: 0.5, ease: "easeInOut" }
|
|
2710
|
+
}
|
|
2711
|
+
) })
|
|
2712
|
+
] }, i);
|
|
2713
|
+
}) });
|
|
2714
|
+
}
|
|
2715
|
+
function VerticalStepper({ steps, currentStep, className }) {
|
|
2716
|
+
return /* @__PURE__ */ jsx24("nav", { "aria-label": "Progress", className: cn("space-y-0", className), children: steps.map((step, i) => {
|
|
2717
|
+
const tone = getTone(i, currentStep);
|
|
2718
|
+
return /* @__PURE__ */ jsxs20("div", { className: "relative pl-10 pb-10 last:pb-0", children: [
|
|
2719
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx24("div", { className: "absolute left-[15px] top-8 bottom-0 w-0.5 rounded-full bg-zinc-100 dark:bg-zinc-800", children: /* @__PURE__ */ jsx24(
|
|
2720
|
+
motion.div,
|
|
2721
|
+
{
|
|
2722
|
+
initial: false,
|
|
2723
|
+
animate: { height: i < currentStep ? "100%" : "0%" },
|
|
2724
|
+
className: "w-full rounded-full bg-zinc-900 dark:bg-white",
|
|
2725
|
+
transition: { duration: 0.4 }
|
|
2726
|
+
}
|
|
2727
|
+
) }),
|
|
2728
|
+
/* @__PURE__ */ jsx24(
|
|
2729
|
+
motion.div,
|
|
2730
|
+
{
|
|
2731
|
+
"aria-current": tone === "current" ? "step" : void 0,
|
|
2732
|
+
animate: { scale: tone === "current" ? 1.15 : 1 },
|
|
2733
|
+
className: cn(
|
|
2734
|
+
"absolute left-0 top-0 z-10 flex h-8 w-8 items-center justify-center rounded-full border-2 transition-all duration-300",
|
|
2735
|
+
tone === "done" || tone === "current" ? "border-zinc-900 bg-zinc-900 dark:border-white dark:bg-white" : "border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-950"
|
|
2736
|
+
),
|
|
2737
|
+
children: tone === "done" ? /* @__PURE__ */ jsx24(Check6, { size: 14, strokeWidth: 3, className: "text-white dark:text-zinc-900" }) : /* @__PURE__ */ jsx24("div", { className: cn("h-1.5 w-1.5 rounded-full", tone === "current" ? "bg-white dark:bg-zinc-900" : "bg-zinc-300 dark:bg-zinc-700") })
|
|
2738
|
+
}
|
|
2739
|
+
),
|
|
2740
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col", children: [
|
|
2741
|
+
/* @__PURE__ */ jsx24("h6", { className: cn("text-sm font-bold tracking-tight transition-colors duration-300", TEXT_TONE[tone]), children: step.title }),
|
|
2742
|
+
/* @__PURE__ */ jsx24("p", { className: "mt-1 text-xs leading-tight text-zinc-500 dark:text-zinc-400", children: step.description })
|
|
2743
|
+
] })
|
|
2744
|
+
] }, i);
|
|
2745
|
+
}) });
|
|
2746
|
+
}
|
|
2747
|
+
function ProgressStepper({ steps, currentStep }) {
|
|
2748
|
+
const progress = (currentStep + 1) / steps.length * 100;
|
|
2749
|
+
return /* @__PURE__ */ jsxs20("div", { className: "w-full space-y-4", children: [
|
|
2750
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-end justify-between", children: [
|
|
2751
|
+
/* @__PURE__ */ jsx24("div", { className: "flex items-baseline gap-2", children: /* @__PURE__ */ jsxs20("span", { className: "text-lg font-black tracking-tighter text-zinc-900 dark:text-white", children: [
|
|
2752
|
+
Math.round(progress),
|
|
2753
|
+
"%"
|
|
2754
|
+
] }) }),
|
|
2755
|
+
/* @__PURE__ */ jsx24("div", { className: "flex gap-1", children: steps.map((_, i) => /* @__PURE__ */ jsx24(
|
|
2756
|
+
motion.div,
|
|
2757
|
+
{
|
|
2758
|
+
animate: { opacity: i <= currentStep ? 1 : 0.2 },
|
|
2759
|
+
className: "h-1 w-4 rounded-full bg-zinc-900 dark:bg-white"
|
|
2760
|
+
},
|
|
2761
|
+
i
|
|
2762
|
+
)) })
|
|
2763
|
+
] }),
|
|
2764
|
+
/* @__PURE__ */ jsx24("div", { className: "h-3 w-full overflow-hidden rounded-full bg-zinc-100 p-1 dark:bg-zinc-800", children: /* @__PURE__ */ jsx24(
|
|
2765
|
+
motion.div,
|
|
2766
|
+
{
|
|
2767
|
+
initial: false,
|
|
2768
|
+
animate: { width: `${progress}%` },
|
|
2769
|
+
className: "h-full rounded-full bg-zinc-900 dark:bg-white",
|
|
2770
|
+
transition: { type: "spring", bounce: 0, duration: 0.8 }
|
|
2771
|
+
}
|
|
2772
|
+
) })
|
|
2773
|
+
] });
|
|
2774
|
+
}
|
|
2775
|
+
function DotStepper({ steps, currentStep }) {
|
|
2776
|
+
return /* @__PURE__ */ jsx24("div", { className: "flex items-center gap-3 rounded-full border border-zinc-200 bg-white p-4 dark:border-zinc-800 dark:bg-zinc-950", children: steps.map((_, i) => {
|
|
2777
|
+
const tone = getTone(i, currentStep);
|
|
2778
|
+
return /* @__PURE__ */ jsx24(
|
|
2779
|
+
motion.div,
|
|
2780
|
+
{
|
|
2781
|
+
animate: { width: tone === "current" ? 40 : 12 },
|
|
2782
|
+
className: cn(
|
|
2783
|
+
"h-3 rounded-full transition-colors duration-300",
|
|
2784
|
+
tone === "done" || tone === "current" ? "bg-zinc-900 dark:bg-white" : "bg-zinc-200 dark:bg-zinc-800"
|
|
2785
|
+
),
|
|
2786
|
+
transition: { type: "spring", stiffness: 300, damping: 20 }
|
|
2787
|
+
},
|
|
2788
|
+
i
|
|
2789
|
+
);
|
|
2790
|
+
}) });
|
|
2791
|
+
}
|
|
2792
|
+
function SegmentedStepper({ steps, currentStep }) {
|
|
2793
|
+
return /* @__PURE__ */ jsx24("div", { className: "flex w-full gap-1", children: steps.map((_, i) => /* @__PURE__ */ jsx24("div", { className: "h-2 flex-1 overflow-hidden rounded-sm bg-zinc-100 dark:bg-zinc-800", children: /* @__PURE__ */ jsx24(
|
|
2794
|
+
motion.div,
|
|
2795
|
+
{
|
|
2796
|
+
initial: false,
|
|
2797
|
+
animate: { x: i <= currentStep ? "0%" : "-100%" },
|
|
2798
|
+
className: "h-full bg-zinc-900 dark:bg-white",
|
|
2799
|
+
transition: { duration: 0.6 }
|
|
2800
|
+
}
|
|
2801
|
+
) }, i)) });
|
|
2802
|
+
}
|
|
2803
|
+
function BreadcrumbStepper({ steps, currentStep }) {
|
|
2804
|
+
return /* @__PURE__ */ jsx24("nav", { "aria-label": "Progress", className: "w-full", children: /* @__PURE__ */ jsx24("div", { className: "flex w-full items-center gap-2", children: steps.map((step, i) => {
|
|
2805
|
+
const tone = getTone(i, currentStep);
|
|
2806
|
+
return /* @__PURE__ */ jsxs20(
|
|
2807
|
+
"div",
|
|
2808
|
+
{
|
|
2809
|
+
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
2810
|
+
children: [
|
|
2811
|
+
/* @__PURE__ */ jsx24(
|
|
2812
|
+
motion.div,
|
|
2813
|
+
{
|
|
2814
|
+
animate: {
|
|
2815
|
+
opacity: tone === "upcoming" ? 0.45 : 1,
|
|
2816
|
+
scale: tone === "current" ? 1 : 0.98
|
|
2817
|
+
},
|
|
2818
|
+
transition: { duration: 0.25 },
|
|
2819
|
+
className: cn(
|
|
2820
|
+
"flex min-w-0 flex-1 items-center justify-center rounded-full px-2 py-2 text-[9px] font-bold uppercase tracking-wide transition-all duration-300",
|
|
2821
|
+
tone === "current" && "bg-zinc-900 text-white shadow-sm dark:bg-white dark:text-zinc-900",
|
|
2822
|
+
tone === "done" && "bg-zinc-100 text-zinc-900 dark:bg-zinc-800 dark:text-white",
|
|
2823
|
+
tone === "upcoming" && "text-zinc-400 dark:text-zinc-600"
|
|
2824
|
+
),
|
|
2825
|
+
children: /* @__PURE__ */ jsx24("span", { className: "whitespace-nowrap", children: step.title })
|
|
2826
|
+
}
|
|
2827
|
+
),
|
|
2828
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx24(
|
|
2829
|
+
"span",
|
|
2830
|
+
{
|
|
2831
|
+
"aria-hidden": "true",
|
|
2832
|
+
className: "h-px w-4 shrink-0 bg-zinc-200 dark:bg-zinc-800"
|
|
2833
|
+
}
|
|
2834
|
+
)
|
|
2835
|
+
]
|
|
2836
|
+
},
|
|
2837
|
+
i
|
|
2838
|
+
);
|
|
2839
|
+
}) }) });
|
|
2840
|
+
}
|
|
2841
|
+
function TimelineStepper({ steps, currentStep }) {
|
|
2842
|
+
return /* @__PURE__ */ jsx24("nav", { "aria-label": "Progress", className: "space-y-12", children: steps.map((step, i) => {
|
|
2843
|
+
const tone = getTone(i, currentStep);
|
|
2844
|
+
return /* @__PURE__ */ jsxs20("div", { className: "relative flex gap-8", children: [
|
|
2845
|
+
i < steps.length - 1 && /* @__PURE__ */ jsx24("div", { className: cn("absolute left-5 top-10 -bottom-12 w-0.5 transition-colors duration-1000", i < currentStep ? "bg-zinc-900 dark:bg-white" : "bg-zinc-100 dark:bg-zinc-800") }),
|
|
2846
|
+
/* @__PURE__ */ jsx24(
|
|
2847
|
+
motion.div,
|
|
2848
|
+
{
|
|
2849
|
+
animate: { scale: tone === "current" ? 1.2 : 1 },
|
|
2850
|
+
className: cn(
|
|
2851
|
+
"z-10 flex h-10 w-10 shrink-0 items-center justify-center rounded-full border-4 border-white shadow-xl ring-2 transition-all duration-300 dark:border-zinc-950",
|
|
2852
|
+
tone === "done" || tone === "current" ? "bg-zinc-900 ring-zinc-900 dark:bg-white dark:ring-white" : "bg-white ring-zinc-200 dark:bg-zinc-950 dark:ring-zinc-800"
|
|
2853
|
+
),
|
|
2854
|
+
children: tone === "done" ? /* @__PURE__ */ jsx24(Check6, { size: 16, strokeWidth: 3, className: "text-white dark:text-zinc-900" }) : /* @__PURE__ */ jsx24("span", { className: cn("text-xs font-bold", tone === "current" ? "text-white dark:text-zinc-900" : "text-zinc-400"), children: i + 1 })
|
|
2855
|
+
}
|
|
2856
|
+
),
|
|
2857
|
+
/* @__PURE__ */ jsxs20("div", { className: cn("transition-all duration-500", tone === "upcoming" ? "translate-x-4 opacity-20" : "translate-x-0 opacity-100"), children: [
|
|
2858
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-sm font-black uppercase tracking-tighter text-zinc-900 dark:text-white", children: step.title }),
|
|
2859
|
+
/* @__PURE__ */ jsx24("p", { className: "mt-1 text-xs text-zinc-500 dark:text-zinc-400", children: step.description })
|
|
2860
|
+
] })
|
|
2861
|
+
] }, i);
|
|
2862
|
+
}) });
|
|
2863
|
+
}
|
|
2864
|
+
function InteractiveStepper({ steps, currentStep, onStepClick }) {
|
|
2865
|
+
return /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-4", children: steps.map((step, i) => {
|
|
2866
|
+
const tone = getTone(i, currentStep);
|
|
2867
|
+
return /* @__PURE__ */ jsxs20(
|
|
2868
|
+
"button",
|
|
2869
|
+
{
|
|
2870
|
+
onClick: () => onStepClick == null ? void 0 : onStepClick(i),
|
|
2871
|
+
className: cn(
|
|
2872
|
+
"group relative flex min-w-44 flex-1 flex-col gap-2 rounded-2xl border-2 p-6 text-left transition-all duration-300",
|
|
2873
|
+
tone === "current" ? "border-zinc-900 bg-zinc-900 text-white dark:border-white dark:bg-white dark:text-zinc-900" : "border-zinc-100 hover:border-zinc-900 dark:border-zinc-800 dark:hover:border-white"
|
|
2874
|
+
),
|
|
2875
|
+
children: [
|
|
2876
|
+
/* @__PURE__ */ jsxs20("span", { className: cn("text-[10px] font-bold uppercase tracking-widest", tone === "current" ? "text-zinc-400" : "text-zinc-400 group-hover:text-zinc-900 dark:group-hover:text-zinc-200"), children: [
|
|
2877
|
+
"Phase 0",
|
|
2878
|
+
i + 1
|
|
2879
|
+
] }),
|
|
2880
|
+
/* @__PURE__ */ jsx24("span", { className: "text-sm font-black", children: step.title }),
|
|
2881
|
+
tone === "done" && /* @__PURE__ */ jsx24(motion.div, { layoutId: "inter-check", className: "absolute -right-2 -top-2 rounded-full bg-zinc-900 p-1 text-white shadow-lg dark:bg-white dark:text-zinc-900", children: /* @__PURE__ */ jsx24(Check6, { size: 14, strokeWidth: 3 }) })
|
|
2882
|
+
]
|
|
2883
|
+
},
|
|
2884
|
+
i
|
|
2885
|
+
);
|
|
2886
|
+
}) });
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
// components/ui/switch.tsx
|
|
2890
|
+
import * as React21 from "react";
|
|
2891
|
+
import { cva as cva12 } from "class-variance-authority";
|
|
2892
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2893
|
+
var switchTrackVariants = cva12(
|
|
2894
|
+
[
|
|
2895
|
+
"relative inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-200",
|
|
2896
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-900/20 focus-visible:ring-offset-2 focus-visible:ring-offset-white",
|
|
2897
|
+
"dark:focus-visible:ring-zinc-100/20 dark:focus-visible:ring-offset-zinc-950",
|
|
2898
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
2899
|
+
"data-[state=checked]:bg-zinc-900 data-[state=unchecked]:bg-zinc-200",
|
|
2900
|
+
"dark:data-[state=checked]:bg-zinc-100 dark:data-[state=unchecked]:bg-zinc-700",
|
|
2901
|
+
"hover:data-[state=unchecked]:bg-zinc-300 dark:hover:data-[state=unchecked]:bg-zinc-600",
|
|
2902
|
+
"hover:data-[state=checked]:bg-zinc-800 dark:hover:data-[state=checked]:bg-zinc-200"
|
|
2903
|
+
],
|
|
2904
|
+
{
|
|
2905
|
+
variants: {
|
|
2906
|
+
size: {
|
|
2907
|
+
sm: "h-5 w-9",
|
|
2908
|
+
md: "h-6 w-11",
|
|
2909
|
+
lg: "h-7 w-[3.25rem]"
|
|
2910
|
+
}
|
|
2911
|
+
},
|
|
2912
|
+
defaultVariants: { size: "md" }
|
|
2913
|
+
}
|
|
2914
|
+
);
|
|
2915
|
+
var switchThumbVariants = cva12(
|
|
2916
|
+
"pointer-events-none absolute left-0.5 top-1/2 block -translate-y-1/2 rounded-full bg-white shadow-sm transition-transform duration-200 dark:bg-zinc-950",
|
|
2917
|
+
{
|
|
2918
|
+
variants: {
|
|
2919
|
+
size: {
|
|
2920
|
+
sm: "h-3.5 w-3.5 data-[state=checked]:translate-x-4",
|
|
2921
|
+
md: "h-4 w-4 data-[state=checked]:translate-x-5",
|
|
2922
|
+
lg: "h-5 w-5 data-[state=checked]:translate-x-6"
|
|
2923
|
+
}
|
|
2924
|
+
},
|
|
2925
|
+
defaultVariants: { size: "md" }
|
|
2926
|
+
}
|
|
2927
|
+
);
|
|
2928
|
+
var Switch = React21.forwardRef(
|
|
2929
|
+
(_a, ref) => {
|
|
2930
|
+
var _b = _a, {
|
|
2931
|
+
className,
|
|
2932
|
+
size,
|
|
2933
|
+
checked,
|
|
2934
|
+
defaultChecked = false,
|
|
2935
|
+
onCheckedChange,
|
|
2936
|
+
disabled,
|
|
2937
|
+
label,
|
|
2938
|
+
description,
|
|
2939
|
+
id,
|
|
2940
|
+
onClick
|
|
2941
|
+
} = _b, props = __objRest(_b, [
|
|
2942
|
+
"className",
|
|
2943
|
+
"size",
|
|
2944
|
+
"checked",
|
|
2945
|
+
"defaultChecked",
|
|
2946
|
+
"onCheckedChange",
|
|
2947
|
+
"disabled",
|
|
2948
|
+
"label",
|
|
2949
|
+
"description",
|
|
2950
|
+
"id",
|
|
2951
|
+
"onClick"
|
|
2952
|
+
]);
|
|
2953
|
+
const generatedId = React21.useId();
|
|
2954
|
+
const switchId = id != null ? id : generatedId;
|
|
2955
|
+
const isControlled = checked !== void 0;
|
|
2956
|
+
const [uncontrolledChecked, setUncontrolledChecked] = React21.useState(defaultChecked);
|
|
2957
|
+
const isChecked = isControlled ? checked : uncontrolledChecked;
|
|
2958
|
+
const state = isChecked ? "checked" : "unchecked";
|
|
2959
|
+
const toggle = () => {
|
|
2960
|
+
if (disabled) return;
|
|
2961
|
+
const next = !isChecked;
|
|
2962
|
+
if (!isControlled) setUncontrolledChecked(next);
|
|
2963
|
+
onCheckedChange == null ? void 0 : onCheckedChange(next);
|
|
2964
|
+
};
|
|
2965
|
+
const switchControl = /* @__PURE__ */ jsx25(
|
|
2966
|
+
"button",
|
|
2967
|
+
__spreadProps(__spreadValues({
|
|
2968
|
+
ref,
|
|
2969
|
+
id: switchId,
|
|
2970
|
+
type: "button",
|
|
2971
|
+
role: "switch",
|
|
2972
|
+
"aria-checked": isChecked,
|
|
2973
|
+
"aria-labelledby": label ? `${switchId}-label` : void 0,
|
|
2974
|
+
"aria-describedby": description ? `${switchId}-description` : void 0,
|
|
2975
|
+
disabled,
|
|
2976
|
+
"data-state": state,
|
|
2977
|
+
className: cn(switchTrackVariants({ size }), className),
|
|
2978
|
+
onClick: (event) => {
|
|
2979
|
+
toggle();
|
|
2980
|
+
onClick == null ? void 0 : onClick(event);
|
|
2981
|
+
},
|
|
2982
|
+
onKeyDown: (event) => {
|
|
2983
|
+
if (event.key === " ") {
|
|
2984
|
+
event.preventDefault();
|
|
2985
|
+
toggle();
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
}, props), {
|
|
2989
|
+
children: /* @__PURE__ */ jsx25("span", { "data-state": state, className: switchThumbVariants({ size }) })
|
|
2990
|
+
})
|
|
2991
|
+
);
|
|
2992
|
+
if (!label && !description) {
|
|
2993
|
+
return switchControl;
|
|
2994
|
+
}
|
|
2995
|
+
return /* @__PURE__ */ jsxs21(
|
|
2996
|
+
"div",
|
|
2997
|
+
{
|
|
2998
|
+
className: cn(
|
|
2999
|
+
"flex items-start justify-between gap-4",
|
|
3000
|
+
disabled && "opacity-60"
|
|
3001
|
+
),
|
|
3002
|
+
children: [
|
|
3003
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
3004
|
+
label && /* @__PURE__ */ jsx25(
|
|
3005
|
+
"label",
|
|
3006
|
+
{
|
|
3007
|
+
id: `${switchId}-label`,
|
|
3008
|
+
htmlFor: switchId,
|
|
3009
|
+
className: cn(
|
|
3010
|
+
"text-sm font-medium leading-snug text-zinc-800 dark:text-zinc-100",
|
|
3011
|
+
!disabled && "cursor-pointer"
|
|
3012
|
+
),
|
|
3013
|
+
children: label
|
|
3014
|
+
}
|
|
3015
|
+
),
|
|
3016
|
+
description && /* @__PURE__ */ jsx25(
|
|
3017
|
+
"p",
|
|
3018
|
+
{
|
|
3019
|
+
id: `${switchId}-description`,
|
|
3020
|
+
className: "text-xs leading-relaxed text-zinc-500 dark:text-zinc-400",
|
|
3021
|
+
children: description
|
|
3022
|
+
}
|
|
3023
|
+
)
|
|
3024
|
+
] }),
|
|
3025
|
+
switchControl
|
|
3026
|
+
]
|
|
3027
|
+
}
|
|
3028
|
+
);
|
|
3029
|
+
}
|
|
3030
|
+
);
|
|
3031
|
+
Switch.displayName = "Switch";
|
|
3032
|
+
|
|
3033
|
+
// components/ui/tabs.tsx
|
|
3034
|
+
import React22, { createContext as createContext5, useContext as useContext5, useState as useState12 } from "react";
|
|
3035
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3036
|
+
var TabsContext = createContext5(null);
|
|
3037
|
+
function useTabs() {
|
|
3038
|
+
const context = useContext5(TabsContext);
|
|
3039
|
+
if (!context) return { activeTab: "", setActiveTab: () => {
|
|
3040
|
+
}, variant: "", uid: "" };
|
|
3041
|
+
return context;
|
|
3042
|
+
}
|
|
3043
|
+
function Tabs({
|
|
3044
|
+
children,
|
|
3045
|
+
defaultValue,
|
|
3046
|
+
variant = "underline",
|
|
3047
|
+
className
|
|
3048
|
+
}) {
|
|
3049
|
+
const [activeTab, setActiveTab] = useState12(defaultValue);
|
|
3050
|
+
const uid = React22.useId();
|
|
3051
|
+
return /* @__PURE__ */ jsx26(TabsContext.Provider, { value: { activeTab, setActiveTab, variant, uid }, children: /* @__PURE__ */ jsx26("div", { className: cn(variant === "vertical" ? "flex gap-8" : "flex flex-col gap-4", className), children }) });
|
|
3052
|
+
}
|
|
3053
|
+
function TabsList({ children, className }) {
|
|
3054
|
+
const { variant } = useTabs();
|
|
3055
|
+
const variantStyles = {
|
|
3056
|
+
underline: "flex min-w-0 gap-4 overflow-x-auto border-b border-zinc-200 dark:border-zinc-800 sm:gap-8 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
3057
|
+
pill: "flex min-w-0 flex-wrap gap-2",
|
|
3058
|
+
segmented: "inline-flex max-w-full flex-wrap p-1 bg-zinc-100 dark:bg-zinc-900 rounded-xl gap-1",
|
|
3059
|
+
bordered: "flex min-w-0 flex-wrap gap-3",
|
|
3060
|
+
filled: "flex min-w-0 flex-wrap gap-1 bg-zinc-50 dark:bg-zinc-900/50 p-1.5 rounded-lg",
|
|
3061
|
+
icon: "flex min-w-0 flex-wrap gap-6 sm:gap-10",
|
|
3062
|
+
vertical: "flex flex-col border-l border-zinc-100 dark:border-zinc-800",
|
|
3063
|
+
floating: "inline-flex max-w-full flex-wrap bg-white dark:bg-zinc-950 shadow-xl border border-zinc-100 dark:border-zinc-800 p-2 rounded-2xl gap-2",
|
|
3064
|
+
scrollable: "flex min-w-0 gap-6 overflow-x-auto pb-2 docs-scrollbar whitespace-nowrap",
|
|
3065
|
+
card: "flex min-w-0 gap-1 overflow-x-auto border-b border-zinc-100 dark:border-zinc-800 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
3066
|
+
};
|
|
3067
|
+
return /* @__PURE__ */ jsx26(
|
|
3068
|
+
"div",
|
|
3069
|
+
{
|
|
3070
|
+
role: "tablist",
|
|
3071
|
+
"aria-orientation": variant === "vertical" ? "vertical" : "horizontal",
|
|
3072
|
+
className: cn(variantStyles[variant], className),
|
|
3073
|
+
children
|
|
3074
|
+
}
|
|
3075
|
+
);
|
|
3076
|
+
}
|
|
3077
|
+
function TabsTrigger({
|
|
3078
|
+
value,
|
|
3079
|
+
label,
|
|
3080
|
+
icon: Icon,
|
|
3081
|
+
badge,
|
|
3082
|
+
className
|
|
3083
|
+
}) {
|
|
3084
|
+
const { activeTab, setActiveTab, variant, uid } = useTabs();
|
|
3085
|
+
const isActive = activeTab === value;
|
|
3086
|
+
const triggerStyles = {
|
|
3087
|
+
underline: cn(
|
|
3088
|
+
"relative pb-3 text-sm font-medium transition-all",
|
|
3089
|
+
isActive ? "text-zinc-900 dark:text-white" : "text-zinc-500 hover:text-zinc-900 dark:hover:text-zinc-100"
|
|
3090
|
+
),
|
|
3091
|
+
pill: cn(
|
|
3092
|
+
"px-4 py-2 rounded-full text-sm font-semibold transition-all",
|
|
3093
|
+
isActive ? "bg-zinc-900 text-white dark:bg-white dark:text-zinc-900 shadow-lg" : "bg-white dark:bg-zinc-900 text-zinc-600 border border-zinc-100 dark:border-zinc-800 hover:bg-zinc-50"
|
|
3094
|
+
),
|
|
3095
|
+
segmented: cn(
|
|
3096
|
+
"px-6 py-1.5 rounded-lg text-xs font-bold transition-all",
|
|
3097
|
+
isActive ? "bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white shadow-sm" : "text-zinc-500 hover:text-zinc-700"
|
|
3098
|
+
),
|
|
3099
|
+
bordered: cn(
|
|
3100
|
+
"px-4 py-2 rounded-lg border-2 text-sm font-bold transition-all",
|
|
3101
|
+
isActive ? "border-zinc-900 text-zinc-900 dark:border-white dark:text-white" : "border-transparent text-zinc-400 hover:border-zinc-200"
|
|
3102
|
+
),
|
|
3103
|
+
filled: cn(
|
|
3104
|
+
"px-4 py-2 rounded-md text-sm font-medium transition-all",
|
|
3105
|
+
isActive ? "bg-zinc-900 text-white dark:bg-white dark:text-zinc-900" : "text-zinc-500 hover:text-zinc-800 dark:hover:text-zinc-200"
|
|
3106
|
+
),
|
|
3107
|
+
card: cn(
|
|
3108
|
+
"relative shrink-0 px-4 py-2.5 text-sm font-medium transition-all",
|
|
3109
|
+
isActive ? "text-zinc-900 dark:text-white" : "text-zinc-500 hover:text-zinc-800 dark:hover:text-zinc-200"
|
|
3110
|
+
),
|
|
3111
|
+
icon: cn(
|
|
3112
|
+
"flex flex-col items-center gap-1.5 transition-all",
|
|
3113
|
+
isActive ? "text-zinc-900 dark:text-white" : "text-zinc-400 hover:text-zinc-700"
|
|
3114
|
+
),
|
|
3115
|
+
vertical: cn(
|
|
3116
|
+
"pl-6 pr-12 py-2 text-sm font-medium border-l-2 -ml-[2px] transition-all",
|
|
3117
|
+
isActive ? "border-zinc-900 text-zinc-900 dark:border-white dark:text-white bg-zinc-50 dark:bg-zinc-900" : "border-transparent text-zinc-500 hover:text-zinc-800"
|
|
3118
|
+
),
|
|
3119
|
+
floating: cn(
|
|
3120
|
+
"px-4 py-2 rounded-xl text-sm font-medium transition-all",
|
|
3121
|
+
isActive ? "bg-zinc-900 text-white dark:bg-white dark:text-zinc-900" : "text-zinc-500 hover:bg-zinc-50"
|
|
3122
|
+
)
|
|
3123
|
+
};
|
|
3124
|
+
return /* @__PURE__ */ jsxs22(
|
|
3125
|
+
"button",
|
|
3126
|
+
{
|
|
3127
|
+
type: "button",
|
|
3128
|
+
role: "tab",
|
|
3129
|
+
id: `${uid}-tab-${value}`,
|
|
3130
|
+
"aria-selected": isActive,
|
|
3131
|
+
"aria-controls": `${uid}-panel-${value}`,
|
|
3132
|
+
tabIndex: isActive ? 0 : -1,
|
|
3133
|
+
onClick: () => setActiveTab(value),
|
|
3134
|
+
className: cn("shrink-0 outline-none", triggerStyles[variant] || triggerStyles["underline"], className),
|
|
3135
|
+
children: [
|
|
3136
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
|
|
3137
|
+
Icon && /* @__PURE__ */ jsx26(Icon, { size: variant === "icon" ? 20 : 16 }),
|
|
3138
|
+
/* @__PURE__ */ jsx26("span", { children: label }),
|
|
3139
|
+
badge && /* @__PURE__ */ jsx26("span", { className: cn("flex h-4 w-4 items-center justify-center rounded-full text-[10px] text-white", isActive ? "bg-zinc-800 dark:bg-zinc-700" : "bg-red-500"), children: badge })
|
|
3140
|
+
] }),
|
|
3141
|
+
variant === "underline" && isActive && /* @__PURE__ */ jsx26("div", { className: "absolute bottom-0 left-0 h-[2.5px] w-full bg-zinc-900 dark:bg-white rounded-full animate-in fade-in" })
|
|
3142
|
+
]
|
|
3143
|
+
}
|
|
3144
|
+
);
|
|
3145
|
+
}
|
|
3146
|
+
function TabsContent({ value, children, className }) {
|
|
3147
|
+
const { activeTab, uid } = useTabs();
|
|
3148
|
+
if (activeTab !== value) return null;
|
|
3149
|
+
return /* @__PURE__ */ jsx26(
|
|
3150
|
+
"div",
|
|
3151
|
+
{
|
|
3152
|
+
role: "tabpanel",
|
|
3153
|
+
id: `${uid}-panel-${value}`,
|
|
3154
|
+
"aria-labelledby": `${uid}-tab-${value}`,
|
|
3155
|
+
tabIndex: 0,
|
|
3156
|
+
className: cn("outline-none animate-in fade-in slide-in-from-bottom-2 duration-300", className),
|
|
3157
|
+
children
|
|
3158
|
+
}
|
|
3159
|
+
);
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
// components/ui/tooltip.tsx
|
|
3163
|
+
import * as React23 from "react";
|
|
3164
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
3165
|
+
import { cva as cva13 } from "class-variance-authority";
|
|
3166
|
+
import { Fragment as Fragment2, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3167
|
+
var tooltipVariants = cva13(
|
|
3168
|
+
[
|
|
3169
|
+
"pointer-events-none fixed z-50 max-w-[260px] rounded-lg px-3 py-2",
|
|
3170
|
+
"text-[13px] font-medium leading-normal tracking-tight",
|
|
3171
|
+
"bg-zinc-900 text-zinc-50",
|
|
3172
|
+
"shadow-[0_4px_16px_rgba(0,0,0,0.14),0_0_0_1px_rgba(255,255,255,0.06)]",
|
|
3173
|
+
"dark:bg-zinc-100 dark:text-zinc-900",
|
|
3174
|
+
"dark:shadow-[0_4px_16px_rgba(0,0,0,0.35),0_0_0_1px_rgba(0,0,0,0.06)]",
|
|
3175
|
+
"transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
3176
|
+
"will-change-[opacity,transform]"
|
|
3177
|
+
],
|
|
3178
|
+
{
|
|
3179
|
+
variants: {
|
|
3180
|
+
visible: {
|
|
3181
|
+
true: "opacity-100 scale-100",
|
|
3182
|
+
false: "opacity-0 scale-[0.97]"
|
|
3183
|
+
},
|
|
3184
|
+
side: {
|
|
3185
|
+
top: "origin-bottom",
|
|
3186
|
+
bottom: "origin-top",
|
|
3187
|
+
left: "origin-right",
|
|
3188
|
+
right: "origin-left"
|
|
3189
|
+
}
|
|
3190
|
+
},
|
|
3191
|
+
defaultVariants: { visible: false, side: "top" }
|
|
3192
|
+
}
|
|
3193
|
+
);
|
|
3194
|
+
var VIEWPORT_PADDING = 10;
|
|
3195
|
+
var ARROW_SIZE = 6;
|
|
3196
|
+
function getTooltipPosition(triggerRect, tooltipRect, side, align, sideOffset) {
|
|
3197
|
+
const offset = sideOffset + ARROW_SIZE;
|
|
3198
|
+
let top = 0;
|
|
3199
|
+
let left = 0;
|
|
3200
|
+
if (side === "top") {
|
|
3201
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
3202
|
+
left = alignTooltipHorizontal(triggerRect, tooltipRect, align);
|
|
3203
|
+
} else if (side === "bottom") {
|
|
3204
|
+
top = triggerRect.bottom + offset;
|
|
3205
|
+
left = alignTooltipHorizontal(triggerRect, tooltipRect, align);
|
|
3206
|
+
} else if (side === "left") {
|
|
3207
|
+
top = alignTooltipVertical(triggerRect, tooltipRect, align);
|
|
3208
|
+
left = triggerRect.left - tooltipRect.width - offset;
|
|
3209
|
+
} else {
|
|
3210
|
+
top = alignTooltipVertical(triggerRect, tooltipRect, align);
|
|
3211
|
+
left = triggerRect.right + offset;
|
|
3212
|
+
}
|
|
3213
|
+
const maxLeft = window.innerWidth - tooltipRect.width - VIEWPORT_PADDING;
|
|
3214
|
+
const maxTop = window.innerHeight - tooltipRect.height - VIEWPORT_PADDING;
|
|
3215
|
+
return {
|
|
3216
|
+
top: Math.min(Math.max(top, VIEWPORT_PADDING), maxTop),
|
|
3217
|
+
left: Math.min(Math.max(left, VIEWPORT_PADDING), maxLeft)
|
|
3218
|
+
};
|
|
3219
|
+
}
|
|
3220
|
+
function alignTooltipHorizontal(triggerRect, tooltipRect, align) {
|
|
3221
|
+
if (align === "start") return triggerRect.left;
|
|
3222
|
+
if (align === "end") return triggerRect.right - tooltipRect.width;
|
|
3223
|
+
return triggerRect.left + triggerRect.width / 2 - tooltipRect.width / 2;
|
|
3224
|
+
}
|
|
3225
|
+
function alignTooltipVertical(triggerRect, tooltipRect, align) {
|
|
3226
|
+
if (align === "start") return triggerRect.top;
|
|
3227
|
+
if (align === "end") return triggerRect.bottom - tooltipRect.height;
|
|
3228
|
+
return triggerRect.top + triggerRect.height / 2 - tooltipRect.height / 2;
|
|
3229
|
+
}
|
|
3230
|
+
function TooltipArrow({ side }) {
|
|
3231
|
+
const position = {
|
|
3232
|
+
top: "bottom-0 left-1/2 -translate-x-1/2 translate-y-[calc(100%-1px)]",
|
|
3233
|
+
bottom: "top-0 left-1/2 -translate-x-1/2 -translate-y-[calc(100%-1px)] rotate-180",
|
|
3234
|
+
left: "right-0 top-1/2 -translate-y-1/2 translate-x-[calc(100%-1px)] -rotate-90",
|
|
3235
|
+
right: "left-0 top-1/2 -translate-y-1/2 -translate-x-[calc(100%-1px)] rotate-90"
|
|
3236
|
+
}[side];
|
|
3237
|
+
return /* @__PURE__ */ jsx27(
|
|
3238
|
+
"svg",
|
|
3239
|
+
{
|
|
3240
|
+
"aria-hidden": true,
|
|
3241
|
+
width: "10",
|
|
3242
|
+
height: "5",
|
|
3243
|
+
viewBox: "0 0 10 5",
|
|
3244
|
+
className: cn(
|
|
3245
|
+
"absolute text-zinc-900 dark:text-zinc-100",
|
|
3246
|
+
position
|
|
3247
|
+
),
|
|
3248
|
+
children: /* @__PURE__ */ jsx27("path", { fill: "currentColor", d: "M0 0h10L5 5 0 0z" })
|
|
3249
|
+
}
|
|
3250
|
+
);
|
|
3251
|
+
}
|
|
3252
|
+
function Tooltip({
|
|
3253
|
+
content,
|
|
3254
|
+
children,
|
|
3255
|
+
side = "top",
|
|
3256
|
+
align = "center",
|
|
3257
|
+
sideOffset = 8,
|
|
3258
|
+
delayDuration = 250,
|
|
3259
|
+
disabled = false,
|
|
3260
|
+
className
|
|
3261
|
+
}) {
|
|
3262
|
+
const [open, setOpen] = React23.useState(false);
|
|
3263
|
+
const [visible, setVisible] = React23.useState(false);
|
|
3264
|
+
const [mounted, setMounted] = React23.useState(false);
|
|
3265
|
+
const [position, setPosition] = React23.useState({ top: -9999, left: -9999 });
|
|
3266
|
+
const timeoutRef = React23.useRef(null);
|
|
3267
|
+
const triggerRef = React23.useRef(null);
|
|
3268
|
+
const tooltipRef = React23.useRef(null);
|
|
3269
|
+
const id = React23.useId();
|
|
3270
|
+
React23.useEffect(() => setMounted(true), []);
|
|
3271
|
+
const clearTimer = () => {
|
|
3272
|
+
if (timeoutRef.current) {
|
|
3273
|
+
clearTimeout(timeoutRef.current);
|
|
3274
|
+
timeoutRef.current = null;
|
|
3275
|
+
}
|
|
3276
|
+
};
|
|
3277
|
+
const updatePosition = React23.useCallback(() => {
|
|
3278
|
+
const trigger2 = triggerRef.current;
|
|
3279
|
+
const tooltip = tooltipRef.current;
|
|
3280
|
+
if (!trigger2 || !tooltip) return;
|
|
3281
|
+
const triggerRect = trigger2.getBoundingClientRect();
|
|
3282
|
+
const tooltipRect = tooltip.getBoundingClientRect();
|
|
3283
|
+
setPosition(getTooltipPosition(triggerRect, tooltipRect, side, align, sideOffset));
|
|
3284
|
+
requestAnimationFrame(() => setVisible(true));
|
|
3285
|
+
}, [side, align, sideOffset]);
|
|
3286
|
+
const show = () => {
|
|
3287
|
+
if (disabled) return;
|
|
3288
|
+
clearTimer();
|
|
3289
|
+
timeoutRef.current = setTimeout(() => {
|
|
3290
|
+
setVisible(false);
|
|
3291
|
+
setOpen(true);
|
|
3292
|
+
}, delayDuration);
|
|
3293
|
+
};
|
|
3294
|
+
const hide = () => {
|
|
3295
|
+
clearTimer();
|
|
3296
|
+
setVisible(false);
|
|
3297
|
+
setOpen(false);
|
|
3298
|
+
};
|
|
3299
|
+
React23.useEffect(() => clearTimer, []);
|
|
3300
|
+
React23.useLayoutEffect(() => {
|
|
3301
|
+
if (!open) return;
|
|
3302
|
+
updatePosition();
|
|
3303
|
+
const handleUpdate = () => updatePosition();
|
|
3304
|
+
window.addEventListener("scroll", handleUpdate, true);
|
|
3305
|
+
window.addEventListener("resize", handleUpdate);
|
|
3306
|
+
return () => {
|
|
3307
|
+
window.removeEventListener("scroll", handleUpdate, true);
|
|
3308
|
+
window.removeEventListener("resize", handleUpdate);
|
|
3309
|
+
};
|
|
3310
|
+
}, [open, updatePosition, content]);
|
|
3311
|
+
const child = React23.Children.only(children);
|
|
3312
|
+
const trigger = React23.isValidElement(child) ? React23.cloneElement(
|
|
3313
|
+
child,
|
|
3314
|
+
{ "aria-describedby": open && visible ? id : void 0 }
|
|
3315
|
+
) : children;
|
|
3316
|
+
const tooltipNode = open ? /* @__PURE__ */ jsxs23(
|
|
3317
|
+
"div",
|
|
3318
|
+
{
|
|
3319
|
+
ref: tooltipRef,
|
|
3320
|
+
id,
|
|
3321
|
+
role: "tooltip",
|
|
3322
|
+
"aria-hidden": !visible,
|
|
3323
|
+
style: { top: position.top, left: position.left },
|
|
3324
|
+
className: cn(tooltipVariants({ visible, side }), className),
|
|
3325
|
+
children: [
|
|
3326
|
+
content,
|
|
3327
|
+
/* @__PURE__ */ jsx27(TooltipArrow, { side })
|
|
3328
|
+
]
|
|
3329
|
+
}
|
|
3330
|
+
) : null;
|
|
3331
|
+
return /* @__PURE__ */ jsxs23(Fragment2, { children: [
|
|
3332
|
+
/* @__PURE__ */ jsx27(
|
|
3333
|
+
"span",
|
|
3334
|
+
{
|
|
3335
|
+
ref: triggerRef,
|
|
3336
|
+
className: "inline-flex",
|
|
3337
|
+
onMouseEnter: show,
|
|
3338
|
+
onMouseLeave: hide,
|
|
3339
|
+
onFocus: show,
|
|
3340
|
+
onBlur: hide,
|
|
3341
|
+
children: trigger
|
|
3342
|
+
}
|
|
3343
|
+
),
|
|
3344
|
+
mounted && tooltipNode ? createPortal3(tooltipNode, document.body) : null
|
|
3345
|
+
] });
|
|
3346
|
+
}
|
|
3347
|
+
export {
|
|
3348
|
+
AILoader,
|
|
3349
|
+
Accordion,
|
|
3350
|
+
AccordionItem,
|
|
3351
|
+
AccordionLink,
|
|
3352
|
+
AccordionNested,
|
|
3353
|
+
AccordionSkeletonChevron,
|
|
3354
|
+
AccordionSkeletonPlus,
|
|
3355
|
+
Alert,
|
|
3356
|
+
Avatar,
|
|
3357
|
+
AvatarGroup,
|
|
3358
|
+
Badge,
|
|
3359
|
+
BlurReveal,
|
|
3360
|
+
BreadcrumbStepper,
|
|
3361
|
+
Button,
|
|
3362
|
+
Card,
|
|
3363
|
+
CardContent,
|
|
3364
|
+
CardDescription,
|
|
3365
|
+
CardFooter,
|
|
3366
|
+
CardHeader,
|
|
3367
|
+
CardSkeletonGrid,
|
|
3368
|
+
CardTitle,
|
|
3369
|
+
Checkbox,
|
|
3370
|
+
CodeBlock,
|
|
3371
|
+
DataTable,
|
|
3372
|
+
Dialog,
|
|
3373
|
+
DialogAction,
|
|
3374
|
+
DialogContent,
|
|
3375
|
+
DialogFooter,
|
|
3376
|
+
DialogHeader,
|
|
3377
|
+
DialogItem,
|
|
3378
|
+
DialogTrigger,
|
|
3379
|
+
DotStepper,
|
|
3380
|
+
DotWave,
|
|
3381
|
+
Dropdown,
|
|
3382
|
+
DropdownContent,
|
|
3383
|
+
DropdownDivider,
|
|
3384
|
+
DropdownItem,
|
|
3385
|
+
DropdownLabel,
|
|
3386
|
+
DropdownTrigger,
|
|
3387
|
+
ExpandableRow,
|
|
3388
|
+
FeatureCard,
|
|
3389
|
+
Field,
|
|
3390
|
+
HalfCircles,
|
|
3391
|
+
HorizontalStepper,
|
|
3392
|
+
Input,
|
|
3393
|
+
InputAddon,
|
|
3394
|
+
InputAutocomplete,
|
|
3395
|
+
InputFilled,
|
|
3396
|
+
InputFloating,
|
|
3397
|
+
InputIcon,
|
|
3398
|
+
InputOTP,
|
|
3399
|
+
InputPassword,
|
|
3400
|
+
InputSearch,
|
|
3401
|
+
InputStandard,
|
|
3402
|
+
InputUnderline,
|
|
3403
|
+
InteractiveStepper,
|
|
3404
|
+
Label,
|
|
3405
|
+
ListSkeleton,
|
|
3406
|
+
LoadBar,
|
|
3407
|
+
Menu,
|
|
3408
|
+
MenuDivider,
|
|
3409
|
+
MenuItem,
|
|
3410
|
+
MenuLabel,
|
|
3411
|
+
Modal,
|
|
3412
|
+
ModalBody,
|
|
3413
|
+
ModalClose,
|
|
3414
|
+
ModalContent,
|
|
3415
|
+
ModalDescription,
|
|
3416
|
+
ModalFooter,
|
|
3417
|
+
ModalHeader,
|
|
3418
|
+
ModalOption,
|
|
3419
|
+
ModalTitle,
|
|
3420
|
+
ModalTrigger,
|
|
3421
|
+
MorphingLoader,
|
|
3422
|
+
OrbitLoader,
|
|
3423
|
+
Pagination,
|
|
3424
|
+
Progress,
|
|
3425
|
+
ProgressBar,
|
|
3426
|
+
ProgressRing,
|
|
3427
|
+
ProgressStepper,
|
|
3428
|
+
PulseLoader,
|
|
3429
|
+
Radio,
|
|
3430
|
+
RadioGroup,
|
|
3431
|
+
SegmentedStepper,
|
|
3432
|
+
SkeletonShimmer,
|
|
3433
|
+
SpinnerDots,
|
|
3434
|
+
SpinnerGradient,
|
|
3435
|
+
SquaresLoader,
|
|
3436
|
+
Switch,
|
|
3437
|
+
Table,
|
|
3438
|
+
TableBody,
|
|
3439
|
+
TableCell,
|
|
3440
|
+
TableHead,
|
|
3441
|
+
TableHeader,
|
|
3442
|
+
TableRow,
|
|
3443
|
+
TableSkeleton,
|
|
3444
|
+
Tabs,
|
|
3445
|
+
TabsContent,
|
|
3446
|
+
TabsList,
|
|
3447
|
+
TabsTrigger,
|
|
3448
|
+
ThreeDots,
|
|
3449
|
+
TimelineStepper,
|
|
3450
|
+
Tooltip,
|
|
3451
|
+
TypingIndicator,
|
|
3452
|
+
VerticalStepper,
|
|
3453
|
+
avatarVariants,
|
|
3454
|
+
badgeVariants,
|
|
3455
|
+
buttonVariants,
|
|
3456
|
+
checkboxControlVariants,
|
|
3457
|
+
getGradientFromName,
|
|
3458
|
+
getInitials,
|
|
3459
|
+
inputVariants,
|
|
3460
|
+
labelVariants,
|
|
3461
|
+
menuItemVariants,
|
|
3462
|
+
menuVariants,
|
|
3463
|
+
modalContentVariants,
|
|
3464
|
+
overlayVariants,
|
|
3465
|
+
radioControlVariants
|
|
3466
|
+
};
|
|
3467
|
+
//# sourceMappingURL=index.mjs.map
|