@lsts_tech/ui 2.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +459 -0
- package/dist/index.css +1484 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +155 -0
- package/dist/index.d.ts +155 -0
- package/dist/index.js +1041 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +970 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +90 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
Alert: () => Alert,
|
|
35
|
+
AlertDescription: () => AlertDescription,
|
|
36
|
+
AlertTitle: () => AlertTitle,
|
|
37
|
+
Avatar: () => Avatar,
|
|
38
|
+
AvatarFallback: () => AvatarFallback,
|
|
39
|
+
AvatarImage: () => AvatarImage,
|
|
40
|
+
Badge: () => Badge,
|
|
41
|
+
BrandProvider: () => BrandProvider,
|
|
42
|
+
BrandSwitcher: () => BrandSwitcher,
|
|
43
|
+
Button: () => Button,
|
|
44
|
+
Card: () => Card,
|
|
45
|
+
CardContent: () => CardContent,
|
|
46
|
+
CardDescription: () => CardDescription,
|
|
47
|
+
CardFooter: () => CardFooter,
|
|
48
|
+
CardHeader: () => CardHeader,
|
|
49
|
+
CardTitle: () => CardTitle,
|
|
50
|
+
Input: () => Input,
|
|
51
|
+
Separator: () => Separator,
|
|
52
|
+
Tabs: () => Tabs,
|
|
53
|
+
TabsContent: () => TabsContent,
|
|
54
|
+
TabsList: () => TabsList,
|
|
55
|
+
TabsTrigger: () => TabsTrigger,
|
|
56
|
+
ThemeProvider: () => ThemeProvider,
|
|
57
|
+
ThemeSwitcher: () => ThemeSwitcher,
|
|
58
|
+
alertVariants: () => alertVariants,
|
|
59
|
+
badgeVariants: () => badgeVariants,
|
|
60
|
+
buttonVariants: () => buttonVariants,
|
|
61
|
+
cardVariants: () => cardVariants,
|
|
62
|
+
cn: () => cn,
|
|
63
|
+
defaultBrandOptions: () => defaultBrandOptions,
|
|
64
|
+
formatCurrency: () => formatCurrency,
|
|
65
|
+
formatDate: () => formatDate,
|
|
66
|
+
inputVariants: () => inputVariants,
|
|
67
|
+
themeOptions: () => themeOptions,
|
|
68
|
+
useBrand: () => useBrand,
|
|
69
|
+
useTheme: () => useTheme
|
|
70
|
+
});
|
|
71
|
+
module.exports = __toCommonJS(index_exports);
|
|
72
|
+
|
|
73
|
+
// src/components/alert.tsx
|
|
74
|
+
var React = __toESM(require("react"));
|
|
75
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
76
|
+
|
|
77
|
+
// src/lib/utils.ts
|
|
78
|
+
var import_clsx = require("clsx");
|
|
79
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
80
|
+
function cn(...inputs) {
|
|
81
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
82
|
+
}
|
|
83
|
+
function formatDate(input) {
|
|
84
|
+
const date = new Date(input);
|
|
85
|
+
return date.toLocaleDateString("en-US", {
|
|
86
|
+
month: "long",
|
|
87
|
+
day: "numeric",
|
|
88
|
+
year: "numeric"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function formatCurrency(amount) {
|
|
92
|
+
return new Intl.NumberFormat("en-US", {
|
|
93
|
+
style: "currency",
|
|
94
|
+
currency: "USD"
|
|
95
|
+
}).format(amount);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/components/alert.tsx
|
|
99
|
+
var import_lucide_react = require("lucide-react");
|
|
100
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
101
|
+
var alertVariants = (0, import_class_variance_authority.cva)(
|
|
102
|
+
"relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
103
|
+
{
|
|
104
|
+
variants: {
|
|
105
|
+
variant: {
|
|
106
|
+
default: "bg-background text-foreground border-border",
|
|
107
|
+
muted: "bg-muted text-muted-foreground border-muted",
|
|
108
|
+
brand: "bg-brand-primary/10 text-brand-primary border-brand-primary/20 [&>svg]:text-brand-primary",
|
|
109
|
+
success: "bg-success/10 text-success border-success/20 [&>svg]:text-success",
|
|
110
|
+
warning: "bg-warning/10 text-warning border-warning/20 [&>svg]:text-warning",
|
|
111
|
+
info: "bg-info/10 text-info border-info/20 [&>svg]:text-info",
|
|
112
|
+
error: "bg-error/10 text-error border-error/20 [&>svg]:text-error",
|
|
113
|
+
destructive: "bg-destructive/10 text-destructive border-destructive/20 [&>svg]:text-destructive"
|
|
114
|
+
},
|
|
115
|
+
radius: {
|
|
116
|
+
default: "rounded-lg",
|
|
117
|
+
sm: "rounded-md",
|
|
118
|
+
lg: "rounded-xl",
|
|
119
|
+
none: "rounded-none"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
defaultVariants: {
|
|
123
|
+
variant: "default",
|
|
124
|
+
radius: "default"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
var alertIconMap = {
|
|
129
|
+
default: import_lucide_react.Info,
|
|
130
|
+
muted: import_lucide_react.Info,
|
|
131
|
+
brand: import_lucide_react.Info,
|
|
132
|
+
success: import_lucide_react.CheckCircle,
|
|
133
|
+
warning: import_lucide_react.AlertTriangle,
|
|
134
|
+
info: import_lucide_react.Info,
|
|
135
|
+
error: import_lucide_react.AlertCircle,
|
|
136
|
+
destructive: import_lucide_react.AlertCircle
|
|
137
|
+
};
|
|
138
|
+
var Alert = React.forwardRef(
|
|
139
|
+
({
|
|
140
|
+
className,
|
|
141
|
+
variant = "default",
|
|
142
|
+
radius,
|
|
143
|
+
title,
|
|
144
|
+
children,
|
|
145
|
+
dismissible,
|
|
146
|
+
onDismiss,
|
|
147
|
+
icon,
|
|
148
|
+
showIcon = true,
|
|
149
|
+
...props
|
|
150
|
+
}, ref) => {
|
|
151
|
+
const IconComponent = variant ? alertIconMap[variant] : import_lucide_react.Info;
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
ref,
|
|
156
|
+
role: "alert",
|
|
157
|
+
className: cn(alertVariants({ variant, radius, className })),
|
|
158
|
+
...props,
|
|
159
|
+
children: [
|
|
160
|
+
showIcon && (icon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconComponent, { className: "h-4 w-4" })),
|
|
161
|
+
dismissible && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
onClick: onDismiss,
|
|
165
|
+
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-4 w-4" }),
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Dismiss" })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: title }),
|
|
173
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, { children })
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
Alert.displayName = "Alert";
|
|
180
|
+
var AlertTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
|
+
"h5",
|
|
182
|
+
{
|
|
183
|
+
ref,
|
|
184
|
+
className: cn("mb-1 font-medium leading-none tracking-tight", className),
|
|
185
|
+
...props
|
|
186
|
+
}
|
|
187
|
+
));
|
|
188
|
+
AlertTitle.displayName = "AlertTitle";
|
|
189
|
+
var AlertDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
ref,
|
|
193
|
+
className: cn("text-sm [&_p]:leading-relaxed", className),
|
|
194
|
+
...props
|
|
195
|
+
}
|
|
196
|
+
));
|
|
197
|
+
AlertDescription.displayName = "AlertDescription";
|
|
198
|
+
|
|
199
|
+
// src/components/avatar.tsx
|
|
200
|
+
var React2 = __toESM(require("react"));
|
|
201
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
202
|
+
var Avatar = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
ref,
|
|
206
|
+
className: "relative flex h-10 w-10 shrink-0 cursor-pointer select-none items-center justify-center overflow-hidden rounded-full border border-gray-200 bg-gray-100 transition-colors hover:border-gray-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2",
|
|
207
|
+
...props
|
|
208
|
+
}
|
|
209
|
+
));
|
|
210
|
+
Avatar.displayName = "Avatar";
|
|
211
|
+
var AvatarImage = React2.forwardRef(({ src, alt, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
212
|
+
"img",
|
|
213
|
+
{
|
|
214
|
+
ref,
|
|
215
|
+
src: src || void 0,
|
|
216
|
+
alt: alt || "",
|
|
217
|
+
className: `aspect-square h-full w-full rounded-full object-cover ${className}`,
|
|
218
|
+
...props
|
|
219
|
+
}
|
|
220
|
+
));
|
|
221
|
+
AvatarImage.displayName = "AvatarImage";
|
|
222
|
+
var AvatarFallback = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
ref,
|
|
226
|
+
className: "flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
227
|
+
...props
|
|
228
|
+
}
|
|
229
|
+
));
|
|
230
|
+
AvatarFallback.displayName = "AvatarFallback";
|
|
231
|
+
|
|
232
|
+
// src/components/badge.tsx
|
|
233
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
234
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
235
|
+
var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
236
|
+
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
237
|
+
{
|
|
238
|
+
variants: {
|
|
239
|
+
variant: {
|
|
240
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary-hover",
|
|
241
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary-hover",
|
|
242
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive-hover",
|
|
243
|
+
muted: "border-transparent bg-muted text-muted-foreground hover:bg-muted/80",
|
|
244
|
+
outline: "text-foreground border-border hover:bg-muted",
|
|
245
|
+
ghost: "border-transparent hover:bg-muted",
|
|
246
|
+
brand: "border-transparent bg-brand-primary text-brand-primary-foreground hover:bg-brand-primary-dark",
|
|
247
|
+
"brand-secondary": "border-transparent bg-brand-secondary text-brand-secondary-foreground hover:opacity-90",
|
|
248
|
+
success: "border-transparent bg-success text-success-foreground",
|
|
249
|
+
warning: "border-transparent bg-warning text-warning-foreground",
|
|
250
|
+
info: "border-transparent bg-info text-info-foreground",
|
|
251
|
+
error: "border-transparent bg-error text-error-foreground"
|
|
252
|
+
},
|
|
253
|
+
size: {
|
|
254
|
+
default: "px-2 py-0.5 text-xs",
|
|
255
|
+
sm: "px-1.5 py-0 text-[10px]",
|
|
256
|
+
lg: "px-3 py-1 text-sm",
|
|
257
|
+
xl: "px-4 py-1.5 text-base"
|
|
258
|
+
},
|
|
259
|
+
radius: {
|
|
260
|
+
default: "rounded-full",
|
|
261
|
+
sm: "rounded-sm",
|
|
262
|
+
md: "rounded-md",
|
|
263
|
+
lg: "rounded-lg",
|
|
264
|
+
full: "rounded-full",
|
|
265
|
+
none: "rounded-none"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
defaultVariants: {
|
|
269
|
+
variant: "default",
|
|
270
|
+
size: "default",
|
|
271
|
+
radius: "default"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
function Badge({ className, variant, size, radius, ...props }) {
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
className: cn(badgeVariants({ variant, size, radius, className })),
|
|
280
|
+
...props
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/providers/brand-provider.tsx
|
|
286
|
+
var React3 = __toESM(require("react"));
|
|
287
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
288
|
+
var BrandContext = React3.createContext(
|
|
289
|
+
void 0
|
|
290
|
+
);
|
|
291
|
+
function BrandProvider({
|
|
292
|
+
children,
|
|
293
|
+
defaultBrand = "lsts",
|
|
294
|
+
brands = ["lsts", "tlao"],
|
|
295
|
+
storageKey = "ui-brand"
|
|
296
|
+
}) {
|
|
297
|
+
const [brand, setBrandState] = React3.useState(defaultBrand);
|
|
298
|
+
React3.useEffect(() => {
|
|
299
|
+
const stored = localStorage.getItem(storageKey);
|
|
300
|
+
if (stored && brands.includes(stored)) {
|
|
301
|
+
setBrandState(stored);
|
|
302
|
+
}
|
|
303
|
+
}, [storageKey]);
|
|
304
|
+
const setBrand = React3.useCallback(
|
|
305
|
+
(newBrand) => {
|
|
306
|
+
setBrandState(newBrand);
|
|
307
|
+
if (typeof window !== "undefined") {
|
|
308
|
+
localStorage.setItem(storageKey, newBrand);
|
|
309
|
+
document.documentElement.setAttribute("data-brand", newBrand);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
[storageKey]
|
|
313
|
+
);
|
|
314
|
+
React3.useEffect(() => {
|
|
315
|
+
if (typeof window !== "undefined") {
|
|
316
|
+
document.documentElement.setAttribute("data-brand", brand);
|
|
317
|
+
}
|
|
318
|
+
}, [brand]);
|
|
319
|
+
const value = React3.useMemo(
|
|
320
|
+
() => ({ brand, setBrand, brands }),
|
|
321
|
+
[brand, setBrand, brands]
|
|
322
|
+
);
|
|
323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BrandContext.Provider, { value, children });
|
|
324
|
+
}
|
|
325
|
+
function useBrand() {
|
|
326
|
+
const context = React3.useContext(BrandContext);
|
|
327
|
+
if (context === void 0) {
|
|
328
|
+
throw new Error("useBrand must be used within a BrandProvider");
|
|
329
|
+
}
|
|
330
|
+
return context;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// src/components/button.tsx
|
|
334
|
+
var React4 = __toESM(require("react"));
|
|
335
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
336
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
337
|
+
var import_lucide_react2 = require("lucide-react");
|
|
338
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
339
|
+
var buttonVariants = (0, import_class_variance_authority3.cva)(
|
|
340
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
341
|
+
{
|
|
342
|
+
variants: {
|
|
343
|
+
variant: {
|
|
344
|
+
default: "bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active shadow-sm",
|
|
345
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive-hover shadow-sm",
|
|
346
|
+
outline: "border border-input bg-background hover:bg-background-hover hover:text-accent-foreground shadow-sm",
|
|
347
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-hover shadow-sm",
|
|
348
|
+
ghost: "hover:bg-background-hover hover:text-foreground",
|
|
349
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
350
|
+
brand: "bg-brand-primary text-brand-primary-foreground hover:bg-brand-primary-dark shadow-sm",
|
|
351
|
+
"brand-secondary": "bg-brand-secondary text-brand-secondary-foreground hover:opacity-90 shadow-sm",
|
|
352
|
+
"brand-ghost": "hover:bg-brand-primary/10 text-brand-primary hover:text-brand-primary"
|
|
353
|
+
},
|
|
354
|
+
size: {
|
|
355
|
+
default: "h-9 px-4 py-2",
|
|
356
|
+
xs: "h-7 px-2 text-xs",
|
|
357
|
+
sm: "h-8 px-3 text-xs",
|
|
358
|
+
lg: "h-10 px-8",
|
|
359
|
+
xl: "h-12 px-8 text-base",
|
|
360
|
+
"2xl": "h-14 px-10 text-base",
|
|
361
|
+
icon: "h-9 w-9 p-0",
|
|
362
|
+
"icon-sm": "h-8 w-8 p-0",
|
|
363
|
+
"icon-lg": "h-10 w-10 p-0"
|
|
364
|
+
},
|
|
365
|
+
radius: {
|
|
366
|
+
default: "rounded-md",
|
|
367
|
+
none: "rounded-none",
|
|
368
|
+
sm: "rounded-sm",
|
|
369
|
+
lg: "rounded-lg",
|
|
370
|
+
xl: "rounded-xl",
|
|
371
|
+
"2xl": "rounded-2xl",
|
|
372
|
+
full: "rounded-full"
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
defaultVariants: {
|
|
376
|
+
variant: "default",
|
|
377
|
+
size: "default",
|
|
378
|
+
radius: "default"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
var Button = React4.forwardRef(
|
|
383
|
+
({
|
|
384
|
+
className,
|
|
385
|
+
variant,
|
|
386
|
+
size,
|
|
387
|
+
radius,
|
|
388
|
+
asChild = false,
|
|
389
|
+
loading = false,
|
|
390
|
+
leftIcon,
|
|
391
|
+
rightIcon,
|
|
392
|
+
children,
|
|
393
|
+
disabled,
|
|
394
|
+
...props
|
|
395
|
+
}, ref) => {
|
|
396
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
397
|
+
const content = loading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Loader2, { className: "animate-spin" }),
|
|
399
|
+
children
|
|
400
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
401
|
+
leftIcon,
|
|
402
|
+
children,
|
|
403
|
+
rightIcon
|
|
404
|
+
] });
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
406
|
+
Comp,
|
|
407
|
+
{
|
|
408
|
+
className: cn(buttonVariants({ variant, size, radius, className })),
|
|
409
|
+
ref,
|
|
410
|
+
disabled: disabled || loading,
|
|
411
|
+
...props,
|
|
412
|
+
children: content
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
Button.displayName = "Button";
|
|
418
|
+
|
|
419
|
+
// src/components/brand-switcher.tsx
|
|
420
|
+
var import_lucide_react3 = require("lucide-react");
|
|
421
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
422
|
+
var defaultBrandOptions = [
|
|
423
|
+
{
|
|
424
|
+
value: "lsts",
|
|
425
|
+
label: "LSTS",
|
|
426
|
+
description: "LSTech Solutions",
|
|
427
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Building2, { className: "h-4 w-4" })
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
value: "tlao",
|
|
431
|
+
label: "TL\xC1O",
|
|
432
|
+
description: "TL\xC1O Project",
|
|
433
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Landmark, { className: "h-4 w-4" })
|
|
434
|
+
}
|
|
435
|
+
];
|
|
436
|
+
function BrandSwitcher({
|
|
437
|
+
options = defaultBrandOptions,
|
|
438
|
+
variant = "buttons",
|
|
439
|
+
size = "md",
|
|
440
|
+
className,
|
|
441
|
+
showIcons = true,
|
|
442
|
+
showDescription = false
|
|
443
|
+
}) {
|
|
444
|
+
const { brand, setBrand } = useBrand();
|
|
445
|
+
const sizeClasses = {
|
|
446
|
+
sm: "h-7 px-2 text-xs",
|
|
447
|
+
md: "h-9 px-3 text-sm",
|
|
448
|
+
lg: "h-10 px-4 text-base"
|
|
449
|
+
};
|
|
450
|
+
if (variant === "buttons") {
|
|
451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("flex items-center gap-1", className), children: options.map((option) => {
|
|
452
|
+
const isActive = brand === option.value;
|
|
453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
454
|
+
Button,
|
|
455
|
+
{
|
|
456
|
+
variant: isActive ? "brand" : "ghost",
|
|
457
|
+
size: "sm",
|
|
458
|
+
onClick: () => setBrand(option.value),
|
|
459
|
+
className: cn(
|
|
460
|
+
"gap-2",
|
|
461
|
+
sizeClasses[size],
|
|
462
|
+
isActive && "ring-2 ring-ring ring-offset-2"
|
|
463
|
+
),
|
|
464
|
+
children: [
|
|
465
|
+
showIcons && option.icon,
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: option.label }),
|
|
467
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Check, { className: "h-3 w-3 ml-1" })
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
option.value
|
|
471
|
+
);
|
|
472
|
+
}) });
|
|
473
|
+
}
|
|
474
|
+
if (variant === "cards") {
|
|
475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("grid gap-3", className), children: options.map((option) => {
|
|
476
|
+
const isActive = brand === option.value;
|
|
477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
478
|
+
"button",
|
|
479
|
+
{
|
|
480
|
+
onClick: () => setBrand(option.value),
|
|
481
|
+
className: cn(
|
|
482
|
+
"flex items-start gap-3 rounded-lg border p-4 text-left transition-all duration-fast",
|
|
483
|
+
"hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring",
|
|
484
|
+
isActive && "border-brand-primary bg-brand-primary/5"
|
|
485
|
+
),
|
|
486
|
+
children: [
|
|
487
|
+
showIcons && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
488
|
+
"div",
|
|
489
|
+
{
|
|
490
|
+
className: cn(
|
|
491
|
+
"flex h-10 w-10 shrink-0 items-center justify-center rounded-md",
|
|
492
|
+
isActive ? "bg-brand-primary text-brand-primary-foreground" : "bg-muted text-muted-foreground"
|
|
493
|
+
),
|
|
494
|
+
children: option.icon
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1", children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "font-medium", children: option.label }),
|
|
499
|
+
showDescription && option.description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm text-muted-foreground", children: option.description })
|
|
500
|
+
] }),
|
|
501
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Check, { className: "h-5 w-5 text-brand-primary shrink-0" })
|
|
502
|
+
]
|
|
503
|
+
},
|
|
504
|
+
option.value
|
|
505
|
+
);
|
|
506
|
+
}) });
|
|
507
|
+
}
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
509
|
+
"select",
|
|
510
|
+
{
|
|
511
|
+
value: brand,
|
|
512
|
+
onChange: (e) => setBrand(e.target.value),
|
|
513
|
+
className: cn(
|
|
514
|
+
"flex h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors",
|
|
515
|
+
"focus:outline-none focus:ring-1 focus:ring-ring",
|
|
516
|
+
className
|
|
517
|
+
),
|
|
518
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/components/card.tsx
|
|
524
|
+
var React5 = __toESM(require("react"));
|
|
525
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
526
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
527
|
+
var cardVariants = (0, import_class_variance_authority4.cva)(
|
|
528
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm transition-all duration-fast",
|
|
529
|
+
{
|
|
530
|
+
variants: {
|
|
531
|
+
variant: {
|
|
532
|
+
default: "",
|
|
533
|
+
elevated: "shadow-elevation-2 hover:shadow-elevation-3",
|
|
534
|
+
outline: "shadow-none",
|
|
535
|
+
ghost: "border-transparent bg-transparent shadow-none",
|
|
536
|
+
brand: "border-brand-primary/20 bg-brand-primary/5"
|
|
537
|
+
},
|
|
538
|
+
radius: {
|
|
539
|
+
default: "rounded-lg",
|
|
540
|
+
sm: "rounded-md",
|
|
541
|
+
lg: "rounded-xl",
|
|
542
|
+
xl: "rounded-2xl",
|
|
543
|
+
none: "rounded-none"
|
|
544
|
+
},
|
|
545
|
+
padding: {
|
|
546
|
+
default: "",
|
|
547
|
+
none: "",
|
|
548
|
+
sm: "p-4",
|
|
549
|
+
md: "p-6",
|
|
550
|
+
lg: "p-8"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
defaultVariants: {
|
|
554
|
+
variant: "default",
|
|
555
|
+
radius: "default",
|
|
556
|
+
padding: "default"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
var Card = React5.forwardRef(
|
|
561
|
+
({ className, variant, radius, padding, ...props }, ref) => {
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
563
|
+
"div",
|
|
564
|
+
{
|
|
565
|
+
ref,
|
|
566
|
+
className: cn(cardVariants({ variant, radius, padding, className })),
|
|
567
|
+
...props
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
Card.displayName = "Card";
|
|
573
|
+
var CardHeader = React5.forwardRef(({ className, ...props }, ref) => {
|
|
574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
575
|
+
"div",
|
|
576
|
+
{
|
|
577
|
+
ref,
|
|
578
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
579
|
+
...props
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
});
|
|
583
|
+
CardHeader.displayName = "CardHeader";
|
|
584
|
+
var CardTitle = React5.forwardRef(({ className, ...props }, ref) => {
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
586
|
+
"h3",
|
|
587
|
+
{
|
|
588
|
+
ref,
|
|
589
|
+
className: cn(
|
|
590
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
591
|
+
className
|
|
592
|
+
),
|
|
593
|
+
...props
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
});
|
|
597
|
+
CardTitle.displayName = "CardTitle";
|
|
598
|
+
var CardDescription = React5.forwardRef(({ className, ...props }, ref) => {
|
|
599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
600
|
+
"p",
|
|
601
|
+
{
|
|
602
|
+
ref,
|
|
603
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
604
|
+
...props
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
});
|
|
608
|
+
CardDescription.displayName = "CardDescription";
|
|
609
|
+
var CardContent = React5.forwardRef(({ className, ...props }, ref) => {
|
|
610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("p-6 pt-0", className), ...props });
|
|
611
|
+
});
|
|
612
|
+
CardContent.displayName = "CardContent";
|
|
613
|
+
var CardFooter = React5.forwardRef(({ className, ...props }, ref) => {
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
615
|
+
"div",
|
|
616
|
+
{
|
|
617
|
+
ref,
|
|
618
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
619
|
+
...props
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
});
|
|
623
|
+
CardFooter.displayName = "CardFooter";
|
|
624
|
+
|
|
625
|
+
// src/components/input.tsx
|
|
626
|
+
var React6 = __toESM(require("react"));
|
|
627
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
628
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
629
|
+
var inputVariants = (0, import_class_variance_authority5.cva)(
|
|
630
|
+
"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-all duration-fast",
|
|
631
|
+
{
|
|
632
|
+
variants: {
|
|
633
|
+
variant: {
|
|
634
|
+
default: "",
|
|
635
|
+
filled: "bg-muted border-transparent",
|
|
636
|
+
ghost: "border-transparent bg-transparent",
|
|
637
|
+
brand: "focus-visible:ring-brand-primary/50"
|
|
638
|
+
},
|
|
639
|
+
size: {
|
|
640
|
+
default: "h-9 px-3 py-2",
|
|
641
|
+
sm: "h-8 px-2 py-1 text-xs",
|
|
642
|
+
lg: "h-10 px-4 py-2",
|
|
643
|
+
xl: "h-12 px-4 py-3 text-base"
|
|
644
|
+
},
|
|
645
|
+
radius: {
|
|
646
|
+
default: "rounded-md",
|
|
647
|
+
sm: "rounded-sm",
|
|
648
|
+
lg: "rounded-lg",
|
|
649
|
+
xl: "rounded-xl",
|
|
650
|
+
full: "rounded-full px-4",
|
|
651
|
+
none: "rounded-none"
|
|
652
|
+
},
|
|
653
|
+
state: {
|
|
654
|
+
default: "",
|
|
655
|
+
error: "border-error focus-visible:ring-error/50",
|
|
656
|
+
success: "border-success focus-visible:ring-success/50",
|
|
657
|
+
warning: "border-warning focus-visible:ring-warning/50"
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
defaultVariants: {
|
|
661
|
+
variant: "default",
|
|
662
|
+
size: "default",
|
|
663
|
+
radius: "default",
|
|
664
|
+
state: "default"
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
var Input = React6.forwardRef(
|
|
669
|
+
({
|
|
670
|
+
className,
|
|
671
|
+
variant,
|
|
672
|
+
size: inputSize,
|
|
673
|
+
radius,
|
|
674
|
+
state,
|
|
675
|
+
leftIcon,
|
|
676
|
+
rightIcon,
|
|
677
|
+
type,
|
|
678
|
+
...props
|
|
679
|
+
}, ref) => {
|
|
680
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
681
|
+
"input",
|
|
682
|
+
{
|
|
683
|
+
type,
|
|
684
|
+
className: cn(inputVariants({ variant, size: inputSize, radius, state, className })),
|
|
685
|
+
ref,
|
|
686
|
+
...props
|
|
687
|
+
}
|
|
688
|
+
);
|
|
689
|
+
if (leftIcon || rightIcon) {
|
|
690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex items-center", children: [
|
|
691
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute left-3 text-muted-foreground pointer-events-none", children: leftIcon }),
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
693
|
+
"input",
|
|
694
|
+
{
|
|
695
|
+
type,
|
|
696
|
+
className: cn(
|
|
697
|
+
inputVariants({ variant, size: inputSize, radius, state, className }),
|
|
698
|
+
leftIcon && "pl-10",
|
|
699
|
+
rightIcon && "pr-10"
|
|
700
|
+
),
|
|
701
|
+
ref,
|
|
702
|
+
...props
|
|
703
|
+
}
|
|
704
|
+
),
|
|
705
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute right-3 text-muted-foreground pointer-events-none", children: rightIcon })
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
return input;
|
|
709
|
+
}
|
|
710
|
+
);
|
|
711
|
+
Input.displayName = "Input";
|
|
712
|
+
|
|
713
|
+
// src/components/separator.tsx
|
|
714
|
+
var React7 = __toESM(require("react"));
|
|
715
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
716
|
+
var Separator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
717
|
+
"hr",
|
|
718
|
+
{
|
|
719
|
+
ref,
|
|
720
|
+
className: cn("shrink-0 bg-border", className),
|
|
721
|
+
...props
|
|
722
|
+
}
|
|
723
|
+
));
|
|
724
|
+
Separator.displayName = "Separator";
|
|
725
|
+
|
|
726
|
+
// src/components/tabs.tsx
|
|
727
|
+
var React8 = __toESM(require("react"));
|
|
728
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
729
|
+
var Tabs = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
730
|
+
"div",
|
|
731
|
+
{
|
|
732
|
+
ref,
|
|
733
|
+
className: cn("inline-flex flex-col", className),
|
|
734
|
+
...props
|
|
735
|
+
}
|
|
736
|
+
));
|
|
737
|
+
Tabs.displayName = "Tabs";
|
|
738
|
+
var TabsList = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
739
|
+
"div",
|
|
740
|
+
{
|
|
741
|
+
ref,
|
|
742
|
+
role: "tablist",
|
|
743
|
+
className: cn(
|
|
744
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
745
|
+
className
|
|
746
|
+
),
|
|
747
|
+
...props
|
|
748
|
+
}
|
|
749
|
+
));
|
|
750
|
+
TabsList.displayName = "TabsList";
|
|
751
|
+
var TabsTrigger = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
752
|
+
"button",
|
|
753
|
+
{
|
|
754
|
+
ref,
|
|
755
|
+
className: cn(
|
|
756
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
757
|
+
className
|
|
758
|
+
),
|
|
759
|
+
...props
|
|
760
|
+
}
|
|
761
|
+
));
|
|
762
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
763
|
+
var TabsContent = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
764
|
+
"div",
|
|
765
|
+
{
|
|
766
|
+
ref,
|
|
767
|
+
className: cn(
|
|
768
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
769
|
+
className
|
|
770
|
+
),
|
|
771
|
+
...props
|
|
772
|
+
}
|
|
773
|
+
));
|
|
774
|
+
TabsContent.displayName = "TabsContent";
|
|
775
|
+
|
|
776
|
+
// src/providers/theme-provider.tsx
|
|
777
|
+
var React9 = __toESM(require("react"));
|
|
778
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
779
|
+
var ThemeContext = React9.createContext(
|
|
780
|
+
void 0
|
|
781
|
+
);
|
|
782
|
+
function ThemeProvider({
|
|
783
|
+
children,
|
|
784
|
+
defaultTheme = "system",
|
|
785
|
+
storageKey = "ui-theme",
|
|
786
|
+
enableSystem = true,
|
|
787
|
+
disableTransitionOnChange = false
|
|
788
|
+
}) {
|
|
789
|
+
const [theme, setThemeState] = React9.useState(defaultTheme);
|
|
790
|
+
const [resolvedTheme, setResolvedTheme] = React9.useState("light");
|
|
791
|
+
React9.useEffect(() => {
|
|
792
|
+
const stored = localStorage.getItem(storageKey);
|
|
793
|
+
if (stored) {
|
|
794
|
+
setThemeState(stored);
|
|
795
|
+
}
|
|
796
|
+
}, [storageKey]);
|
|
797
|
+
const setTheme = React9.useCallback(
|
|
798
|
+
(newTheme) => {
|
|
799
|
+
setThemeState(newTheme);
|
|
800
|
+
if (typeof window !== "undefined") {
|
|
801
|
+
localStorage.setItem(storageKey, newTheme);
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
[storageKey]
|
|
805
|
+
);
|
|
806
|
+
React9.useEffect(() => {
|
|
807
|
+
if (typeof window === "undefined") return;
|
|
808
|
+
const root = document.documentElement;
|
|
809
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
810
|
+
const applyTheme = () => {
|
|
811
|
+
let resolved;
|
|
812
|
+
if (theme === "system" && enableSystem) {
|
|
813
|
+
resolved = mediaQuery.matches ? "dark" : "light";
|
|
814
|
+
} else {
|
|
815
|
+
resolved = theme === "dark" ? "dark" : "light";
|
|
816
|
+
}
|
|
817
|
+
setResolvedTheme(resolved);
|
|
818
|
+
if (disableTransitionOnChange) {
|
|
819
|
+
const css = document.createElement("style");
|
|
820
|
+
css.appendChild(
|
|
821
|
+
document.createTextNode(
|
|
822
|
+
"* { transition: none !important; }"
|
|
823
|
+
)
|
|
824
|
+
);
|
|
825
|
+
document.head.appendChild(css);
|
|
826
|
+
requestAnimationFrame(() => {
|
|
827
|
+
document.head.removeChild(css);
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
root.setAttribute("data-theme", resolved);
|
|
831
|
+
if (resolved === "dark") {
|
|
832
|
+
root.classList.add("dark");
|
|
833
|
+
} else {
|
|
834
|
+
root.classList.remove("dark");
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
applyTheme();
|
|
838
|
+
if (enableSystem && theme === "system") {
|
|
839
|
+
mediaQuery.addEventListener("change", applyTheme);
|
|
840
|
+
return () => mediaQuery.removeEventListener("change", applyTheme);
|
|
841
|
+
}
|
|
842
|
+
}, [theme, enableSystem, disableTransitionOnChange]);
|
|
843
|
+
const value = React9.useMemo(
|
|
844
|
+
() => ({ theme, setTheme, resolvedTheme }),
|
|
845
|
+
[theme, setTheme, resolvedTheme]
|
|
846
|
+
);
|
|
847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeContext.Provider, { value, children });
|
|
848
|
+
}
|
|
849
|
+
function useTheme() {
|
|
850
|
+
const context = React9.useContext(ThemeContext);
|
|
851
|
+
if (context === void 0) {
|
|
852
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
853
|
+
}
|
|
854
|
+
return context;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// src/components/theme-switcher.tsx
|
|
858
|
+
var import_lucide_react4 = require("lucide-react");
|
|
859
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
860
|
+
var themeOptions = [
|
|
861
|
+
{
|
|
862
|
+
value: "light",
|
|
863
|
+
label: "Light",
|
|
864
|
+
description: "Always use light mode",
|
|
865
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Sun, { className: "h-4 w-4" })
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
value: "dark",
|
|
869
|
+
label: "Dark",
|
|
870
|
+
description: "Always use dark mode",
|
|
871
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Moon, { className: "h-4 w-4" })
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
value: "system",
|
|
875
|
+
label: "System",
|
|
876
|
+
description: "Follow system preference",
|
|
877
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Monitor, { className: "h-4 w-4" })
|
|
878
|
+
}
|
|
879
|
+
];
|
|
880
|
+
function ThemeSwitcher({
|
|
881
|
+
variant = "segmented",
|
|
882
|
+
size = "md",
|
|
883
|
+
className,
|
|
884
|
+
showLabel = true,
|
|
885
|
+
showIcons = true
|
|
886
|
+
}) {
|
|
887
|
+
const { theme, setTheme, resolvedTheme } = useTheme();
|
|
888
|
+
const sizeClasses = {
|
|
889
|
+
sm: "h-7 px-2",
|
|
890
|
+
md: "h-9 px-3",
|
|
891
|
+
lg: "h-10 px-4"
|
|
892
|
+
};
|
|
893
|
+
if (variant === "buttons") {
|
|
894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("flex items-center gap-1", className), children: themeOptions.map((option) => {
|
|
895
|
+
const isActive = theme === option.value;
|
|
896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
897
|
+
Button,
|
|
898
|
+
{
|
|
899
|
+
variant: isActive ? "secondary" : "ghost",
|
|
900
|
+
size: "sm",
|
|
901
|
+
onClick: () => setTheme(option.value),
|
|
902
|
+
className: cn(
|
|
903
|
+
"gap-2",
|
|
904
|
+
sizeClasses[size],
|
|
905
|
+
isActive && "ring-2 ring-ring ring-offset-2"
|
|
906
|
+
),
|
|
907
|
+
children: [
|
|
908
|
+
showIcons && option.icon,
|
|
909
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: option.label })
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
option.value
|
|
913
|
+
);
|
|
914
|
+
}) });
|
|
915
|
+
}
|
|
916
|
+
if (variant === "segmented") {
|
|
917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
918
|
+
"div",
|
|
919
|
+
{
|
|
920
|
+
className: cn(
|
|
921
|
+
"inline-flex items-center rounded-lg border bg-muted p-1",
|
|
922
|
+
className
|
|
923
|
+
),
|
|
924
|
+
children: themeOptions.map((option) => {
|
|
925
|
+
const isActive = theme === option.value;
|
|
926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
927
|
+
"button",
|
|
928
|
+
{
|
|
929
|
+
onClick: () => setTheme(option.value),
|
|
930
|
+
className: cn(
|
|
931
|
+
"relative flex items-center justify-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium transition-all duration-fast",
|
|
932
|
+
"hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
933
|
+
isActive ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-muted"
|
|
934
|
+
),
|
|
935
|
+
children: [
|
|
936
|
+
showIcons && option.icon,
|
|
937
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: option.label })
|
|
938
|
+
]
|
|
939
|
+
},
|
|
940
|
+
option.value
|
|
941
|
+
);
|
|
942
|
+
})
|
|
943
|
+
}
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
if (variant === "cards") {
|
|
947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("grid gap-3", className), children: themeOptions.map((option) => {
|
|
948
|
+
const isActive = theme === option.value;
|
|
949
|
+
const isResolved = resolvedTheme === (option.value === "system" ? void 0 : option.value);
|
|
950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
951
|
+
"button",
|
|
952
|
+
{
|
|
953
|
+
onClick: () => setTheme(option.value),
|
|
954
|
+
className: cn(
|
|
955
|
+
"flex items-start gap-3 rounded-lg border p-4 text-left transition-all duration-fast",
|
|
956
|
+
"hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring",
|
|
957
|
+
isActive && "border-primary bg-primary/5"
|
|
958
|
+
),
|
|
959
|
+
children: [
|
|
960
|
+
showIcons && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
961
|
+
"div",
|
|
962
|
+
{
|
|
963
|
+
className: cn(
|
|
964
|
+
"flex h-10 w-10 shrink-0 items-center justify-center rounded-md",
|
|
965
|
+
isActive ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"
|
|
966
|
+
),
|
|
967
|
+
children: option.icon
|
|
968
|
+
}
|
|
969
|
+
),
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-1", children: [
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "font-medium flex items-center gap-2", children: [
|
|
972
|
+
option.label,
|
|
973
|
+
option.value === "system" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
974
|
+
"(",
|
|
975
|
+
resolvedTheme,
|
|
976
|
+
")"
|
|
977
|
+
] })
|
|
978
|
+
] }),
|
|
979
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-muted-foreground", children: option.description })
|
|
980
|
+
] }),
|
|
981
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Check, { className: "h-5 w-5 text-primary shrink-0" })
|
|
982
|
+
]
|
|
983
|
+
},
|
|
984
|
+
option.value
|
|
985
|
+
);
|
|
986
|
+
}) });
|
|
987
|
+
}
|
|
988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
989
|
+
"select",
|
|
990
|
+
{
|
|
991
|
+
value: theme,
|
|
992
|
+
onChange: (e) => setTheme(e.target.value),
|
|
993
|
+
className: cn(
|
|
994
|
+
"flex h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors",
|
|
995
|
+
"focus:outline-none focus:ring-1 focus:ring-ring",
|
|
996
|
+
className
|
|
997
|
+
),
|
|
998
|
+
children: themeOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
999
|
+
}
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1003
|
+
0 && (module.exports = {
|
|
1004
|
+
Alert,
|
|
1005
|
+
AlertDescription,
|
|
1006
|
+
AlertTitle,
|
|
1007
|
+
Avatar,
|
|
1008
|
+
AvatarFallback,
|
|
1009
|
+
AvatarImage,
|
|
1010
|
+
Badge,
|
|
1011
|
+
BrandProvider,
|
|
1012
|
+
BrandSwitcher,
|
|
1013
|
+
Button,
|
|
1014
|
+
Card,
|
|
1015
|
+
CardContent,
|
|
1016
|
+
CardDescription,
|
|
1017
|
+
CardFooter,
|
|
1018
|
+
CardHeader,
|
|
1019
|
+
CardTitle,
|
|
1020
|
+
Input,
|
|
1021
|
+
Separator,
|
|
1022
|
+
Tabs,
|
|
1023
|
+
TabsContent,
|
|
1024
|
+
TabsList,
|
|
1025
|
+
TabsTrigger,
|
|
1026
|
+
ThemeProvider,
|
|
1027
|
+
ThemeSwitcher,
|
|
1028
|
+
alertVariants,
|
|
1029
|
+
badgeVariants,
|
|
1030
|
+
buttonVariants,
|
|
1031
|
+
cardVariants,
|
|
1032
|
+
cn,
|
|
1033
|
+
defaultBrandOptions,
|
|
1034
|
+
formatCurrency,
|
|
1035
|
+
formatDate,
|
|
1036
|
+
inputVariants,
|
|
1037
|
+
themeOptions,
|
|
1038
|
+
useBrand,
|
|
1039
|
+
useTheme
|
|
1040
|
+
});
|
|
1041
|
+
//# sourceMappingURL=index.js.map
|