@facter/ds-core 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +676 -18
- package/dist/index.d.ts +676 -18
- package/dist/index.js +2471 -227
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2403 -229
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +17 -1
- package/dist/themes/index.d.ts +17 -1
- package/dist/themes/index.js +14 -3
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/index.mjs +14 -3
- package/dist/themes/index.mjs.map +1 -1
- package/package.json +14 -7
- package/src/themes/default.css +59 -0
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React48 from 'react';
|
|
2
3
|
import { cva } from 'class-variance-authority';
|
|
3
4
|
import { clsx } from 'clsx';
|
|
4
5
|
import { twMerge } from 'tailwind-merge';
|
|
5
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { ChevronDown, Check, Inbox, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, X, Circle, PinOff, Pin, ArrowDown, ArrowUp, ChevronsUpDown, FileText, FileSpreadsheet, Download, Rows4, Rows3, LayoutList, SlidersHorizontal, Info, AlertTriangle, XCircle, CheckCircle2, Building2, Star, ArrowRight, Search, User, LogOut, Menu, TrendingUp, TrendingDown, Sun, Moon, Bell, MoreHorizontal, Settings } from 'lucide-react';
|
|
8
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
9
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
7
|
-
import { ChevronDown, Check, Inbox, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, X, ArrowDown, ArrowUp, ChevronsUpDown, FileText, FileSpreadsheet, Download, Rows4, Rows3, LayoutList, SlidersHorizontal, Info, AlertTriangle, XCircle, CheckCircle2, Circle, Building2, Star, ArrowRight, Search, User, LogOut, Menu, PinOff, Pin } from 'lucide-react';
|
|
8
10
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
9
|
-
import { AnimatePresence, motion } from 'framer-motion';
|
|
10
11
|
import { flexRender, useReactTable, getSortedRowModel, getPaginationRowModel, getFilteredRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
11
12
|
export { flexRender } from '@tanstack/react-table';
|
|
12
13
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
@@ -15,6 +16,12 @@ import { toast as toast$1, Toaster as Toaster$1 } from 'sonner';
|
|
|
15
16
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
16
17
|
import { Controller } from 'react-hook-form';
|
|
17
18
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
19
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
20
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
21
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
22
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
23
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
24
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
18
25
|
|
|
19
26
|
// src/components/Button/Button.tsx
|
|
20
27
|
function cn(...inputs) {
|
|
@@ -46,7 +53,7 @@ var buttonVariants = cva(
|
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
);
|
|
49
|
-
var Button =
|
|
56
|
+
var Button = React48.forwardRef(
|
|
50
57
|
({ className, variant, size, ...props }, ref) => {
|
|
51
58
|
return /* @__PURE__ */ jsx(
|
|
52
59
|
"button",
|
|
@@ -59,6 +66,66 @@ var Button = React36.forwardRef(
|
|
|
59
66
|
}
|
|
60
67
|
);
|
|
61
68
|
Button.displayName = "Button";
|
|
69
|
+
function Card({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
className: cn(
|
|
74
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
75
|
+
className
|
|
76
|
+
),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
Card.displayName = "Card";
|
|
82
|
+
function CardHeader({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
CardHeader.displayName = "CardHeader";
|
|
92
|
+
function CardTitle({ className, ...props }) {
|
|
93
|
+
return /* @__PURE__ */ jsx(
|
|
94
|
+
"h3",
|
|
95
|
+
{
|
|
96
|
+
className: cn(
|
|
97
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
98
|
+
className
|
|
99
|
+
),
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
CardTitle.displayName = "CardTitle";
|
|
105
|
+
function CardDescription({ className, ...props }) {
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
"p",
|
|
108
|
+
{
|
|
109
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
CardDescription.displayName = "CardDescription";
|
|
115
|
+
function CardContent({ className, ...props }) {
|
|
116
|
+
return /* @__PURE__ */ jsx("div", { className: cn("p-6 pt-0", className), ...props });
|
|
117
|
+
}
|
|
118
|
+
CardContent.displayName = "CardContent";
|
|
119
|
+
function CardFooter({ className, ...props }) {
|
|
120
|
+
return /* @__PURE__ */ jsx(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
124
|
+
...props
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
CardFooter.displayName = "CardFooter";
|
|
62
129
|
var inputVariants = cva(
|
|
63
130
|
"w-full h-12 px-3 pt-4 pb-2 text-sm bg-background rounded-md border-2 transition-colors focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50",
|
|
64
131
|
{
|
|
@@ -79,7 +146,7 @@ var inputVariants = cva(
|
|
|
79
146
|
}
|
|
80
147
|
}
|
|
81
148
|
);
|
|
82
|
-
var Input =
|
|
149
|
+
var Input = React48.forwardRef(
|
|
83
150
|
({
|
|
84
151
|
className,
|
|
85
152
|
variant,
|
|
@@ -93,13 +160,13 @@ var Input = React36.forwardRef(
|
|
|
93
160
|
labelClassName,
|
|
94
161
|
...props
|
|
95
162
|
}, ref) => {
|
|
96
|
-
const inputRef =
|
|
97
|
-
const [showPassword, setShowPassword] =
|
|
98
|
-
|
|
99
|
-
const focusInput =
|
|
163
|
+
const inputRef = React48.useRef(null);
|
|
164
|
+
const [showPassword, setShowPassword] = React48.useState(false);
|
|
165
|
+
React48.useImperativeHandle(ref, () => inputRef.current, []);
|
|
166
|
+
const focusInput = React48.useCallback(() => {
|
|
100
167
|
inputRef.current?.focus();
|
|
101
168
|
}, []);
|
|
102
|
-
const togglePasswordVisibility =
|
|
169
|
+
const togglePasswordVisibility = React48.useCallback(() => {
|
|
103
170
|
setShowPassword((prev) => !prev);
|
|
104
171
|
}, []);
|
|
105
172
|
const inputType = type === "password" ? showPassword ? "text" : "password" : type;
|
|
@@ -208,13 +275,13 @@ var badgeVariants = cva(
|
|
|
208
275
|
{
|
|
209
276
|
variants: {
|
|
210
277
|
variant: {
|
|
211
|
-
default: "border-transparent bg-primary text-primary
|
|
278
|
+
default: "border-transparent bg-primary/15 text-primary hover:bg-primary/25",
|
|
212
279
|
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
213
|
-
success: "border-transparent bg-green-500 text-
|
|
214
|
-
warning: "border-transparent bg-yellow-500 text-
|
|
215
|
-
error: "border-transparent bg-red-500 text-
|
|
216
|
-
info: "border-transparent bg-blue-500 text-
|
|
217
|
-
outline: "border-
|
|
280
|
+
success: "border-transparent bg-green-500/15 text-green-600 dark:text-green-400 hover:bg-green-500/25",
|
|
281
|
+
warning: "border-transparent bg-yellow-500/15 text-yellow-600 dark:text-yellow-400 hover:bg-yellow-500/25",
|
|
282
|
+
error: "border-transparent bg-red-500/15 text-red-600 dark:text-red-400 hover:bg-red-500/25",
|
|
283
|
+
info: "border-transparent bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25",
|
|
284
|
+
outline: "border-border text-foreground hover:bg-muted"
|
|
218
285
|
},
|
|
219
286
|
size: {
|
|
220
287
|
default: "px-2.5 py-0.5 text-xs",
|
|
@@ -232,6 +299,239 @@ function Badge({ className, variant, size, ...props }) {
|
|
|
232
299
|
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant, size }), className), ...props });
|
|
233
300
|
}
|
|
234
301
|
Badge.displayName = "Badge";
|
|
302
|
+
var colorClasses = {
|
|
303
|
+
"chart-1": "text-chart-1",
|
|
304
|
+
"chart-2": "text-chart-2",
|
|
305
|
+
"chart-3": "text-chart-3",
|
|
306
|
+
"chart-4": "text-chart-4",
|
|
307
|
+
"chart-5": "text-chart-5"
|
|
308
|
+
};
|
|
309
|
+
function generateSmoothPath(points) {
|
|
310
|
+
if (points.length < 2) return "";
|
|
311
|
+
if (points.length === 2) {
|
|
312
|
+
return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;
|
|
313
|
+
}
|
|
314
|
+
let path = `M ${points[0].x.toFixed(2)} ${points[0].y.toFixed(2)}`;
|
|
315
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
316
|
+
const p0 = points[Math.max(0, i - 1)];
|
|
317
|
+
const p1 = points[i];
|
|
318
|
+
const p2 = points[i + 1];
|
|
319
|
+
const p3 = points[Math.min(points.length - 1, i + 2)];
|
|
320
|
+
const tension = 0.3;
|
|
321
|
+
const cp1x = p1.x + (p2.x - p0.x) * tension;
|
|
322
|
+
const cp1y = p1.y + (p2.y - p0.y) * tension;
|
|
323
|
+
const cp2x = p2.x - (p3.x - p1.x) * tension;
|
|
324
|
+
const cp2y = p2.y - (p3.y - p1.y) * tension;
|
|
325
|
+
path += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${p2.x.toFixed(2)} ${p2.y.toFixed(2)}`;
|
|
326
|
+
}
|
|
327
|
+
return path;
|
|
328
|
+
}
|
|
329
|
+
function Sparkline({
|
|
330
|
+
data,
|
|
331
|
+
color = "chart-1",
|
|
332
|
+
animate = true,
|
|
333
|
+
className,
|
|
334
|
+
show = true
|
|
335
|
+
}) {
|
|
336
|
+
const gradientId = React48.useId();
|
|
337
|
+
const { linePath, areaPath } = React48.useMemo(() => {
|
|
338
|
+
if (data.length < 2) {
|
|
339
|
+
return { linePath: "", areaPath: "" };
|
|
340
|
+
}
|
|
341
|
+
const max = Math.max(...data);
|
|
342
|
+
const min = Math.min(...data);
|
|
343
|
+
const range = max - min || 1;
|
|
344
|
+
const points = data.map((value, index) => ({
|
|
345
|
+
x: index / (data.length - 1) * 100,
|
|
346
|
+
y: 100 - (value - min) / range * 70 - 15
|
|
347
|
+
// 15% padding top, 15% bottom
|
|
348
|
+
}));
|
|
349
|
+
const line = generateSmoothPath(points);
|
|
350
|
+
const area = `${line} L 100 100 L 0 100 Z`;
|
|
351
|
+
return { linePath: line, areaPath: area };
|
|
352
|
+
}, [data]);
|
|
353
|
+
if (!show || data.length < 2) {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
return /* @__PURE__ */ jsxs(
|
|
357
|
+
"svg",
|
|
358
|
+
{
|
|
359
|
+
viewBox: "0 0 100 100",
|
|
360
|
+
preserveAspectRatio: "none",
|
|
361
|
+
className: cn("w-full h-16", colorClasses[color], className),
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
364
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "0.3" }),
|
|
365
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0" })
|
|
366
|
+
] }) }),
|
|
367
|
+
/* @__PURE__ */ jsx(
|
|
368
|
+
motion.path,
|
|
369
|
+
{
|
|
370
|
+
d: areaPath,
|
|
371
|
+
fill: `url(#${gradientId})`,
|
|
372
|
+
initial: animate ? { opacity: 0 } : void 0,
|
|
373
|
+
animate: { opacity: 1 },
|
|
374
|
+
transition: { duration: 0.5, delay: 0.3 }
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ jsx(
|
|
378
|
+
motion.path,
|
|
379
|
+
{
|
|
380
|
+
d: linePath,
|
|
381
|
+
fill: "none",
|
|
382
|
+
stroke: "currentColor",
|
|
383
|
+
strokeWidth: "2",
|
|
384
|
+
strokeLinecap: "round",
|
|
385
|
+
strokeLinejoin: "round",
|
|
386
|
+
vectorEffect: "non-scaling-stroke",
|
|
387
|
+
initial: animate ? { pathLength: 0 } : void 0,
|
|
388
|
+
animate: { pathLength: 1 },
|
|
389
|
+
transition: { duration: 0.8, ease: "easeOut" }
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
Sparkline.displayName = "BigNumberCard.Sparkline";
|
|
397
|
+
var rootVariants = cva(
|
|
398
|
+
"relative overflow-hidden rounded-xl border border-border bg-card shadow-sm min-h-[140px]",
|
|
399
|
+
{
|
|
400
|
+
variants: {
|
|
401
|
+
size: {
|
|
402
|
+
default: "p-5 pb-14",
|
|
403
|
+
sm: "p-4 pb-12",
|
|
404
|
+
lg: "p-6 pb-16"
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
defaultVariants: {
|
|
408
|
+
size: "default"
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
function BigNumberCardRoot({ children, className, size }) {
|
|
413
|
+
return /* @__PURE__ */ jsx("div", { className: cn(rootVariants({ size }), className), children });
|
|
414
|
+
}
|
|
415
|
+
BigNumberCardRoot.displayName = "BigNumberCard.Root";
|
|
416
|
+
function BigNumberCardHeader({ children, className }) {
|
|
417
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-between", className), children });
|
|
418
|
+
}
|
|
419
|
+
BigNumberCardHeader.displayName = "BigNumberCard.Header";
|
|
420
|
+
function BigNumberCardTitle({ children, className }) {
|
|
421
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium text-muted-foreground", className), children });
|
|
422
|
+
}
|
|
423
|
+
BigNumberCardTitle.displayName = "BigNumberCard.Title";
|
|
424
|
+
function BigNumberCardLink({ children, href, onClick, className }) {
|
|
425
|
+
const handleClick = (e) => {
|
|
426
|
+
if (onClick) {
|
|
427
|
+
e.preventDefault();
|
|
428
|
+
onClick();
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
return /* @__PURE__ */ jsx(
|
|
432
|
+
"a",
|
|
433
|
+
{
|
|
434
|
+
href: href ?? "#",
|
|
435
|
+
onClick: handleClick,
|
|
436
|
+
className: cn(
|
|
437
|
+
"text-xs font-medium text-primary hover:text-primary/80 hover:underline transition-colors",
|
|
438
|
+
className
|
|
439
|
+
),
|
|
440
|
+
children
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
BigNumberCardLink.displayName = "BigNumberCard.Link";
|
|
445
|
+
function BigNumberCardContent({ children, className }) {
|
|
446
|
+
return /* @__PURE__ */ jsx("div", { className: cn("mt-3 space-y-1", className), children });
|
|
447
|
+
}
|
|
448
|
+
BigNumberCardContent.displayName = "BigNumberCard.Content";
|
|
449
|
+
function BigNumberCardValue({ children, prefix, suffix, className }) {
|
|
450
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("mt-3 text-3xl font-bold tracking-tight text-foreground", className), children: [
|
|
451
|
+
prefix && /* @__PURE__ */ jsx("span", { className: "text-2xl", children: prefix }),
|
|
452
|
+
children,
|
|
453
|
+
suffix && /* @__PURE__ */ jsx("span", { className: "text-2xl ml-0.5", children: suffix })
|
|
454
|
+
] });
|
|
455
|
+
}
|
|
456
|
+
BigNumberCardValue.displayName = "BigNumberCard.Value";
|
|
457
|
+
function BigNumberCardTrend({ value, direction, children, className, show = true }) {
|
|
458
|
+
if (!show) {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
const isUp = direction === "up";
|
|
462
|
+
const Icon2 = isUp ? TrendingUp : TrendingDown;
|
|
463
|
+
return /* @__PURE__ */ jsxs(
|
|
464
|
+
"div",
|
|
465
|
+
{
|
|
466
|
+
className: cn(
|
|
467
|
+
"mt-2 flex items-center gap-1.5 text-sm",
|
|
468
|
+
isUp ? "text-emerald-600 dark:text-emerald-400" : "text-red-600 dark:text-red-400",
|
|
469
|
+
className
|
|
470
|
+
),
|
|
471
|
+
children: [
|
|
472
|
+
/* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4 flex-shrink-0" }),
|
|
473
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
474
|
+
isUp ? "+" : "",
|
|
475
|
+
value.toFixed(1),
|
|
476
|
+
"%"
|
|
477
|
+
] }),
|
|
478
|
+
children && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-normal", children })
|
|
479
|
+
]
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
BigNumberCardTrend.displayName = "BigNumberCard.Trend";
|
|
484
|
+
function BigNumberCardDescription({ children, className, show = true }) {
|
|
485
|
+
if (!show) {
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
return /* @__PURE__ */ jsx("p", { className: cn("mt-1 text-xs text-muted-foreground", className), children });
|
|
489
|
+
}
|
|
490
|
+
BigNumberCardDescription.displayName = "BigNumberCard.Description";
|
|
491
|
+
function BigNumberCardSparklineWrapper(props) {
|
|
492
|
+
const { show = true, ...rest } = props;
|
|
493
|
+
if (!show) {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
return /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 h-16 opacity-80", children: /* @__PURE__ */ jsx(Sparkline, { ...rest, show }) });
|
|
497
|
+
}
|
|
498
|
+
BigNumberCardSparklineWrapper.displayName = "BigNumberCard.Sparkline";
|
|
499
|
+
var BigNumberCard = {
|
|
500
|
+
Root: BigNumberCardRoot,
|
|
501
|
+
Header: BigNumberCardHeader,
|
|
502
|
+
Title: BigNumberCardTitle,
|
|
503
|
+
Link: BigNumberCardLink,
|
|
504
|
+
Content: BigNumberCardContent,
|
|
505
|
+
Value: BigNumberCardValue,
|
|
506
|
+
Trend: BigNumberCardTrend,
|
|
507
|
+
Description: BigNumberCardDescription,
|
|
508
|
+
Sparkline: BigNumberCardSparklineWrapper
|
|
509
|
+
};
|
|
510
|
+
function Skeleton({
|
|
511
|
+
className,
|
|
512
|
+
variant = "default",
|
|
513
|
+
animation = "pulse",
|
|
514
|
+
...props
|
|
515
|
+
}) {
|
|
516
|
+
return /* @__PURE__ */ jsx(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
className: cn(
|
|
520
|
+
"bg-muted",
|
|
521
|
+
{
|
|
522
|
+
"rounded-md": variant === "default",
|
|
523
|
+
"rounded-full": variant === "circular",
|
|
524
|
+
"rounded h-4": variant === "text",
|
|
525
|
+
"animate-pulse": animation === "pulse",
|
|
526
|
+
"animate-shimmer": animation === "wave"
|
|
527
|
+
},
|
|
528
|
+
className
|
|
529
|
+
),
|
|
530
|
+
...props
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
Skeleton.displayName = "Skeleton";
|
|
235
535
|
var selectVariants = cva(
|
|
236
536
|
"w-full h-12 px-3 pt-4 pb-2 text-sm bg-background rounded-md border-2 transition-colors focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50",
|
|
237
537
|
{
|
|
@@ -252,7 +552,7 @@ var selectVariants = cva(
|
|
|
252
552
|
}
|
|
253
553
|
}
|
|
254
554
|
);
|
|
255
|
-
var Select =
|
|
555
|
+
var Select = React48.forwardRef(
|
|
256
556
|
({
|
|
257
557
|
className,
|
|
258
558
|
variant,
|
|
@@ -321,7 +621,7 @@ var Select = React36.forwardRef(
|
|
|
321
621
|
}
|
|
322
622
|
);
|
|
323
623
|
Select.displayName = "Select";
|
|
324
|
-
var SelectItem =
|
|
624
|
+
var SelectItem = React48.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
325
625
|
SelectPrimitive.Item,
|
|
326
626
|
{
|
|
327
627
|
ref,
|
|
@@ -340,7 +640,7 @@ var SelectItem = React36.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
340
640
|
));
|
|
341
641
|
SelectItem.displayName = "SelectItem";
|
|
342
642
|
var SelectGroup = SelectPrimitive.Group;
|
|
343
|
-
var SelectLabel =
|
|
643
|
+
var SelectLabel = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
344
644
|
SelectPrimitive.Label,
|
|
345
645
|
{
|
|
346
646
|
ref,
|
|
@@ -349,7 +649,7 @@ var SelectLabel = React36.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
349
649
|
}
|
|
350
650
|
));
|
|
351
651
|
SelectLabel.displayName = "SelectLabel";
|
|
352
|
-
var SelectSeparator =
|
|
652
|
+
var SelectSeparator = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
353
653
|
SelectPrimitive.Separator,
|
|
354
654
|
{
|
|
355
655
|
ref,
|
|
@@ -359,7 +659,7 @@ var SelectSeparator = React36.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
359
659
|
));
|
|
360
660
|
SelectSeparator.displayName = "SelectSeparator";
|
|
361
661
|
var Tabs = TabsPrimitive.Root;
|
|
362
|
-
var TabsList =
|
|
662
|
+
var TabsList = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
363
663
|
TabsPrimitive.List,
|
|
364
664
|
{
|
|
365
665
|
ref,
|
|
@@ -371,7 +671,7 @@ var TabsList = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
371
671
|
}
|
|
372
672
|
));
|
|
373
673
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
374
|
-
var TabsTrigger =
|
|
674
|
+
var TabsTrigger = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
375
675
|
TabsPrimitive.Trigger,
|
|
376
676
|
{
|
|
377
677
|
ref,
|
|
@@ -383,7 +683,7 @@ var TabsTrigger = React36.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
383
683
|
}
|
|
384
684
|
));
|
|
385
685
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
386
|
-
var TabsContent =
|
|
686
|
+
var TabsContent = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
387
687
|
TabsPrimitive.Content,
|
|
388
688
|
{
|
|
389
689
|
ref,
|
|
@@ -492,7 +792,7 @@ function BarsLoader() {
|
|
|
492
792
|
i
|
|
493
793
|
)) });
|
|
494
794
|
}
|
|
495
|
-
var Loader =
|
|
795
|
+
var Loader = React48.forwardRef(
|
|
496
796
|
({
|
|
497
797
|
variant = "default",
|
|
498
798
|
message,
|
|
@@ -542,21 +842,21 @@ var Loader = React36.forwardRef(
|
|
|
542
842
|
}
|
|
543
843
|
);
|
|
544
844
|
Loader.displayName = "Loader";
|
|
545
|
-
var LoaderContext =
|
|
845
|
+
var LoaderContext = React48.createContext(
|
|
546
846
|
void 0
|
|
547
847
|
);
|
|
548
848
|
function LoaderProvider({ children }) {
|
|
549
|
-
const [isLoading, setIsLoading] =
|
|
550
|
-
const [loaderOptions, setLoaderOptions] =
|
|
551
|
-
const show =
|
|
849
|
+
const [isLoading, setIsLoading] = React48.useState(false);
|
|
850
|
+
const [loaderOptions, setLoaderOptions] = React48.useState({});
|
|
851
|
+
const show = React48.useCallback((options = {}) => {
|
|
552
852
|
setLoaderOptions(options);
|
|
553
853
|
setIsLoading(true);
|
|
554
854
|
}, []);
|
|
555
|
-
const hide =
|
|
855
|
+
const hide = React48.useCallback(() => {
|
|
556
856
|
setIsLoading(false);
|
|
557
857
|
setTimeout(() => setLoaderOptions({}), 300);
|
|
558
858
|
}, []);
|
|
559
|
-
const value =
|
|
859
|
+
const value = React48.useMemo(
|
|
560
860
|
() => ({ show, hide, isLoading }),
|
|
561
861
|
[show, hide, isLoading]
|
|
562
862
|
);
|
|
@@ -575,7 +875,7 @@ function LoaderProvider({ children }) {
|
|
|
575
875
|
] });
|
|
576
876
|
}
|
|
577
877
|
function useLoader() {
|
|
578
|
-
const context =
|
|
878
|
+
const context = React48.useContext(LoaderContext);
|
|
579
879
|
if (context === void 0) {
|
|
580
880
|
throw new Error("useLoader must be used within a LoaderProvider");
|
|
581
881
|
}
|
|
@@ -607,7 +907,7 @@ var loader = {
|
|
|
607
907
|
};
|
|
608
908
|
function GlobalLoaderController() {
|
|
609
909
|
const loaderController = useLoader();
|
|
610
|
-
|
|
910
|
+
React48.useEffect(() => {
|
|
611
911
|
setGlobalLoader(loaderController);
|
|
612
912
|
return () => {
|
|
613
913
|
setGlobalLoader(null);
|
|
@@ -693,7 +993,7 @@ var iconAnimation = {
|
|
|
693
993
|
whileHover: { scale: 1.1 },
|
|
694
994
|
whileTap: { scale: 0.9 }
|
|
695
995
|
};
|
|
696
|
-
var EmptyStateContent =
|
|
996
|
+
var EmptyStateContent = React48.memo(
|
|
697
997
|
({
|
|
698
998
|
message = "Nenhum item encontrado",
|
|
699
999
|
description,
|
|
@@ -705,7 +1005,7 @@ var EmptyStateContent = React36.memo(
|
|
|
705
1005
|
layout = "vertical",
|
|
706
1006
|
className
|
|
707
1007
|
}) => {
|
|
708
|
-
const handleAction =
|
|
1008
|
+
const handleAction = React48.useCallback(() => {
|
|
709
1009
|
if (onAction) {
|
|
710
1010
|
onAction();
|
|
711
1011
|
}
|
|
@@ -735,7 +1035,7 @@ var EmptyStateContent = React36.memo(
|
|
|
735
1035
|
}
|
|
736
1036
|
);
|
|
737
1037
|
EmptyStateContent.displayName = "EmptyStateContent";
|
|
738
|
-
var AnimatedEmptyState =
|
|
1038
|
+
var AnimatedEmptyState = React48.memo((props) => {
|
|
739
1039
|
const {
|
|
740
1040
|
message = "Nenhum item encontrado",
|
|
741
1041
|
description,
|
|
@@ -747,7 +1047,7 @@ var AnimatedEmptyState = React36.memo((props) => {
|
|
|
747
1047
|
layout = "vertical",
|
|
748
1048
|
className
|
|
749
1049
|
} = props;
|
|
750
|
-
const handleAction =
|
|
1050
|
+
const handleAction = React48.useCallback(() => {
|
|
751
1051
|
if (onAction) {
|
|
752
1052
|
onAction();
|
|
753
1053
|
}
|
|
@@ -790,7 +1090,7 @@ var AnimatedEmptyState = React36.memo((props) => {
|
|
|
790
1090
|
);
|
|
791
1091
|
});
|
|
792
1092
|
AnimatedEmptyState.displayName = "AnimatedEmptyState";
|
|
793
|
-
var EmptyState =
|
|
1093
|
+
var EmptyState = React48.memo(
|
|
794
1094
|
({ animated = true, ...props }) => {
|
|
795
1095
|
if (!animated) {
|
|
796
1096
|
return /* @__PURE__ */ jsx(EmptyStateContent, { ...props });
|
|
@@ -804,13 +1104,13 @@ function useDataTableInternal({
|
|
|
804
1104
|
columns,
|
|
805
1105
|
getRowId
|
|
806
1106
|
}) {
|
|
807
|
-
const [rowSelection, setRowSelection] =
|
|
808
|
-
const [columnVisibility, setColumnVisibility] =
|
|
809
|
-
const [columnFilters, setColumnFilters] =
|
|
810
|
-
const [sorting, setSorting] =
|
|
811
|
-
const [globalFilter, setGlobalFilter] =
|
|
812
|
-
const [density, setDensity] =
|
|
813
|
-
const [pagination, setPagination] =
|
|
1107
|
+
const [rowSelection, setRowSelection] = React48.useState({});
|
|
1108
|
+
const [columnVisibility, setColumnVisibility] = React48.useState({});
|
|
1109
|
+
const [columnFilters, setColumnFilters] = React48.useState([]);
|
|
1110
|
+
const [sorting, setSorting] = React48.useState([]);
|
|
1111
|
+
const [globalFilter, setGlobalFilter] = React48.useState("");
|
|
1112
|
+
const [density, setDensity] = React48.useState("default");
|
|
1113
|
+
const [pagination, setPagination] = React48.useState({
|
|
814
1114
|
pageIndex: 0,
|
|
815
1115
|
pageSize: 10
|
|
816
1116
|
});
|
|
@@ -844,7 +1144,7 @@ function useDataTableInternal({
|
|
|
844
1144
|
getPaginationRowModel: getPaginationRowModel(),
|
|
845
1145
|
getSortedRowModel: getSortedRowModel()
|
|
846
1146
|
});
|
|
847
|
-
const meta =
|
|
1147
|
+
const meta = React48.useMemo(
|
|
848
1148
|
() => ({
|
|
849
1149
|
isLoading: false,
|
|
850
1150
|
// Loading é controlado externamente via DataTable.Loading
|
|
@@ -862,11 +1162,11 @@ function useDataTableInternal({
|
|
|
862
1162
|
setDensity
|
|
863
1163
|
};
|
|
864
1164
|
}
|
|
865
|
-
var DataTableInstanceContext =
|
|
1165
|
+
var DataTableInstanceContext = React48.createContext(null);
|
|
866
1166
|
DataTableInstanceContext.displayName = "DataTableInstanceContext";
|
|
867
|
-
var DataTableMetaContext =
|
|
1167
|
+
var DataTableMetaContext = React48.createContext(null);
|
|
868
1168
|
DataTableMetaContext.displayName = "DataTableMetaContext";
|
|
869
|
-
var DataTableDensityContext =
|
|
1169
|
+
var DataTableDensityContext = React48.createContext(null);
|
|
870
1170
|
DataTableDensityContext.displayName = "DataTableDensityContext";
|
|
871
1171
|
function DataTableProvider({
|
|
872
1172
|
children,
|
|
@@ -875,11 +1175,11 @@ function DataTableProvider({
|
|
|
875
1175
|
density,
|
|
876
1176
|
setDensity
|
|
877
1177
|
}) {
|
|
878
|
-
const metaValue =
|
|
1178
|
+
const metaValue = React48.useMemo(
|
|
879
1179
|
() => meta,
|
|
880
1180
|
[meta.isLoading, meta.isEmpty, meta.selectedRowCount, meta.totalRows, meta.density]
|
|
881
1181
|
);
|
|
882
|
-
const densityValue =
|
|
1182
|
+
const densityValue = React48.useMemo(
|
|
883
1183
|
() => ({ density, setDensity }),
|
|
884
1184
|
[density, setDensity]
|
|
885
1185
|
);
|
|
@@ -887,7 +1187,7 @@ function DataTableProvider({
|
|
|
887
1187
|
return /* @__PURE__ */ jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsx(DataTableDensityContext.Provider, { value: densityValue, children }) }) });
|
|
888
1188
|
}
|
|
889
1189
|
function useDataTable() {
|
|
890
|
-
const context =
|
|
1190
|
+
const context = React48.useContext(DataTableInstanceContext);
|
|
891
1191
|
if (!context) {
|
|
892
1192
|
throw new Error(
|
|
893
1193
|
"useDataTable must be used within <DataTable>. Make sure your component is wrapped with DataTable."
|
|
@@ -896,7 +1196,7 @@ function useDataTable() {
|
|
|
896
1196
|
return context;
|
|
897
1197
|
}
|
|
898
1198
|
function useDataTableMeta() {
|
|
899
|
-
const context =
|
|
1199
|
+
const context = React48.useContext(DataTableMetaContext);
|
|
900
1200
|
if (!context) {
|
|
901
1201
|
throw new Error(
|
|
902
1202
|
"useDataTableMeta must be used within <DataTable>. Make sure your component is wrapped with DataTable."
|
|
@@ -914,12 +1214,12 @@ function useDataTableEmpty() {
|
|
|
914
1214
|
}
|
|
915
1215
|
function useDataTableSelection() {
|
|
916
1216
|
const table = useDataTable();
|
|
917
|
-
return
|
|
1217
|
+
return React48.useMemo(() => {
|
|
918
1218
|
return table.getSelectedRowModel().rows.map((row) => row.original);
|
|
919
1219
|
}, [table.getSelectedRowModel().rows]);
|
|
920
1220
|
}
|
|
921
1221
|
function useDataTableDensity() {
|
|
922
|
-
const context =
|
|
1222
|
+
const context = React48.useContext(DataTableDensityContext);
|
|
923
1223
|
if (!context) {
|
|
924
1224
|
throw new Error(
|
|
925
1225
|
"useDataTableDensity must be used within <DataTable>. Make sure your component is wrapped with DataTable."
|
|
@@ -930,7 +1230,7 @@ function useDataTableDensity() {
|
|
|
930
1230
|
function useDataTablePagination() {
|
|
931
1231
|
const table = useDataTable();
|
|
932
1232
|
const { pageIndex, pageSize } = table.getState().pagination;
|
|
933
|
-
return
|
|
1233
|
+
return React48.useMemo(() => {
|
|
934
1234
|
const pageCount = table.getPageCount();
|
|
935
1235
|
return {
|
|
936
1236
|
pageIndex,
|
|
@@ -950,7 +1250,7 @@ function useDataTablePagination() {
|
|
|
950
1250
|
function useDataTableSorting() {
|
|
951
1251
|
const table = useDataTable();
|
|
952
1252
|
const sorting = table.getState().sorting;
|
|
953
|
-
return
|
|
1253
|
+
return React48.useMemo(() => ({
|
|
954
1254
|
sorting,
|
|
955
1255
|
setSorting: table.setSorting,
|
|
956
1256
|
clearSorting: () => table.resetSorting(),
|
|
@@ -963,7 +1263,7 @@ function useDataTableSorting() {
|
|
|
963
1263
|
function useDataTableColumnVisibility() {
|
|
964
1264
|
const table = useDataTable();
|
|
965
1265
|
const columnVisibility = table.getState().columnVisibility;
|
|
966
|
-
return
|
|
1266
|
+
return React48.useMemo(() => ({
|
|
967
1267
|
columnVisibility,
|
|
968
1268
|
setColumnVisibility: table.setColumnVisibility,
|
|
969
1269
|
toggleColumn: (columnId) => {
|
|
@@ -1025,7 +1325,7 @@ var DENSITY_CONFIG = {
|
|
|
1025
1325
|
padding: "py-3 px-4"
|
|
1026
1326
|
}
|
|
1027
1327
|
};
|
|
1028
|
-
var Table =
|
|
1328
|
+
var Table = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
1029
1329
|
"table",
|
|
1030
1330
|
{
|
|
1031
1331
|
ref,
|
|
@@ -1034,9 +1334,9 @@ var Table = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
1034
1334
|
}
|
|
1035
1335
|
) }));
|
|
1036
1336
|
Table.displayName = "Table";
|
|
1037
|
-
var TableHeader =
|
|
1337
|
+
var TableHeader = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
1038
1338
|
TableHeader.displayName = "TableHeader";
|
|
1039
|
-
var TableBody =
|
|
1339
|
+
var TableBody = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1040
1340
|
"tbody",
|
|
1041
1341
|
{
|
|
1042
1342
|
ref,
|
|
@@ -1045,7 +1345,7 @@ var TableBody = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
1045
1345
|
}
|
|
1046
1346
|
));
|
|
1047
1347
|
TableBody.displayName = "TableBody";
|
|
1048
|
-
var TableFooter =
|
|
1348
|
+
var TableFooter = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1049
1349
|
"tfoot",
|
|
1050
1350
|
{
|
|
1051
1351
|
ref,
|
|
@@ -1057,8 +1357,8 @@ var TableFooter = React36.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1057
1357
|
}
|
|
1058
1358
|
));
|
|
1059
1359
|
TableFooter.displayName = "TableFooter";
|
|
1060
|
-
var TableRow =
|
|
1061
|
-
|
|
1360
|
+
var TableRow = React48.memo(
|
|
1361
|
+
React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1062
1362
|
"tr",
|
|
1063
1363
|
{
|
|
1064
1364
|
ref,
|
|
@@ -1071,7 +1371,7 @@ var TableRow = React36.memo(
|
|
|
1071
1371
|
))
|
|
1072
1372
|
);
|
|
1073
1373
|
TableRow.displayName = "TableRow";
|
|
1074
|
-
var TableHead =
|
|
1374
|
+
var TableHead = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1075
1375
|
"th",
|
|
1076
1376
|
{
|
|
1077
1377
|
ref,
|
|
@@ -1083,8 +1383,8 @@ var TableHead = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
1083
1383
|
}
|
|
1084
1384
|
));
|
|
1085
1385
|
TableHead.displayName = "TableHead";
|
|
1086
|
-
var TableCell =
|
|
1087
|
-
|
|
1386
|
+
var TableCell = React48.memo(
|
|
1387
|
+
React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1088
1388
|
"td",
|
|
1089
1389
|
{
|
|
1090
1390
|
ref,
|
|
@@ -1094,7 +1394,7 @@ var TableCell = React36.memo(
|
|
|
1094
1394
|
))
|
|
1095
1395
|
);
|
|
1096
1396
|
TableCell.displayName = "TableCell";
|
|
1097
|
-
var TableCaption =
|
|
1397
|
+
var TableCaption = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1098
1398
|
"caption",
|
|
1099
1399
|
{
|
|
1100
1400
|
ref,
|
|
@@ -1103,7 +1403,7 @@ var TableCaption = React36.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
1103
1403
|
}
|
|
1104
1404
|
));
|
|
1105
1405
|
TableCaption.displayName = "TableCaption";
|
|
1106
|
-
var DataTableContent =
|
|
1406
|
+
var DataTableContent = React48.memo(function DataTableContent2({
|
|
1107
1407
|
stickyHeader = false,
|
|
1108
1408
|
stripedRows = false,
|
|
1109
1409
|
highlightOnHover = true,
|
|
@@ -1149,15 +1449,15 @@ var DataTableContent = React36.memo(function DataTableContent2({
|
|
|
1149
1449
|
] }) });
|
|
1150
1450
|
});
|
|
1151
1451
|
DataTableContent.displayName = "DataTable.Content";
|
|
1152
|
-
var DataTableToolbar =
|
|
1452
|
+
var DataTableToolbar = React48.memo(function DataTableToolbar2({
|
|
1153
1453
|
className,
|
|
1154
1454
|
children
|
|
1155
1455
|
}) {
|
|
1156
1456
|
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-between gap-2", className), children });
|
|
1157
1457
|
});
|
|
1158
1458
|
function useDebounce(value, delay = 300) {
|
|
1159
|
-
const [debouncedValue, setDebouncedValue] =
|
|
1160
|
-
|
|
1459
|
+
const [debouncedValue, setDebouncedValue] = React48.useState(value);
|
|
1460
|
+
React48.useEffect(() => {
|
|
1161
1461
|
const handler = setTimeout(() => {
|
|
1162
1462
|
setDebouncedValue(value);
|
|
1163
1463
|
}, delay);
|
|
@@ -1168,12 +1468,12 @@ function useDebounce(value, delay = 300) {
|
|
|
1168
1468
|
return debouncedValue;
|
|
1169
1469
|
}
|
|
1170
1470
|
function useDebouncedCallback(callback, delay = 300) {
|
|
1171
|
-
const callbackRef =
|
|
1172
|
-
const timeoutRef =
|
|
1173
|
-
|
|
1471
|
+
const callbackRef = React48.useRef(callback);
|
|
1472
|
+
const timeoutRef = React48.useRef(null);
|
|
1473
|
+
React48.useEffect(() => {
|
|
1174
1474
|
callbackRef.current = callback;
|
|
1175
1475
|
}, [callback]);
|
|
1176
|
-
return
|
|
1476
|
+
return React48.useCallback(
|
|
1177
1477
|
(...args) => {
|
|
1178
1478
|
if (timeoutRef.current) {
|
|
1179
1479
|
clearTimeout(timeoutRef.current);
|
|
@@ -1185,7 +1485,7 @@ function useDebouncedCallback(callback, delay = 300) {
|
|
|
1185
1485
|
[delay]
|
|
1186
1486
|
);
|
|
1187
1487
|
}
|
|
1188
|
-
var DataTableSearch =
|
|
1488
|
+
var DataTableSearch = React48.memo(function DataTableSearch2({
|
|
1189
1489
|
column,
|
|
1190
1490
|
placeholder = "Buscar...",
|
|
1191
1491
|
debounce = 300,
|
|
@@ -1194,17 +1494,17 @@ var DataTableSearch = React36.memo(function DataTableSearch2({
|
|
|
1194
1494
|
}) {
|
|
1195
1495
|
const table = useDataTableInstance();
|
|
1196
1496
|
const columnInstance = table.getColumn(column);
|
|
1197
|
-
const [value, setValue] =
|
|
1497
|
+
const [value, setValue] = React48.useState(
|
|
1198
1498
|
columnInstance?.getFilterValue() ?? ""
|
|
1199
1499
|
);
|
|
1200
1500
|
const debouncedValue = useDebounce(value, debounce);
|
|
1201
|
-
|
|
1501
|
+
React48.useEffect(() => {
|
|
1202
1502
|
columnInstance?.setFilterValue(debouncedValue);
|
|
1203
1503
|
if (onSearch) {
|
|
1204
1504
|
onSearch(debouncedValue);
|
|
1205
1505
|
}
|
|
1206
1506
|
}, [debouncedValue, columnInstance, onSearch]);
|
|
1207
|
-
|
|
1507
|
+
React48.useEffect(() => {
|
|
1208
1508
|
const filterValue = columnInstance?.getFilterValue() ?? "";
|
|
1209
1509
|
if (filterValue !== value) {
|
|
1210
1510
|
setValue(filterValue);
|
|
@@ -1220,15 +1520,15 @@ var DataTableSearch = React36.memo(function DataTableSearch2({
|
|
|
1220
1520
|
}
|
|
1221
1521
|
);
|
|
1222
1522
|
});
|
|
1223
|
-
var DataTableFilters =
|
|
1523
|
+
var DataTableFilters = React48.memo(function DataTableFilters2({
|
|
1224
1524
|
onChange,
|
|
1225
1525
|
className,
|
|
1226
1526
|
children
|
|
1227
1527
|
}) {
|
|
1228
1528
|
const table = useDataTableInstance();
|
|
1229
1529
|
const filters = table.getState().columnFilters;
|
|
1230
|
-
const filtersRef =
|
|
1231
|
-
|
|
1530
|
+
const filtersRef = React48.useRef(filters);
|
|
1531
|
+
React48.useEffect(() => {
|
|
1232
1532
|
if (onChange && JSON.stringify(filters) !== JSON.stringify(filtersRef.current)) {
|
|
1233
1533
|
filtersRef.current = filters;
|
|
1234
1534
|
onChange(filters);
|
|
@@ -1236,7 +1536,7 @@ var DataTableFilters = React36.memo(function DataTableFilters2({
|
|
|
1236
1536
|
}, [filters, onChange]);
|
|
1237
1537
|
return /* @__PURE__ */ jsx("div", { className: cn("flex gap-2", className), children });
|
|
1238
1538
|
});
|
|
1239
|
-
var DataTableFilter =
|
|
1539
|
+
var DataTableFilter = React48.memo(function DataTableFilter2({
|
|
1240
1540
|
column: columnId,
|
|
1241
1541
|
title,
|
|
1242
1542
|
options,
|
|
@@ -1246,7 +1546,7 @@ var DataTableFilter = React36.memo(function DataTableFilter2({
|
|
|
1246
1546
|
const column = table.getColumn(columnId);
|
|
1247
1547
|
const filterValue = column?.getFilterValue() ?? [];
|
|
1248
1548
|
const currentValue = filterValue.length > 0 ? filterValue[0] : "all";
|
|
1249
|
-
const handleValueChange =
|
|
1549
|
+
const handleValueChange = React48.useCallback(
|
|
1250
1550
|
(value) => {
|
|
1251
1551
|
if (value === "all") {
|
|
1252
1552
|
column?.setFilterValue(void 0);
|
|
@@ -1271,7 +1571,7 @@ var DataTableFilter = React36.memo(function DataTableFilter2({
|
|
|
1271
1571
|
}
|
|
1272
1572
|
);
|
|
1273
1573
|
});
|
|
1274
|
-
var DataTablePagination =
|
|
1574
|
+
var DataTablePagination = React48.memo(function DataTablePagination2({
|
|
1275
1575
|
mode = "client",
|
|
1276
1576
|
pageCount: externalPageCount,
|
|
1277
1577
|
pageSizes = [10, 20, 30, 50],
|
|
@@ -1298,7 +1598,7 @@ var DataTablePagination = React36.memo(function DataTablePagination2({
|
|
|
1298
1598
|
const pageCount = mode === "server" && externalPageCount !== void 0 ? externalPageCount : internalPageCount;
|
|
1299
1599
|
const canGoPrevious = pageIndex > 0;
|
|
1300
1600
|
const canGoNext = pageIndex < pageCount - 1;
|
|
1301
|
-
const handlePageSizeChange =
|
|
1601
|
+
const handlePageSizeChange = React48.useCallback(
|
|
1302
1602
|
(value) => {
|
|
1303
1603
|
setPageSize(Number(value));
|
|
1304
1604
|
},
|
|
@@ -1397,7 +1697,7 @@ var DataTablePagination = React36.memo(function DataTablePagination2({
|
|
|
1397
1697
|
);
|
|
1398
1698
|
});
|
|
1399
1699
|
DataTablePagination.displayName = "DataTable.Pagination";
|
|
1400
|
-
var DataTableEmptyState =
|
|
1700
|
+
var DataTableEmptyState = React48.memo(function DataTableEmptyState2({
|
|
1401
1701
|
message = "Nenhum resultado encontrado.",
|
|
1402
1702
|
description,
|
|
1403
1703
|
icon,
|
|
@@ -1521,8 +1821,8 @@ var iconSizeMap = {
|
|
|
1521
1821
|
md: "h-4 w-4",
|
|
1522
1822
|
lg: "h-5 w-5"
|
|
1523
1823
|
};
|
|
1524
|
-
var Checkbox =
|
|
1525
|
-
|
|
1824
|
+
var Checkbox = React48.memo(
|
|
1825
|
+
React48.forwardRef(({ className, variant, size = "md", ...props }, ref) => {
|
|
1526
1826
|
const iconSize = iconSizeMap[size || "md"];
|
|
1527
1827
|
return /* @__PURE__ */ jsx(
|
|
1528
1828
|
CheckboxPrimitive.Root,
|
|
@@ -1546,9 +1846,9 @@ function DataTableColumnVisibility({
|
|
|
1546
1846
|
className
|
|
1547
1847
|
}) {
|
|
1548
1848
|
const table = useDataTable();
|
|
1549
|
-
const [open, setOpen] =
|
|
1550
|
-
const dropdownRef =
|
|
1551
|
-
|
|
1849
|
+
const [open, setOpen] = React48.useState(false);
|
|
1850
|
+
const dropdownRef = React48.useRef(null);
|
|
1851
|
+
React48.useEffect(() => {
|
|
1552
1852
|
function handleClickOutside(event) {
|
|
1553
1853
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1554
1854
|
setOpen(false);
|
|
@@ -1627,9 +1927,9 @@ function DataTableDensityToggle({
|
|
|
1627
1927
|
className
|
|
1628
1928
|
}) {
|
|
1629
1929
|
const { density, setDensity } = useDataTableDensity();
|
|
1630
|
-
const [open, setOpen] =
|
|
1631
|
-
const dropdownRef =
|
|
1632
|
-
|
|
1930
|
+
const [open, setOpen] = React48.useState(false);
|
|
1931
|
+
const dropdownRef = React48.useRef(null);
|
|
1932
|
+
React48.useEffect(() => {
|
|
1633
1933
|
function handleClickOutside(event) {
|
|
1634
1934
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1635
1935
|
setOpen(false);
|
|
@@ -1808,9 +2108,9 @@ function DataTableExport({
|
|
|
1808
2108
|
className
|
|
1809
2109
|
}) {
|
|
1810
2110
|
const table = useDataTable();
|
|
1811
|
-
const [open, setOpen] =
|
|
1812
|
-
const dropdownRef =
|
|
1813
|
-
|
|
2111
|
+
const [open, setOpen] = React48.useState(false);
|
|
2112
|
+
const dropdownRef = React48.useRef(null);
|
|
2113
|
+
React48.useEffect(() => {
|
|
1814
2114
|
function handleClickOutside(event) {
|
|
1815
2115
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1816
2116
|
setOpen(false);
|
|
@@ -1821,7 +2121,7 @@ function DataTableExport({
|
|
|
1821
2121
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1822
2122
|
}
|
|
1823
2123
|
}, [open]);
|
|
1824
|
-
const handleExport =
|
|
2124
|
+
const handleExport = React48.useCallback((format) => {
|
|
1825
2125
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
1826
2126
|
const rows = table.getFilteredRowModel().rows;
|
|
1827
2127
|
const headers = [];
|
|
@@ -1924,7 +2224,7 @@ function DataTableTabs({
|
|
|
1924
2224
|
onValueChange,
|
|
1925
2225
|
className
|
|
1926
2226
|
}) {
|
|
1927
|
-
const [internalValue, setInternalValue] =
|
|
2227
|
+
const [internalValue, setInternalValue] = React48.useState(defaultValue ?? tabs[0]?.value);
|
|
1928
2228
|
const activeValue = value ?? internalValue;
|
|
1929
2229
|
const handleTabClick = (tabValue) => {
|
|
1930
2230
|
if (value === void 0) {
|
|
@@ -2011,8 +2311,8 @@ var Dialog = DialogPrimitive.Root;
|
|
|
2011
2311
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
2012
2312
|
var DialogPortal = DialogPrimitive.Portal;
|
|
2013
2313
|
var DialogClose = DialogPrimitive.Close;
|
|
2014
|
-
var DialogOverlay =
|
|
2015
|
-
|
|
2314
|
+
var DialogOverlay = React48.memo(
|
|
2315
|
+
React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2016
2316
|
DialogPrimitive.Overlay,
|
|
2017
2317
|
{
|
|
2018
2318
|
ref,
|
|
@@ -2059,8 +2359,8 @@ var dialogContentVariants = cva(
|
|
|
2059
2359
|
}
|
|
2060
2360
|
}
|
|
2061
2361
|
);
|
|
2062
|
-
var DialogContent =
|
|
2063
|
-
|
|
2362
|
+
var DialogContent = React48.memo(
|
|
2363
|
+
React48.forwardRef(({ className, children, showCloseButton = true, size, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
2064
2364
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
2065
2365
|
/* @__PURE__ */ jsxs(
|
|
2066
2366
|
DialogPrimitive.Content,
|
|
@@ -2080,7 +2380,7 @@ var DialogContent = React36.memo(
|
|
|
2080
2380
|
] }))
|
|
2081
2381
|
);
|
|
2082
2382
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
2083
|
-
var DialogHeader =
|
|
2383
|
+
var DialogHeader = React48.memo(
|
|
2084
2384
|
({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
2085
2385
|
"div",
|
|
2086
2386
|
{
|
|
@@ -2093,7 +2393,7 @@ var DialogHeader = React36.memo(
|
|
|
2093
2393
|
)
|
|
2094
2394
|
);
|
|
2095
2395
|
DialogHeader.displayName = "DialogHeader";
|
|
2096
|
-
var DialogFooter =
|
|
2396
|
+
var DialogFooter = React48.memo(
|
|
2097
2397
|
({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
2098
2398
|
"div",
|
|
2099
2399
|
{
|
|
@@ -2106,8 +2406,8 @@ var DialogFooter = React36.memo(
|
|
|
2106
2406
|
)
|
|
2107
2407
|
);
|
|
2108
2408
|
DialogFooter.displayName = "DialogFooter";
|
|
2109
|
-
var DialogTitle =
|
|
2110
|
-
|
|
2409
|
+
var DialogTitle = React48.memo(
|
|
2410
|
+
React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2111
2411
|
DialogPrimitive.Title,
|
|
2112
2412
|
{
|
|
2113
2413
|
ref,
|
|
@@ -2120,8 +2420,8 @@ var DialogTitle = React36.memo(
|
|
|
2120
2420
|
))
|
|
2121
2421
|
);
|
|
2122
2422
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
2123
|
-
var DialogDescription =
|
|
2124
|
-
|
|
2423
|
+
var DialogDescription = React48.memo(
|
|
2424
|
+
React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2125
2425
|
DialogPrimitive.Description,
|
|
2126
2426
|
{
|
|
2127
2427
|
ref,
|
|
@@ -2131,7 +2431,7 @@ var DialogDescription = React36.memo(
|
|
|
2131
2431
|
))
|
|
2132
2432
|
);
|
|
2133
2433
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
2134
|
-
var DialogBody =
|
|
2434
|
+
var DialogBody = React48.memo(
|
|
2135
2435
|
({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-y-auto py-2", className), ...props })
|
|
2136
2436
|
);
|
|
2137
2437
|
DialogBody.displayName = "DialogBody";
|
|
@@ -2162,7 +2462,7 @@ var COLOR_MAP = {
|
|
|
2162
2462
|
accent: "border-accent",
|
|
2163
2463
|
muted: "border-muted"
|
|
2164
2464
|
};
|
|
2165
|
-
var RippleRing =
|
|
2465
|
+
var RippleRing = React48.memo(({ size, color, opacity }) => {
|
|
2166
2466
|
const borderColorClass = COLOR_MAP[color] || COLOR_MAP.primary;
|
|
2167
2467
|
return /* @__PURE__ */ jsx(
|
|
2168
2468
|
"div",
|
|
@@ -2181,7 +2481,7 @@ var RippleRing = React36.memo(({ size, color, opacity }) => {
|
|
|
2181
2481
|
);
|
|
2182
2482
|
});
|
|
2183
2483
|
RippleRing.displayName = "RippleRing";
|
|
2184
|
-
var RippleEffect =
|
|
2484
|
+
var RippleEffect = React48.memo(
|
|
2185
2485
|
({
|
|
2186
2486
|
size = "md",
|
|
2187
2487
|
color = "primary",
|
|
@@ -2193,7 +2493,7 @@ var RippleEffect = React36.memo(
|
|
|
2193
2493
|
const { base, increment } = SIZE_CONFIG[size];
|
|
2194
2494
|
const opacities = INTENSITY_CONFIG[intensity];
|
|
2195
2495
|
const positionClasses = POSITION_CONFIG[position];
|
|
2196
|
-
const rippleRings =
|
|
2496
|
+
const rippleRings = React48.useMemo(
|
|
2197
2497
|
() => Array.from({ length: rings }).map((_, index) => {
|
|
2198
2498
|
const ringSize = base + increment * (rings - index - 1);
|
|
2199
2499
|
const opacity = opacities[index] || opacities[opacities.length - 1];
|
|
@@ -2223,7 +2523,7 @@ var RippleEffect = React36.memo(
|
|
|
2223
2523
|
}
|
|
2224
2524
|
);
|
|
2225
2525
|
RippleEffect.displayName = "RippleEffect";
|
|
2226
|
-
var RippleWrapper =
|
|
2526
|
+
var RippleWrapper = React48.memo(
|
|
2227
2527
|
({ children, rippleProps, className }) => {
|
|
2228
2528
|
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
2229
2529
|
rippleProps && /* @__PURE__ */ jsx(RippleEffect, { ...rippleProps }),
|
|
@@ -2232,7 +2532,7 @@ var RippleWrapper = React36.memo(
|
|
|
2232
2532
|
}
|
|
2233
2533
|
);
|
|
2234
2534
|
RippleWrapper.displayName = "RippleWrapper";
|
|
2235
|
-
var RippleBackground =
|
|
2535
|
+
var RippleBackground = React48.memo(
|
|
2236
2536
|
({ containerClassName, ...rippleProps }) => {
|
|
2237
2537
|
return /* @__PURE__ */ jsx(
|
|
2238
2538
|
"div",
|
|
@@ -2298,7 +2598,7 @@ var statusIndicatorVariants = cva(
|
|
|
2298
2598
|
}
|
|
2299
2599
|
}
|
|
2300
2600
|
);
|
|
2301
|
-
var DialogWrapper =
|
|
2601
|
+
var DialogWrapper = React48.memo(
|
|
2302
2602
|
({
|
|
2303
2603
|
children,
|
|
2304
2604
|
className,
|
|
@@ -2311,7 +2611,7 @@ var DialogWrapper = React36.memo(
|
|
|
2311
2611
|
rippleProps,
|
|
2312
2612
|
...props
|
|
2313
2613
|
}) => {
|
|
2314
|
-
const defaultRippleProps =
|
|
2614
|
+
const defaultRippleProps = React48.useMemo(
|
|
2315
2615
|
() => ({
|
|
2316
2616
|
size: size === "sm" ? "md" : size === "lg" ? "xl" : "lg",
|
|
2317
2617
|
color: variant === "secondary" ? "secondary" : variant === "accent" ? "accent" : "primary",
|
|
@@ -2321,7 +2621,7 @@ var DialogWrapper = React36.memo(
|
|
|
2321
2621
|
}),
|
|
2322
2622
|
[size, variant, rippleProps]
|
|
2323
2623
|
);
|
|
2324
|
-
const backgroundRippleProps =
|
|
2624
|
+
const backgroundRippleProps = React48.useMemo(
|
|
2325
2625
|
() => ({
|
|
2326
2626
|
position: "top-right",
|
|
2327
2627
|
size: "xl",
|
|
@@ -2424,7 +2724,7 @@ var Toaster = ({ ...props }) => {
|
|
|
2424
2724
|
}
|
|
2425
2725
|
);
|
|
2426
2726
|
};
|
|
2427
|
-
var CustomToast =
|
|
2727
|
+
var CustomToast = React48.memo(
|
|
2428
2728
|
({ title, description, variant = "default", action, onClose }) => {
|
|
2429
2729
|
const variantStyles = toastVariants[variant];
|
|
2430
2730
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2560,8 +2860,8 @@ var thumbVariants = cva(
|
|
|
2560
2860
|
}
|
|
2561
2861
|
}
|
|
2562
2862
|
);
|
|
2563
|
-
var Switch =
|
|
2564
|
-
|
|
2863
|
+
var Switch = React48.memo(
|
|
2864
|
+
React48.forwardRef(({ className, variant, size = "md", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2565
2865
|
SwitchPrimitives.Root,
|
|
2566
2866
|
{
|
|
2567
2867
|
className: cn(switchVariants({ variant, size, className })),
|
|
@@ -2592,8 +2892,8 @@ var textareaVariants = cva(
|
|
|
2592
2892
|
}
|
|
2593
2893
|
}
|
|
2594
2894
|
);
|
|
2595
|
-
var Textarea =
|
|
2596
|
-
|
|
2895
|
+
var Textarea = React48.memo(
|
|
2896
|
+
React48.forwardRef(
|
|
2597
2897
|
({
|
|
2598
2898
|
className,
|
|
2599
2899
|
variant,
|
|
@@ -2608,12 +2908,12 @@ var Textarea = React36.memo(
|
|
|
2608
2908
|
onChange,
|
|
2609
2909
|
...props
|
|
2610
2910
|
}, ref) => {
|
|
2611
|
-
const textareaRef =
|
|
2612
|
-
|
|
2613
|
-
const focusTextarea =
|
|
2911
|
+
const textareaRef = React48.useRef(null);
|
|
2912
|
+
React48.useImperativeHandle(ref, () => textareaRef.current, []);
|
|
2913
|
+
const focusTextarea = React48.useCallback(() => {
|
|
2614
2914
|
textareaRef.current?.focus();
|
|
2615
2915
|
}, []);
|
|
2616
|
-
const handleChange =
|
|
2916
|
+
const handleChange = React48.useCallback(
|
|
2617
2917
|
(e) => {
|
|
2618
2918
|
if (autoResize && textareaRef.current) {
|
|
2619
2919
|
textareaRef.current.style.height = "auto";
|
|
@@ -2623,7 +2923,7 @@ var Textarea = React36.memo(
|
|
|
2623
2923
|
},
|
|
2624
2924
|
[autoResize, onChange]
|
|
2625
2925
|
);
|
|
2626
|
-
|
|
2926
|
+
React48.useEffect(() => {
|
|
2627
2927
|
if (autoResize && textareaRef.current) {
|
|
2628
2928
|
textareaRef.current.style.height = "auto";
|
|
2629
2929
|
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
|
@@ -2674,9 +2974,9 @@ var Textarea = React36.memo(
|
|
|
2674
2974
|
)
|
|
2675
2975
|
);
|
|
2676
2976
|
Textarea.displayName = "Textarea";
|
|
2677
|
-
var FormContext =
|
|
2977
|
+
var FormContext = React48.createContext(null);
|
|
2678
2978
|
function useFormContext() {
|
|
2679
|
-
const context =
|
|
2979
|
+
const context = React48.useContext(FormContext);
|
|
2680
2980
|
if (!context) {
|
|
2681
2981
|
throw new Error("useFormContext must be used within a Form provider");
|
|
2682
2982
|
}
|
|
@@ -2686,27 +2986,27 @@ function FormProvider({
|
|
|
2686
2986
|
form,
|
|
2687
2987
|
children
|
|
2688
2988
|
}) {
|
|
2689
|
-
const value =
|
|
2989
|
+
const value = React48.useMemo(() => ({ form }), [form]);
|
|
2690
2990
|
return /* @__PURE__ */ jsx(FormContext.Provider, { value, children });
|
|
2691
2991
|
}
|
|
2692
|
-
var FormFieldContext =
|
|
2992
|
+
var FormFieldContext = React48.createContext(null);
|
|
2693
2993
|
function useFormFieldContext() {
|
|
2694
|
-
const context =
|
|
2994
|
+
const context = React48.useContext(FormFieldContext);
|
|
2695
2995
|
if (!context) {
|
|
2696
2996
|
throw new Error("useFormFieldContext must be used within a Form.Field");
|
|
2697
2997
|
}
|
|
2698
2998
|
return context;
|
|
2699
2999
|
}
|
|
2700
3000
|
function useFormFieldContextOptional() {
|
|
2701
|
-
return
|
|
3001
|
+
return React48.useContext(FormFieldContext);
|
|
2702
3002
|
}
|
|
2703
3003
|
function FormFieldProvider({ name, children }) {
|
|
2704
3004
|
const form = useFormContext();
|
|
2705
|
-
const id =
|
|
3005
|
+
const id = React48.useId();
|
|
2706
3006
|
const fieldState = form.getFieldState(name, form.formState);
|
|
2707
3007
|
const error = fieldState.error?.message;
|
|
2708
3008
|
const isRequired = false;
|
|
2709
|
-
const value =
|
|
3009
|
+
const value = React48.useMemo(
|
|
2710
3010
|
() => ({
|
|
2711
3011
|
name,
|
|
2712
3012
|
id,
|
|
@@ -2814,7 +3114,7 @@ function FormInput({
|
|
|
2814
3114
|
const form = useFormContext();
|
|
2815
3115
|
const fieldState = form.getFieldState(name, form.formState);
|
|
2816
3116
|
const error = fieldState.error?.message;
|
|
2817
|
-
const getInputType =
|
|
3117
|
+
const getInputType = React48.useCallback(() => {
|
|
2818
3118
|
if (["money", "percent", "phone", "cpf", "cnpj", "cep"].includes(mask || "")) {
|
|
2819
3119
|
return "tel";
|
|
2820
3120
|
}
|
|
@@ -3010,7 +3310,7 @@ function FormCheckbox({
|
|
|
3010
3310
|
const form = useFormContext();
|
|
3011
3311
|
const fieldState = form.getFieldState(name, form.formState);
|
|
3012
3312
|
const error = fieldState.error?.message;
|
|
3013
|
-
const id =
|
|
3313
|
+
const id = React48.useId();
|
|
3014
3314
|
return /* @__PURE__ */ jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsx(
|
|
3015
3315
|
Controller,
|
|
3016
3316
|
{
|
|
@@ -3065,7 +3365,7 @@ function FormSwitch({
|
|
|
3065
3365
|
const form = useFormContext();
|
|
3066
3366
|
const fieldState = form.getFieldState(name, form.formState);
|
|
3067
3367
|
const error = fieldState.error?.message;
|
|
3068
|
-
const id =
|
|
3368
|
+
const id = React48.useId();
|
|
3069
3369
|
return /* @__PURE__ */ jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsx(
|
|
3070
3370
|
Controller,
|
|
3071
3371
|
{
|
|
@@ -3203,7 +3503,7 @@ function FormRadioGroup({
|
|
|
3203
3503
|
) });
|
|
3204
3504
|
}
|
|
3205
3505
|
FormRadioGroup.displayName = "Form.RadioGroup";
|
|
3206
|
-
var FormLabel =
|
|
3506
|
+
var FormLabel = React48.forwardRef(
|
|
3207
3507
|
({ className, required, children, ...props }, ref) => {
|
|
3208
3508
|
const fieldContext = useFormFieldContextOptional();
|
|
3209
3509
|
return /* @__PURE__ */ jsxs(
|
|
@@ -3226,7 +3526,7 @@ var FormLabel = React36.forwardRef(
|
|
|
3226
3526
|
}
|
|
3227
3527
|
);
|
|
3228
3528
|
FormLabel.displayName = "Form.Label";
|
|
3229
|
-
var FormDescription =
|
|
3529
|
+
var FormDescription = React48.forwardRef(({ className, ...props }, ref) => {
|
|
3230
3530
|
const fieldContext = useFormFieldContextOptional();
|
|
3231
3531
|
if (fieldContext?.error) {
|
|
3232
3532
|
return null;
|
|
@@ -3241,7 +3541,7 @@ var FormDescription = React36.forwardRef(({ className, ...props }, ref) => {
|
|
|
3241
3541
|
);
|
|
3242
3542
|
});
|
|
3243
3543
|
FormDescription.displayName = "Form.Description";
|
|
3244
|
-
var FormError =
|
|
3544
|
+
var FormError = React48.forwardRef(
|
|
3245
3545
|
({ className, message, children, ...props }, ref) => {
|
|
3246
3546
|
const fieldContext = useFormFieldContextOptional();
|
|
3247
3547
|
const errorMessage = message ?? fieldContext?.error;
|
|
@@ -3260,7 +3560,7 @@ var FormError = React36.forwardRef(
|
|
|
3260
3560
|
}
|
|
3261
3561
|
);
|
|
3262
3562
|
FormError.displayName = "Form.Error";
|
|
3263
|
-
var FormFieldWrapper =
|
|
3563
|
+
var FormFieldWrapper = React48.forwardRef(({ className, label, description, required, error, children, ...props }, ref) => {
|
|
3264
3564
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("space-y-1", className), ...props, children: [
|
|
3265
3565
|
label && /* @__PURE__ */ jsx(FormLabel, { required, children: label }),
|
|
3266
3566
|
children,
|
|
@@ -3303,14 +3603,192 @@ var Form = Object.assign(FormRoot, {
|
|
|
3303
3603
|
FieldWrapper: FormFieldWrapper,
|
|
3304
3604
|
Field: FormFieldProvider
|
|
3305
3605
|
});
|
|
3306
|
-
var
|
|
3606
|
+
var Avatar = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3607
|
+
AvatarPrimitive.Root,
|
|
3608
|
+
{
|
|
3609
|
+
ref,
|
|
3610
|
+
className: cn(
|
|
3611
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
3612
|
+
className
|
|
3613
|
+
),
|
|
3614
|
+
...props
|
|
3615
|
+
}
|
|
3616
|
+
));
|
|
3617
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
3618
|
+
var AvatarImage = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3619
|
+
AvatarPrimitive.Image,
|
|
3620
|
+
{
|
|
3621
|
+
ref,
|
|
3622
|
+
className: cn("aspect-square h-full w-full", className),
|
|
3623
|
+
...props
|
|
3624
|
+
}
|
|
3625
|
+
));
|
|
3626
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
3627
|
+
var AvatarFallback = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3628
|
+
AvatarPrimitive.Fallback,
|
|
3629
|
+
{
|
|
3630
|
+
ref,
|
|
3631
|
+
className: cn(
|
|
3632
|
+
"flex h-full w-full items-center justify-center rounded-full bg-primary/10 text-primary font-semibold",
|
|
3633
|
+
className
|
|
3634
|
+
),
|
|
3635
|
+
...props
|
|
3636
|
+
}
|
|
3637
|
+
));
|
|
3638
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
3639
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
3640
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
3641
|
+
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
3642
|
+
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
3643
|
+
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
3644
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
3645
|
+
var DropdownMenuSubTrigger = React48.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
3646
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
3647
|
+
{
|
|
3648
|
+
ref,
|
|
3649
|
+
className: cn(
|
|
3650
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
3651
|
+
inset && "pl-8",
|
|
3652
|
+
className
|
|
3653
|
+
),
|
|
3654
|
+
...props,
|
|
3655
|
+
children: [
|
|
3656
|
+
children,
|
|
3657
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4" })
|
|
3658
|
+
]
|
|
3659
|
+
}
|
|
3660
|
+
));
|
|
3661
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
3662
|
+
var DropdownMenuSubContent = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3663
|
+
DropdownMenuPrimitive.SubContent,
|
|
3664
|
+
{
|
|
3665
|
+
ref,
|
|
3666
|
+
className: cn(
|
|
3667
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3668
|
+
className
|
|
3669
|
+
),
|
|
3670
|
+
...props
|
|
3671
|
+
}
|
|
3672
|
+
));
|
|
3673
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
3674
|
+
var DropdownMenuContent = React48.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
3675
|
+
DropdownMenuPrimitive.Content,
|
|
3676
|
+
{
|
|
3677
|
+
ref,
|
|
3678
|
+
sideOffset,
|
|
3679
|
+
className: cn(
|
|
3680
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3681
|
+
className
|
|
3682
|
+
),
|
|
3683
|
+
...props
|
|
3684
|
+
}
|
|
3685
|
+
) }));
|
|
3686
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
3687
|
+
var DropdownMenuItem = React48.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3688
|
+
DropdownMenuPrimitive.Item,
|
|
3689
|
+
{
|
|
3690
|
+
ref,
|
|
3691
|
+
className: cn(
|
|
3692
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3693
|
+
inset && "pl-8",
|
|
3694
|
+
className
|
|
3695
|
+
),
|
|
3696
|
+
...props
|
|
3697
|
+
}
|
|
3698
|
+
));
|
|
3699
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
3700
|
+
var DropdownMenuCheckboxItem = React48.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
3701
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
3702
|
+
{
|
|
3703
|
+
ref,
|
|
3704
|
+
className: cn(
|
|
3705
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3706
|
+
className
|
|
3707
|
+
),
|
|
3708
|
+
checked,
|
|
3709
|
+
...props,
|
|
3710
|
+
children: [
|
|
3711
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
3712
|
+
children
|
|
3713
|
+
]
|
|
3714
|
+
}
|
|
3715
|
+
));
|
|
3716
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
3717
|
+
var DropdownMenuRadioItem = React48.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
3718
|
+
DropdownMenuPrimitive.RadioItem,
|
|
3719
|
+
{
|
|
3720
|
+
ref,
|
|
3721
|
+
className: cn(
|
|
3722
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
3723
|
+
className
|
|
3724
|
+
),
|
|
3725
|
+
...props,
|
|
3726
|
+
children: [
|
|
3727
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
3728
|
+
children
|
|
3729
|
+
]
|
|
3730
|
+
}
|
|
3731
|
+
));
|
|
3732
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
3733
|
+
var DropdownMenuLabel = React48.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3734
|
+
DropdownMenuPrimitive.Label,
|
|
3735
|
+
{
|
|
3736
|
+
ref,
|
|
3737
|
+
className: cn(
|
|
3738
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
3739
|
+
inset && "pl-8",
|
|
3740
|
+
className
|
|
3741
|
+
),
|
|
3742
|
+
...props
|
|
3743
|
+
}
|
|
3744
|
+
));
|
|
3745
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
3746
|
+
var DropdownMenuSeparator = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
3747
|
+
DropdownMenuPrimitive.Separator,
|
|
3748
|
+
{
|
|
3749
|
+
ref,
|
|
3750
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
3751
|
+
...props
|
|
3752
|
+
}
|
|
3753
|
+
));
|
|
3754
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
3755
|
+
var DropdownMenuShortcut = ({
|
|
3756
|
+
className,
|
|
3757
|
+
...props
|
|
3758
|
+
}) => {
|
|
3759
|
+
return /* @__PURE__ */ jsx(
|
|
3760
|
+
"span",
|
|
3761
|
+
{
|
|
3762
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
3763
|
+
...props
|
|
3764
|
+
}
|
|
3765
|
+
);
|
|
3766
|
+
};
|
|
3767
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
3768
|
+
var Popover = PopoverPrimitive.Root;
|
|
3769
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3770
|
+
var PopoverContent = React48.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
3771
|
+
PopoverPrimitive.Content,
|
|
3772
|
+
{
|
|
3773
|
+
ref,
|
|
3774
|
+
align,
|
|
3775
|
+
sideOffset,
|
|
3776
|
+
className: cn(
|
|
3777
|
+
"z-50 w-auto rounded-md border bg-popover p-4 text-popover-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3778
|
+
className
|
|
3779
|
+
),
|
|
3780
|
+
...props
|
|
3781
|
+
}
|
|
3782
|
+
) }));
|
|
3783
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
3784
|
+
var AuthLayoutContext = React48.createContext({
|
|
3307
3785
|
imagePosition: "left"
|
|
3308
3786
|
});
|
|
3309
3787
|
function AuthLayoutRoot({ children, className }) {
|
|
3310
|
-
const [imagePosition, setImagePosition] =
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
if (
|
|
3788
|
+
const [imagePosition, setImagePosition] = React48.useState("left");
|
|
3789
|
+
React48.useEffect(() => {
|
|
3790
|
+
React48.Children.forEach(children, (child) => {
|
|
3791
|
+
if (React48.isValidElement(child) && child.type === AuthLayoutImage) {
|
|
3314
3792
|
setImagePosition(child.props.position || "left");
|
|
3315
3793
|
}
|
|
3316
3794
|
});
|
|
@@ -3332,31 +3810,89 @@ function AuthLayoutImage({
|
|
|
3332
3810
|
alt,
|
|
3333
3811
|
position: _position = "left",
|
|
3334
3812
|
className,
|
|
3335
|
-
priority = true
|
|
3813
|
+
priority = true,
|
|
3814
|
+
showPattern = false
|
|
3336
3815
|
}) {
|
|
3337
|
-
return /* @__PURE__ */
|
|
3816
|
+
return /* @__PURE__ */ jsxs(
|
|
3338
3817
|
"div",
|
|
3339
3818
|
{
|
|
3340
3819
|
className: cn(
|
|
3341
|
-
"hidden xl:block relative w-full xl:w-3/6 h-64 xl:h-screen overflow-hidden",
|
|
3820
|
+
"hidden xl:block relative w-full xl:w-3/6 h-64 xl:h-screen overflow-hidden bg-muted",
|
|
3342
3821
|
className
|
|
3343
3822
|
),
|
|
3344
|
-
children:
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3823
|
+
children: [
|
|
3824
|
+
src ? /* @__PURE__ */ jsx(
|
|
3825
|
+
"img",
|
|
3826
|
+
{
|
|
3827
|
+
src,
|
|
3828
|
+
alt,
|
|
3829
|
+
className: "absolute inset-0 w-full h-full object-cover object-top",
|
|
3830
|
+
loading: priority ? "eager" : "lazy"
|
|
3831
|
+
}
|
|
3832
|
+
) : null,
|
|
3833
|
+
showPattern && /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center", children: [
|
|
3834
|
+
/* @__PURE__ */ jsxs(
|
|
3835
|
+
"svg",
|
|
3836
|
+
{
|
|
3837
|
+
className: "absolute inset-0 w-full h-full opacity-10",
|
|
3838
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3839
|
+
children: [
|
|
3840
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
|
|
3841
|
+
"pattern",
|
|
3842
|
+
{
|
|
3843
|
+
id: "auth-grid",
|
|
3844
|
+
width: "40",
|
|
3845
|
+
height: "40",
|
|
3846
|
+
patternUnits: "userSpaceOnUse",
|
|
3847
|
+
children: /* @__PURE__ */ jsx(
|
|
3848
|
+
"path",
|
|
3849
|
+
{
|
|
3850
|
+
d: "M 40 0 L 0 0 0 40",
|
|
3851
|
+
fill: "none",
|
|
3852
|
+
stroke: "currentColor",
|
|
3853
|
+
strokeWidth: "0.5"
|
|
3854
|
+
}
|
|
3855
|
+
)
|
|
3856
|
+
}
|
|
3857
|
+
) }),
|
|
3858
|
+
/* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: "url(#auth-grid)" })
|
|
3859
|
+
]
|
|
3860
|
+
}
|
|
3861
|
+
),
|
|
3862
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-10", children: [
|
|
3863
|
+
/* @__PURE__ */ jsx("div", { className: "w-64 h-64 rounded-full border border-muted-foreground/20" }),
|
|
3864
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-24 h-24 rounded-full border border-muted-foreground/30 flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
3865
|
+
"svg",
|
|
3866
|
+
{
|
|
3867
|
+
className: "w-10 h-10 text-muted-foreground/40",
|
|
3868
|
+
fill: "none",
|
|
3869
|
+
stroke: "currentColor",
|
|
3870
|
+
viewBox: "0 0 24 24",
|
|
3871
|
+
children: /* @__PURE__ */ jsx(
|
|
3872
|
+
"path",
|
|
3873
|
+
{
|
|
3874
|
+
strokeLinecap: "round",
|
|
3875
|
+
strokeLinejoin: "round",
|
|
3876
|
+
strokeWidth: 1,
|
|
3877
|
+
d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
3878
|
+
}
|
|
3879
|
+
)
|
|
3880
|
+
}
|
|
3881
|
+
) }),
|
|
3882
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-1/2 left-full ml-4 w-32 h-px bg-gradient-to-r from-muted-foreground/20 to-transparent" }),
|
|
3883
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-1/2 right-full mr-4 w-32 h-px bg-gradient-to-l from-muted-foreground/20 to-transparent" }),
|
|
3884
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 mt-4 w-px h-32 bg-gradient-to-b from-muted-foreground/20 to-transparent" }),
|
|
3885
|
+
/* @__PURE__ */ jsx("div", { className: "absolute bottom-full left-1/2 -translate-x-1/2 mb-4 w-px h-32 bg-gradient-to-t from-muted-foreground/20 to-transparent" })
|
|
3886
|
+
] })
|
|
3887
|
+
] })
|
|
3888
|
+
]
|
|
3889
|
+
}
|
|
3890
|
+
);
|
|
3891
|
+
}
|
|
3892
|
+
function AuthLayoutContent({
|
|
3893
|
+
children,
|
|
3894
|
+
className,
|
|
3895
|
+
maxWidth = "md"
|
|
3360
3896
|
}) {
|
|
3361
3897
|
const maxWidthClasses = {
|
|
3362
3898
|
sm: "max-w-sm",
|
|
@@ -3367,7 +3903,7 @@ function AuthLayoutContent({
|
|
|
3367
3903
|
"div",
|
|
3368
3904
|
{
|
|
3369
3905
|
className: cn(
|
|
3370
|
-
"w-full lg:w-3/6 flex items-center justify-center p-6
|
|
3906
|
+
"relative w-full lg:w-3/6 flex items-center justify-center p-6 lg:p-12 bg-background",
|
|
3371
3907
|
className
|
|
3372
3908
|
),
|
|
3373
3909
|
children: /* @__PURE__ */ jsx("div", { className: cn("w-full space-y-8", maxWidthClasses[maxWidth]), children })
|
|
@@ -3380,8 +3916,15 @@ function AuthLayoutHeader({
|
|
|
3380
3916
|
logo,
|
|
3381
3917
|
title,
|
|
3382
3918
|
description,
|
|
3383
|
-
centered = true
|
|
3919
|
+
centered = true,
|
|
3920
|
+
position = "top-right"
|
|
3384
3921
|
}) {
|
|
3922
|
+
if (position === "top-left" && logo) {
|
|
3923
|
+
return /* @__PURE__ */ jsx("div", { className: cn("absolute top-6 left-6 lg:top-8 lg:left-8", className), children: logo });
|
|
3924
|
+
}
|
|
3925
|
+
if (position === "top-right" && logo) {
|
|
3926
|
+
return /* @__PURE__ */ jsx("div", { className: cn("absolute top-6 right-6 lg:top-8 lg:right-8", className), children: logo });
|
|
3927
|
+
}
|
|
3385
3928
|
if (children) {
|
|
3386
3929
|
return /* @__PURE__ */ jsx("div", { className: cn("space-y-2", centered && "text-center", className), children });
|
|
3387
3930
|
}
|
|
@@ -3443,7 +3986,7 @@ var AuthLayout = Object.assign(AuthLayoutRoot, {
|
|
|
3443
3986
|
Link: AuthLayoutLink,
|
|
3444
3987
|
Divider: AuthLayoutDivider
|
|
3445
3988
|
});
|
|
3446
|
-
var TabsContext =
|
|
3989
|
+
var TabsContext = React48.createContext(null);
|
|
3447
3990
|
function SelectionLayoutRoot({ children, className }) {
|
|
3448
3991
|
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen bg-muted/30 flex flex-col lg:flex-row", className), children });
|
|
3449
3992
|
}
|
|
@@ -3554,7 +4097,7 @@ function SelectionLayoutTab({
|
|
|
3554
4097
|
badge,
|
|
3555
4098
|
className
|
|
3556
4099
|
}) {
|
|
3557
|
-
const context =
|
|
4100
|
+
const context = React48.useContext(TabsContext);
|
|
3558
4101
|
if (!context) {
|
|
3559
4102
|
throw new Error("SelectionLayout.Tab must be used within SelectionLayout.Tabs");
|
|
3560
4103
|
}
|
|
@@ -3699,17 +4242,17 @@ var SelectionLayout = Object.assign(SelectionLayoutRoot, {
|
|
|
3699
4242
|
Card: SelectionLayoutCard,
|
|
3700
4243
|
Empty: SelectionLayoutEmpty
|
|
3701
4244
|
});
|
|
3702
|
-
var DashboardLayoutContext =
|
|
4245
|
+
var DashboardLayoutContext = React48.createContext(null);
|
|
3703
4246
|
function useDashboardLayout() {
|
|
3704
|
-
const context =
|
|
4247
|
+
const context = React48.useContext(DashboardLayoutContext);
|
|
3705
4248
|
if (!context) {
|
|
3706
4249
|
throw new Error("useDashboardLayout must be used within DashboardLayout");
|
|
3707
4250
|
}
|
|
3708
4251
|
return context;
|
|
3709
4252
|
}
|
|
3710
4253
|
function useMediaQuery(query) {
|
|
3711
|
-
const [matches, setMatches] =
|
|
3712
|
-
|
|
4254
|
+
const [matches, setMatches] = React48.useState(false);
|
|
4255
|
+
React48.useEffect(() => {
|
|
3713
4256
|
const media = window.matchMedia(query);
|
|
3714
4257
|
if (media.matches !== matches) {
|
|
3715
4258
|
setMatches(media.matches);
|
|
@@ -3726,11 +4269,11 @@ function DashboardLayoutRoot({
|
|
|
3726
4269
|
defaultExpanded = false,
|
|
3727
4270
|
defaultPinned = false
|
|
3728
4271
|
}) {
|
|
3729
|
-
const [sidebarExpanded, setSidebarExpanded] =
|
|
3730
|
-
const [sidebarPinned, setSidebarPinned] =
|
|
3731
|
-
const [mobileMenuOpen, setMobileMenuOpen] =
|
|
4272
|
+
const [sidebarExpanded, setSidebarExpanded] = React48.useState(defaultExpanded || defaultPinned);
|
|
4273
|
+
const [sidebarPinned, setSidebarPinned] = React48.useState(defaultPinned);
|
|
4274
|
+
const [mobileMenuOpen, setMobileMenuOpen] = React48.useState(false);
|
|
3732
4275
|
const isMobile = useMediaQuery("(max-width: 1024px)");
|
|
3733
|
-
|
|
4276
|
+
React48.useEffect(() => {
|
|
3734
4277
|
if (!isMobile) {
|
|
3735
4278
|
setMobileMenuOpen(false);
|
|
3736
4279
|
}
|
|
@@ -3869,9 +4412,9 @@ function DashboardLayoutSidebarNavItem({
|
|
|
3869
4412
|
primary: "bg-primary/10 text-primary",
|
|
3870
4413
|
destructive: "bg-destructive/10 text-destructive"
|
|
3871
4414
|
};
|
|
3872
|
-
const
|
|
4415
|
+
const renderIcon4 = () => {
|
|
3873
4416
|
if (!icon) return null;
|
|
3874
|
-
if (
|
|
4417
|
+
if (React48.isValidElement(icon)) {
|
|
3875
4418
|
return icon;
|
|
3876
4419
|
}
|
|
3877
4420
|
if (typeof icon === "function" || typeof icon === "object" && "$$typeof" in icon) {
|
|
@@ -3892,7 +4435,7 @@ function DashboardLayoutSidebarNavItem({
|
|
|
3892
4435
|
),
|
|
3893
4436
|
onClick: disabled ? void 0 : onClick,
|
|
3894
4437
|
children: [
|
|
3895
|
-
|
|
4438
|
+
renderIcon4(),
|
|
3896
4439
|
sidebarExpanded && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3897
4440
|
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-sm", children: label }),
|
|
3898
4441
|
badge !== void 0 && /* @__PURE__ */ jsx(
|
|
@@ -3926,15 +4469,15 @@ function DashboardLayoutSidebarNavGroup({
|
|
|
3926
4469
|
className
|
|
3927
4470
|
}) {
|
|
3928
4471
|
const { sidebarExpanded } = useDashboardLayout();
|
|
3929
|
-
const [isOpen, setIsOpen] =
|
|
4472
|
+
const [isOpen, setIsOpen] = React48.useState(defaultOpen);
|
|
3930
4473
|
const badgeColors = {
|
|
3931
4474
|
default: "bg-muted text-muted-foreground",
|
|
3932
4475
|
primary: "bg-primary/10 text-primary",
|
|
3933
4476
|
destructive: "bg-destructive/10 text-destructive"
|
|
3934
4477
|
};
|
|
3935
|
-
const
|
|
4478
|
+
const renderIcon4 = () => {
|
|
3936
4479
|
if (!icon) return null;
|
|
3937
|
-
if (
|
|
4480
|
+
if (React48.isValidElement(icon)) {
|
|
3938
4481
|
return icon;
|
|
3939
4482
|
}
|
|
3940
4483
|
if (typeof icon === "function" || typeof icon === "object" && "$$typeof" in icon) {
|
|
@@ -3943,7 +4486,7 @@ function DashboardLayoutSidebarNavGroup({
|
|
|
3943
4486
|
}
|
|
3944
4487
|
return null;
|
|
3945
4488
|
};
|
|
3946
|
-
|
|
4489
|
+
React48.useEffect(() => {
|
|
3947
4490
|
if (isActive && sidebarExpanded) {
|
|
3948
4491
|
setIsOpen(true);
|
|
3949
4492
|
}
|
|
@@ -3959,7 +4502,7 @@ function DashboardLayoutSidebarNavGroup({
|
|
|
3959
4502
|
isActive && "text-primary"
|
|
3960
4503
|
),
|
|
3961
4504
|
children: [
|
|
3962
|
-
|
|
4505
|
+
renderIcon4(),
|
|
3963
4506
|
sidebarExpanded && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3964
4507
|
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-sm", children: label }),
|
|
3965
4508
|
badge !== void 0 && /* @__PURE__ */ jsx(
|
|
@@ -4047,7 +4590,7 @@ function DashboardLayoutHeaderUser({
|
|
|
4047
4590
|
children,
|
|
4048
4591
|
onLogout
|
|
4049
4592
|
}) {
|
|
4050
|
-
const [isOpen, setIsOpen] =
|
|
4593
|
+
const [isOpen, setIsOpen] = React48.useState(false);
|
|
4051
4594
|
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
4052
4595
|
/* @__PURE__ */ jsxs(
|
|
4053
4596
|
"button",
|
|
@@ -4128,7 +4671,7 @@ function DashboardLayoutBreadcrumbs({
|
|
|
4128
4671
|
return /* @__PURE__ */ jsx("nav", { className: cn("flex items-center gap-1 text-sm", className), children: items.map((item, index) => {
|
|
4129
4672
|
const Icon2 = item.icon;
|
|
4130
4673
|
const isLast = index === items.length - 1;
|
|
4131
|
-
return /* @__PURE__ */ jsxs(
|
|
4674
|
+
return /* @__PURE__ */ jsxs(React48.Fragment, { children: [
|
|
4132
4675
|
item.href && !isLast ? /* @__PURE__ */ jsxs(
|
|
4133
4676
|
"a",
|
|
4134
4677
|
{
|
|
@@ -4231,52 +4774,1683 @@ var DashboardLayout = Object.assign(DashboardLayoutRoot, {
|
|
|
4231
4774
|
MobileNav: DashboardLayoutMobileNav,
|
|
4232
4775
|
MobileNavItem: DashboardLayoutMobileNavItem
|
|
4233
4776
|
});
|
|
4234
|
-
var
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4777
|
+
var SidebarContext = React48.createContext(null);
|
|
4778
|
+
function useSidebar() {
|
|
4779
|
+
const context = React48.useContext(SidebarContext);
|
|
4780
|
+
if (!context) {
|
|
4781
|
+
throw new Error("useSidebar must be used within a Sidebar component");
|
|
4782
|
+
}
|
|
4783
|
+
return context;
|
|
4784
|
+
}
|
|
4785
|
+
function useSidebarOptional() {
|
|
4786
|
+
return React48.useContext(SidebarContext);
|
|
4787
|
+
}
|
|
4788
|
+
function SidebarProvider({ children, value }) {
|
|
4789
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value, children });
|
|
4790
|
+
}
|
|
4791
|
+
function useMediaQuery2(query) {
|
|
4792
|
+
const [matches, setMatches] = React48.useState(false);
|
|
4793
|
+
React48.useEffect(() => {
|
|
4794
|
+
if (typeof window === "undefined") return;
|
|
4795
|
+
const mediaQuery = window.matchMedia(query);
|
|
4796
|
+
setMatches(mediaQuery.matches);
|
|
4797
|
+
const handler = (event) => {
|
|
4798
|
+
setMatches(event.matches);
|
|
4799
|
+
};
|
|
4800
|
+
mediaQuery.addEventListener("change", handler);
|
|
4801
|
+
return () => mediaQuery.removeEventListener("change", handler);
|
|
4802
|
+
}, [query]);
|
|
4803
|
+
return matches;
|
|
4804
|
+
}
|
|
4805
|
+
var SidebarHeader = React48.memo(function SidebarHeader2({
|
|
4806
|
+
logo,
|
|
4807
|
+
collapsedLogo,
|
|
4808
|
+
title,
|
|
4809
|
+
showPinButton = true,
|
|
4810
|
+
className
|
|
4244
4811
|
}) {
|
|
4245
|
-
const
|
|
4246
|
-
|
|
4812
|
+
const { expanded, pinned, setPinned } = useSidebar();
|
|
4813
|
+
const handleTogglePin = React48.useCallback(() => {
|
|
4814
|
+
setPinned(!pinned);
|
|
4815
|
+
}, [pinned, setPinned]);
|
|
4816
|
+
return /* @__PURE__ */ jsxs(
|
|
4817
|
+
"div",
|
|
4818
|
+
{
|
|
4819
|
+
className: cn(
|
|
4820
|
+
"flex items-center justify-between h-[60px] border-b border-border bg-primary px-3",
|
|
4821
|
+
className
|
|
4822
|
+
),
|
|
4823
|
+
children: [
|
|
4824
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
4825
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: !expanded && collapsedLogo && /* @__PURE__ */ jsx(
|
|
4826
|
+
motion.div,
|
|
4827
|
+
{
|
|
4828
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
4829
|
+
animate: { opacity: 1, scale: 1 },
|
|
4830
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
4831
|
+
transition: { duration: 0.15 },
|
|
4832
|
+
className: "flex items-center justify-center",
|
|
4833
|
+
children: collapsedLogo
|
|
4834
|
+
},
|
|
4835
|
+
"collapsed-logo"
|
|
4836
|
+
) }),
|
|
4837
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: expanded && /* @__PURE__ */ jsxs(
|
|
4838
|
+
motion.div,
|
|
4839
|
+
{
|
|
4840
|
+
initial: { opacity: 0, x: -10 },
|
|
4841
|
+
animate: { opacity: 1, x: 0 },
|
|
4842
|
+
exit: { opacity: 0, x: -10 },
|
|
4843
|
+
transition: { duration: 0.2 },
|
|
4844
|
+
className: "flex items-center gap-2",
|
|
4845
|
+
children: [
|
|
4846
|
+
logo && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: logo }),
|
|
4847
|
+
title && /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-primary-foreground whitespace-nowrap", children: title })
|
|
4848
|
+
]
|
|
4849
|
+
}
|
|
4850
|
+
) }),
|
|
4851
|
+
expanded && !logo && collapsedLogo && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4852
|
+
collapsedLogo,
|
|
4853
|
+
title && /* @__PURE__ */ jsx(
|
|
4854
|
+
motion.span,
|
|
4855
|
+
{
|
|
4856
|
+
initial: { opacity: 0, x: -10 },
|
|
4857
|
+
animate: { opacity: 1, x: 0 },
|
|
4858
|
+
exit: { opacity: 0, x: -10 },
|
|
4859
|
+
transition: { duration: 0.2 },
|
|
4860
|
+
className: "text-sm font-semibold text-primary-foreground whitespace-nowrap",
|
|
4861
|
+
children: title
|
|
4862
|
+
}
|
|
4863
|
+
)
|
|
4864
|
+
] })
|
|
4865
|
+
] }),
|
|
4866
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: showPinButton && expanded && /* @__PURE__ */ jsx(
|
|
4867
|
+
motion.button,
|
|
4868
|
+
{
|
|
4869
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
4870
|
+
animate: { opacity: 1, scale: 1 },
|
|
4871
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
4872
|
+
transition: { duration: 0.15 },
|
|
4873
|
+
onClick: handleTogglePin,
|
|
4874
|
+
className: cn(
|
|
4875
|
+
"flex h-6 w-6 items-center justify-center rounded-md transition-colors",
|
|
4876
|
+
"hover:bg-primary-foreground/10"
|
|
4877
|
+
// pinned ? '' : 'text-primary-foreground/60'
|
|
4878
|
+
),
|
|
4879
|
+
title: pinned ? "Unpin sidebar" : "Pin sidebar",
|
|
4880
|
+
children: pinned ? /* @__PURE__ */ jsx(PinOff, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Pin, { className: "h-3.5 w-3.5" })
|
|
4881
|
+
}
|
|
4882
|
+
) })
|
|
4883
|
+
]
|
|
4884
|
+
}
|
|
4247
4885
|
);
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4886
|
+
});
|
|
4887
|
+
SidebarHeader.displayName = "Sidebar.Header";
|
|
4888
|
+
var SidebarNav = React48.memo(function SidebarNav2({
|
|
4889
|
+
children,
|
|
4890
|
+
className
|
|
4891
|
+
}) {
|
|
4892
|
+
return /* @__PURE__ */ jsx(
|
|
4893
|
+
"nav",
|
|
4894
|
+
{
|
|
4895
|
+
className: cn(
|
|
4896
|
+
"flex-1 overflow-y-auto overflow-x-hidden py-1 custom-scrollbar",
|
|
4897
|
+
className
|
|
4898
|
+
),
|
|
4899
|
+
children: /* @__PURE__ */ jsx("div", { className: "space-y-0.5 px-2", children })
|
|
4257
4900
|
}
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4901
|
+
);
|
|
4902
|
+
});
|
|
4903
|
+
SidebarNav.displayName = "Sidebar.Nav";
|
|
4904
|
+
var SidebarSection = React48.memo(function SidebarSection2({
|
|
4905
|
+
title,
|
|
4906
|
+
children,
|
|
4907
|
+
className
|
|
4908
|
+
}) {
|
|
4909
|
+
const { expanded } = useSidebar();
|
|
4910
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-0.5", className), children: [
|
|
4911
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: title && expanded && /* @__PURE__ */ jsx(
|
|
4912
|
+
motion.div,
|
|
4913
|
+
{
|
|
4914
|
+
initial: { opacity: 0, height: 0 },
|
|
4915
|
+
animate: { opacity: 1, height: "auto" },
|
|
4916
|
+
exit: { opacity: 0, height: 0 },
|
|
4917
|
+
transition: { duration: 0.2 },
|
|
4918
|
+
className: "mb-1 px-2 py-1",
|
|
4919
|
+
children: /* @__PURE__ */ jsx("p", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground", children: title })
|
|
4267
4920
|
}
|
|
4268
|
-
}),
|
|
4269
|
-
|
|
4921
|
+
) }),
|
|
4922
|
+
children
|
|
4923
|
+
] });
|
|
4924
|
+
});
|
|
4925
|
+
SidebarSection.displayName = "Sidebar.Section";
|
|
4926
|
+
function renderIcon(icon, className) {
|
|
4927
|
+
if (!icon) return null;
|
|
4928
|
+
if (React48.isValidElement(icon)) {
|
|
4929
|
+
return React48.cloneElement(icon, { className });
|
|
4930
|
+
}
|
|
4931
|
+
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "$$typeof" in icon) {
|
|
4932
|
+
const IconComponent = icon;
|
|
4933
|
+
return /* @__PURE__ */ jsx(IconComponent, { className });
|
|
4934
|
+
}
|
|
4935
|
+
return null;
|
|
4936
|
+
}
|
|
4937
|
+
var badgeVariantStyles = {
|
|
4938
|
+
default: "bg-primary/10 text-primary",
|
|
4939
|
+
notification: "bg-destructive/20 text-destructive",
|
|
4940
|
+
success: "bg-green-100 text-green-600",
|
|
4941
|
+
warning: "bg-amber-100 text-amber-600"
|
|
4942
|
+
};
|
|
4943
|
+
var SidebarNavItem = React48.memo(function SidebarNavItem2({
|
|
4944
|
+
icon,
|
|
4945
|
+
label,
|
|
4946
|
+
href,
|
|
4947
|
+
onClick,
|
|
4948
|
+
isActive = false,
|
|
4949
|
+
badge,
|
|
4950
|
+
badgeVariant = "default",
|
|
4951
|
+
disabled = false,
|
|
4952
|
+
className
|
|
4953
|
+
}) {
|
|
4954
|
+
const { expanded } = useSidebar();
|
|
4955
|
+
const handleClick = React48.useCallback(() => {
|
|
4956
|
+
if (disabled) return;
|
|
4957
|
+
if (onClick) {
|
|
4958
|
+
onClick();
|
|
4959
|
+
} else if (href && typeof window !== "undefined") {
|
|
4960
|
+
window.location.href = href;
|
|
4961
|
+
}
|
|
4962
|
+
}, [disabled, onClick, href]);
|
|
4963
|
+
const iconSize = expanded ? "h-3.5 w-3.5" : "h-4 w-4";
|
|
4964
|
+
return /* @__PURE__ */ jsxs(
|
|
4965
|
+
"button",
|
|
4966
|
+
{
|
|
4967
|
+
onClick: handleClick,
|
|
4968
|
+
disabled,
|
|
4969
|
+
className: cn(
|
|
4970
|
+
"group relative flex w-full items-center rounded-md px-2 py-1.5 transition-all duration-200",
|
|
4971
|
+
isActive ? "bg-primary/10 text-primary" : "hover:bg-primary/5 hover:text-primary",
|
|
4972
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
4973
|
+
className
|
|
4974
|
+
),
|
|
4975
|
+
children: [
|
|
4976
|
+
isActive && /* @__PURE__ */ jsx(
|
|
4977
|
+
motion.div,
|
|
4978
|
+
{
|
|
4979
|
+
layoutId: "sidebarActiveIndicator",
|
|
4980
|
+
className: "absolute left-0 top-0 bottom-0 w-0.5 rounded-r-full bg-primary",
|
|
4981
|
+
transition: { type: "spring", stiffness: 300, damping: 30 }
|
|
4982
|
+
}
|
|
4983
|
+
),
|
|
4984
|
+
/* @__PURE__ */ jsx(
|
|
4985
|
+
"div",
|
|
4986
|
+
{
|
|
4987
|
+
className: cn(
|
|
4988
|
+
"flex h-6 w-6 items-center justify-center rounded-md transition-all duration-200",
|
|
4989
|
+
isActive ? "text-primary bg-primary/10 group-hover:bg-primary/20" : "text-muted-foreground group-hover:text-foreground"
|
|
4990
|
+
),
|
|
4991
|
+
children: renderIcon(icon, iconSize)
|
|
4992
|
+
}
|
|
4993
|
+
),
|
|
4994
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: expanded && /* @__PURE__ */ jsx(
|
|
4995
|
+
motion.span,
|
|
4996
|
+
{
|
|
4997
|
+
initial: { opacity: 0, x: -10 },
|
|
4998
|
+
animate: { opacity: 1, x: 0 },
|
|
4999
|
+
exit: { opacity: 0, x: -10 },
|
|
5000
|
+
transition: { duration: 0.2 },
|
|
5001
|
+
className: "ml-2 flex-1 text-left text-xs font-medium truncate",
|
|
5002
|
+
children: label
|
|
5003
|
+
}
|
|
5004
|
+
) }),
|
|
5005
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: badge !== void 0 && expanded && /* @__PURE__ */ jsx(
|
|
5006
|
+
motion.div,
|
|
5007
|
+
{
|
|
5008
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
5009
|
+
animate: { opacity: 1, scale: 1 },
|
|
5010
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
5011
|
+
transition: { duration: 0.2 },
|
|
5012
|
+
className: cn(
|
|
5013
|
+
"ml-1 flex h-4 min-w-[16px] items-center justify-center rounded-full px-1 text-[10px] font-medium",
|
|
5014
|
+
badgeVariantStyles[badgeVariant]
|
|
5015
|
+
),
|
|
5016
|
+
children: badge
|
|
5017
|
+
}
|
|
5018
|
+
) }),
|
|
5019
|
+
badge !== void 0 && !expanded && /* @__PURE__ */ jsx(
|
|
5020
|
+
"div",
|
|
5021
|
+
{
|
|
5022
|
+
className: cn(
|
|
5023
|
+
"absolute top-1 right-1 h-2 w-2 rounded-full",
|
|
5024
|
+
badgeVariant === "notification" && "bg-destructive",
|
|
5025
|
+
badgeVariant === "success" && "bg-green-500",
|
|
5026
|
+
badgeVariant === "warning" && "bg-amber-500",
|
|
5027
|
+
badgeVariant === "default" && "bg-primary"
|
|
5028
|
+
)
|
|
5029
|
+
}
|
|
5030
|
+
)
|
|
5031
|
+
]
|
|
5032
|
+
}
|
|
4270
5033
|
);
|
|
4271
|
-
|
|
5034
|
+
});
|
|
5035
|
+
SidebarNavItem.displayName = "Sidebar.NavItem";
|
|
5036
|
+
function renderIcon2(icon, className) {
|
|
5037
|
+
if (!icon) return null;
|
|
5038
|
+
if (React48.isValidElement(icon)) {
|
|
5039
|
+
return React48.cloneElement(icon, { className });
|
|
5040
|
+
}
|
|
5041
|
+
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "$$typeof" in icon) {
|
|
5042
|
+
const IconComponent = icon;
|
|
5043
|
+
return /* @__PURE__ */ jsx(IconComponent, { className });
|
|
5044
|
+
}
|
|
5045
|
+
return null;
|
|
4272
5046
|
}
|
|
4273
|
-
var
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
5047
|
+
var badgeVariantStyles2 = {
|
|
5048
|
+
default: "bg-primary/10 text-primary",
|
|
5049
|
+
notification: "bg-destructive/20 text-destructive",
|
|
5050
|
+
success: "bg-green-100 text-green-600",
|
|
5051
|
+
warning: "bg-amber-100 text-amber-600"
|
|
5052
|
+
};
|
|
5053
|
+
var SidebarNavGroup = React48.memo(function SidebarNavGroup2({
|
|
5054
|
+
icon,
|
|
5055
|
+
label,
|
|
5056
|
+
children,
|
|
5057
|
+
id,
|
|
5058
|
+
defaultOpen = false,
|
|
5059
|
+
isActive = false,
|
|
5060
|
+
badge,
|
|
5061
|
+
badgeVariant = "default",
|
|
5062
|
+
className
|
|
5063
|
+
}) {
|
|
5064
|
+
const { expanded, activeSection, setActiveSection } = useSidebar();
|
|
5065
|
+
const [isOpen, setIsOpen] = React48.useState(defaultOpen);
|
|
5066
|
+
const groupId = id || label.toLowerCase().replace(/\s+/g, "-");
|
|
5067
|
+
const isExpanded = expanded && (activeSection === groupId || isOpen);
|
|
5068
|
+
const handleClick = React48.useCallback(() => {
|
|
5069
|
+
if (activeSection === groupId) {
|
|
5070
|
+
setActiveSection(null);
|
|
5071
|
+
setIsOpen(false);
|
|
5072
|
+
} else {
|
|
5073
|
+
setActiveSection(groupId);
|
|
5074
|
+
setIsOpen(true);
|
|
5075
|
+
}
|
|
5076
|
+
}, [activeSection, groupId, setActiveSection]);
|
|
5077
|
+
React48.useEffect(() => {
|
|
5078
|
+
if (expanded && isActive && !isOpen) {
|
|
5079
|
+
setIsOpen(true);
|
|
5080
|
+
setActiveSection(groupId);
|
|
5081
|
+
}
|
|
5082
|
+
}, [expanded, isActive, isOpen, setActiveSection, groupId]);
|
|
5083
|
+
const iconSize = expanded ? "h-3.5 w-3.5" : "h-4 w-4";
|
|
5084
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
5085
|
+
/* @__PURE__ */ jsxs(
|
|
5086
|
+
"button",
|
|
5087
|
+
{
|
|
5088
|
+
onClick: handleClick,
|
|
5089
|
+
className: cn(
|
|
5090
|
+
"group relative flex w-full items-center rounded-md px-2 py-1.5 transition-all duration-200",
|
|
5091
|
+
isActive ? "bg-primary/10 text-primary" : "hover:bg-primary/5 hover:text-primary"
|
|
5092
|
+
),
|
|
5093
|
+
children: [
|
|
5094
|
+
isActive && /* @__PURE__ */ jsx(
|
|
5095
|
+
motion.div,
|
|
5096
|
+
{
|
|
5097
|
+
layoutId: "sidebarGroupActiveIndicator",
|
|
5098
|
+
className: "absolute left-0 top-0 bottom-0 w-0.5 rounded-r-full bg-primary",
|
|
5099
|
+
transition: { type: "spring", stiffness: 300, damping: 30 }
|
|
5100
|
+
}
|
|
5101
|
+
),
|
|
5102
|
+
/* @__PURE__ */ jsx(
|
|
5103
|
+
"div",
|
|
5104
|
+
{
|
|
5105
|
+
className: cn(
|
|
5106
|
+
"flex h-6 w-6 items-center justify-center rounded-md transition-all duration-200",
|
|
5107
|
+
isActive ? "text-primary bg-primary/10 group-hover:bg-primary/20" : "text-muted-foreground group-hover:text-foreground"
|
|
5108
|
+
),
|
|
5109
|
+
children: renderIcon2(icon, iconSize)
|
|
5110
|
+
}
|
|
5111
|
+
),
|
|
5112
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: expanded && /* @__PURE__ */ jsx(
|
|
5113
|
+
motion.span,
|
|
5114
|
+
{
|
|
5115
|
+
initial: { opacity: 0, x: -10 },
|
|
5116
|
+
animate: { opacity: 1, x: 0 },
|
|
5117
|
+
exit: { opacity: 0, x: -10 },
|
|
5118
|
+
transition: { duration: 0.2 },
|
|
5119
|
+
className: "ml-2 flex-1 text-left text-xs font-medium truncate",
|
|
5120
|
+
children: label
|
|
5121
|
+
}
|
|
5122
|
+
) }),
|
|
5123
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: badge !== void 0 && expanded && /* @__PURE__ */ jsx(
|
|
5124
|
+
motion.div,
|
|
5125
|
+
{
|
|
5126
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
5127
|
+
animate: { opacity: 1, scale: 1 },
|
|
5128
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
5129
|
+
transition: { duration: 0.2 },
|
|
5130
|
+
className: cn(
|
|
5131
|
+
"ml-1 flex h-4 min-w-[16px] items-center justify-center rounded-full px-1 text-[10px] font-medium",
|
|
5132
|
+
badgeVariantStyles2[badgeVariant]
|
|
5133
|
+
),
|
|
5134
|
+
children: badge
|
|
5135
|
+
}
|
|
5136
|
+
) }),
|
|
5137
|
+
expanded && /* @__PURE__ */ jsx(
|
|
5138
|
+
motion.div,
|
|
5139
|
+
{
|
|
5140
|
+
animate: { rotate: isExpanded ? 90 : 0 },
|
|
5141
|
+
transition: { duration: 0.2 },
|
|
5142
|
+
className: "ml-1",
|
|
5143
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 text-muted-foreground" })
|
|
5144
|
+
}
|
|
5145
|
+
),
|
|
5146
|
+
badge !== void 0 && !expanded && /* @__PURE__ */ jsx(
|
|
5147
|
+
"div",
|
|
5148
|
+
{
|
|
5149
|
+
className: cn(
|
|
5150
|
+
"absolute top-1 right-1 h-2 w-2 rounded-full",
|
|
5151
|
+
badgeVariant === "notification" && "bg-destructive",
|
|
5152
|
+
badgeVariant === "success" && "bg-green-500",
|
|
5153
|
+
badgeVariant === "warning" && "bg-amber-500",
|
|
5154
|
+
badgeVariant === "default" && "bg-primary"
|
|
5155
|
+
)
|
|
5156
|
+
}
|
|
5157
|
+
)
|
|
5158
|
+
]
|
|
5159
|
+
}
|
|
5160
|
+
),
|
|
5161
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: isExpanded && /* @__PURE__ */ jsx(
|
|
5162
|
+
motion.div,
|
|
5163
|
+
{
|
|
5164
|
+
initial: { height: 0, opacity: 0 },
|
|
5165
|
+
animate: { height: "auto", opacity: 1 },
|
|
5166
|
+
exit: { height: 0, opacity: 0 },
|
|
5167
|
+
transition: { duration: 0.2, ease: "easeInOut" },
|
|
5168
|
+
className: "overflow-hidden",
|
|
5169
|
+
children: /* @__PURE__ */ jsx("div", { className: "mt-0.5 space-y-0.5 pl-4 pr-2", children })
|
|
5170
|
+
}
|
|
5171
|
+
) })
|
|
5172
|
+
] });
|
|
5173
|
+
});
|
|
5174
|
+
SidebarNavGroup.displayName = "Sidebar.NavGroup";
|
|
5175
|
+
function isLucideIcon(icon) {
|
|
5176
|
+
return typeof icon === "function";
|
|
5177
|
+
}
|
|
5178
|
+
function getInitials(name) {
|
|
5179
|
+
return name.split(" ").map((part) => part.charAt(0)).slice(0, 2).join("").toUpperCase();
|
|
5180
|
+
}
|
|
5181
|
+
var SidebarFooter = React48.memo(function SidebarFooter2({
|
|
5182
|
+
user,
|
|
5183
|
+
menuItems,
|
|
5184
|
+
children,
|
|
5185
|
+
className
|
|
5186
|
+
}) {
|
|
5187
|
+
const { expanded } = useSidebar();
|
|
5188
|
+
const [menuOpen, setMenuOpen] = React48.useState(false);
|
|
5189
|
+
const handleToggleMenu = React48.useCallback(() => {
|
|
5190
|
+
setMenuOpen((prev) => !prev);
|
|
5191
|
+
}, []);
|
|
5192
|
+
React48.useEffect(() => {
|
|
5193
|
+
if (!menuOpen) return;
|
|
5194
|
+
const handleClickOutside = (event) => {
|
|
5195
|
+
const target = event.target;
|
|
5196
|
+
if (!target.closest("[data-sidebar-footer]")) {
|
|
5197
|
+
setMenuOpen(false);
|
|
5198
|
+
}
|
|
5199
|
+
};
|
|
5200
|
+
document.addEventListener("click", handleClickOutside);
|
|
5201
|
+
return () => document.removeEventListener("click", handleClickOutside);
|
|
5202
|
+
}, [menuOpen]);
|
|
5203
|
+
if (children) {
|
|
5204
|
+
return /* @__PURE__ */ jsx("div", { className: cn("border-t border-border p-2", className), children });
|
|
5205
|
+
}
|
|
5206
|
+
if (!user) return null;
|
|
5207
|
+
return /* @__PURE__ */ jsx(
|
|
5208
|
+
"div",
|
|
5209
|
+
{
|
|
5210
|
+
"data-sidebar-footer": true,
|
|
5211
|
+
className: cn("group cursor-pointer border-t border-border p-2", className),
|
|
5212
|
+
children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
5213
|
+
/* @__PURE__ */ jsxs(
|
|
5214
|
+
"button",
|
|
5215
|
+
{
|
|
5216
|
+
onClick: handleToggleMenu,
|
|
5217
|
+
className: cn(
|
|
5218
|
+
"flex w-full items-center gap-2 rounded-md p-1.5 transition-all",
|
|
5219
|
+
"hover:bg-muted",
|
|
5220
|
+
menuOpen && "bg-muted"
|
|
5221
|
+
),
|
|
5222
|
+
children: [
|
|
5223
|
+
/* @__PURE__ */ jsx("div", { className: "relative flex-shrink-0", children: user.avatar ? /* @__PURE__ */ jsx(
|
|
5224
|
+
"img",
|
|
5225
|
+
{
|
|
5226
|
+
src: user.avatar,
|
|
5227
|
+
alt: user.name,
|
|
5228
|
+
className: "h-8 w-8 rounded-full object-cover"
|
|
5229
|
+
}
|
|
5230
|
+
) : /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary", children: getInitials(user.name) }) }),
|
|
5231
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: expanded && /* @__PURE__ */ jsxs(
|
|
5232
|
+
motion.div,
|
|
5233
|
+
{
|
|
5234
|
+
initial: { opacity: 0, x: -10 },
|
|
5235
|
+
animate: { opacity: 1, x: 0 },
|
|
5236
|
+
exit: { opacity: 0, x: -10 },
|
|
5237
|
+
transition: { duration: 0.2 },
|
|
5238
|
+
className: "flex flex-1 items-center justify-between",
|
|
5239
|
+
children: [
|
|
5240
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start", children: [
|
|
5241
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium truncate max-w-[120px]", children: user.name }),
|
|
5242
|
+
user.email && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground truncate max-w-[120px]", children: user.email })
|
|
5243
|
+
] }),
|
|
5244
|
+
/* @__PURE__ */ jsx(
|
|
5245
|
+
ChevronDown,
|
|
5246
|
+
{
|
|
5247
|
+
className: cn(
|
|
5248
|
+
"h-3 w-3 text-muted-foreground transition-transform",
|
|
5249
|
+
menuOpen && "rotate-180"
|
|
5250
|
+
)
|
|
5251
|
+
}
|
|
5252
|
+
)
|
|
5253
|
+
]
|
|
5254
|
+
}
|
|
5255
|
+
) })
|
|
5256
|
+
]
|
|
5257
|
+
}
|
|
5258
|
+
),
|
|
5259
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: menuOpen && expanded && menuItems && menuItems.length > 0 && /* @__PURE__ */ jsx(
|
|
5260
|
+
motion.div,
|
|
5261
|
+
{
|
|
5262
|
+
initial: { opacity: 0, y: -10 },
|
|
5263
|
+
animate: { opacity: 1, y: 0 },
|
|
5264
|
+
exit: { opacity: 0, y: -10 },
|
|
5265
|
+
transition: { duration: 0.15 },
|
|
5266
|
+
className: "absolute bottom-full left-0 right-0 mb-1 overflow-hidden rounded-md border border-border bg-card shadow-lg",
|
|
5267
|
+
children: /* @__PURE__ */ jsx("div", { className: "py-1", children: menuItems.map((item, index) => {
|
|
5268
|
+
const IconComponent = item.icon && isLucideIcon(item.icon) ? item.icon : null;
|
|
5269
|
+
const isDestructive = item.variant === "destructive";
|
|
5270
|
+
return /* @__PURE__ */ jsxs(React48.Fragment, { children: [
|
|
5271
|
+
isDestructive && index > 0 && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
|
|
5272
|
+
/* @__PURE__ */ jsxs(
|
|
5273
|
+
"button",
|
|
5274
|
+
{
|
|
5275
|
+
onClick: () => {
|
|
5276
|
+
item.onClick();
|
|
5277
|
+
setMenuOpen(false);
|
|
5278
|
+
},
|
|
5279
|
+
className: cn(
|
|
5280
|
+
"flex w-full items-center gap-2 px-3 py-1.5 text-xs transition-colors",
|
|
5281
|
+
isDestructive ? "text-destructive hover:bg-destructive/10" : "text-foreground hover:bg-muted"
|
|
5282
|
+
),
|
|
5283
|
+
children: [
|
|
5284
|
+
IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: "h-3 w-3" }),
|
|
5285
|
+
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
5286
|
+
]
|
|
5287
|
+
}
|
|
5288
|
+
)
|
|
5289
|
+
] }, item.label);
|
|
5290
|
+
}) })
|
|
5291
|
+
}
|
|
5292
|
+
) })
|
|
5293
|
+
] })
|
|
5294
|
+
}
|
|
5295
|
+
);
|
|
5296
|
+
});
|
|
5297
|
+
SidebarFooter.displayName = "Sidebar.Footer";
|
|
5298
|
+
var COLLAPSED_WIDTH = 60;
|
|
5299
|
+
var EXPANDED_WIDTH = 250;
|
|
5300
|
+
function SidebarRoot({
|
|
5301
|
+
children,
|
|
5302
|
+
defaultExpanded = false,
|
|
5303
|
+
defaultPinned = false,
|
|
5304
|
+
collapsedWidth = COLLAPSED_WIDTH,
|
|
5305
|
+
expandedWidth = EXPANDED_WIDTH
|
|
5306
|
+
}) {
|
|
5307
|
+
const [expanded, setExpanded] = React48.useState(defaultExpanded || defaultPinned);
|
|
5308
|
+
const [pinned, setPinned] = React48.useState(defaultPinned);
|
|
5309
|
+
const [activeSection, setActiveSection] = React48.useState(null);
|
|
5310
|
+
const isMobile = useMediaQuery2("(max-width: 768px)");
|
|
5311
|
+
const handleSetPinned = React48.useCallback((value) => {
|
|
5312
|
+
setPinned(value);
|
|
5313
|
+
if (value) {
|
|
5314
|
+
setExpanded(true);
|
|
5315
|
+
}
|
|
5316
|
+
}, []);
|
|
5317
|
+
const contextValue = React48.useMemo(
|
|
5318
|
+
() => ({
|
|
5319
|
+
expanded,
|
|
5320
|
+
setExpanded,
|
|
5321
|
+
pinned,
|
|
5322
|
+
setPinned: handleSetPinned,
|
|
5323
|
+
activeSection,
|
|
5324
|
+
setActiveSection,
|
|
5325
|
+
isMobile,
|
|
5326
|
+
collapsedWidth,
|
|
5327
|
+
expandedWidth
|
|
5328
|
+
}),
|
|
5329
|
+
[expanded, pinned, handleSetPinned, activeSection, isMobile, collapsedWidth, expandedWidth]
|
|
5330
|
+
);
|
|
5331
|
+
return /* @__PURE__ */ jsx(SidebarProvider, { value: contextValue, children });
|
|
5332
|
+
}
|
|
5333
|
+
SidebarRoot.displayName = "SidebarRoot";
|
|
5334
|
+
function SidebarAside({ children, className }) {
|
|
5335
|
+
const { expanded, pinned, setExpanded, isMobile, collapsedWidth, expandedWidth } = useSidebar();
|
|
5336
|
+
const sidebarRef = React48.useRef(null);
|
|
5337
|
+
const handleMouseEnter = React48.useCallback(() => {
|
|
5338
|
+
if (!pinned && !isMobile) {
|
|
5339
|
+
setExpanded(true);
|
|
5340
|
+
}
|
|
5341
|
+
}, [pinned, isMobile, setExpanded]);
|
|
5342
|
+
const handleMouseLeave = React48.useCallback(() => {
|
|
5343
|
+
if (!pinned && !isMobile) {
|
|
5344
|
+
setExpanded(false);
|
|
5345
|
+
}
|
|
5346
|
+
}, [pinned, isMobile, setExpanded]);
|
|
5347
|
+
if (isMobile) {
|
|
5348
|
+
return null;
|
|
5349
|
+
}
|
|
5350
|
+
return /* @__PURE__ */ jsx(
|
|
5351
|
+
motion.aside,
|
|
5352
|
+
{
|
|
5353
|
+
ref: sidebarRef,
|
|
5354
|
+
onMouseEnter: handleMouseEnter,
|
|
5355
|
+
onMouseLeave: handleMouseLeave,
|
|
5356
|
+
initial: { width: collapsedWidth },
|
|
5357
|
+
animate: { width: expanded ? expandedWidth : collapsedWidth },
|
|
5358
|
+
transition: {
|
|
5359
|
+
type: "spring",
|
|
5360
|
+
stiffness: 300,
|
|
5361
|
+
damping: 30,
|
|
5362
|
+
mass: 1
|
|
5363
|
+
},
|
|
5364
|
+
className: cn(
|
|
5365
|
+
"relative flex h-screen flex-col bg-card",
|
|
5366
|
+
"shadow-[0_0_20px_rgba(0,0,0,0.06)]",
|
|
5367
|
+
"fixed top-0 left-0 z-50",
|
|
5368
|
+
className
|
|
5369
|
+
),
|
|
5370
|
+
children
|
|
5371
|
+
}
|
|
5372
|
+
);
|
|
5373
|
+
}
|
|
5374
|
+
SidebarAside.displayName = "SidebarAside";
|
|
5375
|
+
function SidebarContent({ children, className }) {
|
|
5376
|
+
const sidebar = useSidebarOptional();
|
|
5377
|
+
if (!sidebar) {
|
|
5378
|
+
return /* @__PURE__ */ jsx("div", { className, children });
|
|
5379
|
+
}
|
|
5380
|
+
const { expanded, pinned, isMobile, collapsedWidth, expandedWidth } = sidebar;
|
|
5381
|
+
if (isMobile) {
|
|
5382
|
+
return /* @__PURE__ */ jsx("div", { className, children });
|
|
5383
|
+
}
|
|
5384
|
+
const marginLeft = pinned && expanded ? expandedWidth : collapsedWidth;
|
|
5385
|
+
return /* @__PURE__ */ jsx(
|
|
5386
|
+
motion.div,
|
|
5387
|
+
{
|
|
5388
|
+
initial: { marginLeft: collapsedWidth },
|
|
5389
|
+
animate: { marginLeft },
|
|
5390
|
+
transition: {
|
|
5391
|
+
type: "spring",
|
|
5392
|
+
stiffness: 300,
|
|
5393
|
+
damping: 30,
|
|
5394
|
+
mass: 1
|
|
5395
|
+
},
|
|
5396
|
+
className: cn("min-h-screen flex flex-col", className),
|
|
5397
|
+
children
|
|
5398
|
+
}
|
|
5399
|
+
);
|
|
5400
|
+
}
|
|
5401
|
+
SidebarContent.displayName = "SidebarContent";
|
|
5402
|
+
function LegacySidebar({
|
|
5403
|
+
children,
|
|
5404
|
+
defaultExpanded = false,
|
|
5405
|
+
defaultPinned = false,
|
|
5406
|
+
collapsedWidth = COLLAPSED_WIDTH,
|
|
5407
|
+
expandedWidth = EXPANDED_WIDTH,
|
|
5408
|
+
className
|
|
5409
|
+
}) {
|
|
5410
|
+
const [expanded, setExpanded] = React48.useState(defaultExpanded || defaultPinned);
|
|
5411
|
+
const [pinned, setPinned] = React48.useState(defaultPinned);
|
|
5412
|
+
const [activeSection, setActiveSection] = React48.useState(null);
|
|
5413
|
+
const isMobile = useMediaQuery2("(max-width: 768px)");
|
|
5414
|
+
const sidebarRef = React48.useRef(null);
|
|
5415
|
+
const handleMouseEnter = React48.useCallback(() => {
|
|
5416
|
+
if (!pinned && !isMobile) {
|
|
5417
|
+
setExpanded(true);
|
|
5418
|
+
}
|
|
5419
|
+
}, [pinned, isMobile]);
|
|
5420
|
+
const handleMouseLeave = React48.useCallback(() => {
|
|
5421
|
+
if (!pinned && !isMobile) {
|
|
5422
|
+
setExpanded(false);
|
|
5423
|
+
}
|
|
5424
|
+
}, [pinned, isMobile]);
|
|
5425
|
+
const handleSetPinned = React48.useCallback((value) => {
|
|
5426
|
+
setPinned(value);
|
|
5427
|
+
if (value) {
|
|
5428
|
+
setExpanded(true);
|
|
5429
|
+
}
|
|
5430
|
+
}, []);
|
|
5431
|
+
const contextValue = React48.useMemo(
|
|
5432
|
+
() => ({
|
|
5433
|
+
expanded,
|
|
5434
|
+
setExpanded,
|
|
5435
|
+
pinned,
|
|
5436
|
+
setPinned: handleSetPinned,
|
|
5437
|
+
activeSection,
|
|
5438
|
+
setActiveSection,
|
|
5439
|
+
isMobile,
|
|
5440
|
+
collapsedWidth,
|
|
5441
|
+
expandedWidth
|
|
5442
|
+
}),
|
|
5443
|
+
[expanded, pinned, handleSetPinned, activeSection, isMobile, collapsedWidth, expandedWidth]
|
|
5444
|
+
);
|
|
5445
|
+
if (isMobile) {
|
|
5446
|
+
return /* @__PURE__ */ jsx(SidebarProvider, { value: contextValue, children });
|
|
5447
|
+
}
|
|
5448
|
+
return /* @__PURE__ */ jsx(SidebarProvider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
5449
|
+
motion.aside,
|
|
5450
|
+
{
|
|
5451
|
+
ref: sidebarRef,
|
|
5452
|
+
onMouseEnter: handleMouseEnter,
|
|
5453
|
+
onMouseLeave: handleMouseLeave,
|
|
5454
|
+
initial: { width: collapsedWidth },
|
|
5455
|
+
animate: { width: expanded ? expandedWidth : collapsedWidth },
|
|
5456
|
+
transition: {
|
|
5457
|
+
type: "spring",
|
|
5458
|
+
stiffness: 300,
|
|
5459
|
+
damping: 30,
|
|
5460
|
+
mass: 1
|
|
5461
|
+
},
|
|
5462
|
+
className: cn(
|
|
5463
|
+
"relative flex h-screen flex-col bg-card",
|
|
5464
|
+
"shadow-[0_0_20px_rgba(0,0,0,0.06)]",
|
|
5465
|
+
"fixed top-0 left-0 z-50",
|
|
5466
|
+
className
|
|
5467
|
+
),
|
|
5468
|
+
children
|
|
5469
|
+
}
|
|
5470
|
+
) });
|
|
5471
|
+
}
|
|
5472
|
+
LegacySidebar.displayName = "Sidebar";
|
|
5473
|
+
var Sidebar = Object.assign(LegacySidebar, {
|
|
5474
|
+
// Layout components
|
|
5475
|
+
Root: SidebarRoot,
|
|
5476
|
+
Aside: SidebarAside,
|
|
5477
|
+
Content: SidebarContent,
|
|
5478
|
+
// Sidebar content components
|
|
5479
|
+
Header: SidebarHeader,
|
|
5480
|
+
Nav: SidebarNav,
|
|
5481
|
+
Section: SidebarSection,
|
|
5482
|
+
NavItem: SidebarNavItem,
|
|
5483
|
+
NavGroup: SidebarNavGroup,
|
|
5484
|
+
Footer: SidebarFooter
|
|
5485
|
+
});
|
|
5486
|
+
function renderIcon3(icon, className) {
|
|
5487
|
+
if (!icon) return null;
|
|
5488
|
+
if (React48.isValidElement(icon)) {
|
|
5489
|
+
return React48.cloneElement(icon, { className });
|
|
5490
|
+
}
|
|
5491
|
+
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "$$typeof" in icon) {
|
|
5492
|
+
const IconComponent = icon;
|
|
5493
|
+
return /* @__PURE__ */ jsx(IconComponent, { className });
|
|
5494
|
+
}
|
|
5495
|
+
return null;
|
|
5496
|
+
}
|
|
5497
|
+
var MobileNavItem = React48.memo(function MobileNavItem2({
|
|
5498
|
+
icon,
|
|
5499
|
+
label,
|
|
5500
|
+
isActive = false,
|
|
5501
|
+
onClick
|
|
5502
|
+
}) {
|
|
5503
|
+
return /* @__PURE__ */ jsxs("button", { onClick, className: "group flex flex-col items-center", children: [
|
|
5504
|
+
/* @__PURE__ */ jsx(
|
|
5505
|
+
"div",
|
|
5506
|
+
{
|
|
5507
|
+
className: cn(
|
|
5508
|
+
"flex items-center justify-center rounded-full p-1.5 transition-colors",
|
|
5509
|
+
isActive ? "text-primary" : "text-muted-foreground group-hover:text-foreground"
|
|
5510
|
+
),
|
|
5511
|
+
children: renderIcon3(icon, "h-5 w-5")
|
|
5512
|
+
}
|
|
5513
|
+
),
|
|
5514
|
+
/* @__PURE__ */ jsx(
|
|
5515
|
+
"span",
|
|
5516
|
+
{
|
|
5517
|
+
className: cn(
|
|
5518
|
+
"mt-0.5 text-[10px] font-medium",
|
|
5519
|
+
isActive ? "text-primary" : "text-muted-foreground group-hover:text-foreground"
|
|
5520
|
+
),
|
|
5521
|
+
children: label
|
|
5522
|
+
}
|
|
5523
|
+
),
|
|
5524
|
+
isActive && /* @__PURE__ */ jsx(
|
|
5525
|
+
motion.div,
|
|
5526
|
+
{
|
|
5527
|
+
layoutId: "mobileNavActiveIndicator",
|
|
5528
|
+
className: "mt-1 h-1 w-8 rounded-full bg-primary",
|
|
5529
|
+
transition: { type: "spring", stiffness: 500, damping: 30 }
|
|
5530
|
+
}
|
|
5531
|
+
)
|
|
5532
|
+
] });
|
|
5533
|
+
});
|
|
5534
|
+
MobileNavItem.displayName = "MobileNavItem";
|
|
5535
|
+
var MobileNav = React48.memo(function MobileNav2({
|
|
5536
|
+
items,
|
|
5537
|
+
fabAction,
|
|
5538
|
+
className
|
|
5539
|
+
}) {
|
|
5540
|
+
const leftItems = fabAction ? items.slice(0, Math.ceil(items.length / 2)) : items;
|
|
5541
|
+
const rightItems = fabAction ? items.slice(Math.ceil(items.length / 2)) : [];
|
|
5542
|
+
return /* @__PURE__ */ jsx(
|
|
5543
|
+
"div",
|
|
5544
|
+
{
|
|
5545
|
+
className: cn(
|
|
5546
|
+
"fixed bottom-0 left-0 right-0 z-50 bg-card px-2 pb-2 pt-1.5 md:hidden",
|
|
5547
|
+
"border-t border-border",
|
|
5548
|
+
className
|
|
5549
|
+
),
|
|
5550
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-around", children: [
|
|
5551
|
+
leftItems.map((item, index) => /* @__PURE__ */ jsx(
|
|
5552
|
+
MobileNavItem,
|
|
5553
|
+
{
|
|
5554
|
+
icon: item.icon,
|
|
5555
|
+
label: item.label,
|
|
5556
|
+
isActive: item.isActive,
|
|
5557
|
+
onClick: () => {
|
|
5558
|
+
if (item.onClick) {
|
|
5559
|
+
item.onClick();
|
|
5560
|
+
} else if (item.href && typeof window !== "undefined") {
|
|
5561
|
+
window.location.href = item.href;
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5564
|
+
},
|
|
5565
|
+
`left-${index}-${item.label}`
|
|
5566
|
+
)),
|
|
5567
|
+
fabAction && /* @__PURE__ */ jsxs("div", { className: "relative -mt-5", children: [
|
|
5568
|
+
/* @__PURE__ */ jsx(
|
|
5569
|
+
"button",
|
|
5570
|
+
{
|
|
5571
|
+
onClick: fabAction.onClick,
|
|
5572
|
+
className: cn(
|
|
5573
|
+
"flex h-14 w-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg",
|
|
5574
|
+
"transition-transform hover:bg-primary/90 active:scale-95"
|
|
5575
|
+
),
|
|
5576
|
+
"aria-label": fabAction.label,
|
|
5577
|
+
children: fabAction.icon
|
|
5578
|
+
}
|
|
5579
|
+
),
|
|
5580
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 block text-center text-[10px] font-medium text-muted-foreground", children: fabAction.label })
|
|
5581
|
+
] }),
|
|
5582
|
+
rightItems.map((item, index) => /* @__PURE__ */ jsx(
|
|
5583
|
+
MobileNavItem,
|
|
5584
|
+
{
|
|
5585
|
+
icon: item.icon,
|
|
5586
|
+
label: item.label,
|
|
5587
|
+
isActive: item.isActive,
|
|
5588
|
+
onClick: () => {
|
|
5589
|
+
if (item.onClick) {
|
|
5590
|
+
item.onClick();
|
|
5591
|
+
} else if (item.href && typeof window !== "undefined") {
|
|
5592
|
+
window.location.href = item.href;
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
},
|
|
5596
|
+
`right-${index}-${item.label}`
|
|
5597
|
+
))
|
|
5598
|
+
] })
|
|
5599
|
+
}
|
|
5600
|
+
);
|
|
5601
|
+
});
|
|
5602
|
+
MobileNav.displayName = "MobileNav";
|
|
5603
|
+
var Navbar = React48.memo(function Navbar2({
|
|
5604
|
+
children,
|
|
5605
|
+
className,
|
|
5606
|
+
style
|
|
5607
|
+
}) {
|
|
5608
|
+
return /* @__PURE__ */ jsx(
|
|
5609
|
+
"nav",
|
|
5610
|
+
{
|
|
5611
|
+
className: cn(
|
|
5612
|
+
"fixed top-0 right-0 bg-card border-b/50 h-16 z-40 w-full shadow-sm",
|
|
5613
|
+
className
|
|
5614
|
+
),
|
|
5615
|
+
style,
|
|
5616
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full px-4 sm:px-6 lg:pr-8 lg:pl-20", children: /* @__PURE__ */ jsx("div", { className: "flex justify-between items-center h-full", children }) })
|
|
5617
|
+
}
|
|
5618
|
+
);
|
|
5619
|
+
});
|
|
5620
|
+
Navbar.displayName = "Navbar";
|
|
5621
|
+
function ThemeToggle({ className }) {
|
|
5622
|
+
const [isDark, setIsDark] = React48.useState(false);
|
|
5623
|
+
React48.useEffect(() => {
|
|
5624
|
+
const isDarkMode = document.documentElement.classList.contains("dark");
|
|
5625
|
+
setIsDark(isDarkMode);
|
|
5626
|
+
}, []);
|
|
5627
|
+
const toggleTheme = () => {
|
|
5628
|
+
setIsDark(!isDark);
|
|
5629
|
+
if (isDark) {
|
|
5630
|
+
document.documentElement.classList.remove("dark");
|
|
5631
|
+
document.documentElement.style.colorScheme = "light";
|
|
5632
|
+
} else {
|
|
5633
|
+
document.documentElement.classList.add("dark");
|
|
5634
|
+
document.documentElement.style.colorScheme = "dark";
|
|
5635
|
+
}
|
|
5636
|
+
};
|
|
5637
|
+
return /* @__PURE__ */ jsxs(
|
|
5638
|
+
Button,
|
|
5639
|
+
{
|
|
5640
|
+
variant: "ghost",
|
|
5641
|
+
size: "icon",
|
|
5642
|
+
onClick: toggleTheme,
|
|
5643
|
+
"aria-label": "Alternar tema",
|
|
5644
|
+
className,
|
|
5645
|
+
children: [
|
|
5646
|
+
isDark ? /* @__PURE__ */ jsx(Sun, { className: "h-[1.2rem] w-[1.2rem] text-muted-foreground transition-all" }) : /* @__PURE__ */ jsx(Moon, { className: "h-[1.2rem] w-[1.2rem] text-muted-foreground transition-all" }),
|
|
5647
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Alternar tema" })
|
|
5648
|
+
]
|
|
5649
|
+
}
|
|
5650
|
+
);
|
|
5651
|
+
}
|
|
5652
|
+
ThemeToggle.displayName = "ThemeToggle";
|
|
5653
|
+
function NavbarNotification({
|
|
5654
|
+
notifications = [],
|
|
5655
|
+
onMarkAllAsRead,
|
|
5656
|
+
onViewAll
|
|
5657
|
+
}) {
|
|
5658
|
+
const hasNotifications = notifications.length > 0;
|
|
5659
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
5660
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "icon", className: "rounded-full relative", children: [
|
|
5661
|
+
/* @__PURE__ */ jsx(Bell, { className: "h-5 w-5 text-muted-foreground" }),
|
|
5662
|
+
hasNotifications && /* @__PURE__ */ jsx("span", { className: "absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500" }),
|
|
5663
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Abrir notifica\xE7\xF5es" })
|
|
5664
|
+
] }) }),
|
|
5665
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[400px] p-0", align: "end", children: /* @__PURE__ */ jsxs(Card, { className: "border-0 shadow-none", children: [
|
|
5666
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
5667
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-xl font-bold", children: "Notifica\xE7\xF5es" }),
|
|
5668
|
+
onMarkAllAsRead && /* @__PURE__ */ jsx(
|
|
5669
|
+
Button,
|
|
5670
|
+
{
|
|
5671
|
+
variant: "link",
|
|
5672
|
+
className: "text-primary hover:text-primary/80",
|
|
5673
|
+
onClick: onMarkAllAsRead,
|
|
5674
|
+
children: "Marcar todas como lidas"
|
|
5675
|
+
}
|
|
5676
|
+
)
|
|
5677
|
+
] }),
|
|
5678
|
+
/* @__PURE__ */ jsx(CardContent, { className: "px-0", children: notifications.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-8 text-center text-muted-foreground", children: "Nenhuma notifica\xE7\xE3o" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5679
|
+
/* @__PURE__ */ jsx("div", { className: "bg-background/30 px-6 py-2 text-sm font-medium text-gray-500", children: "Hoje" }),
|
|
5680
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4 px-6 py-3", children: notifications.map((notification) => /* @__PURE__ */ jsxs(
|
|
5681
|
+
"div",
|
|
5682
|
+
{
|
|
5683
|
+
className: `flex items-start space-x-4 ${notification.isHighlighted ? "rounded-lg bg-primary/5 p-3" : ""}`,
|
|
5684
|
+
children: [
|
|
5685
|
+
notification.icon && /* @__PURE__ */ jsx(
|
|
5686
|
+
"div",
|
|
5687
|
+
{
|
|
5688
|
+
className: `mt-1 rounded-full p-2 ${notification.isHighlighted ? "bg-primary/25" : "bg-gray-500/20"}`,
|
|
5689
|
+
children: notification.icon
|
|
5690
|
+
}
|
|
5691
|
+
),
|
|
5692
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
5693
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: notification.title }),
|
|
5694
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: notification.description }),
|
|
5695
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-gray-400", children: notification.time })
|
|
5696
|
+
] })
|
|
5697
|
+
]
|
|
5698
|
+
},
|
|
5699
|
+
notification.id
|
|
5700
|
+
)) })
|
|
5701
|
+
] }) }),
|
|
5702
|
+
onViewAll && /* @__PURE__ */ jsx(CardFooter, { className: "justify-center", children: /* @__PURE__ */ jsx(
|
|
5703
|
+
Button,
|
|
5704
|
+
{
|
|
5705
|
+
variant: "link",
|
|
5706
|
+
className: "text-primary hover:text-primary/80",
|
|
5707
|
+
onClick: onViewAll,
|
|
5708
|
+
children: "Ver todas notifica\xE7\xF5es"
|
|
5709
|
+
}
|
|
5710
|
+
) })
|
|
5711
|
+
] }) })
|
|
5712
|
+
] });
|
|
5713
|
+
}
|
|
5714
|
+
NavbarNotification.displayName = "NavbarNotification";
|
|
5715
|
+
var ScrollArea = React48.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
5716
|
+
ScrollAreaPrimitive.Root,
|
|
5717
|
+
{
|
|
5718
|
+
ref,
|
|
5719
|
+
className: cn("relative overflow-hidden", className),
|
|
5720
|
+
...props,
|
|
5721
|
+
children: [
|
|
5722
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
5723
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
5724
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
5725
|
+
]
|
|
5726
|
+
}
|
|
5727
|
+
));
|
|
5728
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
5729
|
+
var ScrollBar = React48.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5730
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
5731
|
+
{
|
|
5732
|
+
ref,
|
|
5733
|
+
orientation,
|
|
5734
|
+
className: cn(
|
|
5735
|
+
"flex touch-none select-none transition-colors",
|
|
5736
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
5737
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
5738
|
+
className
|
|
5739
|
+
),
|
|
5740
|
+
...props,
|
|
5741
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
5742
|
+
}
|
|
5743
|
+
));
|
|
5744
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
5745
|
+
var Separator3 = React48.forwardRef(
|
|
5746
|
+
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5747
|
+
SeparatorPrimitive.Root,
|
|
5748
|
+
{
|
|
5749
|
+
ref,
|
|
5750
|
+
decorative,
|
|
5751
|
+
orientation,
|
|
5752
|
+
className: cn(
|
|
5753
|
+
"shrink-0 bg-border",
|
|
5754
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
5755
|
+
className
|
|
5756
|
+
),
|
|
5757
|
+
...props
|
|
5758
|
+
}
|
|
5759
|
+
)
|
|
5760
|
+
);
|
|
5761
|
+
Separator3.displayName = SeparatorPrimitive.Root.displayName;
|
|
5762
|
+
function getInitials2(name) {
|
|
5763
|
+
return name.slice(0, 2).toUpperCase();
|
|
5764
|
+
}
|
|
5765
|
+
function defaultFormatCnpj(cnpj) {
|
|
5766
|
+
return cnpj.replace(/\D/g, "").replace(/^(\d{2})(\d)/, "$1.$2").replace(/^(\d{2})\.(\d{3})(\d)/, "$1.$2.$3").replace(/\.(\d{3})(\d)/, ".$1/$2").replace(/(\d{4})(\d)/, "$1-$2").slice(0, 18);
|
|
5767
|
+
}
|
|
5768
|
+
function NavbarCompanyProfile({
|
|
5769
|
+
companies,
|
|
5770
|
+
activeCompanyId,
|
|
5771
|
+
onCompanySelect,
|
|
5772
|
+
isLoading = false,
|
|
5773
|
+
formatCnpj = defaultFormatCnpj
|
|
5774
|
+
}) {
|
|
5775
|
+
const currentCompany = companies.find(
|
|
5776
|
+
(company) => company.id === activeCompanyId
|
|
5777
|
+
);
|
|
5778
|
+
if (!currentCompany) {
|
|
5779
|
+
return isLoading ? /* @__PURE__ */ jsx(Loader, { variant: "dots" }) : null;
|
|
5780
|
+
}
|
|
5781
|
+
const handleCompanyClick = (companyId) => {
|
|
5782
|
+
if (onCompanySelect) {
|
|
5783
|
+
onCompanySelect(companyId);
|
|
5784
|
+
}
|
|
5785
|
+
};
|
|
5786
|
+
return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-3 bg-primary/5 text-primary px-2 py-1 rounded-md", children: [
|
|
5787
|
+
/* @__PURE__ */ jsx(Avatar, { className: "h-10 w-10 bg-primary/20", children: /* @__PURE__ */ jsx(AvatarFallback, { className: "font-semibold", children: getInitials2(currentCompany.name) }) }),
|
|
5788
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden sm:flex sm:flex-col sm:flex-grow", children: [
|
|
5789
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-sm", children: currentCompany.name }),
|
|
5790
|
+
currentCompany.cnpj && /* @__PURE__ */ jsx("p", { className: "text-xs text-primary/70", children: formatCnpj(currentCompany.cnpj) })
|
|
5791
|
+
] }),
|
|
5792
|
+
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
5793
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
5794
|
+
Button,
|
|
5795
|
+
{
|
|
5796
|
+
variant: "ghost",
|
|
5797
|
+
size: "sm",
|
|
5798
|
+
className: "h-8 px-2 text-primary hover:bg-primary/20",
|
|
5799
|
+
children: [
|
|
5800
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Abrir menu de empresas" }),
|
|
5801
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
5802
|
+
]
|
|
5803
|
+
}
|
|
5804
|
+
) }),
|
|
5805
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-80 p-0", align: "end", children: [
|
|
5806
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-primary/5 p-4 rounded-t-lg", children: [
|
|
5807
|
+
/* @__PURE__ */ jsx("h4", { className: "font-semibold text-sm mb-1", children: "Empresas Vinculadas" }),
|
|
5808
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Selecione para mudar de empresa" })
|
|
5809
|
+
] }),
|
|
5810
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "h-64", children: /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
5811
|
+
isLoading && /* @__PURE__ */ jsx("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ jsx(Loader, { variant: "spinner" }) }),
|
|
5812
|
+
!isLoading && companies.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-center text-muted-foreground", children: "Nenhuma empresa encontrada." }),
|
|
5813
|
+
companies.map((company, index) => /* @__PURE__ */ jsxs(React48.Fragment, { children: [
|
|
5814
|
+
/* @__PURE__ */ jsx(
|
|
5815
|
+
Button,
|
|
5816
|
+
{
|
|
5817
|
+
variant: "ghost",
|
|
5818
|
+
className: "w-full justify-start text-sm mb-1 hover:bg-primary/10",
|
|
5819
|
+
onClick: () => handleCompanyClick(company.id),
|
|
5820
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full", children: [
|
|
5821
|
+
/* @__PURE__ */ jsx(Avatar, { className: "h-8 w-8 mr-3", children: /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-primary/20 text-primary text-xs", children: getInitials2(company.name) }) }),
|
|
5822
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-grow text-left", children: [
|
|
5823
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: company.name }),
|
|
5824
|
+
company.cnpj && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: formatCnpj(company.cnpj) })
|
|
5825
|
+
] }),
|
|
5826
|
+
company.id === activeCompanyId && /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 text-primary ml-2" })
|
|
5827
|
+
] })
|
|
5828
|
+
}
|
|
5829
|
+
),
|
|
5830
|
+
index < companies.length - 1 && /* @__PURE__ */ jsx(Separator3, { className: "my-2" })
|
|
5831
|
+
] }, company.id))
|
|
5832
|
+
] }) })
|
|
5833
|
+
] })
|
|
5834
|
+
] })
|
|
5835
|
+
] }) });
|
|
5836
|
+
}
|
|
5837
|
+
NavbarCompanyProfile.displayName = "NavbarCompanyProfile";
|
|
5838
|
+
function getInitials3(name) {
|
|
5839
|
+
return name.split(" ").map((part) => part[0]).join("").toUpperCase().slice(0, 2);
|
|
5840
|
+
}
|
|
5841
|
+
var defaultMenuItems = [
|
|
5842
|
+
{ icon: /* @__PURE__ */ jsx(User, { className: "h-4 w-4" }), label: "Ver Perfil" },
|
|
5843
|
+
{ icon: /* @__PURE__ */ jsx(Settings, { className: "h-4 w-4" }), label: "Configura\xE7\xF5es" },
|
|
5844
|
+
{ icon: /* @__PURE__ */ jsx(Bell, { className: "h-4 w-4" }), label: "Atualiza\xE7\xF5es" },
|
|
5845
|
+
{ icon: /* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4" }), label: "Sair", variant: "destructive" }
|
|
5846
|
+
];
|
|
5847
|
+
function NavbarUserMenu({
|
|
5848
|
+
name,
|
|
5849
|
+
email,
|
|
5850
|
+
avatarUrl,
|
|
5851
|
+
isCollapsed = false,
|
|
5852
|
+
menuItems = defaultMenuItems,
|
|
5853
|
+
children
|
|
5854
|
+
}) {
|
|
5855
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
5856
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", className: "w-full justify-start p-2", children: [
|
|
5857
|
+
/* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8", children: [
|
|
5858
|
+
avatarUrl && /* @__PURE__ */ jsx(AvatarImage, { src: avatarUrl, alt: name }),
|
|
5859
|
+
/* @__PURE__ */ jsx(AvatarFallback, { children: getInitials3(name) })
|
|
5860
|
+
] }),
|
|
5861
|
+
!isCollapsed && /* @__PURE__ */ jsxs("div", { className: "ml-2 text-left", children: [
|
|
5862
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: name }),
|
|
5863
|
+
email && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: email })
|
|
5864
|
+
] })
|
|
5865
|
+
] }) }),
|
|
5866
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-56 p-2", align: "end", children: children ? children : /* @__PURE__ */ jsx("div", { className: "space-y-1", children: menuItems.map((item, index) => {
|
|
5867
|
+
const content = /* @__PURE__ */ jsxs(
|
|
5868
|
+
Button,
|
|
5869
|
+
{
|
|
5870
|
+
variant: "ghost",
|
|
5871
|
+
className: `w-full justify-start text-sm ${item.variant === "destructive" ? "text-red-500" : ""}`,
|
|
5872
|
+
onClick: item.onClick,
|
|
5873
|
+
children: [
|
|
5874
|
+
item.icon && /* @__PURE__ */ jsx("span", { className: "mr-2", children: item.icon }),
|
|
5875
|
+
item.label
|
|
5876
|
+
]
|
|
5877
|
+
},
|
|
5878
|
+
index
|
|
5879
|
+
);
|
|
5880
|
+
if (item.href) {
|
|
5881
|
+
return /* @__PURE__ */ jsx(
|
|
5882
|
+
"a",
|
|
5883
|
+
{
|
|
5884
|
+
href: item.href,
|
|
5885
|
+
className: "flex flex-col items-center text-center",
|
|
5886
|
+
children: content
|
|
5887
|
+
},
|
|
5888
|
+
index
|
|
5889
|
+
);
|
|
5890
|
+
}
|
|
5891
|
+
return content;
|
|
5892
|
+
}) }) })
|
|
5893
|
+
] });
|
|
5894
|
+
}
|
|
5895
|
+
NavbarUserMenu.displayName = "NavbarUserMenu";
|
|
5896
|
+
var Breadcrumb = React48.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("nav", { ref, "aria-label": "breadcrumb", ...props }));
|
|
5897
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
5898
|
+
var BreadcrumbList = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5899
|
+
"ol",
|
|
5900
|
+
{
|
|
5901
|
+
ref,
|
|
5902
|
+
className: cn(
|
|
5903
|
+
"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
|
|
5904
|
+
className
|
|
5905
|
+
),
|
|
5906
|
+
...props
|
|
5907
|
+
}
|
|
5908
|
+
));
|
|
5909
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
5910
|
+
var BreadcrumbItem = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5911
|
+
"li",
|
|
5912
|
+
{
|
|
5913
|
+
ref,
|
|
5914
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
5915
|
+
...props
|
|
5916
|
+
}
|
|
5917
|
+
));
|
|
5918
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
5919
|
+
var BreadcrumbLink = React48.forwardRef(({ asChild, className, ...props }, ref) => {
|
|
5920
|
+
const Comp = asChild ? Slot : "a";
|
|
5921
|
+
return /* @__PURE__ */ jsx(
|
|
5922
|
+
Comp,
|
|
5923
|
+
{
|
|
5924
|
+
ref,
|
|
5925
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
5926
|
+
...props
|
|
5927
|
+
}
|
|
5928
|
+
);
|
|
5929
|
+
});
|
|
5930
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
5931
|
+
var BreadcrumbPage = React48.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5932
|
+
"span",
|
|
5933
|
+
{
|
|
5934
|
+
ref,
|
|
5935
|
+
role: "link",
|
|
5936
|
+
"aria-disabled": "true",
|
|
5937
|
+
"aria-current": "page",
|
|
5938
|
+
className: cn("font-semibold text-primary", className),
|
|
5939
|
+
...props
|
|
5940
|
+
}
|
|
5941
|
+
));
|
|
5942
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
5943
|
+
var BreadcrumbSeparator = ({
|
|
5944
|
+
children,
|
|
5945
|
+
className,
|
|
5946
|
+
...props
|
|
5947
|
+
}) => /* @__PURE__ */ jsx(
|
|
5948
|
+
"li",
|
|
5949
|
+
{
|
|
5950
|
+
role: "presentation",
|
|
5951
|
+
"aria-hidden": "true",
|
|
5952
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
5953
|
+
...props,
|
|
5954
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
|
|
5955
|
+
}
|
|
5956
|
+
);
|
|
5957
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
5958
|
+
var BreadcrumbEllipsis = ({
|
|
5959
|
+
className,
|
|
5960
|
+
...props
|
|
5961
|
+
}) => /* @__PURE__ */ jsxs(
|
|
5962
|
+
"span",
|
|
5963
|
+
{
|
|
5964
|
+
role: "presentation",
|
|
5965
|
+
"aria-hidden": "true",
|
|
5966
|
+
className: cn("flex h-9 w-9 items-center justify-center", className),
|
|
5967
|
+
...props,
|
|
5968
|
+
children: [
|
|
5969
|
+
/* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }),
|
|
5970
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "More" })
|
|
5971
|
+
]
|
|
5972
|
+
}
|
|
5973
|
+
);
|
|
5974
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
5975
|
+
function SectionHeaderRoot({
|
|
5976
|
+
children,
|
|
5977
|
+
className,
|
|
5978
|
+
gradient = true,
|
|
5979
|
+
bordered = true,
|
|
5980
|
+
...props
|
|
5981
|
+
}) {
|
|
5982
|
+
return /* @__PURE__ */ jsx(
|
|
5983
|
+
"div",
|
|
5984
|
+
{
|
|
5985
|
+
className: cn(
|
|
5986
|
+
"px-6 py-4",
|
|
5987
|
+
gradient && "bg-gradient-to-r from-primary/5 to-transparent",
|
|
5988
|
+
bordered && "border-b border-border/50",
|
|
5989
|
+
className
|
|
5990
|
+
),
|
|
5991
|
+
...props,
|
|
5992
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-4", children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 min-w-0 flex-1", children }) })
|
|
5993
|
+
}
|
|
5994
|
+
);
|
|
5995
|
+
}
|
|
5996
|
+
SectionHeaderRoot.displayName = "SectionHeader";
|
|
5997
|
+
function SectionHeaderIcon({ icon: Icon2, className }) {
|
|
5998
|
+
return /* @__PURE__ */ jsx("div", { className: cn("p-2.5 rounded-xl bg-primary/10 shrink-0", className), children: /* @__PURE__ */ jsx(Icon2, { className: "h-5 w-5 text-primary" }) });
|
|
5999
|
+
}
|
|
6000
|
+
SectionHeaderIcon.displayName = "SectionHeader.Icon";
|
|
6001
|
+
function SectionHeaderContent({ children, className, ...props }) {
|
|
6002
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 flex-1", className), ...props, children });
|
|
6003
|
+
}
|
|
6004
|
+
SectionHeaderContent.displayName = "SectionHeader.Content";
|
|
6005
|
+
function SectionHeaderTitle({ children, className, ...props }) {
|
|
6006
|
+
return /* @__PURE__ */ jsx(
|
|
6007
|
+
"h3",
|
|
6008
|
+
{
|
|
6009
|
+
className: cn("font-semibold text-foreground truncate", className),
|
|
6010
|
+
...props,
|
|
6011
|
+
children
|
|
6012
|
+
}
|
|
6013
|
+
);
|
|
6014
|
+
}
|
|
6015
|
+
SectionHeaderTitle.displayName = "SectionHeader.Title";
|
|
6016
|
+
function SectionHeaderSubtitle({ children, className, ...props }) {
|
|
6017
|
+
return /* @__PURE__ */ jsx(
|
|
6018
|
+
"p",
|
|
6019
|
+
{
|
|
6020
|
+
className: cn("text-sm text-muted-foreground truncate", className),
|
|
6021
|
+
...props,
|
|
6022
|
+
children
|
|
6023
|
+
}
|
|
6024
|
+
);
|
|
6025
|
+
}
|
|
6026
|
+
SectionHeaderSubtitle.displayName = "SectionHeader.Subtitle";
|
|
6027
|
+
function SectionHeaderActions({ children, className, ...props }) {
|
|
6028
|
+
return /* @__PURE__ */ jsx(
|
|
6029
|
+
"div",
|
|
6030
|
+
{
|
|
6031
|
+
className: cn("flex items-center gap-2 shrink-0 ml-auto", className),
|
|
6032
|
+
...props,
|
|
6033
|
+
children
|
|
6034
|
+
}
|
|
6035
|
+
);
|
|
6036
|
+
}
|
|
6037
|
+
SectionHeaderActions.displayName = "SectionHeader.Actions";
|
|
6038
|
+
function SectionHeaderBadge({
|
|
6039
|
+
children,
|
|
6040
|
+
className,
|
|
6041
|
+
variant = "muted",
|
|
6042
|
+
...props
|
|
6043
|
+
}) {
|
|
6044
|
+
return /* @__PURE__ */ jsx(
|
|
6045
|
+
"span",
|
|
6046
|
+
{
|
|
6047
|
+
className: cn(
|
|
6048
|
+
"text-xs px-2 py-1 rounded-full shrink-0",
|
|
6049
|
+
variant === "muted" && "bg-muted text-muted-foreground",
|
|
6050
|
+
variant === "default" && "bg-primary/10 text-primary",
|
|
6051
|
+
className
|
|
6052
|
+
),
|
|
6053
|
+
...props,
|
|
6054
|
+
children
|
|
6055
|
+
}
|
|
6056
|
+
);
|
|
6057
|
+
}
|
|
6058
|
+
SectionHeaderBadge.displayName = "SectionHeader.Badge";
|
|
6059
|
+
var SectionHeader = Object.assign(SectionHeaderRoot, {
|
|
6060
|
+
Icon: SectionHeaderIcon,
|
|
6061
|
+
Content: SectionHeaderContent,
|
|
6062
|
+
Title: SectionHeaderTitle,
|
|
6063
|
+
Subtitle: SectionHeaderSubtitle,
|
|
6064
|
+
Actions: SectionHeaderActions,
|
|
6065
|
+
Badge: SectionHeaderBadge
|
|
6066
|
+
});
|
|
6067
|
+
var KanbanContext = React48.createContext(null);
|
|
6068
|
+
function useKanban() {
|
|
6069
|
+
const context = React48.useContext(KanbanContext);
|
|
6070
|
+
if (!context) {
|
|
6071
|
+
throw new Error("useKanban must be used within a Kanban.Board component");
|
|
6072
|
+
}
|
|
6073
|
+
return context;
|
|
6074
|
+
}
|
|
6075
|
+
function useKanbanOptional() {
|
|
6076
|
+
return React48.useContext(KanbanContext);
|
|
6077
|
+
}
|
|
6078
|
+
function KanbanProvider({ children, value }) {
|
|
6079
|
+
return /* @__PURE__ */ jsx(KanbanContext.Provider, { value, children });
|
|
6080
|
+
}
|
|
6081
|
+
function KanbanBoard({
|
|
6082
|
+
children,
|
|
6083
|
+
onDragEnd,
|
|
6084
|
+
onDragStart,
|
|
6085
|
+
className
|
|
6086
|
+
}) {
|
|
6087
|
+
const [isDragging, setIsDragging] = React48.useState(false);
|
|
6088
|
+
const [draggedItemId, setDraggedItemId] = React48.useState(null);
|
|
6089
|
+
const [sourceColumnId, setSourceColumnId] = React48.useState(null);
|
|
6090
|
+
const [hoveredColumnId, setHoveredColumnId] = React48.useState(null);
|
|
6091
|
+
const dropValidatorsRef = React48.useRef(/* @__PURE__ */ new Map());
|
|
6092
|
+
const registerDropValidator = React48.useCallback((columnId, validator) => {
|
|
6093
|
+
dropValidatorsRef.current.set(columnId, validator);
|
|
6094
|
+
}, []);
|
|
6095
|
+
const unregisterDropValidator = React48.useCallback((columnId) => {
|
|
6096
|
+
dropValidatorsRef.current.delete(columnId);
|
|
6097
|
+
}, []);
|
|
6098
|
+
const canDropInColumn = React48.useCallback((columnId) => {
|
|
6099
|
+
if (!draggedItemId || !sourceColumnId) return false;
|
|
6100
|
+
if (columnId === sourceColumnId) return false;
|
|
6101
|
+
const validator = dropValidatorsRef.current.get(columnId);
|
|
6102
|
+
if (validator) {
|
|
6103
|
+
return validator(draggedItemId, sourceColumnId);
|
|
6104
|
+
}
|
|
6105
|
+
return true;
|
|
6106
|
+
}, [draggedItemId, sourceColumnId]);
|
|
6107
|
+
const handleDragStart = React48.useCallback((itemId, colId) => {
|
|
6108
|
+
setIsDragging(true);
|
|
6109
|
+
setDraggedItemId(itemId);
|
|
6110
|
+
setSourceColumnId(colId);
|
|
6111
|
+
onDragStart?.(itemId, colId);
|
|
6112
|
+
}, [onDragStart]);
|
|
6113
|
+
const handleDrop = React48.useCallback((destinationColumnId) => {
|
|
6114
|
+
if (draggedItemId && sourceColumnId && destinationColumnId !== sourceColumnId) {
|
|
6115
|
+
if (canDropInColumn(destinationColumnId)) {
|
|
6116
|
+
const result = {
|
|
6117
|
+
itemId: draggedItemId,
|
|
6118
|
+
sourceColumnId,
|
|
6119
|
+
destinationColumnId
|
|
6120
|
+
};
|
|
6121
|
+
onDragEnd?.(result);
|
|
6122
|
+
}
|
|
6123
|
+
}
|
|
6124
|
+
setIsDragging(false);
|
|
6125
|
+
setDraggedItemId(null);
|
|
6126
|
+
setSourceColumnId(null);
|
|
6127
|
+
setHoveredColumnId(null);
|
|
6128
|
+
}, [draggedItemId, sourceColumnId, canDropInColumn, onDragEnd]);
|
|
6129
|
+
const handleDragEnd = React48.useCallback(() => {
|
|
6130
|
+
setIsDragging(false);
|
|
6131
|
+
setDraggedItemId(null);
|
|
6132
|
+
setSourceColumnId(null);
|
|
6133
|
+
setHoveredColumnId(null);
|
|
6134
|
+
}, []);
|
|
6135
|
+
const contextValue = React48.useMemo(() => ({
|
|
6136
|
+
isDragging,
|
|
6137
|
+
draggedItemId,
|
|
6138
|
+
sourceColumnId,
|
|
6139
|
+
hoveredColumnId,
|
|
6140
|
+
setHoveredColumnId,
|
|
6141
|
+
canDropInColumn,
|
|
6142
|
+
registerDropValidator,
|
|
6143
|
+
unregisterDropValidator
|
|
6144
|
+
}), [isDragging, draggedItemId, sourceColumnId, hoveredColumnId, canDropInColumn, registerDropValidator, unregisterDropValidator]);
|
|
6145
|
+
return /* @__PURE__ */ jsx(KanbanProvider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
6146
|
+
"div",
|
|
6147
|
+
{
|
|
6148
|
+
className: cn(
|
|
6149
|
+
"flex gap-4 overflow-x-auto pb-4",
|
|
6150
|
+
className
|
|
6151
|
+
),
|
|
6152
|
+
onDragEnd: handleDragEnd,
|
|
6153
|
+
"data-kanban-board": true,
|
|
6154
|
+
"data-onstart": handleDragStart.toString(),
|
|
6155
|
+
"data-ondrop": handleDrop.toString(),
|
|
6156
|
+
children: /* @__PURE__ */ jsx(KanbanBoardInternalContext.Provider, { value: { handleDragStart, handleDrop }, children })
|
|
6157
|
+
}
|
|
6158
|
+
) });
|
|
6159
|
+
}
|
|
6160
|
+
var KanbanBoardInternalContext = React48.createContext(null);
|
|
6161
|
+
function useKanbanBoard() {
|
|
6162
|
+
const context = React48.useContext(KanbanBoardInternalContext);
|
|
6163
|
+
if (!context) {
|
|
6164
|
+
throw new Error("useKanbanBoard must be used within a Kanban.Board component");
|
|
6165
|
+
}
|
|
6166
|
+
return context;
|
|
6167
|
+
}
|
|
6168
|
+
KanbanBoard.displayName = "KanbanBoard";
|
|
6169
|
+
function KanbanColumn({
|
|
6170
|
+
id,
|
|
6171
|
+
title,
|
|
6172
|
+
count,
|
|
6173
|
+
children,
|
|
6174
|
+
className,
|
|
6175
|
+
headerClassName,
|
|
6176
|
+
emptyMessage = "Nenhum item",
|
|
6177
|
+
footer,
|
|
6178
|
+
canDrop
|
|
6179
|
+
}) {
|
|
6180
|
+
const { isDragging, sourceColumnId, hoveredColumnId, setHoveredColumnId, canDropInColumn, registerDropValidator, unregisterDropValidator } = useKanban();
|
|
6181
|
+
const { handleDrop } = useKanbanBoard();
|
|
6182
|
+
React48.useEffect(() => {
|
|
6183
|
+
if (canDrop) {
|
|
6184
|
+
registerDropValidator(id, canDrop);
|
|
6185
|
+
return () => unregisterDropValidator(id);
|
|
6186
|
+
}
|
|
6187
|
+
}, [id, canDrop, registerDropValidator, unregisterDropValidator]);
|
|
6188
|
+
const isValidDropTarget = isDragging && sourceColumnId !== id && canDropInColumn(id);
|
|
6189
|
+
const isInvalidDropTarget = isDragging && sourceColumnId !== id && !canDropInColumn(id);
|
|
6190
|
+
const isHovered = hoveredColumnId === id;
|
|
6191
|
+
const handleDragOver = React48.useCallback((e) => {
|
|
6192
|
+
e.preventDefault();
|
|
6193
|
+
if (isValidDropTarget) {
|
|
6194
|
+
e.dataTransfer.dropEffect = "move";
|
|
6195
|
+
setHoveredColumnId(id);
|
|
6196
|
+
} else {
|
|
6197
|
+
e.dataTransfer.dropEffect = "none";
|
|
6198
|
+
}
|
|
6199
|
+
}, [isValidDropTarget, setHoveredColumnId, id]);
|
|
6200
|
+
const handleDragLeave = React48.useCallback((e) => {
|
|
6201
|
+
if (e.currentTarget === e.target || !e.currentTarget.contains(e.relatedTarget)) {
|
|
6202
|
+
setHoveredColumnId(null);
|
|
6203
|
+
}
|
|
6204
|
+
}, [setHoveredColumnId]);
|
|
6205
|
+
const handleDropEvent = React48.useCallback((e) => {
|
|
6206
|
+
e.preventDefault();
|
|
6207
|
+
if (isValidDropTarget) {
|
|
6208
|
+
handleDrop(id);
|
|
6209
|
+
}
|
|
6210
|
+
}, [isValidDropTarget, handleDrop, id]);
|
|
6211
|
+
const childCount = React48.Children.count(children);
|
|
6212
|
+
const displayCount = count ?? childCount;
|
|
6213
|
+
return /* @__PURE__ */ jsxs(
|
|
6214
|
+
"div",
|
|
6215
|
+
{
|
|
6216
|
+
className: cn(
|
|
6217
|
+
"flex flex-col min-w-[300px] max-w-[340px] rounded-2xl",
|
|
6218
|
+
"bg-muted/20 dark:bg-muted/10",
|
|
6219
|
+
"transition-all duration-200",
|
|
6220
|
+
isValidDropTarget && "ring-2 ring-primary/40 bg-primary/5",
|
|
6221
|
+
isInvalidDropTarget && "opacity-40",
|
|
6222
|
+
isHovered && isValidDropTarget && "ring-primary/60 bg-primary/10 scale-[1.01]",
|
|
6223
|
+
className
|
|
6224
|
+
),
|
|
6225
|
+
onDragOver: handleDragOver,
|
|
6226
|
+
onDragLeave: handleDragLeave,
|
|
6227
|
+
onDrop: handleDropEvent,
|
|
6228
|
+
"data-kanban-column": id,
|
|
6229
|
+
children: [
|
|
6230
|
+
/* @__PURE__ */ jsxs(
|
|
6231
|
+
"div",
|
|
6232
|
+
{
|
|
6233
|
+
className: cn(
|
|
6234
|
+
"flex items-center gap-2 px-4 py-3",
|
|
6235
|
+
headerClassName
|
|
6236
|
+
),
|
|
6237
|
+
children: [
|
|
6238
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u21BB" }),
|
|
6239
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium text-foreground flex-1", children: title }),
|
|
6240
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: displayCount }),
|
|
6241
|
+
/* @__PURE__ */ jsx("button", { className: "p-1 rounded-md hover:bg-muted/50 text-muted-foreground transition-colors", children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: "\u22EF" }) }),
|
|
6242
|
+
/* @__PURE__ */ jsx("button", { className: "p-1 rounded-md hover:bg-muted/50 text-muted-foreground transition-colors", children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: "+" }) })
|
|
6243
|
+
]
|
|
6244
|
+
}
|
|
6245
|
+
),
|
|
6246
|
+
/* @__PURE__ */ jsx(
|
|
6247
|
+
"div",
|
|
6248
|
+
{
|
|
6249
|
+
className: cn(
|
|
6250
|
+
"flex-1 px-2 pb-2 space-y-3 min-h-[200px] max-h-[calc(100vh-200px)] overflow-y-auto",
|
|
6251
|
+
isHovered && isValidDropTarget && "bg-primary/5"
|
|
6252
|
+
),
|
|
6253
|
+
children: childCount === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-32 text-sm text-muted-foreground/60", children: emptyMessage }) : children
|
|
6254
|
+
}
|
|
6255
|
+
),
|
|
6256
|
+
footer && /* @__PURE__ */ jsx("div", { className: "px-2 pb-3", children: footer })
|
|
6257
|
+
]
|
|
6258
|
+
}
|
|
6259
|
+
);
|
|
6260
|
+
}
|
|
6261
|
+
KanbanColumn.displayName = "KanbanColumn";
|
|
6262
|
+
function KanbanCard({
|
|
6263
|
+
id,
|
|
6264
|
+
columnId,
|
|
6265
|
+
children,
|
|
6266
|
+
className,
|
|
6267
|
+
disabled = false
|
|
6268
|
+
}) {
|
|
6269
|
+
const { draggedItemId } = useKanban();
|
|
6270
|
+
const { handleDragStart } = useKanbanBoard();
|
|
6271
|
+
const isThisCardDragging = draggedItemId === id;
|
|
6272
|
+
const handleDragStartEvent = React48.useCallback((e) => {
|
|
6273
|
+
if (disabled) {
|
|
6274
|
+
e.preventDefault();
|
|
6275
|
+
return;
|
|
6276
|
+
}
|
|
6277
|
+
e.dataTransfer.effectAllowed = "move";
|
|
6278
|
+
e.dataTransfer.setData("text/plain", id);
|
|
6279
|
+
setTimeout(() => {
|
|
6280
|
+
handleDragStart(id, columnId);
|
|
6281
|
+
}, 0);
|
|
6282
|
+
}, [id, columnId, handleDragStart, disabled]);
|
|
6283
|
+
return /* @__PURE__ */ jsx(
|
|
6284
|
+
"div",
|
|
6285
|
+
{
|
|
6286
|
+
draggable: !disabled,
|
|
6287
|
+
onDragStart: handleDragStartEvent,
|
|
6288
|
+
className: cn(
|
|
6289
|
+
"group relative rounded-2xl border border-border/60 bg-card p-4",
|
|
6290
|
+
"shadow-[0_2px_8px_-2px_rgba(0,0,0,0.08),0_4px_16px_-4px_rgba(0,0,0,0.04)]",
|
|
6291
|
+
"transition-all duration-200",
|
|
6292
|
+
!disabled && "cursor-grab hover:shadow-[0_4px_16px_-4px_rgba(0,0,0,0.12),0_8px_24px_-8px_rgba(0,0,0,0.08)] hover:border-border",
|
|
6293
|
+
!disabled && "active:cursor-grabbing active:scale-[0.98]",
|
|
6294
|
+
isThisCardDragging && "opacity-50 scale-[0.96] shadow-xl border-primary ring-2 ring-primary/20",
|
|
6295
|
+
disabled && "cursor-not-allowed opacity-60",
|
|
6296
|
+
className
|
|
6297
|
+
),
|
|
6298
|
+
"data-kanban-card": id,
|
|
6299
|
+
"data-column": columnId,
|
|
6300
|
+
children
|
|
6301
|
+
}
|
|
6302
|
+
);
|
|
6303
|
+
}
|
|
6304
|
+
KanbanCard.displayName = "KanbanCard";
|
|
6305
|
+
|
|
6306
|
+
// src/components/Kanban/Kanban.tsx
|
|
6307
|
+
var Kanban = {
|
|
6308
|
+
Board: KanbanBoard,
|
|
6309
|
+
Column: KanbanColumn,
|
|
6310
|
+
Card: KanbanCard
|
|
6311
|
+
};
|
|
6312
|
+
function Logo({
|
|
6313
|
+
width = 100,
|
|
6314
|
+
color = "currentColor",
|
|
6315
|
+
className = "text-primary"
|
|
6316
|
+
}) {
|
|
6317
|
+
const originalWidth = 207;
|
|
6318
|
+
const originalHeight = 304;
|
|
6319
|
+
let calculatedHeight = originalHeight;
|
|
6320
|
+
if (typeof width === "number") {
|
|
6321
|
+
calculatedHeight = Math.round(width * (originalHeight / originalWidth));
|
|
6322
|
+
} else if (typeof width === "string" && width.endsWith("%")) {
|
|
6323
|
+
calculatedHeight = "auto";
|
|
6324
|
+
} else if (typeof width === "string") {
|
|
6325
|
+
const numWidth = parseFloat(width);
|
|
6326
|
+
if (!isNaN(numWidth)) {
|
|
6327
|
+
calculatedHeight = `${Math.round(
|
|
6328
|
+
numWidth * (originalHeight / originalWidth)
|
|
6329
|
+
)}${width.match(/[a-zA-Z%]+$/)?.[0] || ""}`;
|
|
6330
|
+
} else {
|
|
6331
|
+
calculatedHeight = originalHeight;
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
return /* @__PURE__ */ jsxs(
|
|
6335
|
+
"svg",
|
|
6336
|
+
{
|
|
6337
|
+
width,
|
|
6338
|
+
height: calculatedHeight,
|
|
6339
|
+
viewBox: "0 0 207 304",
|
|
6340
|
+
fill: "none",
|
|
6341
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6342
|
+
className: cn(className),
|
|
6343
|
+
style: color !== "currentColor" ? { fill: color } : void 0,
|
|
6344
|
+
"aria-label": "Facter Logo",
|
|
6345
|
+
role: "img",
|
|
6346
|
+
children: [
|
|
6347
|
+
/* @__PURE__ */ jsx(
|
|
6348
|
+
"mask",
|
|
6349
|
+
{
|
|
6350
|
+
id: "facter-logo-mask",
|
|
6351
|
+
maskUnits: "userSpaceOnUse",
|
|
6352
|
+
x: "0",
|
|
6353
|
+
y: "0",
|
|
6354
|
+
width: "207",
|
|
6355
|
+
height: "304",
|
|
6356
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0.15625H206.26V304H0V0.15625Z", fill: "white" })
|
|
6357
|
+
}
|
|
6358
|
+
),
|
|
6359
|
+
/* @__PURE__ */ jsx("g", { mask: "url(#facter-logo-mask)", children: /* @__PURE__ */ jsx(
|
|
6360
|
+
"path",
|
|
6361
|
+
{
|
|
6362
|
+
d: "M25.8384 196.911L15.4739 183.729C-10.7189 150.411 0.44781 101.422 38.4895 82.7344L206.266 0.307297V34.2396C206.266 60.1875 191.448 83.8698 168.12 95.2396L56.578 149.594C48.4634 153.547 41.3489 159.344 35.9791 166.609C30.5936 173.901 25.9582 183.906 26.3176 196.526C29.9947 193.609 34.0624 191.026 38.4843 188.854L206.26 106.432V140.359C206.26 166.313 191.437 189.995 168.109 201.365L56.578 255.708C48.4634 259.667 41.3489 265.464 35.9791 272.724C30.4426 280.224 25.6978 290.578 26.3593 303.693L15.4739 289.854C-7.54698 260.568 -1.72407 219.193 25.8384 196.911ZM134.818 266.526L206.208 303.724L206.187 210.802L134.953 246.661C126.828 250.755 126.755 262.323 134.818 266.526Z",
|
|
6363
|
+
fill: color === "currentColor" ? "currentColor" : color
|
|
6364
|
+
}
|
|
6365
|
+
) })
|
|
6366
|
+
]
|
|
6367
|
+
}
|
|
6368
|
+
);
|
|
6369
|
+
}
|
|
6370
|
+
var initialState = {
|
|
6371
|
+
theme: "system",
|
|
6372
|
+
setTheme: () => null
|
|
6373
|
+
};
|
|
6374
|
+
var ThemeProviderContext = React48.createContext(initialState);
|
|
6375
|
+
function ThemeProvider({
|
|
6376
|
+
children,
|
|
6377
|
+
defaultTheme = "system",
|
|
6378
|
+
storageKey = "facter-ds-theme",
|
|
6379
|
+
...props
|
|
6380
|
+
}) {
|
|
6381
|
+
const [theme, setTheme] = React48.useState(
|
|
6382
|
+
() => localStorage.getItem(storageKey) || defaultTheme
|
|
6383
|
+
);
|
|
6384
|
+
const [resolvedTheme, setResolvedTheme] = React48.useState("light");
|
|
6385
|
+
React48.useEffect(() => {
|
|
6386
|
+
const root = window.document.documentElement;
|
|
6387
|
+
root.classList.remove("light", "dark");
|
|
6388
|
+
if (theme === "system") {
|
|
6389
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
6390
|
+
root.classList.add(systemTheme);
|
|
6391
|
+
setResolvedTheme(systemTheme);
|
|
6392
|
+
return;
|
|
6393
|
+
}
|
|
6394
|
+
root.classList.add(theme);
|
|
6395
|
+
setResolvedTheme(theme);
|
|
6396
|
+
}, [theme]);
|
|
6397
|
+
const value = React48.useMemo(
|
|
6398
|
+
() => ({
|
|
6399
|
+
theme,
|
|
6400
|
+
setTheme: (theme2) => {
|
|
6401
|
+
localStorage.setItem(storageKey, theme2);
|
|
6402
|
+
setTheme(theme2);
|
|
6403
|
+
}
|
|
6404
|
+
}),
|
|
6405
|
+
[theme, storageKey]
|
|
6406
|
+
);
|
|
6407
|
+
return /* @__PURE__ */ jsx(ThemeProviderContext.Provider, { ...props, value, children: /* @__PURE__ */ jsx("div", { className: resolvedTheme, style: { minHeight: "100vh" }, children }) });
|
|
6408
|
+
}
|
|
6409
|
+
var useTheme = () => {
|
|
6410
|
+
const context = React48.useContext(ThemeProviderContext);
|
|
6411
|
+
if (context === void 0)
|
|
6412
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
6413
|
+
return context;
|
|
6414
|
+
};
|
|
6415
|
+
|
|
6416
|
+
// src/themes/index.ts
|
|
6417
|
+
var FACTER_THEMES = {
|
|
6418
|
+
default: "default",
|
|
6419
|
+
truck: "truck",
|
|
6420
|
+
vagas: "vagas",
|
|
6421
|
+
techcare: "techcare"
|
|
6422
|
+
};
|
|
6423
|
+
var THEME_INFO = {
|
|
6424
|
+
default: {
|
|
6425
|
+
name: "Default",
|
|
6426
|
+
primaryColor: "#18181B",
|
|
6427
|
+
primaryHsl: "240 5.9% 10%",
|
|
6428
|
+
ringHsl: "240 5.9% 10%",
|
|
6429
|
+
description: "Tema neutro padr\xE3o"
|
|
6430
|
+
},
|
|
6431
|
+
truck: {
|
|
6432
|
+
name: "Facter Truck",
|
|
6433
|
+
primaryColor: "#3B5BDB",
|
|
6434
|
+
primaryHsl: "233 65% 55%",
|
|
6435
|
+
ringHsl: "233 65% 55%",
|
|
6436
|
+
description: "Sistema de gest\xE3o de frotas"
|
|
6437
|
+
},
|
|
6438
|
+
vagas: {
|
|
6439
|
+
name: "Facter Vagas",
|
|
6440
|
+
primaryColor: "#8B5CF6",
|
|
6441
|
+
primaryHsl: "262 83% 58%",
|
|
6442
|
+
ringHsl: "262 83% 58%",
|
|
6443
|
+
description: "Plataforma de vagas de emprego"
|
|
6444
|
+
},
|
|
6445
|
+
techcare: {
|
|
6446
|
+
name: "Facter TechCare",
|
|
6447
|
+
primaryColor: "#16A34A",
|
|
6448
|
+
primaryHsl: "142 76% 36%",
|
|
6449
|
+
ringHsl: "142 76% 36%",
|
|
6450
|
+
description: "Sistema de assist\xEAncia t\xE9cnica"
|
|
6451
|
+
}
|
|
4278
6452
|
};
|
|
4279
6453
|
|
|
4280
|
-
export { AuthLayout, Badge, Button, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, EmptyState, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormProvider, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, Loader, LoaderProvider, RippleBackground, RippleEffect, RippleWrapper, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, cn, loader, toast, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormContext, useFormFieldContext, useLoader, useTheme };
|
|
6454
|
+
export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormProvider, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, Kanban, Loader, LoaderProvider, Logo, MobileNav, MobileNavItem, Navbar, NavbarCompanyProfile, NavbarNotification, NavbarUserMenu, Popover, PopoverContent, PopoverTrigger, RippleBackground, RippleEffect, RippleWrapper, ScrollArea, ScrollBar, SectionHeader, SectionHeaderActions, SectionHeaderBadge, SectionHeaderContent, SectionHeaderIcon, SectionHeaderRoot, SectionHeaderSubtitle, SectionHeaderTitle, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Separator3 as Separator, Sidebar, Skeleton, Sparkline, Switch, THEME_INFO, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, cn, loader, toast, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormContext, useFormFieldContext, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme };
|
|
4281
6455
|
//# sourceMappingURL=index.mjs.map
|
|
4282
6456
|
//# sourceMappingURL=index.mjs.map
|