@ponti-studios/ui 0.3.0 → 0.4.1
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 +14 -0
- package/package.json +45 -24
- 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/index.ts +1 -1
- package/src/native/index.ts +11 -0
- package/src/native/make-styles.ts +32 -0
- package/src/native/shadows.ts +38 -0
- package/src/native/use-theme-colors.ts +19 -0
- package/src/styles.css +154 -66
- package/src/tokens/chart-colors.stories.tsx +189 -0
- package/src/tokens/color-systems.stories.tsx +21 -3
- package/src/tokens/css-vars.ts +15 -0
- package/src/tokens/foundations.stories.tsx +66 -16
- package/src/tokens/generated/dark.colors.generated.ts +24 -50
- package/src/tokens/generated/dark.css +24 -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 +24 -50
- package/src/tokens/generated/light.css +24 -48
- package/src/tokens/index.ts +12 -15
- package/src/tokens/layout.stories.tsx +40 -3
- package/src/tokens.css +3 -0
- package/dist/index.js +0 -2508
- package/dist/index.js.map +0 -1
|
@@ -5,14 +5,26 @@ import * as React from "react";
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "../../lib/utils";
|
|
7
7
|
|
|
8
|
-
type SliderProps = Omit<
|
|
8
|
+
type SliderProps = Omit<
|
|
9
|
+
React.ComponentProps<typeof SliderPrimitive.Root>,
|
|
10
|
+
"onValueChange" | "value" | "defaultValue"
|
|
11
|
+
> & {
|
|
9
12
|
value?: number[];
|
|
10
13
|
defaultValue?: number[];
|
|
11
14
|
onValueChange?: (value: number[]) => void;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
const Slider = React.forwardRef<HTMLDivElement, SliderProps>(
|
|
15
|
-
(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
className,
|
|
21
|
+
onValueChange,
|
|
22
|
+
"aria-label": ariaLabel,
|
|
23
|
+
"aria-labelledby": ariaLabelledby,
|
|
24
|
+
...props
|
|
25
|
+
},
|
|
26
|
+
ref,
|
|
27
|
+
) => (
|
|
16
28
|
<SliderPrimitive.Root
|
|
17
29
|
ref={ref}
|
|
18
30
|
className={cn("relative flex w-full touch-none items-center select-none", className)}
|
|
@@ -20,12 +32,12 @@ const Slider = React.forwardRef<HTMLDivElement, SliderProps>(
|
|
|
20
32
|
onValueChange={(value) => onValueChange?.(Array.isArray(value) ? [...value] : [value])}
|
|
21
33
|
>
|
|
22
34
|
<SliderPrimitive.Track className="bg-muted relative h-2 w-full grow overflow-hidden rounded-full">
|
|
23
|
-
<SliderPrimitive.Indicator className="bg-
|
|
35
|
+
<SliderPrimitive.Indicator className="bg-primary absolute h-full" />
|
|
24
36
|
</SliderPrimitive.Track>
|
|
25
37
|
<SliderPrimitive.Thumb
|
|
26
38
|
aria-label={ariaLabel ?? "Slider"}
|
|
27
39
|
aria-labelledby={ariaLabelledby}
|
|
28
|
-
className="border-border focus-visible:border-ring focus-visible:bg-
|
|
40
|
+
className="border-border focus-visible:border-ring focus-visible:bg-primary focus-visible:ring-ring bg-background block h-6 w-6 rounded-full border shadow-sm ring-1 ring-black/5 transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"
|
|
29
41
|
/>
|
|
30
42
|
</SliderPrimitive.Root>
|
|
31
43
|
),
|
|
@@ -32,7 +32,7 @@ function Stepper({
|
|
|
32
32
|
const atMax = value >= max;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<div className={cn("flex items-center rounded-lg border
|
|
35
|
+
<div className={cn("border-input bg-muted flex items-center rounded-lg border", className)}>
|
|
36
36
|
<Button
|
|
37
37
|
type="button"
|
|
38
38
|
variant="ghost"
|
|
@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
|
7
7
|
<textarea
|
|
8
8
|
data-slot="textarea"
|
|
9
9
|
className={cn(
|
|
10
|
-
"placeholder:text-muted-foreground aria-invalid:ring-destructive/20 aria-invalid:border-destructive focus-visible:ring-ring flex field-sizing-content min-h-16 w-full rounded-md border
|
|
10
|
+
"placeholder:text-muted-foreground aria-invalid:ring-destructive/20 aria-invalid:border-destructive focus-visible:ring-ring border-input flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
11
11
|
className,
|
|
12
12
|
)}
|
|
13
13
|
{...props}
|
|
@@ -22,7 +22,7 @@ export function SectionIntro({ eyebrow, title, description, actions }: SectionIn
|
|
|
22
22
|
) : null}
|
|
23
23
|
<div className="space-y-3">
|
|
24
24
|
<h1 className="text-title-2 text-foreground font-semibold tracking-tight">{title}</h1>
|
|
25
|
-
{description ? <p className="text-
|
|
25
|
+
{description ? <p className="text-muted-foreground text-sm">{description}</p> : null}
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
{actions ? <div className="shrink-0">{actions}</div> : null}
|
|
@@ -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
|
);
|