@codefast/ui 0.0.50 → 0.0.53
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/{chunk-ZTEJNUH6.js → chunk-46W6RAYD.js} +1 -1
- package/dist/chunk-46W6RAYD.js.map +1 -0
- package/dist/{chunk-CERSQE5J.js → chunk-4JHGPRLG.js} +1 -1
- package/dist/chunk-4JHGPRLG.js.map +1 -0
- package/dist/{chunk-I6QCJDIF.mjs → chunk-5RENVAXH.mjs} +1 -1
- package/dist/chunk-5RENVAXH.mjs.map +1 -0
- package/dist/{chunk-47CSACCM.mjs → chunk-7ABWX5CF.mjs} +2 -2
- package/dist/chunk-7ABWX5CF.mjs.map +1 -0
- package/dist/{chunk-XHNT6PVI.mjs → chunk-BM5KYF6Y.mjs} +1 -1
- package/dist/chunk-BM5KYF6Y.mjs.map +1 -0
- package/dist/{chunk-P5AV3QU7.mjs → chunk-BNKSZEF2.mjs} +1 -1
- package/dist/chunk-BNKSZEF2.mjs.map +1 -0
- package/dist/{chunk-SDGUDONZ.js → chunk-DCDB56BO.js} +1 -1
- package/dist/chunk-DCDB56BO.js.map +1 -0
- package/dist/{chunk-6FL3EBDQ.mjs → chunk-HMD2ZU33.mjs} +1 -1
- package/dist/chunk-HMD2ZU33.mjs.map +1 -0
- package/dist/{chunk-JOBEKA4M.mjs → chunk-K63K4LTH.mjs} +2 -2
- package/dist/chunk-K63K4LTH.mjs.map +1 -0
- package/dist/{chunk-VXPAGNPJ.js → chunk-LJSD47ZL.js} +1 -1
- package/dist/chunk-LJSD47ZL.js.map +1 -0
- package/dist/{chunk-GDMHMSJ2.mjs → chunk-MFYACCZV.mjs} +1 -1
- package/dist/chunk-MFYACCZV.mjs.map +1 -0
- package/dist/{chunk-LG7ACTRE.js → chunk-PRCS3RWN.js} +1 -1
- package/dist/chunk-PRCS3RWN.js.map +1 -0
- package/dist/{chunk-OP6Q7VT5.js → chunk-RHFF4JNH.js} +1 -1
- package/dist/chunk-RHFF4JNH.js.map +1 -0
- package/dist/{chunk-SCPFGC2X.js → chunk-SCXRD727.js} +1 -1
- package/dist/chunk-SCXRD727.js.map +1 -0
- package/dist/{chunk-X3LRJQM3.js → chunk-VZVI3OHH.js} +2 -2
- package/dist/chunk-VZVI3OHH.js.map +1 -0
- package/dist/{chunk-UYRRHPPH.js → chunk-X4BEEJEW.js} +2 -2
- package/dist/chunk-X4BEEJEW.js.map +1 -0
- package/dist/{chunk-PWF46YXQ.mjs → chunk-Y2GMHG3Z.mjs} +1 -1
- package/dist/chunk-Y2GMHG3Z.mjs.map +1 -0
- package/dist/{chunk-MU2MZ434.mjs → chunk-ZIB4ZTST.mjs} +1 -1
- package/dist/chunk-ZIB4ZTST.mjs.map +1 -0
- package/dist/plugin/animate.plugin.js +1 -1
- package/dist/plugin/animate.plugin.mjs +1 -1
- package/dist/react/accordion.js.map +1 -1
- package/dist/react/accordion.mjs.map +1 -1
- package/dist/react/alert-dialog.js +1 -1
- package/dist/react/alert-dialog.js.map +1 -1
- package/dist/react/alert-dialog.mjs +1 -1
- package/dist/react/alert-dialog.mjs.map +1 -1
- package/dist/react/alert.js.map +1 -1
- package/dist/react/alert.mjs.map +1 -1
- package/dist/react/aspect-ratio.d.mts +1 -1
- package/dist/react/aspect-ratio.d.ts +1 -1
- package/dist/react/aspect-ratio.js.map +1 -1
- package/dist/react/aspect-ratio.mjs.map +1 -1
- package/dist/react/avatar.js.map +1 -1
- package/dist/react/avatar.mjs.map +1 -1
- package/dist/react/badge.js.map +1 -1
- package/dist/react/badge.mjs.map +1 -1
- package/dist/react/blockquote.js.map +1 -1
- package/dist/react/blockquote.mjs.map +1 -1
- package/dist/react/box.js.map +1 -1
- package/dist/react/box.mjs.map +1 -1
- package/dist/react/breadcrumb.js.map +1 -1
- package/dist/react/breadcrumb.mjs.map +1 -1
- package/dist/react/button.js +1 -1
- package/dist/react/button.mjs +1 -1
- package/dist/react/calendar.js +1 -1
- package/dist/react/calendar.js.map +1 -1
- package/dist/react/calendar.mjs +1 -1
- package/dist/react/calendar.mjs.map +1 -1
- package/dist/react/card.js.map +1 -1
- package/dist/react/card.mjs.map +1 -1
- package/dist/react/carousel.js +1 -1
- package/dist/react/carousel.js.map +1 -1
- package/dist/react/carousel.mjs +1 -1
- package/dist/react/carousel.mjs.map +1 -1
- package/dist/react/checkbox-cards.js +1 -1
- package/dist/react/checkbox-cards.js.map +1 -1
- package/dist/react/checkbox-cards.mjs +1 -1
- package/dist/react/checkbox-cards.mjs.map +1 -1
- package/dist/react/checkbox-group.js +1 -1
- package/dist/react/checkbox-group.js.map +1 -1
- package/dist/react/checkbox-group.mjs +1 -1
- package/dist/react/checkbox-group.mjs.map +1 -1
- package/dist/react/checkbox-group.primitive.js +1 -1
- package/dist/react/checkbox-group.primitive.mjs +1 -1
- package/dist/react/checkbox.js.map +1 -1
- package/dist/react/checkbox.mjs.map +1 -1
- package/dist/react/code.js.map +1 -1
- package/dist/react/code.mjs.map +1 -1
- package/dist/react/collapsible.js.map +1 -1
- package/dist/react/collapsible.mjs.map +1 -1
- package/dist/react/command.js +1 -1
- package/dist/react/command.js.map +1 -1
- package/dist/react/command.mjs +1 -1
- package/dist/react/command.mjs.map +1 -1
- package/dist/react/container.js.map +1 -1
- package/dist/react/container.mjs.map +1 -1
- package/dist/react/context-menu.js.map +1 -1
- package/dist/react/context-menu.mjs.map +1 -1
- package/dist/react/data-table.d.mts +1 -1
- package/dist/react/data-table.d.ts +1 -1
- package/dist/react/data-table.js +1 -1
- package/dist/react/data-table.js.map +1 -1
- package/dist/react/data-table.mjs +1 -1
- package/dist/react/data-table.mjs.map +1 -1
- package/dist/react/dialog.js +1 -1
- package/dist/react/dialog.mjs +1 -1
- package/dist/react/drawer.js.map +1 -1
- package/dist/react/drawer.mjs.map +1 -1
- package/dist/react/dropdown-menu.js +1 -1
- package/dist/react/dropdown-menu.mjs +1 -1
- package/dist/react/em.js.map +1 -1
- package/dist/react/em.mjs.map +1 -1
- package/dist/react/form.js +1 -1
- package/dist/react/form.js.map +1 -1
- package/dist/react/form.mjs +1 -1
- package/dist/react/form.mjs.map +1 -1
- package/dist/react/heading.js.map +1 -1
- package/dist/react/heading.mjs.map +1 -1
- package/dist/react/hover-card.js.map +1 -1
- package/dist/react/hover-card.mjs.map +1 -1
- package/dist/react/input-otp.js.map +1 -1
- package/dist/react/input-otp.mjs.map +1 -1
- package/dist/react/input.js.map +1 -1
- package/dist/react/input.mjs.map +1 -1
- package/dist/react/kbd.js.map +1 -1
- package/dist/react/kbd.mjs.map +1 -1
- package/dist/react/label.js +1 -1
- package/dist/react/label.mjs +1 -1
- package/dist/react/menubar.js.map +1 -1
- package/dist/react/menubar.mjs.map +1 -1
- package/dist/react/navigation-menu.js.map +1 -1
- package/dist/react/navigation-menu.mjs.map +1 -1
- package/dist/react/pagination.js +1 -1
- package/dist/react/pagination.js.map +1 -1
- package/dist/react/pagination.mjs +1 -1
- package/dist/react/pagination.mjs.map +1 -1
- package/dist/react/popover.js.map +1 -1
- package/dist/react/popover.mjs.map +1 -1
- package/dist/react/pre.js.map +1 -1
- package/dist/react/pre.mjs.map +1 -1
- package/dist/react/progress.js.map +1 -1
- package/dist/react/progress.mjs.map +1 -1
- package/dist/react/quote.js.map +1 -1
- package/dist/react/quote.mjs.map +1 -1
- package/dist/react/radio-cards.js.map +1 -1
- package/dist/react/radio-cards.mjs.map +1 -1
- package/dist/react/radio-group.js.map +1 -1
- package/dist/react/radio-group.mjs.map +1 -1
- package/dist/react/radio.js.map +1 -1
- package/dist/react/radio.mjs.map +1 -1
- package/dist/react/resizable.js.map +1 -1
- package/dist/react/resizable.mjs.map +1 -1
- package/dist/react/scroll-area.js.map +1 -1
- package/dist/react/scroll-area.mjs.map +1 -1
- package/dist/react/section.js.map +1 -1
- package/dist/react/section.mjs.map +1 -1
- package/dist/react/select.js +1 -1
- package/dist/react/select.mjs +1 -1
- package/dist/react/separator.js.map +1 -1
- package/dist/react/separator.mjs.map +1 -1
- package/dist/react/sheet.js +1 -1
- package/dist/react/sheet.js.map +1 -1
- package/dist/react/sheet.mjs +1 -1
- package/dist/react/sheet.mjs.map +1 -1
- package/dist/react/skeleton.js.map +1 -1
- package/dist/react/skeleton.mjs.map +1 -1
- package/dist/react/slider.js.map +1 -1
- package/dist/react/slider.mjs.map +1 -1
- package/dist/react/sonner.js.map +1 -1
- package/dist/react/sonner.mjs.map +1 -1
- package/dist/react/spinner.js +1 -1
- package/dist/react/spinner.mjs +1 -1
- package/dist/react/strong.js.map +1 -1
- package/dist/react/strong.mjs.map +1 -1
- package/dist/react/switch.js.map +1 -1
- package/dist/react/switch.mjs.map +1 -1
- package/dist/react/table.js.map +1 -1
- package/dist/react/table.mjs.map +1 -1
- package/dist/react/tabs.js.map +1 -1
- package/dist/react/tabs.mjs.map +1 -1
- package/dist/react/text.js.map +1 -1
- package/dist/react/text.mjs.map +1 -1
- package/dist/react/textarea.js.map +1 -1
- package/dist/react/textarea.mjs.map +1 -1
- package/dist/react/toggle-group.js +1 -1
- package/dist/react/toggle-group.js.map +1 -1
- package/dist/react/toggle-group.mjs +1 -1
- package/dist/react/toggle-group.mjs.map +1 -1
- package/dist/react/toggle.js +1 -1
- package/dist/react/toggle.mjs +1 -1
- package/dist/react/tooltip.js.map +1 -1
- package/dist/react/tooltip.mjs.map +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/tailwind.config.js +1 -1
- package/dist/tailwind.config.js.map +1 -1
- package/dist/tailwind.config.mjs +1 -1
- package/dist/tailwind.config.mjs.map +1 -1
- package/package.json +5 -5
- package/plugin/animate.plugin.ts +2 -5
- package/src/react/accordion.tsx +36 -60
- package/src/react/alert-dialog.tsx +57 -125
- package/src/react/alert.tsx +16 -42
- package/src/react/aspect-ratio.tsx +2 -4
- package/src/react/avatar.tsx +15 -43
- package/src/react/badge.tsx +3 -8
- package/src/react/blockquote.tsx +5 -8
- package/src/react/box.tsx +4 -6
- package/src/react/breadcrumb.tsx +17 -50
- package/src/react/button.tsx +5 -20
- package/src/react/calendar.tsx +6 -22
- package/src/react/card.tsx +22 -56
- package/src/react/carousel.tsx +20 -76
- package/src/react/checkbox-cards.tsx +28 -55
- package/src/react/checkbox-group.primitive.tsx +24 -78
- package/src/react/checkbox-group.tsx +26 -49
- package/src/react/checkbox.tsx +15 -19
- package/src/react/code.tsx +4 -6
- package/src/react/collapsible.tsx +19 -29
- package/src/react/command.tsx +69 -134
- package/src/react/container.tsx +5 -9
- package/src/react/context-menu.tsx +146 -224
- package/src/react/data-table.tsx +16 -44
- package/src/react/dialog.tsx +45 -90
- package/src/react/drawer.tsx +44 -91
- package/src/react/dropdown-menu.tsx +126 -194
- package/src/react/em.tsx +4 -6
- package/src/react/form.tsx +49 -84
- package/src/react/heading.tsx +4 -6
- package/src/react/hover-card.tsx +22 -38
- package/src/react/input-otp.tsx +26 -37
- package/src/react/input.tsx +6 -16
- package/src/react/kbd.tsx +14 -16
- package/src/react/label.tsx +11 -12
- package/src/react/menubar.tsx +129 -208
- package/src/react/navigation-menu.tsx +105 -147
- package/src/react/pagination.tsx +18 -50
- package/src/react/popover.tsx +25 -40
- package/src/react/pre.tsx +4 -6
- package/src/react/progress.tsx +15 -22
- package/src/react/quote.tsx +4 -6
- package/src/react/radio-cards.tsx +7 -27
- package/src/react/radio-group.tsx +7 -27
- package/src/react/radio.tsx +14 -18
- package/src/react/resizable.tsx +2 -7
- package/src/react/scroll-area.tsx +30 -52
- package/src/react/section.tsx +4 -6
- package/src/react/select.tsx +108 -161
- package/src/react/separator.tsx +3 -12
- package/src/react/sheet.tsx +21 -71
- package/src/react/skeleton.tsx +1 -6
- package/src/react/slider.tsx +20 -27
- package/src/react/sonner.tsx +2 -4
- package/src/react/spinner.tsx +2 -7
- package/src/react/strong.tsx +4 -6
- package/src/react/switch.tsx +12 -14
- package/src/react/table.tsx +37 -82
- package/src/react/tabs.tsx +34 -44
- package/src/react/text.tsx +5 -8
- package/src/react/textarea.tsx +12 -14
- package/src/react/toggle-group.tsx +16 -57
- package/src/react/toggle.tsx +8 -15
- package/src/react/tooltip.tsx +24 -39
- package/tailwind.config.ts +2 -2
- package/dist/chunk-47CSACCM.mjs.map +0 -1
- package/dist/chunk-6FL3EBDQ.mjs.map +0 -1
- package/dist/chunk-CERSQE5J.js.map +0 -1
- package/dist/chunk-GDMHMSJ2.mjs.map +0 -1
- package/dist/chunk-I6QCJDIF.mjs.map +0 -1
- package/dist/chunk-JOBEKA4M.mjs.map +0 -1
- package/dist/chunk-LG7ACTRE.js.map +0 -1
- package/dist/chunk-MU2MZ434.mjs.map +0 -1
- package/dist/chunk-OP6Q7VT5.js.map +0 -1
- package/dist/chunk-P5AV3QU7.mjs.map +0 -1
- package/dist/chunk-PWF46YXQ.mjs.map +0 -1
- package/dist/chunk-SCPFGC2X.js.map +0 -1
- package/dist/chunk-SDGUDONZ.js.map +0 -1
- package/dist/chunk-UYRRHPPH.js.map +0 -1
- package/dist/chunk-VXPAGNPJ.js.map +0 -1
- package/dist/chunk-X3LRJQM3.js.map +0 -1
- package/dist/chunk-XHNT6PVI.mjs.map +0 -1
- package/dist/chunk-ZTEJNUH6.js.map +0 -1
|
@@ -2,100 +2,78 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
5
|
-
import {
|
|
6
|
-
CheckIcon,
|
|
7
|
-
ChevronRightIcon,
|
|
8
|
-
DotFilledIcon,
|
|
9
|
-
} from '@radix-ui/react-icons';
|
|
5
|
+
import { CheckIcon, ChevronRightIcon, DotFilledIcon } from '@radix-ui/react-icons';
|
|
10
6
|
import { cn } from '../lib/utils';
|
|
11
7
|
|
|
12
8
|
/* -----------------------------------------------------------------------------
|
|
13
9
|
* Component: DropdownMenu
|
|
14
10
|
* -------------------------------------------------------------------------- */
|
|
15
11
|
|
|
16
|
-
type DropdownMenuProps = React.ComponentProps<
|
|
17
|
-
typeof DropdownMenuPrimitive.Root
|
|
18
|
-
>;
|
|
12
|
+
type DropdownMenuProps = React.ComponentProps<typeof DropdownMenuPrimitive.Root>;
|
|
19
13
|
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
20
14
|
|
|
21
15
|
/* -----------------------------------------------------------------------------
|
|
22
16
|
* Component: DropdownMenuTrigger
|
|
23
17
|
* -------------------------------------------------------------------------- */
|
|
24
18
|
|
|
25
|
-
type DropdownMenuTriggerProps = React.ComponentPropsWithoutRef<
|
|
26
|
-
typeof DropdownMenuPrimitive.Trigger
|
|
27
|
-
>;
|
|
19
|
+
type DropdownMenuTriggerProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>;
|
|
28
20
|
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
29
21
|
|
|
30
22
|
/* -----------------------------------------------------------------------------
|
|
31
23
|
* Component: DropdownMenuGroup
|
|
32
24
|
* -------------------------------------------------------------------------- */
|
|
33
25
|
|
|
34
|
-
type DropdownMenuGroupProps = React.ComponentPropsWithoutRef<
|
|
35
|
-
typeof DropdownMenuPrimitive.Group
|
|
36
|
-
>;
|
|
26
|
+
type DropdownMenuGroupProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Group>;
|
|
37
27
|
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
38
28
|
|
|
39
29
|
/* -----------------------------------------------------------------------------
|
|
40
30
|
* Component: DropdownMenuSub
|
|
41
31
|
* -------------------------------------------------------------------------- */
|
|
42
32
|
|
|
43
|
-
type DropdownMenuSubProps = React.ComponentPropsWithoutRef<
|
|
44
|
-
typeof DropdownMenuPrimitive.Sub
|
|
45
|
-
>;
|
|
33
|
+
type DropdownMenuSubProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub>;
|
|
46
34
|
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
47
35
|
|
|
48
36
|
/* -----------------------------------------------------------------------------
|
|
49
37
|
* Component: DropdownMenuSubTrigger
|
|
50
38
|
* -------------------------------------------------------------------------- */
|
|
51
39
|
|
|
52
|
-
type DropdownMenuRadioGroupProps = React.ComponentPropsWithoutRef<
|
|
53
|
-
typeof DropdownMenuPrimitive.RadioGroup
|
|
54
|
-
>;
|
|
40
|
+
type DropdownMenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup>;
|
|
55
41
|
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
56
42
|
|
|
57
43
|
/* -----------------------------------------------------------------------------
|
|
58
44
|
* Component: DropdownMenuSubTrigger
|
|
59
45
|
* -------------------------------------------------------------------------- */
|
|
60
46
|
|
|
61
|
-
type DropdownMenuSubTriggerElement = React.ElementRef<
|
|
62
|
-
typeof DropdownMenuPrimitive.SubTrigger
|
|
63
|
-
>;
|
|
47
|
+
type DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;
|
|
64
48
|
|
|
65
|
-
interface DropdownMenuSubTriggerProps
|
|
66
|
-
extends React.ComponentPropsWithoutRef<
|
|
67
|
-
typeof DropdownMenuPrimitive.SubTrigger
|
|
68
|
-
> {
|
|
49
|
+
interface DropdownMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> {
|
|
69
50
|
inset?: boolean;
|
|
70
51
|
}
|
|
71
52
|
|
|
72
|
-
const DropdownMenuSubTrigger = React.forwardRef<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
));
|
|
53
|
+
const DropdownMenuSubTrigger = React.forwardRef<DropdownMenuSubTriggerElement, DropdownMenuSubTriggerProps>(
|
|
54
|
+
({ children, className, inset, ...props }, ref) => (
|
|
55
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
56
|
+
ref={ref}
|
|
57
|
+
className={cn(
|
|
58
|
+
'focus:bg-accent data-[state=open]:bg-accent flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none',
|
|
59
|
+
inset && 'pl-8',
|
|
60
|
+
className,
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
<ChevronRightIcon className="ml-auto size-4" />
|
|
66
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
67
|
+
),
|
|
68
|
+
);
|
|
89
69
|
|
|
90
|
-
DropdownMenuSubTrigger.displayName =
|
|
91
|
-
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
70
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
92
71
|
|
|
93
72
|
/* -----------------------------------------------------------------------------
|
|
94
73
|
* Component: DropdownMenuSubContent
|
|
95
74
|
* -------------------------------------------------------------------------- */
|
|
96
75
|
|
|
97
|
-
type DropdownMenuSubContentProps =
|
|
98
|
-
DropdownMenuPrimitive.DropdownMenuSubContentProps;
|
|
76
|
+
type DropdownMenuSubContentProps = DropdownMenuPrimitive.DropdownMenuSubContentProps;
|
|
99
77
|
|
|
100
78
|
const DropdownMenuSubContent = React.forwardRef<
|
|
101
79
|
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
@@ -113,36 +91,30 @@ const DropdownMenuSubContent = React.forwardRef<
|
|
|
113
91
|
</DropdownMenuPrimitive.Portal>
|
|
114
92
|
));
|
|
115
93
|
|
|
116
|
-
DropdownMenuSubContent.displayName =
|
|
117
|
-
DropdownMenuPrimitive.SubContent.displayName;
|
|
94
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
118
95
|
|
|
119
96
|
/* -----------------------------------------------------------------------------
|
|
120
97
|
* Component: DropdownMenuContent
|
|
121
98
|
* -------------------------------------------------------------------------- */
|
|
122
99
|
|
|
123
|
-
type DropdownMenuContentElement = React.ElementRef<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
)}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
</DropdownMenuPrimitive.Portal>
|
|
145
|
-
));
|
|
100
|
+
type DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;
|
|
101
|
+
type DropdownMenuContentProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>;
|
|
102
|
+
|
|
103
|
+
const DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(
|
|
104
|
+
({ className, sideOffset = 6, ...props }, ref) => (
|
|
105
|
+
<DropdownMenuPrimitive.Portal>
|
|
106
|
+
<DropdownMenuPrimitive.Content
|
|
107
|
+
ref={ref}
|
|
108
|
+
sideOffset={sideOffset}
|
|
109
|
+
className={cn(
|
|
110
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95 data-[state=open]:data-[side=top]:slide-in-from-bottom-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 z-50 min-w-32 rounded-md border p-1 shadow-md',
|
|
111
|
+
className,
|
|
112
|
+
)}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
</DropdownMenuPrimitive.Portal>
|
|
116
|
+
),
|
|
117
|
+
);
|
|
146
118
|
|
|
147
119
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
148
120
|
|
|
@@ -150,29 +122,25 @@ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
|
150
122
|
* Component: DropdownMenuItem
|
|
151
123
|
* -------------------------------------------------------------------------- */
|
|
152
124
|
|
|
153
|
-
type DropdownMenuItemElement = React.ElementRef<
|
|
154
|
-
typeof DropdownMenuPrimitive.Item
|
|
155
|
-
>;
|
|
125
|
+
type DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;
|
|
156
126
|
|
|
157
|
-
interface DropdownMenuItemProps
|
|
158
|
-
extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> {
|
|
127
|
+
interface DropdownMenuItemProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> {
|
|
159
128
|
inset?: boolean;
|
|
160
129
|
}
|
|
161
130
|
|
|
162
|
-
const DropdownMenuItem = React.forwardRef<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
));
|
|
131
|
+
const DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(
|
|
132
|
+
({ className, inset, ...props }, ref) => (
|
|
133
|
+
<DropdownMenuPrimitive.Item
|
|
134
|
+
ref={ref}
|
|
135
|
+
className={cn(
|
|
136
|
+
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm transition focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
137
|
+
inset && 'pl-8',
|
|
138
|
+
className,
|
|
139
|
+
)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
),
|
|
143
|
+
);
|
|
176
144
|
|
|
177
145
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
178
146
|
|
|
@@ -180,69 +148,58 @@ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
|
180
148
|
* Component: DropdownMenuCheckboxItem
|
|
181
149
|
* -------------------------------------------------------------------------- */
|
|
182
150
|
|
|
183
|
-
type DropdownMenuCheckboxItemElement = React.ElementRef<
|
|
184
|
-
|
|
185
|
-
>;
|
|
186
|
-
type DropdownMenuCheckboxItemProps = React.ComponentPropsWithoutRef<
|
|
187
|
-
typeof DropdownMenuPrimitive.CheckboxItem
|
|
188
|
-
>;
|
|
189
|
-
|
|
190
|
-
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
191
|
-
DropdownMenuCheckboxItemElement,
|
|
192
|
-
DropdownMenuCheckboxItemProps
|
|
193
|
-
>(({ children, className, checked, ...props }, ref) => (
|
|
194
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
195
|
-
ref={ref}
|
|
196
|
-
className={cn(
|
|
197
|
-
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm transition focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
198
|
-
className,
|
|
199
|
-
)}
|
|
200
|
-
checked={checked}
|
|
201
|
-
{...props}
|
|
202
|
-
>
|
|
203
|
-
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
204
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
205
|
-
<CheckIcon className="size-4" />
|
|
206
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
207
|
-
</span>
|
|
208
|
-
{children}
|
|
209
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
210
|
-
));
|
|
151
|
+
type DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;
|
|
152
|
+
type DropdownMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>;
|
|
211
153
|
|
|
212
|
-
DropdownMenuCheckboxItem.
|
|
213
|
-
|
|
154
|
+
const DropdownMenuCheckboxItem = React.forwardRef<DropdownMenuCheckboxItemElement, DropdownMenuCheckboxItemProps>(
|
|
155
|
+
({ children, className, checked, ...props }, ref) => (
|
|
156
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
157
|
+
ref={ref}
|
|
158
|
+
className={cn(
|
|
159
|
+
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm transition focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
160
|
+
className,
|
|
161
|
+
)}
|
|
162
|
+
checked={checked}
|
|
163
|
+
{...props}
|
|
164
|
+
>
|
|
165
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
166
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
167
|
+
<CheckIcon className="size-4" />
|
|
168
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
169
|
+
</span>
|
|
170
|
+
{children}
|
|
171
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
172
|
+
),
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
214
176
|
|
|
215
177
|
/* -----------------------------------------------------------------------------
|
|
216
178
|
* Component: DropdownMenuRadioItem
|
|
217
179
|
* -------------------------------------------------------------------------- */
|
|
218
180
|
|
|
219
|
-
type DropdownMenuRadioItemElement = React.ElementRef<
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
242
|
-
</span>
|
|
243
|
-
{children}
|
|
244
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
245
|
-
));
|
|
181
|
+
type DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;
|
|
182
|
+
type DropdownMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>;
|
|
183
|
+
|
|
184
|
+
const DropdownMenuRadioItem = React.forwardRef<DropdownMenuRadioItemElement, DropdownMenuRadioItemProps>(
|
|
185
|
+
({ children, className, ...props }, ref) => (
|
|
186
|
+
<DropdownMenuPrimitive.RadioItem
|
|
187
|
+
ref={ref}
|
|
188
|
+
className={cn(
|
|
189
|
+
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm transition focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
190
|
+
className,
|
|
191
|
+
)}
|
|
192
|
+
{...props}
|
|
193
|
+
>
|
|
194
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
195
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
196
|
+
<DotFilledIcon className="size-4 fill-current" />
|
|
197
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
198
|
+
</span>
|
|
199
|
+
{children}
|
|
200
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
201
|
+
),
|
|
202
|
+
);
|
|
246
203
|
|
|
247
204
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
248
205
|
|
|
@@ -250,29 +207,21 @@ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
|
250
207
|
* Component: DropdownMenuLabel
|
|
251
208
|
* -------------------------------------------------------------------------- */
|
|
252
209
|
|
|
253
|
-
type DropdownMenuLabelElement = React.ElementRef<
|
|
254
|
-
typeof DropdownMenuPrimitive.Label
|
|
255
|
-
>;
|
|
210
|
+
type DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;
|
|
256
211
|
|
|
257
|
-
interface DropdownMenuLabelProps
|
|
258
|
-
extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> {
|
|
212
|
+
interface DropdownMenuLabelProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> {
|
|
259
213
|
inset?: boolean;
|
|
260
214
|
}
|
|
261
215
|
|
|
262
|
-
const DropdownMenuLabel = React.forwardRef<
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
className,
|
|
272
|
-
)}
|
|
273
|
-
{...props}
|
|
274
|
-
/>
|
|
275
|
-
));
|
|
216
|
+
const DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(
|
|
217
|
+
({ className, inset, ...props }, ref) => (
|
|
218
|
+
<DropdownMenuPrimitive.Label
|
|
219
|
+
ref={ref}
|
|
220
|
+
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
221
|
+
{...props}
|
|
222
|
+
/>
|
|
223
|
+
),
|
|
224
|
+
);
|
|
276
225
|
|
|
277
226
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
278
227
|
|
|
@@ -280,23 +229,14 @@ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
|
280
229
|
* Component: DropdownMenuSeparator
|
|
281
230
|
* -------------------------------------------------------------------------- */
|
|
282
231
|
|
|
283
|
-
type DropdownMenuSeparatorElement = React.ElementRef<
|
|
284
|
-
|
|
285
|
-
>;
|
|
286
|
-
type DropdownMenuSeparatorProps = React.ComponentPropsWithoutRef<
|
|
287
|
-
typeof DropdownMenuPrimitive.Separator
|
|
288
|
-
>;
|
|
232
|
+
type DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;
|
|
233
|
+
type DropdownMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>;
|
|
289
234
|
|
|
290
|
-
const DropdownMenuSeparator = React.forwardRef<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
ref={ref}
|
|
296
|
-
className={cn('bg-muted -mx-1 my-1 h-px', className)}
|
|
297
|
-
{...props}
|
|
298
|
-
/>
|
|
299
|
-
));
|
|
235
|
+
const DropdownMenuSeparator = React.forwardRef<DropdownMenuSeparatorElement, DropdownMenuSeparatorProps>(
|
|
236
|
+
({ className, ...props }, ref) => (
|
|
237
|
+
<DropdownMenuPrimitive.Separator ref={ref} className={cn('bg-muted -mx-1 my-1 h-px', className)} {...props} />
|
|
238
|
+
),
|
|
239
|
+
);
|
|
300
240
|
|
|
301
241
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
302
242
|
|
|
@@ -306,16 +246,8 @@ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
|
306
246
|
|
|
307
247
|
type DropdownMenuShortcutProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
308
248
|
|
|
309
|
-
function DropdownMenuShortcut({
|
|
310
|
-
className,
|
|
311
|
-
...props
|
|
312
|
-
}: DropdownMenuShortcutProps): React.JSX.Element {
|
|
313
|
-
return (
|
|
314
|
-
<span
|
|
315
|
-
className={cn('ml-auto text-xs tracking-widest opacity-60', className)}
|
|
316
|
-
{...props}
|
|
317
|
-
/>
|
|
318
|
-
);
|
|
249
|
+
function DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps): React.JSX.Element {
|
|
250
|
+
return <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />;
|
|
319
251
|
}
|
|
320
252
|
|
|
321
253
|
/* -----------------------------------------------------------------------------
|
package/src/react/em.tsx
CHANGED
|
@@ -11,13 +11,11 @@ interface EmProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const Em = React.forwardRef<EmElement, EmProps>(
|
|
15
|
-
|
|
16
|
-
const Component = asChild ? Slot : 'em';
|
|
14
|
+
const Em = React.forwardRef<EmElement, EmProps>(({ asChild, ...props }, ref) => {
|
|
15
|
+
const Component = asChild ? Slot : 'em';
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
17
|
+
return <Component ref={ref} {...props} />;
|
|
18
|
+
});
|
|
21
19
|
|
|
22
20
|
Em.displayName = 'Em';
|
|
23
21
|
|
package/src/react/form.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
4
|
import { Slot } from '@radix-ui/react-slot';
|
|
6
5
|
import {
|
|
7
6
|
Controller,
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
} from 'react-hook-form';
|
|
17
16
|
import { cn } from '../lib/utils';
|
|
18
17
|
import { Label } from './label';
|
|
18
|
+
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
19
19
|
|
|
20
20
|
/* -----------------------------------------------------------------------------
|
|
21
21
|
* Context: Form
|
|
@@ -32,9 +32,7 @@ interface FormItemContextValue {
|
|
|
32
32
|
id: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const FormFieldContext = React.createContext<FormFieldContextValue | null>(
|
|
36
|
-
null,
|
|
37
|
-
);
|
|
35
|
+
const FormFieldContext = React.createContext<FormFieldContextValue | null>(null);
|
|
38
36
|
|
|
39
37
|
const FormItemContext = React.createContext<FormItemContextValue | null>(null);
|
|
40
38
|
|
|
@@ -106,17 +104,15 @@ function FormField<
|
|
|
106
104
|
type FormItemElement = HTMLDivElement;
|
|
107
105
|
type FormItemProps = React.HTMLAttributes<HTMLDivElement>;
|
|
108
106
|
|
|
109
|
-
const FormItem = React.forwardRef<FormItemElement, FormItemProps>(
|
|
110
|
-
|
|
111
|
-
const id = React.useId();
|
|
107
|
+
const FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props }, ref) => {
|
|
108
|
+
const id = React.useId();
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
);
|
|
110
|
+
return (
|
|
111
|
+
<FormItemContext.Provider value={{ id }}>
|
|
112
|
+
<div ref={ref} className={cn('space-y-2', className)} {...props} />
|
|
113
|
+
</FormItemContext.Provider>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
120
116
|
|
|
121
117
|
FormItem.displayName = 'FormItem';
|
|
122
118
|
|
|
@@ -125,24 +121,13 @@ FormItem.displayName = 'FormItem';
|
|
|
125
121
|
* -------------------------------------------------------------------------- */
|
|
126
122
|
|
|
127
123
|
type FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;
|
|
128
|
-
type FormLabelProps = React.ComponentPropsWithoutRef<
|
|
129
|
-
typeof LabelPrimitive.Root
|
|
130
|
-
>;
|
|
124
|
+
type FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;
|
|
131
125
|
|
|
132
|
-
const FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<Label
|
|
138
|
-
ref={ref}
|
|
139
|
-
className={cn(error && 'text-destructive', className)}
|
|
140
|
-
htmlFor={formItemId}
|
|
141
|
-
{...props}
|
|
142
|
-
/>
|
|
143
|
-
);
|
|
144
|
-
},
|
|
145
|
-
);
|
|
126
|
+
const FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props }, ref) => {
|
|
127
|
+
const { error, formItemId } = useFormField();
|
|
128
|
+
|
|
129
|
+
return <Label ref={ref} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />;
|
|
130
|
+
});
|
|
146
131
|
|
|
147
132
|
FormLabel.displayName = 'FormLabel';
|
|
148
133
|
|
|
@@ -153,24 +138,19 @@ FormLabel.displayName = 'FormLabel';
|
|
|
153
138
|
type FormControlElement = React.ElementRef<typeof Slot>;
|
|
154
139
|
type FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;
|
|
155
140
|
|
|
156
|
-
const FormControl = React.forwardRef<FormControlElement, FormControlProps>(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{...props}
|
|
170
|
-
/>
|
|
171
|
-
);
|
|
172
|
-
},
|
|
173
|
-
);
|
|
141
|
+
const FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props }, ref) => {
|
|
142
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Slot
|
|
146
|
+
ref={ref}
|
|
147
|
+
id={formItemId}
|
|
148
|
+
aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}
|
|
149
|
+
aria-invalid={Boolean(error)}
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
});
|
|
174
154
|
|
|
175
155
|
FormControl.displayName = 'FormControl';
|
|
176
156
|
|
|
@@ -181,21 +161,13 @@ FormControl.displayName = 'FormControl';
|
|
|
181
161
|
type FormDescriptionElement = HTMLParagraphElement;
|
|
182
162
|
type FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
183
163
|
|
|
184
|
-
const FormDescription = React.forwardRef<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
>(({ className, ...props }, ref) => {
|
|
188
|
-
const { formDescriptionId } = useFormField();
|
|
164
|
+
const FormDescription = React.forwardRef<FormDescriptionElement, FormDescriptionProps>(
|
|
165
|
+
({ className, ...props }, ref) => {
|
|
166
|
+
const { formDescriptionId } = useFormField();
|
|
189
167
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
id={formDescriptionId}
|
|
194
|
-
className={cn('text-muted-foreground text-xs', className)}
|
|
195
|
-
{...props}
|
|
196
|
-
/>
|
|
197
|
-
);
|
|
198
|
-
});
|
|
168
|
+
return <p ref={ref} id={formDescriptionId} className={cn('text-muted-foreground text-xs', className)} {...props} />;
|
|
169
|
+
},
|
|
170
|
+
);
|
|
199
171
|
|
|
200
172
|
FormDescription.displayName = 'FormDescription';
|
|
201
173
|
|
|
@@ -206,27 +178,20 @@ FormDescription.displayName = 'FormDescription';
|
|
|
206
178
|
type FormMessageElement = HTMLParagraphElement;
|
|
207
179
|
type FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
208
180
|
|
|
209
|
-
const FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
{...props}
|
|
224
|
-
>
|
|
225
|
-
{body}
|
|
226
|
-
</p>
|
|
227
|
-
);
|
|
228
|
-
},
|
|
229
|
-
);
|
|
181
|
+
const FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(({ children, className, ...props }, ref) => {
|
|
182
|
+
const { error, formMessageId } = useFormField();
|
|
183
|
+
const body = error?.message ? String(error.message) : children;
|
|
184
|
+
|
|
185
|
+
if (!body) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<p ref={ref} id={formMessageId} className={cn('text-destructive text-xs font-medium', className)} {...props}>
|
|
191
|
+
{body}
|
|
192
|
+
</p>
|
|
193
|
+
);
|
|
194
|
+
});
|
|
230
195
|
|
|
231
196
|
FormMessage.displayName = 'FormMessage';
|
|
232
197
|
|
package/src/react/heading.tsx
CHANGED
|
@@ -12,13 +12,11 @@ interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const Heading = React.forwardRef<HeadingElement, HeadingProps>(
|
|
16
|
-
|
|
17
|
-
const Component = asChild ? Slot : Tag;
|
|
15
|
+
const Heading = React.forwardRef<HeadingElement, HeadingProps>(({ asChild, as: Tag = 'h1', ...props }, ref) => {
|
|
16
|
+
const Component = asChild ? Slot : Tag;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
18
|
+
return <Component ref={ref} {...props} />;
|
|
19
|
+
});
|
|
22
20
|
|
|
23
21
|
Heading.displayName = 'Heading';
|
|
24
22
|
|