@pago-sh/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +195 -0
- package/CHANGELOG.md +47 -0
- package/README.md +22 -0
- package/components.json +17 -0
- package/dist/chunk-2RCGDEGJ.mjs +1 -0
- package/dist/chunk-3GDNSYGJ.mjs +1 -0
- package/dist/chunk-4TCUGB6E.mjs +1 -0
- package/dist/chunk-6XCXQA5L.mjs +1 -0
- package/dist/chunk-BBYR3CIF.mjs +1 -0
- package/dist/chunk-CFBUY7KY.mjs +1 -0
- package/dist/chunk-CHG2VB73.mjs +1 -0
- package/dist/chunk-GCVBVZU7.mjs +1 -0
- package/dist/chunk-HRGUR4R2.mjs +1 -0
- package/dist/chunk-IVU4SSCD.mjs +1 -0
- package/dist/chunk-N6WI5TGM.mjs +1 -0
- package/dist/chunk-OTKGECM3.mjs +1 -0
- package/dist/chunk-SRZFZUN4.mjs +1 -0
- package/dist/chunk-VPECET7P.mjs +1 -0
- package/dist/chunk-WQPSZXQS.mjs +1 -0
- package/dist/chunk-YXNT3UEO.mjs +1 -0
- package/dist/components/atoms/Accordion.d.mts +20 -0
- package/dist/components/atoms/Accordion.d.ts +20 -0
- package/dist/components/atoms/Accordion.js +1 -0
- package/dist/components/atoms/Accordion.mjs +1 -0
- package/dist/components/atoms/Card.d.mts +18 -0
- package/dist/components/atoms/Card.d.ts +18 -0
- package/dist/components/atoms/Card.js +1 -0
- package/dist/components/atoms/Card.mjs +1 -0
- package/dist/components/atoms/Combobox.d.mts +24 -0
- package/dist/components/atoms/Combobox.d.ts +24 -0
- package/dist/components/atoms/Combobox.js +1 -0
- package/dist/components/atoms/Combobox.mjs +1 -0
- package/dist/components/atoms/CopyToClipboardInput.d.mts +12 -0
- package/dist/components/atoms/CopyToClipboardInput.d.ts +12 -0
- package/dist/components/atoms/CopyToClipboardInput.js +1 -0
- package/dist/components/atoms/CopyToClipboardInput.mjs +1 -0
- package/dist/components/atoms/CountryPicker.d.mts +16 -0
- package/dist/components/atoms/CountryPicker.d.ts +16 -0
- package/dist/components/atoms/CountryPicker.js +1 -0
- package/dist/components/atoms/CountryPicker.mjs +1 -0
- package/dist/components/atoms/CountryStatePicker.d.mts +18 -0
- package/dist/components/atoms/CountryStatePicker.d.ts +18 -0
- package/dist/components/atoms/CountryStatePicker.js +1 -0
- package/dist/components/atoms/CountryStatePicker.mjs +1 -0
- package/dist/components/atoms/DateTimePicker.d.mts +10 -0
- package/dist/components/atoms/DateTimePicker.d.ts +10 -0
- package/dist/components/atoms/DateTimePicker.js +1 -0
- package/dist/components/atoms/DateTimePicker.mjs +1 -0
- package/dist/components/atoms/DropdownMenu.d.mts +22 -0
- package/dist/components/atoms/DropdownMenu.d.ts +22 -0
- package/dist/components/atoms/DropdownMenu.js +1 -0
- package/dist/components/atoms/DropdownMenu.mjs +1 -0
- package/dist/components/atoms/FormattedDateTime.d.mts +10 -0
- package/dist/components/atoms/FormattedDateTime.d.ts +10 -0
- package/dist/components/atoms/FormattedDateTime.js +1 -0
- package/dist/components/atoms/FormattedDateTime.mjs +1 -0
- package/dist/components/atoms/FormattedInterval.d.mts +9 -0
- package/dist/components/atoms/FormattedInterval.d.ts +9 -0
- package/dist/components/atoms/FormattedInterval.js +1 -0
- package/dist/components/atoms/FormattedInterval.mjs +1 -0
- package/dist/components/atoms/InputOTP.d.mts +4 -0
- package/dist/components/atoms/InputOTP.d.ts +4 -0
- package/dist/components/atoms/InputOTP.js +1 -0
- package/dist/components/atoms/InputOTP.mjs +1 -0
- package/dist/components/atoms/MoneyInput.d.mts +21 -0
- package/dist/components/atoms/MoneyInput.d.ts +21 -0
- package/dist/components/atoms/MoneyInput.js +1 -0
- package/dist/components/atoms/MoneyInput.mjs +1 -0
- package/dist/components/atoms/Paginator.d.mts +21 -0
- package/dist/components/atoms/Paginator.d.ts +21 -0
- package/dist/components/atoms/Paginator.js +1 -0
- package/dist/components/atoms/Paginator.mjs +1 -0
- package/dist/components/atoms/PagoTimeAgo.d.mts +8 -0
- package/dist/components/atoms/PagoTimeAgo.d.ts +8 -0
- package/dist/components/atoms/PagoTimeAgo.js +1 -0
- package/dist/components/atoms/PagoTimeAgo.mjs +1 -0
- package/dist/components/atoms/PercentageInput.d.mts +19 -0
- package/dist/components/atoms/PercentageInput.d.ts +19 -0
- package/dist/components/atoms/PercentageInput.js +1 -0
- package/dist/components/atoms/PercentageInput.mjs +1 -0
- package/dist/components/atoms/ShadowBox.d.mts +14 -0
- package/dist/components/atoms/ShadowBox.d.ts +14 -0
- package/dist/components/atoms/ShadowBox.js +1 -0
- package/dist/components/atoms/ShadowBox.mjs +1 -0
- package/dist/components/atoms/ShadowBoxOnMd.d.mts +6 -0
- package/dist/components/atoms/ShadowBoxOnMd.d.ts +6 -0
- package/dist/components/atoms/ShadowBoxOnMd.js +1 -0
- package/dist/components/atoms/ShadowBoxOnMd.mjs +1 -0
- package/dist/components/atoms/Sidebar.d.mts +11 -0
- package/dist/components/atoms/Sidebar.d.ts +11 -0
- package/dist/components/atoms/Sidebar.js +1 -0
- package/dist/components/atoms/Sidebar.mjs +1 -0
- package/dist/components/molecules/Banner.d.mts +11 -0
- package/dist/components/molecules/Banner.d.ts +11 -0
- package/dist/components/molecules/Banner.js +1 -0
- package/dist/components/molecules/Banner.mjs +1 -0
- package/dist/components/ui/accordion.d.mts +19 -0
- package/dist/components/ui/accordion.d.ts +19 -0
- package/dist/components/ui/accordion.js +1 -0
- package/dist/components/ui/accordion.mjs +1 -0
- package/dist/components/ui/alert-dialog.d.mts +41 -0
- package/dist/components/ui/alert-dialog.d.ts +41 -0
- package/dist/components/ui/alert-dialog.js +1 -0
- package/dist/components/ui/alert-dialog.mjs +1 -0
- package/dist/components/ui/calendar.d.mts +12 -0
- package/dist/components/ui/calendar.d.ts +12 -0
- package/dist/components/ui/calendar.js +1 -0
- package/dist/components/ui/calendar.mjs +1 -0
- package/dist/components/ui/card.d.mts +23 -0
- package/dist/components/ui/card.d.ts +23 -0
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/card.mjs +1 -0
- package/dist/components/ui/chart.d.mts +55 -0
- package/dist/components/ui/chart.d.ts +55 -0
- package/dist/components/ui/chart.js +7 -0
- package/dist/components/ui/chart.mjs +7 -0
- package/dist/components/ui/checkbox.d.mts +2 -0
- package/dist/components/ui/checkbox.d.ts +2 -0
- package/dist/components/ui/checkbox.js +1 -0
- package/dist/components/ui/checkbox.mjs +1 -0
- package/dist/components/ui/command.d.mts +36 -0
- package/dist/components/ui/command.d.ts +36 -0
- package/dist/components/ui/command.js +1 -0
- package/dist/components/ui/command.mjs +1 -0
- package/dist/components/ui/dialog.d.mts +34 -0
- package/dist/components/ui/dialog.d.ts +34 -0
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/dialog.mjs +1 -0
- package/dist/components/ui/dropdown-menu.d.mts +23 -0
- package/dist/components/ui/dropdown-menu.d.ts +23 -0
- package/dist/components/ui/dropdown-menu.js +1 -0
- package/dist/components/ui/dropdown-menu.mjs +1 -0
- package/dist/components/ui/form.d.mts +43 -0
- package/dist/components/ui/form.d.ts +43 -0
- package/dist/components/ui/form.js +1 -0
- package/dist/components/ui/form.mjs +1 -0
- package/dist/components/ui/input-otp.d.mts +21 -0
- package/dist/components/ui/input-otp.d.ts +21 -0
- package/dist/components/ui/input-otp.js +1 -0
- package/dist/components/ui/input-otp.mjs +1 -0
- package/dist/components/ui/label.d.mts +9 -0
- package/dist/components/ui/label.d.ts +9 -0
- package/dist/components/ui/label.js +1 -0
- package/dist/components/ui/label.mjs +1 -0
- package/dist/components/ui/popover.d.mts +12 -0
- package/dist/components/ui/popover.d.ts +12 -0
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/popover.mjs +1 -0
- package/dist/components/ui/radio-group.d.mts +14 -0
- package/dist/components/ui/radio-group.d.ts +14 -0
- package/dist/components/ui/radio-group.js +1 -0
- package/dist/components/ui/radio-group.mjs +1 -0
- package/dist/components/ui/separator.d.mts +10 -0
- package/dist/components/ui/separator.d.ts +10 -0
- package/dist/components/ui/separator.js +1 -0
- package/dist/components/ui/separator.mjs +1 -0
- package/dist/components/ui/sheet.d.mts +43 -0
- package/dist/components/ui/sheet.d.ts +43 -0
- package/dist/components/ui/sheet.js +1 -0
- package/dist/components/ui/sheet.mjs +1 -0
- package/dist/components/ui/sidebar.d.mts +149 -0
- package/dist/components/ui/sidebar.d.ts +149 -0
- package/dist/components/ui/sidebar.js +1 -0
- package/dist/components/ui/sidebar.mjs +1 -0
- package/dist/components/ui/tooltip.d.mts +1 -0
- package/dist/components/ui/tooltip.d.ts +1 -0
- package/dist/components/ui/tooltip.js +1 -0
- package/dist/components/ui/tooltip.mjs +1 -0
- package/dist/hooks/theming.d.mts +76 -0
- package/dist/hooks/theming.d.ts +76 -0
- package/dist/hooks/theming.js +1 -0
- package/dist/hooks/theming.mjs +1 -0
- package/dist/hooks/use-mobile.d.mts +3 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +1 -0
- package/dist/hooks/use-mobile.mjs +1 -0
- package/dist/lib/meterUnit.d.mts +34 -0
- package/dist/lib/meterUnit.d.ts +34 -0
- package/dist/lib/meterUnit.js +1 -0
- package/dist/lib/meterUnit.mjs +1 -0
- package/dist/lib/utils.d.mts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/lib/utils.mjs +1 -0
- package/eslint.config.mjs +18 -0
- package/package.json +74 -0
- package/src/components/atoms/Accordion.tsx +56 -0
- package/src/components/atoms/Card.tsx +52 -0
- package/src/components/atoms/Combobox.tsx +166 -0
- package/src/components/atoms/CopyToClipboardInput.tsx +72 -0
- package/src/components/atoms/CountryPicker.tsx +81 -0
- package/src/components/atoms/CountryStatePicker.tsx +155 -0
- package/src/components/atoms/DateTimePicker.tsx +69 -0
- package/src/components/atoms/DropdownMenu.tsx +68 -0
- package/src/components/atoms/FormattedDateTime.tsx +58 -0
- package/src/components/atoms/FormattedInterval.tsx +81 -0
- package/src/components/atoms/InputOTP.tsx +7 -0
- package/src/components/atoms/MoneyInput.tsx +297 -0
- package/src/components/atoms/Paginator.tsx +227 -0
- package/src/components/atoms/PagoTimeAgo.tsx +19 -0
- package/src/components/atoms/PercentageInput.tsx +97 -0
- package/src/components/atoms/ShadowBox.tsx +26 -0
- package/src/components/atoms/ShadowBoxOnMd.tsx +20 -0
- package/src/components/atoms/Sidebar.tsx +1 -0
- package/src/components/molecules/Banner.tsx +42 -0
- package/src/components/ui/accordion.tsx +63 -0
- package/src/components/ui/alert-dialog.tsx +147 -0
- package/src/components/ui/calendar.tsx +81 -0
- package/src/components/ui/card.tsx +47 -0
- package/src/components/ui/chart.tsx +372 -0
- package/src/components/ui/checkbox.tsx +3 -0
- package/src/components/ui/command.tsx +133 -0
- package/src/components/ui/dialog.tsx +127 -0
- package/src/components/ui/dropdown-menu.tsx +74 -0
- package/src/components/ui/form.tsx +180 -0
- package/src/components/ui/input-otp.tsx +68 -0
- package/src/components/ui/label.tsx +25 -0
- package/src/components/ui/popover.tsx +34 -0
- package/src/components/ui/radio-group.tsx +46 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +149 -0
- package/src/components/ui/sidebar.tsx +742 -0
- package/src/components/ui/tooltip.tsx +8 -0
- package/src/hooks/theming.ts +87 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/lib/meterUnit.ts +52 -0
- package/src/lib/utils.ts +6 -0
- package/tsconfig.json +15 -0
- package/tsup.config.ts +11 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
4
|
+
import { X } from 'lucide-react'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
const Dialog = DialogPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
12
|
+
|
|
13
|
+
const DialogPortal = DialogPrimitive.Portal
|
|
14
|
+
|
|
15
|
+
const DialogClose = DialogPrimitive.Close
|
|
16
|
+
|
|
17
|
+
const DialogOverlay = ({
|
|
18
|
+
ref,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) => (
|
|
22
|
+
<DialogPrimitive.Overlay
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cn(
|
|
25
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
32
|
+
|
|
33
|
+
const DialogContent = ({
|
|
34
|
+
ref,
|
|
35
|
+
className,
|
|
36
|
+
children,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content>) => (
|
|
39
|
+
<DialogPortal>
|
|
40
|
+
<DialogOverlay />
|
|
41
|
+
<DialogPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
'bg-background 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg',
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none">
|
|
51
|
+
<X className="h-4 w-4" />
|
|
52
|
+
<span className="sr-only">Close</span>
|
|
53
|
+
</DialogPrimitive.Close>
|
|
54
|
+
</DialogPrimitive.Content>
|
|
55
|
+
</DialogPortal>
|
|
56
|
+
)
|
|
57
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
58
|
+
|
|
59
|
+
const DialogHeader = ({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
63
|
+
<div
|
|
64
|
+
className={cn(
|
|
65
|
+
'flex flex-col space-y-1.5 text-center sm:text-left',
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
DialogHeader.displayName = 'DialogHeader'
|
|
72
|
+
|
|
73
|
+
const DialogFooter = ({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
77
|
+
<div
|
|
78
|
+
className={cn(
|
|
79
|
+
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
)
|
|
85
|
+
DialogFooter.displayName = 'DialogFooter'
|
|
86
|
+
|
|
87
|
+
const DialogTitle = ({
|
|
88
|
+
ref,
|
|
89
|
+
className,
|
|
90
|
+
...props
|
|
91
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) => (
|
|
92
|
+
<DialogPrimitive.Title
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={cn(
|
|
95
|
+
'text-lg leading-none font-semibold tracking-tight',
|
|
96
|
+
className,
|
|
97
|
+
)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
|
102
|
+
|
|
103
|
+
const DialogDescription = ({
|
|
104
|
+
ref,
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) => (
|
|
108
|
+
<DialogPrimitive.Description
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
Dialog,
|
|
118
|
+
DialogClose,
|
|
119
|
+
DialogContent,
|
|
120
|
+
DialogDescription,
|
|
121
|
+
DialogFooter,
|
|
122
|
+
DialogHeader,
|
|
123
|
+
DialogOverlay,
|
|
124
|
+
DialogPortal,
|
|
125
|
+
DialogTitle,
|
|
126
|
+
DialogTrigger,
|
|
127
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
13
|
+
|
|
14
|
+
const DropdownMenuContent = ({
|
|
15
|
+
ref,
|
|
16
|
+
className,
|
|
17
|
+
sideOffset = 4,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) => (
|
|
20
|
+
<DropdownMenuPrimitive.Portal>
|
|
21
|
+
<DropdownMenuPrimitive.Content
|
|
22
|
+
ref={ref}
|
|
23
|
+
sideOffset={sideOffset}
|
|
24
|
+
className={cn(
|
|
25
|
+
'bg-popover text-popover-foreground 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 z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
</DropdownMenuPrimitive.Portal>
|
|
31
|
+
)
|
|
32
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
33
|
+
|
|
34
|
+
const DropdownMenuItem = ({
|
|
35
|
+
ref,
|
|
36
|
+
className,
|
|
37
|
+
destructive,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
40
|
+
destructive?: boolean
|
|
41
|
+
}) => (
|
|
42
|
+
<DropdownMenuPrimitive.Item
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer items-center gap-2 rounded-xs px-2 py-1.5 text-sm transition-colors outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4! [&_svg]:shrink-0',
|
|
46
|
+
destructive && 'text-destructive focus:text-white',
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
53
|
+
|
|
54
|
+
const DropdownMenuSeparator = ({
|
|
55
|
+
ref,
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) => (
|
|
59
|
+
<DropdownMenuPrimitive.Separator
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn('bg-muted -mx-1 my-1 h-px', className)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
DropdownMenu,
|
|
69
|
+
DropdownMenuContent,
|
|
70
|
+
DropdownMenuItem,
|
|
71
|
+
DropdownMenuPortal,
|
|
72
|
+
DropdownMenuSeparator,
|
|
73
|
+
DropdownMenuTrigger,
|
|
74
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label'
|
|
4
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
import {
|
|
7
|
+
Controller,
|
|
8
|
+
ControllerProps,
|
|
9
|
+
FieldPath,
|
|
10
|
+
FieldValues,
|
|
11
|
+
FormProvider,
|
|
12
|
+
useFormContext,
|
|
13
|
+
} from 'react-hook-form'
|
|
14
|
+
|
|
15
|
+
import { Label } from '@/components/ui/label'
|
|
16
|
+
import { cn } from '@/lib/utils'
|
|
17
|
+
|
|
18
|
+
const Form = FormProvider
|
|
19
|
+
|
|
20
|
+
type FormFieldContextValue<
|
|
21
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
22
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
23
|
+
> = {
|
|
24
|
+
name: TName
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
28
|
+
{} as FormFieldContextValue,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
const FormField = <
|
|
32
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
33
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
34
|
+
>({
|
|
35
|
+
...props
|
|
36
|
+
}: ControllerProps<TFieldValues, TName>) => {
|
|
37
|
+
return (
|
|
38
|
+
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
39
|
+
<Controller {...props} />
|
|
40
|
+
</FormFieldContext.Provider>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const useFormField = () => {
|
|
45
|
+
const fieldContext = React.useContext(FormFieldContext)
|
|
46
|
+
const itemContext = React.useContext(FormItemContext)
|
|
47
|
+
const { getFieldState, formState } = useFormContext()
|
|
48
|
+
|
|
49
|
+
const fieldState = getFieldState(fieldContext.name, formState)
|
|
50
|
+
|
|
51
|
+
if (!fieldContext) {
|
|
52
|
+
throw new Error('useFormField should be used within <FormField>')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const { id } = itemContext
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
id,
|
|
59
|
+
name: fieldContext.name,
|
|
60
|
+
formItemId: `${id}-form-item`,
|
|
61
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
62
|
+
formMessageId: `${id}-form-item-message`,
|
|
63
|
+
...fieldState,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type FormItemContextValue = {
|
|
68
|
+
id: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
72
|
+
{} as FormItemContextValue,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const FormItem = ({
|
|
76
|
+
ref,
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React.ComponentProps<'div'>) => {
|
|
80
|
+
const id = React.useId()
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<FormItemContext.Provider value={{ id }}>
|
|
84
|
+
<div ref={ref} className={cn('space-y-2', className)} {...props} />
|
|
85
|
+
</FormItemContext.Provider>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
FormItem.displayName = 'FormItem'
|
|
89
|
+
|
|
90
|
+
const FormLabel = ({
|
|
91
|
+
ref,
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) => {
|
|
95
|
+
const { error, formItemId } = useFormField()
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Label
|
|
99
|
+
ref={ref}
|
|
100
|
+
className={cn(error && 'text-destructive', className)}
|
|
101
|
+
htmlFor={formItemId}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
FormLabel.displayName = 'FormLabel'
|
|
107
|
+
|
|
108
|
+
const FormControl = ({ ref, ...props }: React.ComponentProps<typeof Slot>) => {
|
|
109
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Slot
|
|
113
|
+
ref={ref}
|
|
114
|
+
id={formItemId}
|
|
115
|
+
aria-describedby={
|
|
116
|
+
!error
|
|
117
|
+
? `${formDescriptionId}`
|
|
118
|
+
: `${formDescriptionId} ${formMessageId}`
|
|
119
|
+
}
|
|
120
|
+
aria-invalid={!!error}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
FormControl.displayName = 'FormControl'
|
|
126
|
+
|
|
127
|
+
const FormDescription = ({
|
|
128
|
+
ref,
|
|
129
|
+
className,
|
|
130
|
+
...props
|
|
131
|
+
}: React.ComponentProps<'p'>) => {
|
|
132
|
+
const { formDescriptionId } = useFormField()
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<p
|
|
136
|
+
ref={ref}
|
|
137
|
+
id={formDescriptionId}
|
|
138
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
FormDescription.displayName = 'FormDescription'
|
|
144
|
+
|
|
145
|
+
const FormMessage = ({
|
|
146
|
+
ref,
|
|
147
|
+
className,
|
|
148
|
+
children,
|
|
149
|
+
...props
|
|
150
|
+
}: React.ComponentProps<'p'>) => {
|
|
151
|
+
const { error, formMessageId } = useFormField()
|
|
152
|
+
const body = error ? String(error?.message) : children
|
|
153
|
+
|
|
154
|
+
if (!body) {
|
|
155
|
+
return null
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<p
|
|
160
|
+
ref={ref}
|
|
161
|
+
id={formMessageId}
|
|
162
|
+
className={cn('text-destructive text-sm font-medium', className)}
|
|
163
|
+
{...props}
|
|
164
|
+
>
|
|
165
|
+
{body}
|
|
166
|
+
</p>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
FormMessage.displayName = 'FormMessage'
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
Form,
|
|
173
|
+
FormControl,
|
|
174
|
+
FormDescription,
|
|
175
|
+
FormField,
|
|
176
|
+
FormItem,
|
|
177
|
+
FormLabel,
|
|
178
|
+
FormMessage,
|
|
179
|
+
useFormField,
|
|
180
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { OTPInput, OTPInputContext, RenderProps } from 'input-otp'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const InputOTP = ({
|
|
9
|
+
ref,
|
|
10
|
+
className,
|
|
11
|
+
containerClassName,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof OTPInput>) => (
|
|
14
|
+
<OTPInput
|
|
15
|
+
ref={ref}
|
|
16
|
+
containerClassName={cn(
|
|
17
|
+
'flex items-center gap-2 has-disabled:opacity-50',
|
|
18
|
+
containerClassName,
|
|
19
|
+
)}
|
|
20
|
+
className={cn('disabled:cursor-not-allowed', className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
InputOTP.displayName = 'InputOTP'
|
|
25
|
+
|
|
26
|
+
const InputOTPGroup = ({
|
|
27
|
+
ref,
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<'div'>) => (
|
|
31
|
+
<div ref={ref} className={cn('flex items-center', className)} {...props} />
|
|
32
|
+
)
|
|
33
|
+
InputOTPGroup.displayName = 'InputOTPGroup'
|
|
34
|
+
|
|
35
|
+
const InputOTPSlot = ({
|
|
36
|
+
ref,
|
|
37
|
+
index,
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: {
|
|
41
|
+
index: number
|
|
42
|
+
className?: string
|
|
43
|
+
} & React.ComponentProps<'div'>) => {
|
|
44
|
+
const inputOTPContext = React.useContext<RenderProps>(OTPInputContext)
|
|
45
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(
|
|
51
|
+
'border-input dark:bg-pago-900 relative flex h-10 w-10 items-center justify-center border-y border-r bg-white text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md',
|
|
52
|
+
isActive && 'ring-ring ring-offset-background z-10 ring-2',
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{char}
|
|
58
|
+
{hasFakeCaret && (
|
|
59
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
60
|
+
<div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
InputOTPSlot.displayName = 'InputOTPSlot'
|
|
67
|
+
|
|
68
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label'
|
|
4
|
+
import { cva } from 'class-variance-authority'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const labelVariants = cva(
|
|
9
|
+
'block text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
const Label = ({
|
|
13
|
+
ref,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) => (
|
|
17
|
+
<LabelPrimitive.Root
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(labelVariants(), className)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
Label.displayName = LabelPrimitive.Root.displayName
|
|
24
|
+
|
|
25
|
+
export { Label }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const Popover = PopoverPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const PopoverTrigger = PopoverPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const PopoverContent = ({
|
|
13
|
+
ref,
|
|
14
|
+
className,
|
|
15
|
+
align = 'center',
|
|
16
|
+
sideOffset = 4,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) => (
|
|
19
|
+
<PopoverPrimitive.Portal>
|
|
20
|
+
<PopoverPrimitive.Content
|
|
21
|
+
ref={ref}
|
|
22
|
+
align={align}
|
|
23
|
+
sideOffset={sideOffset}
|
|
24
|
+
className={cn(
|
|
25
|
+
'bg-popover text-popover-foreground 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 z-50 w-72 rounded-md border p-4 shadow-md outline-none',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
</PopoverPrimitive.Portal>
|
|
31
|
+
)
|
|
32
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
|
33
|
+
|
|
34
|
+
export { Popover, PopoverContent, PopoverTrigger }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
|
|
4
|
+
import { Circle } from 'lucide-react'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
const RadioGroup = ({
|
|
10
|
+
ref,
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) => {
|
|
14
|
+
return (
|
|
15
|
+
<RadioGroupPrimitive.Root
|
|
16
|
+
className={cn('grid gap-2', className)}
|
|
17
|
+
{...props}
|
|
18
|
+
ref={ref}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
|
|
23
|
+
|
|
24
|
+
const RadioGroupItem = ({
|
|
25
|
+
ref,
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) => {
|
|
29
|
+
return (
|
|
30
|
+
<RadioGroupPrimitive.Item
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn(
|
|
33
|
+
'border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
>
|
|
38
|
+
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
39
|
+
<Circle className="h-2.5 w-2.5 fill-current text-current" />
|
|
40
|
+
</RadioGroupPrimitive.Indicator>
|
|
41
|
+
</RadioGroupPrimitive.Item>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
|
|
45
|
+
|
|
46
|
+
export { RadioGroup, RadioGroupItem }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const Separator = ({
|
|
9
|
+
ref,
|
|
10
|
+
className,
|
|
11
|
+
orientation = 'horizontal',
|
|
12
|
+
decorative = true,
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) => (
|
|
15
|
+
<SeparatorPrimitive.Root
|
|
16
|
+
ref={ref}
|
|
17
|
+
decorative={decorative}
|
|
18
|
+
orientation={orientation}
|
|
19
|
+
className={cn(
|
|
20
|
+
'bg-border shrink-0',
|
|
21
|
+
orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
28
|
+
|
|
29
|
+
export { Separator }
|