@alepha/ui 0.25.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/README.md +12 -0
- package/components.json +20 -0
- package/package.json +85 -0
- package/src/components/action-error-toaster/action-error-toaster.tsx +70 -0
- package/src/components/admin/admin-audits.tsx +247 -0
- package/src/components/admin/admin-files.tsx +346 -0
- package/src/components/admin/admin-jobs-executions-panel.tsx +235 -0
- package/src/components/admin/admin-jobs-status-badge.tsx +33 -0
- package/src/components/admin/admin-jobs.tsx +294 -0
- package/src/components/admin/admin-keys.tsx +162 -0
- package/src/components/admin/admin-notifications.tsx +130 -0
- package/src/components/admin/admin-page.tsx +24 -0
- package/src/components/admin/admin-parameters.tsx +864 -0
- package/src/components/admin/admin-payments.tsx +93 -0
- package/src/components/admin/admin-sessions.tsx +174 -0
- package/src/components/admin/admin-user-detail-audits-tab.tsx +82 -0
- package/src/components/admin/admin-user-detail-identity-aside.tsx +218 -0
- package/src/components/admin/admin-user-detail-overview-tab.tsx +87 -0
- package/src/components/admin/admin-user-detail-password-dialog.tsx +85 -0
- package/src/components/admin/admin-user-detail-password-schema.ts +11 -0
- package/src/components/admin/admin-user-detail-profile-schema.ts +19 -0
- package/src/components/admin/admin-user-detail-provider-labels.ts +15 -0
- package/src/components/admin/admin-user-detail-security-tab.tsx +146 -0
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +93 -0
- package/src/components/admin/admin-user-detail.tsx +606 -0
- package/src/components/admin/admin-users-roles-picker.tsx +126 -0
- package/src/components/admin/admin-users-status-filter.tsx +51 -0
- package/src/components/admin/admin-users.tsx +518 -0
- package/src/components/admin/diff-lines.spec.ts +58 -0
- package/src/components/admin/diff-lines.ts +58 -0
- package/src/components/admin/parameter-diff-dialog.tsx +119 -0
- package/src/components/admin/parameter-history-item.tsx +252 -0
- package/src/components/admin/parameter-json-dialog.tsx +93 -0
- package/src/components/admin/parameter-save-dialog.tsx +126 -0
- package/src/components/admin/use-confirmed-action.tsx +93 -0
- package/src/components/alepha-table/__tests__/use-table-selection.browser.spec.tsx +92 -0
- package/src/components/alepha-table/alepha-table.tsx +1158 -0
- package/src/components/alepha-table/use-table-selection.ts +95 -0
- package/src/components/app-shell/app-shell.tsx +568 -0
- package/src/components/auth/__tests__/auth-router.spec.ts +52 -0
- package/src/components/auth/auth-login.tsx +382 -0
- package/src/components/auth/auth-register.tsx +786 -0
- package/src/components/auth/auth-reset-password.tsx +349 -0
- package/src/components/auth/auth-router.tsx +126 -0
- package/src/components/auth/auth-verify-email.tsx +179 -0
- package/src/components/auto-form/auto-form.tsx +867 -0
- package/src/components/brand-icon/brand-icon.tsx +104 -0
- package/src/components/button-dark/button-dark.tsx +78 -0
- package/src/components/button-language/button-language.tsx +98 -0
- package/src/components/button-theme/button-theme.tsx +148 -0
- package/src/components/button-user/button-user.tsx +214 -0
- package/src/components/captcha/turnstile-widget.tsx +157 -0
- package/src/components/control/control.tsx +735 -0
- package/src/components/control-array/control-array.tsx +700 -0
- package/src/components/control-base/__tests__/form-field-a11y.browser.spec.tsx +93 -0
- package/src/components/control-base/field-i18n.ts +60 -0
- package/src/components/control-base/form-field.tsx +275 -0
- package/src/components/control-base/grid.tsx +59 -0
- package/src/components/control-base/icon-hint.tsx +64 -0
- package/src/components/control-date/control-date.tsx +190 -0
- package/src/components/control-number/control-number.tsx +136 -0
- package/src/components/control-object/control-object.tsx +200 -0
- package/src/components/control-select/control-select.tsx +774 -0
- package/src/components/control-upload/control-upload.tsx +475 -0
- package/src/components/file-image/file-image.tsx +52 -0
- package/src/components/language-toggle/language-toggle.tsx +66 -0
- package/src/components/markdown-view/markdown-view.css +114 -0
- package/src/components/markdown-view/markdown-view.tsx +92 -0
- package/src/components/nav-shell/nav-page.tsx +56 -0
- package/src/components/nav-shell/nav-shell.tsx +72 -0
- package/src/components/nav-shell/nav-tree-util.ts +62 -0
- package/src/components/nav-shell/spotlight.tsx +163 -0
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +52 -0
- package/src/components/nav-shell/use-nav-entries.ts +101 -0
- package/src/components/nav-shell/use-nav-tree.ts +61 -0
- package/src/components/ui/accordion.tsx +77 -0
- package/src/components/ui/alert-dialog.tsx +186 -0
- package/src/components/ui/alert.tsx +75 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +51 -0
- package/src/components/ui/breadcrumb.tsx +121 -0
- package/src/components/ui/button-group.tsx +86 -0
- package/src/components/ui/button.tsx +83 -0
- package/src/components/ui/calendar.tsx +235 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/carousel.tsx +241 -0
- package/src/components/ui/chart.tsx +370 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/combobox.tsx +298 -0
- package/src/components/ui/command.tsx +196 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +153 -0
- package/src/components/ui/direction.tsx +4 -0
- package/src/components/ui/drawer.tsx +130 -0
- package/src/components/ui/dropdown-menu.tsx +269 -0
- package/src/components/ui/empty.tsx +100 -0
- package/src/components/ui/hover-card.tsx +50 -0
- package/src/components/ui/input-group.tsx +157 -0
- package/src/components/ui/input-otp.tsx +83 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/item.tsx +200 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/menubar.tsx +283 -0
- package/src/components/ui/navigation-menu.tsx +170 -0
- package/src/components/ui/pagination.tsx +133 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/progress.tsx +82 -0
- package/src/components/ui/radio-group.tsx +35 -0
- package/src/components/ui/resizable.tsx +49 -0
- package/src/components/ui/scroll-area.tsx +51 -0
- package/src/components/ui/segmented.tsx +232 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +22 -0
- package/src/components/ui/sheet.tsx +133 -0
- package/src/components/ui/sidebar.tsx +723 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +51 -0
- package/src/components/ui/sonner.tsx +46 -0
- package/src/components/ui/spinner.tsx +15 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +115 -0
- package/src/components/ui/tabs.tsx +79 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toggle-group.tsx +86 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +63 -0
- package/src/components/use-dialog/use-dialog.tsx +244 -0
- package/src/components/use-toast/use-toast.tsx +89 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/lib/__tests__/i18n-fr.spec.ts +72 -0
- package/src/lib/i18n-fr.ts +500 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +129 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { Separator } from "@alepha/ui/components/ui/separator";
|
|
2
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import type * as React from "react";
|
|
7
|
+
|
|
8
|
+
function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
role="list"
|
|
12
|
+
data-slot="item-group"
|
|
13
|
+
className={cn(
|
|
14
|
+
"group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2",
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ItemSeparator({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
26
|
+
return (
|
|
27
|
+
<Separator
|
|
28
|
+
data-slot="item-separator"
|
|
29
|
+
orientation="horizontal"
|
|
30
|
+
className={cn("my-2", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const itemVariants = cva(
|
|
37
|
+
"group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",
|
|
38
|
+
{
|
|
39
|
+
variants: {
|
|
40
|
+
variant: {
|
|
41
|
+
default: "border-transparent",
|
|
42
|
+
outline: "border-border",
|
|
43
|
+
muted: "border-transparent bg-muted/50",
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
default: "gap-2.5 px-3 py-2.5",
|
|
47
|
+
sm: "gap-2.5 px-3 py-2.5",
|
|
48
|
+
xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
variant: "default",
|
|
53
|
+
size: "default",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
function Item({
|
|
59
|
+
className,
|
|
60
|
+
variant = "default",
|
|
61
|
+
size = "default",
|
|
62
|
+
render,
|
|
63
|
+
...props
|
|
64
|
+
}: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>) {
|
|
65
|
+
return useRender({
|
|
66
|
+
defaultTagName: "div",
|
|
67
|
+
props: mergeProps<"div">(
|
|
68
|
+
{
|
|
69
|
+
className: cn(itemVariants({ variant, size, className })),
|
|
70
|
+
},
|
|
71
|
+
props,
|
|
72
|
+
),
|
|
73
|
+
render,
|
|
74
|
+
state: {
|
|
75
|
+
slot: "item",
|
|
76
|
+
variant,
|
|
77
|
+
size,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const itemMediaVariants = cva(
|
|
83
|
+
"flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none",
|
|
84
|
+
{
|
|
85
|
+
variants: {
|
|
86
|
+
variant: {
|
|
87
|
+
default: "bg-transparent",
|
|
88
|
+
icon: "[&_svg:not([class*='size-'])]:size-4",
|
|
89
|
+
image:
|
|
90
|
+
"size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
defaultVariants: {
|
|
94
|
+
variant: "default",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
function ItemMedia({
|
|
100
|
+
className,
|
|
101
|
+
variant = "default",
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
data-slot="item-media"
|
|
107
|
+
data-variant={variant}
|
|
108
|
+
className={cn(itemMediaVariants({ variant, className }))}
|
|
109
|
+
{...props}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
115
|
+
return (
|
|
116
|
+
<div
|
|
117
|
+
data-slot="item-content"
|
|
118
|
+
className={cn(
|
|
119
|
+
"flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none",
|
|
120
|
+
className,
|
|
121
|
+
)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
128
|
+
return (
|
|
129
|
+
<div
|
|
130
|
+
data-slot="item-title"
|
|
131
|
+
className={cn(
|
|
132
|
+
"line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",
|
|
133
|
+
className,
|
|
134
|
+
)}
|
|
135
|
+
{...props}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
141
|
+
return (
|
|
142
|
+
<p
|
|
143
|
+
data-slot="item-description"
|
|
144
|
+
className={cn(
|
|
145
|
+
"line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
146
|
+
className,
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
|
|
154
|
+
return (
|
|
155
|
+
<div
|
|
156
|
+
data-slot="item-actions"
|
|
157
|
+
className={cn("flex items-center gap-2", className)}
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
164
|
+
return (
|
|
165
|
+
<div
|
|
166
|
+
data-slot="item-header"
|
|
167
|
+
className={cn(
|
|
168
|
+
"flex basis-full items-center justify-between gap-2",
|
|
169
|
+
className,
|
|
170
|
+
)}
|
|
171
|
+
{...props}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
177
|
+
return (
|
|
178
|
+
<div
|
|
179
|
+
data-slot="item-footer"
|
|
180
|
+
className={cn(
|
|
181
|
+
"flex basis-full items-center justify-between gap-2",
|
|
182
|
+
className,
|
|
183
|
+
)}
|
|
184
|
+
{...props}
|
|
185
|
+
/>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
Item,
|
|
191
|
+
ItemActions,
|
|
192
|
+
ItemContent,
|
|
193
|
+
ItemDescription,
|
|
194
|
+
ItemFooter,
|
|
195
|
+
ItemGroup,
|
|
196
|
+
ItemHeader,
|
|
197
|
+
ItemMedia,
|
|
198
|
+
ItemSeparator,
|
|
199
|
+
ItemTitle,
|
|
200
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
2
|
+
|
|
3
|
+
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
4
|
+
return (
|
|
5
|
+
<kbd
|
|
6
|
+
data-slot="kbd"
|
|
7
|
+
className={cn(
|
|
8
|
+
"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
|
|
9
|
+
className,
|
|
10
|
+
)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
17
|
+
return (
|
|
18
|
+
<kbd
|
|
19
|
+
data-slot="kbd-group"
|
|
20
|
+
className={cn("inline-flex items-center gap-1", className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Kbd, KbdGroup };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
4
|
+
import type * as React from "react";
|
|
5
|
+
|
|
6
|
+
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
7
|
+
return (
|
|
8
|
+
<label
|
|
9
|
+
data-slot="label"
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Label };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenu,
|
|
5
|
+
DropdownMenuContent,
|
|
6
|
+
DropdownMenuGroup,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
DropdownMenuLabel,
|
|
9
|
+
DropdownMenuPortal,
|
|
10
|
+
DropdownMenuRadioGroup,
|
|
11
|
+
DropdownMenuSeparator,
|
|
12
|
+
DropdownMenuShortcut,
|
|
13
|
+
DropdownMenuSub,
|
|
14
|
+
DropdownMenuSubContent,
|
|
15
|
+
DropdownMenuSubTrigger,
|
|
16
|
+
DropdownMenuTrigger,
|
|
17
|
+
} from "@alepha/ui/components/ui/dropdown-menu";
|
|
18
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
19
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
20
|
+
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar";
|
|
21
|
+
import { CheckIcon } from "lucide-react";
|
|
22
|
+
import type * as React from "react";
|
|
23
|
+
|
|
24
|
+
function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
25
|
+
return (
|
|
26
|
+
<MenubarPrimitive
|
|
27
|
+
data-slot="menubar"
|
|
28
|
+
className={cn(
|
|
29
|
+
"flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
|
|
38
|
+
return <DropdownMenu data-slot="menubar-menu" {...props} />;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function MenubarGroup({
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof DropdownMenuGroup>) {
|
|
44
|
+
return <DropdownMenuGroup data-slot="menubar-group" {...props} />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function MenubarPortal({
|
|
48
|
+
...props
|
|
49
|
+
}: React.ComponentProps<typeof DropdownMenuPortal>) {
|
|
50
|
+
return <DropdownMenuPortal data-slot="menubar-portal" {...props} />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function MenubarTrigger({
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}: React.ComponentProps<typeof DropdownMenuTrigger>) {
|
|
57
|
+
return (
|
|
58
|
+
<DropdownMenuTrigger
|
|
59
|
+
data-slot="menubar-trigger"
|
|
60
|
+
className={cn(
|
|
61
|
+
"flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function MenubarContent({
|
|
70
|
+
className,
|
|
71
|
+
align = "start",
|
|
72
|
+
alignOffset = -4,
|
|
73
|
+
sideOffset = 8,
|
|
74
|
+
...props
|
|
75
|
+
}: React.ComponentProps<typeof DropdownMenuContent>) {
|
|
76
|
+
return (
|
|
77
|
+
<DropdownMenuContent
|
|
78
|
+
data-slot="menubar-content"
|
|
79
|
+
align={align}
|
|
80
|
+
alignOffset={alignOffset}
|
|
81
|
+
sideOffset={sideOffset}
|
|
82
|
+
className={cn(
|
|
83
|
+
"min-w-36 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
|
|
84
|
+
className,
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function MenubarItem({
|
|
92
|
+
className,
|
|
93
|
+
inset,
|
|
94
|
+
variant = "default",
|
|
95
|
+
...props
|
|
96
|
+
}: React.ComponentProps<typeof DropdownMenuItem>) {
|
|
97
|
+
return (
|
|
98
|
+
<DropdownMenuItem
|
|
99
|
+
data-slot="menubar-item"
|
|
100
|
+
data-inset={inset}
|
|
101
|
+
data-variant={variant}
|
|
102
|
+
className={cn(
|
|
103
|
+
"group/menubar-item gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function MenubarCheckboxItem({
|
|
112
|
+
className,
|
|
113
|
+
children,
|
|
114
|
+
checked,
|
|
115
|
+
inset,
|
|
116
|
+
...props
|
|
117
|
+
}: MenuPrimitive.CheckboxItem.Props & {
|
|
118
|
+
inset?: boolean;
|
|
119
|
+
}) {
|
|
120
|
+
return (
|
|
121
|
+
<MenuPrimitive.CheckboxItem
|
|
122
|
+
data-slot="menubar-checkbox-item"
|
|
123
|
+
data-inset={inset}
|
|
124
|
+
className={cn(
|
|
125
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
126
|
+
className,
|
|
127
|
+
)}
|
|
128
|
+
checked={checked}
|
|
129
|
+
{...props}
|
|
130
|
+
>
|
|
131
|
+
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
132
|
+
<MenuPrimitive.CheckboxItemIndicator>
|
|
133
|
+
<CheckIcon />
|
|
134
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
135
|
+
</span>
|
|
136
|
+
{children}
|
|
137
|
+
</MenuPrimitive.CheckboxItem>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function MenubarRadioGroup({
|
|
142
|
+
...props
|
|
143
|
+
}: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
|
|
144
|
+
return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function MenubarRadioItem({
|
|
148
|
+
className,
|
|
149
|
+
children,
|
|
150
|
+
inset,
|
|
151
|
+
...props
|
|
152
|
+
}: MenuPrimitive.RadioItem.Props & {
|
|
153
|
+
inset?: boolean;
|
|
154
|
+
}) {
|
|
155
|
+
return (
|
|
156
|
+
<MenuPrimitive.RadioItem
|
|
157
|
+
data-slot="menubar-radio-item"
|
|
158
|
+
data-inset={inset}
|
|
159
|
+
className={cn(
|
|
160
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
161
|
+
className,
|
|
162
|
+
)}
|
|
163
|
+
{...props}
|
|
164
|
+
>
|
|
165
|
+
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
166
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
167
|
+
<CheckIcon />
|
|
168
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
169
|
+
</span>
|
|
170
|
+
{children}
|
|
171
|
+
</MenuPrimitive.RadioItem>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function MenubarLabel({
|
|
176
|
+
className,
|
|
177
|
+
inset,
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<typeof DropdownMenuLabel> & {
|
|
180
|
+
inset?: boolean;
|
|
181
|
+
}) {
|
|
182
|
+
return (
|
|
183
|
+
<DropdownMenuLabel
|
|
184
|
+
data-slot="menubar-label"
|
|
185
|
+
data-inset={inset}
|
|
186
|
+
className={cn(
|
|
187
|
+
"px-1.5 py-1 text-sm font-medium data-inset:pl-7",
|
|
188
|
+
className,
|
|
189
|
+
)}
|
|
190
|
+
{...props}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function MenubarSeparator({
|
|
196
|
+
className,
|
|
197
|
+
...props
|
|
198
|
+
}: React.ComponentProps<typeof DropdownMenuSeparator>) {
|
|
199
|
+
return (
|
|
200
|
+
<DropdownMenuSeparator
|
|
201
|
+
data-slot="menubar-separator"
|
|
202
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
203
|
+
{...props}
|
|
204
|
+
/>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function MenubarShortcut({
|
|
209
|
+
className,
|
|
210
|
+
...props
|
|
211
|
+
}: React.ComponentProps<typeof DropdownMenuShortcut>) {
|
|
212
|
+
return (
|
|
213
|
+
<DropdownMenuShortcut
|
|
214
|
+
data-slot="menubar-shortcut"
|
|
215
|
+
className={cn(
|
|
216
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
|
|
217
|
+
className,
|
|
218
|
+
)}
|
|
219
|
+
{...props}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function MenubarSub({
|
|
225
|
+
...props
|
|
226
|
+
}: React.ComponentProps<typeof DropdownMenuSub>) {
|
|
227
|
+
return <DropdownMenuSub data-slot="menubar-sub" {...props} />;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function MenubarSubTrigger({
|
|
231
|
+
className,
|
|
232
|
+
inset,
|
|
233
|
+
...props
|
|
234
|
+
}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
|
|
235
|
+
inset?: boolean;
|
|
236
|
+
}) {
|
|
237
|
+
return (
|
|
238
|
+
<DropdownMenuSubTrigger
|
|
239
|
+
data-slot="menubar-sub-trigger"
|
|
240
|
+
data-inset={inset}
|
|
241
|
+
className={cn(
|
|
242
|
+
"gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
243
|
+
className,
|
|
244
|
+
)}
|
|
245
|
+
{...props}
|
|
246
|
+
/>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function MenubarSubContent({
|
|
251
|
+
className,
|
|
252
|
+
...props
|
|
253
|
+
}: React.ComponentProps<typeof DropdownMenuSubContent>) {
|
|
254
|
+
return (
|
|
255
|
+
<DropdownMenuSubContent
|
|
256
|
+
data-slot="menubar-sub-content"
|
|
257
|
+
className={cn(
|
|
258
|
+
"min-w-32 rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
259
|
+
className,
|
|
260
|
+
)}
|
|
261
|
+
{...props}
|
|
262
|
+
/>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export {
|
|
267
|
+
Menubar,
|
|
268
|
+
MenubarCheckboxItem,
|
|
269
|
+
MenubarContent,
|
|
270
|
+
MenubarGroup,
|
|
271
|
+
MenubarItem,
|
|
272
|
+
MenubarLabel,
|
|
273
|
+
MenubarMenu,
|
|
274
|
+
MenubarPortal,
|
|
275
|
+
MenubarRadioGroup,
|
|
276
|
+
MenubarRadioItem,
|
|
277
|
+
MenubarSeparator,
|
|
278
|
+
MenubarShortcut,
|
|
279
|
+
MenubarSub,
|
|
280
|
+
MenubarSubContent,
|
|
281
|
+
MenubarSubTrigger,
|
|
282
|
+
MenubarTrigger,
|
|
283
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
2
|
+
import { NavigationMenu as NavigationMenuPrimitive } from "@base-ui/react/navigation-menu";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
5
|
+
|
|
6
|
+
function NavigationMenu({
|
|
7
|
+
align = "start",
|
|
8
|
+
className,
|
|
9
|
+
children,
|
|
10
|
+
...props
|
|
11
|
+
}: NavigationMenuPrimitive.Root.Props &
|
|
12
|
+
Pick<NavigationMenuPrimitive.Positioner.Props, "align">) {
|
|
13
|
+
return (
|
|
14
|
+
<NavigationMenuPrimitive.Root
|
|
15
|
+
data-slot="navigation-menu"
|
|
16
|
+
className={cn(
|
|
17
|
+
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
<NavigationMenuPositioner align={align} />
|
|
24
|
+
</NavigationMenuPrimitive.Root>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function NavigationMenuList({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.List>) {
|
|
32
|
+
return (
|
|
33
|
+
<NavigationMenuPrimitive.List
|
|
34
|
+
data-slot="navigation-menu-list"
|
|
35
|
+
className={cn(
|
|
36
|
+
"group flex flex-1 list-none items-center justify-center gap-0",
|
|
37
|
+
className,
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function NavigationMenuItem({
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Item>) {
|
|
48
|
+
return (
|
|
49
|
+
<NavigationMenuPrimitive.Item
|
|
50
|
+
data-slot="navigation-menu-item"
|
|
51
|
+
className={cn("relative", className)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const navigationMenuTriggerStyle = cva(
|
|
58
|
+
"group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted",
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
function NavigationMenuTrigger({
|
|
62
|
+
className,
|
|
63
|
+
children,
|
|
64
|
+
...props
|
|
65
|
+
}: NavigationMenuPrimitive.Trigger.Props) {
|
|
66
|
+
return (
|
|
67
|
+
<NavigationMenuPrimitive.Trigger
|
|
68
|
+
data-slot="navigation-menu-trigger"
|
|
69
|
+
className={cn(navigationMenuTriggerStyle(), "group", className)}
|
|
70
|
+
{...props}
|
|
71
|
+
>
|
|
72
|
+
{children}{" "}
|
|
73
|
+
<ChevronDownIcon
|
|
74
|
+
className="relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
/>
|
|
77
|
+
</NavigationMenuPrimitive.Trigger>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function NavigationMenuContent({
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
}: NavigationMenuPrimitive.Content.Props) {
|
|
85
|
+
return (
|
|
86
|
+
<NavigationMenuPrimitive.Content
|
|
87
|
+
data-slot="navigation-menu-content"
|
|
88
|
+
className={cn(
|
|
89
|
+
"data-ending-style:data-activation-direction=left:translate-x-[50%] data-ending-style:data-activation-direction=right:translate-x-[-50%] data-starting-style:data-activation-direction=left:translate-x-[-50%] data-starting-style:data-activation-direction=right:translate-x-[50%] h-full w-auto p-1 transition-[opacity,transform,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300 data-ending-style:opacity-0 data-starting-style:opacity-0 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 data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95",
|
|
90
|
+
className,
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function NavigationMenuPositioner({
|
|
98
|
+
className,
|
|
99
|
+
side = "bottom",
|
|
100
|
+
sideOffset = 8,
|
|
101
|
+
align = "start",
|
|
102
|
+
alignOffset = 0,
|
|
103
|
+
...props
|
|
104
|
+
}: NavigationMenuPrimitive.Positioner.Props) {
|
|
105
|
+
return (
|
|
106
|
+
<NavigationMenuPrimitive.Portal>
|
|
107
|
+
<NavigationMenuPrimitive.Positioner
|
|
108
|
+
side={side}
|
|
109
|
+
sideOffset={sideOffset}
|
|
110
|
+
align={align}
|
|
111
|
+
alignOffset={alignOffset}
|
|
112
|
+
className={cn(
|
|
113
|
+
"isolate z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0",
|
|
114
|
+
className,
|
|
115
|
+
)}
|
|
116
|
+
{...props}
|
|
117
|
+
>
|
|
118
|
+
<NavigationMenuPrimitive.Popup className="data-[ending-style]:easing-[ease] xs:w-(--popup-width) relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) rounded-lg bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 transition-[opacity,transform,width,height,scale,translate] duration-[0.35s] ease-[cubic-bezier(0.22,1,0.36,1)] outline-none data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150 data-starting-style:scale-90 data-starting-style:opacity-0">
|
|
119
|
+
<NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
|
|
120
|
+
</NavigationMenuPrimitive.Popup>
|
|
121
|
+
</NavigationMenuPrimitive.Positioner>
|
|
122
|
+
</NavigationMenuPrimitive.Portal>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function NavigationMenuLink({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: NavigationMenuPrimitive.Link.Props) {
|
|
130
|
+
return (
|
|
131
|
+
<NavigationMenuPrimitive.Link
|
|
132
|
+
data-slot="navigation-menu-link"
|
|
133
|
+
className={cn(
|
|
134
|
+
"flex items-center gap-2 rounded-lg p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-md data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted [&_svg:not([class*='size-'])]:size-4",
|
|
135
|
+
className,
|
|
136
|
+
)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function NavigationMenuIndicator({
|
|
143
|
+
className,
|
|
144
|
+
...props
|
|
145
|
+
}: React.ComponentPropsWithRef<typeof NavigationMenuPrimitive.Icon>) {
|
|
146
|
+
return (
|
|
147
|
+
<NavigationMenuPrimitive.Icon
|
|
148
|
+
data-slot="navigation-menu-indicator"
|
|
149
|
+
className={cn(
|
|
150
|
+
"top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in",
|
|
151
|
+
className,
|
|
152
|
+
)}
|
|
153
|
+
{...props}
|
|
154
|
+
>
|
|
155
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
|
|
156
|
+
</NavigationMenuPrimitive.Icon>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export {
|
|
161
|
+
NavigationMenu,
|
|
162
|
+
NavigationMenuContent,
|
|
163
|
+
NavigationMenuIndicator,
|
|
164
|
+
NavigationMenuItem,
|
|
165
|
+
NavigationMenuLink,
|
|
166
|
+
NavigationMenuList,
|
|
167
|
+
NavigationMenuPositioner,
|
|
168
|
+
NavigationMenuTrigger,
|
|
169
|
+
navigationMenuTriggerStyle,
|
|
170
|
+
};
|