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