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