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