@codefast/ui 0.0.40 → 0.0.42
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-EVN2IB57.js → chunk-6EAQQBWG.js} +2 -2
- package/dist/chunk-6EAQQBWG.js.map +1 -0
- package/dist/{chunk-YR36SVVG.mjs → chunk-7HJV22OF.mjs} +1 -1
- package/dist/chunk-7HJV22OF.mjs.map +1 -0
- package/dist/{chunk-5WJB3UAO.js → chunk-CERSQE5J.js} +1 -1
- package/dist/chunk-CERSQE5J.js.map +1 -0
- package/dist/{chunk-UPZHCTQV.js → chunk-ELWITZPX.js} +2 -2
- package/dist/chunk-ELWITZPX.js.map +1 -0
- package/dist/{chunk-WLMYX3C7.mjs → chunk-GDMHMSJ2.mjs} +2 -2
- package/dist/chunk-GDMHMSJ2.mjs.map +1 -0
- package/dist/{chunk-UJJZZCAC.js → chunk-HQ4AUOQM.js} +1 -1
- package/dist/{chunk-UJJZZCAC.js.map → chunk-HQ4AUOQM.js.map} +1 -1
- package/dist/{chunk-HLXU3SQI.mjs → chunk-HWEFQSTC.mjs} +1 -1
- package/dist/chunk-HWEFQSTC.mjs.map +1 -0
- package/dist/{chunk-JTAXNFUM.mjs → chunk-HX5YKP4E.mjs} +2 -2
- package/dist/chunk-HX5YKP4E.mjs.map +1 -0
- package/dist/{chunk-PLX35IKX.mjs → chunk-I6QCJDIF.mjs} +1 -1
- package/dist/chunk-I6QCJDIF.mjs.map +1 -0
- package/dist/{chunk-466PAJCA.mjs → chunk-LEUB3C3L.mjs} +1 -1
- package/dist/chunk-LEUB3C3L.mjs.map +1 -0
- package/dist/{chunk-KJ77RPJ4.mjs → chunk-M5UKNISJ.mjs} +2 -2
- package/dist/chunk-M5UKNISJ.mjs.map +1 -0
- package/dist/{chunk-EYERINEJ.js → chunk-MZJL73RI.js} +1 -1
- package/dist/chunk-MZJL73RI.js.map +1 -0
- package/dist/{chunk-JCMRDCFT.js → chunk-NH6X3FON.js} +1 -1
- package/dist/{chunk-JCMRDCFT.js.map → chunk-NH6X3FON.js.map} +1 -1
- package/dist/{chunk-UDNWQQ3I.js → chunk-NSK74YTM.js} +2 -2
- package/dist/chunk-NSK74YTM.js.map +1 -0
- package/dist/{chunk-N6QGG4WS.mjs → chunk-P5AV3QU7.mjs} +2 -2
- package/dist/chunk-P5AV3QU7.mjs.map +1 -0
- package/dist/{chunk-GRQGCS7U.mjs → chunk-PWF46YXQ.mjs} +2 -2
- package/dist/chunk-PWF46YXQ.mjs.map +1 -0
- package/dist/{chunk-ZWGC5M4G.js → chunk-SCJ3W2VO.js} +2 -2
- package/dist/chunk-SCJ3W2VO.js.map +1 -0
- package/dist/{chunk-MSHUAEXI.js → chunk-SCPFGC2X.js} +2 -2
- package/dist/chunk-SCPFGC2X.js.map +1 -0
- package/dist/{chunk-JIHHUXA5.js → chunk-VXPAGNPJ.js} +2 -2
- package/dist/chunk-VXPAGNPJ.js.map +1 -0
- package/dist/{chunk-6B2PU2GG.mjs → chunk-WL65TBKJ.mjs} +2 -2
- package/dist/chunk-WL65TBKJ.mjs.map +1 -0
- package/dist/{chunk-4TJBMO2Y.mjs → chunk-WYYOCZNI.mjs} +2 -2
- package/dist/chunk-WYYOCZNI.mjs.map +1 -0
- package/dist/{chunk-FEE6PNWV.js → chunk-XM4Y2S5E.js} +2 -2
- package/dist/chunk-XM4Y2S5E.js.map +1 -0
- package/dist/{chunk-7PJR4WFR.mjs → chunk-ZEYIBYZP.mjs} +2 -2
- package/dist/chunk-ZEYIBYZP.mjs.map +1 -0
- package/dist/{chunk-AEWLL6A2.js → chunk-ZTEJNUH6.js} +2 -2
- package/dist/chunk-ZTEJNUH6.js.map +1 -0
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.mjs +1 -1
- package/dist/plugin/animate.plugin.js +1 -1
- package/dist/plugin/animate.plugin.mjs +1 -1
- package/dist/plugin/base.plugin.js +1 -1
- package/dist/plugin/base.plugin.mjs +1 -1
- package/dist/plugin/perspective.plugin.js +1 -1
- package/dist/plugin/perspective.plugin.mjs +1 -1
- package/dist/react/accordion.js +1 -1
- package/dist/react/accordion.js.map +1 -1
- package/dist/react/accordion.mjs +1 -1
- package/dist/react/accordion.mjs.map +1 -1
- package/dist/react/alert-dialog.js +1 -1
- package/dist/react/alert-dialog.js.map +1 -1
- package/dist/react/alert-dialog.mjs +1 -1
- package/dist/react/alert-dialog.mjs.map +1 -1
- package/dist/react/alert.js +1 -1
- package/dist/react/alert.js.map +1 -1
- package/dist/react/alert.mjs +1 -1
- package/dist/react/alert.mjs.map +1 -1
- package/dist/react/aspect-ratio.js.map +1 -1
- package/dist/react/aspect-ratio.mjs.map +1 -1
- package/dist/react/avatar.js +1 -1
- package/dist/react/avatar.js.map +1 -1
- package/dist/react/avatar.mjs +1 -1
- package/dist/react/avatar.mjs.map +1 -1
- package/dist/react/badge.js +1 -1
- package/dist/react/badge.js.map +1 -1
- package/dist/react/badge.mjs +1 -1
- package/dist/react/badge.mjs.map +1 -1
- package/dist/react/blockquote.js.map +1 -1
- package/dist/react/blockquote.mjs.map +1 -1
- package/dist/react/box.d.mts +2 -2
- package/dist/react/box.d.ts +2 -2
- package/dist/react/box.js.map +1 -1
- package/dist/react/box.mjs.map +1 -1
- package/dist/react/breadcrumb.js +1 -1
- package/dist/react/breadcrumb.js.map +1 -1
- package/dist/react/breadcrumb.mjs +1 -1
- package/dist/react/breadcrumb.mjs.map +1 -1
- package/dist/react/button.js +1 -1
- package/dist/react/button.mjs +1 -1
- package/dist/react/calendar.js +1 -1
- package/dist/react/calendar.js.map +1 -1
- package/dist/react/calendar.mjs +1 -1
- package/dist/react/calendar.mjs.map +1 -1
- package/dist/react/card.js +1 -1
- package/dist/react/card.js.map +1 -1
- package/dist/react/card.mjs +1 -1
- package/dist/react/card.mjs.map +1 -1
- package/dist/react/carousel.d.mts +1 -1
- package/dist/react/carousel.d.ts +1 -1
- package/dist/react/carousel.js +1 -1
- package/dist/react/carousel.js.map +1 -1
- package/dist/react/carousel.mjs +1 -1
- package/dist/react/carousel.mjs.map +1 -1
- package/dist/react/checkbox-cards.js +1 -1
- package/dist/react/checkbox-cards.js.map +1 -1
- package/dist/react/checkbox-cards.mjs +1 -1
- package/dist/react/checkbox-cards.mjs.map +1 -1
- package/dist/react/checkbox-group.js +1 -1
- package/dist/react/checkbox-group.js.map +1 -1
- package/dist/react/checkbox-group.mjs +1 -1
- package/dist/react/checkbox-group.mjs.map +1 -1
- package/dist/react/checkbox-group.primitive.d.mts +8 -8
- package/dist/react/checkbox-group.primitive.d.ts +8 -8
- package/dist/react/checkbox-group.primitive.js +1 -1
- package/dist/react/checkbox-group.primitive.mjs +1 -1
- package/dist/react/checkbox.js +1 -1
- package/dist/react/checkbox.js.map +1 -1
- package/dist/react/checkbox.mjs +1 -1
- package/dist/react/checkbox.mjs.map +1 -1
- package/dist/react/code.js.map +1 -1
- package/dist/react/code.mjs.map +1 -1
- package/dist/react/collapsible.js +1 -1
- package/dist/react/collapsible.js.map +1 -1
- package/dist/react/collapsible.mjs +1 -1
- package/dist/react/collapsible.mjs.map +1 -1
- package/dist/react/command.js +1 -1
- package/dist/react/command.js.map +1 -1
- package/dist/react/command.mjs +1 -1
- package/dist/react/command.mjs.map +1 -1
- package/dist/react/container.js +1 -1
- package/dist/react/container.js.map +1 -1
- package/dist/react/container.mjs +1 -1
- package/dist/react/container.mjs.map +1 -1
- package/dist/react/context-menu.js +1 -1
- package/dist/react/context-menu.js.map +1 -1
- package/dist/react/context-menu.mjs +1 -1
- package/dist/react/context-menu.mjs.map +1 -1
- package/dist/react/data-table.d.mts +1 -1
- package/dist/react/data-table.d.ts +1 -1
- package/dist/react/data-table.js +1 -1
- package/dist/react/data-table.js.map +1 -1
- package/dist/react/data-table.mjs +1 -1
- package/dist/react/data-table.mjs.map +1 -1
- package/dist/react/dialog.js +1 -1
- package/dist/react/dialog.mjs +1 -1
- package/dist/react/drawer.js +1 -1
- package/dist/react/drawer.js.map +1 -1
- package/dist/react/drawer.mjs +1 -1
- package/dist/react/drawer.mjs.map +1 -1
- package/dist/react/dropdown-menu.js +1 -1
- package/dist/react/dropdown-menu.mjs +1 -1
- package/dist/react/em.js.map +1 -1
- package/dist/react/em.mjs.map +1 -1
- package/dist/react/form.js +1 -1
- package/dist/react/form.js.map +1 -1
- package/dist/react/form.mjs +1 -1
- package/dist/react/form.mjs.map +1 -1
- package/dist/react/heading.d.mts +1 -1
- package/dist/react/heading.d.ts +1 -1
- package/dist/react/heading.js.map +1 -1
- package/dist/react/heading.mjs.map +1 -1
- package/dist/react/hover-card.js +1 -1
- package/dist/react/hover-card.js.map +1 -1
- package/dist/react/hover-card.mjs +1 -1
- package/dist/react/hover-card.mjs.map +1 -1
- package/dist/react/input-otp.js +1 -1
- package/dist/react/input-otp.js.map +1 -1
- package/dist/react/input-otp.mjs +1 -1
- package/dist/react/input-otp.mjs.map +1 -1
- package/dist/react/input.js +1 -1
- package/dist/react/input.js.map +1 -1
- package/dist/react/input.mjs +1 -1
- package/dist/react/input.mjs.map +1 -1
- package/dist/react/kbd.js +1 -1
- package/dist/react/kbd.js.map +1 -1
- package/dist/react/kbd.mjs +1 -1
- package/dist/react/kbd.mjs.map +1 -1
- package/dist/react/label.js +1 -1
- package/dist/react/label.mjs +1 -1
- package/dist/react/menubar.js +1 -1
- package/dist/react/menubar.js.map +1 -1
- package/dist/react/menubar.mjs +1 -1
- package/dist/react/menubar.mjs.map +1 -1
- package/dist/react/navigation-menu.js +1 -1
- package/dist/react/navigation-menu.js.map +1 -1
- package/dist/react/navigation-menu.mjs +1 -1
- package/dist/react/navigation-menu.mjs.map +1 -1
- package/dist/react/pagination.d.mts +1 -1
- package/dist/react/pagination.d.ts +1 -1
- package/dist/react/pagination.js +1 -1
- package/dist/react/pagination.js.map +1 -1
- package/dist/react/pagination.mjs +1 -1
- package/dist/react/pagination.mjs.map +1 -1
- package/dist/react/popover.js +1 -1
- package/dist/react/popover.js.map +1 -1
- package/dist/react/popover.mjs +1 -1
- package/dist/react/popover.mjs.map +1 -1
- package/dist/react/pre.js.map +1 -1
- package/dist/react/pre.mjs.map +1 -1
- package/dist/react/progress.js +1 -1
- package/dist/react/progress.js.map +1 -1
- package/dist/react/progress.mjs +1 -1
- package/dist/react/progress.mjs.map +1 -1
- package/dist/react/quote.js.map +1 -1
- package/dist/react/quote.mjs.map +1 -1
- package/dist/react/radio-cards.js +1 -1
- package/dist/react/radio-cards.js.map +1 -1
- package/dist/react/radio-cards.mjs +1 -1
- package/dist/react/radio-cards.mjs.map +1 -1
- package/dist/react/radio-group.js +1 -1
- package/dist/react/radio-group.js.map +1 -1
- package/dist/react/radio-group.mjs +1 -1
- package/dist/react/radio-group.mjs.map +1 -1
- package/dist/react/radio.js +1 -1
- package/dist/react/radio.js.map +1 -1
- package/dist/react/radio.mjs +1 -1
- package/dist/react/radio.mjs.map +1 -1
- package/dist/react/resizable.js +1 -1
- package/dist/react/resizable.js.map +1 -1
- package/dist/react/resizable.mjs +1 -1
- package/dist/react/resizable.mjs.map +1 -1
- package/dist/react/scroll-area.js +1 -1
- package/dist/react/scroll-area.js.map +1 -1
- package/dist/react/scroll-area.mjs +1 -1
- package/dist/react/scroll-area.mjs.map +1 -1
- package/dist/react/section.js.map +1 -1
- package/dist/react/section.mjs.map +1 -1
- package/dist/react/select.js +1 -1
- package/dist/react/select.mjs +1 -1
- package/dist/react/separator.js +1 -1
- package/dist/react/separator.js.map +1 -1
- package/dist/react/separator.mjs +1 -1
- package/dist/react/separator.mjs.map +1 -1
- package/dist/react/sheet.js +1 -1
- package/dist/react/sheet.js.map +1 -1
- package/dist/react/sheet.mjs +1 -1
- package/dist/react/sheet.mjs.map +1 -1
- package/dist/react/skeleton.js +1 -1
- package/dist/react/skeleton.js.map +1 -1
- package/dist/react/skeleton.mjs +1 -1
- package/dist/react/skeleton.mjs.map +1 -1
- package/dist/react/slider.js +1 -1
- package/dist/react/slider.js.map +1 -1
- package/dist/react/slider.mjs +1 -1
- package/dist/react/slider.mjs.map +1 -1
- package/dist/react/sonner.js.map +1 -1
- package/dist/react/sonner.mjs.map +1 -1
- package/dist/react/spinner.js +1 -1
- package/dist/react/spinner.mjs +1 -1
- package/dist/react/strong.js.map +1 -1
- package/dist/react/strong.mjs.map +1 -1
- package/dist/react/switch.js +1 -1
- package/dist/react/switch.js.map +1 -1
- package/dist/react/switch.mjs +1 -1
- package/dist/react/switch.mjs.map +1 -1
- package/dist/react/table.js +1 -1
- package/dist/react/table.js.map +1 -1
- package/dist/react/table.mjs +1 -1
- package/dist/react/table.mjs.map +1 -1
- package/dist/react/tabs.js +1 -1
- package/dist/react/tabs.js.map +1 -1
- package/dist/react/tabs.mjs +1 -1
- package/dist/react/tabs.mjs.map +1 -1
- package/dist/react/text.d.mts +2 -2
- package/dist/react/text.d.ts +2 -2
- package/dist/react/text.js.map +1 -1
- package/dist/react/text.mjs.map +1 -1
- package/dist/react/textarea.js +1 -1
- package/dist/react/textarea.js.map +1 -1
- package/dist/react/textarea.mjs +1 -1
- package/dist/react/textarea.mjs.map +1 -1
- package/dist/react/toggle-group.js +1 -1
- package/dist/react/toggle-group.js.map +1 -1
- package/dist/react/toggle-group.mjs +1 -1
- package/dist/react/toggle-group.mjs.map +1 -1
- package/dist/react/toggle.js +1 -1
- package/dist/react/toggle.mjs +1 -1
- package/dist/react/tooltip.js +1 -1
- package/dist/react/tooltip.js.map +1 -1
- package/dist/react/tooltip.mjs +1 -1
- package/dist/react/tooltip.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/tailwind.config.js +1 -1
- package/dist/tailwind.config.js.map +1 -1
- package/dist/tailwind.config.mjs +1 -1
- package/dist/tailwind.config.mjs.map +1 -1
- package/package.json +7 -7
- package/plugin/animate.plugin.ts +114 -111
- package/plugin/base.plugin.ts +10 -7
- package/plugin/perspective.plugin.ts +1 -1
- package/src/lib/utils.ts +2 -2
- package/src/react/accordion.tsx +65 -41
- package/src/react/alert-dialog.tsx +130 -62
- package/src/react/alert.tsx +50 -24
- package/src/react/aspect-ratio.tsx +6 -4
- package/src/react/avatar.tsx +47 -19
- package/src/react/badge.tsx +15 -10
- package/src/react/blockquote.tsx +11 -8
- package/src/react/box.tsx +11 -9
- package/src/react/breadcrumb.tsx +62 -29
- package/src/react/button.tsx +47 -31
- package/src/react/calendar.tsx +54 -37
- package/src/react/card.tsx +64 -30
- package/src/react/carousel.tsx +101 -43
- package/src/react/checkbox-cards.tsx +60 -33
- package/src/react/checkbox-group.primitive.tsx +93 -38
- package/src/react/checkbox-group.tsx +57 -34
- package/src/react/checkbox.tsx +24 -20
- package/src/react/code.tsx +9 -7
- package/src/react/collapsible.tsx +33 -23
- package/src/react/command.tsx +140 -75
- package/src/react/container.tsx +12 -8
- package/src/react/context-menu.tsx +228 -150
- package/src/react/data-table.tsx +51 -21
- package/src/react/dialog.tsx +95 -50
- package/src/react/drawer.tsx +96 -49
- package/src/react/dropdown-menu.tsx +199 -131
- package/src/react/em.tsx +9 -7
- package/src/react/form.tsx +96 -61
- package/src/react/heading.tsx +10 -8
- package/src/react/hover-card.tsx +42 -26
- package/src/react/input-otp.tsx +48 -37
- package/src/react/input.tsx +25 -15
- package/src/react/kbd.tsx +21 -19
- package/src/react/label.tsx +16 -14
- package/src/react/menubar.tsx +214 -135
- package/src/react/navigation-menu.tsx +153 -111
- package/src/react/pagination.tsx +59 -26
- package/src/react/popover.tsx +44 -29
- package/src/react/pre.tsx +9 -7
- package/src/react/progress.tsx +26 -19
- package/src/react/quote.tsx +9 -7
- package/src/react/radio-cards.tsx +32 -12
- package/src/react/radio-group.tsx +32 -12
- package/src/react/radio.tsx +24 -20
- package/src/react/resizable.tsx +13 -8
- package/src/react/scroll-area.tsx +56 -34
- package/src/react/section.tsx +9 -7
- package/src/react/select.tsx +167 -114
- package/src/react/separator.tsx +16 -7
- package/src/react/sheet.tsx +84 -34
- package/src/react/skeleton.tsx +8 -3
- package/src/react/slider.tsx +31 -24
- package/src/react/sonner.tsx +12 -10
- package/src/react/spinner.tsx +14 -9
- package/src/react/strong.tsx +9 -7
- package/src/react/switch.tsx +18 -16
- package/src/react/table.tsx +97 -52
- package/src/react/tabs.tsx +48 -38
- package/src/react/text.tsx +13 -10
- package/src/react/textarea.tsx +17 -15
- package/src/react/toggle-group.tsx +66 -23
- package/src/react/toggle.tsx +26 -18
- package/src/react/tooltip.tsx +43 -28
- package/tailwind.config.ts +62 -62
- package/dist/chunk-466PAJCA.mjs.map +0 -1
- package/dist/chunk-4TJBMO2Y.mjs.map +0 -1
- package/dist/chunk-5WJB3UAO.js.map +0 -1
- package/dist/chunk-6B2PU2GG.mjs.map +0 -1
- package/dist/chunk-7PJR4WFR.mjs.map +0 -1
- package/dist/chunk-AEWLL6A2.js.map +0 -1
- package/dist/chunk-EVN2IB57.js.map +0 -1
- package/dist/chunk-EYERINEJ.js.map +0 -1
- package/dist/chunk-FEE6PNWV.js.map +0 -1
- package/dist/chunk-GRQGCS7U.mjs.map +0 -1
- package/dist/chunk-HLXU3SQI.mjs.map +0 -1
- package/dist/chunk-JIHHUXA5.js.map +0 -1
- package/dist/chunk-JTAXNFUM.mjs.map +0 -1
- package/dist/chunk-KJ77RPJ4.mjs.map +0 -1
- package/dist/chunk-MSHUAEXI.js.map +0 -1
- package/dist/chunk-N6QGG4WS.mjs.map +0 -1
- package/dist/chunk-PLX35IKX.mjs.map +0 -1
- package/dist/chunk-UDNWQQ3I.js.map +0 -1
- package/dist/chunk-UPZHCTQV.js.map +0 -1
- package/dist/chunk-WLMYX3C7.mjs.map +0 -1
- package/dist/chunk-YR36SVVG.mjs.map +0 -1
- package/dist/chunk-ZWGC5M4G.js.map +0 -1
- package/dist/plugin/animate.plugin.d.mts +0 -9
- package/dist/plugin/animate.plugin.d.ts +0 -9
- package/dist/plugin/base.plugin.d.mts +0 -8
- package/dist/plugin/base.plugin.d.ts +0 -8
- package/dist/plugin/perspective.plugin.d.mts +0 -8
- package/dist/plugin/perspective.plugin.d.ts +0 -8
- package/dist/tailwind.config.d.mts +0 -5
- package/dist/tailwind.config.d.ts +0 -5
package/src/react/form.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import type * as LabelPrimitive from
|
|
5
|
-
import { Slot } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
6
6
|
import {
|
|
7
7
|
Controller,
|
|
8
8
|
type ControllerProps,
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
type FieldValues,
|
|
12
12
|
FormProvider,
|
|
13
13
|
useFormContext,
|
|
14
|
-
} from
|
|
15
|
-
import { cn } from
|
|
16
|
-
import { Label } from
|
|
14
|
+
} from 'react-hook-form';
|
|
15
|
+
import { cn } from '../lib/utils';
|
|
16
|
+
import { Label } from './label';
|
|
17
17
|
|
|
18
18
|
/* -----------------------------------------------------------------------------
|
|
19
19
|
* Context: Form
|
|
@@ -30,7 +30,9 @@ interface FormItemContextValue {
|
|
|
30
30
|
id: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const FormFieldContext = React.createContext<FormFieldContextValue | null>(
|
|
33
|
+
const FormFieldContext = React.createContext<FormFieldContextValue | null>(
|
|
34
|
+
null,
|
|
35
|
+
);
|
|
34
36
|
|
|
35
37
|
const FormItemContext = React.createContext<FormItemContextValue | null>(null);
|
|
36
38
|
|
|
@@ -51,7 +53,7 @@ const useFormField = (): {
|
|
|
51
53
|
const { getFieldState, formState } = useFormContext();
|
|
52
54
|
|
|
53
55
|
if (!fieldContext || !itemContext) {
|
|
54
|
-
throw new Error(
|
|
56
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -102,32 +104,45 @@ function FormField<
|
|
|
102
104
|
type FormItemElement = HTMLDivElement;
|
|
103
105
|
type FormItemProps = React.HTMLAttributes<HTMLDivElement>;
|
|
104
106
|
|
|
105
|
-
const FormItem = React.forwardRef<FormItemElement, FormItemProps>(
|
|
106
|
-
|
|
107
|
+
const FormItem = React.forwardRef<FormItemElement, FormItemProps>(
|
|
108
|
+
({ className, ...props }, ref) => {
|
|
109
|
+
const id = React.useId();
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
111
|
+
return (
|
|
112
|
+
<FormItemContext.Provider value={{ id }}>
|
|
113
|
+
<div ref={ref} className={cn('space-y-2', className)} {...props} />
|
|
114
|
+
</FormItemContext.Provider>
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
114
118
|
|
|
115
|
-
FormItem.displayName =
|
|
119
|
+
FormItem.displayName = 'FormItem';
|
|
116
120
|
|
|
117
121
|
/* -----------------------------------------------------------------------------
|
|
118
122
|
* Component: FormLabel
|
|
119
123
|
* -------------------------------------------------------------------------- */
|
|
120
124
|
|
|
121
125
|
type FormFieldElement = React.ElementRef<typeof LabelPrimitive.Root>;
|
|
122
|
-
type FormLabelProps = React.ComponentPropsWithoutRef<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const { error, formItemId } = useFormField();
|
|
126
|
+
type FormLabelProps = React.ComponentPropsWithoutRef<
|
|
127
|
+
typeof LabelPrimitive.Root
|
|
128
|
+
>;
|
|
126
129
|
|
|
127
|
-
|
|
128
|
-
})
|
|
130
|
+
const FormLabel = React.forwardRef<FormFieldElement, FormLabelProps>(
|
|
131
|
+
({ className, ...props }, ref) => {
|
|
132
|
+
const { error, formItemId } = useFormField();
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Label
|
|
136
|
+
ref={ref}
|
|
137
|
+
className={cn(error && 'text-destructive', className)}
|
|
138
|
+
htmlFor={formItemId}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
},
|
|
143
|
+
);
|
|
129
144
|
|
|
130
|
-
FormLabel.displayName =
|
|
145
|
+
FormLabel.displayName = 'FormLabel';
|
|
131
146
|
|
|
132
147
|
/* -----------------------------------------------------------------------------
|
|
133
148
|
* Component: FormControl
|
|
@@ -136,21 +151,26 @@ FormLabel.displayName = "FormLabel";
|
|
|
136
151
|
type FormControlElement = React.ElementRef<typeof Slot>;
|
|
137
152
|
type FormControlProps = React.ComponentPropsWithoutRef<typeof Slot>;
|
|
138
153
|
|
|
139
|
-
const FormControl = React.forwardRef<FormControlElement, FormControlProps>(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
154
|
+
const FormControl = React.forwardRef<FormControlElement, FormControlProps>(
|
|
155
|
+
({ ...props }, ref) => {
|
|
156
|
+
const { error, formItemId, formDescriptionId, formMessageId } =
|
|
157
|
+
useFormField();
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<Slot
|
|
161
|
+
ref={ref}
|
|
162
|
+
id={formItemId}
|
|
163
|
+
aria-describedby={
|
|
164
|
+
!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`
|
|
165
|
+
}
|
|
166
|
+
aria-invalid={Boolean(error)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
);
|
|
152
172
|
|
|
153
|
-
FormControl.displayName =
|
|
173
|
+
FormControl.displayName = 'FormControl';
|
|
154
174
|
|
|
155
175
|
/* -----------------------------------------------------------------------------
|
|
156
176
|
* Component: FormDescription
|
|
@@ -159,15 +179,23 @@ FormControl.displayName = "FormControl";
|
|
|
159
179
|
type FormDescriptionElement = HTMLParagraphElement;
|
|
160
180
|
type FormDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
161
181
|
|
|
162
|
-
const FormDescription = React.forwardRef<
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
const FormDescription = React.forwardRef<
|
|
183
|
+
FormDescriptionElement,
|
|
184
|
+
FormDescriptionProps
|
|
185
|
+
>(({ className, ...props }, ref) => {
|
|
186
|
+
const { formDescriptionId } = useFormField();
|
|
165
187
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
188
|
+
return (
|
|
189
|
+
<p
|
|
190
|
+
ref={ref}
|
|
191
|
+
id={formDescriptionId}
|
|
192
|
+
className={cn('text-muted-foreground text-xs', className)}
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
});
|
|
169
197
|
|
|
170
|
-
FormDescription.displayName =
|
|
198
|
+
FormDescription.displayName = 'FormDescription';
|
|
171
199
|
|
|
172
200
|
/* -----------------------------------------------------------------------------
|
|
173
201
|
* Component: FormMessage
|
|
@@ -176,22 +204,29 @@ FormDescription.displayName = "FormDescription";
|
|
|
176
204
|
type FormMessageElement = HTMLParagraphElement;
|
|
177
205
|
type FormMessageProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
178
206
|
|
|
179
|
-
const FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
207
|
+
const FormMessage = React.forwardRef<FormMessageElement, FormMessageProps>(
|
|
208
|
+
({ children, className, ...props }, ref) => {
|
|
209
|
+
const { error, formMessageId } = useFormField();
|
|
210
|
+
const body = error?.message ? error.message : children;
|
|
211
|
+
|
|
212
|
+
if (!body) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<p
|
|
218
|
+
ref={ref}
|
|
219
|
+
id={formMessageId}
|
|
220
|
+
className={cn('text-destructive text-xs font-medium', className)}
|
|
221
|
+
{...props}
|
|
222
|
+
>
|
|
223
|
+
{body}
|
|
224
|
+
</p>
|
|
225
|
+
);
|
|
226
|
+
},
|
|
227
|
+
);
|
|
193
228
|
|
|
194
|
-
FormMessage.displayName =
|
|
229
|
+
FormMessage.displayName = 'FormMessage';
|
|
195
230
|
|
|
196
231
|
/* -----------------------------------------------------------------------------
|
|
197
232
|
* Exports
|
package/src/react/heading.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Slot } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
|
|
4
4
|
/* -----------------------------------------------------------------------------
|
|
5
5
|
* Component: Heading
|
|
@@ -8,17 +8,19 @@ import { Slot } from "@radix-ui/react-slot";
|
|
|
8
8
|
type HeadingElement = HTMLHeadingElement;
|
|
9
9
|
|
|
10
10
|
interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
11
|
-
as?:
|
|
11
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
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 }, ref) => {
|
|
17
|
+
const Component = asChild ? Slot : Tag;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
}
|
|
19
|
+
return <Component ref={ref} {...props} />;
|
|
20
|
+
},
|
|
21
|
+
);
|
|
20
22
|
|
|
21
|
-
Heading.displayName =
|
|
23
|
+
Heading.displayName = 'Heading';
|
|
22
24
|
|
|
23
25
|
/* -----------------------------------------------------------------------------
|
|
24
26
|
* Exports
|
package/src/react/hover-card.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as HoverCardPrimitive from
|
|
5
|
-
import { cn } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
5
|
+
import { cn } from '../lib/utils';
|
|
6
6
|
|
|
7
7
|
/* -----------------------------------------------------------------------------
|
|
8
8
|
* Component: HoverCard
|
|
@@ -15,32 +15,39 @@ const HoverCard = HoverCardPrimitive.Root;
|
|
|
15
15
|
* Component: HoverCardTrigger
|
|
16
16
|
* -------------------------------------------------------------------------- */
|
|
17
17
|
|
|
18
|
-
type HoverCardTriggerProps = React.ComponentPropsWithoutRef<
|
|
18
|
+
type HoverCardTriggerProps = React.ComponentPropsWithoutRef<
|
|
19
|
+
typeof HoverCardPrimitive.Trigger
|
|
20
|
+
>;
|
|
19
21
|
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
20
22
|
|
|
21
23
|
/* -----------------------------------------------------------------------------
|
|
22
24
|
* Component: HoverCardContent
|
|
23
25
|
* -------------------------------------------------------------------------- */
|
|
24
26
|
|
|
25
|
-
type HoverCardContentElement = React.ElementRef<
|
|
26
|
-
|
|
27
|
+
type HoverCardContentElement = React.ElementRef<
|
|
28
|
+
typeof HoverCardPrimitive.Content
|
|
29
|
+
>;
|
|
30
|
+
type HoverCardContentProps = React.ComponentPropsWithoutRef<
|
|
31
|
+
typeof HoverCardPrimitive.Content
|
|
32
|
+
>;
|
|
27
33
|
|
|
28
|
-
const HoverCardContent = React.forwardRef<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
const HoverCardContent = React.forwardRef<
|
|
35
|
+
HoverCardContentElement,
|
|
36
|
+
HoverCardContentProps
|
|
37
|
+
>(({ className, align = 'center', sideOffset = 6, ...props }, ref) => (
|
|
38
|
+
<HoverCardPrimitive.Portal>
|
|
39
|
+
<HoverCardPrimitive.Content
|
|
40
|
+
ref={ref}
|
|
41
|
+
align={align}
|
|
42
|
+
sideOffset={sideOffset}
|
|
43
|
+
className={cn(
|
|
44
|
+
'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',
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
</HoverCardPrimitive.Portal>
|
|
50
|
+
));
|
|
44
51
|
|
|
45
52
|
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
46
53
|
|
|
@@ -49,10 +56,19 @@ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
|
49
56
|
* -------------------------------------------------------------------------- */
|
|
50
57
|
|
|
51
58
|
type HoverCardArrowElement = React.ElementRef<typeof HoverCardPrimitive.Arrow>;
|
|
52
|
-
type HoverCardArrowProps = React.ComponentPropsWithoutRef<
|
|
59
|
+
type HoverCardArrowProps = React.ComponentPropsWithoutRef<
|
|
60
|
+
typeof HoverCardPrimitive.Arrow
|
|
61
|
+
>;
|
|
53
62
|
|
|
54
|
-
const HoverCardArrow = React.forwardRef<
|
|
55
|
-
|
|
63
|
+
const HoverCardArrow = React.forwardRef<
|
|
64
|
+
HoverCardArrowElement,
|
|
65
|
+
HoverCardArrowProps
|
|
66
|
+
>(({ className, ...props }, ref) => (
|
|
67
|
+
<HoverCardPrimitive.Arrow
|
|
68
|
+
ref={ref}
|
|
69
|
+
className={cn('fill-popover', className)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
56
72
|
));
|
|
57
73
|
|
|
58
74
|
HoverCardArrow.displayName = HoverCardPrimitive.Arrow.displayName;
|
package/src/react/input-otp.tsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import { DotFilledIcon } from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { DotFilledIcon } from '@radix-ui/react-icons';
|
|
5
5
|
import {
|
|
6
6
|
OTPInput,
|
|
7
7
|
OTPInputContext,
|
|
8
8
|
REGEXP_ONLY_CHARS,
|
|
9
9
|
REGEXP_ONLY_DIGITS,
|
|
10
10
|
REGEXP_ONLY_DIGITS_AND_CHARS,
|
|
11
|
-
} from
|
|
12
|
-
import { cn } from
|
|
11
|
+
} from 'input-otp';
|
|
12
|
+
import { cn } from '../lib/utils';
|
|
13
13
|
|
|
14
14
|
/* -----------------------------------------------------------------------------
|
|
15
15
|
* Component: InputOtp
|
|
@@ -22,14 +22,17 @@ const InputOTP = React.forwardRef<InputOTPElement, InputOTPProps>(
|
|
|
22
22
|
({ className, containerClassName, ...props }, ref) => (
|
|
23
23
|
<OTPInput
|
|
24
24
|
ref={ref}
|
|
25
|
-
containerClassName={cn(
|
|
26
|
-
|
|
25
|
+
containerClassName={cn(
|
|
26
|
+
'flex items-center gap-2 has-[:disabled]:opacity-50',
|
|
27
|
+
containerClassName,
|
|
28
|
+
)}
|
|
29
|
+
className={cn('disabled:cursor-not-allowed', className)}
|
|
27
30
|
{...props}
|
|
28
31
|
/>
|
|
29
32
|
),
|
|
30
33
|
);
|
|
31
34
|
|
|
32
|
-
InputOTP.displayName =
|
|
35
|
+
InputOTP.displayName = 'InputOTP';
|
|
33
36
|
|
|
34
37
|
/* -----------------------------------------------------------------------------
|
|
35
38
|
* Component: InputOTPGroup
|
|
@@ -38,11 +41,14 @@ InputOTP.displayName = "InputOTP";
|
|
|
38
41
|
type InputOTPGroupElement = HTMLDivElement;
|
|
39
42
|
type InputOTPGroupProps = React.HTMLAttributes<HTMLDivElement>;
|
|
40
43
|
|
|
41
|
-
const InputOTPGroup = React.forwardRef<
|
|
42
|
-
|
|
44
|
+
const InputOTPGroup = React.forwardRef<
|
|
45
|
+
InputOTPGroupElement,
|
|
46
|
+
InputOTPGroupProps
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<div ref={ref} className={cn('flex items-center', className)} {...props} />
|
|
43
49
|
));
|
|
44
50
|
|
|
45
|
-
InputOTPGroup.displayName =
|
|
51
|
+
InputOTPGroup.displayName = 'InputOTPGroup';
|
|
46
52
|
|
|
47
53
|
/* -----------------------------------------------------------------------------
|
|
48
54
|
* Component: InputOTPSlot
|
|
@@ -54,31 +60,33 @@ interface InputOTPSlotProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
54
60
|
index: number;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
const InputOTPSlot = React.forwardRef<InputOTPSlotElement, InputOTPSlotProps>(
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
const InputOTPSlot = React.forwardRef<InputOTPSlotElement, InputOTPSlotProps>(
|
|
64
|
+
({ index, className, ...props }, ref) => {
|
|
65
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
66
|
+
const slot = inputOTPContext.slots[index];
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
ref={ref}
|
|
71
|
+
className={cn(
|
|
72
|
+
'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',
|
|
73
|
+
slot?.isActive && 'z-10 outline outline-2',
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
{slot?.char}
|
|
79
|
+
{slot?.hasFakeCaret ? (
|
|
80
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
81
|
+
<div className="animate-caret-blink bg-foreground animate-duration-1000 h-4 w-px" />
|
|
82
|
+
</div>
|
|
83
|
+
) : null}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
);
|
|
60
88
|
|
|
61
|
-
|
|
62
|
-
<div
|
|
63
|
-
ref={ref}
|
|
64
|
-
className={cn(
|
|
65
|
-
"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",
|
|
66
|
-
slot?.isActive && "z-10 outline outline-2",
|
|
67
|
-
className,
|
|
68
|
-
)}
|
|
69
|
-
{...props}
|
|
70
|
-
>
|
|
71
|
-
{slot?.char}
|
|
72
|
-
{slot?.hasFakeCaret ? (
|
|
73
|
-
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
74
|
-
<div className="animate-caret-blink bg-foreground animate-duration-1000 h-4 w-px" />
|
|
75
|
-
</div>
|
|
76
|
-
) : null}
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
InputOTPSlot.displayName = "InputOTPSlot";
|
|
89
|
+
InputOTPSlot.displayName = 'InputOTPSlot';
|
|
82
90
|
|
|
83
91
|
/* -----------------------------------------------------------------------------
|
|
84
92
|
* Component: InputOTPSeparator
|
|
@@ -87,13 +95,16 @@ InputOTPSlot.displayName = "InputOTPSlot";
|
|
|
87
95
|
type InputOTPSeparatorElement = HTMLDivElement;
|
|
88
96
|
type InputOTPSeparatorProps = React.HTMLAttributes<HTMLDivElement>;
|
|
89
97
|
|
|
90
|
-
const InputOTPSeparator = React.forwardRef<
|
|
98
|
+
const InputOTPSeparator = React.forwardRef<
|
|
99
|
+
InputOTPSeparatorElement,
|
|
100
|
+
InputOTPSeparatorProps
|
|
101
|
+
>(({ ...props }, ref) => (
|
|
91
102
|
<div ref={ref} role="separator" {...props}>
|
|
92
103
|
<DotFilledIcon />
|
|
93
104
|
</div>
|
|
94
105
|
));
|
|
95
106
|
|
|
96
|
-
InputOTPSeparator.displayName =
|
|
107
|
+
InputOTPSeparator.displayName = 'InputOTPSeparator';
|
|
97
108
|
|
|
98
109
|
/* -----------------------------------------------------------------------------
|
|
99
110
|
* Exports
|
package/src/react/input.tsx
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { type VariantProps } from
|
|
3
|
-
import { cva } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'cva';
|
|
3
|
+
import { cva } from '../lib/utils';
|
|
4
4
|
|
|
5
5
|
/* -----------------------------------------------------------------------------
|
|
6
6
|
* Variant: Input
|
|
7
7
|
* -------------------------------------------------------------------------- */
|
|
8
8
|
|
|
9
9
|
const inputVariants = cva({
|
|
10
|
-
base:
|
|
10
|
+
base: 'border-input placeholder:text-muted-foreground flex w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm transition file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
11
11
|
variants: {
|
|
12
12
|
inputSize: {
|
|
13
|
-
default:
|
|
14
|
-
xs:
|
|
15
|
-
sm:
|
|
16
|
-
lg:
|
|
13
|
+
default: 'h-10',
|
|
14
|
+
xs: 'h-8',
|
|
15
|
+
sm: 'h-9',
|
|
16
|
+
lg: 'h-11',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
defaultVariants: {
|
|
20
|
-
inputSize:
|
|
20
|
+
inputSize: 'default',
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -28,13 +28,23 @@ type InputVariantsProps = VariantProps<typeof inputVariants>;
|
|
|
28
28
|
* -------------------------------------------------------------------------- */
|
|
29
29
|
|
|
30
30
|
type InputElement = HTMLInputElement;
|
|
31
|
-
type InputProps = React.InputHTMLAttributes<HTMLInputElement> &
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})
|
|
31
|
+
type InputProps = React.InputHTMLAttributes<HTMLInputElement> &
|
|
32
|
+
InputVariantsProps;
|
|
33
|
+
|
|
34
|
+
const Input = React.forwardRef<InputElement, InputProps>(
|
|
35
|
+
({ className, inputSize, ...props }, ref) => {
|
|
36
|
+
return (
|
|
37
|
+
<input
|
|
38
|
+
type="text"
|
|
39
|
+
className={inputVariants({ className, inputSize })}
|
|
40
|
+
ref={ref}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
);
|
|
36
46
|
|
|
37
|
-
Input.displayName =
|
|
47
|
+
Input.displayName = 'Input';
|
|
38
48
|
|
|
39
49
|
/* -----------------------------------------------------------------------------
|
|
40
50
|
* Exports
|
package/src/react/kbd.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Slot } from
|
|
3
|
-
import { cn } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cn } from '../lib/utils';
|
|
4
4
|
|
|
5
5
|
/* -----------------------------------------------------------------------------
|
|
6
6
|
* Component: Kbd
|
|
@@ -12,22 +12,24 @@ interface KbdProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const Kbd = React.forwardRef<KbdElement, KbdProps>(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
const Kbd = React.forwardRef<KbdElement, KbdProps>(
|
|
16
|
+
({ asChild, className, ...props }, ref) => {
|
|
17
|
+
const Component = asChild ? Slot : 'kbd';
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Component
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
'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',
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
Kbd.displayName = 'Kbd';
|
|
31
33
|
|
|
32
34
|
/* -----------------------------------------------------------------------------
|
|
33
35
|
* Exports
|
package/src/react/label.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from
|
|
3
|
-
import * as LabelPrimitive from
|
|
4
|
-
import { cn } from
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
|
+
import { cn } from '../lib/utils';
|
|
5
5
|
|
|
6
6
|
/* -----------------------------------------------------------------------------
|
|
7
7
|
* Component: Label
|
|
@@ -10,16 +10,18 @@ import { cn } from "../lib/utils";
|
|
|
10
10
|
type LabelElement = React.ElementRef<typeof LabelPrimitive.Root>;
|
|
11
11
|
type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>;
|
|
12
12
|
|
|
13
|
-
const Label = React.forwardRef<LabelElement, LabelProps>(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const Label = React.forwardRef<LabelElement, LabelProps>(
|
|
14
|
+
({ className, ...props }, ref) => (
|
|
15
|
+
<LabelPrimitive.Root
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn(
|
|
18
|
+
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
),
|
|
24
|
+
);
|
|
23
25
|
|
|
24
26
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
25
27
|
|