@bearmenu/ui 0.8.36 → 0.8.37
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/dist/{chunk-TVEIUTBQ.js → chunk-IQIJCMG2.js} +1 -1
- package/dist/{chunk-VCRXL7H5.js → chunk-PGQXVJXW.js} +2 -2
- package/dist/{chunk-F3XK34DV.js → chunk-TB2K5JN3.js} +2 -2
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/calendar.js +1 -1
- package/dist/components/combobox.js +3 -3
- package/dist/components/command.d.ts +3 -3
- package/dist/components/command.js +2 -2
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown-menu.js +6 -6
- package/dist/components/input-group.js +1 -1
- package/dist/components/multi-select-combobox.js +2 -2
- package/dist/components/multi-select-menu.js +1 -1
- package/dist/components/responsive-overlay.js +1 -1
- package/dist/components/searchable-select.js +3 -3
- package/dist/components/select.js +2 -2
- package/dist/components/selection-bar.js +1 -1
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/tag.d.ts +2 -2
- package/dist/components/text.d.ts +2 -2
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.d.ts +6 -0
- package/dist/components/toggle.js +1 -1
- package/package.json +1 -1
- package/src/components/calendar.tsx +1 -1
- package/src/components/combobox.tsx +1 -1
- package/src/components/command.test.tsx +10 -0
- package/src/components/command.tsx +1 -1
- package/src/components/dialog.tsx +1 -1
- package/src/components/dropdown-menu.test.tsx +31 -0
- package/src/components/dropdown-menu.tsx +6 -6
- package/src/components/input-group.tsx +1 -1
- package/src/components/multi-select-menu.tsx +1 -1
- package/src/components/searchable-select.tsx +1 -1
- package/src/components/select.tsx +2 -2
- package/src/components/selection-bar.tsx +1 -1
- package/src/components/toggle.test.tsx +19 -0
- package/src/components/toggle.tsx +8 -2
- package/src/globals.css +28 -19
|
@@ -61,7 +61,7 @@ var DialogContent = React.forwardRef(
|
|
|
61
61
|
}, props), {
|
|
62
62
|
children: [
|
|
63
63
|
children,
|
|
64
|
-
showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground opacity-70 transition-opacity hover:bg-accent hover:text-
|
|
64
|
+
showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground opacity-70 transition-opacity hover:bg-accent-subtle hover:text-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none", children: [
|
|
65
65
|
/* @__PURE__ */ jsx(X, { className: "size-4" }),
|
|
66
66
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
67
67
|
] })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from './chunk-
|
|
1
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from './chunk-IQIJCMG2.js';
|
|
2
2
|
import { cn } from './chunk-FEK5XGZW.js';
|
|
3
3
|
import { __objRest, __spreadValues, __spreadProps } from './chunk-MMUBH76A.js';
|
|
4
4
|
import * as React from 'react';
|
|
@@ -122,7 +122,7 @@ var CommandItem = React.forwardRef((_a, ref) => {
|
|
|
122
122
|
ref,
|
|
123
123
|
className: cn(
|
|
124
124
|
"relative flex cursor-default select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none transition-colors",
|
|
125
|
-
"data-[selected=true]:bg-accent data-[selected=true]:text-
|
|
125
|
+
"data-[selected=true]:bg-accent-subtle data-[selected=true]:text-foreground",
|
|
126
126
|
"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
127
127
|
className
|
|
128
128
|
)
|
|
@@ -5,12 +5,12 @@ import { cva } from 'class-variance-authority';
|
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
var toggleVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-semibold hover:bg-accent
|
|
8
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-semibold hover:bg-accent-subtle hover:text-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors aria-invalid:ring-2 aria-invalid:ring-destructive/40 whitespace-nowrap",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
12
|
default: "bg-transparent",
|
|
13
|
-
outline: "border border-border bg-transparent hover:bg-accent
|
|
13
|
+
outline: "border border-border bg-transparent hover:bg-accent-subtle hover:text-foreground data-[state=on]:border-primary",
|
|
14
14
|
/**
|
|
15
15
|
* One cell of a segmented control: a raised card on the group's
|
|
16
16
|
* muted capsule when on, quiet type when off. The group
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "secondary" | "default" | "success" | "warning" | "destructive" | "outline" | "glass" | "overlay" | "brown" | "code" | "onPrimary" | "confirmed" | "pending" | "completed" | "assignee" | "softSuccess" | "softWarning" | "softDestructive" | "softNeutral" | null | undefined;
|
|
8
8
|
size?: "status" | "chip" | null | undefined;
|
|
9
9
|
live?: boolean | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "secondary" | "default" | "link" | "warning" | "destructive" | "outline" | "ghost" | "glass" | "overlay" | "ink" | "brown" | "cta" | null | undefined;
|
|
7
|
+
size?: "default" | "icon" | "cta" | "xs" | "sm" | "lg" | "pill" | "cta-sm" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
8
8
|
fullWidth?: boolean | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -211,7 +211,7 @@ function CalendarDayButton(_a) {
|
|
|
211
211
|
"data-range-end": modifiers.range_end,
|
|
212
212
|
"data-range-middle": modifiers.range_middle,
|
|
213
213
|
className: cn(
|
|
214
|
-
"group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground
|
|
214
|
+
"group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground flex aspect-square h-(--cell-size) w-(--cell-size) size-auto min-w-0 flex-col items-center justify-center gap-1 rounded-md p-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
215
215
|
defaultClassNames.day,
|
|
216
216
|
className
|
|
217
217
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Popover, PopoverTrigger, PopoverContent } from '../chunk-2ADCZXZJ.js';
|
|
2
|
-
import { Command, CommandInput, CommandList, CommandLoading, CommandEmpty, CommandGroup, CommandItem } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
import { Command, CommandInput, CommandList, CommandLoading, CommandEmpty, CommandGroup, CommandItem } from '../chunk-PGQXVJXW.js';
|
|
3
|
+
import '../chunk-IQIJCMG2.js';
|
|
4
4
|
import { Button } from '../chunk-5SGKGFMN.js';
|
|
5
5
|
import '../chunk-RIH2IS7X.js';
|
|
6
6
|
import '../chunk-5YNIQ2BL.js';
|
|
@@ -93,7 +93,7 @@ function Combobox({
|
|
|
93
93
|
e.stopPropagation();
|
|
94
94
|
onValueChange(void 0);
|
|
95
95
|
},
|
|
96
|
-
className: "absolute right-9 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-
|
|
96
|
+
className: "absolute right-9 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
97
97
|
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
98
98
|
}
|
|
99
99
|
)
|
|
@@ -28,7 +28,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
28
28
|
ref?: React.Ref<HTMLInputElement>;
|
|
29
29
|
} & {
|
|
30
30
|
asChild?: boolean;
|
|
31
|
-
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "
|
|
31
|
+
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
|
|
32
32
|
value?: string;
|
|
33
33
|
onValueChange?: (search: string) => void;
|
|
34
34
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -64,7 +64,7 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
|
64
64
|
ref?: React.Ref<HTMLDivElement>;
|
|
65
65
|
} & {
|
|
66
66
|
asChild?: boolean;
|
|
67
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "
|
|
67
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "heading" | "value"> & {
|
|
68
68
|
heading?: React.ReactNode;
|
|
69
69
|
value?: string;
|
|
70
70
|
forceMount?: boolean;
|
|
@@ -82,7 +82,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
82
82
|
ref?: React.Ref<HTMLDivElement>;
|
|
83
83
|
} & {
|
|
84
84
|
asChild?: boolean;
|
|
85
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "
|
|
85
|
+
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild" | "key">, "onSelect" | "value" | "disabled"> & {
|
|
86
86
|
disabled?: boolean;
|
|
87
87
|
onSelect?: (value: string) => void;
|
|
88
88
|
value?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut } from '../chunk-PGQXVJXW.js';
|
|
2
|
+
import '../chunk-IQIJCMG2.js';
|
|
3
3
|
import '../chunk-FEK5XGZW.js';
|
|
4
4
|
import '../chunk-MMUBH76A.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, dialogContentVariants } from '../chunk-
|
|
1
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, dialogContentVariants } from '../chunk-IQIJCMG2.js';
|
|
2
2
|
import '../chunk-FEK5XGZW.js';
|
|
3
3
|
import '../chunk-MMUBH76A.js';
|
|
@@ -62,7 +62,7 @@ function DropdownMenuItem(_a) {
|
|
|
62
62
|
"data-inset": inset,
|
|
63
63
|
"data-variant": variant,
|
|
64
64
|
className: cn(
|
|
65
|
-
"focus:bg-accent focus:text-
|
|
65
|
+
"focus:bg-accent-subtle focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
66
66
|
className
|
|
67
67
|
)
|
|
68
68
|
}, props)
|
|
@@ -85,7 +85,7 @@ function DropdownMenuCheckboxItem(_a) {
|
|
|
85
85
|
__spreadProps(__spreadValues({
|
|
86
86
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
87
87
|
className: cn(
|
|
88
|
-
"focus:bg-accent focus:text-
|
|
88
|
+
"focus:bg-accent-subtle focus:text-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
89
89
|
className
|
|
90
90
|
),
|
|
91
91
|
checked
|
|
@@ -100,7 +100,7 @@ function DropdownMenuCheckboxItem(_a) {
|
|
|
100
100
|
),
|
|
101
101
|
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3" }) })
|
|
102
102
|
}
|
|
103
|
-
) : /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
|
|
103
|
+
) : /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4 text-accent" }) }) }),
|
|
104
104
|
children
|
|
105
105
|
]
|
|
106
106
|
})
|
|
@@ -123,12 +123,12 @@ function DropdownMenuRadioItem(_a) {
|
|
|
123
123
|
__spreadProps(__spreadValues({
|
|
124
124
|
"data-slot": "dropdown-menu-radio-item",
|
|
125
125
|
className: cn(
|
|
126
|
-
"focus:bg-accent focus:text-
|
|
126
|
+
"focus:bg-accent-subtle focus:text-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
127
127
|
className
|
|
128
128
|
)
|
|
129
129
|
}, props), {
|
|
130
130
|
children: [
|
|
131
|
-
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) }) }),
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current text-accent" }) }) }),
|
|
132
132
|
children
|
|
133
133
|
]
|
|
134
134
|
})
|
|
@@ -195,7 +195,7 @@ function DropdownMenuSubTrigger(_a) {
|
|
|
195
195
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
196
196
|
"data-inset": inset,
|
|
197
197
|
className: cn(
|
|
198
|
-
"focus:bg-accent focus:text-
|
|
198
|
+
"focus:bg-accent-subtle focus:text-foreground data-[state=open]:bg-accent-subtle data-[state=open]:text-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
|
|
199
199
|
className
|
|
200
200
|
)
|
|
201
201
|
}, props), {
|
|
@@ -85,7 +85,7 @@ var InputGroupButton = React.forwardRef(
|
|
|
85
85
|
type,
|
|
86
86
|
"data-slot": "input-group-button",
|
|
87
87
|
className: cn(
|
|
88
|
-
"inline-flex h-7 min-w-7 cursor-pointer items-center justify-center gap-1 rounded-md px-2 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent hover:text-
|
|
88
|
+
"inline-flex h-7 min-w-7 cursor-pointer items-center justify-center gap-1 rounded-md px-2 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&:has(svg:only-child)]:w-7 [&:has(svg:only-child)]:px-0 [&_svg]:size-4",
|
|
89
89
|
className
|
|
90
90
|
)
|
|
91
91
|
}, props)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkbox } from '../chunk-L3CDXVEP.js';
|
|
2
2
|
import { Popover, PopoverTrigger, PopoverContent } from '../chunk-2ADCZXZJ.js';
|
|
3
|
-
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from '../chunk-
|
|
4
|
-
import '../chunk-
|
|
3
|
+
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from '../chunk-PGQXVJXW.js';
|
|
4
|
+
import '../chunk-IQIJCMG2.js';
|
|
5
5
|
import { Button } from '../chunk-5SGKGFMN.js';
|
|
6
6
|
import '../chunk-RIH2IS7X.js';
|
|
7
7
|
import '../chunk-5YNIQ2BL.js';
|
|
@@ -54,7 +54,7 @@ function MultiSelectMenu({
|
|
|
54
54
|
onCheckedChange: () => handleToggle(option.value),
|
|
55
55
|
className: cn(
|
|
56
56
|
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none",
|
|
57
|
-
"data-[highlighted]:bg-accent data-[highlighted]:text-
|
|
57
|
+
"data-[highlighted]:bg-accent-subtle data-[highlighted]:text-foreground",
|
|
58
58
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
59
59
|
),
|
|
60
60
|
children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMediaQuery, DESKTOP_MEDIA_QUERY } from '../chunk-OPVKL4VS.js';
|
|
2
2
|
import { Sheet, SheetContent, SheetTitle, SheetDescription } from '../chunk-LAEVMNJN.js';
|
|
3
3
|
import { Drawer, DrawerContent, DrawerTitle, DrawerDescription } from '../chunk-XLHMF6F5.js';
|
|
4
|
-
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '../chunk-
|
|
4
|
+
import { Dialog, DialogContent, DialogTitle, DialogDescription } from '../chunk-IQIJCMG2.js';
|
|
5
5
|
import { cn } from '../chunk-FEK5XGZW.js';
|
|
6
6
|
import { __spreadProps, __spreadValues } from '../chunk-MMUBH76A.js';
|
|
7
7
|
import * as React from 'react';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Popover, PopoverTrigger, PopoverContent } from '../chunk-2ADCZXZJ.js';
|
|
2
|
-
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from '../chunk-PGQXVJXW.js';
|
|
3
|
+
import '../chunk-IQIJCMG2.js';
|
|
4
4
|
import { Button } from '../chunk-5SGKGFMN.js';
|
|
5
5
|
import '../chunk-RIH2IS7X.js';
|
|
6
6
|
import '../chunk-5YNIQ2BL.js';
|
|
@@ -99,7 +99,7 @@ function SearchableSelect({
|
|
|
99
99
|
e.stopPropagation();
|
|
100
100
|
onValueChange(void 0);
|
|
101
101
|
},
|
|
102
|
-
className: "absolute right-9 top-1/2 -translate-y-1/2 inline-flex size-6 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-
|
|
102
|
+
className: "absolute right-9 top-1/2 -translate-y-1/2 inline-flex size-6 items-center justify-center rounded-full text-muted-foreground hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors",
|
|
103
103
|
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
104
104
|
}
|
|
105
105
|
)
|
|
@@ -118,12 +118,12 @@ var SelectItem = React.forwardRef((_a, ref) => {
|
|
|
118
118
|
ref,
|
|
119
119
|
"data-slot": "select-item",
|
|
120
120
|
className: cn(
|
|
121
|
-
"relative flex w-full cursor-default select-none items-center rounded-md py-2 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-
|
|
121
|
+
"relative flex w-full cursor-default select-none items-center rounded-md py-2 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent-subtle data-[highlighted]:text-foreground data-[state=checked]:font-semibold",
|
|
122
122
|
className
|
|
123
123
|
)
|
|
124
124
|
}, props), {
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4" }) }) }),
|
|
126
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4 text-accent" }) }) }),
|
|
127
127
|
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
128
128
|
]
|
|
129
129
|
})
|
|
@@ -43,7 +43,7 @@ var SelectionBar = React.forwardRef(
|
|
|
43
43
|
type: "button",
|
|
44
44
|
"aria-label": "Clear selection",
|
|
45
45
|
onClick: onClear,
|
|
46
|
-
className: "inline-flex size-6 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-
|
|
46
|
+
className: "inline-flex size-6 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
47
47
|
children: /* @__PURE__ */ jsx(X, { className: "size-4" })
|
|
48
48
|
}
|
|
49
49
|
),
|
|
@@ -4,11 +4,11 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
|
|
5
5
|
declare const spinnerVariants: (props?: ({
|
|
6
6
|
size?: "default" | "xs" | "sm" | "lg" | "xl" | null | undefined;
|
|
7
|
-
tone?: "
|
|
7
|
+
tone?: "primary" | "default" | "inherit" | "destructive" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare const Spinner: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
|
|
10
10
|
size?: "default" | "xs" | "sm" | "lg" | "xl" | null | undefined;
|
|
11
|
-
tone?: "
|
|
11
|
+
tone?: "primary" | "default" | "inherit" | "destructive" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
13
13
|
/** Visually-hidden label for screen readers. Defaults to "Loading". */
|
|
14
14
|
label?: string;
|
package/dist/components/tag.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const tagVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "primary" | "default" | "success" | "warning" | "destructive" | "outline" | "quiet" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare const Tag: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
|
|
10
|
-
variant?: "
|
|
10
|
+
variant?: "primary" | "default" | "success" | "warning" | "destructive" | "outline" | "quiet" | null | undefined;
|
|
11
11
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & {
|
|
13
13
|
onRemove?: () => void;
|
|
@@ -22,8 +22,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
22
22
|
* Weights are 400 / 600 / 700. 500 is not in the system.
|
|
23
23
|
*/
|
|
24
24
|
declare const textVariants: (props?: ({
|
|
25
|
-
variant?: "
|
|
26
|
-
color?: "
|
|
25
|
+
variant?: "small" | "body" | "display" | "h2" | "h3" | "label" | "caption" | "h1" | "h4" | "body-lg" | "body-sm" | "overline" | null | undefined;
|
|
26
|
+
color?: "primary" | "default" | "inherit" | "destructive" | "muted" | "primary-foreground" | null | undefined;
|
|
27
27
|
weight?: "bold" | "medium" | "normal" | "semibold" | null | undefined;
|
|
28
28
|
leading?: "none" | "normal" | "tight" | "snug" | "relaxed" | "loose" | null | undefined;
|
|
29
29
|
tracking?: "normal" | "tight" | "wide" | "wider" | null | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toggleVariants } from '../chunk-
|
|
1
|
+
import { toggleVariants } from '../chunk-TB2K5JN3.js';
|
|
2
2
|
import { cn } from '../chunk-FEK5XGZW.js';
|
|
3
3
|
import { __objRest, __spreadProps, __spreadValues } from '../chunk-MMUBH76A.js';
|
|
4
4
|
import * as React from 'react';
|
|
@@ -4,6 +4,12 @@ import * as React from 'react';
|
|
|
4
4
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
5
5
|
import { VariantProps } from 'class-variance-authority';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Hover is a step of the surface (`--accent-subtle`), as Button's quiet
|
|
9
|
+
* variants do. The shadcn default, `hover:bg-accent/50 hover:text-accent-foreground`,
|
|
10
|
+
* put white type on a half-strength terracotta: 2.2:1. The on-state's
|
|
11
|
+
* `data-[state=on]:` utilities sort after `hover:` and still win while on.
|
|
12
|
+
*/
|
|
7
13
|
declare const toggleVariants: (props?: ({
|
|
8
14
|
variant?: "default" | "tab" | "outline" | "chip" | "segmented" | null | undefined;
|
|
9
15
|
size?: "default" | "sm" | "lg" | null | undefined;
|
package/package.json
CHANGED
|
@@ -238,7 +238,7 @@ function CalendarDayButton({
|
|
|
238
238
|
data-range-end={modifiers.range_end}
|
|
239
239
|
data-range-middle={modifiers.range_middle}
|
|
240
240
|
className={cn(
|
|
241
|
-
"group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground
|
|
241
|
+
"group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground flex aspect-square h-(--cell-size) w-(--cell-size) size-auto min-w-0 flex-col items-center justify-center gap-1 rounded-md p-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
242
242
|
defaultClassNames.day,
|
|
243
243
|
className
|
|
244
244
|
)}
|
|
@@ -124,7 +124,7 @@ function Combobox({
|
|
|
124
124
|
e.stopPropagation();
|
|
125
125
|
onValueChange(undefined);
|
|
126
126
|
}}
|
|
127
|
-
className="absolute right-9 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-
|
|
127
|
+
className="absolute right-9 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
|
|
128
128
|
>
|
|
129
129
|
<X className="size-3.5" />
|
|
130
130
|
</button>
|
|
@@ -88,4 +88,14 @@ describe("Command", () => {
|
|
|
88
88
|
await user.keyboard("{ArrowDown}{Enter}");
|
|
89
89
|
expect(onSelect).toHaveBeenCalledWith("banana");
|
|
90
90
|
});
|
|
91
|
+
|
|
92
|
+
it("highlights the selected row with the subtle well, not the accent fill", () => {
|
|
93
|
+
render(<CommandSample />);
|
|
94
|
+
const row = screen.getByRole("option", { name: "Apple" });
|
|
95
|
+
expect(row).toHaveClass(
|
|
96
|
+
"data-[selected=true]:bg-accent-subtle",
|
|
97
|
+
"data-[selected=true]:text-foreground"
|
|
98
|
+
);
|
|
99
|
+
expect(row).not.toHaveClass("data-[selected=true]:bg-accent");
|
|
100
|
+
});
|
|
91
101
|
});
|
|
@@ -138,7 +138,7 @@ const CommandItem = React.forwardRef<
|
|
|
138
138
|
ref={ref}
|
|
139
139
|
className={cn(
|
|
140
140
|
"relative flex cursor-default select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none transition-colors",
|
|
141
|
-
"data-[selected=true]:bg-accent data-[selected=true]:text-
|
|
141
|
+
"data-[selected=true]:bg-accent-subtle data-[selected=true]:text-foreground",
|
|
142
142
|
"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
143
143
|
className
|
|
144
144
|
)}
|
|
@@ -79,7 +79,7 @@ const DialogContent = React.forwardRef<
|
|
|
79
79
|
>
|
|
80
80
|
{children}
|
|
81
81
|
{showCloseButton && (
|
|
82
|
-
<DialogPrimitive.Close className="absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground opacity-70 transition-opacity hover:bg-accent hover:text-
|
|
82
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground opacity-70 transition-opacity hover:bg-accent-subtle hover:text-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none">
|
|
83
83
|
<X className="size-4" />
|
|
84
84
|
<span className="sr-only">Close</span>
|
|
85
85
|
</DialogPrimitive.Close>
|
|
@@ -177,4 +177,35 @@ describe("DropdownMenu", () => {
|
|
|
177
177
|
expect(screen.getByText("Group")).toBeInTheDocument();
|
|
178
178
|
expect(document.querySelector("[data-slot=dropdown-menu-separator]")).not.toBeNull();
|
|
179
179
|
});
|
|
180
|
+
|
|
181
|
+
// A highlighted row is a tinted well with ink type; terracotta is kept for
|
|
182
|
+
// the checked indicators. A solid-accent row read as a second primary.
|
|
183
|
+
it("highlights rows with the subtle well and marks checked items in the accent", async () => {
|
|
184
|
+
const user = userEvent.setup();
|
|
185
|
+
render(
|
|
186
|
+
<DropdownMenu>
|
|
187
|
+
<DropdownMenuTrigger>Open</DropdownMenuTrigger>
|
|
188
|
+
<DropdownMenuContent>
|
|
189
|
+
<DropdownMenuItem>One</DropdownMenuItem>
|
|
190
|
+
<DropdownMenuCheckboxItem checked>Two</DropdownMenuCheckboxItem>
|
|
191
|
+
<DropdownMenuRadioGroup value="a">
|
|
192
|
+
<DropdownMenuRadioItem value="a">Three</DropdownMenuRadioItem>
|
|
193
|
+
</DropdownMenuRadioGroup>
|
|
194
|
+
</DropdownMenuContent>
|
|
195
|
+
</DropdownMenu>
|
|
196
|
+
);
|
|
197
|
+
await user.click(screen.getByText("Open"));
|
|
198
|
+
const rows = [
|
|
199
|
+
screen.getByRole("menuitem", { name: "One" }),
|
|
200
|
+
screen.getByRole("menuitemcheckbox", { name: "Two" }),
|
|
201
|
+
screen.getByRole("menuitemradio", { name: "Three" }),
|
|
202
|
+
];
|
|
203
|
+
for (const row of rows) {
|
|
204
|
+
expect(row).toHaveClass("focus:bg-accent-subtle", "focus:text-foreground");
|
|
205
|
+
expect(row).not.toHaveClass("focus:bg-accent");
|
|
206
|
+
expect(row).not.toHaveClass("focus:text-accent-foreground");
|
|
207
|
+
}
|
|
208
|
+
expect(rows[1]?.querySelector("svg")).toHaveClass("text-accent");
|
|
209
|
+
expect(rows[2]?.querySelector("svg")).toHaveClass("text-accent");
|
|
210
|
+
});
|
|
180
211
|
});
|
|
@@ -67,7 +67,7 @@ function DropdownMenuItem({
|
|
|
67
67
|
data-inset={inset}
|
|
68
68
|
data-variant={variant}
|
|
69
69
|
className={cn(
|
|
70
|
-
"focus:bg-accent focus:text-
|
|
70
|
+
"focus:bg-accent-subtle focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
{...props}
|
|
@@ -89,7 +89,7 @@ function DropdownMenuCheckboxItem({
|
|
|
89
89
|
<DropdownMenuPrimitive.CheckboxItem
|
|
90
90
|
data-slot="dropdown-menu-checkbox-item"
|
|
91
91
|
className={cn(
|
|
92
|
-
"focus:bg-accent focus:text-
|
|
92
|
+
"focus:bg-accent-subtle focus:text-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
93
93
|
className
|
|
94
94
|
)}
|
|
95
95
|
checked={checked}
|
|
@@ -111,7 +111,7 @@ function DropdownMenuCheckboxItem({
|
|
|
111
111
|
</span>
|
|
112
112
|
) : (
|
|
113
113
|
<DropdownMenuPrimitive.ItemIndicator>
|
|
114
|
-
<CheckIcon className="size-4" />
|
|
114
|
+
<CheckIcon className="size-4 text-accent" />
|
|
115
115
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
116
116
|
)}
|
|
117
117
|
</span>
|
|
@@ -135,14 +135,14 @@ function DropdownMenuRadioItem({
|
|
|
135
135
|
<DropdownMenuPrimitive.RadioItem
|
|
136
136
|
data-slot="dropdown-menu-radio-item"
|
|
137
137
|
className={cn(
|
|
138
|
-
"focus:bg-accent focus:text-
|
|
138
|
+
"focus:bg-accent-subtle focus:text-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
139
139
|
className
|
|
140
140
|
)}
|
|
141
141
|
{...props}
|
|
142
142
|
>
|
|
143
143
|
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
144
144
|
<DropdownMenuPrimitive.ItemIndicator>
|
|
145
|
-
<CircleIcon className="size-2 fill-current" />
|
|
145
|
+
<CircleIcon className="size-2 fill-current text-accent" />
|
|
146
146
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
147
147
|
</span>
|
|
148
148
|
{children}
|
|
@@ -207,7 +207,7 @@ function DropdownMenuSubTrigger({
|
|
|
207
207
|
data-slot="dropdown-menu-sub-trigger"
|
|
208
208
|
data-inset={inset}
|
|
209
209
|
className={cn(
|
|
210
|
-
"focus:bg-accent focus:text-
|
|
210
|
+
"focus:bg-accent-subtle focus:text-foreground data-[state=open]:bg-accent-subtle data-[state=open]:text-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
|
|
211
211
|
className
|
|
212
212
|
)}
|
|
213
213
|
{...props}
|
|
@@ -92,7 +92,7 @@ const InputGroupButton = React.forwardRef<HTMLButtonElement, React.ButtonHTMLAtt
|
|
|
92
92
|
type={type}
|
|
93
93
|
data-slot="input-group-button"
|
|
94
94
|
className={cn(
|
|
95
|
-
"inline-flex h-7 min-w-7 cursor-pointer items-center justify-center gap-1 rounded-md px-2 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent hover:text-
|
|
95
|
+
"inline-flex h-7 min-w-7 cursor-pointer items-center justify-center gap-1 rounded-md px-2 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&:has(svg:only-child)]:w-7 [&:has(svg:only-child)]:px-0 [&_svg]:size-4",
|
|
96
96
|
className
|
|
97
97
|
)}
|
|
98
98
|
{...props}
|
|
@@ -81,7 +81,7 @@ export function MultiSelectMenu({
|
|
|
81
81
|
onCheckedChange={() => handleToggle(option.value)}
|
|
82
82
|
className={cn(
|
|
83
83
|
"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none",
|
|
84
|
-
"data-[highlighted]:bg-accent data-[highlighted]:text-
|
|
84
|
+
"data-[highlighted]:bg-accent-subtle data-[highlighted]:text-foreground",
|
|
85
85
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
|
|
86
86
|
)}
|
|
87
87
|
>
|
|
@@ -120,7 +120,7 @@ export function SearchableSelect({
|
|
|
120
120
|
e.stopPropagation();
|
|
121
121
|
onValueChange(undefined);
|
|
122
122
|
}}
|
|
123
|
-
className="absolute right-9 top-1/2 -translate-y-1/2 inline-flex size-6 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-
|
|
123
|
+
className="absolute right-9 top-1/2 -translate-y-1/2 inline-flex size-6 items-center justify-center rounded-full text-muted-foreground hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors"
|
|
124
124
|
>
|
|
125
125
|
<X className="size-3.5" />
|
|
126
126
|
</button>
|
|
@@ -126,14 +126,14 @@ const SelectItem = React.forwardRef<
|
|
|
126
126
|
ref={ref}
|
|
127
127
|
data-slot="select-item"
|
|
128
128
|
className={cn(
|
|
129
|
-
"relative flex w-full cursor-default select-none items-center rounded-md py-2 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-
|
|
129
|
+
"relative flex w-full cursor-default select-none items-center rounded-md py-2 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent-subtle data-[highlighted]:text-foreground data-[state=checked]:font-semibold",
|
|
130
130
|
className
|
|
131
131
|
)}
|
|
132
132
|
{...props}
|
|
133
133
|
>
|
|
134
134
|
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
135
135
|
<SelectPrimitive.ItemIndicator>
|
|
136
|
-
<Check className="size-4" />
|
|
136
|
+
<Check className="size-4 text-accent" />
|
|
137
137
|
</SelectPrimitive.ItemIndicator>
|
|
138
138
|
</span>
|
|
139
139
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
@@ -46,7 +46,7 @@ const SelectionBar = React.forwardRef<HTMLDivElement, SelectionBarProps>(
|
|
|
46
46
|
type="button"
|
|
47
47
|
aria-label="Clear selection"
|
|
48
48
|
onClick={onClear}
|
|
49
|
-
className="inline-flex size-6 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-
|
|
49
|
+
className="inline-flex size-6 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent-subtle hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
50
50
|
>
|
|
51
51
|
<X className="size-4" />
|
|
52
52
|
</button>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { toggleVariants } from "./toggle";
|
|
4
|
+
|
|
5
|
+
describe("toggleVariants", () => {
|
|
6
|
+
// White on a half-strength terracotta measured 2.2:1. Hover steps the
|
|
7
|
+
// surface instead, as Button's quiet variants do; the on-state keeps the fill.
|
|
8
|
+
it("default and outline tint on hover and keep the accent fill for the on-state", () => {
|
|
9
|
+
for (const variant of ["default", "outline"] as const) {
|
|
10
|
+
const classes = toggleVariants({ variant });
|
|
11
|
+
expect(classes).toContain("hover:bg-accent-subtle");
|
|
12
|
+
expect(classes).toContain("hover:text-foreground");
|
|
13
|
+
expect(classes).not.toContain("hover:bg-accent/50");
|
|
14
|
+
expect(classes).not.toContain("hover:text-accent-foreground");
|
|
15
|
+
expect(classes).toContain("data-[state=on]:bg-accent");
|
|
16
|
+
expect(classes).toContain("data-[state=on]:text-accent-foreground");
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -6,14 +6,20 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
6
6
|
|
|
7
7
|
import { cn } from "../lib/utils";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Hover is a step of the surface (`--accent-subtle`), as Button's quiet
|
|
11
|
+
* variants do. The shadcn default, `hover:bg-accent/50 hover:text-accent-foreground`,
|
|
12
|
+
* put white type on a half-strength terracotta: 2.2:1. The on-state's
|
|
13
|
+
* `data-[state=on]:` utilities sort after `hover:` and still win while on.
|
|
14
|
+
*/
|
|
9
15
|
const toggleVariants = cva(
|
|
10
|
-
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-semibold hover:bg-accent
|
|
16
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-semibold hover:bg-accent-subtle hover:text-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors aria-invalid:ring-2 aria-invalid:ring-destructive/40 whitespace-nowrap",
|
|
11
17
|
{
|
|
12
18
|
variants: {
|
|
13
19
|
variant: {
|
|
14
20
|
default: "bg-transparent",
|
|
15
21
|
outline:
|
|
16
|
-
"border border-border bg-transparent hover:bg-accent
|
|
22
|
+
"border border-border bg-transparent hover:bg-accent-subtle hover:text-foreground data-[state=on]:border-primary",
|
|
17
23
|
/**
|
|
18
24
|
* One cell of a segmented control: a raised card on the group's
|
|
19
25
|
* muted capsule when on, quiet type when off. The group
|
package/src/globals.css
CHANGED
|
@@ -130,14 +130,19 @@ h6 {
|
|
|
130
130
|
--ink-secondary: oklch(0.45 0 0);
|
|
131
131
|
--ink-tertiary: oklch(0.52 0 0);
|
|
132
132
|
--radius: 0.625rem;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
--sidebar
|
|
139
|
-
--sidebar-
|
|
140
|
-
--sidebar-
|
|
133
|
+
/* Chrome is the card surface — no third tone. The sidebar aliases the card
|
|
134
|
+
and the shared roles instead of carrying shadcn's factory greys (and, in
|
|
135
|
+
dark, a stray blue primary). `.dark` restates the same aliases: a custom
|
|
136
|
+
property resolves where it is declared, so a `.dark` placed below :root
|
|
137
|
+
would otherwise inherit the light values. */
|
|
138
|
+
--sidebar: var(--card);
|
|
139
|
+
--sidebar-foreground: var(--card-foreground);
|
|
140
|
+
--sidebar-primary: var(--primary);
|
|
141
|
+
--sidebar-primary-foreground: var(--primary-foreground);
|
|
142
|
+
--sidebar-accent: var(--accent-subtle);
|
|
143
|
+
--sidebar-accent-foreground: var(--foreground);
|
|
144
|
+
--sidebar-border: var(--border);
|
|
145
|
+
--sidebar-ring: var(--ring);
|
|
141
146
|
--success: oklch(0.48 0.17 150);
|
|
142
147
|
--success-foreground: oklch(0.985 0 0);
|
|
143
148
|
--warning: oklch(0.72 0.18 68);
|
|
@@ -330,8 +335,9 @@ h6 {
|
|
|
330
335
|
--accent: oklch(0.66 0.09 45);
|
|
331
336
|
--accent-foreground: oklch(0.155 0.01 45);
|
|
332
337
|
--accent-subtle: oklch(0.255 0.022 45);
|
|
333
|
-
/*
|
|
334
|
-
|
|
338
|
+
/* Dialed back from 0.68 to soften eye strain; 0.575 rather than 0.58 so
|
|
339
|
+
white on it clears AA (4.56:1, was 4.46:1). */
|
|
340
|
+
--destructive: oklch(0.575 0.17 25.7);
|
|
335
341
|
--destructive-foreground: oklch(0.985 0 0);
|
|
336
342
|
/** Lifted for text on `--card`, where the solid token measures ~3.8:1. */
|
|
337
343
|
--destructive-ink: oklch(0.72 0.15 25);
|
|
@@ -368,16 +374,19 @@ h6 {
|
|
|
368
374
|
in dark, elevation is carried by the scrim and by lightness, not by a
|
|
369
375
|
shadow nobody can see. */
|
|
370
376
|
--scrim-overlay: oklch(0.05 0.01 55 / 0.78);
|
|
371
|
-
--sidebar:
|
|
372
|
-
--sidebar-foreground:
|
|
373
|
-
--sidebar-primary:
|
|
374
|
-
--sidebar-primary-foreground:
|
|
375
|
-
--sidebar-accent:
|
|
376
|
-
--sidebar-accent-foreground:
|
|
377
|
-
--sidebar-border:
|
|
378
|
-
--sidebar-ring:
|
|
377
|
+
--sidebar: var(--card);
|
|
378
|
+
--sidebar-foreground: var(--card-foreground);
|
|
379
|
+
--sidebar-primary: var(--primary);
|
|
380
|
+
--sidebar-primary-foreground: var(--primary-foreground);
|
|
381
|
+
--sidebar-accent: var(--accent-subtle);
|
|
382
|
+
--sidebar-accent-foreground: var(--foreground);
|
|
383
|
+
--sidebar-border: var(--border);
|
|
384
|
+
--sidebar-ring: var(--ring);
|
|
379
385
|
--success: oklch(0.63 0.17 150);
|
|
380
|
-
--
|
|
386
|
+
/* Dark type on the fill, as --primary and --accent do in dark: white on
|
|
387
|
+
this green measured 3.12:1, and darkening the fill to reach 4.5:1 would
|
|
388
|
+
cost it a tenth of lightness and its presence on the card. 6.01:1. */
|
|
389
|
+
--success-foreground: oklch(0.155 0.01 45);
|
|
381
390
|
--warning: oklch(0.76 0.15 68);
|
|
382
391
|
--warning-foreground: oklch(0.18 0.04 45);
|
|
383
392
|
|