@refinn/core-ui 0.1.0 → 0.1.2
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 +142 -6
- package/dist/index.d.ts +142 -6
- package/dist/index.js +1272 -70
- package/dist/index.mjs +1272 -71
- package/dist/theme.css +915 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,9 +30,444 @@ 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
|
+
function ChevronIcon({ className }) {
|
|
42
|
+
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
43
|
+
"path",
|
|
44
|
+
{
|
|
45
|
+
d: "M5 7.5L10 12.5L15 7.5",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: "1.67",
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
strokeLinejoin: "round"
|
|
50
|
+
}
|
|
51
|
+
) });
|
|
52
|
+
}
|
|
53
|
+
function AccordionItem({ item, isOpen, onToggle, generatedId }) {
|
|
54
|
+
const triggerId = `${generatedId}-trigger`;
|
|
55
|
+
const panelId = `${generatedId}-panel`;
|
|
56
|
+
const iconClasses = [
|
|
57
|
+
"shrink-0 transition-transform duration-200 text-accordion-icon h-28 w-28 p-4 my-8 mx-12 lg:h-40 lg:w-40 lg:p-8 lg:mx-12 lg:my-8",
|
|
58
|
+
isOpen ? "rotate-180" : "",
|
|
59
|
+
item.disabled ? "text-static-icon-disabled" : "text-static-icon-primary"
|
|
60
|
+
].join(" ");
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
62
|
+
/* @__PURE__ */ jsxs(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
id: triggerId,
|
|
66
|
+
type: "button",
|
|
67
|
+
"aria-expanded": isOpen,
|
|
68
|
+
"aria-controls": panelId,
|
|
69
|
+
disabled: item.disabled,
|
|
70
|
+
className: "flex flex-row items-center justify-between w-full pl-16 pr-8 py-8 lg:pl-24 lg:py-16 lg:pr-12",
|
|
71
|
+
onClick: onToggle,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsxs("span", { className: `flex flex-col`, children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
className: `
|
|
78
|
+
text-label-large
|
|
79
|
+
text-start
|
|
80
|
+
lg:text-heading-3
|
|
81
|
+
${item.disabled ? "text-accordion-text-disabled" : "text-accordion-text-primary"}
|
|
82
|
+
`,
|
|
83
|
+
children: item.title
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
item.subtitle && /* @__PURE__ */ jsx("span", { className: [
|
|
87
|
+
"text-body-small",
|
|
88
|
+
item.disabled ? "text-accordion-text-disabled" : "text-accordion-text-secondary"
|
|
89
|
+
].join(" "), children: item.subtitle })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ jsx(ChevronIcon, { className: iconClasses })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
id: panelId,
|
|
99
|
+
role: "region",
|
|
100
|
+
"aria-labelledby": triggerId,
|
|
101
|
+
className: "overflow-hidden transition-[grid-template-rows] duration-200",
|
|
102
|
+
style: { display: "grid", gridTemplateRows: isOpen ? "1fr" : "0fr" },
|
|
103
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: `text-accordion-text-secondary text-body-small pt-8 pb-16 px-16 lg:text-body-regular lg:pl-24 lg:pr-64 lg:pb-24 lg:pt-12`, children: item.content }) })
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
var Accordion = forwardRef(
|
|
109
|
+
(_a, ref) => {
|
|
110
|
+
var _b = _a, {
|
|
111
|
+
items,
|
|
112
|
+
multiple = false,
|
|
113
|
+
loading = false,
|
|
114
|
+
className = ""
|
|
115
|
+
} = _b, rest = __objRest(_b, [
|
|
116
|
+
"items",
|
|
117
|
+
"multiple",
|
|
118
|
+
"loading",
|
|
119
|
+
"className"
|
|
120
|
+
]);
|
|
121
|
+
const baseId = useId();
|
|
122
|
+
const defaultOpen = () => {
|
|
123
|
+
const set = /* @__PURE__ */ new Set();
|
|
124
|
+
items.forEach((item, i) => {
|
|
125
|
+
var _a2;
|
|
126
|
+
if (item.defaultOpen) set.add((_a2 = item.id) != null ? _a2 : String(i));
|
|
127
|
+
});
|
|
128
|
+
return set;
|
|
129
|
+
};
|
|
130
|
+
const [openItems, setOpenItems] = useState(defaultOpen);
|
|
131
|
+
const handleToggle = useCallback(
|
|
132
|
+
(itemId) => {
|
|
133
|
+
setOpenItems((prev) => {
|
|
134
|
+
const next = new Set(multiple ? prev : []);
|
|
135
|
+
if (prev.has(itemId)) {
|
|
136
|
+
next.delete(itemId);
|
|
137
|
+
} else {
|
|
138
|
+
next.add(itemId);
|
|
139
|
+
}
|
|
140
|
+
return next;
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
[multiple]
|
|
144
|
+
);
|
|
145
|
+
const containerClasses = [
|
|
146
|
+
"rounded-lg border border-accordion-border bg-accordion-bg font-sans",
|
|
147
|
+
"divide-y divide-accordion-border",
|
|
148
|
+
className
|
|
149
|
+
].filter(Boolean).join(" ");
|
|
150
|
+
if (loading) {
|
|
151
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: /* @__PURE__ */ jsxs("div", { className: `flex items-center justify-between gap-8 pl-16 pr-8 py-8`, children: [
|
|
152
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col gap-4", children: /* @__PURE__ */ jsx("div", { className: "h-16 w-3/4 rounded bg-gray-200 animate-pulse" }) }),
|
|
153
|
+
/* @__PURE__ */ jsx(ChevronIcon, { className: `shrink-0 text-accordion-icon w-20 h-20 my-8 mx-12` })
|
|
154
|
+
] }) }));
|
|
155
|
+
}
|
|
156
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: items.map((item, i) => {
|
|
157
|
+
var _a2;
|
|
158
|
+
const itemId = (_a2 = item.id) != null ? _a2 : String(i);
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
AccordionItem,
|
|
161
|
+
{
|
|
162
|
+
item,
|
|
163
|
+
isOpen: openItems.has(itemId),
|
|
164
|
+
onToggle: () => handleToggle(itemId),
|
|
165
|
+
generatedId: `${baseId}-${itemId}`
|
|
166
|
+
},
|
|
167
|
+
itemId
|
|
168
|
+
);
|
|
169
|
+
}) }));
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
Accordion.displayName = "Accordion";
|
|
173
|
+
|
|
174
|
+
// src/components/AlertBanner/AlertBanner.tsx
|
|
175
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
176
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
177
|
+
var pageClasses = {
|
|
178
|
+
info: "bg-alert-page-info-bg text-alert-text-primary-inverse",
|
|
179
|
+
success: "bg-alert-page-success-bg text-alert-text-primary-inverse",
|
|
180
|
+
warning: "bg-alert-page-warning-bg text-alert-text-primary-inverse",
|
|
181
|
+
danger: "bg-alert-page-danger-bg text-alert-text-primary-inverse",
|
|
182
|
+
none: "bg-alert-page-common-bg text-alert-text-primary-inverse"
|
|
183
|
+
};
|
|
184
|
+
var SectionClasses = {
|
|
185
|
+
info: "bg-alert-banner-background-info-subtle text-alert-text-primary",
|
|
186
|
+
success: "bg-alert-banner-background-success-subtle text-alert-text-primary",
|
|
187
|
+
warning: "bg-alert-banner-background-warning-subtle text-alert-text-primary",
|
|
188
|
+
danger: "bg-alert-banner-background-danger-subtle text-alert-text-primary",
|
|
189
|
+
none: "bg-alert-banner-background-common-subtle text-alert-text-primary"
|
|
190
|
+
};
|
|
191
|
+
var inlineClasses = {
|
|
192
|
+
info: "bg-alert-banner-background-transparent text-alert-text-primary",
|
|
193
|
+
success: "bg-alert-banner-background-transparent text-alert-text-primary",
|
|
194
|
+
warning: "bg-alert-banner-background-transparent text-alert-text-primary",
|
|
195
|
+
danger: "bg-alert-banner-background-transparent text-alert-text-primary",
|
|
196
|
+
none: "bg-alert-banner-background-transparent text-alert-text-primary"
|
|
197
|
+
};
|
|
198
|
+
var actionsPageClasses = {
|
|
199
|
+
info: "text-enabled-inverse",
|
|
200
|
+
success: "text-enabled-inverse",
|
|
201
|
+
warning: "text-enabled-dark",
|
|
202
|
+
danger: "text-enabled-inverse",
|
|
203
|
+
none: "text-enabled-inverse"
|
|
204
|
+
};
|
|
205
|
+
var inlineIconClasses = {
|
|
206
|
+
info: "text-alert-inline-info-icon",
|
|
207
|
+
success: "text-alert-inline-success-icon",
|
|
208
|
+
warning: "text-alert-inline-warning-icon",
|
|
209
|
+
danger: "text-alert-inline-danger-icon",
|
|
210
|
+
none: "text-alert-inline-common-icon"
|
|
211
|
+
};
|
|
212
|
+
function InfoIcon({ className }) {
|
|
213
|
+
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" }) });
|
|
214
|
+
}
|
|
215
|
+
function SuccessIcon({ className }) {
|
|
216
|
+
return /* @__PURE__ */ jsxs2("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
217
|
+
/* @__PURE__ */ jsx2("path", { d: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
218
|
+
/* @__PURE__ */ jsx2("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
function WarningIcon({ className }) {
|
|
222
|
+
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" }) });
|
|
223
|
+
}
|
|
224
|
+
function DangerIcon({ className }) {
|
|
225
|
+
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" }) });
|
|
226
|
+
}
|
|
227
|
+
function NoneIcon({ className }) {
|
|
228
|
+
return /* @__PURE__ */ jsx2(Fragment, {});
|
|
229
|
+
}
|
|
230
|
+
function CloseIcon({ className }) {
|
|
231
|
+
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" }) });
|
|
232
|
+
}
|
|
233
|
+
var defaultIcons = {
|
|
234
|
+
info: InfoIcon,
|
|
235
|
+
success: SuccessIcon,
|
|
236
|
+
warning: WarningIcon,
|
|
237
|
+
danger: DangerIcon,
|
|
238
|
+
none: NoneIcon
|
|
239
|
+
};
|
|
240
|
+
var AlertBanner = forwardRef2(
|
|
241
|
+
(_a, ref) => {
|
|
242
|
+
var _b = _a, {
|
|
243
|
+
variant = "info",
|
|
244
|
+
mode = "inline",
|
|
245
|
+
title,
|
|
246
|
+
description,
|
|
247
|
+
action,
|
|
248
|
+
icon,
|
|
249
|
+
onClose,
|
|
250
|
+
className = "",
|
|
251
|
+
children
|
|
252
|
+
} = _b, rest = __objRest(_b, [
|
|
253
|
+
"variant",
|
|
254
|
+
"mode",
|
|
255
|
+
"title",
|
|
256
|
+
"description",
|
|
257
|
+
"action",
|
|
258
|
+
"icon",
|
|
259
|
+
"onClose",
|
|
260
|
+
"className",
|
|
261
|
+
"children"
|
|
262
|
+
]);
|
|
263
|
+
const isPage = mode === "page";
|
|
264
|
+
const isSection = mode === "section";
|
|
265
|
+
const variantClass = isPage ? pageClasses[variant] : isSection ? SectionClasses[variant] : inlineClasses[variant];
|
|
266
|
+
const actionClass = isPage ? actionsPageClasses[variant] : "text-enabled";
|
|
267
|
+
const DefaultIcon = defaultIcons[variant];
|
|
268
|
+
const iconColorClass = isPage ? "" : inlineIconClasses[variant];
|
|
269
|
+
const descColorClass = isPage ? "text-alert-text-secondary-inverse" : "text-alert-text-secondary";
|
|
270
|
+
const closeColorClass = isPage ? "text-alert-close-inverse hover:text-alert-close-inverse-hover" : "text-alert-close hover:text-alert-close-hover";
|
|
271
|
+
const classes = [
|
|
272
|
+
"flex items-start gap-24 font-sans justify-between",
|
|
273
|
+
isPage ? "p-12" : isSection ? "p-12 rounded-md" : "p-0",
|
|
274
|
+
variantClass,
|
|
275
|
+
className
|
|
276
|
+
].filter(Boolean).join(" ");
|
|
277
|
+
return /* @__PURE__ */ jsxs2("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
|
|
278
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-8", children: [
|
|
279
|
+
icon != null ? icon : /* @__PURE__ */ jsx2(DefaultIcon, { className: `h-20 w-20 ${iconColorClass}` }),
|
|
280
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 min-w-0 flex flex-col", children: [
|
|
281
|
+
title && /* @__PURE__ */ jsx2("p", { className: "text-label-medium", children: title }),
|
|
282
|
+
description && /* @__PURE__ */ jsx2("p", { className: `text-body-small ${descColorClass} ${title ? "mt-2" : ""} ${children ? "mb-8" : ""}`, children: description }),
|
|
283
|
+
children
|
|
284
|
+
] })
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ jsxs2("div", { className: `flex ${children ? "items-start" : "self-center"} gap-24`, children: [
|
|
287
|
+
(action == null ? void 0 : action[0]) && /* @__PURE__ */ jsx2("a", { className: `${actionClass} underline text-sm font-medium`, href: action[1], children: action[0] }),
|
|
288
|
+
onClose && /* @__PURE__ */ jsx2(
|
|
289
|
+
"button",
|
|
290
|
+
{
|
|
291
|
+
type: "button",
|
|
292
|
+
onClick: onClose,
|
|
293
|
+
className: `shrink-0 p-2 rounded transition-colors ${closeColorClass}`,
|
|
294
|
+
"aria-label": "Close",
|
|
295
|
+
children: /* @__PURE__ */ jsx2(CloseIcon, { className: "h-16 w-16" })
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] })
|
|
299
|
+
] }));
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
AlertBanner.displayName = "AlertBanner";
|
|
303
|
+
|
|
304
|
+
// src/components/Avatar/Avatar.tsx
|
|
305
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
306
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
307
|
+
var sizeClasses = {
|
|
308
|
+
sm: { container: "h-24 w-24", text: "text-sm", status: "h-6 w-6", statusRing: "ring-1" },
|
|
309
|
+
md: { container: "h-32 w-32", text: "text-base", status: "h-8 w-8", statusRing: "ring-[1.5px]" },
|
|
310
|
+
lg: { container: "h-40 w-40", text: "text-lg", status: "h-10 w-10", statusRing: "ring-2" },
|
|
311
|
+
xl: { container: "h-48 w-48", text: "text-xl", status: "h-12 w-12", statusRing: "ring-2" }
|
|
312
|
+
};
|
|
313
|
+
var statusColorClasses = {
|
|
314
|
+
online: "bg-avatar-status-online",
|
|
315
|
+
offline: "bg-avatar-status-offline",
|
|
316
|
+
busy: "bg-avatar-status-busy",
|
|
317
|
+
"": ""
|
|
318
|
+
};
|
|
319
|
+
function getInitials(name) {
|
|
320
|
+
const parts = name.trim().split(/\s+/);
|
|
321
|
+
if (parts.length === 1) return parts[0][0].toUpperCase();
|
|
322
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
323
|
+
}
|
|
324
|
+
function PersonIcon({ className }) {
|
|
325
|
+
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" }) });
|
|
326
|
+
}
|
|
327
|
+
var Avatar = forwardRef3(
|
|
328
|
+
(_a, ref) => {
|
|
329
|
+
var _b = _a, {
|
|
330
|
+
size = "md",
|
|
331
|
+
src,
|
|
332
|
+
alt = "",
|
|
333
|
+
name,
|
|
334
|
+
icon,
|
|
335
|
+
status,
|
|
336
|
+
className = ""
|
|
337
|
+
} = _b, rest = __objRest(_b, [
|
|
338
|
+
"size",
|
|
339
|
+
"src",
|
|
340
|
+
"alt",
|
|
341
|
+
"name",
|
|
342
|
+
"icon",
|
|
343
|
+
"status",
|
|
344
|
+
"className"
|
|
345
|
+
]);
|
|
346
|
+
const sz = sizeClasses[size];
|
|
347
|
+
const containerClasses = [
|
|
348
|
+
"relative inline-flex items-center justify-center shrink-0 rounded-full",
|
|
349
|
+
"bg-avatar-bg text-avatar-text font-medium font-sans",
|
|
350
|
+
"transition-colors duration-150",
|
|
351
|
+
"select-none",
|
|
352
|
+
sz.container,
|
|
353
|
+
className
|
|
354
|
+
].filter(Boolean).join(" ");
|
|
355
|
+
let content;
|
|
356
|
+
if (src) {
|
|
357
|
+
content = /* @__PURE__ */ jsx3(
|
|
358
|
+
"img",
|
|
359
|
+
{
|
|
360
|
+
src,
|
|
361
|
+
alt: alt || name || "",
|
|
362
|
+
className: "h-full w-full object-cover rounded-full"
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
} else if (icon) {
|
|
366
|
+
content = icon;
|
|
367
|
+
} else if (name) {
|
|
368
|
+
content = /* @__PURE__ */ jsx3("span", { className: sz.text, children: getInitials(name) });
|
|
369
|
+
} else {
|
|
370
|
+
content = /* @__PURE__ */ jsx3(PersonIcon, { className: `${sz.text} h-[60%] w-[60%]` });
|
|
371
|
+
}
|
|
372
|
+
return /* @__PURE__ */ jsxs3("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: [
|
|
373
|
+
content,
|
|
374
|
+
status && /* @__PURE__ */ jsx3(
|
|
375
|
+
"span",
|
|
376
|
+
{
|
|
377
|
+
className: [
|
|
378
|
+
"absolute bottom-0 right-0 block rounded-full",
|
|
379
|
+
"ring-avatar-status-border",
|
|
380
|
+
sz.status,
|
|
381
|
+
sz.statusRing,
|
|
382
|
+
statusColorClasses[status]
|
|
383
|
+
].join(" ")
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
] }));
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
Avatar.displayName = "Avatar";
|
|
390
|
+
|
|
391
|
+
// src/components/Badge/Badge.tsx
|
|
392
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
393
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
394
|
+
var sizeClasses2 = {
|
|
395
|
+
sm: "h-20 px-8 py-2 text-label-small gap-4",
|
|
396
|
+
md: "h-28 px-10 py-4 text-label-medium gap-4",
|
|
397
|
+
lg: "h-32 px-14 py-6 text-label-large gap-6"
|
|
398
|
+
};
|
|
399
|
+
var iconSizeClasses = {
|
|
400
|
+
sm: "h-16 w-16",
|
|
401
|
+
md: "h-20 w-20",
|
|
402
|
+
lg: "h-24 w-24"
|
|
403
|
+
};
|
|
404
|
+
var minimalClasses = {
|
|
405
|
+
common: "bg-transparent border border-badges-border-primary text-badges-text-primary",
|
|
406
|
+
success: "bg-transparent border border-badges-border-success text-badges-text-success",
|
|
407
|
+
warning: "bg-transparent border border-badges-border-warning text-badges-text-warning",
|
|
408
|
+
info: "bg-transparent border border-badges-border-info text-badges-text-info",
|
|
409
|
+
brand: "bg-transparent border border-badges-border-brand text-badges-text-brand",
|
|
410
|
+
danger: "bg-transparent border border-badges-border-danger text-badges-text-danger"
|
|
411
|
+
};
|
|
412
|
+
var subtleClasses = {
|
|
413
|
+
common: "bg-badges-background-common-subtle text-badges-text-primary",
|
|
414
|
+
success: "bg-badges-background-success-subtle text-badges-text-success",
|
|
415
|
+
warning: "bg-badges-background-warning-subtle text-badges-text-warning",
|
|
416
|
+
info: "bg-badges-background-info-subtle text-badges-text-info",
|
|
417
|
+
brand: "bg-badges-background-brand-subtle text-badges-text-brand",
|
|
418
|
+
danger: "bg-badges-background-danger-subtle text-badges-text-danger"
|
|
419
|
+
};
|
|
420
|
+
var boldClasses = {
|
|
421
|
+
common: "bg-badges-background-common text-badges-text-inverse",
|
|
422
|
+
success: "bg-badges-background-success text-badges-text-inverse",
|
|
423
|
+
warning: "bg-badges-background-warning text-badges-text-primary",
|
|
424
|
+
info: "bg-badges-background-info text-badges-text-inverse",
|
|
425
|
+
brand: "bg-badges-background-brand text-badges-text-inverse",
|
|
426
|
+
danger: "bg-badges-background-danger text-badges-text-inverse"
|
|
427
|
+
};
|
|
428
|
+
var styleMap = {
|
|
429
|
+
minimal: minimalClasses,
|
|
430
|
+
subtle: subtleClasses,
|
|
431
|
+
bold: boldClasses
|
|
432
|
+
};
|
|
433
|
+
var Badge = forwardRef4(
|
|
434
|
+
(_a, ref) => {
|
|
435
|
+
var _b = _a, {
|
|
436
|
+
status = "common",
|
|
437
|
+
badgeStyle = "subtle",
|
|
438
|
+
size = "md",
|
|
439
|
+
shape = "round",
|
|
440
|
+
icon,
|
|
441
|
+
children,
|
|
442
|
+
className = ""
|
|
443
|
+
} = _b, rest = __objRest(_b, [
|
|
444
|
+
"status",
|
|
445
|
+
"badgeStyle",
|
|
446
|
+
"size",
|
|
447
|
+
"shape",
|
|
448
|
+
"icon",
|
|
449
|
+
"children",
|
|
450
|
+
"className"
|
|
451
|
+
]);
|
|
452
|
+
const classes = [
|
|
453
|
+
"inline-flex items-center justify-center font-medium font-sans",
|
|
454
|
+
"whitespace-nowrap select-none",
|
|
455
|
+
sizeClasses2[size],
|
|
456
|
+
shape === "round" ? "rounded-full" : `rounded-${size}`,
|
|
457
|
+
styleMap[badgeStyle][status],
|
|
458
|
+
className
|
|
459
|
+
].filter(Boolean).join(" ");
|
|
460
|
+
return /* @__PURE__ */ jsxs4("span", __spreadProps(__spreadValues({ ref, className: classes }, rest), { children: [
|
|
461
|
+
icon && /* @__PURE__ */ jsx4("span", { className: `shrink-0 ${iconSizeClasses[size]}`, children: icon }),
|
|
462
|
+
children
|
|
463
|
+
] }));
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
Badge.displayName = "Badge";
|
|
467
|
+
|
|
468
|
+
// src/components/Button/Button.tsx
|
|
469
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
470
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
36
471
|
var variantClasses = {
|
|
37
472
|
primary: [
|
|
38
473
|
"bg-btn-primary text-btn-primary-text",
|
|
@@ -70,14 +505,14 @@ var variantClasses = {
|
|
|
70
505
|
"disabled:bg-btn-transparent-disabled disabled:text-btn-transparent-text-disabled"
|
|
71
506
|
].join(" ")
|
|
72
507
|
};
|
|
73
|
-
var
|
|
74
|
-
small: "h-
|
|
75
|
-
medium: "h-
|
|
76
|
-
large: "h-
|
|
77
|
-
"extra-large": "h-
|
|
508
|
+
var sizeClasses3 = {
|
|
509
|
+
small: "h-32 px-12 text-sm gap-4",
|
|
510
|
+
medium: "h-40 px-16 text-sm gap-6",
|
|
511
|
+
large: "h-48 px-20 text-base gap-8",
|
|
512
|
+
"extra-large": "h-56 px-24 text-lg gap-8"
|
|
78
513
|
};
|
|
79
514
|
function Spinner({ className }) {
|
|
80
|
-
return /* @__PURE__ */
|
|
515
|
+
return /* @__PURE__ */ jsx5(
|
|
81
516
|
"svg",
|
|
82
517
|
{
|
|
83
518
|
className,
|
|
@@ -85,7 +520,7 @@ function Spinner({ className }) {
|
|
|
85
520
|
height: "1em",
|
|
86
521
|
viewBox: "0 0 20 20",
|
|
87
522
|
fill: "none",
|
|
88
|
-
children: /* @__PURE__ */
|
|
523
|
+
children: /* @__PURE__ */ jsx5(
|
|
89
524
|
"path",
|
|
90
525
|
{
|
|
91
526
|
d: "M10 2.5a7.5 7.5 0 1 0 7.5 7.5",
|
|
@@ -97,7 +532,7 @@ function Spinner({ className }) {
|
|
|
97
532
|
}
|
|
98
533
|
);
|
|
99
534
|
}
|
|
100
|
-
var Button =
|
|
535
|
+
var Button = forwardRef5(
|
|
101
536
|
(_a, ref) => {
|
|
102
537
|
var _b = _a, {
|
|
103
538
|
variant = "primary",
|
|
@@ -126,12 +561,12 @@ var Button = forwardRef(
|
|
|
126
561
|
"transition-colors duration-150",
|
|
127
562
|
"outline-none",
|
|
128
563
|
"disabled:cursor-not-allowed",
|
|
129
|
-
|
|
564
|
+
sizeClasses3[size],
|
|
130
565
|
variantClasses[variant],
|
|
131
566
|
rounded ? "rounded-full" : "rounded-lg",
|
|
132
567
|
className
|
|
133
568
|
].filter(Boolean).join(" ");
|
|
134
|
-
return /* @__PURE__ */
|
|
569
|
+
return /* @__PURE__ */ jsxs5(
|
|
135
570
|
"button",
|
|
136
571
|
__spreadProps(__spreadValues({
|
|
137
572
|
ref,
|
|
@@ -139,7 +574,7 @@ var Button = forwardRef(
|
|
|
139
574
|
className: classes
|
|
140
575
|
}, rest), {
|
|
141
576
|
children: [
|
|
142
|
-
loading ? /* @__PURE__ */
|
|
577
|
+
loading ? /* @__PURE__ */ jsx5(Spinner, { className: "animate-spin" }) : startIcon,
|
|
143
578
|
children,
|
|
144
579
|
!loading && endIcon
|
|
145
580
|
]
|
|
@@ -149,58 +584,472 @@ var Button = forwardRef(
|
|
|
149
584
|
);
|
|
150
585
|
Button.displayName = "Button";
|
|
151
586
|
|
|
587
|
+
// src/components/BottomSheet/BottomSheet.tsx
|
|
588
|
+
import React, { useEffect, useState as useState2, useCallback as useCallback2, forwardRef as forwardRef6 } from "react";
|
|
589
|
+
import { createPortal } from "react-dom";
|
|
590
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
591
|
+
var BottomSheet = forwardRef6(
|
|
592
|
+
(_a, ref) => {
|
|
593
|
+
var _b = _a, {
|
|
594
|
+
isForceOpen = false,
|
|
595
|
+
setIsForceOpen,
|
|
596
|
+
isClosedAble = true,
|
|
597
|
+
children,
|
|
598
|
+
startModalBtn,
|
|
599
|
+
stopModalBtn,
|
|
600
|
+
afterStopBtn,
|
|
601
|
+
size = "md",
|
|
602
|
+
modalTitle = "\u0E2B\u0E31\u0E27\u0E02\u0E49\u0E2D",
|
|
603
|
+
modalDesc = "\u0E04\u0E33\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22",
|
|
604
|
+
className = ""
|
|
605
|
+
} = _b, rest = __objRest(_b, [
|
|
606
|
+
"isForceOpen",
|
|
607
|
+
"setIsForceOpen",
|
|
608
|
+
"isClosedAble",
|
|
609
|
+
"children",
|
|
610
|
+
"startModalBtn",
|
|
611
|
+
"stopModalBtn",
|
|
612
|
+
"afterStopBtn",
|
|
613
|
+
"size",
|
|
614
|
+
"modalTitle",
|
|
615
|
+
"modalDesc",
|
|
616
|
+
"className"
|
|
617
|
+
]);
|
|
618
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
619
|
+
const [shouldRender, setShouldRender] = useState2(false);
|
|
620
|
+
const [animate, setAnimate] = useState2(false);
|
|
621
|
+
useEffect(() => {
|
|
622
|
+
if (isOpen) {
|
|
623
|
+
setShouldRender(true);
|
|
624
|
+
setTimeout(() => setAnimate(true), 10);
|
|
625
|
+
} else {
|
|
626
|
+
setAnimate(false);
|
|
627
|
+
const timer = setTimeout(() => setShouldRender(false), 300);
|
|
628
|
+
return () => clearTimeout(timer);
|
|
629
|
+
}
|
|
630
|
+
}, [isOpen]);
|
|
631
|
+
useEffect(() => {
|
|
632
|
+
if (isForceOpen) {
|
|
633
|
+
setIsOpen(true);
|
|
634
|
+
} else {
|
|
635
|
+
setIsOpen(false);
|
|
636
|
+
}
|
|
637
|
+
}, [isForceOpen]);
|
|
638
|
+
const handleStartClick = useCallback2(
|
|
639
|
+
(e) => {
|
|
640
|
+
var _a2, _b2;
|
|
641
|
+
(_b2 = startModalBtn == null ? void 0 : (_a2 = startModalBtn.props).onClick) == null ? void 0 : _b2.call(_a2, e);
|
|
642
|
+
setIsForceOpen == null ? void 0 : setIsForceOpen(true);
|
|
643
|
+
setIsOpen(true);
|
|
644
|
+
},
|
|
645
|
+
[startModalBtn]
|
|
646
|
+
);
|
|
647
|
+
const handleStopClick = useCallback2(
|
|
648
|
+
(e) => {
|
|
649
|
+
var _a2, _b2;
|
|
650
|
+
(_b2 = stopModalBtn == null ? void 0 : (_a2 = stopModalBtn.props).onClick) == null ? void 0 : _b2.call(_a2, e);
|
|
651
|
+
setIsForceOpen == null ? void 0 : setIsForceOpen(false);
|
|
652
|
+
setIsOpen(false);
|
|
653
|
+
},
|
|
654
|
+
[stopModalBtn]
|
|
655
|
+
);
|
|
656
|
+
const handleCloseClick = () => {
|
|
657
|
+
setIsForceOpen == null ? void 0 : setIsForceOpen(false);
|
|
658
|
+
setIsOpen(false);
|
|
659
|
+
};
|
|
660
|
+
return /* @__PURE__ */ jsxs6("span", { ref, style: { display: "contents" }, children: [
|
|
661
|
+
startModalBtn && React.cloneElement(startModalBtn, {
|
|
662
|
+
onClick: handleStartClick
|
|
663
|
+
}),
|
|
664
|
+
shouldRender && createPortal(
|
|
665
|
+
/* @__PURE__ */ jsxs6(
|
|
666
|
+
"div",
|
|
667
|
+
{
|
|
668
|
+
className: `fixed inset-0 z-50 flex items-end justify-center transition-opacity duration-300 ${animate ? "opacity-100" : "opacity-0"}`,
|
|
669
|
+
"aria-modal": "true",
|
|
670
|
+
role: "dialog",
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ jsx6(
|
|
673
|
+
"div",
|
|
674
|
+
{
|
|
675
|
+
className: "absolute inset-0 bg-black/40",
|
|
676
|
+
onClick: () => isClosedAble ? handleCloseClick() : null,
|
|
677
|
+
"aria-label": "Close modal"
|
|
678
|
+
}
|
|
679
|
+
),
|
|
680
|
+
/* @__PURE__ */ jsxs6(
|
|
681
|
+
"div",
|
|
682
|
+
{
|
|
683
|
+
className: `flex flex-col z-10 w-full rounded-t-xl bg-white pt-8 pb-16 px-16 shadow-lg transform transition-all duration-300
|
|
684
|
+
${size === "sm" ? "h-auto max-h-auto" : size === "md" ? "h-full max-h-[85vh]" : "h-full max-h-screen rounded-t-none!"}
|
|
685
|
+
${animate ? "scale-100 translate-y-0" : "scale-95 translate-y-full"}`,
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ jsxs6("div", { className: "w-full flex flex-row relative items-center pt-8 pb-16", children: [
|
|
688
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col px-8 max-w-225", children: [
|
|
689
|
+
/* @__PURE__ */ jsx6("p", { className: "text-heading-3 text-button-sheet-text-primary", children: modalTitle }),
|
|
690
|
+
/* @__PURE__ */ jsx6("p", { className: "text-body-small text-button-sheet-text-secondary", children: modalDesc })
|
|
691
|
+
] }),
|
|
692
|
+
/* @__PURE__ */ jsx6(
|
|
693
|
+
"i",
|
|
694
|
+
{
|
|
695
|
+
className: "fi fi-br-cross-small flex text-xl text-gray-600 w-44 h-44 absolute top-0 right-0 p-12",
|
|
696
|
+
onClick: () => handleCloseClick()
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
/* @__PURE__ */ jsx6(
|
|
700
|
+
"div",
|
|
701
|
+
{
|
|
702
|
+
className: "text-gray-600 text-xl absolute top-0 right-0 p-12",
|
|
703
|
+
onClick: () => handleCloseClick(),
|
|
704
|
+
children: "x"
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
] }),
|
|
708
|
+
/* @__PURE__ */ jsxs6("div", { className: "w-full h-full grow overflow-y-auto overflow-x-visible", children: [
|
|
709
|
+
children,
|
|
710
|
+
stopModalBtn && React.cloneElement(stopModalBtn, {
|
|
711
|
+
onClick: handleStopClick
|
|
712
|
+
}),
|
|
713
|
+
afterStopBtn && afterStopBtn
|
|
714
|
+
] })
|
|
715
|
+
]
|
|
716
|
+
}
|
|
717
|
+
)
|
|
718
|
+
]
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
document.body
|
|
722
|
+
)
|
|
723
|
+
] });
|
|
724
|
+
}
|
|
725
|
+
);
|
|
726
|
+
BottomSheet.displayName = "BottomSheet";
|
|
727
|
+
|
|
152
728
|
// src/components/Checkbox/Checkbox.tsx
|
|
153
729
|
import {
|
|
154
|
-
forwardRef as
|
|
155
|
-
useId
|
|
730
|
+
forwardRef as forwardRef7,
|
|
731
|
+
useId as useId2,
|
|
732
|
+
useState as useState3
|
|
156
733
|
} from "react";
|
|
157
|
-
import { jsx as
|
|
158
|
-
|
|
734
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
735
|
+
function CheckIcon({ className }) {
|
|
736
|
+
return /* @__PURE__ */ jsx7(
|
|
737
|
+
"svg",
|
|
738
|
+
{
|
|
739
|
+
className,
|
|
740
|
+
viewBox: "0 0 16 16",
|
|
741
|
+
fill: "none",
|
|
742
|
+
"aria-hidden": "true",
|
|
743
|
+
children: /* @__PURE__ */ jsx7(
|
|
744
|
+
"path",
|
|
745
|
+
{
|
|
746
|
+
d: "M13.333 4.667 6 12l-3.333-3.333",
|
|
747
|
+
stroke: "currentColor",
|
|
748
|
+
strokeWidth: "2",
|
|
749
|
+
strokeLinecap: "round",
|
|
750
|
+
strokeLinejoin: "round"
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
function IndeterminateIcon({ className }) {
|
|
757
|
+
return /* @__PURE__ */ jsx7(
|
|
758
|
+
"svg",
|
|
759
|
+
{
|
|
760
|
+
className,
|
|
761
|
+
viewBox: "0 0 16 16",
|
|
762
|
+
fill: "none",
|
|
763
|
+
"aria-hidden": "true",
|
|
764
|
+
children: /* @__PURE__ */ jsx7(
|
|
765
|
+
"path",
|
|
766
|
+
{
|
|
767
|
+
d: "M3.333 8h9.334",
|
|
768
|
+
stroke: "currentColor",
|
|
769
|
+
strokeWidth: "2",
|
|
770
|
+
strokeLinecap: "round"
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
var Checkbox = forwardRef7(
|
|
777
|
+
(_a, ref) => {
|
|
778
|
+
var _b = _a, {
|
|
779
|
+
label,
|
|
780
|
+
description,
|
|
781
|
+
error = false,
|
|
782
|
+
contrast = false,
|
|
783
|
+
indeterminate = false,
|
|
784
|
+
disabled = false,
|
|
785
|
+
className = "",
|
|
786
|
+
id,
|
|
787
|
+
defaultChecked
|
|
788
|
+
} = _b, rest = __objRest(_b, [
|
|
789
|
+
"label",
|
|
790
|
+
"description",
|
|
791
|
+
"error",
|
|
792
|
+
"contrast",
|
|
793
|
+
"indeterminate",
|
|
794
|
+
"disabled",
|
|
795
|
+
"className",
|
|
796
|
+
"id",
|
|
797
|
+
"defaultChecked"
|
|
798
|
+
]);
|
|
799
|
+
const reactId = useId2();
|
|
800
|
+
const inputId = id != null ? id : reactId;
|
|
801
|
+
const [isChecked, setIsChecked] = useState3(defaultChecked != null ? defaultChecked : false);
|
|
802
|
+
return /* @__PURE__ */ jsxs7(
|
|
803
|
+
"label",
|
|
804
|
+
{
|
|
805
|
+
htmlFor: inputId,
|
|
806
|
+
className: `flex select-none font-sans ${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${className}`,
|
|
807
|
+
children: [
|
|
808
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative mr-16", children: [
|
|
809
|
+
/* @__PURE__ */ jsx7(
|
|
810
|
+
"input",
|
|
811
|
+
__spreadValues({
|
|
812
|
+
ref,
|
|
813
|
+
id: inputId,
|
|
814
|
+
type: "checkbox",
|
|
815
|
+
defaultChecked,
|
|
816
|
+
onChange: (e) => {
|
|
817
|
+
var _a2;
|
|
818
|
+
setIsChecked(e.target.checked);
|
|
819
|
+
(_a2 = rest.onChange) == null ? void 0 : _a2.call(rest, e);
|
|
820
|
+
},
|
|
821
|
+
disabled,
|
|
822
|
+
"aria-checked": indeterminate ? "mixed" : isChecked,
|
|
823
|
+
className: "sr-only"
|
|
824
|
+
}, rest)
|
|
825
|
+
),
|
|
826
|
+
/* @__PURE__ */ jsx7(
|
|
827
|
+
"div",
|
|
828
|
+
{
|
|
829
|
+
className: `box m-6 flex h-20 w-20 rounded-md items-center justify-center border ${contrast ? isChecked || indeterminate ? "border-white bg-white" : "border-white" : isChecked || indeterminate ? "bg-static-icon-brand border-static-icon-brand" : "border-static-icon-primary"}`,
|
|
830
|
+
children: isChecked ? /* @__PURE__ */ jsx7(
|
|
831
|
+
CheckIcon,
|
|
832
|
+
{
|
|
833
|
+
className: `h-20 ${contrast ? "text-static-icon-brand" : "text-white"}`
|
|
834
|
+
}
|
|
835
|
+
) : indeterminate ? /* @__PURE__ */ jsx7(
|
|
836
|
+
IndeterminateIcon,
|
|
837
|
+
{
|
|
838
|
+
className: `h-20 ${contrast ? "text-static-icon-brand" : "text-white"}`
|
|
839
|
+
}
|
|
840
|
+
) : null
|
|
841
|
+
}
|
|
842
|
+
)
|
|
843
|
+
] }),
|
|
844
|
+
(label || description) && /* @__PURE__ */ jsxs7("span", { className: "flex flex-col", children: [
|
|
845
|
+
label && /* @__PURE__ */ jsx7(
|
|
846
|
+
"span",
|
|
847
|
+
{
|
|
848
|
+
className: `text-label-large ${disabled ? "text-checkbox-text-disabled" : contrast ? "text-checkbox-text-primary-inverse" : "text-checkbox-text-primary"}`,
|
|
849
|
+
children: label
|
|
850
|
+
}
|
|
851
|
+
),
|
|
852
|
+
description && /* @__PURE__ */ jsx7(
|
|
853
|
+
"span",
|
|
854
|
+
{
|
|
855
|
+
className: `text-body-small ${error ? "text-checkbox-text-danger" : disabled ? "text-checkbox-text-disabled" : contrast ? "text-checkbox-text-primary-inverse" : "text-checkbox-text-secondary"}`,
|
|
856
|
+
children: description
|
|
857
|
+
}
|
|
858
|
+
)
|
|
859
|
+
] })
|
|
860
|
+
]
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
);
|
|
865
|
+
Checkbox.displayName = "Checkbox";
|
|
866
|
+
|
|
867
|
+
// src/components/Dialog/Dialog.tsx
|
|
868
|
+
import React2, {
|
|
869
|
+
useEffect as useEffect2,
|
|
870
|
+
useState as useState4,
|
|
871
|
+
useCallback as useCallback3,
|
|
872
|
+
forwardRef as forwardRef8
|
|
873
|
+
} from "react";
|
|
874
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
875
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
876
|
+
var Dialog = forwardRef8(
|
|
877
|
+
({
|
|
878
|
+
isForceOpen = false,
|
|
879
|
+
setIsForceOpen,
|
|
880
|
+
isClosedAble = true,
|
|
881
|
+
children,
|
|
882
|
+
startModalBtn,
|
|
883
|
+
stopModalBtn,
|
|
884
|
+
afterStopBtn,
|
|
885
|
+
p = "20"
|
|
886
|
+
}, ref) => {
|
|
887
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
888
|
+
const [shouldRender, setShouldRender] = useState4(false);
|
|
889
|
+
const [animate, setAnimate] = useState4(false);
|
|
890
|
+
useEffect2(() => {
|
|
891
|
+
if (isOpen) {
|
|
892
|
+
setShouldRender(true);
|
|
893
|
+
setTimeout(() => setAnimate(true), 10);
|
|
894
|
+
} else {
|
|
895
|
+
setAnimate(false);
|
|
896
|
+
const timer = setTimeout(() => setShouldRender(false), 300);
|
|
897
|
+
return () => clearTimeout(timer);
|
|
898
|
+
}
|
|
899
|
+
}, [isOpen]);
|
|
900
|
+
useEffect2(() => {
|
|
901
|
+
if (isForceOpen) {
|
|
902
|
+
setIsOpen(true);
|
|
903
|
+
} else {
|
|
904
|
+
setIsOpen(false);
|
|
905
|
+
}
|
|
906
|
+
}, [isForceOpen]);
|
|
907
|
+
const handleStartClick = useCallback3(
|
|
908
|
+
(e) => {
|
|
909
|
+
var _a, _b;
|
|
910
|
+
(_b = startModalBtn == null ? void 0 : (_a = startModalBtn.props).onClick) == null ? void 0 : _b.call(_a, e);
|
|
911
|
+
setIsForceOpen == null ? void 0 : setIsForceOpen(true);
|
|
912
|
+
setIsOpen(true);
|
|
913
|
+
},
|
|
914
|
+
[startModalBtn]
|
|
915
|
+
);
|
|
916
|
+
const handleStopClick = useCallback3(
|
|
917
|
+
(e) => {
|
|
918
|
+
var _a, _b;
|
|
919
|
+
(_b = stopModalBtn == null ? void 0 : (_a = stopModalBtn.props).onClick) == null ? void 0 : _b.call(_a, e);
|
|
920
|
+
setIsForceOpen == null ? void 0 : setIsForceOpen(false);
|
|
921
|
+
setIsOpen(false);
|
|
922
|
+
},
|
|
923
|
+
[stopModalBtn]
|
|
924
|
+
);
|
|
925
|
+
const handleCloseClick = () => {
|
|
926
|
+
setIsForceOpen == null ? void 0 : setIsForceOpen(false);
|
|
927
|
+
setIsOpen(false);
|
|
928
|
+
};
|
|
929
|
+
return /* @__PURE__ */ jsxs8("span", { ref, style: { display: "contents" }, children: [
|
|
930
|
+
startModalBtn && React2.cloneElement(startModalBtn, {
|
|
931
|
+
onClick: handleStartClick
|
|
932
|
+
}),
|
|
933
|
+
shouldRender && createPortal2(
|
|
934
|
+
/* @__PURE__ */ jsxs8(
|
|
935
|
+
"div",
|
|
936
|
+
{
|
|
937
|
+
className: `fixed inset-0 z-50 flex items-center justify-center transition-opacity duration-300 ${animate ? "opacity-100" : "opacity-0"}`,
|
|
938
|
+
"aria-modal": "true",
|
|
939
|
+
role: "dialog",
|
|
940
|
+
children: [
|
|
941
|
+
/* @__PURE__ */ jsx8(
|
|
942
|
+
"div",
|
|
943
|
+
{
|
|
944
|
+
className: "absolute inset-0 bg-black/40",
|
|
945
|
+
onClick: () => isClosedAble ? handleCloseClick() : null,
|
|
946
|
+
"aria-label": "Close modal"
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ jsxs8(
|
|
950
|
+
"div",
|
|
951
|
+
{
|
|
952
|
+
className: `relative z-10 w-[calc(100%-40px)] max-w-md rounded-xl bg-white p-${p || "20"} shadow-lg transform transition-all duration-300 ${animate ? "scale-100 opacity-100" : "scale-95 opacity-0"}`,
|
|
953
|
+
children: [
|
|
954
|
+
children,
|
|
955
|
+
stopModalBtn && React2.cloneElement(stopModalBtn, {
|
|
956
|
+
onClick: handleStopClick
|
|
957
|
+
}),
|
|
958
|
+
afterStopBtn && afterStopBtn
|
|
959
|
+
]
|
|
960
|
+
}
|
|
961
|
+
)
|
|
962
|
+
]
|
|
963
|
+
}
|
|
964
|
+
),
|
|
965
|
+
document.body
|
|
966
|
+
)
|
|
967
|
+
] });
|
|
968
|
+
}
|
|
969
|
+
);
|
|
970
|
+
Dialog.displayName = "Dialog";
|
|
971
|
+
|
|
972
|
+
// src/components/Icon/Icon.tsx
|
|
973
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
974
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
975
|
+
var Icon = forwardRef9(
|
|
976
|
+
(_a, ref) => {
|
|
977
|
+
var _b = _a, {
|
|
978
|
+
name,
|
|
979
|
+
size = 20,
|
|
980
|
+
weight = 300,
|
|
981
|
+
fill = false,
|
|
982
|
+
grade = 0,
|
|
983
|
+
opticalSize,
|
|
984
|
+
className = "",
|
|
985
|
+
style,
|
|
986
|
+
"aria-label": ariaLabel
|
|
987
|
+
} = _b, rest = __objRest(_b, [
|
|
988
|
+
"name",
|
|
989
|
+
"size",
|
|
990
|
+
"weight",
|
|
991
|
+
"fill",
|
|
992
|
+
"grade",
|
|
993
|
+
"opticalSize",
|
|
994
|
+
"className",
|
|
995
|
+
"style",
|
|
996
|
+
"aria-label"
|
|
997
|
+
]);
|
|
998
|
+
const opsz = opticalSize != null ? opticalSize : size === 16 ? 20 : size === 20 ? 20 : 24;
|
|
999
|
+
const classes = [
|
|
1000
|
+
"material-symbols-outlined select-none shrink-0 inline-block leading-none",
|
|
1001
|
+
className
|
|
1002
|
+
].filter(Boolean).join(" ");
|
|
1003
|
+
return /* @__PURE__ */ jsx9(
|
|
1004
|
+
"span",
|
|
1005
|
+
__spreadProps(__spreadValues({
|
|
1006
|
+
ref,
|
|
1007
|
+
className: classes,
|
|
1008
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
1009
|
+
"aria-label": ariaLabel,
|
|
1010
|
+
role: ariaLabel ? "img" : void 0,
|
|
1011
|
+
style: __spreadValues({
|
|
1012
|
+
fontSize: `${size}px`,
|
|
1013
|
+
width: `${size}px`,
|
|
1014
|
+
height: `${size}px`,
|
|
1015
|
+
fontVariationSettings: `'FILL' ${fill ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grade}, 'opsz' ${opsz}`
|
|
1016
|
+
}, style)
|
|
1017
|
+
}, rest), {
|
|
1018
|
+
children: name
|
|
1019
|
+
})
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
);
|
|
1023
|
+
Icon.displayName = "Icon";
|
|
1024
|
+
|
|
1025
|
+
// src/components/Radio/Radio.tsx
|
|
1026
|
+
import {
|
|
1027
|
+
forwardRef as forwardRef10,
|
|
1028
|
+
useId as useId3
|
|
1029
|
+
} from "react";
|
|
1030
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1031
|
+
var sizeClasses4 = {
|
|
159
1032
|
small: {
|
|
160
1033
|
box: "h-4 w-4",
|
|
161
|
-
|
|
1034
|
+
dot: "h-1.5 w-1.5",
|
|
162
1035
|
label: "text-sm leading-5",
|
|
163
1036
|
description: "text-xs leading-4",
|
|
164
1037
|
gap: "gap-2"
|
|
165
1038
|
},
|
|
166
1039
|
medium: {
|
|
167
1040
|
box: "h-5 w-5",
|
|
168
|
-
|
|
1041
|
+
dot: "h-2 w-2",
|
|
169
1042
|
label: "text-base leading-6",
|
|
170
1043
|
description: "text-sm leading-5",
|
|
171
1044
|
gap: "gap-2.5"
|
|
172
1045
|
}
|
|
173
1046
|
};
|
|
174
|
-
|
|
175
|
-
return /* @__PURE__ */ jsx2("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(
|
|
176
|
-
"path",
|
|
177
|
-
{
|
|
178
|
-
d: "M13.333 4.667 6 12l-3.333-3.333",
|
|
179
|
-
stroke: "currentColor",
|
|
180
|
-
strokeWidth: "2",
|
|
181
|
-
strokeLinecap: "round",
|
|
182
|
-
strokeLinejoin: "round"
|
|
183
|
-
}
|
|
184
|
-
) });
|
|
185
|
-
}
|
|
186
|
-
function IndeterminateIcon({ className }) {
|
|
187
|
-
return /* @__PURE__ */ jsx2("svg", { className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx2(
|
|
188
|
-
"path",
|
|
189
|
-
{
|
|
190
|
-
d: "M3.333 8h9.334",
|
|
191
|
-
stroke: "currentColor",
|
|
192
|
-
strokeWidth: "2",
|
|
193
|
-
strokeLinecap: "round"
|
|
194
|
-
}
|
|
195
|
-
) });
|
|
196
|
-
}
|
|
197
|
-
var Checkbox = forwardRef2(
|
|
1047
|
+
var Radio = forwardRef10(
|
|
198
1048
|
(_a, ref) => {
|
|
199
1049
|
var _b = _a, {
|
|
200
1050
|
size = "medium",
|
|
201
1051
|
label,
|
|
202
1052
|
description,
|
|
203
|
-
indeterminate = false,
|
|
204
1053
|
error = false,
|
|
205
1054
|
contrast = false,
|
|
206
1055
|
checked,
|
|
@@ -212,7 +1061,6 @@ var Checkbox = forwardRef2(
|
|
|
212
1061
|
"size",
|
|
213
1062
|
"label",
|
|
214
1063
|
"description",
|
|
215
|
-
"indeterminate",
|
|
216
1064
|
"error",
|
|
217
1065
|
"contrast",
|
|
218
1066
|
"checked",
|
|
@@ -221,34 +1069,41 @@ var Checkbox = forwardRef2(
|
|
|
221
1069
|
"className",
|
|
222
1070
|
"id"
|
|
223
1071
|
]);
|
|
224
|
-
const reactId =
|
|
1072
|
+
const reactId = useId3();
|
|
225
1073
|
const inputId = id != null ? id : reactId;
|
|
226
|
-
const sz =
|
|
227
|
-
const
|
|
228
|
-
const boxBase = [
|
|
1074
|
+
const sz = sizeClasses4[size];
|
|
1075
|
+
const circleBase = [
|
|
229
1076
|
"relative inline-flex items-center justify-center shrink-0",
|
|
230
|
-
"rounded",
|
|
1077
|
+
"rounded-full",
|
|
231
1078
|
"border",
|
|
232
1079
|
"transition-colors duration-150",
|
|
233
1080
|
sz.box
|
|
234
1081
|
].join(" ");
|
|
235
|
-
let
|
|
1082
|
+
let circleState;
|
|
236
1083
|
if (disabled) {
|
|
237
|
-
|
|
1084
|
+
circleState = checked ? "bg-radio-disabled-selected-bg border-radio-disabled-border" : "bg-radio-disabled-bg border-radio-disabled-border";
|
|
238
1085
|
} else if (contrast) {
|
|
239
|
-
|
|
1086
|
+
circleState = checked ? "bg-radio-contrast-selected-bg border-radio-contrast-selected-bg" : "bg-radio-contrast-bg border-radio-contrast-border";
|
|
240
1087
|
} else if (error) {
|
|
241
|
-
|
|
242
|
-
} else if (
|
|
243
|
-
|
|
1088
|
+
circleState = checked ? "bg-radio-selected-bg border-radio-error-border" : "bg-radio-error-bg border-radio-error-border";
|
|
1089
|
+
} else if (checked) {
|
|
1090
|
+
circleState = "bg-radio-selected-bg border-radio-selected-border";
|
|
244
1091
|
} else {
|
|
245
|
-
|
|
1092
|
+
circleState = "bg-radio-bg border-radio-border hover:border-radio-hover-border";
|
|
246
1093
|
}
|
|
247
|
-
const ringColor = error ? "peer-focus-visible:ring-
|
|
1094
|
+
const ringColor = error ? "peer-focus-visible:ring-radio-error-ring" : contrast ? "peer-focus-visible:ring-radio-contrast-ring" : "peer-focus-visible:ring-radio-ring";
|
|
248
1095
|
const ringClasses = `peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 ${ringColor}`;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
1096
|
+
let dotColor;
|
|
1097
|
+
if (disabled) {
|
|
1098
|
+
dotColor = "bg-radio-disabled-dot";
|
|
1099
|
+
} else if (contrast) {
|
|
1100
|
+
dotColor = "bg-radio-contrast-selected-dot";
|
|
1101
|
+
} else {
|
|
1102
|
+
dotColor = "bg-radio-selected-dot";
|
|
1103
|
+
}
|
|
1104
|
+
const labelColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-label" : error ? "text-radio-label-error" : "text-radio-label";
|
|
1105
|
+
const descriptionColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-description" : "text-radio-description";
|
|
1106
|
+
return /* @__PURE__ */ jsxs9(
|
|
252
1107
|
"label",
|
|
253
1108
|
{
|
|
254
1109
|
htmlFor: inputId,
|
|
@@ -259,33 +1114,379 @@ var Checkbox = forwardRef2(
|
|
|
259
1114
|
className
|
|
260
1115
|
].filter(Boolean).join(" "),
|
|
261
1116
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ jsxs9("span", { className: "relative inline-flex", children: [
|
|
1118
|
+
/* @__PURE__ */ jsx10(
|
|
264
1119
|
"input",
|
|
265
1120
|
__spreadValues({
|
|
266
1121
|
ref,
|
|
267
1122
|
id: inputId,
|
|
268
|
-
type: "
|
|
1123
|
+
type: "radio",
|
|
269
1124
|
checked,
|
|
270
1125
|
defaultChecked,
|
|
271
1126
|
disabled,
|
|
272
|
-
"aria-checked": indeterminate ? "mixed" : checked,
|
|
273
1127
|
className: "peer absolute inset-0 h-full w-full cursor-[inherit] opacity-0"
|
|
274
1128
|
}, rest)
|
|
275
1129
|
),
|
|
276
|
-
/* @__PURE__ */
|
|
1130
|
+
/* @__PURE__ */ jsx10("span", { className: [circleBase, circleState, ringClasses].join(" "), children: checked && /* @__PURE__ */ jsx10("span", { className: `rounded-full ${sz.dot} ${dotColor}` }) })
|
|
277
1131
|
] }),
|
|
278
|
-
(label || description) && /* @__PURE__ */
|
|
279
|
-
label && /* @__PURE__ */
|
|
280
|
-
description && /* @__PURE__ */
|
|
1132
|
+
(label || description) && /* @__PURE__ */ jsxs9("span", { className: "flex flex-col", children: [
|
|
1133
|
+
label && /* @__PURE__ */ jsx10("span", { className: `${sz.label} font-medium ${labelColor}`, children: label }),
|
|
1134
|
+
description && /* @__PURE__ */ jsx10("span", { className: `${sz.description} ${descriptionColor}`, children: description })
|
|
281
1135
|
] })
|
|
282
1136
|
]
|
|
283
1137
|
}
|
|
284
1138
|
);
|
|
285
1139
|
}
|
|
286
1140
|
);
|
|
287
|
-
|
|
1141
|
+
Radio.displayName = "Radio";
|
|
1142
|
+
|
|
1143
|
+
// src/components/Slider/Slider.tsx
|
|
1144
|
+
import {
|
|
1145
|
+
forwardRef as forwardRef11,
|
|
1146
|
+
useCallback as useCallback4,
|
|
1147
|
+
useId as useId4,
|
|
1148
|
+
useState as useState5
|
|
1149
|
+
} from "react";
|
|
1150
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1151
|
+
var sizeConfig = {
|
|
1152
|
+
small: {
|
|
1153
|
+
trackH: "h-4",
|
|
1154
|
+
thumbPx: 24,
|
|
1155
|
+
thumbClass: "h-24 w-24",
|
|
1156
|
+
iconPx: 12,
|
|
1157
|
+
containerH: "h-24",
|
|
1158
|
+
label: "text-sm leading-20",
|
|
1159
|
+
description: "text-xs leading-16"
|
|
1160
|
+
},
|
|
1161
|
+
medium: {
|
|
1162
|
+
trackH: "h-6",
|
|
1163
|
+
thumbPx: 28,
|
|
1164
|
+
thumbClass: "h-28 w-28",
|
|
1165
|
+
iconPx: 14,
|
|
1166
|
+
containerH: "h-28",
|
|
1167
|
+
label: "text-base leading-24",
|
|
1168
|
+
description: "text-sm leading-20"
|
|
1169
|
+
},
|
|
1170
|
+
large: {
|
|
1171
|
+
trackH: "h-8",
|
|
1172
|
+
thumbPx: 32,
|
|
1173
|
+
thumbClass: "h-32 w-32",
|
|
1174
|
+
iconPx: 16,
|
|
1175
|
+
containerH: "h-32",
|
|
1176
|
+
label: "text-base leading-24",
|
|
1177
|
+
description: "text-sm leading-20"
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
function ChevronGlyphs({ size, color }) {
|
|
1181
|
+
return /* @__PURE__ */ jsxs10(
|
|
1182
|
+
"svg",
|
|
1183
|
+
{
|
|
1184
|
+
width: size,
|
|
1185
|
+
height: size,
|
|
1186
|
+
viewBox: "0 0 12 12",
|
|
1187
|
+
fill: "none",
|
|
1188
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1189
|
+
"aria-hidden": "true",
|
|
1190
|
+
children: [
|
|
1191
|
+
/* @__PURE__ */ jsx11(
|
|
1192
|
+
"path",
|
|
1193
|
+
{
|
|
1194
|
+
d: "M4.75 3.25L2.25 6L4.75 8.75",
|
|
1195
|
+
stroke: color,
|
|
1196
|
+
strokeWidth: "1.25",
|
|
1197
|
+
strokeLinecap: "round",
|
|
1198
|
+
strokeLinejoin: "round"
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
/* @__PURE__ */ jsx11(
|
|
1202
|
+
"path",
|
|
1203
|
+
{
|
|
1204
|
+
d: "M7.25 3.25L9.75 6L7.25 8.75",
|
|
1205
|
+
stroke: color,
|
|
1206
|
+
strokeWidth: "1.25",
|
|
1207
|
+
strokeLinecap: "round",
|
|
1208
|
+
strokeLinejoin: "round"
|
|
1209
|
+
}
|
|
1210
|
+
)
|
|
1211
|
+
]
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
var Slider = forwardRef11(
|
|
1216
|
+
(_a, ref) => {
|
|
1217
|
+
var _b = _a, {
|
|
1218
|
+
size = "medium",
|
|
1219
|
+
label,
|
|
1220
|
+
description,
|
|
1221
|
+
error = false,
|
|
1222
|
+
showValue = false,
|
|
1223
|
+
min = 0,
|
|
1224
|
+
max = 100,
|
|
1225
|
+
step = 1,
|
|
1226
|
+
value: controlledValue,
|
|
1227
|
+
defaultValue,
|
|
1228
|
+
disabled = false,
|
|
1229
|
+
className = "",
|
|
1230
|
+
id,
|
|
1231
|
+
onChange,
|
|
1232
|
+
"aria-label": ariaLabelProp
|
|
1233
|
+
} = _b, rest = __objRest(_b, [
|
|
1234
|
+
"size",
|
|
1235
|
+
"label",
|
|
1236
|
+
"description",
|
|
1237
|
+
"error",
|
|
1238
|
+
"showValue",
|
|
1239
|
+
"min",
|
|
1240
|
+
"max",
|
|
1241
|
+
"step",
|
|
1242
|
+
"value",
|
|
1243
|
+
"defaultValue",
|
|
1244
|
+
"disabled",
|
|
1245
|
+
"className",
|
|
1246
|
+
"id",
|
|
1247
|
+
"onChange",
|
|
1248
|
+
"aria-label"
|
|
1249
|
+
]);
|
|
1250
|
+
const reactId = useId4();
|
|
1251
|
+
const inputId = id != null ? id : reactId;
|
|
1252
|
+
const sz = sizeConfig[size];
|
|
1253
|
+
const ariaLabel = ariaLabelProp != null ? ariaLabelProp : typeof label === "string" ? void 0 : "Slider";
|
|
1254
|
+
const ariaDescriptionId = description ? `${inputId}-description` : void 0;
|
|
1255
|
+
const isControlled = controlledValue !== void 0;
|
|
1256
|
+
const [internalValue, setInternalValue] = useState5(defaultValue != null ? defaultValue : min);
|
|
1257
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
1258
|
+
const handleChange = useCallback4(
|
|
1259
|
+
(e) => {
|
|
1260
|
+
const val = Number(e.target.value);
|
|
1261
|
+
if (!isControlled) {
|
|
1262
|
+
setInternalValue(val);
|
|
1263
|
+
}
|
|
1264
|
+
onChange == null ? void 0 : onChange(val, e);
|
|
1265
|
+
},
|
|
1266
|
+
[isControlled, onChange]
|
|
1267
|
+
);
|
|
1268
|
+
const percent = (currentValue - min) / (max - min) * 100;
|
|
1269
|
+
const trackBg = disabled ? "bg-slider-track-disabled" : "bg-slider-track";
|
|
1270
|
+
const fillBg = disabled ? "bg-slider-fill-disabled" : error ? "bg-slider-fill-error" : "bg-slider-fill";
|
|
1271
|
+
const thumbBorder = disabled ? "border-slider-thumb-border-disabled" : error ? "border-slider-thumb-border-error" : "border-gray-200";
|
|
1272
|
+
const thumbBg = disabled ? "bg-slider-thumb-disabled" : "bg-slider-thumb";
|
|
1273
|
+
const iconColor = disabled ? "var(--color-gray-400)" : "var(--color-gray-500)";
|
|
1274
|
+
const labelColor = disabled ? "text-slider-label-disabled" : error ? "text-slider-label-error" : "text-slider-label";
|
|
1275
|
+
const descriptionColor = disabled ? "text-slider-label-disabled" : "text-slider-description";
|
|
1276
|
+
const thumbOffset = percent * sz.thumbPx / 100;
|
|
1277
|
+
const fillOffset = sz.thumbPx / 2 - thumbOffset;
|
|
1278
|
+
return /* @__PURE__ */ jsxs10(
|
|
1279
|
+
"div",
|
|
1280
|
+
{
|
|
1281
|
+
className: ["flex w-full flex-col gap-8 font-sans", className].filter(Boolean).join(" "),
|
|
1282
|
+
children: [
|
|
1283
|
+
(label || showValue && !disabled) && /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
|
|
1284
|
+
label && /* @__PURE__ */ jsx11(
|
|
1285
|
+
"label",
|
|
1286
|
+
{
|
|
1287
|
+
htmlFor: inputId,
|
|
1288
|
+
className: [
|
|
1289
|
+
sz.label,
|
|
1290
|
+
"font-medium",
|
|
1291
|
+
labelColor,
|
|
1292
|
+
disabled ? "cursor-not-allowed" : "cursor-default"
|
|
1293
|
+
].join(" "),
|
|
1294
|
+
children: label
|
|
1295
|
+
}
|
|
1296
|
+
),
|
|
1297
|
+
showValue && /* @__PURE__ */ jsx11(
|
|
1298
|
+
"span",
|
|
1299
|
+
{
|
|
1300
|
+
className: [sz.description, "tabular-nums", labelColor].join(" "),
|
|
1301
|
+
children: currentValue
|
|
1302
|
+
}
|
|
1303
|
+
)
|
|
1304
|
+
] }),
|
|
1305
|
+
/* @__PURE__ */ jsxs10(
|
|
1306
|
+
"div",
|
|
1307
|
+
{
|
|
1308
|
+
className: [
|
|
1309
|
+
"relative flex items-center",
|
|
1310
|
+
sz.containerH,
|
|
1311
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1312
|
+
].join(" "),
|
|
1313
|
+
children: [
|
|
1314
|
+
/* @__PURE__ */ jsx11(
|
|
1315
|
+
"div",
|
|
1316
|
+
{
|
|
1317
|
+
className: [
|
|
1318
|
+
"absolute inset-x-0 rounded-full",
|
|
1319
|
+
sz.trackH,
|
|
1320
|
+
trackBg
|
|
1321
|
+
].join(" ")
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ jsx11(
|
|
1325
|
+
"div",
|
|
1326
|
+
{
|
|
1327
|
+
className: ["absolute left-0 rounded-full", sz.trackH, fillBg].join(" "),
|
|
1328
|
+
style: { width: `calc(${percent}% + ${fillOffset}px)` }
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
/* @__PURE__ */ jsx11(
|
|
1332
|
+
"input",
|
|
1333
|
+
__spreadValues({
|
|
1334
|
+
ref,
|
|
1335
|
+
id: inputId,
|
|
1336
|
+
type: "range",
|
|
1337
|
+
min,
|
|
1338
|
+
max,
|
|
1339
|
+
step,
|
|
1340
|
+
value: currentValue,
|
|
1341
|
+
disabled,
|
|
1342
|
+
onChange: handleChange,
|
|
1343
|
+
"aria-label": ariaLabel,
|
|
1344
|
+
"aria-describedby": ariaDescriptionId,
|
|
1345
|
+
className: [
|
|
1346
|
+
"peer absolute inset-0 z-20 w-full appearance-none bg-transparent opacity-0",
|
|
1347
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1348
|
+
"focus:outline-none"
|
|
1349
|
+
].join(" ")
|
|
1350
|
+
}, rest)
|
|
1351
|
+
),
|
|
1352
|
+
/* @__PURE__ */ jsx11(
|
|
1353
|
+
"div",
|
|
1354
|
+
{
|
|
1355
|
+
className: [
|
|
1356
|
+
"pointer-events-none absolute z-10 flex items-center justify-center rounded-full border",
|
|
1357
|
+
sz.thumbClass,
|
|
1358
|
+
thumbBg,
|
|
1359
|
+
thumbBorder,
|
|
1360
|
+
disabled ? "" : "shadow-base transition-shadow duration-150",
|
|
1361
|
+
!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"),
|
|
1362
|
+
!disabled && "peer-hover:shadow-medium"
|
|
1363
|
+
].filter(Boolean).join(" "),
|
|
1364
|
+
style: { left: `calc(${percent}% - ${thumbOffset}px)` },
|
|
1365
|
+
children: /* @__PURE__ */ jsx11(ChevronGlyphs, { size: sz.iconPx, color: iconColor })
|
|
1366
|
+
}
|
|
1367
|
+
)
|
|
1368
|
+
]
|
|
1369
|
+
}
|
|
1370
|
+
),
|
|
1371
|
+
description && /* @__PURE__ */ jsx11(
|
|
1372
|
+
"span",
|
|
1373
|
+
{
|
|
1374
|
+
id: ariaDescriptionId,
|
|
1375
|
+
className: [sz.description, descriptionColor].join(" "),
|
|
1376
|
+
children: description
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
]
|
|
1380
|
+
}
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
Slider.displayName = "Slider";
|
|
1385
|
+
|
|
1386
|
+
// src/components/Toast/Toast.tsx
|
|
1387
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
1388
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1389
|
+
function CheckCircleIcon({ className }) {
|
|
1390
|
+
return /* @__PURE__ */ jsxs11("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1391
|
+
/* @__PURE__ */ jsx12("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1392
|
+
/* @__PURE__ */ jsx12("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1393
|
+
] });
|
|
1394
|
+
}
|
|
1395
|
+
function ProgressIcon({ className }) {
|
|
1396
|
+
return /* @__PURE__ */ jsxs11("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1397
|
+
/* @__PURE__ */ jsx12("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5", opacity: "0.3" }),
|
|
1398
|
+
/* @__PURE__ */ jsx12("path", { d: "M10 2a8 8 0 0 1 8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: /* @__PURE__ */ jsx12("animateTransform", { attributeName: "transform", type: "rotate", from: "0 10 10", to: "360 10 10", dur: "1s", repeatCount: "indefinite" }) })
|
|
1399
|
+
] });
|
|
1400
|
+
}
|
|
1401
|
+
function ErrorIcon({ className }) {
|
|
1402
|
+
return /* @__PURE__ */ jsxs11("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1403
|
+
/* @__PURE__ */ jsx12("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1404
|
+
/* @__PURE__ */ jsx12("path", { d: "M10 6.5v4M10 13.5h.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1405
|
+
] });
|
|
1406
|
+
}
|
|
1407
|
+
function CloseIcon2({ className }) {
|
|
1408
|
+
return /* @__PURE__ */ jsx12("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx12("path", { d: "M12 4 4 12M4 4l8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1409
|
+
}
|
|
1410
|
+
var defaultIcons2 = {
|
|
1411
|
+
default: CheckCircleIcon,
|
|
1412
|
+
progress: ProgressIcon,
|
|
1413
|
+
error: ErrorIcon
|
|
1414
|
+
};
|
|
1415
|
+
var typeClasses = {
|
|
1416
|
+
default: "bg-toast-default-bg text-toast-default-text",
|
|
1417
|
+
progress: "bg-toast-progress-bg text-toast-progress-text",
|
|
1418
|
+
error: "bg-toast-error-bg text-toast-error-text"
|
|
1419
|
+
};
|
|
1420
|
+
var iconColorClasses = {
|
|
1421
|
+
default: "text-toast-default-icon",
|
|
1422
|
+
progress: "text-toast-progress-icon",
|
|
1423
|
+
error: "text-toast-error-icon"
|
|
1424
|
+
};
|
|
1425
|
+
var Toast = forwardRef12(
|
|
1426
|
+
(_a, ref) => {
|
|
1427
|
+
var _b = _a, {
|
|
1428
|
+
type = "default",
|
|
1429
|
+
icon = true,
|
|
1430
|
+
actionLabel,
|
|
1431
|
+
onAction,
|
|
1432
|
+
onDismiss,
|
|
1433
|
+
children,
|
|
1434
|
+
className = ""
|
|
1435
|
+
} = _b, rest = __objRest(_b, [
|
|
1436
|
+
"type",
|
|
1437
|
+
"icon",
|
|
1438
|
+
"actionLabel",
|
|
1439
|
+
"onAction",
|
|
1440
|
+
"onDismiss",
|
|
1441
|
+
"children",
|
|
1442
|
+
"className"
|
|
1443
|
+
]);
|
|
1444
|
+
const DefaultIcon = defaultIcons2[type];
|
|
1445
|
+
const classes = [
|
|
1446
|
+
"inline-flex items-center gap-12 font-sans",
|
|
1447
|
+
"rounded-xl px-16 py-12",
|
|
1448
|
+
"min-w-[320px] max-w-[480px]",
|
|
1449
|
+
"shadow-large",
|
|
1450
|
+
typeClasses[type],
|
|
1451
|
+
className
|
|
1452
|
+
].filter(Boolean).join(" ");
|
|
1453
|
+
return /* @__PURE__ */ jsxs11("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
|
|
1454
|
+
icon && /* @__PURE__ */ jsx12("span", { className: `shrink-0 ${iconColorClasses[type]}`, children: /* @__PURE__ */ jsx12(DefaultIcon, { className: "h-20 w-20" }) }),
|
|
1455
|
+
/* @__PURE__ */ jsx12("span", { className: "flex-1 text-sm font-medium leading-20 truncate", children }),
|
|
1456
|
+
actionLabel && onAction && /* @__PURE__ */ jsx12(
|
|
1457
|
+
"button",
|
|
1458
|
+
{
|
|
1459
|
+
type: "button",
|
|
1460
|
+
onClick: onAction,
|
|
1461
|
+
className: "shrink-0 text-sm font-medium text-toast-action-text hover:bg-toast-action-bg-hover rounded-md px-8 py-4 transition-colors",
|
|
1462
|
+
children: actionLabel
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
onDismiss && /* @__PURE__ */ jsx12(
|
|
1466
|
+
"button",
|
|
1467
|
+
{
|
|
1468
|
+
type: "button",
|
|
1469
|
+
onClick: onDismiss,
|
|
1470
|
+
className: "shrink-0 p-4 rounded-md text-toast-dismiss hover:text-toast-dismiss-hover transition-colors",
|
|
1471
|
+
"aria-label": "Dismiss",
|
|
1472
|
+
children: /* @__PURE__ */ jsx12(CloseIcon2, { className: "h-16 w-16" })
|
|
1473
|
+
}
|
|
1474
|
+
)
|
|
1475
|
+
] }));
|
|
1476
|
+
}
|
|
1477
|
+
);
|
|
1478
|
+
Toast.displayName = "Toast";
|
|
288
1479
|
export {
|
|
1480
|
+
Accordion,
|
|
1481
|
+
AlertBanner,
|
|
1482
|
+
Avatar,
|
|
1483
|
+
Badge,
|
|
1484
|
+
BottomSheet,
|
|
289
1485
|
Button,
|
|
290
|
-
Checkbox
|
|
1486
|
+
Checkbox,
|
|
1487
|
+
Dialog,
|
|
1488
|
+
Icon,
|
|
1489
|
+
Radio,
|
|
1490
|
+
Slider,
|
|
1491
|
+
Toast
|
|
291
1492
|
};
|