@vendure-io/ui 2.0.0-beta.2 → 2.0.0-beta.20

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.
Files changed (35) hide show
  1. package/LICENSE.md +34 -0
  2. package/README.md +6 -3
  3. package/package.json +10 -9
  4. package/src/components/atoms/button.tsx +5 -1
  5. package/src/components/atoms/card.tsx +39 -4
  6. package/src/components/atoms/combobox.tsx +19 -4
  7. package/src/components/atoms/scroll-area.tsx +4 -2
  8. package/src/components/atoms/sidebar.tsx +27 -12
  9. package/src/components/atoms/table.tsx +1 -1
  10. package/src/components/atoms/tabs.tsx +64 -1
  11. package/src/components/atoms/toggle-group.tsx +1 -1
  12. package/src/components/atoms/toggle.tsx +5 -2
  13. package/src/components/molecules/anonymized-token.tsx +2 -2
  14. package/src/components/molecules/app-shell.tsx +110 -0
  15. package/src/components/molecules/code-block/file-type-icons.tsx +123 -0
  16. package/src/components/molecules/code-block/transform-command.tsx +177 -0
  17. package/src/components/molecules/code-block.tsx +634 -0
  18. package/src/components/molecules/combobox-free-text.tsx +18 -0
  19. package/src/components/molecules/copy-feedback-provider.tsx +33 -0
  20. package/src/components/molecules/copyable-text.tsx +30 -7
  21. package/src/components/molecules/data-table/data-table-bulk-actions.tsx +10 -9
  22. package/src/components/molecules/data-table/data-table-types.tsx +50 -2
  23. package/src/components/molecules/data-table/data-table.tsx +184 -91
  24. package/src/components/molecules/date-picker.tsx +119 -0
  25. package/src/components/molecules/date-range-picker.tsx +153 -0
  26. package/src/components/molecules/date-time-picker.tsx +133 -0
  27. package/src/components/molecules/file-dropzone.tsx +271 -0
  28. package/src/components/molecules/id-chip.tsx +1 -1
  29. package/src/components/molecules/page-header.tsx +7 -3
  30. package/src/components/molecules/skip-link.tsx +36 -0
  31. package/src/components/molecules/state-views/empty-state.tsx +12 -1
  32. package/src/components/molecules/state-views/loading-state.tsx +7 -3
  33. package/src/lib/date-value.ts +48 -0
  34. package/src/lib/highlight.ts +174 -0
  35. 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/README.md CHANGED
@@ -4,8 +4,8 @@ React component library for Vendure, built on [shadcn/ui](https://ui.shadcn.com/
4
4
 
5
5
  ## Install
6
6
 
7
- ```bash
8
- npm install @vendure-io/ui
7
+ ```sh
8
+ bun add @vendure-io/ui
9
9
  ```
10
10
 
11
11
  ### Peer dependencies
@@ -13,7 +13,7 @@ npm install @vendure-io/ui
13
13
  - `react` >= 19
14
14
  - `react-dom` >= 19
15
15
 
16
- Optional peers: `next`, `next-themes`, `react-hook-form`
16
+ Optional peers: `next`, `next-themes`
17
17
 
18
18
  ## Usage
19
19
 
@@ -32,6 +32,9 @@ import { cn } from "@vendure-io/ui/lib/utils";
32
32
  | `@vendure-io/ui/lib/base-ui` | `@base-ui/react` primitive namespaces (see below) |
33
33
  | `@vendure-io/ui/hooks/*` | Shared React hooks |
34
34
 
35
+ See the repository's [component guide](../../docs/ui-components.md) for the full
36
+ atom and molecule inventory.
37
+
35
38
  ## Customizing wrapper components
36
39
 
37
40
  The components under `components/atoms/*` are thin wrappers around [`@base-ui/react`](https://base-ui.com/) primitives. To override a single subcomponent (e.g. swap `DialogTitle` for one with a different font) while re-using the rest, import the underlying primitive namespace from `@vendure-io/ui/lib/base-ui` rather than from `@base-ui/react` directly:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendure-io/ui",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.20",
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",
@@ -21,11 +21,12 @@
21
21
  "src",
22
22
  "!src/**/*.test.ts",
23
23
  "!src/**/*.test.tsx",
24
- "README.md"
24
+ "README.md",
25
+ "LICENSE.md"
25
26
  ],
26
27
  "scripts": {
27
28
  "lint": "biome check src/",
28
- "check-types": "tsc --noEmit",
29
+ "check-types": "tsc --noEmit && tsc --noEmit -p tsconfig.stories.json",
29
30
  "test": "bun test",
30
31
  "pack:check": "bun pm pack --dry-run"
31
32
  },
@@ -33,8 +34,7 @@
33
34
  "react": ">=19",
34
35
  "react-dom": ">=19",
35
36
  "next": ">=14",
36
- "next-themes": "^0.4.6",
37
- "react-hook-form": ">=7"
37
+ "next-themes": "^0.4.6"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "next": {
@@ -42,15 +42,15 @@
42
42
  },
43
43
  "next-themes": {
44
44
  "optional": true
45
- },
46
- "react-hook-form": {
47
- "optional": true
48
45
  }
49
46
  },
50
47
  "dependencies": {
51
48
  "@base-ui/react": "^1.2.0",
49
+ "@shikijs/langs": "^3.23.0",
50
+ "@shikijs/themes": "^3.23.0",
51
+ "@shikijs/transformers": "^3.22.0",
52
52
  "@tanstack/react-table": "^8.21.3",
53
- "@vendure-io/design-tokens": "^2.0.0-beta.0",
53
+ "@vendure-io/design-tokens": "^2.0.0-beta.9",
54
54
  "class-variance-authority": "^0.7.1",
55
55
  "clsx": "^2.1.1",
56
56
  "cmdk": "^1.1.1",
@@ -62,6 +62,7 @@
62
62
  "react-day-picker": "^9.14.0",
63
63
  "react-resizable-panels": "^4.7.0",
64
64
  "recharts": "2.15.4",
65
+ "shiki": "^3.22.0",
65
66
  "sonner": "^2.0.7",
66
67
  "tailwind-merge": "^3.5.0",
67
68
  "vaul": "^1.1.2"
@@ -6,11 +6,15 @@ 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 dark:aria-invalid:border-destructive/50 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",
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 dark:aria-invalid:border-destructive/50 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: {
13
13
  default: "bg-primary text-primary-foreground hover:bg-primary/80",
14
+ // Identity/marketing CTA only ("Start free trial", "Upgrade to Cloud"):
15
+ // a deliberate brand moment, not a louder `default` primary. Brand is a
16
+ // signature, not a wallpaper; see Button guidance before reaching for it.
17
+ brand: "bg-brand text-brand-foreground hover:bg-brand/80",
14
18
  outline:
15
19
  "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",
16
20
  secondary:
@@ -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-6 overflow-hidden rounded-xl py-6 text-sm has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
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-6 group-data-[size=sm]/card:px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4",
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-6 group-data-[size=sm]/card:px-4", className)}
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-6 group-data-[size=sm]/card:px-4 [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4",
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
  }
@@ -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
- className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
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 dark:aria-invalid:border-destructive/50 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}
@@ -68,14 +79,18 @@ function ComboboxInput({
68
79
  />
69
80
  <InputGroupAddon align="inline-end">
70
81
  {showTrigger && (
82
+ // The bare primitive, not ComboboxTrigger: the icon button inside
83
+ // the input group must not take the field styling.
71
84
  <InputGroupButton
72
85
  size="icon-xs"
73
86
  variant="ghost"
74
- render={<ComboboxTrigger />}
87
+ render={<ComboboxPrimitive.Trigger />}
75
88
  data-slot="input-group-button"
76
89
  className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
77
90
  disabled={disabled}
78
- />
91
+ >
92
+ <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4" />
93
+ </InputGroupButton>
79
94
  )}
80
95
  {showClear && <ComboboxClear disabled={disabled} />}
81
96
  </InputGroupAddon>
@@ -1,6 +1,5 @@
1
1
  "use client"
2
2
 
3
- import * as React from "react"
4
3
  import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
5
4
 
6
5
  import { cn } from "@vendure-io/ui/lib/utils"
@@ -39,7 +38,10 @@ function ScrollBar({
39
38
  data-orientation={orientation}
40
39
  orientation={orientation}
41
40
  className={cn(
42
- "flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
41
+ // Overlay scrollbars: invisible at rest, fade in while the pointer is over
42
+ // the scroll area (data-hovering) or during active scrolling (data-scrolling).
43
+ // Base UI omits data-scrolling on programmatic scrolls, so route changes don't flash.
44
+ "flex touch-none p-px select-none opacity-0 transition-opacity data-hovering:opacity-100 data-scrolling:opacity-100 data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
43
45
  className
44
46
  )}
45
47
  {...props}
@@ -302,17 +302,32 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
302
302
  )
303
303
  }
304
304
 
305
- function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
306
- return (
307
- <main
308
- data-slot="sidebar-inset"
309
- className={cn(
310
- "bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
311
- className
312
- )}
313
- {...props}
314
- />
315
- )
305
+ function SidebarInset({
306
+ className,
307
+ render,
308
+ ...props
309
+ }: useRender.ComponentProps<"main">) {
310
+ // The inset variant is our recessed content pane, built on the surface ramp: it
311
+ // steps up to --surface while the wrapper stays on --background, so the shell
312
+ // recedes and cards (--surface-raised) lift off the pane. A border carries the
313
+ // tier in light mode where the ramp collapses to white; flat by design, no drop
314
+ // shadow (see AGENTS.md "flat look"). The default variant stays flush on canvas.
315
+ return useRender({
316
+ defaultTagName: "main",
317
+ props: mergeProps<"main">(
318
+ {
319
+ className: cn(
320
+ "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]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-border/60",
321
+ className
322
+ ),
323
+ },
324
+ props
325
+ ),
326
+ render,
327
+ state: {
328
+ slot: "sidebar-inset",
329
+ },
330
+ })
316
331
  }
317
332
 
318
333
  function SidebarInput({
@@ -475,7 +490,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
475
490
  }
476
491
 
477
492
  const sidebarMenuButtonVariants = cva(
478
- "ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0",
493
+ "ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&>svg:first-child]:size-4.5 [&>svg:first-child]:[stroke-width:2.125] [&_svg]:shrink-0",
479
494
  {
480
495
  variants: {
481
496
  variant: {
@@ -57,7 +57,7 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
57
57
  <tr
58
58
  data-slot="table-row"
59
59
  className={cn(
60
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
60
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b border-border/50 transition-colors",
61
61
  className
62
62
  )}
63
63
  {...props}
@@ -1,6 +1,8 @@
1
1
  "use client"
2
2
 
3
+ import { mergeProps } from "@base-ui/react/merge-props"
3
4
  import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
5
+ import { useRender } from "@base-ui/react/use-render"
4
6
  import { cva, type VariantProps } from "class-variance-authority"
5
7
 
6
8
  import { cn } from "@vendure-io/ui/lib/utils"
@@ -82,4 +84,65 @@ function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
82
84
  )
83
85
  }
84
86
 
85
- export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
87
+ // Link tabs: section navigation where each tab is a route. They look like the
88
+ // line variant, but they are a <nav> of links with aria-current="page", not a
89
+ // tablist. Base UI Tabs would put role="tab" on a link and expect a panel for
90
+ // each tab, and the router already owns which section shows.
91
+ function TabsNav({ className, ...props }: React.ComponentProps<"nav">) {
92
+ return (
93
+ <nav
94
+ data-slot="tabs-nav"
95
+ className={cn(
96
+ // The padding keeps the focus ring and the underline inside the
97
+ // scroll box, which clips everything outside it.
98
+ "text-muted-foreground flex h-9 max-w-full items-center gap-1 overflow-x-auto p-[3px]",
99
+ className
100
+ )}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ // `active` sets aria-current="page". The style reads aria-current, so a router
107
+ // link that sets it on the active route (TanStack Router, React Router's
108
+ // NavLink) works through `render` without `active`.
109
+ function TabsLink({
110
+ className,
111
+ active,
112
+ render,
113
+ ...props
114
+ }: useRender.ComponentProps<"a"> & { active?: boolean }) {
115
+ return useRender({
116
+ defaultTagName: "a",
117
+ render,
118
+ props: mergeProps<"a">(
119
+ {
120
+ // Leave the attribute to the router link unless `active` is set.
121
+ ...(active !== undefined && {
122
+ "aria-current": active ? ("page" as const) : undefined,
123
+ }),
124
+ className: cn(
125
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-full shrink-0 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] focus-visible:outline-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
126
+ "aria-[current=page]:text-foreground dark:aria-[current=page]:text-foreground",
127
+ // The underline sits on the bottom edge of the nav, like the line variant.
128
+ "after:bg-foreground after:absolute after:inset-x-0 after:bottom-[-4px] after:h-0.5 after:opacity-0 after:transition-opacity aria-[current=page]:after:opacity-100",
129
+ className
130
+ ),
131
+ },
132
+ props
133
+ ),
134
+ state: {
135
+ slot: "tabs-link",
136
+ },
137
+ })
138
+ }
139
+
140
+ export {
141
+ Tabs,
142
+ TabsList,
143
+ TabsTrigger,
144
+ TabsContent,
145
+ TabsNav,
146
+ TabsLink,
147
+ tabsListVariants,
148
+ }
@@ -72,7 +72,7 @@ function ToggleGroupItem({
72
72
  data-size={context.size || size}
73
73
  data-spacing={context.spacing}
74
74
  className={cn(
75
- // Base UI's Toggle emits data-pressed, never Radix's data-[state=on] — the pressed style comes from toggleVariants via its aria-pressed rule
75
+ // Base UI's Toggle emits data-pressed, never Radix's data-[state=on] — the pressed style comes from toggleVariants via its aria-pressed and data-pressed rules
76
76
  "shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
77
77
  toggleVariants({
78
78
  variant: context.variant || variant,
@@ -6,12 +6,15 @@ import { cva, type VariantProps } from "class-variance-authority"
6
6
  import { cn } from "@vendure-io/ui/lib/utils"
7
7
 
8
8
  const toggleVariants = cva(
9
- "hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive gap-1 rounded-md text-sm font-medium transition-[color,box-shadow] [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
9
+ // Pressed uses the solid primary pair, like checked Checkbox, Radio and
10
+ // Switch: bg-muted was the hover shade and nearly vanished on dark overlays.
11
+ // Base UI sets both aria-pressed and data-pressed; both are styled.
12
+ "hover:text-foreground aria-pressed:bg-primary aria-pressed:text-primary-foreground aria-pressed:hover:bg-primary/80 aria-pressed:hover:text-primary-foreground data-pressed:bg-primary data-pressed:text-primary-foreground data-pressed:hover:bg-primary/80 data-pressed:hover:text-primary-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive gap-1 rounded-md text-sm font-medium transition-[color,box-shadow] [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
10
13
  {
11
14
  variants: {
12
15
  variant: {
13
16
  default: "bg-transparent",
14
- outline: "border-input hover:bg-muted border bg-transparent",
17
+ outline: "border-input hover:bg-muted aria-pressed:border-primary data-pressed:border-primary border bg-transparent",
15
18
  },
16
19
  size: {
17
20
  default: "h-9 min-w-9 px-2",
@@ -53,9 +53,9 @@ interface AnonymizedTokenProps extends Omit<React.ComponentProps<'span'>, 'child
53
53
  copyable?: boolean;
54
54
  /** How long the check-mark feedback stays visible, in ms. */
55
55
  timeout?: CopyButtonProps['timeout'];
56
- /** Called after a successful copy. Wire your toast here. */
56
+ /** Called after a successful copy. Wire your toast here. Falls back to `CopyFeedbackProvider`. */
57
57
  onCopied?: CopyButtonProps['onCopied'];
58
- /** Called when the clipboard write fails. */
58
+ /** Called when the clipboard write fails. Falls back to `CopyFeedbackProvider`. */
59
59
  onCopyError?: CopyButtonProps['onCopyError'];
60
60
  /** Accessible label before copying. @default "Copy token" */
61
61
  copyLabel?: CopyButtonProps['copyLabel'];
@@ -0,0 +1,110 @@
1
+ import { cn } from '@vendure-io/ui/lib/utils';
2
+ import type * as React from 'react';
3
+
4
+ // AppShell — the recessed-surface app layout, built on the surface ramp.
5
+ //
6
+ // Nests three surface tiers so the chrome reads as "deep" the way Linear's does:
7
+ //
8
+ // AppShell → --background the canvas the whole window sits on
9
+ // AppShellSidebar → --sidebar nav rail; equals the canvas, so it recedes
10
+ // AppShellContent → --surface the content pane, stepped forward + inset
11
+ //
12
+ // Cards dropped into the content pane resolve to --surface-raised (via the `card`
13
+ // token), completing the third step. In dark mode each tier is a lightness step;
14
+ // in light mode the ramp collapses to white, so the pane's border + shadow carry
15
+ // the step instead. That asymmetry is intentional, not a gap.
16
+ //
17
+ // The sidebar slot is deliberately unopinionated: drop the full `Sidebar` atom in
18
+ // for a real app, or use `AppShellSidebar` for a lightweight rail. Content owns a
19
+ // header + main anatomy so every consumer gets the same scroll boundary and skip
20
+ // link target without coupling the design system to a router or auth provider. The
21
+ // shell is viewport-bound so the canvas inset remains visible while main scrolls.
22
+
23
+ function AppShell({ className, ...props }: React.ComponentProps<'div'>) {
24
+ return (
25
+ <div
26
+ data-slot="app-shell"
27
+ className={cn('bg-background text-foreground flex h-svh w-full overflow-hidden', className)}
28
+ {...props}
29
+ />
30
+ );
31
+ }
32
+
33
+ function AppShellSidebar({ className, ...props }: React.ComponentProps<'aside'>) {
34
+ return (
35
+ <aside
36
+ data-slot="app-shell-sidebar"
37
+ className={cn(
38
+ 'bg-sidebar text-sidebar-foreground flex w-64 shrink-0 flex-col gap-1 p-3',
39
+ className,
40
+ )}
41
+ {...props}
42
+ />
43
+ );
44
+ }
45
+
46
+ function AppShellContent({ className, ...props }: React.ComponentProps<'div'>) {
47
+ return (
48
+ <div
49
+ data-slot="app-shell-content"
50
+ className={cn(
51
+ // The missing tier: step up to --surface and inset from the canvas so the
52
+ // shell frames the pane on all sides, including a gutter between the
53
+ // sidebar and the pane. Flat by design: the border carries the tier in
54
+ // light mode (see AGENTS.md "flat look"), so no drop shadow.
55
+ 'bg-surface m-3 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/60',
56
+ className,
57
+ )}
58
+ {...props}
59
+ />
60
+ );
61
+ }
62
+
63
+ function AppShellHeader({ className, ...props }: React.ComponentProps<'header'>) {
64
+ return (
65
+ <header
66
+ data-slot="app-shell-header"
67
+ className={cn(
68
+ 'flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-4',
69
+ className,
70
+ )}
71
+ {...props}
72
+ />
73
+ );
74
+ }
75
+
76
+ interface AppShellMainProps extends React.ComponentProps<'main'> {
77
+ /** The element responsible for scrolling the main content region. */
78
+ scrollOwner?: 'main' | 'container';
79
+ }
80
+
81
+ function AppShellMain({
82
+ className,
83
+ id = 'main-content',
84
+ scrollOwner = 'main',
85
+ ...props
86
+ }: AppShellMainProps) {
87
+ return (
88
+ <main
89
+ id={id}
90
+ tabIndex={-1}
91
+ data-slot="app-shell-main"
92
+ className={cn(
93
+ scrollOwner === 'main'
94
+ ? 'min-h-0 min-w-0 flex-1 overflow-auto outline-none'
95
+ : 'min-w-0 flex-1 outline-none',
96
+ className,
97
+ )}
98
+ {...props}
99
+ />
100
+ );
101
+ }
102
+
103
+ export {
104
+ AppShell,
105
+ AppShellSidebar,
106
+ AppShellContent,
107
+ AppShellHeader,
108
+ AppShellMain,
109
+ type AppShellMainProps,
110
+ };