@refinn/core-ui 0.1.1 → 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 +44 -15
- package/dist/index.d.ts +44 -15
- package/dist/index.js +538 -332
- package/dist/index.mjs +534 -334
- package/dist/theme.css +648 -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,6 +46,14 @@ 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
|
|
@@ -53,8 +63,10 @@ __export(index_exports, {
|
|
|
53
63
|
AlertBanner: () => AlertBanner,
|
|
54
64
|
Avatar: () => Avatar,
|
|
55
65
|
Badge: () => Badge,
|
|
66
|
+
BottomSheet: () => BottomSheet,
|
|
56
67
|
Button: () => Button,
|
|
57
68
|
Checkbox: () => Checkbox,
|
|
69
|
+
Dialog: () => Dialog,
|
|
58
70
|
Icon: () => Icon,
|
|
59
71
|
Radio: () => Radio,
|
|
60
72
|
Slider: () => Slider,
|
|
@@ -65,29 +77,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
65
77
|
// src/components/Accordion/Accordion.tsx
|
|
66
78
|
var import_react = require("react");
|
|
67
79
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
68
|
-
var sizeClasses = {
|
|
69
|
-
small: {
|
|
70
|
-
trigger: "px-3 py-2.5",
|
|
71
|
-
title: "text-sm leading-5",
|
|
72
|
-
subtitle: "text-xs leading-4",
|
|
73
|
-
content: "px-3 pb-3 text-sm leading-5",
|
|
74
|
-
icon: "h-4 w-4"
|
|
75
|
-
},
|
|
76
|
-
medium: {
|
|
77
|
-
trigger: "px-4 py-3",
|
|
78
|
-
title: "text-base leading-6",
|
|
79
|
-
subtitle: "text-sm leading-5",
|
|
80
|
-
content: "px-4 pb-4 text-sm leading-5",
|
|
81
|
-
icon: "h-5 w-5"
|
|
82
|
-
},
|
|
83
|
-
large: {
|
|
84
|
-
trigger: "px-5 py-4",
|
|
85
|
-
title: "text-lg leading-7",
|
|
86
|
-
subtitle: "text-sm leading-5",
|
|
87
|
-
content: "px-5 pb-5 text-base leading-6",
|
|
88
|
-
icon: "h-5 w-5"
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
80
|
function ChevronIcon({ className }) {
|
|
92
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)(
|
|
93
82
|
"path",
|
|
@@ -100,26 +89,16 @@ function ChevronIcon({ className }) {
|
|
|
100
89
|
}
|
|
101
90
|
) });
|
|
102
91
|
}
|
|
103
|
-
function AccordionItem({ item,
|
|
104
|
-
const sz = sizeClasses[size];
|
|
92
|
+
function AccordionItem({ item, isOpen, onToggle, generatedId }) {
|
|
105
93
|
const triggerId = `${generatedId}-trigger`;
|
|
106
94
|
const panelId = `${generatedId}-panel`;
|
|
107
|
-
const triggerClasses = [
|
|
108
|
-
"flex w-full items-center justify-between gap-2 text-left font-sans font-medium",
|
|
109
|
-
"transition-colors duration-150",
|
|
110
|
-
"outline-none",
|
|
111
|
-
sz.trigger,
|
|
112
|
-
sz.title,
|
|
113
|
-
item.disabled ? "cursor-not-allowed text-accordion-text-disabled" : "cursor-pointer text-accordion-text hover:bg-accordion-bg-hover active:bg-accordion-bg-active focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accordion-border-focus"
|
|
114
|
-
].join(" ");
|
|
115
95
|
const iconClasses = [
|
|
116
|
-
|
|
117
|
-
"shrink-0 transition-transform duration-200",
|
|
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",
|
|
118
97
|
isOpen ? "rotate-180" : "",
|
|
119
|
-
item.disabled ? "text-
|
|
98
|
+
item.disabled ? "text-static-icon-disabled" : "text-static-icon-primary"
|
|
120
99
|
].join(" ");
|
|
121
100
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
122
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
123
102
|
"button",
|
|
124
103
|
{
|
|
125
104
|
id: triggerId,
|
|
@@ -127,21 +106,31 @@ function AccordionItem({ item, size, isOpen, onToggle, generatedId }) {
|
|
|
127
106
|
"aria-expanded": isOpen,
|
|
128
107
|
"aria-controls": panelId,
|
|
129
108
|
disabled: item.disabled,
|
|
130
|
-
className:
|
|
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",
|
|
131
110
|
onClick: onToggle,
|
|
132
111
|
children: [
|
|
133
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className:
|
|
134
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
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
|
+
),
|
|
135
125
|
item.subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: [
|
|
136
|
-
|
|
137
|
-
"font-normal",
|
|
126
|
+
"text-body-small",
|
|
138
127
|
item.disabled ? "text-accordion-text-disabled" : "text-accordion-text-secondary"
|
|
139
128
|
].join(" "), children: item.subtitle })
|
|
140
129
|
] }),
|
|
141
130
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronIcon, { className: iconClasses })
|
|
142
131
|
]
|
|
143
132
|
}
|
|
144
|
-
)
|
|
133
|
+
),
|
|
145
134
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
146
135
|
"div",
|
|
147
136
|
{
|
|
@@ -150,7 +139,7 @@ function AccordionItem({ item, size, isOpen, onToggle, generatedId }) {
|
|
|
150
139
|
"aria-labelledby": triggerId,
|
|
151
140
|
className: "overflow-hidden transition-[grid-template-rows] duration-200",
|
|
152
141
|
style: { display: "grid", gridTemplateRows: isOpen ? "1fr" : "0fr" },
|
|
153
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className:
|
|
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 }) })
|
|
154
143
|
}
|
|
155
144
|
)
|
|
156
145
|
] });
|
|
@@ -159,13 +148,11 @@ var Accordion = (0, import_react.forwardRef)(
|
|
|
159
148
|
(_a, ref) => {
|
|
160
149
|
var _b = _a, {
|
|
161
150
|
items,
|
|
162
|
-
size = "medium",
|
|
163
151
|
multiple = false,
|
|
164
152
|
loading = false,
|
|
165
153
|
className = ""
|
|
166
154
|
} = _b, rest = __objRest(_b, [
|
|
167
155
|
"items",
|
|
168
|
-
"size",
|
|
169
156
|
"multiple",
|
|
170
157
|
"loading",
|
|
171
158
|
"className"
|
|
@@ -200,10 +187,9 @@ var Accordion = (0, import_react.forwardRef)(
|
|
|
200
187
|
className
|
|
201
188
|
].filter(Boolean).join(" ");
|
|
202
189
|
if (loading) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
206
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronIcon, { className: `${sz.icon} shrink-0 text-accordion-icon` })
|
|
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` })
|
|
207
193
|
] }) }));
|
|
208
194
|
}
|
|
209
195
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: items.map((item, i) => {
|
|
@@ -213,7 +199,6 @@ var Accordion = (0, import_react.forwardRef)(
|
|
|
213
199
|
AccordionItem,
|
|
214
200
|
{
|
|
215
201
|
item,
|
|
216
|
-
size,
|
|
217
202
|
isOpen: openItems.has(itemId),
|
|
218
203
|
onToggle: () => handleToggle(itemId),
|
|
219
204
|
generatedId: `${baseId}-${itemId}`
|
|
@@ -228,26 +213,40 @@ Accordion.displayName = "Accordion";
|
|
|
228
213
|
// src/components/AlertBanner/AlertBanner.tsx
|
|
229
214
|
var import_react2 = require("react");
|
|
230
215
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
231
|
-
var inlineClasses = {
|
|
232
|
-
info: "bg-alert-inline-info-bg border-alert-inline-info-border text-alert-text-primary",
|
|
233
|
-
success: "bg-alert-inline-success-bg border-alert-inline-success-border text-alert-text-primary",
|
|
234
|
-
warning: "bg-alert-inline-warning-bg border-alert-inline-warning-border text-alert-text-primary",
|
|
235
|
-
danger: "bg-alert-inline-danger-bg border-alert-inline-danger-border text-alert-text-primary",
|
|
236
|
-
common: "bg-alert-inline-common-bg border-alert-inline-common-border text-alert-text-primary"
|
|
237
|
-
};
|
|
238
216
|
var pageClasses = {
|
|
239
217
|
info: "bg-alert-page-info-bg text-alert-text-primary-inverse",
|
|
240
218
|
success: "bg-alert-page-success-bg text-alert-text-primary-inverse",
|
|
241
219
|
warning: "bg-alert-page-warning-bg text-alert-text-primary-inverse",
|
|
242
220
|
danger: "bg-alert-page-danger-bg text-alert-text-primary-inverse",
|
|
243
|
-
|
|
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"
|
|
244
243
|
};
|
|
245
244
|
var inlineIconClasses = {
|
|
246
245
|
info: "text-alert-inline-info-icon",
|
|
247
246
|
success: "text-alert-inline-success-icon",
|
|
248
247
|
warning: "text-alert-inline-warning-icon",
|
|
249
248
|
danger: "text-alert-inline-danger-icon",
|
|
250
|
-
|
|
249
|
+
none: "text-alert-inline-common-icon"
|
|
251
250
|
};
|
|
252
251
|
function InfoIcon({ className }) {
|
|
253
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" }) });
|
|
@@ -264,8 +263,8 @@ function WarningIcon({ className }) {
|
|
|
264
263
|
function DangerIcon({ className }) {
|
|
265
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" }) });
|
|
266
265
|
}
|
|
267
|
-
function
|
|
268
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
266
|
+
function NoneIcon({ className }) {
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {});
|
|
269
268
|
}
|
|
270
269
|
function CloseIcon({ className }) {
|
|
271
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" }) });
|
|
@@ -275,7 +274,7 @@ var defaultIcons = {
|
|
|
275
274
|
success: SuccessIcon,
|
|
276
275
|
warning: WarningIcon,
|
|
277
276
|
danger: DangerIcon,
|
|
278
|
-
|
|
277
|
+
none: NoneIcon
|
|
279
278
|
};
|
|
280
279
|
var AlertBanner = (0, import_react2.forwardRef)(
|
|
281
280
|
(_a, ref) => {
|
|
@@ -284,6 +283,7 @@ var AlertBanner = (0, import_react2.forwardRef)(
|
|
|
284
283
|
mode = "inline",
|
|
285
284
|
title,
|
|
286
285
|
description,
|
|
286
|
+
action,
|
|
287
287
|
icon,
|
|
288
288
|
onClose,
|
|
289
289
|
className = "",
|
|
@@ -293,40 +293,48 @@ var AlertBanner = (0, import_react2.forwardRef)(
|
|
|
293
293
|
"mode",
|
|
294
294
|
"title",
|
|
295
295
|
"description",
|
|
296
|
+
"action",
|
|
296
297
|
"icon",
|
|
297
298
|
"onClose",
|
|
298
299
|
"className",
|
|
299
300
|
"children"
|
|
300
301
|
]);
|
|
301
302
|
const isPage = mode === "page";
|
|
302
|
-
const
|
|
303
|
+
const isSection = mode === "section";
|
|
304
|
+
const variantClass = isPage ? pageClasses[variant] : isSection ? SectionClasses[variant] : inlineClasses[variant];
|
|
305
|
+
const actionClass = isPage ? actionsPageClasses[variant] : "text-enabled";
|
|
303
306
|
const DefaultIcon = defaultIcons[variant];
|
|
304
307
|
const iconColorClass = isPage ? "" : inlineIconClasses[variant];
|
|
305
308
|
const descColorClass = isPage ? "text-alert-text-secondary-inverse" : "text-alert-text-secondary";
|
|
306
309
|
const closeColorClass = isPage ? "text-alert-close-inverse hover:text-alert-close-inverse-hover" : "text-alert-close hover:text-alert-close-hover";
|
|
307
310
|
const classes = [
|
|
308
|
-
"flex items-start gap-
|
|
309
|
-
isPage ? "
|
|
311
|
+
"flex items-start gap-24 font-sans justify-between",
|
|
312
|
+
isPage ? "p-12" : isSection ? "p-12 rounded-md" : "p-0",
|
|
310
313
|
variantClass,
|
|
311
314
|
className
|
|
312
315
|
].filter(Boolean).join(" ");
|
|
313
316
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
|
|
314
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
+
] })
|
|
319
324
|
] }),
|
|
320
|
-
|
|
321
|
-
"
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
+
] })
|
|
330
338
|
] }));
|
|
331
339
|
}
|
|
332
340
|
);
|
|
@@ -335,18 +343,17 @@ AlertBanner.displayName = "AlertBanner";
|
|
|
335
343
|
// src/components/Avatar/Avatar.tsx
|
|
336
344
|
var import_react3 = require("react");
|
|
337
345
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
xl: { container: "h-14 w-14", text: "text-lg", status: "h-4 w-4", statusRing: "ring-2" },
|
|
344
|
-
"2xl": { container: "h-16 w-16", text: "text-xl", status: "h-4 w-4", statusRing: "ring-2" }
|
|
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" }
|
|
345
351
|
};
|
|
346
352
|
var statusColorClasses = {
|
|
347
353
|
online: "bg-avatar-status-online",
|
|
348
354
|
offline: "bg-avatar-status-offline",
|
|
349
|
-
busy: "bg-avatar-status-busy"
|
|
355
|
+
busy: "bg-avatar-status-busy",
|
|
356
|
+
"": ""
|
|
350
357
|
};
|
|
351
358
|
function getInitials(name) {
|
|
352
359
|
const parts = name.trim().split(/\s+/);
|
|
@@ -360,7 +367,6 @@ var Avatar = (0, import_react3.forwardRef)(
|
|
|
360
367
|
(_a, ref) => {
|
|
361
368
|
var _b = _a, {
|
|
362
369
|
size = "md",
|
|
363
|
-
shape = "circle",
|
|
364
370
|
src,
|
|
365
371
|
alt = "",
|
|
366
372
|
name,
|
|
@@ -369,7 +375,6 @@ var Avatar = (0, import_react3.forwardRef)(
|
|
|
369
375
|
className = ""
|
|
370
376
|
} = _b, rest = __objRest(_b, [
|
|
371
377
|
"size",
|
|
372
|
-
"shape",
|
|
373
378
|
"src",
|
|
374
379
|
"alt",
|
|
375
380
|
"name",
|
|
@@ -377,15 +382,13 @@ var Avatar = (0, import_react3.forwardRef)(
|
|
|
377
382
|
"status",
|
|
378
383
|
"className"
|
|
379
384
|
]);
|
|
380
|
-
const sz =
|
|
381
|
-
const roundedClass = shape === "circle" ? "rounded-full" : "rounded-lg";
|
|
385
|
+
const sz = sizeClasses[size];
|
|
382
386
|
const containerClasses = [
|
|
383
|
-
"relative inline-flex items-center justify-center shrink-0",
|
|
387
|
+
"relative inline-flex items-center justify-center shrink-0 rounded-full",
|
|
384
388
|
"bg-avatar-bg text-avatar-text font-medium font-sans",
|
|
385
389
|
"transition-colors duration-150",
|
|
386
390
|
"select-none",
|
|
387
391
|
sz.container,
|
|
388
|
-
roundedClass,
|
|
389
392
|
className
|
|
390
393
|
].filter(Boolean).join(" ");
|
|
391
394
|
let content;
|
|
@@ -395,7 +398,7 @@ var Avatar = (0, import_react3.forwardRef)(
|
|
|
395
398
|
{
|
|
396
399
|
src,
|
|
397
400
|
alt: alt || name || "",
|
|
398
|
-
className:
|
|
401
|
+
className: "h-full w-full object-cover rounded-full"
|
|
399
402
|
}
|
|
400
403
|
);
|
|
401
404
|
} else if (icon) {
|
|
@@ -427,83 +430,45 @@ Avatar.displayName = "Avatar";
|
|
|
427
430
|
// src/components/Badge/Badge.tsx
|
|
428
431
|
var import_react4 = require("react");
|
|
429
432
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
430
|
-
var
|
|
431
|
-
sm: "h-
|
|
432
|
-
md: "h-
|
|
433
|
-
lg: "h-
|
|
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"
|
|
434
437
|
};
|
|
435
438
|
var iconSizeClasses = {
|
|
436
|
-
sm: "h-
|
|
437
|
-
md: "h-
|
|
438
|
-
lg: "h-
|
|
439
|
-
};
|
|
440
|
-
var dotSizeClasses = {
|
|
441
|
-
sm: "h-1.5 w-1.5",
|
|
442
|
-
md: "h-1.5 w-1.5",
|
|
443
|
-
lg: "h-2 w-2"
|
|
444
|
-
};
|
|
445
|
-
var shapeClasses = {
|
|
446
|
-
round: "rounded-full",
|
|
447
|
-
square: "rounded"
|
|
439
|
+
sm: "h-16 w-16",
|
|
440
|
+
md: "h-20 w-20",
|
|
441
|
+
lg: "h-24 w-24"
|
|
448
442
|
};
|
|
449
443
|
var minimalClasses = {
|
|
450
|
-
common: "bg-transparent border border-
|
|
451
|
-
success: "bg-transparent border border-
|
|
452
|
-
warning: "bg-transparent border border-
|
|
453
|
-
info: "bg-transparent border border-
|
|
454
|
-
brand: "bg-transparent border border-
|
|
455
|
-
danger: "bg-transparent border border-
|
|
456
|
-
};
|
|
457
|
-
var minimalDotClasses = {
|
|
458
|
-
common: "bg-badge-minimal-common-dot",
|
|
459
|
-
success: "bg-badge-minimal-success-dot",
|
|
460
|
-
warning: "bg-badge-minimal-warning-dot",
|
|
461
|
-
info: "bg-badge-minimal-info-dot",
|
|
462
|
-
brand: "bg-badge-minimal-brand-dot",
|
|
463
|
-
danger: "bg-badge-minimal-danger-dot"
|
|
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"
|
|
464
450
|
};
|
|
465
451
|
var subtleClasses = {
|
|
466
|
-
common: "bg-
|
|
467
|
-
success: "bg-
|
|
468
|
-
warning: "bg-
|
|
469
|
-
info: "bg-
|
|
470
|
-
brand: "bg-
|
|
471
|
-
danger: "bg-
|
|
472
|
-
};
|
|
473
|
-
var subtleDotClasses = {
|
|
474
|
-
common: "bg-badge-subtle-common-dot",
|
|
475
|
-
success: "bg-badge-subtle-success-dot",
|
|
476
|
-
warning: "bg-badge-subtle-warning-dot",
|
|
477
|
-
info: "bg-badge-subtle-info-dot",
|
|
478
|
-
brand: "bg-badge-subtle-brand-dot",
|
|
479
|
-
danger: "bg-badge-subtle-danger-dot"
|
|
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"
|
|
480
458
|
};
|
|
481
459
|
var boldClasses = {
|
|
482
|
-
common: "bg-
|
|
483
|
-
success: "bg-
|
|
484
|
-
warning: "bg-
|
|
485
|
-
info: "bg-
|
|
486
|
-
brand: "bg-
|
|
487
|
-
danger: "bg-
|
|
488
|
-
};
|
|
489
|
-
var boldDotClasses = {
|
|
490
|
-
common: "bg-badge-bold-common-dot",
|
|
491
|
-
success: "bg-badge-bold-success-dot",
|
|
492
|
-
warning: "bg-badge-bold-warning-dot",
|
|
493
|
-
info: "bg-badge-bold-info-dot",
|
|
494
|
-
brand: "bg-badge-bold-brand-dot",
|
|
495
|
-
danger: "bg-badge-bold-danger-dot"
|
|
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"
|
|
496
466
|
};
|
|
497
467
|
var styleMap = {
|
|
498
468
|
minimal: minimalClasses,
|
|
499
469
|
subtle: subtleClasses,
|
|
500
470
|
bold: boldClasses
|
|
501
471
|
};
|
|
502
|
-
var dotStyleMap = {
|
|
503
|
-
minimal: minimalDotClasses,
|
|
504
|
-
subtle: subtleDotClasses,
|
|
505
|
-
bold: boldDotClasses
|
|
506
|
-
};
|
|
507
472
|
var Badge = (0, import_react4.forwardRef)(
|
|
508
473
|
(_a, ref) => {
|
|
509
474
|
var _b = _a, {
|
|
@@ -512,7 +477,6 @@ var Badge = (0, import_react4.forwardRef)(
|
|
|
512
477
|
size = "md",
|
|
513
478
|
shape = "round",
|
|
514
479
|
icon,
|
|
515
|
-
dot = false,
|
|
516
480
|
children,
|
|
517
481
|
className = ""
|
|
518
482
|
} = _b, rest = __objRest(_b, [
|
|
@@ -521,21 +485,19 @@ var Badge = (0, import_react4.forwardRef)(
|
|
|
521
485
|
"size",
|
|
522
486
|
"shape",
|
|
523
487
|
"icon",
|
|
524
|
-
"dot",
|
|
525
488
|
"children",
|
|
526
489
|
"className"
|
|
527
490
|
]);
|
|
528
491
|
const classes = [
|
|
529
492
|
"inline-flex items-center justify-center font-medium font-sans",
|
|
530
493
|
"whitespace-nowrap select-none",
|
|
531
|
-
|
|
532
|
-
|
|
494
|
+
sizeClasses2[size],
|
|
495
|
+
shape === "round" ? "rounded-full" : `rounded-${size}`,
|
|
533
496
|
styleMap[badgeStyle][status],
|
|
534
497
|
className
|
|
535
498
|
].filter(Boolean).join(" ");
|
|
536
499
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", __spreadProps(__spreadValues({ ref, className: classes }, rest), { children: [
|
|
537
|
-
|
|
538
|
-
!dot && icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `shrink-0 ${iconSizeClasses[size]}`, children: icon }),
|
|
500
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `shrink-0 ${iconSizeClasses[size]}`, children: icon }),
|
|
539
501
|
children
|
|
540
502
|
] }));
|
|
541
503
|
}
|
|
@@ -582,11 +544,11 @@ var variantClasses = {
|
|
|
582
544
|
"disabled:bg-btn-transparent-disabled disabled:text-btn-transparent-text-disabled"
|
|
583
545
|
].join(" ")
|
|
584
546
|
};
|
|
585
|
-
var
|
|
586
|
-
small: "h-
|
|
587
|
-
medium: "h-
|
|
588
|
-
large: "h-
|
|
589
|
-
"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"
|
|
590
552
|
};
|
|
591
553
|
function Spinner({ className }) {
|
|
592
554
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -638,7 +600,7 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
638
600
|
"transition-colors duration-150",
|
|
639
601
|
"outline-none",
|
|
640
602
|
"disabled:cursor-not-allowed",
|
|
641
|
-
|
|
603
|
+
sizeClasses3[size],
|
|
642
604
|
variantClasses[variant],
|
|
643
605
|
rounded ? "rounded-full" : "rounded-lg",
|
|
644
606
|
className
|
|
@@ -661,132 +623,274 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
661
623
|
);
|
|
662
624
|
Button.displayName = "Button";
|
|
663
625
|
|
|
664
|
-
// src/components/
|
|
665
|
-
var import_react6 = require("react");
|
|
626
|
+
// src/components/BottomSheet/BottomSheet.tsx
|
|
627
|
+
var import_react6 = __toESM(require("react"));
|
|
628
|
+
var import_react_dom = require("react-dom");
|
|
666
629
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
667
|
-
var
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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
|
+
] });
|
|
681
763
|
}
|
|
682
|
-
|
|
764
|
+
);
|
|
765
|
+
BottomSheet.displayName = "BottomSheet";
|
|
766
|
+
|
|
767
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
768
|
+
var import_react7 = require("react");
|
|
769
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
683
770
|
function CheckIcon({ className }) {
|
|
684
|
-
return /* @__PURE__ */ (0,
|
|
685
|
-
"
|
|
771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
772
|
+
"svg",
|
|
686
773
|
{
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
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
|
+
)
|
|
692
788
|
}
|
|
693
|
-
)
|
|
789
|
+
);
|
|
694
790
|
}
|
|
695
791
|
function IndeterminateIcon({ className }) {
|
|
696
|
-
return /* @__PURE__ */ (0,
|
|
697
|
-
"
|
|
792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
793
|
+
"svg",
|
|
698
794
|
{
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
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
|
+
)
|
|
703
808
|
}
|
|
704
|
-
)
|
|
809
|
+
);
|
|
705
810
|
}
|
|
706
|
-
var Checkbox = (0,
|
|
811
|
+
var Checkbox = (0, import_react7.forwardRef)(
|
|
707
812
|
(_a, ref) => {
|
|
708
813
|
var _b = _a, {
|
|
709
|
-
size = "medium",
|
|
710
814
|
label,
|
|
711
815
|
description,
|
|
712
|
-
indeterminate = false,
|
|
713
816
|
error = false,
|
|
714
817
|
contrast = false,
|
|
715
|
-
|
|
716
|
-
defaultChecked,
|
|
818
|
+
indeterminate = false,
|
|
717
819
|
disabled = false,
|
|
718
820
|
className = "",
|
|
719
|
-
id
|
|
821
|
+
id,
|
|
822
|
+
defaultChecked
|
|
720
823
|
} = _b, rest = __objRest(_b, [
|
|
721
|
-
"size",
|
|
722
824
|
"label",
|
|
723
825
|
"description",
|
|
724
|
-
"indeterminate",
|
|
725
826
|
"error",
|
|
726
827
|
"contrast",
|
|
727
|
-
"
|
|
728
|
-
"defaultChecked",
|
|
828
|
+
"indeterminate",
|
|
729
829
|
"disabled",
|
|
730
830
|
"className",
|
|
731
|
-
"id"
|
|
831
|
+
"id",
|
|
832
|
+
"defaultChecked"
|
|
732
833
|
]);
|
|
733
|
-
const reactId = (0,
|
|
834
|
+
const reactId = (0, import_react7.useId)();
|
|
734
835
|
const inputId = id != null ? id : reactId;
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
const boxBase = [
|
|
738
|
-
"relative inline-flex items-center justify-center shrink-0",
|
|
739
|
-
"rounded",
|
|
740
|
-
"border",
|
|
741
|
-
"transition-colors duration-150",
|
|
742
|
-
sz.box
|
|
743
|
-
].join(" ");
|
|
744
|
-
let boxState;
|
|
745
|
-
if (disabled) {
|
|
746
|
-
boxState = isActive ? "bg-checkbox-disabled-checked-bg border-checkbox-disabled-border text-checkbox-disabled-icon" : "bg-checkbox-disabled-bg border-checkbox-disabled-border";
|
|
747
|
-
} else if (contrast) {
|
|
748
|
-
boxState = isActive ? "bg-checkbox-contrast-checked-bg border-checkbox-contrast-checked-bg text-checkbox-contrast-checked-icon" : "bg-checkbox-contrast-bg border-checkbox-contrast-border text-transparent";
|
|
749
|
-
} else if (error) {
|
|
750
|
-
boxState = isActive ? "bg-checkbox-checked-bg border-checkbox-error-border text-checkbox-checked-icon" : "bg-checkbox-error-bg border-checkbox-error-border text-transparent";
|
|
751
|
-
} else if (isActive) {
|
|
752
|
-
boxState = "bg-checkbox-checked-bg border-checkbox-checked-border text-checkbox-checked-icon";
|
|
753
|
-
} else {
|
|
754
|
-
boxState = "bg-checkbox-bg border-checkbox-border text-transparent hover:border-checkbox-hover-border";
|
|
755
|
-
}
|
|
756
|
-
const ringColor = error ? "peer-focus-visible:ring-checkbox-error-ring" : contrast ? "peer-focus-visible:ring-checkbox-contrast-ring" : "peer-focus-visible:ring-checkbox-ring";
|
|
757
|
-
const ringClasses = `peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 ${ringColor}`;
|
|
758
|
-
const labelColor = disabled ? "text-checkbox-label-disabled" : contrast ? "text-checkbox-contrast-label" : error ? "text-checkbox-label-error" : "text-checkbox-label";
|
|
759
|
-
const descriptionColor = disabled ? "text-checkbox-label-disabled" : contrast ? "text-checkbox-contrast-description" : "text-checkbox-description";
|
|
760
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
836
|
+
const [isChecked, setIsChecked] = (0, import_react7.useState)(defaultChecked != null ? defaultChecked : false);
|
|
837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
761
838
|
"label",
|
|
762
839
|
{
|
|
763
840
|
htmlFor: inputId,
|
|
764
|
-
className:
|
|
765
|
-
"inline-flex items-start font-sans",
|
|
766
|
-
sz.gap,
|
|
767
|
-
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
768
|
-
className
|
|
769
|
-
].filter(Boolean).join(" "),
|
|
841
|
+
className: `flex select-none font-sans ${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${className}`,
|
|
770
842
|
children: [
|
|
771
|
-
/* @__PURE__ */ (0,
|
|
772
|
-
/* @__PURE__ */ (0,
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative mr-16", children: [
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
773
845
|
"input",
|
|
774
846
|
__spreadValues({
|
|
775
847
|
ref,
|
|
776
848
|
id: inputId,
|
|
777
849
|
type: "checkbox",
|
|
778
|
-
checked,
|
|
779
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
|
+
},
|
|
780
856
|
disabled,
|
|
781
|
-
"aria-checked": indeterminate ? "mixed" :
|
|
782
|
-
className: "
|
|
857
|
+
"aria-checked": indeterminate ? "mixed" : isChecked,
|
|
858
|
+
className: "sr-only"
|
|
783
859
|
}, rest)
|
|
784
860
|
),
|
|
785
|
-
/* @__PURE__ */ (0,
|
|
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
|
+
)
|
|
786
878
|
] }),
|
|
787
|
-
(label || description) && /* @__PURE__ */ (0,
|
|
788
|
-
label && /* @__PURE__ */ (0,
|
|
789
|
-
|
|
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
|
+
)
|
|
790
894
|
] })
|
|
791
895
|
]
|
|
792
896
|
}
|
|
@@ -795,10 +899,110 @@ var Checkbox = (0, import_react6.forwardRef)(
|
|
|
795
899
|
);
|
|
796
900
|
Checkbox.displayName = "Checkbox";
|
|
797
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
|
+
|
|
798
1002
|
// src/components/Icon/Icon.tsx
|
|
799
|
-
var
|
|
800
|
-
var
|
|
801
|
-
var Icon = (0,
|
|
1003
|
+
var import_react9 = require("react");
|
|
1004
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1005
|
+
var Icon = (0, import_react9.forwardRef)(
|
|
802
1006
|
(_a, ref) => {
|
|
803
1007
|
var _b = _a, {
|
|
804
1008
|
name,
|
|
@@ -826,7 +1030,7 @@ var Icon = (0, import_react7.forwardRef)(
|
|
|
826
1030
|
"material-symbols-outlined select-none shrink-0 inline-block leading-none",
|
|
827
1031
|
className
|
|
828
1032
|
].filter(Boolean).join(" ");
|
|
829
|
-
return /* @__PURE__ */ (0,
|
|
1033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
830
1034
|
"span",
|
|
831
1035
|
__spreadProps(__spreadValues({
|
|
832
1036
|
ref,
|
|
@@ -849,9 +1053,9 @@ var Icon = (0, import_react7.forwardRef)(
|
|
|
849
1053
|
Icon.displayName = "Icon";
|
|
850
1054
|
|
|
851
1055
|
// src/components/Radio/Radio.tsx
|
|
852
|
-
var
|
|
853
|
-
var
|
|
854
|
-
var
|
|
1056
|
+
var import_react10 = require("react");
|
|
1057
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1058
|
+
var sizeClasses4 = {
|
|
855
1059
|
small: {
|
|
856
1060
|
box: "h-4 w-4",
|
|
857
1061
|
dot: "h-1.5 w-1.5",
|
|
@@ -867,7 +1071,7 @@ var sizeClasses6 = {
|
|
|
867
1071
|
gap: "gap-2.5"
|
|
868
1072
|
}
|
|
869
1073
|
};
|
|
870
|
-
var Radio = (0,
|
|
1074
|
+
var Radio = (0, import_react10.forwardRef)(
|
|
871
1075
|
(_a, ref) => {
|
|
872
1076
|
var _b = _a, {
|
|
873
1077
|
size = "medium",
|
|
@@ -892,9 +1096,9 @@ var Radio = (0, import_react8.forwardRef)(
|
|
|
892
1096
|
"className",
|
|
893
1097
|
"id"
|
|
894
1098
|
]);
|
|
895
|
-
const reactId = (0,
|
|
1099
|
+
const reactId = (0, import_react10.useId)();
|
|
896
1100
|
const inputId = id != null ? id : reactId;
|
|
897
|
-
const sz =
|
|
1101
|
+
const sz = sizeClasses4[size];
|
|
898
1102
|
const circleBase = [
|
|
899
1103
|
"relative inline-flex items-center justify-center shrink-0",
|
|
900
1104
|
"rounded-full",
|
|
@@ -926,7 +1130,7 @@ var Radio = (0, import_react8.forwardRef)(
|
|
|
926
1130
|
}
|
|
927
1131
|
const labelColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-label" : error ? "text-radio-label-error" : "text-radio-label";
|
|
928
1132
|
const descriptionColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-description" : "text-radio-description";
|
|
929
|
-
return /* @__PURE__ */ (0,
|
|
1133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
930
1134
|
"label",
|
|
931
1135
|
{
|
|
932
1136
|
htmlFor: inputId,
|
|
@@ -937,8 +1141,8 @@ var Radio = (0, import_react8.forwardRef)(
|
|
|
937
1141
|
className
|
|
938
1142
|
].filter(Boolean).join(" "),
|
|
939
1143
|
children: [
|
|
940
|
-
/* @__PURE__ */ (0,
|
|
941
|
-
/* @__PURE__ */ (0,
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "relative inline-flex", children: [
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
942
1146
|
"input",
|
|
943
1147
|
__spreadValues({
|
|
944
1148
|
ref,
|
|
@@ -950,11 +1154,11 @@ var Radio = (0, import_react8.forwardRef)(
|
|
|
950
1154
|
className: "peer absolute inset-0 h-full w-full cursor-[inherit] opacity-0"
|
|
951
1155
|
}, rest)
|
|
952
1156
|
),
|
|
953
|
-
/* @__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}` }) })
|
|
954
1158
|
] }),
|
|
955
|
-
(label || description) && /* @__PURE__ */ (0,
|
|
956
|
-
label && /* @__PURE__ */ (0,
|
|
957
|
-
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 })
|
|
958
1162
|
] })
|
|
959
1163
|
]
|
|
960
1164
|
}
|
|
@@ -964,39 +1168,39 @@ var Radio = (0, import_react8.forwardRef)(
|
|
|
964
1168
|
Radio.displayName = "Radio";
|
|
965
1169
|
|
|
966
1170
|
// src/components/Slider/Slider.tsx
|
|
967
|
-
var
|
|
968
|
-
var
|
|
1171
|
+
var import_react11 = require("react");
|
|
1172
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
969
1173
|
var sizeConfig = {
|
|
970
1174
|
small: {
|
|
971
|
-
trackH: "h-
|
|
1175
|
+
trackH: "h-4",
|
|
972
1176
|
thumbPx: 24,
|
|
973
|
-
thumbClass: "h-
|
|
1177
|
+
thumbClass: "h-24 w-24",
|
|
974
1178
|
iconPx: 12,
|
|
975
|
-
containerH: "h-
|
|
976
|
-
label: "text-sm leading-
|
|
977
|
-
description: "text-xs leading-
|
|
1179
|
+
containerH: "h-24",
|
|
1180
|
+
label: "text-sm leading-20",
|
|
1181
|
+
description: "text-xs leading-16"
|
|
978
1182
|
},
|
|
979
1183
|
medium: {
|
|
980
|
-
trackH: "h-
|
|
1184
|
+
trackH: "h-6",
|
|
981
1185
|
thumbPx: 28,
|
|
982
|
-
thumbClass: "h-
|
|
1186
|
+
thumbClass: "h-28 w-28",
|
|
983
1187
|
iconPx: 14,
|
|
984
|
-
containerH: "h-
|
|
985
|
-
label: "text-base leading-
|
|
986
|
-
description: "text-sm leading-
|
|
1188
|
+
containerH: "h-28",
|
|
1189
|
+
label: "text-base leading-24",
|
|
1190
|
+
description: "text-sm leading-20"
|
|
987
1191
|
},
|
|
988
1192
|
large: {
|
|
989
|
-
trackH: "h-
|
|
1193
|
+
trackH: "h-8",
|
|
990
1194
|
thumbPx: 32,
|
|
991
|
-
thumbClass: "h-
|
|
1195
|
+
thumbClass: "h-32 w-32",
|
|
992
1196
|
iconPx: 16,
|
|
993
|
-
containerH: "h-
|
|
994
|
-
label: "text-base leading-
|
|
995
|
-
description: "text-sm leading-
|
|
1197
|
+
containerH: "h-32",
|
|
1198
|
+
label: "text-base leading-24",
|
|
1199
|
+
description: "text-sm leading-20"
|
|
996
1200
|
}
|
|
997
1201
|
};
|
|
998
1202
|
function ChevronGlyphs({ size, color }) {
|
|
999
|
-
return /* @__PURE__ */ (0,
|
|
1203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1000
1204
|
"svg",
|
|
1001
1205
|
{
|
|
1002
1206
|
width: size,
|
|
@@ -1006,7 +1210,7 @@ function ChevronGlyphs({ size, color }) {
|
|
|
1006
1210
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1007
1211
|
"aria-hidden": "true",
|
|
1008
1212
|
children: [
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1010
1214
|
"path",
|
|
1011
1215
|
{
|
|
1012
1216
|
d: "M4.75 3.25L2.25 6L4.75 8.75",
|
|
@@ -1016,7 +1220,7 @@ function ChevronGlyphs({ size, color }) {
|
|
|
1016
1220
|
strokeLinejoin: "round"
|
|
1017
1221
|
}
|
|
1018
1222
|
),
|
|
1019
|
-
/* @__PURE__ */ (0,
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1020
1224
|
"path",
|
|
1021
1225
|
{
|
|
1022
1226
|
d: "M7.25 3.25L9.75 6L7.25 8.75",
|
|
@@ -1030,7 +1234,7 @@ function ChevronGlyphs({ size, color }) {
|
|
|
1030
1234
|
}
|
|
1031
1235
|
);
|
|
1032
1236
|
}
|
|
1033
|
-
var Slider = (0,
|
|
1237
|
+
var Slider = (0, import_react11.forwardRef)(
|
|
1034
1238
|
(_a, ref) => {
|
|
1035
1239
|
var _b = _a, {
|
|
1036
1240
|
size = "medium",
|
|
@@ -1065,15 +1269,15 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1065
1269
|
"onChange",
|
|
1066
1270
|
"aria-label"
|
|
1067
1271
|
]);
|
|
1068
|
-
const reactId = (0,
|
|
1272
|
+
const reactId = (0, import_react11.useId)();
|
|
1069
1273
|
const inputId = id != null ? id : reactId;
|
|
1070
1274
|
const sz = sizeConfig[size];
|
|
1071
1275
|
const ariaLabel = ariaLabelProp != null ? ariaLabelProp : typeof label === "string" ? void 0 : "Slider";
|
|
1072
1276
|
const ariaDescriptionId = description ? `${inputId}-description` : void 0;
|
|
1073
1277
|
const isControlled = controlledValue !== void 0;
|
|
1074
|
-
const [internalValue, setInternalValue] = (0,
|
|
1278
|
+
const [internalValue, setInternalValue] = (0, import_react11.useState)(defaultValue != null ? defaultValue : min);
|
|
1075
1279
|
const currentValue = isControlled ? controlledValue : internalValue;
|
|
1076
|
-
const handleChange = (0,
|
|
1280
|
+
const handleChange = (0, import_react11.useCallback)(
|
|
1077
1281
|
(e) => {
|
|
1078
1282
|
const val = Number(e.target.value);
|
|
1079
1283
|
if (!isControlled) {
|
|
@@ -1093,13 +1297,13 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1093
1297
|
const descriptionColor = disabled ? "text-slider-label-disabled" : "text-slider-description";
|
|
1094
1298
|
const thumbOffset = percent * sz.thumbPx / 100;
|
|
1095
1299
|
const fillOffset = sz.thumbPx / 2 - thumbOffset;
|
|
1096
|
-
return /* @__PURE__ */ (0,
|
|
1300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1097
1301
|
"div",
|
|
1098
1302
|
{
|
|
1099
|
-
className: ["flex w-full flex-col gap-
|
|
1303
|
+
className: ["flex w-full flex-col gap-8 font-sans", className].filter(Boolean).join(" "),
|
|
1100
1304
|
children: [
|
|
1101
|
-
(label || showValue && !disabled) && /* @__PURE__ */ (0,
|
|
1102
|
-
label && /* @__PURE__ */ (0,
|
|
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)(
|
|
1103
1307
|
"label",
|
|
1104
1308
|
{
|
|
1105
1309
|
htmlFor: inputId,
|
|
@@ -1112,7 +1316,7 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1112
1316
|
children: label
|
|
1113
1317
|
}
|
|
1114
1318
|
),
|
|
1115
|
-
showValue && /* @__PURE__ */ (0,
|
|
1319
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1116
1320
|
"span",
|
|
1117
1321
|
{
|
|
1118
1322
|
className: [sz.description, "tabular-nums", labelColor].join(" "),
|
|
@@ -1120,7 +1324,7 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1120
1324
|
}
|
|
1121
1325
|
)
|
|
1122
1326
|
] }),
|
|
1123
|
-
/* @__PURE__ */ (0,
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1124
1328
|
"div",
|
|
1125
1329
|
{
|
|
1126
1330
|
className: [
|
|
@@ -1129,7 +1333,7 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1129
1333
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1130
1334
|
].join(" "),
|
|
1131
1335
|
children: [
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1133
1337
|
"div",
|
|
1134
1338
|
{
|
|
1135
1339
|
className: [
|
|
@@ -1139,14 +1343,14 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1139
1343
|
].join(" ")
|
|
1140
1344
|
}
|
|
1141
1345
|
),
|
|
1142
|
-
/* @__PURE__ */ (0,
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1143
1347
|
"div",
|
|
1144
1348
|
{
|
|
1145
1349
|
className: ["absolute left-0 rounded-full", sz.trackH, fillBg].join(" "),
|
|
1146
1350
|
style: { width: `calc(${percent}% + ${fillOffset}px)` }
|
|
1147
1351
|
}
|
|
1148
1352
|
),
|
|
1149
|
-
/* @__PURE__ */ (0,
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1150
1354
|
"input",
|
|
1151
1355
|
__spreadValues({
|
|
1152
1356
|
ref,
|
|
@@ -1167,7 +1371,7 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1167
1371
|
].join(" ")
|
|
1168
1372
|
}, rest)
|
|
1169
1373
|
),
|
|
1170
|
-
/* @__PURE__ */ (0,
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1171
1375
|
"div",
|
|
1172
1376
|
{
|
|
1173
1377
|
className: [
|
|
@@ -1180,13 +1384,13 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1180
1384
|
!disabled && "peer-hover:shadow-medium"
|
|
1181
1385
|
].filter(Boolean).join(" "),
|
|
1182
1386
|
style: { left: `calc(${percent}% - ${thumbOffset}px)` },
|
|
1183
|
-
children: /* @__PURE__ */ (0,
|
|
1387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronGlyphs, { size: sz.iconPx, color: iconColor })
|
|
1184
1388
|
}
|
|
1185
1389
|
)
|
|
1186
1390
|
]
|
|
1187
1391
|
}
|
|
1188
1392
|
),
|
|
1189
|
-
description && /* @__PURE__ */ (0,
|
|
1393
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1190
1394
|
"span",
|
|
1191
1395
|
{
|
|
1192
1396
|
id: ariaDescriptionId,
|
|
@@ -1202,28 +1406,28 @@ var Slider = (0, import_react9.forwardRef)(
|
|
|
1202
1406
|
Slider.displayName = "Slider";
|
|
1203
1407
|
|
|
1204
1408
|
// src/components/Toast/Toast.tsx
|
|
1205
|
-
var
|
|
1206
|
-
var
|
|
1409
|
+
var import_react12 = require("react");
|
|
1410
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1207
1411
|
function CheckCircleIcon({ className }) {
|
|
1208
|
-
return /* @__PURE__ */ (0,
|
|
1209
|
-
/* @__PURE__ */ (0,
|
|
1210
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1211
1415
|
] });
|
|
1212
1416
|
}
|
|
1213
1417
|
function ProgressIcon({ className }) {
|
|
1214
|
-
return /* @__PURE__ */ (0,
|
|
1215
|
-
/* @__PURE__ */ (0,
|
|
1216
|
-
/* @__PURE__ */ (0,
|
|
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" }) })
|
|
1217
1421
|
] });
|
|
1218
1422
|
}
|
|
1219
1423
|
function ErrorIcon({ className }) {
|
|
1220
|
-
return /* @__PURE__ */ (0,
|
|
1221
|
-
/* @__PURE__ */ (0,
|
|
1222
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1223
1427
|
] });
|
|
1224
1428
|
}
|
|
1225
1429
|
function CloseIcon2({ className }) {
|
|
1226
|
-
return /* @__PURE__ */ (0,
|
|
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" }) });
|
|
1227
1431
|
}
|
|
1228
1432
|
var defaultIcons2 = {
|
|
1229
1433
|
default: CheckCircleIcon,
|
|
@@ -1240,7 +1444,7 @@ var iconColorClasses = {
|
|
|
1240
1444
|
progress: "text-toast-progress-icon",
|
|
1241
1445
|
error: "text-toast-error-icon"
|
|
1242
1446
|
};
|
|
1243
|
-
var Toast = (0,
|
|
1447
|
+
var Toast = (0, import_react12.forwardRef)(
|
|
1244
1448
|
(_a, ref) => {
|
|
1245
1449
|
var _b = _a, {
|
|
1246
1450
|
type = "default",
|
|
@@ -1261,33 +1465,33 @@ var Toast = (0, import_react10.forwardRef)(
|
|
|
1261
1465
|
]);
|
|
1262
1466
|
const DefaultIcon = defaultIcons2[type];
|
|
1263
1467
|
const classes = [
|
|
1264
|
-
"inline-flex items-center gap-
|
|
1265
|
-
"rounded-xl px-
|
|
1468
|
+
"inline-flex items-center gap-12 font-sans",
|
|
1469
|
+
"rounded-xl px-16 py-12",
|
|
1266
1470
|
"min-w-[320px] max-w-[480px]",
|
|
1267
1471
|
"shadow-large",
|
|
1268
1472
|
typeClasses[type],
|
|
1269
1473
|
className
|
|
1270
1474
|
].filter(Boolean).join(" ");
|
|
1271
|
-
return /* @__PURE__ */ (0,
|
|
1272
|
-
icon && /* @__PURE__ */ (0,
|
|
1273
|
-
/* @__PURE__ */ (0,
|
|
1274
|
-
actionLabel && onAction && /* @__PURE__ */ (0,
|
|
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)(
|
|
1275
1479
|
"button",
|
|
1276
1480
|
{
|
|
1277
1481
|
type: "button",
|
|
1278
1482
|
onClick: onAction,
|
|
1279
|
-
className: "shrink-0 text-sm font-medium text-toast-action-text hover:bg-toast-action-bg-hover rounded-md px-
|
|
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",
|
|
1280
1484
|
children: actionLabel
|
|
1281
1485
|
}
|
|
1282
1486
|
),
|
|
1283
|
-
onDismiss && /* @__PURE__ */ (0,
|
|
1487
|
+
onDismiss && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1284
1488
|
"button",
|
|
1285
1489
|
{
|
|
1286
1490
|
type: "button",
|
|
1287
1491
|
onClick: onDismiss,
|
|
1288
|
-
className: "shrink-0 p-
|
|
1492
|
+
className: "shrink-0 p-4 rounded-md text-toast-dismiss hover:text-toast-dismiss-hover transition-colors",
|
|
1289
1493
|
"aria-label": "Dismiss",
|
|
1290
|
-
children: /* @__PURE__ */ (0,
|
|
1494
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon2, { className: "h-16 w-16" })
|
|
1291
1495
|
}
|
|
1292
1496
|
)
|
|
1293
1497
|
] }));
|
|
@@ -1300,8 +1504,10 @@ Toast.displayName = "Toast";
|
|
|
1300
1504
|
AlertBanner,
|
|
1301
1505
|
Avatar,
|
|
1302
1506
|
Badge,
|
|
1507
|
+
BottomSheet,
|
|
1303
1508
|
Button,
|
|
1304
1509
|
Checkbox,
|
|
1510
|
+
Dialog,
|
|
1305
1511
|
Icon,
|
|
1306
1512
|
Radio,
|
|
1307
1513
|
Slider,
|