@ponti-studios/ui 0.3.0 → 0.4.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/dist/index.js +70 -112
- package/dist/index.js.map +1 -1
- package/package.json +25 -23
- package/src/animations.css +92 -15
- package/src/components/data-display/accordion.tsx +15 -6
- package/src/components/data-display/filter-chip.stories.tsx +38 -0
- package/src/components/data-display/filter-chip.tsx +9 -3
- package/src/components/data-display/sort-controls.tsx +1 -1
- package/src/components/data-display/table.tsx +3 -7
- package/src/components/feedback/empty-state.tsx +16 -6
- package/src/components/feedback/file-upload-status-badge.tsx +1 -1
- package/src/components/feedback/progress.tsx +2 -2
- package/src/components/feedback/update-guard.tsx +1 -1
- package/src/components/forms/calendar.tsx +6 -3
- package/src/components/forms/field.tsx +3 -3
- package/src/components/forms/input.tsx +1 -1
- package/src/components/forms/passkey-management.tsx +2 -2
- package/src/components/forms/radio-group.tsx +1 -1
- package/src/components/forms/select.tsx +11 -4
- package/src/components/forms/slider.tsx +16 -4
- package/src/components/forms/stepper.tsx +1 -1
- package/src/components/forms/textarea.tsx +1 -1
- package/src/components/layout/section-intro.tsx +1 -1
- package/src/components/navigation/app-navigation.tsx +4 -4
- package/src/components/navigation/pagination-controls.tsx +2 -2
- package/src/components/navigation/tabs.tsx +1 -1
- package/src/components/overlays/alert-dialog.tsx +30 -8
- package/src/components/overlays/command.tsx +123 -20
- package/src/components/overlays/dialog.tsx +4 -4
- package/src/components/overlays/dropdown-menu.tsx +137 -21
- package/src/components/overlays/popover.tsx +14 -3
- package/src/components/overlays/sheet.tsx +24 -8
- package/src/components/primitives/avatar.tsx +6 -2
- package/src/components/primitives/badge.tsx +5 -2
- package/src/components/primitives/button.tsx +16 -18
- package/src/components/primitives/card.stories.tsx +2 -2
- package/src/components/primitives/card.tsx +2 -5
- package/src/constants/chart-colors.ts +2 -2
- package/src/styles.css +153 -63
- package/src/tokens/chart-colors.stories.tsx +192 -0
- package/src/tokens/color-systems.stories.tsx +21 -3
- package/src/tokens/foundations.stories.tsx +66 -16
- package/src/tokens/generated/dark.colors.generated.ts +23 -50
- package/src/tokens/generated/dark.css +23 -48
- package/src/tokens/generated/foundations.css +2 -2
- package/src/tokens/generated/foundations.generated.ts +14 -6
- package/src/tokens/generated/light.colors.generated.ts +23 -50
- package/src/tokens/generated/light.css +23 -48
- package/src/tokens/index.ts +14 -9
- package/src/tokens/layout.stories.tsx +40 -3
|
@@ -72,10 +72,10 @@ export function AppNavigation({
|
|
|
72
72
|
...linkProps,
|
|
73
73
|
...(linkProp === "to" ? { to: href } : { href }),
|
|
74
74
|
className: brand
|
|
75
|
-
? "inline-flex min-h-
|
|
75
|
+
? "inline-flex min-h-9 shrink-0 items-center rounded-md px-3 py-2 text-sm font-medium"
|
|
76
76
|
: variant
|
|
77
|
-
? "inline-flex min-h-
|
|
78
|
-
: "inline-flex min-h-
|
|
77
|
+
? "inline-flex min-h-9 shrink-0 items-center justify-center rounded-md px-3 py-2 text-sm font-medium"
|
|
78
|
+
: "inline-flex min-h-9 shrink-0 items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-muted hover:text-muted-foreground",
|
|
79
79
|
"aria-current": active ? "page" : undefined,
|
|
80
80
|
"data-variant": variant,
|
|
81
81
|
},
|
|
@@ -83,7 +83,7 @@ export function AppNavigation({
|
|
|
83
83
|
);
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<header className="sticky top-0 z-50 flex w-full justify-center border-b
|
|
86
|
+
<header className="bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex w-full justify-center border-b px-4 backdrop-blur">
|
|
87
87
|
<nav className="w-full max-w-7xl" aria-label={ariaLabel}>
|
|
88
88
|
<div className="flex min-h-14 items-center justify-between gap-6">
|
|
89
89
|
<div className="flex min-w-0 items-center">
|
|
@@ -19,7 +19,7 @@ export function PaginationControls({
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<div className="text-
|
|
22
|
+
<div className="text-muted-foreground flex items-center justify-end gap-2 text-sm">
|
|
23
23
|
<Button
|
|
24
24
|
type="button"
|
|
25
25
|
variant="outline"
|
|
@@ -31,7 +31,7 @@ export function PaginationControls({
|
|
|
31
31
|
<ChevronLeft className="size-4" aria-hidden />
|
|
32
32
|
Previous
|
|
33
33
|
</Button>
|
|
34
|
-
<span className="text-
|
|
34
|
+
<span className="text-foreground text-xs">
|
|
35
35
|
Page {currentPage + 1} of {totalPages}
|
|
36
36
|
</span>
|
|
37
37
|
<Button
|
|
@@ -38,7 +38,7 @@ function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPr
|
|
|
38
38
|
<TabsPrimitive.Panel
|
|
39
39
|
data-slot="tabs-content"
|
|
40
40
|
className={cn(
|
|
41
|
-
"focus-visible:bg-
|
|
41
|
+
"focus-visible:bg-muted/10 mt-2 rounded-md focus-visible:border focus-visible:outline-none",
|
|
42
42
|
className,
|
|
43
43
|
)}
|
|
44
44
|
{...props}
|
|
@@ -7,9 +7,14 @@ import { buttonVariants } from "../primitives/button";
|
|
|
7
7
|
const AlertDialog = AlertDialogPrimitive.Root;
|
|
8
8
|
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
9
9
|
|
|
10
|
-
const AlertDialogPortal = ({
|
|
10
|
+
const AlertDialogPortal = ({
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) => (
|
|
11
14
|
<AlertDialogPrimitive.Portal {...props}>
|
|
12
|
-
<div className="fixed inset-0 z-50 flex items-end justify-center sm:items-center">
|
|
15
|
+
<div className="fixed inset-0 z-50 flex items-end justify-center sm:items-center">
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
13
18
|
</AlertDialogPrimitive.Portal>
|
|
14
19
|
);
|
|
15
20
|
|
|
@@ -20,7 +25,7 @@ const AlertDialogOverlay = React.forwardRef<
|
|
|
20
25
|
<AlertDialogPrimitive.Backdrop
|
|
21
26
|
ref={ref}
|
|
22
27
|
className={cn(
|
|
23
|
-
"
|
|
28
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/80 transition-opacity",
|
|
24
29
|
className,
|
|
25
30
|
)}
|
|
26
31
|
{...props}
|
|
@@ -36,7 +41,7 @@ const AlertDialogContent = React.forwardRef<
|
|
|
36
41
|
<AlertDialogPrimitive.Popup
|
|
37
42
|
ref={ref}
|
|
38
43
|
className={cn(
|
|
39
|
-
"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0
|
|
44
|
+
"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 sm:data-open:slide-in-from-bottom-0 fixed bottom-0 z-50 grid w-full max-w-lg gap-6 rounded-t-xl border p-4 outline-none sm:top-[50%] sm:right-auto sm:bottom-auto sm:left-[50%] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl sm:p-6",
|
|
40
45
|
className,
|
|
41
46
|
)}
|
|
42
47
|
{...props}
|
|
@@ -49,21 +54,34 @@ function AlertDialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDiv
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
function AlertDialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
52
|
-
return
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
className={cn("flex flex-col-reverse gap-3 sm:flex-row sm:justify-end", className)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
const AlertDialogTitle = React.forwardRef<
|
|
56
66
|
React.ComponentRef<typeof AlertDialogPrimitive.Title>,
|
|
57
67
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
58
68
|
>(({ className, ...props }, ref) => (
|
|
59
|
-
<AlertDialogPrimitive.Title
|
|
69
|
+
<AlertDialogPrimitive.Title
|
|
70
|
+
ref={ref}
|
|
71
|
+
className={cn("text-lg font-semibold tracking-tight", className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
60
74
|
));
|
|
61
75
|
|
|
62
76
|
const AlertDialogDescription = React.forwardRef<
|
|
63
77
|
React.ComponentRef<typeof AlertDialogPrimitive.Description>,
|
|
64
78
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
65
79
|
>(({ className, ...props }, ref) => (
|
|
66
|
-
<AlertDialogPrimitive.Description
|
|
80
|
+
<AlertDialogPrimitive.Description
|
|
81
|
+
ref={ref}
|
|
82
|
+
className={cn("text-muted-foreground max-w-prose text-sm", className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
67
85
|
));
|
|
68
86
|
|
|
69
87
|
const AlertDialogAction = React.forwardRef<
|
|
@@ -77,7 +95,11 @@ const AlertDialogCancel = React.forwardRef<
|
|
|
77
95
|
React.ComponentRef<typeof AlertDialogPrimitive.Close>,
|
|
78
96
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Close>
|
|
79
97
|
>(({ className, ...props }, ref) => (
|
|
80
|
-
<AlertDialogPrimitive.Close
|
|
98
|
+
<AlertDialogPrimitive.Close
|
|
99
|
+
ref={ref}
|
|
100
|
+
className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
81
103
|
));
|
|
82
104
|
|
|
83
105
|
export {
|
|
@@ -4,26 +4,59 @@ import * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog";
|
|
6
6
|
|
|
7
|
-
function Command({
|
|
7
|
+
function Command({
|
|
8
|
+
className,
|
|
9
|
+
children,
|
|
10
|
+
...props
|
|
11
|
+
}: Omit<React.ComponentProps<typeof CommandPrimitive.Root<string>>, "className"> & {
|
|
12
|
+
className?: string;
|
|
13
|
+
}) {
|
|
8
14
|
return (
|
|
9
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
data-slot="command"
|
|
17
|
+
className={`bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md ${className ?? ""}`}
|
|
18
|
+
>
|
|
10
19
|
<CommandPrimitive.Root {...props}>{children}</CommandPrimitive.Root>
|
|
11
20
|
</div>
|
|
12
21
|
);
|
|
13
22
|
}
|
|
14
23
|
|
|
15
|
-
function CommandDialog({
|
|
24
|
+
function CommandDialog({
|
|
25
|
+
title = "Command Palette",
|
|
26
|
+
description = "Search for a command to run...",
|
|
27
|
+
children,
|
|
28
|
+
showCloseButton = true,
|
|
29
|
+
...props
|
|
30
|
+
}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
31
|
+
title?: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
showCloseButton?: boolean;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}) {
|
|
16
36
|
return (
|
|
17
37
|
<Dialog {...props}>
|
|
18
|
-
<DialogHeader className="sr-only"
|
|
19
|
-
|
|
38
|
+
<DialogHeader className="sr-only">
|
|
39
|
+
<DialogTitle>{title}</DialogTitle>
|
|
40
|
+
<DialogDescription>{description}</DialogDescription>
|
|
41
|
+
</DialogHeader>
|
|
42
|
+
<DialogContent className="overflow-hidden p-0" showCloseButton={showCloseButton}>
|
|
43
|
+
<Command>{children}</Command>
|
|
44
|
+
</DialogContent>
|
|
20
45
|
</Dialog>
|
|
21
46
|
);
|
|
22
47
|
}
|
|
23
48
|
|
|
24
|
-
type CommandInputProps = React.ComponentProps<typeof CommandPrimitive.Input> & {
|
|
25
|
-
|
|
26
|
-
|
|
49
|
+
type CommandInputProps = React.ComponentProps<typeof CommandPrimitive.Input> & {
|
|
50
|
+
onValueChange?: (value: string) => void;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function CommandInput({
|
|
54
|
+
className,
|
|
55
|
+
onValueChange,
|
|
56
|
+
onChange,
|
|
57
|
+
"aria-label": ariaLabel = "Search commands",
|
|
58
|
+
...props
|
|
59
|
+
}: CommandInputProps) {
|
|
27
60
|
return (
|
|
28
61
|
<div data-slot="command-input-wrapper" className="flex h-9 items-center gap-2 border-b px-3">
|
|
29
62
|
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
@@ -31,7 +64,10 @@ function CommandInput({ className, onValueChange, onChange, "aria-label": ariaLa
|
|
|
31
64
|
data-slot="command-input"
|
|
32
65
|
aria-label={ariaLabel}
|
|
33
66
|
className={`placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 ${className ?? ""}`}
|
|
34
|
-
onChange={(event) => {
|
|
67
|
+
onChange={(event) => {
|
|
68
|
+
onChange?.(event);
|
|
69
|
+
onValueChange?.(event.currentTarget.value);
|
|
70
|
+
}}
|
|
35
71
|
{...props}
|
|
36
72
|
/>
|
|
37
73
|
</div>
|
|
@@ -41,7 +77,13 @@ function CommandInput({ className, onValueChange, onChange, "aria-label": ariaLa
|
|
|
41
77
|
function CommandList({ children, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
42
78
|
if (typeof children === "function") {
|
|
43
79
|
return (
|
|
44
|
-
<CommandPrimitive.List
|
|
80
|
+
<CommandPrimitive.List
|
|
81
|
+
data-slot="command-list"
|
|
82
|
+
aria-label="Command results"
|
|
83
|
+
tabIndex={0}
|
|
84
|
+
className="max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto"
|
|
85
|
+
{...props}
|
|
86
|
+
>
|
|
45
87
|
{children}
|
|
46
88
|
</CommandPrimitive.List>
|
|
47
89
|
);
|
|
@@ -57,7 +99,13 @@ function CommandList({ children, ...props }: React.ComponentProps<typeof Command
|
|
|
57
99
|
|
|
58
100
|
return (
|
|
59
101
|
<div data-slot="command-list-container" className="relative">
|
|
60
|
-
<CommandPrimitive.List
|
|
102
|
+
<CommandPrimitive.List
|
|
103
|
+
data-slot="command-list"
|
|
104
|
+
aria-label="Command results"
|
|
105
|
+
tabIndex={0}
|
|
106
|
+
className="max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto"
|
|
107
|
+
{...props}
|
|
108
|
+
>
|
|
61
109
|
{listChildren}
|
|
62
110
|
</CommandPrimitive.List>
|
|
63
111
|
{emptyChildren}
|
|
@@ -66,34 +114,89 @@ function CommandList({ children, ...props }: React.ComponentProps<typeof Command
|
|
|
66
114
|
}
|
|
67
115
|
|
|
68
116
|
function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
69
|
-
return
|
|
117
|
+
return (
|
|
118
|
+
<CommandPrimitive.Empty
|
|
119
|
+
data-slot="command-empty"
|
|
120
|
+
className="py-6 text-center text-sm"
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
70
124
|
}
|
|
71
125
|
|
|
72
|
-
function CommandGroup({
|
|
126
|
+
function CommandGroup({
|
|
127
|
+
className,
|
|
128
|
+
heading,
|
|
129
|
+
children,
|
|
130
|
+
...props
|
|
131
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group> & { heading?: React.ReactNode }) {
|
|
73
132
|
return (
|
|
74
|
-
<CommandPrimitive.Group
|
|
75
|
-
|
|
133
|
+
<CommandPrimitive.Group
|
|
134
|
+
data-slot="command-group"
|
|
135
|
+
className={`text-foreground overflow-hidden p-1 ${className ?? ""}`}
|
|
136
|
+
{...props}
|
|
137
|
+
>
|
|
138
|
+
{heading ? (
|
|
139
|
+
<CommandPrimitive.GroupLabel className="text-muted-foreground px-2 py-1.5 text-xs font-medium">
|
|
140
|
+
{heading}
|
|
141
|
+
</CommandPrimitive.GroupLabel>
|
|
142
|
+
) : null}
|
|
76
143
|
{children}
|
|
77
144
|
</CommandPrimitive.Group>
|
|
78
145
|
);
|
|
79
146
|
}
|
|
80
147
|
|
|
81
|
-
type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item> & {
|
|
148
|
+
type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item> & {
|
|
149
|
+
onSelect?: () => void;
|
|
150
|
+
};
|
|
82
151
|
|
|
83
152
|
function CommandItem({ className, onSelect, onClick, ...props }: CommandItemProps) {
|
|
84
|
-
return
|
|
153
|
+
return (
|
|
154
|
+
<CommandPrimitive.Item
|
|
155
|
+
data-slot="command-item"
|
|
156
|
+
className={`data-highlighted:bg-muted data-highlighted:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 ${className ?? ""}`}
|
|
157
|
+
onClick={(event) => {
|
|
158
|
+
onClick?.(event);
|
|
159
|
+
onSelect?.();
|
|
160
|
+
}}
|
|
161
|
+
{...props}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
85
164
|
}
|
|
86
165
|
|
|
87
166
|
function CommandSeparator({ className, ...props }: React.ComponentProps<"div">) {
|
|
88
|
-
return
|
|
167
|
+
return (
|
|
168
|
+
<div
|
|
169
|
+
data-slot="command-separator"
|
|
170
|
+
aria-hidden="true"
|
|
171
|
+
className={`bg-border -mx-1 h-px ${className ?? ""}`}
|
|
172
|
+
{...props}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
89
175
|
}
|
|
90
176
|
|
|
91
177
|
function CommandShortcut(props: React.ComponentProps<"span">) {
|
|
92
|
-
return
|
|
178
|
+
return (
|
|
179
|
+
<span
|
|
180
|
+
data-slot="command-shortcut"
|
|
181
|
+
className="text-muted-foreground ml-auto text-xs tracking-widest"
|
|
182
|
+
{...props}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
93
185
|
}
|
|
94
186
|
|
|
95
187
|
function CommandListLoading(props: React.ComponentProps<"div">) {
|
|
96
188
|
return <div data-slot="command-list-loading" className="py-6 text-center text-sm" {...props} />;
|
|
97
189
|
}
|
|
98
190
|
|
|
99
|
-
export {
|
|
191
|
+
export {
|
|
192
|
+
Command,
|
|
193
|
+
CommandDialog,
|
|
194
|
+
CommandEmpty,
|
|
195
|
+
CommandGroup,
|
|
196
|
+
CommandInput,
|
|
197
|
+
CommandItem,
|
|
198
|
+
CommandList,
|
|
199
|
+
CommandListLoading,
|
|
200
|
+
CommandSeparator,
|
|
201
|
+
CommandShortcut,
|
|
202
|
+
};
|
|
@@ -63,7 +63,7 @@ function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Base
|
|
|
63
63
|
<BaseDialog.Backdrop
|
|
64
64
|
data-slot="dialog-overlay"
|
|
65
65
|
className={cn(
|
|
66
|
-
"
|
|
66
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/80 transition-opacity",
|
|
67
67
|
className,
|
|
68
68
|
)}
|
|
69
69
|
{...props}
|
|
@@ -94,7 +94,7 @@ function DialogContent({
|
|
|
94
94
|
{showCloseButton && (
|
|
95
95
|
<BaseDialog.Close
|
|
96
96
|
data-slot="dialog-close"
|
|
97
|
-
className="text-muted-foreground hover:bg-
|
|
97
|
+
className="text-muted-foreground hover:bg-muted hover:text-muted-foreground focus-visible:outline-ring absolute top-3 right-3 inline-flex size-9 items-center justify-center rounded-md border border-transparent opacity-100 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none sm:top-4 sm:right-4 [&_svg]:pointer-events-none [&_svg]:size-4.5 [&_svg]:shrink-0"
|
|
98
98
|
>
|
|
99
99
|
<XIcon />
|
|
100
100
|
<span className="sr-only">Close</span>
|
|
@@ -129,7 +129,7 @@ function DialogTitle({ className, ...props }: React.ComponentProps<typeof BaseDi
|
|
|
129
129
|
return (
|
|
130
130
|
<BaseDialog.Title
|
|
131
131
|
data-slot="dialog-title"
|
|
132
|
-
className={cn("text-lg font-semibold
|
|
132
|
+
className={cn("text-lg leading-none font-semibold tracking-tight", className)}
|
|
133
133
|
{...props}
|
|
134
134
|
/>
|
|
135
135
|
);
|
|
@@ -142,7 +142,7 @@ function DialogDescription({
|
|
|
142
142
|
return (
|
|
143
143
|
<BaseDialog.Description
|
|
144
144
|
data-slot="dialog-description"
|
|
145
|
-
className={cn("max-w-prose text-sm
|
|
145
|
+
className={cn("text-muted-foreground max-w-prose text-sm", className)}
|
|
146
146
|
{...props}
|
|
147
147
|
/>
|
|
148
148
|
);
|
|
@@ -12,11 +12,17 @@ function DropdownMenuPortal(props: React.ComponentProps<typeof DropdownMenuPrimi
|
|
|
12
12
|
return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function DropdownMenuTrigger({
|
|
15
|
+
function DropdownMenuTrigger({
|
|
16
|
+
asChild,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger> & { asChild?: boolean }) {
|
|
16
20
|
return (
|
|
17
21
|
<DropdownMenuPrimitive.Trigger
|
|
18
22
|
data-slot="dropdown-menu-trigger"
|
|
19
|
-
{...(asChild && React.isValidElement(children)
|
|
23
|
+
{...(asChild && React.isValidElement(children)
|
|
24
|
+
? { render: children as React.ReactElement }
|
|
25
|
+
: {})}
|
|
20
26
|
{...props}
|
|
21
27
|
>
|
|
22
28
|
{!asChild && children}
|
|
@@ -24,7 +30,12 @@ function DropdownMenuTrigger({ asChild, children, ...props }: React.ComponentPro
|
|
|
24
30
|
);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
function DropdownMenuContent({
|
|
33
|
+
function DropdownMenuContent({
|
|
34
|
+
className,
|
|
35
|
+
sideOffset = 4,
|
|
36
|
+
children,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Popup> & { sideOffset?: number }) {
|
|
28
39
|
return (
|
|
29
40
|
<DropdownMenuPrimitive.Portal>
|
|
30
41
|
<DropdownMenuPrimitive.Positioner sideOffset={sideOffset}>
|
|
@@ -47,54 +58,159 @@ function DropdownMenuGroup(props: React.ComponentProps<typeof DropdownMenuPrimit
|
|
|
47
58
|
return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
|
-
function DropdownMenuLabel({
|
|
51
|
-
|
|
61
|
+
function DropdownMenuLabel({
|
|
62
|
+
className,
|
|
63
|
+
inset,
|
|
64
|
+
...props
|
|
65
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.GroupLabel> & { inset?: boolean }) {
|
|
66
|
+
return (
|
|
67
|
+
<DropdownMenuPrimitive.GroupLabel
|
|
68
|
+
data-slot="dropdown-menu-label"
|
|
69
|
+
data-inset={inset}
|
|
70
|
+
className={cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
52
74
|
}
|
|
53
75
|
|
|
54
|
-
function DropdownMenuItem({
|
|
55
|
-
|
|
76
|
+
function DropdownMenuItem({
|
|
77
|
+
className,
|
|
78
|
+
inset,
|
|
79
|
+
variant = "default",
|
|
80
|
+
...props
|
|
81
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
82
|
+
inset?: boolean;
|
|
83
|
+
variant?: "default" | "destructive";
|
|
84
|
+
}) {
|
|
85
|
+
return (
|
|
86
|
+
<DropdownMenuPrimitive.Item
|
|
87
|
+
data-slot="dropdown-menu-item"
|
|
88
|
+
data-inset={inset}
|
|
89
|
+
data-variant={variant}
|
|
90
|
+
className={cn(
|
|
91
|
+
"data-highlighted:bg-muted data-highlighted:text-muted-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
56
97
|
}
|
|
57
98
|
|
|
58
|
-
function DropdownMenuCheckboxItem({
|
|
99
|
+
function DropdownMenuCheckboxItem({
|
|
100
|
+
className,
|
|
101
|
+
children,
|
|
102
|
+
checked,
|
|
103
|
+
...props
|
|
104
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
59
105
|
return (
|
|
60
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
61
|
-
|
|
106
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
107
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
108
|
+
className={cn(
|
|
109
|
+
"data-highlighted:bg-muted data-highlighted:text-muted-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
110
|
+
className,
|
|
111
|
+
)}
|
|
112
|
+
checked={checked}
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
116
|
+
<DropdownMenuPrimitive.CheckboxItemIndicator>
|
|
117
|
+
<CheckIcon className="size-4" />
|
|
118
|
+
</DropdownMenuPrimitive.CheckboxItemIndicator>
|
|
119
|
+
</span>
|
|
62
120
|
{children}
|
|
63
121
|
</DropdownMenuPrimitive.CheckboxItem>
|
|
64
122
|
);
|
|
65
123
|
}
|
|
66
124
|
|
|
67
|
-
function DropdownMenuRadioGroup(
|
|
125
|
+
function DropdownMenuRadioGroup(
|
|
126
|
+
props: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>,
|
|
127
|
+
) {
|
|
68
128
|
return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
|
|
69
129
|
}
|
|
70
130
|
|
|
71
|
-
function DropdownMenuRadioItem({
|
|
131
|
+
function DropdownMenuRadioItem({
|
|
132
|
+
className,
|
|
133
|
+
children,
|
|
134
|
+
...props
|
|
135
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
72
136
|
return (
|
|
73
|
-
<DropdownMenuPrimitive.RadioItem
|
|
74
|
-
|
|
137
|
+
<DropdownMenuPrimitive.RadioItem
|
|
138
|
+
data-slot="dropdown-menu-radio-item"
|
|
139
|
+
className={cn(
|
|
140
|
+
"data-highlighted:bg-muted data-highlighted:text-muted-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
141
|
+
className,
|
|
142
|
+
)}
|
|
143
|
+
{...props}
|
|
144
|
+
>
|
|
145
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
146
|
+
<DropdownMenuPrimitive.RadioItemIndicator>
|
|
147
|
+
<CircleIcon className="size-2 fill-current" />
|
|
148
|
+
</DropdownMenuPrimitive.RadioItemIndicator>
|
|
149
|
+
</span>
|
|
75
150
|
{children}
|
|
76
151
|
</DropdownMenuPrimitive.RadioItem>
|
|
77
152
|
);
|
|
78
153
|
}
|
|
79
154
|
|
|
80
|
-
function DropdownMenuSeparator({
|
|
81
|
-
|
|
155
|
+
function DropdownMenuSeparator({
|
|
156
|
+
className,
|
|
157
|
+
...props
|
|
158
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
159
|
+
return (
|
|
160
|
+
<DropdownMenuPrimitive.Separator
|
|
161
|
+
data-slot="dropdown-menu-separator"
|
|
162
|
+
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
);
|
|
82
166
|
}
|
|
83
167
|
|
|
84
168
|
function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
|
|
85
|
-
return
|
|
169
|
+
return (
|
|
170
|
+
<span className={cn("ml-auto text-xs tracking-widest opacity-60", className)} {...props} />
|
|
171
|
+
);
|
|
86
172
|
}
|
|
87
173
|
|
|
88
174
|
function DropdownMenuSub(props: React.ComponentProps<typeof DropdownMenuPrimitive.SubmenuRoot>) {
|
|
89
175
|
return <DropdownMenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />;
|
|
90
176
|
}
|
|
91
177
|
|
|
92
|
-
function DropdownMenuSubTrigger({
|
|
93
|
-
|
|
178
|
+
function DropdownMenuSubTrigger({
|
|
179
|
+
className,
|
|
180
|
+
inset,
|
|
181
|
+
children,
|
|
182
|
+
...props
|
|
183
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubmenuTrigger> & { inset?: boolean }) {
|
|
184
|
+
return (
|
|
185
|
+
<DropdownMenuPrimitive.SubmenuTrigger
|
|
186
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
187
|
+
data-inset={inset}
|
|
188
|
+
className={cn(
|
|
189
|
+
"data-highlighted:bg-muted data-highlighted:text-muted-foreground data-open:bg-muted data-open:text-muted-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8",
|
|
190
|
+
className,
|
|
191
|
+
)}
|
|
192
|
+
{...props}
|
|
193
|
+
>
|
|
194
|
+
{children}
|
|
195
|
+
<ChevronRightIcon className="ml-auto size-4" />
|
|
196
|
+
</DropdownMenuPrimitive.SubmenuTrigger>
|
|
197
|
+
);
|
|
94
198
|
}
|
|
95
199
|
|
|
96
|
-
function DropdownMenuSubContent({
|
|
97
|
-
|
|
200
|
+
function DropdownMenuSubContent({
|
|
201
|
+
className,
|
|
202
|
+
...props
|
|
203
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.Popup>) {
|
|
204
|
+
return (
|
|
205
|
+
<DropdownMenuPrimitive.Popup
|
|
206
|
+
data-slot="dropdown-menu-sub-content"
|
|
207
|
+
className={cn(
|
|
208
|
+
"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg outline-none",
|
|
209
|
+
className,
|
|
210
|
+
)}
|
|
211
|
+
{...props}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
98
214
|
}
|
|
99
215
|
|
|
100
216
|
export {
|
|
@@ -7,11 +7,17 @@ function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root
|
|
|
7
7
|
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function PopoverTrigger({
|
|
10
|
+
function PopoverTrigger({
|
|
11
|
+
asChild,
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger> & { asChild?: boolean }) {
|
|
11
15
|
return (
|
|
12
16
|
<PopoverPrimitive.Trigger
|
|
13
17
|
data-slot="popover-trigger"
|
|
14
|
-
{...(asChild && React.isValidElement(children)
|
|
18
|
+
{...(asChild && React.isValidElement(children)
|
|
19
|
+
? { render: children as React.ReactElement }
|
|
20
|
+
: {})}
|
|
15
21
|
{...props}
|
|
16
22
|
>
|
|
17
23
|
{!asChild && children}
|
|
@@ -35,7 +41,12 @@ function PopoverContent({
|
|
|
35
41
|
}) {
|
|
36
42
|
return (
|
|
37
43
|
<PopoverPrimitive.Portal>
|
|
38
|
-
<PopoverPrimitive.Positioner
|
|
44
|
+
<PopoverPrimitive.Positioner
|
|
45
|
+
align={align}
|
|
46
|
+
side={side}
|
|
47
|
+
sideOffset={sideOffset}
|
|
48
|
+
collisionAvoidance={avoidCollisions ? undefined : { side: "none", align: "none" }}
|
|
49
|
+
>
|
|
39
50
|
<PopoverPrimitive.Popup
|
|
40
51
|
data-slot="popover-content"
|
|
41
52
|
className={cn(
|