@facter/ds-core 1.1.1 → 1.1.2

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.js CHANGED
@@ -1,11 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var React4 = require('react');
3
+ var React36 = require('react');
4
4
  var classVarianceAuthority = require('class-variance-authority');
5
5
  var clsx = require('clsx');
6
6
  var tailwindMerge = require('tailwind-merge');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
+ var SelectPrimitive = require('@radix-ui/react-select');
9
+ var lucideReact = require('lucide-react');
10
+ var TabsPrimitive = require('@radix-ui/react-tabs');
8
11
  var framerMotion = require('framer-motion');
12
+ var reactTable = require('@tanstack/react-table');
13
+ var CheckboxPrimitive = require('@radix-ui/react-checkbox');
14
+ var DialogPrimitive = require('@radix-ui/react-dialog');
15
+ var sonner = require('sonner');
16
+ var SwitchPrimitives = require('@radix-ui/react-switch');
17
+ var reactHookForm = require('react-hook-form');
18
+ var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
9
19
 
10
20
  function _interopNamespace(e) {
11
21
  if (e && e.__esModule) return e;
@@ -25,20 +35,27 @@ function _interopNamespace(e) {
25
35
  return Object.freeze(n);
26
36
  }
27
37
 
28
- var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
38
+ var React36__namespace = /*#__PURE__*/_interopNamespace(React36);
39
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
40
+ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
41
+ var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
42
+ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
43
+ var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
44
+ var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
29
45
 
30
46
  // src/components/Button/Button.tsx
31
47
  function cn(...inputs) {
32
48
  return tailwindMerge.twMerge(clsx.clsx(inputs));
33
49
  }
34
50
  var buttonVariants = classVarianceAuthority.cva(
35
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
51
+ "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",
36
52
  {
37
53
  variants: {
38
54
  variant: {
39
- default: "bg-primary text-white hover:bg-primary/90",
40
- destructive: "bg-red-600 text-white hover:bg-red-700",
41
- outline: "border border-input hover:bg-accent hover:text-accent-foreground",
55
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
56
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
57
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
58
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
42
59
  ghost: "hover:bg-accent hover:text-accent-foreground",
43
60
  link: "text-primary underline-offset-4 hover:underline"
44
61
  },
@@ -46,7 +63,8 @@ var buttonVariants = classVarianceAuthority.cva(
46
63
  default: "h-10 px-4 py-2",
47
64
  sm: "h-9 px-3",
48
65
  lg: "h-11 px-8",
49
- icon: "h-10 w-10"
66
+ icon: "h-10 w-10",
67
+ "icon-sm": "h-8 w-8"
50
68
  }
51
69
  },
52
70
  defaultVariants: {
@@ -55,7 +73,7 @@ var buttonVariants = classVarianceAuthority.cva(
55
73
  }
56
74
  }
57
75
  );
58
- var Button = React4__namespace.forwardRef(
76
+ var Button = React36__namespace.forwardRef(
59
77
  ({ className, variant, size, ...props }, ref) => {
60
78
  return /* @__PURE__ */ jsxRuntime.jsx(
61
79
  "button",
@@ -88,7 +106,7 @@ var inputVariants = classVarianceAuthority.cva(
88
106
  }
89
107
  }
90
108
  );
91
- var Input = React4__namespace.forwardRef(
109
+ var Input = React36__namespace.forwardRef(
92
110
  ({
93
111
  className,
94
112
  variant,
@@ -96,25 +114,25 @@ var Input = React4__namespace.forwardRef(
96
114
  error,
97
115
  type = "text",
98
116
  label,
99
- icon: Icon,
117
+ icon: Icon2,
100
118
  required,
101
119
  containerClassName,
102
120
  labelClassName,
103
121
  ...props
104
122
  }, ref) => {
105
- const inputRef = React4__namespace.useRef(null);
106
- const [showPassword, setShowPassword] = React4__namespace.useState(false);
107
- React4__namespace.useImperativeHandle(ref, () => inputRef.current, []);
108
- const focusInput = React4__namespace.useCallback(() => {
123
+ const inputRef = React36__namespace.useRef(null);
124
+ const [showPassword, setShowPassword] = React36__namespace.useState(false);
125
+ React36__namespace.useImperativeHandle(ref, () => inputRef.current, []);
126
+ const focusInput = React36__namespace.useCallback(() => {
109
127
  inputRef.current?.focus();
110
128
  }, []);
111
- const togglePasswordVisibility = React4__namespace.useCallback(() => {
129
+ const togglePasswordVisibility = React36__namespace.useCallback(() => {
112
130
  setShowPassword((prev) => !prev);
113
131
  }, []);
114
132
  const inputType = type === "password" ? showPassword ? "text" : "password" : type;
115
133
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", containerClassName), children: [
116
- Icon && /* @__PURE__ */ jsxRuntime.jsx(
117
- Icon,
134
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(
135
+ Icon2,
118
136
  {
119
137
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground h-4 w-4 cursor-pointer z-10",
120
138
  onClick: focusInput
@@ -129,7 +147,7 @@ var Input = React4__namespace.forwardRef(
129
147
  variant: error ? "error" : variant,
130
148
  inputSize
131
149
  }),
132
- Icon && "pl-10",
150
+ Icon2 && "pl-10",
133
151
  type === "password" && "pr-11",
134
152
  className
135
153
  ),
@@ -143,7 +161,7 @@ var Input = React4__namespace.forwardRef(
143
161
  className: cn(
144
162
  "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 cursor-pointer",
145
163
  error ? "text-red-500" : "text-foreground",
146
- Icon && "left-10",
164
+ Icon2 && "left-10",
147
165
  labelClassName
148
166
  ),
149
167
  onClick: focusInput,
@@ -241,6 +259,169 @@ function Badge({ className, variant, size, ...props }) {
241
259
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant, size }), className), ...props });
242
260
  }
243
261
  Badge.displayName = "Badge";
262
+ var selectVariants = classVarianceAuthority.cva(
263
+ "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",
264
+ {
265
+ variants: {
266
+ variant: {
267
+ default: "border-border focus:border-primary",
268
+ error: "border-red-500 focus:border-red-600"
269
+ },
270
+ selectSize: {
271
+ default: "h-12",
272
+ sm: "h-10 pt-3 pb-1",
273
+ lg: "h-14 pt-5 pb-2"
274
+ }
275
+ },
276
+ defaultVariants: {
277
+ variant: "default",
278
+ selectSize: "default"
279
+ }
280
+ }
281
+ );
282
+ var Select = React36__namespace.forwardRef(
283
+ ({
284
+ className,
285
+ variant,
286
+ selectSize,
287
+ error,
288
+ label,
289
+ icon: Icon2,
290
+ required,
291
+ containerClassName,
292
+ labelClassName,
293
+ placeholder,
294
+ children,
295
+ ...props
296
+ }, ref) => {
297
+ return /* @__PURE__ */ jsxRuntime.jsxs(SelectPrimitive__namespace.Root, { ...props, children: [
298
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", containerClassName), children: [
299
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground h-4 w-4 z-10 pointer-events-none" }),
300
+ /* @__PURE__ */ jsxRuntime.jsxs(
301
+ SelectPrimitive__namespace.Trigger,
302
+ {
303
+ ref,
304
+ className: cn(
305
+ selectVariants({
306
+ variant: error ? "error" : variant,
307
+ selectSize
308
+ }),
309
+ Icon2 && "pl-10",
310
+ "flex items-center justify-between",
311
+ className
312
+ ),
313
+ children: [
314
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { placeholder }),
315
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 opacity-50" }) })
316
+ ]
317
+ }
318
+ ),
319
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
320
+ "label",
321
+ {
322
+ className: cn(
323
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
324
+ error ? "text-red-500" : "text-foreground",
325
+ Icon2 && "left-10",
326
+ labelClassName
327
+ ),
328
+ children: [
329
+ label,
330
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
331
+ ]
332
+ }
333
+ )
334
+ ] }),
335
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
336
+ SelectPrimitive__namespace.Content,
337
+ {
338
+ className: cn(
339
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
340
+ "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"
341
+ ),
342
+ position: "popper",
343
+ sideOffset: 4,
344
+ children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: "p-1", children })
345
+ }
346
+ ) })
347
+ ] });
348
+ }
349
+ );
350
+ Select.displayName = "Select";
351
+ var SelectItem = React36__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
352
+ SelectPrimitive__namespace.Item,
353
+ {
354
+ ref,
355
+ className: cn(
356
+ "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
357
+ "focus:bg-accent focus:text-accent-foreground",
358
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
359
+ className
360
+ ),
361
+ ...props,
362
+ children: [
363
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
364
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
365
+ ]
366
+ }
367
+ ));
368
+ SelectItem.displayName = "SelectItem";
369
+ var SelectGroup = SelectPrimitive__namespace.Group;
370
+ var SelectLabel = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
371
+ SelectPrimitive__namespace.Label,
372
+ {
373
+ ref,
374
+ className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
375
+ ...props
376
+ }
377
+ ));
378
+ SelectLabel.displayName = "SelectLabel";
379
+ var SelectSeparator = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
380
+ SelectPrimitive__namespace.Separator,
381
+ {
382
+ ref,
383
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
384
+ ...props
385
+ }
386
+ ));
387
+ SelectSeparator.displayName = "SelectSeparator";
388
+ var Tabs = TabsPrimitive__namespace.Root;
389
+ var TabsList = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
390
+ TabsPrimitive__namespace.List,
391
+ {
392
+ ref,
393
+ className: cn(
394
+ "inline-flex h-12 items-center gap-6 border-b border-border",
395
+ className
396
+ ),
397
+ ...props
398
+ }
399
+ ));
400
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
401
+ var TabsTrigger = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
402
+ TabsPrimitive__namespace.Trigger,
403
+ {
404
+ ref,
405
+ className: cn(
406
+ "inline-flex items-center justify-center whitespace-nowrap px-1 py-3 text-sm font-medium text-muted-foreground ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:-mb-px",
407
+ className
408
+ ),
409
+ ...props
410
+ }
411
+ ));
412
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
413
+ var TabsContent = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
414
+ TabsPrimitive__namespace.Content,
415
+ {
416
+ ref,
417
+ className: cn(
418
+ "mt-4 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
419
+ className
420
+ ),
421
+ ...props
422
+ }
423
+ ));
424
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
244
425
  var loaderVariants = classVarianceAuthority.cva("flex items-center justify-center backdrop-blur-sm", {
245
426
  variants: {
246
427
  variant: {
@@ -338,7 +519,7 @@ function BarsLoader() {
338
519
  i
339
520
  )) });
340
521
  }
341
- var Loader = React4__namespace.forwardRef(
522
+ var Loader = React36__namespace.forwardRef(
342
523
  ({
343
524
  variant = "default",
344
525
  message,
@@ -388,21 +569,21 @@ var Loader = React4__namespace.forwardRef(
388
569
  }
389
570
  );
390
571
  Loader.displayName = "Loader";
391
- var LoaderContext = React4__namespace.createContext(
572
+ var LoaderContext = React36__namespace.createContext(
392
573
  void 0
393
574
  );
394
575
  function LoaderProvider({ children }) {
395
- const [isLoading, setIsLoading] = React4__namespace.useState(false);
396
- const [loaderOptions, setLoaderOptions] = React4__namespace.useState({});
397
- const show = React4__namespace.useCallback((options = {}) => {
576
+ const [isLoading, setIsLoading] = React36__namespace.useState(false);
577
+ const [loaderOptions, setLoaderOptions] = React36__namespace.useState({});
578
+ const show = React36__namespace.useCallback((options = {}) => {
398
579
  setLoaderOptions(options);
399
580
  setIsLoading(true);
400
581
  }, []);
401
- const hide = React4__namespace.useCallback(() => {
582
+ const hide = React36__namespace.useCallback(() => {
402
583
  setIsLoading(false);
403
584
  setTimeout(() => setLoaderOptions({}), 300);
404
585
  }, []);
405
- const value = React4__namespace.useMemo(
586
+ const value = React36__namespace.useMemo(
406
587
  () => ({ show, hide, isLoading }),
407
588
  [show, hide, isLoading]
408
589
  );
@@ -421,7 +602,7 @@ function LoaderProvider({ children }) {
421
602
  ] });
422
603
  }
423
604
  function useLoader() {
424
- const context = React4__namespace.useContext(LoaderContext);
605
+ const context = React36__namespace.useContext(LoaderContext);
425
606
  if (context === void 0) {
426
607
  throw new Error("useLoader must be used within a LoaderProvider");
427
608
  }
@@ -453,7 +634,7 @@ var loader = {
453
634
  };
454
635
  function GlobalLoaderController() {
455
636
  const loaderController = useLoader();
456
- React4__namespace.useEffect(() => {
637
+ React36__namespace.useEffect(() => {
457
638
  setGlobalLoader(loaderController);
458
639
  return () => {
459
640
  setGlobalLoader(null);
@@ -461,15 +642,3754 @@ function GlobalLoaderController() {
461
642
  }, [loaderController]);
462
643
  return null;
463
644
  }
645
+ var emptyStateVariants = classVarianceAuthority.cva(
646
+ "flex items-center justify-center p-8 text-center w-full",
647
+ {
648
+ variants: {
649
+ layout: {
650
+ vertical: "flex-col",
651
+ horizontal: "flex-row gap-4 px-4 py-3"
652
+ }
653
+ },
654
+ defaultVariants: {
655
+ layout: "vertical"
656
+ }
657
+ }
658
+ );
659
+ var iconWrapperVariants = classVarianceAuthority.cva("rounded-full bg-primary/5", {
660
+ variants: {
661
+ size: {
662
+ default: "mb-3 p-6",
663
+ sm: "mb-4 p-3"
664
+ },
665
+ layout: {
666
+ vertical: "",
667
+ horizontal: "mb-0"
668
+ }
669
+ },
670
+ defaultVariants: {
671
+ size: "default",
672
+ layout: "vertical"
673
+ }
674
+ });
675
+ var iconVariants = classVarianceAuthority.cva("text-primary", {
676
+ variants: {
677
+ size: {
678
+ default: "h-10 w-10",
679
+ sm: "h-8 w-8"
680
+ }
681
+ },
682
+ defaultVariants: {
683
+ size: "default"
684
+ }
685
+ });
686
+ var titleVariants = classVarianceAuthority.cva("font-semibold text-foreground", {
687
+ variants: {
688
+ size: {
689
+ default: "text-lg",
690
+ sm: "text-base"
691
+ }
692
+ },
693
+ defaultVariants: {
694
+ size: "default"
695
+ }
696
+ });
697
+ var descriptionVariants = classVarianceAuthority.cva("text-muted-foreground", {
698
+ variants: {
699
+ size: {
700
+ default: "mb-6 text-sm",
701
+ sm: "mb-4 text-xs"
702
+ },
703
+ layout: {
704
+ vertical: "",
705
+ horizontal: "mb-0"
706
+ }
707
+ },
708
+ defaultVariants: {
709
+ size: "default",
710
+ layout: "vertical"
711
+ }
712
+ });
713
+ var defaultDescriptionMessage = "N\xE3o se preocupe, isso \xE9 normal quando n\xE3o h\xE1 itens para exibir.";
714
+ var containerAnimation = {
715
+ initial: { opacity: 0, y: 20 },
716
+ animate: { opacity: 1, y: 0 },
717
+ transition: { duration: 0.5 }
718
+ };
719
+ var iconAnimation = {
720
+ whileHover: { scale: 1.1 },
721
+ whileTap: { scale: 0.9 }
722
+ };
723
+ var EmptyStateContent = React36__namespace.memo(
724
+ ({
725
+ message = "Nenhum item encontrado",
726
+ description,
727
+ icon: IconComponent = lucideReact.Inbox,
728
+ actionLabel,
729
+ onAction,
730
+ hideDescription = false,
731
+ size = "default",
732
+ layout = "vertical",
733
+ className
734
+ }) => {
735
+ const handleAction = React36__namespace.useCallback(() => {
736
+ if (onAction) {
737
+ onAction();
738
+ }
739
+ }, [onAction]);
740
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(emptyStateVariants({ layout }), className), children: [
741
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconWrapperVariants({ size, layout }), children: /* @__PURE__ */ jsxRuntime.jsx(
742
+ IconComponent,
743
+ {
744
+ className: iconVariants({ size }),
745
+ "aria-hidden": "true"
746
+ }
747
+ ) }),
748
+ /* @__PURE__ */ jsxRuntime.jsxs(
749
+ "div",
750
+ {
751
+ className: cn(
752
+ layout === "horizontal" && "flex flex-col items-start text-left"
753
+ ),
754
+ children: [
755
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: titleVariants({ size }), children: message }),
756
+ !hideDescription && /* @__PURE__ */ jsxRuntime.jsx("p", { className: descriptionVariants({ size, layout }), children: description || defaultDescriptionMessage })
757
+ ]
758
+ }
759
+ ),
760
+ actionLabel && onAction && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleAction, className: "mt-2", children: actionLabel })
761
+ ] });
762
+ }
763
+ );
764
+ EmptyStateContent.displayName = "EmptyStateContent";
765
+ var AnimatedEmptyState = React36__namespace.memo((props) => {
766
+ const {
767
+ message = "Nenhum item encontrado",
768
+ description,
769
+ icon: IconComponent = lucideReact.Inbox,
770
+ actionLabel,
771
+ onAction,
772
+ hideDescription = false,
773
+ size = "default",
774
+ layout = "vertical",
775
+ className
776
+ } = props;
777
+ const handleAction = React36__namespace.useCallback(() => {
778
+ if (onAction) {
779
+ onAction();
780
+ }
781
+ }, [onAction]);
782
+ return /* @__PURE__ */ jsxRuntime.jsxs(
783
+ framerMotion.motion.div,
784
+ {
785
+ ...containerAnimation,
786
+ className: cn(emptyStateVariants({ layout }), className),
787
+ children: [
788
+ /* @__PURE__ */ jsxRuntime.jsx(
789
+ framerMotion.motion.div,
790
+ {
791
+ ...iconAnimation,
792
+ className: iconWrapperVariants({ size, layout }),
793
+ children: /* @__PURE__ */ jsxRuntime.jsx(
794
+ IconComponent,
795
+ {
796
+ className: iconVariants({ size }),
797
+ "aria-hidden": "true"
798
+ }
799
+ )
800
+ }
801
+ ),
802
+ /* @__PURE__ */ jsxRuntime.jsxs(
803
+ "div",
804
+ {
805
+ className: cn(
806
+ layout === "horizontal" && "flex flex-col items-start text-left"
807
+ ),
808
+ children: [
809
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: titleVariants({ size }), children: message }),
810
+ !hideDescription && /* @__PURE__ */ jsxRuntime.jsx("p", { className: descriptionVariants({ size, layout }), children: description || defaultDescriptionMessage })
811
+ ]
812
+ }
813
+ ),
814
+ actionLabel && onAction && /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleAction, className: "mt-2", children: actionLabel })
815
+ ]
816
+ }
817
+ );
818
+ });
819
+ AnimatedEmptyState.displayName = "AnimatedEmptyState";
820
+ var EmptyState = React36__namespace.memo(
821
+ ({ animated = true, ...props }) => {
822
+ if (!animated) {
823
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptyStateContent, { ...props });
824
+ }
825
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedEmptyState, { ...props });
826
+ }
827
+ );
828
+ EmptyState.displayName = "EmptyState";
829
+ function useDataTableInternal({
830
+ data,
831
+ columns,
832
+ getRowId
833
+ }) {
834
+ const [rowSelection, setRowSelection] = React36__namespace.useState({});
835
+ const [columnVisibility, setColumnVisibility] = React36__namespace.useState({});
836
+ const [columnFilters, setColumnFilters] = React36__namespace.useState([]);
837
+ const [sorting, setSorting] = React36__namespace.useState([]);
838
+ const [globalFilter, setGlobalFilter] = React36__namespace.useState("");
839
+ const [density, setDensity] = React36__namespace.useState("default");
840
+ const [pagination, setPagination] = React36__namespace.useState({
841
+ pageIndex: 0,
842
+ pageSize: 10
843
+ });
844
+ const table = reactTable.useReactTable({
845
+ data,
846
+ columns,
847
+ getRowId,
848
+ state: {
849
+ sorting,
850
+ columnVisibility,
851
+ rowSelection,
852
+ columnFilters,
853
+ pagination,
854
+ globalFilter
855
+ },
856
+ // Features
857
+ enableRowSelection: true,
858
+ enableSorting: true,
859
+ enableFilters: true,
860
+ enableGlobalFilter: true,
861
+ // Handlers
862
+ onRowSelectionChange: setRowSelection,
863
+ onSortingChange: setSorting,
864
+ onColumnFiltersChange: setColumnFilters,
865
+ onColumnVisibilityChange: setColumnVisibility,
866
+ onPaginationChange: setPagination,
867
+ onGlobalFilterChange: setGlobalFilter,
868
+ // Row Models
869
+ getCoreRowModel: reactTable.getCoreRowModel(),
870
+ getFilteredRowModel: reactTable.getFilteredRowModel(),
871
+ getPaginationRowModel: reactTable.getPaginationRowModel(),
872
+ getSortedRowModel: reactTable.getSortedRowModel()
873
+ });
874
+ const meta = React36__namespace.useMemo(
875
+ () => ({
876
+ isLoading: false,
877
+ // Loading é controlado externamente via DataTable.Loading
878
+ isEmpty: data.length === 0,
879
+ selectedRowCount: Object.keys(rowSelection).length,
880
+ totalRows: data.length,
881
+ density
882
+ }),
883
+ [data.length, rowSelection, density]
884
+ );
885
+ return {
886
+ table,
887
+ meta,
888
+ density,
889
+ setDensity
890
+ };
891
+ }
892
+ var DataTableInstanceContext = React36__namespace.createContext(null);
893
+ DataTableInstanceContext.displayName = "DataTableInstanceContext";
894
+ var DataTableMetaContext = React36__namespace.createContext(null);
895
+ DataTableMetaContext.displayName = "DataTableMetaContext";
896
+ var DataTableDensityContext = React36__namespace.createContext(null);
897
+ DataTableDensityContext.displayName = "DataTableDensityContext";
898
+ function DataTableProvider({
899
+ children,
900
+ table,
901
+ meta,
902
+ density,
903
+ setDensity
904
+ }) {
905
+ const metaValue = React36__namespace.useMemo(
906
+ () => meta,
907
+ [meta.isLoading, meta.isEmpty, meta.selectedRowCount, meta.totalRows, meta.density]
908
+ );
909
+ const densityValue = React36__namespace.useMemo(
910
+ () => ({ density, setDensity }),
911
+ [density, setDensity]
912
+ );
913
+ const tableValue = table;
914
+ return /* @__PURE__ */ jsxRuntime.jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableDensityContext.Provider, { value: densityValue, children }) }) });
915
+ }
916
+ function useDataTable() {
917
+ const context = React36__namespace.useContext(DataTableInstanceContext);
918
+ if (!context) {
919
+ throw new Error(
920
+ "useDataTable must be used within <DataTable>. Make sure your component is wrapped with DataTable."
921
+ );
922
+ }
923
+ return context;
924
+ }
925
+ function useDataTableMeta() {
926
+ const context = React36__namespace.useContext(DataTableMetaContext);
927
+ if (!context) {
928
+ throw new Error(
929
+ "useDataTableMeta must be used within <DataTable>. Make sure your component is wrapped with DataTable."
930
+ );
931
+ }
932
+ return context;
933
+ }
934
+ function useDataTableLoading() {
935
+ const meta = useDataTableMeta();
936
+ return meta.isLoading;
937
+ }
938
+ function useDataTableEmpty() {
939
+ const meta = useDataTableMeta();
940
+ return meta.isEmpty;
941
+ }
942
+ function useDataTableSelection() {
943
+ const table = useDataTable();
944
+ return React36__namespace.useMemo(() => {
945
+ return table.getSelectedRowModel().rows.map((row) => row.original);
946
+ }, [table.getSelectedRowModel().rows]);
947
+ }
948
+ function useDataTableDensity() {
949
+ const context = React36__namespace.useContext(DataTableDensityContext);
950
+ if (!context) {
951
+ throw new Error(
952
+ "useDataTableDensity must be used within <DataTable>. Make sure your component is wrapped with DataTable."
953
+ );
954
+ }
955
+ return context;
956
+ }
957
+ function useDataTablePagination() {
958
+ const table = useDataTable();
959
+ const { pageIndex, pageSize } = table.getState().pagination;
960
+ return React36__namespace.useMemo(() => {
961
+ const pageCount = table.getPageCount();
962
+ return {
963
+ pageIndex,
964
+ pageSize,
965
+ pageCount,
966
+ canPreviousPage: pageIndex > 0,
967
+ canNextPage: pageIndex < pageCount - 1,
968
+ setPageIndex: (index) => table.setPageIndex(index),
969
+ setPageSize: (size) => table.setPageSize(size),
970
+ previousPage: () => table.previousPage(),
971
+ nextPage: () => table.nextPage(),
972
+ firstPage: () => table.setPageIndex(0),
973
+ lastPage: () => table.setPageIndex(pageCount - 1)
974
+ };
975
+ }, [table, pageIndex, pageSize]);
976
+ }
977
+ function useDataTableSorting() {
978
+ const table = useDataTable();
979
+ const sorting = table.getState().sorting;
980
+ return React36__namespace.useMemo(() => ({
981
+ sorting,
982
+ setSorting: table.setSorting,
983
+ clearSorting: () => table.resetSorting(),
984
+ toggleSort: (columnId) => {
985
+ const column = table.getColumn(columnId);
986
+ column?.toggleSorting();
987
+ }
988
+ }), [table, sorting]);
989
+ }
990
+ function useDataTableColumnVisibility() {
991
+ const table = useDataTable();
992
+ const columnVisibility = table.getState().columnVisibility;
993
+ return React36__namespace.useMemo(() => ({
994
+ columnVisibility,
995
+ setColumnVisibility: table.setColumnVisibility,
996
+ toggleColumn: (columnId) => {
997
+ const column = table.getColumn(columnId);
998
+ column?.toggleVisibility();
999
+ },
1000
+ getAllColumns: () => table.getAllColumns().filter((col) => col.getCanHide())
1001
+ }), [table, columnVisibility]);
1002
+ }
1003
+ var useDataTableInstance = useDataTable;
1004
+ var useDataTableState = useDataTableMeta;
1005
+ function DataTableRoot({
1006
+ children,
1007
+ data,
1008
+ columns,
1009
+ getRowId,
1010
+ className
1011
+ }) {
1012
+ const { table, meta, density, setDensity } = useDataTableInternal({
1013
+ data,
1014
+ columns,
1015
+ getRowId
1016
+ });
1017
+ return /* @__PURE__ */ jsxRuntime.jsx(
1018
+ DataTableProvider,
1019
+ {
1020
+ table,
1021
+ meta,
1022
+ density,
1023
+ setDensity,
1024
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1025
+ "div",
1026
+ {
1027
+ className: cn("w-full space-y-4", className),
1028
+ "data-density": density,
1029
+ children
1030
+ }
1031
+ )
1032
+ }
1033
+ );
1034
+ }
1035
+ DataTableRoot.displayName = "DataTable";
464
1036
 
1037
+ // src/components/Table/types.ts
1038
+ var DENSITY_CONFIG = {
1039
+ compact: {
1040
+ rowHeight: 32,
1041
+ fontSize: "text-xs",
1042
+ padding: "py-1 px-2"
1043
+ },
1044
+ default: {
1045
+ rowHeight: 40,
1046
+ fontSize: "text-sm",
1047
+ padding: "py-2 px-4"
1048
+ },
1049
+ comfortable: {
1050
+ rowHeight: 52,
1051
+ fontSize: "text-sm",
1052
+ padding: "py-3 px-4"
1053
+ }
1054
+ };
1055
+ var Table = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
1056
+ "table",
1057
+ {
1058
+ ref,
1059
+ className: cn("w-full caption-bottom text-sm", className),
1060
+ ...props
1061
+ }
1062
+ ) }));
1063
+ Table.displayName = "Table";
1064
+ var TableHeader = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
1065
+ TableHeader.displayName = "TableHeader";
1066
+ var TableBody = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1067
+ "tbody",
1068
+ {
1069
+ ref,
1070
+ className: cn("[&_tr:last-child]:border-0", className),
1071
+ ...props
1072
+ }
1073
+ ));
1074
+ TableBody.displayName = "TableBody";
1075
+ var TableFooter = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1076
+ "tfoot",
1077
+ {
1078
+ ref,
1079
+ className: cn(
1080
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
1081
+ className
1082
+ ),
1083
+ ...props
1084
+ }
1085
+ ));
1086
+ TableFooter.displayName = "TableFooter";
1087
+ var TableRow = React36__namespace.memo(
1088
+ React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1089
+ "tr",
1090
+ {
1091
+ ref,
1092
+ className: cn(
1093
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
1094
+ className
1095
+ ),
1096
+ ...props
1097
+ }
1098
+ ))
1099
+ );
1100
+ TableRow.displayName = "TableRow";
1101
+ var TableHead = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1102
+ "th",
1103
+ {
1104
+ ref,
1105
+ className: cn(
1106
+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
1107
+ className
1108
+ ),
1109
+ ...props
1110
+ }
1111
+ ));
1112
+ TableHead.displayName = "TableHead";
1113
+ var TableCell = React36__namespace.memo(
1114
+ React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1115
+ "td",
1116
+ {
1117
+ ref,
1118
+ className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className),
1119
+ ...props
1120
+ }
1121
+ ))
1122
+ );
1123
+ TableCell.displayName = "TableCell";
1124
+ var TableCaption = React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1125
+ "caption",
1126
+ {
1127
+ ref,
1128
+ className: cn("mt-4 text-sm text-muted-foreground", className),
1129
+ ...props
1130
+ }
1131
+ ));
1132
+ TableCaption.displayName = "TableCaption";
1133
+ var DataTableContent = React36__namespace.memo(function DataTableContent2({
1134
+ stickyHeader = false,
1135
+ stripedRows = false,
1136
+ highlightOnHover = true,
1137
+ className
1138
+ }) {
1139
+ const table = useDataTable();
1140
+ const { isEmpty } = useDataTableMeta();
1141
+ const { density } = useDataTableDensity();
1142
+ const densityStyles = DENSITY_CONFIG[density];
1143
+ const cellClasses = cn(densityStyles.padding, densityStyles.fontSize);
1144
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("rounded-md border overflow-auto", className), children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
1145
+ /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { className: cn(stickyHeader && "sticky top-0 z-10 bg-background"), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(
1146
+ TableHead,
1147
+ {
1148
+ className: cn(cellClasses, "font-medium"),
1149
+ style: { width: header.getSize() !== 150 ? header.getSize() : void 0 },
1150
+ children: header.isPlaceholder ? null : reactTable.flexRender(
1151
+ header.column.columnDef.header,
1152
+ header.getContext()
1153
+ )
1154
+ },
1155
+ header.id
1156
+ )) }, headerGroup.id)) }),
1157
+ /* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row, index) => /* @__PURE__ */ jsxRuntime.jsx(
1158
+ TableRow,
1159
+ {
1160
+ "data-state": row.getIsSelected() && "selected",
1161
+ className: cn(
1162
+ highlightOnHover && "hover:bg-muted/50",
1163
+ stripedRows && index % 2 === 1 && "bg-muted/30"
1164
+ ),
1165
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: cellClasses, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
1166
+ },
1167
+ row.id
1168
+ )) : /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(
1169
+ TableCell,
1170
+ {
1171
+ colSpan: table.getAllColumns().length,
1172
+ className: "h-24 text-center text-muted-foreground",
1173
+ children: isEmpty ? "Nenhum resultado encontrado." : "Carregando..."
1174
+ }
1175
+ ) }) })
1176
+ ] }) });
1177
+ });
1178
+ DataTableContent.displayName = "DataTable.Content";
1179
+ var DataTableToolbar = React36__namespace.memo(function DataTableToolbar2({
1180
+ className,
1181
+ children
1182
+ }) {
1183
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center justify-between gap-2", className), children });
1184
+ });
1185
+ function useDebounce(value, delay = 300) {
1186
+ const [debouncedValue, setDebouncedValue] = React36__namespace.useState(value);
1187
+ React36__namespace.useEffect(() => {
1188
+ const handler = setTimeout(() => {
1189
+ setDebouncedValue(value);
1190
+ }, delay);
1191
+ return () => {
1192
+ clearTimeout(handler);
1193
+ };
1194
+ }, [value, delay]);
1195
+ return debouncedValue;
1196
+ }
1197
+ function useDebouncedCallback(callback, delay = 300) {
1198
+ const callbackRef = React36__namespace.useRef(callback);
1199
+ const timeoutRef = React36__namespace.useRef();
1200
+ React36__namespace.useEffect(() => {
1201
+ callbackRef.current = callback;
1202
+ }, [callback]);
1203
+ return React36__namespace.useCallback(
1204
+ (...args) => {
1205
+ if (timeoutRef.current) {
1206
+ clearTimeout(timeoutRef.current);
1207
+ }
1208
+ timeoutRef.current = setTimeout(() => {
1209
+ callbackRef.current(...args);
1210
+ }, delay);
1211
+ },
1212
+ [delay]
1213
+ );
1214
+ }
1215
+ var DataTableSearch = React36__namespace.memo(function DataTableSearch2({
1216
+ column,
1217
+ placeholder = "Buscar...",
1218
+ debounce = 300,
1219
+ onSearch,
1220
+ className
1221
+ }) {
1222
+ const table = useDataTableInstance();
1223
+ const columnInstance = table.getColumn(column);
1224
+ const [value, setValue] = React36__namespace.useState(
1225
+ columnInstance?.getFilterValue() ?? ""
1226
+ );
1227
+ const debouncedValue = useDebounce(value, debounce);
1228
+ React36__namespace.useEffect(() => {
1229
+ columnInstance?.setFilterValue(debouncedValue);
1230
+ if (onSearch) {
1231
+ onSearch(debouncedValue);
1232
+ }
1233
+ }, [debouncedValue, columnInstance, onSearch]);
1234
+ React36__namespace.useEffect(() => {
1235
+ const filterValue = columnInstance?.getFilterValue() ?? "";
1236
+ if (filterValue !== value) {
1237
+ setValue(filterValue);
1238
+ }
1239
+ }, [columnInstance?.getFilterValue()]);
1240
+ return /* @__PURE__ */ jsxRuntime.jsx(
1241
+ Input,
1242
+ {
1243
+ placeholder,
1244
+ value,
1245
+ onChange: (e) => setValue(e.target.value),
1246
+ className: cn("h-9 w-[150px] lg:w-[250px]", className)
1247
+ }
1248
+ );
1249
+ });
1250
+ var DataTableFilters = React36__namespace.memo(function DataTableFilters2({
1251
+ onChange,
1252
+ className,
1253
+ children
1254
+ }) {
1255
+ const table = useDataTableInstance();
1256
+ const filters = table.getState().columnFilters;
1257
+ const filtersRef = React36__namespace.useRef(filters);
1258
+ React36__namespace.useEffect(() => {
1259
+ if (onChange && JSON.stringify(filters) !== JSON.stringify(filtersRef.current)) {
1260
+ filtersRef.current = filters;
1261
+ onChange(filters);
1262
+ }
1263
+ }, [filters, onChange]);
1264
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex gap-2", className), children });
1265
+ });
1266
+ var DataTableFilter = React36__namespace.memo(function DataTableFilter2({
1267
+ column: columnId,
1268
+ title,
1269
+ options,
1270
+ className
1271
+ }) {
1272
+ const table = useDataTableInstance();
1273
+ const column = table.getColumn(columnId);
1274
+ const filterValue = column?.getFilterValue() ?? [];
1275
+ const currentValue = filterValue.length > 0 ? filterValue[0] : "all";
1276
+ const handleValueChange = React36__namespace.useCallback(
1277
+ (value) => {
1278
+ if (value === "all") {
1279
+ column?.setFilterValue(void 0);
1280
+ } else {
1281
+ column?.setFilterValue([value]);
1282
+ }
1283
+ },
1284
+ [column]
1285
+ );
1286
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1287
+ Select,
1288
+ {
1289
+ value: currentValue,
1290
+ onValueChange: handleValueChange,
1291
+ selectSize: "sm",
1292
+ placeholder: title,
1293
+ className,
1294
+ children: [
1295
+ /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "all", children: "Todos" }),
1296
+ options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value))
1297
+ ]
1298
+ }
1299
+ );
1300
+ });
1301
+ var DataTablePagination = React36__namespace.memo(function DataTablePagination2({
1302
+ mode = "client",
1303
+ pageCount: externalPageCount,
1304
+ pageSizes = [10, 20, 30, 50],
1305
+ showPageSize = true,
1306
+ showPageInfo = true,
1307
+ showFirstLast = true,
1308
+ className
1309
+ }) {
1310
+ useDataTable();
1311
+ const { selectedRowCount, totalRows } = useDataTableMeta();
1312
+ const {
1313
+ pageIndex,
1314
+ pageSize,
1315
+ pageCount: internalPageCount,
1316
+ canPreviousPage,
1317
+ canNextPage,
1318
+ setPageIndex,
1319
+ setPageSize,
1320
+ previousPage,
1321
+ nextPage,
1322
+ firstPage,
1323
+ lastPage
1324
+ } = useDataTablePagination();
1325
+ const pageCount = mode === "server" && externalPageCount !== void 0 ? externalPageCount : internalPageCount;
1326
+ const canGoPrevious = pageIndex > 0;
1327
+ const canGoNext = pageIndex < pageCount - 1;
1328
+ const handlePageSizeChange = React36__namespace.useCallback(
1329
+ (value) => {
1330
+ setPageSize(Number(value));
1331
+ },
1332
+ [setPageSize]
1333
+ );
1334
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1335
+ "div",
1336
+ {
1337
+ className: cn(
1338
+ "flex flex-col-reverse items-center justify-between gap-4 sm:flex-row",
1339
+ className
1340
+ ),
1341
+ children: [
1342
+ showPageInfo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 text-sm text-muted-foreground", children: selectedRowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1343
+ selectedRowCount,
1344
+ " de ",
1345
+ totalRows,
1346
+ " linha(s) selecionada(s)"
1347
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1348
+ "P\xE1gina ",
1349
+ pageIndex + 1,
1350
+ " de ",
1351
+ pageCount
1352
+ ] }) }),
1353
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-6", children: [
1354
+ showPageSize && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1355
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium whitespace-nowrap", children: "Linhas por p\xE1gina" }),
1356
+ /* @__PURE__ */ jsxRuntime.jsx(
1357
+ Select,
1358
+ {
1359
+ value: `${pageSize}`,
1360
+ onValueChange: handlePageSizeChange,
1361
+ selectSize: "sm",
1362
+ children: pageSizes.map((size) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: `${size}`, children: size }, size))
1363
+ }
1364
+ )
1365
+ ] }),
1366
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1367
+ showFirstLast && /* @__PURE__ */ jsxRuntime.jsx(
1368
+ Button,
1369
+ {
1370
+ variant: "outline",
1371
+ size: "icon-sm",
1372
+ className: "hidden h-8 w-8 p-0 lg:flex",
1373
+ onClick: firstPage,
1374
+ disabled: !canGoPrevious,
1375
+ "aria-label": "Primeira p\xE1gina",
1376
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, { className: "h-4 w-4" })
1377
+ }
1378
+ ),
1379
+ /* @__PURE__ */ jsxRuntime.jsx(
1380
+ Button,
1381
+ {
1382
+ variant: "outline",
1383
+ size: "icon-sm",
1384
+ className: "h-8 w-8 p-0",
1385
+ onClick: previousPage,
1386
+ disabled: !canGoPrevious,
1387
+ "aria-label": "P\xE1gina anterior",
1388
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" })
1389
+ }
1390
+ ),
1391
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex h-8 min-w-[4rem] items-center justify-center text-sm font-medium", children: [
1392
+ pageIndex + 1,
1393
+ " / ",
1394
+ pageCount
1395
+ ] }),
1396
+ /* @__PURE__ */ jsxRuntime.jsx(
1397
+ Button,
1398
+ {
1399
+ variant: "outline",
1400
+ size: "icon-sm",
1401
+ className: "h-8 w-8 p-0",
1402
+ onClick: nextPage,
1403
+ disabled: !canGoNext,
1404
+ "aria-label": "Pr\xF3xima p\xE1gina",
1405
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
1406
+ }
1407
+ ),
1408
+ showFirstLast && /* @__PURE__ */ jsxRuntime.jsx(
1409
+ Button,
1410
+ {
1411
+ variant: "outline",
1412
+ size: "icon-sm",
1413
+ className: "hidden h-8 w-8 p-0 lg:flex",
1414
+ onClick: lastPage,
1415
+ disabled: !canGoNext,
1416
+ "aria-label": "\xDAltima p\xE1gina",
1417
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, { className: "h-4 w-4" })
1418
+ }
1419
+ )
1420
+ ] })
1421
+ ] })
1422
+ ]
1423
+ }
1424
+ );
1425
+ });
1426
+ DataTablePagination.displayName = "DataTable.Pagination";
1427
+ var DataTableEmptyState = React36__namespace.memo(function DataTableEmptyState2({
1428
+ message = "Nenhum resultado encontrado.",
1429
+ description,
1430
+ icon,
1431
+ action,
1432
+ className
1433
+ }) {
1434
+ const defaultIcon = /* @__PURE__ */ jsxRuntime.jsx(
1435
+ "svg",
1436
+ {
1437
+ className: "h-10 w-10 text-muted-foreground",
1438
+ fill: "none",
1439
+ viewBox: "0 0 24 24",
1440
+ stroke: "currentColor",
1441
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1442
+ "path",
1443
+ {
1444
+ strokeLinecap: "round",
1445
+ strokeLinejoin: "round",
1446
+ strokeWidth: 1.5,
1447
+ d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
1448
+ }
1449
+ )
1450
+ }
1451
+ );
1452
+ return /* @__PURE__ */ jsxRuntime.jsx(
1453
+ "div",
1454
+ {
1455
+ className: cn(
1456
+ "flex min-h-[400px] flex-col items-center justify-center rounded-md border border-dashed p-8 text-center",
1457
+ className
1458
+ ),
1459
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex max-w-[420px] flex-col items-center justify-center text-center", children: [
1460
+ icon ?? defaultIcon,
1461
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mt-4 text-lg font-semibold", children: message }),
1462
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-4 mt-2 text-sm text-muted-foreground", children: description }),
1463
+ action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: action })
1464
+ ] })
1465
+ }
1466
+ );
1467
+ });
1468
+ function SkeletonRow({ columns }) {
1469
+ return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { className: "animate-pulse", children: Array.from({ length: columns }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 bg-muted rounded w-3/4" }) }, index)) });
1470
+ }
1471
+ function DataTableLoading({
1472
+ visible,
1473
+ skeleton,
1474
+ skeletonRows = 5,
1475
+ className
1476
+ }) {
1477
+ const table = useDataTable();
1478
+ const columnCount = table.getVisibleLeafColumns().length;
1479
+ if (!visible) {
1480
+ return null;
1481
+ }
1482
+ if (skeleton) {
1483
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), children: skeleton });
1484
+ }
1485
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: Array.from({ length: skeletonRows }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(SkeletonRow, { columns: columnCount || 4 }, index)) }) }) }) });
1486
+ }
1487
+ DataTableLoading.displayName = "DataTable.Loading";
1488
+ function DataTableColumnHeader({
1489
+ column,
1490
+ title,
1491
+ className
1492
+ }) {
1493
+ if (!column.getCanSort()) {
1494
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className), children: title });
1495
+ }
1496
+ const handleSort = () => {
1497
+ const currentSort = column.getIsSorted();
1498
+ if (currentSort === "asc") {
1499
+ column.toggleSorting(true);
1500
+ } else if (currentSort === "desc") {
1501
+ column.clearSorting();
1502
+ } else {
1503
+ column.toggleSorting(false);
1504
+ }
1505
+ };
1506
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center space-x-2", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
1507
+ Button,
1508
+ {
1509
+ variant: "ghost",
1510
+ size: "sm",
1511
+ className: "-ml-3 h-8 data-[state=open]:bg-accent",
1512
+ onClick: handleSort,
1513
+ children: [
1514
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
1515
+ column.getIsSorted() === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "ml-2 h-4 w-4" }) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "ml-2 h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4" })
1516
+ ]
1517
+ }
1518
+ ) });
1519
+ }
1520
+ var checkboxVariants = classVarianceAuthority.cva(
1521
+ [
1522
+ "peer shrink-0 rounded-sm border-2 ring-offset-background",
1523
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1524
+ "disabled:cursor-not-allowed disabled:opacity-50",
1525
+ "transition-all duration-200"
1526
+ ],
1527
+ {
1528
+ variants: {
1529
+ variant: {
1530
+ default: "border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
1531
+ secondary: "border-secondary data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-foreground",
1532
+ outline: "border-border data-[state=checked]:bg-background data-[state=checked]:text-primary data-[state=checked]:border-primary"
1533
+ },
1534
+ size: {
1535
+ sm: "h-4 w-4",
1536
+ md: "h-5 w-5",
1537
+ lg: "h-6 w-6"
1538
+ }
1539
+ },
1540
+ defaultVariants: {
1541
+ variant: "default",
1542
+ size: "md"
1543
+ }
1544
+ }
1545
+ );
1546
+ var iconSizeMap = {
1547
+ sm: "h-3 w-3",
1548
+ md: "h-4 w-4",
1549
+ lg: "h-5 w-5"
1550
+ };
1551
+ var Checkbox = React36__namespace.memo(
1552
+ React36__namespace.forwardRef(({ className, variant, size = "md", ...props }, ref) => {
1553
+ const iconSize = iconSizeMap[size || "md"];
1554
+ return /* @__PURE__ */ jsxRuntime.jsx(
1555
+ CheckboxPrimitive__namespace.Root,
1556
+ {
1557
+ ref,
1558
+ className: cn(checkboxVariants({ variant, size, className })),
1559
+ ...props,
1560
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1561
+ CheckboxPrimitive__namespace.Indicator,
1562
+ {
1563
+ className: cn("flex items-center justify-center text-current"),
1564
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: iconSize })
1565
+ }
1566
+ )
1567
+ }
1568
+ );
1569
+ })
1570
+ );
1571
+ Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
1572
+ function DataTableColumnVisibility({
1573
+ className
1574
+ }) {
1575
+ const table = useDataTable();
1576
+ const [open, setOpen] = React36__namespace.useState(false);
1577
+ const dropdownRef = React36__namespace.useRef(null);
1578
+ React36__namespace.useEffect(() => {
1579
+ function handleClickOutside(event) {
1580
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1581
+ setOpen(false);
1582
+ }
1583
+ }
1584
+ if (open) {
1585
+ document.addEventListener("mousedown", handleClickOutside);
1586
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1587
+ }
1588
+ }, [open]);
1589
+ const columns = table.getAllColumns().filter((column) => column.getCanHide());
1590
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", className), ref: dropdownRef, children: [
1591
+ /* @__PURE__ */ jsxRuntime.jsxs(
1592
+ Button,
1593
+ {
1594
+ variant: "outline",
1595
+ size: "sm",
1596
+ className: "h-8",
1597
+ onClick: () => setOpen(!open),
1598
+ "aria-expanded": open,
1599
+ "aria-haspopup": "true",
1600
+ children: [
1601
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SlidersHorizontal, { className: "mr-2 h-4 w-4" }),
1602
+ "Colunas"
1603
+ ]
1604
+ }
1605
+ ),
1606
+ open && /* @__PURE__ */ jsxRuntime.jsxs(
1607
+ "div",
1608
+ {
1609
+ className: cn(
1610
+ "absolute right-0 top-full z-50 mt-1 w-48",
1611
+ "rounded-md border bg-popover p-2 shadow-md",
1612
+ "animate-in fade-in-0 zoom-in-95"
1613
+ ),
1614
+ children: [
1615
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-sm font-semibold", children: "Alternar colunas" }),
1616
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-px bg-border my-1" }),
1617
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-60 overflow-auto", children: columns.map((column) => {
1618
+ const header = column.columnDef.header;
1619
+ const title = typeof header === "string" ? header : column.id;
1620
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1621
+ "label",
1622
+ {
1623
+ className: cn(
1624
+ "flex items-center gap-2 px-2 py-1.5 rounded-sm cursor-pointer",
1625
+ "hover:bg-accent hover:text-accent-foreground",
1626
+ "text-sm"
1627
+ ),
1628
+ children: [
1629
+ /* @__PURE__ */ jsxRuntime.jsx(
1630
+ Checkbox,
1631
+ {
1632
+ checked: column.getIsVisible(),
1633
+ onCheckedChange: (value) => column.toggleVisibility(!!value)
1634
+ }
1635
+ ),
1636
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "capitalize", children: title })
1637
+ ]
1638
+ },
1639
+ column.id
1640
+ );
1641
+ }) })
1642
+ ]
1643
+ }
1644
+ )
1645
+ ] });
1646
+ }
1647
+ DataTableColumnVisibility.displayName = "DataTable.ColumnVisibility";
1648
+ var densityOptions = [
1649
+ { value: "compact", label: "Compacto", icon: lucideReact.Rows4 },
1650
+ { value: "default", label: "Padr\xE3o", icon: lucideReact.Rows3 },
1651
+ { value: "comfortable", label: "Confort\xE1vel", icon: lucideReact.LayoutList }
1652
+ ];
1653
+ function DataTableDensityToggle({
1654
+ className
1655
+ }) {
1656
+ const { density, setDensity } = useDataTableDensity();
1657
+ const [open, setOpen] = React36__namespace.useState(false);
1658
+ const dropdownRef = React36__namespace.useRef(null);
1659
+ React36__namespace.useEffect(() => {
1660
+ function handleClickOutside(event) {
1661
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1662
+ setOpen(false);
1663
+ }
1664
+ }
1665
+ if (open) {
1666
+ document.addEventListener("mousedown", handleClickOutside);
1667
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1668
+ }
1669
+ }, [open]);
1670
+ const currentOption = densityOptions.find((opt) => opt.value === density) ?? densityOptions[1];
1671
+ const Icon2 = currentOption.icon;
1672
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", className), ref: dropdownRef, children: [
1673
+ /* @__PURE__ */ jsxRuntime.jsxs(
1674
+ Button,
1675
+ {
1676
+ variant: "outline",
1677
+ size: "sm",
1678
+ className: "h-8",
1679
+ onClick: () => setOpen(!open),
1680
+ "aria-expanded": open,
1681
+ "aria-haspopup": "true",
1682
+ children: [
1683
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "mr-2 h-4 w-4" }),
1684
+ "Densidade"
1685
+ ]
1686
+ }
1687
+ ),
1688
+ open && /* @__PURE__ */ jsxRuntime.jsx(
1689
+ "div",
1690
+ {
1691
+ className: cn(
1692
+ "absolute right-0 top-full z-50 mt-1 w-40",
1693
+ "rounded-md border bg-popover p-1 shadow-md",
1694
+ "animate-in fade-in-0 zoom-in-95"
1695
+ ),
1696
+ children: densityOptions.map((option) => {
1697
+ const OptionIcon = option.icon;
1698
+ const isSelected = density === option.value;
1699
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1700
+ "button",
1701
+ {
1702
+ className: cn(
1703
+ "flex w-full items-center gap-2 px-2 py-1.5 rounded-sm cursor-pointer",
1704
+ "hover:bg-accent hover:text-accent-foreground",
1705
+ "text-sm text-left",
1706
+ isSelected && "bg-accent"
1707
+ ),
1708
+ onClick: () => {
1709
+ setDensity(option.value);
1710
+ setOpen(false);
1711
+ },
1712
+ children: [
1713
+ /* @__PURE__ */ jsxRuntime.jsx(OptionIcon, { className: "h-4 w-4" }),
1714
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
1715
+ isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: "\u2713" })
1716
+ ]
1717
+ },
1718
+ option.value
1719
+ );
1720
+ })
1721
+ }
1722
+ )
1723
+ ] });
1724
+ }
1725
+ DataTableDensityToggle.displayName = "DataTable.DensityToggle";
1726
+ function DataTableBulkActions({
1727
+ children,
1728
+ className
1729
+ }) {
1730
+ const table = useDataTable();
1731
+ const { selectedRowCount } = useDataTableMeta();
1732
+ const selectedRows = useDataTableSelection();
1733
+ if (selectedRowCount === 0) {
1734
+ return null;
1735
+ }
1736
+ const handleClearSelection = () => {
1737
+ table.toggleAllRowsSelected(false);
1738
+ };
1739
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1740
+ "div",
1741
+ {
1742
+ className: cn(
1743
+ "flex items-center gap-3 rounded-lg border bg-muted/50 p-3",
1744
+ "animate-in fade-in-0 slide-in-from-top-2",
1745
+ className
1746
+ ),
1747
+ children: [
1748
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1749
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-medium", children: [
1750
+ selectedRowCount,
1751
+ " ",
1752
+ selectedRowCount === 1 ? "item selecionado" : "itens selecionados"
1753
+ ] }),
1754
+ /* @__PURE__ */ jsxRuntime.jsxs(
1755
+ Button,
1756
+ {
1757
+ variant: "ghost",
1758
+ size: "sm",
1759
+ className: "h-7 px-2",
1760
+ onClick: handleClearSelection,
1761
+ children: [
1762
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4 mr-1" }),
1763
+ "Limpar"
1764
+ ]
1765
+ }
1766
+ )
1767
+ ] }),
1768
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-5 w-px bg-border" }),
1769
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: children(selectedRows) })
1770
+ ]
1771
+ }
1772
+ );
1773
+ }
1774
+ DataTableBulkActions.displayName = "DataTable.BulkActions";
1775
+ var formatConfig = {
1776
+ csv: {
1777
+ label: "CSV",
1778
+ icon: lucideReact.FileText,
1779
+ mimeType: "text/csv",
1780
+ extension: "csv"
1781
+ },
1782
+ xlsx: {
1783
+ label: "Excel",
1784
+ icon: lucideReact.FileSpreadsheet,
1785
+ mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1786
+ extension: "xlsx"
1787
+ },
1788
+ pdf: {
1789
+ label: "PDF",
1790
+ icon: lucideReact.FileText,
1791
+ mimeType: "application/pdf",
1792
+ extension: "pdf"
1793
+ }
1794
+ };
1795
+ function escapeCSV(value) {
1796
+ if (value === null || value === void 0) return "";
1797
+ const str = String(value);
1798
+ if (str.includes(",") || str.includes('"') || str.includes("\n")) {
1799
+ return `"${str.replace(/"/g, '""')}"`;
1800
+ }
1801
+ return str;
1802
+ }
1803
+ function getNestedValue(obj, path) {
1804
+ return path.split(".").reduce((current, key) => {
1805
+ if (current && typeof current === "object" && key in current) {
1806
+ return current[key];
1807
+ }
1808
+ return void 0;
1809
+ }, obj);
1810
+ }
1811
+ function generateCSV(headers, rows, accessors) {
1812
+ const headerLine = headers.map(escapeCSV).join(",");
1813
+ const dataLines = rows.map(
1814
+ (row) => accessors.map((accessor) => {
1815
+ const value = getNestedValue(row, accessor);
1816
+ return escapeCSV(value);
1817
+ }).join(",")
1818
+ );
1819
+ return [headerLine, ...dataLines].join("\n");
1820
+ }
1821
+ function downloadFile(content, filename, mimeType) {
1822
+ const blob = new Blob(["\uFEFF" + content], { type: `${mimeType};charset=utf-8` });
1823
+ const url = URL.createObjectURL(blob);
1824
+ const link = document.createElement("a");
1825
+ link.href = url;
1826
+ link.download = filename;
1827
+ document.body.appendChild(link);
1828
+ link.click();
1829
+ document.body.removeChild(link);
1830
+ URL.revokeObjectURL(url);
1831
+ }
1832
+ function DataTableExport({
1833
+ formats = ["csv"],
1834
+ filename = "export",
1835
+ className
1836
+ }) {
1837
+ const table = useDataTable();
1838
+ const [open, setOpen] = React36__namespace.useState(false);
1839
+ const dropdownRef = React36__namespace.useRef(null);
1840
+ React36__namespace.useEffect(() => {
1841
+ function handleClickOutside(event) {
1842
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1843
+ setOpen(false);
1844
+ }
1845
+ }
1846
+ if (open) {
1847
+ document.addEventListener("mousedown", handleClickOutside);
1848
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1849
+ }
1850
+ }, [open]);
1851
+ const handleExport = React36__namespace.useCallback((format) => {
1852
+ const visibleColumns = table.getVisibleLeafColumns();
1853
+ const rows = table.getFilteredRowModel().rows;
1854
+ const headers = [];
1855
+ const accessors = [];
1856
+ visibleColumns.forEach((column) => {
1857
+ const header = column.columnDef.header;
1858
+ const headerText = typeof header === "string" ? header : column.id;
1859
+ const columnDef = column.columnDef;
1860
+ if (column.accessorFn || columnDef.accessorKey) {
1861
+ headers.push(headerText);
1862
+ accessors.push(columnDef.accessorKey || column.id);
1863
+ }
1864
+ });
1865
+ const data = rows.map((row) => row.original);
1866
+ if (format === "csv") {
1867
+ const csv = generateCSV(headers, data, accessors);
1868
+ const config = formatConfig[format];
1869
+ downloadFile(csv, `${filename}.${config.extension}`, config.mimeType);
1870
+ } else if (format === "xlsx") {
1871
+ console.warn("XLSX export requires xlsx library. Falling back to CSV.");
1872
+ const csv = generateCSV(headers, data, accessors);
1873
+ downloadFile(csv, `${filename}.csv`, "text/csv");
1874
+ } else if (format === "pdf") {
1875
+ console.warn("PDF export not implemented yet.");
1876
+ }
1877
+ setOpen(false);
1878
+ }, [table, filename]);
1879
+ if (formats.length === 1) {
1880
+ const format = formats[0];
1881
+ const config = formatConfig[format];
1882
+ const Icon2 = config.icon;
1883
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1884
+ Button,
1885
+ {
1886
+ variant: "outline",
1887
+ size: "sm",
1888
+ className: cn("h-8", className),
1889
+ onClick: () => handleExport(format),
1890
+ children: [
1891
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "mr-2 h-4 w-4" }),
1892
+ "Exportar ",
1893
+ config.label
1894
+ ]
1895
+ }
1896
+ );
1897
+ }
1898
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", className), ref: dropdownRef, children: [
1899
+ /* @__PURE__ */ jsxRuntime.jsxs(
1900
+ Button,
1901
+ {
1902
+ variant: "outline",
1903
+ size: "sm",
1904
+ className: "h-8",
1905
+ onClick: () => setOpen(!open),
1906
+ "aria-expanded": open,
1907
+ "aria-haspopup": "true",
1908
+ children: [
1909
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "mr-2 h-4 w-4" }),
1910
+ "Exportar"
1911
+ ]
1912
+ }
1913
+ ),
1914
+ open && /* @__PURE__ */ jsxRuntime.jsx(
1915
+ "div",
1916
+ {
1917
+ className: cn(
1918
+ "absolute right-0 top-full z-50 mt-1 w-36",
1919
+ "rounded-md border bg-popover p-1 shadow-md",
1920
+ "animate-in fade-in-0 zoom-in-95"
1921
+ ),
1922
+ children: formats.map((format) => {
1923
+ const config = formatConfig[format];
1924
+ const Icon2 = config.icon;
1925
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1926
+ "button",
1927
+ {
1928
+ className: cn(
1929
+ "flex w-full items-center gap-2 px-2 py-1.5 rounded-sm cursor-pointer",
1930
+ "hover:bg-accent hover:text-accent-foreground",
1931
+ "text-sm text-left"
1932
+ ),
1933
+ onClick: () => handleExport(format),
1934
+ children: [
1935
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-4 w-4" }),
1936
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: config.label })
1937
+ ]
1938
+ },
1939
+ format
1940
+ );
1941
+ })
1942
+ }
1943
+ )
1944
+ ] });
1945
+ }
1946
+ DataTableExport.displayName = "DataTable.Export";
1947
+ function DataTableTabs({
1948
+ tabs,
1949
+ value,
1950
+ defaultValue,
1951
+ onValueChange,
1952
+ className
1953
+ }) {
1954
+ const [internalValue, setInternalValue] = React36__namespace.useState(defaultValue ?? tabs[0]?.value);
1955
+ const activeValue = value ?? internalValue;
1956
+ const handleTabClick = (tabValue) => {
1957
+ if (value === void 0) {
1958
+ setInternalValue(tabValue);
1959
+ }
1960
+ onValueChange?.(tabValue);
1961
+ };
1962
+ return /* @__PURE__ */ jsxRuntime.jsx(
1963
+ "div",
1964
+ {
1965
+ className: cn("flex items-center gap-1 border-b", className),
1966
+ role: "tablist",
1967
+ "aria-label": "Filtros",
1968
+ children: tabs.map((tab) => {
1969
+ const isActive = activeValue === tab.value;
1970
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1971
+ "button",
1972
+ {
1973
+ role: "tab",
1974
+ "aria-selected": isActive,
1975
+ "aria-controls": `tabpanel-${tab.value}`,
1976
+ className: cn(
1977
+ "relative px-4 py-2.5 text-sm font-medium transition-colors",
1978
+ "hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1979
+ isActive ? "text-primary" : "text-muted-foreground hover:text-foreground/80"
1980
+ ),
1981
+ onClick: () => handleTabClick(tab.value),
1982
+ children: [
1983
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
1984
+ tab.label,
1985
+ tab.count !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
1986
+ "span",
1987
+ {
1988
+ className: cn(
1989
+ "inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded text-xs font-medium",
1990
+ isActive ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
1991
+ ),
1992
+ children: tab.count
1993
+ }
1994
+ )
1995
+ ] }),
1996
+ isActive && /* @__PURE__ */ jsxRuntime.jsx(
1997
+ "span",
1998
+ {
1999
+ className: "absolute bottom-0 left-0 right-0 h-0.5 bg-primary",
2000
+ "aria-hidden": "true"
2001
+ }
2002
+ )
2003
+ ]
2004
+ },
2005
+ tab.value
2006
+ );
2007
+ })
2008
+ }
2009
+ );
2010
+ }
2011
+ DataTableTabs.displayName = "DataTable.Tabs";
2012
+
2013
+ // src/components/Table/index.ts
2014
+ var DataTable = Object.assign(DataTableRoot, {
2015
+ // Estado
2016
+ Loading: DataTableLoading,
2017
+ EmptyState: DataTableEmptyState,
2018
+ // Layout
2019
+ Tabs: DataTableTabs,
2020
+ Toolbar: DataTableToolbar,
2021
+ Content: DataTableContent,
2022
+ // Search & Filter
2023
+ Search: DataTableSearch,
2024
+ Filters: DataTableFilters,
2025
+ Filter: DataTableFilter,
2026
+ // Pagination
2027
+ Pagination: DataTablePagination,
2028
+ // Actions
2029
+ BulkActions: DataTableBulkActions,
2030
+ // Preferences
2031
+ ColumnVisibility: DataTableColumnVisibility,
2032
+ DensityToggle: DataTableDensityToggle,
2033
+ Export: DataTableExport,
2034
+ // Column utilities (para uso em column definitions)
2035
+ ColumnHeader: DataTableColumnHeader
2036
+ });
2037
+ var Dialog = DialogPrimitive__namespace.Root;
2038
+ var DialogTrigger = DialogPrimitive__namespace.Trigger;
2039
+ var DialogPortal = DialogPrimitive__namespace.Portal;
2040
+ var DialogClose = DialogPrimitive__namespace.Close;
2041
+ var DialogOverlay = React36__namespace.memo(
2042
+ React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2043
+ DialogPrimitive__namespace.Overlay,
2044
+ {
2045
+ ref,
2046
+ className: cn(
2047
+ "fixed inset-0 z-50 bg-black/80",
2048
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
2049
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
2050
+ className
2051
+ ),
2052
+ ...props
2053
+ }
2054
+ ))
2055
+ );
2056
+ DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
2057
+ var dialogContentVariants = classVarianceAuthority.cva(
2058
+ [
2059
+ "fixed left-[50%] top-[50%] z-50",
2060
+ "translate-x-[-50%] translate-y-[-50%]",
2061
+ "grid w-full gap-4",
2062
+ "border bg-background p-6 shadow-lg",
2063
+ "duration-200",
2064
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
2065
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
2066
+ "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
2067
+ "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
2068
+ "data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
2069
+ "sm:rounded-lg"
2070
+ ],
2071
+ {
2072
+ variants: {
2073
+ size: {
2074
+ sm: "max-w-sm",
2075
+ md: "max-w-md",
2076
+ lg: "max-w-lg",
2077
+ xl: "max-w-xl",
2078
+ "2xl": "max-w-2xl",
2079
+ "3xl": "max-w-3xl",
2080
+ "4xl": "max-w-4xl",
2081
+ full: "max-w-[95vw] max-h-[95vh]"
2082
+ }
2083
+ },
2084
+ defaultVariants: {
2085
+ size: "lg"
2086
+ }
2087
+ }
2088
+ );
2089
+ var DialogContent = React36__namespace.memo(
2090
+ React36__namespace.forwardRef(({ className, children, showCloseButton = true, size, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
2091
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
2092
+ /* @__PURE__ */ jsxRuntime.jsxs(
2093
+ DialogPrimitive__namespace.Content,
2094
+ {
2095
+ ref,
2096
+ className: cn(dialogContentVariants({ size, className })),
2097
+ ...props,
2098
+ children: [
2099
+ children,
2100
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
2101
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
2102
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Fechar" })
2103
+ ] })
2104
+ ]
2105
+ }
2106
+ )
2107
+ ] }))
2108
+ );
2109
+ DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
2110
+ var DialogHeader = React36__namespace.memo(
2111
+ ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
2112
+ "div",
2113
+ {
2114
+ className: cn(
2115
+ "flex flex-col space-y-1.5 text-center sm:text-left",
2116
+ className
2117
+ ),
2118
+ ...props
2119
+ }
2120
+ )
2121
+ );
2122
+ DialogHeader.displayName = "DialogHeader";
2123
+ var DialogFooter = React36__namespace.memo(
2124
+ ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
2125
+ "div",
2126
+ {
2127
+ className: cn(
2128
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
2129
+ className
2130
+ ),
2131
+ ...props
2132
+ }
2133
+ )
2134
+ );
2135
+ DialogFooter.displayName = "DialogFooter";
2136
+ var DialogTitle = React36__namespace.memo(
2137
+ React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2138
+ DialogPrimitive__namespace.Title,
2139
+ {
2140
+ ref,
2141
+ className: cn(
2142
+ "text-2xl font-semibold leading-none tracking-tight",
2143
+ className
2144
+ ),
2145
+ ...props
2146
+ }
2147
+ ))
2148
+ );
2149
+ DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
2150
+ var DialogDescription = React36__namespace.memo(
2151
+ React36__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2152
+ DialogPrimitive__namespace.Description,
2153
+ {
2154
+ ref,
2155
+ className: cn("text-[0.920rem] text-muted-foreground", className),
2156
+ ...props
2157
+ }
2158
+ ))
2159
+ );
2160
+ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
2161
+ var DialogBody = React36__namespace.memo(
2162
+ ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto py-2", className), ...props })
2163
+ );
2164
+ DialogBody.displayName = "DialogBody";
2165
+ var SIZE_CONFIG = {
2166
+ sm: { base: 8, increment: 2 },
2167
+ md: { base: 12, increment: 4 },
2168
+ lg: { base: 16, increment: 6 },
2169
+ xl: { base: 28, increment: 14 },
2170
+ xxl: { base: 36, increment: 16 }
2171
+ };
2172
+ var INTENSITY_CONFIG = {
2173
+ light: [4, 6, 8, 10, 12],
2174
+ medium: [6, 8, 10, 12, 16],
2175
+ strong: [8, 12, 16, 20, 25]
2176
+ };
2177
+ var POSITION_CONFIG = {
2178
+ center: "items-center justify-center",
2179
+ "top-left": "items-start justify-start",
2180
+ "top-right": "items-start justify-end",
2181
+ "bottom-left": "items-end justify-start",
2182
+ "bottom-right": "items-end justify-end",
2183
+ "top-center": "items-start justify-center",
2184
+ "bottom-center": "items-end justify-center"
2185
+ };
2186
+ var COLOR_MAP = {
2187
+ primary: "border-primary",
2188
+ secondary: "border-secondary",
2189
+ accent: "border-accent",
2190
+ muted: "border-muted"
2191
+ };
2192
+ var RippleRing = React36__namespace.memo(({ size, color, opacity }) => {
2193
+ const borderColorClass = COLOR_MAP[color] || COLOR_MAP.primary;
2194
+ return /* @__PURE__ */ jsxRuntime.jsx(
2195
+ "div",
2196
+ {
2197
+ className: cn("absolute rounded-full", borderColorClass),
2198
+ style: {
2199
+ width: `${size * 4}px`,
2200
+ height: `${size * 4}px`,
2201
+ borderWidth: "1px",
2202
+ opacity: opacity / 100,
2203
+ top: "50%",
2204
+ left: "50%",
2205
+ transform: "translate(-50%, -50%)"
2206
+ }
2207
+ }
2208
+ );
2209
+ });
2210
+ RippleRing.displayName = "RippleRing";
2211
+ var RippleEffect = React36__namespace.memo(
2212
+ ({
2213
+ size = "md",
2214
+ color = "primary",
2215
+ intensity = "medium",
2216
+ rings = 5,
2217
+ position = "center",
2218
+ className
2219
+ }) => {
2220
+ const { base, increment } = SIZE_CONFIG[size];
2221
+ const opacities = INTENSITY_CONFIG[intensity];
2222
+ const positionClasses = POSITION_CONFIG[position];
2223
+ const rippleRings = React36__namespace.useMemo(
2224
+ () => Array.from({ length: rings }).map((_, index) => {
2225
+ const ringSize = base + increment * (rings - index - 1);
2226
+ const opacity = opacities[index] || opacities[opacities.length - 1];
2227
+ return /* @__PURE__ */ jsxRuntime.jsx(
2228
+ RippleRing,
2229
+ {
2230
+ size: ringSize,
2231
+ color,
2232
+ opacity
2233
+ },
2234
+ index
2235
+ );
2236
+ }),
2237
+ [base, increment, rings, opacities, color]
2238
+ );
2239
+ return /* @__PURE__ */ jsxRuntime.jsx(
2240
+ "div",
2241
+ {
2242
+ className: cn(
2243
+ "absolute inset-0 flex pointer-events-none",
2244
+ positionClasses,
2245
+ className
2246
+ ),
2247
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: rippleRings })
2248
+ }
2249
+ );
2250
+ }
2251
+ );
2252
+ RippleEffect.displayName = "RippleEffect";
2253
+ var RippleWrapper = React36__namespace.memo(
2254
+ ({ children, rippleProps, className }) => {
2255
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", className), children: [
2256
+ rippleProps && /* @__PURE__ */ jsxRuntime.jsx(RippleEffect, { ...rippleProps }),
2257
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-10", children })
2258
+ ] });
2259
+ }
2260
+ );
2261
+ RippleWrapper.displayName = "RippleWrapper";
2262
+ var RippleBackground = React36__namespace.memo(
2263
+ ({ containerClassName, ...rippleProps }) => {
2264
+ return /* @__PURE__ */ jsxRuntime.jsx(
2265
+ "div",
2266
+ {
2267
+ className: cn(
2268
+ "absolute inset-0 overflow-hidden pointer-events-none",
2269
+ containerClassName
2270
+ ),
2271
+ children: /* @__PURE__ */ jsxRuntime.jsx(RippleEffect, { ...rippleProps })
2272
+ }
2273
+ );
2274
+ }
2275
+ );
2276
+ RippleBackground.displayName = "RippleBackground";
2277
+ var iconWrapperVariants2 = classVarianceAuthority.cva(
2278
+ "p-3 rounded-2xl shadow-lg transition-all duration-200",
2279
+ {
2280
+ variants: {
2281
+ variant: {
2282
+ default: "bg-primary shadow-primary/25",
2283
+ secondary: "bg-secondary shadow-secondary/25",
2284
+ accent: "bg-accent shadow-accent/25",
2285
+ destructive: "bg-red-600 shadow-red-600/25",
2286
+ success: "bg-green-600 shadow-green-600/25"
2287
+ },
2288
+ size: {
2289
+ sm: "p-2",
2290
+ md: "p-3",
2291
+ lg: "p-4"
2292
+ }
2293
+ },
2294
+ defaultVariants: {
2295
+ variant: "default",
2296
+ size: "md"
2297
+ }
2298
+ }
2299
+ );
2300
+ var iconVariants2 = classVarianceAuthority.cva("text-white", {
2301
+ variants: {
2302
+ size: {
2303
+ sm: "h-4 w-4",
2304
+ md: "h-5 w-5",
2305
+ lg: "h-6 w-6"
2306
+ }
2307
+ },
2308
+ defaultVariants: {
2309
+ size: "md"
2310
+ }
2311
+ });
2312
+ var statusIndicatorVariants = classVarianceAuthority.cva(
2313
+ "absolute -top-1 -right-0 w-4 h-4 rounded-full border-2 border-white/70 shadow-sm z-20",
2314
+ {
2315
+ variants: {
2316
+ status: {
2317
+ active: "bg-green-500",
2318
+ inactive: "bg-slate-500",
2319
+ warning: "bg-yellow-500",
2320
+ error: "bg-red-500"
2321
+ }
2322
+ },
2323
+ defaultVariants: {
2324
+ status: "active"
2325
+ }
2326
+ }
2327
+ );
2328
+ var DialogWrapper = React36__namespace.memo(
2329
+ ({
2330
+ children,
2331
+ className,
2332
+ icon: Icon2,
2333
+ status,
2334
+ variant = "default",
2335
+ size = "md",
2336
+ iconSize = "md",
2337
+ showRipple = true,
2338
+ rippleProps,
2339
+ ...props
2340
+ }) => {
2341
+ const defaultRippleProps = React36__namespace.useMemo(
2342
+ () => ({
2343
+ size: size === "sm" ? "md" : size === "lg" ? "xl" : "lg",
2344
+ color: variant === "secondary" ? "secondary" : variant === "accent" ? "accent" : "primary",
2345
+ intensity: "light",
2346
+ rings: 3,
2347
+ ...rippleProps
2348
+ }),
2349
+ [size, variant, rippleProps]
2350
+ );
2351
+ const backgroundRippleProps = React36__namespace.useMemo(
2352
+ () => ({
2353
+ position: "top-right",
2354
+ size: "xl",
2355
+ color: variant === "secondary" ? "secondary" : variant === "accent" ? "accent" : "primary",
2356
+ intensity: "light",
2357
+ rings: 5
2358
+ }),
2359
+ [variant]
2360
+ );
2361
+ if (!Icon2) {
2362
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2363
+ DialogHeader,
2364
+ {
2365
+ className: cn("flex flex-col justify-between px-0", className),
2366
+ ...props,
2367
+ children: [
2368
+ showRipple && /* @__PURE__ */ jsxRuntime.jsx(RippleBackground, { ...backgroundRippleProps }),
2369
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3 w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children }) })
2370
+ ]
2371
+ }
2372
+ );
2373
+ }
2374
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2375
+ DialogHeader,
2376
+ {
2377
+ className: cn("flex flex-col justify-between px-0 pb-3", className),
2378
+ ...props,
2379
+ children: [
2380
+ showRipple && /* @__PURE__ */ jsxRuntime.jsx(RippleBackground, { ...backgroundRippleProps }),
2381
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
2382
+ /* @__PURE__ */ jsxRuntime.jsxs(
2383
+ RippleWrapper,
2384
+ {
2385
+ rippleProps: showRipple ? defaultRippleProps : void 0,
2386
+ children: [
2387
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(iconWrapperVariants2({ variant, size }), "mr-2"), children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: iconVariants2({ size: iconSize }) }) }),
2388
+ status && /* @__PURE__ */ jsxRuntime.jsx("div", { className: statusIndicatorVariants({ status }) })
2389
+ ]
2390
+ }
2391
+ ),
2392
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children })
2393
+ ] })
2394
+ ]
2395
+ }
2396
+ );
2397
+ }
2398
+ );
2399
+ DialogWrapper.displayName = "DialogWrapper";
2400
+ var toastVariants = {
2401
+ default: {
2402
+ bg: "bg-card",
2403
+ border: "border-border",
2404
+ barColor: "bg-muted-foreground",
2405
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "h-5 w-5 text-muted-foreground" }),
2406
+ textColor: "text-foreground"
2407
+ },
2408
+ success: {
2409
+ bg: "bg-card",
2410
+ border: "border-green-300 dark:border-green-700",
2411
+ barColor: "bg-green-500",
2412
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-green-600 dark:text-green-500" }),
2413
+ textColor: "text-foreground"
2414
+ },
2415
+ error: {
2416
+ bg: "bg-card",
2417
+ border: "border-red-300 dark:border-red-700",
2418
+ barColor: "bg-red-500",
2419
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-5 w-5 text-red-600 dark:text-red-500" }),
2420
+ textColor: "text-foreground"
2421
+ },
2422
+ warning: {
2423
+ bg: "bg-card",
2424
+ border: "border-yellow-400 dark:border-yellow-700",
2425
+ barColor: "bg-yellow-500",
2426
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "h-5 w-5 text-yellow-600 dark:text-yellow-500" }),
2427
+ textColor: "text-foreground"
2428
+ },
2429
+ info: {
2430
+ bg: "bg-card",
2431
+ border: "border-blue-300 dark:border-blue-700",
2432
+ barColor: "bg-blue-500",
2433
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "h-5 w-5 text-blue-600 dark:text-blue-500" }),
2434
+ textColor: "text-foreground"
2435
+ }
2436
+ };
2437
+ var Toaster = ({ ...props }) => {
2438
+ return /* @__PURE__ */ jsxRuntime.jsx(
2439
+ sonner.Toaster,
2440
+ {
2441
+ position: "top-right",
2442
+ expand: false,
2443
+ closeButton: false,
2444
+ toastOptions: {
2445
+ unstyled: true,
2446
+ classNames: {
2447
+ toast: "w-full"
2448
+ }
2449
+ },
2450
+ ...props
2451
+ }
2452
+ );
2453
+ };
2454
+ var CustomToast = React36__namespace.memo(
2455
+ ({ title, description, variant = "default", action, onClose }) => {
2456
+ const variantStyles = toastVariants[variant];
2457
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2458
+ "div",
2459
+ {
2460
+ className: cn(
2461
+ "flex items-start gap-3 p-4 pr-3 rounded-lg shadow-lg border min-w-[350px] max-w-[450px] relative overflow-hidden",
2462
+ variantStyles.bg,
2463
+ variantStyles.border
2464
+ ),
2465
+ children: [
2466
+ /* @__PURE__ */ jsxRuntime.jsx(
2467
+ "div",
2468
+ {
2469
+ className: cn(
2470
+ "absolute left-0 top-0 bottom-0 w-1.5",
2471
+ variantStyles.barColor
2472
+ )
2473
+ }
2474
+ ),
2475
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 ml-2", children: variantStyles.icon }),
2476
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
2477
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm font-medium", variantStyles.textColor), children: title }),
2478
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: description })
2479
+ ] }),
2480
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
2481
+ action && /* @__PURE__ */ jsxRuntime.jsx(
2482
+ "button",
2483
+ {
2484
+ onClick: (e) => {
2485
+ e.stopPropagation();
2486
+ action.onClick();
2487
+ },
2488
+ className: cn(
2489
+ "text-sm font-medium px-2 py-1 rounded hover:bg-accent transition-colors",
2490
+ variant === "error" || variant === "warning" ? "text-red-700 dark:text-red-400" : variant === "success" ? "text-green-700 dark:text-green-400" : variant === "info" ? "text-blue-700 dark:text-blue-400" : "text-foreground"
2491
+ ),
2492
+ children: action.label
2493
+ }
2494
+ ),
2495
+ /* @__PURE__ */ jsxRuntime.jsx(
2496
+ "button",
2497
+ {
2498
+ onClick: (e) => {
2499
+ e.stopPropagation();
2500
+ onClose?.();
2501
+ },
2502
+ className: "p-1 rounded hover:bg-accent transition-colors",
2503
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4 text-muted-foreground" })
2504
+ }
2505
+ )
2506
+ ] })
2507
+ ]
2508
+ }
2509
+ );
2510
+ }
2511
+ );
2512
+ CustomToast.displayName = "CustomToast";
2513
+ var createToast = (message, variant = "default") => {
2514
+ const props = typeof message === "string" ? { title: message, variant } : message;
2515
+ return sonner.toast.custom(
2516
+ (t) => /* @__PURE__ */ jsxRuntime.jsx(CustomToast, { ...props, onClose: () => sonner.toast.dismiss(t) }),
2517
+ {
2518
+ duration: props.action ? 1e4 : 4e3
2519
+ }
2520
+ );
2521
+ };
2522
+ var toast = Object.assign(
2523
+ (message) => createToast(message, "default"),
2524
+ {
2525
+ success: (message) => createToast(
2526
+ typeof message === "string" ? { title: message } : message,
2527
+ "success"
2528
+ ),
2529
+ error: (message) => createToast(
2530
+ typeof message === "string" ? { title: message } : message,
2531
+ "error"
2532
+ ),
2533
+ warning: (message) => createToast(
2534
+ typeof message === "string" ? { title: message } : message,
2535
+ "warning"
2536
+ ),
2537
+ info: (message) => createToast(
2538
+ typeof message === "string" ? { title: message } : message,
2539
+ "info"
2540
+ ),
2541
+ custom: (component, options) => sonner.toast.custom(component, options),
2542
+ dismiss: (id) => sonner.toast.dismiss(id),
2543
+ promise: (promise, options) => sonner.toast.promise(promise, options)
2544
+ }
2545
+ );
2546
+ var switchVariants = classVarianceAuthority.cva(
2547
+ [
2548
+ "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent",
2549
+ "transition-colors",
2550
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2551
+ "disabled:cursor-not-allowed disabled:opacity-50"
2552
+ ],
2553
+ {
2554
+ variants: {
2555
+ variant: {
2556
+ default: "data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
2557
+ secondary: "data-[state=checked]:bg-secondary data-[state=unchecked]:bg-input",
2558
+ success: "data-[state=checked]:bg-green-600 data-[state=unchecked]:bg-input"
2559
+ },
2560
+ size: {
2561
+ sm: "h-5 w-9",
2562
+ md: "h-6 w-11",
2563
+ lg: "h-7 w-14"
2564
+ }
2565
+ },
2566
+ defaultVariants: {
2567
+ variant: "default",
2568
+ size: "md"
2569
+ }
2570
+ }
2571
+ );
2572
+ var thumbVariants = classVarianceAuthority.cva(
2573
+ [
2574
+ "pointer-events-none block rounded-full bg-background shadow-lg ring-0",
2575
+ "transition-transform"
2576
+ ],
2577
+ {
2578
+ variants: {
2579
+ size: {
2580
+ sm: "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",
2581
+ md: "h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
2582
+ lg: "h-6 w-6 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0"
2583
+ }
2584
+ },
2585
+ defaultVariants: {
2586
+ size: "md"
2587
+ }
2588
+ }
2589
+ );
2590
+ var Switch = React36__namespace.memo(
2591
+ React36__namespace.forwardRef(({ className, variant, size = "md", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2592
+ SwitchPrimitives__namespace.Root,
2593
+ {
2594
+ className: cn(switchVariants({ variant, size, className })),
2595
+ ...props,
2596
+ ref,
2597
+ children: /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitives__namespace.Thumb, { className: cn(thumbVariants({ size })) })
2598
+ }
2599
+ ))
2600
+ );
2601
+ Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
2602
+ var textareaVariants = classVarianceAuthority.cva(
2603
+ "w-full 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 resize-none",
2604
+ {
2605
+ variants: {
2606
+ variant: {
2607
+ default: "border-border focus:border-primary",
2608
+ error: "border-red-500 focus:border-red-600"
2609
+ },
2610
+ textareaSize: {
2611
+ sm: "min-h-[80px] pt-3 pb-1",
2612
+ default: "min-h-[100px]",
2613
+ lg: "min-h-[120px] pt-5 pb-2"
2614
+ }
2615
+ },
2616
+ defaultVariants: {
2617
+ variant: "default",
2618
+ textareaSize: "default"
2619
+ }
2620
+ }
2621
+ );
2622
+ var Textarea = React36__namespace.memo(
2623
+ React36__namespace.forwardRef(
2624
+ ({
2625
+ className,
2626
+ variant,
2627
+ textareaSize,
2628
+ error,
2629
+ label,
2630
+ icon: Icon2,
2631
+ required,
2632
+ containerClassName,
2633
+ labelClassName,
2634
+ autoResize = false,
2635
+ onChange,
2636
+ ...props
2637
+ }, ref) => {
2638
+ const textareaRef = React36__namespace.useRef(null);
2639
+ React36__namespace.useImperativeHandle(ref, () => textareaRef.current, []);
2640
+ const focusTextarea = React36__namespace.useCallback(() => {
2641
+ textareaRef.current?.focus();
2642
+ }, []);
2643
+ const handleChange = React36__namespace.useCallback(
2644
+ (e) => {
2645
+ if (autoResize && textareaRef.current) {
2646
+ textareaRef.current.style.height = "auto";
2647
+ textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
2648
+ }
2649
+ onChange?.(e);
2650
+ },
2651
+ [autoResize, onChange]
2652
+ );
2653
+ React36__namespace.useEffect(() => {
2654
+ if (autoResize && textareaRef.current) {
2655
+ textareaRef.current.style.height = "auto";
2656
+ textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
2657
+ }
2658
+ }, [autoResize]);
2659
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", containerClassName), children: [
2660
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(
2661
+ Icon2,
2662
+ {
2663
+ className: "absolute left-3 top-4 text-muted-foreground h-4 w-4 cursor-pointer z-10",
2664
+ onClick: focusTextarea
2665
+ }
2666
+ ),
2667
+ /* @__PURE__ */ jsxRuntime.jsx(
2668
+ "textarea",
2669
+ {
2670
+ className: cn(
2671
+ textareaVariants({
2672
+ variant: error ? "error" : variant,
2673
+ textareaSize
2674
+ }),
2675
+ Icon2 && "pl-10",
2676
+ className
2677
+ ),
2678
+ ref: textareaRef,
2679
+ onChange: handleChange,
2680
+ ...props
2681
+ }
2682
+ ),
2683
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
2684
+ "label",
2685
+ {
2686
+ className: cn(
2687
+ "absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 cursor-pointer",
2688
+ error ? "text-red-500" : "text-foreground",
2689
+ Icon2 && "left-10",
2690
+ labelClassName
2691
+ ),
2692
+ onClick: focusTextarea,
2693
+ children: [
2694
+ label,
2695
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
2696
+ ]
2697
+ }
2698
+ )
2699
+ ] });
2700
+ }
2701
+ )
2702
+ );
2703
+ Textarea.displayName = "Textarea";
2704
+ var FormContext = React36__namespace.createContext(null);
2705
+ function useFormContext() {
2706
+ const context = React36__namespace.useContext(FormContext);
2707
+ if (!context) {
2708
+ throw new Error("useFormContext must be used within a Form provider");
2709
+ }
2710
+ return context.form;
2711
+ }
2712
+ function FormProvider({
2713
+ form,
2714
+ children
2715
+ }) {
2716
+ const value = React36__namespace.useMemo(() => ({ form }), [form]);
2717
+ return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value, children });
2718
+ }
2719
+ var FormFieldContext = React36__namespace.createContext(null);
2720
+ function useFormFieldContext() {
2721
+ const context = React36__namespace.useContext(FormFieldContext);
2722
+ if (!context) {
2723
+ throw new Error("useFormFieldContext must be used within a Form.Field");
2724
+ }
2725
+ return context;
2726
+ }
2727
+ function useFormFieldContextOptional() {
2728
+ return React36__namespace.useContext(FormFieldContext);
2729
+ }
2730
+ function FormFieldProvider({ name, children }) {
2731
+ const form = useFormContext();
2732
+ const id = React36__namespace.useId();
2733
+ const fieldState = form.getFieldState(name, form.formState);
2734
+ const error = fieldState.error?.message;
2735
+ const isRequired = false;
2736
+ const value = React36__namespace.useMemo(
2737
+ () => ({
2738
+ name,
2739
+ id,
2740
+ error,
2741
+ isRequired
2742
+ }),
2743
+ [name, id, error, isRequired]
2744
+ );
2745
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value, children });
2746
+ }
2747
+ function applyMask(value, mask) {
2748
+ const digits = value.replace(/\D/g, "");
2749
+ switch (mask) {
2750
+ case "phone":
2751
+ if (digits.length <= 10) {
2752
+ return digits.replace(/(\d{2})(\d{4})(\d{0,4})/, "($1) $2-$3").trim();
2753
+ }
2754
+ return digits.replace(/(\d{2})(\d{5})(\d{0,4})/, "($1) $2-$3").trim();
2755
+ case "cpf":
2756
+ return digits.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2");
2757
+ case "cnpj":
2758
+ return digits.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1/$2").replace(/(\d{4})(\d{1,2})$/, "$1-$2");
2759
+ case "cep":
2760
+ return digits.replace(/(\d{5})(\d{0,3})/, "$1-$2");
2761
+ case "money":
2762
+ if (!digits) return "";
2763
+ const cents = parseInt(digits, 10) / 100;
2764
+ return new Intl.NumberFormat("pt-BR", {
2765
+ style: "currency",
2766
+ currency: "BRL"
2767
+ }).format(cents);
2768
+ case "percent":
2769
+ if (!digits) return "";
2770
+ const percent = parseInt(digits, 10) / 100;
2771
+ return `${percent.toFixed(2)}%`;
2772
+ case "plate":
2773
+ const upper = value.toUpperCase().replace(/[^A-Z0-9]/g, "");
2774
+ if (upper.length <= 3) return upper;
2775
+ if (upper.length <= 7) {
2776
+ return upper.replace(/([A-Z]{3})(\d{0,1})([A-Z0-9]{0,1})(\d{0,2})/, "$1-$2$3$4");
2777
+ }
2778
+ return upper.slice(0, 7).replace(/([A-Z]{3})(\d{0,1})([A-Z0-9]{0,1})(\d{0,2})/, "$1-$2$3$4");
2779
+ case "date":
2780
+ return digits.replace(/(\d{2})(\d)/, "$1/$2").replace(/(\d{2})(\d)/, "$1/$2").slice(0, 10);
2781
+ case "time":
2782
+ return digits.replace(/(\d{2})(\d{0,2})/, "$1:$2").slice(0, 5);
2783
+ case "datetime":
2784
+ const dateTime = digits.replace(/(\d{2})(\d)/, "$1/$2").replace(/(\d{2})(\d)/, "$1/$2").replace(/(\d{4})(\d)/, "$1 $2").replace(/(\d{2})(\d{0,2})$/, "$1:$2");
2785
+ return dateTime.slice(0, 16);
2786
+ default:
2787
+ return value;
2788
+ }
2789
+ }
2790
+ function getMaxLength(mask) {
2791
+ switch (mask) {
2792
+ case "phone":
2793
+ return 15;
2794
+ case "cpf":
2795
+ return 14;
2796
+ case "cnpj":
2797
+ return 18;
2798
+ case "cep":
2799
+ return 9;
2800
+ case "plate":
2801
+ return 8;
2802
+ case "date":
2803
+ return 10;
2804
+ case "time":
2805
+ return 5;
2806
+ case "datetime":
2807
+ return 16;
2808
+ default:
2809
+ return void 0;
2810
+ }
2811
+ }
2812
+ function parseValue(displayValue, mask) {
2813
+ if (!displayValue) return void 0;
2814
+ switch (mask) {
2815
+ case "money":
2816
+ const moneyDigits = displayValue.replace(/\D/g, "");
2817
+ return moneyDigits ? parseInt(moneyDigits, 10) / 100 : void 0;
2818
+ case "percent":
2819
+ const percentDigits = displayValue.replace(/\D/g, "");
2820
+ return percentDigits ? parseInt(percentDigits, 10) / 100 : void 0;
2821
+ default:
2822
+ return displayValue || void 0;
2823
+ }
2824
+ }
2825
+ function FormInput({
2826
+ name,
2827
+ label,
2828
+ description,
2829
+ required,
2830
+ disabled,
2831
+ className,
2832
+ mask,
2833
+ icon,
2834
+ showPasswordToggle = true,
2835
+ inputSize = "default",
2836
+ hideError = false,
2837
+ type = "text",
2838
+ maxLength,
2839
+ ...inputProps
2840
+ }) {
2841
+ const form = useFormContext();
2842
+ const fieldState = form.getFieldState(name, form.formState);
2843
+ const error = fieldState.error?.message;
2844
+ const getInputType = React36__namespace.useCallback(() => {
2845
+ if (["money", "percent", "phone", "cpf", "cnpj", "cep"].includes(mask || "")) {
2846
+ return "tel";
2847
+ }
2848
+ return type;
2849
+ }, [mask, type]);
2850
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsxRuntime.jsx(
2851
+ reactHookForm.Controller,
2852
+ {
2853
+ control: form.control,
2854
+ name,
2855
+ render: ({ field }) => {
2856
+ const getDisplayValue = () => {
2857
+ if (field.value === void 0 || field.value === null) return "";
2858
+ if (mask) {
2859
+ return applyMask(String(field.value), mask);
2860
+ }
2861
+ return String(field.value);
2862
+ };
2863
+ const handleChange = (e) => {
2864
+ let newValue = e.target.value;
2865
+ if (mask) {
2866
+ newValue = applyMask(newValue, mask);
2867
+ const parsed = parseValue(newValue, mask);
2868
+ field.onChange(parsed);
2869
+ } else {
2870
+ field.onChange(newValue || void 0);
2871
+ }
2872
+ };
2873
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
2874
+ /* @__PURE__ */ jsxRuntime.jsx(
2875
+ Input,
2876
+ {
2877
+ ...inputProps,
2878
+ ref: field.ref,
2879
+ name: field.name,
2880
+ value: getDisplayValue(),
2881
+ onChange: handleChange,
2882
+ onBlur: field.onBlur,
2883
+ disabled,
2884
+ type: getInputType(),
2885
+ label,
2886
+ required,
2887
+ error: !!error,
2888
+ icon,
2889
+ inputSize,
2890
+ maxLength: maxLength ?? getMaxLength(mask)
2891
+ }
2892
+ ),
2893
+ description && !error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground px-1", children: description }),
2894
+ !hideError && error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500 px-1", children: error })
2895
+ ] });
2896
+ }
2897
+ }
2898
+ ) });
2899
+ }
2900
+ FormInput.displayName = "Form.Input";
2901
+ function FormSelect({
2902
+ name,
2903
+ label,
2904
+ description,
2905
+ required,
2906
+ disabled,
2907
+ className,
2908
+ options,
2909
+ placeholder = "Selecione...",
2910
+ icon,
2911
+ hideError = false,
2912
+ selectSize = "default",
2913
+ emptyText = "Nenhuma op\xE7\xE3o dispon\xEDvel",
2914
+ loading = false
2915
+ }) {
2916
+ const form = useFormContext();
2917
+ const fieldState = form.getFieldState(name, form.formState);
2918
+ const error = fieldState.error?.message;
2919
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsxRuntime.jsx(
2920
+ reactHookForm.Controller,
2921
+ {
2922
+ control: form.control,
2923
+ name,
2924
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
2925
+ /* @__PURE__ */ jsxRuntime.jsx(
2926
+ Select,
2927
+ {
2928
+ value: field.value ?? "",
2929
+ onValueChange: (value) => {
2930
+ field.onChange(value || void 0);
2931
+ },
2932
+ disabled: disabled || loading,
2933
+ label,
2934
+ required,
2935
+ error: !!error,
2936
+ icon,
2937
+ selectSize,
2938
+ placeholder,
2939
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__loading__", disabled: true, children: "Carregando..." }) : options.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__empty__", disabled: true, children: emptyText }) : options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
2940
+ SelectItem,
2941
+ {
2942
+ value: option.value,
2943
+ disabled: option.disabled,
2944
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2945
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-4 w-4 text-muted-foreground" }),
2946
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2947
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
2948
+ option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground ml-2", children: option.description })
2949
+ ] })
2950
+ ] })
2951
+ },
2952
+ option.value
2953
+ ))
2954
+ }
2955
+ ),
2956
+ description && !error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground px-1", children: description }),
2957
+ !hideError && error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500 px-1", children: error })
2958
+ ] })
2959
+ }
2960
+ ) });
2961
+ }
2962
+ FormSelect.displayName = "Form.Select";
2963
+ function FormTextarea({
2964
+ name,
2965
+ label,
2966
+ description,
2967
+ required,
2968
+ disabled,
2969
+ className,
2970
+ hideError = false,
2971
+ showCount = false,
2972
+ maxLength,
2973
+ ...textareaProps
2974
+ }) {
2975
+ const form = useFormContext();
2976
+ const fieldState = form.getFieldState(name, form.formState);
2977
+ const error = fieldState.error?.message;
2978
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsxRuntime.jsx(
2979
+ reactHookForm.Controller,
2980
+ {
2981
+ control: form.control,
2982
+ name,
2983
+ render: ({ field }) => {
2984
+ const charCount = field.value?.length ?? 0;
2985
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
2986
+ /* @__PURE__ */ jsxRuntime.jsx(
2987
+ Textarea,
2988
+ {
2989
+ ...textareaProps,
2990
+ ref: field.ref,
2991
+ name: field.name,
2992
+ value: field.value ?? "",
2993
+ onChange: (e) => field.onChange(e.target.value || void 0),
2994
+ onBlur: field.onBlur,
2995
+ disabled,
2996
+ label,
2997
+ required,
2998
+ error: !!error,
2999
+ maxLength
3000
+ }
3001
+ ),
3002
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between px-1", children: [
3003
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3004
+ description && !error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: description }),
3005
+ !hideError && error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
3006
+ ] }),
3007
+ showCount && maxLength && /* @__PURE__ */ jsxRuntime.jsxs(
3008
+ "p",
3009
+ {
3010
+ className: cn(
3011
+ "text-xs",
3012
+ charCount > maxLength ? "text-red-500" : "text-muted-foreground"
3013
+ ),
3014
+ children: [
3015
+ charCount,
3016
+ "/",
3017
+ maxLength
3018
+ ]
3019
+ }
3020
+ )
3021
+ ] })
3022
+ ] });
3023
+ }
3024
+ }
3025
+ ) });
3026
+ }
3027
+ FormTextarea.displayName = "Form.Textarea";
3028
+ function FormCheckbox({
3029
+ name,
3030
+ label,
3031
+ description,
3032
+ required,
3033
+ disabled,
3034
+ className,
3035
+ hideError = false
3036
+ }) {
3037
+ const form = useFormContext();
3038
+ const fieldState = form.getFieldState(name, form.formState);
3039
+ const error = fieldState.error?.message;
3040
+ const id = React36__namespace.useId();
3041
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsxRuntime.jsx(
3042
+ reactHookForm.Controller,
3043
+ {
3044
+ control: form.control,
3045
+ name,
3046
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
3047
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
3048
+ /* @__PURE__ */ jsxRuntime.jsx(
3049
+ Checkbox,
3050
+ {
3051
+ id,
3052
+ ref: field.ref,
3053
+ checked: field.value ?? false,
3054
+ onCheckedChange: (checked) => field.onChange(checked),
3055
+ onBlur: field.onBlur,
3056
+ disabled
3057
+ }
3058
+ ),
3059
+ (label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-0.5 leading-none", children: [
3060
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
3061
+ "label",
3062
+ {
3063
+ htmlFor: id,
3064
+ className: cn(
3065
+ "text-sm font-medium leading-none cursor-pointer",
3066
+ disabled && "cursor-not-allowed opacity-50"
3067
+ ),
3068
+ children: [
3069
+ label,
3070
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3071
+ ]
3072
+ }
3073
+ ),
3074
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: description })
3075
+ ] })
3076
+ ] }),
3077
+ !hideError && error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500 pl-8", children: error })
3078
+ ] })
3079
+ }
3080
+ ) });
3081
+ }
3082
+ FormCheckbox.displayName = "Form.Checkbox";
3083
+ function FormSwitch({
3084
+ name,
3085
+ label,
3086
+ description,
3087
+ required,
3088
+ disabled,
3089
+ className,
3090
+ hideError = false
3091
+ }) {
3092
+ const form = useFormContext();
3093
+ const fieldState = form.getFieldState(name, form.formState);
3094
+ const error = fieldState.error?.message;
3095
+ const id = React36__namespace.useId();
3096
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsxRuntime.jsx(
3097
+ reactHookForm.Controller,
3098
+ {
3099
+ control: form.control,
3100
+ name,
3101
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-1", className), children: [
3102
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
3103
+ (label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-0.5 leading-none", children: [
3104
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
3105
+ "label",
3106
+ {
3107
+ htmlFor: id,
3108
+ className: cn(
3109
+ "text-sm font-medium leading-none cursor-pointer",
3110
+ disabled && "cursor-not-allowed opacity-50"
3111
+ ),
3112
+ children: [
3113
+ label,
3114
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3115
+ ]
3116
+ }
3117
+ ),
3118
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: description })
3119
+ ] }),
3120
+ /* @__PURE__ */ jsxRuntime.jsx(
3121
+ Switch,
3122
+ {
3123
+ id,
3124
+ ref: field.ref,
3125
+ checked: field.value ?? false,
3126
+ onCheckedChange: (checked) => field.onChange(checked),
3127
+ onBlur: field.onBlur,
3128
+ disabled
3129
+ }
3130
+ )
3131
+ ] }),
3132
+ !hideError && error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
3133
+ ] })
3134
+ }
3135
+ ) });
3136
+ }
3137
+ FormSwitch.displayName = "Form.Switch";
3138
+ function FormRadioGroup({
3139
+ name,
3140
+ label,
3141
+ description,
3142
+ required,
3143
+ disabled,
3144
+ className,
3145
+ options,
3146
+ orientation = "vertical",
3147
+ hideError = false
3148
+ }) {
3149
+ const form = useFormContext();
3150
+ const fieldState = form.getFieldState(name, form.formState);
3151
+ const error = fieldState.error?.message;
3152
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldProvider, { name, children: /* @__PURE__ */ jsxRuntime.jsx(
3153
+ reactHookForm.Controller,
3154
+ {
3155
+ control: form.control,
3156
+ name,
3157
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-2", className), children: [
3158
+ label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "text-sm font-medium", children: [
3159
+ label,
3160
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3161
+ ] }),
3162
+ description && !error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: description }),
3163
+ /* @__PURE__ */ jsxRuntime.jsx(
3164
+ RadioGroupPrimitive__namespace.Root,
3165
+ {
3166
+ ref: field.ref,
3167
+ value: field.value,
3168
+ onValueChange: (value) => field.onChange(value || void 0),
3169
+ disabled,
3170
+ className: cn(
3171
+ "grid gap-2",
3172
+ orientation === "horizontal" && "flex flex-wrap gap-4"
3173
+ ),
3174
+ children: options.map((option) => {
3175
+ const optionId = `${name}-${option.value}`;
3176
+ const isSelected = field.value === option.value;
3177
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3178
+ "div",
3179
+ {
3180
+ className: cn(
3181
+ "flex items-center gap-3 border-2 py-2 px-4 rounded-lg transition-colors cursor-pointer",
3182
+ isSelected ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground/50",
3183
+ option.disabled && "opacity-50 cursor-not-allowed"
3184
+ ),
3185
+ onClick: () => {
3186
+ if (!option.disabled && !disabled) {
3187
+ field.onChange(option.value);
3188
+ }
3189
+ },
3190
+ children: [
3191
+ /* @__PURE__ */ jsxRuntime.jsx(
3192
+ RadioGroupPrimitive__namespace.Item,
3193
+ {
3194
+ id: optionId,
3195
+ value: option.value,
3196
+ disabled: option.disabled,
3197
+ className: cn(
3198
+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary",
3199
+ "ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
3200
+ "disabled:cursor-not-allowed disabled:opacity-50"
3201
+ ),
3202
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2.5 w-2.5 fill-current text-current" }) })
3203
+ }
3204
+ ),
3205
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-0.5 leading-none", children: [
3206
+ /* @__PURE__ */ jsxRuntime.jsx(
3207
+ "label",
3208
+ {
3209
+ htmlFor: optionId,
3210
+ className: cn(
3211
+ "text-sm font-medium leading-none cursor-pointer",
3212
+ isSelected && "text-primary",
3213
+ option.disabled && "cursor-not-allowed"
3214
+ ),
3215
+ children: option.label
3216
+ }
3217
+ ),
3218
+ option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: option.description })
3219
+ ] })
3220
+ ]
3221
+ },
3222
+ option.value
3223
+ );
3224
+ })
3225
+ }
3226
+ ),
3227
+ !hideError && error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
3228
+ ] })
3229
+ }
3230
+ ) });
3231
+ }
3232
+ FormRadioGroup.displayName = "Form.RadioGroup";
3233
+ var FormLabel = React36__namespace.forwardRef(
3234
+ ({ className, required, children, ...props }, ref) => {
3235
+ const fieldContext = useFormFieldContextOptional();
3236
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3237
+ "label",
3238
+ {
3239
+ ref,
3240
+ htmlFor: fieldContext?.id,
3241
+ className: cn(
3242
+ "text-sm font-medium leading-none",
3243
+ fieldContext?.error && "text-red-500",
3244
+ className
3245
+ ),
3246
+ ...props,
3247
+ children: [
3248
+ children,
3249
+ (required || fieldContext?.isRequired) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
3250
+ ]
3251
+ }
3252
+ );
3253
+ }
3254
+ );
3255
+ FormLabel.displayName = "Form.Label";
3256
+ var FormDescription = React36__namespace.forwardRef(({ className, ...props }, ref) => {
3257
+ const fieldContext = useFormFieldContextOptional();
3258
+ if (fieldContext?.error) {
3259
+ return null;
3260
+ }
3261
+ return /* @__PURE__ */ jsxRuntime.jsx(
3262
+ "p",
3263
+ {
3264
+ ref,
3265
+ className: cn("text-xs text-muted-foreground", className),
3266
+ ...props
3267
+ }
3268
+ );
3269
+ });
3270
+ FormDescription.displayName = "Form.Description";
3271
+ var FormError = React36__namespace.forwardRef(
3272
+ ({ className, message, children, ...props }, ref) => {
3273
+ const fieldContext = useFormFieldContextOptional();
3274
+ const errorMessage = message ?? fieldContext?.error;
3275
+ if (!errorMessage && !children) {
3276
+ return null;
3277
+ }
3278
+ return /* @__PURE__ */ jsxRuntime.jsx(
3279
+ "p",
3280
+ {
3281
+ ref,
3282
+ className: cn("text-xs text-red-500", className),
3283
+ ...props,
3284
+ children: children || errorMessage
3285
+ }
3286
+ );
3287
+ }
3288
+ );
3289
+ FormError.displayName = "Form.Error";
3290
+ var FormFieldWrapper = React36__namespace.forwardRef(({ className, label, description, required, error, children, ...props }, ref) => {
3291
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn("space-y-1", className), ...props, children: [
3292
+ label && /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, children: label }),
3293
+ children,
3294
+ description && /* @__PURE__ */ jsxRuntime.jsx(FormDescription, { children: description }),
3295
+ error && /* @__PURE__ */ jsxRuntime.jsx(FormError, { message: error })
3296
+ ] });
3297
+ });
3298
+ FormFieldWrapper.displayName = "Form.FieldWrapper";
3299
+ function FormRoot({
3300
+ form,
3301
+ onSubmit,
3302
+ onError,
3303
+ children,
3304
+ className,
3305
+ ...props
3306
+ }) {
3307
+ return /* @__PURE__ */ jsxRuntime.jsx(FormProvider, { form, children: /* @__PURE__ */ jsxRuntime.jsx(
3308
+ "form",
3309
+ {
3310
+ onSubmit: form.handleSubmit(onSubmit, onError),
3311
+ className: cn("space-y-4", className),
3312
+ ...props,
3313
+ children
3314
+ }
3315
+ ) });
3316
+ }
3317
+ FormRoot.displayName = "Form";
3318
+ var Form = Object.assign(FormRoot, {
3319
+ // Campos com auto-bind
3320
+ Input: FormInput,
3321
+ Select: FormSelect,
3322
+ Textarea: FormTextarea,
3323
+ Checkbox: FormCheckbox,
3324
+ Switch: FormSwitch,
3325
+ RadioGroup: FormRadioGroup,
3326
+ // Partes auxiliares
3327
+ Label: FormLabel,
3328
+ Description: FormDescription,
3329
+ Error: FormError,
3330
+ FieldWrapper: FormFieldWrapper,
3331
+ Field: FormFieldProvider
3332
+ });
3333
+ var AuthLayoutContext = React36__namespace.createContext({
3334
+ imagePosition: "left"
3335
+ });
3336
+ function AuthLayoutRoot({ children, className }) {
3337
+ const [imagePosition, setImagePosition] = React36__namespace.useState("left");
3338
+ React36__namespace.useEffect(() => {
3339
+ React36__namespace.Children.forEach(children, (child) => {
3340
+ if (React36__namespace.isValidElement(child) && child.type === AuthLayoutImage) {
3341
+ setImagePosition(child.props.position || "left");
3342
+ }
3343
+ });
3344
+ }, [children]);
3345
+ return /* @__PURE__ */ jsxRuntime.jsx(AuthLayoutContext.Provider, { value: { imagePosition }, children: /* @__PURE__ */ jsxRuntime.jsx(
3346
+ "div",
3347
+ {
3348
+ className: cn(
3349
+ "min-h-screen flex flex-col xl:flex-row max-xl:justify-center",
3350
+ imagePosition === "right" && "xl:flex-row-reverse",
3351
+ className
3352
+ ),
3353
+ children
3354
+ }
3355
+ ) });
3356
+ }
3357
+ function AuthLayoutImage({
3358
+ src,
3359
+ alt,
3360
+ position: _position = "left",
3361
+ className,
3362
+ priority = true
3363
+ }) {
3364
+ return /* @__PURE__ */ jsxRuntime.jsx(
3365
+ "div",
3366
+ {
3367
+ className: cn(
3368
+ "hidden xl:block relative w-full xl:w-3/6 h-64 xl:h-screen overflow-hidden",
3369
+ className
3370
+ ),
3371
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3372
+ "img",
3373
+ {
3374
+ src,
3375
+ alt,
3376
+ className: "absolute inset-0 w-full h-full object-cover object-top",
3377
+ loading: priority ? "eager" : "lazy"
3378
+ }
3379
+ )
3380
+ }
3381
+ );
3382
+ }
3383
+ function AuthLayoutContent({
3384
+ children,
3385
+ className,
3386
+ maxWidth = "md"
3387
+ }) {
3388
+ const maxWidthClasses = {
3389
+ sm: "max-w-sm",
3390
+ md: "max-w-md",
3391
+ lg: "max-w-lg"
3392
+ };
3393
+ return /* @__PURE__ */ jsxRuntime.jsx(
3394
+ "div",
3395
+ {
3396
+ className: cn(
3397
+ "w-full lg:w-3/6 flex items-center justify-center p-6 pt-20 sm:pt-0 lg:p-12 bg-background mx-auto",
3398
+ className
3399
+ ),
3400
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full space-y-8", maxWidthClasses[maxWidth]), children })
3401
+ }
3402
+ );
3403
+ }
3404
+ function AuthLayoutHeader({
3405
+ children,
3406
+ className,
3407
+ logo,
3408
+ title,
3409
+ description,
3410
+ centered = true
3411
+ }) {
3412
+ if (children) {
3413
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", centered && "text-center", className), children });
3414
+ }
3415
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3416
+ "div",
3417
+ {
3418
+ className: cn(
3419
+ "flex flex-col gap-2",
3420
+ centered && "items-center text-center",
3421
+ className
3422
+ ),
3423
+ children: [
3424
+ logo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: logo }),
3425
+ title && /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold", children: title }),
3426
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-balance text-sm text-muted-foreground", children: description })
3427
+ ]
3428
+ }
3429
+ );
3430
+ }
3431
+ function AuthLayoutBody({ children, className }) {
3432
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-6", className), children });
3433
+ }
3434
+ function AuthLayoutFooter({ children, className }) {
3435
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("text-center text-sm text-muted-foreground", className), children });
3436
+ }
3437
+ function AuthLayoutLink({ children, className, ...props }) {
3438
+ return /* @__PURE__ */ jsxRuntime.jsx(
3439
+ "a",
3440
+ {
3441
+ className: cn(
3442
+ "text-sm text-primary hover:underline cursor-pointer",
3443
+ className
3444
+ ),
3445
+ ...props,
3446
+ children
3447
+ }
3448
+ );
3449
+ }
3450
+ function AuthLayoutDivider({ text = "ou", className }) {
3451
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", className), children: [
3452
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-full border-t" }) }),
3453
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex justify-center text-xs uppercase", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-background px-2 text-muted-foreground", children: text }) })
3454
+ ] });
3455
+ }
3456
+ AuthLayoutRoot.displayName = "AuthLayout";
3457
+ AuthLayoutImage.displayName = "AuthLayout.Image";
3458
+ AuthLayoutContent.displayName = "AuthLayout.Content";
3459
+ AuthLayoutHeader.displayName = "AuthLayout.Header";
3460
+ AuthLayoutBody.displayName = "AuthLayout.Body";
3461
+ AuthLayoutFooter.displayName = "AuthLayout.Footer";
3462
+ AuthLayoutLink.displayName = "AuthLayout.Link";
3463
+ AuthLayoutDivider.displayName = "AuthLayout.Divider";
3464
+ var AuthLayout = Object.assign(AuthLayoutRoot, {
3465
+ Image: AuthLayoutImage,
3466
+ Content: AuthLayoutContent,
3467
+ Header: AuthLayoutHeader,
3468
+ Body: AuthLayoutBody,
3469
+ Footer: AuthLayoutFooter,
3470
+ Link: AuthLayoutLink,
3471
+ Divider: AuthLayoutDivider
3472
+ });
3473
+ var TabsContext = React36__namespace.createContext(null);
3474
+ function SelectionLayoutRoot({ children, className }) {
3475
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-h-screen bg-muted/30 flex flex-col lg:flex-row", className), children });
3476
+ }
3477
+ function SelectionLayoutSidebar({ children, className }) {
3478
+ return /* @__PURE__ */ jsxRuntime.jsx(
3479
+ "div",
3480
+ {
3481
+ className: cn(
3482
+ "lg:w-2/5 bg-gradient-to-br from-primary/90 to-primary p-6 lg:p-12",
3483
+ "flex flex-col justify-between text-white relative overflow-hidden",
3484
+ "min-h-[50vh] lg:min-h-screen",
3485
+ className
3486
+ ),
3487
+ children
3488
+ }
3489
+ );
3490
+ }
3491
+ function SelectionLayoutLogo({ children, className }) {
3492
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-3 mb-8 lg:mb-16", className), children });
3493
+ }
3494
+ function SelectionLayoutHeadline({
3495
+ title,
3496
+ bullets,
3497
+ className
3498
+ }) {
3499
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4 lg:space-y-6 flex-1", className), children: [
3500
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl lg:text-5xl font-bold leading-tight", children: title }),
3501
+ bullets && bullets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2 text-white/80", children: bullets.map((bullet, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base lg:text-lg", children: bullet }, index)) })
3502
+ ] });
3503
+ }
3504
+ function SelectionLayoutStats({ label, value, className }) {
3505
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("bg-white/10 rounded-lg p-4 backdrop-blur-sm", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm lg:text-base", children: [
3506
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
3507
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: value })
3508
+ ] }) });
3509
+ }
3510
+ function SelectionLayoutMain({ children, className }) {
3511
+ return /* @__PURE__ */ jsxRuntime.jsx(
3512
+ "div",
3513
+ {
3514
+ className: cn(
3515
+ "lg:w-3/5 bg-background flex flex-col min-h-[50vh] lg:min-h-screen",
3516
+ className
3517
+ ),
3518
+ children
3519
+ }
3520
+ );
3521
+ }
3522
+ function SelectionLayoutHeader({
3523
+ title,
3524
+ subtitle,
3525
+ action,
3526
+ className
3527
+ }) {
3528
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3529
+ "div",
3530
+ {
3531
+ className: cn(
3532
+ "flex justify-between items-center p-6 lg:p-8 border-b border-border",
3533
+ className
3534
+ ),
3535
+ children: [
3536
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3537
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl lg:text-2xl font-bold", children: title }),
3538
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: subtitle })
3539
+ ] }),
3540
+ action && /* @__PURE__ */ jsxRuntime.jsx("div", { children: action })
3541
+ ]
3542
+ }
3543
+ );
3544
+ }
3545
+ function SelectionLayoutSearch({
3546
+ value,
3547
+ onChange,
3548
+ placeholder = "Buscar...",
3549
+ className
3550
+ }) {
3551
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-6 lg:p-8 pb-4 lg:pb-6", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3552
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
3553
+ /* @__PURE__ */ jsxRuntime.jsx(
3554
+ "input",
3555
+ {
3556
+ type: "text",
3557
+ placeholder,
3558
+ value,
3559
+ onChange: (e) => onChange(e.target.value),
3560
+ className: cn(
3561
+ "w-full pl-10 h-11 rounded-md border border-input bg-muted/50",
3562
+ "focus:bg-background focus:outline-none focus:ring-2 focus:ring-ring",
3563
+ "text-sm placeholder:text-muted-foreground"
3564
+ )
3565
+ }
3566
+ )
3567
+ ] }) });
3568
+ }
3569
+ function SelectionLayoutTabs({
3570
+ children,
3571
+ value,
3572
+ onValueChange,
3573
+ className
3574
+ }) {
3575
+ return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: { value, onValueChange }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 lg:px-8", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex space-x-1 bg-muted p-1 rounded-lg", children }) }) });
3576
+ }
3577
+ function SelectionLayoutTab({
3578
+ value,
3579
+ label,
3580
+ icon: Icon2,
3581
+ badge,
3582
+ className
3583
+ }) {
3584
+ const context = React36__namespace.useContext(TabsContext);
3585
+ if (!context) {
3586
+ throw new Error("SelectionLayout.Tab must be used within SelectionLayout.Tabs");
3587
+ }
3588
+ const isActive = context.value === value;
3589
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3590
+ "button",
3591
+ {
3592
+ onClick: () => context.onValueChange(value),
3593
+ className: cn(
3594
+ "flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-all",
3595
+ isActive ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
3596
+ className
3597
+ ),
3598
+ children: [
3599
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4" }),
3600
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: label }),
3601
+ badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3602
+ "span",
3603
+ {
3604
+ className: cn(
3605
+ "text-xs px-2 py-0.5 rounded-full",
3606
+ isActive ? "bg-primary/10 text-primary" : "bg-muted-foreground/20"
3607
+ ),
3608
+ children: badge
3609
+ }
3610
+ )
3611
+ ]
3612
+ }
3613
+ );
3614
+ }
3615
+ function SelectionLayoutList({ children, className }) {
3616
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 p-6 lg:p-8 pt-6", className), children: /* @__PURE__ */ jsxRuntime.jsx(
3617
+ "div",
3618
+ {
3619
+ className: cn(
3620
+ "space-y-3 max-h-[50vh] lg:max-h-[55vh] overflow-y-auto pr-2",
3621
+ "scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent"
3622
+ ),
3623
+ children
3624
+ }
3625
+ ) });
3626
+ }
3627
+ function SelectionLayoutCard({
3628
+ children,
3629
+ className,
3630
+ onClick,
3631
+ icon,
3632
+ title,
3633
+ description,
3634
+ badge,
3635
+ favorite,
3636
+ onFavoriteClick
3637
+ }) {
3638
+ const isIconComponent = typeof icon === "function" || icon && typeof icon === "object" && "$$typeof" in icon;
3639
+ const IconComponent = isIconComponent ? icon : null;
3640
+ return /* @__PURE__ */ jsxRuntime.jsx(
3641
+ "div",
3642
+ {
3643
+ onClick,
3644
+ className: cn(
3645
+ "cursor-pointer transition-all duration-200 rounded-lg border-2 bg-card",
3646
+ "hover:shadow-lg hover:border-primary/20 active:scale-[0.98] group",
3647
+ className
3648
+ ),
3649
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 lg:p-5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3650
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 lg:gap-4 flex-1 min-w-0", children: [
3651
+ icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-10 h-10 lg:w-12 lg:h-12 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0", children: IconComponent ? /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "w-5 h-5 lg:w-6 lg:h-6 text-primary" }) : icon }),
3652
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
3653
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
3654
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-sm lg:text-base truncate", children: title }),
3655
+ favorite && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Star, { className: "w-4 h-4 text-yellow-500 fill-current flex-shrink-0" }),
3656
+ badge
3657
+ ] }),
3658
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs lg:text-sm truncate", children: description }),
3659
+ children
3660
+ ] })
3661
+ ] }),
3662
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-shrink-0 ml-2", children: [
3663
+ onFavoriteClick && /* @__PURE__ */ jsxRuntime.jsx(
3664
+ "button",
3665
+ {
3666
+ onClick: (e) => {
3667
+ e.stopPropagation();
3668
+ onFavoriteClick();
3669
+ },
3670
+ className: "p-2 hover:bg-muted rounded-md transition-colors",
3671
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3672
+ lucideReact.Star,
3673
+ {
3674
+ className: cn(
3675
+ "w-4 h-4",
3676
+ favorite ? "text-yellow-500 fill-current" : "text-muted-foreground"
3677
+ )
3678
+ }
3679
+ )
3680
+ }
3681
+ ),
3682
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "w-5 h-5 text-muted-foreground group-hover:text-foreground transition-colors" })
3683
+ ] })
3684
+ ] }) })
3685
+ }
3686
+ );
3687
+ }
3688
+ function SelectionLayoutEmpty({
3689
+ icon: Icon2 = lucideReact.Building2,
3690
+ title,
3691
+ description,
3692
+ action,
3693
+ className
3694
+ }) {
3695
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("text-center py-12", className), children: [
3696
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-12 h-12 text-muted-foreground/50 mx-auto mb-4" }),
3697
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-medium mb-2", children: title }),
3698
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mb-4", children: description }),
3699
+ action
3700
+ ] });
3701
+ }
3702
+ SelectionLayoutRoot.displayName = "SelectionLayout";
3703
+ SelectionLayoutSidebar.displayName = "SelectionLayout.Sidebar";
3704
+ SelectionLayoutLogo.displayName = "SelectionLayout.Logo";
3705
+ SelectionLayoutHeadline.displayName = "SelectionLayout.Headline";
3706
+ SelectionLayoutStats.displayName = "SelectionLayout.Stats";
3707
+ SelectionLayoutMain.displayName = "SelectionLayout.Main";
3708
+ SelectionLayoutHeader.displayName = "SelectionLayout.Header";
3709
+ SelectionLayoutSearch.displayName = "SelectionLayout.Search";
3710
+ SelectionLayoutTabs.displayName = "SelectionLayout.Tabs";
3711
+ SelectionLayoutTab.displayName = "SelectionLayout.Tab";
3712
+ SelectionLayoutList.displayName = "SelectionLayout.List";
3713
+ SelectionLayoutCard.displayName = "SelectionLayout.Card";
3714
+ SelectionLayoutEmpty.displayName = "SelectionLayout.Empty";
3715
+ var SelectionLayout = Object.assign(SelectionLayoutRoot, {
3716
+ Sidebar: SelectionLayoutSidebar,
3717
+ Logo: SelectionLayoutLogo,
3718
+ Headline: SelectionLayoutHeadline,
3719
+ Stats: SelectionLayoutStats,
3720
+ Main: SelectionLayoutMain,
3721
+ Header: SelectionLayoutHeader,
3722
+ Search: SelectionLayoutSearch,
3723
+ Tabs: SelectionLayoutTabs,
3724
+ Tab: SelectionLayoutTab,
3725
+ List: SelectionLayoutList,
3726
+ Card: SelectionLayoutCard,
3727
+ Empty: SelectionLayoutEmpty
3728
+ });
3729
+ var DashboardLayoutContext = React36__namespace.createContext(null);
3730
+ function useDashboardLayout() {
3731
+ const context = React36__namespace.useContext(DashboardLayoutContext);
3732
+ if (!context) {
3733
+ throw new Error("useDashboardLayout must be used within DashboardLayout");
3734
+ }
3735
+ return context;
3736
+ }
3737
+ function useMediaQuery(query) {
3738
+ const [matches, setMatches] = React36__namespace.useState(false);
3739
+ React36__namespace.useEffect(() => {
3740
+ const media = window.matchMedia(query);
3741
+ if (media.matches !== matches) {
3742
+ setMatches(media.matches);
3743
+ }
3744
+ const listener = () => setMatches(media.matches);
3745
+ media.addEventListener("change", listener);
3746
+ return () => media.removeEventListener("change", listener);
3747
+ }, [matches, query]);
3748
+ return matches;
3749
+ }
3750
+ function DashboardLayoutRoot({
3751
+ children,
3752
+ className,
3753
+ defaultExpanded = false,
3754
+ defaultPinned = false
3755
+ }) {
3756
+ const [sidebarExpanded, setSidebarExpanded] = React36__namespace.useState(defaultExpanded);
3757
+ const [sidebarPinned, setSidebarPinned] = React36__namespace.useState(defaultPinned);
3758
+ const [mobileMenuOpen, setMobileMenuOpen] = React36__namespace.useState(false);
3759
+ const isMobile = useMediaQuery("(max-width: 1024px)");
3760
+ React36__namespace.useEffect(() => {
3761
+ if (!isMobile) {
3762
+ setMobileMenuOpen(false);
3763
+ }
3764
+ }, [isMobile]);
3765
+ const value = {
3766
+ sidebarExpanded,
3767
+ setSidebarExpanded,
3768
+ sidebarPinned,
3769
+ setSidebarPinned,
3770
+ isMobile,
3771
+ mobileMenuOpen,
3772
+ setMobileMenuOpen
3773
+ };
3774
+ return /* @__PURE__ */ jsxRuntime.jsx(DashboardLayoutContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-h-screen bg-muted/30 flex", className), children }) });
3775
+ }
3776
+ function DashboardLayoutSidebar({
3777
+ children,
3778
+ className,
3779
+ collapsedWidth = 64,
3780
+ expandedWidth = 256
3781
+ }) {
3782
+ const {
3783
+ sidebarExpanded,
3784
+ setSidebarExpanded,
3785
+ sidebarPinned,
3786
+ isMobile,
3787
+ mobileMenuOpen,
3788
+ setMobileMenuOpen
3789
+ } = useDashboardLayout();
3790
+ const handleMouseEnter = () => {
3791
+ if (!sidebarPinned && !isMobile) {
3792
+ setSidebarExpanded(true);
3793
+ }
3794
+ };
3795
+ const handleMouseLeave = () => {
3796
+ if (!sidebarPinned && !isMobile) {
3797
+ setSidebarExpanded(false);
3798
+ }
3799
+ };
3800
+ if (isMobile) {
3801
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3802
+ mobileMenuOpen && /* @__PURE__ */ jsxRuntime.jsx(
3803
+ "div",
3804
+ {
3805
+ className: "fixed inset-0 bg-black/50 z-40 lg:hidden",
3806
+ onClick: () => setMobileMenuOpen(false)
3807
+ }
3808
+ ),
3809
+ /* @__PURE__ */ jsxRuntime.jsx(
3810
+ "aside",
3811
+ {
3812
+ className: cn(
3813
+ "fixed top-0 left-0 h-full bg-card z-50 shadow-xl",
3814
+ "transform transition-transform duration-300 ease-in-out",
3815
+ mobileMenuOpen ? "translate-x-0" : "-translate-x-full",
3816
+ "w-[280px]",
3817
+ className
3818
+ ),
3819
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full", children: [
3820
+ /* @__PURE__ */ jsxRuntime.jsx(
3821
+ "button",
3822
+ {
3823
+ onClick: () => setMobileMenuOpen(false),
3824
+ className: "absolute top-4 right-4 p-2 hover:bg-muted rounded-md",
3825
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-5 h-5" })
3826
+ }
3827
+ ),
3828
+ children
3829
+ ] })
3830
+ }
3831
+ )
3832
+ ] });
3833
+ }
3834
+ return /* @__PURE__ */ jsxRuntime.jsx(
3835
+ "aside",
3836
+ {
3837
+ onMouseEnter: handleMouseEnter,
3838
+ onMouseLeave: handleMouseLeave,
3839
+ style: {
3840
+ width: sidebarExpanded ? expandedWidth : collapsedWidth
3841
+ },
3842
+ className: cn(
3843
+ "fixed top-0 left-0 h-screen bg-card z-40",
3844
+ "flex flex-col shadow-[0_0_20px_rgba(0,0,0,0.06)]",
3845
+ "transition-[width] duration-300 ease-in-out",
3846
+ className
3847
+ ),
3848
+ children
3849
+ }
3850
+ );
3851
+ }
3852
+ function DashboardLayoutSidebarHeader({
3853
+ children,
3854
+ className,
3855
+ logo,
3856
+ collapsedLogo,
3857
+ title
3858
+ }) {
3859
+ const { sidebarExpanded, sidebarPinned, setSidebarPinned, isMobile } = useDashboardLayout();
3860
+ if (children) {
3861
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-4 border-b border-border", className), children });
3862
+ }
3863
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-4 border-b border-border", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3864
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
3865
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0", children: sidebarExpanded ? logo : collapsedLogo || logo }),
3866
+ sidebarExpanded && title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-lg truncate", children: title })
3867
+ ] }),
3868
+ sidebarExpanded && !isMobile && /* @__PURE__ */ jsxRuntime.jsx(
3869
+ "button",
3870
+ {
3871
+ onClick: () => setSidebarPinned(!sidebarPinned),
3872
+ className: "p-1.5 hover:bg-muted rounded-md transition-colors",
3873
+ title: sidebarPinned ? "Unpin sidebar" : "Pin sidebar",
3874
+ children: sidebarPinned ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PinOff, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pin, { className: "w-4 h-4 text-muted-foreground" })
3875
+ }
3876
+ )
3877
+ ] }) });
3878
+ }
3879
+ function DashboardLayoutSidebarNav({ children, className }) {
3880
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: cn("flex-1 overflow-y-auto overflow-x-hidden py-2", className), children });
3881
+ }
3882
+ function DashboardLayoutSidebarNavItem({
3883
+ icon,
3884
+ label,
3885
+ href,
3886
+ onClick,
3887
+ isActive,
3888
+ badge,
3889
+ badgeVariant = "default",
3890
+ className,
3891
+ disabled
3892
+ }) {
3893
+ const { sidebarExpanded } = useDashboardLayout();
3894
+ const badgeColors = {
3895
+ default: "bg-muted text-muted-foreground",
3896
+ primary: "bg-primary/10 text-primary",
3897
+ destructive: "bg-destructive/10 text-destructive"
3898
+ };
3899
+ const renderIcon = () => {
3900
+ if (!icon) return null;
3901
+ if (React36__namespace.isValidElement(icon)) {
3902
+ return icon;
3903
+ }
3904
+ if (typeof icon === "function" || typeof icon === "object" && "$$typeof" in icon) {
3905
+ const IconComponent = icon;
3906
+ return /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "w-5 h-5 flex-shrink-0" });
3907
+ }
3908
+ return null;
3909
+ };
3910
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(
3911
+ "div",
3912
+ {
3913
+ className: cn(
3914
+ "flex items-center gap-3 px-3 py-2.5 mx-2 rounded-md transition-colors",
3915
+ "hover:bg-muted cursor-pointer",
3916
+ isActive && "bg-primary/10 text-primary hover:bg-primary/15",
3917
+ disabled && "opacity-50 cursor-not-allowed pointer-events-none",
3918
+ className
3919
+ ),
3920
+ onClick: disabled ? void 0 : onClick,
3921
+ children: [
3922
+ renderIcon(),
3923
+ sidebarExpanded && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3924
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-sm", children: label }),
3925
+ badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3926
+ "span",
3927
+ {
3928
+ className: cn(
3929
+ "text-xs px-2 py-0.5 rounded-full",
3930
+ badgeColors[badgeVariant]
3931
+ ),
3932
+ children: badge
3933
+ }
3934
+ )
3935
+ ] }),
3936
+ !sidebarExpanded && badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute top-1 right-1 w-2 h-2 bg-primary rounded-full" })
3937
+ ]
3938
+ }
3939
+ );
3940
+ if (href && !disabled) {
3941
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: "block relative", children: content });
3942
+ }
3943
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: content });
3944
+ }
3945
+ function DashboardLayoutSidebarNavGroup({
3946
+ icon,
3947
+ label,
3948
+ children,
3949
+ defaultOpen = false,
3950
+ isActive,
3951
+ badge,
3952
+ badgeVariant = "default",
3953
+ className
3954
+ }) {
3955
+ const { sidebarExpanded } = useDashboardLayout();
3956
+ const [isOpen, setIsOpen] = React36__namespace.useState(defaultOpen);
3957
+ const badgeColors = {
3958
+ default: "bg-muted text-muted-foreground",
3959
+ primary: "bg-primary/10 text-primary",
3960
+ destructive: "bg-destructive/10 text-destructive"
3961
+ };
3962
+ const renderIcon = () => {
3963
+ if (!icon) return null;
3964
+ if (React36__namespace.isValidElement(icon)) {
3965
+ return icon;
3966
+ }
3967
+ if (typeof icon === "function" || typeof icon === "object" && "$$typeof" in icon) {
3968
+ const IconComponent = icon;
3969
+ return /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "w-5 h-5 flex-shrink-0" });
3970
+ }
3971
+ return null;
3972
+ };
3973
+ React36__namespace.useEffect(() => {
3974
+ if (isActive && sidebarExpanded) {
3975
+ setIsOpen(true);
3976
+ }
3977
+ }, [isActive, sidebarExpanded]);
3978
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
3979
+ /* @__PURE__ */ jsxRuntime.jsxs(
3980
+ "div",
3981
+ {
3982
+ onClick: () => sidebarExpanded && setIsOpen(!isOpen),
3983
+ className: cn(
3984
+ "flex items-center gap-3 px-3 py-2.5 mx-2 rounded-md transition-colors",
3985
+ "hover:bg-muted cursor-pointer",
3986
+ isActive && "text-primary"
3987
+ ),
3988
+ children: [
3989
+ renderIcon(),
3990
+ sidebarExpanded && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3991
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-sm", children: label }),
3992
+ badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3993
+ "span",
3994
+ {
3995
+ className: cn(
3996
+ "text-xs px-2 py-0.5 rounded-full",
3997
+ badgeColors[badgeVariant]
3998
+ ),
3999
+ children: badge
4000
+ }
4001
+ ),
4002
+ isOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-muted-foreground" })
4003
+ ] })
4004
+ ]
4005
+ }
4006
+ ),
4007
+ sidebarExpanded && isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4 mt-1 space-y-0.5", children })
4008
+ ] });
4009
+ }
4010
+ function DashboardLayoutSidebarSection({
4011
+ title,
4012
+ children,
4013
+ className
4014
+ }) {
4015
+ const { sidebarExpanded } = useDashboardLayout();
4016
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mb-2", className), children: [
4017
+ title && sidebarExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-5 py-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground", children: title }) }),
4018
+ children
4019
+ ] });
4020
+ }
4021
+ function DashboardLayoutSidebarFooter({ children, className }) {
4022
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("p-4 border-t border-border mt-auto", className), children });
4023
+ }
4024
+ function DashboardLayoutHeader({ children, className }) {
4025
+ const { isMobile, setMobileMenuOpen, sidebarPinned } = useDashboardLayout();
4026
+ const marginLeft = isMobile ? 0 : sidebarPinned ? 256 : 64;
4027
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4028
+ "header",
4029
+ {
4030
+ style: { marginLeft },
4031
+ className: cn(
4032
+ "h-16 bg-background border-b border-border",
4033
+ "flex items-center px-4 lg:px-6",
4034
+ "sticky top-0 z-30",
4035
+ !isMobile && "transition-[margin-left] duration-300",
4036
+ className
4037
+ ),
4038
+ children: [
4039
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(
4040
+ "button",
4041
+ {
4042
+ onClick: () => setMobileMenuOpen(true),
4043
+ className: "p-2 hover:bg-muted rounded-md mr-2",
4044
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "w-5 h-5" })
4045
+ }
4046
+ ),
4047
+ children
4048
+ ]
4049
+ }
4050
+ );
4051
+ }
4052
+ function DashboardLayoutHeaderTitle({
4053
+ children,
4054
+ className,
4055
+ title,
4056
+ subtitle
4057
+ }) {
4058
+ if (children) {
4059
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1", className), children });
4060
+ }
4061
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex-1 min-w-0", className), children: [
4062
+ title && /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-semibold text-lg truncate", children: title }),
4063
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground truncate", children: subtitle })
4064
+ ] });
4065
+ }
4066
+ function DashboardLayoutHeaderActions({ children, className }) {
4067
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center gap-2", className), children });
4068
+ }
4069
+ function DashboardLayoutHeaderUser({
4070
+ name,
4071
+ email,
4072
+ avatar,
4073
+ className,
4074
+ children,
4075
+ onLogout
4076
+ }) {
4077
+ const [isOpen, setIsOpen] = React36__namespace.useState(false);
4078
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative", className), children: [
4079
+ /* @__PURE__ */ jsxRuntime.jsxs(
4080
+ "button",
4081
+ {
4082
+ onClick: () => setIsOpen(!isOpen),
4083
+ className: "flex items-center gap-2 p-1.5 hover:bg-muted rounded-md transition-colors",
4084
+ children: [
4085
+ avatar ? /* @__PURE__ */ jsxRuntime.jsx(
4086
+ "img",
4087
+ {
4088
+ src: avatar,
4089
+ alt: name,
4090
+ className: "w-8 h-8 rounded-full object-cover"
4091
+ }
4092
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "w-4 h-4 text-primary" }) }),
4093
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden sm:block text-left", children: [
4094
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate max-w-[120px]", children: name }),
4095
+ email && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate max-w-[120px]", children: email })
4096
+ ] }),
4097
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-4 h-4 text-muted-foreground hidden sm:block" })
4098
+ ]
4099
+ }
4100
+ ),
4101
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4102
+ /* @__PURE__ */ jsxRuntime.jsx(
4103
+ "div",
4104
+ {
4105
+ className: "fixed inset-0 z-40",
4106
+ onClick: () => setIsOpen(false)
4107
+ }
4108
+ ),
4109
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute right-0 top-full mt-1 w-56 bg-card border border-border rounded-md shadow-lg z-50", children: [
4110
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 border-b border-border", children: [
4111
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium truncate", children: name }),
4112
+ email && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground truncate", children: email })
4113
+ ] }),
4114
+ children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1", children }),
4115
+ onLogout && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1 border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsxs(
4116
+ "button",
4117
+ {
4118
+ onClick: () => {
4119
+ setIsOpen(false);
4120
+ onLogout();
4121
+ },
4122
+ className: "flex items-center gap-2 w-full px-3 py-2 text-sm hover:bg-muted rounded-md transition-colors text-destructive",
4123
+ children: [
4124
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "w-4 h-4" }),
4125
+ "Sair"
4126
+ ]
4127
+ }
4128
+ ) })
4129
+ ] })
4130
+ ] })
4131
+ ] });
4132
+ }
4133
+ function DashboardLayoutContent({ children, className }) {
4134
+ const { isMobile, sidebarPinned } = useDashboardLayout();
4135
+ const marginLeft = isMobile ? 0 : sidebarPinned ? 256 : 64;
4136
+ return /* @__PURE__ */ jsxRuntime.jsx(
4137
+ "main",
4138
+ {
4139
+ style: { marginLeft },
4140
+ className: cn(
4141
+ "flex-1 flex flex-col min-h-screen",
4142
+ "transition-[margin-left] duration-300",
4143
+ className
4144
+ ),
4145
+ children
4146
+ }
4147
+ );
4148
+ }
4149
+ function DashboardLayoutBreadcrumbs({
4150
+ items,
4151
+ className,
4152
+ separator
4153
+ }) {
4154
+ const defaultSeparator = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-muted-foreground" });
4155
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: cn("flex items-center gap-1 text-sm", className), children: items.map((item, index) => {
4156
+ const Icon2 = item.icon;
4157
+ const isLast = index === items.length - 1;
4158
+ return /* @__PURE__ */ jsxRuntime.jsxs(React36__namespace.Fragment, { children: [
4159
+ item.href && !isLast ? /* @__PURE__ */ jsxRuntime.jsxs(
4160
+ "a",
4161
+ {
4162
+ href: item.href,
4163
+ className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
4164
+ children: [
4165
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4" }),
4166
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
4167
+ ]
4168
+ }
4169
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
4170
+ "span",
4171
+ {
4172
+ className: cn(
4173
+ "flex items-center gap-1",
4174
+ isLast ? "text-foreground font-medium" : "text-muted-foreground"
4175
+ ),
4176
+ children: [
4177
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4" }),
4178
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
4179
+ ]
4180
+ }
4181
+ ),
4182
+ !isLast && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mx-1", children: separator || defaultSeparator })
4183
+ ] }, index);
4184
+ }) });
4185
+ }
4186
+ function DashboardLayoutMobileNav({ children, className }) {
4187
+ return /* @__PURE__ */ jsxRuntime.jsx(
4188
+ "nav",
4189
+ {
4190
+ className: cn(
4191
+ "fixed bottom-0 left-0 right-0 h-16 bg-card border-t border-border",
4192
+ "flex items-center justify-around px-2 z-50 lg:hidden",
4193
+ className
4194
+ ),
4195
+ children
4196
+ }
4197
+ );
4198
+ }
4199
+ function DashboardLayoutMobileNavItem({
4200
+ icon: Icon2,
4201
+ label,
4202
+ href,
4203
+ onClick,
4204
+ isActive,
4205
+ badge
4206
+ }) {
4207
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(
4208
+ "div",
4209
+ {
4210
+ className: cn(
4211
+ "flex flex-col items-center gap-1 p-2 rounded-md transition-colors relative",
4212
+ "hover:bg-muted",
4213
+ isActive && "text-primary"
4214
+ ),
4215
+ onClick,
4216
+ children: [
4217
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-5 h-5" }),
4218
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px]", children: label }),
4219
+ badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -top-1 -right-1 min-w-[18px] h-[18px] flex items-center justify-center text-[10px] font-medium bg-destructive text-destructive-foreground rounded-full px-1", children: badge })
4220
+ ]
4221
+ }
4222
+ );
4223
+ if (href) {
4224
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, children: content });
4225
+ }
4226
+ return content;
4227
+ }
4228
+ DashboardLayoutRoot.displayName = "DashboardLayout";
4229
+ DashboardLayoutSidebar.displayName = "DashboardLayout.Sidebar";
4230
+ DashboardLayoutSidebarHeader.displayName = "DashboardLayout.SidebarHeader";
4231
+ DashboardLayoutSidebarNav.displayName = "DashboardLayout.SidebarNav";
4232
+ DashboardLayoutSidebarNavItem.displayName = "DashboardLayout.SidebarNavItem";
4233
+ DashboardLayoutSidebarNavGroup.displayName = "DashboardLayout.SidebarNavGroup";
4234
+ DashboardLayoutSidebarSection.displayName = "DashboardLayout.SidebarSection";
4235
+ DashboardLayoutSidebarFooter.displayName = "DashboardLayout.SidebarFooter";
4236
+ DashboardLayoutHeader.displayName = "DashboardLayout.Header";
4237
+ DashboardLayoutHeaderTitle.displayName = "DashboardLayout.HeaderTitle";
4238
+ DashboardLayoutHeaderActions.displayName = "DashboardLayout.HeaderActions";
4239
+ DashboardLayoutHeaderUser.displayName = "DashboardLayout.HeaderUser";
4240
+ DashboardLayoutContent.displayName = "DashboardLayout.Content";
4241
+ DashboardLayoutBreadcrumbs.displayName = "DashboardLayout.Breadcrumbs";
4242
+ DashboardLayoutMobileNav.displayName = "DashboardLayout.MobileNav";
4243
+ DashboardLayoutMobileNavItem.displayName = "DashboardLayout.MobileNavItem";
4244
+ var DashboardLayout = Object.assign(DashboardLayoutRoot, {
4245
+ Sidebar: DashboardLayoutSidebar,
4246
+ SidebarHeader: DashboardLayoutSidebarHeader,
4247
+ SidebarNav: DashboardLayoutSidebarNav,
4248
+ SidebarNavItem: DashboardLayoutSidebarNavItem,
4249
+ SidebarNavGroup: DashboardLayoutSidebarNavGroup,
4250
+ SidebarSection: DashboardLayoutSidebarSection,
4251
+ SidebarFooter: DashboardLayoutSidebarFooter,
4252
+ Header: DashboardLayoutHeader,
4253
+ HeaderTitle: DashboardLayoutHeaderTitle,
4254
+ HeaderActions: DashboardLayoutHeaderActions,
4255
+ HeaderUser: DashboardLayoutHeaderUser,
4256
+ Content: DashboardLayoutContent,
4257
+ Breadcrumbs: DashboardLayoutBreadcrumbs,
4258
+ MobileNav: DashboardLayoutMobileNav,
4259
+ MobileNavItem: DashboardLayoutMobileNavItem
4260
+ });
4261
+ var initialState = {
4262
+ theme: "system",
4263
+ setTheme: () => null
4264
+ };
4265
+ var ThemeProviderContext = React36__namespace.createContext(initialState);
4266
+ function ThemeProvider({
4267
+ children,
4268
+ defaultTheme = "system",
4269
+ storageKey = "facter-ds-theme",
4270
+ ...props
4271
+ }) {
4272
+ const [theme, setTheme] = React36__namespace.useState(
4273
+ () => localStorage.getItem(storageKey) || defaultTheme
4274
+ );
4275
+ const [resolvedTheme, setResolvedTheme] = React36__namespace.useState("light");
4276
+ React36__namespace.useEffect(() => {
4277
+ const root = window.document.documentElement;
4278
+ root.classList.remove("light", "dark");
4279
+ if (theme === "system") {
4280
+ const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
4281
+ root.classList.add(systemTheme);
4282
+ setResolvedTheme(systemTheme);
4283
+ return;
4284
+ }
4285
+ root.classList.add(theme);
4286
+ setResolvedTheme(theme);
4287
+ }, [theme]);
4288
+ const value = React36__namespace.useMemo(
4289
+ () => ({
4290
+ theme,
4291
+ setTheme: (theme2) => {
4292
+ localStorage.setItem(storageKey, theme2);
4293
+ setTheme(theme2);
4294
+ }
4295
+ }),
4296
+ [theme, storageKey]
4297
+ );
4298
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeProviderContext.Provider, { ...props, value, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: resolvedTheme, style: { minHeight: "100vh" }, children }) });
4299
+ }
4300
+ var useTheme = () => {
4301
+ const context = React36__namespace.useContext(ThemeProviderContext);
4302
+ if (context === void 0)
4303
+ throw new Error("useTheme must be used within a ThemeProvider");
4304
+ return context;
4305
+ };
4306
+
4307
+ Object.defineProperty(exports, "flexRender", {
4308
+ enumerable: true,
4309
+ get: function () { return reactTable.flexRender; }
4310
+ });
4311
+ exports.AuthLayout = AuthLayout;
465
4312
  exports.Badge = Badge;
466
4313
  exports.Button = Button;
4314
+ exports.Checkbox = Checkbox;
4315
+ exports.DENSITY_CONFIG = DENSITY_CONFIG;
4316
+ exports.DashboardLayout = DashboardLayout;
4317
+ exports.DataTable = DataTable;
4318
+ exports.Dialog = Dialog;
4319
+ exports.DialogBody = DialogBody;
4320
+ exports.DialogClose = DialogClose;
4321
+ exports.DialogContent = DialogContent;
4322
+ exports.DialogDescription = DialogDescription;
4323
+ exports.DialogFooter = DialogFooter;
4324
+ exports.DialogHeader = DialogHeader;
4325
+ exports.DialogOverlay = DialogOverlay;
4326
+ exports.DialogPortal = DialogPortal;
4327
+ exports.DialogTitle = DialogTitle;
4328
+ exports.DialogTrigger = DialogTrigger;
4329
+ exports.DialogWrapper = DialogWrapper;
4330
+ exports.EmptyState = EmptyState;
4331
+ exports.Form = Form;
4332
+ exports.FormCheckbox = FormCheckbox;
4333
+ exports.FormDescription = FormDescription;
4334
+ exports.FormError = FormError;
4335
+ exports.FormFieldProvider = FormFieldProvider;
4336
+ exports.FormFieldWrapper = FormFieldWrapper;
4337
+ exports.FormInput = FormInput;
4338
+ exports.FormLabel = FormLabel;
4339
+ exports.FormProvider = FormProvider;
4340
+ exports.FormRadioGroup = FormRadioGroup;
4341
+ exports.FormSelect = FormSelect;
4342
+ exports.FormSwitch = FormSwitch;
4343
+ exports.FormTextarea = FormTextarea;
467
4344
  exports.GlobalLoaderController = GlobalLoaderController;
468
4345
  exports.Input = Input;
469
4346
  exports.Loader = Loader;
470
4347
  exports.LoaderProvider = LoaderProvider;
4348
+ exports.RippleBackground = RippleBackground;
4349
+ exports.RippleEffect = RippleEffect;
4350
+ exports.RippleWrapper = RippleWrapper;
4351
+ exports.Select = Select;
4352
+ exports.SelectGroup = SelectGroup;
4353
+ exports.SelectItem = SelectItem;
4354
+ exports.SelectLabel = SelectLabel;
4355
+ exports.SelectSeparator = SelectSeparator;
4356
+ exports.SelectionLayout = SelectionLayout;
4357
+ exports.Switch = Switch;
4358
+ exports.Table = Table;
4359
+ exports.TableBody = TableBody;
4360
+ exports.TableCaption = TableCaption;
4361
+ exports.TableCell = TableCell;
4362
+ exports.TableFooter = TableFooter;
4363
+ exports.TableHead = TableHead;
4364
+ exports.TableHeader = TableHeader;
4365
+ exports.TableRow = TableRow;
4366
+ exports.Tabs = Tabs;
4367
+ exports.TabsContent = TabsContent;
4368
+ exports.TabsList = TabsList;
4369
+ exports.TabsTrigger = TabsTrigger;
4370
+ exports.Textarea = Textarea;
4371
+ exports.ThemeProvider = ThemeProvider;
4372
+ exports.Toaster = Toaster;
471
4373
  exports.cn = cn;
472
4374
  exports.loader = loader;
4375
+ exports.toast = toast;
4376
+ exports.useDashboardLayout = useDashboardLayout;
4377
+ exports.useDataTable = useDataTable;
4378
+ exports.useDataTableColumnVisibility = useDataTableColumnVisibility;
4379
+ exports.useDataTableDensity = useDataTableDensity;
4380
+ exports.useDataTableEmpty = useDataTableEmpty;
4381
+ exports.useDataTableInstance = useDataTableInstance;
4382
+ exports.useDataTableLoading = useDataTableLoading;
4383
+ exports.useDataTableMeta = useDataTableMeta;
4384
+ exports.useDataTablePagination = useDataTablePagination;
4385
+ exports.useDataTableSelection = useDataTableSelection;
4386
+ exports.useDataTableSorting = useDataTableSorting;
4387
+ exports.useDataTableState = useDataTableState;
4388
+ exports.useDebounce = useDebounce;
4389
+ exports.useDebouncedCallback = useDebouncedCallback;
4390
+ exports.useFormContext = useFormContext;
4391
+ exports.useFormFieldContext = useFormFieldContext;
473
4392
  exports.useLoader = useLoader;
4393
+ exports.useTheme = useTheme;
474
4394
  //# sourceMappingURL=index.js.map
475
4395
  //# sourceMappingURL=index.js.map