smartsell-ui-kit 0.0.1 → 0.0.3
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/chunk-KZRGV5RH.js +582 -0
- package/dist/chunk-KZRGV5RH.js.map +1 -0
- package/dist/index.cjs +461 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -31
- package/dist/index.d.ts +3 -31
- package/dist/index.js +64 -206
- package/dist/index.js.map +1 -1
- package/dist/modal-DDArHRQM.d.cts +79 -0
- package/dist/modal-DDArHRQM.d.ts +79 -0
- package/dist/modal.cjs +608 -0
- package/dist/modal.cjs.map +1 -0
- package/dist/modal.d.cts +4 -0
- package/dist/modal.d.ts +4 -0
- package/dist/modal.js +7 -0
- package/dist/modal.js.map +1 -0
- package/package.json +13 -4
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
// src/components/Modal.tsx
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var defaultThemeColors = {
|
|
5
|
+
background: "#f8fafc",
|
|
6
|
+
surface: "#ffffff",
|
|
7
|
+
onSurface: "#0f172a",
|
|
8
|
+
onBackground: "#0f172a",
|
|
9
|
+
primary: "#0f766e",
|
|
10
|
+
onPrimary: "#ffffff",
|
|
11
|
+
secondary: "#1d4ed8",
|
|
12
|
+
onSecondary: "#ffffff",
|
|
13
|
+
negative: "#dc2626",
|
|
14
|
+
warning: "#d97706"
|
|
15
|
+
};
|
|
16
|
+
var withAlpha = (hex, alpha) => {
|
|
17
|
+
const normalized = hex.replace("#", "").trim();
|
|
18
|
+
const value = normalized.length === 3 ? normalized.split("").map((char) => char + char).join("") : normalized;
|
|
19
|
+
const red = Number.parseInt(value.slice(0, 2), 16);
|
|
20
|
+
const green = Number.parseInt(value.slice(2, 4), 16);
|
|
21
|
+
const blue = Number.parseInt(value.slice(4, 6), 16);
|
|
22
|
+
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
23
|
+
};
|
|
24
|
+
var isUiKitThemeTokens = (theme) => {
|
|
25
|
+
return Boolean(theme && typeof theme === "object" && "theme" in theme);
|
|
26
|
+
};
|
|
27
|
+
var resolveTheme = (theme) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const colorOverrides = isUiKitThemeTokens(theme) ? theme.theme.colors : (_a = theme == null ? void 0 : theme.colors) != null ? _a : {};
|
|
30
|
+
const colors = {
|
|
31
|
+
...defaultThemeColors,
|
|
32
|
+
...colorOverrides
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
colors,
|
|
36
|
+
borderSoft: isUiKitThemeTokens(theme) ? theme.borderSoft : withAlpha(colors.onSurface, 0.1),
|
|
37
|
+
borderStrong: isUiKitThemeTokens(theme) ? theme.borderStrong : withAlpha(colors.onSurface, 0.16),
|
|
38
|
+
surfaceMuted: isUiKitThemeTokens(theme) ? theme.surfaceMuted : withAlpha(colors.onSurface, 0.04),
|
|
39
|
+
surfaceRaised: isUiKitThemeTokens(theme) ? theme.surfaceRaised : withAlpha(colors.surface, 0.94),
|
|
40
|
+
overlay: isUiKitThemeTokens(theme) ? theme.overlay : withAlpha("#030712", 0.62),
|
|
41
|
+
mutedText: isUiKitThemeTokens(theme) ? theme.mutedText : withAlpha(colors.onSurface, 0.72)
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var normalizeWidth = (maxWidth) => {
|
|
45
|
+
if (typeof maxWidth === "number") {
|
|
46
|
+
return `${maxWidth}px`;
|
|
47
|
+
}
|
|
48
|
+
return maxWidth != null ? maxWidth : "720px";
|
|
49
|
+
};
|
|
50
|
+
var isLikelyMobileViewport = () => {
|
|
51
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
55
|
+
navigator.userAgent
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
var isLegacyModalProps = (props) => {
|
|
59
|
+
return "showModal" in props;
|
|
60
|
+
};
|
|
61
|
+
function LegacyActionButton({
|
|
62
|
+
label,
|
|
63
|
+
onClick,
|
|
64
|
+
disabled,
|
|
65
|
+
type = "contained",
|
|
66
|
+
theme,
|
|
67
|
+
style
|
|
68
|
+
}) {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
const { colors } = theme;
|
|
71
|
+
const buttonStyle = {
|
|
72
|
+
width: "100%",
|
|
73
|
+
display: "flex",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
borderRadius: "0.4rem",
|
|
77
|
+
padding: type === "link" ? 0 : "1.3rem",
|
|
78
|
+
boxSizing: "border-box",
|
|
79
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
80
|
+
fontWeight: 700,
|
|
81
|
+
fontSize: "1.3rem",
|
|
82
|
+
margin: 0,
|
|
83
|
+
textAlign: "center",
|
|
84
|
+
transition: "0.5s",
|
|
85
|
+
opacity: disabled ? 0.5 : 1,
|
|
86
|
+
filter: disabled ? "saturate(0)" : void 0
|
|
87
|
+
};
|
|
88
|
+
if (type === "text") {
|
|
89
|
+
buttonStyle.background = "none";
|
|
90
|
+
buttonStyle.border = "1px solid transparent";
|
|
91
|
+
buttonStyle.color = colors.primary;
|
|
92
|
+
buttonStyle.boxShadow = "none";
|
|
93
|
+
} else if (type === "link") {
|
|
94
|
+
buttonStyle.background = "none";
|
|
95
|
+
buttonStyle.border = "none";
|
|
96
|
+
buttonStyle.color = colors.primary;
|
|
97
|
+
buttonStyle.boxShadow = "none";
|
|
98
|
+
} else if (type === "outlined") {
|
|
99
|
+
buttonStyle.background = "none";
|
|
100
|
+
buttonStyle.border = `2px solid ${colors.primary}`;
|
|
101
|
+
buttonStyle.color = colors.primary;
|
|
102
|
+
buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.onSurface, 0.08)}`;
|
|
103
|
+
} else {
|
|
104
|
+
buttonStyle.background = colors.primary;
|
|
105
|
+
buttonStyle.border = "1px solid transparent";
|
|
106
|
+
buttonStyle.color = colors.onPrimary;
|
|
107
|
+
buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.primary, 0.22)}`;
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
style: {
|
|
113
|
+
width: (_a = style == null ? void 0 : style.width) != null ? _a : (style == null ? void 0 : style.maxWidth) ? "100%" : "max-content",
|
|
114
|
+
display: "flex",
|
|
115
|
+
alignItems: "center",
|
|
116
|
+
justifyContent: "center",
|
|
117
|
+
margin: "0 5px",
|
|
118
|
+
marginBottom: (_b = style == null ? void 0 : style.marginBottom) != null ? _b : 0,
|
|
119
|
+
...style
|
|
120
|
+
},
|
|
121
|
+
children: /* @__PURE__ */ jsx(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
type: "button",
|
|
125
|
+
onClick: disabled ? void 0 : onClick,
|
|
126
|
+
disabled,
|
|
127
|
+
style: buttonStyle,
|
|
128
|
+
children: label
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function StandardModal({
|
|
135
|
+
isOpen,
|
|
136
|
+
onClose,
|
|
137
|
+
children,
|
|
138
|
+
footer,
|
|
139
|
+
title,
|
|
140
|
+
description,
|
|
141
|
+
headerContent,
|
|
142
|
+
maxWidth,
|
|
143
|
+
closeOnBackdrop = true,
|
|
144
|
+
closeOnEscape = true,
|
|
145
|
+
hideCloseButton = false,
|
|
146
|
+
contentStyle,
|
|
147
|
+
theme
|
|
148
|
+
}) {
|
|
149
|
+
const modalTheme = useMemo(() => resolveTheme(theme), [theme]);
|
|
150
|
+
const titleId = useMemo(
|
|
151
|
+
() => `smartsell-modal-${String(title != null ? title : "dialog").toLowerCase().replace(/[^a-z0-9]+/g, "-")}`,
|
|
152
|
+
[title]
|
|
153
|
+
);
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (!isOpen || typeof window === "undefined" || typeof document === "undefined") {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const previousOverflow = document.body.style.overflow;
|
|
159
|
+
document.body.style.overflow = "hidden";
|
|
160
|
+
const handleKeyDown = (event) => {
|
|
161
|
+
if (closeOnEscape && event.key === "Escape") {
|
|
162
|
+
onClose();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
166
|
+
return () => {
|
|
167
|
+
document.body.style.overflow = previousOverflow;
|
|
168
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
169
|
+
};
|
|
170
|
+
}, [closeOnEscape, isOpen, onClose]);
|
|
171
|
+
if (!isOpen) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const header = headerContent != null ? headerContent : /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
175
|
+
title ? /* @__PURE__ */ jsx(
|
|
176
|
+
"h2",
|
|
177
|
+
{
|
|
178
|
+
id: titleId,
|
|
179
|
+
style: {
|
|
180
|
+
margin: 0,
|
|
181
|
+
color: modalTheme.colors.onSurface,
|
|
182
|
+
fontSize: 30,
|
|
183
|
+
fontWeight: 800,
|
|
184
|
+
lineHeight: 1.1
|
|
185
|
+
},
|
|
186
|
+
children: title
|
|
187
|
+
}
|
|
188
|
+
) : null,
|
|
189
|
+
description ? /* @__PURE__ */ jsx(
|
|
190
|
+
"p",
|
|
191
|
+
{
|
|
192
|
+
style: {
|
|
193
|
+
margin: 0,
|
|
194
|
+
color: modalTheme.mutedText,
|
|
195
|
+
fontSize: 15,
|
|
196
|
+
lineHeight: 1.6
|
|
197
|
+
},
|
|
198
|
+
children: description
|
|
199
|
+
}
|
|
200
|
+
) : null
|
|
201
|
+
] });
|
|
202
|
+
return /* @__PURE__ */ jsx(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
"aria-label": headerContent ? typeof title === "string" ? title : "Dialog" : void 0,
|
|
206
|
+
"aria-labelledby": headerContent ? void 0 : title ? titleId : void 0,
|
|
207
|
+
"aria-modal": "true",
|
|
208
|
+
role: "dialog",
|
|
209
|
+
onMouseDown: (event) => {
|
|
210
|
+
if (closeOnBackdrop && event.target === event.currentTarget) {
|
|
211
|
+
onClose();
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
style: {
|
|
215
|
+
position: "fixed",
|
|
216
|
+
inset: 0,
|
|
217
|
+
zIndex: 70,
|
|
218
|
+
display: "flex",
|
|
219
|
+
alignItems: "center",
|
|
220
|
+
justifyContent: "center",
|
|
221
|
+
padding: 16,
|
|
222
|
+
backgroundColor: modalTheme.overlay,
|
|
223
|
+
backdropFilter: "blur(8px)"
|
|
224
|
+
},
|
|
225
|
+
children: /* @__PURE__ */ jsxs(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
style: {
|
|
229
|
+
width: "min(100%, 100%)",
|
|
230
|
+
maxWidth: normalizeWidth(maxWidth),
|
|
231
|
+
borderRadius: 30,
|
|
232
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
233
|
+
background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,
|
|
234
|
+
boxShadow: `0 34px 80px ${withAlpha("#020617", 0.28)}`,
|
|
235
|
+
color: modalTheme.colors.onSurface,
|
|
236
|
+
overflow: "hidden",
|
|
237
|
+
...contentStyle
|
|
238
|
+
},
|
|
239
|
+
children: [
|
|
240
|
+
/* @__PURE__ */ jsxs(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
style: {
|
|
244
|
+
display: "flex",
|
|
245
|
+
alignItems: "flex-start",
|
|
246
|
+
justifyContent: "space-between",
|
|
247
|
+
gap: 16,
|
|
248
|
+
padding: "24px 24px 0"
|
|
249
|
+
},
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: header }),
|
|
252
|
+
!hideCloseButton ? /* @__PURE__ */ jsx(
|
|
253
|
+
"button",
|
|
254
|
+
{
|
|
255
|
+
"aria-label": "Close modal",
|
|
256
|
+
type: "button",
|
|
257
|
+
onClick: onClose,
|
|
258
|
+
style: {
|
|
259
|
+
height: 42,
|
|
260
|
+
width: 42,
|
|
261
|
+
borderRadius: 999,
|
|
262
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
263
|
+
backgroundColor: "transparent",
|
|
264
|
+
color: modalTheme.colors.onSurface,
|
|
265
|
+
cursor: "pointer",
|
|
266
|
+
fontSize: 20,
|
|
267
|
+
fontWeight: 700
|
|
268
|
+
},
|
|
269
|
+
children: "\xD7"
|
|
270
|
+
}
|
|
271
|
+
) : null
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/* @__PURE__ */ jsx("div", { style: { padding: 24 }, children }),
|
|
276
|
+
footer ? /* @__PURE__ */ jsx(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
style: {
|
|
280
|
+
display: "flex",
|
|
281
|
+
justifyContent: "flex-end",
|
|
282
|
+
gap: 12,
|
|
283
|
+
padding: "0 24px 24px",
|
|
284
|
+
borderTop: `1px solid ${withAlpha(modalTheme.colors.onSurface, 0.06)}`
|
|
285
|
+
},
|
|
286
|
+
children: footer
|
|
287
|
+
}
|
|
288
|
+
) : null
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
function LegacyModal({
|
|
296
|
+
title,
|
|
297
|
+
showModal,
|
|
298
|
+
closeModal,
|
|
299
|
+
children,
|
|
300
|
+
action,
|
|
301
|
+
actionNameBtn,
|
|
302
|
+
hideActionButton = false,
|
|
303
|
+
cancelButton,
|
|
304
|
+
disableActionBtn = false,
|
|
305
|
+
isLoading = false,
|
|
306
|
+
onlyCloseButton = false,
|
|
307
|
+
hideCloseIcon = false,
|
|
308
|
+
style,
|
|
309
|
+
bodyStyle,
|
|
310
|
+
additionalActions,
|
|
311
|
+
maximized,
|
|
312
|
+
theme
|
|
313
|
+
}) {
|
|
314
|
+
const modalTheme = useMemo(() => resolveTheme(theme), [theme]);
|
|
315
|
+
const [isMaximized, setIsMaximized] = useState(maximized != null ? maximized : false);
|
|
316
|
+
const resolvedAction = action != null ? action : (() => null);
|
|
317
|
+
useEffect(() => {
|
|
318
|
+
if (maximized === void 0 && isLikelyMobileViewport()) {
|
|
319
|
+
setIsMaximized(true);
|
|
320
|
+
}
|
|
321
|
+
}, [maximized]);
|
|
322
|
+
if (!showModal) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
const actionButtons = () => {
|
|
326
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
327
|
+
additionalActions == null ? void 0 : additionalActions.map((item) => {
|
|
328
|
+
var _a, _b, _c;
|
|
329
|
+
return /* @__PURE__ */ jsx(
|
|
330
|
+
LegacyActionButton,
|
|
331
|
+
{
|
|
332
|
+
label: item.name,
|
|
333
|
+
onClick: item.onClick,
|
|
334
|
+
type: (_a = item.type) != null ? _a : "contained",
|
|
335
|
+
style: (_b = item.style) != null ? _b : { maxWidth: "150px" },
|
|
336
|
+
theme: modalTheme,
|
|
337
|
+
disabled: (_c = item.disable) != null ? _c : disableActionBtn || isLoading
|
|
338
|
+
},
|
|
339
|
+
item.name
|
|
340
|
+
);
|
|
341
|
+
}),
|
|
342
|
+
!hideActionButton ? /* @__PURE__ */ jsx(
|
|
343
|
+
LegacyActionButton,
|
|
344
|
+
{
|
|
345
|
+
label: actionNameBtn != null ? actionNameBtn : "Save",
|
|
346
|
+
onClick: resolvedAction,
|
|
347
|
+
type: "contained",
|
|
348
|
+
style: { maxWidth: "100px" },
|
|
349
|
+
theme: modalTheme,
|
|
350
|
+
disabled: disableActionBtn || isLoading
|
|
351
|
+
}
|
|
352
|
+
) : null
|
|
353
|
+
] });
|
|
354
|
+
};
|
|
355
|
+
return /* @__PURE__ */ jsx(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
"aria-labelledby": "modal-title",
|
|
359
|
+
"aria-modal": "true",
|
|
360
|
+
role: "dialog",
|
|
361
|
+
style: {
|
|
362
|
+
background: `${modalTheme.colors.background}90`,
|
|
363
|
+
backdropFilter: "blur(2px)",
|
|
364
|
+
width: "100%",
|
|
365
|
+
height: "100%",
|
|
366
|
+
position: "fixed",
|
|
367
|
+
zIndex: 999,
|
|
368
|
+
top: 0,
|
|
369
|
+
left: 0,
|
|
370
|
+
display: "flex",
|
|
371
|
+
justifyContent: "center",
|
|
372
|
+
alignItems: "center",
|
|
373
|
+
boxSizing: "border-box"
|
|
374
|
+
},
|
|
375
|
+
children: /* @__PURE__ */ jsxs(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
id: isLoading ? "ldg1" : void 0,
|
|
379
|
+
style: {
|
|
380
|
+
position: isMaximized ? "fixed" : "relative",
|
|
381
|
+
left: isMaximized ? 0 : void 0,
|
|
382
|
+
top: isMaximized ? 0 : void 0,
|
|
383
|
+
background: modalTheme.colors.background,
|
|
384
|
+
display: "flex",
|
|
385
|
+
alignItems: "center",
|
|
386
|
+
flexDirection: "column",
|
|
387
|
+
borderRadius: "0.8rem",
|
|
388
|
+
boxSizing: "border-box",
|
|
389
|
+
maxHeight: isMaximized ? "100vh" : "80vh",
|
|
390
|
+
maxWidth: isMaximized ? "100vw" : "80vw",
|
|
391
|
+
minWidth: isMaximized ? "100vw" : 300,
|
|
392
|
+
minHeight: isMaximized ? "100vh" : void 0,
|
|
393
|
+
width: isMaximized ? "100vw" : void 0,
|
|
394
|
+
boxShadow: "0 24px 64px rgba(15, 23, 42, 0.18)",
|
|
395
|
+
...isLoading ? { opacity: 0.5 } : null,
|
|
396
|
+
...style
|
|
397
|
+
},
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ jsxs(
|
|
400
|
+
"div",
|
|
401
|
+
{
|
|
402
|
+
style: {
|
|
403
|
+
background: modalTheme.colors.surface,
|
|
404
|
+
color: modalTheme.colors.onSurface,
|
|
405
|
+
position: "absolute",
|
|
406
|
+
top: 0,
|
|
407
|
+
zIndex: 500,
|
|
408
|
+
display: "flex",
|
|
409
|
+
justifyContent: "space-between",
|
|
410
|
+
alignItems: "center",
|
|
411
|
+
width: "100%",
|
|
412
|
+
height: "4rem",
|
|
413
|
+
padding: "1rem",
|
|
414
|
+
boxSizing: "border-box",
|
|
415
|
+
borderTopLeftRadius: "0.8rem",
|
|
416
|
+
borderTopRightRadius: "0.8rem",
|
|
417
|
+
borderBottom: `1px solid ${withAlpha(modalTheme.colors.onBackground, 0.1)}`
|
|
418
|
+
},
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ jsx("div", { id: "modal-title", style: { fontWeight: "bold", fontSize: "1.3rem" }, children: title }),
|
|
421
|
+
/* @__PURE__ */ jsxs(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
id: "modal-header-icons",
|
|
425
|
+
style: { display: "flex", alignItems: "center", gap: "0.5rem" },
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ jsx(
|
|
428
|
+
"button",
|
|
429
|
+
{
|
|
430
|
+
"aria-label": isMaximized ? "Minimize modal" : "Maximize modal",
|
|
431
|
+
title: isMaximized ? "Minimize" : "Maximize",
|
|
432
|
+
type: "button",
|
|
433
|
+
onClick: () => setIsMaximized((current) => !current),
|
|
434
|
+
style: {
|
|
435
|
+
border: "none",
|
|
436
|
+
background: "transparent",
|
|
437
|
+
color: modalTheme.colors.onSurface,
|
|
438
|
+
cursor: "pointer",
|
|
439
|
+
fontSize: 18,
|
|
440
|
+
lineHeight: 1,
|
|
441
|
+
padding: 0
|
|
442
|
+
},
|
|
443
|
+
children: isMaximized ? "\u25A2" : "\u25A1"
|
|
444
|
+
}
|
|
445
|
+
),
|
|
446
|
+
!hideCloseIcon ? /* @__PURE__ */ jsx(
|
|
447
|
+
"button",
|
|
448
|
+
{
|
|
449
|
+
"aria-label": "Close modal",
|
|
450
|
+
title: "Close",
|
|
451
|
+
type: "button",
|
|
452
|
+
onClick: isLoading ? void 0 : closeModal,
|
|
453
|
+
style: {
|
|
454
|
+
border: "none",
|
|
455
|
+
background: "transparent",
|
|
456
|
+
color: modalTheme.colors.onSurface,
|
|
457
|
+
cursor: isLoading ? "not-allowed" : "pointer",
|
|
458
|
+
fontSize: 22,
|
|
459
|
+
lineHeight: 1,
|
|
460
|
+
padding: 0,
|
|
461
|
+
opacity: isLoading ? 0.5 : 1
|
|
462
|
+
},
|
|
463
|
+
children: "\xD7"
|
|
464
|
+
}
|
|
465
|
+
) : null
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ jsx(
|
|
473
|
+
"div",
|
|
474
|
+
{
|
|
475
|
+
style: {
|
|
476
|
+
scrollbarWidth: "thin",
|
|
477
|
+
width: "100%",
|
|
478
|
+
maxWidth: "100%",
|
|
479
|
+
paddingTop: "4rem",
|
|
480
|
+
paddingBottom: "4rem",
|
|
481
|
+
overflow: "auto",
|
|
482
|
+
...bodyStyle
|
|
483
|
+
},
|
|
484
|
+
children
|
|
485
|
+
}
|
|
486
|
+
),
|
|
487
|
+
onlyCloseButton ? /* @__PURE__ */ jsx(
|
|
488
|
+
"div",
|
|
489
|
+
{
|
|
490
|
+
style: {
|
|
491
|
+
background: modalTheme.colors.surface,
|
|
492
|
+
color: modalTheme.colors.onSurface,
|
|
493
|
+
position: "absolute",
|
|
494
|
+
bottom: 0,
|
|
495
|
+
width: "100%",
|
|
496
|
+
height: "4rem",
|
|
497
|
+
padding: "0.5rem",
|
|
498
|
+
borderTop: `1px solid ${withAlpha(modalTheme.colors.onBackground, 0.1)}`,
|
|
499
|
+
boxSizing: "border-box",
|
|
500
|
+
borderBottomLeftRadius: "0.8rem",
|
|
501
|
+
borderBottomRightRadius: "0.8rem"
|
|
502
|
+
},
|
|
503
|
+
children: /* @__PURE__ */ jsx(
|
|
504
|
+
"div",
|
|
505
|
+
{
|
|
506
|
+
className: "buttons-footer",
|
|
507
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
508
|
+
children: /* @__PURE__ */ jsx(
|
|
509
|
+
LegacyActionButton,
|
|
510
|
+
{
|
|
511
|
+
label: "Close",
|
|
512
|
+
onClick: closeModal,
|
|
513
|
+
theme: modalTheme,
|
|
514
|
+
disabled: isLoading
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
}
|
|
520
|
+
) : /* @__PURE__ */ jsx(
|
|
521
|
+
"div",
|
|
522
|
+
{
|
|
523
|
+
style: {
|
|
524
|
+
background: modalTheme.colors.surface,
|
|
525
|
+
color: modalTheme.colors.onSurface,
|
|
526
|
+
position: "absolute",
|
|
527
|
+
bottom: 0,
|
|
528
|
+
width: "100%",
|
|
529
|
+
height: "4rem",
|
|
530
|
+
padding: "0.5rem",
|
|
531
|
+
borderTop: `1px solid ${withAlpha(modalTheme.colors.onBackground, 0.1)}`,
|
|
532
|
+
boxSizing: "border-box",
|
|
533
|
+
borderBottomLeftRadius: "0.8rem",
|
|
534
|
+
borderBottomRightRadius: "0.8rem"
|
|
535
|
+
},
|
|
536
|
+
children: cancelButton ? /* @__PURE__ */ jsxs(
|
|
537
|
+
"div",
|
|
538
|
+
{
|
|
539
|
+
className: "buttons-footer",
|
|
540
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ jsx(
|
|
543
|
+
LegacyActionButton,
|
|
544
|
+
{
|
|
545
|
+
label: "Cancel",
|
|
546
|
+
onClick: cancelButton,
|
|
547
|
+
type: "text",
|
|
548
|
+
style: { maxWidth: "100px" },
|
|
549
|
+
theme: modalTheme,
|
|
550
|
+
disabled: false
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
actionButtons()
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
) : /* @__PURE__ */ jsx(
|
|
557
|
+
"div",
|
|
558
|
+
{
|
|
559
|
+
className: "buttons-footer",
|
|
560
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
561
|
+
children: actionButtons()
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
)
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
function Modal(props) {
|
|
573
|
+
if (isLegacyModalProps(props)) {
|
|
574
|
+
return /* @__PURE__ */ jsx(LegacyModal, { ...props });
|
|
575
|
+
}
|
|
576
|
+
return /* @__PURE__ */ jsx(StandardModal, { ...props });
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export {
|
|
580
|
+
Modal
|
|
581
|
+
};
|
|
582
|
+
//# sourceMappingURL=chunk-KZRGV5RH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Modal.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport type { CSSProperties, ReactNode } from 'react';\n\nimport type { UiKitThemeTokens } from '../theme';\n\ntype LegacyButtonType = 'text' | 'outlined' | 'contained' | 'link';\n\ntype ModalThemeColors = {\n background: string;\n surface: string;\n onSurface: string;\n onBackground: string;\n primary: string;\n onPrimary: string;\n secondary: string;\n onSecondary: string;\n negative: string;\n warning: string;\n};\n\nexport interface ModalTheme {\n colors?: Partial<ModalThemeColors>;\n}\n\nexport type ModalThemeSource = ModalTheme | UiKitThemeTokens;\n\nexport interface LegacyModalAction {\n name: string;\n onClick: () => void;\n type?: LegacyButtonType;\n style?: CSSProperties;\n disable?: boolean;\n}\n\ninterface BaseModalProps {\n children?: ReactNode;\n theme?: ModalThemeSource;\n}\n\nexport interface StandardModalProps extends BaseModalProps {\n isOpen: boolean;\n onClose: () => void;\n children: ReactNode;\n footer?: ReactNode;\n title?: ReactNode;\n description?: ReactNode;\n headerContent?: ReactNode;\n maxWidth?: number | string;\n closeOnBackdrop?: boolean;\n closeOnEscape?: boolean;\n hideCloseButton?: boolean;\n contentStyle?: CSSProperties;\n}\n\nexport interface LegacyModalProps extends BaseModalProps {\n title: ReactNode;\n showModal: boolean;\n closeModal: () => void;\n action?: () => void;\n actionNameBtn?: string | undefined;\n hideActionButton?: boolean;\n cancelButton?: () => void;\n disableActionBtn?: boolean;\n isLoading?: boolean;\n onlyCloseButton?: boolean;\n hideCloseIcon?: boolean;\n style?: CSSProperties;\n bodyStyle?: CSSProperties;\n additionalActions?: LegacyModalAction[];\n maximized?: boolean;\n}\n\nexport type ModalProps = StandardModalProps | LegacyModalProps;\n\nconst defaultThemeColors: ModalThemeColors = {\n background: '#f8fafc',\n surface: '#ffffff',\n onSurface: '#0f172a',\n onBackground: '#0f172a',\n primary: '#0f766e',\n onPrimary: '#ffffff',\n secondary: '#1d4ed8',\n onSecondary: '#ffffff',\n negative: '#dc2626',\n warning: '#d97706',\n};\n\nconst withAlpha = (hex: string, alpha: number): string => {\n const normalized = hex.replace('#', '').trim();\n const value = normalized.length === 3\n ? normalized.split('').map((char) => char + char).join('')\n : normalized;\n\n const red = Number.parseInt(value.slice(0, 2), 16);\n const green = Number.parseInt(value.slice(2, 4), 16);\n const blue = Number.parseInt(value.slice(4, 6), 16);\n\n return `rgba(${red}, ${green}, ${blue}, ${alpha})`;\n};\n\nconst isUiKitThemeTokens = (theme?: ModalThemeSource): theme is UiKitThemeTokens => {\n return Boolean(theme && typeof theme === 'object' && 'theme' in theme);\n};\n\nconst resolveTheme = (theme?: ModalThemeSource) => {\n const colorOverrides = isUiKitThemeTokens(theme)\n ? theme.theme.colors\n : (theme?.colors ?? {});\n\n const colors: ModalThemeColors = {\n ...defaultThemeColors,\n ...colorOverrides,\n };\n\n return {\n colors,\n borderSoft: isUiKitThemeTokens(theme)\n ? theme.borderSoft\n : withAlpha(colors.onSurface, 0.1),\n borderStrong: isUiKitThemeTokens(theme)\n ? theme.borderStrong\n : withAlpha(colors.onSurface, 0.16),\n surfaceMuted: isUiKitThemeTokens(theme)\n ? theme.surfaceMuted\n : withAlpha(colors.onSurface, 0.04),\n surfaceRaised: isUiKitThemeTokens(theme)\n ? theme.surfaceRaised\n : withAlpha(colors.surface, 0.94),\n overlay: isUiKitThemeTokens(theme)\n ? theme.overlay\n : withAlpha('#030712', 0.62),\n mutedText: isUiKitThemeTokens(theme)\n ? theme.mutedText\n : withAlpha(colors.onSurface, 0.72),\n };\n};\n\nconst normalizeWidth = (maxWidth?: number | string): string | number => {\n if (typeof maxWidth === 'number') {\n return `${maxWidth}px`;\n }\n\n return maxWidth ?? '720px';\n};\n\nconst isLikelyMobileViewport = (): boolean => {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return false;\n }\n\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent,\n );\n};\n\nconst isLegacyModalProps = (props: ModalProps): props is LegacyModalProps => {\n return 'showModal' in props;\n};\n\nfunction LegacyActionButton({\n label,\n onClick,\n disabled,\n type = 'contained',\n theme,\n style,\n}: {\n label: string;\n onClick: () => void;\n disabled: boolean;\n type?: LegacyButtonType;\n theme: ReturnType<typeof resolveTheme>;\n style?: CSSProperties;\n}) {\n const { colors } = theme;\n\n const buttonStyle: CSSProperties = {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '0.4rem',\n padding: type === 'link' ? 0 : '1.3rem',\n boxSizing: 'border-box',\n cursor: disabled ? 'not-allowed' : 'pointer',\n fontWeight: 700,\n fontSize: '1.3rem',\n margin: 0,\n textAlign: 'center',\n transition: '0.5s',\n opacity: disabled ? 0.5 : 1,\n filter: disabled ? 'saturate(0)' : undefined,\n };\n\n if (type === 'text') {\n buttonStyle.background = 'none';\n buttonStyle.border = '1px solid transparent';\n buttonStyle.color = colors.primary;\n buttonStyle.boxShadow = 'none';\n } else if (type === 'link') {\n buttonStyle.background = 'none';\n buttonStyle.border = 'none';\n buttonStyle.color = colors.primary;\n buttonStyle.boxShadow = 'none';\n } else if (type === 'outlined') {\n buttonStyle.background = 'none';\n buttonStyle.border = `2px solid ${colors.primary}`;\n buttonStyle.color = colors.primary;\n buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.onSurface, 0.08)}`;\n } else {\n buttonStyle.background = colors.primary;\n buttonStyle.border = '1px solid transparent';\n buttonStyle.color = colors.onPrimary;\n buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.primary, 0.22)}`;\n }\n\n return (\n <div\n style={{\n width: style?.width ?? (style?.maxWidth ? '100%' : 'max-content'),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: '0 5px',\n marginBottom: style?.marginBottom ?? 0,\n ...style,\n }}\n >\n <button\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n style={buttonStyle}\n >\n {label}\n </button>\n </div>\n );\n}\n\nfunction StandardModal({\n isOpen,\n onClose,\n children,\n footer,\n title,\n description,\n headerContent,\n maxWidth,\n closeOnBackdrop = true,\n closeOnEscape = true,\n hideCloseButton = false,\n contentStyle,\n theme,\n}: StandardModalProps) {\n const modalTheme = useMemo(() => resolveTheme(theme), [theme]);\n const titleId = useMemo(\n () => `smartsell-modal-${String(title ?? 'dialog').toLowerCase().replace(/[^a-z0-9]+/g, '-')}`,\n [title],\n );\n\n useEffect(() => {\n if (!isOpen || typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (closeOnEscape && event.key === 'Escape') {\n onClose();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.body.style.overflow = previousOverflow;\n window.removeEventListener('keydown', handleKeyDown);\n };\n }, [closeOnEscape, isOpen, onClose]);\n\n if (!isOpen) {\n return null;\n }\n\n const header = headerContent ?? (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>\n {title ? (\n <h2\n id={titleId}\n style={{\n margin: 0,\n color: modalTheme.colors.onSurface,\n fontSize: 30,\n fontWeight: 800,\n lineHeight: 1.1,\n }}\n >\n {title}\n </h2>\n ) : null}\n {description ? (\n <p\n style={{\n margin: 0,\n color: modalTheme.mutedText,\n fontSize: 15,\n lineHeight: 1.6,\n }}\n >\n {description}\n </p>\n ) : null}\n </div>\n );\n\n return (\n <div\n aria-label={headerContent ? (typeof title === 'string' ? title : 'Dialog') : undefined}\n aria-labelledby={headerContent ? undefined : title ? titleId : undefined}\n aria-modal=\"true\"\n role=\"dialog\"\n onMouseDown={(event) => {\n if (closeOnBackdrop && event.target === event.currentTarget) {\n onClose();\n }\n }}\n style={{\n position: 'fixed',\n inset: 0,\n zIndex: 70,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 16,\n backgroundColor: modalTheme.overlay,\n backdropFilter: 'blur(8px)',\n }}\n >\n <div\n style={{\n width: 'min(100%, 100%)',\n maxWidth: normalizeWidth(maxWidth),\n borderRadius: 30,\n border: `1px solid ${modalTheme.borderSoft}`,\n background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,\n boxShadow: `0 34px 80px ${withAlpha('#020617', 0.28)}`,\n color: modalTheme.colors.onSurface,\n overflow: 'hidden',\n ...contentStyle,\n }}\n >\n <div\n style={{\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n gap: 16,\n padding: '24px 24px 0',\n }}\n >\n <div style={{ flex: 1 }}>{header}</div>\n {!hideCloseButton ? (\n <button\n aria-label=\"Close modal\"\n type=\"button\"\n onClick={onClose}\n style={{\n height: 42,\n width: 42,\n borderRadius: 999,\n border: `1px solid ${modalTheme.borderSoft}`,\n backgroundColor: 'transparent',\n color: modalTheme.colors.onSurface,\n cursor: 'pointer',\n fontSize: 20,\n fontWeight: 700,\n }}\n >\n ×\n </button>\n ) : null}\n </div>\n\n <div style={{ padding: 24 }}>{children}</div>\n\n {footer ? (\n <div\n style={{\n display: 'flex',\n justifyContent: 'flex-end',\n gap: 12,\n padding: '0 24px 24px',\n borderTop: `1px solid ${withAlpha(modalTheme.colors.onSurface, 0.06)}`,\n }}\n >\n {footer}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nfunction LegacyModal({\n title,\n showModal,\n closeModal,\n children,\n action,\n actionNameBtn,\n hideActionButton = false,\n cancelButton,\n disableActionBtn = false,\n isLoading = false,\n onlyCloseButton = false,\n hideCloseIcon = false,\n style,\n bodyStyle,\n additionalActions,\n maximized,\n theme,\n}: LegacyModalProps) {\n const modalTheme = useMemo(() => resolveTheme(theme), [theme]);\n const [isMaximized, setIsMaximized] = useState<boolean>(maximized ?? false);\n const resolvedAction = action ?? (() => null);\n\n useEffect(() => {\n if (maximized === undefined && isLikelyMobileViewport()) {\n setIsMaximized(true);\n }\n }, [maximized]);\n\n if (!showModal) {\n return null;\n }\n\n const actionButtons = () => {\n return (\n <>\n {additionalActions?.map((item) => (\n <LegacyActionButton\n key={item.name}\n label={item.name}\n onClick={item.onClick}\n type={item.type ?? 'contained'}\n style={item.style ?? { maxWidth: '150px' }}\n theme={modalTheme}\n disabled={item.disable ?? (disableActionBtn || isLoading)}\n />\n ))}\n\n {!hideActionButton ? (\n <LegacyActionButton\n label={actionNameBtn ?? 'Save'}\n onClick={resolvedAction}\n type=\"contained\"\n style={{ maxWidth: '100px' }}\n theme={modalTheme}\n disabled={disableActionBtn || isLoading}\n />\n ) : null}\n </>\n );\n };\n\n return (\n <div\n aria-labelledby=\"modal-title\"\n aria-modal=\"true\"\n role=\"dialog\"\n style={{\n background: `${modalTheme.colors.background}90`,\n backdropFilter: 'blur(2px)',\n width: '100%',\n height: '100%',\n position: 'fixed',\n zIndex: 999,\n top: 0,\n left: 0,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n boxSizing: 'border-box',\n }}\n >\n <div\n id={isLoading ? 'ldg1' : undefined}\n style={{\n position: isMaximized ? 'fixed' : 'relative',\n left: isMaximized ? 0 : undefined,\n top: isMaximized ? 0 : undefined,\n background: modalTheme.colors.background,\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n borderRadius: '0.8rem',\n boxSizing: 'border-box',\n maxHeight: isMaximized ? '100vh' : '80vh',\n maxWidth: isMaximized ? '100vw' : '80vw',\n minWidth: isMaximized ? '100vw' : 300,\n minHeight: isMaximized ? '100vh' : undefined,\n width: isMaximized ? '100vw' : undefined,\n boxShadow: '0 24px 64px rgba(15, 23, 42, 0.18)',\n ...(isLoading ? { opacity: 0.5 } : null),\n ...style,\n }}\n >\n <div\n style={{\n background: modalTheme.colors.surface,\n color: modalTheme.colors.onSurface,\n position: 'absolute',\n top: 0,\n zIndex: 500,\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n width: '100%',\n height: '4rem',\n padding: '1rem',\n boxSizing: 'border-box',\n borderTopLeftRadius: '0.8rem',\n borderTopRightRadius: '0.8rem',\n borderBottom: `1px solid ${withAlpha(modalTheme.colors.onBackground, 0.1)}`,\n }}\n >\n <div id=\"modal-title\" style={{ fontWeight: 'bold', fontSize: '1.3rem' }}>\n {title}\n </div>\n <div\n id=\"modal-header-icons\"\n style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}\n >\n <button\n aria-label={isMaximized ? 'Minimize modal' : 'Maximize modal'}\n title={isMaximized ? 'Minimize' : 'Maximize'}\n type=\"button\"\n onClick={() => setIsMaximized((current) => !current)}\n style={{\n border: 'none',\n background: 'transparent',\n color: modalTheme.colors.onSurface,\n cursor: 'pointer',\n fontSize: 18,\n lineHeight: 1,\n padding: 0,\n }}\n >\n {isMaximized ? '▢' : '□'}\n </button>\n\n {!hideCloseIcon ? (\n <button\n aria-label=\"Close modal\"\n title=\"Close\"\n type=\"button\"\n onClick={isLoading ? undefined : closeModal}\n style={{\n border: 'none',\n background: 'transparent',\n color: modalTheme.colors.onSurface,\n cursor: isLoading ? 'not-allowed' : 'pointer',\n fontSize: 22,\n lineHeight: 1,\n padding: 0,\n opacity: isLoading ? 0.5 : 1,\n }}\n >\n ×\n </button>\n ) : null}\n </div>\n </div>\n\n <div\n style={{\n scrollbarWidth: 'thin',\n width: '100%',\n maxWidth: '100%',\n paddingTop: '4rem',\n paddingBottom: '4rem',\n overflow: 'auto',\n ...bodyStyle,\n }}\n >\n {children}\n </div>\n\n {onlyCloseButton ? (\n <div\n style={{\n background: modalTheme.colors.surface,\n color: modalTheme.colors.onSurface,\n position: 'absolute',\n bottom: 0,\n width: '100%',\n height: '4rem',\n padding: '0.5rem',\n borderTop: `1px solid ${withAlpha(modalTheme.colors.onBackground, 0.1)}`,\n boxSizing: 'border-box',\n borderBottomLeftRadius: '0.8rem',\n borderBottomRightRadius: '0.8rem',\n }}\n >\n <div\n className=\"buttons-footer\"\n style={{ flex: 1, display: 'flex', justifyContent: 'end' }}\n >\n <LegacyActionButton\n label=\"Close\"\n onClick={closeModal}\n theme={modalTheme}\n disabled={isLoading}\n />\n </div>\n </div>\n ) : (\n <div\n style={{\n background: modalTheme.colors.surface,\n color: modalTheme.colors.onSurface,\n position: 'absolute',\n bottom: 0,\n width: '100%',\n height: '4rem',\n padding: '0.5rem',\n borderTop: `1px solid ${withAlpha(modalTheme.colors.onBackground, 0.1)}`,\n boxSizing: 'border-box',\n borderBottomLeftRadius: '0.8rem',\n borderBottomRightRadius: '0.8rem',\n }}\n >\n {cancelButton ? (\n <div\n className=\"buttons-footer\"\n style={{ flex: 1, display: 'flex', justifyContent: 'end' }}\n >\n <LegacyActionButton\n label=\"Cancel\"\n onClick={cancelButton}\n type=\"text\"\n style={{ maxWidth: '100px' }}\n theme={modalTheme}\n disabled={false}\n />\n {actionButtons()}\n </div>\n ) : (\n <div\n className=\"buttons-footer\"\n style={{ flex: 1, display: 'flex', justifyContent: 'end' }}\n >\n {actionButtons()}\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n}\n\nexport function Modal(props: ModalProps) {\n if (isLegacyModalProps(props)) {\n return <LegacyModal {...props} />;\n }\n\n return <StandardModal {...props} />;\n}"],"mappings":";AAAA,SAAS,WAAW,SAAS,gBAAgB;AAoOvC,SAqNA,UArNA,KA4DF,YA5DE;AA1JN,IAAM,qBAAuC;AAAA,EAC3C,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,cAAc;AAAA,EACd,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,UAAU;AAAA,EACV,SAAS;AACX;AAEA,IAAM,YAAY,CAAC,KAAa,UAA0B;AACxD,QAAM,aAAa,IAAI,QAAQ,KAAK,EAAE,EAAE,KAAK;AAC7C,QAAM,QAAQ,WAAW,WAAW,IAChC,WAAW,MAAM,EAAE,EAAE,IAAI,CAAC,SAAS,OAAO,IAAI,EAAE,KAAK,EAAE,IACvD;AAEJ,QAAM,MAAM,OAAO,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AACjD,QAAM,QAAQ,OAAO,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AACnD,QAAM,OAAO,OAAO,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AAElD,SAAO,QAAQ,GAAG,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK;AACjD;AAEA,IAAM,qBAAqB,CAAC,UAAwD;AAClF,SAAO,QAAQ,SAAS,OAAO,UAAU,YAAY,WAAW,KAAK;AACvE;AAEA,IAAM,eAAe,CAAC,UAA6B;AAxGnD;AAyGE,QAAM,iBAAiB,mBAAmB,KAAK,IAC3C,MAAM,MAAM,UACX,oCAAO,WAAP,YAAiB,CAAC;AAEvB,QAAM,SAA2B;AAAA,IAC/B,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY,mBAAmB,KAAK,IAChC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