@vendure-io/ui 3.0.0-next.4 → 3.0.0-next.6
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 +12 -11
- package/src/components/atoms/alert-dialog.tsx +1 -4
- package/src/components/atoms/alert.tsx +59 -35
- package/src/components/atoms/badge.tsx +2 -2
- package/src/components/atoms/breadcrumb.tsx +154 -59
- package/src/components/atoms/button-group.tsx +1 -1
- package/src/components/atoms/button.tsx +2 -2
- package/src/components/atoms/calendar.tsx +2 -2
- package/src/components/atoms/card.tsx +15 -2
- package/src/components/atoms/carousel.tsx +33 -7
- package/src/components/atoms/chart.tsx +3 -3
- package/src/components/atoms/checkbox.tsx +1 -1
- package/src/components/atoms/combobox.tsx +60 -36
- package/src/components/atoms/command.tsx +17 -7
- package/src/components/atoms/context-menu.tsx +5 -5
- package/src/components/atoms/dialog.tsx +30 -14
- package/src/components/atoms/dropdown-menu.tsx +1 -1
- package/src/components/atoms/hover-card.tsx +1 -1
- package/src/components/atoms/input-group.tsx +30 -12
- package/src/components/atoms/input-otp.tsx +2 -2
- package/src/components/atoms/input.tsx +13 -3
- package/src/components/atoms/menubar.tsx +2 -2
- package/src/components/atoms/native-select.tsx +1 -1
- package/src/components/atoms/navigation-menu.tsx +3 -3
- package/src/components/atoms/pagination.tsx +52 -15
- package/src/components/atoms/popover.tsx +1 -1
- package/src/components/atoms/select.tsx +3 -3
- package/src/components/atoms/sheet.tsx +35 -15
- package/src/components/atoms/sidebar.tsx +224 -36
- package/src/components/atoms/skeleton.tsx +6 -3
- package/src/components/atoms/spinner.tsx +7 -2
- package/src/components/atoms/tabs.tsx +6 -2
- package/src/components/atoms/textarea.tsx +1 -1
- package/src/components/atoms/toggle.tsx +1 -1
- package/src/components/molecules/action-needed.tsx +483 -0
- package/src/components/molecules/anonymized-token.tsx +70 -25
- package/src/components/molecules/app-shell.tsx +14 -5
- package/src/components/molecules/checklist/checklist.tsx +47 -17
- package/src/components/molecules/chip.tsx +37 -19
- package/src/components/molecules/choice-card.tsx +117 -9
- package/src/components/molecules/code-block/package-manager-storage.ts +50 -0
- package/src/components/molecules/code-block/process-code.ts +1 -1
- package/src/components/molecules/code-block.tsx +58 -47
- package/src/components/molecules/combobox-free-text.tsx +75 -20
- package/src/components/molecules/confirm-dialog.tsx +17 -5
- package/src/components/molecules/copyable-text.tsx +10 -8
- package/src/components/molecules/data-table/data-table-filters.tsx +36 -6
- package/src/components/molecules/data-table/data-table-helpers.tsx +109 -3
- package/src/components/molecules/data-table/data-table-row-count-storage.tsx +88 -0
- package/src/components/molecules/data-table/data-table-selection-storage.tsx +33 -15
- package/src/components/molecules/data-table/data-table-types.tsx +156 -29
- package/src/components/molecules/data-table/data-table-view-options.tsx +14 -4
- package/src/components/molecules/data-table/data-table.tsx +156 -75
- package/src/components/molecules/data-table/table-pagination.tsx +142 -38
- package/src/components/molecules/date-picker.tsx +58 -25
- package/src/components/molecules/date-range-picker.tsx +59 -24
- package/src/components/molecules/date-time-picker.tsx +63 -25
- package/src/components/molecules/date-time.tsx +38 -3
- package/src/components/molecules/elapsed-time.tsx +61 -12
- package/src/components/molecules/file-dropzone.tsx +151 -40
- package/src/components/molecules/format-provider.tsx +14 -4
- package/src/components/molecules/id-chip-chrome.tsx +114 -0
- package/src/components/molecules/id-chip.tsx +13 -115
- package/src/components/molecules/issued-secret.tsx +35 -25
- package/src/components/molecules/live-indicator.tsx +1 -1
- package/src/components/molecules/money.tsx +44 -3
- package/src/components/molecules/multi-select.tsx +62 -16
- package/src/components/molecules/page-header.tsx +6 -2
- package/src/components/molecules/password-input.tsx +11 -10
- package/src/components/molecules/relative-time.tsx +88 -16
- package/src/components/molecules/search-trigger.tsx +5 -3
- package/src/components/molecules/secret-value.tsx +35 -19
- package/src/components/molecules/skip-link.tsx +11 -9
- package/src/components/molecules/stat-card.tsx +145 -33
- package/src/components/molecules/state-views/empty-state.tsx +16 -12
- package/src/components/molecules/state-views/error-state.tsx +36 -20
- package/src/components/molecules/state-views/loading-state.tsx +18 -6
- package/src/components/molecules/state-views/skeleton-parts.tsx +6 -4
- package/src/components/molecules/status-badge.tsx +11 -35
- package/src/components/molecules/time-tooltip.tsx +55 -1
- package/src/hooks/use-copy.ts +3 -1
- package/src/lib/deprecated.ts +71 -0
- package/src/lib/field-surface.ts +7 -7
- package/src/lib/format-messages.ts +368 -0
- package/src/lib/highlight.ts +1 -1
- package/src/lib/menu-item.tsx +1 -1
- package/src/lib/tint-recipes.ts +10 -5
- package/src/lib/utils.ts +19 -1
- package/src/lib/dialog-padding.ts +0 -48
|
@@ -4,11 +4,13 @@ import * as React from "react"
|
|
|
4
4
|
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
|
|
5
5
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
|
+
import { useMessages } from "../../lib/format-messages.ts"
|
|
7
8
|
import { Button } from "@vendure-io/ui/components/atoms/button"
|
|
8
9
|
import { XIcon } from "lucide-react"
|
|
9
10
|
import { usePopupDir } from "../../lib/popup-direction.ts"
|
|
10
11
|
import { usePinnedHeight } from "../../hooks/use-pinned-height.ts"
|
|
11
12
|
import { triggerSlot } from "../../lib/trigger-slot.ts"
|
|
13
|
+
import { logicalSide, type PhysicalSide } from "../../lib/deprecated.ts"
|
|
12
14
|
|
|
13
15
|
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
|
|
14
16
|
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
@@ -40,10 +42,11 @@ function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
// Tells SheetHeader to host the close button, so the ✕ stays pinned with the
|
|
43
|
-
// header while the body scrolls.
|
|
44
|
-
|
|
45
|
+
// header while the body scrolls. The value is the button's accessible name, or
|
|
46
|
+
// null when the sheet shows no ✕.
|
|
47
|
+
const SheetCloseButtonContext = React.createContext<string | null>(null)
|
|
45
48
|
|
|
46
|
-
function SheetCloseButton({ className }: { className?: string }) {
|
|
49
|
+
function SheetCloseButton({ className, label }: { className?: string; label: string }) {
|
|
47
50
|
return (
|
|
48
51
|
<SheetPrimitive.Close
|
|
49
52
|
data-slot="sheet-close"
|
|
@@ -57,37 +60,51 @@ function SheetCloseButton({ className }: { className?: string }) {
|
|
|
57
60
|
>
|
|
58
61
|
<XIcon
|
|
59
62
|
/>
|
|
60
|
-
<span className="sr-only">
|
|
63
|
+
<span className="sr-only">{label}</span>
|
|
61
64
|
</SheetPrimitive.Close>
|
|
62
65
|
)
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
// The width of a
|
|
68
|
+
// The width of a start or end sheet per size, as whole class strings so
|
|
66
69
|
// Tailwind finds them in this source. A top or bottom sheet spans the viewport
|
|
67
70
|
// and ignores the size. Below `sm` every side sheet is 3/4 of the viewport.
|
|
68
71
|
const sheetSizes = {
|
|
69
|
-
default: "data-[side=
|
|
70
|
-
xl: "data-[side=
|
|
72
|
+
default: "data-[side=start]:sm:max-w-lg data-[side=end]:sm:max-w-lg",
|
|
73
|
+
xl: "data-[side=start]:sm:max-w-200 data-[side=end]:sm:max-w-200",
|
|
71
74
|
} as const
|
|
72
75
|
|
|
73
76
|
function SheetContent({
|
|
74
77
|
className,
|
|
75
78
|
children,
|
|
76
|
-
side = "
|
|
79
|
+
side: sideProp = "end",
|
|
77
80
|
size = "default",
|
|
78
81
|
showCloseButton = true,
|
|
82
|
+
closeLabel,
|
|
79
83
|
...props
|
|
80
84
|
}: SheetPrimitive.Popup.Props & {
|
|
81
|
-
side?: "top" | "right" | "bottom" | "left"
|
|
82
85
|
/**
|
|
83
|
-
* The
|
|
86
|
+
* The edge the sheet slides in from. `start` and `end` follow the reading
|
|
87
|
+
* direction: in right-to-left, `start` is the right edge. Defaults to `end`.
|
|
88
|
+
* `left` and `right` are deprecated: use `start` or `end`. They are removed
|
|
89
|
+
* in 4.0.
|
|
90
|
+
*/
|
|
91
|
+
side?: "top" | "bottom" | "start" | "end" | PhysicalSide
|
|
92
|
+
/**
|
|
93
|
+
* The width of a start or end sheet. `default` (512px): a short form or a
|
|
84
94
|
* settings list. `xl` (800px): a table or a wide form. Both stay at 3/4 of
|
|
85
95
|
* the viewport below 640px. Top and bottom sheets ignore it.
|
|
86
96
|
*/
|
|
87
97
|
size?: keyof typeof sheetSizes
|
|
88
98
|
showCloseButton?: boolean
|
|
99
|
+
/**
|
|
100
|
+
* The ✕'s accessible name. Defaults to `messages.sheet.close` from
|
|
101
|
+
* `FormatProvider`, then "Close".
|
|
102
|
+
*/
|
|
103
|
+
closeLabel?: string
|
|
89
104
|
}) {
|
|
90
105
|
const dir = usePopupDir()
|
|
106
|
+
const side = logicalSide("SheetContent", sideProp, dir)
|
|
107
|
+
const t = useMessages("sheet", { close: closeLabel })
|
|
91
108
|
return (
|
|
92
109
|
<SheetPortal>
|
|
93
110
|
<SheetOverlay />
|
|
@@ -98,18 +115,21 @@ function SheetContent({
|
|
|
98
115
|
data-side={side}
|
|
99
116
|
data-size={size}
|
|
100
117
|
className={cn(
|
|
101
|
-
"group/sheet-content bg-overlay fixed z-50 flex flex-col gap-4 overflow-y-auto overscroll-contain [scroll-padding-block:calc(var(--pinned-header-height,0px)+--spacing(1))_calc(var(--pinned-footer-height,0px)+--spacing(1))] bg-clip-padding text-sm shadow-overlay transition-[opacity,translate] duration-normal ease-drawer data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:duration-fast motion-safe:data-[side=
|
|
118
|
+
"group/sheet-content bg-overlay fixed z-50 flex flex-col gap-4 overflow-y-auto overscroll-contain [scroll-padding-block:calc(var(--pinned-header-height,0px)+--spacing(1))_calc(var(--pinned-footer-height,0px)+--spacing(1))] bg-clip-padding text-sm shadow-overlay transition-[opacity,translate] duration-normal ease-drawer data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:duration-fast motion-safe:data-[side=end]:data-starting-style:translate-x-10 motion-safe:data-[side=end]:data-ending-style:translate-x-10 motion-safe:rtl:data-[side=end]:data-starting-style:-translate-x-10 motion-safe:rtl:data-[side=end]:data-ending-style:-translate-x-10 motion-safe:data-[side=start]:data-starting-style:-translate-x-10 motion-safe:data-[side=start]:data-ending-style:-translate-x-10 motion-safe:rtl:data-[side=start]:data-starting-style:translate-x-10 motion-safe:rtl:data-[side=start]:data-ending-style:translate-x-10 motion-safe:data-[side=top]:data-starting-style:-translate-y-10 motion-safe:data-[side=top]:data-ending-style:-translate-y-10 motion-safe:data-[side=bottom]:data-starting-style:translate-y-10 motion-safe:data-[side=bottom]:data-ending-style:translate-y-10 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:max-h-dvh data-[side=start]:inset-y-0 data-[side=start]:start-0 data-[side=start]:h-full data-[side=start]:w-3/4 data-[side=end]:inset-y-0 data-[side=end]:end-0 data-[side=end]:h-full data-[side=end]:w-3/4 data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:max-h-dvh",
|
|
102
119
|
sheetSizes[size],
|
|
103
120
|
className
|
|
104
121
|
)}
|
|
105
122
|
{...props}
|
|
106
123
|
>
|
|
107
|
-
<SheetCloseButtonContext.Provider value={showCloseButton}>
|
|
124
|
+
<SheetCloseButtonContext.Provider value={showCloseButton ? t.close : null}>
|
|
108
125
|
{children}
|
|
109
126
|
</SheetCloseButtonContext.Provider>
|
|
110
127
|
{/* A sheet without a SheetHeader keeps the ✕ here, in the corner. */}
|
|
111
128
|
{showCloseButton && (
|
|
112
|
-
<SheetCloseButton
|
|
129
|
+
<SheetCloseButton
|
|
130
|
+
label={t.close}
|
|
131
|
+
className="group-has-data-[slot=sheet-header]/sheet-content:hidden"
|
|
132
|
+
/>
|
|
113
133
|
)}
|
|
114
134
|
</SheetPrimitive.Popup>
|
|
115
135
|
</SheetPortal>
|
|
@@ -120,7 +140,7 @@ function SheetContent({
|
|
|
120
140
|
// so a scrolled body passes under them. Their own 16px padding keeps the body
|
|
121
141
|
// clear of their text. Each measures its height for the sheet's scroll padding.
|
|
122
142
|
function SheetHeader({ className, children, ref, ...props }: React.ComponentProps<"div">) {
|
|
123
|
-
const
|
|
143
|
+
const closeLabel = React.useContext(SheetCloseButtonContext)
|
|
124
144
|
const pinnedRef = usePinnedHeight("--pinned-header-height", "sheet-content", ref)
|
|
125
145
|
return (
|
|
126
146
|
<div
|
|
@@ -133,7 +153,7 @@ function SheetHeader({ className, children, ref, ...props }: React.ComponentProp
|
|
|
133
153
|
{...props}
|
|
134
154
|
>
|
|
135
155
|
{children}
|
|
136
|
-
{
|
|
156
|
+
{closeLabel !== null && <SheetCloseButton label={closeLabel} />}
|
|
137
157
|
</div>
|
|
138
158
|
)
|
|
139
159
|
}
|
|
@@ -7,7 +7,16 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
7
7
|
|
|
8
8
|
import { useIsMobile } from "@vendure-io/ui/hooks/use-mobile"
|
|
9
9
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
10
|
+
import { useMessages } from "../../lib/format-messages.ts"
|
|
11
|
+
import { menuItem } from "../../lib/menu-item.tsx"
|
|
12
|
+
import { logicalSide, type PhysicalSide, warnDeprecated } from "../../lib/deprecated.ts"
|
|
13
|
+
import { usePopupDir } from "../../lib/popup-direction.ts"
|
|
10
14
|
import { Button } from "@vendure-io/ui/components/atoms/button"
|
|
15
|
+
import {
|
|
16
|
+
HoverCard,
|
|
17
|
+
HoverCardContent,
|
|
18
|
+
HoverCardTrigger,
|
|
19
|
+
} from "@vendure-io/ui/components/atoms/hover-card"
|
|
11
20
|
import { Input } from "@vendure-io/ui/components/atoms/input"
|
|
12
21
|
import { Separator } from "@vendure-io/ui/components/atoms/separator"
|
|
13
22
|
import {
|
|
@@ -150,19 +159,38 @@ function SidebarProvider({
|
|
|
150
159
|
}
|
|
151
160
|
|
|
152
161
|
function Sidebar({
|
|
153
|
-
side = "
|
|
162
|
+
side: sideProp = "start",
|
|
154
163
|
variant = "sidebar",
|
|
155
164
|
collapsible = "offcanvas",
|
|
156
165
|
className,
|
|
157
166
|
children,
|
|
158
167
|
dir,
|
|
168
|
+
mobileLabels,
|
|
159
169
|
...props
|
|
160
170
|
}: React.ComponentProps<"div"> & {
|
|
161
|
-
|
|
171
|
+
/**
|
|
172
|
+
* The edge the sidebar sits on. `start` and `end` follow the reading
|
|
173
|
+
* direction. `left` and `right` are deprecated: use `start` or `end`.
|
|
174
|
+
* They are removed in 4.0.
|
|
175
|
+
*/
|
|
176
|
+
side?: "start" | "end" | PhysicalSide
|
|
162
177
|
variant?: "sidebar" | "floating" | "inset"
|
|
163
178
|
collapsible?: "offcanvas" | "icon" | "none"
|
|
179
|
+
/**
|
|
180
|
+
* The screen-reader title and description of the sheet the sidebar opens
|
|
181
|
+
* in on a small screen. Default to `messages.sidebar` (`mobileTitle`,
|
|
182
|
+
* `mobileDescription`) from `FormatProvider`, then "Sidebar" and
|
|
183
|
+
* "Displays the mobile sidebar.".
|
|
184
|
+
*/
|
|
185
|
+
mobileLabels?: { title?: string; description?: string }
|
|
164
186
|
}) {
|
|
165
187
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
|
|
188
|
+
const providedDir = usePopupDir()
|
|
189
|
+
const side = logicalSide("Sidebar", sideProp, dir ?? providedDir)
|
|
190
|
+
const t = useMessages("sidebar", {
|
|
191
|
+
mobileTitle: mobileLabels?.title,
|
|
192
|
+
mobileDescription: mobileLabels?.description,
|
|
193
|
+
})
|
|
166
194
|
|
|
167
195
|
if (collapsible === "none") {
|
|
168
196
|
return (
|
|
@@ -196,8 +224,8 @@ function Sidebar({
|
|
|
196
224
|
side={side}
|
|
197
225
|
>
|
|
198
226
|
<SheetHeader className="sr-only">
|
|
199
|
-
<SheetTitle>
|
|
200
|
-
<SheetDescription>
|
|
227
|
+
<SheetTitle>{t.mobileTitle}</SheetTitle>
|
|
228
|
+
<SheetDescription>{t.mobileDescription}</SheetDescription>
|
|
201
229
|
</SheetHeader>
|
|
202
230
|
<div className="flex h-full w-full flex-col">{children}</div>
|
|
203
231
|
</SheetContent>
|
|
@@ -205,13 +233,13 @@ function Sidebar({
|
|
|
205
233
|
)
|
|
206
234
|
}
|
|
207
235
|
|
|
208
|
-
// The sidebar's flex order follows its
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
236
|
+
// The sidebar's flex order follows its side, not its place in the markup,
|
|
237
|
+
// so the gap that keeps its width sits on the same side as the fixed
|
|
238
|
+
// container: at the start of the line for the start side, at the end for
|
|
239
|
+
// the end side, in either direction.
|
|
212
240
|
return (
|
|
213
241
|
<div
|
|
214
|
-
className="group peer text-sidebar-foreground hidden md:block data-[side=
|
|
242
|
+
className="group peer text-sidebar-foreground hidden md:block data-[side=start]:order-first data-[side=end]:order-last"
|
|
215
243
|
data-state={state}
|
|
216
244
|
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
217
245
|
data-variant={variant}
|
|
@@ -224,7 +252,7 @@ function Sidebar({
|
|
|
224
252
|
className={cn(
|
|
225
253
|
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-slow ease-drawer motion-reduce:transition-none",
|
|
226
254
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
227
|
-
"group-data-[side=
|
|
255
|
+
"group-data-[side=end]:rotate-180",
|
|
228
256
|
variant === "floating" || variant === "inset"
|
|
229
257
|
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
|
|
230
258
|
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
@@ -234,11 +262,11 @@ function Sidebar({
|
|
|
234
262
|
data-slot="sidebar-container"
|
|
235
263
|
data-side={side}
|
|
236
264
|
className={cn(
|
|
237
|
-
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[
|
|
265
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[inset-inline-start,inset-inline-end,width] duration-slow ease-drawer motion-reduce:transition-none data-[side=start]:start-0 data-[side=start]:group-data-[collapsible=offcanvas]:start-[calc(var(--sidebar-width)*-1)] data-[side=end]:end-0 data-[side=end]:group-data-[collapsible=offcanvas]:end-[calc(var(--sidebar-width)*-1)] md:flex",
|
|
238
266
|
// Adjust the padding for floating and inset variants.
|
|
239
267
|
variant === "floating" || variant === "inset"
|
|
240
268
|
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
241
|
-
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=
|
|
269
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=start]:border-e group-data-[side=end]:border-s",
|
|
242
270
|
className
|
|
243
271
|
)}
|
|
244
272
|
{...props}
|
|
@@ -246,7 +274,7 @@ function Sidebar({
|
|
|
246
274
|
<div
|
|
247
275
|
data-sidebar="sidebar"
|
|
248
276
|
data-slot="sidebar-inner"
|
|
249
|
-
className="bg-sidebar group-data-[variant=floating]:ring-sidebar-border flex size-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-
|
|
277
|
+
className="bg-sidebar group-data-[variant=floating]:ring-sidebar-border flex size-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-control group-data-[variant=floating]:ring-1"
|
|
250
278
|
>
|
|
251
279
|
{children}
|
|
252
280
|
</div>
|
|
@@ -258,9 +286,17 @@ function Sidebar({
|
|
|
258
286
|
function SidebarTrigger({
|
|
259
287
|
className,
|
|
260
288
|
onClick,
|
|
289
|
+
label,
|
|
261
290
|
...props
|
|
262
|
-
}: React.ComponentProps<typeof Button>
|
|
291
|
+
}: React.ComponentProps<typeof Button> & {
|
|
292
|
+
/**
|
|
293
|
+
* Screen-reader text of the button.
|
|
294
|
+
* @default `messages.sidebar.toggle`, "Toggle Sidebar"
|
|
295
|
+
*/
|
|
296
|
+
label?: string
|
|
297
|
+
}) {
|
|
263
298
|
const { toggleSidebar } = useSidebar()
|
|
299
|
+
const t = useMessages("sidebar", { toggle: label })
|
|
264
300
|
|
|
265
301
|
return (
|
|
266
302
|
<Button
|
|
@@ -276,29 +312,40 @@ function SidebarTrigger({
|
|
|
276
312
|
{...props}
|
|
277
313
|
>
|
|
278
314
|
<PanelLeftIcon />
|
|
279
|
-
<span className="sr-only">
|
|
315
|
+
<span className="sr-only">{t.toggle}</span>
|
|
280
316
|
</Button>
|
|
281
317
|
)
|
|
282
318
|
}
|
|
283
319
|
|
|
284
|
-
function SidebarRail({
|
|
320
|
+
function SidebarRail({
|
|
321
|
+
className,
|
|
322
|
+
label,
|
|
323
|
+
...props
|
|
324
|
+
}: React.ComponentProps<"button"> & {
|
|
325
|
+
/**
|
|
326
|
+
* Accessible name and tooltip of the rail.
|
|
327
|
+
* @default `messages.sidebar.toggle`, "Toggle Sidebar"
|
|
328
|
+
*/
|
|
329
|
+
label?: string
|
|
330
|
+
}) {
|
|
285
331
|
const { toggleSidebar } = useSidebar()
|
|
332
|
+
const t = useMessages("sidebar", { toggle: label })
|
|
286
333
|
|
|
287
334
|
return (
|
|
288
335
|
<button
|
|
289
336
|
data-sidebar="rail"
|
|
290
337
|
data-slot="sidebar-rail"
|
|
291
|
-
aria-label=
|
|
338
|
+
aria-label={t.toggle}
|
|
292
339
|
tabIndex={-1}
|
|
293
340
|
onClick={toggleSidebar}
|
|
294
|
-
title=
|
|
341
|
+
title={t.toggle}
|
|
295
342
|
className={cn(
|
|
296
|
-
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-[
|
|
297
|
-
"in-data-[side=
|
|
298
|
-
"[[data-side=
|
|
299
|
-
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:
|
|
300
|
-
"[[data-side=
|
|
301
|
-
"[[data-side=
|
|
343
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-[inset-inline-start,inset-inline-end,translate,background-color] ease-drawer group-data-[side=start]:-end-4 group-data-[side=end]:start-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:translate-x-1/2",
|
|
344
|
+
"in-data-[side=start]:ltr:cursor-w-resize in-data-[side=start]:rtl:cursor-e-resize in-data-[side=end]:ltr:cursor-e-resize in-data-[side=end]:rtl:cursor-w-resize",
|
|
345
|
+
"[[data-side=start][data-state=collapsed]_&]:ltr:cursor-e-resize [[data-side=start][data-state=collapsed]_&]:rtl:cursor-w-resize [[data-side=end][data-state=collapsed]_&]:ltr:cursor-w-resize [[data-side=end][data-state=collapsed]_&]:rtl:cursor-e-resize",
|
|
346
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:start-full",
|
|
347
|
+
"[[data-side=start][data-collapsible=offcanvas]_&]:-end-2",
|
|
348
|
+
"[[data-side=end][data-collapsible=offcanvas]_&]:-start-2",
|
|
302
349
|
className
|
|
303
350
|
)}
|
|
304
351
|
{...props}
|
|
@@ -316,14 +363,14 @@ function SidebarInset({
|
|
|
316
363
|
// recedes and cards (--surface-raised) lift off the pane. A border carries the
|
|
317
364
|
// tier in light mode where the ramp collapses to white; flat by design, no drop
|
|
318
365
|
// shadow (see AGENTS.md "flat look"). The default variant stays flush on canvas.
|
|
319
|
-
// The pane drops its margin on the sidebar's side. `side` is
|
|
320
|
-
// for Sheet:
|
|
366
|
+
// The pane drops its margin on the sidebar's side. `side` is logical, as
|
|
367
|
+
// for Sheet: in right-to-left the start side is the right edge.
|
|
321
368
|
return useRender({
|
|
322
369
|
defaultTagName: "main",
|
|
323
370
|
props: mergeProps<"main">(
|
|
324
371
|
{
|
|
325
372
|
className: cn(
|
|
326
|
-
"bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=inset]:bg-surface md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:peer-data-[side=
|
|
373
|
+
"bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=inset]:bg-surface md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:peer-data-[side=start]:ms-0 md:peer-data-[variant=inset]:peer-data-[side=end]:me-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-border/60",
|
|
327
374
|
className
|
|
328
375
|
),
|
|
329
376
|
},
|
|
@@ -621,7 +668,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
621
668
|
variant: {
|
|
622
669
|
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
623
670
|
outline:
|
|
624
|
-
"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground
|
|
671
|
+
"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground ring ring-sidebar-border hover:ring-sidebar-accent",
|
|
625
672
|
},
|
|
626
673
|
size: {
|
|
627
674
|
default: "h-8 text-sm",
|
|
@@ -638,7 +685,8 @@ const sidebarMenuButtonVariants = cva(
|
|
|
638
685
|
|
|
639
686
|
function SidebarMenuButton({
|
|
640
687
|
render,
|
|
641
|
-
|
|
688
|
+
active: activeProp,
|
|
689
|
+
isActive,
|
|
642
690
|
hasActiveChild = false,
|
|
643
691
|
variant = "default",
|
|
644
692
|
size = "default",
|
|
@@ -647,6 +695,8 @@ function SidebarMenuButton({
|
|
|
647
695
|
...props
|
|
648
696
|
}: useRender.ComponentProps<"button"> &
|
|
649
697
|
React.ComponentProps<"button"> & {
|
|
698
|
+
active?: boolean
|
|
699
|
+
/** @deprecated Use `active`. Removed in 4.0. */
|
|
650
700
|
isActive?: boolean
|
|
651
701
|
/**
|
|
652
702
|
* Set it on the button of every group that holds the current page, whether
|
|
@@ -660,6 +710,8 @@ function SidebarMenuButton({
|
|
|
660
710
|
hasActiveChild?: boolean
|
|
661
711
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
662
712
|
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
713
|
+
if (isActive !== undefined) warnDeprecated("SidebarMenuButton", "isActive", "active")
|
|
714
|
+
const active = activeProp ?? isActive ?? false
|
|
663
715
|
const { isMobile, state } = useSidebar()
|
|
664
716
|
const comp = useRender({
|
|
665
717
|
defaultTagName: "button",
|
|
@@ -674,7 +726,7 @@ function SidebarMenuButton({
|
|
|
674
726
|
slot: "sidebar-menu-button",
|
|
675
727
|
sidebar: "menu-button",
|
|
676
728
|
size,
|
|
677
|
-
active
|
|
729
|
+
active,
|
|
678
730
|
"has-active-child": hasActiveChild,
|
|
679
731
|
},
|
|
680
732
|
})
|
|
@@ -693,7 +745,7 @@ function SidebarMenuButton({
|
|
|
693
745
|
<Tooltip>
|
|
694
746
|
{comp}
|
|
695
747
|
<TooltipContent
|
|
696
|
-
side="
|
|
748
|
+
side="inline-end"
|
|
697
749
|
align="center"
|
|
698
750
|
// Clears the rail: the button ends one group padding (8px) short of
|
|
699
751
|
// the rail edge, and the label sits 8px beyond that edge.
|
|
@@ -890,21 +942,29 @@ function SidebarMenuSubItem({
|
|
|
890
942
|
|
|
891
943
|
function SidebarMenuSubButton({
|
|
892
944
|
render,
|
|
893
|
-
size = "
|
|
894
|
-
|
|
945
|
+
size: sizeProp = "default",
|
|
946
|
+
active: activeProp,
|
|
947
|
+
isActive,
|
|
895
948
|
className,
|
|
896
949
|
...props
|
|
897
950
|
}: useRender.ComponentProps<"a"> &
|
|
898
951
|
React.ComponentProps<"a"> & {
|
|
899
|
-
|
|
952
|
+
/** `md` is deprecated: use `default`. It is removed in 4.0. */
|
|
953
|
+
size?: "sm" | "default" | "md"
|
|
954
|
+
active?: boolean
|
|
955
|
+
/** @deprecated Use `active`. Removed in 4.0. */
|
|
900
956
|
isActive?: boolean
|
|
901
957
|
}) {
|
|
958
|
+
if (isActive !== undefined) warnDeprecated("SidebarMenuSubButton", "isActive", "active")
|
|
959
|
+
if (sizeProp === "md") warnDeprecated("SidebarMenuSubButton", 'size="md"', 'size="default"')
|
|
960
|
+
const active = activeProp ?? isActive ?? false
|
|
961
|
+
const size = sizeProp === "md" ? "default" : sizeProp
|
|
902
962
|
return useRender({
|
|
903
963
|
defaultTagName: "a",
|
|
904
964
|
props: mergeProps<"a">(
|
|
905
965
|
{
|
|
906
966
|
className: cn(
|
|
907
|
-
"relative text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring [&>svg]:opacity-55 [&>svg]:transition-opacity [&>svg]:duration-normal hover:[&>svg]:opacity-85 data-active:[&>svg]:opacity-100 data-active:[&>svg]:text-brand-indicator data-[size=
|
|
967
|
+
"relative text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring [&>svg]:opacity-55 [&>svg]:transition-opacity [&>svg]:duration-normal hover:[&>svg]:opacity-85 data-active:[&>svg]:opacity-100 data-active:[&>svg]:text-brand-indicator data-[size=default]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px rtl:translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",
|
|
908
968
|
className
|
|
909
969
|
),
|
|
910
970
|
},
|
|
@@ -915,7 +975,131 @@ function SidebarMenuSubButton({
|
|
|
915
975
|
slot: "sidebar-menu-sub-button",
|
|
916
976
|
sidebar: "menu-sub-button",
|
|
917
977
|
size,
|
|
918
|
-
active
|
|
978
|
+
active,
|
|
979
|
+
},
|
|
980
|
+
})
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// The icon rail's flyout: hover or focus a group's icon and a card beside the
|
|
984
|
+
// rail shows the group's title, a separator and its items. Use it for a group
|
|
985
|
+
// whose items the rail hides. The card's title row is centred on the trigger,
|
|
986
|
+
// so the title reads as the icon's label, and the card still flips to the other
|
|
987
|
+
// side or shifts along the rail when it would leave the viewport.
|
|
988
|
+
//
|
|
989
|
+
// <SidebarMenuFlyout>
|
|
990
|
+
// <SidebarMenuFlyoutTrigger hasActiveChild><CartIcon /><span>Sales</span></SidebarMenuFlyoutTrigger>
|
|
991
|
+
// <SidebarMenuFlyoutContent label="Sales">
|
|
992
|
+
// <SidebarMenuFlyoutItem render={<Link to="/orders" />} active>Orders</SidebarMenuFlyoutItem>
|
|
993
|
+
// </SidebarMenuFlyoutContent>
|
|
994
|
+
// </SidebarMenuFlyout>
|
|
995
|
+
|
|
996
|
+
// The card's padding and its title row's height. The title row is centred on
|
|
997
|
+
// the trigger from these, whatever the trigger's height.
|
|
998
|
+
const FLYOUT_PADDING = 5
|
|
999
|
+
const FLYOUT_LABEL_HEIGHT = 34
|
|
1000
|
+
|
|
1001
|
+
function SidebarMenuFlyout(props: React.ComponentProps<typeof HoverCard>) {
|
|
1002
|
+
return <HoverCard {...props} />
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* A SidebarMenuButton that opens the flyout. It takes the button's props, plus
|
|
1007
|
+
* the hover delays of the card. The flyout opens only in the icon rail, like
|
|
1008
|
+
* the rail's tooltips: on the expanded sidebar and on mobile it is a plain
|
|
1009
|
+
* button.
|
|
1010
|
+
*/
|
|
1011
|
+
function SidebarMenuFlyoutTrigger({
|
|
1012
|
+
delay,
|
|
1013
|
+
closeDelay,
|
|
1014
|
+
...props
|
|
1015
|
+
}: Omit<React.ComponentProps<typeof SidebarMenuButton>, "tooltip"> &
|
|
1016
|
+
Pick<React.ComponentProps<typeof HoverCardTrigger>, "delay" | "closeDelay">) {
|
|
1017
|
+
const { isMobile, state } = useSidebar()
|
|
1018
|
+
if (state !== "collapsed" || isMobile) {
|
|
1019
|
+
return <SidebarMenuButton {...props} />
|
|
1020
|
+
}
|
|
1021
|
+
return (
|
|
1022
|
+
<HoverCardTrigger
|
|
1023
|
+
delay={delay}
|
|
1024
|
+
closeDelay={closeDelay}
|
|
1025
|
+
render={<SidebarMenuButton {...props} />}
|
|
1026
|
+
/>
|
|
1027
|
+
)
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* The card. `label` is the group's title: it sits on the trigger's centre
|
|
1032
|
+
* line, above a separator and the items.
|
|
1033
|
+
*/
|
|
1034
|
+
function SidebarMenuFlyoutContent({
|
|
1035
|
+
label,
|
|
1036
|
+
className,
|
|
1037
|
+
children,
|
|
1038
|
+
...props
|
|
1039
|
+
}: Omit<
|
|
1040
|
+
React.ComponentProps<typeof HoverCardContent>,
|
|
1041
|
+
"side" | "align" | "alignOffset" | "sideOffset"
|
|
1042
|
+
> & { label: React.ReactNode }) {
|
|
1043
|
+
return (
|
|
1044
|
+
<HoverCardContent
|
|
1045
|
+
side="inline-end"
|
|
1046
|
+
align="start"
|
|
1047
|
+
// Moves the card up by its padding plus half the height difference
|
|
1048
|
+
// between the title row and the trigger.
|
|
1049
|
+
alignOffset={({ anchor }) =>
|
|
1050
|
+
(anchor.height - FLYOUT_LABEL_HEIGHT) / 2 - FLYOUT_PADDING
|
|
1051
|
+
}
|
|
1052
|
+
// Clears the rail by the same 8px as the rail's tooltips.
|
|
1053
|
+
sideOffset={16}
|
|
1054
|
+
className={cn("flex w-auto min-w-40 flex-col rounded-2xl p-1.25", className)}
|
|
1055
|
+
{...props}
|
|
1056
|
+
>
|
|
1057
|
+
<div
|
|
1058
|
+
data-slot="sidebar-menu-flyout-label"
|
|
1059
|
+
className="text-foreground flex h-8.5 shrink-0 items-center px-2 text-sm font-medium"
|
|
1060
|
+
>
|
|
1061
|
+
{label}
|
|
1062
|
+
</div>
|
|
1063
|
+
<div
|
|
1064
|
+
data-slot="sidebar-menu-flyout-separator"
|
|
1065
|
+
role="presentation"
|
|
1066
|
+
className="bg-border -mx-1.25 my-1.25 h-px shrink-0"
|
|
1067
|
+
/>
|
|
1068
|
+
{children}
|
|
1069
|
+
</HoverCardContent>
|
|
1070
|
+
)
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* One item of the flyout, a link by default. Compose a router link with
|
|
1075
|
+
* `render`. `active` sets aria-current="page"; a router link that sets it
|
|
1076
|
+
* itself does not need `active`.
|
|
1077
|
+
*/
|
|
1078
|
+
function SidebarMenuFlyoutItem({
|
|
1079
|
+
render,
|
|
1080
|
+
active,
|
|
1081
|
+
className,
|
|
1082
|
+
...props
|
|
1083
|
+
}: useRender.ComponentProps<"a"> & { active?: boolean }) {
|
|
1084
|
+
return useRender({
|
|
1085
|
+
defaultTagName: "a",
|
|
1086
|
+
render,
|
|
1087
|
+
props: mergeProps<"a">(
|
|
1088
|
+
{
|
|
1089
|
+
...(active !== undefined && {
|
|
1090
|
+
"aria-current": active ? ("page" as const) : undefined,
|
|
1091
|
+
}),
|
|
1092
|
+
className: cn(
|
|
1093
|
+
menuItem,
|
|
1094
|
+
"hover:bg-muted hover:text-accent-foreground aria-[current=page]:text-foreground aria-[current=page]:font-medium [&>span:last-child]:min-w-0 [&>span:last-child]:truncate",
|
|
1095
|
+
className
|
|
1096
|
+
),
|
|
1097
|
+
},
|
|
1098
|
+
props
|
|
1099
|
+
),
|
|
1100
|
+
state: {
|
|
1101
|
+
slot: "sidebar-menu-flyout-item",
|
|
1102
|
+
sidebar: "menu-flyout-item",
|
|
919
1103
|
},
|
|
920
1104
|
})
|
|
921
1105
|
}
|
|
@@ -1109,6 +1293,10 @@ export {
|
|
|
1109
1293
|
SidebarMenuAction,
|
|
1110
1294
|
SidebarMenuBadge,
|
|
1111
1295
|
SidebarMenuButton,
|
|
1296
|
+
SidebarMenuFlyout,
|
|
1297
|
+
SidebarMenuFlyoutContent,
|
|
1298
|
+
SidebarMenuFlyoutItem,
|
|
1299
|
+
SidebarMenuFlyoutTrigger,
|
|
1112
1300
|
SidebarMenuItem,
|
|
1113
1301
|
SidebarMenuSkeleton,
|
|
1114
1302
|
SidebarMenuSub,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// A <span> with `block`, not a <div>: a skeleton stands in for a value, and a
|
|
4
|
+
// value often sits in a <p> or a <span>, where a <div> is invalid HTML. A
|
|
5
|
+
// caller's display class (`inline-block`, `flex`) replaces `block`.
|
|
6
|
+
function Skeleton({ className, ...props }: React.ComponentProps<"span">) {
|
|
4
7
|
return (
|
|
5
|
-
<
|
|
8
|
+
<span
|
|
6
9
|
data-slot="skeleton"
|
|
7
10
|
className={cn(
|
|
8
|
-
"animate-shimmer motion-reduce:animate-none motion-reduce:bg-none motion-reduce:bg-muted rounded-md bg-[length:200%_100%] bg-[linear-gradient(90deg,var(--muted)_25%,var(--accent)_50%,var(--muted)_75%)]",
|
|
11
|
+
"animate-shimmer motion-reduce:animate-none motion-reduce:bg-none motion-reduce:bg-muted block rounded-md bg-[length:200%_100%] bg-[linear-gradient(90deg,var(--muted)_25%,var(--accent)_50%,var(--muted)_75%)]",
|
|
9
12
|
className
|
|
10
13
|
)}
|
|
11
14
|
{...props}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
2
4
|
import { Loader2Icon } from "lucide-react"
|
|
5
|
+
import { useMessages } from "../../lib/format-messages.ts"
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
// `aria-label` defaults to `messages.spinner.loading`, "Loading".
|
|
8
|
+
function Spinner({ className, "aria-label": ariaLabel, ...props }: React.ComponentProps<"svg">) {
|
|
9
|
+
const t = useMessages("spinner", { loading: ariaLabel })
|
|
5
10
|
return (
|
|
6
|
-
<Loader2Icon role="status" aria-label=
|
|
11
|
+
<Loader2Icon role="status" aria-label={t.loading} className={cn("size-4 animate-spin motion-reduce:animate-none", className)} {...props} />
|
|
7
12
|
)
|
|
8
13
|
}
|
|
9
14
|
|
|
@@ -60,13 +60,17 @@ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
|
|
|
60
60
|
<TabsPrimitive.Tab
|
|
61
61
|
data-slot="tabs-trigger"
|
|
62
62
|
className={cn(
|
|
63
|
-
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-
|
|
63
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-[calc(var(--radius-lg)-3px)] border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,opacity] group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='stroke-'])]:stroke-[1.75]",
|
|
64
64
|
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent",
|
|
65
65
|
// ADR 0001: the active trigger lifts to surface-raised out of the inset
|
|
66
66
|
// track in both themes. Dark keeps a hairline — lightness alone can't
|
|
67
67
|
// separate a 0.21 thumb near the black end of the ramp.
|
|
68
68
|
"data-active:bg-surface-raised dark:data-active:border-input dark:data-active:text-foreground data-active:text-foreground",
|
|
69
|
-
|
|
69
|
+
// The underline must not stick out below the list: a parent that
|
|
70
|
+
// scrolls sideways also scrolls vertically, and 1px of overflow gives
|
|
71
|
+
// it a vertical scrollbar. The default variant has no underline, and
|
|
72
|
+
// the line variant's ends on the list's bottom edge.
|
|
73
|
+
"after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[variant=default]/tabs-list:after:hidden group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-4.5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-end-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
70
74
|
className
|
|
71
75
|
)}
|
|
72
76
|
{...props}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
|
|
5
5
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
6
|
-
import { fieldSurface } from "
|
|
6
|
+
import { fieldSurface } from "../../lib/field-surface.ts"
|
|
7
7
|
import { useFieldControlProps } from "@vendure-io/ui/components/atoms/field"
|
|
8
8
|
|
|
9
9
|
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
@@ -4,7 +4,7 @@ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
|
|
|
4
4
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
5
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
|
-
import { outlineEdge, outlineEdgeHover } from "
|
|
7
|
+
import { outlineEdge, outlineEdgeHover } from "../../lib/outline-edge.ts"
|
|
8
8
|
|
|
9
9
|
const toggleVariants = cva(
|
|
10
10
|
// Pressed is the accent tint with foreground text, as in the v3 look. Hover
|