eai-frontend-components 2.0.4 → 2.0.6

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.
Files changed (103) hide show
  1. package/README.md +14 -14
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/package.json +4 -4
  5. package/src/components/ui/accordion.tsx +0 -48
  6. package/src/components/ui/alert-dialog.tsx +0 -138
  7. package/src/components/ui/alert.tsx +0 -36
  8. package/src/components/ui/avatar.tsx +0 -48
  9. package/src/components/ui/badge.tsx +0 -35
  10. package/src/components/ui/breadcrumb.tsx +0 -115
  11. package/src/components/ui/button.tsx +0 -43
  12. package/src/components/ui/calendar.tsx +0 -142
  13. package/src/components/ui/card.tsx +0 -35
  14. package/src/components/ui/carousel.tsx +0 -257
  15. package/src/components/ui/chart.tsx +0 -364
  16. package/src/components/ui/checkbox.tsx +0 -26
  17. package/src/components/ui/collapsible.tsx +0 -9
  18. package/src/components/ui/command.tsx +0 -145
  19. package/src/components/ui/context-menu.tsx +0 -198
  20. package/src/components/ui/custom/date-picker.tsx +0 -97
  21. package/src/components/ui/custom/form/checkbox.tsx +0 -53
  22. package/src/components/ui/custom/form/color.tsx +0 -140
  23. package/src/components/ui/custom/form/combobox.tsx +0 -259
  24. package/src/components/ui/custom/form/cpf-cnpj.tsx +0 -85
  25. package/src/components/ui/custom/form/currency.tsx +0 -51
  26. package/src/components/ui/custom/form/date-range.tsx +0 -110
  27. package/src/components/ui/custom/form/date.tsx +0 -109
  28. package/src/components/ui/custom/form/decimal.tsx +0 -50
  29. package/src/components/ui/custom/form/file.tsx +0 -65
  30. package/src/components/ui/custom/form/form-help-text.tsx +0 -20
  31. package/src/components/ui/custom/form/form-label.tsx +0 -24
  32. package/src/components/ui/custom/form/form-message.tsx +0 -10
  33. package/src/components/ui/custom/form/ghost.tsx +0 -28
  34. package/src/components/ui/custom/form/input.tsx +0 -69
  35. package/src/components/ui/custom/form/mask.tsx +0 -78
  36. package/src/components/ui/custom/form/multi-select.tsx +0 -209
  37. package/src/components/ui/custom/form/password.tsx +0 -70
  38. package/src/components/ui/custom/form/percent.tsx +0 -52
  39. package/src/components/ui/custom/form/phone.tsx +0 -79
  40. package/src/components/ui/custom/form/radio-group.tsx +0 -94
  41. package/src/components/ui/custom/form/select.tsx +0 -62
  42. package/src/components/ui/custom/form/step-new-form.tsx +0 -49
  43. package/src/components/ui/custom/form/switch.tsx +0 -51
  44. package/src/components/ui/custom/form/text.tsx +0 -71
  45. package/src/components/ui/custom/form/textarea.tsx +0 -71
  46. package/src/components/ui/custom/form/utils.ts +0 -100
  47. package/src/components/ui/custom/header.tsx +0 -128
  48. package/src/components/ui/custom/label.tsx +0 -79
  49. package/src/components/ui/custom/not-found.tsx +0 -30
  50. package/src/components/ui/custom/sidebar/module-switcher.tsx +0 -58
  51. package/src/components/ui/custom/sidebar/nav-footer.tsx +0 -35
  52. package/src/components/ui/custom/sidebar/nav-main.tsx +0 -64
  53. package/src/components/ui/custom/sidebar/nav-submenu-collapsible.tsx +0 -60
  54. package/src/components/ui/custom/sidebar/nav-submenu-dropdown.tsx +0 -56
  55. package/src/components/ui/custom/sidebar/nav-user.tsx +0 -77
  56. package/src/components/ui/custom/sidebar/sidebar-button.tsx +0 -30
  57. package/src/components/ui/custom/sidebar/sidebar-item-two-lines.tsx +0 -25
  58. package/src/components/ui/custom/sidebar/sidebar-item.tsx +0 -19
  59. package/src/components/ui/custom/sidebar/types/sidebar.ts +0 -31
  60. package/src/components/ui/custom/table/data-table-export.tsx +0 -126
  61. package/src/components/ui/custom/table/data-table-footer.tsx +0 -148
  62. package/src/components/ui/custom/table/data-table-header.tsx +0 -58
  63. package/src/components/ui/custom/table/data-table-rows.tsx +0 -94
  64. package/src/components/ui/custom/table/data-table.tsx +0 -285
  65. package/src/components/ui/custom/table/types/data-table.ts +0 -31
  66. package/src/components/ui/custom/theme-provider.tsx +0 -121
  67. package/src/components/ui/dateRangePicker.tsx +0 -63
  68. package/src/components/ui/dialog.tsx +0 -84
  69. package/src/components/ui/drawer.tsx +0 -116
  70. package/src/components/ui/dropdown-menu.tsx +0 -173
  71. package/src/components/ui/form.tsx +0 -114
  72. package/src/components/ui/hover-card.tsx +0 -27
  73. package/src/components/ui/input.tsx +0 -265
  74. package/src/components/ui/label.tsx +0 -15
  75. package/src/components/ui/masks.ts +0 -35
  76. package/src/components/ui/pagination.tsx +0 -78
  77. package/src/components/ui/popover.tsx +0 -32
  78. package/src/components/ui/progress.tsx +0 -22
  79. package/src/components/ui/radio-group.tsx +0 -36
  80. package/src/components/ui/scroll-area.tsx +0 -46
  81. package/src/components/ui/select.tsx +0 -130
  82. package/src/components/ui/separator.tsx +0 -29
  83. package/src/components/ui/sheet.tsx +0 -90
  84. package/src/components/ui/sidebar.tsx +0 -598
  85. package/src/components/ui/skeleton.tsx +0 -15
  86. package/src/components/ui/slider.tsx +0 -18
  87. package/src/components/ui/switch.tsx +0 -26
  88. package/src/components/ui/table.tsx +0 -53
  89. package/src/components/ui/tabs.tsx +0 -47
  90. package/src/components/ui/textarea.tsx +0 -27
  91. package/src/components/ui/toast.tsx +0 -88
  92. package/src/components/ui/toaster.tsx +0 -49
  93. package/src/components/ui/tooltip.tsx +0 -31
  94. package/src/components/ui/use-calendar.tsx +0 -61
  95. package/src/components/ui/use-toast.ts +0 -186
  96. package/src/hooks/use-mobile.tsx +0 -19
  97. package/src/index.ts +0 -299
  98. package/src/lib/help/date-utils.ts +0 -41
  99. package/src/lib/help/format.ts +0 -171
  100. package/src/lib/help/theme.ts +0 -346
  101. package/src/lib/help/uuid.ts +0 -4
  102. package/src/lib/utils.ts +0 -6
  103. package/src/styles/globals.css +0 -59
@@ -1,53 +0,0 @@
1
- import * as React from 'react';
2
- import { cn } from '../../lib/utils';
3
-
4
- const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(({ className, ...props }, ref) => (
5
- <table ref={ref} className={cn('w-full caption-bottom text-sm', className)} {...props} />
6
- ));
7
- Table.displayName = 'Table';
8
-
9
- const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(({ className, ...props }, ref) => (
10
- <thead ref={ref} className={cn('sticky top-0 [&_tr]:border-b', className)} {...props} />
11
- ));
12
- TableHeader.displayName = 'TableHeader';
13
-
14
- const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(({ className, ...props }, ref) => (
15
- <tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />
16
- ));
17
- TableBody.displayName = 'TableBody';
18
-
19
- const TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(({ className, ...props }, ref) => (
20
- <tfoot ref={ref} className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)} {...props} />
21
- ));
22
- TableFooter.displayName = 'TableFooter';
23
-
24
- const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(({ className, ...props }, ref) => (
25
- <tr
26
- ref={ref}
27
- className={cn('border-b transition-colors hover:bg-datatable-accent', 'data-[state=selected]:bg-background-secondary', className)}
28
- {...props}
29
- />
30
- ));
31
- TableRow.displayName = 'TableRow';
32
-
33
- const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(({ className, ...props }, ref) => (
34
- <th
35
- ref={ref}
36
- className={cn('h-12 py-[12.25px] px-6 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0', className)}
37
- {...props}
38
- />
39
- ));
40
- TableHead.displayName = 'TableHead';
41
-
42
- const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(({ className, ...props }, ref) => (
43
- <td ref={ref} className={cn('align-middle px-6 [&:has([role=checkbox])]:pr-0', className)} {...props} />
44
- ));
45
- TableCell.displayName = 'TableCell';
46
-
47
- const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(({ className, ...props }, ref) => (
48
- <caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />
49
- ));
50
- TableCaption.displayName = 'TableCaption';
51
-
52
- export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
53
-
@@ -1,47 +0,0 @@
1
- import * as TabsPrimitive from '@radix-ui/react-tabs';
2
- import * as React from 'react';
3
- import { cn } from '../../lib/utils';
4
-
5
- const Tabs = TabsPrimitive.Root;
6
-
7
- const TabsList = React.forwardRef<React.ElementRef<typeof TabsPrimitive.List>, React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>>(
8
- ({ className, ...props }, ref) => (
9
- <TabsPrimitive.List
10
- ref={ref}
11
- className={cn('inline-flex h-10 items-center justify-center rounded-md bg-background-elevated p-1 text-muted-foreground', className)}
12
- {...props}
13
- />
14
- ),
15
- );
16
- TabsList.displayName = TabsPrimitive.List.displayName;
17
-
18
- const TabsTrigger = React.forwardRef<React.ElementRef<typeof TabsPrimitive.Trigger>, React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>>(
19
- ({ className, ...props }, ref) => (
20
- <TabsPrimitive.Trigger
21
- ref={ref}
22
- className={cn(
23
- 'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
24
- className,
25
- )}
26
- {...props}
27
- />
28
- ),
29
- );
30
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
31
-
32
- const TabsContent = React.forwardRef<React.ElementRef<typeof TabsPrimitive.Content>, React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>>(
33
- ({ className, ...props }, ref) => (
34
- <TabsPrimitive.Content
35
- ref={ref}
36
- className={cn(
37
- 'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
38
- className,
39
- )}
40
- {...props}
41
- />
42
- ),
43
- );
44
- TabsContent.displayName = TabsPrimitive.Content.displayName;
45
-
46
- export { Tabs, TabsContent, TabsList, TabsTrigger };
47
-
@@ -1,27 +0,0 @@
1
- import * as React from 'react';
2
- import { cn } from '../../lib/utils';
3
-
4
- function classBorderColor(className: string | undefined, ariaInvalid: boolean | undefined) {
5
- if (className?.includes('border-none')) {
6
- return '';
7
- }
8
- return ariaInvalid ? 'border-red-600' : 'border-input';
9
- }
10
-
11
- const Textarea = React.forwardRef<HTMLTextAreaElement, React.TextareaHTMLAttributes<HTMLTextAreaElement>>(({ className, ...props }, ref) => {
12
- return (
13
- <textarea
14
- className={cn(
15
- 'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
16
- classBorderColor(className, props['aria-invalid'] === true),
17
- className,
18
- )}
19
- ref={ref}
20
- {...props}
21
- />
22
- );
23
- });
24
- Textarea.displayName = 'Textarea';
25
-
26
- export { Textarea };
27
-
@@ -1,88 +0,0 @@
1
- import * as ToastPrimitives from '@radix-ui/react-toast';
2
- import { type VariantProps, cva } from 'class-variance-authority';
3
- import { X } from 'lucide-react';
4
- import * as React from 'react';
5
- import { cn } from '../../lib/utils';
6
-
7
- const ToastProvider = ToastPrimitives.Provider;
8
-
9
- const ToastViewport = React.forwardRef<
10
- React.ElementRef<typeof ToastPrimitives.Viewport>,
11
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
12
- >(({ className, ...props }, ref) => (
13
- <ToastPrimitives.Viewport ref={ref} className={cn('fixed top-0 right-0 p-4 space-y-2 z-[100]', className)} {...props} />
14
- ));
15
- ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
16
-
17
- const toastVariants = cva(
18
- 'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-top-full',
19
- {
20
- variants: {
21
- variant: {
22
- default: 'border bg-background text-foreground',
23
- destructive: 'bg-white text-zinc-950',
24
- success: 'bg-white text-zinc-950',
25
- },
26
- },
27
- defaultVariants: {
28
- variant: 'default',
29
- },
30
- },
31
- );
32
-
33
- const Toast = React.forwardRef<
34
- React.ElementRef<typeof ToastPrimitives.Root>,
35
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>
36
- >(({ className, variant, ...props }, ref) => {
37
- return <ToastPrimitives.Root ref={ref} className={cn(toastVariants({ variant }), className)} {...props} />;
38
- });
39
- Toast.displayName = ToastPrimitives.Root.displayName;
40
-
41
- const ToastAction = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Action>, React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>>(
42
- ({ className, ...props }, ref) => (
43
- <ToastPrimitives.Action
44
- ref={ref}
45
- className={cn(
46
- 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-background-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive',
47
- className,
48
- )}
49
- {...props}
50
- />
51
- ),
52
- );
53
- ToastAction.displayName = ToastPrimitives.Action.displayName;
54
-
55
- const ToastClose = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Close>, React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>>(
56
- ({ className, ...props }, ref) => (
57
- <ToastPrimitives.Close
58
- ref={ref}
59
- className={cn(
60
- 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',
61
- className,
62
- )}
63
- toast-close=''
64
- {...props}
65
- >
66
- <X className='h-4 w-4' />
67
- </ToastPrimitives.Close>
68
- ),
69
- );
70
- ToastClose.displayName = ToastPrimitives.Close.displayName;
71
-
72
- const ToastTitle = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Title>, React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>>(
73
- ({ className, ...props }, ref) => <ToastPrimitives.Title ref={ref} className={cn('text-sm font-semibold', className)} {...props} />,
74
- );
75
- ToastTitle.displayName = ToastPrimitives.Title.displayName;
76
-
77
- const ToastDescription = React.forwardRef<
78
- React.ElementRef<typeof ToastPrimitives.Description>,
79
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
80
- >(({ className, ...props }, ref) => <ToastPrimitives.Description ref={ref} className={cn('text-sm opacity-90', className)} {...props} />);
81
- ToastDescription.displayName = ToastPrimitives.Description.displayName;
82
-
83
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
84
-
85
- type ToastActionElement = React.ReactElement<typeof ToastAction>;
86
-
87
- export { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, type ToastActionElement, type ToastProps };
88
-
@@ -1,49 +0,0 @@
1
- import { Check, CircleX } from 'lucide-react';
2
- import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from './toast';
3
- import { useToast } from './use-toast';
4
-
5
- export function Toaster() {
6
- const { toasts } = useToast();
7
-
8
- const getIcon = (icon: React.ReactNode, variant: string | null) => {
9
- if (icon) {
10
- return icon;
11
- }
12
-
13
- switch (variant) {
14
- case 'success':
15
- return (
16
- <div className='mr-3 p-px rounded-full bg-emerald-700'>
17
- <Check size={16} className='text-white' />
18
- </div>
19
- );
20
- case 'destructive':
21
- return (
22
- <div className='mr-3 p-px rounded-full bg-red-700'>
23
- <CircleX size={16} className='text-white' />
24
- </div>
25
- );
26
- default:
27
- return null;
28
- }
29
- };
30
-
31
- return (
32
- <ToastProvider>
33
- {toasts.map(({ id, title, description, action, icon, variant, ...props }) => (
34
- <Toast key={id} {...props} variant={variant} className='p-4 w-[334px] rounded-lg'>
35
- <div className='grid gap-1'>
36
- <div className='flex items-center'>
37
- {getIcon(icon, variant ?? null)}
38
- {title && <ToastTitle>{title}</ToastTitle>} {/* title deve funcionar aqui */}
39
- </div>
40
- {description && <ToastDescription>{description}</ToastDescription>}
41
- </div>
42
- {action}
43
- <ToastClose className='text-white' />
44
- </Toast>
45
- ))}
46
- <ToastViewport />
47
- </ToastProvider>
48
- );
49
- }
@@ -1,31 +0,0 @@
1
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
2
- import * as React from 'react';
3
- import { cn } from '../../lib/utils';
4
-
5
- const TooltipProvider = TooltipPrimitive.Provider;
6
-
7
- const Tooltip = TooltipPrimitive.Root;
8
-
9
- const TooltipTrigger = TooltipPrimitive.Trigger;
10
-
11
- const TooltipContent = React.forwardRef<
12
- React.ElementRef<typeof TooltipPrimitive.Content>,
13
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
14
- >(({ className, sideOffset = 4, ...props }, ref) => (
15
- <TooltipPrimitive.Content
16
- ref={ref}
17
- sideOffset={sideOffset}
18
- className={cn(
19
- 'z-50 overflow-hidden rounded-md bg-background-primary text-white px-3 py-1.5 text-sm shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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',
20
- className,
21
- )}
22
- {...props}
23
- >
24
- {props.children}
25
- <TooltipPrimitive.Arrow className='z-50 fill-primary animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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' />
26
- </TooltipPrimitive.Content>
27
- ));
28
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
29
-
30
- export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
31
-
@@ -1,61 +0,0 @@
1
- import { Popover, PopoverClose, PopoverContent, PopoverTrigger } from '@radix-ui/react-popover';
2
- import { format } from 'date-fns';
3
- import { ptBR } from 'date-fns/locale';
4
- import { CalendarDays } from 'lucide-react';
5
- import React from 'react';
6
- import { DateRange } from 'react-day-picker';
7
- import { cn } from '../../lib/utils';
8
- import { Button } from './button';
9
- import { Calendar } from './calendar';
10
-
11
- interface CalendarFormProps extends React.HTMLAttributes<HTMLDivElement> {
12
- getDataFilter: (from: Date | null, to: Date | null) => void;
13
- }
14
-
15
- export default function UseCalendar({ className, getDataFilter }: CalendarFormProps) {
16
- const endDate = null;
17
- const startDate = null;
18
-
19
- const [date, setDate] = React.useState<DateRange | any>({
20
- from: startDate,
21
- to: endDate,
22
- });
23
-
24
- const submitDate = () => {
25
- if (date.from !== null && date.to !== null) {
26
- getDataFilter(date.from, date.to);
27
- }
28
- };
29
-
30
- return (
31
- <div className={cn('grid gap-2', className)}>
32
- <Popover>
33
- <PopoverTrigger asChild>
34
- <Button
35
- id='date'
36
- variant={'outline'}
37
- className={'flex justify-center items-center px-4 py-2 cursor-pointer bg-primaryBack text-textFilter rounded-md'}
38
- >
39
- <CalendarDays color='#0F172A' size={16} className='mr-4' />
40
- {date?.to ? (
41
- <>
42
- {format(date.from, 'dd/MM', { locale: ptBR })} - {format(date.to, 'dd/MM', { locale: ptBR })}
43
- </>
44
- ) : (
45
- <span>Filtrar por Período</span>
46
- )}
47
- </Button>
48
- </PopoverTrigger>
49
- <PopoverContent className='w-auto p-0 testeCalendar flex flex-col justify-center bg-white z-10 shadow-md text-black ' align='start'>
50
- <Calendar mode='range' locale={ptBR} selected={date} onSelect={setDate} className=' ' />
51
-
52
- <PopoverClose className='flex justify-center items-center p-4'>
53
- <Button className='w-[150px] bg-background-primary mt-8 px-4 py-2 text-white' onClick={submitDate}>
54
- Aplicar Filtro
55
- </Button>
56
- </PopoverClose>
57
- </PopoverContent>
58
- </Popover>
59
- </div>
60
- );
61
- }
@@ -1,186 +0,0 @@
1
- // Inspired by react-hot-toast library
2
- import * as React from 'react';
3
-
4
- import type { ToastActionElement, ToastProps } from './toast';
5
-
6
- const TOAST_LIMIT = 1;
7
- const TOAST_REMOVE_DELAY = 1000000;
8
-
9
- type ToasterToast = ToastProps & {
10
- id: string;
11
- title?: React.ReactNode;
12
- description?: React.ReactNode;
13
- action?: ToastActionElement;
14
- icon?: React.ReactNode;
15
- };
16
-
17
- const actionTypes = {
18
- ADD_TOAST: 'ADD_TOAST',
19
- UPDATE_TOAST: 'UPDATE_TOAST',
20
- DISMISS_TOAST: 'DISMISS_TOAST',
21
- REMOVE_TOAST: 'REMOVE_TOAST',
22
- } as const;
23
-
24
- let count = 0;
25
-
26
- function genId() {
27
- count = (count + 1) % Number.MAX_SAFE_INTEGER;
28
- return count.toString();
29
- }
30
-
31
- type ActionType = typeof actionTypes;
32
-
33
- type Action =
34
- | {
35
- type: ActionType['ADD_TOAST'];
36
- toast: ToasterToast;
37
- }
38
- | {
39
- type: ActionType['UPDATE_TOAST'];
40
- toast: Partial<ToasterToast>;
41
- }
42
- | {
43
- type: ActionType['DISMISS_TOAST'];
44
- toastId?: ToasterToast['id'];
45
- }
46
- | {
47
- type: ActionType['REMOVE_TOAST'];
48
- toastId?: ToasterToast['id'];
49
- };
50
-
51
- interface State {
52
- toasts: ToasterToast[];
53
- }
54
-
55
- const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
56
-
57
- const addToRemoveQueue = (toastId: string) => {
58
- if (toastTimeouts.has(toastId)) {
59
- return;
60
- }
61
-
62
- const timeout = setTimeout(() => {
63
- toastTimeouts.delete(toastId);
64
- dispatch({
65
- type: 'REMOVE_TOAST',
66
- toastId: toastId,
67
- });
68
- }, TOAST_REMOVE_DELAY);
69
-
70
- toastTimeouts.set(toastId, timeout);
71
- };
72
-
73
- export const reducer = (state: State, action: Action): State => {
74
- switch (action.type) {
75
- case 'ADD_TOAST':
76
- return {
77
- ...state,
78
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
79
- };
80
-
81
- case 'UPDATE_TOAST':
82
- return {
83
- ...state,
84
- toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t)),
85
- };
86
-
87
- case 'DISMISS_TOAST': {
88
- const { toastId } = action;
89
-
90
- if (toastId) {
91
- addToRemoveQueue(toastId);
92
- } else {
93
- for (const toast of state.toasts) {
94
- addToRemoveQueue(toast.id);
95
- }
96
- }
97
-
98
- return {
99
- ...state,
100
- toasts: state.toasts.map((t) =>
101
- t.id === toastId || toastId === undefined
102
- ? {
103
- ...t,
104
- open: false,
105
- }
106
- : t,
107
- ),
108
- };
109
- }
110
- case 'REMOVE_TOAST':
111
- if (action.toastId === undefined) {
112
- return {
113
- ...state,
114
- toasts: [],
115
- };
116
- }
117
- return {
118
- ...state,
119
- toasts: state.toasts.filter((t) => t.id !== action.toastId),
120
- };
121
- }
122
- };
123
-
124
- const listeners: Array<(state: State) => void> = [];
125
-
126
- let memoryState: State = { toasts: [] };
127
-
128
- function dispatch(action: Action) {
129
- memoryState = reducer(memoryState, action);
130
- for (const listener of listeners) {
131
- listener(memoryState);
132
- }
133
- }
134
-
135
- type Toast = Omit<ToasterToast, 'id'>;
136
-
137
- function toast({ ...props }: Toast) {
138
- const id = genId();
139
-
140
- const update = (props: ToasterToast) =>
141
- dispatch({
142
- type: 'UPDATE_TOAST',
143
- toast: { ...props, id },
144
- });
145
- const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id });
146
-
147
- dispatch({
148
- type: 'ADD_TOAST',
149
- toast: {
150
- ...props,
151
- id,
152
- open: true,
153
- onOpenChange: (open) => {
154
- if (!open) dismiss();
155
- },
156
- },
157
- });
158
-
159
- return {
160
- id: id,
161
- dismiss,
162
- update,
163
- };
164
- }
165
-
166
- function useToast() {
167
- const [state, setState] = React.useState<State>(memoryState);
168
-
169
- React.useEffect(() => {
170
- listeners.push(setState);
171
- return () => {
172
- const index = listeners.indexOf(setState);
173
- if (index > -1) {
174
- listeners.splice(index, 1);
175
- }
176
- };
177
- }, [state]);
178
-
179
- return {
180
- ...state,
181
- toast,
182
- dismiss: (toastId?: string) => dispatch({ type: 'DISMISS_TOAST', toastId }),
183
- };
184
- }
185
-
186
- export { toast, useToast };
@@ -1,19 +0,0 @@
1
- import * as React from 'react';
2
-
3
- const MOBILE_BREAKPOINT = 1350;
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);
7
-
8
- React.useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
- };
13
- mql.addEventListener('change', onChange);
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
15
- return () => mql.removeEventListener('change', onChange);
16
- }, []);
17
-
18
- return !!isMobile;
19
- }