@vendure-io/ui 2.0.0-beta.8 → 2.0.0-rc.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/LICENSE.md +34 -0
- package/package.json +8 -6
- package/src/components/atoms/alert-dialog.tsx +1 -1
- package/src/components/atoms/alert.tsx +1 -1
- package/src/components/atoms/badge.tsx +1 -1
- package/src/components/atoms/button.tsx +2 -2
- package/src/components/atoms/card.tsx +39 -4
- package/src/components/atoms/checkbox.tsx +1 -1
- package/src/components/atoms/combobox.tsx +24 -5
- package/src/components/atoms/command.tsx +16 -5
- package/src/components/atoms/context-menu.tsx +1 -1
- package/src/components/atoms/dialog.tsx +1 -1
- package/src/components/atoms/drawer.tsx +134 -35
- package/src/components/atoms/dropdown-menu.tsx +1 -1
- package/src/components/atoms/field.tsx +2 -2
- package/src/components/atoms/input.tsx +1 -1
- package/src/components/atoms/item.tsx +4 -1
- package/src/components/atoms/menubar.tsx +1 -1
- package/src/components/atoms/native-select.tsx +1 -1
- package/src/components/atoms/navigation-menu.tsx +8 -2
- package/src/components/atoms/progress.tsx +1 -1
- package/src/components/atoms/radio-group.tsx +1 -1
- package/src/components/atoms/scroll-area.tsx +1 -2
- package/src/components/atoms/select.tsx +1 -1
- package/src/components/atoms/sheet.tsx +1 -1
- package/src/components/atoms/sidebar.tsx +6 -4
- package/src/components/atoms/slider.tsx +2 -2
- package/src/components/atoms/switch.tsx +1 -1
- package/src/components/atoms/table.tsx +34 -2
- package/src/components/atoms/tabs.tsx +64 -1
- package/src/components/atoms/textarea.tsx +1 -1
- package/src/components/atoms/toggle-group.tsx +1 -1
- package/src/components/atoms/toggle.tsx +5 -2
- package/src/components/molecules/chip.tsx +7 -2
- package/src/components/molecules/code-block/file-type-icons.tsx +123 -0
- package/src/components/molecules/code-block/process-code.ts +60 -0
- package/src/components/molecules/code-block/transform-command.tsx +177 -0
- package/src/components/molecules/code-block.tsx +29 -575
- package/src/components/molecules/combobox-free-text.tsx +23 -2
- package/src/components/molecules/copyable-text.tsx +14 -1
- package/src/components/molecules/data-table/data-table-bulk-actions.tsx +12 -13
- package/src/components/molecules/data-table/data-table-types.tsx +50 -2
- package/src/components/molecules/data-table/data-table-view-options.tsx +2 -1
- package/src/components/molecules/data-table/data-table.tsx +188 -96
- package/src/components/molecules/date-picker.tsx +3 -1
- package/src/components/molecules/date-range-picker.tsx +3 -1
- package/src/components/molecules/date-time-picker.tsx +3 -1
- package/src/components/molecules/file-dropzone.tsx +15 -5
- package/src/components/molecules/illustrations/empty-database.tsx +8 -5
- package/src/components/molecules/illustrations/error.tsx +19 -17
- package/src/components/molecules/illustrations/expired.tsx +55 -0
- package/src/components/molecules/illustrations/first-run.tsx +3 -1
- package/src/components/molecules/illustrations/no-activity.tsx +35 -14
- package/src/components/molecules/illustrations/no-customers.tsx +66 -0
- package/src/components/molecules/illustrations/no-documents.tsx +4 -3
- package/src/components/molecules/illustrations/no-invoices.tsx +45 -0
- package/src/components/molecules/illustrations/no-notifications.tsx +7 -8
- package/src/components/molecules/illustrations/no-orders.tsx +25 -17
- package/src/components/molecules/illustrations/no-plugins.tsx +21 -31
- package/src/components/molecules/illustrations/no-products.tsx +53 -0
- package/src/components/molecules/illustrations/no-projects.tsx +54 -0
- package/src/components/molecules/illustrations/no-promotions.tsx +49 -0
- package/src/components/molecules/illustrations/no-subscription.tsx +72 -0
- package/src/components/molecules/illustrations/not-found.tsx +17 -15
- package/src/components/molecules/illustrations/offline.tsx +12 -10
- package/src/components/molecules/illustrations/payment-failed.tsx +53 -0
- package/src/components/molecules/illustrations/success.tsx +43 -0
- package/src/components/molecules/inline-code.tsx +26 -0
- package/src/components/molecules/page-header.tsx +7 -3
- package/src/components/molecules/stat-card.tsx +13 -12
- package/src/components/molecules/state-views/empty-state.tsx +12 -1
- package/src/components/molecules/state-views/loading-state.tsx +7 -3
- package/src/lib/highlight.ts +177 -0
- package/src/lib/state-dictionary.ts +18 -5
- package/src/lib/utils.ts +0 -19
package/LICENSE.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
Copyright (C) Vendure GmbH
|
|
4
|
+
|
|
5
|
+
This software is available under two different licenses:
|
|
6
|
+
|
|
7
|
+
- GNU General Public License version 3 (GPLv3) as Vendure Community Edition
|
|
8
|
+
- Vendure Commercial License (VCL)
|
|
9
|
+
|
|
10
|
+
The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
|
|
11
|
+
|
|
12
|
+
## GNU General Public License version 3 (GPLv3)
|
|
13
|
+
|
|
14
|
+
If you decide to choose the GPLv3 license, you must comply with the following terms:
|
|
15
|
+
|
|
16
|
+
This program is free software: you can redistribute it and/or modify
|
|
17
|
+
it under the terms of the GNU General Public License as published by
|
|
18
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
19
|
+
(at your option) any later version.
|
|
20
|
+
|
|
21
|
+
This program is distributed in the hope that it will be useful,
|
|
22
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
23
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
24
|
+
GNU General Public License for more details.
|
|
25
|
+
|
|
26
|
+
You should have received a copy of the GNU General Public License
|
|
27
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
28
|
+
|
|
29
|
+
## Vendure Commercial License (VCL)
|
|
30
|
+
|
|
31
|
+
Alternatively, commercial and supported versions of the program - also known as
|
|
32
|
+
Commercial Distributions - must be used in accordance with the terms and conditions
|
|
33
|
+
contained in a separate written agreement between you and Vendure GmbH.
|
|
34
|
+
For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure-io/ui",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.0",
|
|
4
4
|
"description": "React component library for Vendure, built on shadcn/ui and Tailwind v4",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://github.com/vendurehq/design/tree/main/packages/ui",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
"./components/atoms/*": "./src/components/atoms/*.tsx",
|
|
16
16
|
"./components/molecules/*": "./src/components/molecules/*.tsx",
|
|
17
|
+
"./components/molecules/code-block/*": null,
|
|
18
|
+
"./components/molecules/data-table/data-table-helpers": null,
|
|
17
19
|
"./lib/*": "./src/lib/*.ts",
|
|
18
20
|
"./hooks/*": "./src/hooks/*.ts"
|
|
19
21
|
},
|
|
@@ -21,15 +23,17 @@
|
|
|
21
23
|
"src",
|
|
22
24
|
"!src/**/*.test.ts",
|
|
23
25
|
"!src/**/*.test.tsx",
|
|
24
|
-
"README.md"
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE.md"
|
|
25
28
|
],
|
|
26
29
|
"scripts": {
|
|
27
30
|
"lint": "biome check src/",
|
|
28
|
-
"check-types": "tsc --noEmit",
|
|
31
|
+
"check-types": "tsc --noEmit && tsc --noEmit -p tsconfig.stories.json",
|
|
29
32
|
"test": "bun test",
|
|
30
33
|
"pack:check": "bun pm pack --dry-run"
|
|
31
34
|
},
|
|
32
35
|
"peerDependencies": {
|
|
36
|
+
"@vendure-io/design-tokens": "^2.0.0-rc.0",
|
|
33
37
|
"react": ">=19",
|
|
34
38
|
"react-dom": ">=19",
|
|
35
39
|
"next": ">=14",
|
|
@@ -49,7 +53,6 @@
|
|
|
49
53
|
"@shikijs/themes": "^3.23.0",
|
|
50
54
|
"@shikijs/transformers": "^3.22.0",
|
|
51
55
|
"@tanstack/react-table": "^8.21.3",
|
|
52
|
-
"@vendure-io/design-tokens": "^2.0.0-beta.7",
|
|
53
56
|
"class-variance-authority": "^0.7.1",
|
|
54
57
|
"clsx": "^2.1.1",
|
|
55
58
|
"cmdk": "^1.1.1",
|
|
@@ -63,8 +66,7 @@
|
|
|
63
66
|
"recharts": "2.15.4",
|
|
64
67
|
"shiki": "^3.22.0",
|
|
65
68
|
"sonner": "^2.0.7",
|
|
66
|
-
"tailwind-merge": "^3.5.0"
|
|
67
|
-
"vaul": "^1.1.2"
|
|
69
|
+
"tailwind-merge": "^3.5.0"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
72
|
"@types/react": "^19.1.2",
|
|
@@ -30,7 +30,7 @@ function AlertDialogOverlay({
|
|
|
30
30
|
<AlertDialogPrimitive.Backdrop
|
|
31
31
|
data-slot="alert-dialog-overlay"
|
|
32
32
|
className={cn(
|
|
33
|
-
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-
|
|
33
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-scrim motion-reduce:animate-none data-open:duration-(--transition-duration-normal) data-open:ease-(--ease-out) data-closed:duration-(--transition-duration-fast) data-closed:ease-(--ease-in) supports-backdrop-filter:backdrop-blur-xs",
|
|
34
34
|
className
|
|
35
35
|
)}
|
|
36
36
|
{...props}
|
|
@@ -10,7 +10,7 @@ const alertVariants = cva(
|
|
|
10
10
|
variant: {
|
|
11
11
|
default: "bg-card text-card-foreground",
|
|
12
12
|
destructive:
|
|
13
|
-
"text-destructive bg-card *:data-[slot=alert-description]:text-destructive
|
|
13
|
+
"text-destructive-subtle-foreground bg-card *:data-[slot=alert-description]:text-destructive-subtle-foreground *:[svg]:text-current",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
defaultVariants: {
|
|
@@ -16,7 +16,7 @@ const badgeVariants = cva(
|
|
|
16
16
|
primary: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
17
17
|
brand: "bg-brand text-brand-foreground [a]:hover:bg-brand/80",
|
|
18
18
|
destructive:
|
|
19
|
-
"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
|
19
|
+
"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive-subtle-foreground dark:bg-destructive/20",
|
|
20
20
|
outline:
|
|
21
21
|
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
22
22
|
ghost:
|
|
@@ -6,7 +6,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
7
|
|
|
8
8
|
const buttonVariants = cva(
|
|
9
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive
|
|
9
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all duration-(--transition-duration-fast) ease-(--ease-default) data-pressed:brightness-95 dark:data-pressed:brightness-110 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none cursor-pointer",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
@@ -22,7 +22,7 @@ const buttonVariants = cva(
|
|
|
22
22
|
ghost:
|
|
23
23
|
"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
24
24
|
destructive:
|
|
25
|
-
"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
|
25
|
+
"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive-subtle-foreground focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
|
26
26
|
link: "text-primary underline-offset-4 hover:underline",
|
|
27
27
|
},
|
|
28
28
|
size: {
|
|
@@ -2,6 +2,12 @@ import * as React from "react"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
// The size variant publishes the card's spacing contract as CSS variables
|
|
6
|
+
// (--card-px: horizontal content padding, --card-gap: vertical rhythm shared
|
|
7
|
+
// by the root padding and the flex gap). Slots consume the variables instead
|
|
8
|
+
// of `group-data-[size=sm]` hooks so that nested cards resolve to the NEAREST
|
|
9
|
+
// card — a group selector matches any ancestor and leaks the outer card's
|
|
10
|
+
// size into an inner one.
|
|
5
11
|
function Card({
|
|
6
12
|
className,
|
|
7
13
|
size = "default",
|
|
@@ -12,7 +18,7 @@ function Card({
|
|
|
12
18
|
data-slot="card"
|
|
13
19
|
data-size={size}
|
|
14
20
|
className={cn(
|
|
15
|
-
"bg-card text-card-foreground group/card flex flex-col gap-
|
|
21
|
+
"bg-card text-card-foreground group/card [--card-gap:--spacing(6)] [--card-px:--spacing(6)] data-[size=sm]:[--card-gap:--spacing(4)] data-[size=sm]:[--card-px:--spacing(4)] flex flex-col gap-(--card-gap) overflow-hidden rounded-xl border border-border/60 py-(--card-gap) text-sm has-[>img:first-child]:pt-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
16
22
|
className
|
|
17
23
|
)}
|
|
18
24
|
{...props}
|
|
@@ -20,12 +26,15 @@ function Card({
|
|
|
20
26
|
)
|
|
21
27
|
}
|
|
22
28
|
|
|
29
|
+
// Band dividers (consumer-applied border-b / border-t on header/footer) render
|
|
30
|
+
// at row-separator strength (border/50) so the card outline (border/60) stays
|
|
31
|
+
// the strongest structural line.
|
|
23
32
|
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
24
33
|
return (
|
|
25
34
|
<div
|
|
26
35
|
data-slot="card-header"
|
|
27
36
|
className={cn(
|
|
28
|
-
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-
|
|
37
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-px) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:border-border/50 [.border-b]:pb-(--card-gap)",
|
|
29
38
|
className
|
|
30
39
|
)}
|
|
31
40
|
{...props}
|
|
@@ -73,7 +82,32 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
73
82
|
return (
|
|
74
83
|
<div
|
|
75
84
|
data-slot="card-content"
|
|
76
|
-
className={cn("px-
|
|
85
|
+
className={cn("px-(--card-px)", className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Hosts a Table full-bleed inside the card: negative vertical margins cancel
|
|
92
|
+
// the card's flex gap against a border-b header / border-t footer, and cancel
|
|
93
|
+
// the card's own padding when the table is the first/last child, so rows and
|
|
94
|
+
// band dividers run edge to edge (the card's overflow-hidden clips the
|
|
95
|
+
// corners). Edge cells get the card's content padding so cell content aligns
|
|
96
|
+
// with CardHeader/CardFooter content. Two contract notes:
|
|
97
|
+
// - The gap cancellation is unconditional: an adjacent CardHeader/CardFooter
|
|
98
|
+
// must carry its band border (border-b / border-t), otherwise the table
|
|
99
|
+
// sits directly against the band's content.
|
|
100
|
+
// - The edge-cell selector ((0,2,1)) out-specifies a plain padding utility on
|
|
101
|
+
// the cell ((0,1,0)): a `pl-*`/`pr-*` on a first/last cell silently loses —
|
|
102
|
+
// override with the important modifier (`pl-0!`) when a cell must opt out.
|
|
103
|
+
function CardTable({ className, ...props }: React.ComponentProps<"div">) {
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
data-slot="card-table"
|
|
107
|
+
className={cn(
|
|
108
|
+
"-my-(--card-gap) [&_tr>*:first-child]:pl-(--card-px) [&_tr>*:last-child]:pr-(--card-px)",
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
77
111
|
{...props}
|
|
78
112
|
/>
|
|
79
113
|
)
|
|
@@ -84,7 +118,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
84
118
|
<div
|
|
85
119
|
data-slot="card-footer"
|
|
86
120
|
className={cn(
|
|
87
|
-
"flex items-center rounded-b-xl px-
|
|
121
|
+
"flex items-center rounded-b-xl px-(--card-px) [.border-t]:border-border/50 [.border-t]:pt-(--card-gap)",
|
|
88
122
|
className
|
|
89
123
|
)}
|
|
90
124
|
{...props}
|
|
@@ -100,4 +134,5 @@ export {
|
|
|
100
134
|
CardAction,
|
|
101
135
|
CardDescription,
|
|
102
136
|
CardContent,
|
|
137
|
+
CardTable,
|
|
103
138
|
}
|
|
@@ -10,7 +10,7 @@ function Checkbox({ className, indeterminate, ...props }: CheckboxPrimitive.Root
|
|
|
10
10
|
<CheckboxPrimitive.Root
|
|
11
11
|
data-slot="checkbox"
|
|
12
12
|
className={cn(
|
|
13
|
-
"border-
|
|
13
|
+
"border-control-border dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground dark:data-indeterminate:bg-primary data-indeterminate:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",
|
|
14
14
|
className
|
|
15
15
|
)}
|
|
16
16
|
indeterminate={indeterminate}
|
|
@@ -19,15 +19,26 @@ function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
|
19
19
|
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// Field styling matches SelectTrigger, so a select-like combobox (the trigger
|
|
23
|
+
// shows the value, the search input sits in the popup) looks like the other
|
|
24
|
+
// form fields. ComboboxValue renders no element, so there is no value slot to
|
|
25
|
+
// style.
|
|
22
26
|
function ComboboxTrigger({
|
|
23
27
|
className,
|
|
28
|
+
size = "default",
|
|
24
29
|
children,
|
|
25
30
|
...props
|
|
26
|
-
}: ComboboxPrimitive.Trigger.Props
|
|
31
|
+
}: ComboboxPrimitive.Trigger.Props & {
|
|
32
|
+
size?: "sm" | "default"
|
|
33
|
+
}) {
|
|
27
34
|
return (
|
|
28
35
|
<ComboboxPrimitive.Trigger
|
|
29
36
|
data-slot="combobox-trigger"
|
|
30
|
-
|
|
37
|
+
data-size={size}
|
|
38
|
+
className={cn(
|
|
39
|
+
"border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-fit items-center justify-between gap-1.5 rounded-md border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-9 data-[size=sm]:h-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
31
42
|
{...props}
|
|
32
43
|
>
|
|
33
44
|
{children}
|
|
@@ -55,10 +66,13 @@ function ComboboxInput({
|
|
|
55
66
|
disabled = false,
|
|
56
67
|
showTrigger = true,
|
|
57
68
|
showClear = false,
|
|
69
|
+
triggerLabel = "Open options",
|
|
58
70
|
...props
|
|
59
71
|
}: ComboboxPrimitive.Input.Props & {
|
|
60
72
|
showTrigger?: boolean
|
|
61
73
|
showClear?: boolean
|
|
74
|
+
/** Accessible name of the icon-only trigger button. */
|
|
75
|
+
triggerLabel?: string
|
|
62
76
|
}) {
|
|
63
77
|
return (
|
|
64
78
|
<InputGroup className={cn("w-auto", className)}>
|
|
@@ -68,14 +82,19 @@ function ComboboxInput({
|
|
|
68
82
|
/>
|
|
69
83
|
<InputGroupAddon align="inline-end">
|
|
70
84
|
{showTrigger && (
|
|
85
|
+
// The bare primitive, not ComboboxTrigger: the icon button inside
|
|
86
|
+
// the input group must not take the field styling.
|
|
71
87
|
<InputGroupButton
|
|
72
88
|
size="icon-xs"
|
|
73
89
|
variant="ghost"
|
|
74
|
-
render={<
|
|
90
|
+
render={<ComboboxPrimitive.Trigger />}
|
|
75
91
|
data-slot="input-group-button"
|
|
92
|
+
aria-label={triggerLabel}
|
|
76
93
|
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
77
94
|
disabled={disabled}
|
|
78
|
-
|
|
95
|
+
>
|
|
96
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4" />
|
|
97
|
+
</InputGroupButton>
|
|
79
98
|
)}
|
|
80
99
|
{showClear && <ComboboxClear disabled={disabled} />}
|
|
81
100
|
</InputGroupAddon>
|
|
@@ -221,7 +240,7 @@ function ComboboxChips({
|
|
|
221
240
|
<ComboboxPrimitive.Chips
|
|
222
241
|
data-slot="combobox-chips"
|
|
223
242
|
className={cn(
|
|
224
|
-
"dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive
|
|
243
|
+
"dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border bg-transparent bg-clip-padding px-2.5 py-1.5 text-sm transition-[color,box-shadow] focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1.5",
|
|
225
244
|
className
|
|
226
245
|
)}
|
|
227
246
|
{...props}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { Command as CommandPrimitive } from "cmdk"
|
|
4
|
+
import { Command as CommandPrimitive, useCommandState } from "cmdk"
|
|
5
5
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
7
|
import {
|
|
@@ -134,19 +134,30 @@ function CommandGroup({
|
|
|
134
134
|
)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// cmdk's Separator forces role="separator", which a listbox does not allow as
|
|
138
|
+
// a child (axe aria-required-children). This div keeps cmdk's behaviour of
|
|
139
|
+
// hiding while a search is active, unless alwaysRender is set.
|
|
137
140
|
function CommandSeparator({
|
|
138
141
|
className,
|
|
142
|
+
alwaysRender = false,
|
|
139
143
|
...props
|
|
140
|
-
}: React.ComponentProps<
|
|
144
|
+
}: React.ComponentProps<"div"> & { alwaysRender?: boolean }) {
|
|
145
|
+
const searching = useCommandState((state) => state.search !== "")
|
|
146
|
+
if (searching && !alwaysRender) {
|
|
147
|
+
return null
|
|
148
|
+
}
|
|
141
149
|
return (
|
|
142
|
-
<
|
|
150
|
+
<div
|
|
143
151
|
data-slot="command-separator"
|
|
152
|
+
role="none"
|
|
144
153
|
className={cn("bg-border -mx-1 h-px w-auto", className)}
|
|
145
154
|
{...props}
|
|
146
155
|
/>
|
|
147
156
|
)
|
|
148
157
|
}
|
|
149
158
|
|
|
159
|
+
// cmdk writes data-selected="true" or "false" on every item, so the highlight
|
|
160
|
+
// matches the value; a bare data-selected: variant would match every item.
|
|
150
161
|
function CommandItem({
|
|
151
162
|
className,
|
|
152
163
|
children,
|
|
@@ -156,7 +167,7 @@ function CommandItem({
|
|
|
156
167
|
<CommandPrimitive.Item
|
|
157
168
|
data-slot="command-item"
|
|
158
169
|
className={cn(
|
|
159
|
-
"data-selected:bg-
|
|
170
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[selected=true]:**:[svg]:text-accent-foreground group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
160
171
|
className
|
|
161
172
|
)}
|
|
162
173
|
{...props}
|
|
@@ -175,7 +186,7 @@ function CommandShortcut({
|
|
|
175
186
|
<span
|
|
176
187
|
data-slot="command-shortcut"
|
|
177
188
|
className={cn(
|
|
178
|
-
"text-muted-foreground group-data-selected/command-item:text-foreground ml-auto text-xs tracking-widest",
|
|
189
|
+
"text-muted-foreground group-data-[selected=true]/command-item:text-foreground ml-auto text-xs tracking-widest",
|
|
179
190
|
className
|
|
180
191
|
)}
|
|
181
192
|
{...props}
|
|
@@ -101,7 +101,7 @@ function ContextMenuItem({
|
|
|
101
101
|
data-inset={inset}
|
|
102
102
|
data-variant={variant}
|
|
103
103
|
className={cn(
|
|
104
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground group/context-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
104
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-subtle-foreground data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive-subtle-foreground data-[variant=destructive]:*:[svg]:text-destructive-subtle-foreground focus:*:[svg]:text-accent-foreground group/context-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
105
105
|
className
|
|
106
106
|
)}
|
|
107
107
|
{...props}
|
|
@@ -31,7 +31,7 @@ function DialogOverlay({
|
|
|
31
31
|
<DialogPrimitive.Backdrop
|
|
32
32
|
data-slot="dialog-overlay"
|
|
33
33
|
className={cn(
|
|
34
|
-
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-
|
|
34
|
+
"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-scrim motion-reduce:animate-none data-open:duration-(--transition-duration-normal) data-open:ease-(--ease-out) data-closed:duration-(--transition-duration-fast) data-closed:ease-(--ease-in) supports-backdrop-filter:backdrop-blur-xs",
|
|
35
35
|
className
|
|
36
36
|
)}
|
|
37
37
|
{...props}
|
|
@@ -1,43 +1,100 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { DrawerPreview as DrawerPrimitive } from "@base-ui/react/drawer"
|
|
5
5
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
7
|
|
|
8
|
+
// Follows the shadcn base-vega Base UI drawer (upstream replaced vaul, which
|
|
9
|
+
// depends on Radix). Divergences: Base UI 1.2 exports the drawer as
|
|
10
|
+
// DrawerPreview, the scrim and surface use the scrim and overlay slots, the
|
|
11
|
+
// title uses our type style, and reduced motion turns the transitions off.
|
|
12
|
+
|
|
13
|
+
type DrawerContextProps = {
|
|
14
|
+
hasSnapPoints: boolean
|
|
15
|
+
modal: DrawerPrimitive.Root.Props["modal"]
|
|
16
|
+
showSwipeHandle: boolean
|
|
17
|
+
swipeDirection: NonNullable<DrawerPrimitive.Root.Props["swipeDirection"]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DrawerContext = React.createContext<DrawerContextProps | null>(null)
|
|
21
|
+
|
|
22
|
+
function useDrawer() {
|
|
23
|
+
const context = React.useContext(DrawerContext)
|
|
24
|
+
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error("useDrawer must be used within a Drawer.")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return context
|
|
30
|
+
}
|
|
31
|
+
|
|
8
32
|
function Drawer({
|
|
33
|
+
modal = true,
|
|
34
|
+
showSwipeHandle = false,
|
|
35
|
+
snapPoints,
|
|
36
|
+
swipeDirection = "down",
|
|
9
37
|
...props
|
|
10
|
-
}:
|
|
11
|
-
|
|
38
|
+
}: DrawerPrimitive.Root.Props & {
|
|
39
|
+
showSwipeHandle?: boolean
|
|
40
|
+
}) {
|
|
41
|
+
const hasSnapPoints = snapPoints != null && snapPoints.length > 0
|
|
42
|
+
const contextValue = React.useMemo(
|
|
43
|
+
() => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }),
|
|
44
|
+
[hasSnapPoints, modal, showSwipeHandle, swipeDirection]
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<DrawerContext.Provider value={contextValue}>
|
|
49
|
+
<DrawerPrimitive.Root
|
|
50
|
+
data-slot="drawer"
|
|
51
|
+
modal={modal}
|
|
52
|
+
snapPoints={snapPoints}
|
|
53
|
+
swipeDirection={swipeDirection}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
</DrawerContext.Provider>
|
|
57
|
+
)
|
|
12
58
|
}
|
|
13
59
|
|
|
14
|
-
function DrawerTrigger({
|
|
15
|
-
...props
|
|
16
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
60
|
+
function DrawerTrigger({ ...props }: DrawerPrimitive.Trigger.Props) {
|
|
17
61
|
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
18
62
|
}
|
|
19
63
|
|
|
20
|
-
function DrawerPortal({
|
|
21
|
-
...props
|
|
22
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
64
|
+
function DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) {
|
|
23
65
|
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
24
66
|
}
|
|
25
67
|
|
|
26
|
-
function DrawerClose({
|
|
27
|
-
...props
|
|
28
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
68
|
+
function DrawerClose({ ...props }: DrawerPrimitive.Close.Props) {
|
|
29
69
|
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
30
70
|
}
|
|
31
71
|
|
|
32
72
|
function DrawerOverlay({
|
|
33
73
|
className,
|
|
34
74
|
...props
|
|
35
|
-
}:
|
|
75
|
+
}: DrawerPrimitive.Backdrop.Props) {
|
|
36
76
|
return (
|
|
37
|
-
<DrawerPrimitive.
|
|
77
|
+
<DrawerPrimitive.Backdrop
|
|
38
78
|
data-slot="drawer-overlay"
|
|
39
79
|
className={cn(
|
|
40
|
-
"
|
|
80
|
+
"fixed inset-0 z-50 min-h-dvh bg-scrim opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))] transition-opacity duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-snap-points:[--drawer-overlay-min-opacity:0.5] data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs supports-[-webkit-touch-callout:none]:absolute motion-reduce:transition-none",
|
|
81
|
+
className
|
|
82
|
+
)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function DrawerSwipeHandle({
|
|
89
|
+
className,
|
|
90
|
+
...props
|
|
91
|
+
}: React.ComponentProps<"div">) {
|
|
92
|
+
return (
|
|
93
|
+
<div
|
|
94
|
+
data-slot="drawer-swipe-handle"
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
className={cn(
|
|
97
|
+
"relative z-10 flex shrink-0 cursor-grab transition-opacity duration-200 group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-[swipe-axis=x]/drawer-popup:h-full group-data-[swipe-axis=x]/drawer-popup:w-3 group-data-[swipe-axis=x]/drawer-popup:items-center group-data-[swipe-axis=y]/drawer-popup:h-3 group-data-[swipe-axis=y]/drawer-popup:w-full group-data-[swipe-axis=y]/drawer-popup:justify-center group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:items-start after:block after:shrink-0 after:rounded-full after:bg-muted group-data-[swipe-axis=x]/drawer-popup:after:h-[100px] group-data-[swipe-axis=x]/drawer-popup:after:w-1.5 group-data-[swipe-axis=y]/drawer-popup:after:h-1.5 group-data-[swipe-axis=y]/drawer-popup:after:w-[100px] active:cursor-grabbing",
|
|
41
98
|
className
|
|
42
99
|
)}
|
|
43
100
|
{...props}
|
|
@@ -49,21 +106,65 @@ function DrawerContent({
|
|
|
49
106
|
className,
|
|
50
107
|
children,
|
|
51
108
|
...props
|
|
52
|
-
}:
|
|
109
|
+
}: DrawerPrimitive.Popup.Props) {
|
|
110
|
+
const { hasSnapPoints, modal, showSwipeHandle, swipeDirection } = useDrawer()
|
|
111
|
+
const swipeAxis =
|
|
112
|
+
swipeDirection === "down" || swipeDirection === "up" ? "y" : "x"
|
|
113
|
+
|
|
53
114
|
return (
|
|
54
115
|
<DrawerPortal data-slot="drawer-portal">
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{...props}
|
|
116
|
+
{modal === true && (
|
|
117
|
+
<DrawerOverlay data-snap-points={hasSnapPoints ? "" : undefined} />
|
|
118
|
+
)}
|
|
119
|
+
<DrawerPrimitive.Viewport
|
|
120
|
+
data-slot="drawer-viewport"
|
|
121
|
+
data-modal={modal}
|
|
122
|
+
className="pointer-events-none fixed inset-0 z-50 select-none data-[modal=true]:pointer-events-auto"
|
|
63
123
|
>
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
124
|
+
<DrawerPrimitive.Popup
|
|
125
|
+
data-slot="drawer-popup"
|
|
126
|
+
data-swipe-axis={swipeAxis}
|
|
127
|
+
data-snap-points={hasSnapPoints ? "" : undefined}
|
|
128
|
+
className={cn(
|
|
129
|
+
// Base.
|
|
130
|
+
"group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col bg-overlay text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [interpolate-size:allow-keywords] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b motion-reduce:transition-none",
|
|
131
|
+
// Nested.
|
|
132
|
+
"data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95",
|
|
133
|
+
// Bleed.
|
|
134
|
+
"after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-overlay)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full",
|
|
135
|
+
// Sizing.
|
|
136
|
+
"[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem]",
|
|
137
|
+
// Stack.
|
|
138
|
+
"[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05]",
|
|
139
|
+
// Transitions.
|
|
140
|
+
"data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)]",
|
|
141
|
+
// Axis: y.
|
|
142
|
+
"data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height)",
|
|
143
|
+
// Axis: x.
|
|
144
|
+
"data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row",
|
|
145
|
+
// Direction: down.
|
|
146
|
+
"data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]",
|
|
147
|
+
// Direction: up.
|
|
148
|
+
"data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]",
|
|
149
|
+
// Direction: left.
|
|
150
|
+
"data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]",
|
|
151
|
+
// Direction: right.
|
|
152
|
+
"data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]",
|
|
153
|
+
className
|
|
154
|
+
)}
|
|
155
|
+
{...props}
|
|
156
|
+
>
|
|
157
|
+
{showSwipeHandle && <DrawerSwipeHandle />}
|
|
158
|
+
<DrawerPrimitive.Content
|
|
159
|
+
data-slot="drawer-content"
|
|
160
|
+
className={cn(
|
|
161
|
+
"flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-300 ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none"
|
|
162
|
+
)}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
</DrawerPrimitive.Content>
|
|
166
|
+
</DrawerPrimitive.Popup>
|
|
167
|
+
</DrawerPrimitive.Viewport>
|
|
67
168
|
</DrawerPortal>
|
|
68
169
|
)
|
|
69
170
|
}
|
|
@@ -73,7 +174,7 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
73
174
|
<div
|
|
74
175
|
data-slot="drawer-header"
|
|
75
176
|
className={cn(
|
|
76
|
-
"flex flex-col gap-0.5 p-4
|
|
177
|
+
"flex shrink-0 flex-col gap-0.5 p-4 pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-1.5 md:text-left",
|
|
77
178
|
className
|
|
78
179
|
)}
|
|
79
180
|
{...props}
|
|
@@ -85,16 +186,13 @@ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
85
186
|
return (
|
|
86
187
|
<div
|
|
87
188
|
data-slot="drawer-footer"
|
|
88
|
-
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
189
|
+
className={cn("mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0", className)}
|
|
89
190
|
{...props}
|
|
90
191
|
/>
|
|
91
192
|
)
|
|
92
193
|
}
|
|
93
194
|
|
|
94
|
-
function DrawerTitle({
|
|
95
|
-
className,
|
|
96
|
-
...props
|
|
97
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
195
|
+
function DrawerTitle({ className, ...props }: DrawerPrimitive.Title.Props) {
|
|
98
196
|
return (
|
|
99
197
|
<DrawerPrimitive.Title
|
|
100
198
|
data-slot="drawer-title"
|
|
@@ -107,11 +205,11 @@ function DrawerTitle({
|
|
|
107
205
|
function DrawerDescription({
|
|
108
206
|
className,
|
|
109
207
|
...props
|
|
110
|
-
}:
|
|
208
|
+
}: DrawerPrimitive.Description.Props) {
|
|
111
209
|
return (
|
|
112
210
|
<DrawerPrimitive.Description
|
|
113
211
|
data-slot="drawer-description"
|
|
114
|
-
className={cn("text-
|
|
212
|
+
className={cn("text-sm text-balance text-muted-foreground", className)}
|
|
115
213
|
{...props}
|
|
116
214
|
/>
|
|
117
215
|
)
|
|
@@ -121,6 +219,7 @@ export {
|
|
|
121
219
|
Drawer,
|
|
122
220
|
DrawerPortal,
|
|
123
221
|
DrawerOverlay,
|
|
222
|
+
DrawerSwipeHandle,
|
|
124
223
|
DrawerTrigger,
|
|
125
224
|
DrawerClose,
|
|
126
225
|
DrawerContent,
|