@refinn/core-ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +109 -2
- package/dist/index.d.ts +109 -2
- package/dist/index.js +1021 -25
- package/dist/index.mjs +1027 -26
- package/dist/theme.css +267 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,9 +30,494 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
// src/components/
|
|
34
|
-
import {
|
|
33
|
+
// src/components/Accordion/Accordion.tsx
|
|
34
|
+
import {
|
|
35
|
+
forwardRef,
|
|
36
|
+
useCallback,
|
|
37
|
+
useId,
|
|
38
|
+
useState
|
|
39
|
+
} from "react";
|
|
35
40
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
41
|
+
var sizeClasses = {
|
|
42
|
+
small: {
|
|
43
|
+
trigger: "px-3 py-2.5",
|
|
44
|
+
title: "text-sm leading-5",
|
|
45
|
+
subtitle: "text-xs leading-4",
|
|
46
|
+
content: "px-3 pb-3 text-sm leading-5",
|
|
47
|
+
icon: "h-4 w-4"
|
|
48
|
+
},
|
|
49
|
+
medium: {
|
|
50
|
+
trigger: "px-4 py-3",
|
|
51
|
+
title: "text-base leading-6",
|
|
52
|
+
subtitle: "text-sm leading-5",
|
|
53
|
+
content: "px-4 pb-4 text-sm leading-5",
|
|
54
|
+
icon: "h-5 w-5"
|
|
55
|
+
},
|
|
56
|
+
large: {
|
|
57
|
+
trigger: "px-5 py-4",
|
|
58
|
+
title: "text-lg leading-7",
|
|
59
|
+
subtitle: "text-sm leading-5",
|
|
60
|
+
content: "px-5 pb-5 text-base leading-6",
|
|
61
|
+
icon: "h-5 w-5"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function ChevronIcon({ className }) {
|
|
65
|
+
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
66
|
+
"path",
|
|
67
|
+
{
|
|
68
|
+
d: "M5 7.5L10 12.5L15 7.5",
|
|
69
|
+
stroke: "currentColor",
|
|
70
|
+
strokeWidth: "1.67",
|
|
71
|
+
strokeLinecap: "round",
|
|
72
|
+
strokeLinejoin: "round"
|
|
73
|
+
}
|
|
74
|
+
) });
|
|
75
|
+
}
|
|
76
|
+
function AccordionItem({ item, size, isOpen, onToggle, generatedId }) {
|
|
77
|
+
const sz = sizeClasses[size];
|
|
78
|
+
const triggerId = `${generatedId}-trigger`;
|
|
79
|
+
const panelId = `${generatedId}-panel`;
|
|
80
|
+
const triggerClasses = [
|
|
81
|
+
"flex w-full items-center justify-between gap-2 text-left font-sans font-medium",
|
|
82
|
+
"transition-colors duration-150",
|
|
83
|
+
"outline-none",
|
|
84
|
+
sz.trigger,
|
|
85
|
+
sz.title,
|
|
86
|
+
item.disabled ? "cursor-not-allowed text-accordion-text-disabled" : "cursor-pointer text-accordion-text hover:bg-accordion-bg-hover active:bg-accordion-bg-active focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accordion-border-focus"
|
|
87
|
+
].join(" ");
|
|
88
|
+
const iconClasses = [
|
|
89
|
+
sz.icon,
|
|
90
|
+
"shrink-0 transition-transform duration-200",
|
|
91
|
+
isOpen ? "rotate-180" : "",
|
|
92
|
+
item.disabled ? "text-accordion-icon-disabled" : "text-accordion-icon"
|
|
93
|
+
].join(" ");
|
|
94
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
95
|
+
/* @__PURE__ */ jsx("h3", { className: "m-0", children: /* @__PURE__ */ jsxs(
|
|
96
|
+
"button",
|
|
97
|
+
{
|
|
98
|
+
id: triggerId,
|
|
99
|
+
type: "button",
|
|
100
|
+
"aria-expanded": isOpen,
|
|
101
|
+
"aria-controls": panelId,
|
|
102
|
+
disabled: item.disabled,
|
|
103
|
+
className: triggerClasses,
|
|
104
|
+
onClick: onToggle,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
|
|
107
|
+
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
108
|
+
item.subtitle && /* @__PURE__ */ jsx("span", { className: [
|
|
109
|
+
sz.subtitle,
|
|
110
|
+
"font-normal",
|
|
111
|
+
item.disabled ? "text-accordion-text-disabled" : "text-accordion-text-secondary"
|
|
112
|
+
].join(" "), children: item.subtitle })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ jsx(ChevronIcon, { className: iconClasses })
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
) }),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
id: panelId,
|
|
122
|
+
role: "region",
|
|
123
|
+
"aria-labelledby": triggerId,
|
|
124
|
+
className: "overflow-hidden transition-[grid-template-rows] duration-200",
|
|
125
|
+
style: { display: "grid", gridTemplateRows: isOpen ? "1fr" : "0fr" },
|
|
126
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: [sz.content, "text-accordion-text-secondary"].join(" "), children: item.content }) })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
var Accordion = forwardRef(
|
|
132
|
+
(_a, ref) => {
|
|
133
|
+
var _b = _a, {
|
|
134
|
+
items,
|
|
135
|
+
size = "medium",
|
|
136
|
+
multiple = false,
|
|
137
|
+
loading = false,
|
|
138
|
+
className = ""
|
|
139
|
+
} = _b, rest = __objRest(_b, [
|
|
140
|
+
"items",
|
|
141
|
+
"size",
|
|
142
|
+
"multiple",
|
|
143
|
+
"loading",
|
|
144
|
+
"className"
|
|
145
|
+
]);
|
|
146
|
+
const baseId = useId();
|
|
147
|
+
const defaultOpen = () => {
|
|
148
|
+
const set = /* @__PURE__ */ new Set();
|
|
149
|
+
items.forEach((item, i) => {
|
|
150
|
+
var _a2;
|
|
151
|
+
if (item.defaultOpen) set.add((_a2 = item.id) != null ? _a2 : String(i));
|
|
152
|
+
});
|
|
153
|
+
return set;
|
|
154
|
+
};
|
|
155
|
+
const [openItems, setOpenItems] = useState(defaultOpen);
|
|
156
|
+
const handleToggle = useCallback(
|
|
157
|
+
(itemId) => {
|
|
158
|
+
setOpenItems((prev) => {
|
|
159
|
+
const next = new Set(multiple ? prev : []);
|
|
160
|
+
if (prev.has(itemId)) {
|
|
161
|
+
next.delete(itemId);
|
|
162
|
+
} else {
|
|
163
|
+
next.add(itemId);
|
|
164
|
+
}
|
|
165
|
+
return next;
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
[multiple]
|
|
169
|
+
);
|
|
170
|
+
const containerClasses = [
|
|
171
|
+
"rounded-lg border border-accordion-border bg-accordion-bg font-sans",
|
|
172
|
+
"divide-y divide-accordion-border",
|
|
173
|
+
className
|
|
174
|
+
].filter(Boolean).join(" ");
|
|
175
|
+
if (loading) {
|
|
176
|
+
const sz = sizeClasses[size];
|
|
177
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between gap-2 ${sz.trigger}`, children: [
|
|
178
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col gap-1", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-3/4 rounded bg-gray-200 animate-pulse" }) }),
|
|
179
|
+
/* @__PURE__ */ jsx(ChevronIcon, { className: `${sz.icon} shrink-0 text-accordion-icon` })
|
|
180
|
+
] }) }));
|
|
181
|
+
}
|
|
182
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: items.map((item, i) => {
|
|
183
|
+
var _a2;
|
|
184
|
+
const itemId = (_a2 = item.id) != null ? _a2 : String(i);
|
|
185
|
+
return /* @__PURE__ */ jsx(
|
|
186
|
+
AccordionItem,
|
|
187
|
+
{
|
|
188
|
+
item,
|
|
189
|
+
size,
|
|
190
|
+
isOpen: openItems.has(itemId),
|
|
191
|
+
onToggle: () => handleToggle(itemId),
|
|
192
|
+
generatedId: `${baseId}-${itemId}`
|
|
193
|
+
},
|
|
194
|
+
itemId
|
|
195
|
+
);
|
|
196
|
+
}) }));
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
Accordion.displayName = "Accordion";
|
|
200
|
+
|
|
201
|
+
// src/components/AlertBanner/AlertBanner.tsx
|
|
202
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
203
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
204
|
+
var inlineClasses = {
|
|
205
|
+
info: "bg-alert-inline-info-bg border-alert-inline-info-border text-alert-text-primary",
|
|
206
|
+
success: "bg-alert-inline-success-bg border-alert-inline-success-border text-alert-text-primary",
|
|
207
|
+
warning: "bg-alert-inline-warning-bg border-alert-inline-warning-border text-alert-text-primary",
|
|
208
|
+
danger: "bg-alert-inline-danger-bg border-alert-inline-danger-border text-alert-text-primary",
|
|
209
|
+
common: "bg-alert-inline-common-bg border-alert-inline-common-border text-alert-text-primary"
|
|
210
|
+
};
|
|
211
|
+
var pageClasses = {
|
|
212
|
+
info: "bg-alert-page-info-bg text-alert-text-primary-inverse",
|
|
213
|
+
success: "bg-alert-page-success-bg text-alert-text-primary-inverse",
|
|
214
|
+
warning: "bg-alert-page-warning-bg text-alert-text-primary-inverse",
|
|
215
|
+
danger: "bg-alert-page-danger-bg text-alert-text-primary-inverse",
|
|
216
|
+
common: "bg-alert-page-common-bg text-alert-text-primary-inverse"
|
|
217
|
+
};
|
|
218
|
+
var inlineIconClasses = {
|
|
219
|
+
info: "text-alert-inline-info-icon",
|
|
220
|
+
success: "text-alert-inline-success-icon",
|
|
221
|
+
warning: "text-alert-inline-warning-icon",
|
|
222
|
+
danger: "text-alert-inline-danger-icon",
|
|
223
|
+
common: "text-alert-inline-common-icon"
|
|
224
|
+
};
|
|
225
|
+
function InfoIcon({ className }) {
|
|
226
|
+
return /* @__PURE__ */ jsx2("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM10 6h.01M9 10h1v4h1", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
227
|
+
}
|
|
228
|
+
function SuccessIcon({ className }) {
|
|
229
|
+
return /* @__PURE__ */ jsxs2("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
230
|
+
/* @__PURE__ */ jsx2("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
231
|
+
/* @__PURE__ */ jsx2("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
232
|
+
] });
|
|
233
|
+
}
|
|
234
|
+
function WarningIcon({ className }) {
|
|
235
|
+
return /* @__PURE__ */ jsx2("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M8.57 3.22 1.53 15.5a1.67 1.67 0 0 0 1.43 2.5h14.08a1.67 1.67 0 0 0 1.43-2.5L11.43 3.22a1.67 1.67 0 0 0-2.86 0ZM10 7.5v3.33M10 14.17h.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
236
|
+
}
|
|
237
|
+
function DangerIcon({ className }) {
|
|
238
|
+
return /* @__PURE__ */ jsx2("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM12.5 7.5l-5 5M7.5 7.5l5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
239
|
+
}
|
|
240
|
+
function CommonIcon({ className }) {
|
|
241
|
+
return /* @__PURE__ */ jsx2("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM10 6v4M10 14h.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
242
|
+
}
|
|
243
|
+
function CloseIcon({ className }) {
|
|
244
|
+
return /* @__PURE__ */ jsx2("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M12 4 4 12M4 4l8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
245
|
+
}
|
|
246
|
+
var defaultIcons = {
|
|
247
|
+
info: InfoIcon,
|
|
248
|
+
success: SuccessIcon,
|
|
249
|
+
warning: WarningIcon,
|
|
250
|
+
danger: DangerIcon,
|
|
251
|
+
common: CommonIcon
|
|
252
|
+
};
|
|
253
|
+
var AlertBanner = forwardRef2(
|
|
254
|
+
(_a, ref) => {
|
|
255
|
+
var _b = _a, {
|
|
256
|
+
variant = "info",
|
|
257
|
+
mode = "inline",
|
|
258
|
+
title,
|
|
259
|
+
description,
|
|
260
|
+
icon,
|
|
261
|
+
onClose,
|
|
262
|
+
className = "",
|
|
263
|
+
children
|
|
264
|
+
} = _b, rest = __objRest(_b, [
|
|
265
|
+
"variant",
|
|
266
|
+
"mode",
|
|
267
|
+
"title",
|
|
268
|
+
"description",
|
|
269
|
+
"icon",
|
|
270
|
+
"onClose",
|
|
271
|
+
"className",
|
|
272
|
+
"children"
|
|
273
|
+
]);
|
|
274
|
+
const isPage = mode === "page";
|
|
275
|
+
const variantClass = isPage ? pageClasses[variant] : inlineClasses[variant];
|
|
276
|
+
const DefaultIcon = defaultIcons[variant];
|
|
277
|
+
const iconColorClass = isPage ? "" : inlineIconClasses[variant];
|
|
278
|
+
const descColorClass = isPage ? "text-alert-text-secondary-inverse" : "text-alert-text-secondary";
|
|
279
|
+
const closeColorClass = isPage ? "text-alert-close-inverse hover:text-alert-close-inverse-hover" : "text-alert-close hover:text-alert-close-hover";
|
|
280
|
+
const classes = [
|
|
281
|
+
"flex items-start gap-3 font-sans",
|
|
282
|
+
isPage ? "px-4 py-3" : "px-4 py-3 border-l-4 rounded-lg",
|
|
283
|
+
variantClass,
|
|
284
|
+
className
|
|
285
|
+
].filter(Boolean).join(" ");
|
|
286
|
+
return /* @__PURE__ */ jsxs2("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
|
|
287
|
+
/* @__PURE__ */ jsx2("span", { className: `shrink-0 mt-0.5 ${iconColorClass}`, children: icon != null ? icon : /* @__PURE__ */ jsx2(DefaultIcon, { className: "h-5 w-5" }) }),
|
|
288
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 min-w-0", children: [
|
|
289
|
+
title && /* @__PURE__ */ jsx2("p", { className: "text-sm font-medium leading-5", children: title }),
|
|
290
|
+
description && /* @__PURE__ */ jsx2("p", { className: `text-sm leading-5 ${descColorClass} ${title ? "mt-1" : ""}`, children: description }),
|
|
291
|
+
children
|
|
292
|
+
] }),
|
|
293
|
+
onClose && /* @__PURE__ */ jsx2(
|
|
294
|
+
"button",
|
|
295
|
+
{
|
|
296
|
+
type: "button",
|
|
297
|
+
onClick: onClose,
|
|
298
|
+
className: `shrink-0 p-0.5 rounded transition-colors ${closeColorClass}`,
|
|
299
|
+
"aria-label": "Close",
|
|
300
|
+
children: /* @__PURE__ */ jsx2(CloseIcon, { className: "h-4 w-4" })
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
] }));
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
AlertBanner.displayName = "AlertBanner";
|
|
307
|
+
|
|
308
|
+
// src/components/Avatar/Avatar.tsx
|
|
309
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
310
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
311
|
+
var sizeClasses2 = {
|
|
312
|
+
xs: { container: "h-6 w-6", text: "text-[10px]", status: "h-2 w-2", statusRing: "ring-1" },
|
|
313
|
+
sm: { container: "h-8 w-8", text: "text-xs", status: "h-2.5 w-2.5", statusRing: "ring-[1.5px]" },
|
|
314
|
+
md: { container: "h-10 w-10", text: "text-sm", status: "h-3 w-3", statusRing: "ring-2" },
|
|
315
|
+
lg: { container: "h-12 w-12", text: "text-base", status: "h-3.5 w-3.5", statusRing: "ring-2" },
|
|
316
|
+
xl: { container: "h-14 w-14", text: "text-lg", status: "h-4 w-4", statusRing: "ring-2" },
|
|
317
|
+
"2xl": { container: "h-16 w-16", text: "text-xl", status: "h-4 w-4", statusRing: "ring-2" }
|
|
318
|
+
};
|
|
319
|
+
var statusColorClasses = {
|
|
320
|
+
online: "bg-avatar-status-online",
|
|
321
|
+
offline: "bg-avatar-status-offline",
|
|
322
|
+
busy: "bg-avatar-status-busy"
|
|
323
|
+
};
|
|
324
|
+
function getInitials(name) {
|
|
325
|
+
const parts = name.trim().split(/\s+/);
|
|
326
|
+
if (parts.length === 1) return parts[0][0].toUpperCase();
|
|
327
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
328
|
+
}
|
|
329
|
+
function PersonIcon({ className }) {
|
|
330
|
+
return /* @__PURE__ */ jsx3("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx3("path", { d: "M10 10a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5ZM3.75 17.5a6.25 6.25 0 0 1 12.5 0" }) });
|
|
331
|
+
}
|
|
332
|
+
var Avatar = forwardRef3(
|
|
333
|
+
(_a, ref) => {
|
|
334
|
+
var _b = _a, {
|
|
335
|
+
size = "md",
|
|
336
|
+
shape = "circle",
|
|
337
|
+
src,
|
|
338
|
+
alt = "",
|
|
339
|
+
name,
|
|
340
|
+
icon,
|
|
341
|
+
status,
|
|
342
|
+
className = ""
|
|
343
|
+
} = _b, rest = __objRest(_b, [
|
|
344
|
+
"size",
|
|
345
|
+
"shape",
|
|
346
|
+
"src",
|
|
347
|
+
"alt",
|
|
348
|
+
"name",
|
|
349
|
+
"icon",
|
|
350
|
+
"status",
|
|
351
|
+
"className"
|
|
352
|
+
]);
|
|
353
|
+
const sz = sizeClasses2[size];
|
|
354
|
+
const roundedClass = shape === "circle" ? "rounded-full" : "rounded-lg";
|
|
355
|
+
const containerClasses = [
|
|
356
|
+
"relative inline-flex items-center justify-center shrink-0",
|
|
357
|
+
"bg-avatar-bg text-avatar-text font-medium font-sans",
|
|
358
|
+
"transition-colors duration-150",
|
|
359
|
+
"select-none",
|
|
360
|
+
sz.container,
|
|
361
|
+
roundedClass,
|
|
362
|
+
className
|
|
363
|
+
].filter(Boolean).join(" ");
|
|
364
|
+
let content;
|
|
365
|
+
if (src) {
|
|
366
|
+
content = /* @__PURE__ */ jsx3(
|
|
367
|
+
"img",
|
|
368
|
+
{
|
|
369
|
+
src,
|
|
370
|
+
alt: alt || name || "",
|
|
371
|
+
className: `h-full w-full object-cover ${roundedClass}`
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
} else if (icon) {
|
|
375
|
+
content = icon;
|
|
376
|
+
} else if (name) {
|
|
377
|
+
content = /* @__PURE__ */ jsx3("span", { className: sz.text, children: getInitials(name) });
|
|
378
|
+
} else {
|
|
379
|
+
content = /* @__PURE__ */ jsx3(PersonIcon, { className: `${sz.text} h-[60%] w-[60%]` });
|
|
380
|
+
}
|
|
381
|
+
return /* @__PURE__ */ jsxs3("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: [
|
|
382
|
+
content,
|
|
383
|
+
status && /* @__PURE__ */ jsx3(
|
|
384
|
+
"span",
|
|
385
|
+
{
|
|
386
|
+
className: [
|
|
387
|
+
"absolute bottom-0 right-0 block rounded-full",
|
|
388
|
+
"ring-avatar-status-border",
|
|
389
|
+
sz.status,
|
|
390
|
+
sz.statusRing,
|
|
391
|
+
statusColorClasses[status]
|
|
392
|
+
].join(" ")
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
] }));
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
Avatar.displayName = "Avatar";
|
|
399
|
+
|
|
400
|
+
// src/components/Badge/Badge.tsx
|
|
401
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
402
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
403
|
+
var sizeClasses3 = {
|
|
404
|
+
sm: "h-5 px-1.5 text-xs gap-1",
|
|
405
|
+
md: "h-6 px-2 text-xs gap-1",
|
|
406
|
+
lg: "h-7 px-2.5 text-sm gap-1.5"
|
|
407
|
+
};
|
|
408
|
+
var iconSizeClasses = {
|
|
409
|
+
sm: "h-3 w-3",
|
|
410
|
+
md: "h-3.5 w-3.5",
|
|
411
|
+
lg: "h-4 w-4"
|
|
412
|
+
};
|
|
413
|
+
var dotSizeClasses = {
|
|
414
|
+
sm: "h-1.5 w-1.5",
|
|
415
|
+
md: "h-1.5 w-1.5",
|
|
416
|
+
lg: "h-2 w-2"
|
|
417
|
+
};
|
|
418
|
+
var shapeClasses = {
|
|
419
|
+
round: "rounded-full",
|
|
420
|
+
square: "rounded"
|
|
421
|
+
};
|
|
422
|
+
var minimalClasses = {
|
|
423
|
+
common: "bg-transparent border border-badge-minimal-common-border text-badge-minimal-common-text",
|
|
424
|
+
success: "bg-transparent border border-badge-minimal-success-border text-badge-minimal-success-text",
|
|
425
|
+
warning: "bg-transparent border border-badge-minimal-warning-border text-badge-minimal-warning-text",
|
|
426
|
+
info: "bg-transparent border border-badge-minimal-info-border text-badge-minimal-info-text",
|
|
427
|
+
brand: "bg-transparent border border-badge-minimal-brand-border text-badge-minimal-brand-text",
|
|
428
|
+
danger: "bg-transparent border border-badge-minimal-danger-border text-badge-minimal-danger-text"
|
|
429
|
+
};
|
|
430
|
+
var minimalDotClasses = {
|
|
431
|
+
common: "bg-badge-minimal-common-dot",
|
|
432
|
+
success: "bg-badge-minimal-success-dot",
|
|
433
|
+
warning: "bg-badge-minimal-warning-dot",
|
|
434
|
+
info: "bg-badge-minimal-info-dot",
|
|
435
|
+
brand: "bg-badge-minimal-brand-dot",
|
|
436
|
+
danger: "bg-badge-minimal-danger-dot"
|
|
437
|
+
};
|
|
438
|
+
var subtleClasses = {
|
|
439
|
+
common: "bg-badge-subtle-common-bg text-badge-subtle-common-text",
|
|
440
|
+
success: "bg-badge-subtle-success-bg text-badge-subtle-success-text",
|
|
441
|
+
warning: "bg-badge-subtle-warning-bg text-badge-subtle-warning-text",
|
|
442
|
+
info: "bg-badge-subtle-info-bg text-badge-subtle-info-text",
|
|
443
|
+
brand: "bg-badge-subtle-brand-bg text-badge-subtle-brand-text",
|
|
444
|
+
danger: "bg-badge-subtle-danger-bg text-badge-subtle-danger-text"
|
|
445
|
+
};
|
|
446
|
+
var subtleDotClasses = {
|
|
447
|
+
common: "bg-badge-subtle-common-dot",
|
|
448
|
+
success: "bg-badge-subtle-success-dot",
|
|
449
|
+
warning: "bg-badge-subtle-warning-dot",
|
|
450
|
+
info: "bg-badge-subtle-info-dot",
|
|
451
|
+
brand: "bg-badge-subtle-brand-dot",
|
|
452
|
+
danger: "bg-badge-subtle-danger-dot"
|
|
453
|
+
};
|
|
454
|
+
var boldClasses = {
|
|
455
|
+
common: "bg-badge-bold-common-bg text-badge-bold-text",
|
|
456
|
+
success: "bg-badge-bold-success-bg text-badge-bold-text",
|
|
457
|
+
warning: "bg-badge-bold-warning-bg text-badge-bold-text",
|
|
458
|
+
info: "bg-badge-bold-info-bg text-badge-bold-text",
|
|
459
|
+
brand: "bg-badge-bold-brand-bg text-badge-bold-text",
|
|
460
|
+
danger: "bg-badge-bold-danger-bg text-badge-bold-text"
|
|
461
|
+
};
|
|
462
|
+
var boldDotClasses = {
|
|
463
|
+
common: "bg-badge-bold-common-dot",
|
|
464
|
+
success: "bg-badge-bold-success-dot",
|
|
465
|
+
warning: "bg-badge-bold-warning-dot",
|
|
466
|
+
info: "bg-badge-bold-info-dot",
|
|
467
|
+
brand: "bg-badge-bold-brand-dot",
|
|
468
|
+
danger: "bg-badge-bold-danger-dot"
|
|
469
|
+
};
|
|
470
|
+
var styleMap = {
|
|
471
|
+
minimal: minimalClasses,
|
|
472
|
+
subtle: subtleClasses,
|
|
473
|
+
bold: boldClasses
|
|
474
|
+
};
|
|
475
|
+
var dotStyleMap = {
|
|
476
|
+
minimal: minimalDotClasses,
|
|
477
|
+
subtle: subtleDotClasses,
|
|
478
|
+
bold: boldDotClasses
|
|
479
|
+
};
|
|
480
|
+
var Badge = forwardRef4(
|
|
481
|
+
(_a, ref) => {
|
|
482
|
+
var _b = _a, {
|
|
483
|
+
status = "common",
|
|
484
|
+
badgeStyle = "subtle",
|
|
485
|
+
size = "md",
|
|
486
|
+
shape = "round",
|
|
487
|
+
icon,
|
|
488
|
+
dot = false,
|
|
489
|
+
children,
|
|
490
|
+
className = ""
|
|
491
|
+
} = _b, rest = __objRest(_b, [
|
|
492
|
+
"status",
|
|
493
|
+
"badgeStyle",
|
|
494
|
+
"size",
|
|
495
|
+
"shape",
|
|
496
|
+
"icon",
|
|
497
|
+
"dot",
|
|
498
|
+
"children",
|
|
499
|
+
"className"
|
|
500
|
+
]);
|
|
501
|
+
const classes = [
|
|
502
|
+
"inline-flex items-center justify-center font-medium font-sans",
|
|
503
|
+
"whitespace-nowrap select-none",
|
|
504
|
+
sizeClasses3[size],
|
|
505
|
+
shapeClasses[shape],
|
|
506
|
+
styleMap[badgeStyle][status],
|
|
507
|
+
className
|
|
508
|
+
].filter(Boolean).join(" ");
|
|
509
|
+
return /* @__PURE__ */ jsxs4("span", __spreadProps(__spreadValues({ ref, className: classes }, rest), { children: [
|
|
510
|
+
dot && /* @__PURE__ */ jsx4("span", { className: `shrink-0 rounded-full ${dotSizeClasses[size]} ${dotStyleMap[badgeStyle][status]}` }),
|
|
511
|
+
!dot && icon && /* @__PURE__ */ jsx4("span", { className: `shrink-0 ${iconSizeClasses[size]}`, children: icon }),
|
|
512
|
+
children
|
|
513
|
+
] }));
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
Badge.displayName = "Badge";
|
|
517
|
+
|
|
518
|
+
// src/components/Button/Button.tsx
|
|
519
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
520
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
36
521
|
var variantClasses = {
|
|
37
522
|
primary: [
|
|
38
523
|
"bg-btn-primary text-btn-primary-text",
|
|
@@ -70,14 +555,14 @@ var variantClasses = {
|
|
|
70
555
|
"disabled:bg-btn-transparent-disabled disabled:text-btn-transparent-text-disabled"
|
|
71
556
|
].join(" ")
|
|
72
557
|
};
|
|
73
|
-
var
|
|
558
|
+
var sizeClasses4 = {
|
|
74
559
|
small: "h-8 px-3 text-sm gap-1",
|
|
75
560
|
medium: "h-10 px-4 text-sm gap-1.5",
|
|
76
561
|
large: "h-12 px-5 text-base gap-2",
|
|
77
562
|
"extra-large": "h-14 px-6 text-lg gap-2"
|
|
78
563
|
};
|
|
79
564
|
function Spinner({ className }) {
|
|
80
|
-
return /* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ jsx5(
|
|
81
566
|
"svg",
|
|
82
567
|
{
|
|
83
568
|
className,
|
|
@@ -85,7 +570,7 @@ function Spinner({ className }) {
|
|
|
85
570
|
height: "1em",
|
|
86
571
|
viewBox: "0 0 20 20",
|
|
87
572
|
fill: "none",
|
|
88
|
-
children: /* @__PURE__ */
|
|
573
|
+
children: /* @__PURE__ */ jsx5(
|
|
89
574
|
"path",
|
|
90
575
|
{
|
|
91
576
|
d: "M10 2.5a7.5 7.5 0 1 0 7.5 7.5",
|
|
@@ -97,7 +582,7 @@ function Spinner({ className }) {
|
|
|
97
582
|
}
|
|
98
583
|
);
|
|
99
584
|
}
|
|
100
|
-
var Button =
|
|
585
|
+
var Button = forwardRef5(
|
|
101
586
|
(_a, ref) => {
|
|
102
587
|
var _b = _a, {
|
|
103
588
|
variant = "primary",
|
|
@@ -126,12 +611,12 @@ var Button = forwardRef(
|
|
|
126
611
|
"transition-colors duration-150",
|
|
127
612
|
"outline-none",
|
|
128
613
|
"disabled:cursor-not-allowed",
|
|
129
|
-
|
|
614
|
+
sizeClasses4[size],
|
|
130
615
|
variantClasses[variant],
|
|
131
616
|
rounded ? "rounded-full" : "rounded-lg",
|
|
132
617
|
className
|
|
133
618
|
].filter(Boolean).join(" ");
|
|
134
|
-
return /* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ jsxs5(
|
|
135
620
|
"button",
|
|
136
621
|
__spreadProps(__spreadValues({
|
|
137
622
|
ref,
|
|
@@ -139,7 +624,7 @@ var Button = forwardRef(
|
|
|
139
624
|
className: classes
|
|
140
625
|
}, rest), {
|
|
141
626
|
children: [
|
|
142
|
-
loading ? /* @__PURE__ */
|
|
627
|
+
loading ? /* @__PURE__ */ jsx5(Spinner, { className: "animate-spin" }) : startIcon,
|
|
143
628
|
children,
|
|
144
629
|
!loading && endIcon
|
|
145
630
|
]
|
|
@@ -151,11 +636,11 @@ Button.displayName = "Button";
|
|
|
151
636
|
|
|
152
637
|
// src/components/Checkbox/Checkbox.tsx
|
|
153
638
|
import {
|
|
154
|
-
forwardRef as
|
|
155
|
-
useId
|
|
639
|
+
forwardRef as forwardRef6,
|
|
640
|
+
useId as useId2
|
|
156
641
|
} from "react";
|
|
157
|
-
import { jsx as
|
|
158
|
-
var
|
|
642
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
643
|
+
var sizeClasses5 = {
|
|
159
644
|
small: {
|
|
160
645
|
box: "h-4 w-4",
|
|
161
646
|
icon: "h-3 w-3",
|
|
@@ -172,7 +657,7 @@ var sizeClasses2 = {
|
|
|
172
657
|
}
|
|
173
658
|
};
|
|
174
659
|
function CheckIcon({ className }) {
|
|
175
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ jsx6("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(
|
|
176
661
|
"path",
|
|
177
662
|
{
|
|
178
663
|
d: "M13.333 4.667 6 12l-3.333-3.333",
|
|
@@ -184,7 +669,7 @@ function CheckIcon({ className }) {
|
|
|
184
669
|
) });
|
|
185
670
|
}
|
|
186
671
|
function IndeterminateIcon({ className }) {
|
|
187
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ jsx6("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(
|
|
188
673
|
"path",
|
|
189
674
|
{
|
|
190
675
|
d: "M3.333 8h9.334",
|
|
@@ -194,7 +679,7 @@ function IndeterminateIcon({ className }) {
|
|
|
194
679
|
}
|
|
195
680
|
) });
|
|
196
681
|
}
|
|
197
|
-
var Checkbox =
|
|
682
|
+
var Checkbox = forwardRef6(
|
|
198
683
|
(_a, ref) => {
|
|
199
684
|
var _b = _a, {
|
|
200
685
|
size = "medium",
|
|
@@ -221,9 +706,9 @@ var Checkbox = forwardRef2(
|
|
|
221
706
|
"className",
|
|
222
707
|
"id"
|
|
223
708
|
]);
|
|
224
|
-
const reactId =
|
|
709
|
+
const reactId = useId2();
|
|
225
710
|
const inputId = id != null ? id : reactId;
|
|
226
|
-
const sz =
|
|
711
|
+
const sz = sizeClasses5[size];
|
|
227
712
|
const isActive = checked || indeterminate;
|
|
228
713
|
const boxBase = [
|
|
229
714
|
"relative inline-flex items-center justify-center shrink-0",
|
|
@@ -248,7 +733,7 @@ var Checkbox = forwardRef2(
|
|
|
248
733
|
const ringClasses = `peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 ${ringColor}`;
|
|
249
734
|
const labelColor = disabled ? "text-checkbox-label-disabled" : contrast ? "text-checkbox-contrast-label" : error ? "text-checkbox-label-error" : "text-checkbox-label";
|
|
250
735
|
const descriptionColor = disabled ? "text-checkbox-label-disabled" : contrast ? "text-checkbox-contrast-description" : "text-checkbox-description";
|
|
251
|
-
return /* @__PURE__ */
|
|
736
|
+
return /* @__PURE__ */ jsxs6(
|
|
252
737
|
"label",
|
|
253
738
|
{
|
|
254
739
|
htmlFor: inputId,
|
|
@@ -259,8 +744,8 @@ var Checkbox = forwardRef2(
|
|
|
259
744
|
className
|
|
260
745
|
].filter(Boolean).join(" "),
|
|
261
746
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ jsxs6("span", { className: "relative inline-flex", children: [
|
|
748
|
+
/* @__PURE__ */ jsx6(
|
|
264
749
|
"input",
|
|
265
750
|
__spreadValues({
|
|
266
751
|
ref,
|
|
@@ -273,11 +758,11 @@ var Checkbox = forwardRef2(
|
|
|
273
758
|
className: "peer absolute inset-0 h-full w-full cursor-[inherit] opacity-0"
|
|
274
759
|
}, rest)
|
|
275
760
|
),
|
|
276
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ jsx6("span", { className: [boxBase, boxState, ringClasses].join(" "), children: indeterminate ? /* @__PURE__ */ jsx6(IndeterminateIcon, { className: sz.icon }) : checked ? /* @__PURE__ */ jsx6(CheckIcon, { className: sz.icon }) : null })
|
|
277
762
|
] }),
|
|
278
|
-
(label || description) && /* @__PURE__ */
|
|
279
|
-
label && /* @__PURE__ */
|
|
280
|
-
description && /* @__PURE__ */
|
|
763
|
+
(label || description) && /* @__PURE__ */ jsxs6("span", { className: "flex flex-col", children: [
|
|
764
|
+
label && /* @__PURE__ */ jsx6("span", { className: `${sz.label} font-medium ${labelColor}`, children: label }),
|
|
765
|
+
description && /* @__PURE__ */ jsx6("span", { className: `${sz.description} ${descriptionColor}`, children: description })
|
|
281
766
|
] })
|
|
282
767
|
]
|
|
283
768
|
}
|
|
@@ -285,7 +770,523 @@ var Checkbox = forwardRef2(
|
|
|
285
770
|
}
|
|
286
771
|
);
|
|
287
772
|
Checkbox.displayName = "Checkbox";
|
|
773
|
+
|
|
774
|
+
// src/components/Icon/Icon.tsx
|
|
775
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
776
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
777
|
+
var Icon = forwardRef7(
|
|
778
|
+
(_a, ref) => {
|
|
779
|
+
var _b = _a, {
|
|
780
|
+
name,
|
|
781
|
+
size = 20,
|
|
782
|
+
weight = 300,
|
|
783
|
+
fill = false,
|
|
784
|
+
grade = 0,
|
|
785
|
+
opticalSize,
|
|
786
|
+
className = "",
|
|
787
|
+
style,
|
|
788
|
+
"aria-label": ariaLabel
|
|
789
|
+
} = _b, rest = __objRest(_b, [
|
|
790
|
+
"name",
|
|
791
|
+
"size",
|
|
792
|
+
"weight",
|
|
793
|
+
"fill",
|
|
794
|
+
"grade",
|
|
795
|
+
"opticalSize",
|
|
796
|
+
"className",
|
|
797
|
+
"style",
|
|
798
|
+
"aria-label"
|
|
799
|
+
]);
|
|
800
|
+
const opsz = opticalSize != null ? opticalSize : size === 16 ? 20 : size === 20 ? 20 : 24;
|
|
801
|
+
const classes = [
|
|
802
|
+
"material-symbols-outlined select-none shrink-0 inline-block leading-none",
|
|
803
|
+
className
|
|
804
|
+
].filter(Boolean).join(" ");
|
|
805
|
+
return /* @__PURE__ */ jsx7(
|
|
806
|
+
"span",
|
|
807
|
+
__spreadProps(__spreadValues({
|
|
808
|
+
ref,
|
|
809
|
+
className: classes,
|
|
810
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
811
|
+
"aria-label": ariaLabel,
|
|
812
|
+
role: ariaLabel ? "img" : void 0,
|
|
813
|
+
style: __spreadValues({
|
|
814
|
+
fontSize: `${size}px`,
|
|
815
|
+
width: `${size}px`,
|
|
816
|
+
height: `${size}px`,
|
|
817
|
+
fontVariationSettings: `'FILL' ${fill ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grade}, 'opsz' ${opsz}`
|
|
818
|
+
}, style)
|
|
819
|
+
}, rest), {
|
|
820
|
+
children: name
|
|
821
|
+
})
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
Icon.displayName = "Icon";
|
|
826
|
+
|
|
827
|
+
// src/components/Radio/Radio.tsx
|
|
828
|
+
import {
|
|
829
|
+
forwardRef as forwardRef8,
|
|
830
|
+
useId as useId3
|
|
831
|
+
} from "react";
|
|
832
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
833
|
+
var sizeClasses6 = {
|
|
834
|
+
small: {
|
|
835
|
+
box: "h-4 w-4",
|
|
836
|
+
dot: "h-1.5 w-1.5",
|
|
837
|
+
label: "text-sm leading-5",
|
|
838
|
+
description: "text-xs leading-4",
|
|
839
|
+
gap: "gap-2"
|
|
840
|
+
},
|
|
841
|
+
medium: {
|
|
842
|
+
box: "h-5 w-5",
|
|
843
|
+
dot: "h-2 w-2",
|
|
844
|
+
label: "text-base leading-6",
|
|
845
|
+
description: "text-sm leading-5",
|
|
846
|
+
gap: "gap-2.5"
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
var Radio = forwardRef8(
|
|
850
|
+
(_a, ref) => {
|
|
851
|
+
var _b = _a, {
|
|
852
|
+
size = "medium",
|
|
853
|
+
label,
|
|
854
|
+
description,
|
|
855
|
+
error = false,
|
|
856
|
+
contrast = false,
|
|
857
|
+
checked,
|
|
858
|
+
defaultChecked,
|
|
859
|
+
disabled = false,
|
|
860
|
+
className = "",
|
|
861
|
+
id
|
|
862
|
+
} = _b, rest = __objRest(_b, [
|
|
863
|
+
"size",
|
|
864
|
+
"label",
|
|
865
|
+
"description",
|
|
866
|
+
"error",
|
|
867
|
+
"contrast",
|
|
868
|
+
"checked",
|
|
869
|
+
"defaultChecked",
|
|
870
|
+
"disabled",
|
|
871
|
+
"className",
|
|
872
|
+
"id"
|
|
873
|
+
]);
|
|
874
|
+
const reactId = useId3();
|
|
875
|
+
const inputId = id != null ? id : reactId;
|
|
876
|
+
const sz = sizeClasses6[size];
|
|
877
|
+
const circleBase = [
|
|
878
|
+
"relative inline-flex items-center justify-center shrink-0",
|
|
879
|
+
"rounded-full",
|
|
880
|
+
"border",
|
|
881
|
+
"transition-colors duration-150",
|
|
882
|
+
sz.box
|
|
883
|
+
].join(" ");
|
|
884
|
+
let circleState;
|
|
885
|
+
if (disabled) {
|
|
886
|
+
circleState = checked ? "bg-radio-disabled-selected-bg border-radio-disabled-border" : "bg-radio-disabled-bg border-radio-disabled-border";
|
|
887
|
+
} else if (contrast) {
|
|
888
|
+
circleState = checked ? "bg-radio-contrast-selected-bg border-radio-contrast-selected-bg" : "bg-radio-contrast-bg border-radio-contrast-border";
|
|
889
|
+
} else if (error) {
|
|
890
|
+
circleState = checked ? "bg-radio-selected-bg border-radio-error-border" : "bg-radio-error-bg border-radio-error-border";
|
|
891
|
+
} else if (checked) {
|
|
892
|
+
circleState = "bg-radio-selected-bg border-radio-selected-border";
|
|
893
|
+
} else {
|
|
894
|
+
circleState = "bg-radio-bg border-radio-border hover:border-radio-hover-border";
|
|
895
|
+
}
|
|
896
|
+
const ringColor = error ? "peer-focus-visible:ring-radio-error-ring" : contrast ? "peer-focus-visible:ring-radio-contrast-ring" : "peer-focus-visible:ring-radio-ring";
|
|
897
|
+
const ringClasses = `peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 ${ringColor}`;
|
|
898
|
+
let dotColor;
|
|
899
|
+
if (disabled) {
|
|
900
|
+
dotColor = "bg-radio-disabled-dot";
|
|
901
|
+
} else if (contrast) {
|
|
902
|
+
dotColor = "bg-radio-contrast-selected-dot";
|
|
903
|
+
} else {
|
|
904
|
+
dotColor = "bg-radio-selected-dot";
|
|
905
|
+
}
|
|
906
|
+
const labelColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-label" : error ? "text-radio-label-error" : "text-radio-label";
|
|
907
|
+
const descriptionColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-description" : "text-radio-description";
|
|
908
|
+
return /* @__PURE__ */ jsxs7(
|
|
909
|
+
"label",
|
|
910
|
+
{
|
|
911
|
+
htmlFor: inputId,
|
|
912
|
+
className: [
|
|
913
|
+
"inline-flex items-start font-sans",
|
|
914
|
+
sz.gap,
|
|
915
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
916
|
+
className
|
|
917
|
+
].filter(Boolean).join(" "),
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ jsxs7("span", { className: "relative inline-flex", children: [
|
|
920
|
+
/* @__PURE__ */ jsx8(
|
|
921
|
+
"input",
|
|
922
|
+
__spreadValues({
|
|
923
|
+
ref,
|
|
924
|
+
id: inputId,
|
|
925
|
+
type: "radio",
|
|
926
|
+
checked,
|
|
927
|
+
defaultChecked,
|
|
928
|
+
disabled,
|
|
929
|
+
className: "peer absolute inset-0 h-full w-full cursor-[inherit] opacity-0"
|
|
930
|
+
}, rest)
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ jsx8("span", { className: [circleBase, circleState, ringClasses].join(" "), children: checked && /* @__PURE__ */ jsx8("span", { className: `rounded-full ${sz.dot} ${dotColor}` }) })
|
|
933
|
+
] }),
|
|
934
|
+
(label || description) && /* @__PURE__ */ jsxs7("span", { className: "flex flex-col", children: [
|
|
935
|
+
label && /* @__PURE__ */ jsx8("span", { className: `${sz.label} font-medium ${labelColor}`, children: label }),
|
|
936
|
+
description && /* @__PURE__ */ jsx8("span", { className: `${sz.description} ${descriptionColor}`, children: description })
|
|
937
|
+
] })
|
|
938
|
+
]
|
|
939
|
+
}
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
);
|
|
943
|
+
Radio.displayName = "Radio";
|
|
944
|
+
|
|
945
|
+
// src/components/Slider/Slider.tsx
|
|
946
|
+
import {
|
|
947
|
+
forwardRef as forwardRef9,
|
|
948
|
+
useCallback as useCallback2,
|
|
949
|
+
useId as useId4,
|
|
950
|
+
useState as useState2
|
|
951
|
+
} from "react";
|
|
952
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
953
|
+
var sizeConfig = {
|
|
954
|
+
small: {
|
|
955
|
+
trackH: "h-1",
|
|
956
|
+
thumbPx: 24,
|
|
957
|
+
thumbClass: "h-6 w-6",
|
|
958
|
+
iconPx: 12,
|
|
959
|
+
containerH: "h-6",
|
|
960
|
+
label: "text-sm leading-5",
|
|
961
|
+
description: "text-xs leading-4"
|
|
962
|
+
},
|
|
963
|
+
medium: {
|
|
964
|
+
trackH: "h-1.5",
|
|
965
|
+
thumbPx: 28,
|
|
966
|
+
thumbClass: "h-7 w-7",
|
|
967
|
+
iconPx: 14,
|
|
968
|
+
containerH: "h-7",
|
|
969
|
+
label: "text-base leading-6",
|
|
970
|
+
description: "text-sm leading-5"
|
|
971
|
+
},
|
|
972
|
+
large: {
|
|
973
|
+
trackH: "h-2",
|
|
974
|
+
thumbPx: 32,
|
|
975
|
+
thumbClass: "h-8 w-8",
|
|
976
|
+
iconPx: 16,
|
|
977
|
+
containerH: "h-8",
|
|
978
|
+
label: "text-base leading-6",
|
|
979
|
+
description: "text-sm leading-5"
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
function ChevronGlyphs({ size, color }) {
|
|
983
|
+
return /* @__PURE__ */ jsxs8(
|
|
984
|
+
"svg",
|
|
985
|
+
{
|
|
986
|
+
width: size,
|
|
987
|
+
height: size,
|
|
988
|
+
viewBox: "0 0 12 12",
|
|
989
|
+
fill: "none",
|
|
990
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
991
|
+
"aria-hidden": "true",
|
|
992
|
+
children: [
|
|
993
|
+
/* @__PURE__ */ jsx9(
|
|
994
|
+
"path",
|
|
995
|
+
{
|
|
996
|
+
d: "M4.75 3.25L2.25 6L4.75 8.75",
|
|
997
|
+
stroke: color,
|
|
998
|
+
strokeWidth: "1.25",
|
|
999
|
+
strokeLinecap: "round",
|
|
1000
|
+
strokeLinejoin: "round"
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
/* @__PURE__ */ jsx9(
|
|
1004
|
+
"path",
|
|
1005
|
+
{
|
|
1006
|
+
d: "M7.25 3.25L9.75 6L7.25 8.75",
|
|
1007
|
+
stroke: color,
|
|
1008
|
+
strokeWidth: "1.25",
|
|
1009
|
+
strokeLinecap: "round",
|
|
1010
|
+
strokeLinejoin: "round"
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
var Slider = forwardRef9(
|
|
1018
|
+
(_a, ref) => {
|
|
1019
|
+
var _b = _a, {
|
|
1020
|
+
size = "medium",
|
|
1021
|
+
label,
|
|
1022
|
+
description,
|
|
1023
|
+
error = false,
|
|
1024
|
+
showValue = false,
|
|
1025
|
+
min = 0,
|
|
1026
|
+
max = 100,
|
|
1027
|
+
step = 1,
|
|
1028
|
+
value: controlledValue,
|
|
1029
|
+
defaultValue,
|
|
1030
|
+
disabled = false,
|
|
1031
|
+
className = "",
|
|
1032
|
+
id,
|
|
1033
|
+
onChange,
|
|
1034
|
+
"aria-label": ariaLabelProp
|
|
1035
|
+
} = _b, rest = __objRest(_b, [
|
|
1036
|
+
"size",
|
|
1037
|
+
"label",
|
|
1038
|
+
"description",
|
|
1039
|
+
"error",
|
|
1040
|
+
"showValue",
|
|
1041
|
+
"min",
|
|
1042
|
+
"max",
|
|
1043
|
+
"step",
|
|
1044
|
+
"value",
|
|
1045
|
+
"defaultValue",
|
|
1046
|
+
"disabled",
|
|
1047
|
+
"className",
|
|
1048
|
+
"id",
|
|
1049
|
+
"onChange",
|
|
1050
|
+
"aria-label"
|
|
1051
|
+
]);
|
|
1052
|
+
const reactId = useId4();
|
|
1053
|
+
const inputId = id != null ? id : reactId;
|
|
1054
|
+
const sz = sizeConfig[size];
|
|
1055
|
+
const ariaLabel = ariaLabelProp != null ? ariaLabelProp : typeof label === "string" ? void 0 : "Slider";
|
|
1056
|
+
const ariaDescriptionId = description ? `${inputId}-description` : void 0;
|
|
1057
|
+
const isControlled = controlledValue !== void 0;
|
|
1058
|
+
const [internalValue, setInternalValue] = useState2(defaultValue != null ? defaultValue : min);
|
|
1059
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
1060
|
+
const handleChange = useCallback2(
|
|
1061
|
+
(e) => {
|
|
1062
|
+
const val = Number(e.target.value);
|
|
1063
|
+
if (!isControlled) {
|
|
1064
|
+
setInternalValue(val);
|
|
1065
|
+
}
|
|
1066
|
+
onChange == null ? void 0 : onChange(val, e);
|
|
1067
|
+
},
|
|
1068
|
+
[isControlled, onChange]
|
|
1069
|
+
);
|
|
1070
|
+
const percent = (currentValue - min) / (max - min) * 100;
|
|
1071
|
+
const trackBg = disabled ? "bg-slider-track-disabled" : "bg-slider-track";
|
|
1072
|
+
const fillBg = disabled ? "bg-slider-fill-disabled" : error ? "bg-slider-fill-error" : "bg-slider-fill";
|
|
1073
|
+
const thumbBorder = disabled ? "border-slider-thumb-border-disabled" : error ? "border-slider-thumb-border-error" : "border-gray-200";
|
|
1074
|
+
const thumbBg = disabled ? "bg-slider-thumb-disabled" : "bg-slider-thumb";
|
|
1075
|
+
const iconColor = disabled ? "var(--color-gray-400)" : "var(--color-gray-500)";
|
|
1076
|
+
const labelColor = disabled ? "text-slider-label-disabled" : error ? "text-slider-label-error" : "text-slider-label";
|
|
1077
|
+
const descriptionColor = disabled ? "text-slider-label-disabled" : "text-slider-description";
|
|
1078
|
+
const thumbOffset = percent * sz.thumbPx / 100;
|
|
1079
|
+
const fillOffset = sz.thumbPx / 2 - thumbOffset;
|
|
1080
|
+
return /* @__PURE__ */ jsxs8(
|
|
1081
|
+
"div",
|
|
1082
|
+
{
|
|
1083
|
+
className: ["flex w-full flex-col gap-2 font-sans", className].filter(Boolean).join(" "),
|
|
1084
|
+
children: [
|
|
1085
|
+
(label || showValue && !disabled) && /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between", children: [
|
|
1086
|
+
label && /* @__PURE__ */ jsx9(
|
|
1087
|
+
"label",
|
|
1088
|
+
{
|
|
1089
|
+
htmlFor: inputId,
|
|
1090
|
+
className: [
|
|
1091
|
+
sz.label,
|
|
1092
|
+
"font-medium",
|
|
1093
|
+
labelColor,
|
|
1094
|
+
disabled ? "cursor-not-allowed" : "cursor-default"
|
|
1095
|
+
].join(" "),
|
|
1096
|
+
children: label
|
|
1097
|
+
}
|
|
1098
|
+
),
|
|
1099
|
+
showValue && /* @__PURE__ */ jsx9(
|
|
1100
|
+
"span",
|
|
1101
|
+
{
|
|
1102
|
+
className: [sz.description, "tabular-nums", labelColor].join(" "),
|
|
1103
|
+
children: currentValue
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
] }),
|
|
1107
|
+
/* @__PURE__ */ jsxs8(
|
|
1108
|
+
"div",
|
|
1109
|
+
{
|
|
1110
|
+
className: [
|
|
1111
|
+
"relative flex items-center",
|
|
1112
|
+
sz.containerH,
|
|
1113
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1114
|
+
].join(" "),
|
|
1115
|
+
children: [
|
|
1116
|
+
/* @__PURE__ */ jsx9(
|
|
1117
|
+
"div",
|
|
1118
|
+
{
|
|
1119
|
+
className: [
|
|
1120
|
+
"absolute inset-x-0 rounded-full",
|
|
1121
|
+
sz.trackH,
|
|
1122
|
+
trackBg
|
|
1123
|
+
].join(" ")
|
|
1124
|
+
}
|
|
1125
|
+
),
|
|
1126
|
+
/* @__PURE__ */ jsx9(
|
|
1127
|
+
"div",
|
|
1128
|
+
{
|
|
1129
|
+
className: ["absolute left-0 rounded-full", sz.trackH, fillBg].join(" "),
|
|
1130
|
+
style: { width: `calc(${percent}% + ${fillOffset}px)` }
|
|
1131
|
+
}
|
|
1132
|
+
),
|
|
1133
|
+
/* @__PURE__ */ jsx9(
|
|
1134
|
+
"input",
|
|
1135
|
+
__spreadValues({
|
|
1136
|
+
ref,
|
|
1137
|
+
id: inputId,
|
|
1138
|
+
type: "range",
|
|
1139
|
+
min,
|
|
1140
|
+
max,
|
|
1141
|
+
step,
|
|
1142
|
+
value: currentValue,
|
|
1143
|
+
disabled,
|
|
1144
|
+
onChange: handleChange,
|
|
1145
|
+
"aria-label": ariaLabel,
|
|
1146
|
+
"aria-describedby": ariaDescriptionId,
|
|
1147
|
+
className: [
|
|
1148
|
+
"peer absolute inset-0 z-20 w-full appearance-none bg-transparent opacity-0",
|
|
1149
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1150
|
+
"focus:outline-none"
|
|
1151
|
+
].join(" ")
|
|
1152
|
+
}, rest)
|
|
1153
|
+
),
|
|
1154
|
+
/* @__PURE__ */ jsx9(
|
|
1155
|
+
"div",
|
|
1156
|
+
{
|
|
1157
|
+
className: [
|
|
1158
|
+
"pointer-events-none absolute z-10 flex items-center justify-center rounded-full border",
|
|
1159
|
+
sz.thumbClass,
|
|
1160
|
+
thumbBg,
|
|
1161
|
+
thumbBorder,
|
|
1162
|
+
disabled ? "" : "shadow-base transition-shadow duration-150",
|
|
1163
|
+
!disabled && (error ? "peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-slider-ring-error" : "peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-slider-ring"),
|
|
1164
|
+
!disabled && "peer-hover:shadow-medium"
|
|
1165
|
+
].filter(Boolean).join(" "),
|
|
1166
|
+
style: { left: `calc(${percent}% - ${thumbOffset}px)` },
|
|
1167
|
+
children: /* @__PURE__ */ jsx9(ChevronGlyphs, { size: sz.iconPx, color: iconColor })
|
|
1168
|
+
}
|
|
1169
|
+
)
|
|
1170
|
+
]
|
|
1171
|
+
}
|
|
1172
|
+
),
|
|
1173
|
+
description && /* @__PURE__ */ jsx9(
|
|
1174
|
+
"span",
|
|
1175
|
+
{
|
|
1176
|
+
id: ariaDescriptionId,
|
|
1177
|
+
className: [sz.description, descriptionColor].join(" "),
|
|
1178
|
+
children: description
|
|
1179
|
+
}
|
|
1180
|
+
)
|
|
1181
|
+
]
|
|
1182
|
+
}
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1185
|
+
);
|
|
1186
|
+
Slider.displayName = "Slider";
|
|
1187
|
+
|
|
1188
|
+
// src/components/Toast/Toast.tsx
|
|
1189
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
1190
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1191
|
+
function CheckCircleIcon({ className }) {
|
|
1192
|
+
return /* @__PURE__ */ jsxs9("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1193
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1194
|
+
/* @__PURE__ */ jsx10("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1195
|
+
] });
|
|
1196
|
+
}
|
|
1197
|
+
function ProgressIcon({ className }) {
|
|
1198
|
+
return /* @__PURE__ */ jsxs9("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1199
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5", opacity: "0.3" }),
|
|
1200
|
+
/* @__PURE__ */ jsx10("path", { d: "M10 2a8 8 0 0 1 8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: /* @__PURE__ */ jsx10("animateTransform", { attributeName: "transform", type: "rotate", from: "0 10 10", to: "360 10 10", dur: "1s", repeatCount: "indefinite" }) })
|
|
1201
|
+
] });
|
|
1202
|
+
}
|
|
1203
|
+
function ErrorIcon({ className }) {
|
|
1204
|
+
return /* @__PURE__ */ jsxs9("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1205
|
+
/* @__PURE__ */ jsx10("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1206
|
+
/* @__PURE__ */ jsx10("path", { d: "M10 6.5v4M10 13.5h.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1207
|
+
] });
|
|
1208
|
+
}
|
|
1209
|
+
function CloseIcon2({ className }) {
|
|
1210
|
+
return /* @__PURE__ */ jsx10("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "M12 4 4 12M4 4l8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1211
|
+
}
|
|
1212
|
+
var defaultIcons2 = {
|
|
1213
|
+
default: CheckCircleIcon,
|
|
1214
|
+
progress: ProgressIcon,
|
|
1215
|
+
error: ErrorIcon
|
|
1216
|
+
};
|
|
1217
|
+
var typeClasses = {
|
|
1218
|
+
default: "bg-toast-default-bg text-toast-default-text",
|
|
1219
|
+
progress: "bg-toast-progress-bg text-toast-progress-text",
|
|
1220
|
+
error: "bg-toast-error-bg text-toast-error-text"
|
|
1221
|
+
};
|
|
1222
|
+
var iconColorClasses = {
|
|
1223
|
+
default: "text-toast-default-icon",
|
|
1224
|
+
progress: "text-toast-progress-icon",
|
|
1225
|
+
error: "text-toast-error-icon"
|
|
1226
|
+
};
|
|
1227
|
+
var Toast = forwardRef10(
|
|
1228
|
+
(_a, ref) => {
|
|
1229
|
+
var _b = _a, {
|
|
1230
|
+
type = "default",
|
|
1231
|
+
icon = true,
|
|
1232
|
+
actionLabel,
|
|
1233
|
+
onAction,
|
|
1234
|
+
onDismiss,
|
|
1235
|
+
children,
|
|
1236
|
+
className = ""
|
|
1237
|
+
} = _b, rest = __objRest(_b, [
|
|
1238
|
+
"type",
|
|
1239
|
+
"icon",
|
|
1240
|
+
"actionLabel",
|
|
1241
|
+
"onAction",
|
|
1242
|
+
"onDismiss",
|
|
1243
|
+
"children",
|
|
1244
|
+
"className"
|
|
1245
|
+
]);
|
|
1246
|
+
const DefaultIcon = defaultIcons2[type];
|
|
1247
|
+
const classes = [
|
|
1248
|
+
"inline-flex items-center gap-3 font-sans",
|
|
1249
|
+
"rounded-xl px-4 py-3",
|
|
1250
|
+
"min-w-[320px] max-w-[480px]",
|
|
1251
|
+
"shadow-large",
|
|
1252
|
+
typeClasses[type],
|
|
1253
|
+
className
|
|
1254
|
+
].filter(Boolean).join(" ");
|
|
1255
|
+
return /* @__PURE__ */ jsxs9("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
|
|
1256
|
+
icon && /* @__PURE__ */ jsx10("span", { className: `shrink-0 ${iconColorClasses[type]}`, children: /* @__PURE__ */ jsx10(DefaultIcon, { className: "h-5 w-5" }) }),
|
|
1257
|
+
/* @__PURE__ */ jsx10("span", { className: "flex-1 text-sm font-medium leading-5 truncate", children }),
|
|
1258
|
+
actionLabel && onAction && /* @__PURE__ */ jsx10(
|
|
1259
|
+
"button",
|
|
1260
|
+
{
|
|
1261
|
+
type: "button",
|
|
1262
|
+
onClick: onAction,
|
|
1263
|
+
className: "shrink-0 text-sm font-medium text-toast-action-text hover:bg-toast-action-bg-hover rounded-md px-2 py-1 transition-colors",
|
|
1264
|
+
children: actionLabel
|
|
1265
|
+
}
|
|
1266
|
+
),
|
|
1267
|
+
onDismiss && /* @__PURE__ */ jsx10(
|
|
1268
|
+
"button",
|
|
1269
|
+
{
|
|
1270
|
+
type: "button",
|
|
1271
|
+
onClick: onDismiss,
|
|
1272
|
+
className: "shrink-0 p-1 rounded-md text-toast-dismiss hover:text-toast-dismiss-hover transition-colors",
|
|
1273
|
+
"aria-label": "Dismiss",
|
|
1274
|
+
children: /* @__PURE__ */ jsx10(CloseIcon2, { className: "h-4 w-4" })
|
|
1275
|
+
}
|
|
1276
|
+
)
|
|
1277
|
+
] }));
|
|
1278
|
+
}
|
|
1279
|
+
);
|
|
1280
|
+
Toast.displayName = "Toast";
|
|
288
1281
|
export {
|
|
1282
|
+
Accordion,
|
|
1283
|
+
AlertBanner,
|
|
1284
|
+
Avatar,
|
|
1285
|
+
Badge,
|
|
289
1286
|
Button,
|
|
290
|
-
Checkbox
|
|
1287
|
+
Checkbox,
|
|
1288
|
+
Icon,
|
|
1289
|
+
Radio,
|
|
1290
|
+
Slider,
|
|
1291
|
+
Toast
|
|
291
1292
|
};
|