@refinn/core-ui 0.1.3 → 0.1.5

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.mjs DELETED
@@ -1,1540 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
-
33
- // src/components/Accordion/Accordion.tsx
34
- import {
35
- forwardRef,
36
- useCallback,
37
- useId,
38
- useState
39
- } from "react";
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 forwardRef6 } from "react";
470
-
471
- // src/components/Loading/Loading.tsx
472
- import { forwardRef as forwardRef5 } from "react";
473
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
474
- var Loading = forwardRef5(
475
- (_a, ref) => {
476
- var _b = _a, { size = "sm", isDark = false, className = "" } = _b, rest = __objRest(_b, ["size", "isDark", "className"]);
477
- const containerClasses = [
478
- isDark ? "text-white-100" : "text-blue-600",
479
- className
480
- ].filter(Boolean).join(" ");
481
- return size === "sm" && !isDark ? /* @__PURE__ */ jsx5("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: /* @__PURE__ */ jsxs5(
482
- "svg",
483
- {
484
- className: "animate-spin",
485
- xmlns: "http://www.w3.org/2000/svg",
486
- width: "18",
487
- height: "18",
488
- viewBox: "0 0 18 18",
489
- fill: "none",
490
- children: [
491
- /* @__PURE__ */ jsx5(
492
- "path",
493
- {
494
- d: "M1 9C1 6.87827 1.84286 4.84344 3.34315 3.34315C4.84344 1.84285 6.87827 1 9 1C11.1217 1 13.1566 1.84286 14.6569 3.34315C16.1571 4.84344 17 6.87827 17 9C17 11.1217 16.1571 13.1566 14.6569 14.6569C13.1566 16.1571 11.1217 17 9 17C6.87827 17 4.84344 16.1571 3.34315 14.6569C1.84285 13.1566 1 11.1217 1 9L1 9Z",
495
- stroke: "#F3F4F6",
496
- "stroke-width": "2"
497
- }
498
- ),
499
- /* @__PURE__ */ jsx5(
500
- "path",
501
- {
502
- d: "M1 9C1 7.31057 1.53484 5.6645 2.52786 4.29772C3.52089 2.93094 4.92112 1.91361 6.52787 1.39155C8.13461 0.869484 9.86539 0.869484 11.4721 1.39155C13.0789 1.91361 14.4791 2.93094 15.4721 4.29772",
503
- stroke: "#0193D7",
504
- "stroke-width": "2"
505
- }
506
- )
507
- ]
508
- }
509
- ) })) : /* @__PURE__ */ jsx5("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: /* @__PURE__ */ jsx5(
510
- "svg",
511
- {
512
- className: "animate-spin",
513
- width: size === "sm" ? 18 : 88,
514
- height: size === "sm" ? 18 : 88,
515
- viewBox: "0 0 20 20",
516
- fill: "none",
517
- children: /* @__PURE__ */ jsx5(
518
- "path",
519
- {
520
- d: "M10 2.5a7.5 7.5 0 1 0 7.5 7.5",
521
- stroke: "currentColor",
522
- strokeWidth: size === "sm" ? 2 : 1,
523
- strokeLinecap: "round"
524
- }
525
- )
526
- }
527
- ) }));
528
- }
529
- );
530
- Loading.displayName = "Loading";
531
-
532
- // src/components/Button/Button.tsx
533
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
534
- var variantClasses = {
535
- primary: [
536
- "bg-blue-600 text-white-100",
537
- "hover:bg-blue-700",
538
- "active:bg-blue-800",
539
- "focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
540
- "disabled:bg-gray-100 disabled:text-gray-400"
541
- ].join(" "),
542
- secondary: [
543
- "bg-gray-100 text-gray-900",
544
- "hover:bg-gray-200",
545
- "active:bg-gray-300",
546
- "focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
547
- "disabled:bg-gray-100 disabled:text-gray-400"
548
- ].join(" "),
549
- tertiary: [
550
- "bg-black-0 text-gray-900",
551
- "hover:bg-gray-200",
552
- "active:bg-gray-300",
553
- "focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
554
- "disabled:bg-gray-100 disabled:text-gray-400"
555
- ].join(" "),
556
- contrast: [
557
- "bg-white-100 text-blue-600",
558
- "hover:bg-white-90",
559
- "active:bg-white-80",
560
- "focus-visible:ring-2 focus-visible:ring-white-100 focus-visible:ring-offset-2",
561
- "disabled:bg-gray-50 disabled:text-gray-400"
562
- ].join(" "),
563
- transparent: [
564
- "bg-black-0 text-white-100",
565
- "hover:bg-white-20",
566
- "active:bg-white-30",
567
- "focus-visible:ring-2 focus-visible:ring-white-100 focus-visible:bg-black-0 focus-visible:ring-offset-2",
568
- "disabled:bg-black-0 disabled:text-white-40"
569
- ].join(" ")
570
- };
571
- var sizeClasses3 = {
572
- sm: "px-16 py-6 text-label-medium",
573
- md: "px-20 py-8 text-label-large",
574
- lg: "px-24 py-12 text-label-large",
575
- xl: "px-32 py-16 text-label-large"
576
- };
577
- var Button = forwardRef6(
578
- (_a, ref) => {
579
- var _b = _a, {
580
- variant = "primary",
581
- size = "md",
582
- rounded = false,
583
- loading = false,
584
- disabled = false,
585
- startIcon,
586
- endIcon,
587
- children,
588
- className = ""
589
- } = _b, rest = __objRest(_b, [
590
- "variant",
591
- "size",
592
- "rounded",
593
- "loading",
594
- "disabled",
595
- "startIcon",
596
- "endIcon",
597
- "children",
598
- "className"
599
- ]);
600
- const isDisabled = disabled;
601
- const classes = [
602
- "inline-flex items-center justify-center gap-8",
603
- "transition-colors duration-150",
604
- "outline-none",
605
- "disabled:cursor-not-allowed",
606
- loading ? "pointer-events-none" : "cursor-pointer",
607
- sizeClasses3[size],
608
- variantClasses[variant],
609
- rounded ? "rounded-full" : size === "sm" ? "rounded-6" : size === "xl" ? "rounded-12" : "rounded-8",
610
- className
611
- ].filter(Boolean).join(" ");
612
- return /* @__PURE__ */ jsxs6("button", __spreadProps(__spreadValues({ ref, disabled: isDisabled, className: classes }, rest), { children: [
613
- loading ? /* @__PURE__ */ jsx6(Loading, { size: "sm", isDark: variant === "primary" || variant === "transparent" }) : startIcon,
614
- children,
615
- !loading && endIcon
616
- ] }));
617
- }
618
- );
619
- Button.displayName = "Button";
620
-
621
- // src/components/BottomSheet/BottomSheet.tsx
622
- import React, { useEffect, useState as useState2, useCallback as useCallback2, forwardRef as forwardRef7 } from "react";
623
- import { createPortal } from "react-dom";
624
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
625
- var BottomSheet = forwardRef7(
626
- (_a, ref) => {
627
- var _b = _a, {
628
- isForceOpen = false,
629
- setIsForceOpen,
630
- isClosedAble = true,
631
- children,
632
- startModalBtn,
633
- stopModalBtn,
634
- afterStopBtn,
635
- size = "md",
636
- modalTitle = "\u0E2B\u0E31\u0E27\u0E02\u0E49\u0E2D",
637
- modalDesc = "\u0E04\u0E33\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22",
638
- className = ""
639
- } = _b, rest = __objRest(_b, [
640
- "isForceOpen",
641
- "setIsForceOpen",
642
- "isClosedAble",
643
- "children",
644
- "startModalBtn",
645
- "stopModalBtn",
646
- "afterStopBtn",
647
- "size",
648
- "modalTitle",
649
- "modalDesc",
650
- "className"
651
- ]);
652
- const [isOpen, setIsOpen] = useState2(false);
653
- const [shouldRender, setShouldRender] = useState2(false);
654
- const [animate, setAnimate] = useState2(false);
655
- useEffect(() => {
656
- if (isOpen) {
657
- setShouldRender(true);
658
- setTimeout(() => setAnimate(true), 10);
659
- } else {
660
- setAnimate(false);
661
- const timer = setTimeout(() => setShouldRender(false), 300);
662
- return () => clearTimeout(timer);
663
- }
664
- }, [isOpen]);
665
- useEffect(() => {
666
- if (isForceOpen) {
667
- setIsOpen(true);
668
- } else {
669
- setIsOpen(false);
670
- }
671
- }, [isForceOpen]);
672
- const handleStartClick = useCallback2(
673
- (e) => {
674
- var _a2, _b2;
675
- (_b2 = startModalBtn == null ? void 0 : (_a2 = startModalBtn.props).onClick) == null ? void 0 : _b2.call(_a2, e);
676
- setIsForceOpen == null ? void 0 : setIsForceOpen(true);
677
- setIsOpen(true);
678
- },
679
- [startModalBtn]
680
- );
681
- const handleStopClick = useCallback2(
682
- (e) => {
683
- var _a2, _b2;
684
- (_b2 = stopModalBtn == null ? void 0 : (_a2 = stopModalBtn.props).onClick) == null ? void 0 : _b2.call(_a2, e);
685
- setIsForceOpen == null ? void 0 : setIsForceOpen(false);
686
- setIsOpen(false);
687
- },
688
- [stopModalBtn]
689
- );
690
- const handleCloseClick = () => {
691
- setIsForceOpen == null ? void 0 : setIsForceOpen(false);
692
- setIsOpen(false);
693
- };
694
- return /* @__PURE__ */ jsxs7("span", { ref, style: { display: "contents" }, children: [
695
- startModalBtn && React.cloneElement(startModalBtn, {
696
- onClick: handleStartClick
697
- }),
698
- shouldRender && createPortal(
699
- /* @__PURE__ */ jsxs7(
700
- "div",
701
- {
702
- className: `fixed inset-0 z-50 flex items-end justify-center transition-opacity duration-300 ${animate ? "opacity-100" : "opacity-0"}`,
703
- "aria-modal": "true",
704
- role: "dialog",
705
- children: [
706
- /* @__PURE__ */ jsx7(
707
- "div",
708
- {
709
- className: "absolute inset-0 bg-black/40",
710
- onClick: () => isClosedAble ? handleCloseClick() : null,
711
- "aria-label": "Close modal"
712
- }
713
- ),
714
- /* @__PURE__ */ jsxs7(
715
- "div",
716
- {
717
- 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
718
- ${size === "sm" ? "h-auto max-h-auto" : size === "md" ? "h-full max-h-[85vh]" : "h-full max-h-screen rounded-t-none!"}
719
- ${animate ? "scale-100 translate-y-0" : "scale-95 translate-y-full"}`,
720
- children: [
721
- /* @__PURE__ */ jsxs7("div", { className: "w-full flex flex-row relative items-center pt-8 pb-16", children: [
722
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-col px-8 max-w-225", children: [
723
- /* @__PURE__ */ jsx7("p", { className: "text-heading-3 text-button-sheet-text-primary", children: modalTitle }),
724
- /* @__PURE__ */ jsx7("p", { className: "text-body-small text-button-sheet-text-secondary", children: modalDesc })
725
- ] }),
726
- /* @__PURE__ */ jsx7(
727
- "i",
728
- {
729
- className: "fi fi-br-cross-small flex text-xl text-gray-600 w-44 h-44 absolute top-0 right-0 p-12",
730
- onClick: () => handleCloseClick()
731
- }
732
- ),
733
- /* @__PURE__ */ jsx7(
734
- "div",
735
- {
736
- className: "text-gray-600 text-xl absolute top-0 right-0 p-12",
737
- onClick: () => handleCloseClick(),
738
- children: "x"
739
- }
740
- )
741
- ] }),
742
- /* @__PURE__ */ jsxs7("div", { className: "w-full h-full grow overflow-y-auto overflow-x-visible", children: [
743
- children,
744
- stopModalBtn && React.cloneElement(stopModalBtn, {
745
- onClick: handleStopClick
746
- }),
747
- afterStopBtn && afterStopBtn
748
- ] })
749
- ]
750
- }
751
- )
752
- ]
753
- }
754
- ),
755
- document.body
756
- )
757
- ] });
758
- }
759
- );
760
- BottomSheet.displayName = "BottomSheet";
761
-
762
- // src/components/Checkbox/Checkbox.tsx
763
- import {
764
- forwardRef as forwardRef8,
765
- useId as useId2,
766
- useState as useState3
767
- } from "react";
768
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
769
- function CheckIcon({ className }) {
770
- return /* @__PURE__ */ jsx8(
771
- "svg",
772
- {
773
- className,
774
- viewBox: "0 0 16 16",
775
- fill: "none",
776
- "aria-hidden": "true",
777
- children: /* @__PURE__ */ jsx8(
778
- "path",
779
- {
780
- d: "M13.333 4.667 6 12l-3.333-3.333",
781
- stroke: "currentColor",
782
- strokeWidth: "2",
783
- strokeLinecap: "round",
784
- strokeLinejoin: "round"
785
- }
786
- )
787
- }
788
- );
789
- }
790
- function IndeterminateIcon({ className }) {
791
- return /* @__PURE__ */ jsx8(
792
- "svg",
793
- {
794
- className,
795
- viewBox: "0 0 16 16",
796
- fill: "none",
797
- "aria-hidden": "true",
798
- children: /* @__PURE__ */ jsx8(
799
- "path",
800
- {
801
- d: "M3.333 8h9.334",
802
- stroke: "currentColor",
803
- strokeWidth: "2",
804
- strokeLinecap: "round"
805
- }
806
- )
807
- }
808
- );
809
- }
810
- var Checkbox = forwardRef8(
811
- (_a, ref) => {
812
- var _b = _a, {
813
- label,
814
- description,
815
- error = false,
816
- contrast = false,
817
- indeterminate = false,
818
- disabled = false,
819
- className = "",
820
- id,
821
- defaultChecked
822
- } = _b, rest = __objRest(_b, [
823
- "label",
824
- "description",
825
- "error",
826
- "contrast",
827
- "indeterminate",
828
- "disabled",
829
- "className",
830
- "id",
831
- "defaultChecked"
832
- ]);
833
- const reactId = useId2();
834
- const inputId = id != null ? id : reactId;
835
- const [isChecked, setIsChecked] = useState3(defaultChecked != null ? defaultChecked : false);
836
- return /* @__PURE__ */ jsxs8(
837
- "label",
838
- {
839
- htmlFor: inputId,
840
- className: `flex select-none font-sans ${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${className}`,
841
- children: [
842
- /* @__PURE__ */ jsxs8("div", { className: "relative mr-16", children: [
843
- /* @__PURE__ */ jsx8(
844
- "input",
845
- __spreadValues({
846
- ref,
847
- id: inputId,
848
- type: "checkbox",
849
- defaultChecked,
850
- onChange: (e) => {
851
- var _a2;
852
- setIsChecked(e.target.checked);
853
- (_a2 = rest.onChange) == null ? void 0 : _a2.call(rest, e);
854
- },
855
- disabled,
856
- "aria-checked": indeterminate ? "mixed" : isChecked,
857
- className: "sr-only"
858
- }, rest)
859
- ),
860
- /* @__PURE__ */ jsx8(
861
- "div",
862
- {
863
- 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"}`,
864
- children: isChecked ? /* @__PURE__ */ jsx8(
865
- CheckIcon,
866
- {
867
- className: `h-20 ${contrast ? "text-static-icon-brand" : "text-white"}`
868
- }
869
- ) : indeterminate ? /* @__PURE__ */ jsx8(
870
- IndeterminateIcon,
871
- {
872
- className: `h-20 ${contrast ? "text-static-icon-brand" : "text-white"}`
873
- }
874
- ) : null
875
- }
876
- )
877
- ] }),
878
- (label || description) && /* @__PURE__ */ jsxs8("span", { className: "flex flex-col", children: [
879
- label && /* @__PURE__ */ jsx8(
880
- "span",
881
- {
882
- className: `text-label-large ${disabled ? "text-checkbox-text-disabled" : contrast ? "text-checkbox-text-primary-inverse" : "text-checkbox-text-primary"}`,
883
- children: label
884
- }
885
- ),
886
- description && /* @__PURE__ */ jsx8(
887
- "span",
888
- {
889
- className: `text-body-small ${error ? "text-checkbox-text-danger" : disabled ? "text-checkbox-text-disabled" : contrast ? "text-checkbox-text-primary-inverse" : "text-checkbox-text-secondary"}`,
890
- children: description
891
- }
892
- )
893
- ] })
894
- ]
895
- }
896
- );
897
- }
898
- );
899
- Checkbox.displayName = "Checkbox";
900
-
901
- // src/components/Dialog/Dialog.tsx
902
- import React2, {
903
- useEffect as useEffect2,
904
- useState as useState4,
905
- useCallback as useCallback3,
906
- forwardRef as forwardRef9
907
- } from "react";
908
- import { createPortal as createPortal2 } from "react-dom";
909
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
910
- var Dialog = forwardRef9(
911
- ({
912
- isForceOpen = false,
913
- setIsForceOpen,
914
- isClosedAble = true,
915
- isCloseIcon = true,
916
- children,
917
- startModalBtn,
918
- stopModalBtn,
919
- afterStopBtn,
920
- p = "20"
921
- }, ref) => {
922
- const [isOpen, setIsOpen] = useState4(false);
923
- const [isRender, setIsRender] = useState4(false);
924
- const [animate, setAnimate] = useState4(false);
925
- useEffect2(() => {
926
- if (isOpen) {
927
- setIsRender(true);
928
- setTimeout(() => setAnimate(true), 10);
929
- } else {
930
- setAnimate(false);
931
- const timer = setTimeout(() => setIsRender(false), 300);
932
- return () => clearTimeout(timer);
933
- }
934
- }, [isOpen]);
935
- useEffect2(() => {
936
- if (isForceOpen) {
937
- setIsOpen(true);
938
- } else {
939
- setIsOpen(false);
940
- }
941
- }, [isForceOpen]);
942
- const handleStartClick = useCallback3(
943
- (e) => {
944
- var _a, _b;
945
- (_b = startModalBtn == null ? void 0 : (_a = startModalBtn.props).onClick) == null ? void 0 : _b.call(_a, e);
946
- setIsForceOpen == null ? void 0 : setIsForceOpen(true);
947
- setIsOpen(true);
948
- },
949
- [startModalBtn]
950
- );
951
- const handleStopClick = useCallback3(
952
- (e) => {
953
- var _a, _b;
954
- (_b = stopModalBtn == null ? void 0 : (_a = stopModalBtn.props).onClick) == null ? void 0 : _b.call(_a, e);
955
- setIsForceOpen == null ? void 0 : setIsForceOpen(false);
956
- setIsOpen(false);
957
- },
958
- [stopModalBtn]
959
- );
960
- const handleCloseClick = () => {
961
- setIsForceOpen == null ? void 0 : setIsForceOpen(false);
962
- setIsOpen(false);
963
- };
964
- return /* @__PURE__ */ jsxs9("span", { ref, style: { display: "contents" }, children: [
965
- startModalBtn && React2.cloneElement(startModalBtn, {
966
- onClick: handleStartClick
967
- }),
968
- isRender && createPortal2(
969
- /* @__PURE__ */ jsxs9(
970
- "div",
971
- {
972
- className: `fixed inset-0 z-50 flex items-center justify-center transition-opacity duration-300 ${animate ? "opacity-100" : "opacity-0"}`,
973
- "aria-modal": "true",
974
- role: "dialog",
975
- children: [
976
- /* @__PURE__ */ jsx9(
977
- "div",
978
- {
979
- className: "absolute inset-0 bg-black/40",
980
- onClick: () => isClosedAble ? handleCloseClick() : null,
981
- "aria-label": "Close modal"
982
- }
983
- ),
984
- /* @__PURE__ */ jsxs9(
985
- "div",
986
- {
987
- 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"}`,
988
- children: [
989
- isCloseIcon && /* @__PURE__ */ jsx9(
990
- "svg",
991
- {
992
- xmlns: "http://www.w3.org/2000/svg",
993
- width: "20",
994
- height: "20",
995
- viewBox: "0 0 20 20",
996
- fill: "none",
997
- className: "text-gray-900 flex h-20 w-20 items-center justify-center absolute right-16 top-16 cursor-pointer",
998
- onMouseDown: (e) => {
999
- e.preventDefault();
1000
- handleCloseClick();
1001
- },
1002
- children: /* @__PURE__ */ jsx9(
1003
- "path",
1004
- {
1005
- d: "M14.7119 6.0625L10.7744 10L14.7119 13.9375L13.9375 14.7119L10 10.7744L6.0625 14.7119L5.28809 13.9375L9.22559 10L5.28809 6.0625L6.0625 5.28809L10 9.22559L13.9375 5.28809L14.7119 6.0625Z",
1006
- fill: "#111827"
1007
- }
1008
- )
1009
- }
1010
- ),
1011
- children,
1012
- stopModalBtn && React2.cloneElement(stopModalBtn, {
1013
- onClick: handleStopClick
1014
- }),
1015
- afterStopBtn && afterStopBtn
1016
- ]
1017
- }
1018
- )
1019
- ]
1020
- }
1021
- ),
1022
- document.body
1023
- )
1024
- ] });
1025
- }
1026
- );
1027
- Dialog.displayName = "Dialog";
1028
-
1029
- // src/components/Icon/Icon.tsx
1030
- import { forwardRef as forwardRef10 } from "react";
1031
- import { jsx as jsx10 } from "react/jsx-runtime";
1032
- var Icon = forwardRef10(
1033
- (_a, ref) => {
1034
- var _b = _a, {
1035
- name,
1036
- size = 20,
1037
- weight = 300,
1038
- fill = false,
1039
- grade = 0,
1040
- opticalSize,
1041
- className = "",
1042
- style,
1043
- "aria-label": ariaLabel
1044
- } = _b, rest = __objRest(_b, [
1045
- "name",
1046
- "size",
1047
- "weight",
1048
- "fill",
1049
- "grade",
1050
- "opticalSize",
1051
- "className",
1052
- "style",
1053
- "aria-label"
1054
- ]);
1055
- const opsz = opticalSize != null ? opticalSize : size === 16 ? 20 : size === 20 ? 20 : 24;
1056
- const classes = [
1057
- "material-symbols-outlined select-none shrink-0 inline-block leading-none",
1058
- className
1059
- ].filter(Boolean).join(" ");
1060
- return /* @__PURE__ */ jsx10(
1061
- "span",
1062
- __spreadProps(__spreadValues({
1063
- ref,
1064
- className: classes,
1065
- "aria-hidden": ariaLabel ? void 0 : true,
1066
- "aria-label": ariaLabel,
1067
- role: ariaLabel ? "img" : void 0,
1068
- style: __spreadValues({
1069
- fontSize: `${size}px`,
1070
- width: `${size}px`,
1071
- height: `${size}px`,
1072
- fontVariationSettings: `'FILL' ${fill ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grade}, 'opsz' ${opsz}`
1073
- }, style)
1074
- }, rest), {
1075
- children: name
1076
- })
1077
- );
1078
- }
1079
- );
1080
- Icon.displayName = "Icon";
1081
-
1082
- // src/components/Radio/Radio.tsx
1083
- import {
1084
- forwardRef as forwardRef11,
1085
- useId as useId3
1086
- } from "react";
1087
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1088
- var Radio = forwardRef11(
1089
- (_a, ref) => {
1090
- var _b = _a, {
1091
- size = "sm",
1092
- label,
1093
- description,
1094
- error = false,
1095
- checked,
1096
- defaultChecked,
1097
- disabled = false,
1098
- className = "",
1099
- id,
1100
- name
1101
- } = _b, rest = __objRest(_b, [
1102
- "size",
1103
- "label",
1104
- "description",
1105
- "error",
1106
- "checked",
1107
- "defaultChecked",
1108
- "disabled",
1109
- "className",
1110
- "id",
1111
- "name"
1112
- ]);
1113
- const reactId = useId3();
1114
- const inputId = id != null ? id : reactId;
1115
- return /* @__PURE__ */ jsx11(
1116
- "div",
1117
- {
1118
- className: `${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${className}`,
1119
- children: /* @__PURE__ */ jsxs10(
1120
- "label",
1121
- {
1122
- htmlFor: inputId,
1123
- className: `flex gap-4 ${disabled ? "pointer-events-none text-gray-400" : "text-gray-900 cursor-pointer"}`,
1124
- children: [
1125
- /* @__PURE__ */ jsxs10("div", { children: [
1126
- /* @__PURE__ */ jsx11(
1127
- "input",
1128
- __spreadValues({
1129
- ref,
1130
- id: inputId,
1131
- type: "radio",
1132
- className: "sr-only peer",
1133
- checked,
1134
- defaultChecked,
1135
- disabled,
1136
- name
1137
- }, rest)
1138
- ),
1139
- /* @__PURE__ */ jsx11(
1140
- "div",
1141
- {
1142
- className: `relative box flex items-center justify-center rounded-full border-2 group bg-white
1143
- ${size === "sm" ? "h-16 w-16 my-4 ml-3 mr-3" : "m-3 h-20 w-20 text-label-large"}
1144
- ${error ? "border-red-500" : "border-gray-600 peer-checked:border-blue-600 peer-disabled:border-gray-400!"}
1145
- `,
1146
- children: /* @__PURE__ */ jsx11(
1147
- "span",
1148
- {
1149
- className: `absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
1150
- ${size === "sm" ? "h-8 w-8" : "h-10 w-10"}
1151
- rounded-full bg-white group-peer-checked:bg-blue-600 group-peer-disabled:bg-white`
1152
- }
1153
- )
1154
- }
1155
- )
1156
- ] }),
1157
- /* @__PURE__ */ jsxs10(
1158
- "div",
1159
- {
1160
- className: `flex flex-col gap-1 ${size === "sm" ? "mt-2" : "mt-4"}`,
1161
- children: [
1162
- /* @__PURE__ */ jsx11(
1163
- "p",
1164
- {
1165
- className: `
1166
- ${size === "sm" ? "text-label-medium" : "text-label-large"}
1167
- ${disabled ? "text-gray-400" : "text-gray-900"}
1168
- `,
1169
- children: label
1170
- }
1171
- ),
1172
- /* @__PURE__ */ jsx11(
1173
- "p",
1174
- {
1175
- className: `text-caption-caption ${disabled ? "text-gray-400" : error ? "text-red-600" : "text-gray-600"}`,
1176
- children: description
1177
- }
1178
- )
1179
- ]
1180
- }
1181
- )
1182
- ]
1183
- }
1184
- )
1185
- }
1186
- );
1187
- }
1188
- );
1189
- Radio.displayName = "Radio";
1190
-
1191
- // src/components/Slider/Slider.tsx
1192
- import {
1193
- forwardRef as forwardRef12,
1194
- useCallback as useCallback4,
1195
- useId as useId4,
1196
- useState as useState5
1197
- } from "react";
1198
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1199
- var sizeConfig = {
1200
- small: {
1201
- trackH: "h-4",
1202
- thumbPx: 24,
1203
- thumbClass: "h-24 w-24",
1204
- iconPx: 12,
1205
- containerH: "h-24",
1206
- label: "text-sm leading-20",
1207
- description: "text-xs leading-16"
1208
- },
1209
- medium: {
1210
- trackH: "h-6",
1211
- thumbPx: 28,
1212
- thumbClass: "h-28 w-28",
1213
- iconPx: 14,
1214
- containerH: "h-28",
1215
- label: "text-base leading-24",
1216
- description: "text-sm leading-20"
1217
- },
1218
- large: {
1219
- trackH: "h-8",
1220
- thumbPx: 32,
1221
- thumbClass: "h-32 w-32",
1222
- iconPx: 16,
1223
- containerH: "h-32",
1224
- label: "text-base leading-24",
1225
- description: "text-sm leading-20"
1226
- }
1227
- };
1228
- function ChevronGlyphs({ size, color }) {
1229
- return /* @__PURE__ */ jsxs11(
1230
- "svg",
1231
- {
1232
- width: size,
1233
- height: size,
1234
- viewBox: "0 0 12 12",
1235
- fill: "none",
1236
- xmlns: "http://www.w3.org/2000/svg",
1237
- "aria-hidden": "true",
1238
- children: [
1239
- /* @__PURE__ */ jsx12(
1240
- "path",
1241
- {
1242
- d: "M4.75 3.25L2.25 6L4.75 8.75",
1243
- stroke: color,
1244
- strokeWidth: "1.25",
1245
- strokeLinecap: "round",
1246
- strokeLinejoin: "round"
1247
- }
1248
- ),
1249
- /* @__PURE__ */ jsx12(
1250
- "path",
1251
- {
1252
- d: "M7.25 3.25L9.75 6L7.25 8.75",
1253
- stroke: color,
1254
- strokeWidth: "1.25",
1255
- strokeLinecap: "round",
1256
- strokeLinejoin: "round"
1257
- }
1258
- )
1259
- ]
1260
- }
1261
- );
1262
- }
1263
- var Slider = forwardRef12(
1264
- (_a, ref) => {
1265
- var _b = _a, {
1266
- size = "medium",
1267
- label,
1268
- description,
1269
- error = false,
1270
- showValue = false,
1271
- min = 0,
1272
- max = 100,
1273
- step = 1,
1274
- value: controlledValue,
1275
- defaultValue,
1276
- disabled = false,
1277
- className = "",
1278
- id,
1279
- onChange,
1280
- "aria-label": ariaLabelProp
1281
- } = _b, rest = __objRest(_b, [
1282
- "size",
1283
- "label",
1284
- "description",
1285
- "error",
1286
- "showValue",
1287
- "min",
1288
- "max",
1289
- "step",
1290
- "value",
1291
- "defaultValue",
1292
- "disabled",
1293
- "className",
1294
- "id",
1295
- "onChange",
1296
- "aria-label"
1297
- ]);
1298
- const reactId = useId4();
1299
- const inputId = id != null ? id : reactId;
1300
- const sz = sizeConfig[size];
1301
- const ariaLabel = ariaLabelProp != null ? ariaLabelProp : typeof label === "string" ? void 0 : "Slider";
1302
- const ariaDescriptionId = description ? `${inputId}-description` : void 0;
1303
- const isControlled = controlledValue !== void 0;
1304
- const [internalValue, setInternalValue] = useState5(defaultValue != null ? defaultValue : min);
1305
- const currentValue = isControlled ? controlledValue : internalValue;
1306
- const handleChange = useCallback4(
1307
- (e) => {
1308
- const val = Number(e.target.value);
1309
- if (!isControlled) {
1310
- setInternalValue(val);
1311
- }
1312
- onChange == null ? void 0 : onChange(val, e);
1313
- },
1314
- [isControlled, onChange]
1315
- );
1316
- const percent = (currentValue - min) / (max - min) * 100;
1317
- const trackBg = disabled ? "bg-slider-track-disabled" : "bg-slider-track";
1318
- const fillBg = disabled ? "bg-slider-fill-disabled" : error ? "bg-slider-fill-error" : "bg-slider-fill";
1319
- const thumbBorder = disabled ? "border-slider-thumb-border-disabled" : error ? "border-slider-thumb-border-error" : "border-gray-200";
1320
- const thumbBg = disabled ? "bg-slider-thumb-disabled" : "bg-slider-thumb";
1321
- const iconColor = disabled ? "var(--color-gray-400)" : "var(--color-gray-500)";
1322
- const labelColor = disabled ? "text-slider-label-disabled" : error ? "text-slider-label-error" : "text-slider-label";
1323
- const descriptionColor = disabled ? "text-slider-label-disabled" : "text-slider-description";
1324
- const thumbOffset = percent * sz.thumbPx / 100;
1325
- const fillOffset = sz.thumbPx / 2 - thumbOffset;
1326
- return /* @__PURE__ */ jsxs11(
1327
- "div",
1328
- {
1329
- className: ["flex w-full flex-col gap-8 font-sans", className].filter(Boolean).join(" "),
1330
- children: [
1331
- (label || showValue && !disabled) && /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
1332
- label && /* @__PURE__ */ jsx12(
1333
- "label",
1334
- {
1335
- htmlFor: inputId,
1336
- className: [
1337
- sz.label,
1338
- "font-medium",
1339
- labelColor,
1340
- disabled ? "cursor-not-allowed" : "cursor-default"
1341
- ].join(" "),
1342
- children: label
1343
- }
1344
- ),
1345
- showValue && /* @__PURE__ */ jsx12(
1346
- "span",
1347
- {
1348
- className: [sz.description, "tabular-nums", labelColor].join(" "),
1349
- children: currentValue
1350
- }
1351
- )
1352
- ] }),
1353
- /* @__PURE__ */ jsxs11(
1354
- "div",
1355
- {
1356
- className: [
1357
- "relative flex items-center",
1358
- sz.containerH,
1359
- disabled ? "cursor-not-allowed" : "cursor-pointer"
1360
- ].join(" "),
1361
- children: [
1362
- /* @__PURE__ */ jsx12(
1363
- "div",
1364
- {
1365
- className: [
1366
- "absolute inset-x-0 rounded-full",
1367
- sz.trackH,
1368
- trackBg
1369
- ].join(" ")
1370
- }
1371
- ),
1372
- /* @__PURE__ */ jsx12(
1373
- "div",
1374
- {
1375
- className: ["absolute left-0 rounded-full", sz.trackH, fillBg].join(" "),
1376
- style: { width: `calc(${percent}% + ${fillOffset}px)` }
1377
- }
1378
- ),
1379
- /* @__PURE__ */ jsx12(
1380
- "input",
1381
- __spreadValues({
1382
- ref,
1383
- id: inputId,
1384
- type: "range",
1385
- min,
1386
- max,
1387
- step,
1388
- value: currentValue,
1389
- disabled,
1390
- onChange: handleChange,
1391
- "aria-label": ariaLabel,
1392
- "aria-describedby": ariaDescriptionId,
1393
- className: [
1394
- "peer absolute inset-0 z-20 w-full appearance-none bg-transparent opacity-0",
1395
- disabled ? "cursor-not-allowed" : "cursor-pointer",
1396
- "focus:outline-none"
1397
- ].join(" ")
1398
- }, rest)
1399
- ),
1400
- /* @__PURE__ */ jsx12(
1401
- "div",
1402
- {
1403
- className: [
1404
- "pointer-events-none absolute z-10 flex items-center justify-center rounded-full border",
1405
- sz.thumbClass,
1406
- thumbBg,
1407
- thumbBorder,
1408
- disabled ? "" : "shadow-base transition-shadow duration-150",
1409
- !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"),
1410
- !disabled && "peer-hover:shadow-medium"
1411
- ].filter(Boolean).join(" "),
1412
- style: { left: `calc(${percent}% - ${thumbOffset}px)` },
1413
- children: /* @__PURE__ */ jsx12(ChevronGlyphs, { size: sz.iconPx, color: iconColor })
1414
- }
1415
- )
1416
- ]
1417
- }
1418
- ),
1419
- description && /* @__PURE__ */ jsx12(
1420
- "span",
1421
- {
1422
- id: ariaDescriptionId,
1423
- className: [sz.description, descriptionColor].join(" "),
1424
- children: description
1425
- }
1426
- )
1427
- ]
1428
- }
1429
- );
1430
- }
1431
- );
1432
- Slider.displayName = "Slider";
1433
-
1434
- // src/components/Toast/Toast.tsx
1435
- import { forwardRef as forwardRef13 } from "react";
1436
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1437
- function CheckCircleIcon({ className }) {
1438
- return /* @__PURE__ */ jsxs12("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1439
- /* @__PURE__ */ jsx13("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
1440
- /* @__PURE__ */ jsx13("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1441
- ] });
1442
- }
1443
- function ProgressIcon({ className }) {
1444
- return /* @__PURE__ */ jsxs12("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1445
- /* @__PURE__ */ jsx13("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5", opacity: "0.3" }),
1446
- /* @__PURE__ */ jsx13("path", { d: "M10 2a8 8 0 0 1 8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: /* @__PURE__ */ jsx13("animateTransform", { attributeName: "transform", type: "rotate", from: "0 10 10", to: "360 10 10", dur: "1s", repeatCount: "indefinite" }) })
1447
- ] });
1448
- }
1449
- function ErrorIcon({ className }) {
1450
- return /* @__PURE__ */ jsxs12("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
1451
- /* @__PURE__ */ jsx13("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
1452
- /* @__PURE__ */ jsx13("path", { d: "M10 6.5v4M10 13.5h.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
1453
- ] });
1454
- }
1455
- function CloseIcon2({ className }) {
1456
- return /* @__PURE__ */ jsx13("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx13("path", { d: "M12 4 4 12M4 4l8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1457
- }
1458
- var defaultIcons2 = {
1459
- default: CheckCircleIcon,
1460
- progress: ProgressIcon,
1461
- error: ErrorIcon
1462
- };
1463
- var typeClasses = {
1464
- default: "bg-toast-default-bg text-toast-default-text",
1465
- progress: "bg-toast-progress-bg text-toast-progress-text",
1466
- error: "bg-toast-error-bg text-toast-error-text"
1467
- };
1468
- var iconColorClasses = {
1469
- default: "text-toast-default-icon",
1470
- progress: "text-toast-progress-icon",
1471
- error: "text-toast-error-icon"
1472
- };
1473
- var Toast = forwardRef13(
1474
- (_a, ref) => {
1475
- var _b = _a, {
1476
- type = "default",
1477
- icon = true,
1478
- actionLabel,
1479
- onAction,
1480
- onDismiss,
1481
- children,
1482
- className = ""
1483
- } = _b, rest = __objRest(_b, [
1484
- "type",
1485
- "icon",
1486
- "actionLabel",
1487
- "onAction",
1488
- "onDismiss",
1489
- "children",
1490
- "className"
1491
- ]);
1492
- const DefaultIcon = defaultIcons2[type];
1493
- const classes = [
1494
- "inline-flex items-center gap-12 font-sans",
1495
- "rounded-xl px-16 py-12",
1496
- "min-w-[320px] max-w-[480px]",
1497
- "shadow-large",
1498
- typeClasses[type],
1499
- className
1500
- ].filter(Boolean).join(" ");
1501
- return /* @__PURE__ */ jsxs12("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
1502
- icon && /* @__PURE__ */ jsx13("span", { className: `shrink-0 ${iconColorClasses[type]}`, children: /* @__PURE__ */ jsx13(DefaultIcon, { className: "h-20 w-20" }) }),
1503
- /* @__PURE__ */ jsx13("span", { className: "flex-1 text-sm font-medium leading-20 truncate", children }),
1504
- actionLabel && onAction && /* @__PURE__ */ jsx13(
1505
- "button",
1506
- {
1507
- type: "button",
1508
- onClick: onAction,
1509
- 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",
1510
- children: actionLabel
1511
- }
1512
- ),
1513
- onDismiss && /* @__PURE__ */ jsx13(
1514
- "button",
1515
- {
1516
- type: "button",
1517
- onClick: onDismiss,
1518
- className: "shrink-0 p-4 rounded-md text-toast-dismiss hover:text-toast-dismiss-hover transition-colors",
1519
- "aria-label": "Dismiss",
1520
- children: /* @__PURE__ */ jsx13(CloseIcon2, { className: "h-16 w-16" })
1521
- }
1522
- )
1523
- ] }));
1524
- }
1525
- );
1526
- Toast.displayName = "Toast";
1527
- export {
1528
- Accordion,
1529
- AlertBanner,
1530
- Avatar,
1531
- Badge,
1532
- BottomSheet,
1533
- Button,
1534
- Checkbox,
1535
- Dialog,
1536
- Icon,
1537
- Radio,
1538
- Slider,
1539
- Toast
1540
- };