@behavioral-agentic-design-system/core 0.1.4 → 0.2.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/package.json +1 -1
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/button.tsx +3 -0
- package/src/components/ui/checkbox.tsx +2 -2
- package/src/components/ui/dialog.tsx +28 -7
- package/src/components/ui/field.tsx +265 -0
- package/src/components/ui/input.tsx +29 -8
- package/src/components/ui/progress.tsx +6 -1
- package/src/components/ui/radio-group.tsx +2 -2
- package/src/components/ui/resizable.tsx +3 -3
- package/src/components/ui/scroll-area.tsx +4 -4
- package/src/components/ui/sheet.tsx +6 -2
- package/src/components/ui/slider.tsx +7 -2
- package/src/components/ui/switch.tsx +7 -2
- package/src/components/ui/tabs.tsx +69 -2
- package/src/lib/color-name.ts +182 -0
- package/src/lib/theme-editor.ts +213 -0
- package/src/styles.css +227 -87
- package/src/tokens.default.json +984 -0
- package/src/tokens.json +886 -328
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
4
4
|
import { cn } from "../../lib/utils"
|
|
5
5
|
|
|
6
6
|
const alertVariants = cva(
|
|
7
|
-
"relative grid w-full grid-cols-[0_1fr] items-start gap-y-0
|
|
7
|
+
"relative grid w-full grid-cols-[0_1fr] items-start gap-y-0 rounded-lg border px-6 py-5 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:row-span-2 [&>svg]:self-center [&>svg]:text-current",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -39,7 +39,7 @@ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
39
39
|
<div
|
|
40
40
|
data-slot="alert-title"
|
|
41
41
|
className={cn(
|
|
42
|
-
"col-start-2 line-clamp-1
|
|
42
|
+
"col-start-2 line-clamp-1 text-lg font-semibold leading-tight tracking-tight",
|
|
43
43
|
className
|
|
44
44
|
)}
|
|
45
45
|
{...props}
|
|
@@ -26,10 +26,13 @@ const buttonVariants = cva(
|
|
|
26
26
|
xs: "h-6 gap-1 rounded-md px-2 text-xs [&_svg:not([class*='size-'])]:size-3",
|
|
27
27
|
sm: "h-8 gap-1.5 rounded-md px-3",
|
|
28
28
|
lg: "h-10 rounded-md px-8",
|
|
29
|
+
xl: "h-11 rounded-md px-10 text-base [&_svg:not([class*='size-'])]:size-5",
|
|
30
|
+
"2xl": "h-12 rounded-md px-12 text-base font-semibold [&_svg:not([class*='size-'])]:size-5",
|
|
29
31
|
icon: "size-9",
|
|
30
32
|
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
31
33
|
"icon-sm": "size-8",
|
|
32
34
|
"icon-lg": "size-10",
|
|
35
|
+
"icon-xl": "size-11 [&_svg:not([class*='size-'])]:size-5",
|
|
33
36
|
},
|
|
34
37
|
},
|
|
35
38
|
defaultVariants: {
|
|
@@ -14,7 +14,7 @@ function Checkbox({
|
|
|
14
14
|
<CheckboxPrimitive.Root
|
|
15
15
|
data-slot="checkbox"
|
|
16
16
|
className={cn(
|
|
17
|
-
"peer size-
|
|
17
|
+
"peer size-8 shrink-0 rounded-[4px] border-2 border-muted-foreground/60 bg-white shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:aria-invalid:ring-destructive/40",
|
|
18
18
|
className
|
|
19
19
|
)}
|
|
20
20
|
{...props}
|
|
@@ -23,7 +23,7 @@ function Checkbox({
|
|
|
23
23
|
data-slot="checkbox-indicator"
|
|
24
24
|
className="grid place-content-center text-current transition-none"
|
|
25
25
|
>
|
|
26
|
-
<CheckIcon className="size-
|
|
26
|
+
<CheckIcon className="size-6" strokeWidth={3} />
|
|
27
27
|
</CheckboxPrimitive.Indicator>
|
|
28
28
|
</CheckboxPrimitive.Root>
|
|
29
29
|
)
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
5
|
import { XIcon } from "lucide-react"
|
|
5
6
|
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
6
7
|
|
|
7
8
|
import { cn } from "../../lib/utils"
|
|
8
9
|
import { Button } from "./button"
|
|
9
10
|
|
|
11
|
+
const dialogContentVariants = cva(
|
|
12
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: "max-w-sm",
|
|
17
|
+
default: "max-w-lg",
|
|
18
|
+
lg: "max-w-2xl",
|
|
19
|
+
xl: "max-w-4xl",
|
|
20
|
+
"2xl": "max-w-6xl",
|
|
21
|
+
full: "max-w-[calc(100vw-2rem)]",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "default",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
10
30
|
function Dialog({
|
|
11
31
|
...props
|
|
12
32
|
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
@@ -51,19 +71,19 @@ function DialogContent({
|
|
|
51
71
|
className,
|
|
52
72
|
children,
|
|
53
73
|
showCloseButton = true,
|
|
74
|
+
size,
|
|
54
75
|
...props
|
|
55
|
-
}: React.ComponentProps<typeof DialogPrimitive.Content> &
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> &
|
|
77
|
+
VariantProps<typeof dialogContentVariants> & {
|
|
78
|
+
showCloseButton?: boolean
|
|
79
|
+
}) {
|
|
58
80
|
return (
|
|
59
81
|
<DialogPortal data-slot="dialog-portal">
|
|
60
82
|
<DialogOverlay />
|
|
61
83
|
<DialogPrimitive.Content
|
|
62
84
|
data-slot="dialog-content"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
className
|
|
66
|
-
)}
|
|
85
|
+
data-size={size ?? "default"}
|
|
86
|
+
className={cn(dialogContentVariants({ size }), className)}
|
|
67
87
|
{...props}
|
|
68
88
|
>
|
|
69
89
|
{children}
|
|
@@ -155,4 +175,5 @@ export {
|
|
|
155
175
|
DialogPortal,
|
|
156
176
|
DialogTitle,
|
|
157
177
|
DialogTrigger,
|
|
178
|
+
dialogContentVariants,
|
|
158
179
|
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
import { Label } from "./label";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Form composition primitives. Form-lib agnostic — pair with react-hook-form,
|
|
11
|
+
* Formik, or vanilla state. Just provide value/onChange to the input you nest
|
|
12
|
+
* inside <Field>.
|
|
13
|
+
*
|
|
14
|
+
* The Field generates ids and wires aria-describedby + aria-invalid onto its
|
|
15
|
+
* single child input so screen readers announce label + helper + error
|
|
16
|
+
* correctly. Use <FieldLabel>, <FieldHelper>, <FieldError> as siblings — order
|
|
17
|
+
* is up to you, but conventional is label → input → helper → error.
|
|
18
|
+
*
|
|
19
|
+
* <Field name="email" required invalid={!!errors.email}>
|
|
20
|
+
* <FieldLabel>Email</FieldLabel>
|
|
21
|
+
* <Input type="email" autoComplete="email" />
|
|
22
|
+
* <FieldHelper>We'll never share it.</FieldHelper>
|
|
23
|
+
* <FieldError>{errors.email}</FieldError>
|
|
24
|
+
* </Field>
|
|
25
|
+
*
|
|
26
|
+
* For a row of related fields (e.g. first/last name), wrap in <FieldGroup>.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type FieldContextValue = {
|
|
30
|
+
id: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
required: boolean;
|
|
33
|
+
invalid: boolean;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
helperId: string;
|
|
36
|
+
errorId: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const FieldContext = React.createContext<FieldContextValue | null>(null);
|
|
40
|
+
|
|
41
|
+
function useFieldContext() {
|
|
42
|
+
const ctx = React.useContext(FieldContext);
|
|
43
|
+
if (!ctx) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
"Field subcomponents must be rendered inside a <Field> parent.",
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return ctx;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const fieldVariants = cva("flex flex-col gap-2", {
|
|
52
|
+
variants: {
|
|
53
|
+
layout: {
|
|
54
|
+
vertical: "flex-col gap-2",
|
|
55
|
+
horizontal: "flex-row items-center gap-4",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
layout: "vertical",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
type FieldProps = Omit<React.ComponentProps<"div">, "id"> &
|
|
64
|
+
VariantProps<typeof fieldVariants> & {
|
|
65
|
+
/** Form field name. Used as the basis for the auto-generated id when no id is provided. */
|
|
66
|
+
name?: string;
|
|
67
|
+
/** Override the auto-generated id. */
|
|
68
|
+
id?: string;
|
|
69
|
+
required?: boolean;
|
|
70
|
+
/** When true, sets aria-invalid on the nested input and surfaces error styling. */
|
|
71
|
+
invalid?: boolean;
|
|
72
|
+
/** Disables the entire field group (input + label + helpers fade). */
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
function Field({
|
|
77
|
+
className,
|
|
78
|
+
layout,
|
|
79
|
+
name,
|
|
80
|
+
id,
|
|
81
|
+
required = false,
|
|
82
|
+
invalid = false,
|
|
83
|
+
disabled = false,
|
|
84
|
+
children,
|
|
85
|
+
...props
|
|
86
|
+
}: FieldProps) {
|
|
87
|
+
const reactId = React.useId();
|
|
88
|
+
const fieldId = id ?? (name ? `field-${name}` : reactId);
|
|
89
|
+
const helperId = `${fieldId}-helper`;
|
|
90
|
+
const errorId = `${fieldId}-error`;
|
|
91
|
+
|
|
92
|
+
const ctx = React.useMemo<FieldContextValue>(
|
|
93
|
+
() => ({ id: fieldId, name, required, invalid, disabled, helperId, errorId }),
|
|
94
|
+
[fieldId, name, required, invalid, disabled, helperId, errorId],
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<FieldContext.Provider value={ctx}>
|
|
99
|
+
<div
|
|
100
|
+
data-slot="field"
|
|
101
|
+
data-invalid={invalid || undefined}
|
|
102
|
+
data-disabled={disabled || undefined}
|
|
103
|
+
// group lets nested Label respect group-data-[disabled=true] from label.tsx
|
|
104
|
+
className={cn("group", fieldVariants({ layout }), className)}
|
|
105
|
+
{...props}
|
|
106
|
+
>
|
|
107
|
+
{children}
|
|
108
|
+
</div>
|
|
109
|
+
</FieldContext.Provider>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function FieldLabel({
|
|
114
|
+
className,
|
|
115
|
+
children,
|
|
116
|
+
...props
|
|
117
|
+
}: React.ComponentProps<typeof Label>) {
|
|
118
|
+
const { id, required } = useFieldContext();
|
|
119
|
+
return (
|
|
120
|
+
<Label data-slot="field-label" htmlFor={id} className={className} {...props}>
|
|
121
|
+
{children}
|
|
122
|
+
{required && (
|
|
123
|
+
<span aria-hidden="true" className="text-destructive font-normal">
|
|
124
|
+
*
|
|
125
|
+
</span>
|
|
126
|
+
)}
|
|
127
|
+
</Label>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function FieldHelper({
|
|
132
|
+
className,
|
|
133
|
+
...props
|
|
134
|
+
}: React.ComponentProps<"p">) {
|
|
135
|
+
const { helperId, invalid } = useFieldContext();
|
|
136
|
+
// Hide helper text when an error is also showing — the error replaces it
|
|
137
|
+
// visually so screen readers don't double-announce.
|
|
138
|
+
return (
|
|
139
|
+
<p
|
|
140
|
+
data-slot="field-helper"
|
|
141
|
+
id={helperId}
|
|
142
|
+
className={cn(
|
|
143
|
+
"text-sm text-muted-foreground",
|
|
144
|
+
invalid && "hidden",
|
|
145
|
+
className,
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function FieldError({
|
|
153
|
+
className,
|
|
154
|
+
children,
|
|
155
|
+
...props
|
|
156
|
+
}: React.ComponentProps<"p">) {
|
|
157
|
+
const { errorId, invalid } = useFieldContext();
|
|
158
|
+
if (!invalid || !children) return null;
|
|
159
|
+
return (
|
|
160
|
+
<p
|
|
161
|
+
data-slot="field-error"
|
|
162
|
+
id={errorId}
|
|
163
|
+
role="alert"
|
|
164
|
+
className={cn("text-sm font-medium text-destructive", className)}
|
|
165
|
+
{...props}
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
</p>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Wraps the input element so we can inject id, aria-describedby, aria-invalid,
|
|
174
|
+
* required, disabled without forcing every Input/Textarea/Select to know about
|
|
175
|
+
* Field. Place around the actual input element:
|
|
176
|
+
*
|
|
177
|
+
* <FieldControl>
|
|
178
|
+
* <Input type="email" />
|
|
179
|
+
* </FieldControl>
|
|
180
|
+
*
|
|
181
|
+
* For most cases you can skip FieldControl entirely — Field auto-injects on
|
|
182
|
+
* its first interactive child. Use FieldControl when you need wrapping markup
|
|
183
|
+
* (e.g. an icon prefix div) between Field and the input.
|
|
184
|
+
*/
|
|
185
|
+
function FieldControl({ children }: { children: React.ReactElement }) {
|
|
186
|
+
const { id, helperId, errorId, required, invalid, disabled, name } =
|
|
187
|
+
useFieldContext();
|
|
188
|
+
|
|
189
|
+
type InputElProps = {
|
|
190
|
+
id?: string;
|
|
191
|
+
name?: string;
|
|
192
|
+
required?: boolean;
|
|
193
|
+
disabled?: boolean;
|
|
194
|
+
"aria-invalid"?: boolean;
|
|
195
|
+
"aria-describedby"?: string;
|
|
196
|
+
"aria-required"?: boolean;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const child = children as React.ReactElement<InputElProps>;
|
|
200
|
+
const childProps = (child.props ?? {}) as InputElProps;
|
|
201
|
+
|
|
202
|
+
const describedBy =
|
|
203
|
+
[
|
|
204
|
+
invalid ? errorId : null,
|
|
205
|
+
!invalid ? helperId : null,
|
|
206
|
+
childProps["aria-describedby"],
|
|
207
|
+
]
|
|
208
|
+
.filter(Boolean)
|
|
209
|
+
.join(" ") || undefined;
|
|
210
|
+
|
|
211
|
+
return React.cloneElement(child, {
|
|
212
|
+
id: childProps.id ?? id,
|
|
213
|
+
name: childProps.name ?? name,
|
|
214
|
+
required: childProps.required ?? required,
|
|
215
|
+
disabled: childProps.disabled ?? disabled,
|
|
216
|
+
"aria-invalid": invalid || childProps["aria-invalid"],
|
|
217
|
+
"aria-describedby": describedBy,
|
|
218
|
+
"aria-required": required || childProps["aria-required"],
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const fieldGroupVariants = cva("grid", {
|
|
223
|
+
variants: {
|
|
224
|
+
columns: {
|
|
225
|
+
1: "grid-cols-1",
|
|
226
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
227
|
+
3: "grid-cols-1 md:grid-cols-3",
|
|
228
|
+
4: "grid-cols-1 md:grid-cols-4",
|
|
229
|
+
},
|
|
230
|
+
gap: {
|
|
231
|
+
sm: "gap-3",
|
|
232
|
+
default: "gap-5",
|
|
233
|
+
lg: "gap-6",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
defaultVariants: {
|
|
237
|
+
columns: 2,
|
|
238
|
+
gap: "default",
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
type FieldGroupProps = React.ComponentProps<"div"> &
|
|
243
|
+
VariantProps<typeof fieldGroupVariants>;
|
|
244
|
+
|
|
245
|
+
/** Layout container for related fields (e.g. address line 1 + line 2). */
|
|
246
|
+
function FieldGroup({ className, columns, gap, ...props }: FieldGroupProps) {
|
|
247
|
+
return (
|
|
248
|
+
<div
|
|
249
|
+
data-slot="field-group"
|
|
250
|
+
className={cn(fieldGroupVariants({ columns, gap }), className)}
|
|
251
|
+
{...props}
|
|
252
|
+
/>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export {
|
|
257
|
+
Field,
|
|
258
|
+
FieldLabel,
|
|
259
|
+
FieldHelper,
|
|
260
|
+
FieldError,
|
|
261
|
+
FieldControl,
|
|
262
|
+
FieldGroup,
|
|
263
|
+
fieldVariants,
|
|
264
|
+
fieldGroupVariants,
|
|
265
|
+
};
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
3
|
|
|
3
4
|
import { cn } from "../../lib/utils"
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const inputVariants = cva(
|
|
7
|
+
"w-full min-w-0 rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:border-0 file:bg-transparent file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "h-8 px-2.5 py-1 text-sm file:h-6 file:text-xs",
|
|
12
|
+
default: "h-9 px-3 py-1 text-base file:h-7 file:text-sm md:text-sm",
|
|
13
|
+
lg: "h-10 px-4 py-2 text-base file:h-8 file:text-sm",
|
|
14
|
+
xl: "h-11 px-4 py-2 text-base file:h-9 file:text-base",
|
|
15
|
+
"2xl": "h-12 px-5 py-2.5 text-lg file:h-10 file:text-base",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: "default",
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
function Input({
|
|
25
|
+
className,
|
|
26
|
+
type,
|
|
27
|
+
size,
|
|
28
|
+
...props
|
|
29
|
+
}: Omit<React.ComponentProps<"input">, "size"> &
|
|
30
|
+
VariantProps<typeof inputVariants>) {
|
|
6
31
|
return (
|
|
7
32
|
<input
|
|
8
33
|
type={type}
|
|
9
34
|
data-slot="input"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
13
|
-
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
35
|
+
data-size={size ?? "default"}
|
|
36
|
+
className={cn(inputVariants({ size, className }))}
|
|
16
37
|
{...props}
|
|
17
38
|
/>
|
|
18
39
|
)
|
|
19
40
|
}
|
|
20
41
|
|
|
21
|
-
export { Input }
|
|
42
|
+
export { Input, inputVariants }
|
|
@@ -14,7 +14,12 @@ function Progress({
|
|
|
14
14
|
<ProgressPrimitive.Root
|
|
15
15
|
data-slot="progress"
|
|
16
16
|
className={cn(
|
|
17
|
-
|
|
17
|
+
// Asymmetric alpha: /30 in light gives a faint "empty track" feel
|
|
18
|
+
// (typical progress UX, ~2.0:1 — under AAA 1.4.11), /60 in dark hits
|
|
19
|
+
// 6.79:1 (AAA pass). Documented exception in CLAUDE.md → "Known AAA
|
|
20
|
+
// exceptions" because no symmetric value reads correctly in both modes
|
|
21
|
+
// with a near-black primary.
|
|
22
|
+
"relative h-2 w-full overflow-hidden rounded-full bg-primary/30 dark:bg-primary/60",
|
|
18
23
|
className
|
|
19
24
|
)}
|
|
20
25
|
{...props}
|
|
@@ -27,7 +27,7 @@ function RadioGroupItem({
|
|
|
27
27
|
<RadioGroupPrimitive.Item
|
|
28
28
|
data-slot="radio-group-item"
|
|
29
29
|
className={cn(
|
|
30
|
-
"aspect-square size-
|
|
30
|
+
"aspect-square size-9 shrink-0 rounded-full border-2 border-muted-foreground/60 bg-white text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 data-[state=checked]:bg-primary data-[state=checked]:border-primary",
|
|
31
31
|
className
|
|
32
32
|
)}
|
|
33
33
|
{...props}
|
|
@@ -36,7 +36,7 @@ function RadioGroupItem({
|
|
|
36
36
|
data-slot="radio-group-indicator"
|
|
37
37
|
className="relative flex items-center justify-center"
|
|
38
38
|
>
|
|
39
|
-
<CircleIcon className="absolute top-1/2 left-1/2 size-
|
|
39
|
+
<CircleIcon className="absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 fill-primary-foreground" />
|
|
40
40
|
</RadioGroupPrimitive.Indicator>
|
|
41
41
|
</RadioGroupPrimitive.Item>
|
|
42
42
|
)
|
|
@@ -36,14 +36,14 @@ function ResizableHandle({
|
|
|
36
36
|
<ResizablePrimitive.Separator
|
|
37
37
|
data-slot="resizable-handle"
|
|
38
38
|
className={cn(
|
|
39
|
-
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
|
|
39
|
+
"relative flex w-px items-center justify-center bg-border hover:bg-muted-foreground/30 transition-colors after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
|
|
40
40
|
className
|
|
41
41
|
)}
|
|
42
42
|
{...props}
|
|
43
43
|
>
|
|
44
44
|
{withHandle && (
|
|
45
|
-
<div className="z-10 flex h-
|
|
46
|
-
<GripVerticalIcon className="size-
|
|
45
|
+
<div className="z-10 flex h-6 w-6 items-center justify-center rounded-sm bg-muted border border-muted-foreground/30 hover:bg-muted-foreground/20">
|
|
46
|
+
<GripVerticalIcon className="size-3.5 text-muted-foreground" />
|
|
47
47
|
</div>
|
|
48
48
|
)}
|
|
49
49
|
</ResizablePrimitive.Separator>
|
|
@@ -38,18 +38,18 @@ function ScrollBar({
|
|
|
38
38
|
data-slot="scroll-area-scrollbar"
|
|
39
39
|
orientation={orientation}
|
|
40
40
|
className={cn(
|
|
41
|
-
"flex touch-none p-
|
|
41
|
+
"flex touch-none p-1 transition-colors select-none bg-muted",
|
|
42
42
|
orientation === "vertical" &&
|
|
43
|
-
"h-full w-
|
|
43
|
+
"h-full w-3 border-l border-l-transparent",
|
|
44
44
|
orientation === "horizontal" &&
|
|
45
|
-
"h-
|
|
45
|
+
"h-3 flex-col border-t border-t-transparent",
|
|
46
46
|
className
|
|
47
47
|
)}
|
|
48
48
|
{...props}
|
|
49
49
|
>
|
|
50
50
|
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
51
51
|
data-slot="scroll-area-thumb"
|
|
52
|
-
className="relative flex-1 rounded-full bg-
|
|
52
|
+
className="relative flex-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground/80 transition-colors"
|
|
53
53
|
/>
|
|
54
54
|
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
55
55
|
)
|
|
@@ -75,8 +75,12 @@ function SheetContent({
|
|
|
75
75
|
>
|
|
76
76
|
{children}
|
|
77
77
|
{showCloseButton && (
|
|
78
|
-
<SheetPrimitive.Close
|
|
79
|
-
|
|
78
|
+
<SheetPrimitive.Close
|
|
79
|
+
data-slot="sheet-close"
|
|
80
|
+
className="absolute top-4 right-4 rounded-xs text-foreground ring-offset-background transition-opacity hover:opacity-70 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-8"
|
|
81
|
+
style={{ strokeWidth: '1.5px' }}
|
|
82
|
+
>
|
|
83
|
+
<XIcon />
|
|
80
84
|
<span className="sr-only">Close</span>
|
|
81
85
|
</SheetPrimitive.Close>
|
|
82
86
|
)}
|
|
@@ -39,7 +39,12 @@ function Slider({
|
|
|
39
39
|
<SliderPrimitive.Track
|
|
40
40
|
data-slot="slider-track"
|
|
41
41
|
className={cn(
|
|
42
|
-
|
|
42
|
+
// Match Progress: asymmetric alpha keeps the track readable as
|
|
43
|
+
// "empty space" in light mode while hitting AAA 1.4.11 (3:1) in
|
|
44
|
+
// dark mode. Light mode fails AAA on this one surface — known and
|
|
45
|
+
// documented exception (see CLAUDE.md). Brand-tinted via primary
|
|
46
|
+
// so the track inherits the active brand color.
|
|
47
|
+
"relative grow overflow-hidden rounded-full bg-primary/30 dark:bg-primary/60 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
43
48
|
)}
|
|
44
49
|
>
|
|
45
50
|
<SliderPrimitive.Range
|
|
@@ -53,7 +58,7 @@ function Slider({
|
|
|
53
58
|
<SliderPrimitive.Thumb
|
|
54
59
|
data-slot="slider-thumb"
|
|
55
60
|
key={index}
|
|
56
|
-
className="block size-
|
|
61
|
+
className="block size-8 shrink-0 rounded-full border-2 border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
57
62
|
/>
|
|
58
63
|
))}
|
|
59
64
|
</SliderPrimitive.Root>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
+
import { CheckIcon } from "lucide-react"
|
|
4
5
|
import * as SwitchPrimitive from "@radix-ui/react-switch"
|
|
5
6
|
|
|
6
7
|
import { cn } from "../../lib/utils"
|
|
@@ -17,15 +18,19 @@ function Switch({
|
|
|
17
18
|
data-slot="switch"
|
|
18
19
|
data-size={size}
|
|
19
20
|
className={cn(
|
|
20
|
-
"peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-
|
|
21
|
+
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[2.3rem] data-[size=default]:w-16 data-[size=sm]:h-7 data-[size=sm]:w-12 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
|
|
21
22
|
className
|
|
22
23
|
)}
|
|
23
24
|
{...props}
|
|
24
25
|
>
|
|
26
|
+
<CheckIcon
|
|
27
|
+
strokeWidth={3}
|
|
28
|
+
className="pointer-events-none absolute left-2 size-4 text-primary-foreground opacity-0 scale-50 -translate-x-1 transition-all duration-200 group-data-[state=checked]/switch:opacity-100 group-data-[state=checked]/switch:scale-100 group-data-[state=checked]/switch:translate-x-0"
|
|
29
|
+
/>
|
|
25
30
|
<SwitchPrimitive.Thumb
|
|
26
31
|
data-slot="switch-thumb"
|
|
27
32
|
className={cn(
|
|
28
|
-
"pointer-events-none block rounded-full bg-
|
|
33
|
+
"pointer-events-none block rounded-full bg-white ring-0 transition-transform group-data-[size=default]/switch:size-8 group-data-[size=sm]/switch:size-6 data-[state=checked]:translate-x-[calc(100%-4px)] data-[state=unchecked]:translate-x-[2px]"
|
|
29
34
|
)}
|
|
30
35
|
/>
|
|
31
36
|
</SwitchPrimitive.Root>
|