@codefast/ui 0.3.11 → 0.3.12-canary.1
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/CHANGELOG.md +66 -0
- package/README.md +4 -0
- package/dist/components/accordion.d.ts +11 -29
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +11 -38
- package/dist/components/alert-dialog.d.ts +25 -60
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +17 -70
- package/dist/components/alert.d.ts +16 -27
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +33 -31
- package/dist/components/aspect-ratio.d.ts +5 -8
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +5 -7
- package/dist/components/avatar.d.ts +7 -17
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +8 -19
- package/dist/components/badge.d.ts +15 -21
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +53 -21
- package/dist/components/breadcrumb.d.ts +13 -35
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +14 -50
- package/dist/components/button-group.d.ts +15 -29
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +37 -28
- package/dist/components/button.d.ts +26 -35
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +87 -52
- package/dist/components/calendar.d.ts +10 -24
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +88 -93
- package/dist/components/card.d.ts +11 -34
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +12 -40
- package/dist/components/carousel.d.ts +25 -55
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +83 -115
- package/dist/components/chart.d.ts +37 -72
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +162 -151
- package/dist/components/checkbox-cards.d.ts +9 -15
- package/dist/components/checkbox-cards.d.ts.map +1 -0
- package/dist/components/checkbox-cards.js +9 -23
- package/dist/components/checkbox-group.d.ts +9 -16
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group.js +8 -20
- package/dist/components/checkbox.d.ts +5 -9
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +7 -15
- package/dist/components/collapsible.d.ts +7 -14
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +7 -15
- package/dist/components/command.d.ts +24 -55
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +19 -70
- package/dist/components/context-menu.d.ts +23 -72
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +22 -90
- package/dist/components/dialog.d.ts +23 -53
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +21 -73
- package/dist/components/drawer.d.ts +29 -60
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +17 -59
- package/dist/components/dropdown-menu.d.ts +23 -73
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +22 -97
- package/dist/components/empty.d.ts +16 -37
- package/dist/components/empty.d.ts.map +1 -0
- package/dist/components/empty.js +33 -45
- package/dist/components/field.d.ts +26 -63
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +61 -90
- package/dist/components/form.d.ts +16 -37
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +51 -67
- package/dist/components/hover-card.d.ts +8 -21
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +9 -24
- package/dist/components/input-group.d.ts +29 -53
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +110 -67
- package/dist/components/input-number.d.ts +8 -28
- package/dist/components/input-number.d.ts.map +1 -0
- package/dist/components/input-number.js +15 -56
- package/dist/components/input-otp.d.ts +11 -24
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +14 -35
- package/dist/components/input-password.d.ts +6 -12
- package/dist/components/input-password.d.ts.map +1 -0
- package/dist/components/input-password.js +11 -31
- package/dist/components/input-search.d.ts +9 -18
- package/dist/components/input-search.d.ts.map +1 -0
- package/dist/components/input-search.js +17 -44
- package/dist/components/input.d.ts +5 -10
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +6 -10
- package/dist/components/item.d.ts +33 -69
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +69 -91
- package/dist/components/kbd.d.ts +6 -13
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +7 -14
- package/dist/components/label.d.ts +5 -9
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +6 -9
- package/dist/components/menubar.d.ts +24 -80
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +24 -100
- package/dist/components/native-select.d.ts +7 -16
- package/dist/components/native-select.d.ts.map +1 -0
- package/dist/components/native-select.js +8 -26
- package/dist/components/navigation-menu.d.ts +13 -36
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +26 -62
- package/dist/components/pagination.d.ts +15 -35
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +14 -56
- package/dist/components/popover.d.ts +9 -24
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +10 -28
- package/dist/components/progress-circle.d.ts +89 -106
- package/dist/components/progress-circle.d.ts.map +1 -0
- package/dist/components/progress-circle.js +71 -104
- package/dist/components/progress.d.ts +5 -10
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +8 -14
- package/dist/components/radio-cards.d.ts +5 -10
- package/dist/components/radio-cards.d.ts.map +1 -0
- package/dist/components/radio-cards.js +8 -22
- package/dist/components/radio-group.d.ts +6 -13
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +7 -18
- package/dist/components/radio.d.ts +6 -12
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/radio.js +6 -11
- package/dist/components/resizable.d.ts +8 -18
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +8 -22
- package/dist/components/scroll-area.d.ts +21 -33
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +65 -85
- package/dist/components/select.d.ts +17 -50
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +27 -79
- package/dist/components/separator.d.ts +20 -29
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +28 -37
- package/dist/components/sheet.d.ts +30 -62
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +68 -81
- package/dist/components/sidebar.d.ts +67 -160
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +184 -302
- package/dist/components/skeleton.d.ts +5 -9
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +6 -9
- package/dist/components/slider.d.ts +5 -13
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +13 -35
- package/dist/components/sonner.d.ts +8 -10
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +14 -16
- package/dist/components/spinner.d.ts +6 -12
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +21 -34
- package/dist/components/switch.d.ts +5 -9
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +6 -13
- package/dist/components/table.d.ts +12 -37
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +13 -48
- package/dist/components/tabs.d.ts +8 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +9 -24
- package/dist/components/textarea.d.ts +5 -9
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +6 -9
- package/dist/components/toggle-group.d.ts +10 -24
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +21 -39
- package/dist/components/toggle.d.ts +18 -25
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +42 -30
- package/dist/components/tooltip.d.ts +9 -24
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +10 -29
- package/dist/hooks/use-animated-value.d.ts +2 -4
- package/dist/hooks/use-animated-value.d.ts.map +1 -0
- package/dist/hooks/use-animated-value.js +67 -58
- package/dist/hooks/use-copy-to-clipboard.d.ts +6 -11
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +42 -39
- package/dist/hooks/use-is-mobile.d.ts +2 -4
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +20 -23
- package/dist/hooks/use-media-query.d.ts +2 -4
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +49 -46
- package/dist/hooks/use-mutation-observer.d.ts +3 -6
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
- package/dist/hooks/use-mutation-observer.js +33 -34
- package/dist/hooks/use-pagination.d.ts +15 -22
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-pagination.js +99 -99
- package/dist/index.d.ts +131 -69
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -69
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/primitives/checkbox-group.d.ts +84 -105
- package/dist/primitives/checkbox-group.d.ts.map +1 -0
- package/dist/primitives/checkbox-group.js +91 -105
- package/dist/primitives/input-number.d.ts +41 -51
- package/dist/primitives/input-number.d.ts.map +1 -0
- package/dist/primitives/input-number.js +417 -473
- package/dist/primitives/input.d.ts +43 -48
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +67 -66
- package/dist/primitives/progress-circle.d.ts +49 -79
- package/dist/primitives/progress-circle.d.ts.map +1 -0
- package/dist/primitives/progress-circle.js +134 -149
- package/package.json +33 -16
- package/{dist → src}/css/preset.css +86 -9
- /package/{dist → src}/css/amber.css +0 -0
- /package/{dist → src}/css/blue.css +0 -0
- /package/{dist → src}/css/cyan.css +0 -0
- /package/{dist → src}/css/emerald.css +0 -0
- /package/{dist → src}/css/fuchsia.css +0 -0
- /package/{dist → src}/css/gray.css +0 -0
- /package/{dist → src}/css/green.css +0 -0
- /package/{dist → src}/css/indigo.css +0 -0
- /package/{dist → src}/css/lime.css +0 -0
- /package/{dist → src}/css/neutral.css +0 -0
- /package/{dist → src}/css/orange.css +0 -0
- /package/{dist → src}/css/pink.css +0 -0
- /package/{dist → src}/css/purple.css +0 -0
- /package/{dist → src}/css/red.css +0 -0
- /package/{dist → src}/css/rose.css +0 -0
- /package/{dist → src}/css/sky.css +0 -0
- /package/{dist → src}/css/slate.css +0 -0
- /package/{dist → src}/css/stone.css +0 -0
- /package/{dist → src}/css/style.css +0 -0
- /package/{dist → src}/css/teal.css +0 -0
- /package/{dist → src}/css/violet.css +0 -0
- /package/{dist → src}/css/yellow.css +0 -0
- /package/{dist → src}/css/zinc.css +0 -0
|
@@ -1,44 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
default: string;
|
|
9
|
-
icon: string;
|
|
10
|
-
};
|
|
1
|
+
import type { VariantProps } from "#lib/utils";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
declare const emptyMediaVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
icon: string[];
|
|
7
|
+
};
|
|
11
8
|
}, Record<string, never>>;
|
|
12
9
|
type EmptyProps = ComponentProps<"div">;
|
|
13
|
-
declare function Empty({
|
|
14
|
-
className,
|
|
15
|
-
...props
|
|
16
|
-
}: EmptyProps): JSX.Element;
|
|
10
|
+
declare function Empty({ className, ...props }: EmptyProps): JSX.Element;
|
|
17
11
|
type EmptyHeaderProps = ComponentProps<"div">;
|
|
18
|
-
declare function EmptyHeader({
|
|
19
|
-
className,
|
|
20
|
-
...props
|
|
21
|
-
}: EmptyHeaderProps): JSX.Element;
|
|
12
|
+
declare function EmptyHeader({ className, ...props }: EmptyHeaderProps): JSX.Element;
|
|
22
13
|
type EmptyMediaProps = ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>;
|
|
23
|
-
declare function EmptyMedia({
|
|
24
|
-
className,
|
|
25
|
-
variant,
|
|
26
|
-
...props
|
|
27
|
-
}: EmptyMediaProps): JSX.Element;
|
|
14
|
+
declare function EmptyMedia({ className, variant, ...props }: EmptyMediaProps): JSX.Element;
|
|
28
15
|
type EmptyTitleProps = ComponentProps<"div">;
|
|
29
|
-
declare function EmptyTitle({
|
|
30
|
-
className,
|
|
31
|
-
...props
|
|
32
|
-
}: EmptyTitleProps): JSX.Element;
|
|
16
|
+
declare function EmptyTitle({ className, ...props }: EmptyTitleProps): JSX.Element;
|
|
33
17
|
type EmptyDescriptionProps = ComponentProps<"p">;
|
|
34
|
-
declare function EmptyDescription({
|
|
35
|
-
className,
|
|
36
|
-
...props
|
|
37
|
-
}: EmptyDescriptionProps): JSX.Element;
|
|
18
|
+
declare function EmptyDescription({ className, ...props }: EmptyDescriptionProps): JSX.Element;
|
|
38
19
|
type EmptyContentProps = ComponentProps<"div">;
|
|
39
|
-
declare function EmptyContent({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { Empty, EmptyContent, type EmptyContentProps, EmptyDescription, type EmptyDescriptionProps, EmptyHeader, type EmptyHeaderProps, EmptyMedia, type EmptyMediaProps, type EmptyProps, EmptyTitle, type EmptyTitleProps, emptyMediaVariants };
|
|
20
|
+
declare function EmptyContent({ className, ...props }: EmptyContentProps): JSX.Element;
|
|
21
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, emptyMediaVariants, EmptyTitle, };
|
|
22
|
+
export type { EmptyContentProps, EmptyDescriptionProps, EmptyHeaderProps, EmptyMediaProps, EmptyProps, EmptyTitleProps, };
|
|
23
|
+
//# sourceMappingURL=empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../src/components/empty.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAQjD,QAAA,MAAM,kBAAkB;;QAUlB,OAAO;QACP,IAAI;;yBAQR,CAAC;AAMH,KAAK,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExC,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAc/D;AAMD,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9C,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAQ3E;AAMD,KAAK,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEvF,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,OAAmB,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAS9F;AAMD,KAAK,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE7C,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAQzE;AAMD,KAAK,qBAAqB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAEjD,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAarF;AAMD,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE/C,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAY7E;AAMD,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,UAAU,GACX,CAAC;AAEF,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,eAAe,GAChB,CAAC"}
|
package/dist/components/empty.js
CHANGED
|
@@ -1,59 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn, tv } from "#lib/utils";
|
|
3
|
+
/* -----------------------------------------------------------------------------
|
|
4
|
+
* Variants: Empty
|
|
5
|
+
* -------------------------------------------------------------------------- */
|
|
4
6
|
const emptyMediaVariants = tv({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
base: [
|
|
8
|
+
"mb-2 flex shrink-0 items-center justify-center",
|
|
9
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
10
|
+
],
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
variant: "default",
|
|
13
|
+
},
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: "bg-transparent",
|
|
17
|
+
icon: [
|
|
18
|
+
"flex size-10 shrink-0 items-center justify-center",
|
|
19
|
+
"rounded-xl",
|
|
20
|
+
"bg-muted text-foreground",
|
|
21
|
+
"[&_svg:not([class*='size-'])]:size-6",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
11
25
|
});
|
|
12
26
|
function Empty({ className, ...props }) {
|
|
13
|
-
|
|
14
|
-
className: cn("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-xl border-dashed p-6 text-center text-balance md:p-12", className),
|
|
15
|
-
"data-slot": "empty",
|
|
16
|
-
...props
|
|
17
|
-
});
|
|
27
|
+
return (_jsx("div", { className: cn("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 p-6", "rounded-xl border-dashed", "text-center text-balance", "md:p-12", className), "data-slot": "empty", ...props }));
|
|
18
28
|
}
|
|
19
29
|
function EmptyHeader({ className, ...props }) {
|
|
20
|
-
|
|
21
|
-
className: cn("flex max-w-sm flex-col items-center gap-2 text-center", className),
|
|
22
|
-
"data-slot": "empty-header",
|
|
23
|
-
...props
|
|
24
|
-
});
|
|
30
|
+
return (_jsx("div", { className: cn("flex max-w-sm flex-col items-center gap-2", "text-center", className), "data-slot": "empty-header", ...props }));
|
|
25
31
|
}
|
|
26
32
|
function EmptyMedia({ className, variant = "default", ...props }) {
|
|
27
|
-
|
|
28
|
-
className: emptyMediaVariants({
|
|
29
|
-
className,
|
|
30
|
-
variant
|
|
31
|
-
}),
|
|
32
|
-
"data-slot": "empty-icon",
|
|
33
|
-
"data-variant": variant,
|
|
34
|
-
...props
|
|
35
|
-
});
|
|
33
|
+
return (_jsx("div", { className: emptyMediaVariants({ className, variant }), "data-slot": "empty-icon", "data-variant": variant, ...props }));
|
|
36
34
|
}
|
|
37
35
|
function EmptyTitle({ className, ...props }) {
|
|
38
|
-
|
|
39
|
-
className: cn("text-lg font-medium tracking-tight", className),
|
|
40
|
-
"data-slot": "empty-title",
|
|
41
|
-
...props
|
|
42
|
-
});
|
|
36
|
+
return (_jsx("div", { className: cn("text-lg font-medium tracking-tight", className), "data-slot": "empty-title", ...props }));
|
|
43
37
|
}
|
|
44
38
|
function EmptyDescription({ className, ...props }) {
|
|
45
|
-
|
|
46
|
-
className: cn("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
47
|
-
"data-slot": "empty-description",
|
|
48
|
-
...props
|
|
49
|
-
});
|
|
39
|
+
return (_jsx("p", { className: cn("text-sm/relaxed text-muted-foreground", "[&>a]:underline [&>a]:underline-offset-4", "[&>a:hover]:text-primary", className), "data-slot": "empty-description", ...props }));
|
|
50
40
|
}
|
|
51
41
|
function EmptyContent({ className, ...props }) {
|
|
52
|
-
|
|
53
|
-
className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance", className),
|
|
54
|
-
"data-slot": "empty-content",
|
|
55
|
-
...props
|
|
56
|
-
});
|
|
42
|
+
return (_jsx("div", { className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4", "text-sm text-balance", className), "data-slot": "empty-content", ...props }));
|
|
57
43
|
}
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
/* -----------------------------------------------------------------------------
|
|
45
|
+
* Exports
|
|
46
|
+
* -------------------------------------------------------------------------- */
|
|
47
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, emptyMediaVariants, EmptyTitle, };
|
|
@@ -1,79 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
responsive: string;
|
|
11
|
-
vertical: string;
|
|
12
|
-
};
|
|
1
|
+
import type { VariantProps } from "#lib/utils";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
import { Label } from "#components/label";
|
|
4
|
+
declare const fieldVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
5
|
+
orientation: {
|
|
6
|
+
horizontal: string[];
|
|
7
|
+
responsive: string[];
|
|
8
|
+
vertical: string[];
|
|
9
|
+
};
|
|
13
10
|
}, Record<string, never>>;
|
|
14
11
|
type FieldSetProps = ComponentProps<"fieldset">;
|
|
15
|
-
declare function FieldSet({
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}: FieldSetProps): JSX.Element;
|
|
12
|
+
declare function FieldSet({ className, ...props }: FieldSetProps): JSX.Element;
|
|
19
13
|
type FieldLegendProps = ComponentProps<"legend"> & {
|
|
20
|
-
|
|
14
|
+
variant?: "label" | "legend";
|
|
21
15
|
};
|
|
22
|
-
declare function FieldLegend({
|
|
23
|
-
className,
|
|
24
|
-
variant,
|
|
25
|
-
...props
|
|
26
|
-
}: FieldLegendProps): JSX.Element;
|
|
16
|
+
declare function FieldLegend({ className, variant, ...props }: FieldLegendProps): JSX.Element;
|
|
27
17
|
type FieldGroupProps = ComponentProps<"div">;
|
|
28
|
-
declare function FieldGroup({
|
|
29
|
-
className,
|
|
30
|
-
...props
|
|
31
|
-
}: FieldGroupProps): JSX.Element;
|
|
18
|
+
declare function FieldGroup({ className, ...props }: FieldGroupProps): JSX.Element;
|
|
32
19
|
type FieldProps = ComponentProps<"div"> & VariantProps<typeof fieldVariants>;
|
|
33
|
-
declare function Field({
|
|
34
|
-
className,
|
|
35
|
-
orientation,
|
|
36
|
-
...props
|
|
37
|
-
}: FieldProps): JSX.Element;
|
|
20
|
+
declare function Field({ className, orientation, ...props }: FieldProps): JSX.Element;
|
|
38
21
|
type FieldContentProps = ComponentProps<"div">;
|
|
39
|
-
declare function FieldContent({
|
|
40
|
-
className,
|
|
41
|
-
...props
|
|
42
|
-
}: FieldContentProps): JSX.Element;
|
|
22
|
+
declare function FieldContent({ className, ...props }: FieldContentProps): JSX.Element;
|
|
43
23
|
type FieldLabelProps = ComponentProps<typeof Label>;
|
|
44
|
-
declare function FieldLabel({
|
|
45
|
-
className,
|
|
46
|
-
...props
|
|
47
|
-
}: FieldLabelProps): JSX.Element;
|
|
24
|
+
declare function FieldLabel({ className, ...props }: FieldLabelProps): JSX.Element;
|
|
48
25
|
type FieldTitleProps = ComponentProps<"div">;
|
|
49
|
-
declare function FieldTitle({
|
|
50
|
-
className,
|
|
51
|
-
...props
|
|
52
|
-
}: FieldTitleProps): JSX.Element;
|
|
26
|
+
declare function FieldTitle({ className, ...props }: FieldTitleProps): JSX.Element;
|
|
53
27
|
type FieldDescriptionProps = ComponentProps<"p">;
|
|
54
|
-
declare function FieldDescription({
|
|
55
|
-
className,
|
|
56
|
-
...props
|
|
57
|
-
}: FieldDescriptionProps): JSX.Element;
|
|
28
|
+
declare function FieldDescription({ className, ...props }: FieldDescriptionProps): JSX.Element;
|
|
58
29
|
type FieldSeparatorProps = ComponentProps<"div"> & {
|
|
59
|
-
|
|
30
|
+
children?: ComponentProps<"span">["children"];
|
|
60
31
|
};
|
|
61
|
-
declare function FieldSeparator({
|
|
62
|
-
children,
|
|
63
|
-
className,
|
|
64
|
-
...props
|
|
65
|
-
}: FieldSeparatorProps): JSX.Element;
|
|
32
|
+
declare function FieldSeparator({ children, className, ...props }: FieldSeparatorProps): JSX.Element;
|
|
66
33
|
interface FieldErrorMessage {
|
|
67
|
-
|
|
34
|
+
message?: string;
|
|
68
35
|
}
|
|
69
36
|
interface FieldErrorProps extends ComponentProps<"div"> {
|
|
70
|
-
|
|
37
|
+
errors?: (FieldErrorMessage | undefined)[];
|
|
71
38
|
}
|
|
72
|
-
declare function FieldError({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
...props
|
|
77
|
-
}: FieldErrorProps): JSX.Element | null;
|
|
78
|
-
//#endregion
|
|
79
|
-
export { Field, FieldContent, type FieldContentProps, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorProps, FieldGroup, type FieldGroupProps, FieldLabel, type FieldLabelProps, FieldLegend, type FieldLegendProps, type FieldProps, FieldSeparator, type FieldSeparatorProps, FieldSet, type FieldSetProps, FieldTitle, type FieldTitleProps, fieldVariants };
|
|
39
|
+
declare function FieldError({ children, className, errors, ...props }: FieldErrorProps): JSX.Element | null;
|
|
40
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants, };
|
|
41
|
+
export type { FieldContentProps, FieldDescriptionProps, FieldErrorProps, FieldGroupProps, FieldLabelProps, FieldLegendProps, FieldProps, FieldSeparatorProps, FieldSetProps, FieldTitleProps, };
|
|
42
|
+
//# sourceMappingURL=field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/components/field.tsx"],"names":[],"mappings":"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"}
|
package/dist/components/field.js
CHANGED
|
@@ -1,114 +1,85 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { cn, tv } from "@codefast/tailwind-variants";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn, tv } from "#lib/utils";
|
|
6
4
|
import { useMemo } from "react";
|
|
7
|
-
|
|
5
|
+
import { Label } from "#components/label";
|
|
6
|
+
import { Separator } from "#components/separator";
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Variants: Field
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
8
10
|
const fieldVariants = tv({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
base: ["group/field flex w-full gap-3", "data-[invalid=true]:text-destructive"],
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
orientation: "vertical",
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
orientation: {
|
|
17
|
+
horizontal: [
|
|
18
|
+
"flex-row items-center",
|
|
19
|
+
"has-[>[data-slot=field-content]]:items-start",
|
|
20
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
21
|
+
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
22
|
+
],
|
|
23
|
+
responsive: [
|
|
24
|
+
"flex-col",
|
|
25
|
+
"@md/field-group:flex-row @md/field-group:items-center",
|
|
26
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start",
|
|
27
|
+
"[&>*]:w-full",
|
|
28
|
+
"@md/field-group:[&>*]:w-auto",
|
|
29
|
+
"[&>.sr-only]:w-auto",
|
|
30
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
31
|
+
"@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
32
|
+
],
|
|
33
|
+
vertical: ["flex-col", "[&>*]:w-full", "[&>.sr-only]:w-auto"],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
16
36
|
});
|
|
17
37
|
function FieldSet({ className, ...props }) {
|
|
18
|
-
|
|
19
|
-
className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
|
|
20
|
-
"data-slot": "field-set",
|
|
21
|
-
...props
|
|
22
|
-
});
|
|
38
|
+
return (_jsx("fieldset", { className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3", "has-[>[data-slot=radio-group]]:gap-3", className), "data-slot": "field-set", ...props }));
|
|
23
39
|
}
|
|
24
40
|
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
25
|
-
|
|
26
|
-
className: cn("mb-3 text-base font-medium", "data-[variant=label]:text-sm", className),
|
|
27
|
-
"data-slot": "field-legend",
|
|
28
|
-
"data-variant": variant,
|
|
29
|
-
...props
|
|
30
|
-
});
|
|
41
|
+
return (_jsx("legend", { className: cn("mb-3", "text-base font-medium", "data-[variant=label]:text-sm", className), "data-slot": "field-legend", "data-variant": variant, ...props }));
|
|
31
42
|
}
|
|
32
43
|
function FieldGroup({ className, ...props }) {
|
|
33
|
-
|
|
34
|
-
className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className),
|
|
35
|
-
"data-slot": "field-group",
|
|
36
|
-
...props
|
|
37
|
-
});
|
|
44
|
+
return (_jsx("div", { className: cn("group/field-group @container/field-group flex w-full flex-col gap-7", "data-[slot=checkbox-group]:gap-3", "[&>[data-slot=field-group]]:gap-4", className), "data-slot": "field-group", ...props }));
|
|
38
45
|
}
|
|
39
46
|
function Field({ className, orientation = "vertical", ...props }) {
|
|
40
|
-
|
|
41
|
-
className: fieldVariants({
|
|
42
|
-
className,
|
|
43
|
-
orientation
|
|
44
|
-
}),
|
|
45
|
-
"data-orientation": orientation,
|
|
46
|
-
"data-slot": "field",
|
|
47
|
-
role: "group",
|
|
48
|
-
...props
|
|
49
|
-
});
|
|
47
|
+
return (_jsx("div", { className: fieldVariants({ className, orientation }), "data-orientation": orientation, "data-slot": "field", role: "group", ...props }));
|
|
50
48
|
}
|
|
51
49
|
function FieldContent({ className, ...props }) {
|
|
52
|
-
|
|
53
|
-
className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
|
|
54
|
-
"data-slot": "field-content",
|
|
55
|
-
...props
|
|
56
|
-
});
|
|
50
|
+
return (_jsx("div", { className: cn("group/field-content flex flex-1 flex-col gap-1.5", "leading-snug", className), "data-slot": "field-content", ...props }));
|
|
57
51
|
}
|
|
58
52
|
function FieldLabel({ className, ...props }) {
|
|
59
|
-
|
|
60
|
-
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4", "has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10", className),
|
|
61
|
-
"data-slot": "field-label",
|
|
62
|
-
...props
|
|
63
|
-
});
|
|
53
|
+
return (_jsx(Label, { className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug", "group-data-disabled/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border", "has-data-checked:border-primary has-data-checked:bg-primary/5", "dark:has-data-checked:bg-primary/10", "[&>*]:data-[slot=field]:p-4", className), "data-slot": "field-label", ...props }));
|
|
64
54
|
}
|
|
65
55
|
function FieldTitle({ className, ...props }) {
|
|
66
|
-
|
|
67
|
-
className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
|
|
68
|
-
"data-slot": "field-label",
|
|
69
|
-
...props
|
|
70
|
-
});
|
|
56
|
+
return (_jsx("div", { className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium", "group-data-disabled/field:opacity-50", className), "data-slot": "field-label", ...props }));
|
|
71
57
|
}
|
|
72
58
|
function FieldDescription({ className, ...props }) {
|
|
73
|
-
|
|
74
|
-
className: cn("text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
|
|
75
|
-
"data-slot": "field-description",
|
|
76
|
-
...props
|
|
77
|
-
});
|
|
59
|
+
return (_jsx("p", { className: cn("text-sm leading-normal font-normal text-muted-foreground", "group-has-data-[orientation=horizontal]/field:text-balance", "last:mt-0", "nth-last-2:-mt-1", "[&>a]:underline [&>a]:underline-offset-4", "[&>a:hover]:text-primary", "[[data-variant=legend]+&]:-mt-1.5", className), "data-slot": "field-description", ...props }));
|
|
78
60
|
}
|
|
79
61
|
function FieldSeparator({ children, className, ...props }) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
|
|
83
|
-
"data-content": hasContent,
|
|
84
|
-
"data-slot": "field-separator",
|
|
85
|
-
...props,
|
|
86
|
-
children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), hasContent ? /* @__PURE__ */ jsx("span", {
|
|
87
|
-
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
88
|
-
"data-slot": "field-separator-content",
|
|
89
|
-
children
|
|
90
|
-
}) : null]
|
|
91
|
-
});
|
|
62
|
+
const hasContent = Boolean(children);
|
|
63
|
+
return (_jsxs("div", { className: cn("relative", "-my-2 h-5 text-sm", "group-data-[variant=outline]/field-group:-mb-2", className), "data-content": hasContent, "data-slot": "field-separator", ...props, children: [_jsx(Separator, { className: cn("absolute", "inset-0 top-1/2") }), hasContent ? (_jsx("span", { className: cn("relative block", "mx-auto w-fit px-2", "bg-background text-muted-foreground"), "data-slot": "field-separator-content", children: children })) : null] }));
|
|
92
64
|
}
|
|
93
65
|
function FieldError({ children, className, errors, ...props }) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
...props,
|
|
110
|
-
children: content
|
|
111
|
-
});
|
|
66
|
+
const fallbackContent = useMemo(() => {
|
|
67
|
+
if (!errors?.length) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
71
|
+
if (uniqueErrors.length === 1) {
|
|
72
|
+
return uniqueErrors[0]?.message ?? null;
|
|
73
|
+
}
|
|
74
|
+
return (_jsx("ul", { className: cn("flex flex-col gap-1", "ml-4", "list-disc"), children: uniqueErrors.map((error) => error?.message ? _jsx("li", { children: error.message }, error.message) : null) }));
|
|
75
|
+
}, [errors]);
|
|
76
|
+
const content = children ?? fallbackContent;
|
|
77
|
+
if (content === null || content === undefined || content === false) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return (_jsx("div", { className: cn("text-sm font-normal text-destructive", className), "data-slot": "field-error", role: "alert", ...props, children: content }));
|
|
112
81
|
}
|
|
113
|
-
|
|
114
|
-
|
|
82
|
+
/* -----------------------------------------------------------------------------
|
|
83
|
+
* Exports
|
|
84
|
+
* -------------------------------------------------------------------------- */
|
|
85
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants, };
|
|
@@ -1,48 +1,27 @@
|
|
|
1
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
+
import type * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
import type { ComponentProps, JSX, ReactNode } from "react";
|
|
4
|
+
import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
1
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
-
import {
|
|
3
|
-
import * as _$_radix_ui_react_context0 from "@radix-ui/react-context";
|
|
4
|
-
import { Scope } from "@radix-ui/react-context";
|
|
5
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
6
|
-
import * as _$react_hook_form0 from "react-hook-form";
|
|
7
|
-
import { ControllerProps, FieldPath, FieldValues, FormProvider } from "react-hook-form";
|
|
8
|
-
|
|
9
|
-
//#region src/components/form.d.ts
|
|
6
|
+
import { FormProvider } from "react-hook-form";
|
|
10
7
|
type FormProps = ComponentProps<typeof FormProvider>;
|
|
11
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props:
|
|
8
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
12
9
|
type ScopedProps<P> = P & {
|
|
13
|
-
|
|
10
|
+
__scopeFormField?: Scope;
|
|
14
11
|
};
|
|
15
|
-
declare const createFormFieldScope:
|
|
12
|
+
declare const createFormFieldScope: import("@radix-ui/react-context").CreateScope;
|
|
16
13
|
type FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ControllerProps<TFieldValues, TName>;
|
|
17
14
|
declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(formFieldProps: ScopedProps<FormFieldProps<TFieldValues, TName>>): JSX.Element;
|
|
18
15
|
type FormItemProps = ComponentProps<"div">;
|
|
19
|
-
declare function FormItem({
|
|
20
|
-
__scopeFormField,
|
|
21
|
-
className,
|
|
22
|
-
...props
|
|
23
|
-
}: ScopedProps<FormItemProps>): JSX.Element;
|
|
16
|
+
declare function FormItem({ __scopeFormField, className, ...props }: ScopedProps<FormItemProps>): JSX.Element;
|
|
24
17
|
type FormLabelProps = ComponentProps<typeof LabelPrimitive.Root>;
|
|
25
|
-
declare function FormLabel({
|
|
26
|
-
__scopeFormField,
|
|
27
|
-
...props
|
|
28
|
-
}: ScopedProps<FormLabelProps>): JSX.Element;
|
|
18
|
+
declare function FormLabel({ __scopeFormField, ...props }: ScopedProps<FormLabelProps>): JSX.Element;
|
|
29
19
|
type FormControlProps = ComponentProps<typeof Slot>;
|
|
30
|
-
declare function FormControl({
|
|
31
|
-
__scopeFormField,
|
|
32
|
-
...props
|
|
33
|
-
}: ScopedProps<FormControlProps>): JSX.Element;
|
|
20
|
+
declare function FormControl({ __scopeFormField, ...props }: ScopedProps<FormControlProps>): JSX.Element;
|
|
34
21
|
type FormDescriptionProps = ComponentProps<"p">;
|
|
35
|
-
declare function FormDescription({
|
|
36
|
-
__scopeFormField,
|
|
37
|
-
className,
|
|
38
|
-
...props
|
|
39
|
-
}: ScopedProps<FormDescriptionProps>): JSX.Element;
|
|
22
|
+
declare function FormDescription({ __scopeFormField, className, ...props }: ScopedProps<FormDescriptionProps>): JSX.Element;
|
|
40
23
|
type FormMessageProps = ComponentProps<"p">;
|
|
41
|
-
declare function FormMessage({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...props
|
|
46
|
-
}: ScopedProps<FormMessageProps>): ReactNode;
|
|
47
|
-
//#endregion
|
|
48
|
-
export { Form, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, type FormFieldProps, FormItem, type FormItemProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, createFormFieldScope };
|
|
24
|
+
declare function FormMessage({ __scopeFormField, children, className, ...props }: ScopedProps<FormMessageProps>): ReactNode;
|
|
25
|
+
export type { FormControlProps, FormDescriptionProps, FormFieldProps, FormItemProps, FormLabelProps, FormMessageProps, FormProps, };
|
|
26
|
+
export { createFormFieldScope, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, };
|
|
27
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAc,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI3F,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAc,YAAY,EAAgC,MAAM,iBAAiB,CAAC;AAQzF,KAAK,SAAS,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAErD,QAAA,MAAM,IAAI,4MAAe,CAAC;AAQ1B,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,gBAAgB,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvD,QAAA,MAA+B,oBAAoB,+CAAuC,CAAC;AA+C3F,KAAK,cAAc,CACjB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAC7D,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AAEzC,iBAAS,SAAS,CAChB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,cAAc,EAAE,WAAW,CAAC,cAAc,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAQ/E;AAmBD,KAAK,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3C,iBAAS,QAAQ,CAAC,EAChB,gBAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,OAAO,CAQ1C;AAQD,KAAK,cAAc,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAEjE,iBAAS,SAAS,CAAC,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,OAAO,CAW3F;AAQD,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAEpD,iBAAS,WAAW,CAAC,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,GAAG,CAAC,OAAO,CAe/F;AAMD,KAAK,oBAAoB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAEhD,iBAAS,eAAe,CAAC,EACvB,gBAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC,OAAO,CAWjD;AAQD,KAAK,gBAAgB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAE5C,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAsB3C;AAMD,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,SAAS,GACV,CAAC;AACF,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,CAAC"}
|