@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/heading.tsx
CHANGED
|
@@ -12,11 +12,13 @@ interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const Heading = React.forwardRef<HeadingElement, HeadingProps>(
|
|
16
|
-
|
|
15
|
+
const Heading = React.forwardRef<HeadingElement, HeadingProps>(
|
|
16
|
+
({ asChild, as: Tag = 'h1', ...props }, forwardedRef) => {
|
|
17
|
+
const Component = asChild ? Slot : Tag;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
}
|
|
19
|
+
return <Component ref={forwardedRef} {...props} />;
|
|
20
|
+
},
|
|
21
|
+
);
|
|
20
22
|
|
|
21
23
|
Heading.displayName = 'Heading';
|
|
22
24
|
|
package/src/react/hover-card.tsx
CHANGED
|
@@ -26,10 +26,10 @@ type HoverCardContentElement = React.ElementRef<typeof HoverCardPrimitive.Conten
|
|
|
26
26
|
type HoverCardContentProps = React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>;
|
|
27
27
|
|
|
28
28
|
const HoverCardContent = React.forwardRef<HoverCardContentElement, HoverCardContentProps>(
|
|
29
|
-
({ className, align = 'center', sideOffset = 6, ...props },
|
|
29
|
+
({ className, align = 'center', sideOffset = 6, ...props }, forwardedRef) => (
|
|
30
30
|
<HoverCardPrimitive.Portal>
|
|
31
31
|
<HoverCardPrimitive.Content
|
|
32
|
-
ref={
|
|
32
|
+
ref={forwardedRef}
|
|
33
33
|
align={align}
|
|
34
34
|
className={cn(
|
|
35
35
|
'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=left]:slide-in-from-right-2 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=right]:slide-in-from-left-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=left]:slide-out-to-right-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 z-50 min-w-32 rounded-md border p-4 shadow-md',
|
|
@@ -51,9 +51,11 @@ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
|
51
51
|
type HoverCardArrowElement = React.ElementRef<typeof HoverCardPrimitive.Arrow>;
|
|
52
52
|
type HoverCardArrowProps = React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Arrow>;
|
|
53
53
|
|
|
54
|
-
const HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(
|
|
55
|
-
|
|
56
|
-
)
|
|
54
|
+
const HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(
|
|
55
|
+
({ className, ...props }, forwardedRef) => (
|
|
56
|
+
<HoverCardPrimitive.Arrow ref={forwardedRef} className={cn('fill-popover', className)} {...props} />
|
|
57
|
+
),
|
|
58
|
+
);
|
|
57
59
|
|
|
58
60
|
HoverCardArrow.displayName = HoverCardPrimitive.Arrow.displayName;
|
|
59
61
|
|
package/src/react/input-otp.tsx
CHANGED
|
@@ -19,10 +19,10 @@ type InputOTPElement = React.ElementRef<typeof OTPInput>;
|
|
|
19
19
|
type InputOTPProps = React.ComponentPropsWithoutRef<typeof OTPInput>;
|
|
20
20
|
|
|
21
21
|
const InputOTP = React.forwardRef<InputOTPElement, InputOTPProps>(
|
|
22
|
-
({ className, containerClassName, ...props },
|
|
22
|
+
({ className, containerClassName, ...props }, forwardedRef) => (
|
|
23
23
|
<OTPInput
|
|
24
|
-
ref={
|
|
25
|
-
className={cn('disabled:cursor-
|
|
24
|
+
ref={forwardedRef}
|
|
25
|
+
className={cn('disabled:cursor-default', className)}
|
|
26
26
|
containerClassName={cn('flex items-center gap-2 has-[:disabled]:opacity-50', containerClassName)}
|
|
27
27
|
{...props}
|
|
28
28
|
/>
|
|
@@ -38,9 +38,11 @@ InputOTP.displayName = 'InputOTP';
|
|
|
38
38
|
type InputOTPGroupElement = HTMLDivElement;
|
|
39
39
|
type InputOTPGroupProps = React.HTMLAttributes<HTMLDivElement>;
|
|
40
40
|
|
|
41
|
-
const InputOTPGroup = React.forwardRef<InputOTPGroupElement, InputOTPGroupProps>(
|
|
42
|
-
|
|
43
|
-
)
|
|
41
|
+
const InputOTPGroup = React.forwardRef<InputOTPGroupElement, InputOTPGroupProps>(
|
|
42
|
+
({ className, ...props }, forwardedRef) => (
|
|
43
|
+
<div ref={forwardedRef} className={cn('flex items-center', className)} {...props} />
|
|
44
|
+
),
|
|
45
|
+
);
|
|
44
46
|
|
|
45
47
|
InputOTPGroup.displayName = 'InputOTPGroup';
|
|
46
48
|
|
|
@@ -54,29 +56,31 @@ interface InputOTPSlotProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
54
56
|
index: number;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
const InputOTPSlot = React.forwardRef<InputOTPSlotElement, InputOTPSlotProps>(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<div className="
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
59
|
+
const InputOTPSlot = React.forwardRef<InputOTPSlotElement, InputOTPSlotProps>(
|
|
60
|
+
({ index, className, ...props }, forwardedRef) => {
|
|
61
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
62
|
+
const slot = inputOTPContext.slots[index];
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
ref={forwardedRef}
|
|
67
|
+
className={cn(
|
|
68
|
+
'border-input relative flex size-10 items-center justify-center border-y border-r text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md',
|
|
69
|
+
slot?.isActive && 'z-10 outline outline-2',
|
|
70
|
+
className,
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{slot?.char}
|
|
75
|
+
{slot?.hasFakeCaret ? (
|
|
76
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
77
|
+
<div className="animate-caret-blink bg-foreground animate-duration-1000 h-4 w-px" />
|
|
78
|
+
</div>
|
|
79
|
+
) : null}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
);
|
|
80
84
|
|
|
81
85
|
InputOTPSlot.displayName = 'InputOTPSlot';
|
|
82
86
|
|
|
@@ -87,11 +91,13 @@ InputOTPSlot.displayName = 'InputOTPSlot';
|
|
|
87
91
|
type InputOTPSeparatorElement = HTMLDivElement;
|
|
88
92
|
type InputOTPSeparatorProps = React.HTMLAttributes<HTMLDivElement>;
|
|
89
93
|
|
|
90
|
-
const InputOTPSeparator = React.forwardRef<InputOTPSeparatorElement, InputOTPSeparatorProps>(
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
const InputOTPSeparator = React.forwardRef<InputOTPSeparatorElement, InputOTPSeparatorProps>(
|
|
95
|
+
({ ...props }, forwardedRef) => (
|
|
96
|
+
<div ref={forwardedRef} role="separator" {...props}>
|
|
97
|
+
<DotFilledIcon />
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
);
|
|
95
101
|
|
|
96
102
|
InputOTPSeparator.displayName = 'InputOTPSeparator';
|
|
97
103
|
|
package/src/react/input.tsx
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { tv, type VariantProps } from 'tailwind-variants';
|
|
5
|
+
import { createContextScope, type Scope } from '@radix-ui/react-context';
|
|
6
|
+
import { useComposedRefs } from '@radix-ui/react-compose-refs';
|
|
7
|
+
import { Spinner } from './spinner';
|
|
3
8
|
|
|
4
9
|
/* -----------------------------------------------------------------------------
|
|
5
10
|
* Variant: Input
|
|
6
11
|
* -------------------------------------------------------------------------- */
|
|
7
12
|
|
|
8
13
|
const inputVariants = tv({
|
|
9
|
-
|
|
14
|
+
slots: {
|
|
15
|
+
root: 'border-input inline-flex w-full cursor-text items-center gap-3 rounded-md border bg-transparent px-3 shadow-sm transition focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 has-[input[disabled]]:cursor-default has-[input[disabled]]:opacity-50 [&_svg]:size-4',
|
|
16
|
+
slot: 'placeholder:text-muted-foreground size-full flex-1 bg-transparent text-sm outline-none file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-default',
|
|
17
|
+
},
|
|
10
18
|
variants: {
|
|
11
19
|
inputSize: {
|
|
12
|
-
default:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
default: {
|
|
21
|
+
root: 'h-10',
|
|
22
|
+
},
|
|
23
|
+
xs: {
|
|
24
|
+
root: 'h-8',
|
|
25
|
+
},
|
|
26
|
+
sm: {
|
|
27
|
+
root: 'h-9',
|
|
28
|
+
},
|
|
29
|
+
lg: {
|
|
30
|
+
root: 'h-11',
|
|
31
|
+
},
|
|
16
32
|
},
|
|
17
33
|
},
|
|
18
34
|
defaultVariants: {
|
|
@@ -22,21 +38,108 @@ const inputVariants = tv({
|
|
|
22
38
|
|
|
23
39
|
type InputVariantsProps = VariantProps<typeof inputVariants>;
|
|
24
40
|
|
|
41
|
+
const { root, slot } = inputVariants();
|
|
42
|
+
|
|
43
|
+
/* -----------------------------------------------------------------------------
|
|
44
|
+
* Context: Input
|
|
45
|
+
* -------------------------------------------------------------------------- */
|
|
46
|
+
|
|
47
|
+
const INPUT_NAME = 'Input';
|
|
48
|
+
|
|
49
|
+
type ScopedProps<P> = P & { __scopeInput?: Scope };
|
|
50
|
+
const [createInputContext, createInputScope] = createContextScope(INPUT_NAME);
|
|
51
|
+
|
|
52
|
+
interface InputContextValue {
|
|
53
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const [InputProvider, useInputContext] = createInputContext<InputContextValue>(INPUT_NAME);
|
|
58
|
+
|
|
25
59
|
/* -----------------------------------------------------------------------------
|
|
26
60
|
* Component: Input
|
|
27
61
|
* -------------------------------------------------------------------------- */
|
|
28
62
|
|
|
29
|
-
|
|
30
|
-
|
|
63
|
+
interface InputProps extends React.PropsWithChildren, InputVariantsProps {
|
|
64
|
+
className?: string | undefined;
|
|
65
|
+
loaderPosition?: 'prefix' | 'suffix';
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
prefix?: React.ReactNode;
|
|
68
|
+
suffix?: React.ReactNode;
|
|
69
|
+
}
|
|
31
70
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
71
|
+
function Input({
|
|
72
|
+
__scopeInput,
|
|
73
|
+
className,
|
|
74
|
+
prefix,
|
|
75
|
+
suffix,
|
|
76
|
+
loading,
|
|
77
|
+
loaderPosition,
|
|
78
|
+
inputSize,
|
|
79
|
+
children,
|
|
80
|
+
...props
|
|
81
|
+
}: ScopedProps<InputProps>): React.JSX.Element {
|
|
82
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
83
|
+
|
|
84
|
+
const handlePointerDown: React.PointerEventHandler<HTMLDivElement> = (event) => {
|
|
85
|
+
const target = event.target as HTMLElement;
|
|
86
|
+
|
|
87
|
+
if (target.closest('input, a, button')) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const inputElement = inputRef.current;
|
|
92
|
+
|
|
93
|
+
if (!inputElement) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
inputElement.focus();
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<InputProvider inputRef={inputRef} scope={__scopeInput}>
|
|
104
|
+
<div className={root({ inputSize, className })} {...props} role="presentation" onPointerDown={handlePointerDown}>
|
|
105
|
+
{loading && loaderPosition === 'prefix' ? <Spinner /> : prefix}
|
|
106
|
+
{children}
|
|
107
|
+
{loading && loaderPosition === 'suffix' ? <Spinner /> : suffix}
|
|
108
|
+
</div>
|
|
109
|
+
</InputProvider>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* -----------------------------------------------------------------------------
|
|
114
|
+
* Component: InputSlot
|
|
115
|
+
* -------------------------------------------------------------------------- */
|
|
116
|
+
|
|
117
|
+
const INPUT_SLOT_NAME = 'InputSlot';
|
|
118
|
+
|
|
119
|
+
type InputSlotElement = HTMLInputElement;
|
|
120
|
+
type InputSlotProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
121
|
+
|
|
122
|
+
const InputSlot = React.forwardRef<InputSlotElement, InputSlotProps>(
|
|
123
|
+
({ __scopeInput, className, ...props }: ScopedProps<InputSlotProps>, forwardedRef) => {
|
|
124
|
+
const context = useInputContext(INPUT_SLOT_NAME, __scopeInput);
|
|
125
|
+
const composedInputRef = useComposedRefs(forwardedRef, context.inputRef);
|
|
126
|
+
|
|
127
|
+
return <input ref={composedInputRef} className={slot({ className })} type="text" {...props} />;
|
|
128
|
+
},
|
|
129
|
+
);
|
|
35
130
|
|
|
36
|
-
|
|
131
|
+
InputSlot.displayName = 'Input';
|
|
37
132
|
|
|
38
133
|
/* -----------------------------------------------------------------------------
|
|
39
134
|
* Exports
|
|
40
135
|
* -------------------------------------------------------------------------- */
|
|
41
136
|
|
|
42
|
-
export {
|
|
137
|
+
export {
|
|
138
|
+
createInputScope,
|
|
139
|
+
Input,
|
|
140
|
+
InputSlot,
|
|
141
|
+
inputVariants,
|
|
142
|
+
type InputProps,
|
|
143
|
+
type InputSlotProps,
|
|
144
|
+
type InputVariantsProps,
|
|
145
|
+
};
|
package/src/react/kbd.tsx
CHANGED
|
@@ -12,12 +12,12 @@ interface KbdProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const Kbd = React.forwardRef<KbdElement, KbdProps>(({ asChild, className, ...props },
|
|
15
|
+
const Kbd = React.forwardRef<KbdElement, KbdProps>(({ asChild, className, ...props }, forwardedRef) => {
|
|
16
16
|
const Component = asChild ? Slot : 'kbd';
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<Component
|
|
20
|
-
ref={
|
|
20
|
+
ref={forwardedRef}
|
|
21
21
|
className={cn(
|
|
22
22
|
'bg-muted text-muted-foreground inline-flex h-5 select-none items-center gap-1 rounded border px-1.5 font-mono text-xs font-medium',
|
|
23
23
|
className,
|
package/src/react/label.tsx
CHANGED
|
@@ -11,9 +11,9 @@ import { cn } from '../lib/utils';
|
|
|
11
11
|
type LabelElement = React.ElementRef<typeof LabelPrimitive.Root>;
|
|
12
12
|
type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;
|
|
13
13
|
|
|
14
|
-
const Label = React.forwardRef<LabelElement, LabelProps>(({ className, ...props },
|
|
14
|
+
const Label = React.forwardRef<LabelElement, LabelProps>(({ className, ...props }, forwardedRef) => (
|
|
15
15
|
<LabelPrimitive.Root
|
|
16
|
-
ref={
|
|
16
|
+
ref={forwardedRef}
|
|
17
17
|
className={cn(
|
|
18
18
|
'text-sm font-medium leading-none peer-disabled:pointer-events-none peer-disabled:opacity-70',
|
|
19
19
|
className,
|
package/src/react/menubar.tsx
CHANGED
|
@@ -40,9 +40,9 @@ const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
|
|
|
40
40
|
type MenubarElement = React.ElementRef<typeof MenubarPrimitive.Root>;
|
|
41
41
|
type MenubarProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>;
|
|
42
42
|
|
|
43
|
-
const Menubar = React.forwardRef<MenubarElement, MenubarProps>(({ className, ...props },
|
|
43
|
+
const Menubar = React.forwardRef<MenubarElement, MenubarProps>(({ className, ...props }, forwardedRef) => (
|
|
44
44
|
<MenubarPrimitive.Root
|
|
45
|
-
ref={
|
|
45
|
+
ref={forwardedRef}
|
|
46
46
|
className={cn('bg-background flex h-10 items-center space-x-1 rounded-md border p-1 shadow-sm', className)}
|
|
47
47
|
{...props}
|
|
48
48
|
/>
|
|
@@ -57,16 +57,18 @@ Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
|
57
57
|
type MenubarTriggerElement = React.ElementRef<typeof MenubarPrimitive.Trigger>;
|
|
58
58
|
type MenubarTriggerProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>;
|
|
59
59
|
|
|
60
|
-
const MenubarTrigger = React.forwardRef<MenubarTriggerElement, MenubarTriggerProps>(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
const MenubarTrigger = React.forwardRef<MenubarTriggerElement, MenubarTriggerProps>(
|
|
61
|
+
({ className, ...props }, forwardedRef) => (
|
|
62
|
+
<MenubarPrimitive.Trigger
|
|
63
|
+
ref={forwardedRef}
|
|
64
|
+
className={cn(
|
|
65
|
+
'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-3 py-1 text-sm font-medium focus:outline-none',
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
),
|
|
71
|
+
);
|
|
70
72
|
|
|
71
73
|
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
|
|
72
74
|
|
|
@@ -81,9 +83,9 @@ interface MenubarSubTriggerProps extends React.ComponentPropsWithoutRef<typeof M
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
const MenubarSubTrigger = React.forwardRef<MenubarSubTriggerElement, MenubarSubTriggerProps>(
|
|
84
|
-
({ children, className, inset, ...props },
|
|
86
|
+
({ children, className, inset, ...props }, forwardedRef) => (
|
|
85
87
|
<MenubarPrimitive.SubTrigger
|
|
86
|
-
ref={
|
|
88
|
+
ref={forwardedRef}
|
|
87
89
|
className={cn(
|
|
88
90
|
'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',
|
|
89
91
|
inset && 'pl-8',
|
|
@@ -107,10 +109,10 @@ type MenubarSubContentElement = React.ElementRef<typeof MenubarPrimitive.SubCont
|
|
|
107
109
|
type MenubarSubContentProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>;
|
|
108
110
|
|
|
109
111
|
const MenubarSubContent = React.forwardRef<MenubarSubContentElement, MenubarSubContentProps>(
|
|
110
|
-
({ className, ...props },
|
|
112
|
+
({ className, ...props }, forwardedRef) => (
|
|
111
113
|
<MenubarPrimitive.Portal>
|
|
112
114
|
<MenubarPrimitive.SubContent
|
|
113
|
-
ref={
|
|
115
|
+
ref={forwardedRef}
|
|
114
116
|
className={cn(
|
|
115
117
|
'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=left]:slide-out-to-right-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 z-50 min-w-32 rounded-md border p-1 shadow-md',
|
|
116
118
|
className,
|
|
@@ -131,10 +133,10 @@ type MenubarContentElement = React.ElementRef<typeof MenubarPrimitive.Content>;
|
|
|
131
133
|
type MenubarContentProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>;
|
|
132
134
|
|
|
133
135
|
const MenubarContent = React.forwardRef<MenubarContentElement, MenubarContentProps>(
|
|
134
|
-
({ className, align = 'start', alignOffset = -4, sideOffset = 8, ...props },
|
|
136
|
+
({ className, align = 'start', alignOffset = -4, sideOffset = 8, ...props }, forwardedRef) => (
|
|
135
137
|
<MenubarPrimitive.Portal>
|
|
136
138
|
<MenubarPrimitive.Content
|
|
137
|
-
ref={
|
|
139
|
+
ref={forwardedRef}
|
|
138
140
|
align={align}
|
|
139
141
|
alignOffset={alignOffset}
|
|
140
142
|
className={cn(
|
|
@@ -160,17 +162,19 @@ interface MenubarItemProps extends React.ComponentPropsWithoutRef<typeof Menubar
|
|
|
160
162
|
inset?: boolean;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
|
-
const MenubarItem = React.forwardRef<MenubarItemElement, MenubarItemProps>(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
const MenubarItem = React.forwardRef<MenubarItemElement, MenubarItemProps>(
|
|
166
|
+
({ className, inset, ...props }, forwardedRef) => (
|
|
167
|
+
<MenubarPrimitive.Item
|
|
168
|
+
ref={forwardedRef}
|
|
169
|
+
className={cn(
|
|
170
|
+
'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',
|
|
171
|
+
inset && 'pl-8',
|
|
172
|
+
className,
|
|
173
|
+
)}
|
|
174
|
+
{...props}
|
|
175
|
+
/>
|
|
176
|
+
),
|
|
177
|
+
);
|
|
174
178
|
|
|
175
179
|
MenubarItem.displayName = MenubarPrimitive.Item.displayName;
|
|
176
180
|
|
|
@@ -182,9 +186,9 @@ type MenubarCheckboxItemElement = React.ElementRef<typeof MenubarPrimitive.Check
|
|
|
182
186
|
type MenubarCheckboxItemProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>;
|
|
183
187
|
|
|
184
188
|
const MenubarCheckboxItem = React.forwardRef<MenubarCheckboxItemElement, MenubarCheckboxItemProps>(
|
|
185
|
-
({ children, className, checked, ...props },
|
|
189
|
+
({ children, className, checked, ...props }, forwardedRef) => (
|
|
186
190
|
<MenubarPrimitive.CheckboxItem
|
|
187
|
-
ref={
|
|
191
|
+
ref={forwardedRef}
|
|
188
192
|
checked={checked}
|
|
189
193
|
className={cn(
|
|
190
194
|
'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',
|
|
@@ -212,9 +216,9 @@ type MenubarRadioItemElement = React.ElementRef<typeof MenubarPrimitive.RadioIte
|
|
|
212
216
|
type MenubarRadioItemProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>;
|
|
213
217
|
|
|
214
218
|
const MenubarRadioItem = React.forwardRef<MenubarRadioItemElement, MenubarRadioItemProps>(
|
|
215
|
-
({ children, className, ...props },
|
|
219
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
216
220
|
<MenubarPrimitive.RadioItem
|
|
217
|
-
ref={
|
|
221
|
+
ref={forwardedRef}
|
|
218
222
|
className={cn(
|
|
219
223
|
'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',
|
|
220
224
|
className,
|
|
@@ -243,13 +247,15 @@ interface MenubarLabelProps extends React.ComponentPropsWithoutRef<typeof Menuba
|
|
|
243
247
|
inset?: boolean;
|
|
244
248
|
}
|
|
245
249
|
|
|
246
|
-
const MenubarLabel = React.forwardRef<MenubarLabelElement, MenubarLabelProps>(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
const MenubarLabel = React.forwardRef<MenubarLabelElement, MenubarLabelProps>(
|
|
251
|
+
({ className, inset, ...props }, forwardedRef) => (
|
|
252
|
+
<MenubarPrimitive.Label
|
|
253
|
+
ref={forwardedRef}
|
|
254
|
+
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
255
|
+
{...props}
|
|
256
|
+
/>
|
|
257
|
+
),
|
|
258
|
+
);
|
|
253
259
|
|
|
254
260
|
MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
|
|
255
261
|
|
|
@@ -261,8 +267,8 @@ type MenubarSeparatorElement = React.ElementRef<typeof MenubarPrimitive.Separato
|
|
|
261
267
|
type MenubarSeparatorProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>;
|
|
262
268
|
|
|
263
269
|
const MenubarSeparator = React.forwardRef<MenubarSeparatorElement, MenubarSeparatorProps>(
|
|
264
|
-
({ className, ...props },
|
|
265
|
-
<MenubarPrimitive.Separator ref={
|
|
270
|
+
({ className, ...props }, forwardedRef) => (
|
|
271
|
+
<MenubarPrimitive.Separator ref={forwardedRef} className={cn('bg-muted -mx-1 my-1 h-px', className)} {...props} />
|
|
266
272
|
),
|
|
267
273
|
);
|
|
268
274
|
|
|
@@ -22,9 +22,9 @@ type NavigationMenuElement = React.ElementRef<typeof NavigationMenuPrimitive.Roo
|
|
|
22
22
|
type NavigationMenuProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>;
|
|
23
23
|
|
|
24
24
|
const NavigationMenu = React.forwardRef<NavigationMenuElement, NavigationMenuProps>(
|
|
25
|
-
({ children, className, ...props },
|
|
25
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
26
26
|
<NavigationMenuPrimitive.Root
|
|
27
|
-
ref={
|
|
27
|
+
ref={forwardedRef}
|
|
28
28
|
className={cn('relative z-10 flex max-w-max flex-1 items-center justify-center', className)}
|
|
29
29
|
{...props}
|
|
30
30
|
>
|
|
@@ -44,9 +44,9 @@ type NavigationMenuListElement = React.ElementRef<typeof NavigationMenuPrimitive
|
|
|
44
44
|
type NavigationMenuListProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>;
|
|
45
45
|
|
|
46
46
|
const NavigationMenuList = React.forwardRef<NavigationMenuListElement, NavigationMenuListProps>(
|
|
47
|
-
({ children, className, ...props },
|
|
47
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
48
48
|
<NavigationMenuPrimitive.List
|
|
49
|
-
ref={
|
|
49
|
+
ref={forwardedRef}
|
|
50
50
|
className={cn('group flex flex-1 list-none items-center justify-center space-x-1', className)}
|
|
51
51
|
{...props}
|
|
52
52
|
>
|
|
@@ -74,9 +74,9 @@ type NavigationMenuTriggerElement = React.ElementRef<typeof NavigationMenuPrimit
|
|
|
74
74
|
type NavigationMenuTriggerProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>;
|
|
75
75
|
|
|
76
76
|
const NavigationMenuTrigger = React.forwardRef<NavigationMenuTriggerElement, NavigationMenuTriggerProps>(
|
|
77
|
-
({ children, className, ...props },
|
|
77
|
+
({ children, className, ...props }, forwardedRef) => (
|
|
78
78
|
<NavigationMenuPrimitive.Trigger
|
|
79
|
-
ref={
|
|
79
|
+
ref={forwardedRef}
|
|
80
80
|
className={navigationMenuTriggerVariants({
|
|
81
81
|
className: ['group', className],
|
|
82
82
|
})}
|
|
@@ -101,9 +101,9 @@ type NavigationMenuContentElement = React.ElementRef<typeof NavigationMenuPrimit
|
|
|
101
101
|
type NavigationMenuContentProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>;
|
|
102
102
|
|
|
103
103
|
const NavigationMenuContent = React.forwardRef<NavigationMenuContentElement, NavigationMenuContentProps>(
|
|
104
|
-
({ className, ...props },
|
|
104
|
+
({ className, ...props }, forwardedRef) => (
|
|
105
105
|
<NavigationMenuPrimitive.Content
|
|
106
|
-
ref={
|
|
106
|
+
ref={forwardedRef}
|
|
107
107
|
className={cn(
|
|
108
108
|
'data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 left-0 top-0 w-full md:absolute md:w-auto',
|
|
109
109
|
className,
|
|
@@ -131,10 +131,10 @@ type NavigationMenuViewportElement = React.ElementRef<typeof NavigationMenuPrimi
|
|
|
131
131
|
type NavigationMenuViewportProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>;
|
|
132
132
|
|
|
133
133
|
const NavigationMenuViewport = React.forwardRef<NavigationMenuViewportElement, NavigationMenuViewportProps>(
|
|
134
|
-
({ className, ...props },
|
|
134
|
+
({ className, ...props }, forwardedRef) => (
|
|
135
135
|
<div className="perspective-[125rem] absolute left-0 top-full flex justify-center">
|
|
136
136
|
<NavigationMenuPrimitive.Viewport
|
|
137
|
-
ref={
|
|
137
|
+
ref={forwardedRef}
|
|
138
138
|
className={cn(
|
|
139
139
|
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-90 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full origin-[top_center] overflow-hidden rounded-md border transition-[width,height] sm:w-[var(--radix-navigation-menu-viewport-width)]',
|
|
140
140
|
className,
|
|
@@ -155,9 +155,9 @@ type NavigationMenuIndicatorElement = React.ElementRef<typeof NavigationMenuPrim
|
|
|
155
155
|
type NavigationMenuIndicatorProps = React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>;
|
|
156
156
|
|
|
157
157
|
const NavigationMenuIndicator = React.forwardRef<NavigationMenuIndicatorElement, NavigationMenuIndicatorProps>(
|
|
158
|
-
({ className, ...props },
|
|
158
|
+
({ className, ...props }, forwardedRef) => (
|
|
159
159
|
<NavigationMenuPrimitive.Indicator
|
|
160
|
-
ref={
|
|
160
|
+
ref={forwardedRef}
|
|
161
161
|
className={cn(
|
|
162
162
|
'data-[state=visible]:animate-fade-in data-[state=hidden]:animate-fade-out top-full z-10 flex h-1.5 items-center justify-center overflow-hidden transition',
|
|
163
163
|
className,
|
package/src/react/pagination.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChevronLeftIcon, ChevronRightIcon, DotsHorizontalIcon } from '@radix-ui/react-icons';
|
|
3
3
|
import { cn } from '../lib/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { type ButtonProps, buttonVariants } from './button';
|
|
5
5
|
|
|
6
6
|
/* -----------------------------------------------------------------------------
|
|
7
7
|
* Component: Pagination
|
|
@@ -28,8 +28,8 @@ type PaginationContentElement = HTMLUListElement;
|
|
|
28
28
|
type PaginationContentProps = React.HTMLAttributes<HTMLUListElement>;
|
|
29
29
|
|
|
30
30
|
const PaginationContent = React.forwardRef<PaginationContentElement, PaginationContentProps>(
|
|
31
|
-
({ className, ...props },
|
|
32
|
-
<ul ref={
|
|
31
|
+
({ className, ...props }, forwardedRef) => (
|
|
32
|
+
<ul ref={forwardedRef} className={cn('flex flex-row items-center gap-1', className)} {...props} />
|
|
33
33
|
),
|
|
34
34
|
);
|
|
35
35
|
|
|
@@ -42,8 +42,8 @@ PaginationContent.displayName = 'PaginationContent';
|
|
|
42
42
|
type PaginationItemElement = HTMLLIElement;
|
|
43
43
|
type PaginationItemProps = React.LiHTMLAttributes<HTMLLIElement>;
|
|
44
44
|
|
|
45
|
-
const PaginationItem = React.forwardRef<PaginationItemElement, PaginationItemProps>((props,
|
|
46
|
-
<li ref={
|
|
45
|
+
const PaginationItem = React.forwardRef<PaginationItemElement, PaginationItemProps>((props, forwardedRef) => (
|
|
46
|
+
<li ref={forwardedRef} {...props} />
|
|
47
47
|
));
|
|
48
48
|
|
|
49
49
|
PaginationItem.displayName = 'PaginationItem';
|
package/src/react/popover.tsx
CHANGED
|
@@ -33,10 +33,10 @@ type PopoverContentElement = React.ElementRef<typeof PopoverPrimitive.Content>;
|
|
|
33
33
|
type PopoverContentProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>;
|
|
34
34
|
|
|
35
35
|
const PopoverContent = React.forwardRef<PopoverContentElement, PopoverContentProps>(
|
|
36
|
-
({ className, align = 'center', sideOffset = 6, ...props },
|
|
36
|
+
({ className, align = 'center', sideOffset = 6, ...props }, forwardedRef) => (
|
|
37
37
|
<PopoverPrimitive.Portal>
|
|
38
38
|
<PopoverPrimitive.Content
|
|
39
|
-
ref={
|
|
39
|
+
ref={forwardedRef}
|
|
40
40
|
align={align}
|
|
41
41
|
className={cn(
|
|
42
42
|
'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=left]:slide-out-to-right-2 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 z-50 min-w-32 rounded-md border p-4 shadow-md',
|
|
@@ -58,9 +58,11 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
58
58
|
type PopoverArrowElement = React.ElementRef<typeof PopoverPrimitive.Arrow>;
|
|
59
59
|
type PopoverArrowProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>;
|
|
60
60
|
|
|
61
|
-
const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(
|
|
62
|
-
|
|
63
|
-
)
|
|
61
|
+
const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(
|
|
62
|
+
({ className, ...props }, forwardedRef) => (
|
|
63
|
+
<PopoverPrimitive.Arrow ref={forwardedRef} className={cn('fill-popover', className)} {...props} />
|
|
64
|
+
),
|
|
65
|
+
);
|
|
64
66
|
|
|
65
67
|
PopoverArrow.displayName = PopoverPrimitive.Arrow.displayName;
|
|
66
68
|
|
package/src/react/pre.tsx
CHANGED
|
@@ -11,10 +11,10 @@ interface PreProps extends React.HTMLAttributes<HTMLPreElement> {
|
|
|
11
11
|
asChild?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const Pre = React.forwardRef<PreElement, PreProps>(({ asChild, ...props },
|
|
14
|
+
const Pre = React.forwardRef<PreElement, PreProps>(({ asChild, ...props }, forwardedRef) => {
|
|
15
15
|
const Component = asChild ? Slot : 'pre';
|
|
16
16
|
|
|
17
|
-
return <Component ref={
|
|
17
|
+
return <Component ref={forwardedRef} {...props} />;
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
Pre.displayName = 'Pre';
|