banhatten-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/index.d.mts +806 -0
- package/dist/index.d.ts +806 -0
- package/dist/index.js +4639 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4524 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/utils.d.mts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +35 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +10 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/tokens/tailwind.config.d.mts +5 -0
- package/dist/tokens/tailwind.config.d.ts +5 -0
- package/dist/tokens/tailwind.config.js +423 -0
- package/dist/tokens/tailwind.config.js.map +1 -0
- package/dist/tokens/tailwind.config.mjs +400 -0
- package/dist/tokens/tailwind.config.mjs.map +1 -0
- package/dist/tokens/tokens.json +340 -0
- package/package.json +71 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4524 @@
|
|
|
1
|
+
// src/components/ColorPalette.tsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
var tokenSamples = [
|
|
4
|
+
{
|
|
5
|
+
className: "bg-brand",
|
|
6
|
+
label: "bg-brand",
|
|
7
|
+
textClass: "text-white"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
className: "bg-danger",
|
|
11
|
+
label: "bg-danger",
|
|
12
|
+
textClass: "text-white"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
className: "bg-inactive",
|
|
16
|
+
label: "bg-inactive",
|
|
17
|
+
textClass: "text-primary"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
className: "bg-success",
|
|
21
|
+
label: "bg-success",
|
|
22
|
+
textClass: "text-white"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
className: "bg-warning",
|
|
26
|
+
label: "bg-warning",
|
|
27
|
+
textClass: "text-white"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
className: "bg-info",
|
|
31
|
+
label: "bg-info",
|
|
32
|
+
textClass: "text-white"
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
var ColorPalette = () => {
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { className: "p-0", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("h2", { className: "text-primary mb-lg text-xl font-semibold", children: "Token Validation" }),
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3", children: tokenSamples.map((sample) => /* @__PURE__ */ jsx(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: `${sample.className} ${sample.textClass} flex h-24 items-center justify-center rounded-lg p-4 text-sm font-mono`,
|
|
42
|
+
children: sample.label
|
|
43
|
+
},
|
|
44
|
+
sample.label
|
|
45
|
+
)) }),
|
|
46
|
+
/* @__PURE__ */ jsx("h3", { className: "text-primary mt-8 mb-4 text-lg font-semibold", children: "Text Colors" }),
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
48
|
+
/* @__PURE__ */ jsx("p", { className: "text-primary", children: "text-primary (dark gray)" }),
|
|
49
|
+
/* @__PURE__ */ jsx("p", { className: "text-secondary", children: "text-secondary (medium gray)" }),
|
|
50
|
+
/* @__PURE__ */ jsx("p", { className: "text-brand", children: "text-brand (primary blue)" }),
|
|
51
|
+
/* @__PURE__ */ jsx("p", { className: "text-danger", children: "text-danger (red)" })
|
|
52
|
+
] })
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/components/accordion.tsx
|
|
57
|
+
import * as React3 from "react";
|
|
58
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
59
|
+
|
|
60
|
+
// src/lib/utils.ts
|
|
61
|
+
import { clsx } from "clsx";
|
|
62
|
+
import { twMerge } from "tailwind-merge";
|
|
63
|
+
function cn(...inputs) {
|
|
64
|
+
return twMerge(clsx(inputs));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/components/icon.tsx
|
|
68
|
+
import * as React from "react";
|
|
69
|
+
import { cva } from "class-variance-authority";
|
|
70
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
71
|
+
var iconVariants = cva("shrink-0 select-none", {
|
|
72
|
+
variants: {
|
|
73
|
+
variant: {
|
|
74
|
+
outlined: "material-symbols-outlined",
|
|
75
|
+
rounded: "material-symbols-rounded",
|
|
76
|
+
sharp: "material-symbols-sharp"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
variant: "outlined"
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
var sizeMap = {
|
|
84
|
+
xs: 12,
|
|
85
|
+
sm: 16,
|
|
86
|
+
md: 20,
|
|
87
|
+
lg: 24,
|
|
88
|
+
xl: 32
|
|
89
|
+
};
|
|
90
|
+
var Icon = React.forwardRef(
|
|
91
|
+
({
|
|
92
|
+
name,
|
|
93
|
+
variant,
|
|
94
|
+
size = "md",
|
|
95
|
+
filled = false,
|
|
96
|
+
weight = 400,
|
|
97
|
+
grade = 0,
|
|
98
|
+
label,
|
|
99
|
+
className,
|
|
100
|
+
style,
|
|
101
|
+
...props
|
|
102
|
+
}, ref) => {
|
|
103
|
+
const fontSize = sizeMap[size];
|
|
104
|
+
return /* @__PURE__ */ jsx2(
|
|
105
|
+
"span",
|
|
106
|
+
{
|
|
107
|
+
ref,
|
|
108
|
+
className: cn(iconVariants({ variant }), className),
|
|
109
|
+
style: {
|
|
110
|
+
fontSize,
|
|
111
|
+
fontVariationSettings: `'FILL' ${filled ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grade}`,
|
|
112
|
+
...style
|
|
113
|
+
},
|
|
114
|
+
"aria-hidden": !label,
|
|
115
|
+
"aria-label": label,
|
|
116
|
+
role: label ? "img" : void 0,
|
|
117
|
+
...props,
|
|
118
|
+
children: name
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
Icon.displayName = "Icon";
|
|
124
|
+
|
|
125
|
+
// src/components/divider.tsx
|
|
126
|
+
import * as React2 from "react";
|
|
127
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
128
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
129
|
+
var dividerVariants = cva2("border-default", {
|
|
130
|
+
variants: {
|
|
131
|
+
orientation: {
|
|
132
|
+
horizontal: "w-full border-t",
|
|
133
|
+
vertical: "h-full border-l"
|
|
134
|
+
},
|
|
135
|
+
variant: {
|
|
136
|
+
solid: "border-solid",
|
|
137
|
+
dashed: "border-dashed"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
defaultVariants: {
|
|
141
|
+
orientation: "horizontal",
|
|
142
|
+
variant: "solid"
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
var Divider = React2.forwardRef(
|
|
146
|
+
({ className, orientation = "horizontal", variant = "solid", ...props }, ref) => {
|
|
147
|
+
const Component = orientation === "vertical" ? "div" : "hr";
|
|
148
|
+
return /* @__PURE__ */ jsx3(
|
|
149
|
+
Component,
|
|
150
|
+
{
|
|
151
|
+
ref,
|
|
152
|
+
className: cn(dividerVariants({ orientation, variant }), className),
|
|
153
|
+
role: "separator",
|
|
154
|
+
"aria-orientation": orientation ?? void 0,
|
|
155
|
+
...props
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
Divider.displayName = "Divider";
|
|
161
|
+
|
|
162
|
+
// src/components/accordion.tsx
|
|
163
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
164
|
+
var accordionTriggerVariants = cva3(
|
|
165
|
+
"flex w-full items-center gap-md py-md px-md text-left text-primary transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2",
|
|
166
|
+
{
|
|
167
|
+
variants: {
|
|
168
|
+
disabled: {
|
|
169
|
+
true: "cursor-default text-inactive pointer-events-none [&_*]:pointer-events-none [&_.accordion-expand-icon]:text-icon-inactive [&_.accordion-icon-left]:text-icon-inactive",
|
|
170
|
+
false: "cursor-pointer hover:bg-tertiary [&_.accordion-expand-icon]:text-icon-primary [&_.accordion-icon-left]:text-icon-secondary"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
defaultVariants: {
|
|
174
|
+
disabled: false
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
var AccordionContext = React3.createContext(null);
|
|
179
|
+
var AccordionItemContext = React3.createContext(null);
|
|
180
|
+
function useAccordion() {
|
|
181
|
+
const ctx = React3.useContext(AccordionContext);
|
|
182
|
+
if (!ctx) throw new Error("Accordion components must be used within Accordion.");
|
|
183
|
+
return ctx;
|
|
184
|
+
}
|
|
185
|
+
function useAccordionItem() {
|
|
186
|
+
const ctx = React3.useContext(AccordionItemContext);
|
|
187
|
+
if (!ctx) throw new Error("AccordionTrigger/AccordionContent must be used within AccordionItem.");
|
|
188
|
+
return ctx;
|
|
189
|
+
}
|
|
190
|
+
function toSet(value) {
|
|
191
|
+
if (Array.isArray(value)) return new Set(value.filter(Boolean));
|
|
192
|
+
return value ? /* @__PURE__ */ new Set([value]) : /* @__PURE__ */ new Set();
|
|
193
|
+
}
|
|
194
|
+
var Accordion = React3.forwardRef(
|
|
195
|
+
({
|
|
196
|
+
className,
|
|
197
|
+
type = "single",
|
|
198
|
+
value: controlledValue,
|
|
199
|
+
defaultValue,
|
|
200
|
+
onValueChange,
|
|
201
|
+
children,
|
|
202
|
+
...props
|
|
203
|
+
}, ref) => {
|
|
204
|
+
const [uncontrolledValue, setUncontrolledValue] = React3.useState(() => defaultValue ?? (type === "single" ? "" : []));
|
|
205
|
+
const isControlled = controlledValue !== void 0;
|
|
206
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
207
|
+
const openKeys = React3.useMemo(() => toSet(value), [value]);
|
|
208
|
+
const onToggle = React3.useCallback(
|
|
209
|
+
(key) => {
|
|
210
|
+
let nextKeys;
|
|
211
|
+
if (openKeys.has(key)) {
|
|
212
|
+
nextKeys = new Set(openKeys);
|
|
213
|
+
nextKeys.delete(key);
|
|
214
|
+
} else {
|
|
215
|
+
nextKeys = type === "single" ? /* @__PURE__ */ new Set([key]) : /* @__PURE__ */ new Set([...openKeys, key]);
|
|
216
|
+
}
|
|
217
|
+
const nextValue = type === "single" ? Array.from(nextKeys)[0] ?? "" : Array.from(nextKeys);
|
|
218
|
+
if (!isControlled) setUncontrolledValue(nextValue);
|
|
219
|
+
onValueChange?.(nextValue);
|
|
220
|
+
},
|
|
221
|
+
[type, openKeys, isControlled, onValueChange]
|
|
222
|
+
);
|
|
223
|
+
const ctx = React3.useMemo(
|
|
224
|
+
() => ({ openKeys, onToggle }),
|
|
225
|
+
[openKeys, onToggle]
|
|
226
|
+
);
|
|
227
|
+
return /* @__PURE__ */ jsx4(AccordionContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx4("div", { ref, className: cn("flex flex-col", className), ...props, children }) });
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
Accordion.displayName = "Accordion";
|
|
231
|
+
var AccordionItem = React3.forwardRef(
|
|
232
|
+
({ className, value, disabled = false, showDivider = false, children, ...props }, ref) => {
|
|
233
|
+
const triggerId = React3.useId();
|
|
234
|
+
const contentId = React3.useId();
|
|
235
|
+
const itemCtx = React3.useMemo(
|
|
236
|
+
() => ({ value, disabled, showDivider, triggerId, contentId }),
|
|
237
|
+
[value, disabled, showDivider, triggerId, contentId]
|
|
238
|
+
);
|
|
239
|
+
return /* @__PURE__ */ jsx4(AccordionItemContext.Provider, { value: itemCtx, children: /* @__PURE__ */ jsx4("div", { ref, className: cn("flex flex-col", className), "data-value": value, ...props, children }) });
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
AccordionItem.displayName = "AccordionItem";
|
|
243
|
+
var AccordionTrigger = React3.forwardRef(
|
|
244
|
+
({ className, disabled: propDisabled, iconLeft, children, ...props }, ref) => {
|
|
245
|
+
const { openKeys, onToggle } = useAccordion();
|
|
246
|
+
const { value, disabled: itemDisabled, triggerId, contentId } = useAccordionItem();
|
|
247
|
+
const disabled = propDisabled ?? itemDisabled;
|
|
248
|
+
const isExpanded = openKeys.has(value);
|
|
249
|
+
const handleClick = (e) => {
|
|
250
|
+
if (disabled) return;
|
|
251
|
+
onToggle(value);
|
|
252
|
+
props.onClick?.(e);
|
|
253
|
+
};
|
|
254
|
+
return /* @__PURE__ */ jsxs2(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
ref,
|
|
258
|
+
type: "button",
|
|
259
|
+
id: triggerId,
|
|
260
|
+
"aria-expanded": isExpanded,
|
|
261
|
+
"aria-controls": contentId,
|
|
262
|
+
"aria-disabled": disabled ?? void 0,
|
|
263
|
+
className: cn(accordionTriggerVariants({ disabled }), className),
|
|
264
|
+
onClick: handleClick,
|
|
265
|
+
...props,
|
|
266
|
+
children: [
|
|
267
|
+
iconLeft != null && /* @__PURE__ */ jsx4("span", { className: "accordion-icon-left shrink-0", children: iconLeft }),
|
|
268
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 flex-1", children }),
|
|
269
|
+
/* @__PURE__ */ jsx4(
|
|
270
|
+
Icon,
|
|
271
|
+
{
|
|
272
|
+
name: isExpanded ? "expand_less" : "expand_more",
|
|
273
|
+
size: "sm",
|
|
274
|
+
className: "accordion-expand-icon shrink-0",
|
|
275
|
+
"aria-hidden": true
|
|
276
|
+
}
|
|
277
|
+
)
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
284
|
+
var AccordionContent = React3.forwardRef(
|
|
285
|
+
({ className, children, ...props }, ref) => {
|
|
286
|
+
const { openKeys } = useAccordion();
|
|
287
|
+
const { value, showDivider, triggerId, contentId } = useAccordionItem();
|
|
288
|
+
const isExpanded = openKeys.has(value);
|
|
289
|
+
if (!isExpanded) return null;
|
|
290
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
291
|
+
showDivider && /* @__PURE__ */ jsx4(Divider, { className: "my-0" }),
|
|
292
|
+
/* @__PURE__ */ jsx4(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
ref,
|
|
296
|
+
id: contentId,
|
|
297
|
+
role: "region",
|
|
298
|
+
"aria-labelledby": triggerId,
|
|
299
|
+
className: cn("py-md px-md text-secondary text-sm", className),
|
|
300
|
+
...props,
|
|
301
|
+
children
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
AccordionContent.displayName = "AccordionContent";
|
|
308
|
+
|
|
309
|
+
// src/components/alert.tsx
|
|
310
|
+
import * as React6 from "react";
|
|
311
|
+
import { cva as cva6 } from "class-variance-authority";
|
|
312
|
+
|
|
313
|
+
// src/components/button.tsx
|
|
314
|
+
import * as React4 from "react";
|
|
315
|
+
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
316
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
317
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
318
|
+
var buttonVariants = cva4(
|
|
319
|
+
"inline-flex items-center justify-center font-medium shrink-0 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none",
|
|
320
|
+
{
|
|
321
|
+
variants: {
|
|
322
|
+
variant: {
|
|
323
|
+
primary: "bg-component-button-brand-bg text-on-color hover:bg-component-button-brand-bg-hover active:bg-brand-strong",
|
|
324
|
+
secondary: "bg-component-button-secondary-bg border border-strong text-component-button-secondary-fg shadow-xs hover:bg-component-button-secondary-bg-hover active:bg-quarterary",
|
|
325
|
+
tertiary: "bg-transparent text-component-button-tertiary-color-fg hover:bg-component-button-tertiary-bg-hover active:bg-quarterary",
|
|
326
|
+
danger: "bg-component-button-danger-bg text-on-color hover:bg-component-button-danger-bg-hover active:bg-danger-strong",
|
|
327
|
+
link: "bg-transparent text-component-button-tertiary-color-fg underline-offset-4 hover:underline",
|
|
328
|
+
"link-brand": "bg-transparent text-component-button-link-color-fg underline-offset-4 hover:text-component-button-link-color-fg-hover"
|
|
329
|
+
},
|
|
330
|
+
size: {
|
|
331
|
+
xs: "h-9 px-md gap-0.5 text-sm rounded-sm",
|
|
332
|
+
md: "h-10 px-lg gap-1 text-sm rounded-sm",
|
|
333
|
+
lg: "h-11 px-xl gap-1 text-base rounded-sm",
|
|
334
|
+
xl: "h-12 px-2xl gap-1 text-base rounded-sm",
|
|
335
|
+
"2xl": "h-14 px-2xl gap-2 text-base rounded-md"
|
|
336
|
+
},
|
|
337
|
+
iconOnly: {
|
|
338
|
+
true: "",
|
|
339
|
+
false: ""
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
compoundVariants: [
|
|
343
|
+
// Link variants don't need height/padding
|
|
344
|
+
{
|
|
345
|
+
variant: "link",
|
|
346
|
+
className: "h-auto px-0 py-0 rounded-[6px]"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
variant: "link-brand",
|
|
350
|
+
className: "h-auto px-0 py-0 rounded-[6px]"
|
|
351
|
+
},
|
|
352
|
+
// Icon-only variants: square buttons with no horizontal padding
|
|
353
|
+
{
|
|
354
|
+
iconOnly: true,
|
|
355
|
+
size: "xs",
|
|
356
|
+
className: "w-9 px-0"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
iconOnly: true,
|
|
360
|
+
size: "md",
|
|
361
|
+
className: "w-10 px-0"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
iconOnly: true,
|
|
365
|
+
size: "lg",
|
|
366
|
+
className: "w-11 px-0"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
iconOnly: true,
|
|
370
|
+
size: "xl",
|
|
371
|
+
className: "w-12 px-0"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
iconOnly: true,
|
|
375
|
+
size: "2xl",
|
|
376
|
+
className: "w-14 px-0"
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
defaultVariants: {
|
|
380
|
+
variant: "primary",
|
|
381
|
+
size: "md",
|
|
382
|
+
iconOnly: false
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
var buttonSizeToIconSize = {
|
|
387
|
+
xs: "md",
|
|
388
|
+
md: "md",
|
|
389
|
+
lg: "md",
|
|
390
|
+
xl: "lg",
|
|
391
|
+
"2xl": "lg"
|
|
392
|
+
};
|
|
393
|
+
var Button = React4.forwardRef(
|
|
394
|
+
({
|
|
395
|
+
className,
|
|
396
|
+
variant,
|
|
397
|
+
size = "md",
|
|
398
|
+
asChild = false,
|
|
399
|
+
icon,
|
|
400
|
+
leftIcon,
|
|
401
|
+
rightIcon,
|
|
402
|
+
iconVariant,
|
|
403
|
+
iconFilled,
|
|
404
|
+
children,
|
|
405
|
+
...props
|
|
406
|
+
}, ref) => {
|
|
407
|
+
const Comp = asChild ? Slot : "button";
|
|
408
|
+
const iconSize = buttonSizeToIconSize[size ?? "md"];
|
|
409
|
+
const hasChildren = children != null && children !== "";
|
|
410
|
+
const isIconOnly = !!icon || (!!leftIcon && !rightIcon && !hasChildren || !!rightIcon && !leftIcon && !hasChildren);
|
|
411
|
+
const iconElement = icon ? /* @__PURE__ */ jsx5(
|
|
412
|
+
Icon,
|
|
413
|
+
{
|
|
414
|
+
name: icon,
|
|
415
|
+
size: iconSize,
|
|
416
|
+
variant: iconVariant,
|
|
417
|
+
filled: iconFilled,
|
|
418
|
+
"aria-hidden": true
|
|
419
|
+
}
|
|
420
|
+
) : null;
|
|
421
|
+
const leftIconElement = leftIcon && !icon ? /* @__PURE__ */ jsx5(
|
|
422
|
+
Icon,
|
|
423
|
+
{
|
|
424
|
+
name: leftIcon,
|
|
425
|
+
size: iconSize,
|
|
426
|
+
variant: iconVariant,
|
|
427
|
+
filled: iconFilled,
|
|
428
|
+
"aria-hidden": true
|
|
429
|
+
}
|
|
430
|
+
) : null;
|
|
431
|
+
const rightIconElement = rightIcon && !icon ? /* @__PURE__ */ jsx5(
|
|
432
|
+
Icon,
|
|
433
|
+
{
|
|
434
|
+
name: rightIcon,
|
|
435
|
+
size: iconSize,
|
|
436
|
+
variant: iconVariant,
|
|
437
|
+
filled: iconFilled,
|
|
438
|
+
"aria-hidden": true
|
|
439
|
+
}
|
|
440
|
+
) : null;
|
|
441
|
+
return /* @__PURE__ */ jsxs3(
|
|
442
|
+
Comp,
|
|
443
|
+
{
|
|
444
|
+
ref,
|
|
445
|
+
className: cn(
|
|
446
|
+
buttonVariants({ variant, size, iconOnly: isIconOnly }),
|
|
447
|
+
className
|
|
448
|
+
),
|
|
449
|
+
...props,
|
|
450
|
+
children: [
|
|
451
|
+
iconElement,
|
|
452
|
+
leftIconElement,
|
|
453
|
+
/* @__PURE__ */ jsx5(Slottable, { children }),
|
|
454
|
+
rightIconElement
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
Button.displayName = "Button";
|
|
461
|
+
|
|
462
|
+
// src/components/close-button.tsx
|
|
463
|
+
import * as React5 from "react";
|
|
464
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
465
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
466
|
+
var closeButtonVariants = cva5(
|
|
467
|
+
"inline-flex items-center justify-center shrink-0 rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
468
|
+
{
|
|
469
|
+
variants: {
|
|
470
|
+
variant: {
|
|
471
|
+
ghost: "bg-transparent text-icon-primary hover:bg-tertiary active:bg-quarterary disabled:text-inactive",
|
|
472
|
+
outlined: "bg-transparent border border-strong text-icon-primary hover:border-strong hover:bg-secondary active:bg-tertiary disabled:border-inactive-subtle disabled:bg-secondary disabled:text-inactive"
|
|
473
|
+
},
|
|
474
|
+
size: {
|
|
475
|
+
sm: "size-6",
|
|
476
|
+
md: "size-8",
|
|
477
|
+
lg: "size-10",
|
|
478
|
+
xl: "size-12"
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
defaultVariants: {
|
|
482
|
+
variant: "ghost",
|
|
483
|
+
size: "md"
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
var closeButtonSizeToIconSize = {
|
|
488
|
+
sm: "sm",
|
|
489
|
+
md: "md",
|
|
490
|
+
lg: "md",
|
|
491
|
+
xl: "lg"
|
|
492
|
+
};
|
|
493
|
+
var CloseButton = React5.forwardRef(
|
|
494
|
+
({
|
|
495
|
+
className,
|
|
496
|
+
variant,
|
|
497
|
+
size = "md",
|
|
498
|
+
"aria-label": ariaLabel = "Close",
|
|
499
|
+
iconVariant,
|
|
500
|
+
iconFilled,
|
|
501
|
+
...props
|
|
502
|
+
}, ref) => {
|
|
503
|
+
const iconSize = closeButtonSizeToIconSize[size ?? "md"];
|
|
504
|
+
return /* @__PURE__ */ jsx6(
|
|
505
|
+
"button",
|
|
506
|
+
{
|
|
507
|
+
ref,
|
|
508
|
+
type: "button",
|
|
509
|
+
"aria-label": ariaLabel,
|
|
510
|
+
className: cn(closeButtonVariants({ variant, size }), className),
|
|
511
|
+
...props,
|
|
512
|
+
children: /* @__PURE__ */ jsx6(
|
|
513
|
+
Icon,
|
|
514
|
+
{
|
|
515
|
+
name: "close",
|
|
516
|
+
size: iconSize,
|
|
517
|
+
variant: iconVariant,
|
|
518
|
+
filled: iconFilled,
|
|
519
|
+
"aria-hidden": true
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
CloseButton.displayName = "CloseButton";
|
|
527
|
+
|
|
528
|
+
// src/components/alert.tsx
|
|
529
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
530
|
+
var alertVariants = cva6(
|
|
531
|
+
"flex gap-md rounded-sm px-md py-md transition-colors",
|
|
532
|
+
{
|
|
533
|
+
variants: {
|
|
534
|
+
type: {
|
|
535
|
+
info: "",
|
|
536
|
+
success: "",
|
|
537
|
+
warning: "",
|
|
538
|
+
danger: "",
|
|
539
|
+
neutral: ""
|
|
540
|
+
},
|
|
541
|
+
emphasis: {
|
|
542
|
+
// Low is identical across all types — no compound variant needed
|
|
543
|
+
low: "bg-primary border border-strong text-primary",
|
|
544
|
+
medium: "",
|
|
545
|
+
// NOTE: "medium" and "moderate" are near-synonyms in English.
|
|
546
|
+
// Consider renaming to "subtle" / "bold" in a future major version.
|
|
547
|
+
moderate: "",
|
|
548
|
+
high: ""
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
compoundVariants: [
|
|
552
|
+
// Medium emphasis — light pastel backgrounds with pastel borders
|
|
553
|
+
{ emphasis: "medium", type: "info", className: "bg-info-tertiary border border-info-subtle text-info" },
|
|
554
|
+
{ emphasis: "medium", type: "success", className: "bg-success-tertiary border border-success-secondary text-success" },
|
|
555
|
+
{ emphasis: "medium", type: "warning", className: "bg-warning-tertiary border border-warning-secondary text-warning-strong" },
|
|
556
|
+
{ emphasis: "medium", type: "danger", className: "bg-danger-tertiary border border-danger-secondary text-danger" },
|
|
557
|
+
{ emphasis: "medium", type: "neutral", className: "bg-secondary border border-strong" },
|
|
558
|
+
// Moderate emphasis — secondary backgrounds with more saturated borders
|
|
559
|
+
{ emphasis: "moderate", type: "info", className: "bg-info-secondary border border-info-subtle text-info" },
|
|
560
|
+
{ emphasis: "moderate", type: "success", className: "bg-success-secondary border border-success-secondary text-success" },
|
|
561
|
+
{ emphasis: "moderate", type: "warning", className: "bg-warning-secondary border border-warning-secondary text-warning-strong" },
|
|
562
|
+
{ emphasis: "moderate", type: "danger", className: "bg-danger-secondary border border-danger-secondary text-danger" },
|
|
563
|
+
{ emphasis: "moderate", type: "neutral", className: "bg-tertiary border border-strong" },
|
|
564
|
+
// High emphasis — saturated backgrounds with white text, no border
|
|
565
|
+
{ emphasis: "high", type: "info", className: "bg-info text-on-color" },
|
|
566
|
+
{ emphasis: "high", type: "success", className: "bg-success text-on-color" },
|
|
567
|
+
{ emphasis: "high", type: "warning", className: "bg-warning text-on-color" },
|
|
568
|
+
{ emphasis: "high", type: "danger", className: "bg-danger text-on-color" },
|
|
569
|
+
{ emphasis: "high", type: "neutral", className: "bg-quarterary text-primary" }
|
|
570
|
+
],
|
|
571
|
+
defaultVariants: {
|
|
572
|
+
type: "info",
|
|
573
|
+
emphasis: "medium"
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
);
|
|
577
|
+
var TYPE_ICON = {
|
|
578
|
+
danger: "error",
|
|
579
|
+
success: "check_circle",
|
|
580
|
+
warning: "warning",
|
|
581
|
+
info: "info",
|
|
582
|
+
neutral: "notifications"
|
|
583
|
+
};
|
|
584
|
+
var TYPE_COLOR = {
|
|
585
|
+
danger: "text-danger",
|
|
586
|
+
success: "text-success",
|
|
587
|
+
warning: "text-warning-strong",
|
|
588
|
+
info: "text-info",
|
|
589
|
+
neutral: "text-primary"
|
|
590
|
+
};
|
|
591
|
+
var TYPE_ICON_COLOR = {
|
|
592
|
+
danger: "text-danger",
|
|
593
|
+
success: "text-success",
|
|
594
|
+
warning: "text-warning-strong",
|
|
595
|
+
info: "text-info",
|
|
596
|
+
neutral: "text-icon-primary"
|
|
597
|
+
};
|
|
598
|
+
var Alert = React6.forwardRef(
|
|
599
|
+
({
|
|
600
|
+
className,
|
|
601
|
+
type = "info",
|
|
602
|
+
emphasis = "medium",
|
|
603
|
+
expand = false,
|
|
604
|
+
title,
|
|
605
|
+
description,
|
|
606
|
+
actions,
|
|
607
|
+
onClose,
|
|
608
|
+
iconVariant,
|
|
609
|
+
iconFilled,
|
|
610
|
+
role,
|
|
611
|
+
...props
|
|
612
|
+
}, ref) => {
|
|
613
|
+
const t = type ?? "info";
|
|
614
|
+
const e = emphasis ?? "medium";
|
|
615
|
+
const isHigh = e === "high";
|
|
616
|
+
const isHighContrast = isHigh && t !== "neutral";
|
|
617
|
+
const iconSize = e === "low" ? "sm" : "md";
|
|
618
|
+
const iconColor = isHighContrast ? "text-on-color" : TYPE_ICON_COLOR[t];
|
|
619
|
+
const descriptionColor = isHighContrast ? "text-on-color" : "";
|
|
620
|
+
const closeButtonColor = e === "low" ? "text-icon-secondary" : t === "neutral" ? isHigh ? "text-icon-primary" : "text-icon-secondary" : iconColor;
|
|
621
|
+
const resolvedRole = role ?? (t === "danger" || t === "warning" ? "alert" : "status");
|
|
622
|
+
const liveRegion = t === "danger" || t === "warning" ? "assertive" : "polite";
|
|
623
|
+
return /* @__PURE__ */ jsxs4(
|
|
624
|
+
"div",
|
|
625
|
+
{
|
|
626
|
+
ref,
|
|
627
|
+
role: resolvedRole,
|
|
628
|
+
"aria-live": liveRegion,
|
|
629
|
+
className: cn(
|
|
630
|
+
alertVariants({ type: t, emphasis: e }),
|
|
631
|
+
expand ? "items-start" : "items-center",
|
|
632
|
+
className
|
|
633
|
+
),
|
|
634
|
+
...props,
|
|
635
|
+
children: [
|
|
636
|
+
/* @__PURE__ */ jsx7(
|
|
637
|
+
Icon,
|
|
638
|
+
{
|
|
639
|
+
name: TYPE_ICON[t],
|
|
640
|
+
size: iconSize,
|
|
641
|
+
variant: iconVariant,
|
|
642
|
+
filled: iconFilled,
|
|
643
|
+
className: cn("shrink-0", iconColor),
|
|
644
|
+
"aria-hidden": true
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 min-w-0", children: [
|
|
648
|
+
/* @__PURE__ */ jsxs4(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
className: cn(
|
|
652
|
+
"flex justify-between gap-md",
|
|
653
|
+
expand ? "items-start" : "items-center"
|
|
654
|
+
),
|
|
655
|
+
children: [
|
|
656
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 min-w-0", children: [
|
|
657
|
+
/* @__PURE__ */ jsx7(
|
|
658
|
+
"div",
|
|
659
|
+
{
|
|
660
|
+
className: cn(
|
|
661
|
+
"text-sm leading-5",
|
|
662
|
+
expand && description ? "font-medium" : "font-regular"
|
|
663
|
+
),
|
|
664
|
+
children: title
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
expand && description && /* @__PURE__ */ jsx7(
|
|
668
|
+
"div",
|
|
669
|
+
{
|
|
670
|
+
className: cn("text-sm leading-5 mt-xs", descriptionColor),
|
|
671
|
+
children: description
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
] }),
|
|
675
|
+
onClose && /* @__PURE__ */ jsx7(
|
|
676
|
+
CloseButton,
|
|
677
|
+
{
|
|
678
|
+
variant: "ghost",
|
|
679
|
+
size: "sm",
|
|
680
|
+
onClick: onClose,
|
|
681
|
+
"aria-label": "Close alert",
|
|
682
|
+
className: closeButtonColor
|
|
683
|
+
}
|
|
684
|
+
)
|
|
685
|
+
]
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
expand && actions && actions.length > 0 && /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-md mt-sm", children: actions.map((action, index) => /* @__PURE__ */ jsx7(
|
|
689
|
+
Button,
|
|
690
|
+
{
|
|
691
|
+
variant: "link-brand",
|
|
692
|
+
size: "xs",
|
|
693
|
+
onClick: action.onClick,
|
|
694
|
+
className: isHighContrast ? "text-on-color" : e === "low" ? void 0 : TYPE_COLOR[t],
|
|
695
|
+
children: action.label
|
|
696
|
+
},
|
|
697
|
+
index
|
|
698
|
+
)) })
|
|
699
|
+
] })
|
|
700
|
+
]
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
);
|
|
705
|
+
Alert.displayName = "Alert";
|
|
706
|
+
|
|
707
|
+
// src/components/avatar.tsx
|
|
708
|
+
import * as React7 from "react";
|
|
709
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
710
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
711
|
+
var avatarVariants = cva7(
|
|
712
|
+
"inline-flex items-center justify-center font-medium shrink-0 bg-quarterary text-secondary select-none overflow-hidden",
|
|
713
|
+
{
|
|
714
|
+
variants: {
|
|
715
|
+
shape: {
|
|
716
|
+
circle: "rounded-full",
|
|
717
|
+
rounded: "rounded-md"
|
|
718
|
+
},
|
|
719
|
+
size: {
|
|
720
|
+
xs: "h-6 w-6 text-xs",
|
|
721
|
+
sm: "h-7 w-7 text-xs",
|
|
722
|
+
md: "h-8 w-8 text-sm",
|
|
723
|
+
lg: "h-9 w-9 text-sm",
|
|
724
|
+
xl: "h-10 w-10 text-base",
|
|
725
|
+
"2xl": "h-12 w-12 text-lg",
|
|
726
|
+
"3xl": "h-14 w-14 text-xl",
|
|
727
|
+
"4xl": "h-16 w-16 text-xl"
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
defaultVariants: {
|
|
731
|
+
shape: "circle",
|
|
732
|
+
size: "md"
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
var avatarSizeToIconSize = {
|
|
737
|
+
xs: "xs",
|
|
738
|
+
sm: "xs",
|
|
739
|
+
md: "sm",
|
|
740
|
+
lg: "sm",
|
|
741
|
+
xl: "md",
|
|
742
|
+
"2xl": "md",
|
|
743
|
+
"3xl": "lg",
|
|
744
|
+
"4xl": "lg"
|
|
745
|
+
};
|
|
746
|
+
var Avatar = React7.forwardRef(
|
|
747
|
+
({
|
|
748
|
+
className,
|
|
749
|
+
shape,
|
|
750
|
+
size = "md",
|
|
751
|
+
initials,
|
|
752
|
+
"aria-label": ariaLabel,
|
|
753
|
+
username,
|
|
754
|
+
supportingText,
|
|
755
|
+
...props
|
|
756
|
+
}, ref) => {
|
|
757
|
+
const iconSize = avatarSizeToIconSize[size ?? "md"];
|
|
758
|
+
const trimmedInitials = initials?.trim() ?? "";
|
|
759
|
+
const trimmedUsername = username?.trim() ?? "";
|
|
760
|
+
const trimmedSupporting = supportingText?.trim() ?? "";
|
|
761
|
+
const hasInitials = trimmedInitials !== "";
|
|
762
|
+
const isDecorative = ariaLabel == null || ariaLabel.trim() === "";
|
|
763
|
+
const hasText = trimmedUsername !== "" || trimmedSupporting !== "";
|
|
764
|
+
const circle = /* @__PURE__ */ jsx8(
|
|
765
|
+
"div",
|
|
766
|
+
{
|
|
767
|
+
role: isDecorative ? void 0 : "img",
|
|
768
|
+
"aria-label": isDecorative ? void 0 : ariaLabel,
|
|
769
|
+
className: cn(avatarVariants({ shape, size }), !hasText && className),
|
|
770
|
+
children: hasInitials ? /* @__PURE__ */ jsx8("span", { className: "shrink-0 leading-none", children: trimmedInitials.slice(0, 2).toUpperCase() }) : /* @__PURE__ */ jsx8(
|
|
771
|
+
Icon,
|
|
772
|
+
{
|
|
773
|
+
name: "person",
|
|
774
|
+
size: iconSize,
|
|
775
|
+
className: "text-icon-secondary",
|
|
776
|
+
"aria-hidden": true
|
|
777
|
+
}
|
|
778
|
+
)
|
|
779
|
+
}
|
|
780
|
+
);
|
|
781
|
+
if (hasText) {
|
|
782
|
+
return /* @__PURE__ */ jsxs5(
|
|
783
|
+
"div",
|
|
784
|
+
{
|
|
785
|
+
ref,
|
|
786
|
+
className: cn("inline-flex items-center gap-md min-w-0", className),
|
|
787
|
+
...props,
|
|
788
|
+
children: [
|
|
789
|
+
circle,
|
|
790
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col justify-center", children: [
|
|
791
|
+
trimmedUsername !== "" && /* @__PURE__ */ jsx8("span", { className: "truncate text-sm font-medium text-primary", children: trimmedUsername }),
|
|
792
|
+
trimmedSupporting !== "" && /* @__PURE__ */ jsx8("span", { className: "truncate text-xs text-secondary", children: trimmedSupporting })
|
|
793
|
+
] })
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
return React7.cloneElement(circle, {
|
|
799
|
+
ref,
|
|
800
|
+
className: cn(avatarVariants({ shape, size }), className),
|
|
801
|
+
...props
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
Avatar.displayName = "Avatar";
|
|
806
|
+
|
|
807
|
+
// src/components/avatar-group.tsx
|
|
808
|
+
import * as React9 from "react";
|
|
809
|
+
|
|
810
|
+
// src/components/avatar-profile.tsx
|
|
811
|
+
import * as React8 from "react";
|
|
812
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
813
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
814
|
+
function withFilledIcon(node) {
|
|
815
|
+
if (React8.isValidElement(node) && node.type === Icon) {
|
|
816
|
+
return React8.cloneElement(node, {
|
|
817
|
+
filled: true
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
return node;
|
|
821
|
+
}
|
|
822
|
+
var avatarProfileVariants = cva8(
|
|
823
|
+
"relative inline-flex shrink-0 border-2 border-subtract shadow-sm",
|
|
824
|
+
{
|
|
825
|
+
variants: {
|
|
826
|
+
shape: {
|
|
827
|
+
circle: "rounded-full",
|
|
828
|
+
rounded: "rounded-md"
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
defaultVariants: {
|
|
832
|
+
shape: "circle"
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
);
|
|
836
|
+
var badgeSlotClasses = "absolute flex items-center justify-center rounded-full shrink-0 overflow-hidden z-10 box-border border-2 border-subtract bg-brand text-on-color w-xl h-xl min-w-xl min-h-xl";
|
|
837
|
+
var AvatarProfile = React8.forwardRef(
|
|
838
|
+
({
|
|
839
|
+
className,
|
|
840
|
+
shape,
|
|
841
|
+
size = "md",
|
|
842
|
+
initials,
|
|
843
|
+
"aria-label": ariaLabel,
|
|
844
|
+
topRight,
|
|
845
|
+
bottomRight,
|
|
846
|
+
...props
|
|
847
|
+
}, ref) => {
|
|
848
|
+
return /* @__PURE__ */ jsxs6(
|
|
849
|
+
"div",
|
|
850
|
+
{
|
|
851
|
+
ref,
|
|
852
|
+
className: cn(avatarProfileVariants({ shape }), className),
|
|
853
|
+
...props,
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ jsx9(
|
|
856
|
+
Avatar,
|
|
857
|
+
{
|
|
858
|
+
shape: shape ?? "circle",
|
|
859
|
+
size,
|
|
860
|
+
initials,
|
|
861
|
+
"aria-label": ariaLabel,
|
|
862
|
+
className: "shrink-0"
|
|
863
|
+
}
|
|
864
|
+
),
|
|
865
|
+
topRight != null && /* @__PURE__ */ jsx9(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
className: cn(
|
|
869
|
+
badgeSlotClasses,
|
|
870
|
+
"top-0 right-0 translate-x-1/2 -translate-y-1/2"
|
|
871
|
+
),
|
|
872
|
+
"aria-hidden": true,
|
|
873
|
+
children: withFilledIcon(topRight)
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
bottomRight != null && /* @__PURE__ */ jsx9(
|
|
877
|
+
"div",
|
|
878
|
+
{
|
|
879
|
+
className: cn(
|
|
880
|
+
badgeSlotClasses,
|
|
881
|
+
"bottom-0 right-0 translate-x-1/2 translate-y-1/2"
|
|
882
|
+
),
|
|
883
|
+
"aria-hidden": true,
|
|
884
|
+
children: withFilledIcon(bottomRight)
|
|
885
|
+
}
|
|
886
|
+
)
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
);
|
|
892
|
+
AvatarProfile.displayName = "AvatarProfile";
|
|
893
|
+
|
|
894
|
+
// src/components/avatar-group.tsx
|
|
895
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
896
|
+
var groupSizeToProfileSize = {
|
|
897
|
+
"24": "xs",
|
|
898
|
+
"32": "md",
|
|
899
|
+
"40": "xl"
|
|
900
|
+
};
|
|
901
|
+
var groupSizeToIconSize = {
|
|
902
|
+
"24": "xs",
|
|
903
|
+
"32": "sm",
|
|
904
|
+
"40": "md"
|
|
905
|
+
};
|
|
906
|
+
var overlapClass = "-ml-sm";
|
|
907
|
+
var badgeSizeClasses = {
|
|
908
|
+
"24": "h-6 w-6 min-w-6 min-h-6 text-xs",
|
|
909
|
+
"32": "h-8 w-8 min-w-8 min-h-8 text-sm",
|
|
910
|
+
"40": "h-10 w-10 min-w-10 min-h-10 text-base"
|
|
911
|
+
};
|
|
912
|
+
var AvatarGroup = React9.forwardRef(
|
|
913
|
+
({
|
|
914
|
+
className,
|
|
915
|
+
lastOnTop = true,
|
|
916
|
+
size = "32",
|
|
917
|
+
moreAvatars = false,
|
|
918
|
+
addMore = false,
|
|
919
|
+
avatars,
|
|
920
|
+
maxVisible = 4,
|
|
921
|
+
onAddMore,
|
|
922
|
+
...props
|
|
923
|
+
}, ref) => {
|
|
924
|
+
const profileSize = groupSizeToProfileSize[size];
|
|
925
|
+
const iconSize = groupSizeToIconSize[size];
|
|
926
|
+
const badgeSize = badgeSizeClasses[size];
|
|
927
|
+
const visible = avatars.slice(0, maxVisible);
|
|
928
|
+
const overflowCount = avatars.length - visible.length;
|
|
929
|
+
const showOverflow = moreAvatars && overflowCount > 0;
|
|
930
|
+
return /* @__PURE__ */ jsxs7(
|
|
931
|
+
"div",
|
|
932
|
+
{
|
|
933
|
+
ref,
|
|
934
|
+
role: "group",
|
|
935
|
+
"aria-label": avatars.length > 0 ? `${avatars.length} ${avatars.length === 1 ? "member" : "members"}` : void 0,
|
|
936
|
+
className: cn("inline-flex items-center", className),
|
|
937
|
+
...props,
|
|
938
|
+
children: [
|
|
939
|
+
visible.map((item, index) => /* @__PURE__ */ jsx10(
|
|
940
|
+
"span",
|
|
941
|
+
{
|
|
942
|
+
className: cn("relative shrink-0", index === 0 ? "" : overlapClass),
|
|
943
|
+
style: {
|
|
944
|
+
zIndex: lastOnTop ? visible.length - index : index + 1
|
|
945
|
+
},
|
|
946
|
+
children: /* @__PURE__ */ jsx10(
|
|
947
|
+
AvatarProfile,
|
|
948
|
+
{
|
|
949
|
+
size: profileSize,
|
|
950
|
+
shape: "circle",
|
|
951
|
+
initials: item.initials,
|
|
952
|
+
"aria-label": item["aria-label"]
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
},
|
|
956
|
+
index
|
|
957
|
+
)),
|
|
958
|
+
showOverflow && /* @__PURE__ */ jsxs7(
|
|
959
|
+
"span",
|
|
960
|
+
{
|
|
961
|
+
className: cn(
|
|
962
|
+
"inline-flex items-center justify-center rounded-full border-2 border-subtract bg-tertiary text-secondary font-medium shrink-0",
|
|
963
|
+
overlapClass,
|
|
964
|
+
badgeSize
|
|
965
|
+
),
|
|
966
|
+
style: { zIndex: 0 },
|
|
967
|
+
"aria-hidden": true,
|
|
968
|
+
children: [
|
|
969
|
+
"+",
|
|
970
|
+
overflowCount
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
addMore && /* @__PURE__ */ jsx10(
|
|
975
|
+
"button",
|
|
976
|
+
{
|
|
977
|
+
type: "button",
|
|
978
|
+
onClick: onAddMore,
|
|
979
|
+
className: cn(
|
|
980
|
+
"inline-flex items-center justify-center rounded-full border-2 border-dashed border-strong bg-transparent text-icon-tertiary shrink-0 transition-colors hover:bg-tertiary hover:border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2",
|
|
981
|
+
overlapClass,
|
|
982
|
+
badgeSize
|
|
983
|
+
),
|
|
984
|
+
"aria-label": "Add member",
|
|
985
|
+
children: /* @__PURE__ */ jsx10(Icon, { name: "add", size: iconSize, filled: true, "aria-hidden": true })
|
|
986
|
+
}
|
|
987
|
+
)
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
AvatarGroup.displayName = "AvatarGroup";
|
|
994
|
+
|
|
995
|
+
// src/components/badge.tsx
|
|
996
|
+
import * as React10 from "react";
|
|
997
|
+
import { cva as cva9 } from "class-variance-authority";
|
|
998
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
999
|
+
var badgeVariants = cva9(
|
|
1000
|
+
"inline-flex items-center justify-center rounded-full font-medium shrink-0 gap-1",
|
|
1001
|
+
{
|
|
1002
|
+
variants: {
|
|
1003
|
+
variant: {
|
|
1004
|
+
filled: "",
|
|
1005
|
+
light: "border",
|
|
1006
|
+
outlined: "border bg-transparent"
|
|
1007
|
+
},
|
|
1008
|
+
color: {
|
|
1009
|
+
brand: "",
|
|
1010
|
+
neutral: "",
|
|
1011
|
+
success: "",
|
|
1012
|
+
warning: "",
|
|
1013
|
+
danger: "",
|
|
1014
|
+
info: ""
|
|
1015
|
+
},
|
|
1016
|
+
size: {
|
|
1017
|
+
sm: "h-6 px-sm text-xs leading-4",
|
|
1018
|
+
lg: "h-7 px-md text-sm leading-5"
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
compoundVariants: [
|
|
1022
|
+
// Filled variants
|
|
1023
|
+
{
|
|
1024
|
+
variant: "filled",
|
|
1025
|
+
color: "brand",
|
|
1026
|
+
className: "bg-brand text-on-color"
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
variant: "filled",
|
|
1030
|
+
color: "neutral",
|
|
1031
|
+
className: "bg-brand-neutral-700 text-on-color"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
variant: "filled",
|
|
1035
|
+
color: "success",
|
|
1036
|
+
className: "bg-success text-on-color"
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
variant: "filled",
|
|
1040
|
+
color: "warning",
|
|
1041
|
+
className: "bg-warning text-on-color"
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
variant: "filled",
|
|
1045
|
+
color: "danger",
|
|
1046
|
+
className: "bg-danger text-on-color"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
variant: "filled",
|
|
1050
|
+
color: "info",
|
|
1051
|
+
className: "bg-info text-on-color"
|
|
1052
|
+
},
|
|
1053
|
+
// Light variants
|
|
1054
|
+
{
|
|
1055
|
+
variant: "light",
|
|
1056
|
+
color: "brand",
|
|
1057
|
+
className: "bg-brand-tertiary border-brand-secondary text-brand"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
variant: "light",
|
|
1061
|
+
color: "neutral",
|
|
1062
|
+
className: "bg-secondary border-strong text-primary"
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
variant: "light",
|
|
1066
|
+
color: "success",
|
|
1067
|
+
className: "bg-success-tertiary border-success-secondary text-success-strong"
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
variant: "light",
|
|
1071
|
+
color: "warning",
|
|
1072
|
+
className: "bg-warning-tertiary border-warning-secondary text-warning-strong"
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
variant: "light",
|
|
1076
|
+
color: "danger",
|
|
1077
|
+
className: "bg-danger-tertiary border-danger-secondary text-danger-strong"
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
variant: "light",
|
|
1081
|
+
color: "info",
|
|
1082
|
+
className: "bg-info-tertiary border-info-subtle text-info-strong"
|
|
1083
|
+
},
|
|
1084
|
+
// Outlined variants
|
|
1085
|
+
{
|
|
1086
|
+
variant: "outlined",
|
|
1087
|
+
color: "brand",
|
|
1088
|
+
className: "border-brand text-brand"
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
variant: "outlined",
|
|
1092
|
+
color: "neutral",
|
|
1093
|
+
className: "border-strong text-primary"
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
variant: "outlined",
|
|
1097
|
+
color: "success",
|
|
1098
|
+
className: "border-success text-success"
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
variant: "outlined",
|
|
1102
|
+
color: "warning",
|
|
1103
|
+
className: "border-warning text-warning-strong"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
variant: "outlined",
|
|
1107
|
+
color: "danger",
|
|
1108
|
+
className: "border-danger text-danger"
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
variant: "outlined",
|
|
1112
|
+
color: "info",
|
|
1113
|
+
className: "border-info text-info"
|
|
1114
|
+
}
|
|
1115
|
+
],
|
|
1116
|
+
defaultVariants: {
|
|
1117
|
+
variant: "light",
|
|
1118
|
+
color: "brand",
|
|
1119
|
+
size: "sm"
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
var badgeSizeToIconSize = {
|
|
1124
|
+
sm: "xs",
|
|
1125
|
+
lg: "sm"
|
|
1126
|
+
};
|
|
1127
|
+
var Badge = React10.forwardRef(
|
|
1128
|
+
({
|
|
1129
|
+
className,
|
|
1130
|
+
variant,
|
|
1131
|
+
color,
|
|
1132
|
+
size = "sm",
|
|
1133
|
+
withDot,
|
|
1134
|
+
leftIcon,
|
|
1135
|
+
rightIcon,
|
|
1136
|
+
iconVariant,
|
|
1137
|
+
iconFilled,
|
|
1138
|
+
children,
|
|
1139
|
+
...props
|
|
1140
|
+
}, ref) => {
|
|
1141
|
+
const iconSize = badgeSizeToIconSize[size ?? "sm"];
|
|
1142
|
+
const dotElement = withDot ? /* @__PURE__ */ jsx11(
|
|
1143
|
+
"span",
|
|
1144
|
+
{
|
|
1145
|
+
className: "inline-block size-1.5 rounded-full bg-current",
|
|
1146
|
+
"aria-hidden": "true"
|
|
1147
|
+
}
|
|
1148
|
+
) : null;
|
|
1149
|
+
const leftIconElement = leftIcon ? /* @__PURE__ */ jsx11(
|
|
1150
|
+
Icon,
|
|
1151
|
+
{
|
|
1152
|
+
name: leftIcon,
|
|
1153
|
+
size: iconSize,
|
|
1154
|
+
variant: iconVariant,
|
|
1155
|
+
filled: iconFilled,
|
|
1156
|
+
"aria-hidden": true
|
|
1157
|
+
}
|
|
1158
|
+
) : null;
|
|
1159
|
+
const rightIconElement = rightIcon ? /* @__PURE__ */ jsx11(
|
|
1160
|
+
Icon,
|
|
1161
|
+
{
|
|
1162
|
+
name: rightIcon,
|
|
1163
|
+
size: iconSize,
|
|
1164
|
+
variant: iconVariant,
|
|
1165
|
+
filled: iconFilled,
|
|
1166
|
+
"aria-hidden": true
|
|
1167
|
+
}
|
|
1168
|
+
) : null;
|
|
1169
|
+
return /* @__PURE__ */ jsxs8(
|
|
1170
|
+
"span",
|
|
1171
|
+
{
|
|
1172
|
+
ref,
|
|
1173
|
+
className: cn(badgeVariants({ variant, color, size }), className),
|
|
1174
|
+
...props,
|
|
1175
|
+
children: [
|
|
1176
|
+
dotElement,
|
|
1177
|
+
leftIconElement,
|
|
1178
|
+
children,
|
|
1179
|
+
rightIconElement
|
|
1180
|
+
]
|
|
1181
|
+
}
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
);
|
|
1185
|
+
Badge.displayName = "Badge";
|
|
1186
|
+
|
|
1187
|
+
// src/components/breadcrumb.tsx
|
|
1188
|
+
import * as React11 from "react";
|
|
1189
|
+
import { cva as cva10 } from "class-variance-authority";
|
|
1190
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1191
|
+
var breadcrumbListVariants = cva10("flex flex-wrap items-center gap-xs", {
|
|
1192
|
+
variants: {
|
|
1193
|
+
containerStyle: {
|
|
1194
|
+
default: "",
|
|
1195
|
+
withBackground: "rounded-sm border border-default bg-primary p-md"
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
defaultVariants: {
|
|
1199
|
+
containerStyle: "default"
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
var breadcrumbSeparatorVariants = cva10(
|
|
1203
|
+
"flex items-center shrink-0 text-inactive",
|
|
1204
|
+
{
|
|
1205
|
+
variants: {
|
|
1206
|
+
separator: {
|
|
1207
|
+
slash: "px-xs text-sm font-normal",
|
|
1208
|
+
chevron: "[&_.breadcrumb-sep-icon]:text-icon-inactive"
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
defaultVariants: {
|
|
1212
|
+
separator: "chevron"
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
var Breadcrumb = React11.forwardRef(
|
|
1217
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1218
|
+
"nav",
|
|
1219
|
+
{
|
|
1220
|
+
ref,
|
|
1221
|
+
"aria-label": "Breadcrumb",
|
|
1222
|
+
className: cn(className),
|
|
1223
|
+
...props
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
);
|
|
1227
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
1228
|
+
var BreadcrumbList = React11.forwardRef(
|
|
1229
|
+
({ className, containerStyle, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1230
|
+
"ol",
|
|
1231
|
+
{
|
|
1232
|
+
ref,
|
|
1233
|
+
className: cn(breadcrumbListVariants({ containerStyle }), className),
|
|
1234
|
+
...props
|
|
1235
|
+
}
|
|
1236
|
+
)
|
|
1237
|
+
);
|
|
1238
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
1239
|
+
var BreadcrumbListItem = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1240
|
+
"li",
|
|
1241
|
+
{
|
|
1242
|
+
ref,
|
|
1243
|
+
className: cn("inline-flex items-center gap-xs", className),
|
|
1244
|
+
...props
|
|
1245
|
+
}
|
|
1246
|
+
));
|
|
1247
|
+
BreadcrumbListItem.displayName = "BreadcrumbListItem";
|
|
1248
|
+
var BreadcrumbSeparator = React11.forwardRef(({ className, separator = "chevron", ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
1249
|
+
"span",
|
|
1250
|
+
{
|
|
1251
|
+
ref,
|
|
1252
|
+
role: "presentation",
|
|
1253
|
+
"aria-hidden": true,
|
|
1254
|
+
className: cn(breadcrumbSeparatorVariants({ separator }), className),
|
|
1255
|
+
...props,
|
|
1256
|
+
children: separator === "slash" ? "/" : /* @__PURE__ */ jsx12(
|
|
1257
|
+
Icon,
|
|
1258
|
+
{
|
|
1259
|
+
name: "chevron_right",
|
|
1260
|
+
size: "sm",
|
|
1261
|
+
"aria-hidden": true,
|
|
1262
|
+
className: "breadcrumb-sep-icon"
|
|
1263
|
+
}
|
|
1264
|
+
)
|
|
1265
|
+
}
|
|
1266
|
+
));
|
|
1267
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
1268
|
+
|
|
1269
|
+
// src/components/breadcrumb-item.tsx
|
|
1270
|
+
import * as React12 from "react";
|
|
1271
|
+
import { cva as cva11 } from "class-variance-authority";
|
|
1272
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1273
|
+
var breadcrumbItemVariants = cva11(
|
|
1274
|
+
"inline-flex text-sm items-center gap-xs rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 [&_.breadcrumb-icon]:shrink-0",
|
|
1275
|
+
{
|
|
1276
|
+
variants: {
|
|
1277
|
+
variant: {
|
|
1278
|
+
iconText: "min-w-0",
|
|
1279
|
+
iconOnly: "",
|
|
1280
|
+
overflow: "min-w-0"
|
|
1281
|
+
},
|
|
1282
|
+
state: {
|
|
1283
|
+
default: "text-secondary [&_.breadcrumb-icon]:text-icon-secondary hover:text-tertiary-hover hover:[&_.breadcrumb-icon]:text-icon-tertiary-hover",
|
|
1284
|
+
active: "text-primary font-medium [&_.breadcrumb-icon]:text-icon-primary",
|
|
1285
|
+
disabled: "text-inactive [&_.breadcrumb-icon]:text-icon-inactive-subtle cursor-default pointer-events-none"
|
|
1286
|
+
},
|
|
1287
|
+
overflowHover: {
|
|
1288
|
+
true: "hover:bg-tertiary",
|
|
1289
|
+
false: ""
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
compoundVariants: [
|
|
1293
|
+
{
|
|
1294
|
+
variant: "overflow",
|
|
1295
|
+
overflowHover: true,
|
|
1296
|
+
state: "default",
|
|
1297
|
+
className: "hover:bg-tertiary hover:text-secondary-hover hover:[&_.breadcrumb-icon]:text-icon-secondary-hover"
|
|
1298
|
+
}
|
|
1299
|
+
],
|
|
1300
|
+
defaultVariants: {
|
|
1301
|
+
variant: "iconText",
|
|
1302
|
+
state: "default",
|
|
1303
|
+
overflowHover: false
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
);
|
|
1307
|
+
var BreadcrumbItem = React12.forwardRef(
|
|
1308
|
+
({
|
|
1309
|
+
className,
|
|
1310
|
+
variant: styleVariant = "iconText",
|
|
1311
|
+
state,
|
|
1312
|
+
overflowHover,
|
|
1313
|
+
active = false,
|
|
1314
|
+
disabled = false,
|
|
1315
|
+
icon,
|
|
1316
|
+
href,
|
|
1317
|
+
children,
|
|
1318
|
+
...props
|
|
1319
|
+
}, ref) => {
|
|
1320
|
+
const derivedState = state ? state : disabled ? "disabled" : active ? "active" : "default";
|
|
1321
|
+
const showOverflowHover = overflowHover ?? (styleVariant === "overflow" && derivedState === "default");
|
|
1322
|
+
const iconName = styleVariant === "overflow" ? "more_horiz" : icon ?? "home";
|
|
1323
|
+
const classes = cn(
|
|
1324
|
+
breadcrumbItemVariants({
|
|
1325
|
+
variant: styleVariant,
|
|
1326
|
+
state: derivedState,
|
|
1327
|
+
overflowHover: showOverflowHover
|
|
1328
|
+
}),
|
|
1329
|
+
className
|
|
1330
|
+
);
|
|
1331
|
+
const iconElement = styleVariant !== "overflow" || iconName ? /* @__PURE__ */ jsx13(
|
|
1332
|
+
Icon,
|
|
1333
|
+
{
|
|
1334
|
+
name: iconName,
|
|
1335
|
+
size: "sm",
|
|
1336
|
+
filled: derivedState === "active",
|
|
1337
|
+
"aria-hidden": true,
|
|
1338
|
+
className: "breadcrumb-icon"
|
|
1339
|
+
}
|
|
1340
|
+
) : null;
|
|
1341
|
+
const labelContent = styleVariant === "iconText" && children != null ? /* @__PURE__ */ jsx13("span", { className: "truncate", children }) : (styleVariant === "iconOnly" || styleVariant === "overflow") && children != null ? /* @__PURE__ */ jsx13("span", { className: "sr-only", children }) : null;
|
|
1342
|
+
if (disabled) {
|
|
1343
|
+
return /* @__PURE__ */ jsxs9(
|
|
1344
|
+
"span",
|
|
1345
|
+
{
|
|
1346
|
+
ref,
|
|
1347
|
+
className: classes,
|
|
1348
|
+
"aria-disabled": "true",
|
|
1349
|
+
...props,
|
|
1350
|
+
children: [
|
|
1351
|
+
iconElement,
|
|
1352
|
+
labelContent
|
|
1353
|
+
]
|
|
1354
|
+
}
|
|
1355
|
+
);
|
|
1356
|
+
}
|
|
1357
|
+
if (active || !href) {
|
|
1358
|
+
return /* @__PURE__ */ jsxs9(
|
|
1359
|
+
"span",
|
|
1360
|
+
{
|
|
1361
|
+
ref,
|
|
1362
|
+
className: classes,
|
|
1363
|
+
"aria-current": active ? "page" : void 0,
|
|
1364
|
+
...props,
|
|
1365
|
+
children: [
|
|
1366
|
+
iconElement,
|
|
1367
|
+
labelContent
|
|
1368
|
+
]
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
return /* @__PURE__ */ jsxs9(
|
|
1373
|
+
"a",
|
|
1374
|
+
{
|
|
1375
|
+
ref,
|
|
1376
|
+
href,
|
|
1377
|
+
className: classes,
|
|
1378
|
+
...props,
|
|
1379
|
+
children: [
|
|
1380
|
+
iconElement,
|
|
1381
|
+
labelContent
|
|
1382
|
+
]
|
|
1383
|
+
}
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
);
|
|
1387
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
1388
|
+
|
|
1389
|
+
// src/components/button-group-item.tsx
|
|
1390
|
+
import * as React13 from "react";
|
|
1391
|
+
import { cva as cva12 } from "class-variance-authority";
|
|
1392
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1393
|
+
var buttonGroupItemVariants = cva12(
|
|
1394
|
+
"inline-flex items-center justify-center shrink-0 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:pointer-events-none",
|
|
1395
|
+
{
|
|
1396
|
+
variants: {
|
|
1397
|
+
size: {
|
|
1398
|
+
small: "h-9 px-md gap-0.5 text-sm",
|
|
1399
|
+
medium: "h-10 px-lg gap-1 text-sm"
|
|
1400
|
+
},
|
|
1401
|
+
type: {
|
|
1402
|
+
textAndIcon: "",
|
|
1403
|
+
textOnly: "",
|
|
1404
|
+
iconOnly: ""
|
|
1405
|
+
},
|
|
1406
|
+
selected: {
|
|
1407
|
+
true: "bg-brand-tertiary text-brand",
|
|
1408
|
+
false: "bg-transparent text-primary hover:bg-tertiary disabled:text-inactive disabled:bg-inactive"
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
compoundVariants: [
|
|
1412
|
+
{
|
|
1413
|
+
type: "iconOnly",
|
|
1414
|
+
size: "small",
|
|
1415
|
+
className: "w-9 px-0"
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
type: "iconOnly",
|
|
1419
|
+
size: "medium",
|
|
1420
|
+
className: "w-10 px-0"
|
|
1421
|
+
}
|
|
1422
|
+
],
|
|
1423
|
+
defaultVariants: {
|
|
1424
|
+
size: "medium",
|
|
1425
|
+
type: "textAndIcon",
|
|
1426
|
+
selected: false
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
);
|
|
1430
|
+
var sizeToIconSize = {
|
|
1431
|
+
small: "sm",
|
|
1432
|
+
medium: "md"
|
|
1433
|
+
};
|
|
1434
|
+
var ButtonGroupItem = React13.forwardRef(
|
|
1435
|
+
({
|
|
1436
|
+
className,
|
|
1437
|
+
size = "medium",
|
|
1438
|
+
type = "textAndIcon",
|
|
1439
|
+
selected = false,
|
|
1440
|
+
position,
|
|
1441
|
+
leftIcon,
|
|
1442
|
+
rightIcon,
|
|
1443
|
+
icon,
|
|
1444
|
+
children,
|
|
1445
|
+
disabled,
|
|
1446
|
+
"aria-current": ariaCurrent,
|
|
1447
|
+
...props
|
|
1448
|
+
}, ref) => {
|
|
1449
|
+
const iconSize = sizeToIconSize[size ?? "medium"];
|
|
1450
|
+
const positionClass = position === "first" ? "rounded-l-sm rounded-r-none" : position === "middle" ? "rounded-none border-l border-strong" : position === "last" ? "rounded-r-sm rounded-l-none border-l border-strong" : "rounded-sm";
|
|
1451
|
+
const iconColorClass = selected ? "text-icon-brand" : disabled ? "text-icon-inactive" : "text-icon-primary";
|
|
1452
|
+
return /* @__PURE__ */ jsxs10(
|
|
1453
|
+
"button",
|
|
1454
|
+
{
|
|
1455
|
+
ref,
|
|
1456
|
+
type: "button",
|
|
1457
|
+
className: cn(
|
|
1458
|
+
buttonGroupItemVariants({ size, type, selected }),
|
|
1459
|
+
positionClass,
|
|
1460
|
+
className
|
|
1461
|
+
),
|
|
1462
|
+
disabled,
|
|
1463
|
+
"aria-current": selected ? "true" : ariaCurrent,
|
|
1464
|
+
"aria-disabled": disabled,
|
|
1465
|
+
...props,
|
|
1466
|
+
children: [
|
|
1467
|
+
type === "textAndIcon" && leftIcon && /* @__PURE__ */ jsx14(Icon, { name: leftIcon, size: iconSize, className: iconColorClass, "aria-hidden": true }),
|
|
1468
|
+
type === "iconOnly" && icon && /* @__PURE__ */ jsx14(Icon, { name: icon, size: iconSize, className: iconColorClass, "aria-hidden": true }),
|
|
1469
|
+
type !== "iconOnly" && /* @__PURE__ */ jsxs10("span", { className: "inline-grid [&>*]:col-start-1 [&>*]:row-start-1", children: [
|
|
1470
|
+
/* @__PURE__ */ jsx14("span", { className: "invisible font-medium", "aria-hidden": true, children }),
|
|
1471
|
+
/* @__PURE__ */ jsx14("span", { className: selected ? "font-medium" : "font-normal", children })
|
|
1472
|
+
] }),
|
|
1473
|
+
type === "textAndIcon" && rightIcon && /* @__PURE__ */ jsx14(Icon, { name: rightIcon, size: iconSize, className: iconColorClass, "aria-hidden": true })
|
|
1474
|
+
]
|
|
1475
|
+
}
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1478
|
+
);
|
|
1479
|
+
ButtonGroupItem.displayName = "ButtonGroupItem";
|
|
1480
|
+
|
|
1481
|
+
// src/components/button-group.tsx
|
|
1482
|
+
import * as React14 from "react";
|
|
1483
|
+
import { cva as cva13 } from "class-variance-authority";
|
|
1484
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1485
|
+
var buttonGroupVariants = cva13(
|
|
1486
|
+
"inline-flex flex-row items-stretch rounded-sm border border-strong bg-primary overflow-hidden"
|
|
1487
|
+
);
|
|
1488
|
+
function getPosition(index, total) {
|
|
1489
|
+
if (total <= 1) return "only";
|
|
1490
|
+
if (index === 0) return "first";
|
|
1491
|
+
if (index === total - 1) return "last";
|
|
1492
|
+
return "middle";
|
|
1493
|
+
}
|
|
1494
|
+
var ButtonGroup = React14.forwardRef(
|
|
1495
|
+
({ className, size = "medium", children, ...props }, ref) => {
|
|
1496
|
+
const items = React14.Children.toArray(children).filter(Boolean);
|
|
1497
|
+
const total = items.length;
|
|
1498
|
+
return /* @__PURE__ */ jsx15(
|
|
1499
|
+
"div",
|
|
1500
|
+
{
|
|
1501
|
+
ref,
|
|
1502
|
+
role: "group",
|
|
1503
|
+
className: cn(buttonGroupVariants(), className),
|
|
1504
|
+
...props,
|
|
1505
|
+
children: items.map((child, index) => {
|
|
1506
|
+
const position = getPosition(index, total);
|
|
1507
|
+
const childProps = React14.isValidElement(child) ? child.props : {};
|
|
1508
|
+
const injectedProps = {
|
|
1509
|
+
position,
|
|
1510
|
+
...childProps.size === void 0 ? { size } : {}
|
|
1511
|
+
};
|
|
1512
|
+
return React14.isValidElement(child) && typeof child.type !== "string" ? React14.cloneElement(
|
|
1513
|
+
child,
|
|
1514
|
+
injectedProps
|
|
1515
|
+
) : child;
|
|
1516
|
+
})
|
|
1517
|
+
}
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
);
|
|
1521
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
1522
|
+
|
|
1523
|
+
// src/components/featured-icon.tsx
|
|
1524
|
+
import * as React15 from "react";
|
|
1525
|
+
import { cva as cva14 } from "class-variance-authority";
|
|
1526
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1527
|
+
var featuredIconVariants = cva14(
|
|
1528
|
+
"inline-flex shrink-0 items-center justify-center",
|
|
1529
|
+
{
|
|
1530
|
+
variants: {
|
|
1531
|
+
variant: {
|
|
1532
|
+
"circle-light": "rounded-full",
|
|
1533
|
+
"square-light": "rounded-lg",
|
|
1534
|
+
"circle-pulse": "rounded-full",
|
|
1535
|
+
"solid-circle": "rounded-full",
|
|
1536
|
+
"solid-square": "rounded-lg"
|
|
1537
|
+
},
|
|
1538
|
+
type: {
|
|
1539
|
+
brand: "",
|
|
1540
|
+
success: "",
|
|
1541
|
+
danger: "",
|
|
1542
|
+
warning: "",
|
|
1543
|
+
neutral: ""
|
|
1544
|
+
},
|
|
1545
|
+
size: {
|
|
1546
|
+
sm: "p-sm",
|
|
1547
|
+
md: "p-md",
|
|
1548
|
+
lg: "p-lg"
|
|
1549
|
+
}
|
|
1550
|
+
},
|
|
1551
|
+
compoundVariants: [
|
|
1552
|
+
// Circle light + type (light bg, colored icon)
|
|
1553
|
+
{ variant: "circle-light", type: "brand", className: "bg-brand-tertiary text-brand" },
|
|
1554
|
+
{ variant: "circle-light", type: "success", className: "bg-success-tertiary text-success" },
|
|
1555
|
+
{ variant: "circle-light", type: "danger", className: "bg-danger-tertiary text-danger" },
|
|
1556
|
+
{ variant: "circle-light", type: "warning", className: "bg-warning-tertiary text-warning" },
|
|
1557
|
+
{ variant: "circle-light", type: "neutral", className: "bg-tertiary text-secondary" },
|
|
1558
|
+
// Square light + type
|
|
1559
|
+
{ variant: "square-light", type: "brand", className: "bg-brand-tertiary text-brand" },
|
|
1560
|
+
{ variant: "square-light", type: "success", className: "bg-success-tertiary text-success" },
|
|
1561
|
+
{ variant: "square-light", type: "danger", className: "bg-danger-tertiary text-danger" },
|
|
1562
|
+
{ variant: "square-light", type: "warning", className: "bg-warning-tertiary text-warning" },
|
|
1563
|
+
{ variant: "square-light", type: "neutral", className: "bg-tertiary text-secondary" },
|
|
1564
|
+
// Circle pulse + type (solid bg, on-color icon, glow, 8px border)
|
|
1565
|
+
{ variant: "circle-pulse", type: "brand", className: "border-8 border-brand-tertiary bg-brand-secondary text-brand" },
|
|
1566
|
+
{ variant: "circle-pulse", type: "success", className: "border-8 border-success-tertiary bg-success-secondary text-success" },
|
|
1567
|
+
{ variant: "circle-pulse", type: "danger", className: "border-8 border-danger-tertiary bg-danger-secondary text-danger" },
|
|
1568
|
+
{ variant: "circle-pulse", type: "warning", className: "border-8 border-warning-tertiary bg-warning-secondary text-warning" },
|
|
1569
|
+
{ variant: "circle-pulse", type: "neutral", className: "border-8 border-secondary bg-quarterary text-secondary" },
|
|
1570
|
+
// Solid circle + type
|
|
1571
|
+
{ variant: "solid-circle", type: "brand", className: "bg-brand text-on-color" },
|
|
1572
|
+
{ variant: "solid-circle", type: "success", className: "bg-success text-on-color" },
|
|
1573
|
+
{ variant: "solid-circle", type: "danger", className: "bg-danger text-on-color" },
|
|
1574
|
+
{ variant: "solid-circle", type: "warning", className: "bg-warning text-on-color" },
|
|
1575
|
+
{ variant: "solid-circle", type: "neutral", className: "bg-primary-inverse text-on-color" },
|
|
1576
|
+
// Solid square + type
|
|
1577
|
+
{ variant: "solid-square", type: "brand", className: "bg-brand text-on-color" },
|
|
1578
|
+
{ variant: "solid-square", type: "success", className: "bg-success text-on-color" },
|
|
1579
|
+
{ variant: "solid-square", type: "danger", className: "bg-danger text-on-color" },
|
|
1580
|
+
{ variant: "solid-square", type: "warning", className: "bg-warning text-on-color" },
|
|
1581
|
+
{ variant: "solid-square", type: "neutral", className: "bg-primary-inverse text-on-color" }
|
|
1582
|
+
],
|
|
1583
|
+
defaultVariants: {
|
|
1584
|
+
variant: "solid-circle",
|
|
1585
|
+
type: "brand",
|
|
1586
|
+
size: "md"
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
);
|
|
1590
|
+
var featuredSizeToIconSize = {
|
|
1591
|
+
sm: "md",
|
|
1592
|
+
md: "lg",
|
|
1593
|
+
lg: "xl"
|
|
1594
|
+
};
|
|
1595
|
+
var FeaturedIcon = React15.forwardRef(
|
|
1596
|
+
({
|
|
1597
|
+
className,
|
|
1598
|
+
variant,
|
|
1599
|
+
type,
|
|
1600
|
+
size = "md",
|
|
1601
|
+
name,
|
|
1602
|
+
label,
|
|
1603
|
+
...props
|
|
1604
|
+
}, ref) => {
|
|
1605
|
+
return /* @__PURE__ */ jsx16(
|
|
1606
|
+
"span",
|
|
1607
|
+
{
|
|
1608
|
+
ref,
|
|
1609
|
+
className: cn(
|
|
1610
|
+
featuredIconVariants({ variant, type, size }),
|
|
1611
|
+
className
|
|
1612
|
+
),
|
|
1613
|
+
role: label ? "img" : void 0,
|
|
1614
|
+
"aria-label": label,
|
|
1615
|
+
"aria-hidden": !label,
|
|
1616
|
+
...props,
|
|
1617
|
+
children: /* @__PURE__ */ jsx16(Icon, { name, size: featuredSizeToIconSize[size ?? "md"], filled: true })
|
|
1618
|
+
}
|
|
1619
|
+
);
|
|
1620
|
+
}
|
|
1621
|
+
);
|
|
1622
|
+
FeaturedIcon.displayName = "FeaturedIcon";
|
|
1623
|
+
|
|
1624
|
+
// src/components/progress-bar.tsx
|
|
1625
|
+
import * as React16 from "react";
|
|
1626
|
+
import { cva as cva15 } from "class-variance-authority";
|
|
1627
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1628
|
+
var progressBarTrackVariants = cva15(
|
|
1629
|
+
"w-full overflow-hidden rounded-sm bg-tertiary",
|
|
1630
|
+
{
|
|
1631
|
+
variants: {
|
|
1632
|
+
size: {
|
|
1633
|
+
sm: "h-1",
|
|
1634
|
+
lg: "h-2"
|
|
1635
|
+
}
|
|
1636
|
+
},
|
|
1637
|
+
defaultVariants: {
|
|
1638
|
+
size: "sm"
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
);
|
|
1642
|
+
var progressBarFillVariants = cva15("h-full rounded-sm shrink-0", {
|
|
1643
|
+
variants: {
|
|
1644
|
+
color: {
|
|
1645
|
+
brand: "bg-brand",
|
|
1646
|
+
success: "bg-success",
|
|
1647
|
+
danger: "bg-danger",
|
|
1648
|
+
info: "bg-info",
|
|
1649
|
+
neutral: "bg-quarterary"
|
|
1650
|
+
}
|
|
1651
|
+
},
|
|
1652
|
+
defaultVariants: {
|
|
1653
|
+
color: "brand"
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
var ProgressBar = React16.forwardRef(
|
|
1657
|
+
({
|
|
1658
|
+
className,
|
|
1659
|
+
size = "sm",
|
|
1660
|
+
color = "brand",
|
|
1661
|
+
value,
|
|
1662
|
+
label,
|
|
1663
|
+
showLabelInfoIcon = false,
|
|
1664
|
+
helperText,
|
|
1665
|
+
showValue = false,
|
|
1666
|
+
onRefresh,
|
|
1667
|
+
"aria-label": ariaLabel,
|
|
1668
|
+
...props
|
|
1669
|
+
}, ref) => {
|
|
1670
|
+
const isIndeterminate = value === void 0;
|
|
1671
|
+
const clampedValue = isIndeterminate ? void 0 : Math.min(100, Math.max(0, value));
|
|
1672
|
+
const valueText = clampedValue !== void 0 ? `${Math.round(clampedValue)}%` : void 0;
|
|
1673
|
+
const barId = React16.useId();
|
|
1674
|
+
const labelId = `${barId}-label`;
|
|
1675
|
+
const helperId = `${barId}-helper`;
|
|
1676
|
+
return /* @__PURE__ */ jsxs11(
|
|
1677
|
+
"div",
|
|
1678
|
+
{
|
|
1679
|
+
ref,
|
|
1680
|
+
role: "group",
|
|
1681
|
+
className: cn("flex min-w-0 flex-col", className),
|
|
1682
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
1683
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
1684
|
+
...props,
|
|
1685
|
+
children: [
|
|
1686
|
+
label && /* @__PURE__ */ jsxs11(
|
|
1687
|
+
"div",
|
|
1688
|
+
{
|
|
1689
|
+
id: labelId,
|
|
1690
|
+
className: "flex items-center gap-xs text-sm font-medium text-primary mb-sm",
|
|
1691
|
+
children: [
|
|
1692
|
+
label,
|
|
1693
|
+
showLabelInfoIcon && /* @__PURE__ */ jsx17(
|
|
1694
|
+
Icon,
|
|
1695
|
+
{
|
|
1696
|
+
name: "info",
|
|
1697
|
+
size: "xs",
|
|
1698
|
+
className: "text-icon-tertiary",
|
|
1699
|
+
"aria-hidden": true
|
|
1700
|
+
}
|
|
1701
|
+
)
|
|
1702
|
+
]
|
|
1703
|
+
}
|
|
1704
|
+
),
|
|
1705
|
+
/* @__PURE__ */ jsxs11(
|
|
1706
|
+
"div",
|
|
1707
|
+
{
|
|
1708
|
+
id: barId,
|
|
1709
|
+
role: "progressbar",
|
|
1710
|
+
"aria-valuenow": isIndeterminate ? void 0 : clampedValue,
|
|
1711
|
+
"aria-valuemin": isIndeterminate ? void 0 : 0,
|
|
1712
|
+
"aria-valuemax": isIndeterminate ? void 0 : 100,
|
|
1713
|
+
"aria-valuetext": isIndeterminate ? "Loading" : valueText,
|
|
1714
|
+
"aria-label": ariaLabel,
|
|
1715
|
+
className: "flex min-w-0 items-center gap-md",
|
|
1716
|
+
children: [
|
|
1717
|
+
/* @__PURE__ */ jsx17(
|
|
1718
|
+
"div",
|
|
1719
|
+
{
|
|
1720
|
+
className: cn(
|
|
1721
|
+
"min-w-0 flex-1",
|
|
1722
|
+
progressBarTrackVariants({ size })
|
|
1723
|
+
),
|
|
1724
|
+
children: /* @__PURE__ */ jsx17(
|
|
1725
|
+
"div",
|
|
1726
|
+
{
|
|
1727
|
+
className: cn(
|
|
1728
|
+
progressBarFillVariants({ color }),
|
|
1729
|
+
isIndeterminate ? "w-[40%] min-w-[40%] animate-pulse" : "min-w-0"
|
|
1730
|
+
),
|
|
1731
|
+
style: !isIndeterminate && clampedValue !== void 0 ? { width: `${clampedValue}%` } : void 0
|
|
1732
|
+
}
|
|
1733
|
+
)
|
|
1734
|
+
}
|
|
1735
|
+
),
|
|
1736
|
+
showValue && !isIndeterminate && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 text-sm text-secondary shrink-0", children: [
|
|
1737
|
+
/* @__PURE__ */ jsx17("span", { "aria-hidden": true, children: valueText }),
|
|
1738
|
+
onRefresh && /* @__PURE__ */ jsx17(
|
|
1739
|
+
"button",
|
|
1740
|
+
{
|
|
1741
|
+
type: "button",
|
|
1742
|
+
onClick: onRefresh,
|
|
1743
|
+
className: "rounded-sm p-xxs text-icon-secondary hover:text-icon-primary hover:bg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1",
|
|
1744
|
+
"aria-label": "Refresh",
|
|
1745
|
+
children: /* @__PURE__ */ jsx17(Icon, { name: "refresh", size: "xs", "aria-hidden": true })
|
|
1746
|
+
}
|
|
1747
|
+
)
|
|
1748
|
+
] })
|
|
1749
|
+
]
|
|
1750
|
+
}
|
|
1751
|
+
),
|
|
1752
|
+
helperText && /* @__PURE__ */ jsx17(
|
|
1753
|
+
"p",
|
|
1754
|
+
{
|
|
1755
|
+
id: helperId,
|
|
1756
|
+
className: "mt-sm text-sm text-secondary",
|
|
1757
|
+
role: "status",
|
|
1758
|
+
children: helperText
|
|
1759
|
+
}
|
|
1760
|
+
)
|
|
1761
|
+
]
|
|
1762
|
+
}
|
|
1763
|
+
);
|
|
1764
|
+
}
|
|
1765
|
+
);
|
|
1766
|
+
ProgressBar.displayName = "ProgressBar";
|
|
1767
|
+
|
|
1768
|
+
// src/components/menu-item.tsx
|
|
1769
|
+
import * as React18 from "react";
|
|
1770
|
+
import { cva as cva17 } from "class-variance-authority";
|
|
1771
|
+
|
|
1772
|
+
// src/components/toggle.tsx
|
|
1773
|
+
import * as React17 from "react";
|
|
1774
|
+
import { cva as cva16 } from "class-variance-authority";
|
|
1775
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1776
|
+
var toggleVariants = cva16(
|
|
1777
|
+
"relative inline-flex shrink-0 rounded-full p-0.5 transition-colors",
|
|
1778
|
+
{
|
|
1779
|
+
variants: {
|
|
1780
|
+
size: {
|
|
1781
|
+
sm: "h-5 w-8",
|
|
1782
|
+
md: "h-6 w-10"
|
|
1783
|
+
},
|
|
1784
|
+
active: {
|
|
1785
|
+
true: "bg-component-toggle-brand-bg hover:bg-component-toggle-brand-bg-hover",
|
|
1786
|
+
false: "bg-quarterary hover:bg-quarterary/80"
|
|
1787
|
+
},
|
|
1788
|
+
disabled: {
|
|
1789
|
+
true: "bg-inactive-subtle hover:bg-inactive-subtle",
|
|
1790
|
+
false: ""
|
|
1791
|
+
}
|
|
1792
|
+
},
|
|
1793
|
+
defaultVariants: {
|
|
1794
|
+
size: "md",
|
|
1795
|
+
active: false,
|
|
1796
|
+
disabled: false
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1800
|
+
var thumbVariants = cva16(
|
|
1801
|
+
"pointer-events-none absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded-full bg-primary shadow-md transition-transform",
|
|
1802
|
+
{
|
|
1803
|
+
variants: {
|
|
1804
|
+
size: {
|
|
1805
|
+
sm: "left-0.5 size-3.5 data-[state=on]:translate-x-3",
|
|
1806
|
+
md: "left-0.5 size-5 data-[state=on]:translate-x-4"
|
|
1807
|
+
},
|
|
1808
|
+
disabled: {
|
|
1809
|
+
true: "bg-quarterary shadow-none",
|
|
1810
|
+
false: ""
|
|
1811
|
+
}
|
|
1812
|
+
},
|
|
1813
|
+
defaultVariants: {
|
|
1814
|
+
size: "md",
|
|
1815
|
+
disabled: false
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
);
|
|
1819
|
+
var Toggle = React17.forwardRef(
|
|
1820
|
+
({
|
|
1821
|
+
className,
|
|
1822
|
+
label,
|
|
1823
|
+
supportText,
|
|
1824
|
+
togglePosition = "trailing",
|
|
1825
|
+
size = "md",
|
|
1826
|
+
withIcon = false,
|
|
1827
|
+
checked,
|
|
1828
|
+
defaultChecked,
|
|
1829
|
+
disabled,
|
|
1830
|
+
onChange,
|
|
1831
|
+
id,
|
|
1832
|
+
...props
|
|
1833
|
+
}, ref) => {
|
|
1834
|
+
const [internalChecked, setInternalChecked] = React17.useState(
|
|
1835
|
+
defaultChecked ?? false
|
|
1836
|
+
);
|
|
1837
|
+
const inputId = id || React17.useId();
|
|
1838
|
+
const isControlled = checked !== void 0;
|
|
1839
|
+
const isChecked = isControlled ? !!checked : internalChecked;
|
|
1840
|
+
const isDisabled = !!disabled;
|
|
1841
|
+
const handleChange = React17.useCallback(
|
|
1842
|
+
(e) => {
|
|
1843
|
+
if (!isControlled) setInternalChecked(e.target.checked);
|
|
1844
|
+
onChange?.(e);
|
|
1845
|
+
},
|
|
1846
|
+
[isControlled, onChange]
|
|
1847
|
+
);
|
|
1848
|
+
const iconName = isChecked ? "check" : "close";
|
|
1849
|
+
const iconColor = isDisabled ? "text-icon-inactive-subtle" : isChecked ? "text-icon-primary-inverse" : "text-icon-secondary";
|
|
1850
|
+
const switchElement = /* @__PURE__ */ jsx18(
|
|
1851
|
+
"span",
|
|
1852
|
+
{
|
|
1853
|
+
className: cn(
|
|
1854
|
+
toggleVariants({ size, active: isChecked, disabled: isDisabled }),
|
|
1855
|
+
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-2"
|
|
1856
|
+
),
|
|
1857
|
+
"aria-hidden": true,
|
|
1858
|
+
children: /* @__PURE__ */ jsx18(
|
|
1859
|
+
"span",
|
|
1860
|
+
{
|
|
1861
|
+
className: thumbVariants({ size, disabled: isDisabled }),
|
|
1862
|
+
"data-state": isChecked ? "on" : "off",
|
|
1863
|
+
children: withIcon && /* @__PURE__ */ jsx18(
|
|
1864
|
+
Icon,
|
|
1865
|
+
{
|
|
1866
|
+
name: iconName,
|
|
1867
|
+
size: "xs",
|
|
1868
|
+
className: cn("pointer-events-none", iconColor),
|
|
1869
|
+
"aria-hidden": true
|
|
1870
|
+
}
|
|
1871
|
+
)
|
|
1872
|
+
}
|
|
1873
|
+
)
|
|
1874
|
+
}
|
|
1875
|
+
);
|
|
1876
|
+
const labelContent = label || supportText ? /* @__PURE__ */ jsxs12("span", { className: cn("flex min-w-0 flex-col", supportText && "gap-xxs"), children: [
|
|
1877
|
+
label && /* @__PURE__ */ jsx18(
|
|
1878
|
+
"span",
|
|
1879
|
+
{
|
|
1880
|
+
className: cn(
|
|
1881
|
+
"text-sm font-medium leading-4",
|
|
1882
|
+
isDisabled ? "text-inactive" : "text-primary"
|
|
1883
|
+
),
|
|
1884
|
+
children: label
|
|
1885
|
+
}
|
|
1886
|
+
),
|
|
1887
|
+
supportText && /* @__PURE__ */ jsx18(
|
|
1888
|
+
"span",
|
|
1889
|
+
{
|
|
1890
|
+
className: cn(
|
|
1891
|
+
"text-sm leading-5",
|
|
1892
|
+
isDisabled ? "text-inactive" : "text-secondary"
|
|
1893
|
+
),
|
|
1894
|
+
children: supportText
|
|
1895
|
+
}
|
|
1896
|
+
)
|
|
1897
|
+
] }) : null;
|
|
1898
|
+
return /* @__PURE__ */ jsxs12(
|
|
1899
|
+
"label",
|
|
1900
|
+
{
|
|
1901
|
+
className: cn(
|
|
1902
|
+
"group/toggle inline-flex gap-md",
|
|
1903
|
+
supportText ? "items-start" : "items-center",
|
|
1904
|
+
isDisabled ? "cursor-default" : "cursor-pointer",
|
|
1905
|
+
className
|
|
1906
|
+
),
|
|
1907
|
+
children: [
|
|
1908
|
+
/* @__PURE__ */ jsx18(
|
|
1909
|
+
"input",
|
|
1910
|
+
{
|
|
1911
|
+
ref,
|
|
1912
|
+
id: inputId,
|
|
1913
|
+
type: "checkbox",
|
|
1914
|
+
role: "switch",
|
|
1915
|
+
className: "peer sr-only",
|
|
1916
|
+
checked,
|
|
1917
|
+
defaultChecked,
|
|
1918
|
+
disabled,
|
|
1919
|
+
"aria-checked": isChecked,
|
|
1920
|
+
onChange: handleChange,
|
|
1921
|
+
...props
|
|
1922
|
+
}
|
|
1923
|
+
),
|
|
1924
|
+
togglePosition === "leading" ? /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
1925
|
+
switchElement,
|
|
1926
|
+
labelContent
|
|
1927
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
1928
|
+
labelContent,
|
|
1929
|
+
switchElement
|
|
1930
|
+
] })
|
|
1931
|
+
]
|
|
1932
|
+
}
|
|
1933
|
+
);
|
|
1934
|
+
}
|
|
1935
|
+
);
|
|
1936
|
+
Toggle.displayName = "Toggle";
|
|
1937
|
+
|
|
1938
|
+
// src/components/menu-item.tsx
|
|
1939
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1940
|
+
var menuItemVariants = cva17(
|
|
1941
|
+
"flex items-center w-full gap-md rounded-sm px-md py-sm text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2",
|
|
1942
|
+
{
|
|
1943
|
+
variants: {
|
|
1944
|
+
disabled: {
|
|
1945
|
+
true: "cursor-default opacity-50 pointer-events-none [&_*]:pointer-events-none",
|
|
1946
|
+
false: "cursor-pointer hover:bg-tertiary"
|
|
1947
|
+
},
|
|
1948
|
+
active: {
|
|
1949
|
+
true: "bg-brand-tertiary text-brand font-medium",
|
|
1950
|
+
false: ""
|
|
1951
|
+
}
|
|
1952
|
+
},
|
|
1953
|
+
defaultVariants: {
|
|
1954
|
+
disabled: false,
|
|
1955
|
+
active: false
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
);
|
|
1959
|
+
var stopPropagation = (e) => e.stopPropagation();
|
|
1960
|
+
var MenuItem = React18.forwardRef(
|
|
1961
|
+
({
|
|
1962
|
+
className,
|
|
1963
|
+
type: typeVariant = "default",
|
|
1964
|
+
disabled = false,
|
|
1965
|
+
active = false,
|
|
1966
|
+
children,
|
|
1967
|
+
supportingText,
|
|
1968
|
+
leftIcon,
|
|
1969
|
+
rightIcon,
|
|
1970
|
+
avatar,
|
|
1971
|
+
badge,
|
|
1972
|
+
showSwitch = false,
|
|
1973
|
+
switchChecked,
|
|
1974
|
+
onSwitchChange,
|
|
1975
|
+
textRight,
|
|
1976
|
+
cta,
|
|
1977
|
+
progressLabel,
|
|
1978
|
+
progressValue,
|
|
1979
|
+
...props
|
|
1980
|
+
}, ref) => {
|
|
1981
|
+
const isMultiline = typeVariant === "multiline" || typeVariant === "callToAction";
|
|
1982
|
+
const isProgress = typeVariant === "progress";
|
|
1983
|
+
const leftSection = leftIcon || avatar ? /* @__PURE__ */ jsxs13("span", { className: "flex shrink-0 items-center gap-md", children: [
|
|
1984
|
+
leftIcon && /* @__PURE__ */ jsx19(
|
|
1985
|
+
Icon,
|
|
1986
|
+
{
|
|
1987
|
+
name: leftIcon,
|
|
1988
|
+
size: "sm",
|
|
1989
|
+
className: disabled ? "text-icon-inactive-subtle" : "text-icon-secondary",
|
|
1990
|
+
"aria-hidden": true
|
|
1991
|
+
}
|
|
1992
|
+
),
|
|
1993
|
+
avatar
|
|
1994
|
+
] }) : null;
|
|
1995
|
+
const centerSection = isProgress ? /* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx19(
|
|
1996
|
+
ProgressBar,
|
|
1997
|
+
{
|
|
1998
|
+
label: progressLabel,
|
|
1999
|
+
value: progressValue,
|
|
2000
|
+
showValue: true,
|
|
2001
|
+
size: "sm",
|
|
2002
|
+
className: "mb-0"
|
|
2003
|
+
}
|
|
2004
|
+
) }) : /* @__PURE__ */ jsxs13(
|
|
2005
|
+
"span",
|
|
2006
|
+
{
|
|
2007
|
+
className: cn(
|
|
2008
|
+
"min-w-0 flex-1",
|
|
2009
|
+
isMultiline && "flex flex-col gap-xxs"
|
|
2010
|
+
),
|
|
2011
|
+
children: [
|
|
2012
|
+
children != null && /* @__PURE__ */ jsx19(
|
|
2013
|
+
"span",
|
|
2014
|
+
{
|
|
2015
|
+
className: cn(
|
|
2016
|
+
"text-sm font-medium leading-5",
|
|
2017
|
+
disabled ? "text-inactive" : "text-primary"
|
|
2018
|
+
),
|
|
2019
|
+
children
|
|
2020
|
+
}
|
|
2021
|
+
),
|
|
2022
|
+
isMultiline && supportingText != null && /* @__PURE__ */ jsx19(
|
|
2023
|
+
"span",
|
|
2024
|
+
{
|
|
2025
|
+
className: cn(
|
|
2026
|
+
"text-sm leading-5",
|
|
2027
|
+
disabled ? "text-inactive" : "text-secondary"
|
|
2028
|
+
),
|
|
2029
|
+
children: supportingText
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
]
|
|
2033
|
+
}
|
|
2034
|
+
);
|
|
2035
|
+
const rightSection = isProgress ? null : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
2036
|
+
badge,
|
|
2037
|
+
showSwitch && /* @__PURE__ */ jsx19(
|
|
2038
|
+
"span",
|
|
2039
|
+
{
|
|
2040
|
+
role: "presentation",
|
|
2041
|
+
onPointerDown: stopPropagation,
|
|
2042
|
+
onClick: stopPropagation,
|
|
2043
|
+
children: /* @__PURE__ */ jsx19(
|
|
2044
|
+
Toggle,
|
|
2045
|
+
{
|
|
2046
|
+
size: "sm",
|
|
2047
|
+
togglePosition: "trailing",
|
|
2048
|
+
checked: switchChecked,
|
|
2049
|
+
onChange: onSwitchChange,
|
|
2050
|
+
disabled,
|
|
2051
|
+
"aria-label": typeof children === "string" ? `Toggle ${children}` : "Toggle"
|
|
2052
|
+
}
|
|
2053
|
+
)
|
|
2054
|
+
}
|
|
2055
|
+
),
|
|
2056
|
+
textRight != null && /* @__PURE__ */ jsx19(
|
|
2057
|
+
"span",
|
|
2058
|
+
{
|
|
2059
|
+
className: cn(
|
|
2060
|
+
"text-sm",
|
|
2061
|
+
disabled ? "text-inactive" : "text-secondary"
|
|
2062
|
+
),
|
|
2063
|
+
children: textRight
|
|
2064
|
+
}
|
|
2065
|
+
),
|
|
2066
|
+
rightIcon && /* @__PURE__ */ jsx19(
|
|
2067
|
+
Icon,
|
|
2068
|
+
{
|
|
2069
|
+
name: rightIcon,
|
|
2070
|
+
size: "sm",
|
|
2071
|
+
className: disabled ? "text-icon-inactive-subtle" : "text-icon-secondary",
|
|
2072
|
+
"aria-hidden": true
|
|
2073
|
+
}
|
|
2074
|
+
),
|
|
2075
|
+
typeVariant === "callToAction" && cta
|
|
2076
|
+
] });
|
|
2077
|
+
const hasRightContent = rightSection !== null && (!!badge || showSwitch || !!textRight || !!rightIcon || typeVariant === "callToAction" && !!cta);
|
|
2078
|
+
return /* @__PURE__ */ jsxs13(
|
|
2079
|
+
"button",
|
|
2080
|
+
{
|
|
2081
|
+
ref,
|
|
2082
|
+
type: "button",
|
|
2083
|
+
disabled,
|
|
2084
|
+
className: cn(menuItemVariants({ disabled, active }), className),
|
|
2085
|
+
"aria-disabled": disabled,
|
|
2086
|
+
"aria-current": active ? "page" : void 0,
|
|
2087
|
+
...props,
|
|
2088
|
+
children: [
|
|
2089
|
+
leftSection,
|
|
2090
|
+
centerSection,
|
|
2091
|
+
hasRightContent && /* @__PURE__ */ jsx19("span", { className: "flex shrink-0 items-center gap-md", children: rightSection })
|
|
2092
|
+
]
|
|
2093
|
+
}
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
2096
|
+
);
|
|
2097
|
+
MenuItem.displayName = "MenuItem";
|
|
2098
|
+
|
|
2099
|
+
// src/components/menu-heading.tsx
|
|
2100
|
+
import * as React19 from "react";
|
|
2101
|
+
import { cva as cva18 } from "class-variance-authority";
|
|
2102
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2103
|
+
var menuHeadingVariants = cva18(
|
|
2104
|
+
"px-md py-xs text-sm font-medium text-tertiary"
|
|
2105
|
+
);
|
|
2106
|
+
var MenuHeading = React19.forwardRef(
|
|
2107
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2108
|
+
"div",
|
|
2109
|
+
{
|
|
2110
|
+
ref,
|
|
2111
|
+
className: cn(menuHeadingVariants(), className),
|
|
2112
|
+
...props,
|
|
2113
|
+
children
|
|
2114
|
+
}
|
|
2115
|
+
)
|
|
2116
|
+
);
|
|
2117
|
+
MenuHeading.displayName = "MenuHeading";
|
|
2118
|
+
|
|
2119
|
+
// src/components/menu-group.tsx
|
|
2120
|
+
import * as React20 from "react";
|
|
2121
|
+
import { cva as cva19 } from "class-variance-authority";
|
|
2122
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2123
|
+
var menuGroupVariants = cva19("flex flex-col");
|
|
2124
|
+
var MenuGroup = React20.forwardRef(
|
|
2125
|
+
({ className, heading, children, headingId, ...props }, ref) => {
|
|
2126
|
+
const hasHeading = heading != null;
|
|
2127
|
+
return /* @__PURE__ */ jsxs14(
|
|
2128
|
+
"div",
|
|
2129
|
+
{
|
|
2130
|
+
ref,
|
|
2131
|
+
role: "group",
|
|
2132
|
+
className: cn(menuGroupVariants(), className),
|
|
2133
|
+
"aria-labelledby": hasHeading && headingId ? headingId : void 0,
|
|
2134
|
+
...props,
|
|
2135
|
+
children: [
|
|
2136
|
+
hasHeading && /* @__PURE__ */ jsx21(
|
|
2137
|
+
"div",
|
|
2138
|
+
{
|
|
2139
|
+
className: "mb-sm shrink-0",
|
|
2140
|
+
id: headingId,
|
|
2141
|
+
children: heading
|
|
2142
|
+
}
|
|
2143
|
+
),
|
|
2144
|
+
children
|
|
2145
|
+
]
|
|
2146
|
+
}
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
);
|
|
2150
|
+
MenuGroup.displayName = "MenuGroup";
|
|
2151
|
+
|
|
2152
|
+
// src/components/menu.tsx
|
|
2153
|
+
import * as React21 from "react";
|
|
2154
|
+
import { cva as cva20 } from "class-variance-authority";
|
|
2155
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2156
|
+
var menuVariants = cva20(
|
|
2157
|
+
"flex flex-col rounded-sm bg-primary py-md px-sm shadow-sm"
|
|
2158
|
+
);
|
|
2159
|
+
var Menu = React21.forwardRef(
|
|
2160
|
+
({ className, children, ...props }, ref) => {
|
|
2161
|
+
const items = React21.Children.toArray(children);
|
|
2162
|
+
return /* @__PURE__ */ jsx22(
|
|
2163
|
+
"div",
|
|
2164
|
+
{
|
|
2165
|
+
ref,
|
|
2166
|
+
className: cn(menuVariants(), className),
|
|
2167
|
+
...props,
|
|
2168
|
+
children: items.flatMap(
|
|
2169
|
+
(child, index) => index === 0 ? [child] : [
|
|
2170
|
+
/* @__PURE__ */ jsx22(Divider, { className: "my-sm" }, `menu-divider-${index}`),
|
|
2171
|
+
child
|
|
2172
|
+
]
|
|
2173
|
+
)
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
);
|
|
2178
|
+
Menu.displayName = "Menu";
|
|
2179
|
+
|
|
2180
|
+
// src/components/sidebar-menu-item.tsx
|
|
2181
|
+
import * as React23 from "react";
|
|
2182
|
+
import { cva as cva22 } from "class-variance-authority";
|
|
2183
|
+
|
|
2184
|
+
// src/components/sidebar.tsx
|
|
2185
|
+
import * as React22 from "react";
|
|
2186
|
+
import { cva as cva21 } from "class-variance-authority";
|
|
2187
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2188
|
+
var sidebarVariants = cva21(
|
|
2189
|
+
"flex h-full flex-col bg-primary shadow-sm transition-[width] duration-200 ease-out",
|
|
2190
|
+
{
|
|
2191
|
+
variants: {
|
|
2192
|
+
collapsed: {
|
|
2193
|
+
true: "w-16 min-w-16",
|
|
2194
|
+
false: "w-64 min-w-64"
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
defaultVariants: {
|
|
2198
|
+
collapsed: false
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
);
|
|
2202
|
+
var SidebarContext = React22.createContext(null);
|
|
2203
|
+
function useSidebarContext() {
|
|
2204
|
+
return React22.useContext(SidebarContext);
|
|
2205
|
+
}
|
|
2206
|
+
var Sidebar = React22.forwardRef(
|
|
2207
|
+
({
|
|
2208
|
+
className,
|
|
2209
|
+
header,
|
|
2210
|
+
children,
|
|
2211
|
+
footer,
|
|
2212
|
+
collapsible = false,
|
|
2213
|
+
collapsed: collapsedProp,
|
|
2214
|
+
onCollapsedChange,
|
|
2215
|
+
defaultCollapsed = false,
|
|
2216
|
+
...props
|
|
2217
|
+
}, ref) => {
|
|
2218
|
+
const [collapsedState, setCollapsedState] = React22.useState(defaultCollapsed);
|
|
2219
|
+
const collapsed = collapsible ? collapsedProp !== void 0 ? collapsedProp : collapsedState : false;
|
|
2220
|
+
const setCollapsed = collapsible && onCollapsedChange != null ? (value) => {
|
|
2221
|
+
setCollapsedState(value);
|
|
2222
|
+
onCollapsedChange(value);
|
|
2223
|
+
} : setCollapsedState;
|
|
2224
|
+
const contextValue = React22.useMemo(
|
|
2225
|
+
() => ({ collapsed }),
|
|
2226
|
+
[collapsed]
|
|
2227
|
+
);
|
|
2228
|
+
return /* @__PURE__ */ jsx23(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs15(
|
|
2229
|
+
"aside",
|
|
2230
|
+
{
|
|
2231
|
+
ref,
|
|
2232
|
+
"aria-label": "Sidebar",
|
|
2233
|
+
className: cn(
|
|
2234
|
+
sidebarVariants({ collapsed }),
|
|
2235
|
+
"rounded-sm",
|
|
2236
|
+
className
|
|
2237
|
+
),
|
|
2238
|
+
...props,
|
|
2239
|
+
children: [
|
|
2240
|
+
/* @__PURE__ */ jsxs15(
|
|
2241
|
+
"div",
|
|
2242
|
+
{
|
|
2243
|
+
className: cn(
|
|
2244
|
+
"flex shrink-0 items-center gap-sm px-2xl py-2xl",
|
|
2245
|
+
collapsible ? "justify-between" : ""
|
|
2246
|
+
),
|
|
2247
|
+
children: [
|
|
2248
|
+
/* @__PURE__ */ jsx23("div", { className: collapsible ? "min-w-0 flex-1" : "min-w-0", children: header }),
|
|
2249
|
+
collapsible && /* @__PURE__ */ jsx23(
|
|
2250
|
+
"button",
|
|
2251
|
+
{
|
|
2252
|
+
type: "button",
|
|
2253
|
+
onClick: () => setCollapsed(!collapsed),
|
|
2254
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-icon-secondary transition-colors hover:bg-tertiary hover:text-icon-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2",
|
|
2255
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
2256
|
+
children: /* @__PURE__ */ jsx23(
|
|
2257
|
+
Icon,
|
|
2258
|
+
{
|
|
2259
|
+
name: collapsed ? "chevron_right" : "chevron_left",
|
|
2260
|
+
size: "sm",
|
|
2261
|
+
"aria-hidden": true
|
|
2262
|
+
}
|
|
2263
|
+
)
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
]
|
|
2267
|
+
}
|
|
2268
|
+
),
|
|
2269
|
+
/* @__PURE__ */ jsx23(Divider, { orientation: "horizontal", className: "shrink-0" }),
|
|
2270
|
+
/* @__PURE__ */ jsx23("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden px-xl py-xl [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children }),
|
|
2271
|
+
footer != null && /* @__PURE__ */ jsx23("div", { className: "flex shrink-0 flex-col gap-xxs border-t border-secondary px-md py-md pt-lg", children: footer })
|
|
2272
|
+
]
|
|
2273
|
+
}
|
|
2274
|
+
) });
|
|
2275
|
+
}
|
|
2276
|
+
);
|
|
2277
|
+
Sidebar.displayName = "Sidebar";
|
|
2278
|
+
|
|
2279
|
+
// src/components/sidebar-menu-item.tsx
|
|
2280
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2281
|
+
var sidebarMenuItemVariants = cva22(
|
|
2282
|
+
"flex items-center w-full gap-md rounded-sm px-md py-sm text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2",
|
|
2283
|
+
{
|
|
2284
|
+
variants: {
|
|
2285
|
+
disabled: {
|
|
2286
|
+
true: "cursor-default opacity-50 pointer-events-none [&_*]:pointer-events-none",
|
|
2287
|
+
false: "cursor-pointer hover:bg-tertiary"
|
|
2288
|
+
},
|
|
2289
|
+
active: {
|
|
2290
|
+
true: "bg-brand-tertiary text-brand",
|
|
2291
|
+
false: ""
|
|
2292
|
+
},
|
|
2293
|
+
collapsed: {
|
|
2294
|
+
true: "justify-center px-sm",
|
|
2295
|
+
false: ""
|
|
2296
|
+
}
|
|
2297
|
+
},
|
|
2298
|
+
defaultVariants: {
|
|
2299
|
+
disabled: false,
|
|
2300
|
+
active: false,
|
|
2301
|
+
collapsed: false
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
);
|
|
2305
|
+
var SidebarMenuItem = React23.forwardRef(
|
|
2306
|
+
({
|
|
2307
|
+
className,
|
|
2308
|
+
disabled = false,
|
|
2309
|
+
active = false,
|
|
2310
|
+
collapsed = false,
|
|
2311
|
+
children,
|
|
2312
|
+
leftIcon,
|
|
2313
|
+
submenu,
|
|
2314
|
+
expanded: expandedProp,
|
|
2315
|
+
onExpandedChange,
|
|
2316
|
+
defaultExpanded = false,
|
|
2317
|
+
onClick,
|
|
2318
|
+
...props
|
|
2319
|
+
}, ref) => {
|
|
2320
|
+
const sidebarContext = useSidebarContext();
|
|
2321
|
+
const collapsedResolved = collapsed !== void 0 ? collapsed : sidebarContext?.collapsed ?? false;
|
|
2322
|
+
const [expandedState, setExpandedState] = React23.useState(defaultExpanded);
|
|
2323
|
+
const expanded = expandedProp !== void 0 ? expandedProp : expandedState;
|
|
2324
|
+
const setExpanded = onExpandedChange != null ? (value) => {
|
|
2325
|
+
setExpandedState(value);
|
|
2326
|
+
onExpandedChange(value);
|
|
2327
|
+
} : setExpandedState;
|
|
2328
|
+
const hasSubmenu = submenu != null && React23.Children.count(submenu) > 0;
|
|
2329
|
+
const submenuId = React23.useId();
|
|
2330
|
+
const regionId = `${submenuId}-submenu`;
|
|
2331
|
+
const handleClick = (e) => {
|
|
2332
|
+
if (hasSubmenu) {
|
|
2333
|
+
e.preventDefault();
|
|
2334
|
+
setExpanded(!expanded);
|
|
2335
|
+
}
|
|
2336
|
+
onClick?.(e);
|
|
2337
|
+
};
|
|
2338
|
+
const trigger = /* @__PURE__ */ jsxs16(
|
|
2339
|
+
"button",
|
|
2340
|
+
{
|
|
2341
|
+
ref,
|
|
2342
|
+
type: "button",
|
|
2343
|
+
disabled,
|
|
2344
|
+
className: cn(
|
|
2345
|
+
sidebarMenuItemVariants({
|
|
2346
|
+
disabled,
|
|
2347
|
+
active,
|
|
2348
|
+
collapsed: collapsedResolved
|
|
2349
|
+
}),
|
|
2350
|
+
hasSubmenu && !collapsedResolved && "flex-1",
|
|
2351
|
+
!hasSubmenu && className
|
|
2352
|
+
),
|
|
2353
|
+
"aria-disabled": disabled,
|
|
2354
|
+
"aria-current": active ? "page" : void 0,
|
|
2355
|
+
"aria-label": collapsedResolved && typeof children === "string" ? children : void 0,
|
|
2356
|
+
"aria-expanded": hasSubmenu && !collapsedResolved ? expanded : void 0,
|
|
2357
|
+
"aria-controls": hasSubmenu && !collapsedResolved ? regionId : void 0,
|
|
2358
|
+
onClick: handleClick,
|
|
2359
|
+
...props,
|
|
2360
|
+
children: [
|
|
2361
|
+
leftIcon != null && /* @__PURE__ */ jsx24(
|
|
2362
|
+
Icon,
|
|
2363
|
+
{
|
|
2364
|
+
name: leftIcon,
|
|
2365
|
+
size: "sm",
|
|
2366
|
+
className: disabled ? "text-icon-inactive-subtle" : active ? "text-icon-brand" : "text-icon-secondary",
|
|
2367
|
+
"aria-hidden": true
|
|
2368
|
+
}
|
|
2369
|
+
),
|
|
2370
|
+
!collapsedResolved && children != null && /* @__PURE__ */ jsx24(
|
|
2371
|
+
"span",
|
|
2372
|
+
{
|
|
2373
|
+
className: cn(
|
|
2374
|
+
"min-w-0 flex-1 truncate text-sm font-medium leading-5",
|
|
2375
|
+
disabled ? "text-inactive" : active ? "text-brand" : "text-primary"
|
|
2376
|
+
),
|
|
2377
|
+
children
|
|
2378
|
+
}
|
|
2379
|
+
),
|
|
2380
|
+
hasSubmenu && !collapsedResolved && /* @__PURE__ */ jsx24(
|
|
2381
|
+
Icon,
|
|
2382
|
+
{
|
|
2383
|
+
name: expanded ? "expand_less" : "expand_more",
|
|
2384
|
+
size: "sm",
|
|
2385
|
+
className: disabled ? "text-icon-inactive-subtle" : active ? "text-icon-brand" : "text-icon-secondary",
|
|
2386
|
+
"aria-hidden": true
|
|
2387
|
+
}
|
|
2388
|
+
)
|
|
2389
|
+
]
|
|
2390
|
+
}
|
|
2391
|
+
);
|
|
2392
|
+
if (!hasSubmenu || collapsedResolved) {
|
|
2393
|
+
return hasSubmenu && collapsedResolved ? /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col", className), children: trigger }) : trigger;
|
|
2394
|
+
}
|
|
2395
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn("flex flex-col", className), children: [
|
|
2396
|
+
trigger,
|
|
2397
|
+
/* @__PURE__ */ jsx24(
|
|
2398
|
+
"div",
|
|
2399
|
+
{
|
|
2400
|
+
id: regionId,
|
|
2401
|
+
role: "group",
|
|
2402
|
+
"aria-label": typeof children === "string" ? `${children} submenu` : "Submenu",
|
|
2403
|
+
className: cn(
|
|
2404
|
+
"flex flex-col overflow-hidden transition-[height] duration-200 ease-out",
|
|
2405
|
+
expanded ? "visible" : "hidden"
|
|
2406
|
+
),
|
|
2407
|
+
children: submenu
|
|
2408
|
+
}
|
|
2409
|
+
)
|
|
2410
|
+
] });
|
|
2411
|
+
}
|
|
2412
|
+
);
|
|
2413
|
+
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
2414
|
+
|
|
2415
|
+
// src/components/sidebar-submenu-item.tsx
|
|
2416
|
+
import * as React24 from "react";
|
|
2417
|
+
import { cva as cva23 } from "class-variance-authority";
|
|
2418
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2419
|
+
var sidebarSubmenuItemVariants = cva23(
|
|
2420
|
+
"flex w-full items-center rounded-sm pl-xl pr-md py-sm text-secondary text-left text-sm font-regular leading-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2",
|
|
2421
|
+
{
|
|
2422
|
+
variants: {
|
|
2423
|
+
disabled: {
|
|
2424
|
+
true: "cursor-default opacity-50 pointer-events-none [&_*]:pointer-events-none",
|
|
2425
|
+
false: "group cursor-pointer hover:bg-tertiary"
|
|
2426
|
+
},
|
|
2427
|
+
active: {
|
|
2428
|
+
true: "bg-brand-tertiary text-brand font-medium",
|
|
2429
|
+
false: ""
|
|
2430
|
+
}
|
|
2431
|
+
},
|
|
2432
|
+
defaultVariants: {
|
|
2433
|
+
disabled: false,
|
|
2434
|
+
active: false
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
);
|
|
2438
|
+
var SidebarSubmenuItem = React24.forwardRef(({ className, disabled = false, active = false, children, ...props }, ref) => {
|
|
2439
|
+
return /* @__PURE__ */ jsx25(
|
|
2440
|
+
"button",
|
|
2441
|
+
{
|
|
2442
|
+
ref,
|
|
2443
|
+
type: "button",
|
|
2444
|
+
disabled,
|
|
2445
|
+
className: cn(
|
|
2446
|
+
sidebarSubmenuItemVariants({ disabled, active }),
|
|
2447
|
+
className
|
|
2448
|
+
),
|
|
2449
|
+
"aria-disabled": disabled,
|
|
2450
|
+
"aria-current": active ? "page" : void 0,
|
|
2451
|
+
...props,
|
|
2452
|
+
children: children != null && /* @__PURE__ */ jsx25(
|
|
2453
|
+
"span",
|
|
2454
|
+
{
|
|
2455
|
+
className: cn(
|
|
2456
|
+
"min-w-0 truncate",
|
|
2457
|
+
disabled ? "text-inactive" : "group-hover:text-primary",
|
|
2458
|
+
!disabled && (active ? "text-brand" : "text-secondary")
|
|
2459
|
+
),
|
|
2460
|
+
children
|
|
2461
|
+
}
|
|
2462
|
+
)
|
|
2463
|
+
}
|
|
2464
|
+
);
|
|
2465
|
+
});
|
|
2466
|
+
SidebarSubmenuItem.displayName = "SidebarSubmenuItem";
|
|
2467
|
+
|
|
2468
|
+
// src/components/sidebar-account-card.tsx
|
|
2469
|
+
import * as React25 from "react";
|
|
2470
|
+
import { cva as cva24 } from "class-variance-authority";
|
|
2471
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2472
|
+
var sidebarAccountCardVariants = cva24(
|
|
2473
|
+
"flex w-full items-center gap-md rounded-sm px-md py-md min-w-0",
|
|
2474
|
+
{
|
|
2475
|
+
variants: {
|
|
2476
|
+
selected: {
|
|
2477
|
+
true: "bg-tertiary",
|
|
2478
|
+
false: ""
|
|
2479
|
+
},
|
|
2480
|
+
collapsed: {
|
|
2481
|
+
true: "justify-center px-0 py-sm",
|
|
2482
|
+
false: ""
|
|
2483
|
+
}
|
|
2484
|
+
},
|
|
2485
|
+
defaultVariants: {
|
|
2486
|
+
selected: false,
|
|
2487
|
+
collapsed: false
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
);
|
|
2491
|
+
var SidebarAccountCard = React25.forwardRef(
|
|
2492
|
+
({
|
|
2493
|
+
className,
|
|
2494
|
+
username,
|
|
2495
|
+
supportingText,
|
|
2496
|
+
initials,
|
|
2497
|
+
"aria-label": ariaLabel,
|
|
2498
|
+
rightIcon,
|
|
2499
|
+
selected = false,
|
|
2500
|
+
collapsed: collapsedProp,
|
|
2501
|
+
...props
|
|
2502
|
+
}, ref) => {
|
|
2503
|
+
const sidebarContext = useSidebarContext();
|
|
2504
|
+
const collapsed = collapsedProp ?? sidebarContext?.collapsed ?? false;
|
|
2505
|
+
return /* @__PURE__ */ jsxs17(
|
|
2506
|
+
"div",
|
|
2507
|
+
{
|
|
2508
|
+
ref,
|
|
2509
|
+
className: cn(
|
|
2510
|
+
sidebarAccountCardVariants({ selected, collapsed }),
|
|
2511
|
+
className
|
|
2512
|
+
),
|
|
2513
|
+
...props,
|
|
2514
|
+
children: [
|
|
2515
|
+
/* @__PURE__ */ jsx26(
|
|
2516
|
+
Avatar,
|
|
2517
|
+
{
|
|
2518
|
+
size: "md",
|
|
2519
|
+
initials,
|
|
2520
|
+
username: collapsed ? void 0 : username,
|
|
2521
|
+
supportingText: collapsed ? void 0 : supportingText,
|
|
2522
|
+
"aria-label": ariaLabel ?? username,
|
|
2523
|
+
className: collapsed ? "shrink-0" : "min-w-0 flex-1"
|
|
2524
|
+
}
|
|
2525
|
+
),
|
|
2526
|
+
!collapsed && rightIcon != null && /* @__PURE__ */ jsx26(
|
|
2527
|
+
Icon,
|
|
2528
|
+
{
|
|
2529
|
+
name: rightIcon,
|
|
2530
|
+
size: "sm",
|
|
2531
|
+
className: "shrink-0 text-icon-secondary",
|
|
2532
|
+
"aria-hidden": true
|
|
2533
|
+
}
|
|
2534
|
+
)
|
|
2535
|
+
]
|
|
2536
|
+
}
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
);
|
|
2540
|
+
SidebarAccountCard.displayName = "SidebarAccountCard";
|
|
2541
|
+
|
|
2542
|
+
// src/components/input.tsx
|
|
2543
|
+
import * as React26 from "react";
|
|
2544
|
+
import { cva as cva25 } from "class-variance-authority";
|
|
2545
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2546
|
+
var inputWrapperVariants = cva25(
|
|
2547
|
+
"flex w-full items-center border bg-component-input-bg border-strong rounded-sm shadow-xs transition-colors",
|
|
2548
|
+
{
|
|
2549
|
+
variants: {
|
|
2550
|
+
size: {
|
|
2551
|
+
sm: "h-9 px-sm",
|
|
2552
|
+
md: "h-10 px-sm",
|
|
2553
|
+
lg: "h-11 px-sm"
|
|
2554
|
+
},
|
|
2555
|
+
error: {
|
|
2556
|
+
true: "border-danger-secondary",
|
|
2557
|
+
false: ""
|
|
2558
|
+
},
|
|
2559
|
+
disabled: {
|
|
2560
|
+
true: "bg-secondary border-inactive shadow-none pointer-events-none",
|
|
2561
|
+
false: ""
|
|
2562
|
+
},
|
|
2563
|
+
focused: {
|
|
2564
|
+
true: "",
|
|
2565
|
+
false: ""
|
|
2566
|
+
}
|
|
2567
|
+
},
|
|
2568
|
+
compoundVariants: [
|
|
2569
|
+
{ focused: true, error: false, className: "border-brand" },
|
|
2570
|
+
{ focused: true, error: true, className: "border-danger" }
|
|
2571
|
+
],
|
|
2572
|
+
defaultVariants: {
|
|
2573
|
+
size: "md",
|
|
2574
|
+
error: false,
|
|
2575
|
+
disabled: false,
|
|
2576
|
+
focused: false
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
);
|
|
2580
|
+
var focusRingVariants = cva25(
|
|
2581
|
+
"pointer-events-none absolute inset-[-1px] rounded-sm border-4",
|
|
2582
|
+
{
|
|
2583
|
+
variants: {
|
|
2584
|
+
error: {
|
|
2585
|
+
true: "border-focused-danger",
|
|
2586
|
+
false: "border-focused"
|
|
2587
|
+
}
|
|
2588
|
+
},
|
|
2589
|
+
defaultVariants: {
|
|
2590
|
+
error: false
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
);
|
|
2594
|
+
var presetConfig = {
|
|
2595
|
+
user: {
|
|
2596
|
+
leftIcon: "account_circle"
|
|
2597
|
+
},
|
|
2598
|
+
email: {
|
|
2599
|
+
leftIcon: "email",
|
|
2600
|
+
type: "email"
|
|
2601
|
+
},
|
|
2602
|
+
password: {
|
|
2603
|
+
leftIcon: "lock",
|
|
2604
|
+
rightIcon: "visibility",
|
|
2605
|
+
type: "password",
|
|
2606
|
+
hasPasswordToggle: true
|
|
2607
|
+
},
|
|
2608
|
+
date: {
|
|
2609
|
+
leftIcon: "calendar_month",
|
|
2610
|
+
type: "date"
|
|
2611
|
+
},
|
|
2612
|
+
amount: {
|
|
2613
|
+
leftIcon: "attach_money",
|
|
2614
|
+
rightIcon: "close",
|
|
2615
|
+
type: "number",
|
|
2616
|
+
hasClearBehavior: true
|
|
2617
|
+
},
|
|
2618
|
+
description: {
|
|
2619
|
+
leftIcon: "description",
|
|
2620
|
+
optional: true
|
|
2621
|
+
},
|
|
2622
|
+
search: {
|
|
2623
|
+
leftIcon: "search",
|
|
2624
|
+
rightIcon: "close",
|
|
2625
|
+
optional: true,
|
|
2626
|
+
hasClearBehavior: true
|
|
2627
|
+
}
|
|
2628
|
+
};
|
|
2629
|
+
var Input = React26.forwardRef(
|
|
2630
|
+
({
|
|
2631
|
+
className,
|
|
2632
|
+
size = "md",
|
|
2633
|
+
error: errorProp,
|
|
2634
|
+
label,
|
|
2635
|
+
optional,
|
|
2636
|
+
helperText,
|
|
2637
|
+
helperTextIcon,
|
|
2638
|
+
errorMessage,
|
|
2639
|
+
maxLength,
|
|
2640
|
+
characterCount,
|
|
2641
|
+
leftIcon,
|
|
2642
|
+
rightIcon,
|
|
2643
|
+
iconVariant,
|
|
2644
|
+
iconFilled,
|
|
2645
|
+
id,
|
|
2646
|
+
disabled,
|
|
2647
|
+
value,
|
|
2648
|
+
defaultValue,
|
|
2649
|
+
onFocus,
|
|
2650
|
+
onBlur,
|
|
2651
|
+
preset,
|
|
2652
|
+
type,
|
|
2653
|
+
onChange,
|
|
2654
|
+
...props
|
|
2655
|
+
}, ref) => {
|
|
2656
|
+
const [isFocused, setIsFocused] = React26.useState(false);
|
|
2657
|
+
const [showPassword, setShowPassword] = React26.useState(false);
|
|
2658
|
+
const internalRef = React26.useRef(null);
|
|
2659
|
+
const inputId = id || React26.useId();
|
|
2660
|
+
const inputRef = React26.useCallback(
|
|
2661
|
+
(node) => {
|
|
2662
|
+
internalRef.current = node;
|
|
2663
|
+
if (typeof ref === "function") {
|
|
2664
|
+
ref(node);
|
|
2665
|
+
} else if (ref) {
|
|
2666
|
+
ref.current = node;
|
|
2667
|
+
}
|
|
2668
|
+
},
|
|
2669
|
+
[ref]
|
|
2670
|
+
);
|
|
2671
|
+
const helperId = `${inputId}-helper`;
|
|
2672
|
+
const errorId = `${inputId}-error`;
|
|
2673
|
+
const hasError = errorProp || !!errorMessage;
|
|
2674
|
+
const isControlled = value !== void 0;
|
|
2675
|
+
const presetData = preset ? presetConfig[preset] : null;
|
|
2676
|
+
const mergedLeftIcon = leftIcon ?? presetData?.leftIcon;
|
|
2677
|
+
const mergedRightIcon = rightIcon ?? presetData?.rightIcon;
|
|
2678
|
+
const mergedType = type ?? presetData?.type;
|
|
2679
|
+
const mergedOptional = optional ?? presetData?.optional;
|
|
2680
|
+
const hasPasswordToggle = presetData?.hasPasswordToggle ?? false;
|
|
2681
|
+
const hasClearBehavior = presetData?.hasClearBehavior ?? false;
|
|
2682
|
+
const actualInputType = hasPasswordToggle && mergedType === "password" ? showPassword ? "text" : "password" : mergedType;
|
|
2683
|
+
const currentValue = value ?? defaultValue ?? "";
|
|
2684
|
+
const currentLength = characterCount !== void 0 ? characterCount : typeof currentValue === "string" ? currentValue.length : 0;
|
|
2685
|
+
const handleFocus = React26.useCallback(
|
|
2686
|
+
(e) => {
|
|
2687
|
+
setIsFocused(true);
|
|
2688
|
+
onFocus?.(e);
|
|
2689
|
+
},
|
|
2690
|
+
[onFocus]
|
|
2691
|
+
);
|
|
2692
|
+
const handleBlur = React26.useCallback(
|
|
2693
|
+
(e) => {
|
|
2694
|
+
setIsFocused(false);
|
|
2695
|
+
onBlur?.(e);
|
|
2696
|
+
},
|
|
2697
|
+
[onBlur]
|
|
2698
|
+
);
|
|
2699
|
+
const handlePasswordToggle = React26.useCallback(() => {
|
|
2700
|
+
setShowPassword((prev) => !prev);
|
|
2701
|
+
}, []);
|
|
2702
|
+
const handleClear = React26.useCallback(
|
|
2703
|
+
(e) => {
|
|
2704
|
+
e.preventDefault();
|
|
2705
|
+
e.stopPropagation();
|
|
2706
|
+
if (isControlled && onChange) {
|
|
2707
|
+
const syntheticEvent = {
|
|
2708
|
+
target: { value: "" },
|
|
2709
|
+
currentTarget: { value: "" }
|
|
2710
|
+
};
|
|
2711
|
+
onChange(syntheticEvent);
|
|
2712
|
+
} else if (internalRef.current) {
|
|
2713
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
2714
|
+
window.HTMLInputElement.prototype,
|
|
2715
|
+
"value"
|
|
2716
|
+
)?.set;
|
|
2717
|
+
nativeInputValueSetter?.call(internalRef.current, "");
|
|
2718
|
+
const event = new Event("input", { bubbles: true });
|
|
2719
|
+
internalRef.current.dispatchEvent(event);
|
|
2720
|
+
}
|
|
2721
|
+
},
|
|
2722
|
+
[isControlled, onChange]
|
|
2723
|
+
);
|
|
2724
|
+
const leftIconElement = mergedLeftIcon ? /* @__PURE__ */ jsx27(
|
|
2725
|
+
"span",
|
|
2726
|
+
{
|
|
2727
|
+
className: cn(
|
|
2728
|
+
"flex shrink-0 items-center",
|
|
2729
|
+
size !== "sm" && "pl-[4px]"
|
|
2730
|
+
),
|
|
2731
|
+
children: /* @__PURE__ */ jsx27(
|
|
2732
|
+
Icon,
|
|
2733
|
+
{
|
|
2734
|
+
name: mergedLeftIcon,
|
|
2735
|
+
size: "md",
|
|
2736
|
+
variant: iconVariant,
|
|
2737
|
+
filled: iconFilled,
|
|
2738
|
+
className: disabled ? "text-inactive-subtle" : "text-tertiary",
|
|
2739
|
+
"aria-hidden": true
|
|
2740
|
+
}
|
|
2741
|
+
)
|
|
2742
|
+
}
|
|
2743
|
+
) : null;
|
|
2744
|
+
const rightIconElement = mergedRightIcon ? /* @__PURE__ */ jsx27(
|
|
2745
|
+
"span",
|
|
2746
|
+
{
|
|
2747
|
+
className: cn(
|
|
2748
|
+
"flex shrink-0 items-center",
|
|
2749
|
+
size === "sm" ? "pl-[2px]" : "px-[2px]",
|
|
2750
|
+
(hasPasswordToggle || hasClearBehavior) && !disabled && "cursor-pointer"
|
|
2751
|
+
),
|
|
2752
|
+
onClick: hasPasswordToggle ? handlePasswordToggle : hasClearBehavior ? handleClear : void 0,
|
|
2753
|
+
role: hasPasswordToggle || hasClearBehavior ? "button" : void 0,
|
|
2754
|
+
"aria-label": hasPasswordToggle ? showPassword ? "Hide password" : "Show password" : hasClearBehavior ? "Clear input" : void 0,
|
|
2755
|
+
tabIndex: hasPasswordToggle || hasClearBehavior ? disabled ? -1 : 0 : void 0,
|
|
2756
|
+
onKeyDown: hasPasswordToggle || hasClearBehavior ? (e) => {
|
|
2757
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2758
|
+
e.preventDefault();
|
|
2759
|
+
if (hasPasswordToggle) {
|
|
2760
|
+
handlePasswordToggle();
|
|
2761
|
+
} else if (hasClearBehavior) {
|
|
2762
|
+
handleClear(e);
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
} : void 0,
|
|
2766
|
+
children: /* @__PURE__ */ jsx27(
|
|
2767
|
+
Icon,
|
|
2768
|
+
{
|
|
2769
|
+
name: hasPasswordToggle && showPassword ? "visibility_off" : mergedRightIcon,
|
|
2770
|
+
size: "md",
|
|
2771
|
+
variant: iconVariant,
|
|
2772
|
+
filled: iconFilled,
|
|
2773
|
+
className: disabled ? "text-inactive-subtle" : "text-tertiary",
|
|
2774
|
+
"aria-hidden": true
|
|
2775
|
+
}
|
|
2776
|
+
)
|
|
2777
|
+
}
|
|
2778
|
+
) : null;
|
|
2779
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn("w-full", className), children: [
|
|
2780
|
+
label && /* @__PURE__ */ jsxs18(
|
|
2781
|
+
"label",
|
|
2782
|
+
{
|
|
2783
|
+
htmlFor: inputId,
|
|
2784
|
+
className: "block text-sm font-medium text-primary mb-sm",
|
|
2785
|
+
children: [
|
|
2786
|
+
label,
|
|
2787
|
+
mergedOptional && /* @__PURE__ */ jsx27("span", { className: "text-tertiary font-normal ml-1", children: "(Optional)" })
|
|
2788
|
+
]
|
|
2789
|
+
}
|
|
2790
|
+
),
|
|
2791
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-xs", children: [
|
|
2792
|
+
/* @__PURE__ */ jsxs18(
|
|
2793
|
+
"div",
|
|
2794
|
+
{
|
|
2795
|
+
className: cn(
|
|
2796
|
+
inputWrapperVariants({
|
|
2797
|
+
size,
|
|
2798
|
+
error: hasError,
|
|
2799
|
+
disabled: !!disabled,
|
|
2800
|
+
focused: isFocused
|
|
2801
|
+
}),
|
|
2802
|
+
"relative flex-1"
|
|
2803
|
+
),
|
|
2804
|
+
children: [
|
|
2805
|
+
isFocused && /* @__PURE__ */ jsx27("div", { className: focusRingVariants({ error: hasError }) }),
|
|
2806
|
+
leftIconElement,
|
|
2807
|
+
/* @__PURE__ */ jsx27(
|
|
2808
|
+
"input",
|
|
2809
|
+
{
|
|
2810
|
+
ref: inputRef,
|
|
2811
|
+
id: inputId,
|
|
2812
|
+
className: cn(
|
|
2813
|
+
"flex-1 min-w-0 bg-transparent text-sm text-primary placeholder:text-placeholder focus:outline-none disabled:text-inactive pl-[6px] pr-[8px]",
|
|
2814
|
+
"leading-[20px]"
|
|
2815
|
+
),
|
|
2816
|
+
disabled,
|
|
2817
|
+
type: actualInputType,
|
|
2818
|
+
value,
|
|
2819
|
+
defaultValue,
|
|
2820
|
+
maxLength,
|
|
2821
|
+
"aria-invalid": hasError,
|
|
2822
|
+
"aria-describedby": errorMessage ? errorId : helperText ? helperId : void 0,
|
|
2823
|
+
onFocus: handleFocus,
|
|
2824
|
+
onBlur: handleBlur,
|
|
2825
|
+
onChange,
|
|
2826
|
+
...props
|
|
2827
|
+
}
|
|
2828
|
+
),
|
|
2829
|
+
rightIconElement
|
|
2830
|
+
]
|
|
2831
|
+
}
|
|
2832
|
+
),
|
|
2833
|
+
maxLength !== void 0 && /* @__PURE__ */ jsx27(
|
|
2834
|
+
"span",
|
|
2835
|
+
{
|
|
2836
|
+
className: cn(
|
|
2837
|
+
"text-sm shrink-0",
|
|
2838
|
+
size === "sm" && "leading-9",
|
|
2839
|
+
size === "md" && "leading-10",
|
|
2840
|
+
size === "lg" && "leading-[44px]",
|
|
2841
|
+
hasError ? "text-error" : "text-tertiary"
|
|
2842
|
+
),
|
|
2843
|
+
children: currentLength
|
|
2844
|
+
}
|
|
2845
|
+
)
|
|
2846
|
+
] }),
|
|
2847
|
+
(helperText || errorMessage) && /* @__PURE__ */ jsxs18(
|
|
2848
|
+
"p",
|
|
2849
|
+
{
|
|
2850
|
+
id: errorMessage ? errorId : helperId,
|
|
2851
|
+
className: cn(
|
|
2852
|
+
"mt-sm text-sm flex items-center gap-1",
|
|
2853
|
+
errorMessage ? "text-error" : "text-secondary"
|
|
2854
|
+
),
|
|
2855
|
+
children: [
|
|
2856
|
+
helperTextIcon && !errorMessage && /* @__PURE__ */ jsx27(
|
|
2857
|
+
Icon,
|
|
2858
|
+
{
|
|
2859
|
+
name: helperTextIcon,
|
|
2860
|
+
size: "sm",
|
|
2861
|
+
className: "text-secondary shrink-0",
|
|
2862
|
+
"aria-hidden": true
|
|
2863
|
+
}
|
|
2864
|
+
),
|
|
2865
|
+
errorMessage || helperText
|
|
2866
|
+
]
|
|
2867
|
+
}
|
|
2868
|
+
)
|
|
2869
|
+
] });
|
|
2870
|
+
}
|
|
2871
|
+
);
|
|
2872
|
+
Input.displayName = "Input";
|
|
2873
|
+
|
|
2874
|
+
// src/components/textarea.tsx
|
|
2875
|
+
import * as React27 from "react";
|
|
2876
|
+
import { cva as cva26 } from "class-variance-authority";
|
|
2877
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2878
|
+
var textareaWrapperVariants = cva26(
|
|
2879
|
+
"flex w-full items-start border bg-component-input-bg border-strong rounded-sm shadow-xs transition-colors min-h-[88px] px-sm py-sm",
|
|
2880
|
+
{
|
|
2881
|
+
variants: {
|
|
2882
|
+
error: {
|
|
2883
|
+
true: "border-danger-secondary",
|
|
2884
|
+
false: ""
|
|
2885
|
+
},
|
|
2886
|
+
disabled: {
|
|
2887
|
+
true: "bg-secondary border-inactive shadow-none pointer-events-none",
|
|
2888
|
+
false: ""
|
|
2889
|
+
},
|
|
2890
|
+
focused: {
|
|
2891
|
+
true: "",
|
|
2892
|
+
false: ""
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2895
|
+
compoundVariants: [
|
|
2896
|
+
{ focused: true, error: false, className: "border-brand" },
|
|
2897
|
+
{ focused: true, error: true, className: "border-danger" }
|
|
2898
|
+
],
|
|
2899
|
+
defaultVariants: {
|
|
2900
|
+
error: false,
|
|
2901
|
+
disabled: false,
|
|
2902
|
+
focused: false
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
);
|
|
2906
|
+
var focusRingVariants2 = cva26(
|
|
2907
|
+
"pointer-events-none absolute inset-[-1px] rounded-sm border-4",
|
|
2908
|
+
{
|
|
2909
|
+
variants: {
|
|
2910
|
+
error: {
|
|
2911
|
+
true: "border-focused-danger",
|
|
2912
|
+
false: "border-focused"
|
|
2913
|
+
}
|
|
2914
|
+
},
|
|
2915
|
+
defaultVariants: {
|
|
2916
|
+
error: false
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
);
|
|
2920
|
+
var TextArea = React27.forwardRef(
|
|
2921
|
+
({
|
|
2922
|
+
className,
|
|
2923
|
+
error: errorProp,
|
|
2924
|
+
label,
|
|
2925
|
+
optional,
|
|
2926
|
+
helperText,
|
|
2927
|
+
helperTextIcon,
|
|
2928
|
+
errorMessage,
|
|
2929
|
+
maxLength,
|
|
2930
|
+
characterCount,
|
|
2931
|
+
iconVariant,
|
|
2932
|
+
iconFilled,
|
|
2933
|
+
id,
|
|
2934
|
+
disabled,
|
|
2935
|
+
value,
|
|
2936
|
+
defaultValue,
|
|
2937
|
+
onFocus,
|
|
2938
|
+
onBlur,
|
|
2939
|
+
onChange,
|
|
2940
|
+
rows,
|
|
2941
|
+
...props
|
|
2942
|
+
}, ref) => {
|
|
2943
|
+
const [isFocused, setIsFocused] = React27.useState(false);
|
|
2944
|
+
const internalRef = React27.useRef(null);
|
|
2945
|
+
const textareaId = id || React27.useId();
|
|
2946
|
+
const textareaRef = React27.useCallback(
|
|
2947
|
+
(node) => {
|
|
2948
|
+
internalRef.current = node;
|
|
2949
|
+
if (typeof ref === "function") {
|
|
2950
|
+
ref(node);
|
|
2951
|
+
} else if (ref) {
|
|
2952
|
+
ref.current = node;
|
|
2953
|
+
}
|
|
2954
|
+
},
|
|
2955
|
+
[ref]
|
|
2956
|
+
);
|
|
2957
|
+
const helperId = `${textareaId}-helper`;
|
|
2958
|
+
const errorId = `${textareaId}-error`;
|
|
2959
|
+
const hasError = errorProp || !!errorMessage;
|
|
2960
|
+
const currentValue = value ?? defaultValue ?? "";
|
|
2961
|
+
const currentLength = characterCount !== void 0 ? characterCount : typeof currentValue === "string" ? currentValue.length : 0;
|
|
2962
|
+
const handleFocus = React27.useCallback(
|
|
2963
|
+
(e) => {
|
|
2964
|
+
setIsFocused(true);
|
|
2965
|
+
onFocus?.(e);
|
|
2966
|
+
},
|
|
2967
|
+
[onFocus]
|
|
2968
|
+
);
|
|
2969
|
+
const handleBlur = React27.useCallback(
|
|
2970
|
+
(e) => {
|
|
2971
|
+
setIsFocused(false);
|
|
2972
|
+
onBlur?.(e);
|
|
2973
|
+
},
|
|
2974
|
+
[onBlur]
|
|
2975
|
+
);
|
|
2976
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn("w-full", className), children: [
|
|
2977
|
+
label && /* @__PURE__ */ jsxs19(
|
|
2978
|
+
"label",
|
|
2979
|
+
{
|
|
2980
|
+
htmlFor: textareaId,
|
|
2981
|
+
className: "block text-sm font-medium text-primary mb-sm",
|
|
2982
|
+
children: [
|
|
2983
|
+
label,
|
|
2984
|
+
optional && /* @__PURE__ */ jsx28("span", { className: "text-tertiary font-normal ml-1", children: "(Optional)" }),
|
|
2985
|
+
optional && /* @__PURE__ */ jsx28(
|
|
2986
|
+
Icon,
|
|
2987
|
+
{
|
|
2988
|
+
name: "info",
|
|
2989
|
+
size: "sm",
|
|
2990
|
+
variant: iconVariant,
|
|
2991
|
+
filled: iconFilled,
|
|
2992
|
+
className: "text-tertiary ml-1 inline-block align-middle",
|
|
2993
|
+
"aria-hidden": true
|
|
2994
|
+
}
|
|
2995
|
+
)
|
|
2996
|
+
]
|
|
2997
|
+
}
|
|
2998
|
+
),
|
|
2999
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-start gap-xs", children: [
|
|
3000
|
+
/* @__PURE__ */ jsxs19(
|
|
3001
|
+
"div",
|
|
3002
|
+
{
|
|
3003
|
+
className: cn(
|
|
3004
|
+
textareaWrapperVariants({
|
|
3005
|
+
error: hasError,
|
|
3006
|
+
disabled: !!disabled,
|
|
3007
|
+
focused: isFocused
|
|
3008
|
+
}),
|
|
3009
|
+
"relative flex-1"
|
|
3010
|
+
),
|
|
3011
|
+
children: [
|
|
3012
|
+
isFocused && /* @__PURE__ */ jsx28("div", { className: focusRingVariants2({ error: hasError }) }),
|
|
3013
|
+
/* @__PURE__ */ jsx28(
|
|
3014
|
+
"textarea",
|
|
3015
|
+
{
|
|
3016
|
+
ref: textareaRef,
|
|
3017
|
+
id: textareaId,
|
|
3018
|
+
className: cn(
|
|
3019
|
+
"flex-1 min-w-0 w-full bg-transparent text-sm text-primary placeholder:text-placeholder focus:outline-none disabled:text-inactive resize-none",
|
|
3020
|
+
"leading-[20px]"
|
|
3021
|
+
),
|
|
3022
|
+
disabled,
|
|
3023
|
+
value,
|
|
3024
|
+
defaultValue,
|
|
3025
|
+
maxLength,
|
|
3026
|
+
rows: rows ?? 4,
|
|
3027
|
+
"aria-invalid": hasError,
|
|
3028
|
+
"aria-describedby": errorMessage ? errorId : helperText ? helperId : void 0,
|
|
3029
|
+
onFocus: handleFocus,
|
|
3030
|
+
onBlur: handleBlur,
|
|
3031
|
+
onChange,
|
|
3032
|
+
...props
|
|
3033
|
+
}
|
|
3034
|
+
)
|
|
3035
|
+
]
|
|
3036
|
+
}
|
|
3037
|
+
),
|
|
3038
|
+
maxLength !== void 0 && /* @__PURE__ */ jsx28(
|
|
3039
|
+
"span",
|
|
3040
|
+
{
|
|
3041
|
+
className: cn(
|
|
3042
|
+
"text-sm shrink-0 leading-[88px]",
|
|
3043
|
+
hasError ? "text-error" : "text-tertiary"
|
|
3044
|
+
),
|
|
3045
|
+
children: currentLength
|
|
3046
|
+
}
|
|
3047
|
+
)
|
|
3048
|
+
] }),
|
|
3049
|
+
(helperText || errorMessage) && /* @__PURE__ */ jsxs19(
|
|
3050
|
+
"p",
|
|
3051
|
+
{
|
|
3052
|
+
id: errorMessage ? errorId : helperId,
|
|
3053
|
+
className: cn(
|
|
3054
|
+
"mt-sm text-sm flex items-center gap-1",
|
|
3055
|
+
errorMessage ? "text-error" : "text-secondary"
|
|
3056
|
+
),
|
|
3057
|
+
children: [
|
|
3058
|
+
helperTextIcon && !errorMessage && /* @__PURE__ */ jsx28(
|
|
3059
|
+
Icon,
|
|
3060
|
+
{
|
|
3061
|
+
name: helperTextIcon,
|
|
3062
|
+
size: "sm",
|
|
3063
|
+
className: "text-secondary shrink-0",
|
|
3064
|
+
"aria-hidden": true
|
|
3065
|
+
}
|
|
3066
|
+
),
|
|
3067
|
+
errorMessage && /* @__PURE__ */ jsx28(
|
|
3068
|
+
Icon,
|
|
3069
|
+
{
|
|
3070
|
+
name: "error",
|
|
3071
|
+
size: "sm",
|
|
3072
|
+
className: "text-error shrink-0",
|
|
3073
|
+
"aria-hidden": true
|
|
3074
|
+
}
|
|
3075
|
+
),
|
|
3076
|
+
errorMessage || helperText
|
|
3077
|
+
]
|
|
3078
|
+
}
|
|
3079
|
+
)
|
|
3080
|
+
] });
|
|
3081
|
+
}
|
|
3082
|
+
);
|
|
3083
|
+
TextArea.displayName = "TextArea";
|
|
3084
|
+
|
|
3085
|
+
// src/components/checkbox.tsx
|
|
3086
|
+
import * as React28 from "react";
|
|
3087
|
+
import { Fragment as Fragment4, jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3088
|
+
function CheckSvg({ className }) {
|
|
3089
|
+
return /* @__PURE__ */ jsx29(
|
|
3090
|
+
Icon,
|
|
3091
|
+
{
|
|
3092
|
+
name: "check",
|
|
3093
|
+
size: "xs",
|
|
3094
|
+
className: cn(
|
|
3095
|
+
"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
3096
|
+
className
|
|
3097
|
+
)
|
|
3098
|
+
}
|
|
3099
|
+
);
|
|
3100
|
+
}
|
|
3101
|
+
function IndeterminateSvg({ className }) {
|
|
3102
|
+
return /* @__PURE__ */ jsx29(
|
|
3103
|
+
Icon,
|
|
3104
|
+
{
|
|
3105
|
+
name: "remove",
|
|
3106
|
+
size: "xs",
|
|
3107
|
+
className: cn(
|
|
3108
|
+
"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
3109
|
+
className
|
|
3110
|
+
)
|
|
3111
|
+
}
|
|
3112
|
+
);
|
|
3113
|
+
}
|
|
3114
|
+
var Checkbox = React28.forwardRef(
|
|
3115
|
+
({
|
|
3116
|
+
className,
|
|
3117
|
+
label,
|
|
3118
|
+
supportText,
|
|
3119
|
+
checkboxPosition = "leading",
|
|
3120
|
+
indeterminate = false,
|
|
3121
|
+
checked,
|
|
3122
|
+
defaultChecked,
|
|
3123
|
+
disabled,
|
|
3124
|
+
onChange,
|
|
3125
|
+
onFocus,
|
|
3126
|
+
onBlur,
|
|
3127
|
+
id,
|
|
3128
|
+
...props
|
|
3129
|
+
}, ref) => {
|
|
3130
|
+
const [isFocused, setIsFocused] = React28.useState(false);
|
|
3131
|
+
const [internalChecked, setInternalChecked] = React28.useState(
|
|
3132
|
+
defaultChecked ?? false
|
|
3133
|
+
);
|
|
3134
|
+
const internalRef = React28.useRef(null);
|
|
3135
|
+
const inputId = id || React28.useId();
|
|
3136
|
+
const mergedRef = React28.useCallback(
|
|
3137
|
+
(node) => {
|
|
3138
|
+
internalRef.current = node;
|
|
3139
|
+
if (typeof ref === "function") {
|
|
3140
|
+
ref(node);
|
|
3141
|
+
} else if (ref) {
|
|
3142
|
+
ref.current = node;
|
|
3143
|
+
}
|
|
3144
|
+
},
|
|
3145
|
+
[ref]
|
|
3146
|
+
);
|
|
3147
|
+
React28.useEffect(() => {
|
|
3148
|
+
if (internalRef.current) {
|
|
3149
|
+
internalRef.current.indeterminate = indeterminate;
|
|
3150
|
+
}
|
|
3151
|
+
}, [indeterminate]);
|
|
3152
|
+
const isControlled = checked !== void 0;
|
|
3153
|
+
const isChecked = isControlled ? !!checked : internalChecked;
|
|
3154
|
+
const isActive = indeterminate || isChecked;
|
|
3155
|
+
const isDisabled = !!disabled;
|
|
3156
|
+
const handleChange = React28.useCallback(
|
|
3157
|
+
(e) => {
|
|
3158
|
+
if (!isControlled) {
|
|
3159
|
+
setInternalChecked(e.target.checked);
|
|
3160
|
+
}
|
|
3161
|
+
onChange?.(e);
|
|
3162
|
+
},
|
|
3163
|
+
[isControlled, onChange]
|
|
3164
|
+
);
|
|
3165
|
+
const handleFocus = React28.useCallback(
|
|
3166
|
+
(e) => {
|
|
3167
|
+
setIsFocused(true);
|
|
3168
|
+
onFocus?.(e);
|
|
3169
|
+
},
|
|
3170
|
+
[onFocus]
|
|
3171
|
+
);
|
|
3172
|
+
const handleBlur = React28.useCallback(
|
|
3173
|
+
(e) => {
|
|
3174
|
+
setIsFocused(false);
|
|
3175
|
+
onBlur?.(e);
|
|
3176
|
+
},
|
|
3177
|
+
[onBlur]
|
|
3178
|
+
);
|
|
3179
|
+
const iconColor = isDisabled ? "text-icon-inactive-subtle" : "text-icon-primary-inverse";
|
|
3180
|
+
const indicator = /* @__PURE__ */ jsxs20("span", { className: "relative size-5 shrink-0", children: [
|
|
3181
|
+
isFocused && !isDisabled && /* @__PURE__ */ jsx29("span", { className: "pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-4 rounded-xs border-2 border-focused" }),
|
|
3182
|
+
/* @__PURE__ */ jsx29(
|
|
3183
|
+
"span",
|
|
3184
|
+
{
|
|
3185
|
+
className: cn(
|
|
3186
|
+
"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-4 rounded-xs transition-colors",
|
|
3187
|
+
isDisabled ? "bg-inactive-subtle border border-inactive" : isActive ? "bg-brand group-hover/checkbox:bg-brand-hover" : cn(
|
|
3188
|
+
"bg-primary border",
|
|
3189
|
+
isFocused ? "border-brand" : "border-strong"
|
|
3190
|
+
)
|
|
3191
|
+
)
|
|
3192
|
+
}
|
|
3193
|
+
),
|
|
3194
|
+
isActive && (indeterminate ? /* @__PURE__ */ jsx29(IndeterminateSvg, { className: iconColor }) : /* @__PURE__ */ jsx29(CheckSvg, { className: iconColor }))
|
|
3195
|
+
] });
|
|
3196
|
+
const labelContent = label ? /* @__PURE__ */ jsxs20(
|
|
3197
|
+
"span",
|
|
3198
|
+
{
|
|
3199
|
+
className: cn("flex min-w-0 flex-col", supportText && "gap-xxs"),
|
|
3200
|
+
children: [
|
|
3201
|
+
/* @__PURE__ */ jsx29(
|
|
3202
|
+
"span",
|
|
3203
|
+
{
|
|
3204
|
+
className: cn(
|
|
3205
|
+
"text-sm font-medium leading-4",
|
|
3206
|
+
isDisabled ? "text-inactive" : "text-primary"
|
|
3207
|
+
),
|
|
3208
|
+
children: label
|
|
3209
|
+
}
|
|
3210
|
+
),
|
|
3211
|
+
supportText && /* @__PURE__ */ jsx29(
|
|
3212
|
+
"span",
|
|
3213
|
+
{
|
|
3214
|
+
className: cn(
|
|
3215
|
+
"text-sm leading-5",
|
|
3216
|
+
isDisabled ? "text-inactive" : "text-secondary"
|
|
3217
|
+
),
|
|
3218
|
+
children: supportText
|
|
3219
|
+
}
|
|
3220
|
+
)
|
|
3221
|
+
]
|
|
3222
|
+
}
|
|
3223
|
+
) : null;
|
|
3224
|
+
return /* @__PURE__ */ jsxs20(
|
|
3225
|
+
"label",
|
|
3226
|
+
{
|
|
3227
|
+
className: cn(
|
|
3228
|
+
"group/checkbox inline-flex gap-md",
|
|
3229
|
+
supportText ? "items-start" : "items-center",
|
|
3230
|
+
isDisabled ? "cursor-default" : "cursor-pointer",
|
|
3231
|
+
className
|
|
3232
|
+
),
|
|
3233
|
+
children: [
|
|
3234
|
+
/* @__PURE__ */ jsx29(
|
|
3235
|
+
"input",
|
|
3236
|
+
{
|
|
3237
|
+
ref: mergedRef,
|
|
3238
|
+
id: inputId,
|
|
3239
|
+
type: "checkbox",
|
|
3240
|
+
className: "sr-only",
|
|
3241
|
+
checked,
|
|
3242
|
+
defaultChecked,
|
|
3243
|
+
disabled,
|
|
3244
|
+
"aria-checked": indeterminate ? "mixed" : void 0,
|
|
3245
|
+
onChange: handleChange,
|
|
3246
|
+
onFocus: handleFocus,
|
|
3247
|
+
onBlur: handleBlur,
|
|
3248
|
+
...props
|
|
3249
|
+
}
|
|
3250
|
+
),
|
|
3251
|
+
checkboxPosition === "leading" ? /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
3252
|
+
indicator,
|
|
3253
|
+
labelContent
|
|
3254
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
3255
|
+
labelContent,
|
|
3256
|
+
indicator
|
|
3257
|
+
] })
|
|
3258
|
+
]
|
|
3259
|
+
}
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
);
|
|
3263
|
+
Checkbox.displayName = "Checkbox";
|
|
3264
|
+
|
|
3265
|
+
// src/components/checkbox-card.tsx
|
|
3266
|
+
import * as React29 from "react";
|
|
3267
|
+
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3268
|
+
function CheckSvg2({ className }) {
|
|
3269
|
+
return /* @__PURE__ */ jsx30(
|
|
3270
|
+
"svg",
|
|
3271
|
+
{
|
|
3272
|
+
width: "12",
|
|
3273
|
+
height: "12",
|
|
3274
|
+
viewBox: "0 0 12 12",
|
|
3275
|
+
fill: "none",
|
|
3276
|
+
className: cn(
|
|
3277
|
+
"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
3278
|
+
className
|
|
3279
|
+
),
|
|
3280
|
+
"aria-hidden": "true",
|
|
3281
|
+
children: /* @__PURE__ */ jsx30(
|
|
3282
|
+
"path",
|
|
3283
|
+
{
|
|
3284
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
3285
|
+
stroke: "currentColor",
|
|
3286
|
+
strokeWidth: "2",
|
|
3287
|
+
strokeLinecap: "round",
|
|
3288
|
+
strokeLinejoin: "round"
|
|
3289
|
+
}
|
|
3290
|
+
)
|
|
3291
|
+
}
|
|
3292
|
+
);
|
|
3293
|
+
}
|
|
3294
|
+
function IndeterminateSvg2({ className }) {
|
|
3295
|
+
return /* @__PURE__ */ jsx30(
|
|
3296
|
+
"svg",
|
|
3297
|
+
{
|
|
3298
|
+
width: "12",
|
|
3299
|
+
height: "12",
|
|
3300
|
+
viewBox: "0 0 12 12",
|
|
3301
|
+
fill: "none",
|
|
3302
|
+
className: cn(
|
|
3303
|
+
"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
3304
|
+
className
|
|
3305
|
+
),
|
|
3306
|
+
"aria-hidden": "true",
|
|
3307
|
+
children: /* @__PURE__ */ jsx30(
|
|
3308
|
+
"path",
|
|
3309
|
+
{
|
|
3310
|
+
d: "M2.5 6H9.5",
|
|
3311
|
+
stroke: "currentColor",
|
|
3312
|
+
strokeWidth: "2",
|
|
3313
|
+
strokeLinecap: "round"
|
|
3314
|
+
}
|
|
3315
|
+
)
|
|
3316
|
+
}
|
|
3317
|
+
);
|
|
3318
|
+
}
|
|
3319
|
+
var CheckboxCard = React29.forwardRef(
|
|
3320
|
+
({
|
|
3321
|
+
className,
|
|
3322
|
+
label,
|
|
3323
|
+
description,
|
|
3324
|
+
icon,
|
|
3325
|
+
iconVariant,
|
|
3326
|
+
iconFilled,
|
|
3327
|
+
checkboxPosition = "trailing",
|
|
3328
|
+
indeterminate = false,
|
|
3329
|
+
checked,
|
|
3330
|
+
defaultChecked,
|
|
3331
|
+
disabled,
|
|
3332
|
+
onChange,
|
|
3333
|
+
onFocus,
|
|
3334
|
+
onBlur,
|
|
3335
|
+
id,
|
|
3336
|
+
...props
|
|
3337
|
+
}, ref) => {
|
|
3338
|
+
const [isFocused, setIsFocused] = React29.useState(false);
|
|
3339
|
+
const [internalChecked, setInternalChecked] = React29.useState(
|
|
3340
|
+
defaultChecked ?? false
|
|
3341
|
+
);
|
|
3342
|
+
const internalRef = React29.useRef(null);
|
|
3343
|
+
const inputId = id || React29.useId();
|
|
3344
|
+
const mergedRef = React29.useCallback(
|
|
3345
|
+
(node) => {
|
|
3346
|
+
internalRef.current = node;
|
|
3347
|
+
if (typeof ref === "function") {
|
|
3348
|
+
ref(node);
|
|
3349
|
+
} else if (ref) {
|
|
3350
|
+
ref.current = node;
|
|
3351
|
+
}
|
|
3352
|
+
},
|
|
3353
|
+
[ref]
|
|
3354
|
+
);
|
|
3355
|
+
React29.useEffect(() => {
|
|
3356
|
+
if (internalRef.current) {
|
|
3357
|
+
internalRef.current.indeterminate = indeterminate;
|
|
3358
|
+
}
|
|
3359
|
+
}, [indeterminate]);
|
|
3360
|
+
const isControlled = checked !== void 0;
|
|
3361
|
+
const isChecked = isControlled ? !!checked : internalChecked;
|
|
3362
|
+
const isActive = indeterminate || isChecked;
|
|
3363
|
+
const isDisabled = !!disabled;
|
|
3364
|
+
const handleChange = React29.useCallback(
|
|
3365
|
+
(e) => {
|
|
3366
|
+
if (!isControlled) {
|
|
3367
|
+
setInternalChecked(e.target.checked);
|
|
3368
|
+
}
|
|
3369
|
+
onChange?.(e);
|
|
3370
|
+
},
|
|
3371
|
+
[isControlled, onChange]
|
|
3372
|
+
);
|
|
3373
|
+
const handleFocus = React29.useCallback(
|
|
3374
|
+
(e) => {
|
|
3375
|
+
setIsFocused(true);
|
|
3376
|
+
onFocus?.(e);
|
|
3377
|
+
},
|
|
3378
|
+
[onFocus]
|
|
3379
|
+
);
|
|
3380
|
+
const handleBlur = React29.useCallback(
|
|
3381
|
+
(e) => {
|
|
3382
|
+
setIsFocused(false);
|
|
3383
|
+
onBlur?.(e);
|
|
3384
|
+
},
|
|
3385
|
+
[onBlur]
|
|
3386
|
+
);
|
|
3387
|
+
const checkIconColor = isDisabled ? "text-icon-inactive-subtle" : "text-icon-primary-inverse";
|
|
3388
|
+
const checkboxIndicator = /* @__PURE__ */ jsxs21("span", { className: "relative size-5 shrink-0", children: [
|
|
3389
|
+
/* @__PURE__ */ jsx30(
|
|
3390
|
+
"span",
|
|
3391
|
+
{
|
|
3392
|
+
className: cn(
|
|
3393
|
+
"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-4 rounded-xs transition-colors",
|
|
3394
|
+
isDisabled ? "bg-inactive-subtle border border-inactive" : isActive ? "bg-brand" : "bg-primary border border-strong"
|
|
3395
|
+
)
|
|
3396
|
+
}
|
|
3397
|
+
),
|
|
3398
|
+
isActive && (indeterminate ? /* @__PURE__ */ jsx30(IndeterminateSvg2, { className: checkIconColor }) : /* @__PURE__ */ jsx30(CheckSvg2, { className: checkIconColor }))
|
|
3399
|
+
] });
|
|
3400
|
+
const iconElement = icon ? /* @__PURE__ */ jsx30(
|
|
3401
|
+
Icon,
|
|
3402
|
+
{
|
|
3403
|
+
name: icon,
|
|
3404
|
+
size: "lg",
|
|
3405
|
+
variant: iconVariant,
|
|
3406
|
+
filled: iconFilled,
|
|
3407
|
+
className: isDisabled ? "text-icon-inactive" : "text-icon-secondary",
|
|
3408
|
+
"aria-hidden": true
|
|
3409
|
+
}
|
|
3410
|
+
) : null;
|
|
3411
|
+
const textContent = /* @__PURE__ */ jsxs21(
|
|
3412
|
+
"div",
|
|
3413
|
+
{
|
|
3414
|
+
className: cn(
|
|
3415
|
+
"flex min-w-0 flex-1 flex-col",
|
|
3416
|
+
description && "gap-xs"
|
|
3417
|
+
),
|
|
3418
|
+
children: [
|
|
3419
|
+
/* @__PURE__ */ jsx30(
|
|
3420
|
+
"span",
|
|
3421
|
+
{
|
|
3422
|
+
className: cn(
|
|
3423
|
+
"font-medium",
|
|
3424
|
+
description ? "text-sm leading-4" : "text-base leading-5",
|
|
3425
|
+
isDisabled ? "text-inactive" : "text-primary"
|
|
3426
|
+
),
|
|
3427
|
+
children: label
|
|
3428
|
+
}
|
|
3429
|
+
),
|
|
3430
|
+
description && /* @__PURE__ */ jsx30(
|
|
3431
|
+
"span",
|
|
3432
|
+
{
|
|
3433
|
+
className: cn(
|
|
3434
|
+
"text-sm leading-5",
|
|
3435
|
+
isDisabled ? "text-inactive" : "text-secondary"
|
|
3436
|
+
),
|
|
3437
|
+
children: description
|
|
3438
|
+
}
|
|
3439
|
+
)
|
|
3440
|
+
]
|
|
3441
|
+
}
|
|
3442
|
+
);
|
|
3443
|
+
const cardClasses = cn(
|
|
3444
|
+
"relative flex rounded-md p-lg border transition-colors",
|
|
3445
|
+
checkboxPosition === "leading" ? "gap-md" : "gap-lg",
|
|
3446
|
+
!description && checkboxPosition === "leading" ? "items-center" : "items-start",
|
|
3447
|
+
isDisabled ? "bg-inactive-subtle border-inactive-subtle cursor-default" : isActive ? "bg-primary border-brand cursor-pointer" : "bg-primary border-default hover:bg-highlight-hover cursor-pointer",
|
|
3448
|
+
className
|
|
3449
|
+
);
|
|
3450
|
+
return /* @__PURE__ */ jsxs21("label", { className: cardClasses, children: [
|
|
3451
|
+
/* @__PURE__ */ jsx30(
|
|
3452
|
+
"input",
|
|
3453
|
+
{
|
|
3454
|
+
ref: mergedRef,
|
|
3455
|
+
id: inputId,
|
|
3456
|
+
type: "checkbox",
|
|
3457
|
+
className: "sr-only",
|
|
3458
|
+
checked,
|
|
3459
|
+
defaultChecked,
|
|
3460
|
+
disabled,
|
|
3461
|
+
"aria-checked": indeterminate ? "mixed" : void 0,
|
|
3462
|
+
onChange: handleChange,
|
|
3463
|
+
onFocus: handleFocus,
|
|
3464
|
+
onBlur: handleBlur,
|
|
3465
|
+
...props
|
|
3466
|
+
}
|
|
3467
|
+
),
|
|
3468
|
+
(isActive || isFocused) && !isDisabled && /* @__PURE__ */ jsx30("span", { className: "pointer-events-none absolute inset-[-1px] rounded-md border-2 border-focused" }),
|
|
3469
|
+
checkboxPosition === "leading" ? /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3470
|
+
checkboxIndicator,
|
|
3471
|
+
iconElement && /* @__PURE__ */ jsxs21("div", { className: "flex flex-1 items-start gap-md", children: [
|
|
3472
|
+
iconElement,
|
|
3473
|
+
textContent
|
|
3474
|
+
] }),
|
|
3475
|
+
!iconElement && textContent
|
|
3476
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3477
|
+
iconElement ? /* @__PURE__ */ jsxs21("div", { className: "flex min-w-0 flex-1 items-start gap-md", children: [
|
|
3478
|
+
iconElement,
|
|
3479
|
+
textContent
|
|
3480
|
+
] }) : textContent,
|
|
3481
|
+
checkboxIndicator
|
|
3482
|
+
] })
|
|
3483
|
+
] });
|
|
3484
|
+
}
|
|
3485
|
+
);
|
|
3486
|
+
CheckboxCard.displayName = "CheckboxCard";
|
|
3487
|
+
|
|
3488
|
+
// src/components/radio.tsx
|
|
3489
|
+
import * as React30 from "react";
|
|
3490
|
+
import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3491
|
+
function RadioDot({ className }) {
|
|
3492
|
+
return /* @__PURE__ */ jsx31(
|
|
3493
|
+
"svg",
|
|
3494
|
+
{
|
|
3495
|
+
width: "12",
|
|
3496
|
+
height: "12",
|
|
3497
|
+
viewBox: "0 0 12 12",
|
|
3498
|
+
fill: "none",
|
|
3499
|
+
className: cn(
|
|
3500
|
+
"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
3501
|
+
className
|
|
3502
|
+
),
|
|
3503
|
+
"aria-hidden": "true",
|
|
3504
|
+
children: /* @__PURE__ */ jsx31("circle", { cx: "6", cy: "6", r: "3", fill: "currentColor" })
|
|
3505
|
+
}
|
|
3506
|
+
);
|
|
3507
|
+
}
|
|
3508
|
+
var Radio = React30.forwardRef(
|
|
3509
|
+
({
|
|
3510
|
+
className,
|
|
3511
|
+
label,
|
|
3512
|
+
supportText,
|
|
3513
|
+
radioPosition = "leading",
|
|
3514
|
+
checked,
|
|
3515
|
+
defaultChecked,
|
|
3516
|
+
disabled,
|
|
3517
|
+
onChange,
|
|
3518
|
+
onFocus,
|
|
3519
|
+
onBlur,
|
|
3520
|
+
id,
|
|
3521
|
+
name,
|
|
3522
|
+
value,
|
|
3523
|
+
...props
|
|
3524
|
+
}, ref) => {
|
|
3525
|
+
const [isFocused, setIsFocused] = React30.useState(false);
|
|
3526
|
+
const [internalChecked, setInternalChecked] = React30.useState(
|
|
3527
|
+
defaultChecked ?? false
|
|
3528
|
+
);
|
|
3529
|
+
const internalRef = React30.useRef(null);
|
|
3530
|
+
const inputId = id || React30.useId();
|
|
3531
|
+
const mergedRef = React30.useCallback(
|
|
3532
|
+
(node) => {
|
|
3533
|
+
internalRef.current = node;
|
|
3534
|
+
if (typeof ref === "function") {
|
|
3535
|
+
ref(node);
|
|
3536
|
+
} else if (ref) {
|
|
3537
|
+
ref.current = node;
|
|
3538
|
+
}
|
|
3539
|
+
},
|
|
3540
|
+
[ref]
|
|
3541
|
+
);
|
|
3542
|
+
const isControlled = checked !== void 0;
|
|
3543
|
+
const isChecked = isControlled ? !!checked : internalChecked;
|
|
3544
|
+
const isDisabled = !!disabled;
|
|
3545
|
+
const handleChange = React30.useCallback(
|
|
3546
|
+
(e) => {
|
|
3547
|
+
if (!isControlled) {
|
|
3548
|
+
setInternalChecked(e.target.checked);
|
|
3549
|
+
}
|
|
3550
|
+
onChange?.(e);
|
|
3551
|
+
},
|
|
3552
|
+
[isControlled, onChange]
|
|
3553
|
+
);
|
|
3554
|
+
const handleFocus = React30.useCallback(
|
|
3555
|
+
(e) => {
|
|
3556
|
+
setIsFocused(true);
|
|
3557
|
+
onFocus?.(e);
|
|
3558
|
+
},
|
|
3559
|
+
[onFocus]
|
|
3560
|
+
);
|
|
3561
|
+
const handleBlur = React30.useCallback(
|
|
3562
|
+
(e) => {
|
|
3563
|
+
setIsFocused(false);
|
|
3564
|
+
onBlur?.(e);
|
|
3565
|
+
},
|
|
3566
|
+
[onBlur]
|
|
3567
|
+
);
|
|
3568
|
+
const iconColor = isDisabled ? "text-icon-inactive-subtle" : "text-icon-primary-inverse";
|
|
3569
|
+
const indicator = /* @__PURE__ */ jsxs22("span", { className: "relative size-5 shrink-0", children: [
|
|
3570
|
+
isFocused && !isDisabled && /* @__PURE__ */ jsx31("span", { className: "pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-4 rounded-full border-2 border-focused" }),
|
|
3571
|
+
/* @__PURE__ */ jsx31(
|
|
3572
|
+
"span",
|
|
3573
|
+
{
|
|
3574
|
+
className: cn(
|
|
3575
|
+
"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-4 rounded-full transition-colors",
|
|
3576
|
+
isDisabled ? "bg-inactive-subtle border border-inactive" : isChecked ? "bg-brand group-hover/radio:bg-brand-hover" : cn(
|
|
3577
|
+
"bg-primary border",
|
|
3578
|
+
isFocused ? "border-brand" : "border-strong"
|
|
3579
|
+
)
|
|
3580
|
+
)
|
|
3581
|
+
}
|
|
3582
|
+
),
|
|
3583
|
+
isChecked && /* @__PURE__ */ jsx31(RadioDot, { className: iconColor })
|
|
3584
|
+
] });
|
|
3585
|
+
const labelContent = label ? /* @__PURE__ */ jsxs22(
|
|
3586
|
+
"span",
|
|
3587
|
+
{
|
|
3588
|
+
className: cn("flex min-w-0 flex-col", supportText && "gap-xxs"),
|
|
3589
|
+
children: [
|
|
3590
|
+
/* @__PURE__ */ jsx31(
|
|
3591
|
+
"span",
|
|
3592
|
+
{
|
|
3593
|
+
className: cn(
|
|
3594
|
+
"text-sm font-medium leading-4",
|
|
3595
|
+
isDisabled ? "text-inactive" : "text-primary"
|
|
3596
|
+
),
|
|
3597
|
+
children: label
|
|
3598
|
+
}
|
|
3599
|
+
),
|
|
3600
|
+
supportText && /* @__PURE__ */ jsx31(
|
|
3601
|
+
"span",
|
|
3602
|
+
{
|
|
3603
|
+
className: cn(
|
|
3604
|
+
"text-sm leading-5",
|
|
3605
|
+
isDisabled ? "text-inactive" : "text-secondary"
|
|
3606
|
+
),
|
|
3607
|
+
children: supportText
|
|
3608
|
+
}
|
|
3609
|
+
)
|
|
3610
|
+
]
|
|
3611
|
+
}
|
|
3612
|
+
) : null;
|
|
3613
|
+
return /* @__PURE__ */ jsxs22(
|
|
3614
|
+
"label",
|
|
3615
|
+
{
|
|
3616
|
+
className: cn(
|
|
3617
|
+
"group/radio inline-flex gap-md",
|
|
3618
|
+
supportText ? "items-start" : "items-center",
|
|
3619
|
+
isDisabled ? "cursor-default" : "cursor-pointer",
|
|
3620
|
+
className
|
|
3621
|
+
),
|
|
3622
|
+
children: [
|
|
3623
|
+
/* @__PURE__ */ jsx31(
|
|
3624
|
+
"input",
|
|
3625
|
+
{
|
|
3626
|
+
ref: mergedRef,
|
|
3627
|
+
id: inputId,
|
|
3628
|
+
type: "radio",
|
|
3629
|
+
className: "sr-only",
|
|
3630
|
+
checked,
|
|
3631
|
+
defaultChecked,
|
|
3632
|
+
disabled,
|
|
3633
|
+
name,
|
|
3634
|
+
value,
|
|
3635
|
+
onChange: handleChange,
|
|
3636
|
+
onFocus: handleFocus,
|
|
3637
|
+
onBlur: handleBlur,
|
|
3638
|
+
...props
|
|
3639
|
+
}
|
|
3640
|
+
),
|
|
3641
|
+
radioPosition === "leading" ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
3642
|
+
indicator,
|
|
3643
|
+
labelContent
|
|
3644
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
3645
|
+
labelContent,
|
|
3646
|
+
indicator
|
|
3647
|
+
] })
|
|
3648
|
+
]
|
|
3649
|
+
}
|
|
3650
|
+
);
|
|
3651
|
+
}
|
|
3652
|
+
);
|
|
3653
|
+
Radio.displayName = "Radio";
|
|
3654
|
+
|
|
3655
|
+
// src/components/radio-card.tsx
|
|
3656
|
+
import * as React31 from "react";
|
|
3657
|
+
import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3658
|
+
function RadioDotSvg({ className }) {
|
|
3659
|
+
return /* @__PURE__ */ jsx32(
|
|
3660
|
+
"svg",
|
|
3661
|
+
{
|
|
3662
|
+
width: "12",
|
|
3663
|
+
height: "12",
|
|
3664
|
+
viewBox: "0 0 12 12",
|
|
3665
|
+
fill: "none",
|
|
3666
|
+
className: cn(
|
|
3667
|
+
"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
3668
|
+
className
|
|
3669
|
+
),
|
|
3670
|
+
"aria-hidden": "true",
|
|
3671
|
+
children: /* @__PURE__ */ jsx32("circle", { cx: "6", cy: "6", r: "3", fill: "currentColor" })
|
|
3672
|
+
}
|
|
3673
|
+
);
|
|
3674
|
+
}
|
|
3675
|
+
var RadioCard = React31.forwardRef(
|
|
3676
|
+
({
|
|
3677
|
+
className,
|
|
3678
|
+
label,
|
|
3679
|
+
description,
|
|
3680
|
+
icon,
|
|
3681
|
+
iconVariant,
|
|
3682
|
+
iconFilled,
|
|
3683
|
+
radioPosition = "trailing",
|
|
3684
|
+
checked,
|
|
3685
|
+
defaultChecked,
|
|
3686
|
+
disabled,
|
|
3687
|
+
onChange,
|
|
3688
|
+
onFocus,
|
|
3689
|
+
onBlur,
|
|
3690
|
+
id,
|
|
3691
|
+
name,
|
|
3692
|
+
value,
|
|
3693
|
+
...props
|
|
3694
|
+
}, ref) => {
|
|
3695
|
+
const [isFocused, setIsFocused] = React31.useState(false);
|
|
3696
|
+
const [internalChecked, setInternalChecked] = React31.useState(
|
|
3697
|
+
defaultChecked ?? false
|
|
3698
|
+
);
|
|
3699
|
+
const internalRef = React31.useRef(null);
|
|
3700
|
+
const inputId = id || React31.useId();
|
|
3701
|
+
const mergedRef = React31.useCallback(
|
|
3702
|
+
(node) => {
|
|
3703
|
+
internalRef.current = node;
|
|
3704
|
+
if (typeof ref === "function") {
|
|
3705
|
+
ref(node);
|
|
3706
|
+
} else if (ref) {
|
|
3707
|
+
ref.current = node;
|
|
3708
|
+
}
|
|
3709
|
+
},
|
|
3710
|
+
[ref]
|
|
3711
|
+
);
|
|
3712
|
+
const isControlled = checked !== void 0;
|
|
3713
|
+
const isChecked = isControlled ? !!checked : internalChecked;
|
|
3714
|
+
const isDisabled = !!disabled;
|
|
3715
|
+
const handleChange = React31.useCallback(
|
|
3716
|
+
(e) => {
|
|
3717
|
+
if (!isControlled) {
|
|
3718
|
+
setInternalChecked(e.target.checked);
|
|
3719
|
+
}
|
|
3720
|
+
onChange?.(e);
|
|
3721
|
+
},
|
|
3722
|
+
[isControlled, onChange]
|
|
3723
|
+
);
|
|
3724
|
+
const handleFocus = React31.useCallback(
|
|
3725
|
+
(e) => {
|
|
3726
|
+
setIsFocused(true);
|
|
3727
|
+
onFocus?.(e);
|
|
3728
|
+
},
|
|
3729
|
+
[onFocus]
|
|
3730
|
+
);
|
|
3731
|
+
const handleBlur = React31.useCallback(
|
|
3732
|
+
(e) => {
|
|
3733
|
+
setIsFocused(false);
|
|
3734
|
+
onBlur?.(e);
|
|
3735
|
+
},
|
|
3736
|
+
[onBlur]
|
|
3737
|
+
);
|
|
3738
|
+
const radioDotColor = isDisabled ? "text-icon-inactive-subtle" : "text-icon-primary-inverse";
|
|
3739
|
+
const radioIndicator = /* @__PURE__ */ jsxs23("span", { className: "relative size-5 shrink-0", children: [
|
|
3740
|
+
/* @__PURE__ */ jsx32(
|
|
3741
|
+
"span",
|
|
3742
|
+
{
|
|
3743
|
+
className: cn(
|
|
3744
|
+
"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-4 rounded-full transition-colors",
|
|
3745
|
+
isDisabled ? "bg-inactive-subtle border border-inactive" : isChecked ? "bg-brand" : "bg-primary border border-strong"
|
|
3746
|
+
)
|
|
3747
|
+
}
|
|
3748
|
+
),
|
|
3749
|
+
isChecked && /* @__PURE__ */ jsx32(RadioDotSvg, { className: radioDotColor })
|
|
3750
|
+
] });
|
|
3751
|
+
const iconElement = icon ? /* @__PURE__ */ jsx32(
|
|
3752
|
+
Icon,
|
|
3753
|
+
{
|
|
3754
|
+
name: icon,
|
|
3755
|
+
size: "lg",
|
|
3756
|
+
variant: iconVariant,
|
|
3757
|
+
filled: iconFilled,
|
|
3758
|
+
className: isDisabled ? "text-icon-inactive" : "text-icon-secondary",
|
|
3759
|
+
"aria-hidden": true
|
|
3760
|
+
}
|
|
3761
|
+
) : null;
|
|
3762
|
+
const textContent = /* @__PURE__ */ jsxs23(
|
|
3763
|
+
"div",
|
|
3764
|
+
{
|
|
3765
|
+
className: cn(
|
|
3766
|
+
"flex min-w-0 flex-1 flex-col",
|
|
3767
|
+
description && "gap-xs"
|
|
3768
|
+
),
|
|
3769
|
+
children: [
|
|
3770
|
+
/* @__PURE__ */ jsx32(
|
|
3771
|
+
"span",
|
|
3772
|
+
{
|
|
3773
|
+
className: cn(
|
|
3774
|
+
"font-medium",
|
|
3775
|
+
description ? "text-sm leading-4" : "text-base leading-5",
|
|
3776
|
+
isDisabled ? "text-inactive" : "text-primary"
|
|
3777
|
+
),
|
|
3778
|
+
children: label
|
|
3779
|
+
}
|
|
3780
|
+
),
|
|
3781
|
+
description && /* @__PURE__ */ jsx32(
|
|
3782
|
+
"span",
|
|
3783
|
+
{
|
|
3784
|
+
className: cn(
|
|
3785
|
+
"text-sm leading-5",
|
|
3786
|
+
isDisabled ? "text-inactive" : "text-secondary"
|
|
3787
|
+
),
|
|
3788
|
+
children: description
|
|
3789
|
+
}
|
|
3790
|
+
)
|
|
3791
|
+
]
|
|
3792
|
+
}
|
|
3793
|
+
);
|
|
3794
|
+
const cardClasses = cn(
|
|
3795
|
+
"relative flex rounded-md p-lg border transition-colors",
|
|
3796
|
+
radioPosition === "leading" ? "gap-md" : "gap-lg",
|
|
3797
|
+
!description && radioPosition === "leading" ? "items-center" : "items-start",
|
|
3798
|
+
isDisabled ? "bg-inactive-subtle border-inactive-subtle cursor-default" : isChecked ? "bg-primary border-brand cursor-pointer" : "bg-primary border-default hover:bg-highlight-hover cursor-pointer",
|
|
3799
|
+
className
|
|
3800
|
+
);
|
|
3801
|
+
return /* @__PURE__ */ jsxs23("label", { className: cardClasses, children: [
|
|
3802
|
+
/* @__PURE__ */ jsx32(
|
|
3803
|
+
"input",
|
|
3804
|
+
{
|
|
3805
|
+
ref: mergedRef,
|
|
3806
|
+
id: inputId,
|
|
3807
|
+
type: "radio",
|
|
3808
|
+
className: "sr-only",
|
|
3809
|
+
checked,
|
|
3810
|
+
defaultChecked,
|
|
3811
|
+
disabled,
|
|
3812
|
+
name,
|
|
3813
|
+
value,
|
|
3814
|
+
onChange: handleChange,
|
|
3815
|
+
onFocus: handleFocus,
|
|
3816
|
+
onBlur: handleBlur,
|
|
3817
|
+
...props
|
|
3818
|
+
}
|
|
3819
|
+
),
|
|
3820
|
+
(isChecked || isFocused) && !isDisabled && /* @__PURE__ */ jsx32("span", { className: "pointer-events-none absolute inset-[-1px] rounded-md border-2 border-focused" }),
|
|
3821
|
+
radioPosition === "leading" ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
3822
|
+
radioIndicator,
|
|
3823
|
+
iconElement && /* @__PURE__ */ jsxs23("div", { className: "flex flex-1 items-start gap-md", children: [
|
|
3824
|
+
iconElement,
|
|
3825
|
+
textContent
|
|
3826
|
+
] }),
|
|
3827
|
+
!iconElement && textContent
|
|
3828
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
3829
|
+
iconElement ? /* @__PURE__ */ jsxs23("div", { className: "flex min-w-0 flex-1 items-start gap-md", children: [
|
|
3830
|
+
iconElement,
|
|
3831
|
+
textContent
|
|
3832
|
+
] }) : textContent,
|
|
3833
|
+
radioIndicator
|
|
3834
|
+
] })
|
|
3835
|
+
] });
|
|
3836
|
+
}
|
|
3837
|
+
);
|
|
3838
|
+
RadioCard.displayName = "RadioCard";
|
|
3839
|
+
|
|
3840
|
+
// src/components/tag.tsx
|
|
3841
|
+
import * as React32 from "react";
|
|
3842
|
+
import { cva as cva27 } from "class-variance-authority";
|
|
3843
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3844
|
+
var tagVariants = cva27(
|
|
3845
|
+
"inline-flex items-center justify-center rounded-sm font-regular shrink-0 gap-1 border transition-colors",
|
|
3846
|
+
{
|
|
3847
|
+
variants: {
|
|
3848
|
+
type: {
|
|
3849
|
+
simple: "",
|
|
3850
|
+
"with-dot": "",
|
|
3851
|
+
"with-icon": ""
|
|
3852
|
+
},
|
|
3853
|
+
state: {
|
|
3854
|
+
default: "bg-primary border-strong text-primary hover:bg-highlight-hover",
|
|
3855
|
+
focus: "bg-primary border-brand text-brand",
|
|
3856
|
+
active: "bg-brand-tertiary border-brand text-primary",
|
|
3857
|
+
disabled: "bg-secondary border-inactive-subtle text-inactive pointer-events-none"
|
|
3858
|
+
},
|
|
3859
|
+
size: {
|
|
3860
|
+
small: "h-6 px-sm text-xs leading-4",
|
|
3861
|
+
large: "h-7 px-md text-sm leading-5"
|
|
3862
|
+
}
|
|
3863
|
+
},
|
|
3864
|
+
compoundVariants: [
|
|
3865
|
+
{
|
|
3866
|
+
state: "disabled",
|
|
3867
|
+
className: "hover:bg-secondary hover:border-inactive-subtle"
|
|
3868
|
+
},
|
|
3869
|
+
{
|
|
3870
|
+
state: "active",
|
|
3871
|
+
className: "hover:bg-brand-tertiary hover:border-brand"
|
|
3872
|
+
}
|
|
3873
|
+
],
|
|
3874
|
+
defaultVariants: {
|
|
3875
|
+
type: "simple",
|
|
3876
|
+
state: "default",
|
|
3877
|
+
size: "small"
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
);
|
|
3881
|
+
var tagSizeToIconSize = {
|
|
3882
|
+
small: "xs",
|
|
3883
|
+
large: "sm"
|
|
3884
|
+
};
|
|
3885
|
+
var Tag = React32.forwardRef(
|
|
3886
|
+
({
|
|
3887
|
+
className,
|
|
3888
|
+
type = "simple",
|
|
3889
|
+
state = "default",
|
|
3890
|
+
size = "small",
|
|
3891
|
+
leftIcon,
|
|
3892
|
+
iconVariant,
|
|
3893
|
+
iconFilled,
|
|
3894
|
+
close,
|
|
3895
|
+
onClose,
|
|
3896
|
+
children,
|
|
3897
|
+
...props
|
|
3898
|
+
}, ref) => {
|
|
3899
|
+
const iconSize = tagSizeToIconSize[size ?? "small"];
|
|
3900
|
+
const isDisabled = state === "disabled";
|
|
3901
|
+
const isActive = state === "active";
|
|
3902
|
+
const isDefault = state === "default" || !state;
|
|
3903
|
+
const dotColor = (isDefault || isActive) && !isDisabled ? "bg-success" : "bg-current";
|
|
3904
|
+
const iconColor = isDisabled ? "text-inactive" : isActive ? "text-brand" : state === "focus" ? "text-brand" : "text-primary";
|
|
3905
|
+
const dotElement = type === "with-dot" ? /* @__PURE__ */ jsx33(
|
|
3906
|
+
"span",
|
|
3907
|
+
{
|
|
3908
|
+
className: cn(
|
|
3909
|
+
"inline-block size-1.5 rounded-full shrink-0",
|
|
3910
|
+
dotColor
|
|
3911
|
+
),
|
|
3912
|
+
"aria-hidden": "true"
|
|
3913
|
+
}
|
|
3914
|
+
) : null;
|
|
3915
|
+
const leftIconElement = type === "with-icon" ? /* @__PURE__ */ jsx33(
|
|
3916
|
+
Icon,
|
|
3917
|
+
{
|
|
3918
|
+
name: leftIcon || "calendar_month",
|
|
3919
|
+
size: iconSize,
|
|
3920
|
+
variant: iconVariant,
|
|
3921
|
+
filled: iconFilled,
|
|
3922
|
+
className: iconColor,
|
|
3923
|
+
"aria-hidden": true
|
|
3924
|
+
}
|
|
3925
|
+
) : null;
|
|
3926
|
+
const handleCloseClick = React32.useCallback(
|
|
3927
|
+
(e) => {
|
|
3928
|
+
e.stopPropagation();
|
|
3929
|
+
if (!isDisabled && onClose) {
|
|
3930
|
+
onClose(e);
|
|
3931
|
+
}
|
|
3932
|
+
},
|
|
3933
|
+
[isDisabled, onClose]
|
|
3934
|
+
);
|
|
3935
|
+
const closeButtonElement = close ? /* @__PURE__ */ jsx33(
|
|
3936
|
+
CloseButton,
|
|
3937
|
+
{
|
|
3938
|
+
variant: "ghost",
|
|
3939
|
+
size: "sm",
|
|
3940
|
+
onClick: handleCloseClick,
|
|
3941
|
+
disabled: isDisabled,
|
|
3942
|
+
"aria-label": "Remove tag",
|
|
3943
|
+
className: iconColor,
|
|
3944
|
+
iconVariant,
|
|
3945
|
+
iconFilled
|
|
3946
|
+
}
|
|
3947
|
+
) : null;
|
|
3948
|
+
return /* @__PURE__ */ jsxs24(
|
|
3949
|
+
"span",
|
|
3950
|
+
{
|
|
3951
|
+
ref,
|
|
3952
|
+
className: cn(tagVariants({ type, state, size }), className),
|
|
3953
|
+
...props,
|
|
3954
|
+
children: [
|
|
3955
|
+
dotElement,
|
|
3956
|
+
leftIconElement,
|
|
3957
|
+
children,
|
|
3958
|
+
closeButtonElement
|
|
3959
|
+
]
|
|
3960
|
+
}
|
|
3961
|
+
);
|
|
3962
|
+
}
|
|
3963
|
+
);
|
|
3964
|
+
Tag.displayName = "Tag";
|
|
3965
|
+
|
|
3966
|
+
// src/components/slider-handle.tsx
|
|
3967
|
+
import * as React34 from "react";
|
|
3968
|
+
import { cva as cva29 } from "class-variance-authority";
|
|
3969
|
+
|
|
3970
|
+
// src/components/tooltip.tsx
|
|
3971
|
+
import * as React33 from "react";
|
|
3972
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3973
|
+
import { cva as cva28 } from "class-variance-authority";
|
|
3974
|
+
import { Fragment as Fragment8, jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3975
|
+
var tooltipContentVariants = cva28(
|
|
3976
|
+
"rounded-sm text-xs leading-5 max-w-[var(--radix-tooltip-content-available-width)] z-50 transition-opacity duration-150 ease-out data-[state=closed]:opacity-0 data-[state=open]:opacity-100",
|
|
3977
|
+
{
|
|
3978
|
+
variants: {
|
|
3979
|
+
size: {
|
|
3980
|
+
small: "px-md py-sm",
|
|
3981
|
+
large: "px-md py-md flex flex-col gap-xs"
|
|
3982
|
+
},
|
|
3983
|
+
variant: {
|
|
3984
|
+
dark: "bg-always-dark text-on-color",
|
|
3985
|
+
light: "bg-primary text-primary shadow-lg border border-default"
|
|
3986
|
+
}
|
|
3987
|
+
},
|
|
3988
|
+
defaultVariants: {
|
|
3989
|
+
size: "small",
|
|
3990
|
+
variant: "dark"
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
);
|
|
3994
|
+
var arrowClassMap = {
|
|
3995
|
+
dark: "fill-primary-inverse",
|
|
3996
|
+
light: "fill-white"
|
|
3997
|
+
};
|
|
3998
|
+
var subtitleClassMap = {
|
|
3999
|
+
dark: "text-on-color",
|
|
4000
|
+
light: "text-on-color-inverse"
|
|
4001
|
+
};
|
|
4002
|
+
var TooltipContent = React33.forwardRef(
|
|
4003
|
+
({
|
|
4004
|
+
className,
|
|
4005
|
+
size: sizeProp,
|
|
4006
|
+
variant = "dark",
|
|
4007
|
+
title,
|
|
4008
|
+
subtitle,
|
|
4009
|
+
children,
|
|
4010
|
+
side = "bottom",
|
|
4011
|
+
sideOffset = 8,
|
|
4012
|
+
showArrow = true,
|
|
4013
|
+
...props
|
|
4014
|
+
}, ref) => {
|
|
4015
|
+
const resolvedVariant = variant ?? "dark";
|
|
4016
|
+
const isLarge = sizeProp === "large" || !sizeProp && (title != null || subtitle != null);
|
|
4017
|
+
const size = isLarge ? "large" : sizeProp ?? "small";
|
|
4018
|
+
return /* @__PURE__ */ jsx34(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs25(
|
|
4019
|
+
TooltipPrimitive.Content,
|
|
4020
|
+
{
|
|
4021
|
+
ref,
|
|
4022
|
+
side,
|
|
4023
|
+
sideOffset,
|
|
4024
|
+
className: cn(tooltipContentVariants({ size, variant: resolvedVariant }), className),
|
|
4025
|
+
...props,
|
|
4026
|
+
children: [
|
|
4027
|
+
isLarge ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
4028
|
+
title != null && /* @__PURE__ */ jsx34("span", { className: "font-medium", children: title }),
|
|
4029
|
+
subtitle != null && /* @__PURE__ */ jsx34("span", { className: cn("font-regular", subtitleClassMap[resolvedVariant]), children: subtitle })
|
|
4030
|
+
] }) : children,
|
|
4031
|
+
showArrow && /* @__PURE__ */ jsx34(
|
|
4032
|
+
TooltipPrimitive.Arrow,
|
|
4033
|
+
{
|
|
4034
|
+
className: arrowClassMap[resolvedVariant],
|
|
4035
|
+
width: 12,
|
|
4036
|
+
height: 6
|
|
4037
|
+
}
|
|
4038
|
+
)
|
|
4039
|
+
]
|
|
4040
|
+
}
|
|
4041
|
+
) });
|
|
4042
|
+
}
|
|
4043
|
+
);
|
|
4044
|
+
TooltipContent.displayName = "TooltipContent";
|
|
4045
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4046
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
4047
|
+
function Tooltip({
|
|
4048
|
+
children,
|
|
4049
|
+
content,
|
|
4050
|
+
title,
|
|
4051
|
+
subtitle,
|
|
4052
|
+
size,
|
|
4053
|
+
variant = "dark",
|
|
4054
|
+
side = "bottom",
|
|
4055
|
+
sideOffset = 8,
|
|
4056
|
+
delayDuration = 200,
|
|
4057
|
+
showArrow = true,
|
|
4058
|
+
contentClassName,
|
|
4059
|
+
...rootProps
|
|
4060
|
+
}) {
|
|
4061
|
+
return /* @__PURE__ */ jsxs25(TooltipPrimitive.Root, { delayDuration, ...rootProps, children: [
|
|
4062
|
+
/* @__PURE__ */ jsx34(TooltipPrimitive.Trigger, { asChild: true, children }),
|
|
4063
|
+
/* @__PURE__ */ jsx34(
|
|
4064
|
+
TooltipContent,
|
|
4065
|
+
{
|
|
4066
|
+
size,
|
|
4067
|
+
variant,
|
|
4068
|
+
side,
|
|
4069
|
+
sideOffset,
|
|
4070
|
+
title,
|
|
4071
|
+
subtitle,
|
|
4072
|
+
showArrow,
|
|
4073
|
+
className: contentClassName,
|
|
4074
|
+
children: content
|
|
4075
|
+
}
|
|
4076
|
+
)
|
|
4077
|
+
] });
|
|
4078
|
+
}
|
|
4079
|
+
|
|
4080
|
+
// src/components/slider-handle.tsx
|
|
4081
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4082
|
+
var stateClassMap = {
|
|
4083
|
+
default: "hover:bg-primary active:bg-primary",
|
|
4084
|
+
hover: "bg-brand-tertiary pointer-events-none",
|
|
4085
|
+
active: "bg-brand-secondary pointer-events-none"
|
|
4086
|
+
};
|
|
4087
|
+
var sliderHandleCircleVariants = cva29(
|
|
4088
|
+
"size-2xl shrink-0 rounded-full border border-brand bg-primary transition-colors cursor-grab touch-none select-none hover:bg-brand-tertiary active:bg-brand-secondary active:cursor-grabbing shadow-sm"
|
|
4089
|
+
);
|
|
4090
|
+
var SliderHandle = React34.forwardRef(
|
|
4091
|
+
({
|
|
4092
|
+
className,
|
|
4093
|
+
state,
|
|
4094
|
+
valueLabel,
|
|
4095
|
+
labelVariant,
|
|
4096
|
+
labelPosition = "below",
|
|
4097
|
+
...props
|
|
4098
|
+
}, ref) => {
|
|
4099
|
+
const circle = /* @__PURE__ */ jsx35(
|
|
4100
|
+
"div",
|
|
4101
|
+
{
|
|
4102
|
+
ref,
|
|
4103
|
+
role: "img",
|
|
4104
|
+
...valueLabel != null && valueLabel !== "" ? { "aria-hidden": true } : { "aria-label": "Slider handle" },
|
|
4105
|
+
className: cn(
|
|
4106
|
+
sliderHandleCircleVariants(),
|
|
4107
|
+
state && stateClassMap[state],
|
|
4108
|
+
className
|
|
4109
|
+
),
|
|
4110
|
+
...props
|
|
4111
|
+
}
|
|
4112
|
+
);
|
|
4113
|
+
if (!valueLabel || valueLabel === "") return circle;
|
|
4114
|
+
const tooltipSide = labelPosition === "above" ? "top" : "bottom";
|
|
4115
|
+
const label = labelVariant === "label" ? /* @__PURE__ */ jsx35(
|
|
4116
|
+
"span",
|
|
4117
|
+
{
|
|
4118
|
+
className: cn(
|
|
4119
|
+
"absolute left-1/2 -translate-x-1/2 text-xs text-primary whitespace-nowrap",
|
|
4120
|
+
labelPosition === "above" ? "bottom-[calc(100%+8px)]" : "top-[calc(100%+8px)]"
|
|
4121
|
+
),
|
|
4122
|
+
children: valueLabel
|
|
4123
|
+
}
|
|
4124
|
+
) : null;
|
|
4125
|
+
const handle = labelVariant === "tooltip" ? /* @__PURE__ */ jsx35(
|
|
4126
|
+
Tooltip,
|
|
4127
|
+
{
|
|
4128
|
+
content: valueLabel,
|
|
4129
|
+
variant: "light",
|
|
4130
|
+
side: tooltipSide,
|
|
4131
|
+
sideOffset: 8,
|
|
4132
|
+
open: true,
|
|
4133
|
+
showArrow: false,
|
|
4134
|
+
children: circle
|
|
4135
|
+
}
|
|
4136
|
+
) : circle;
|
|
4137
|
+
return /* @__PURE__ */ jsxs26("div", { className: "relative inline-flex flex-col items-center", children: [
|
|
4138
|
+
label,
|
|
4139
|
+
handle
|
|
4140
|
+
] });
|
|
4141
|
+
}
|
|
4142
|
+
);
|
|
4143
|
+
SliderHandle.displayName = "SliderHandle";
|
|
4144
|
+
|
|
4145
|
+
// src/components/slider.tsx
|
|
4146
|
+
import * as React35 from "react";
|
|
4147
|
+
import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4148
|
+
function clamp(v, lo, hi) {
|
|
4149
|
+
return Math.min(hi, Math.max(lo, v));
|
|
4150
|
+
}
|
|
4151
|
+
function snap(raw, min, max, step) {
|
|
4152
|
+
if (step <= 0) return raw;
|
|
4153
|
+
return clamp(Math.round((raw - min) / step) * step + min, min, max);
|
|
4154
|
+
}
|
|
4155
|
+
function toPct(v, min, max) {
|
|
4156
|
+
return max > min ? (v - min) / (max - min) * 100 : 0;
|
|
4157
|
+
}
|
|
4158
|
+
var Slider = React35.forwardRef(
|
|
4159
|
+
({
|
|
4160
|
+
className,
|
|
4161
|
+
variant = "single",
|
|
4162
|
+
value: valueProp,
|
|
4163
|
+
defaultValue,
|
|
4164
|
+
onChange,
|
|
4165
|
+
label,
|
|
4166
|
+
showLabelInfoIcon = false,
|
|
4167
|
+
helperText,
|
|
4168
|
+
valueLabelVariant,
|
|
4169
|
+
valueLabelPosition = "below",
|
|
4170
|
+
formatValue,
|
|
4171
|
+
min = 0,
|
|
4172
|
+
max = 100,
|
|
4173
|
+
step = 1,
|
|
4174
|
+
disabled = false,
|
|
4175
|
+
"aria-label": ariaLabel,
|
|
4176
|
+
...props
|
|
4177
|
+
}, ref) => {
|
|
4178
|
+
const isSingle = variant === "single";
|
|
4179
|
+
const isControlled = valueProp !== void 0;
|
|
4180
|
+
const trackRef = React35.useRef(null);
|
|
4181
|
+
const [internalSingle, setInternalSingle] = React35.useState(
|
|
4182
|
+
() => isSingle ? defaultValue ?? 0 : 0
|
|
4183
|
+
);
|
|
4184
|
+
const [internalRange, setInternalRange] = React35.useState(
|
|
4185
|
+
() => {
|
|
4186
|
+
if (isSingle) return [min, max];
|
|
4187
|
+
const [s, e] = defaultValue ?? [min, max];
|
|
4188
|
+
return [clamp(Math.min(s, e), min, max), clamp(Math.max(s, e), min, max)];
|
|
4189
|
+
}
|
|
4190
|
+
);
|
|
4191
|
+
const singleVal = isSingle ? clamp(isControlled ? valueProp : internalSingle, min, max) : 0;
|
|
4192
|
+
const singlePct = toPct(singleVal, min, max);
|
|
4193
|
+
const rawRange = !isSingle ? isControlled ? valueProp : internalRange : [min, max];
|
|
4194
|
+
const rangeStart = clamp(Math.min(rawRange[0], rawRange[1]), min, max);
|
|
4195
|
+
const rangeEnd = clamp(Math.max(rawRange[0], rawRange[1]), min, max);
|
|
4196
|
+
const startPct = toPct(rangeStart, min, max);
|
|
4197
|
+
const endPct = toPct(rangeEnd, min, max);
|
|
4198
|
+
const format = formatValue ?? ((v) => `${Math.round(v)}%`);
|
|
4199
|
+
const latestRef = React35.useRef({ rangeStart, rangeEnd });
|
|
4200
|
+
latestRef.current = { rangeStart, rangeEnd };
|
|
4201
|
+
const commitSingle = React35.useCallback(
|
|
4202
|
+
(next) => {
|
|
4203
|
+
const v = clamp(next, min, max);
|
|
4204
|
+
if (!isControlled) setInternalSingle(v);
|
|
4205
|
+
onChange?.(v);
|
|
4206
|
+
},
|
|
4207
|
+
[isControlled, min, max, onChange]
|
|
4208
|
+
);
|
|
4209
|
+
const commitRange = React35.useCallback(
|
|
4210
|
+
(next) => {
|
|
4211
|
+
const ordered = [
|
|
4212
|
+
clamp(Math.min(next[0], next[1]), min, max),
|
|
4213
|
+
clamp(Math.max(next[0], next[1]), min, max)
|
|
4214
|
+
];
|
|
4215
|
+
if (!isControlled) setInternalRange(ordered);
|
|
4216
|
+
onChange?.(ordered);
|
|
4217
|
+
},
|
|
4218
|
+
[isControlled, min, max, onChange]
|
|
4219
|
+
);
|
|
4220
|
+
const valueFromClientX = React35.useCallback(
|
|
4221
|
+
(clientX) => {
|
|
4222
|
+
const track = trackRef.current;
|
|
4223
|
+
if (!track) return min;
|
|
4224
|
+
const { left, width } = track.getBoundingClientRect();
|
|
4225
|
+
if (width <= 0) return min;
|
|
4226
|
+
return snap(min + clamp((clientX - left) / width, 0, 1) * (max - min), min, max, step);
|
|
4227
|
+
},
|
|
4228
|
+
[min, max, step]
|
|
4229
|
+
);
|
|
4230
|
+
const updateSingleRef = React35.useRef((clientX) => {
|
|
4231
|
+
});
|
|
4232
|
+
updateSingleRef.current = (clientX) => {
|
|
4233
|
+
commitSingle(valueFromClientX(clientX));
|
|
4234
|
+
};
|
|
4235
|
+
const updateStartRef = React35.useRef((clientX) => {
|
|
4236
|
+
});
|
|
4237
|
+
updateStartRef.current = (clientX) => {
|
|
4238
|
+
const v = valueFromClientX(clientX);
|
|
4239
|
+
const { rangeEnd: end } = latestRef.current;
|
|
4240
|
+
commitRange([Math.min(v, end), end]);
|
|
4241
|
+
};
|
|
4242
|
+
const updateEndRef = React35.useRef((clientX) => {
|
|
4243
|
+
});
|
|
4244
|
+
updateEndRef.current = (clientX) => {
|
|
4245
|
+
const v = valueFromClientX(clientX);
|
|
4246
|
+
const { rangeStart: start } = latestRef.current;
|
|
4247
|
+
commitRange([start, Math.max(v, start)]);
|
|
4248
|
+
};
|
|
4249
|
+
const makeDrag = React35.useCallback(
|
|
4250
|
+
(fnRef) => (e) => {
|
|
4251
|
+
if (disabled) return;
|
|
4252
|
+
e.preventDefault();
|
|
4253
|
+
fnRef.current(e.clientX);
|
|
4254
|
+
const onMove = (ev) => fnRef.current(ev.clientX);
|
|
4255
|
+
const onUp = () => {
|
|
4256
|
+
document.removeEventListener("pointermove", onMove);
|
|
4257
|
+
document.removeEventListener("pointerup", onUp);
|
|
4258
|
+
};
|
|
4259
|
+
document.addEventListener("pointermove", onMove);
|
|
4260
|
+
document.addEventListener("pointerup", onUp);
|
|
4261
|
+
},
|
|
4262
|
+
[disabled]
|
|
4263
|
+
);
|
|
4264
|
+
const onSingleDrag = makeDrag(updateSingleRef);
|
|
4265
|
+
const onStartDrag = makeDrag(updateStartRef);
|
|
4266
|
+
const onEndDrag = makeDrag(updateEndRef);
|
|
4267
|
+
const onTrackClick = React35.useCallback(
|
|
4268
|
+
(e) => {
|
|
4269
|
+
if (disabled) return;
|
|
4270
|
+
e.preventDefault();
|
|
4271
|
+
const v = valueFromClientX(e.clientX);
|
|
4272
|
+
const { rangeStart: s, rangeEnd: en } = latestRef.current;
|
|
4273
|
+
const mid = (s + en) / 2;
|
|
4274
|
+
commitRange(v < mid ? [Math.min(v, en), en] : [s, Math.max(v, s)]);
|
|
4275
|
+
},
|
|
4276
|
+
[disabled, valueFromClientX, commitRange]
|
|
4277
|
+
);
|
|
4278
|
+
const barId = React35.useId();
|
|
4279
|
+
const labelId = `${barId}-label`;
|
|
4280
|
+
const helperId = `${barId}-helper`;
|
|
4281
|
+
const renderHandle = (pct, text, onPointerDown) => /* @__PURE__ */ jsx36(
|
|
4282
|
+
"div",
|
|
4283
|
+
{
|
|
4284
|
+
className: "absolute top-1/2 z-20 overflow-visible",
|
|
4285
|
+
style: { left: `${pct}%`, transform: "translate(-50%, -50%)" },
|
|
4286
|
+
onPointerDown: disabled ? void 0 : onPointerDown,
|
|
4287
|
+
children: /* @__PURE__ */ jsx36(
|
|
4288
|
+
SliderHandle,
|
|
4289
|
+
{
|
|
4290
|
+
valueLabel: valueLabelVariant ? text : void 0,
|
|
4291
|
+
labelVariant: valueLabelVariant,
|
|
4292
|
+
labelPosition: valueLabelPosition,
|
|
4293
|
+
"aria-hidden": true
|
|
4294
|
+
}
|
|
4295
|
+
)
|
|
4296
|
+
}
|
|
4297
|
+
);
|
|
4298
|
+
return /* @__PURE__ */ jsxs27(
|
|
4299
|
+
"div",
|
|
4300
|
+
{
|
|
4301
|
+
ref,
|
|
4302
|
+
role: "group",
|
|
4303
|
+
className: cn("flex min-w-0 flex-col", className),
|
|
4304
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
4305
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
4306
|
+
...props,
|
|
4307
|
+
children: [
|
|
4308
|
+
label && /* @__PURE__ */ jsxs27(
|
|
4309
|
+
"div",
|
|
4310
|
+
{
|
|
4311
|
+
id: labelId,
|
|
4312
|
+
className: "flex items-center gap-xs text-sm font-medium text-primary mb-sm",
|
|
4313
|
+
children: [
|
|
4314
|
+
label,
|
|
4315
|
+
showLabelInfoIcon && /* @__PURE__ */ jsx36(
|
|
4316
|
+
Icon,
|
|
4317
|
+
{
|
|
4318
|
+
name: "info",
|
|
4319
|
+
size: "xs",
|
|
4320
|
+
className: "text-icon-tertiary",
|
|
4321
|
+
"aria-hidden": true
|
|
4322
|
+
}
|
|
4323
|
+
)
|
|
4324
|
+
]
|
|
4325
|
+
}
|
|
4326
|
+
),
|
|
4327
|
+
/* @__PURE__ */ jsx36("div", { id: barId, className: "relative flex min-w-0 items-center overflow-visible", children: /* @__PURE__ */ jsxs27(
|
|
4328
|
+
"div",
|
|
4329
|
+
{
|
|
4330
|
+
ref: trackRef,
|
|
4331
|
+
className: cn(
|
|
4332
|
+
"relative min-w-0 flex-1",
|
|
4333
|
+
progressBarTrackVariants({ size: "lg" }),
|
|
4334
|
+
"overflow-visible"
|
|
4335
|
+
),
|
|
4336
|
+
children: [
|
|
4337
|
+
/* @__PURE__ */ jsx36(
|
|
4338
|
+
"div",
|
|
4339
|
+
{
|
|
4340
|
+
className: cn(
|
|
4341
|
+
progressBarFillVariants({ color: "brand" }),
|
|
4342
|
+
!isSingle && "absolute inset-y-0"
|
|
4343
|
+
),
|
|
4344
|
+
style: isSingle ? { width: `${singlePct}%` } : { left: `${startPct}%`, width: `${endPct - startPct}%` }
|
|
4345
|
+
}
|
|
4346
|
+
),
|
|
4347
|
+
isSingle ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
4348
|
+
/* @__PURE__ */ jsx36(
|
|
4349
|
+
"input",
|
|
4350
|
+
{
|
|
4351
|
+
type: "range",
|
|
4352
|
+
min,
|
|
4353
|
+
max,
|
|
4354
|
+
step,
|
|
4355
|
+
value: singleVal,
|
|
4356
|
+
onChange: (e) => commitSingle(parseFloat(e.target.value)),
|
|
4357
|
+
disabled,
|
|
4358
|
+
"aria-valuenow": singleVal,
|
|
4359
|
+
"aria-valuemin": min,
|
|
4360
|
+
"aria-valuemax": max,
|
|
4361
|
+
"aria-valuetext": format(singleVal),
|
|
4362
|
+
"aria-label": ariaLabel,
|
|
4363
|
+
className: "absolute inset-0 w-full opacity-0 cursor-grab disabled:cursor-default z-10 disabled:pointer-events-none"
|
|
4364
|
+
}
|
|
4365
|
+
),
|
|
4366
|
+
renderHandle(singlePct, format(singleVal), onSingleDrag)
|
|
4367
|
+
] }) : /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
4368
|
+
/* @__PURE__ */ jsx36(
|
|
4369
|
+
"input",
|
|
4370
|
+
{
|
|
4371
|
+
type: "range",
|
|
4372
|
+
min,
|
|
4373
|
+
max,
|
|
4374
|
+
step,
|
|
4375
|
+
value: rangeStart,
|
|
4376
|
+
onChange: (e) => {
|
|
4377
|
+
const v = parseFloat(e.target.value);
|
|
4378
|
+
commitRange([Math.min(v, rangeEnd), rangeEnd]);
|
|
4379
|
+
},
|
|
4380
|
+
disabled,
|
|
4381
|
+
"aria-valuenow": rangeStart,
|
|
4382
|
+
"aria-valuemin": min,
|
|
4383
|
+
"aria-valuemax": max,
|
|
4384
|
+
"aria-valuetext": format(rangeStart),
|
|
4385
|
+
"aria-label": ariaLabel ? `${ariaLabel} (start)` : "Range start",
|
|
4386
|
+
className: "sr-only"
|
|
4387
|
+
}
|
|
4388
|
+
),
|
|
4389
|
+
/* @__PURE__ */ jsx36(
|
|
4390
|
+
"input",
|
|
4391
|
+
{
|
|
4392
|
+
type: "range",
|
|
4393
|
+
min,
|
|
4394
|
+
max,
|
|
4395
|
+
step,
|
|
4396
|
+
value: rangeEnd,
|
|
4397
|
+
onChange: (e) => {
|
|
4398
|
+
const v = parseFloat(e.target.value);
|
|
4399
|
+
commitRange([rangeStart, Math.max(v, rangeStart)]);
|
|
4400
|
+
},
|
|
4401
|
+
disabled,
|
|
4402
|
+
"aria-valuenow": rangeEnd,
|
|
4403
|
+
"aria-valuemin": min,
|
|
4404
|
+
"aria-valuemax": max,
|
|
4405
|
+
"aria-valuetext": format(rangeEnd),
|
|
4406
|
+
"aria-label": ariaLabel ? `${ariaLabel} (end)` : "Range end",
|
|
4407
|
+
className: "sr-only"
|
|
4408
|
+
}
|
|
4409
|
+
),
|
|
4410
|
+
/* @__PURE__ */ jsx36(
|
|
4411
|
+
"div",
|
|
4412
|
+
{
|
|
4413
|
+
role: "presentation",
|
|
4414
|
+
className: "absolute inset-0 z-10",
|
|
4415
|
+
style: {
|
|
4416
|
+
cursor: disabled ? "default" : "grab",
|
|
4417
|
+
pointerEvents: disabled ? "none" : void 0
|
|
4418
|
+
},
|
|
4419
|
+
onPointerDown: onTrackClick
|
|
4420
|
+
}
|
|
4421
|
+
),
|
|
4422
|
+
renderHandle(startPct, format(rangeStart), onStartDrag),
|
|
4423
|
+
renderHandle(endPct, format(rangeEnd), onEndDrag)
|
|
4424
|
+
] })
|
|
4425
|
+
]
|
|
4426
|
+
}
|
|
4427
|
+
) }),
|
|
4428
|
+
helperText && /* @__PURE__ */ jsx36(
|
|
4429
|
+
"p",
|
|
4430
|
+
{
|
|
4431
|
+
id: helperId,
|
|
4432
|
+
className: "mt-sm text-sm text-secondary",
|
|
4433
|
+
role: "status",
|
|
4434
|
+
children: helperText
|
|
4435
|
+
}
|
|
4436
|
+
)
|
|
4437
|
+
]
|
|
4438
|
+
}
|
|
4439
|
+
);
|
|
4440
|
+
}
|
|
4441
|
+
);
|
|
4442
|
+
Slider.displayName = "Slider";
|
|
4443
|
+
export {
|
|
4444
|
+
Accordion,
|
|
4445
|
+
AccordionContent,
|
|
4446
|
+
AccordionItem,
|
|
4447
|
+
AccordionTrigger,
|
|
4448
|
+
Alert,
|
|
4449
|
+
Avatar,
|
|
4450
|
+
AvatarGroup,
|
|
4451
|
+
AvatarProfile,
|
|
4452
|
+
Badge,
|
|
4453
|
+
Breadcrumb,
|
|
4454
|
+
BreadcrumbItem,
|
|
4455
|
+
BreadcrumbList,
|
|
4456
|
+
BreadcrumbListItem,
|
|
4457
|
+
BreadcrumbSeparator,
|
|
4458
|
+
Button,
|
|
4459
|
+
ButtonGroup,
|
|
4460
|
+
ButtonGroupItem,
|
|
4461
|
+
Checkbox,
|
|
4462
|
+
CheckboxCard,
|
|
4463
|
+
CloseButton,
|
|
4464
|
+
ColorPalette,
|
|
4465
|
+
Divider,
|
|
4466
|
+
FeaturedIcon,
|
|
4467
|
+
Icon,
|
|
4468
|
+
Input,
|
|
4469
|
+
Menu,
|
|
4470
|
+
MenuGroup,
|
|
4471
|
+
MenuHeading,
|
|
4472
|
+
MenuItem,
|
|
4473
|
+
ProgressBar,
|
|
4474
|
+
Radio,
|
|
4475
|
+
RadioCard,
|
|
4476
|
+
Sidebar,
|
|
4477
|
+
SidebarAccountCard,
|
|
4478
|
+
SidebarContext,
|
|
4479
|
+
SidebarMenuItem,
|
|
4480
|
+
SidebarSubmenuItem,
|
|
4481
|
+
Slider,
|
|
4482
|
+
SliderHandle,
|
|
4483
|
+
Tag,
|
|
4484
|
+
TextArea,
|
|
4485
|
+
Toggle,
|
|
4486
|
+
Tooltip,
|
|
4487
|
+
TooltipContent,
|
|
4488
|
+
TooltipProvider,
|
|
4489
|
+
TooltipTrigger,
|
|
4490
|
+
accordionTriggerVariants,
|
|
4491
|
+
alertVariants,
|
|
4492
|
+
avatarProfileVariants,
|
|
4493
|
+
avatarVariants,
|
|
4494
|
+
badgeVariants,
|
|
4495
|
+
breadcrumbItemVariants,
|
|
4496
|
+
breadcrumbListVariants,
|
|
4497
|
+
breadcrumbSeparatorVariants,
|
|
4498
|
+
buttonGroupItemVariants,
|
|
4499
|
+
buttonGroupVariants,
|
|
4500
|
+
buttonVariants,
|
|
4501
|
+
closeButtonVariants,
|
|
4502
|
+
dividerVariants,
|
|
4503
|
+
featuredIconVariants,
|
|
4504
|
+
iconVariants,
|
|
4505
|
+
inputWrapperVariants as inputVariants,
|
|
4506
|
+
menuGroupVariants,
|
|
4507
|
+
menuHeadingVariants,
|
|
4508
|
+
menuItemVariants,
|
|
4509
|
+
menuVariants,
|
|
4510
|
+
progressBarFillVariants,
|
|
4511
|
+
progressBarTrackVariants,
|
|
4512
|
+
sidebarAccountCardVariants,
|
|
4513
|
+
sidebarMenuItemVariants,
|
|
4514
|
+
sidebarSubmenuItemVariants,
|
|
4515
|
+
sidebarVariants,
|
|
4516
|
+
sliderHandleCircleVariants,
|
|
4517
|
+
tagVariants,
|
|
4518
|
+
textareaWrapperVariants as textareaVariants,
|
|
4519
|
+
thumbVariants,
|
|
4520
|
+
toggleVariants,
|
|
4521
|
+
tooltipContentVariants,
|
|
4522
|
+
useSidebarContext
|
|
4523
|
+
};
|
|
4524
|
+
//# sourceMappingURL=index.mjs.map
|