@camox/ui 0.6.0 → 0.7.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/package.json +5 -47
- package/src/components/alert-dialog.tsx +62 -35
- package/src/components/alert.tsx +18 -5
- package/src/components/avatar.tsx +8 -11
- package/src/components/badge.tsx +26 -16
- package/src/components/breadcrumb.tsx +26 -25
- package/src/components/button-group.tsx +23 -23
- package/src/components/button.tsx +26 -26
- package/src/components/command.tsx +53 -48
- package/src/components/dialog.tsx +40 -32
- package/src/components/dropdown-menu.tsx +137 -107
- package/src/components/input-group.tsx +146 -0
- package/src/components/input.tsx +4 -5
- package/src/components/kbd.tsx +1 -3
- package/src/components/label.tsx +2 -5
- package/src/components/panel.tsx +56 -25
- package/src/components/popover.tsx +55 -15
- package/src/components/select.tsx +86 -67
- package/src/components/separator.tsx +4 -11
- package/src/components/sheet.tsx +32 -37
- package/src/components/skeleton.tsx +1 -1
- package/src/components/switch.tsx +11 -7
- package/src/components/tabs.tsx +37 -16
- package/src/components/textarea.tsx +2 -4
- package/src/components/toggle.tsx +12 -14
- package/src/components/tooltip.tsx +29 -32
- package/src/styles/globals.css +1 -1
- package/src/components/accordion.tsx +0 -58
- package/src/components/checkbox.tsx +0 -27
- package/src/components/control-group.tsx +0 -58
- package/src/components/frame.tsx +0 -146
- package/src/components/input-base.tsx +0 -189
- package/src/components/resizable.tsx +0 -46
- package/src/hooks/use-mobile.ts +0 -19
package/src/components/panel.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
|
|
4
3
|
import { cn } from "../lib/utils";
|
|
@@ -6,15 +5,26 @@ import { cn } from "../lib/utils";
|
|
|
6
5
|
export const Panel = ({
|
|
7
6
|
children,
|
|
8
7
|
className,
|
|
9
|
-
|
|
8
|
+
render,
|
|
10
9
|
...props
|
|
11
|
-
}: React.ComponentProps<"section"> & {
|
|
12
|
-
|
|
10
|
+
}: Omit<React.ComponentProps<"section">, "children"> & {
|
|
11
|
+
render?: React.ReactElement<{ className?: string }>;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
13
|
}) => {
|
|
14
|
-
|
|
14
|
+
if (render) {
|
|
15
|
+
return React.cloneElement(render, {
|
|
16
|
+
...props,
|
|
17
|
+
className: cn(
|
|
18
|
+
"flex flex-col bg-background border-2 border-border shadow-xl rounded-lg overflow-hidden",
|
|
19
|
+
className,
|
|
20
|
+
render.props.className,
|
|
21
|
+
),
|
|
22
|
+
children,
|
|
23
|
+
} as Record<string, unknown>);
|
|
24
|
+
}
|
|
15
25
|
|
|
16
26
|
return (
|
|
17
|
-
<
|
|
27
|
+
<section
|
|
18
28
|
className={cn(
|
|
19
29
|
"flex flex-col bg-background border-2 border-border shadow-xl rounded-lg overflow-hidden",
|
|
20
30
|
className,
|
|
@@ -22,57 +32,78 @@ export const Panel = ({
|
|
|
22
32
|
{...props}
|
|
23
33
|
>
|
|
24
34
|
{children}
|
|
25
|
-
</
|
|
35
|
+
</section>
|
|
26
36
|
);
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
export const PanelHeader = ({
|
|
30
40
|
children,
|
|
31
41
|
className,
|
|
32
|
-
|
|
42
|
+
render,
|
|
33
43
|
...props
|
|
34
|
-
}: React.ComponentProps<"header"> & {
|
|
35
|
-
|
|
44
|
+
}: Omit<React.ComponentProps<"header">, "children"> & {
|
|
45
|
+
render?: React.ReactElement<{ className?: string }>;
|
|
46
|
+
children?: React.ReactNode;
|
|
36
47
|
}) => {
|
|
37
|
-
|
|
48
|
+
if (render) {
|
|
49
|
+
return React.cloneElement(render, {
|
|
50
|
+
...props,
|
|
51
|
+
className: cn("p-4 border-b-2 border-border", className, render.props.className),
|
|
52
|
+
children,
|
|
53
|
+
} as Record<string, unknown>);
|
|
54
|
+
}
|
|
38
55
|
|
|
39
56
|
return (
|
|
40
|
-
<
|
|
57
|
+
<header className={cn("p-4 border-b-2 border-border", className)} {...props}>
|
|
41
58
|
{children}
|
|
42
|
-
</
|
|
59
|
+
</header>
|
|
43
60
|
);
|
|
44
61
|
};
|
|
45
62
|
|
|
46
63
|
export const PanelTitle = ({
|
|
47
64
|
children,
|
|
48
65
|
className,
|
|
49
|
-
|
|
66
|
+
render,
|
|
50
67
|
...props
|
|
51
|
-
}: React.ComponentProps<"h3"> & {
|
|
52
|
-
|
|
68
|
+
}: Omit<React.ComponentProps<"h3">, "children"> & {
|
|
69
|
+
render?: React.ReactElement<{ className?: string }>;
|
|
70
|
+
children?: React.ReactNode;
|
|
53
71
|
}) => {
|
|
54
|
-
|
|
72
|
+
if (render) {
|
|
73
|
+
return React.cloneElement(render, {
|
|
74
|
+
...props,
|
|
75
|
+
className: cn("text-lg leading-none font-semibold", className, render.props.className),
|
|
76
|
+
children,
|
|
77
|
+
} as Record<string, unknown>);
|
|
78
|
+
}
|
|
55
79
|
|
|
56
80
|
return (
|
|
57
|
-
<
|
|
81
|
+
<h3 className={cn("text-lg leading-none font-semibold", className)} {...props}>
|
|
58
82
|
{children}
|
|
59
|
-
</
|
|
83
|
+
</h3>
|
|
60
84
|
);
|
|
61
85
|
};
|
|
62
86
|
|
|
63
87
|
export const PanelContent = ({
|
|
64
88
|
children,
|
|
65
89
|
className,
|
|
66
|
-
|
|
90
|
+
render,
|
|
67
91
|
...props
|
|
68
|
-
}: React.ComponentProps<"
|
|
69
|
-
|
|
92
|
+
}: Omit<React.ComponentProps<"main">, "children"> & {
|
|
93
|
+
render?: React.ReactElement<{ className?: string }>;
|
|
94
|
+
children?: React.ReactNode;
|
|
70
95
|
}) => {
|
|
71
|
-
|
|
96
|
+
if (render) {
|
|
97
|
+
return React.cloneElement(render, {
|
|
98
|
+
...props,
|
|
99
|
+
className: cn("grow overflow-auto", className, render.props.className),
|
|
100
|
+
children,
|
|
101
|
+
} as Record<string, unknown>);
|
|
102
|
+
}
|
|
72
103
|
|
|
73
104
|
return (
|
|
74
|
-
<
|
|
105
|
+
<main className={cn("grow overflow-auto", className)} {...props}>
|
|
75
106
|
{children}
|
|
76
|
-
</
|
|
107
|
+
</main>
|
|
77
108
|
);
|
|
78
109
|
};
|
|
@@ -1,40 +1,80 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
5
|
|
|
6
|
-
function Popover({ ...props }:
|
|
6
|
+
function Popover({ ...props }: PopoverPrimitive.Root.Props) {
|
|
7
7
|
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function PopoverTrigger({ ...props }:
|
|
10
|
+
function PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {
|
|
11
11
|
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function PopoverContent({
|
|
15
15
|
className,
|
|
16
16
|
align = "center",
|
|
17
|
+
alignOffset = 0,
|
|
18
|
+
side = "bottom",
|
|
17
19
|
sideOffset = 4,
|
|
20
|
+
anchor,
|
|
18
21
|
...props
|
|
19
|
-
}:
|
|
22
|
+
}: PopoverPrimitive.Popup.Props &
|
|
23
|
+
Pick<
|
|
24
|
+
PopoverPrimitive.Positioner.Props,
|
|
25
|
+
"align" | "alignOffset" | "side" | "sideOffset" | "anchor"
|
|
26
|
+
>) {
|
|
20
27
|
return (
|
|
21
28
|
<PopoverPrimitive.Portal>
|
|
22
|
-
<PopoverPrimitive.
|
|
23
|
-
data-slot="popover-content"
|
|
29
|
+
<PopoverPrimitive.Positioner
|
|
24
30
|
align={align}
|
|
31
|
+
alignOffset={alignOffset}
|
|
32
|
+
side={side}
|
|
25
33
|
sideOffset={sideOffset}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
anchor={anchor}
|
|
35
|
+
className="isolate z-50"
|
|
36
|
+
>
|
|
37
|
+
<PopoverPrimitive.Popup
|
|
38
|
+
data-slot="popover-content"
|
|
39
|
+
className={cn(
|
|
40
|
+
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden 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 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
</PopoverPrimitive.Positioner>
|
|
32
46
|
</PopoverPrimitive.Portal>
|
|
33
47
|
);
|
|
34
48
|
}
|
|
35
49
|
|
|
36
|
-
function
|
|
37
|
-
return
|
|
50
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
data-slot="popover-header"
|
|
54
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
|
|
61
|
+
return (
|
|
62
|
+
<PopoverPrimitive.Title
|
|
63
|
+
data-slot="popover-title"
|
|
64
|
+
className={cn("font-medium", className)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props) {
|
|
71
|
+
return (
|
|
72
|
+
<PopoverPrimitive.Description
|
|
73
|
+
data-slot="popover-description"
|
|
74
|
+
className={cn("text-muted-foreground", className)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
38
78
|
}
|
|
39
79
|
|
|
40
|
-
export { Popover,
|
|
80
|
+
export { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger };
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
2
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
9
|
-
}
|
|
7
|
+
const Select = SelectPrimitive.Root;
|
|
10
8
|
|
|
11
|
-
function SelectGroup({ ...props }:
|
|
12
|
-
return
|
|
9
|
+
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
|
|
10
|
+
return (
|
|
11
|
+
<SelectPrimitive.Group
|
|
12
|
+
data-slot="select-group"
|
|
13
|
+
className={cn("scroll-my-1 p-1", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
function SelectValue({ ...props }:
|
|
16
|
-
return
|
|
19
|
+
function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
|
|
20
|
+
return (
|
|
21
|
+
<SelectPrimitive.Value
|
|
22
|
+
data-slot="select-value"
|
|
23
|
+
className={cn("flex flex-1 text-left", className)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
function SelectTrigger({
|
|
@@ -21,7 +31,7 @@ function SelectTrigger({
|
|
|
21
31
|
size = "default",
|
|
22
32
|
children,
|
|
23
33
|
...props
|
|
24
|
-
}:
|
|
34
|
+
}: SelectPrimitive.Trigger.Props & {
|
|
25
35
|
size?: "sm" | "default";
|
|
26
36
|
}) {
|
|
27
37
|
return (
|
|
@@ -29,16 +39,15 @@ function SelectTrigger({
|
|
|
29
39
|
data-slot="select-trigger"
|
|
30
40
|
data-size={size}
|
|
31
41
|
className={cn(
|
|
32
|
-
|
|
33
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
42
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
34
43
|
className,
|
|
35
44
|
)}
|
|
36
45
|
{...props}
|
|
37
46
|
>
|
|
38
47
|
{children}
|
|
39
|
-
<SelectPrimitive.Icon
|
|
40
|
-
<ChevronDownIcon className="size-4
|
|
41
|
-
|
|
48
|
+
<SelectPrimitive.Icon
|
|
49
|
+
render={<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4" />}
|
|
50
|
+
/>
|
|
42
51
|
</SelectPrimitive.Trigger>
|
|
43
52
|
);
|
|
44
53
|
}
|
|
@@ -46,80 +55,84 @@ function SelectTrigger({
|
|
|
46
55
|
function SelectContent({
|
|
47
56
|
className,
|
|
48
57
|
children,
|
|
49
|
-
|
|
58
|
+
side = "bottom",
|
|
59
|
+
sideOffset = 4,
|
|
60
|
+
align = "center",
|
|
61
|
+
alignOffset = 0,
|
|
62
|
+
alignItemWithTrigger = true,
|
|
50
63
|
...props
|
|
51
|
-
}:
|
|
64
|
+
}: SelectPrimitive.Popup.Props &
|
|
65
|
+
Pick<
|
|
66
|
+
SelectPrimitive.Positioner.Props,
|
|
67
|
+
"align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
|
|
68
|
+
>) {
|
|
52
69
|
return (
|
|
53
70
|
<SelectPrimitive.Portal>
|
|
54
|
-
<SelectPrimitive.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)}
|
|
62
|
-
position={position}
|
|
63
|
-
{...props}
|
|
71
|
+
<SelectPrimitive.Positioner
|
|
72
|
+
side={side}
|
|
73
|
+
sideOffset={sideOffset}
|
|
74
|
+
align={align}
|
|
75
|
+
alignOffset={alignOffset}
|
|
76
|
+
alignItemWithTrigger={alignItemWithTrigger}
|
|
77
|
+
className="isolate z-50"
|
|
64
78
|
>
|
|
65
|
-
<
|
|
66
|
-
|
|
79
|
+
<SelectPrimitive.Popup
|
|
80
|
+
data-slot="select-content"
|
|
81
|
+
data-align-trigger={alignItemWithTrigger}
|
|
67
82
|
className={cn(
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
|
|
83
|
+
"relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
84
|
+
className,
|
|
71
85
|
)}
|
|
86
|
+
{...props}
|
|
72
87
|
>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
<SelectScrollUpButton />
|
|
89
|
+
<SelectPrimitive.List>{children}</SelectPrimitive.List>
|
|
90
|
+
<SelectScrollDownButton />
|
|
91
|
+
</SelectPrimitive.Popup>
|
|
92
|
+
</SelectPrimitive.Positioner>
|
|
77
93
|
</SelectPrimitive.Portal>
|
|
78
94
|
);
|
|
79
95
|
}
|
|
80
96
|
|
|
81
|
-
function SelectLabel({ className, ...props }:
|
|
97
|
+
function SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {
|
|
82
98
|
return (
|
|
83
|
-
<SelectPrimitive.
|
|
99
|
+
<SelectPrimitive.GroupLabel
|
|
84
100
|
data-slot="select-label"
|
|
85
|
-
className={cn("
|
|
101
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
86
102
|
{...props}
|
|
87
103
|
/>
|
|
88
104
|
);
|
|
89
105
|
}
|
|
90
106
|
|
|
91
|
-
function SelectItem({
|
|
92
|
-
className,
|
|
93
|
-
children,
|
|
94
|
-
...props
|
|
95
|
-
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
107
|
+
function SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {
|
|
96
108
|
return (
|
|
97
109
|
<SelectPrimitive.Item
|
|
98
110
|
data-slot="select-item"
|
|
99
111
|
className={cn(
|
|
100
|
-
"
|
|
112
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
101
113
|
className,
|
|
102
114
|
)}
|
|
103
115
|
{...props}
|
|
104
116
|
>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
<SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
|
|
118
|
+
{children}
|
|
119
|
+
</SelectPrimitive.ItemText>
|
|
120
|
+
<SelectPrimitive.ItemIndicator
|
|
121
|
+
render={
|
|
122
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
123
|
+
}
|
|
124
|
+
>
|
|
125
|
+
<CheckIcon className="pointer-events-none" />
|
|
126
|
+
</SelectPrimitive.ItemIndicator>
|
|
111
127
|
</SelectPrimitive.Item>
|
|
112
128
|
);
|
|
113
129
|
}
|
|
114
130
|
|
|
115
|
-
function SelectSeparator({
|
|
116
|
-
className,
|
|
117
|
-
...props
|
|
118
|
-
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
131
|
+
function SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {
|
|
119
132
|
return (
|
|
120
133
|
<SelectPrimitive.Separator
|
|
121
134
|
data-slot="select-separator"
|
|
122
|
-
className={cn("
|
|
135
|
+
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
|
123
136
|
{...props}
|
|
124
137
|
/>
|
|
125
138
|
);
|
|
@@ -128,30 +141,36 @@ function SelectSeparator({
|
|
|
128
141
|
function SelectScrollUpButton({
|
|
129
142
|
className,
|
|
130
143
|
...props
|
|
131
|
-
}: React.ComponentProps<typeof SelectPrimitive.
|
|
144
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
|
|
132
145
|
return (
|
|
133
|
-
<SelectPrimitive.
|
|
146
|
+
<SelectPrimitive.ScrollUpArrow
|
|
134
147
|
data-slot="select-scroll-up-button"
|
|
135
|
-
className={cn(
|
|
148
|
+
className={cn(
|
|
149
|
+
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
150
|
+
className,
|
|
151
|
+
)}
|
|
136
152
|
{...props}
|
|
137
153
|
>
|
|
138
|
-
<ChevronUpIcon
|
|
139
|
-
</SelectPrimitive.
|
|
154
|
+
<ChevronUpIcon />
|
|
155
|
+
</SelectPrimitive.ScrollUpArrow>
|
|
140
156
|
);
|
|
141
157
|
}
|
|
142
158
|
|
|
143
159
|
function SelectScrollDownButton({
|
|
144
160
|
className,
|
|
145
161
|
...props
|
|
146
|
-
}: React.ComponentProps<typeof SelectPrimitive.
|
|
162
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
|
|
147
163
|
return (
|
|
148
|
-
<SelectPrimitive.
|
|
164
|
+
<SelectPrimitive.ScrollDownArrow
|
|
149
165
|
data-slot="select-scroll-down-button"
|
|
150
|
-
className={cn(
|
|
166
|
+
className={cn(
|
|
167
|
+
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
168
|
+
className,
|
|
169
|
+
)}
|
|
151
170
|
{...props}
|
|
152
171
|
>
|
|
153
|
-
<ChevronDownIcon
|
|
154
|
-
</SelectPrimitive.
|
|
172
|
+
<ChevronDownIcon />
|
|
173
|
+
</SelectPrimitive.ScrollDownArrow>
|
|
155
174
|
);
|
|
156
175
|
}
|
|
157
176
|
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as React from "react";
|
|
1
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
3
2
|
|
|
4
3
|
import { cn } from "../lib/utils";
|
|
5
4
|
|
|
6
|
-
function Separator({
|
|
7
|
-
className,
|
|
8
|
-
orientation = "horizontal",
|
|
9
|
-
decorative = true,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
5
|
+
function Separator({ className, orientation = "horizontal", ...props }: SeparatorPrimitive.Props) {
|
|
12
6
|
return (
|
|
13
|
-
<SeparatorPrimitive
|
|
7
|
+
<SeparatorPrimitive
|
|
14
8
|
data-slot="separator"
|
|
15
|
-
decorative={decorative}
|
|
16
9
|
orientation={orientation}
|
|
17
10
|
className={cn(
|
|
18
|
-
"bg-border
|
|
11
|
+
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
19
12
|
className,
|
|
20
13
|
)}
|
|
21
14
|
{...props}
|
package/src/components/sheet.tsx
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
2
2
|
import { XIcon } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
|
+
import { Button } from "./button";
|
|
6
7
|
|
|
7
|
-
function Sheet({ ...props }:
|
|
8
|
+
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
|
|
8
9
|
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
function SheetTrigger({ ...props }:
|
|
12
|
+
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
|
|
12
13
|
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
function SheetClose({ ...props }:
|
|
16
|
+
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
|
|
16
17
|
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
function SheetPortal({ ...props }:
|
|
20
|
+
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
|
|
20
21
|
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
function SheetOverlay({
|
|
24
|
-
className,
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
24
|
+
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
|
|
27
25
|
return (
|
|
28
|
-
<SheetPrimitive.
|
|
26
|
+
<SheetPrimitive.Backdrop
|
|
29
27
|
data-slot="sheet-overlay"
|
|
30
28
|
className={cn(
|
|
31
|
-
"
|
|
29
|
+
"fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
|
|
32
30
|
className,
|
|
33
31
|
)}
|
|
34
32
|
{...props}
|
|
@@ -40,37 +38,37 @@ function SheetContent({
|
|
|
40
38
|
className,
|
|
41
39
|
children,
|
|
42
40
|
side = "right",
|
|
43
|
-
|
|
41
|
+
showCloseButton = true,
|
|
42
|
+
showOverlay = true,
|
|
44
43
|
...props
|
|
45
|
-
}:
|
|
44
|
+
}: SheetPrimitive.Popup.Props & {
|
|
46
45
|
side?: "top" | "right" | "bottom" | "left";
|
|
47
|
-
|
|
46
|
+
showCloseButton?: boolean;
|
|
47
|
+
showOverlay?: boolean;
|
|
48
48
|
}) {
|
|
49
49
|
return (
|
|
50
50
|
<SheetPortal>
|
|
51
|
-
<SheetOverlay
|
|
52
|
-
<SheetPrimitive.
|
|
51
|
+
{showOverlay && <SheetOverlay />}
|
|
52
|
+
<SheetPrimitive.Popup
|
|
53
53
|
data-slot="sheet-content"
|
|
54
|
+
data-side={side}
|
|
54
55
|
className={cn(
|
|
55
|
-
"bg-
|
|
56
|
-
side === "right" &&
|
|
57
|
-
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
58
|
-
side === "left" &&
|
|
59
|
-
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
60
|
-
side === "top" &&
|
|
61
|
-
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
62
|
-
side === "bottom" &&
|
|
63
|
-
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
56
|
+
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-300 ease-in-out data-open:duration-500 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-full data-[side=bottom]:data-starting-style:translate-y-full data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:-translate-x-full data-[side=left]:data-starting-style:-translate-x-full data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-full data-[side=right]:data-starting-style:translate-x-full data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:-translate-y-full data-[side=top]:data-starting-style:-translate-y-full data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
|
|
64
57
|
className,
|
|
65
58
|
)}
|
|
66
59
|
{...props}
|
|
67
60
|
>
|
|
68
61
|
{children}
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
{showCloseButton && (
|
|
63
|
+
<SheetPrimitive.Close
|
|
64
|
+
data-slot="sheet-close"
|
|
65
|
+
render={<Button variant="ghost" className="absolute top-4 right-4" size="icon-sm" />}
|
|
66
|
+
>
|
|
67
|
+
<XIcon />
|
|
68
|
+
<span className="sr-only">Close</span>
|
|
69
|
+
</SheetPrimitive.Close>
|
|
70
|
+
)}
|
|
71
|
+
</SheetPrimitive.Popup>
|
|
74
72
|
</SheetPortal>
|
|
75
73
|
);
|
|
76
74
|
}
|
|
@@ -95,24 +93,21 @@ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
95
93
|
);
|
|
96
94
|
}
|
|
97
95
|
|
|
98
|
-
function SheetTitle({ className, ...props }:
|
|
96
|
+
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
|
|
99
97
|
return (
|
|
100
98
|
<SheetPrimitive.Title
|
|
101
99
|
data-slot="sheet-title"
|
|
102
|
-
className={cn("text-foreground
|
|
100
|
+
className={cn("font-medium text-foreground", className)}
|
|
103
101
|
{...props}
|
|
104
102
|
/>
|
|
105
103
|
);
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
function SheetDescription({
|
|
109
|
-
className,
|
|
110
|
-
...props
|
|
111
|
-
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
106
|
+
function SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {
|
|
112
107
|
return (
|
|
113
108
|
<SheetPrimitive.Description
|
|
114
109
|
data-slot="sheet-description"
|
|
115
|
-
className={cn("text-muted-foreground
|
|
110
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
116
111
|
{...props}
|
|
117
112
|
/>
|
|
118
113
|
);
|
|
@@ -4,7 +4,7 @@ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
4
4
|
return (
|
|
5
5
|
<div
|
|
6
6
|
data-slot="skeleton"
|
|
7
|
-
className={cn("
|
|
7
|
+
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
8
8
|
{...props}
|
|
9
9
|
/>
|
|
10
10
|
);
|