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