eai-frontend-components 2.0.5 → 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.
- package/package.json +3 -3
- package/src/components/ui/accordion.tsx +0 -48
- package/src/components/ui/alert-dialog.tsx +0 -138
- package/src/components/ui/alert.tsx +0 -36
- package/src/components/ui/avatar.tsx +0 -48
- package/src/components/ui/badge.tsx +0 -35
- package/src/components/ui/breadcrumb.tsx +0 -115
- package/src/components/ui/button.tsx +0 -43
- package/src/components/ui/calendar.tsx +0 -142
- package/src/components/ui/card.tsx +0 -35
- package/src/components/ui/carousel.tsx +0 -257
- package/src/components/ui/chart.tsx +0 -363
- package/src/components/ui/checkbox.tsx +0 -26
- package/src/components/ui/collapsible.tsx +0 -9
- package/src/components/ui/command.tsx +0 -145
- package/src/components/ui/context-menu.tsx +0 -198
- package/src/components/ui/custom/date-picker.tsx +0 -97
- package/src/components/ui/custom/form/checkbox.tsx +0 -53
- package/src/components/ui/custom/form/color.tsx +0 -140
- package/src/components/ui/custom/form/combobox.tsx +0 -259
- package/src/components/ui/custom/form/cpf-cnpj.tsx +0 -85
- package/src/components/ui/custom/form/currency.tsx +0 -51
- package/src/components/ui/custom/form/date-range.tsx +0 -110
- package/src/components/ui/custom/form/date.tsx +0 -109
- package/src/components/ui/custom/form/decimal.tsx +0 -50
- package/src/components/ui/custom/form/file.tsx +0 -65
- package/src/components/ui/custom/form/form-help-text.tsx +0 -20
- package/src/components/ui/custom/form/form-label.tsx +0 -24
- package/src/components/ui/custom/form/form-message.tsx +0 -10
- package/src/components/ui/custom/form/ghost.tsx +0 -28
- package/src/components/ui/custom/form/input.tsx +0 -69
- package/src/components/ui/custom/form/mask.tsx +0 -78
- package/src/components/ui/custom/form/multi-select.tsx +0 -209
- package/src/components/ui/custom/form/password.tsx +0 -70
- package/src/components/ui/custom/form/percent.tsx +0 -52
- package/src/components/ui/custom/form/phone.tsx +0 -79
- package/src/components/ui/custom/form/radio-group.tsx +0 -94
- package/src/components/ui/custom/form/select.tsx +0 -62
- package/src/components/ui/custom/form/step-new-form.tsx +0 -49
- package/src/components/ui/custom/form/switch.tsx +0 -51
- package/src/components/ui/custom/form/text.tsx +0 -71
- package/src/components/ui/custom/form/textarea.tsx +0 -71
- package/src/components/ui/custom/form/utils.ts +0 -100
- package/src/components/ui/custom/header.tsx +0 -128
- package/src/components/ui/custom/label.tsx +0 -79
- package/src/components/ui/custom/not-found.tsx +0 -30
- package/src/components/ui/custom/sidebar/module-switcher.tsx +0 -58
- package/src/components/ui/custom/sidebar/nav-footer.tsx +0 -35
- package/src/components/ui/custom/sidebar/nav-main.tsx +0 -64
- package/src/components/ui/custom/sidebar/nav-submenu-collapsible.tsx +0 -60
- package/src/components/ui/custom/sidebar/nav-submenu-dropdown.tsx +0 -56
- package/src/components/ui/custom/sidebar/nav-user.tsx +0 -77
- package/src/components/ui/custom/sidebar/sidebar-button.tsx +0 -30
- package/src/components/ui/custom/sidebar/sidebar-item-two-lines.tsx +0 -25
- package/src/components/ui/custom/sidebar/sidebar-item.tsx +0 -19
- package/src/components/ui/custom/sidebar/types/sidebar.ts +0 -31
- package/src/components/ui/custom/table/data-table-export.tsx +0 -126
- package/src/components/ui/custom/table/data-table-footer.tsx +0 -148
- package/src/components/ui/custom/table/data-table-header.tsx +0 -58
- package/src/components/ui/custom/table/data-table-rows.tsx +0 -94
- package/src/components/ui/custom/table/data-table.tsx +0 -285
- package/src/components/ui/custom/table/types/data-table.ts +0 -31
- package/src/components/ui/custom/theme-provider.tsx +0 -121
- package/src/components/ui/dateRangePicker.tsx +0 -63
- package/src/components/ui/dialog.tsx +0 -84
- package/src/components/ui/drawer.tsx +0 -116
- package/src/components/ui/dropdown-menu.tsx +0 -173
- package/src/components/ui/form.tsx +0 -114
- package/src/components/ui/hover-card.tsx +0 -27
- package/src/components/ui/input.tsx +0 -265
- package/src/components/ui/label.tsx +0 -15
- package/src/components/ui/masks.ts +0 -35
- package/src/components/ui/pagination.tsx +0 -78
- package/src/components/ui/popover.tsx +0 -32
- package/src/components/ui/progress.tsx +0 -22
- package/src/components/ui/radio-group.tsx +0 -36
- package/src/components/ui/scroll-area.tsx +0 -46
- package/src/components/ui/select.tsx +0 -130
- package/src/components/ui/separator.tsx +0 -29
- package/src/components/ui/sheet.tsx +0 -90
- package/src/components/ui/sidebar.tsx +0 -598
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/slider.tsx +0 -18
- package/src/components/ui/switch.tsx +0 -26
- package/src/components/ui/table.tsx +0 -53
- package/src/components/ui/tabs.tsx +0 -47
- package/src/components/ui/textarea.tsx +0 -27
- package/src/components/ui/toast.tsx +0 -88
- package/src/components/ui/toaster.tsx +0 -49
- package/src/components/ui/tooltip.tsx +0 -31
- package/src/components/ui/use-calendar.tsx +0 -61
- package/src/components/ui/use-toast.ts +0 -186
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/index.ts +0 -299
- package/src/lib/help/date-utils.ts +0 -41
- package/src/lib/help/format.ts +0 -171
- package/src/lib/help/theme.ts +0 -346
- package/src/lib/help/uuid.ts +0 -4
- package/src/lib/utils.ts +0 -6
- package/src/styles/globals.css +0 -59
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { cn } from "@/lib/utils"
|
|
2
|
-
import { type DialogProps } from "@radix-ui/react-dialog"
|
|
3
|
-
import { Command as CommandPrimitive } from "cmdk"
|
|
4
|
-
import { Search } from "lucide-react"
|
|
5
|
-
import * as React from "react"
|
|
6
|
-
import { Dialog, DialogContent } from "./dialog"
|
|
7
|
-
|
|
8
|
-
const Command = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof CommandPrimitive>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
11
|
-
>(({ className, ...props }, ref) => (
|
|
12
|
-
<CommandPrimitive
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn(
|
|
15
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
16
|
-
className
|
|
17
|
-
)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
))
|
|
21
|
-
Command.displayName = CommandPrimitive.displayName
|
|
22
|
-
|
|
23
|
-
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
|
24
|
-
return (
|
|
25
|
-
<Dialog {...props}>
|
|
26
|
-
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
|
27
|
-
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
28
|
-
{children}
|
|
29
|
-
</Command>
|
|
30
|
-
</DialogContent>
|
|
31
|
-
</Dialog>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const CommandInput = React.forwardRef<
|
|
36
|
-
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
37
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
38
|
-
>(({ className, ...props }, ref) => (
|
|
39
|
-
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
40
|
-
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
41
|
-
<CommandPrimitive.Input
|
|
42
|
-
ref={ref}
|
|
43
|
-
className={cn(
|
|
44
|
-
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
45
|
-
className
|
|
46
|
-
)}
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
49
|
-
</div>
|
|
50
|
-
))
|
|
51
|
-
|
|
52
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
53
|
-
|
|
54
|
-
const CommandList = React.forwardRef<
|
|
55
|
-
React.ElementRef<typeof CommandPrimitive.List>,
|
|
56
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
57
|
-
>(({ className, ...props }, ref) => (
|
|
58
|
-
<CommandPrimitive.List
|
|
59
|
-
ref={ref}
|
|
60
|
-
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
63
|
-
))
|
|
64
|
-
|
|
65
|
-
CommandList.displayName = CommandPrimitive.List.displayName
|
|
66
|
-
|
|
67
|
-
const CommandEmpty = React.forwardRef<
|
|
68
|
-
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
69
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
70
|
-
>((props, ref) => (
|
|
71
|
-
<CommandPrimitive.Empty
|
|
72
|
-
ref={ref}
|
|
73
|
-
className="py-6 text-center text-sm"
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
))
|
|
77
|
-
|
|
78
|
-
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
79
|
-
|
|
80
|
-
const CommandGroup = React.forwardRef<
|
|
81
|
-
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
82
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
83
|
-
>(({ className, ...props }, ref) => (
|
|
84
|
-
<CommandPrimitive.Group
|
|
85
|
-
ref={ref}
|
|
86
|
-
className={cn(
|
|
87
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
88
|
-
className
|
|
89
|
-
)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
))
|
|
93
|
-
|
|
94
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
95
|
-
|
|
96
|
-
const CommandSeparator = React.forwardRef<
|
|
97
|
-
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
98
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
99
|
-
>(({ className, ...props }, ref) => (
|
|
100
|
-
<CommandPrimitive.Separator
|
|
101
|
-
ref={ref}
|
|
102
|
-
className={cn("-mx-1 h-px bg-border", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
))
|
|
106
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
107
|
-
|
|
108
|
-
const CommandItem = React.forwardRef<
|
|
109
|
-
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
110
|
-
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
111
|
-
>(({ className, ...props }, ref) => (
|
|
112
|
-
<CommandPrimitive.Item
|
|
113
|
-
ref={ref}
|
|
114
|
-
className={cn(
|
|
115
|
-
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
116
|
-
className
|
|
117
|
-
)}
|
|
118
|
-
{...props}
|
|
119
|
-
/>
|
|
120
|
-
))
|
|
121
|
-
|
|
122
|
-
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
123
|
-
|
|
124
|
-
const CommandShortcut = ({
|
|
125
|
-
className,
|
|
126
|
-
...props
|
|
127
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
128
|
-
return (
|
|
129
|
-
<span
|
|
130
|
-
className={cn(
|
|
131
|
-
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
132
|
-
className
|
|
133
|
-
)}
|
|
134
|
-
{...props}
|
|
135
|
-
/>
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
CommandShortcut.displayName = "CommandShortcut"
|
|
139
|
-
|
|
140
|
-
export {
|
|
141
|
-
Command,
|
|
142
|
-
CommandDialog, CommandEmpty,
|
|
143
|
-
CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut
|
|
144
|
-
}
|
|
145
|
-
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
3
|
-
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
const ContextMenu = ContextMenuPrimitive.Root
|
|
8
|
-
|
|
9
|
-
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
|
10
|
-
|
|
11
|
-
const ContextMenuGroup = ContextMenuPrimitive.Group
|
|
12
|
-
|
|
13
|
-
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
|
14
|
-
|
|
15
|
-
const ContextMenuSub = ContextMenuPrimitive.Sub
|
|
16
|
-
|
|
17
|
-
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
|
18
|
-
|
|
19
|
-
const ContextMenuSubTrigger = React.forwardRef<
|
|
20
|
-
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
21
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
22
|
-
inset?: boolean
|
|
23
|
-
}
|
|
24
|
-
>(({ className, inset, children, ...props }, ref) => (
|
|
25
|
-
<ContextMenuPrimitive.SubTrigger
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={cn(
|
|
28
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
29
|
-
inset && "pl-8",
|
|
30
|
-
className
|
|
31
|
-
)}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
<ChevronRight className="ml-auto h-4 w-4" />
|
|
36
|
-
</ContextMenuPrimitive.SubTrigger>
|
|
37
|
-
))
|
|
38
|
-
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
|
39
|
-
|
|
40
|
-
const ContextMenuSubContent = React.forwardRef<
|
|
41
|
-
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
42
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
|
43
|
-
>(({ className, ...props }, ref) => (
|
|
44
|
-
<ContextMenuPrimitive.SubContent
|
|
45
|
-
ref={ref}
|
|
46
|
-
className={cn(
|
|
47
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
48
|
-
className
|
|
49
|
-
)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
))
|
|
53
|
-
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
|
54
|
-
|
|
55
|
-
const ContextMenuContent = React.forwardRef<
|
|
56
|
-
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
57
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
58
|
-
>(({ className, ...props }, ref) => (
|
|
59
|
-
<ContextMenuPrimitive.Portal>
|
|
60
|
-
<ContextMenuPrimitive.Content
|
|
61
|
-
ref={ref}
|
|
62
|
-
className={cn(
|
|
63
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",
|
|
64
|
-
className
|
|
65
|
-
)}
|
|
66
|
-
{...props}
|
|
67
|
-
/>
|
|
68
|
-
</ContextMenuPrimitive.Portal>
|
|
69
|
-
))
|
|
70
|
-
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
|
71
|
-
|
|
72
|
-
const ContextMenuItem = React.forwardRef<
|
|
73
|
-
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
74
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
75
|
-
inset?: boolean
|
|
76
|
-
}
|
|
77
|
-
>(({ className, inset, ...props }, ref) => (
|
|
78
|
-
<ContextMenuPrimitive.Item
|
|
79
|
-
ref={ref}
|
|
80
|
-
className={cn(
|
|
81
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
82
|
-
inset && "pl-8",
|
|
83
|
-
className
|
|
84
|
-
)}
|
|
85
|
-
{...props}
|
|
86
|
-
/>
|
|
87
|
-
))
|
|
88
|
-
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
|
89
|
-
|
|
90
|
-
const ContextMenuCheckboxItem = React.forwardRef<
|
|
91
|
-
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
92
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
93
|
-
>(({ className, children, checked, ...props }, ref) => (
|
|
94
|
-
<ContextMenuPrimitive.CheckboxItem
|
|
95
|
-
ref={ref}
|
|
96
|
-
className={cn(
|
|
97
|
-
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
98
|
-
className
|
|
99
|
-
)}
|
|
100
|
-
checked={checked}
|
|
101
|
-
{...props}
|
|
102
|
-
>
|
|
103
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
104
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
105
|
-
<Check className="h-4 w-4" />
|
|
106
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
107
|
-
</span>
|
|
108
|
-
{children}
|
|
109
|
-
</ContextMenuPrimitive.CheckboxItem>
|
|
110
|
-
))
|
|
111
|
-
ContextMenuCheckboxItem.displayName =
|
|
112
|
-
ContextMenuPrimitive.CheckboxItem.displayName
|
|
113
|
-
|
|
114
|
-
const ContextMenuRadioItem = React.forwardRef<
|
|
115
|
-
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
116
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
|
117
|
-
>(({ className, children, ...props }, ref) => (
|
|
118
|
-
<ContextMenuPrimitive.RadioItem
|
|
119
|
-
ref={ref}
|
|
120
|
-
className={cn(
|
|
121
|
-
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
122
|
-
className
|
|
123
|
-
)}
|
|
124
|
-
{...props}
|
|
125
|
-
>
|
|
126
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
127
|
-
<ContextMenuPrimitive.ItemIndicator>
|
|
128
|
-
<Circle className="h-2 w-2 fill-current" />
|
|
129
|
-
</ContextMenuPrimitive.ItemIndicator>
|
|
130
|
-
</span>
|
|
131
|
-
{children}
|
|
132
|
-
</ContextMenuPrimitive.RadioItem>
|
|
133
|
-
))
|
|
134
|
-
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
|
135
|
-
|
|
136
|
-
const ContextMenuLabel = React.forwardRef<
|
|
137
|
-
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
138
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
139
|
-
inset?: boolean
|
|
140
|
-
}
|
|
141
|
-
>(({ className, inset, ...props }, ref) => (
|
|
142
|
-
<ContextMenuPrimitive.Label
|
|
143
|
-
ref={ref}
|
|
144
|
-
className={cn(
|
|
145
|
-
"px-2 py-1.5 text-sm font-semibold text-foreground",
|
|
146
|
-
inset && "pl-8",
|
|
147
|
-
className
|
|
148
|
-
)}
|
|
149
|
-
{...props}
|
|
150
|
-
/>
|
|
151
|
-
))
|
|
152
|
-
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
|
153
|
-
|
|
154
|
-
const ContextMenuSeparator = React.forwardRef<
|
|
155
|
-
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
156
|
-
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
|
157
|
-
>(({ className, ...props }, ref) => (
|
|
158
|
-
<ContextMenuPrimitive.Separator
|
|
159
|
-
ref={ref}
|
|
160
|
-
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
161
|
-
{...props}
|
|
162
|
-
/>
|
|
163
|
-
))
|
|
164
|
-
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
|
165
|
-
|
|
166
|
-
const ContextMenuShortcut = ({
|
|
167
|
-
className,
|
|
168
|
-
...props
|
|
169
|
-
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
170
|
-
return (
|
|
171
|
-
<span
|
|
172
|
-
className={cn(
|
|
173
|
-
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
174
|
-
className
|
|
175
|
-
)}
|
|
176
|
-
{...props}
|
|
177
|
-
/>
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
|
181
|
-
|
|
182
|
-
export {
|
|
183
|
-
ContextMenu,
|
|
184
|
-
ContextMenuTrigger,
|
|
185
|
-
ContextMenuContent,
|
|
186
|
-
ContextMenuItem,
|
|
187
|
-
ContextMenuCheckboxItem,
|
|
188
|
-
ContextMenuRadioItem,
|
|
189
|
-
ContextMenuLabel,
|
|
190
|
-
ContextMenuSeparator,
|
|
191
|
-
ContextMenuShortcut,
|
|
192
|
-
ContextMenuGroup,
|
|
193
|
-
ContextMenuPortal,
|
|
194
|
-
ContextMenuSub,
|
|
195
|
-
ContextMenuSubContent,
|
|
196
|
-
ContextMenuSubTrigger,
|
|
197
|
-
ContextMenuRadioGroup,
|
|
198
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { getMonth, getYear, setMonth, setYear } from 'date-fns';
|
|
2
|
-
import { ptBR } from 'date-fns/locale';
|
|
3
|
-
import { Calendar as CalendarIcon } from 'lucide-react';
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import { DayPicker } from 'react-day-picker';
|
|
6
|
-
import { cn } from '../../../lib/utils';
|
|
7
|
-
import { Calendar as CalendarComponent } from '../calendar';
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
9
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../select';
|
|
10
|
-
|
|
11
|
-
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
|
|
12
|
-
|
|
13
|
-
interface CalendarFormProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
-
onDateSelected: (selectedDateProps: Date | null) => void;
|
|
15
|
-
selectedDateProps?: Date | null;
|
|
16
|
-
startYear?: number;
|
|
17
|
-
endYear?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const DatePicker = React.forwardRef<HTMLDivElement, CalendarFormProps>(
|
|
21
|
-
({ className, onDateSelected, selectedDateProps, startYear = getYear(new Date()) - 100, endYear = getYear(new Date()) + 100, ...props }, ref) => {
|
|
22
|
-
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
|
23
|
-
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
24
|
-
const months = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];
|
|
25
|
-
|
|
26
|
-
const years = Array.from({ length: endYear - startYear + 1 }, (_, i) => startYear + i);
|
|
27
|
-
|
|
28
|
-
const handleMonthChange = (month: string) => {
|
|
29
|
-
if (selectedDate) {
|
|
30
|
-
const newDate = setMonth(selectedDate, months.indexOf(month));
|
|
31
|
-
setSelectedDate(newDate);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleYearChange = (year: string) => {
|
|
36
|
-
if (selectedDate) {
|
|
37
|
-
const newDate = setYear(selectedDate, parseInt(year, 10));
|
|
38
|
-
setSelectedDate(newDate);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const handleDateChange = (selectedDate: Date | undefined) => {
|
|
43
|
-
const newDate = selectedDate || null;
|
|
44
|
-
setSelectedDate(newDate);
|
|
45
|
-
setIsPopoverOpen(false);
|
|
46
|
-
onDateSelected(newDate);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div className={cn('gap-2', className)} ref={ref} {...props}>
|
|
51
|
-
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
|
|
52
|
-
<PopoverTrigger asChild>
|
|
53
|
-
<CalendarIcon size={16} className='cursor-pointer text-gray-500' onClick={() => setIsPopoverOpen(true)} />
|
|
54
|
-
</PopoverTrigger>
|
|
55
|
-
<PopoverContent className='w-auto p-0 flex flex-col justify-center' align='start'>
|
|
56
|
-
<div className='flex justify-between pt-5 px-5'>
|
|
57
|
-
<Select onValueChange={handleMonthChange} value={months[getMonth(selectedDate || new Date())]}>
|
|
58
|
-
<SelectTrigger className='w-[100px]'>
|
|
59
|
-
<SelectValue placeholder='Month' />
|
|
60
|
-
</SelectTrigger>
|
|
61
|
-
<SelectContent>
|
|
62
|
-
{months.map((month) => (
|
|
63
|
-
<SelectItem key={month} value={month}>
|
|
64
|
-
{month}
|
|
65
|
-
</SelectItem>
|
|
66
|
-
))}
|
|
67
|
-
</SelectContent>
|
|
68
|
-
</Select>
|
|
69
|
-
<Select onValueChange={handleYearChange} value={getYear(selectedDate || new Date()).toString()}>
|
|
70
|
-
<SelectTrigger className='w-[100px]'>
|
|
71
|
-
<SelectValue placeholder='Year' />
|
|
72
|
-
</SelectTrigger>
|
|
73
|
-
<SelectContent>
|
|
74
|
-
{years.map((year) => (
|
|
75
|
-
<SelectItem key={year} value={year.toString()}>
|
|
76
|
-
{year}
|
|
77
|
-
</SelectItem>
|
|
78
|
-
))}
|
|
79
|
-
</SelectContent>
|
|
80
|
-
</Select>
|
|
81
|
-
</div>
|
|
82
|
-
<CalendarComponent
|
|
83
|
-
mode='single'
|
|
84
|
-
locale={ptBR}
|
|
85
|
-
onSelect={handleDateChange}
|
|
86
|
-
className='bg-white text-black'
|
|
87
|
-
month={selectedDate || undefined}
|
|
88
|
-
/>
|
|
89
|
-
</PopoverContent>
|
|
90
|
-
</Popover>
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
},
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
export { DatePicker };
|
|
97
|
-
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Checkbox } from '../../checkbox';
|
|
2
|
-
import * as FormComponents from '../../form';
|
|
3
|
-
import { formHelpText } from './form-help-text';
|
|
4
|
-
import { formLabel } from './form-label';
|
|
5
|
-
import { formMessage } from './form-message';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
control: any;
|
|
9
|
-
name: string;
|
|
10
|
-
label: string;
|
|
11
|
-
subLabel?: string;
|
|
12
|
-
helpText?: JSX.Element;
|
|
13
|
-
className?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const FormInputCheckbox: React.FC<Props> = ({ control, name, label, helpText, className, disabled, onCheckedChange }) => {
|
|
19
|
-
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<FormField
|
|
23
|
-
control={control}
|
|
24
|
-
name={name}
|
|
25
|
-
render={({ field }) => (
|
|
26
|
-
<FormItem className={className}>
|
|
27
|
-
<div className='flex items-center gap-2'>
|
|
28
|
-
<FormControl>
|
|
29
|
-
<Checkbox
|
|
30
|
-
value={field.value}
|
|
31
|
-
className={`${
|
|
32
|
-
field.value
|
|
33
|
-
? 'bg-purple-700 border border-purple-900 text-white rounded-[3px]'
|
|
34
|
-
: 'bg-white border border-black text-black'
|
|
35
|
-
}`}
|
|
36
|
-
onCheckedChange={(checked) => {
|
|
37
|
-
field?.onChange?.(checked);
|
|
38
|
-
onCheckedChange?.(checked as boolean);
|
|
39
|
-
}}
|
|
40
|
-
disabled={disabled}
|
|
41
|
-
/>
|
|
42
|
-
</FormControl>
|
|
43
|
-
<div className='flex h-full items-center space-x-1.5'>
|
|
44
|
-
{label && formLabel(FormLabel, label)}
|
|
45
|
-
{helpText && formHelpText(helpText)}
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
{formMessage(FormMessage)}
|
|
49
|
-
</FormItem>
|
|
50
|
-
)}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Paintbrush } from 'lucide-react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { HexColorPicker } from 'react-colorful';
|
|
4
|
-
import { cn } from '../../../../lib/utils';
|
|
5
|
-
import { Button } from '../../button';
|
|
6
|
-
import * as FormComponents from '../../form';
|
|
7
|
-
import { Input } from '../../input';
|
|
8
|
-
import { Label } from '../../label';
|
|
9
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../../popover';
|
|
10
|
-
import { formHelpText } from './form-help-text';
|
|
11
|
-
import { formLabelAndSubLabel } from './form-label';
|
|
12
|
-
import { formMessage } from './form-message';
|
|
13
|
-
import { hexToRgb, rgbToHex } from './utils';
|
|
14
|
-
|
|
15
|
-
interface Props {
|
|
16
|
-
control: any;
|
|
17
|
-
id?: string;
|
|
18
|
-
name: string;
|
|
19
|
-
label: string;
|
|
20
|
-
subLabel?: string;
|
|
21
|
-
helpText?: JSX.Element;
|
|
22
|
-
placeholder?: string;
|
|
23
|
-
className?: string;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
required?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const FormInputColor: React.FC<Props> = ({ control, name, label, subLabel, helpText, placeholder, className, disabled, required }) => {
|
|
29
|
-
const { FormField, FormItem, FormLabel, FormControl, FormMessage } = FormComponents;
|
|
30
|
-
|
|
31
|
-
const DEFAULT_COLOR = '#000000';
|
|
32
|
-
const [currentColor, setCurrentColor] = useState<string>(DEFAULT_COLOR);
|
|
33
|
-
const rgb = hexToRgb(currentColor) || { r: 0, g: 0, b: 0 };
|
|
34
|
-
|
|
35
|
-
const handleColorChange = (newColor: string, onChange: (...event: any[]) => void) => {
|
|
36
|
-
onChange?.(newColor);
|
|
37
|
-
setCurrentColor(newColor);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const handleHexChange = (hex: string, onChange: (...event: any[]) => void) => {
|
|
41
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(hex)) {
|
|
42
|
-
handleColorChange(hex, onChange);
|
|
43
|
-
} else {
|
|
44
|
-
setCurrentColor(hex);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const handleRgbChange = (key: keyof typeof rgb, value: string, onChange: (...event: any[]) => void) => {
|
|
49
|
-
const numValue = Number.parseInt(value);
|
|
50
|
-
|
|
51
|
-
if (!Number.isNaN(numValue) && numValue >= 0 && numValue <= 255) {
|
|
52
|
-
const newRgb = { ...rgb, [key]: numValue };
|
|
53
|
-
|
|
54
|
-
handleColorChange(rgbToHex(newRgb), onChange);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<FormField
|
|
60
|
-
control={control}
|
|
61
|
-
name={name}
|
|
62
|
-
render={({ field, formState }) => (
|
|
63
|
-
<FormItem className={className}>
|
|
64
|
-
<div className='flex items-center space-x-1.5'>
|
|
65
|
-
{label && formLabelAndSubLabel(FormLabel, label, subLabel, required)}
|
|
66
|
-
{helpText && formHelpText(helpText)}
|
|
67
|
-
</div>
|
|
68
|
-
<Popover>
|
|
69
|
-
<PopoverTrigger asChild>
|
|
70
|
-
<FormControl>
|
|
71
|
-
<Button
|
|
72
|
-
variant='outline'
|
|
73
|
-
className={cn('w-[240px] justify-start text-left font-normal', !field.value && 'text-zinc-500', className)}
|
|
74
|
-
disabled={disabled || formState.isSubmitting}
|
|
75
|
-
>
|
|
76
|
-
<div className='w-full flex items-center gap-2'>
|
|
77
|
-
{field.value ? (
|
|
78
|
-
<div
|
|
79
|
-
className='h-4 w-4 rounded !bg-center !bg-cover transition-all border'
|
|
80
|
-
style={{ backgroundColor: field.value }}
|
|
81
|
-
/>
|
|
82
|
-
) : (
|
|
83
|
-
<Paintbrush className='h-4 w-4' />
|
|
84
|
-
)}
|
|
85
|
-
<div className='truncate flex-1 text-sm'>
|
|
86
|
-
{field.value ? field.value : placeholder || 'Selecione uma cor'}
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</Button>
|
|
90
|
-
</FormControl>
|
|
91
|
-
</PopoverTrigger>
|
|
92
|
-
<PopoverContent className={cn('w-80', className)}>
|
|
93
|
-
<div className='flex flex-col gap-4'>
|
|
94
|
-
<section className='[&_.react-colorful]:w-auto'>
|
|
95
|
-
<HexColorPicker
|
|
96
|
-
color={field.value ?? DEFAULT_COLOR}
|
|
97
|
-
onChange={(newColor) => handleColorChange(newColor, field.onChange)}
|
|
98
|
-
/>
|
|
99
|
-
</section>
|
|
100
|
-
<div className='flex gap-2'>
|
|
101
|
-
<div className='flex flex-col gap-1'>
|
|
102
|
-
<Label>Hex</Label>
|
|
103
|
-
<Input value={currentColor} onChange={(e) => handleHexChange(e.target.value, field.onChange)} maxLength={7} />
|
|
104
|
-
</div>
|
|
105
|
-
<div className='flex gap-2'>
|
|
106
|
-
<div className='flex flex-col gap-1'>
|
|
107
|
-
<Label>R</Label>
|
|
108
|
-
<Input
|
|
109
|
-
value={rgb.r}
|
|
110
|
-
onChange={(e) => handleRgbChange('r', e.target.value, field.onChange)}
|
|
111
|
-
className='w-14'
|
|
112
|
-
/>
|
|
113
|
-
</div>
|
|
114
|
-
<div className='flex flex-col gap-1'>
|
|
115
|
-
<Label>G</Label>
|
|
116
|
-
<Input
|
|
117
|
-
value={rgb.g}
|
|
118
|
-
onChange={(e) => handleRgbChange('g', e.target.value, field.onChange)}
|
|
119
|
-
className='w-14'
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
122
|
-
<div className='flex flex-col gap-1'>
|
|
123
|
-
<Label>B</Label>
|
|
124
|
-
<Input
|
|
125
|
-
value={rgb.b}
|
|
126
|
-
onChange={(e) => handleRgbChange('b', e.target.value, field.onChange)}
|
|
127
|
-
className='w-14'
|
|
128
|
-
/>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</PopoverContent>
|
|
134
|
-
</Popover>
|
|
135
|
-
{formMessage(FormMessage)}
|
|
136
|
-
</FormItem>
|
|
137
|
-
)}
|
|
138
|
-
/>
|
|
139
|
-
);
|
|
140
|
-
};
|