@bearmenu/ui 0.8.25 → 0.8.27
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-VEGFQSZA.js → chunk-F3XK34DV.js} +8 -0
- package/dist/chunk-L3CDXVEP.js +56 -0
- package/dist/{chunk-CZK2MRS2.js → chunk-VEFKZIK6.js} +13 -3
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/banner.d.ts +36 -0
- package/dist/components/banner.js +29 -0
- package/dist/components/button.d.ts +1 -1
- package/dist/components/card.d.ts +2 -2
- package/dist/components/checkbox.d.ts +9 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/command.d.ts +15 -15
- package/dist/components/currency-input.js +1 -1
- package/dist/components/date-input.js +1 -1
- package/dist/components/event-detail-panel.js +1 -1
- package/dist/components/event-index-row.js +1 -1
- package/dist/components/event-list-row-wide.js +1 -1
- package/dist/components/event-list-row.js +1 -1
- package/dist/components/field.d.ts +15 -1
- package/dist/components/field.js +64 -21
- package/dist/components/input.d.ts +1 -0
- package/dist/components/input.js +1 -1
- package/dist/components/item.d.ts +2 -2
- package/dist/components/kitchen-dossier.js +1 -1
- package/dist/components/multi-select-combobox.js +1 -1
- package/dist/components/multi-select-menu.js +1 -1
- package/dist/components/place-card.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 +3 -3
- package/dist/components/textarea.d.ts +10 -3
- package/dist/components/textarea.js +21 -6
- package/dist/components/toggle-group.js +5 -5
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/toggle.js +1 -1
- package/package.json +207 -23
- package/src/components/banner.stories.tsx +36 -0
- package/src/components/banner.tsx +58 -0
- package/src/components/booking-details-primitives.test.tsx +75 -0
- package/src/components/checkbox.tsx +49 -23
- package/src/components/field.stories.tsx +51 -1
- package/src/components/field.tsx +70 -9
- package/src/components/input.tsx +13 -2
- package/src/components/textarea.tsx +25 -7
- package/src/components/toggle-group.tsx +4 -4
- package/src/components/toggle.tsx +8 -0
- package/dist/chunk-NMEVJT5Q.js +0 -26
|
@@ -2,31 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
6
|
import { Check, Minus } from "lucide-react";
|
|
6
7
|
import { cn } from "../lib/utils";
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
const checkboxVariants = cva(
|
|
10
|
+
"peer size-5 shrink-0 rounded-md border border-border bg-background transition-all duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground data-[state=indeterminate]:border-primary hover:border-primary/50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/40",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
/**
|
|
14
|
+
* The booking flow's opt-in ("Save these details for next time",
|
|
15
|
+
* booking flow.html): a 17px box with a 5px radius, a hairline on the
|
|
16
|
+
* soft ground when off, the brand gradient with an 11px white check
|
|
17
|
+
* when on.
|
|
18
|
+
*/
|
|
19
|
+
appearance: {
|
|
20
|
+
default: "",
|
|
21
|
+
booking:
|
|
22
|
+
"size-[17px] rounded-[5px] bg-surface-2 data-[state=checked]:border-transparent data-[state=checked]:bg-[image:var(--gradient-primary)] data-[state=checked]:text-white [&_svg]:size-[11px]",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: { appearance: "default" },
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
type CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> &
|
|
30
|
+
VariantProps<typeof checkboxVariants>;
|
|
31
|
+
|
|
32
|
+
const Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(
|
|
33
|
+
({ className, appearance, ...props }, ref) => (
|
|
34
|
+
<CheckboxPrimitive.Root
|
|
35
|
+
ref={ref}
|
|
36
|
+
data-slot="checkbox"
|
|
37
|
+
className={cn(checkboxVariants({ appearance }), className)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
|
|
41
|
+
{props.checked === "indeterminate" ? (
|
|
42
|
+
<Minus
|
|
43
|
+
className="size-3.5 animate-in fade-in-0 zoom-in-50 duration-200 ease-out"
|
|
44
|
+
strokeWidth={3}
|
|
45
|
+
/>
|
|
46
|
+
) : (
|
|
47
|
+
<Check
|
|
48
|
+
className="size-3.5 animate-in fade-in-0 zoom-in-50 duration-200 ease-out"
|
|
49
|
+
strokeWidth={3}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</CheckboxPrimitive.Indicator>
|
|
53
|
+
</CheckboxPrimitive.Root>
|
|
54
|
+
)
|
|
55
|
+
);
|
|
30
56
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
31
57
|
|
|
32
|
-
export { Checkbox };
|
|
58
|
+
export { Checkbox, checkboxVariants };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import {
|
|
2
|
+
import { Checkbox } from "./checkbox";
|
|
3
|
+
import {
|
|
4
|
+
Field,
|
|
5
|
+
FieldControl,
|
|
6
|
+
FieldDescription,
|
|
7
|
+
FieldError,
|
|
8
|
+
FieldLabel,
|
|
9
|
+
FieldOptional,
|
|
10
|
+
} from "./field";
|
|
3
11
|
import { Input } from "./input";
|
|
12
|
+
import { Textarea } from "./textarea";
|
|
4
13
|
|
|
5
14
|
const meta = {
|
|
6
15
|
title: "Components/Field",
|
|
@@ -34,3 +43,44 @@ export const Invalid: Story = {
|
|
|
34
43
|
</Field>
|
|
35
44
|
),
|
|
36
45
|
};
|
|
46
|
+
|
|
47
|
+
/** The booking flow's "Your details" fields (B2, S6): caption labels, 46px fields, the opt-in. */
|
|
48
|
+
export const Booking: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<div className="flex w-[335px] flex-col gap-3">
|
|
51
|
+
<Field appearance="booking">
|
|
52
|
+
<FieldLabel>Name</FieldLabel>
|
|
53
|
+
<FieldControl>
|
|
54
|
+
<Input appearance="booking" defaultValue="Adrian Pop" />
|
|
55
|
+
</FieldControl>
|
|
56
|
+
</Field>
|
|
57
|
+
<Field appearance="booking" invalid>
|
|
58
|
+
<FieldLabel>Phone</FieldLabel>
|
|
59
|
+
<FieldControl>
|
|
60
|
+
<Input appearance="booking" defaultValue="0712 34" />
|
|
61
|
+
</FieldControl>
|
|
62
|
+
<FieldError>That number looks too short.</FieldError>
|
|
63
|
+
</Field>
|
|
64
|
+
<Field appearance="booking">
|
|
65
|
+
<FieldLabel>
|
|
66
|
+
Email <FieldOptional>(optional)</FieldOptional>
|
|
67
|
+
</FieldLabel>
|
|
68
|
+
<FieldControl>
|
|
69
|
+
<Input appearance="booking" type="email" placeholder="you@example.com" />
|
|
70
|
+
</FieldControl>
|
|
71
|
+
</Field>
|
|
72
|
+
<Field appearance="booking">
|
|
73
|
+
<FieldLabel>
|
|
74
|
+
Anything we should know <FieldOptional>(optional)</FieldOptional>
|
|
75
|
+
</FieldLabel>
|
|
76
|
+
<FieldControl>
|
|
77
|
+
<Textarea appearance="booking" defaultValue="Birthday — a quieter corner if possible." />
|
|
78
|
+
</FieldControl>
|
|
79
|
+
</Field>
|
|
80
|
+
<label className="flex items-center gap-[9px] text-[12.5px] text-ink-secondary">
|
|
81
|
+
<Checkbox appearance="booking" defaultChecked />
|
|
82
|
+
Save these details for next time
|
|
83
|
+
</label>
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
};
|
package/src/components/field.tsx
CHANGED
|
@@ -5,12 +5,21 @@ import { Slot } from "@radix-ui/react-slot";
|
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
6
|
import { Label } from "./label";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* `booking` — the booking flow's fields (booking flow.html, `.fld`): the
|
|
10
|
+
* label a 10.5px uppercase caption in the muted ink that stays muted when
|
|
11
|
+
* the field is invalid (the hairline and the line under it carry the error),
|
|
12
|
+
* the error at 11.5px, 5px between label, control and error.
|
|
13
|
+
*/
|
|
14
|
+
type FieldAppearance = "default" | "booking";
|
|
15
|
+
|
|
8
16
|
const FieldContext = React.createContext<{
|
|
9
17
|
id: string;
|
|
10
18
|
descriptionId: string;
|
|
11
19
|
errorId: string;
|
|
12
20
|
hasError: boolean;
|
|
13
|
-
|
|
21
|
+
appearance: FieldAppearance;
|
|
22
|
+
}>({ id: "", descriptionId: "", errorId: "", hasError: false, appearance: "default" });
|
|
14
23
|
|
|
15
24
|
type FieldProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
16
25
|
/** Field id. Auto-generated if omitted. */
|
|
@@ -19,23 +28,38 @@ type FieldProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
19
28
|
invalid?: boolean;
|
|
20
29
|
/** Lay out content horizontally instead of stacked. */
|
|
21
30
|
orientation?: "vertical" | "horizontal";
|
|
31
|
+
appearance?: FieldAppearance;
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
const Field = React.forwardRef<HTMLDivElement, FieldProps>(
|
|
25
|
-
(
|
|
35
|
+
(
|
|
36
|
+
{
|
|
37
|
+
id: providedId,
|
|
38
|
+
invalid,
|
|
39
|
+
orientation = "vertical",
|
|
40
|
+
appearance = "default",
|
|
41
|
+
className,
|
|
42
|
+
children,
|
|
43
|
+
...props
|
|
44
|
+
},
|
|
45
|
+
ref
|
|
46
|
+
) => {
|
|
26
47
|
const generatedId = React.useId();
|
|
27
48
|
const id = providedId ?? generatedId;
|
|
28
49
|
const descriptionId = `${id}-description`;
|
|
29
50
|
const errorId = `${id}-error`;
|
|
30
51
|
|
|
31
52
|
return (
|
|
32
|
-
<FieldContext.Provider
|
|
53
|
+
<FieldContext.Provider
|
|
54
|
+
value={{ id, descriptionId, errorId, hasError: !!invalid, appearance }}
|
|
55
|
+
>
|
|
33
56
|
<div
|
|
34
57
|
ref={ref}
|
|
35
58
|
data-slot="field"
|
|
36
59
|
data-invalid={invalid || undefined}
|
|
37
60
|
className={cn(
|
|
38
|
-
"flex
|
|
61
|
+
"flex",
|
|
62
|
+
appearance === "booking" ? "gap-[5px]" : "gap-2",
|
|
39
63
|
orientation === "vertical" ? "flex-col" : "flex-row items-center",
|
|
40
64
|
className
|
|
41
65
|
)}
|
|
@@ -53,19 +77,38 @@ const FieldLabel = React.forwardRef<
|
|
|
53
77
|
HTMLLabelElement,
|
|
54
78
|
React.ComponentPropsWithoutRef<typeof Label>
|
|
55
79
|
>(({ className, ...props }, ref) => {
|
|
56
|
-
const { id, hasError } = React.useContext(FieldContext);
|
|
80
|
+
const { id, hasError, appearance } = React.useContext(FieldContext);
|
|
57
81
|
return (
|
|
58
82
|
<Label
|
|
59
83
|
ref={ref}
|
|
60
84
|
data-slot="field-label"
|
|
61
85
|
htmlFor={id}
|
|
62
|
-
className={cn(
|
|
86
|
+
className={cn(
|
|
87
|
+
appearance === "booking"
|
|
88
|
+
? "text-[10.5px] leading-[1.2] font-semibold tracking-[0.04em] text-muted-foreground uppercase"
|
|
89
|
+
: hasError && "text-destructive",
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
63
92
|
{...props}
|
|
64
93
|
/>
|
|
65
94
|
);
|
|
66
95
|
});
|
|
67
96
|
FieldLabel.displayName = "FieldLabel";
|
|
68
97
|
|
|
98
|
+
/**
|
|
99
|
+
* "(optional)" after a label's text — sentence case, regular weight, a
|
|
100
|
+
* shade quieter than the label (booking flow.html's EMAIL (optional)).
|
|
101
|
+
*/
|
|
102
|
+
function FieldOptional({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) {
|
|
103
|
+
return (
|
|
104
|
+
<span
|
|
105
|
+
data-slot="field-optional"
|
|
106
|
+
className={cn("font-normal normal-case opacity-70", className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
69
112
|
const FieldControl = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<typeof Slot>>(
|
|
70
113
|
({ ...props }, ref) => {
|
|
71
114
|
const { id, descriptionId, errorId, hasError } = React.useContext(FieldContext);
|
|
@@ -101,7 +144,7 @@ FieldDescription.displayName = "FieldDescription";
|
|
|
101
144
|
|
|
102
145
|
const FieldError = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
|
103
146
|
({ className, children, ...props }, ref) => {
|
|
104
|
-
const { errorId, hasError } = React.useContext(FieldContext);
|
|
147
|
+
const { errorId, hasError, appearance } = React.useContext(FieldContext);
|
|
105
148
|
if (!hasError || !children) return null;
|
|
106
149
|
return (
|
|
107
150
|
<p
|
|
@@ -109,7 +152,16 @@ const FieldError = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<H
|
|
|
109
152
|
id={errorId}
|
|
110
153
|
role="alert"
|
|
111
154
|
data-slot="field-error"
|
|
112
|
-
className={cn(
|
|
155
|
+
className={cn(
|
|
156
|
+
appearance === "booking"
|
|
157
|
+
? // The design's error ink: the solid token is too bright for AA
|
|
158
|
+
// at 11.5px on white; dark mode's lifted token already clears it.
|
|
159
|
+
// Light: the design's ink. Dark: lifted further than the solid
|
|
160
|
+
// token, which lands at ~3.8:1 on the card ground at 11.5px.
|
|
161
|
+
"m-0 text-[11.5px] leading-[1.2] text-[oklch(0.52_0.16_25)] dark:text-[oklch(0.75_0.13_25)]"
|
|
162
|
+
: "text-sm text-destructive",
|
|
163
|
+
className
|
|
164
|
+
)}
|
|
113
165
|
{...props}
|
|
114
166
|
>
|
|
115
167
|
{children}
|
|
@@ -143,4 +195,13 @@ const FieldLegend = React.forwardRef<HTMLLegendElement, React.HTMLAttributes<HTM
|
|
|
143
195
|
);
|
|
144
196
|
FieldLegend.displayName = "FieldLegend";
|
|
145
197
|
|
|
146
|
-
export {
|
|
198
|
+
export {
|
|
199
|
+
Field,
|
|
200
|
+
FieldLabel,
|
|
201
|
+
FieldOptional,
|
|
202
|
+
FieldControl,
|
|
203
|
+
FieldDescription,
|
|
204
|
+
FieldError,
|
|
205
|
+
FieldSet,
|
|
206
|
+
FieldLegend,
|
|
207
|
+
};
|
package/src/components/input.tsx
CHANGED
|
@@ -15,10 +15,21 @@ const inputVariants = cva(
|
|
|
15
15
|
rounded: "rounded-xl focus-visible:ring-ring",
|
|
16
16
|
pill: "rounded-full bg-background shadow-[var(--shadow-card)] focus-visible:ring-accent/30",
|
|
17
17
|
},
|
|
18
|
+
/**
|
|
19
|
+
* The booking flow's field (booking flow.html, `.in`): 46px on the card
|
|
20
|
+
* ground rather than the input wash, an 11px radius, 13px inset, 14px
|
|
21
|
+
* type. Last, so it wins over the size and shape it restates.
|
|
22
|
+
*/
|
|
23
|
+
appearance: {
|
|
24
|
+
default: "",
|
|
25
|
+
booking:
|
|
26
|
+
"h-[46px] rounded-[11px] bg-card px-[13px] py-0 text-[14px] leading-[1.2] focus-visible:bg-card focus-visible:ring-ring aria-invalid:border-[oklch(0.52_0.16_25)] dark:aria-invalid:border-destructive",
|
|
27
|
+
},
|
|
18
28
|
},
|
|
19
29
|
defaultVariants: {
|
|
20
30
|
size: "default",
|
|
21
31
|
shape: "rounded",
|
|
32
|
+
appearance: "default",
|
|
22
33
|
},
|
|
23
34
|
}
|
|
24
35
|
);
|
|
@@ -28,12 +39,12 @@ export interface InputProps
|
|
|
28
39
|
VariantProps<typeof inputVariants> {}
|
|
29
40
|
|
|
30
41
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
31
|
-
({ className, type, size, shape, ...props }, ref) => {
|
|
42
|
+
({ className, type, size, shape, appearance, ...props }, ref) => {
|
|
32
43
|
return (
|
|
33
44
|
<input
|
|
34
45
|
type={type}
|
|
35
46
|
data-slot="input"
|
|
36
|
-
className={cn(inputVariants({ size, shape }), className)}
|
|
47
|
+
className={cn(inputVariants({ size, shape, appearance }), className)}
|
|
37
48
|
ref={ref}
|
|
38
49
|
{...props}
|
|
39
50
|
/>
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
3
|
import { cn } from "../lib/utils";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
const textareaVariants = cva(
|
|
6
|
+
"flex min-h-20 w-full rounded-xl border border-border bg-input/50 px-4 py-3 text-base transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:bg-input disabled:cursor-not-allowed disabled:opacity-50 resize-y aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/40",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
/**
|
|
10
|
+
* The booking flow's note field (booking flow.html, `.in.ta`): the
|
|
11
|
+
* `Input` booking appearance's ground, radius and type, 66px tall with
|
|
12
|
+
* a 12px × 13px inset, and no drag handle — the design draws none.
|
|
13
|
+
*/
|
|
14
|
+
appearance: {
|
|
15
|
+
default: "",
|
|
16
|
+
booking:
|
|
17
|
+
"min-h-[66px] resize-none rounded-[11px] bg-card px-[13px] py-3 text-[14px] leading-[1.4] focus-visible:bg-card aria-invalid:border-[oklch(0.52_0.16_25)] dark:aria-invalid:border-destructive",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { appearance: "default" },
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
25
|
+
VariantProps<typeof textareaVariants>;
|
|
5
26
|
|
|
6
27
|
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
7
|
-
({ className, ...props }, ref) => {
|
|
28
|
+
({ className, appearance, ...props }, ref) => {
|
|
8
29
|
return (
|
|
9
30
|
<textarea
|
|
10
31
|
data-slot="textarea"
|
|
11
|
-
className={cn(
|
|
12
|
-
"flex min-h-20 w-full rounded-xl border border-border bg-input/50 px-4 py-3 text-base transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:bg-input disabled:cursor-not-allowed disabled:opacity-50 resize-y aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/40",
|
|
13
|
-
className
|
|
14
|
-
)}
|
|
32
|
+
className={cn(textareaVariants({ appearance }), className)}
|
|
15
33
|
ref={ref}
|
|
16
34
|
{...props}
|
|
17
35
|
/>
|
|
@@ -20,4 +38,4 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
20
38
|
);
|
|
21
39
|
Textarea.displayName = "Textarea";
|
|
22
40
|
|
|
23
|
-
export { Textarea };
|
|
41
|
+
export { Textarea, textareaVariants };
|
|
@@ -67,13 +67,13 @@ function ToggleGroupItem({
|
|
|
67
67
|
"min-w-0 flex-1 shrink-0 shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
|
|
68
68
|
resolved === "segmented"
|
|
69
69
|
? "rounded-full px-0 data-[state=on]:shadow-[var(--shadow-card)]"
|
|
70
|
-
: // Tabs and chips size
|
|
71
|
-
//
|
|
70
|
+
: // Tabs and chips size themselves (`toggleVariants`' compounds);
|
|
71
|
+
// the item's own rounding must not square them off.
|
|
72
72
|
resolved === "tab"
|
|
73
|
-
? "
|
|
73
|
+
? "rounded-full"
|
|
74
74
|
: resolved === "chip"
|
|
75
75
|
? // A chip keeps its own width, so the row can wrap.
|
|
76
|
-
"
|
|
76
|
+
"flex-none rounded-full"
|
|
77
77
|
: "rounded-none first:rounded-l-md last:rounded-r-md",
|
|
78
78
|
className
|
|
79
79
|
)}
|
|
@@ -45,6 +45,14 @@ const toggleVariants = cva(
|
|
|
45
45
|
lg: "h-10 px-2.5 min-w-10",
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
|
+
// Chips and tabs size to their type. Restated here, after the size
|
|
49
|
+
// variants, so the default size's `h-9 px-2 min-w-9` never wins the
|
|
50
|
+
// merge — for a `Toggle`, a `ToggleGroupItem` or a bare `toggleVariants`
|
|
51
|
+
// call on another element alike.
|
|
52
|
+
compoundVariants: [
|
|
53
|
+
{ variant: "chip", class: "h-auto min-w-0 px-[13px]" },
|
|
54
|
+
{ variant: "tab", class: "h-auto min-w-0 px-3" },
|
|
55
|
+
],
|
|
48
56
|
defaultVariants: {
|
|
49
57
|
variant: "default",
|
|
50
58
|
size: "default",
|
package/dist/chunk-NMEVJT5Q.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-FEK5XGZW.js';
|
|
2
|
-
import { __objRest, __spreadProps, __spreadValues } from './chunk-MMUBH76A.js';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
5
|
-
import { Minus, Check } from 'lucide-react';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var Checkbox = React.forwardRef((_a, ref) => {
|
|
9
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
CheckboxPrimitive.Root,
|
|
12
|
-
__spreadProps(__spreadValues({
|
|
13
|
-
ref,
|
|
14
|
-
"data-slot": "checkbox",
|
|
15
|
-
className: cn(
|
|
16
|
-
"peer size-5 shrink-0 rounded-md border border-border bg-background transition-all duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground data-[state=indeterminate]:border-primary hover:border-primary/50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/40",
|
|
17
|
-
className
|
|
18
|
-
)
|
|
19
|
-
}, props), {
|
|
20
|
-
children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: props.checked === "indeterminate" ? /* @__PURE__ */ jsx(Minus, { className: "size-3.5 animate-in fade-in-0 zoom-in-50 duration-200 ease-out", strokeWidth: 3 }) : /* @__PURE__ */ jsx(Check, { className: "size-3.5 animate-in fade-in-0 zoom-in-50 duration-200 ease-out", strokeWidth: 3 }) })
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
25
|
-
|
|
26
|
-
export { Checkbox };
|