@codefast/ui 0.3.11-canary.1 → 0.3.11
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 +36 -0
- package/README.md +34 -14
- package/dist/components/accordion.d.ts +29 -10
- package/dist/components/accordion.js +38 -37
- package/dist/components/alert-dialog.d.ts +60 -24
- package/dist/components/alert-dialog.js +69 -72
- package/dist/components/alert.d.ts +27 -15
- package/dist/components/alert.js +29 -31
- package/dist/components/aspect-ratio.d.ts +8 -4
- package/dist/components/aspect-ratio.js +7 -5
- package/dist/components/avatar.d.ts +17 -6
- package/dist/components/avatar.js +19 -17
- package/dist/components/badge.d.ts +21 -14
- package/dist/components/badge.js +19 -22
- package/dist/components/breadcrumb.d.ts +35 -12
- package/dist/components/breadcrumb.js +48 -54
- package/dist/components/button-group.d.ts +29 -14
- package/dist/components/button-group.js +27 -32
- package/dist/components/button.d.ts +35 -25
- package/dist/components/button.js +50 -48
- package/dist/components/calendar.d.ts +24 -9
- package/dist/components/calendar.js +92 -98
- package/dist/components/card.d.ts +34 -10
- package/dist/components/card.js +39 -37
- package/dist/components/carousel.d.ts +55 -24
- package/dist/components/carousel.js +113 -130
- package/dist/components/chart.d.ts +72 -36
- package/dist/components/chart.js +154 -166
- package/dist/components/checkbox-cards.d.ts +15 -8
- package/dist/components/checkbox-cards.js +22 -25
- package/dist/components/checkbox-group.d.ts +16 -8
- package/dist/components/checkbox-group.js +19 -19
- package/dist/components/checkbox.d.ts +9 -4
- package/dist/components/checkbox.js +14 -14
- package/dist/components/collapsible.d.ts +14 -6
- package/dist/components/collapsible.js +18 -16
- package/dist/components/command.d.ts +55 -23
- package/dist/components/command.js +70 -85
- package/dist/components/context-menu.d.ts +72 -22
- package/dist/components/context-menu.js +88 -109
- package/dist/components/dialog.d.ts +53 -22
- package/dist/components/dialog.js +71 -85
- package/dist/components/drawer.d.ts +60 -28
- package/dist/components/drawer.js +59 -67
- package/dist/components/dropdown-menu.d.ts +73 -22
- package/dist/components/dropdown-menu.js +95 -112
- package/dist/components/empty.d.ts +37 -15
- package/dist/components/empty.js +43 -45
- package/dist/components/field.d.ts +63 -25
- package/dist/components/field.js +88 -104
- package/dist/components/form.d.ts +37 -15
- package/dist/components/form.js +65 -70
- package/dist/components/hover-card.d.ts +21 -7
- package/dist/components/hover-card.js +24 -24
- package/dist/components/input-group.d.ts +53 -28
- package/dist/components/input-group.js +63 -77
- package/dist/components/input-number.d.ts +28 -7
- package/dist/components/input-number.js +55 -59
- package/dist/components/input-otp.d.ts +24 -10
- package/dist/components/input-otp.js +33 -37
- package/dist/components/input-password.d.ts +12 -5
- package/dist/components/input-password.js +31 -32
- package/dist/components/input-search.d.ts +18 -8
- package/dist/components/input-search.js +43 -41
- package/dist/components/input.d.ts +10 -4
- package/dist/components/input.js +9 -7
- package/dist/components/item.d.ts +69 -32
- package/dist/components/item.js +89 -92
- package/dist/components/kbd.d.ts +13 -5
- package/dist/components/kbd.js +13 -11
- package/dist/components/label.d.ts +9 -4
- package/dist/components/label.js +9 -7
- package/dist/components/menubar.d.ts +80 -23
- package/dist/components/menubar.js +97 -118
- package/dist/components/native-select.d.ts +16 -6
- package/dist/components/native-select.js +25 -26
- package/dist/components/navigation-menu.d.ts +36 -12
- package/dist/components/navigation-menu.js +60 -75
- package/dist/components/pagination.d.ts +35 -14
- package/dist/components/pagination.js +54 -69
- package/dist/components/popover.d.ts +24 -8
- package/dist/components/popover.js +28 -28
- package/dist/components/progress-circle.d.ts +106 -88
- package/dist/components/progress-circle.js +106 -138
- package/dist/components/progress.d.ts +10 -4
- package/dist/components/progress.js +14 -14
- package/dist/components/radio-cards.d.ts +10 -4
- package/dist/components/radio-cards.js +22 -23
- package/dist/components/radio-group.d.ts +13 -5
- package/dist/components/radio-group.js +18 -16
- package/dist/components/radio.d.ts +12 -5
- package/dist/components/radio.js +10 -8
- package/dist/components/resizable.d.ts +18 -7
- package/dist/components/resizable.js +22 -22
- package/dist/components/scroll-area.d.ts +33 -20
- package/dist/components/scroll-area.js +84 -88
- package/dist/components/select.d.ts +50 -16
- package/dist/components/select.js +77 -96
- package/dist/components/separator.d.ts +29 -19
- package/dist/components/separator.js +36 -34
- package/dist/components/sheet.d.ts +62 -29
- package/dist/components/sheet.js +79 -100
- package/dist/components/sidebar.d.ts +160 -66
- package/dist/components/sidebar.js +294 -336
- package/dist/components/skeleton.d.ts +9 -4
- package/dist/components/skeleton.js +8 -6
- package/dist/components/slider.d.ts +13 -4
- package/dist/components/slider.js +34 -40
- package/dist/components/sonner.d.ts +10 -7
- package/dist/components/sonner.js +16 -14
- package/dist/components/spinner.d.ts +12 -5
- package/dist/components/spinner.js +33 -35
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +13 -11
- package/dist/components/table.d.ts +37 -11
- package/dist/components/table.js +47 -45
- package/dist/components/tabs.d.ts +21 -7
- package/dist/components/tabs.js +24 -22
- package/dist/components/textarea.d.ts +9 -4
- package/dist/components/textarea.js +8 -6
- package/dist/components/toggle-group.d.ts +24 -9
- package/dist/components/toggle-group.js +41 -42
- package/dist/components/toggle.d.ts +25 -17
- package/dist/components/toggle.js +30 -28
- package/dist/components/tooltip.d.ts +24 -8
- package/dist/components/tooltip.js +29 -32
- package/dist/hooks/use-animated-value.d.ts +4 -1
- package/dist/hooks/use-animated-value.js +57 -36
- package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
- package/dist/hooks/use-copy-to-clipboard.js +39 -20
- package/dist/hooks/use-is-mobile.d.ts +4 -1
- package/dist/hooks/use-is-mobile.js +21 -1
- package/dist/hooks/use-media-query.d.ts +4 -1
- package/dist/hooks/use-media-query.js +45 -18
- package/dist/hooks/use-mutation-observer.d.ts +6 -2
- package/dist/hooks/use-mutation-observer.js +34 -16
- package/dist/hooks/use-pagination.d.ts +22 -14
- package/dist/hooks/use-pagination.js +100 -49
- package/dist/index.d.ts +69 -130
- package/dist/index.js +11 -11
- package/dist/primitives/checkbox-group.d.ts +105 -83
- package/dist/primitives/checkbox-group.js +111 -84
- package/dist/primitives/input-number.d.ts +51 -40
- package/dist/primitives/input-number.js +483 -350
- package/dist/primitives/input.d.ts +48 -42
- package/dist/primitives/input.js +65 -43
- package/dist/primitives/progress-circle.d.ts +79 -48
- package/dist/primitives/progress-circle.js +154 -105
- package/package.json +6 -7
|
@@ -1,154 +1,133 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import { Arrow, CheckboxItem, Content, Group, Item, ItemIndicator, Label, Menu, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-menubar";
|
|
5
3
|
import { CheckIcon, ChevronRightIcon, DotIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
6
|
+
//#region src/components/menubar.tsx
|
|
6
7
|
function Menubar({ className, ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Root, {
|
|
9
|
+
className: cn("flex items-center space-x-1 rounded-lg border bg-background p-1", className),
|
|
10
|
+
"data-slot": "menubar",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
12
13
|
}
|
|
13
14
|
function MenubarMenu({ ...props }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Menu, {
|
|
16
|
+
"data-slot": "menubar-menu",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
18
19
|
}
|
|
19
20
|
function MenubarGroup({ ...props }) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Group, {
|
|
22
|
+
"data-slot": "menubar-group",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
26
|
function MenubarSub({ ...props }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Sub, {
|
|
28
|
+
"data-slot": "menubar-sub",
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
32
|
function MenubarRadioGroup({ ...props }) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.RadioGroup, {
|
|
34
|
+
"data-slot": "menubar-radio-group",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
36
37
|
}
|
|
37
38
|
function MenubarTrigger({ className, ...props }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Trigger, {
|
|
40
|
+
className: cn("flex items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", className),
|
|
41
|
+
"data-slot": "menubar-trigger",
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
43
44
|
}
|
|
44
45
|
function MenubarSubTrigger({ children, className, inset, ...props }) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/*#__PURE__*/ jsx(ChevronRightIcon, {
|
|
53
|
-
className: "ml-auto size-4"
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
});
|
|
46
|
+
return /* @__PURE__ */ jsxs(MenubarPrimitive.SubTrigger, {
|
|
47
|
+
className: cn("flex cursor-default items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", className),
|
|
48
|
+
"data-inset": inset,
|
|
49
|
+
"data-slot": "menubar-sub-trigger",
|
|
50
|
+
...props,
|
|
51
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })]
|
|
52
|
+
});
|
|
57
53
|
}
|
|
58
54
|
function MenubarSubContent({ className, ...props }) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})
|
|
65
|
-
});
|
|
55
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Portal, { children: /* @__PURE__ */ jsx(MenubarPrimitive.SubContent, {
|
|
56
|
+
className: cn("z-50 min-w-32 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg ease-ui data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:data-[side=bottom]:slide-out-to-top-2 data-[state=closed]:data-[side=left]:slide-out-to-right-2 data-[state=closed]:data-[side=right]:slide-out-to-left-2 data-[state=closed]:data-[side=top]:slide-out-to-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=top]:slide-in-from-bottom-2", className),
|
|
57
|
+
"data-slot": "menubar-sub-content",
|
|
58
|
+
...props
|
|
59
|
+
}) });
|
|
66
60
|
}
|
|
67
61
|
function MenubarContent({ align = "start", alignOffset = -4, className, sideOffset = 4, ...props }) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})
|
|
77
|
-
});
|
|
62
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Portal, { children: /* @__PURE__ */ jsx(MenubarPrimitive.Content, {
|
|
63
|
+
align,
|
|
64
|
+
alignOffset,
|
|
65
|
+
className: cn("z-50 min-w-32 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg ease-ui data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:data-[side=bottom]:slide-in-from-top-2 data-[state=open]:data-[side=left]:slide-in-from-right-2 data-[state=open]:data-[side=right]:slide-in-from-left-2 data-[state=open]:data-[side=top]:slide-in-from-bottom-2", className),
|
|
66
|
+
"data-slot": "menubar-content",
|
|
67
|
+
sideOffset,
|
|
68
|
+
...props
|
|
69
|
+
}) });
|
|
78
70
|
}
|
|
79
71
|
function MenubarItem({ className, inset, variant, ...props }) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Item, {
|
|
73
|
+
className: cn("group/menubar-item relative flex cursor-default items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-hidden 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 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80", className),
|
|
74
|
+
"data-inset": inset,
|
|
75
|
+
"data-slot": "menubar-item",
|
|
76
|
+
"data-variant": variant,
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
87
79
|
}
|
|
88
80
|
function MenubarCheckboxItem({ checked, children, className, ...props }) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
className: "size-4"
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
}),
|
|
103
|
-
children
|
|
104
|
-
]
|
|
105
|
-
});
|
|
81
|
+
return /* @__PURE__ */ jsxs(MenubarPrimitive.CheckboxItem, {
|
|
82
|
+
checked,
|
|
83
|
+
className: cn("group/menubar-item relative flex cursor-default items-center gap-x-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground aria-disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
84
|
+
"data-slot": "menubar-checkbox-item",
|
|
85
|
+
...props,
|
|
86
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: "absolute left-2 flex items-center justify-center",
|
|
88
|
+
children: /* @__PURE__ */ jsx(MenubarPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
89
|
+
}), children]
|
|
90
|
+
});
|
|
106
91
|
}
|
|
107
92
|
function MenubarRadioItem({ children, className, ...props }) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
className: "size-4 fill-current"
|
|
118
|
-
})
|
|
119
|
-
})
|
|
120
|
-
}),
|
|
121
|
-
children
|
|
122
|
-
]
|
|
123
|
-
});
|
|
93
|
+
return /* @__PURE__ */ jsxs(MenubarPrimitive.RadioItem, {
|
|
94
|
+
className: cn("group/menubar-item relative flex cursor-default items-center gap-x-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground aria-disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
95
|
+
"data-slot": "menubar-radio-item",
|
|
96
|
+
...props,
|
|
97
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "absolute left-2 flex items-center justify-center",
|
|
99
|
+
children: /* @__PURE__ */ jsx(MenubarPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(DotIcon, { className: "size-4 fill-current" }) })
|
|
100
|
+
}), children]
|
|
101
|
+
});
|
|
124
102
|
}
|
|
125
103
|
function MenubarLabel({ className, inset, ...props }) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
104
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Label, {
|
|
105
|
+
className: cn("flex items-center gap-x-2 px-2 py-1.5 text-sm font-semibold data-inset:pl-8", className),
|
|
106
|
+
"data-inset": inset,
|
|
107
|
+
"data-slot": "menubar-label",
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
132
110
|
}
|
|
133
111
|
function MenubarSeparator({ className, ...props }) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
112
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Separator, {
|
|
113
|
+
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
114
|
+
"data-slot": "menubar-separator",
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
139
117
|
}
|
|
140
118
|
function MenubarShortcut({ className, ...props }) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
119
|
+
return /* @__PURE__ */ jsx("span", {
|
|
120
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-[variant=destructive]/menubar-item:text-destructive/80", className),
|
|
121
|
+
"data-slot": "menubar-shortcut",
|
|
122
|
+
...props
|
|
123
|
+
});
|
|
146
124
|
}
|
|
147
125
|
function MenubarArrow({ className, ...props }) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
126
|
+
return /* @__PURE__ */ jsx(MenubarPrimitive.Arrow, {
|
|
127
|
+
className: cn("fill-popover", className),
|
|
128
|
+
"data-slot": "menubar-arrow",
|
|
129
|
+
...props
|
|
130
|
+
});
|
|
153
131
|
}
|
|
132
|
+
//#endregion
|
|
154
133
|
export { Menubar, MenubarArrow, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger };
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/native-select.d.ts
|
|
2
4
|
type NativeSelectProps = ComponentProps<"select">;
|
|
3
|
-
declare function NativeSelect({
|
|
5
|
+
declare function NativeSelect({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: NativeSelectProps): JSX.Element;
|
|
4
9
|
type NativeSelectOptionProps = ComponentProps<"option">;
|
|
5
|
-
declare function NativeSelectOption({
|
|
10
|
+
declare function NativeSelectOption({
|
|
11
|
+
...props
|
|
12
|
+
}: NativeSelectOptionProps): JSX.Element;
|
|
6
13
|
type NativeSelectOptGroupProps = ComponentProps<"optgroup">;
|
|
7
|
-
declare function NativeSelectOptGroup({
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
declare function NativeSelectOptGroup({
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: NativeSelectOptGroupProps): JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NativeSelect, NativeSelectOptGroup, type NativeSelectOptGroupProps, NativeSelectOption, type NativeSelectOptionProps, type NativeSelectProps };
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { cn } from "@codefast/tailwind-variants";
|
|
3
2
|
import { ChevronDownIcon } from "lucide-react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/native-select.tsx
|
|
4
5
|
function NativeSelect({ className, ...props }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
]
|
|
20
|
-
});
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7
|
+
className: "group/native-select relative w-fit has-[select:disabled]:opacity-50",
|
|
8
|
+
"data-slot": "native-select-wrapper",
|
|
9
|
+
children: [/* @__PURE__ */ jsx("select", {
|
|
10
|
+
className: cn("h-9 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed dark:bg-input/30 dark:hover:bg-input/50", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className),
|
|
11
|
+
"data-slot": "native-select",
|
|
12
|
+
...props
|
|
13
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
className: "pointer-events-none absolute top-1/2 right-3.5 size-4 -translate-y-1/2 text-muted-foreground opacity-50 select-none",
|
|
16
|
+
"data-slot": "native-select-icon"
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
21
19
|
}
|
|
22
20
|
function NativeSelectOption({ ...props }) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
return /* @__PURE__ */ jsx("option", {
|
|
22
|
+
"data-slot": "native-select-option",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
27
25
|
}
|
|
28
26
|
function NativeSelectOptGroup({ className, ...props }) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
return /* @__PURE__ */ jsx("optgroup", {
|
|
28
|
+
className: cn(className),
|
|
29
|
+
"data-slot": "native-select-optgroup",
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
34
32
|
}
|
|
33
|
+
//#endregion
|
|
35
34
|
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
@@ -1,20 +1,44 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _$_codefast_tailwind_variants0 from "@codefast/tailwind-variants";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
2
3
|
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
//#region src/components/navigation-menu.d.ts
|
|
6
|
+
declare const navigationMenuTriggerVariants: _$_codefast_tailwind_variants0.VariantFunctionType<_$_codefast_tailwind_variants0.ConfigurationSchema, Record<string, never>>;
|
|
4
7
|
interface NavigationMenuProps extends ComponentProps<typeof NavigationMenuPrimitive.Root> {
|
|
5
|
-
|
|
8
|
+
viewport?: boolean;
|
|
6
9
|
}
|
|
7
|
-
declare function NavigationMenu({
|
|
10
|
+
declare function NavigationMenu({
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
viewport,
|
|
14
|
+
...props
|
|
15
|
+
}: NavigationMenuProps): JSX.Element;
|
|
8
16
|
type NavigationMenuListProps = ComponentProps<typeof NavigationMenuPrimitive.List>;
|
|
9
|
-
declare function NavigationMenuList({
|
|
17
|
+
declare function NavigationMenuList({
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: NavigationMenuListProps): JSX.Element;
|
|
10
22
|
type NavigationMenuItemProps = ComponentProps<typeof NavigationMenuPrimitive.Item>;
|
|
11
|
-
declare function NavigationMenuItem({
|
|
23
|
+
declare function NavigationMenuItem({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: NavigationMenuItemProps): JSX.Element;
|
|
12
27
|
type NavigationMenuTriggerProps = ComponentProps<typeof NavigationMenuPrimitive.Trigger>;
|
|
13
|
-
declare function NavigationMenuTrigger({
|
|
28
|
+
declare function NavigationMenuTrigger({
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: NavigationMenuTriggerProps): JSX.Element;
|
|
14
33
|
type NavigationMenuContentProps = ComponentProps<typeof NavigationMenuPrimitive.Content>;
|
|
15
|
-
declare function NavigationMenuContent({
|
|
34
|
+
declare function NavigationMenuContent({
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}: NavigationMenuContentProps): JSX.Element;
|
|
16
38
|
type NavigationMenuLinkProps = ComponentProps<typeof NavigationMenuPrimitive.Link>;
|
|
17
|
-
declare function NavigationMenuLink({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
39
|
+
declare function NavigationMenuLink({
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}: NavigationMenuLinkProps): JSX.Element;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { NavigationMenu, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, navigationMenuTriggerVariants };
|
|
@@ -1,94 +1,79 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buttonVariants } from "./button.js";
|
|
2
2
|
import { cn, tv } from "@codefast/tailwind-variants";
|
|
3
|
-
import { Content, Indicator, Item, Link, List, Root, Trigger, Viewport } from "@radix-ui/react-navigation-menu";
|
|
4
3
|
import { ChevronDownIcon } from "lucide-react";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
6
|
+
//#region src/components/navigation-menu.tsx
|
|
7
|
+
const navigationMenuTriggerVariants = tv({ base: buttonVariants({
|
|
8
|
+
className: "data-[state=open]:bg-secondary/50 data-[state=open]:text-secondary-foreground group/navigation-menu-trigger focus-visible:bg-secondary dark:hover:not-disabled:bg-secondary",
|
|
9
|
+
variant: "ghost"
|
|
10
|
+
}) });
|
|
12
11
|
function NavigationMenu({ children, className, viewport = true, ...props }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
viewport ? /*#__PURE__*/ jsx(NavigationMenuViewport, {}) : null
|
|
21
|
-
]
|
|
22
|
-
});
|
|
12
|
+
return /* @__PURE__ */ jsxs(NavigationMenuPrimitive.Root, {
|
|
13
|
+
className: cn("group/navigation-menu relative flex max-w-max flex-1 items-center justify-center", className),
|
|
14
|
+
"data-slot": "navigation-menu",
|
|
15
|
+
"data-viewport": viewport,
|
|
16
|
+
...props,
|
|
17
|
+
children: [children, viewport ? /* @__PURE__ */ jsx(NavigationMenuViewport, {}) : null]
|
|
18
|
+
});
|
|
23
19
|
}
|
|
24
20
|
function NavigationMenuList({ children, className, ...props }) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/*#__PURE__*/ jsx(NavigationMenuIndicator, {
|
|
32
|
-
className: "invisible"
|
|
33
|
-
})
|
|
34
|
-
]
|
|
35
|
-
});
|
|
21
|
+
return /* @__PURE__ */ jsxs(NavigationMenuPrimitive.List, {
|
|
22
|
+
className: cn("flex flex-1 list-none items-center justify-center gap-1", className),
|
|
23
|
+
"data-slot": "navigation-menu-list",
|
|
24
|
+
...props,
|
|
25
|
+
children: [children, /* @__PURE__ */ jsx(NavigationMenuIndicator, { className: "invisible" })]
|
|
26
|
+
});
|
|
36
27
|
}
|
|
37
28
|
function NavigationMenuItem({ className, ...props }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Item, {
|
|
30
|
+
className: cn("group-data-[viewport=false]/navigation-menu:relative", className),
|
|
31
|
+
"data-slot": "navigation-menu-item",
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
43
34
|
}
|
|
44
35
|
function NavigationMenuTrigger({ children, className, ...props }) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"aria-hidden": "true",
|
|
55
|
-
className: "relative top-px ml-1 size-3 transition duration-300 group-data-[state=open]/navigation-menu-trigger:rotate-180"
|
|
56
|
-
})
|
|
57
|
-
]
|
|
58
|
-
});
|
|
36
|
+
return /* @__PURE__ */ jsxs(NavigationMenuPrimitive.Trigger, {
|
|
37
|
+
className: navigationMenuTriggerVariants({ className }),
|
|
38
|
+
"data-slot": "navigation-menu-trigger",
|
|
39
|
+
...props,
|
|
40
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
className: "relative top-px ml-1 size-3 transition duration-300 group-data-[state=open]/navigation-menu-trigger:rotate-180"
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
59
45
|
}
|
|
60
46
|
function NavigationMenuContent({ className, ...props }) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Content, {
|
|
48
|
+
className: cn("top-0 left-0 w-full ease-ui group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-2 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:p-1 group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=true]/navigation-menu:p-2 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in-0 data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 md:absolute md:w-auto", className),
|
|
49
|
+
"data-slot": "navigation-menu-content",
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
66
52
|
}
|
|
67
53
|
function NavigationMenuLink({ className, ...props }) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Link, {
|
|
55
|
+
className: cn("flex flex-col gap-1 rounded-sm p-2 text-sm outline-hidden transition hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground data-[active=true]:hover:bg-accent data-[active=true]:focus:bg-accent [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80", className),
|
|
56
|
+
"data-slot": "navigation-menu-link",
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
73
59
|
}
|
|
74
60
|
function NavigationMenuViewport({ className, ...props }) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
return /* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "absolute top-full left-0 z-30 flex justify-center perspective-distant",
|
|
63
|
+
children: /* @__PURE__ */ jsx(NavigationMenuPrimitive.Viewport, {
|
|
64
|
+
className: cn("relative mt-2 min-h-[calc(var(--radix-navigation-menu-viewport-height)+2px)] w-full origin-[top_center] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-lg transition-[width,height] ease-ui data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-90 sm:min-w-[calc(var(--radix-navigation-menu-viewport-width)+2px)]", className),
|
|
65
|
+
"data-slot": "navigation-menu-viewport",
|
|
66
|
+
...props
|
|
67
|
+
})
|
|
68
|
+
});
|
|
83
69
|
}
|
|
84
70
|
function NavigationMenuIndicator({ className, ...props }) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
});
|
|
71
|
+
return /* @__PURE__ */ jsx(NavigationMenuPrimitive.Indicator, {
|
|
72
|
+
className: cn("top-full z-10 flex h-2 items-center justify-center overflow-hidden ease-ui data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0 data-[state=visible]:animate-in data-[state=visible]:fade-in-0", className),
|
|
73
|
+
"data-slot": "navigation-menu-indicator",
|
|
74
|
+
...props,
|
|
75
|
+
children: /* @__PURE__ */ jsx("div", { className: "relative top-[60%] size-2.5 rotate-45 rounded-tl-xs bg-popover text-popover-foreground" })
|
|
76
|
+
});
|
|
93
77
|
}
|
|
78
|
+
//#endregion
|
|
94
79
|
export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerVariants };
|