@codefast/ui 0.3.15 → 0.3.16-canary.0
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 +7 -0
- package/dist/components/accordion.d.mts +30 -0
- package/dist/components/accordion.mjs +15 -0
- package/dist/components/alert-dialog.d.mts +60 -0
- package/dist/components/alert-dialog.mjs +30 -0
- package/dist/components/alert.d.mts +21 -0
- package/dist/components/alert.mjs +12 -0
- package/dist/components/aspect-ratio.d.mts +6 -0
- package/dist/components/aspect-ratio.mjs +3 -0
- package/dist/components/avatar.d.mts +18 -0
- package/dist/components/avatar.mjs +9 -0
- package/dist/components/badge.d.mts +9 -0
- package/dist/components/badge.mjs +6 -0
- package/dist/components/breadcrumb.d.mts +42 -0
- package/dist/components/breadcrumb.mjs +21 -0
- package/dist/components/button-group.d.mts +21 -0
- package/dist/components/button-group.mjs +12 -0
- package/dist/components/button.d.mts +9 -0
- package/dist/components/button.mjs +6 -0
- package/dist/components/calendar.d.mts +12 -0
- package/dist/components/calendar.mjs +6 -0
- package/dist/components/card.d.mts +42 -0
- package/dist/components/card.mjs +21 -0
- package/dist/components/carousel.d.mts +33 -0
- package/dist/components/carousel.mjs +15 -0
- package/dist/components/chart.d.mts +39 -0
- package/dist/components/chart.mjs +18 -0
- package/dist/components/checkbox-cards.d.mts +12 -0
- package/dist/components/checkbox-cards.mjs +6 -0
- package/dist/components/checkbox-group.d.mts +12 -0
- package/dist/components/checkbox-group.mjs +6 -0
- package/dist/components/checkbox.d.mts +6 -0
- package/dist/components/checkbox.mjs +3 -0
- package/dist/components/collapsible.d.mts +18 -0
- package/dist/components/collapsible.mjs +9 -0
- package/dist/components/command.d.mts +60 -0
- package/dist/components/command.mjs +30 -0
- package/dist/components/context-menu.d.mts +90 -0
- package/dist/components/context-menu.mjs +45 -0
- package/dist/components/dialog.d.mts +54 -0
- package/dist/components/dialog.mjs +27 -0
- package/dist/components/drawer.d.mts +54 -0
- package/dist/components/drawer.mjs +27 -0
- package/dist/components/dropdown-menu.d.mts +90 -0
- package/dist/components/dropdown-menu.mjs +45 -0
- package/dist/components/empty.d.mts +39 -0
- package/dist/components/empty.mjs +21 -0
- package/dist/components/field.d.mts +63 -0
- package/dist/components/field.mjs +33 -0
- package/dist/components/form.d.mts +42 -0
- package/dist/components/form.mjs +21 -0
- package/dist/components/hover-card.d.mts +24 -0
- package/dist/components/hover-card.mjs +12 -0
- package/dist/components/input-group.d.mts +45 -0
- package/dist/components/input-group.mjs +27 -0
- package/dist/components/input-number.d.mts +6 -0
- package/dist/components/input-number.mjs +3 -0
- package/dist/components/input-otp.d.mts +24 -0
- package/dist/components/input-otp.mjs +12 -0
- package/dist/components/input-password.d.mts +6 -0
- package/dist/components/input-password.mjs +3 -0
- package/dist/components/input-search.d.mts +6 -0
- package/dist/components/input-search.mjs +3 -0
- package/dist/components/input.d.mts +6 -0
- package/dist/components/input.mjs +3 -0
- package/dist/components/item.d.mts +66 -0
- package/dist/components/item.mjs +36 -0
- package/dist/components/kbd.d.mts +12 -0
- package/dist/components/kbd.mjs +6 -0
- package/dist/components/label.d.mts +6 -0
- package/dist/components/label.mjs +3 -0
- package/dist/components/menubar.d.mts +96 -0
- package/dist/components/menubar.mjs +48 -0
- package/dist/components/native-select.d.mts +18 -0
- package/dist/components/native-select.mjs +9 -0
- package/dist/components/navigation-menu.d.mts +39 -0
- package/dist/components/navigation-menu.mjs +21 -0
- package/dist/components/pagination.d.mts +42 -0
- package/dist/components/pagination.mjs +21 -0
- package/dist/components/popover.d.mts +30 -0
- package/dist/components/popover.mjs +15 -0
- package/dist/components/progress-circle.d.mts +9 -0
- package/dist/components/progress-circle.mjs +6 -0
- package/dist/components/progress.d.mts +6 -0
- package/dist/components/progress.mjs +3 -0
- package/dist/components/radio-cards.d.mts +12 -0
- package/dist/components/radio-cards.mjs +6 -0
- package/dist/components/radio-group.d.mts +12 -0
- package/dist/components/radio-group.mjs +6 -0
- package/dist/components/radio.d.mts +6 -0
- package/dist/components/radio.mjs +3 -0
- package/dist/components/resizable.d.mts +18 -0
- package/dist/components/resizable.mjs +9 -0
- package/dist/components/scroll-area.d.mts +15 -0
- package/dist/components/scroll-area.mjs +9 -0
- package/dist/components/select.d.mts +60 -0
- package/dist/components/select.mjs +30 -0
- package/dist/components/separator.d.mts +15 -0
- package/dist/components/separator.mjs +9 -0
- package/dist/components/sheet.d.mts +57 -0
- package/dist/components/sheet.mjs +30 -0
- package/dist/components/sidebar.d.mts +141 -0
- package/dist/components/sidebar.mjs +72 -0
- package/dist/components/skeleton.d.mts +6 -0
- package/dist/components/skeleton.mjs +3 -0
- package/dist/components/slider.d.mts +6 -0
- package/dist/components/slider.mjs +3 -0
- package/dist/components/sonner.d.mts +6 -0
- package/dist/components/sonner.mjs +3 -0
- package/dist/components/spinner.d.mts +6 -0
- package/dist/components/spinner.mjs +3 -0
- package/dist/components/switch.d.mts +6 -0
- package/dist/components/switch.mjs +3 -0
- package/dist/components/table.d.mts +48 -0
- package/dist/components/table.mjs +24 -0
- package/dist/components/tabs.d.mts +24 -0
- package/dist/components/tabs.mjs +12 -0
- package/dist/components/textarea.d.mts +6 -0
- package/dist/components/textarea.mjs +3 -0
- package/dist/components/toggle-group.d.mts +12 -0
- package/dist/components/toggle-group.mjs +6 -0
- package/dist/components/toggle.d.mts +12 -0
- package/dist/components/toggle.mjs +6 -0
- package/dist/components/tooltip.d.mts +30 -0
- package/dist/components/tooltip.mjs +15 -0
- package/dist/hooks/use-animated-value.d.mts +2 -0
- package/dist/hooks/use-animated-value.mjs +5 -3
- package/dist/hooks/use-copy-to-clipboard.d.mts +2 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +5 -3
- package/dist/hooks/use-is-mobile.d.mts +2 -0
- package/dist/hooks/use-is-mobile.mjs +5 -3
- package/dist/hooks/use-media-query.d.mts +2 -0
- package/dist/hooks/use-media-query.mjs +5 -3
- package/dist/hooks/use-mutation-observer.d.mts +2 -0
- package/dist/hooks/use-mutation-observer.mjs +5 -3
- package/dist/hooks/use-pagination.d.mts +7 -0
- package/dist/hooks/use-pagination.mjs +7 -3
- package/dist/primitives/checkbox-group.d.mts +12 -0
- package/dist/primitives/checkbox-group.mjs +6 -0
- package/dist/primitives/input-number.d.mts +22 -0
- package/dist/primitives/input-number.mjs +12 -0
- package/dist/primitives/input.d.mts +10 -0
- package/dist/primitives/input.mjs +6 -0
- package/dist/primitives/progress-circle.d.mts +30 -0
- package/dist/primitives/progress-circle.mjs +19 -7
- package/package.json +4 -4
|
@@ -4,36 +4,54 @@ import { CheckIcon, ChevronRightIcon, DotIcon } from "lucide-react";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
6
6
|
//#region src/components/dropdown-menu.tsx
|
|
7
|
+
/**
|
|
8
|
+
* @since 0.3.16-canary.0
|
|
9
|
+
*/
|
|
7
10
|
function DropdownMenu({ ...props }) {
|
|
8
11
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, {
|
|
9
12
|
"data-slot": "dropdown-menu",
|
|
10
13
|
...props
|
|
11
14
|
});
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
13
19
|
function DropdownMenuTrigger({ ...props }) {
|
|
14
20
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, {
|
|
15
21
|
"data-slot": "dropdown-menu-trigger",
|
|
16
22
|
...props
|
|
17
23
|
});
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @since 0.3.16-canary.0
|
|
27
|
+
*/
|
|
19
28
|
function DropdownMenuGroup({ ...props }) {
|
|
20
29
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, {
|
|
21
30
|
"data-slot": "dropdown-menu-group",
|
|
22
31
|
...props
|
|
23
32
|
});
|
|
24
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
25
37
|
function DropdownMenuSub({ ...props }) {
|
|
26
38
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, {
|
|
27
39
|
"data-slot": "dropdown-menu-sub",
|
|
28
40
|
...props
|
|
29
41
|
});
|
|
30
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.3.16-canary.0
|
|
45
|
+
*/
|
|
31
46
|
function DropdownMenuRadioGroup({ ...props }) {
|
|
32
47
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioGroup, {
|
|
33
48
|
"data-slot": "dropdown-menu-radio-group",
|
|
34
49
|
...props
|
|
35
50
|
});
|
|
36
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* @since 0.3.16-canary.0
|
|
54
|
+
*/
|
|
37
55
|
function DropdownMenuSubTrigger({ children, className, inset, ...props }) {
|
|
38
56
|
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
39
57
|
className: cn("flex items-center gap-x-2", "px-2 py-1.5", "rounded-sm outline-hidden", "text-sm", "cursor-default select-none", "focus:bg-accent focus:text-accent-foreground", "data-inset:pl-8", "data-open:bg-accent data-open:text-accent-foreground", className),
|
|
@@ -43,6 +61,9 @@ function DropdownMenuSubTrigger({ children, className, inset, ...props }) {
|
|
|
43
61
|
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("size-4", "ml-auto") })]
|
|
44
62
|
});
|
|
45
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* @since 0.3.16-canary.0
|
|
66
|
+
*/
|
|
46
67
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
47
68
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
48
69
|
"data-slot": "dropdown-menu-portal",
|
|
@@ -53,6 +74,9 @@ function DropdownMenuSubContent({ className, ...props }) {
|
|
|
53
74
|
})
|
|
54
75
|
});
|
|
55
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* @since 0.3.16-canary.0
|
|
79
|
+
*/
|
|
56
80
|
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
57
81
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
58
82
|
"data-slot": "dropdown-menu-portal",
|
|
@@ -64,6 +88,9 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
|
64
88
|
})
|
|
65
89
|
});
|
|
66
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @since 0.3.16-canary.0
|
|
93
|
+
*/
|
|
67
94
|
function DropdownMenuItem({ className, inset, variant, ...props }) {
|
|
68
95
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
69
96
|
className: cn("group/dropdown-menu-item relative flex items-center gap-x-2", "px-2 py-1.5", "rounded-sm outline-hidden", "text-sm", "cursor-default select-none", "focus:bg-accent focus:text-accent-foreground", "aria-disabled:opacity-50", "data-inset:pl-8", "data-[variant=destructive]:text-destructive", "data-[variant=destructive]:focus:bg-destructive/10", "dark:data-[variant=destructive]:focus:bg-destructive/20", "data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80", "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "[&_svg:not([class*='text-'])]:text-muted-foreground", className),
|
|
@@ -73,6 +100,9 @@ function DropdownMenuItem({ className, inset, variant, ...props }) {
|
|
|
73
100
|
...props
|
|
74
101
|
});
|
|
75
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* @since 0.3.16-canary.0
|
|
105
|
+
*/
|
|
76
106
|
function DropdownMenuCheckboxItem({ checked, children, className, ...props }) {
|
|
77
107
|
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
78
108
|
checked,
|
|
@@ -85,6 +115,9 @@ function DropdownMenuCheckboxItem({ checked, children, className, ...props }) {
|
|
|
85
115
|
}), children]
|
|
86
116
|
});
|
|
87
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* @since 0.3.16-canary.0
|
|
120
|
+
*/
|
|
88
121
|
function DropdownMenuRadioItem({ children, className, ...props }) {
|
|
89
122
|
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
90
123
|
className: cn("group/dropdown-menu-item relative flex items-center gap-x-2", "py-1.5 pr-2 pl-8", "rounded-sm outline-hidden", "text-sm", "cursor-default select-none", "focus:bg-accent focus:text-accent-foreground", "aria-disabled:opacity-50", "[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
@@ -96,6 +129,9 @@ function DropdownMenuRadioItem({ children, className, ...props }) {
|
|
|
96
129
|
}), children]
|
|
97
130
|
});
|
|
98
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* @since 0.3.16-canary.0
|
|
134
|
+
*/
|
|
99
135
|
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
100
136
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
101
137
|
className: cn("flex items-center gap-x-2", "px-2 py-1.5", "text-sm font-semibold", "data-inset:pl-8", className),
|
|
@@ -104,6 +140,9 @@ function DropdownMenuLabel({ className, inset, ...props }) {
|
|
|
104
140
|
...props
|
|
105
141
|
});
|
|
106
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* @since 0.3.16-canary.0
|
|
145
|
+
*/
|
|
107
146
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
108
147
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
109
148
|
className: cn("mx-2 my-1 h-px", "bg-border", className),
|
|
@@ -111,6 +150,9 @@ function DropdownMenuSeparator({ className, ...props }) {
|
|
|
111
150
|
...props
|
|
112
151
|
});
|
|
113
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* @since 0.3.16-canary.0
|
|
155
|
+
*/
|
|
114
156
|
function DropdownMenuShortcut({ className, ...props }) {
|
|
115
157
|
return /* @__PURE__ */ jsx("span", {
|
|
116
158
|
className: cn("ml-auto", "text-xs tracking-widest text-muted-foreground", "group-data-[variant=destructive]/dropdown-menu-item:text-destructive/80", className),
|
|
@@ -118,6 +160,9 @@ function DropdownMenuShortcut({ className, ...props }) {
|
|
|
118
160
|
...props
|
|
119
161
|
});
|
|
120
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* @since 0.3.16-canary.0
|
|
165
|
+
*/
|
|
121
166
|
function DropdownMenuArrow({ className, ...props }) {
|
|
122
167
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Arrow, {
|
|
123
168
|
className: cn("fill-popover", className),
|
|
@@ -3,39 +3,78 @@ import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
|
3
3
|
import { ComponentProps, JSX } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/empty.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* @since 0.3.16-canary.0
|
|
8
|
+
*/
|
|
6
9
|
declare const emptyMediaVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
|
|
7
10
|
variant: {
|
|
8
11
|
default: string;
|
|
9
12
|
icon: string[];
|
|
10
13
|
};
|
|
11
14
|
}, Record<string, never>>;
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
12
18
|
type EmptyProps = ComponentProps<"div">;
|
|
19
|
+
/**
|
|
20
|
+
* @since 0.3.16-canary.0
|
|
21
|
+
*/
|
|
13
22
|
declare function Empty({
|
|
14
23
|
className,
|
|
15
24
|
...props
|
|
16
25
|
}: EmptyProps): JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* @since 0.3.16-canary.0
|
|
28
|
+
*/
|
|
17
29
|
type EmptyHeaderProps = ComponentProps<"div">;
|
|
30
|
+
/**
|
|
31
|
+
* @since 0.3.16-canary.0
|
|
32
|
+
*/
|
|
18
33
|
declare function EmptyHeader({
|
|
19
34
|
className,
|
|
20
35
|
...props
|
|
21
36
|
}: EmptyHeaderProps): JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* @since 0.3.16-canary.0
|
|
39
|
+
*/
|
|
22
40
|
type EmptyMediaProps = ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>;
|
|
41
|
+
/**
|
|
42
|
+
* @since 0.3.16-canary.0
|
|
43
|
+
*/
|
|
23
44
|
declare function EmptyMedia({
|
|
24
45
|
className,
|
|
25
46
|
variant,
|
|
26
47
|
...props
|
|
27
48
|
}: EmptyMediaProps): JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* @since 0.3.16-canary.0
|
|
51
|
+
*/
|
|
28
52
|
type EmptyTitleProps = ComponentProps<"div">;
|
|
53
|
+
/**
|
|
54
|
+
* @since 0.3.16-canary.0
|
|
55
|
+
*/
|
|
29
56
|
declare function EmptyTitle({
|
|
30
57
|
className,
|
|
31
58
|
...props
|
|
32
59
|
}: EmptyTitleProps): JSX.Element;
|
|
60
|
+
/**
|
|
61
|
+
* @since 0.3.16-canary.0
|
|
62
|
+
*/
|
|
33
63
|
type EmptyDescriptionProps = ComponentProps<"p">;
|
|
64
|
+
/**
|
|
65
|
+
* @since 0.3.16-canary.0
|
|
66
|
+
*/
|
|
34
67
|
declare function EmptyDescription({
|
|
35
68
|
className,
|
|
36
69
|
...props
|
|
37
70
|
}: EmptyDescriptionProps): JSX.Element;
|
|
71
|
+
/**
|
|
72
|
+
* @since 0.3.16-canary.0
|
|
73
|
+
*/
|
|
38
74
|
type EmptyContentProps = ComponentProps<"div">;
|
|
75
|
+
/**
|
|
76
|
+
* @since 0.3.16-canary.0
|
|
77
|
+
*/
|
|
39
78
|
declare function EmptyContent({
|
|
40
79
|
className,
|
|
41
80
|
...props
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { cn, tv } from "../lib/utils.mjs";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/empty.tsx
|
|
4
|
+
/**
|
|
5
|
+
* @since 0.3.16-canary.0
|
|
6
|
+
*/
|
|
4
7
|
const emptyMediaVariants = tv({
|
|
5
8
|
base: ["mb-2 flex shrink-0 items-center justify-center", "[&_svg]:pointer-events-none [&_svg]:shrink-0"],
|
|
6
9
|
defaultVariants: { variant: "default" },
|
|
@@ -14,6 +17,9 @@ const emptyMediaVariants = tv({
|
|
|
14
17
|
]
|
|
15
18
|
} }
|
|
16
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
17
23
|
function Empty({ className, ...props }) {
|
|
18
24
|
return /* @__PURE__ */ jsx("div", {
|
|
19
25
|
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),
|
|
@@ -21,6 +27,9 @@ function Empty({ className, ...props }) {
|
|
|
21
27
|
...props
|
|
22
28
|
});
|
|
23
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @since 0.3.16-canary.0
|
|
32
|
+
*/
|
|
24
33
|
function EmptyHeader({ className, ...props }) {
|
|
25
34
|
return /* @__PURE__ */ jsx("div", {
|
|
26
35
|
className: cn("flex max-w-sm flex-col items-center gap-2", "text-center", className),
|
|
@@ -28,6 +37,9 @@ function EmptyHeader({ className, ...props }) {
|
|
|
28
37
|
...props
|
|
29
38
|
});
|
|
30
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @since 0.3.16-canary.0
|
|
42
|
+
*/
|
|
31
43
|
function EmptyMedia({ className, variant = "default", ...props }) {
|
|
32
44
|
return /* @__PURE__ */ jsx("div", {
|
|
33
45
|
className: emptyMediaVariants({
|
|
@@ -39,6 +51,9 @@ function EmptyMedia({ className, variant = "default", ...props }) {
|
|
|
39
51
|
...props
|
|
40
52
|
});
|
|
41
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @since 0.3.16-canary.0
|
|
56
|
+
*/
|
|
42
57
|
function EmptyTitle({ className, ...props }) {
|
|
43
58
|
return /* @__PURE__ */ jsx("div", {
|
|
44
59
|
className: cn("text-lg font-medium tracking-tight", className),
|
|
@@ -46,6 +61,9 @@ function EmptyTitle({ className, ...props }) {
|
|
|
46
61
|
...props
|
|
47
62
|
});
|
|
48
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* @since 0.3.16-canary.0
|
|
66
|
+
*/
|
|
49
67
|
function EmptyDescription({ className, ...props }) {
|
|
50
68
|
return /* @__PURE__ */ jsx("p", {
|
|
51
69
|
className: cn("text-sm/relaxed text-muted-foreground", "[&>a]:underline [&>a]:underline-offset-4", "[&>a:hover]:text-primary", className),
|
|
@@ -53,6 +71,9 @@ function EmptyDescription({ className, ...props }) {
|
|
|
53
71
|
...props
|
|
54
72
|
});
|
|
55
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @since 0.3.16-canary.0
|
|
76
|
+
*/
|
|
56
77
|
function EmptyContent({ className, ...props }) {
|
|
57
78
|
return /* @__PURE__ */ jsx("div", {
|
|
58
79
|
className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4", "text-sm text-balance", className),
|
|
@@ -4,6 +4,9 @@ import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
|
4
4
|
import { ComponentProps, JSX } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/field.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* @since 0.3.16-canary.0
|
|
9
|
+
*/
|
|
7
10
|
declare const fieldVariants: _$_codefast_tailwind_variants0.VariantFunctionType<{
|
|
8
11
|
orientation: {
|
|
9
12
|
horizontal: string[];
|
|
@@ -11,53 +14,107 @@ declare const fieldVariants: _$_codefast_tailwind_variants0.VariantFunctionType<
|
|
|
11
14
|
vertical: string[];
|
|
12
15
|
};
|
|
13
16
|
}, Record<string, never>>;
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
14
20
|
type FieldSetProps = ComponentProps<"fieldset">;
|
|
21
|
+
/**
|
|
22
|
+
* @since 0.3.16-canary.0
|
|
23
|
+
*/
|
|
15
24
|
declare function FieldSet({
|
|
16
25
|
className,
|
|
17
26
|
...props
|
|
18
27
|
}: FieldSetProps): JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* @since 0.3.16-canary.0
|
|
30
|
+
*/
|
|
19
31
|
type FieldLegendProps = ComponentProps<"legend"> & {
|
|
20
32
|
variant?: "label" | "legend";
|
|
21
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
22
37
|
declare function FieldLegend({
|
|
23
38
|
className,
|
|
24
39
|
variant,
|
|
25
40
|
...props
|
|
26
41
|
}: FieldLegendProps): JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* @since 0.3.16-canary.0
|
|
44
|
+
*/
|
|
27
45
|
type FieldGroupProps = ComponentProps<"div">;
|
|
46
|
+
/**
|
|
47
|
+
* @since 0.3.16-canary.0
|
|
48
|
+
*/
|
|
28
49
|
declare function FieldGroup({
|
|
29
50
|
className,
|
|
30
51
|
...props
|
|
31
52
|
}: FieldGroupProps): JSX.Element;
|
|
53
|
+
/**
|
|
54
|
+
* @since 0.3.16-canary.0
|
|
55
|
+
*/
|
|
32
56
|
type FieldProps = ComponentProps<"div"> & VariantProps<typeof fieldVariants>;
|
|
57
|
+
/**
|
|
58
|
+
* @since 0.3.16-canary.0
|
|
59
|
+
*/
|
|
33
60
|
declare function Field({
|
|
34
61
|
className,
|
|
35
62
|
orientation,
|
|
36
63
|
...props
|
|
37
64
|
}: FieldProps): JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* @since 0.3.16-canary.0
|
|
67
|
+
*/
|
|
38
68
|
type FieldContentProps = ComponentProps<"div">;
|
|
69
|
+
/**
|
|
70
|
+
* @since 0.3.16-canary.0
|
|
71
|
+
*/
|
|
39
72
|
declare function FieldContent({
|
|
40
73
|
className,
|
|
41
74
|
...props
|
|
42
75
|
}: FieldContentProps): JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* @since 0.3.16-canary.0
|
|
78
|
+
*/
|
|
43
79
|
type FieldLabelProps = ComponentProps<typeof Label>;
|
|
80
|
+
/**
|
|
81
|
+
* @since 0.3.16-canary.0
|
|
82
|
+
*/
|
|
44
83
|
declare function FieldLabel({
|
|
45
84
|
className,
|
|
46
85
|
...props
|
|
47
86
|
}: FieldLabelProps): JSX.Element;
|
|
87
|
+
/**
|
|
88
|
+
* @since 0.3.16-canary.0
|
|
89
|
+
*/
|
|
48
90
|
type FieldTitleProps = ComponentProps<"div">;
|
|
91
|
+
/**
|
|
92
|
+
* @since 0.3.16-canary.0
|
|
93
|
+
*/
|
|
49
94
|
declare function FieldTitle({
|
|
50
95
|
className,
|
|
51
96
|
...props
|
|
52
97
|
}: FieldTitleProps): JSX.Element;
|
|
98
|
+
/**
|
|
99
|
+
* @since 0.3.16-canary.0
|
|
100
|
+
*/
|
|
53
101
|
type FieldDescriptionProps = ComponentProps<"p">;
|
|
102
|
+
/**
|
|
103
|
+
* @since 0.3.16-canary.0
|
|
104
|
+
*/
|
|
54
105
|
declare function FieldDescription({
|
|
55
106
|
className,
|
|
56
107
|
...props
|
|
57
108
|
}: FieldDescriptionProps): JSX.Element;
|
|
109
|
+
/**
|
|
110
|
+
* @since 0.3.16-canary.0
|
|
111
|
+
*/
|
|
58
112
|
type FieldSeparatorProps = ComponentProps<"div"> & {
|
|
59
113
|
children?: ComponentProps<"span">["children"];
|
|
60
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* @since 0.3.16-canary.0
|
|
117
|
+
*/
|
|
61
118
|
declare function FieldSeparator({
|
|
62
119
|
children,
|
|
63
120
|
className,
|
|
@@ -66,9 +123,15 @@ declare function FieldSeparator({
|
|
|
66
123
|
interface FieldErrorMessage {
|
|
67
124
|
message?: string;
|
|
68
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* @since 0.3.16-canary.0
|
|
128
|
+
*/
|
|
69
129
|
interface FieldErrorProps extends ComponentProps<"div"> {
|
|
70
130
|
errors?: (FieldErrorMessage | undefined)[];
|
|
71
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* @since 0.3.16-canary.0
|
|
134
|
+
*/
|
|
72
135
|
declare function FieldError({
|
|
73
136
|
children,
|
|
74
137
|
className,
|
|
@@ -5,6 +5,9 @@ import { Label } from "./label.mjs";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
//#region src/components/field.tsx
|
|
8
|
+
/**
|
|
9
|
+
* @since 0.3.16-canary.0
|
|
10
|
+
*/
|
|
8
11
|
const fieldVariants = tv({
|
|
9
12
|
base: ["group/field flex w-full gap-3", "data-[invalid=true]:text-destructive"],
|
|
10
13
|
defaultVariants: { orientation: "vertical" },
|
|
@@ -32,6 +35,9 @@ const fieldVariants = tv({
|
|
|
32
35
|
]
|
|
33
36
|
} }
|
|
34
37
|
});
|
|
38
|
+
/**
|
|
39
|
+
* @since 0.3.16-canary.0
|
|
40
|
+
*/
|
|
35
41
|
function FieldSet({ className, ...props }) {
|
|
36
42
|
return /* @__PURE__ */ jsx("fieldset", {
|
|
37
43
|
className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3", "has-[>[data-slot=radio-group]]:gap-3", className),
|
|
@@ -39,6 +45,9 @@ function FieldSet({ className, ...props }) {
|
|
|
39
45
|
...props
|
|
40
46
|
});
|
|
41
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @since 0.3.16-canary.0
|
|
50
|
+
*/
|
|
42
51
|
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
43
52
|
return /* @__PURE__ */ jsx("legend", {
|
|
44
53
|
className: cn("mb-3", "text-base font-medium", "data-[variant=label]:text-sm", className),
|
|
@@ -47,6 +56,9 @@ function FieldLegend({ className, variant = "legend", ...props }) {
|
|
|
47
56
|
...props
|
|
48
57
|
});
|
|
49
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* @since 0.3.16-canary.0
|
|
61
|
+
*/
|
|
50
62
|
function FieldGroup({ className, ...props }) {
|
|
51
63
|
return /* @__PURE__ */ jsx("div", {
|
|
52
64
|
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),
|
|
@@ -54,6 +66,9 @@ function FieldGroup({ className, ...props }) {
|
|
|
54
66
|
...props
|
|
55
67
|
});
|
|
56
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* @since 0.3.16-canary.0
|
|
71
|
+
*/
|
|
57
72
|
function Field({ className, orientation = "vertical", ...props }) {
|
|
58
73
|
return /* @__PURE__ */ jsx("div", {
|
|
59
74
|
className: fieldVariants({
|
|
@@ -66,6 +81,9 @@ function Field({ className, orientation = "vertical", ...props }) {
|
|
|
66
81
|
...props
|
|
67
82
|
});
|
|
68
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @since 0.3.16-canary.0
|
|
86
|
+
*/
|
|
69
87
|
function FieldContent({ className, ...props }) {
|
|
70
88
|
return /* @__PURE__ */ jsx("div", {
|
|
71
89
|
className: cn("group/field-content flex flex-1 flex-col gap-1.5", "leading-snug", className),
|
|
@@ -73,6 +91,9 @@ function FieldContent({ className, ...props }) {
|
|
|
73
91
|
...props
|
|
74
92
|
});
|
|
75
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* @since 0.3.16-canary.0
|
|
96
|
+
*/
|
|
76
97
|
function FieldLabel({ className, ...props }) {
|
|
77
98
|
return /* @__PURE__ */ jsx(Label, {
|
|
78
99
|
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),
|
|
@@ -80,6 +101,9 @@ function FieldLabel({ className, ...props }) {
|
|
|
80
101
|
...props
|
|
81
102
|
});
|
|
82
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @since 0.3.16-canary.0
|
|
106
|
+
*/
|
|
83
107
|
function FieldTitle({ className, ...props }) {
|
|
84
108
|
return /* @__PURE__ */ jsx("div", {
|
|
85
109
|
className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium", "group-data-disabled/field:opacity-50", className),
|
|
@@ -87,6 +111,9 @@ function FieldTitle({ className, ...props }) {
|
|
|
87
111
|
...props
|
|
88
112
|
});
|
|
89
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* @since 0.3.16-canary.0
|
|
116
|
+
*/
|
|
90
117
|
function FieldDescription({ className, ...props }) {
|
|
91
118
|
return /* @__PURE__ */ jsx("p", {
|
|
92
119
|
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),
|
|
@@ -94,6 +121,9 @@ function FieldDescription({ className, ...props }) {
|
|
|
94
121
|
...props
|
|
95
122
|
});
|
|
96
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* @since 0.3.16-canary.0
|
|
126
|
+
*/
|
|
97
127
|
function FieldSeparator({ children, className, ...props }) {
|
|
98
128
|
const hasContent = Boolean(children);
|
|
99
129
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -108,6 +138,9 @@ function FieldSeparator({ children, className, ...props }) {
|
|
|
108
138
|
}) : null]
|
|
109
139
|
});
|
|
110
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* @since 0.3.16-canary.0
|
|
143
|
+
*/
|
|
111
144
|
function FieldError({ children, className, errors, ...props }) {
|
|
112
145
|
const fallbackContent = useMemo(() => {
|
|
113
146
|
if (!errors?.length) return null;
|
|
@@ -7,37 +7,79 @@ import * as _$react_hook_form0 from "react-hook-form";
|
|
|
7
7
|
import { ControllerProps, FieldPath, FieldValues, FormProvider } from "react-hook-form";
|
|
8
8
|
|
|
9
9
|
//#region src/components/form.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* @since 0.3.16-canary.0
|
|
12
|
+
*/
|
|
10
13
|
type FormProps = ComponentProps<typeof FormProvider>;
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.3.16-canary.0
|
|
16
|
+
*/
|
|
11
17
|
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: _$react_hook_form0.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
12
18
|
type ScopedProps<P> = P & {
|
|
13
19
|
__scopeFormField?: Scope;
|
|
14
20
|
};
|
|
15
21
|
declare const createFormFieldScope: _$_radix_ui_react_context0.CreateScope;
|
|
22
|
+
/**
|
|
23
|
+
* @since 0.3.16-canary.0
|
|
24
|
+
*/
|
|
16
25
|
type FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ControllerProps<TFieldValues, TName>;
|
|
26
|
+
/**
|
|
27
|
+
* @since 0.3.16-canary.0
|
|
28
|
+
*/
|
|
17
29
|
declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(formFieldProps: ScopedProps<FormFieldProps<TFieldValues, TName>>): JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* @since 0.3.16-canary.0
|
|
32
|
+
*/
|
|
18
33
|
type FormItemProps = ComponentProps<"div">;
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
19
37
|
declare function FormItem({
|
|
20
38
|
__scopeFormField,
|
|
21
39
|
className,
|
|
22
40
|
...props
|
|
23
41
|
}: ScopedProps<FormItemProps>): JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* @since 0.3.16-canary.0
|
|
44
|
+
*/
|
|
24
45
|
type FormLabelProps = ComponentProps<typeof LabelPrimitive.Root>;
|
|
46
|
+
/**
|
|
47
|
+
* @since 0.3.16-canary.0
|
|
48
|
+
*/
|
|
25
49
|
declare function FormLabel({
|
|
26
50
|
__scopeFormField,
|
|
27
51
|
...props
|
|
28
52
|
}: ScopedProps<FormLabelProps>): JSX.Element;
|
|
53
|
+
/**
|
|
54
|
+
* @since 0.3.16-canary.0
|
|
55
|
+
*/
|
|
29
56
|
type FormControlProps = ComponentProps<typeof Slot>;
|
|
57
|
+
/**
|
|
58
|
+
* @since 0.3.16-canary.0
|
|
59
|
+
*/
|
|
30
60
|
declare function FormControl({
|
|
31
61
|
__scopeFormField,
|
|
32
62
|
...props
|
|
33
63
|
}: ScopedProps<FormControlProps>): JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* @since 0.3.16-canary.0
|
|
66
|
+
*/
|
|
34
67
|
type FormDescriptionProps = ComponentProps<"p">;
|
|
68
|
+
/**
|
|
69
|
+
* @since 0.3.16-canary.0
|
|
70
|
+
*/
|
|
35
71
|
declare function FormDescription({
|
|
36
72
|
__scopeFormField,
|
|
37
73
|
className,
|
|
38
74
|
...props
|
|
39
75
|
}: ScopedProps<FormDescriptionProps>): JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* @since 0.3.16-canary.0
|
|
78
|
+
*/
|
|
40
79
|
type FormMessageProps = ComponentProps<"p">;
|
|
80
|
+
/**
|
|
81
|
+
* @since 0.3.16-canary.0
|
|
82
|
+
*/
|
|
41
83
|
declare function FormMessage({
|
|
42
84
|
__scopeFormField,
|
|
43
85
|
children,
|
package/dist/components/form.mjs
CHANGED
|
@@ -7,6 +7,9 @@ import { useId } from "react";
|
|
|
7
7
|
import { createContextScope } from "@radix-ui/react-context";
|
|
8
8
|
import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
|
|
9
9
|
//#region src/components/form.tsx
|
|
10
|
+
/**
|
|
11
|
+
* @since 0.3.16-canary.0
|
|
12
|
+
*/
|
|
10
13
|
const Form = FormProvider;
|
|
11
14
|
const FORM_FIELD_NAME = "FormField";
|
|
12
15
|
const [createFormFieldContext, createFormFieldScope] = createContextScope(FORM_FIELD_NAME);
|
|
@@ -25,6 +28,9 @@ function useFormItem(consumerName, scope) {
|
|
|
25
28
|
...fieldState
|
|
26
29
|
};
|
|
27
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
28
34
|
function FormField(formFieldProps) {
|
|
29
35
|
const { __scopeFormField, ...props } = formFieldProps;
|
|
30
36
|
return /* @__PURE__ */ jsx(FormFieldContextProvider, {
|
|
@@ -34,6 +40,9 @@ function FormField(formFieldProps) {
|
|
|
34
40
|
});
|
|
35
41
|
}
|
|
36
42
|
const [FormItemContextProvider, useFormItemContext] = createFormFieldContext("FormItem");
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.3.16-canary.0
|
|
45
|
+
*/
|
|
37
46
|
function FormItem({ __scopeFormField, className, ...props }) {
|
|
38
47
|
return /* @__PURE__ */ jsx(FormItemContextProvider, {
|
|
39
48
|
id: useId(),
|
|
@@ -46,6 +55,9 @@ function FormItem({ __scopeFormField, className, ...props }) {
|
|
|
46
55
|
});
|
|
47
56
|
}
|
|
48
57
|
const FORM_LABEL_NAME = "FormLabel";
|
|
58
|
+
/**
|
|
59
|
+
* @since 0.3.16-canary.0
|
|
60
|
+
*/
|
|
49
61
|
function FormLabel({ __scopeFormField, ...props }) {
|
|
50
62
|
const { error, formItemId } = useFormItem(FORM_LABEL_NAME, __scopeFormField);
|
|
51
63
|
return /* @__PURE__ */ jsx(Label, {
|
|
@@ -56,6 +68,9 @@ function FormLabel({ __scopeFormField, ...props }) {
|
|
|
56
68
|
});
|
|
57
69
|
}
|
|
58
70
|
const FORM_CONTROL_NAME = "FormControl";
|
|
71
|
+
/**
|
|
72
|
+
* @since 0.3.16-canary.0
|
|
73
|
+
*/
|
|
59
74
|
function FormControl({ __scopeFormField, ...props }) {
|
|
60
75
|
const { error, formDescriptionId, formItemId, formMessageId } = useFormItem(FORM_CONTROL_NAME, __scopeFormField);
|
|
61
76
|
return /* @__PURE__ */ jsx(Slot, {
|
|
@@ -66,6 +81,9 @@ function FormControl({ __scopeFormField, ...props }) {
|
|
|
66
81
|
...props
|
|
67
82
|
});
|
|
68
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @since 0.3.16-canary.0
|
|
86
|
+
*/
|
|
69
87
|
function FormDescription({ __scopeFormField, className, ...props }) {
|
|
70
88
|
const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);
|
|
71
89
|
return /* @__PURE__ */ jsx("p", {
|
|
@@ -76,6 +94,9 @@ function FormDescription({ __scopeFormField, className, ...props }) {
|
|
|
76
94
|
});
|
|
77
95
|
}
|
|
78
96
|
const FORM_MESSAGE_NAME = "FormMessage";
|
|
97
|
+
/**
|
|
98
|
+
* @since 0.3.16-canary.0
|
|
99
|
+
*/
|
|
79
100
|
function FormMessage({ __scopeFormField, children, className, ...props }) {
|
|
80
101
|
const { error, formMessageId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);
|
|
81
102
|
const body = error?.message ?? children;
|