@vendure-io/ui 1.0.4 → 1.1.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/README.md +49 -0
- package/package.json +3 -2
- package/src/components/ui/button-group.tsx +2 -1
- package/src/components/ui/button.tsx +2 -1
- package/src/components/ui/card.tsx +2 -1
- package/src/components/ui/checkbox.tsx +2 -1
- package/src/components/ui/combobox.tsx +2 -1
- package/src/components/ui/input-group.tsx +2 -1
- package/src/components/ui/input-otp.tsx +2 -1
- package/src/components/ui/input.tsx +2 -1
- package/src/components/ui/menubar.tsx +2 -1
- package/src/components/ui/native-select.tsx +2 -1
- package/src/components/ui/select.tsx +4 -2
- package/src/components/ui/slider.tsx +2 -1
- package/src/components/ui/switch.tsx +2 -1
- package/src/components/ui/tabs.tsx +2 -1
- package/src/components/ui/textarea.tsx +2 -1
- package/src/components/ui/toggle-group.tsx +2 -1
- package/src/components/ui/toggle.tsx +2 -1
- package/src/lib/base-ui.ts +53 -0
package/README.md
CHANGED
|
@@ -29,8 +29,57 @@ import { cn } from "@vendure-io/ui/lib/utils";
|
|
|
29
29
|
| `@vendure-io/ui/components/ui/*` | shadcn/ui primitives (button, dialog, input, etc.) |
|
|
30
30
|
| `@vendure-io/ui/components/custom/*` | Vendure-specific components |
|
|
31
31
|
| `@vendure-io/ui/lib/*` | Utilities (`cn`, etc.) |
|
|
32
|
+
| `@vendure-io/ui/lib/base-ui` | `@base-ui/react` primitive namespaces (see below) |
|
|
32
33
|
| `@vendure-io/ui/hooks/*` | Shared React hooks |
|
|
33
34
|
|
|
35
|
+
## Customizing wrapper components
|
|
36
|
+
|
|
37
|
+
The components under `components/ui/*` 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:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// In your own dialog.tsx
|
|
41
|
+
import { DialogPrimitive } from "@vendure-io/ui/lib/base-ui";
|
|
42
|
+
import {
|
|
43
|
+
Dialog,
|
|
44
|
+
DialogClose,
|
|
45
|
+
DialogContent,
|
|
46
|
+
DialogDescription,
|
|
47
|
+
DialogFooter,
|
|
48
|
+
DialogHeader,
|
|
49
|
+
DialogOverlay,
|
|
50
|
+
DialogPortal,
|
|
51
|
+
DialogTrigger,
|
|
52
|
+
} from "@vendure-io/ui/components/ui/dialog";
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
Dialog,
|
|
56
|
+
DialogClose,
|
|
57
|
+
DialogContent,
|
|
58
|
+
DialogDescription,
|
|
59
|
+
DialogFooter,
|
|
60
|
+
DialogHeader,
|
|
61
|
+
DialogOverlay,
|
|
62
|
+
DialogPortal,
|
|
63
|
+
DialogTrigger,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
67
|
+
return (
|
|
68
|
+
<DialogPrimitive.Title
|
|
69
|
+
data-slot="dialog-title"
|
|
70
|
+
className={cn("font-display text-lg", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Each primitive is exposed as a TypeScript namespace, so you get both the runtime component (`<DialogPrimitive.Title />`) and its prop types (`DialogPrimitive.Title.Props`) from the same import. This means you don't need `@base-ui/react` as a direct dependency in your project — `@vendure-io/ui` is the single source of truth for both wrappers and primitives.
|
|
78
|
+
|
|
79
|
+
Available primitives include `AccordionPrimitive`, `AlertDialogPrimitive`, `AvatarPrimitive`, `ButtonPrimitive`, `CheckboxPrimitive`, `CollapsiblePrimitive`, `ComboboxPrimitive`, `ContextMenuPrimitive`, `DialogPrimitive`, `InputPrimitive`, `MenuPrimitive`, `MenubarPrimitive`, `NavigationMenuPrimitive`, `PopoverPrimitive`, `PreviewCardPrimitive`, `ProgressPrimitive`, `RadioPrimitive`, `RadioGroupPrimitive`, `ScrollAreaPrimitive`, `SelectPrimitive`, `SeparatorPrimitive`, `SliderPrimitive`, `SwitchPrimitive`, `TabsPrimitive`, `TogglePrimitive`, `ToggleGroupPrimitive`, `TooltipPrimitive`, plus the `mergeProps` and `useRender` helpers.
|
|
80
|
+
|
|
81
|
+
> Where two wrappers share the same base-ui primitive (e.g. both `dialog` and `sheet` are built on `Dialog`; both `dropdown-menu` and `menubar` on `Menu`), the primitive is exposed under its canonical base-ui name only.
|
|
82
|
+
|
|
34
83
|
## License
|
|
35
84
|
|
|
36
85
|
See [LICENSE.md](../../LICENSE.md) for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure-io/ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.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",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"directory": "packages/ui"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
|
+
"sideEffects": false,
|
|
13
14
|
"exports": {
|
|
14
15
|
"./components/ui/*": "./src/components/ui/*.tsx",
|
|
15
16
|
"./components/custom/*": "./src/components/custom/*.tsx",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@base-ui/react": "^1.2.0",
|
|
47
|
-
"@vendure-io/design-tokens": "^1.1.
|
|
48
|
+
"@vendure-io/design-tokens": "^1.1.2",
|
|
48
49
|
"class-variance-authority": "^0.7.1",
|
|
49
50
|
"clsx": "^2.1.1",
|
|
50
51
|
"cmdk": "^1.1.1",
|
|
@@ -38,6 +38,7 @@ function ButtonGroup({
|
|
|
38
38
|
)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
41
42
|
function ButtonGroupText({
|
|
42
43
|
className,
|
|
43
44
|
render,
|
|
@@ -48,7 +49,7 @@ function ButtonGroupText({
|
|
|
48
49
|
props: mergeProps<"div">(
|
|
49
50
|
{
|
|
50
51
|
className: cn(
|
|
51
|
-
"bg-muted gap-2 rounded-md border px-2.5 text-sm font-medium
|
|
52
|
+
"bg-muted gap-2 rounded-md border px-2.5 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",
|
|
52
53
|
className
|
|
53
54
|
),
|
|
54
55
|
},
|
|
@@ -5,6 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
7
|
|
|
8
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
8
9
|
const buttonVariants = cva(
|
|
9
10
|
"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 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
|
10
11
|
{
|
|
@@ -12,7 +13,7 @@ const buttonVariants = cva(
|
|
|
12
13
|
variant: {
|
|
13
14
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
14
15
|
outline:
|
|
15
|
-
"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
|
+
"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
17
|
secondary:
|
|
17
18
|
"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
18
19
|
ghost:
|
|
@@ -2,6 +2,7 @@ import * as React from "react"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
5
6
|
function Card({
|
|
6
7
|
className,
|
|
7
8
|
size = "default",
|
|
@@ -12,7 +13,7 @@ function Card({
|
|
|
12
13
|
data-slot="card"
|
|
13
14
|
data-size={size}
|
|
14
15
|
className={cn(
|
|
15
|
-
"ring-foreground/10 bg-card text-card-foreground group/card flex flex-col gap-6 overflow-hidden rounded-xl py-6 text-sm
|
|
16
|
+
"ring-foreground/10 bg-card text-card-foreground group/card flex flex-col gap-6 overflow-hidden rounded-xl py-6 text-sm ring-1 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",
|
|
16
17
|
className
|
|
17
18
|
)}
|
|
18
19
|
{...props}
|
|
@@ -5,12 +5,13 @@ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
|
|
|
5
5
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
6
6
|
import { CheckIcon } from "lucide-react"
|
|
7
7
|
|
|
8
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
8
9
|
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
9
10
|
return (
|
|
10
11
|
<CheckboxPrimitive.Root
|
|
11
12
|
data-slot="checkbox"
|
|
12
13
|
className={cn(
|
|
13
|
-
"border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 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
|
|
14
|
+
"border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 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
15
|
className
|
|
15
16
|
)}
|
|
16
17
|
{...props}
|
|
@@ -212,6 +212,7 @@ function ComboboxSeparator({
|
|
|
212
212
|
)
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
215
216
|
function ComboboxChips({
|
|
216
217
|
className,
|
|
217
218
|
...props
|
|
@@ -221,7 +222,7 @@ function ComboboxChips({
|
|
|
221
222
|
<ComboboxPrimitive.Chips
|
|
222
223
|
data-slot="combobox-chips"
|
|
223
224
|
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 dark:has-aria-invalid:border-destructive/50 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
|
|
225
|
+
"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 dark:has-aria-invalid:border-destructive/50 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
226
|
className
|
|
226
227
|
)}
|
|
227
228
|
{...props}
|
|
@@ -8,13 +8,14 @@ import { Button } from "@vendure-io/ui/components/ui/button"
|
|
|
8
8
|
import { Input } from "@vendure-io/ui/components/ui/input"
|
|
9
9
|
import { Textarea } from "@vendure-io/ui/components/ui/textarea"
|
|
10
10
|
|
|
11
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
11
12
|
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
12
13
|
return (
|
|
13
14
|
<div
|
|
14
15
|
data-slot="input-group"
|
|
15
16
|
role="group"
|
|
16
17
|
className={cn(
|
|
17
|
-
"border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border
|
|
18
|
+
"border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
|
|
18
19
|
className
|
|
19
20
|
)}
|
|
20
21
|
{...props}
|
|
@@ -40,6 +40,7 @@ function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
43
44
|
function InputOTPSlot({
|
|
44
45
|
index,
|
|
45
46
|
className,
|
|
@@ -55,7 +56,7 @@ function InputOTPSlot({
|
|
|
55
56
|
data-slot="input-otp-slot"
|
|
56
57
|
data-active={isActive}
|
|
57
58
|
className={cn(
|
|
58
|
-
"dark:bg-input/30 border-input data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive relative flex size-9 items-center justify-center border-y border-r text-sm
|
|
59
|
+
"dark:bg-input/30 border-input data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive relative flex size-9 items-center justify-center border-y border-r text-sm transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-3",
|
|
59
60
|
className
|
|
60
61
|
)}
|
|
61
62
|
{...props}
|
|
@@ -3,13 +3,14 @@ import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
5
5
|
|
|
6
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
6
7
|
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
7
8
|
return (
|
|
8
9
|
<InputPrimitive
|
|
9
10
|
type={type}
|
|
10
11
|
data-slot="input"
|
|
11
12
|
className={cn(
|
|
12
|
-
"dark:bg-input/30 border-input 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 file:text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base
|
|
13
|
+
"dark:bg-input/30 border-input 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 file:text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",
|
|
13
14
|
className
|
|
14
15
|
)}
|
|
15
16
|
{...props}
|
|
@@ -22,12 +22,13 @@ import {
|
|
|
22
22
|
} from "@vendure-io/ui/components/ui/dropdown-menu"
|
|
23
23
|
import { CheckIcon } from "lucide-react"
|
|
24
24
|
|
|
25
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
25
26
|
function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
26
27
|
return (
|
|
27
28
|
<MenubarPrimitive
|
|
28
29
|
data-slot="menubar"
|
|
29
30
|
className={cn(
|
|
30
|
-
"bg-background flex h-9 items-center gap-1 rounded-md border p-1
|
|
31
|
+
"bg-background flex h-9 items-center gap-1 rounded-md border p-1",
|
|
31
32
|
className
|
|
32
33
|
)}
|
|
33
34
|
{...props}
|
|
@@ -7,6 +7,7 @@ type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
|
|
|
7
7
|
size?: "sm" | "default"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
10
11
|
function NativeSelect({
|
|
11
12
|
className,
|
|
12
13
|
size = "default",
|
|
@@ -24,7 +25,7 @@ function NativeSelect({
|
|
|
24
25
|
<select
|
|
25
26
|
data-slot="native-select"
|
|
26
27
|
data-size={size}
|
|
27
|
-
className="border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-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 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent py-1 pr-8 pl-2.5 text-sm
|
|
28
|
+
className="border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-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 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent py-1 pr-8 pl-2.5 text-sm transition-[color,box-shadow] outline-none select-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:ring-3 data-[size=sm]:h-8"
|
|
28
29
|
{...props}
|
|
29
30
|
/>
|
|
30
31
|
<ChevronDownIcon className="text-muted-foreground pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 select-none" aria-hidden="true" data-slot="native-select-icon" />
|
|
@@ -28,6 +28,7 @@ function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
|
|
|
28
28
|
)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
31
32
|
function SelectTrigger({
|
|
32
33
|
className,
|
|
33
34
|
size = "default",
|
|
@@ -41,7 +42,7 @@ function SelectTrigger({
|
|
|
41
42
|
data-slot="select-trigger"
|
|
42
43
|
data-size={size}
|
|
43
44
|
className={cn(
|
|
44
|
-
"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
|
|
45
|
+
"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 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
45
46
|
className
|
|
46
47
|
)}
|
|
47
48
|
{...props}
|
|
@@ -56,6 +57,7 @@ function SelectTrigger({
|
|
|
56
57
|
)
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
// [vendure] changed w-(--anchor-width) to min-w-(--anchor-width) so dropdown expands to fit content
|
|
59
61
|
function SelectContent({
|
|
60
62
|
className,
|
|
61
63
|
children,
|
|
@@ -83,7 +85,7 @@ function SelectContent({
|
|
|
83
85
|
<SelectPrimitive.Popup
|
|
84
86
|
data-slot="select-content"
|
|
85
87
|
data-align-trigger={alignItemWithTrigger}
|
|
86
|
-
className={cn("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) w-(--anchor-width)
|
|
88
|
+
className={cn("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none", className )}
|
|
87
89
|
{...props}
|
|
88
90
|
>
|
|
89
91
|
<SelectScrollUpButton />
|
|
@@ -44,11 +44,12 @@ function Slider({
|
|
|
44
44
|
className="bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
45
45
|
/>
|
|
46
46
|
</SliderPrimitive.Track>
|
|
47
|
+
{/* [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade */}
|
|
47
48
|
{Array.from({ length: _values.length }, (_, index) => (
|
|
48
49
|
<SliderPrimitive.Thumb
|
|
49
50
|
data-slot="slider-thumb"
|
|
50
51
|
key={index}
|
|
51
|
-
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white
|
|
52
|
+
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white transition-[color,box-shadow] select-none hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
52
53
|
/>
|
|
53
54
|
))}
|
|
54
55
|
</SliderPrimitive.Control>
|
|
@@ -4,6 +4,7 @@ import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
6
6
|
|
|
7
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
7
8
|
function Switch({
|
|
8
9
|
className,
|
|
9
10
|
size = "default",
|
|
@@ -16,7 +17,7 @@ function Switch({
|
|
|
16
17
|
data-slot="switch"
|
|
17
18
|
data-size={size}
|
|
18
19
|
className={cn(
|
|
19
|
-
"data-checked:bg-primary data-unchecked:bg-input 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 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent
|
|
20
|
+
"data-checked:bg-primary data-unchecked:bg-input 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 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",
|
|
20
21
|
className
|
|
21
22
|
)}
|
|
22
23
|
{...props}
|
|
@@ -53,12 +53,13 @@ function TabsList({
|
|
|
53
53
|
)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
56
57
|
function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
|
|
57
58
|
return (
|
|
58
59
|
<TabsPrimitive.Tab
|
|
59
60
|
data-slot="tabs-trigger"
|
|
60
61
|
className={cn(
|
|
61
|
-
"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-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=
|
|
62
|
+
"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-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 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",
|
|
62
63
|
"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 dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
63
64
|
"data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground",
|
|
64
65
|
"after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
@@ -2,12 +2,13 @@ import * as React from "react"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
5
6
|
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
6
7
|
return (
|
|
7
8
|
<textarea
|
|
8
9
|
data-slot="textarea"
|
|
9
10
|
className={cn(
|
|
10
|
-
"border-input dark:bg-input/30 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 placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-2.5 py-2 text-base
|
|
11
|
+
"border-input dark:bg-input/30 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 placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-2.5 py-2 text-base transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",
|
|
11
12
|
className
|
|
12
13
|
)}
|
|
13
14
|
{...props}
|
|
@@ -20,6 +20,7 @@ const ToggleGroupContext = React.createContext<
|
|
|
20
20
|
orientation: "horizontal",
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
23
24
|
function ToggleGroup({
|
|
24
25
|
className,
|
|
25
26
|
variant,
|
|
@@ -42,7 +43,7 @@ function ToggleGroup({
|
|
|
42
43
|
data-orientation={orientation}
|
|
43
44
|
style={{ "--gap": spacing } as React.CSSProperties}
|
|
44
45
|
className={cn(
|
|
45
|
-
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-vertical:flex-col data-vertical:items-stretch
|
|
46
|
+
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-vertical:flex-col data-vertical:items-stretch",
|
|
46
47
|
className
|
|
47
48
|
)}
|
|
48
49
|
{...props}
|
|
@@ -5,13 +5,14 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@vendure-io/ui/lib/utils"
|
|
7
7
|
|
|
8
|
+
// [vendure] shadow removed for flat look — restore if overwritten by shadcn upgrade
|
|
8
9
|
const toggleVariants = cva(
|
|
9
10
|
"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",
|
|
10
11
|
{
|
|
11
12
|
variants: {
|
|
12
13
|
variant: {
|
|
13
14
|
default: "bg-transparent",
|
|
14
|
-
outline: "border-input hover:bg-muted border bg-transparent
|
|
15
|
+
outline: "border-input hover:bg-muted border bg-transparent",
|
|
15
16
|
},
|
|
16
17
|
size: {
|
|
17
18
|
default: "h-9 min-w-9 px-2",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports of `@base-ui/react` primitive namespaces.
|
|
3
|
+
*
|
|
4
|
+
* Why this exists: the wrapper components in `@vendure-io/ui/components/ui/*`
|
|
5
|
+
* are intentionally thin layers over `@base-ui/react` primitives. Consumers
|
|
6
|
+
* (notably `@vendure/dashboard`) often need to override a single subcomponent
|
|
7
|
+
* — e.g. swap `DialogTitle` for one that uses a different font — while
|
|
8
|
+
* re-exporting the rest of the wrapper. To do that they need access to the
|
|
9
|
+
* underlying primitive's types and components (e.g. `Dialog.Title.Props`).
|
|
10
|
+
*
|
|
11
|
+
* Exposing the primitives here means consumers can drop `@base-ui/react` as
|
|
12
|
+
* a direct dependency entirely — `@vendure-io/ui` becomes the single source
|
|
13
|
+
* of truth for both the wrapper and the primitive substrate.
|
|
14
|
+
*
|
|
15
|
+
* Each primitive is a TS namespace, so both values (`<DialogPrimitive.Title />`)
|
|
16
|
+
* and types (`DialogPrimitive.Title.Props`) are available from the same
|
|
17
|
+
* import.
|
|
18
|
+
*
|
|
19
|
+
* Where two wrapper files share a base-ui primitive (e.g. `Dialog` is used
|
|
20
|
+
* by both `dialog.tsx` and `sheet.tsx`; `Menu` by `dropdown-menu.tsx` and
|
|
21
|
+
* `menubar.tsx`), we expose the canonical base-ui name only — they resolve
|
|
22
|
+
* to the same underlying type.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { Accordion as AccordionPrimitive } from '@base-ui/react/accordion';
|
|
26
|
+
export { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';
|
|
27
|
+
export { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
28
|
+
export { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
29
|
+
export { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';
|
|
30
|
+
export { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';
|
|
31
|
+
export { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';
|
|
32
|
+
export { ContextMenu as ContextMenuPrimitive } from '@base-ui/react/context-menu';
|
|
33
|
+
export { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
|
|
34
|
+
export { Input as InputPrimitive } from '@base-ui/react/input';
|
|
35
|
+
export { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
36
|
+
export { Menubar as MenubarPrimitive } from '@base-ui/react/menubar';
|
|
37
|
+
export { mergeProps } from '@base-ui/react/merge-props';
|
|
38
|
+
export { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu';
|
|
39
|
+
export { Popover as PopoverPrimitive } from '@base-ui/react/popover';
|
|
40
|
+
export { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';
|
|
41
|
+
export { Progress as ProgressPrimitive } from '@base-ui/react/progress';
|
|
42
|
+
export { Radio as RadioPrimitive } from '@base-ui/react/radio';
|
|
43
|
+
export { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';
|
|
44
|
+
export { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';
|
|
45
|
+
export { Select as SelectPrimitive } from '@base-ui/react/select';
|
|
46
|
+
export { Separator as SeparatorPrimitive } from '@base-ui/react/separator';
|
|
47
|
+
export { Slider as SliderPrimitive } from '@base-ui/react/slider';
|
|
48
|
+
export { Switch as SwitchPrimitive } from '@base-ui/react/switch';
|
|
49
|
+
export { Tabs as TabsPrimitive } from '@base-ui/react/tabs';
|
|
50
|
+
export { Toggle as TogglePrimitive } from '@base-ui/react/toggle';
|
|
51
|
+
export { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group';
|
|
52
|
+
export { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';
|
|
53
|
+
export { useRender } from '@base-ui/react/use-render';
|