@codefast/ui 0.0.64 → 0.0.66
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-ZMF2SRE5.js → chunk-26W5NJTU.js} +1 -1
- package/dist/chunk-26W5NJTU.js.map +1 -0
- package/dist/chunk-3COHZ24E.cjs +2 -0
- package/dist/chunk-3COHZ24E.cjs.map +1 -0
- package/dist/chunk-4MTN7WZ2.cjs +2 -0
- package/dist/chunk-4MTN7WZ2.cjs.map +1 -0
- package/dist/chunk-5QETIFO4.js +2 -0
- package/dist/chunk-5QETIFO4.js.map +1 -0
- package/dist/{chunk-WECV77JD.cjs → chunk-5RJANBDJ.cjs} +1 -1
- package/dist/chunk-5RJANBDJ.cjs.map +1 -0
- package/dist/chunk-6UQKMUZG.cjs +2 -0
- package/dist/chunk-6UQKMUZG.cjs.map +1 -0
- package/dist/chunk-AVEDWLNQ.js +2 -0
- package/dist/chunk-AVEDWLNQ.js.map +1 -0
- package/dist/{chunk-YLE5XFEO.cjs → chunk-EW7DAPDC.cjs} +1 -1
- package/dist/chunk-EW7DAPDC.cjs.map +1 -0
- package/dist/chunk-HDHZESSG.js +2 -0
- package/dist/chunk-HDHZESSG.js.map +1 -0
- package/dist/{chunk-GCHNSK5O.cjs → chunk-JMM2MTPI.cjs} +1 -1
- package/dist/chunk-JMM2MTPI.cjs.map +1 -0
- package/dist/{chunk-WRO3QIWH.js → chunk-JNOLIDCD.js} +1 -1
- package/dist/chunk-JNOLIDCD.js.map +1 -0
- package/dist/{chunk-F5TIIJJJ.cjs → chunk-LOJBMYTH.cjs} +1 -1
- package/dist/chunk-LOJBMYTH.cjs.map +1 -0
- package/dist/{chunk-A5ILA637.js → chunk-RBP4PBCK.js} +1 -1
- package/dist/chunk-RBP4PBCK.js.map +1 -0
- package/dist/{chunk-L7IASKCH.js → chunk-RVGKUNXC.js} +1 -1
- package/dist/{chunk-L7IASKCH.js.map → chunk-RVGKUNXC.js.map} +1 -1
- package/dist/{chunk-72NPDP3X.cjs → chunk-T3G5USVY.cjs} +1 -1
- package/dist/chunk-T3G5USVY.cjs.map +1 -0
- package/dist/chunk-VDVLCSO4.js +2 -0
- package/dist/chunk-VDVLCSO4.js.map +1 -0
- package/dist/{chunk-2OBTJ7SD.cjs → chunk-WKKCZQNO.cjs} +2 -2
- package/dist/chunk-WKKCZQNO.cjs.map +1 -0
- package/dist/{chunk-FNQFZJUG.js → chunk-WQFHFTYS.js} +1 -1
- package/dist/chunk-WQFHFTYS.js.map +1 -0
- package/dist/react/accordion.cjs.map +1 -1
- package/dist/react/accordion.js.map +1 -1
- package/dist/react/alert-dialog.cjs +1 -1
- package/dist/react/alert-dialog.cjs.map +1 -1
- package/dist/react/alert-dialog.d.cts +3 -1
- package/dist/react/alert-dialog.d.ts +3 -1
- package/dist/react/alert-dialog.js +1 -1
- package/dist/react/alert-dialog.js.map +1 -1
- package/dist/react/alert.cjs.map +1 -1
- package/dist/react/alert.js.map +1 -1
- package/dist/react/avatar.cjs.map +1 -1
- package/dist/react/avatar.js.map +1 -1
- package/dist/react/blockquote.cjs.map +1 -1
- package/dist/react/blockquote.js.map +1 -1
- package/dist/react/box.cjs.map +1 -1
- package/dist/react/box.js.map +1 -1
- package/dist/react/breadcrumb.cjs +1 -1
- package/dist/react/breadcrumb.cjs.map +1 -1
- package/dist/react/breadcrumb.js +1 -1
- package/dist/react/breadcrumb.js.map +1 -1
- package/dist/react/button.cjs +1 -1
- package/dist/react/button.js +1 -1
- package/dist/react/calendar.cjs +1 -1
- package/dist/react/calendar.js +1 -1
- package/dist/react/card.cjs.map +1 -1
- package/dist/react/card.js.map +1 -1
- package/dist/react/carousel.cjs +1 -1
- package/dist/react/carousel.cjs.map +1 -1
- package/dist/react/carousel.js +1 -1
- package/dist/react/carousel.js.map +1 -1
- package/dist/react/checkbox-cards.cjs +1 -1
- package/dist/react/checkbox-cards.cjs.map +1 -1
- package/dist/react/checkbox-cards.js +1 -1
- package/dist/react/checkbox-cards.js.map +1 -1
- package/dist/react/checkbox-group.cjs +1 -1
- package/dist/react/checkbox-group.cjs.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.primitive.cjs +1 -1
- package/dist/react/checkbox-group.primitive.js +1 -1
- package/dist/react/checkbox.cjs +1 -1
- package/dist/react/checkbox.cjs.map +1 -1
- package/dist/react/checkbox.js +1 -1
- package/dist/react/checkbox.js.map +1 -1
- package/dist/react/code.cjs.map +1 -1
- package/dist/react/code.js.map +1 -1
- package/dist/react/collapsible.cjs.map +1 -1
- package/dist/react/collapsible.js.map +1 -1
- package/dist/react/command.cjs +1 -1
- package/dist/react/command.cjs.map +1 -1
- package/dist/react/command.js +1 -1
- package/dist/react/command.js.map +1 -1
- package/dist/react/container.cjs.map +1 -1
- package/dist/react/container.js.map +1 -1
- package/dist/react/context-menu.cjs.map +1 -1
- package/dist/react/context-menu.js.map +1 -1
- package/dist/react/data-table.cjs +1 -1
- package/dist/react/data-table.js +1 -1
- package/dist/react/dialog.cjs +1 -1
- package/dist/react/dialog.d.cts +1 -1
- package/dist/react/dialog.d.ts +1 -1
- package/dist/react/dialog.js +1 -1
- package/dist/react/drawer.cjs.map +1 -1
- package/dist/react/drawer.js.map +1 -1
- package/dist/react/dropdown-menu.cjs +1 -1
- package/dist/react/dropdown-menu.js +1 -1
- package/dist/react/em.cjs.map +1 -1
- package/dist/react/em.js.map +1 -1
- package/dist/react/form.cjs +1 -1
- package/dist/react/form.cjs.map +1 -1
- package/dist/react/form.js +1 -1
- package/dist/react/form.js.map +1 -1
- package/dist/react/heading.cjs.map +1 -1
- package/dist/react/heading.js.map +1 -1
- package/dist/react/hover-card.cjs.map +1 -1
- package/dist/react/hover-card.js.map +1 -1
- package/dist/react/input-otp.cjs +1 -1
- package/dist/react/input-otp.cjs.map +1 -1
- package/dist/react/input-otp.js +1 -1
- package/dist/react/input-otp.js.map +1 -1
- package/dist/react/input.cjs +1 -1
- package/dist/react/input.cjs.map +1 -1
- package/dist/react/input.d.cts +113 -34
- package/dist/react/input.d.ts +113 -34
- package/dist/react/input.js +1 -1
- package/dist/react/input.js.map +1 -1
- package/dist/react/kbd.cjs.map +1 -1
- package/dist/react/kbd.js.map +1 -1
- package/dist/react/label.cjs +1 -1
- package/dist/react/label.js +1 -1
- package/dist/react/menubar.cjs.map +1 -1
- package/dist/react/menubar.js.map +1 -1
- package/dist/react/navigation-menu.cjs.map +1 -1
- package/dist/react/navigation-menu.js.map +1 -1
- package/dist/react/pagination.cjs +1 -1
- package/dist/react/pagination.cjs.map +1 -1
- package/dist/react/pagination.js +1 -1
- package/dist/react/pagination.js.map +1 -1
- package/dist/react/popover.cjs.map +1 -1
- package/dist/react/popover.js.map +1 -1
- package/dist/react/pre.cjs.map +1 -1
- package/dist/react/pre.js.map +1 -1
- package/dist/react/progress.cjs.map +1 -1
- package/dist/react/progress.js.map +1 -1
- package/dist/react/quote.cjs.map +1 -1
- package/dist/react/quote.js.map +1 -1
- package/dist/react/radio-cards.cjs +1 -1
- package/dist/react/radio-cards.cjs.map +1 -1
- package/dist/react/radio-cards.js +1 -1
- package/dist/react/radio-cards.js.map +1 -1
- package/dist/react/radio-group.cjs.map +1 -1
- package/dist/react/radio-group.js.map +1 -1
- package/dist/react/radio.cjs.map +1 -1
- package/dist/react/radio.js.map +1 -1
- package/dist/react/scroll-area.cjs.map +1 -1
- package/dist/react/scroll-area.js.map +1 -1
- package/dist/react/section.cjs.map +1 -1
- package/dist/react/section.js.map +1 -1
- package/dist/react/select.cjs +1 -1
- package/dist/react/select.js +1 -1
- package/dist/react/separator.cjs.map +1 -1
- package/dist/react/separator.js.map +1 -1
- package/dist/react/sheet.cjs +1 -1
- package/dist/react/sheet.cjs.map +1 -1
- package/dist/react/sheet.js +1 -1
- package/dist/react/sheet.js.map +1 -1
- package/dist/react/slider.cjs.map +1 -1
- package/dist/react/slider.js.map +1 -1
- package/dist/react/spinner.cjs +1 -1
- package/dist/react/spinner.js +1 -1
- package/dist/react/strong.cjs.map +1 -1
- package/dist/react/strong.js.map +1 -1
- package/dist/react/switch.cjs +1 -1
- package/dist/react/switch.cjs.map +1 -1
- package/dist/react/switch.js +1 -1
- package/dist/react/switch.js.map +1 -1
- package/dist/react/table.cjs.map +1 -1
- package/dist/react/table.js.map +1 -1
- package/dist/react/tabs.cjs.map +1 -1
- package/dist/react/tabs.js.map +1 -1
- package/dist/react/text-input.cjs +2 -0
- package/dist/react/text-input.cjs.map +1 -0
- package/dist/react/text-input.d.cts +11 -0
- package/dist/react/text-input.d.ts +11 -0
- package/dist/react/text-input.js +2 -0
- package/dist/react/text-input.js.map +1 -0
- package/dist/react/text.cjs.map +1 -1
- package/dist/react/text.js.map +1 -1
- package/dist/react/textarea.cjs +1 -1
- package/dist/react/textarea.cjs.map +1 -1
- package/dist/react/textarea.js +1 -1
- package/dist/react/textarea.js.map +1 -1
- package/dist/react/toggle-group.cjs +1 -1
- package/dist/react/toggle-group.cjs.map +1 -1
- package/dist/react/toggle-group.js +1 -1
- package/dist/react/toggle-group.js.map +1 -1
- package/dist/react/toggle.cjs +1 -1
- package/dist/react/toggle.js +1 -1
- package/dist/react/tooltip.cjs.map +1 -1
- package/dist/react/tooltip.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +8 -2
- package/src/react/accordion.tsx +9 -7
- package/src/react/alert-dialog.tsx +55 -20
- package/src/react/alert.tsx +11 -9
- package/src/react/avatar.tsx +13 -11
- package/src/react/blockquote.tsx +2 -2
- package/src/react/box.tsx +2 -2
- package/src/react/breadcrumb.tsx +33 -27
- package/src/react/button.tsx +3 -4
- package/src/react/card.tsx +21 -15
- package/src/react/carousel.tsx +10 -10
- package/src/react/checkbox-cards.tsx +8 -6
- package/src/react/checkbox-group.primitive.tsx +12 -6
- package/src/react/checkbox-group.tsx +7 -5
- package/src/react/checkbox.tsx +3 -3
- package/src/react/code.tsx +2 -2
- package/src/react/collapsible.tsx +2 -2
- package/src/react/command.tsx +46 -36
- package/src/react/container.tsx +6 -4
- package/src/react/context-menu.tsx +22 -18
- package/src/react/dialog.tsx +13 -9
- package/src/react/drawer.tsx +10 -6
- package/src/react/dropdown-menu.tsx +20 -16
- package/src/react/em.tsx +2 -2
- package/src/react/form.tsx +38 -22
- package/src/react/heading.tsx +6 -4
- package/src/react/hover-card.tsx +7 -5
- package/src/react/input-otp.tsx +40 -34
- package/src/react/input.tsx +115 -12
- package/src/react/kbd.tsx +2 -2
- package/src/react/label.tsx +2 -2
- package/src/react/menubar.tsx +48 -42
- package/src/react/navigation-menu.tsx +12 -12
- package/src/react/pagination.tsx +5 -5
- package/src/react/popover.tsx +7 -5
- package/src/react/pre.tsx +2 -2
- package/src/react/progress.tsx +2 -2
- package/src/react/quote.tsx +2 -2
- package/src/react/radio-cards.tsx +16 -14
- package/src/react/radio-group.tsx +18 -16
- package/src/react/radio.tsx +16 -14
- package/src/react/scroll-area.tsx +4 -4
- package/src/react/section.tsx +2 -2
- package/src/react/select.tsx +32 -30
- package/src/react/separator.tsx +2 -2
- package/src/react/sheet.tsx +15 -7
- package/src/react/slider.tsx +2 -2
- package/src/react/spinner.tsx +2 -2
- package/src/react/strong.tsx +2 -2
- package/src/react/switch.tsx +3 -3
- package/src/react/table.tsx +23 -17
- package/src/react/tabs.tsx +6 -6
- package/src/react/text-input.tsx +36 -0
- package/src/react/text.tsx +2 -2
- package/src/react/textarea.tsx +3 -3
- package/src/react/toggle-group.tsx +7 -4
- package/src/react/toggle.tsx +2 -2
- package/src/react/tooltip.tsx +7 -5
- package/dist/chunk-2OBTJ7SD.cjs.map +0 -1
- package/dist/chunk-37XZ3LKY.cjs +0 -2
- package/dist/chunk-37XZ3LKY.cjs.map +0 -1
- package/dist/chunk-3OEPCFBF.cjs +0 -2
- package/dist/chunk-3OEPCFBF.cjs.map +0 -1
- package/dist/chunk-6AFJCDFU.js +0 -2
- package/dist/chunk-6AFJCDFU.js.map +0 -1
- package/dist/chunk-72NPDP3X.cjs.map +0 -1
- package/dist/chunk-7CHCTEST.js +0 -2
- package/dist/chunk-7CHCTEST.js.map +0 -1
- package/dist/chunk-A5ILA637.js.map +0 -1
- package/dist/chunk-F5TIIJJJ.cjs.map +0 -1
- package/dist/chunk-FNQFZJUG.js.map +0 -1
- package/dist/chunk-GCHNSK5O.cjs.map +0 -1
- package/dist/chunk-SHMTOJHM.js +0 -2
- package/dist/chunk-SHMTOJHM.js.map +0 -1
- package/dist/chunk-WECV77JD.cjs.map +0 -1
- package/dist/chunk-WRO3QIWH.js.map +0 -1
- package/dist/chunk-YLE5XFEO.cjs.map +0 -1
- package/dist/chunk-ZMF2SRE5.js.map +0 -1
package/src/react/checkbox.tsx
CHANGED
|
@@ -12,11 +12,11 @@ import { cn } from '../lib/utils';
|
|
|
12
12
|
type CheckboxElement = React.ElementRef<typeof CheckboxPrimitive.Root>;
|
|
13
13
|
type CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;
|
|
14
14
|
|
|
15
|
-
const Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>(({ className, ...props },
|
|
15
|
+
const Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>(({ className, ...props }, forwardedRef) => (
|
|
16
16
|
<CheckboxPrimitive.Root
|
|
17
|
-
ref={
|
|
17
|
+
ref={forwardedRef}
|
|
18
18
|
className={cn(
|
|
19
|
-
'border-input hover:border-primary aria-checked:border-primary aria-checked:bg-primary aria-checked:text-primary-foreground peer flex size-4 shrink-0 rounded-sm border shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-
|
|
19
|
+
'border-input hover:border-primary aria-checked:border-primary aria-checked:bg-primary aria-checked:text-primary-foreground peer flex size-4 shrink-0 rounded-sm border shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-default disabled:opacity-50',
|
|
20
20
|
className,
|
|
21
21
|
)}
|
|
22
22
|
{...props}
|
package/src/react/code.tsx
CHANGED
|
@@ -11,10 +11,10 @@ interface CodeProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const Code = React.forwardRef<CodeElement, CodeProps>(({ asChild, ...props },
|
|
14
|
+
const Code = React.forwardRef<CodeElement, CodeProps>(({ asChild, ...props }, forwardedRef) => {
|
|
15
15
|
const Component = asChild ? Slot : 'code';
|
|
16
16
|
|
|
17
|
-
return <Component ref={
|
|
17
|
+
return <Component ref={forwardedRef} {...props} />;
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
Code.displayName = 'Code';
|
|
@@ -26,9 +26,9 @@ type CollapsibleContentElement = React.ElementRef<typeof CollapsiblePrimitive.Co
|
|
|
26
26
|
type CollapsibleContentProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>;
|
|
27
27
|
|
|
28
28
|
const CollapsibleContent = React.forwardRef<CollapsibleContentElement, CollapsibleContentProps>(
|
|
29
|
-
({ className, ...props },
|
|
29
|
+
({ className, ...props }, forwardedRef) => (
|
|
30
30
|
<CollapsiblePrimitive.CollapsibleContent
|
|
31
|
-
ref={
|
|
31
|
+
ref={forwardedRef}
|
|
32
32
|
className={cn(
|
|
33
33
|
'data-[state=open]:animate-collapsible-open data-[state=closed]:animate-collapsible-closed overflow-hidden',
|
|
34
34
|
className,
|
package/src/react/command.tsx
CHANGED
|
@@ -13,9 +13,9 @@ import { Dialog, DialogContent } from './dialog';
|
|
|
13
13
|
type CommandElement = React.ElementRef<typeof CommandPrimitive>;
|
|
14
14
|
type CommandProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive>;
|
|
15
15
|
|
|
16
|
-
const Command = React.forwardRef<CommandElement, CommandProps>(({ className, ...props },
|
|
16
|
+
const Command = React.forwardRef<CommandElement, CommandProps>(({ className, ...props }, forwardedRef) => (
|
|
17
17
|
<CommandPrimitive
|
|
18
|
-
ref={
|
|
18
|
+
ref={forwardedRef}
|
|
19
19
|
className={cn(
|
|
20
20
|
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
|
|
21
21
|
className,
|
|
@@ -51,19 +51,21 @@ function CommandDialog({ children, ...props }: CommandDialogProps): React.JSX.El
|
|
|
51
51
|
type CommandInputElement = React.ElementRef<typeof CommandPrimitive.Input>;
|
|
52
52
|
type CommandInputProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>;
|
|
53
53
|
|
|
54
|
-
const CommandInput = React.forwardRef<CommandInputElement, CommandInputProps>(
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
const CommandInput = React.forwardRef<CommandInputElement, CommandInputProps>(
|
|
55
|
+
({ className, ...props }, forwardedRef) => (
|
|
56
|
+
<div className="flex items-center gap-2 border-b px-3" cmdk-input-wrapper="">
|
|
57
|
+
<MagnifyingGlassIcon className="size-5 shrink-0 opacity-50" />
|
|
58
|
+
<CommandPrimitive.Input
|
|
59
|
+
ref={forwardedRef}
|
|
60
|
+
className={cn(
|
|
61
|
+
'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent text-sm outline-none disabled:cursor-default disabled:opacity-50',
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
),
|
|
68
|
+
);
|
|
67
69
|
|
|
68
70
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
69
71
|
|
|
@@ -74,8 +76,12 @@ CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
|
74
76
|
type CommandListElement = React.ElementRef<typeof CommandPrimitive.List>;
|
|
75
77
|
type CommandListProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>;
|
|
76
78
|
|
|
77
|
-
const CommandList = React.forwardRef<CommandListElement, CommandListProps>(({ className, ...props },
|
|
78
|
-
<CommandPrimitive.List
|
|
79
|
+
const CommandList = React.forwardRef<CommandListElement, CommandListProps>(({ className, ...props }, forwardedRef) => (
|
|
80
|
+
<CommandPrimitive.List
|
|
81
|
+
ref={forwardedRef}
|
|
82
|
+
className={cn('max-h-72 overflow-y-auto overflow-x-hidden', className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
79
85
|
));
|
|
80
86
|
|
|
81
87
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
@@ -87,8 +93,8 @@ CommandList.displayName = CommandPrimitive.List.displayName;
|
|
|
87
93
|
type CommandEmptyElement = React.ElementRef<typeof CommandPrimitive.Empty>;
|
|
88
94
|
type CommandEmptyProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>;
|
|
89
95
|
|
|
90
|
-
const CommandEmpty = React.forwardRef<CommandEmptyElement, CommandEmptyProps>((props,
|
|
91
|
-
<CommandPrimitive.Empty ref={
|
|
96
|
+
const CommandEmpty = React.forwardRef<CommandEmptyElement, CommandEmptyProps>((props, forwardedRef) => (
|
|
97
|
+
<CommandPrimitive.Empty ref={forwardedRef} className="py-6 text-center text-sm" {...props} />
|
|
92
98
|
));
|
|
93
99
|
|
|
94
100
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
@@ -100,16 +106,18 @@ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
|
100
106
|
type CommandGroupElement = React.ElementRef<typeof CommandPrimitive.Group>;
|
|
101
107
|
type CommandGroupProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>;
|
|
102
108
|
|
|
103
|
-
const CommandGroup = React.forwardRef<CommandGroupElement, CommandGroupProps>(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
const CommandGroup = React.forwardRef<CommandGroupElement, CommandGroupProps>(
|
|
110
|
+
({ className, ...props }, forwardedRef) => (
|
|
111
|
+
<CommandPrimitive.Group
|
|
112
|
+
ref={forwardedRef}
|
|
113
|
+
className={cn(
|
|
114
|
+
'text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
|
|
115
|
+
className,
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
/>
|
|
119
|
+
),
|
|
120
|
+
);
|
|
113
121
|
|
|
114
122
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
115
123
|
|
|
@@ -121,8 +129,8 @@ type CommandSeparatorElement = React.ElementRef<typeof CommandPrimitive.Separato
|
|
|
121
129
|
type CommandSeparatorProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>;
|
|
122
130
|
|
|
123
131
|
const CommandSeparator = React.forwardRef<CommandSeparatorElement, CommandSeparatorProps>(
|
|
124
|
-
({ className, ...props },
|
|
125
|
-
<CommandPrimitive.Separator ref={
|
|
132
|
+
({ className, ...props }, forwardedRef) => (
|
|
133
|
+
<CommandPrimitive.Separator ref={forwardedRef} className={cn('bg-border -mx-1 h-px', className)} {...props} />
|
|
126
134
|
),
|
|
127
135
|
);
|
|
128
136
|
|
|
@@ -135,9 +143,9 @@ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
|
135
143
|
type CommandItemElement = React.ElementRef<typeof CommandPrimitive.Item>;
|
|
136
144
|
type CommandItemProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>;
|
|
137
145
|
|
|
138
|
-
const CommandItem = React.forwardRef<CommandItemElement, CommandItemProps>(({ className, ...props },
|
|
146
|
+
const CommandItem = React.forwardRef<CommandItemElement, CommandItemProps>(({ className, ...props }, forwardedRef) => (
|
|
139
147
|
<CommandPrimitive.Item
|
|
140
|
-
ref={
|
|
148
|
+
ref={forwardedRef}
|
|
141
149
|
className={cn(
|
|
142
150
|
'aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:outline-none',
|
|
143
151
|
className,
|
|
@@ -155,9 +163,11 @@ CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
|
155
163
|
type CommandLoadingElement = React.ElementRef<typeof CommandPrimitive.Loading>;
|
|
156
164
|
type CommandLoadingProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Loading>;
|
|
157
165
|
|
|
158
|
-
const CommandLoading = React.forwardRef<CommandLoadingElement, CommandLoadingProps>(
|
|
159
|
-
|
|
160
|
-
)
|
|
166
|
+
const CommandLoading = React.forwardRef<CommandLoadingElement, CommandLoadingProps>(
|
|
167
|
+
({ className, ...props }, forwardedRef) => (
|
|
168
|
+
<CommandPrimitive.Loading ref={forwardedRef} className={cn('flex justify-center p-2', className)} {...props} />
|
|
169
|
+
),
|
|
170
|
+
);
|
|
161
171
|
|
|
162
172
|
CommandLoading.displayName = CommandPrimitive.Loading.displayName;
|
|
163
173
|
|
package/src/react/container.tsx
CHANGED
|
@@ -12,11 +12,13 @@ interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const Container = React.forwardRef<ContainerElement, ContainerProps>(
|
|
16
|
-
|
|
15
|
+
const Container = React.forwardRef<ContainerElement, ContainerProps>(
|
|
16
|
+
({ className, asChild, ...props }, forwardedRef) => {
|
|
17
|
+
const Component = asChild ? Slot : 'div';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
}
|
|
19
|
+
return <Component ref={forwardedRef} className={cn('container', className)} {...props} />;
|
|
20
|
+
},
|
|
21
|
+
);
|
|
20
22
|
|
|
21
23
|
Container.displayName = 'Container';
|
|
22
24
|
|
|
@@ -51,9 +51,9 @@ interface ContextMenuSubTriggerProps extends React.ComponentPropsWithoutRef<type
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const ContextMenuSubTrigger = React.forwardRef<ContextMenuSubTriggerElement, ContextMenuSubTriggerProps>(
|
|
54
|
-
({ children, className, inset, ...props },
|
|
54
|
+
({ children, className, inset, ...props }, forwardedRef) => (
|
|
55
55
|
<ContextMenuPrimitive.SubTrigger
|
|
56
|
-
ref={
|
|
56
|
+
ref={forwardedRef}
|
|
57
57
|
className={cn(
|
|
58
58
|
'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none',
|
|
59
59
|
inset && 'pl-8',
|
|
@@ -77,10 +77,10 @@ type ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive
|
|
|
77
77
|
type ContextMenuSubContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>;
|
|
78
78
|
|
|
79
79
|
const ContextMenuSubContent = React.forwardRef<ContextMenuSubContentElement, ContextMenuSubContentProps>(
|
|
80
|
-
({ className, ...props },
|
|
80
|
+
({ className, ...props }, forwardedRef) => (
|
|
81
81
|
<ContextMenuPrimitive.Portal>
|
|
82
82
|
<ContextMenuPrimitive.SubContent
|
|
83
|
-
ref={
|
|
83
|
+
ref={forwardedRef}
|
|
84
84
|
className={cn(
|
|
85
85
|
'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',
|
|
86
86
|
className,
|
|
@@ -101,10 +101,10 @@ type ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Co
|
|
|
101
101
|
type ContextMenuContentProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>;
|
|
102
102
|
|
|
103
103
|
const ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(
|
|
104
|
-
({ className, ...props },
|
|
104
|
+
({ className, ...props }, forwardedRef) => (
|
|
105
105
|
<ContextMenuPrimitive.Portal>
|
|
106
106
|
<ContextMenuPrimitive.Content
|
|
107
|
-
ref={
|
|
107
|
+
ref={forwardedRef}
|
|
108
108
|
className={cn(
|
|
109
109
|
'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 z-50 min-w-32 rounded-md border p-1 shadow-md',
|
|
110
110
|
className,
|
|
@@ -128,9 +128,9 @@ interface ContextMenuItemProps extends React.ComponentPropsWithoutRef<typeof Con
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
const ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(
|
|
131
|
-
({ className, inset, ...props },
|
|
131
|
+
({ className, inset, ...props }, forwardedRef) => (
|
|
132
132
|
<ContextMenuPrimitive.Item
|
|
133
|
-
ref={
|
|
133
|
+
ref={forwardedRef}
|
|
134
134
|
className={cn(
|
|
135
135
|
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
136
136
|
inset && 'pl-8',
|
|
@@ -151,9 +151,9 @@ type ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimiti
|
|
|
151
151
|
type ContextMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>;
|
|
152
152
|
|
|
153
153
|
const ContextMenuCheckboxItem = React.forwardRef<ContextMenuCheckboxItemElement, ContextMenuCheckboxItemProps>(
|
|
154
|
-
({ children, className, checked, ...props },
|
|
154
|
+
({ children, className, checked, ...props }, forwardedRef) => (
|
|
155
155
|
<ContextMenuPrimitive.CheckboxItem
|
|
156
|
-
ref={
|
|
156
|
+
ref={forwardedRef}
|
|
157
157
|
checked={checked}
|
|
158
158
|
className={cn(
|
|
159
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 focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
@@ -181,9 +181,9 @@ type ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.
|
|
|
181
181
|
type ContextMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>;
|
|
182
182
|
|
|
183
183
|
const ContextMenuRadioItem = React.forwardRef<ContextMenuRadioItemElement, ContextMenuRadioItemProps>(
|
|
184
|
-
({ children, className, ...props },
|
|
184
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
185
185
|
<ContextMenuPrimitive.RadioItem
|
|
186
|
-
ref={
|
|
186
|
+
ref={forwardedRef}
|
|
187
187
|
className={cn(
|
|
188
188
|
'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 focus:outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
189
189
|
className,
|
|
@@ -213,9 +213,9 @@ interface ContextMenuLabelProps extends React.ComponentPropsWithoutRef<typeof Co
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
const ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(
|
|
216
|
-
({ className, inset, ...props },
|
|
216
|
+
({ className, inset, ...props }, forwardedRef) => (
|
|
217
217
|
<ContextMenuPrimitive.Label
|
|
218
|
-
ref={
|
|
218
|
+
ref={forwardedRef}
|
|
219
219
|
className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
220
220
|
{...props}
|
|
221
221
|
/>
|
|
@@ -232,8 +232,12 @@ type ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.
|
|
|
232
232
|
type ContextMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>;
|
|
233
233
|
|
|
234
234
|
const ContextMenuSeparator = React.forwardRef<ContextMenuSeparatorElement, ContextMenuSeparatorProps>(
|
|
235
|
-
({ className, ...props },
|
|
236
|
-
<ContextMenuPrimitive.Separator
|
|
235
|
+
({ className, ...props }, forwardedRef) => (
|
|
236
|
+
<ContextMenuPrimitive.Separator
|
|
237
|
+
ref={forwardedRef}
|
|
238
|
+
className={cn('bg-border -mx-1 my-1 h-px', className)}
|
|
239
|
+
{...props}
|
|
240
|
+
/>
|
|
237
241
|
),
|
|
238
242
|
);
|
|
239
243
|
|
|
@@ -257,8 +261,8 @@ type ContextMenuArrowElement = React.ElementRef<typeof ContextMenuPrimitive.Arro
|
|
|
257
261
|
type ContextMenuArrowProps = ContextMenuPrimitive.ContextMenuArrowProps;
|
|
258
262
|
|
|
259
263
|
const ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(
|
|
260
|
-
({ className, ...props },
|
|
261
|
-
<ContextMenuPrimitive.Arrow ref={
|
|
264
|
+
({ className, ...props }, forwardedRef) => (
|
|
265
|
+
<ContextMenuPrimitive.Arrow ref={forwardedRef} className={cn('fill-popover', className)} {...props} />
|
|
262
266
|
),
|
|
263
267
|
);
|
|
264
268
|
|
package/src/react/dialog.tsx
CHANGED
|
@@ -34,13 +34,13 @@ type DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;
|
|
|
34
34
|
type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
|
|
35
35
|
|
|
36
36
|
const DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(
|
|
37
|
-
({ children, className, ...props },
|
|
37
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
38
38
|
<DialogPrimitive.Portal>
|
|
39
39
|
<DialogPrimitive.Overlay className="data-[state=open]:animate-duration-200 data-[state=closed]:animate-duration-200 data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out fixed inset-0 z-50 grid place-items-center overflow-auto bg-black/80 p-4 sm:pb-12 sm:pt-8">
|
|
40
40
|
<DialogPrimitive.Content
|
|
41
|
-
ref={
|
|
41
|
+
ref={forwardedRef}
|
|
42
42
|
className={cn(
|
|
43
|
-
'bg-background data-[state=open]:animate-in data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95 data-[state=open]:animate-duration-200 data-[state=closed]:animate-duration-200 data-[state=open]:fade-in data-[state=closed]:animate-out data-[state=closed]:fade-out relative z-50 flex w-full max-w-lg
|
|
43
|
+
'bg-background data-[state=open]:animate-in data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95 data-[state=open]:animate-duration-200 data-[state=closed]:animate-duration-200 data-[state=open]:fade-in data-[state=closed]:animate-out data-[state=closed]:fade-out relative z-50 flex w-full max-w-lg flex-col rounded-lg border shadow-lg',
|
|
44
44
|
className,
|
|
45
45
|
)}
|
|
46
46
|
{...props}
|
|
@@ -79,7 +79,7 @@ function DialogHeader({ className, ...props }: DialogHeaderProps): React.JSX.Ele
|
|
|
79
79
|
|
|
80
80
|
type DialogBodyProps = React.HTMLAttributes<HTMLDivElement>;
|
|
81
81
|
|
|
82
|
-
function DialogBody({ className, ...props }:
|
|
82
|
+
function DialogBody({ className, ...props }: DialogBodyProps): React.JSX.Element {
|
|
83
83
|
return <main className={cn('overflow-auto px-6 py-2', className)} {...props} />;
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -92,7 +92,7 @@ type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
|
92
92
|
function DialogFooter({ className, ...props }: DialogFooterProps): React.JSX.Element {
|
|
93
93
|
return (
|
|
94
94
|
<footer
|
|
95
|
-
className={cn('flex shrink-0 flex-col-reverse px-6 pb-6 pt-4 sm:flex-row sm:justify-end
|
|
95
|
+
className={cn('flex shrink-0 flex-col-reverse gap-2 px-6 pb-6 pt-4 sm:flex-row sm:justify-end', className)}
|
|
96
96
|
{...props}
|
|
97
97
|
/>
|
|
98
98
|
);
|
|
@@ -105,9 +105,9 @@ function DialogFooter({ className, ...props }: DialogFooterProps): React.JSX.Ele
|
|
|
105
105
|
type DialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;
|
|
106
106
|
type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
|
|
107
107
|
|
|
108
|
-
const DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(({ className, ...props },
|
|
108
|
+
const DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(({ className, ...props }, forwardedRef) => (
|
|
109
109
|
<DialogPrimitive.Title
|
|
110
|
-
ref={
|
|
110
|
+
ref={forwardedRef}
|
|
111
111
|
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
112
112
|
{...props}
|
|
113
113
|
/>
|
|
@@ -123,8 +123,12 @@ type DialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Descript
|
|
|
123
123
|
type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
|
|
124
124
|
|
|
125
125
|
const DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(
|
|
126
|
-
({ className, ...props },
|
|
127
|
-
<DialogPrimitive.Description
|
|
126
|
+
({ className, ...props }, forwardedRef) => (
|
|
127
|
+
<DialogPrimitive.Description
|
|
128
|
+
ref={forwardedRef}
|
|
129
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
128
132
|
),
|
|
129
133
|
);
|
|
130
134
|
|
package/src/react/drawer.tsx
CHANGED
|
@@ -36,11 +36,11 @@ type DrawerContentElement = React.ElementRef<typeof DrawerPrimitive.Content>;
|
|
|
36
36
|
type DrawerContentProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>;
|
|
37
37
|
|
|
38
38
|
const DrawerContent = React.forwardRef<DrawerContentElement, DrawerContentProps>(
|
|
39
|
-
({ children, className, ...props },
|
|
39
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
40
40
|
<DrawerPrimitive.Portal>
|
|
41
41
|
<DrawerPrimitive.Overlay className="fixed inset-0 z-50 bg-black/80" />
|
|
42
42
|
<DrawerPrimitive.Content
|
|
43
|
-
ref={
|
|
43
|
+
ref={forwardedRef}
|
|
44
44
|
className={cn(
|
|
45
45
|
'bg-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-xl border',
|
|
46
46
|
className,
|
|
@@ -83,9 +83,9 @@ function DrawerFooter({ className, ...props }: DrawerFooterProps): React.JSX.Ele
|
|
|
83
83
|
type DrawerTitleElement = React.ElementRef<typeof DrawerPrimitive.Title>;
|
|
84
84
|
type DrawerTitleProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>;
|
|
85
85
|
|
|
86
|
-
const DrawerTitle = React.forwardRef<DrawerTitleElement, DrawerTitleProps>(({ className, ...props },
|
|
86
|
+
const DrawerTitle = React.forwardRef<DrawerTitleElement, DrawerTitleProps>(({ className, ...props }, forwardedRef) => (
|
|
87
87
|
<DrawerPrimitive.Title
|
|
88
|
-
ref={
|
|
88
|
+
ref={forwardedRef}
|
|
89
89
|
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
90
90
|
{...props}
|
|
91
91
|
/>
|
|
@@ -101,8 +101,12 @@ type DrawerDescriptionElement = React.ElementRef<typeof DrawerPrimitive.Descript
|
|
|
101
101
|
type DrawerDescriptionProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>;
|
|
102
102
|
|
|
103
103
|
const DrawerDescription = React.forwardRef<DrawerDescriptionElement, DrawerDescriptionProps>(
|
|
104
|
-
({ className, ...props },
|
|
105
|
-
<DrawerPrimitive.Description
|
|
104
|
+
({ className, ...props }, forwardedRef) => (
|
|
105
|
+
<DrawerPrimitive.Description
|
|
106
|
+
ref={forwardedRef}
|
|
107
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
106
110
|
),
|
|
107
111
|
);
|
|
108
112
|
|
|
@@ -51,9 +51,9 @@ interface DropdownMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typ
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const DropdownMenuSubTrigger = React.forwardRef<DropdownMenuSubTriggerElement, DropdownMenuSubTriggerProps>(
|
|
54
|
-
({ children, className, inset, ...props },
|
|
54
|
+
({ children, className, inset, ...props }, forwardedRef) => (
|
|
55
55
|
<DropdownMenuPrimitive.SubTrigger
|
|
56
|
-
ref={
|
|
56
|
+
ref={forwardedRef}
|
|
57
57
|
className={cn(
|
|
58
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
59
|
inset && 'pl-8',
|
|
@@ -78,10 +78,10 @@ type DropdownMenuSubContentProps = DropdownMenuPrimitive.DropdownMenuSubContentP
|
|
|
78
78
|
const DropdownMenuSubContent = React.forwardRef<
|
|
79
79
|
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
80
80
|
DropdownMenuSubContentProps
|
|
81
|
-
>(({ className, ...props },
|
|
81
|
+
>(({ className, ...props }, forwardedRef) => (
|
|
82
82
|
<DropdownMenuPrimitive.Portal>
|
|
83
83
|
<DropdownMenuPrimitive.SubContent
|
|
84
|
-
ref={
|
|
84
|
+
ref={forwardedRef}
|
|
85
85
|
className={cn(
|
|
86
86
|
'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',
|
|
87
87
|
className,
|
|
@@ -101,10 +101,10 @@ type DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.
|
|
|
101
101
|
type DropdownMenuContentProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>;
|
|
102
102
|
|
|
103
103
|
const DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(
|
|
104
|
-
({ className, sideOffset = 6, ...props },
|
|
104
|
+
({ className, sideOffset = 6, ...props }, forwardedRef) => (
|
|
105
105
|
<DropdownMenuPrimitive.Portal>
|
|
106
106
|
<DropdownMenuPrimitive.Content
|
|
107
|
-
ref={
|
|
107
|
+
ref={forwardedRef}
|
|
108
108
|
className={cn(
|
|
109
109
|
'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',
|
|
110
110
|
className,
|
|
@@ -129,9 +129,9 @@ interface DropdownMenuItemProps extends React.ComponentPropsWithoutRef<typeof Dr
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(
|
|
132
|
-
({ className, inset, ...props },
|
|
132
|
+
({ className, inset, ...props }, forwardedRef) => (
|
|
133
133
|
<DropdownMenuPrimitive.Item
|
|
134
|
-
ref={
|
|
134
|
+
ref={forwardedRef}
|
|
135
135
|
className={cn(
|
|
136
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
137
|
inset && 'pl-8',
|
|
@@ -152,9 +152,9 @@ type DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimi
|
|
|
152
152
|
type DropdownMenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>;
|
|
153
153
|
|
|
154
154
|
const DropdownMenuCheckboxItem = React.forwardRef<DropdownMenuCheckboxItemElement, DropdownMenuCheckboxItemProps>(
|
|
155
|
-
({ children, className, checked, ...props },
|
|
155
|
+
({ children, className, checked, ...props }, forwardedRef) => (
|
|
156
156
|
<DropdownMenuPrimitive.CheckboxItem
|
|
157
|
-
ref={
|
|
157
|
+
ref={forwardedRef}
|
|
158
158
|
checked={checked}
|
|
159
159
|
className={cn(
|
|
160
160
|
'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',
|
|
@@ -182,9 +182,9 @@ type DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitiv
|
|
|
182
182
|
type DropdownMenuRadioItemProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>;
|
|
183
183
|
|
|
184
184
|
const DropdownMenuRadioItem = React.forwardRef<DropdownMenuRadioItemElement, DropdownMenuRadioItemProps>(
|
|
185
|
-
({ children, className, ...props },
|
|
185
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
186
186
|
<DropdownMenuPrimitive.RadioItem
|
|
187
|
-
ref={
|
|
187
|
+
ref={forwardedRef}
|
|
188
188
|
className={cn(
|
|
189
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
190
|
className,
|
|
@@ -214,9 +214,9 @@ interface DropdownMenuLabelProps extends React.ComponentPropsWithoutRef<typeof D
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
const DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(
|
|
217
|
-
({ className, inset, ...props },
|
|
217
|
+
({ className, inset, ...props }, forwardedRef) => (
|
|
218
218
|
<DropdownMenuPrimitive.Label
|
|
219
|
-
ref={
|
|
219
|
+
ref={forwardedRef}
|
|
220
220
|
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
221
221
|
{...props}
|
|
222
222
|
/>
|
|
@@ -233,8 +233,12 @@ type DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitiv
|
|
|
233
233
|
type DropdownMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>;
|
|
234
234
|
|
|
235
235
|
const DropdownMenuSeparator = React.forwardRef<DropdownMenuSeparatorElement, DropdownMenuSeparatorProps>(
|
|
236
|
-
({ className, ...props },
|
|
237
|
-
<DropdownMenuPrimitive.Separator
|
|
236
|
+
({ className, ...props }, forwardedRef) => (
|
|
237
|
+
<DropdownMenuPrimitive.Separator
|
|
238
|
+
ref={forwardedRef}
|
|
239
|
+
className={cn('bg-muted -mx-1 my-1 h-px', className)}
|
|
240
|
+
{...props}
|
|
241
|
+
/>
|
|
238
242
|
),
|
|
239
243
|
);
|
|
240
244
|
|
package/src/react/em.tsx
CHANGED
|
@@ -11,10 +11,10 @@ interface EmProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const Em = React.forwardRef<EmElement, EmProps>(({ asChild, ...props },
|
|
14
|
+
const Em = React.forwardRef<EmElement, EmProps>(({ asChild, ...props }, forwardedRef) => {
|
|
15
15
|
const Component = asChild ? Slot : 'em';
|
|
16
16
|
|
|
17
|
-
return <Component ref={
|
|
17
|
+
return <Component ref={forwardedRef} {...props} />;
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
Em.displayName = 'Em';
|
package/src/react/form.tsx
CHANGED
|
@@ -104,12 +104,12 @@ function FormField<
|
|
|
104
104
|
type FormItemElement = HTMLDivElement;
|
|
105
105
|
type FormItemProps = React.HTMLAttributes<HTMLDivElement>;
|
|
106
106
|
|
|
107
|
-
const FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props },
|
|
107
|
+
const FormItem = React.forwardRef<FormItemElement, FormItemProps>(({ className, ...props }, forwardedRef) => {
|
|
108
108
|
const id = React.useId();
|
|
109
109
|
|
|
110
110
|
return (
|
|
111
111
|
<FormItemContext.Provider value={{ id }}>
|
|
112
|
-
<div ref={
|
|
112
|
+
<div ref={forwardedRef} className={cn('space-y-2', className)} {...props} />
|
|
113
113
|
</FormItemContext.Provider>
|
|
114
114
|
);
|
|
115
115
|
});
|
|
@@ -123,10 +123,12 @@ FormItem.displayName = 'FormItem';
|
|
|
123
123
|
type FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;
|
|
124
124
|
type FormLabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;
|
|
125
125
|
|
|
126
|
-
const FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props },
|
|
126
|
+
const FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(({ className, ...props }, forwardedRef) => {
|
|
127
127
|
const { error, formItemId } = useFormField();
|
|
128
128
|
|
|
129
|
-
return
|
|
129
|
+
return (
|
|
130
|
+
<Label ref={forwardedRef} className={cn(error && 'text-destructive', className)} htmlFor={formItemId} {...props} />
|
|
131
|
+
);
|
|
130
132
|
});
|
|
131
133
|
|
|
132
134
|
FormLabel.displayName = 'FormLabel';
|
|
@@ -138,12 +140,12 @@ FormLabel.displayName = 'FormLabel';
|
|
|
138
140
|
type FormControlElement = React.ElementRef<typeof Slot>;
|
|
139
141
|
type FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;
|
|
140
142
|
|
|
141
|
-
const FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props },
|
|
143
|
+
const FormControl = React.forwardRef<FormControlElement, FormControlProps>(({ ...props }, forwardedRef) => {
|
|
142
144
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
143
145
|
|
|
144
146
|
return (
|
|
145
147
|
<Slot
|
|
146
|
-
ref={
|
|
148
|
+
ref={forwardedRef}
|
|
147
149
|
aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}
|
|
148
150
|
aria-invalid={Boolean(error)}
|
|
149
151
|
id={formItemId}
|
|
@@ -162,10 +164,17 @@ type FormDescriptionElement = HTMLParagraphElement;
|
|
|
162
164
|
type FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
163
165
|
|
|
164
166
|
const FormDescription = React.forwardRef<FormDescriptionElement, FormDescriptionProps>(
|
|
165
|
-
({ className, ...props },
|
|
167
|
+
({ className, ...props }, forwardedRef) => {
|
|
166
168
|
const { formDescriptionId } = useFormField();
|
|
167
169
|
|
|
168
|
-
return
|
|
170
|
+
return (
|
|
171
|
+
<p
|
|
172
|
+
ref={forwardedRef}
|
|
173
|
+
className={cn('text-muted-foreground text-xs', className)}
|
|
174
|
+
id={formDescriptionId}
|
|
175
|
+
{...props}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
169
178
|
},
|
|
170
179
|
);
|
|
171
180
|
|
|
@@ -178,20 +187,27 @@ FormDescription.displayName = 'FormDescription';
|
|
|
178
187
|
type FormMessageElement = HTMLParagraphElement;
|
|
179
188
|
type FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
180
189
|
|
|
181
|
-
const FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
190
|
+
const FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(
|
|
191
|
+
({ children, className, ...props }, forwardedRef) => {
|
|
192
|
+
const { error, formMessageId } = useFormField();
|
|
193
|
+
const body = error?.message ? String(error.message) : children;
|
|
194
|
+
|
|
195
|
+
if (!body) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<p
|
|
201
|
+
ref={forwardedRef}
|
|
202
|
+
className={cn('text-destructive text-xs font-medium', className)}
|
|
203
|
+
id={formMessageId}
|
|
204
|
+
{...props}
|
|
205
|
+
>
|
|
206
|
+
{body}
|
|
207
|
+
</p>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
);
|
|
195
211
|
|
|
196
212
|
FormMessage.displayName = 'FormMessage';
|
|
197
213
|
|