@codefast/ui 0.3.9 → 0.3.10
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 +11 -0
- package/dist/components/accordion.cjs +97 -1
- package/dist/components/accordion.d.ts +4 -4
- package/dist/components/accordion.js +51 -1
- package/dist/components/alert-dialog.cjs +155 -1
- package/dist/components/alert-dialog.d.ts +11 -11
- package/dist/components/alert-dialog.js +94 -1
- package/dist/components/alert.cjs +84 -1
- package/dist/components/alert.d.ts +5 -5
- package/dist/components/alert.js +41 -1
- package/dist/components/aspect-ratio.cjs +43 -1
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/aspect-ratio.js +9 -1
- package/dist/components/avatar.cjs +65 -1
- package/dist/components/avatar.d.ts +2 -2
- package/dist/components/avatar.js +25 -1
- package/dist/components/badge.cjs +66 -1
- package/dist/components/badge.d.ts +3 -3
- package/dist/components/badge.js +29 -1
- package/dist/components/breadcrumb.cjs +126 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +74 -1
- package/dist/components/button-group.cjs +86 -1
- package/dist/components/button-group.d.ts +5 -5
- package/dist/components/button-group.js +43 -1
- package/dist/components/button.cjs +92 -1
- package/dist/components/button.d.ts +6 -6
- package/dist/components/button.js +55 -1
- package/dist/components/calendar.cjs +150 -1
- package/dist/components/calendar.d.ts +12 -19
- package/dist/components/calendar.js +113 -1
- package/dist/components/card.cjs +105 -1
- package/dist/components/card.d.ts +8 -8
- package/dist/components/card.js +53 -1
- package/dist/components/carousel.cjs +210 -1
- package/dist/components/carousel.d.ts +10 -10
- package/dist/components/carousel.js +151 -1
- package/dist/components/chart.cjs +250 -3
- package/dist/components/chart.d.ts +9 -9
- package/dist/components/chart.js +198 -3
- package/dist/components/checkbox-cards.cjs +69 -1
- package/dist/components/checkbox-cards.d.ts +2 -2
- package/dist/components/checkbox-cards.js +32 -1
- package/dist/components/checkbox-group.cjs +63 -1
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group.js +26 -1
- package/dist/components/checkbox.cjs +53 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +19 -1
- package/dist/components/collapsible.cjs +61 -1
- package/dist/components/collapsible.d.ts +2 -2
- package/dist/components/collapsible.js +21 -1
- package/dist/components/command.cjs +167 -1
- package/dist/components/command.d.ts +4 -4
- package/dist/components/command.js +106 -1
- package/dist/components/context-menu.cjs +218 -1
- package/dist/components/context-menu.d.ts +4 -4
- package/dist/components/context-menu.js +142 -1
- package/dist/components/dialog.cjs +164 -1
- package/dist/components/dialog.d.ts +10 -10
- package/dist/components/dialog.js +106 -1
- package/dist/components/drawer.cjs +143 -1
- package/dist/components/drawer.d.ts +9 -9
- package/dist/components/drawer.js +85 -1
- package/dist/components/dropdown-menu.cjs +221 -1
- package/dist/components/dropdown-menu.d.ts +4 -4
- package/dist/components/dropdown-menu.js +145 -1
- package/dist/components/empty.cjs +113 -1
- package/dist/components/empty.d.ts +9 -9
- package/dist/components/empty.js +61 -1
- package/dist/components/field.cjs +193 -1
- package/dist/components/field.d.ts +14 -14
- package/dist/components/field.js +129 -1
- package/dist/components/form.cjs +151 -1
- package/dist/components/form.d.ts +10 -10
- package/dist/components/form.js +96 -1
- package/dist/components/hover-card.cjs +77 -1
- package/dist/components/hover-card.d.ts +2 -2
- package/dist/components/hover-card.js +34 -1
- package/dist/components/input-group.cjs +155 -1
- package/dist/components/input-group.d.ts +15 -15
- package/dist/components/input-group.js +97 -1
- package/dist/components/input-number.cjs +98 -1
- package/dist/components/input-number.d.ts +2 -2
- package/dist/components/input-number.js +64 -1
- package/dist/components/input-otp.cjs +101 -1
- package/dist/components/input-otp.d.ts +6 -6
- package/dist/components/input-otp.js +49 -1
- package/dist/components/input-password.cjs +71 -1
- package/dist/components/input-password.d.ts +3 -3
- package/dist/components/input-password.js +37 -1
- package/dist/components/input-search.cjs +80 -1
- package/dist/components/input-search.d.ts +3 -3
- package/dist/components/input-search.js +46 -1
- package/dist/components/input.cjs +45 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +11 -1
- package/dist/components/item.cjs +186 -1
- package/dist/components/item.d.ts +12 -12
- package/dist/components/item.js +119 -1
- package/dist/components/kbd.cjs +54 -1
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +17 -1
- package/dist/components/label.cjs +45 -1
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +11 -1
- package/dist/components/menubar.cjs +232 -1
- package/dist/components/menubar.d.ts +4 -4
- package/dist/components/menubar.js +153 -1
- package/dist/components/native-select.cjs +75 -1
- package/dist/components/native-select.d.ts +4 -4
- package/dist/components/native-select.js +35 -1
- package/dist/components/navigation-menu.cjs +146 -2
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +94 -2
- package/dist/components/pagination.cjs +138 -1
- package/dist/components/pagination.d.ts +10 -10
- package/dist/components/pagination.js +86 -1
- package/dist/components/popover.cjs +86 -1
- package/dist/components/popover.d.ts +3 -3
- package/dist/components/popover.js +40 -1
- package/dist/components/progress-circle.cjs +184 -1
- package/dist/components/progress-circle.d.ts +5 -5
- package/dist/components/progress-circle.js +147 -1
- package/dist/components/progress.cjs +52 -1
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +18 -1
- package/dist/components/radio-cards.cjs +66 -1
- package/dist/components/radio-cards.d.ts +2 -2
- package/dist/components/radio-cards.js +29 -1
- package/dist/components/radio-group.cjs +59 -1
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +22 -1
- package/dist/components/radio.cjs +47 -1
- package/dist/components/radio.d.ts +2 -2
- package/dist/components/radio.js +13 -1
- package/dist/components/resizable.cjs +71 -1
- package/dist/components/resizable.d.ts +8 -8
- package/dist/components/resizable.js +31 -1
- package/dist/components/scroll-area.cjs +140 -1
- package/dist/components/scroll-area.d.ts +5 -5
- package/dist/components/scroll-area.js +100 -1
- package/dist/components/select.cjs +180 -1
- package/dist/components/select.d.ts +5 -5
- package/dist/components/select.js +119 -1
- package/dist/components/separator.cjs +82 -1
- package/dist/components/separator.d.ts +5 -5
- package/dist/components/separator.js +42 -1
- package/dist/components/sheet.cjs +184 -1
- package/dist/components/sheet.d.ts +9 -9
- package/dist/components/sheet.js +123 -1
- package/dist/components/sidebar.cjs +506 -1
- package/dist/components/sidebar.d.ts +31 -31
- package/dist/components/sidebar.js +400 -1
- package/dist/components/skeleton.cjs +44 -1
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +10 -1
- package/dist/components/slider.cjs +79 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +45 -1
- package/dist/components/sonner.cjs +57 -1
- package/dist/components/sonner.d.ts +3 -3
- package/dist/components/sonner.js +17 -1
- package/dist/components/spinner.cjs +75 -1
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +41 -1
- package/dist/components/switch.cjs +49 -1
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +15 -1
- package/dist/components/table.cjs +118 -1
- package/dist/components/table.d.ts +9 -9
- package/dist/components/table.js +63 -1
- package/dist/components/tabs.cjs +75 -1
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +32 -1
- package/dist/components/textarea.cjs +44 -1
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +10 -1
- package/dist/components/toggle-group.cjs +90 -1
- package/dist/components/toggle-group.d.ts +10 -12
- package/dist/components/toggle-group.js +53 -1
- package/dist/components/toggle.cjs +71 -1
- package/dist/components/toggle.d.ts +10 -12
- package/dist/components/toggle.js +34 -1
- package/dist/components/tooltip.cjs +90 -1
- package/dist/components/tooltip.d.ts +3 -3
- package/dist/components/tooltip.js +44 -1
- package/dist/css/amber.css +95 -1
- package/dist/css/blue.css +95 -1
- package/dist/css/cyan.css +95 -1
- package/dist/css/emerald.css +95 -1
- package/dist/css/fuchsia.css +95 -1
- package/dist/css/gray.css +95 -1
- package/dist/css/green.css +95 -1
- package/dist/css/indigo.css +95 -1
- package/dist/css/lime.css +95 -1
- package/dist/css/neutral.css +95 -1
- package/dist/css/orange.css +95 -1
- package/dist/css/pink.css +95 -1
- package/dist/css/preset.css +118 -1
- package/dist/css/purple.css +95 -1
- package/dist/css/red.css +95 -1
- package/dist/css/rose.css +95 -1
- package/dist/css/sky.css +95 -1
- package/dist/css/slate.css +95 -1
- package/dist/css/stone.css +95 -1
- package/dist/css/style.css +3 -1
- package/dist/css/teal.css +95 -1
- package/dist/css/violet.css +95 -1
- package/dist/css/yellow.css +95 -1
- package/dist/css/zinc.css +95 -1
- package/dist/hooks/use-animated-value.cjs +74 -1
- package/dist/hooks/use-animated-value.d.ts +9 -10
- package/dist/hooks/use-animated-value.js +40 -1
- package/dist/hooks/use-copy-to-clipboard.cjs +57 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +18 -1
- package/dist/hooks/use-copy-to-clipboard.js +23 -1
- package/dist/hooks/use-is-mobile.cjs +39 -1
- package/dist/hooks/use-is-mobile.d.ts +15 -6
- package/dist/hooks/use-is-mobile.js +5 -1
- package/dist/hooks/use-media-query.cjs +56 -1
- package/dist/hooks/use-media-query.d.ts +11 -3
- package/dist/hooks/use-media-query.js +22 -1
- package/dist/hooks/use-mutation-observer.cjs +56 -1
- package/dist/hooks/use-mutation-observer.d.ts +8 -12
- package/dist/hooks/use-mutation-observer.js +22 -1
- package/dist/hooks/use-pagination.cjs +92 -1
- package/dist/hooks/use-pagination.d.ts +12 -10
- package/dist/hooks/use-pagination.js +55 -1
- package/dist/index.cjs +1081 -1
- package/dist/index.d.ts +130 -131
- package/dist/index.js +69 -1
- package/dist/primitives/checkbox-group.cjs +151 -1
- package/dist/primitives/checkbox-group.d.ts +11 -11
- package/dist/primitives/checkbox-group.js +99 -1
- package/dist/primitives/input-number.cjs +439 -1
- package/dist/primitives/input-number.d.ts +8 -8
- package/dist/primitives/input-number.js +381 -1
- package/dist/primitives/input.cjs +99 -1
- package/dist/primitives/input.d.ts +4 -4
- package/dist/primitives/input.js +53 -1
- package/dist/primitives/progress-circle.cjs +198 -1
- package/dist/primitives/progress-circle.d.ts +7 -7
- package/dist/primitives/progress-circle.js +128 -1
- package/package.json +385 -38
|
@@ -1 +1,113 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EmptyTitle: ()=>EmptyTitle,
|
|
28
|
+
emptyMediaVariants: ()=>emptyMediaVariants,
|
|
29
|
+
EmptyHeader: ()=>EmptyHeader,
|
|
30
|
+
Empty: ()=>Empty,
|
|
31
|
+
EmptyContent: ()=>EmptyContent,
|
|
32
|
+
EmptyDescription: ()=>EmptyDescription,
|
|
33
|
+
EmptyMedia: ()=>EmptyMedia
|
|
34
|
+
});
|
|
35
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
36
|
+
const tailwind_variants_namespaceObject = require("@codefast/tailwind-variants");
|
|
37
|
+
const emptyMediaVariants = (0, tailwind_variants_namespaceObject.tv)({
|
|
38
|
+
base: 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: 'default'
|
|
41
|
+
},
|
|
42
|
+
variants: {
|
|
43
|
+
variant: {
|
|
44
|
+
default: 'bg-transparent',
|
|
45
|
+
icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-xl [&_svg:not([class*='size-'])]:size-6"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
function Empty({ className, ...props }) {
|
|
50
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
51
|
+
className: (0, tailwind_variants_namespaceObject.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),
|
|
52
|
+
"data-slot": "empty",
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function EmptyHeader({ className, ...props }) {
|
|
57
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
58
|
+
className: (0, tailwind_variants_namespaceObject.cn)('flex max-w-sm flex-col items-center gap-2 text-center', className),
|
|
59
|
+
"data-slot": "empty-header",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function EmptyMedia({ className, variant = 'default', ...props }) {
|
|
64
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
65
|
+
className: emptyMediaVariants({
|
|
66
|
+
className,
|
|
67
|
+
variant
|
|
68
|
+
}),
|
|
69
|
+
"data-slot": "empty-icon",
|
|
70
|
+
"data-variant": variant,
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function EmptyTitle({ className, ...props }) {
|
|
75
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
76
|
+
className: (0, tailwind_variants_namespaceObject.cn)('text-lg font-medium tracking-tight', className),
|
|
77
|
+
"data-slot": "empty-title",
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function EmptyDescription({ className, ...props }) {
|
|
82
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
83
|
+
className: (0, tailwind_variants_namespaceObject.cn)('text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4', className),
|
|
84
|
+
"data-slot": "empty-description",
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function EmptyContent({ className, ...props }) {
|
|
89
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
90
|
+
className: (0, tailwind_variants_namespaceObject.cn)('flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance', className),
|
|
91
|
+
"data-slot": "empty-content",
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
exports.Empty = __webpack_exports__.Empty;
|
|
96
|
+
exports.EmptyContent = __webpack_exports__.EmptyContent;
|
|
97
|
+
exports.EmptyDescription = __webpack_exports__.EmptyDescription;
|
|
98
|
+
exports.EmptyHeader = __webpack_exports__.EmptyHeader;
|
|
99
|
+
exports.EmptyMedia = __webpack_exports__.EmptyMedia;
|
|
100
|
+
exports.EmptyTitle = __webpack_exports__.EmptyTitle;
|
|
101
|
+
exports.emptyMediaVariants = __webpack_exports__.emptyMediaVariants;
|
|
102
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
103
|
+
"Empty",
|
|
104
|
+
"EmptyContent",
|
|
105
|
+
"EmptyDescription",
|
|
106
|
+
"EmptyHeader",
|
|
107
|
+
"EmptyMedia",
|
|
108
|
+
"EmptyTitle",
|
|
109
|
+
"emptyMediaVariants"
|
|
110
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
111
|
+
Object.defineProperty(exports, '__esModule', {
|
|
112
|
+
value: true
|
|
113
|
+
});
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { VariantProps } from '@codefast/tailwind-variants';
|
|
2
|
+
import type { ComponentProps, JSX } from 'react';
|
|
3
3
|
declare const emptyMediaVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
4
4
|
variant: {
|
|
5
5
|
default: string;
|
|
6
6
|
icon: string;
|
|
7
7
|
};
|
|
8
8
|
}, Record<string, never>>;
|
|
9
|
-
type EmptyProps = ComponentProps<
|
|
9
|
+
type EmptyProps = ComponentProps<'div'>;
|
|
10
10
|
declare function Empty({ className, ...props }: EmptyProps): JSX.Element;
|
|
11
|
-
type EmptyHeaderProps = ComponentProps<
|
|
11
|
+
type EmptyHeaderProps = ComponentProps<'div'>;
|
|
12
12
|
declare function EmptyHeader({ className, ...props }: EmptyHeaderProps): JSX.Element;
|
|
13
|
-
type EmptyMediaProps = ComponentProps<
|
|
13
|
+
type EmptyMediaProps = ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>;
|
|
14
14
|
declare function EmptyMedia({ className, variant, ...props }: EmptyMediaProps): JSX.Element;
|
|
15
|
-
type EmptyTitleProps = ComponentProps<
|
|
15
|
+
type EmptyTitleProps = ComponentProps<'div'>;
|
|
16
16
|
declare function EmptyTitle({ className, ...props }: EmptyTitleProps): JSX.Element;
|
|
17
|
-
type EmptyDescriptionProps = ComponentProps<
|
|
17
|
+
type EmptyDescriptionProps = ComponentProps<'p'>;
|
|
18
18
|
declare function EmptyDescription({ className, ...props }: EmptyDescriptionProps): JSX.Element;
|
|
19
|
-
type EmptyContentProps = ComponentProps<
|
|
19
|
+
type EmptyContentProps = ComponentProps<'div'>;
|
|
20
20
|
declare function EmptyContent({ className, ...props }: EmptyContentProps): JSX.Element;
|
|
21
|
-
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, emptyMediaVariants, EmptyTitle
|
|
21
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, emptyMediaVariants, EmptyTitle };
|
|
22
22
|
export type { EmptyContentProps, EmptyDescriptionProps, EmptyHeaderProps, EmptyMediaProps, EmptyProps, EmptyTitleProps, };
|
package/dist/components/empty.js
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn, tv } from "@codefast/tailwind-variants";
|
|
3
|
+
const emptyMediaVariants = tv({
|
|
4
|
+
base: 'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
5
|
+
defaultVariants: {
|
|
6
|
+
variant: 'default'
|
|
7
|
+
},
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'bg-transparent',
|
|
11
|
+
icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-xl [&_svg:not([class*='size-'])]:size-6"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
function Empty({ className, ...props }) {
|
|
16
|
+
return /*#__PURE__*/ jsx("div", {
|
|
17
|
+
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),
|
|
18
|
+
"data-slot": "empty",
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function EmptyHeader({ className, ...props }) {
|
|
23
|
+
return /*#__PURE__*/ jsx("div", {
|
|
24
|
+
className: cn('flex max-w-sm flex-col items-center gap-2 text-center', className),
|
|
25
|
+
"data-slot": "empty-header",
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function EmptyMedia({ className, variant = 'default', ...props }) {
|
|
30
|
+
return /*#__PURE__*/ jsx("div", {
|
|
31
|
+
className: emptyMediaVariants({
|
|
32
|
+
className,
|
|
33
|
+
variant
|
|
34
|
+
}),
|
|
35
|
+
"data-slot": "empty-icon",
|
|
36
|
+
"data-variant": variant,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function EmptyTitle({ className, ...props }) {
|
|
41
|
+
return /*#__PURE__*/ jsx("div", {
|
|
42
|
+
className: cn('text-lg font-medium tracking-tight', className),
|
|
43
|
+
"data-slot": "empty-title",
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function EmptyDescription({ className, ...props }) {
|
|
48
|
+
return /*#__PURE__*/ jsx("p", {
|
|
49
|
+
className: cn('text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4', className),
|
|
50
|
+
"data-slot": "empty-description",
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function EmptyContent({ className, ...props }) {
|
|
55
|
+
return /*#__PURE__*/ jsx("div", {
|
|
56
|
+
className: cn('flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance', className),
|
|
57
|
+
"data-slot": "empty-content",
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants };
|
|
@@ -1,2 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
"use client";
|
|
2
|
-
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
FieldContent: ()=>FieldContent,
|
|
29
|
+
FieldError: ()=>FieldError,
|
|
30
|
+
FieldLabel: ()=>FieldLabel,
|
|
31
|
+
FieldDescription: ()=>FieldDescription,
|
|
32
|
+
FieldSeparator: ()=>FieldSeparator,
|
|
33
|
+
fieldVariants: ()=>fieldVariants,
|
|
34
|
+
FieldGroup: ()=>FieldGroup,
|
|
35
|
+
FieldTitle: ()=>FieldTitle,
|
|
36
|
+
FieldSet: ()=>FieldSet,
|
|
37
|
+
Field: ()=>Field,
|
|
38
|
+
FieldLegend: ()=>FieldLegend
|
|
39
|
+
});
|
|
40
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
|
+
const tailwind_variants_namespaceObject = require("@codefast/tailwind-variants");
|
|
42
|
+
const external_react_namespaceObject = require("react");
|
|
43
|
+
const external_label_cjs_namespaceObject = require("./label.cjs");
|
|
44
|
+
const external_separator_cjs_namespaceObject = require("./separator.cjs");
|
|
45
|
+
const fieldVariants = (0, tailwind_variants_namespaceObject.tv)({
|
|
46
|
+
base: 'group/field flex w-full gap-3 data-[invalid=true]:text-destructive',
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
orientation: 'vertical'
|
|
49
|
+
},
|
|
50
|
+
variants: {
|
|
51
|
+
orientation: {
|
|
52
|
+
horizontal: (0, tailwind_variants_namespaceObject.cn)('flex-row items-center', '[&>[data-slot=field-label]]:flex-auto', 'has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'),
|
|
53
|
+
responsive: (0, tailwind_variants_namespaceObject.cn)('flex-col [&>*]:w-full [&>.sr-only]:w-auto', '@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto', '@md/field-group:[&>[data-slot=field-label]]:flex-auto', '@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'),
|
|
54
|
+
vertical: 'flex-col [&>*]:w-full [&>.sr-only]:w-auto'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
function FieldSet({ className, ...props }) {
|
|
59
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("fieldset", {
|
|
60
|
+
className: (0, tailwind_variants_namespaceObject.cn)('flex flex-col gap-6', 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className),
|
|
61
|
+
"data-slot": "field-set",
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function FieldLegend({ className, variant = 'legend', ...props }) {
|
|
66
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("legend", {
|
|
67
|
+
className: (0, tailwind_variants_namespaceObject.cn)('mb-3 text-base font-medium', 'data-[variant=label]:text-sm', className),
|
|
68
|
+
"data-slot": "field-legend",
|
|
69
|
+
"data-variant": variant,
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function FieldGroup({ className, ...props }) {
|
|
74
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
75
|
+
className: (0, tailwind_variants_namespaceObject.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),
|
|
76
|
+
"data-slot": "field-group",
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function Field({ className, orientation = 'vertical', ...props }) {
|
|
81
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
82
|
+
className: fieldVariants({
|
|
83
|
+
className,
|
|
84
|
+
orientation
|
|
85
|
+
}),
|
|
86
|
+
"data-orientation": orientation,
|
|
87
|
+
"data-slot": "field",
|
|
88
|
+
role: "group",
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function FieldContent({ className, ...props }) {
|
|
93
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
94
|
+
className: (0, tailwind_variants_namespaceObject.cn)('group/field-content flex flex-1 flex-col gap-1.5 leading-snug', className),
|
|
95
|
+
"data-slot": "field-content",
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function FieldLabel({ className, ...props }) {
|
|
100
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.Label, {
|
|
101
|
+
className: (0, tailwind_variants_namespaceObject.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),
|
|
102
|
+
"data-slot": "field-label",
|
|
103
|
+
...props
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function FieldTitle({ className, ...props }) {
|
|
107
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
108
|
+
className: (0, tailwind_variants_namespaceObject.cn)('flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50', className),
|
|
109
|
+
"data-slot": "field-label",
|
|
110
|
+
...props
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function FieldDescription({ className, ...props }) {
|
|
114
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
115
|
+
className: (0, tailwind_variants_namespaceObject.cn)('text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance', 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5', '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4', className),
|
|
116
|
+
"data-slot": "field-description",
|
|
117
|
+
...props
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
121
|
+
const hasContent = Boolean(children);
|
|
122
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
123
|
+
className: (0, tailwind_variants_namespaceObject.cn)('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className),
|
|
124
|
+
"data-content": hasContent,
|
|
125
|
+
"data-slot": "field-separator",
|
|
126
|
+
...props,
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_separator_cjs_namespaceObject.Separator, {
|
|
129
|
+
className: "absolute inset-0 top-1/2"
|
|
130
|
+
}),
|
|
131
|
+
hasContent ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
132
|
+
className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
|
|
133
|
+
"data-slot": "field-separator-content",
|
|
134
|
+
children: children
|
|
135
|
+
}) : null
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function FieldError({ children, className, errors, ...props }) {
|
|
140
|
+
const fallbackContent = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
141
|
+
if (!errors?.length) return null;
|
|
142
|
+
const uniqueErrors = [
|
|
143
|
+
...new Map(errors.map((error)=>[
|
|
144
|
+
error?.message,
|
|
145
|
+
error
|
|
146
|
+
])).values()
|
|
147
|
+
];
|
|
148
|
+
if (1 === uniqueErrors.length) return uniqueErrors[0]?.message ?? null;
|
|
149
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("ul", {
|
|
150
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
151
|
+
children: uniqueErrors.map((error)=>error?.message ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("li", {
|
|
152
|
+
children: error.message
|
|
153
|
+
}, error.message) : null)
|
|
154
|
+
});
|
|
155
|
+
}, [
|
|
156
|
+
errors
|
|
157
|
+
]);
|
|
158
|
+
const content = children ?? fallbackContent;
|
|
159
|
+
if (null == content || false === content) return null;
|
|
160
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
161
|
+
className: (0, tailwind_variants_namespaceObject.cn)('text-destructive text-sm font-normal', className),
|
|
162
|
+
"data-slot": "field-error",
|
|
163
|
+
role: "alert",
|
|
164
|
+
...props,
|
|
165
|
+
children: content
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
exports.Field = __webpack_exports__.Field;
|
|
169
|
+
exports.FieldContent = __webpack_exports__.FieldContent;
|
|
170
|
+
exports.FieldDescription = __webpack_exports__.FieldDescription;
|
|
171
|
+
exports.FieldError = __webpack_exports__.FieldError;
|
|
172
|
+
exports.FieldGroup = __webpack_exports__.FieldGroup;
|
|
173
|
+
exports.FieldLabel = __webpack_exports__.FieldLabel;
|
|
174
|
+
exports.FieldLegend = __webpack_exports__.FieldLegend;
|
|
175
|
+
exports.FieldSeparator = __webpack_exports__.FieldSeparator;
|
|
176
|
+
exports.FieldSet = __webpack_exports__.FieldSet;
|
|
177
|
+
exports.FieldTitle = __webpack_exports__.FieldTitle;
|
|
178
|
+
exports.fieldVariants = __webpack_exports__.fieldVariants;
|
|
179
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
180
|
+
"Field",
|
|
181
|
+
"FieldContent",
|
|
182
|
+
"FieldDescription",
|
|
183
|
+
"FieldError",
|
|
184
|
+
"FieldGroup",
|
|
185
|
+
"FieldLabel",
|
|
186
|
+
"FieldLegend",
|
|
187
|
+
"FieldSeparator",
|
|
188
|
+
"FieldSet",
|
|
189
|
+
"FieldTitle",
|
|
190
|
+
"fieldVariants"
|
|
191
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
192
|
+
Object.defineProperty(exports, '__esModule', {
|
|
193
|
+
value: true
|
|
194
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import { Label } from
|
|
1
|
+
import type { VariantProps } from '@codefast/tailwind-variants';
|
|
2
|
+
import type { ComponentProps, JSX } from 'react';
|
|
3
|
+
import { Label } from './label';
|
|
4
4
|
declare const fieldVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
5
5
|
orientation: {
|
|
6
6
|
horizontal: string;
|
|
@@ -8,32 +8,32 @@ declare const fieldVariants: import("@codefast/tailwind-variants").VariantFuncti
|
|
|
8
8
|
vertical: string;
|
|
9
9
|
};
|
|
10
10
|
}, Record<string, never>>;
|
|
11
|
-
type FieldSetProps = ComponentProps<
|
|
11
|
+
type FieldSetProps = ComponentProps<'fieldset'>;
|
|
12
12
|
declare function FieldSet({ className, ...props }: FieldSetProps): JSX.Element;
|
|
13
|
-
type FieldLegendProps = ComponentProps<
|
|
14
|
-
variant?:
|
|
13
|
+
type FieldLegendProps = ComponentProps<'legend'> & {
|
|
14
|
+
variant?: 'label' | 'legend';
|
|
15
15
|
};
|
|
16
16
|
declare function FieldLegend({ className, variant, ...props }: FieldLegendProps): JSX.Element;
|
|
17
|
-
type FieldGroupProps = ComponentProps<
|
|
17
|
+
type FieldGroupProps = ComponentProps<'div'>;
|
|
18
18
|
declare function FieldGroup({ className, ...props }: FieldGroupProps): JSX.Element;
|
|
19
|
-
type FieldProps = ComponentProps<
|
|
19
|
+
type FieldProps = ComponentProps<'div'> & VariantProps<typeof fieldVariants>;
|
|
20
20
|
declare function Field({ className, orientation, ...props }: FieldProps): JSX.Element;
|
|
21
|
-
type FieldContentProps = ComponentProps<
|
|
21
|
+
type FieldContentProps = ComponentProps<'div'>;
|
|
22
22
|
declare function FieldContent({ className, ...props }: FieldContentProps): JSX.Element;
|
|
23
23
|
type FieldLabelProps = ComponentProps<typeof Label>;
|
|
24
24
|
declare function FieldLabel({ className, ...props }: FieldLabelProps): JSX.Element;
|
|
25
|
-
type FieldTitleProps = ComponentProps<
|
|
25
|
+
type FieldTitleProps = ComponentProps<'div'>;
|
|
26
26
|
declare function FieldTitle({ className, ...props }: FieldTitleProps): JSX.Element;
|
|
27
|
-
type FieldDescriptionProps = ComponentProps<
|
|
27
|
+
type FieldDescriptionProps = ComponentProps<'p'>;
|
|
28
28
|
declare function FieldDescription({ className, ...props }: FieldDescriptionProps): JSX.Element;
|
|
29
|
-
type FieldSeparatorProps = ComponentProps<
|
|
30
|
-
children?: ComponentProps<
|
|
29
|
+
type FieldSeparatorProps = ComponentProps<'div'> & {
|
|
30
|
+
children?: ComponentProps<'span'>['children'];
|
|
31
31
|
};
|
|
32
32
|
declare function FieldSeparator({ children, className, ...props }: FieldSeparatorProps): JSX.Element;
|
|
33
33
|
interface FieldErrorMessage {
|
|
34
34
|
message?: string;
|
|
35
35
|
}
|
|
36
|
-
interface FieldErrorProps extends ComponentProps<
|
|
36
|
+
interface FieldErrorProps extends ComponentProps<'div'> {
|
|
37
37
|
errors?: (FieldErrorMessage | undefined)[];
|
|
38
38
|
}
|
|
39
39
|
declare function FieldError({ children, className, errors, ...props }: FieldErrorProps): JSX.Element | null;
|
package/dist/components/field.js
CHANGED
|
@@ -1,2 +1,130 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn, tv } from "@codefast/tailwind-variants";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
import { Separator } from "./separator.js";
|
|
7
|
+
const fieldVariants = tv({
|
|
8
|
+
base: 'group/field flex w-full gap-3 data-[invalid=true]:text-destructive',
|
|
9
|
+
defaultVariants: {
|
|
10
|
+
orientation: 'vertical'
|
|
11
|
+
},
|
|
12
|
+
variants: {
|
|
13
|
+
orientation: {
|
|
14
|
+
horizontal: cn('flex-row items-center', '[&>[data-slot=field-label]]:flex-auto', 'has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'),
|
|
15
|
+
responsive: cn('flex-col [&>*]:w-full [&>.sr-only]:w-auto', '@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto', '@md/field-group:[&>[data-slot=field-label]]:flex-auto', '@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'),
|
|
16
|
+
vertical: 'flex-col [&>*]:w-full [&>.sr-only]:w-auto'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
function FieldSet({ className, ...props }) {
|
|
21
|
+
return /*#__PURE__*/ jsx("fieldset", {
|
|
22
|
+
className: cn('flex flex-col gap-6', 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className),
|
|
23
|
+
"data-slot": "field-set",
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function FieldLegend({ className, variant = 'legend', ...props }) {
|
|
28
|
+
return /*#__PURE__*/ jsx("legend", {
|
|
29
|
+
className: cn('mb-3 text-base font-medium', 'data-[variant=label]:text-sm', className),
|
|
30
|
+
"data-slot": "field-legend",
|
|
31
|
+
"data-variant": variant,
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function FieldGroup({ className, ...props }) {
|
|
36
|
+
return /*#__PURE__*/ jsx("div", {
|
|
37
|
+
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),
|
|
38
|
+
"data-slot": "field-group",
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function Field({ className, orientation = 'vertical', ...props }) {
|
|
43
|
+
return /*#__PURE__*/ jsx("div", {
|
|
44
|
+
className: fieldVariants({
|
|
45
|
+
className,
|
|
46
|
+
orientation
|
|
47
|
+
}),
|
|
48
|
+
"data-orientation": orientation,
|
|
49
|
+
"data-slot": "field",
|
|
50
|
+
role: "group",
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function FieldContent({ className, ...props }) {
|
|
55
|
+
return /*#__PURE__*/ jsx("div", {
|
|
56
|
+
className: cn('group/field-content flex flex-1 flex-col gap-1.5 leading-snug', className),
|
|
57
|
+
"data-slot": "field-content",
|
|
58
|
+
...props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function FieldLabel({ className, ...props }) {
|
|
62
|
+
return /*#__PURE__*/ jsx(Label, {
|
|
63
|
+
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),
|
|
64
|
+
"data-slot": "field-label",
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function FieldTitle({ className, ...props }) {
|
|
69
|
+
return /*#__PURE__*/ jsx("div", {
|
|
70
|
+
className: cn('flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50', className),
|
|
71
|
+
"data-slot": "field-label",
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function FieldDescription({ className, ...props }) {
|
|
76
|
+
return /*#__PURE__*/ jsx("p", {
|
|
77
|
+
className: cn('text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance', 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5', '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4', className),
|
|
78
|
+
"data-slot": "field-description",
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
83
|
+
const hasContent = Boolean(children);
|
|
84
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
85
|
+
className: cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className),
|
|
86
|
+
"data-content": hasContent,
|
|
87
|
+
"data-slot": "field-separator",
|
|
88
|
+
...props,
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ jsx(Separator, {
|
|
91
|
+
className: "absolute inset-0 top-1/2"
|
|
92
|
+
}),
|
|
93
|
+
hasContent ? /*#__PURE__*/ jsx("span", {
|
|
94
|
+
className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
|
|
95
|
+
"data-slot": "field-separator-content",
|
|
96
|
+
children: children
|
|
97
|
+
}) : null
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function FieldError({ children, className, errors, ...props }) {
|
|
102
|
+
const fallbackContent = useMemo(()=>{
|
|
103
|
+
if (!errors?.length) return null;
|
|
104
|
+
const uniqueErrors = [
|
|
105
|
+
...new Map(errors.map((error)=>[
|
|
106
|
+
error?.message,
|
|
107
|
+
error
|
|
108
|
+
])).values()
|
|
109
|
+
];
|
|
110
|
+
if (1 === uniqueErrors.length) return uniqueErrors[0]?.message ?? null;
|
|
111
|
+
return /*#__PURE__*/ jsx("ul", {
|
|
112
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
113
|
+
children: uniqueErrors.map((error)=>error?.message ? /*#__PURE__*/ jsx("li", {
|
|
114
|
+
children: error.message
|
|
115
|
+
}, error.message) : null)
|
|
116
|
+
});
|
|
117
|
+
}, [
|
|
118
|
+
errors
|
|
119
|
+
]);
|
|
120
|
+
const content = children ?? fallbackContent;
|
|
121
|
+
if (null == content || false === content) return null;
|
|
122
|
+
return /*#__PURE__*/ jsx("div", {
|
|
123
|
+
className: cn('text-destructive text-sm font-normal', className),
|
|
124
|
+
"data-slot": "field-error",
|
|
125
|
+
role: "alert",
|
|
126
|
+
...props,
|
|
127
|
+
children: content
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, fieldVariants };
|