smartsell-ui-kit 0.0.2 → 0.0.4
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-BI3QBKFG.js +634 -0
- package/dist/chunk-BI3QBKFG.js.map +1 -0
- package/dist/index.cjs +514 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -32
- package/dist/index.d.ts +6 -32
- package/dist/index.js +45 -210
- package/dist/index.js.map +1 -1
- package/dist/modal-BDeh1TYW.d.cts +81 -0
- package/dist/modal-BDeh1TYW.d.ts +81 -0
- package/dist/modal.cjs +660 -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
package/dist/index.cjs
CHANGED
|
@@ -249,20 +249,142 @@ function Card({
|
|
|
249
249
|
|
|
250
250
|
// src/components/ComposableModal.tsx
|
|
251
251
|
var import_react3 = require("react");
|
|
252
|
-
var
|
|
252
|
+
var import_smartsell_sales_sdk4 = require("smartsell-sales-sdk");
|
|
253
253
|
|
|
254
254
|
// src/components/Modal.tsx
|
|
255
255
|
var import_react2 = require("react");
|
|
256
|
-
var import_smartsell_sales_sdk4 = require("smartsell-sales-sdk");
|
|
257
256
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
257
|
+
var defaultThemeColors = {
|
|
258
|
+
background: "#f8fafc",
|
|
259
|
+
surface: "#ffffff",
|
|
260
|
+
onSurface: "#0f172a",
|
|
261
|
+
onBackground: "#0f172a",
|
|
262
|
+
primary: "#0f766e",
|
|
263
|
+
onPrimary: "#ffffff",
|
|
264
|
+
secondary: "#1d4ed8",
|
|
265
|
+
onSecondary: "#ffffff",
|
|
266
|
+
negative: "#dc2626",
|
|
267
|
+
warning: "#d97706"
|
|
268
|
+
};
|
|
269
|
+
var withAlpha4 = (hex, alpha) => {
|
|
270
|
+
const normalized = hex.replace("#", "").trim();
|
|
271
|
+
const value = normalized.length === 3 ? normalized.split("").map((char) => char + char).join("") : normalized;
|
|
272
|
+
const red = Number.parseInt(value.slice(0, 2), 16);
|
|
273
|
+
const green = Number.parseInt(value.slice(2, 4), 16);
|
|
274
|
+
const blue = Number.parseInt(value.slice(4, 6), 16);
|
|
275
|
+
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
276
|
+
};
|
|
277
|
+
var isUiKitThemeTokens = (theme) => {
|
|
278
|
+
return Boolean(theme && typeof theme === "object" && "theme" in theme);
|
|
279
|
+
};
|
|
280
|
+
var resolveTheme = (theme) => {
|
|
281
|
+
var _a;
|
|
282
|
+
const colorOverrides = isUiKitThemeTokens(theme) ? theme.theme.colors : (_a = theme == null ? void 0 : theme.colors) != null ? _a : {};
|
|
283
|
+
const colors = {
|
|
284
|
+
...defaultThemeColors,
|
|
285
|
+
...colorOverrides
|
|
286
|
+
};
|
|
287
|
+
return {
|
|
288
|
+
colors,
|
|
289
|
+
borderSoft: isUiKitThemeTokens(theme) ? theme.borderSoft : withAlpha4(colors.onSurface, 0.1),
|
|
290
|
+
borderStrong: isUiKitThemeTokens(theme) ? theme.borderStrong : withAlpha4(colors.onSurface, 0.16),
|
|
291
|
+
surfaceMuted: isUiKitThemeTokens(theme) ? theme.surfaceMuted : withAlpha4(colors.onSurface, 0.04),
|
|
292
|
+
surfaceRaised: isUiKitThemeTokens(theme) ? theme.surfaceRaised : withAlpha4(colors.surface, 0.94),
|
|
293
|
+
overlay: isUiKitThemeTokens(theme) ? theme.overlay : withAlpha4("#030712", 0.62),
|
|
294
|
+
mutedText: isUiKitThemeTokens(theme) ? theme.mutedText : withAlpha4(colors.onSurface, 0.72)
|
|
295
|
+
};
|
|
296
|
+
};
|
|
258
297
|
var normalizeWidth = (maxWidth) => {
|
|
259
298
|
if (typeof maxWidth === "number") {
|
|
260
299
|
return `${maxWidth}px`;
|
|
261
300
|
}
|
|
262
301
|
return maxWidth != null ? maxWidth : "720px";
|
|
263
302
|
};
|
|
264
|
-
|
|
265
|
-
|
|
303
|
+
var isLikelyMobileViewport = () => {
|
|
304
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
308
|
+
navigator.userAgent
|
|
309
|
+
);
|
|
310
|
+
};
|
|
311
|
+
var isLegacyModalProps = (props) => {
|
|
312
|
+
return "showModal" in props;
|
|
313
|
+
};
|
|
314
|
+
function LegacyActionButton({
|
|
315
|
+
label,
|
|
316
|
+
onClick,
|
|
317
|
+
disabled,
|
|
318
|
+
type = "contained",
|
|
319
|
+
theme,
|
|
320
|
+
style
|
|
321
|
+
}) {
|
|
322
|
+
var _a, _b;
|
|
323
|
+
const { colors } = theme;
|
|
324
|
+
const buttonStyle = {
|
|
325
|
+
width: "100%",
|
|
326
|
+
display: "flex",
|
|
327
|
+
alignItems: "center",
|
|
328
|
+
justifyContent: "center",
|
|
329
|
+
borderRadius: "0.4rem",
|
|
330
|
+
padding: type === "link" ? 0 : "1.3rem",
|
|
331
|
+
boxSizing: "border-box",
|
|
332
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
333
|
+
fontWeight: 700,
|
|
334
|
+
fontSize: "1.3rem",
|
|
335
|
+
margin: 0,
|
|
336
|
+
textAlign: "center",
|
|
337
|
+
transition: "0.5s",
|
|
338
|
+
opacity: disabled ? 0.5 : 1,
|
|
339
|
+
filter: disabled ? "saturate(0)" : void 0
|
|
340
|
+
};
|
|
341
|
+
if (type === "text") {
|
|
342
|
+
buttonStyle.background = "none";
|
|
343
|
+
buttonStyle.border = "1px solid transparent";
|
|
344
|
+
buttonStyle.color = colors.primary;
|
|
345
|
+
buttonStyle.boxShadow = "none";
|
|
346
|
+
} else if (type === "link") {
|
|
347
|
+
buttonStyle.background = "none";
|
|
348
|
+
buttonStyle.border = "none";
|
|
349
|
+
buttonStyle.color = colors.primary;
|
|
350
|
+
buttonStyle.boxShadow = "none";
|
|
351
|
+
} else if (type === "outlined") {
|
|
352
|
+
buttonStyle.background = "none";
|
|
353
|
+
buttonStyle.border = `2px solid ${colors.primary}`;
|
|
354
|
+
buttonStyle.color = colors.primary;
|
|
355
|
+
buttonStyle.boxShadow = `0 14px 28px ${withAlpha4(colors.onSurface, 0.08)}`;
|
|
356
|
+
} else {
|
|
357
|
+
buttonStyle.background = colors.primary;
|
|
358
|
+
buttonStyle.border = "1px solid transparent";
|
|
359
|
+
buttonStyle.color = colors.onPrimary;
|
|
360
|
+
buttonStyle.boxShadow = `0 14px 28px ${withAlpha4(colors.primary, 0.22)}`;
|
|
361
|
+
}
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
363
|
+
"div",
|
|
364
|
+
{
|
|
365
|
+
style: {
|
|
366
|
+
width: (_a = style == null ? void 0 : style.width) != null ? _a : (style == null ? void 0 : style.maxWidth) ? "100%" : "max-content",
|
|
367
|
+
display: "flex",
|
|
368
|
+
alignItems: "center",
|
|
369
|
+
justifyContent: "center",
|
|
370
|
+
margin: "0 5px",
|
|
371
|
+
marginBottom: (_b = style == null ? void 0 : style.marginBottom) != null ? _b : 0,
|
|
372
|
+
...style
|
|
373
|
+
},
|
|
374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
375
|
+
"button",
|
|
376
|
+
{
|
|
377
|
+
type: "button",
|
|
378
|
+
onClick: disabled ? void 0 : onClick,
|
|
379
|
+
disabled,
|
|
380
|
+
style: buttonStyle,
|
|
381
|
+
children: label
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
function StandardModal({
|
|
266
388
|
isOpen,
|
|
267
389
|
onClose,
|
|
268
390
|
children,
|
|
@@ -274,13 +396,26 @@ function Modal({
|
|
|
274
396
|
closeOnBackdrop = true,
|
|
275
397
|
closeOnEscape = true,
|
|
276
398
|
hideCloseButton = false,
|
|
277
|
-
|
|
399
|
+
hideExpandButton = false,
|
|
400
|
+
maximized,
|
|
401
|
+
contentStyle,
|
|
402
|
+
theme
|
|
278
403
|
}) {
|
|
279
|
-
const
|
|
404
|
+
const modalTheme = (0, import_react2.useMemo)(() => resolveTheme(theme), [theme]);
|
|
405
|
+
const [isMaximized, setIsMaximized] = (0, import_react2.useState)(maximized != null ? maximized : false);
|
|
280
406
|
const titleId = (0, import_react2.useMemo)(
|
|
281
407
|
() => `smartsell-modal-${String(title != null ? title : "dialog").toLowerCase().replace(/[^a-z0-9]+/g, "-")}`,
|
|
282
408
|
[title]
|
|
283
409
|
);
|
|
410
|
+
(0, import_react2.useEffect)(() => {
|
|
411
|
+
if (typeof maximized === "boolean") {
|
|
412
|
+
setIsMaximized(maximized);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (isLikelyMobileViewport()) {
|
|
416
|
+
setIsMaximized(true);
|
|
417
|
+
}
|
|
418
|
+
}, [maximized]);
|
|
284
419
|
(0, import_react2.useEffect)(() => {
|
|
285
420
|
if (!isOpen || typeof window === "undefined" || typeof document === "undefined") {
|
|
286
421
|
return;
|
|
@@ -308,7 +443,7 @@ function Modal({
|
|
|
308
443
|
id: titleId,
|
|
309
444
|
style: {
|
|
310
445
|
margin: 0,
|
|
311
|
-
color:
|
|
446
|
+
color: modalTheme.colors.onSurface,
|
|
312
447
|
fontSize: 30,
|
|
313
448
|
fontWeight: 800,
|
|
314
449
|
lineHeight: 1.1
|
|
@@ -321,7 +456,7 @@ function Modal({
|
|
|
321
456
|
{
|
|
322
457
|
style: {
|
|
323
458
|
margin: 0,
|
|
324
|
-
color: mutedText,
|
|
459
|
+
color: modalTheme.mutedText,
|
|
325
460
|
fontSize: 15,
|
|
326
461
|
lineHeight: 1.6
|
|
327
462
|
},
|
|
@@ -348,21 +483,26 @@ function Modal({
|
|
|
348
483
|
display: "flex",
|
|
349
484
|
alignItems: "center",
|
|
350
485
|
justifyContent: "center",
|
|
351
|
-
padding: 16,
|
|
352
|
-
backgroundColor: overlay,
|
|
486
|
+
padding: isMaximized ? 0 : 16,
|
|
487
|
+
backgroundColor: modalTheme.overlay,
|
|
353
488
|
backdropFilter: "blur(8px)"
|
|
354
489
|
},
|
|
355
490
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
356
491
|
"div",
|
|
357
492
|
{
|
|
358
493
|
style: {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
494
|
+
position: "relative",
|
|
495
|
+
display: "flex",
|
|
496
|
+
flexDirection: "column",
|
|
497
|
+
width: isMaximized ? "100vw" : "min(100%, 100%)",
|
|
498
|
+
maxWidth: isMaximized ? "100vw" : normalizeWidth(maxWidth),
|
|
499
|
+
height: isMaximized ? "100vh" : void 0,
|
|
500
|
+
maxHeight: isMaximized ? "100vh" : "calc(100vh - 32px)",
|
|
501
|
+
borderRadius: isMaximized ? 0 : 30,
|
|
502
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
503
|
+
background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,
|
|
504
|
+
boxShadow: `0 34px 80px ${withAlpha4("#020617", 0.28)}`,
|
|
505
|
+
color: modalTheme.colors.onSurface,
|
|
366
506
|
overflow: "hidden",
|
|
367
507
|
...contentStyle
|
|
368
508
|
},
|
|
@@ -375,34 +515,69 @@ function Modal({
|
|
|
375
515
|
alignItems: "flex-start",
|
|
376
516
|
justifyContent: "space-between",
|
|
377
517
|
gap: 16,
|
|
378
|
-
padding: "24px 24px
|
|
518
|
+
padding: "24px 24px 16px",
|
|
519
|
+
borderBottom: `1px solid ${withAlpha4(modalTheme.colors.onSurface, 0.06)}`
|
|
379
520
|
},
|
|
380
521
|
children: [
|
|
381
522
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { flex: 1 }, children: header }),
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
524
|
+
!hideExpandButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
"aria-label": isMaximized ? "Minimize modal" : "Maximize modal",
|
|
528
|
+
title: isMaximized ? "Minimize" : "Maximize",
|
|
529
|
+
type: "button",
|
|
530
|
+
onClick: () => setIsMaximized((current) => !current),
|
|
531
|
+
style: {
|
|
532
|
+
height: 42,
|
|
533
|
+
width: 42,
|
|
534
|
+
borderRadius: 999,
|
|
535
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
536
|
+
backgroundColor: "transparent",
|
|
537
|
+
color: modalTheme.colors.onSurface,
|
|
538
|
+
cursor: "pointer",
|
|
539
|
+
fontSize: 18,
|
|
540
|
+
fontWeight: 700
|
|
541
|
+
},
|
|
542
|
+
children: isMaximized ? "\u25A2" : "\u25A1"
|
|
543
|
+
}
|
|
544
|
+
) : null,
|
|
545
|
+
!hideCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
546
|
+
"button",
|
|
547
|
+
{
|
|
548
|
+
"aria-label": "Close modal",
|
|
549
|
+
type: "button",
|
|
550
|
+
onClick: onClose,
|
|
551
|
+
style: {
|
|
552
|
+
height: 42,
|
|
553
|
+
width: 42,
|
|
554
|
+
borderRadius: 999,
|
|
555
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
556
|
+
backgroundColor: "transparent",
|
|
557
|
+
color: modalTheme.colors.onSurface,
|
|
558
|
+
cursor: "pointer",
|
|
559
|
+
fontSize: 20,
|
|
560
|
+
fontWeight: 700
|
|
561
|
+
},
|
|
562
|
+
children: "\xD7"
|
|
563
|
+
}
|
|
564
|
+
) : null
|
|
565
|
+
] })
|
|
402
566
|
]
|
|
403
567
|
}
|
|
404
568
|
),
|
|
405
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
570
|
+
"div",
|
|
571
|
+
{
|
|
572
|
+
style: {
|
|
573
|
+
flex: 1,
|
|
574
|
+
minHeight: 0,
|
|
575
|
+
overflow: "auto",
|
|
576
|
+
padding: 24
|
|
577
|
+
},
|
|
578
|
+
children
|
|
579
|
+
}
|
|
580
|
+
),
|
|
406
581
|
footer ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
407
582
|
"div",
|
|
408
583
|
{
|
|
@@ -410,8 +585,8 @@ function Modal({
|
|
|
410
585
|
display: "flex",
|
|
411
586
|
justifyContent: "flex-end",
|
|
412
587
|
gap: 12,
|
|
413
|
-
padding: "
|
|
414
|
-
borderTop: `1px solid ${(
|
|
588
|
+
padding: "16px 24px 24px",
|
|
589
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onSurface, 0.06)}`
|
|
415
590
|
},
|
|
416
591
|
children: footer
|
|
417
592
|
}
|
|
@@ -422,6 +597,289 @@ function Modal({
|
|
|
422
597
|
}
|
|
423
598
|
);
|
|
424
599
|
}
|
|
600
|
+
function LegacyModal({
|
|
601
|
+
title,
|
|
602
|
+
showModal,
|
|
603
|
+
closeModal,
|
|
604
|
+
children,
|
|
605
|
+
action,
|
|
606
|
+
actionNameBtn,
|
|
607
|
+
hideActionButton = false,
|
|
608
|
+
cancelButton,
|
|
609
|
+
disableActionBtn = false,
|
|
610
|
+
isLoading = false,
|
|
611
|
+
onlyCloseButton = false,
|
|
612
|
+
hideCloseIcon = false,
|
|
613
|
+
style,
|
|
614
|
+
bodyStyle,
|
|
615
|
+
additionalActions,
|
|
616
|
+
maximized,
|
|
617
|
+
theme
|
|
618
|
+
}) {
|
|
619
|
+
const modalTheme = (0, import_react2.useMemo)(() => resolveTheme(theme), [theme]);
|
|
620
|
+
const [isMaximized, setIsMaximized] = (0, import_react2.useState)(maximized != null ? maximized : false);
|
|
621
|
+
const resolvedAction = action != null ? action : (() => null);
|
|
622
|
+
(0, import_react2.useEffect)(() => {
|
|
623
|
+
if (maximized === void 0 && isLikelyMobileViewport()) {
|
|
624
|
+
setIsMaximized(true);
|
|
625
|
+
}
|
|
626
|
+
}, [maximized]);
|
|
627
|
+
if (!showModal) {
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
const actionButtons = () => {
|
|
631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
632
|
+
additionalActions == null ? void 0 : additionalActions.map((item) => {
|
|
633
|
+
var _a, _b, _c;
|
|
634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
635
|
+
LegacyActionButton,
|
|
636
|
+
{
|
|
637
|
+
label: item.name,
|
|
638
|
+
onClick: item.onClick,
|
|
639
|
+
type: (_a = item.type) != null ? _a : "contained",
|
|
640
|
+
style: (_b = item.style) != null ? _b : { maxWidth: "150px" },
|
|
641
|
+
theme: modalTheme,
|
|
642
|
+
disabled: (_c = item.disable) != null ? _c : disableActionBtn || isLoading
|
|
643
|
+
},
|
|
644
|
+
item.name
|
|
645
|
+
);
|
|
646
|
+
}),
|
|
647
|
+
!hideActionButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
648
|
+
LegacyActionButton,
|
|
649
|
+
{
|
|
650
|
+
label: actionNameBtn != null ? actionNameBtn : "Save",
|
|
651
|
+
onClick: resolvedAction,
|
|
652
|
+
type: "contained",
|
|
653
|
+
style: { maxWidth: "100px" },
|
|
654
|
+
theme: modalTheme,
|
|
655
|
+
disabled: disableActionBtn || isLoading
|
|
656
|
+
}
|
|
657
|
+
) : null
|
|
658
|
+
] });
|
|
659
|
+
};
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
661
|
+
"div",
|
|
662
|
+
{
|
|
663
|
+
"aria-labelledby": "modal-title",
|
|
664
|
+
"aria-modal": "true",
|
|
665
|
+
role: "dialog",
|
|
666
|
+
style: {
|
|
667
|
+
background: `${modalTheme.colors.background}90`,
|
|
668
|
+
backdropFilter: "blur(2px)",
|
|
669
|
+
width: "100%",
|
|
670
|
+
height: "100%",
|
|
671
|
+
position: "fixed",
|
|
672
|
+
zIndex: 999,
|
|
673
|
+
top: 0,
|
|
674
|
+
left: 0,
|
|
675
|
+
display: "flex",
|
|
676
|
+
justifyContent: "center",
|
|
677
|
+
alignItems: "center",
|
|
678
|
+
boxSizing: "border-box"
|
|
679
|
+
},
|
|
680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
681
|
+
"div",
|
|
682
|
+
{
|
|
683
|
+
id: isLoading ? "ldg1" : void 0,
|
|
684
|
+
style: {
|
|
685
|
+
position: isMaximized ? "fixed" : "relative",
|
|
686
|
+
left: isMaximized ? 0 : void 0,
|
|
687
|
+
top: isMaximized ? 0 : void 0,
|
|
688
|
+
background: modalTheme.colors.background,
|
|
689
|
+
display: "flex",
|
|
690
|
+
alignItems: "center",
|
|
691
|
+
flexDirection: "column",
|
|
692
|
+
borderRadius: "0.8rem",
|
|
693
|
+
boxSizing: "border-box",
|
|
694
|
+
maxHeight: isMaximized ? "100vh" : "80vh",
|
|
695
|
+
maxWidth: isMaximized ? "100vw" : "80vw",
|
|
696
|
+
minWidth: isMaximized ? "100vw" : 300,
|
|
697
|
+
minHeight: isMaximized ? "100vh" : void 0,
|
|
698
|
+
width: isMaximized ? "100vw" : void 0,
|
|
699
|
+
boxShadow: "0 24px 64px rgba(15, 23, 42, 0.18)",
|
|
700
|
+
...isLoading ? { opacity: 0.5 } : null,
|
|
701
|
+
...style
|
|
702
|
+
},
|
|
703
|
+
children: [
|
|
704
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
705
|
+
"div",
|
|
706
|
+
{
|
|
707
|
+
style: {
|
|
708
|
+
background: modalTheme.colors.surface,
|
|
709
|
+
color: modalTheme.colors.onSurface,
|
|
710
|
+
position: "absolute",
|
|
711
|
+
top: 0,
|
|
712
|
+
zIndex: 500,
|
|
713
|
+
display: "flex",
|
|
714
|
+
justifyContent: "space-between",
|
|
715
|
+
alignItems: "center",
|
|
716
|
+
width: "100%",
|
|
717
|
+
height: "4rem",
|
|
718
|
+
padding: "1rem",
|
|
719
|
+
boxSizing: "border-box",
|
|
720
|
+
borderTopLeftRadius: "0.8rem",
|
|
721
|
+
borderTopRightRadius: "0.8rem",
|
|
722
|
+
borderBottom: `1px solid ${withAlpha4(modalTheme.colors.onBackground, 0.1)}`
|
|
723
|
+
},
|
|
724
|
+
children: [
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { id: "modal-title", style: { fontWeight: "bold", fontSize: "1.3rem" }, children: title }),
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
727
|
+
"div",
|
|
728
|
+
{
|
|
729
|
+
id: "modal-header-icons",
|
|
730
|
+
style: { display: "flex", alignItems: "center", gap: "0.5rem" },
|
|
731
|
+
children: [
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
733
|
+
"button",
|
|
734
|
+
{
|
|
735
|
+
"aria-label": isMaximized ? "Minimize modal" : "Maximize modal",
|
|
736
|
+
title: isMaximized ? "Minimize" : "Maximize",
|
|
737
|
+
type: "button",
|
|
738
|
+
onClick: () => setIsMaximized((current) => !current),
|
|
739
|
+
style: {
|
|
740
|
+
border: "none",
|
|
741
|
+
background: "transparent",
|
|
742
|
+
color: modalTheme.colors.onSurface,
|
|
743
|
+
cursor: "pointer",
|
|
744
|
+
fontSize: 18,
|
|
745
|
+
lineHeight: 1,
|
|
746
|
+
padding: 0
|
|
747
|
+
},
|
|
748
|
+
children: isMaximized ? "\u25A2" : "\u25A1"
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
!hideCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
752
|
+
"button",
|
|
753
|
+
{
|
|
754
|
+
"aria-label": "Close modal",
|
|
755
|
+
title: "Close",
|
|
756
|
+
type: "button",
|
|
757
|
+
onClick: isLoading ? void 0 : closeModal,
|
|
758
|
+
style: {
|
|
759
|
+
border: "none",
|
|
760
|
+
background: "transparent",
|
|
761
|
+
color: modalTheme.colors.onSurface,
|
|
762
|
+
cursor: isLoading ? "not-allowed" : "pointer",
|
|
763
|
+
fontSize: 22,
|
|
764
|
+
lineHeight: 1,
|
|
765
|
+
padding: 0,
|
|
766
|
+
opacity: isLoading ? 0.5 : 1
|
|
767
|
+
},
|
|
768
|
+
children: "\xD7"
|
|
769
|
+
}
|
|
770
|
+
) : null
|
|
771
|
+
]
|
|
772
|
+
}
|
|
773
|
+
)
|
|
774
|
+
]
|
|
775
|
+
}
|
|
776
|
+
),
|
|
777
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
778
|
+
"div",
|
|
779
|
+
{
|
|
780
|
+
style: {
|
|
781
|
+
scrollbarWidth: "thin",
|
|
782
|
+
width: "100%",
|
|
783
|
+
maxWidth: "100%",
|
|
784
|
+
paddingTop: "4rem",
|
|
785
|
+
paddingBottom: "4rem",
|
|
786
|
+
overflow: "auto",
|
|
787
|
+
...bodyStyle
|
|
788
|
+
},
|
|
789
|
+
children
|
|
790
|
+
}
|
|
791
|
+
),
|
|
792
|
+
onlyCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
793
|
+
"div",
|
|
794
|
+
{
|
|
795
|
+
style: {
|
|
796
|
+
background: modalTheme.colors.surface,
|
|
797
|
+
color: modalTheme.colors.onSurface,
|
|
798
|
+
position: "absolute",
|
|
799
|
+
bottom: 0,
|
|
800
|
+
width: "100%",
|
|
801
|
+
height: "4rem",
|
|
802
|
+
padding: "0.5rem",
|
|
803
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onBackground, 0.1)}`,
|
|
804
|
+
boxSizing: "border-box",
|
|
805
|
+
borderBottomLeftRadius: "0.8rem",
|
|
806
|
+
borderBottomRightRadius: "0.8rem"
|
|
807
|
+
},
|
|
808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
809
|
+
"div",
|
|
810
|
+
{
|
|
811
|
+
className: "buttons-footer",
|
|
812
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
814
|
+
LegacyActionButton,
|
|
815
|
+
{
|
|
816
|
+
label: "Close",
|
|
817
|
+
onClick: closeModal,
|
|
818
|
+
theme: modalTheme,
|
|
819
|
+
disabled: isLoading
|
|
820
|
+
}
|
|
821
|
+
)
|
|
822
|
+
}
|
|
823
|
+
)
|
|
824
|
+
}
|
|
825
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
826
|
+
"div",
|
|
827
|
+
{
|
|
828
|
+
style: {
|
|
829
|
+
background: modalTheme.colors.surface,
|
|
830
|
+
color: modalTheme.colors.onSurface,
|
|
831
|
+
position: "absolute",
|
|
832
|
+
bottom: 0,
|
|
833
|
+
width: "100%",
|
|
834
|
+
height: "4rem",
|
|
835
|
+
padding: "0.5rem",
|
|
836
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onBackground, 0.1)}`,
|
|
837
|
+
boxSizing: "border-box",
|
|
838
|
+
borderBottomLeftRadius: "0.8rem",
|
|
839
|
+
borderBottomRightRadius: "0.8rem"
|
|
840
|
+
},
|
|
841
|
+
children: cancelButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
842
|
+
"div",
|
|
843
|
+
{
|
|
844
|
+
className: "buttons-footer",
|
|
845
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
848
|
+
LegacyActionButton,
|
|
849
|
+
{
|
|
850
|
+
label: "Cancel",
|
|
851
|
+
onClick: cancelButton,
|
|
852
|
+
type: "text",
|
|
853
|
+
style: { maxWidth: "100px" },
|
|
854
|
+
theme: modalTheme,
|
|
855
|
+
disabled: false
|
|
856
|
+
}
|
|
857
|
+
),
|
|
858
|
+
actionButtons()
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
862
|
+
"div",
|
|
863
|
+
{
|
|
864
|
+
className: "buttons-footer",
|
|
865
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
866
|
+
children: actionButtons()
|
|
867
|
+
}
|
|
868
|
+
)
|
|
869
|
+
}
|
|
870
|
+
)
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
}
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
function Modal(props) {
|
|
878
|
+
if (isLegacyModalProps(props)) {
|
|
879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LegacyModal, { ...props });
|
|
880
|
+
}
|
|
881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StandardModal, { ...props });
|
|
882
|
+
}
|
|
425
883
|
|
|
426
884
|
// src/components/ComposableModal.tsx
|
|
427
885
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -444,12 +902,15 @@ function ComposableModal({
|
|
|
444
902
|
isBusy = false,
|
|
445
903
|
closeOnBackdrop = true,
|
|
446
904
|
closeOnEscape = true,
|
|
905
|
+
hideExpandButton = false,
|
|
906
|
+
maximized,
|
|
447
907
|
hideDefaultFooter = false,
|
|
448
908
|
maxWidth,
|
|
449
909
|
headerFallback,
|
|
450
910
|
footerFallback,
|
|
451
911
|
children
|
|
452
912
|
}) {
|
|
913
|
+
const theme = useUiKitTheme(sdk);
|
|
453
914
|
const slotIds = createModalSlotIds(slotBaseId);
|
|
454
915
|
const context = (0, import_react3.useMemo)(
|
|
455
916
|
() => ({
|
|
@@ -495,20 +956,22 @@ function ComposableModal({
|
|
|
495
956
|
}
|
|
496
957
|
) : null
|
|
497
958
|
] });
|
|
498
|
-
const headerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
499
|
-
const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
500
|
-
const footerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
959
|
+
const headerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_smartsell_sales_sdk4.SlotRenderer, { id: slotIds.header, sdk, context, children: defaultHeader });
|
|
960
|
+
const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_smartsell_sales_sdk4.SlotRenderer, { id: slotIds.body, sdk, context, children });
|
|
961
|
+
const footerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_smartsell_sales_sdk4.SlotRenderer, { id: slotIds.footer, sdk, context, children: defaultFooter });
|
|
501
962
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
502
963
|
Modal,
|
|
503
964
|
{
|
|
504
|
-
sdk,
|
|
505
965
|
isOpen,
|
|
506
966
|
onClose,
|
|
507
967
|
title,
|
|
508
968
|
description,
|
|
509
969
|
headerContent,
|
|
510
970
|
footer: footerContent,
|
|
971
|
+
theme,
|
|
511
972
|
maxWidth,
|
|
973
|
+
hideExpandButton,
|
|
974
|
+
maximized,
|
|
512
975
|
closeOnBackdrop,
|
|
513
976
|
closeOnEscape,
|
|
514
977
|
children: bodyContent
|
|
@@ -588,7 +1051,7 @@ function Field({
|
|
|
588
1051
|
}
|
|
589
1052
|
|
|
590
1053
|
// src/components/Input.tsx
|
|
591
|
-
var
|
|
1054
|
+
var import_smartsell_sales_sdk5 = require("smartsell-sales-sdk");
|
|
592
1055
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
593
1056
|
var getPadding = (size) => {
|
|
594
1057
|
if (size === "sm") return "10px 12px";
|
|
@@ -615,7 +1078,7 @@ function Input({
|
|
|
615
1078
|
outline: "none",
|
|
616
1079
|
color: theme.colors.onSurface,
|
|
617
1080
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
618
|
-
boxShadow: error ? `0 0 0 3px ${(0,
|
|
1081
|
+
boxShadow: error ? `0 0 0 3px ${(0, import_smartsell_sales_sdk5.withAlpha)(theme.colors.negative, 0.12)}` : `0 0 0 0 ${focusRing}`,
|
|
619
1082
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
620
1083
|
...style
|
|
621
1084
|
};
|
|
@@ -627,7 +1090,7 @@ function Input({
|
|
|
627
1090
|
}
|
|
628
1091
|
|
|
629
1092
|
// src/components/Select.tsx
|
|
630
|
-
var
|
|
1093
|
+
var import_smartsell_sales_sdk6 = require("smartsell-sales-sdk");
|
|
631
1094
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
632
1095
|
var getPadding2 = (size) => {
|
|
633
1096
|
if (size === "sm") return "10px 12px";
|
|
@@ -655,7 +1118,7 @@ function Select({
|
|
|
655
1118
|
outline: "none",
|
|
656
1119
|
color: theme.colors.onSurface,
|
|
657
1120
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
658
|
-
boxShadow: error ? `0 0 0 3px ${(0,
|
|
1121
|
+
boxShadow: error ? `0 0 0 3px ${(0, import_smartsell_sales_sdk6.withAlpha)(theme.colors.negative, 0.12)}` : `0 0 0 0 ${focusRing}`,
|
|
659
1122
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
660
1123
|
...style
|
|
661
1124
|
};
|
|
@@ -667,7 +1130,7 @@ function Select({
|
|
|
667
1130
|
}
|
|
668
1131
|
|
|
669
1132
|
// src/components/Textarea.tsx
|
|
670
|
-
var
|
|
1133
|
+
var import_smartsell_sales_sdk7 = require("smartsell-sales-sdk");
|
|
671
1134
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
672
1135
|
var getPadding3 = (size) => {
|
|
673
1136
|
if (size === "sm") return "10px 12px";
|
|
@@ -695,7 +1158,7 @@ function Textarea({
|
|
|
695
1158
|
outline: "none",
|
|
696
1159
|
color: theme.colors.onSurface,
|
|
697
1160
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
698
|
-
boxShadow: error ? `0 0 0 3px ${(0,
|
|
1161
|
+
boxShadow: error ? `0 0 0 3px ${(0, import_smartsell_sales_sdk7.withAlpha)(theme.colors.negative, 0.12)}` : `0 0 0 0 ${focusRing}`,
|
|
699
1162
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
700
1163
|
resize: "vertical",
|
|
701
1164
|
...style
|