smartsell-ui-kit 0.0.2 → 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 +433 -26
- 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 +41 -210
- 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
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,9 +396,10 @@ function Modal({
|
|
|
274
396
|
closeOnBackdrop = true,
|
|
275
397
|
closeOnEscape = true,
|
|
276
398
|
hideCloseButton = false,
|
|
277
|
-
contentStyle
|
|
399
|
+
contentStyle,
|
|
400
|
+
theme
|
|
278
401
|
}) {
|
|
279
|
-
const
|
|
402
|
+
const modalTheme = (0, import_react2.useMemo)(() => resolveTheme(theme), [theme]);
|
|
280
403
|
const titleId = (0, import_react2.useMemo)(
|
|
281
404
|
() => `smartsell-modal-${String(title != null ? title : "dialog").toLowerCase().replace(/[^a-z0-9]+/g, "-")}`,
|
|
282
405
|
[title]
|
|
@@ -308,7 +431,7 @@ function Modal({
|
|
|
308
431
|
id: titleId,
|
|
309
432
|
style: {
|
|
310
433
|
margin: 0,
|
|
311
|
-
color:
|
|
434
|
+
color: modalTheme.colors.onSurface,
|
|
312
435
|
fontSize: 30,
|
|
313
436
|
fontWeight: 800,
|
|
314
437
|
lineHeight: 1.1
|
|
@@ -321,7 +444,7 @@ function Modal({
|
|
|
321
444
|
{
|
|
322
445
|
style: {
|
|
323
446
|
margin: 0,
|
|
324
|
-
color: mutedText,
|
|
447
|
+
color: modalTheme.mutedText,
|
|
325
448
|
fontSize: 15,
|
|
326
449
|
lineHeight: 1.6
|
|
327
450
|
},
|
|
@@ -349,7 +472,7 @@ function Modal({
|
|
|
349
472
|
alignItems: "center",
|
|
350
473
|
justifyContent: "center",
|
|
351
474
|
padding: 16,
|
|
352
|
-
backgroundColor: overlay,
|
|
475
|
+
backgroundColor: modalTheme.overlay,
|
|
353
476
|
backdropFilter: "blur(8px)"
|
|
354
477
|
},
|
|
355
478
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -359,10 +482,10 @@ function Modal({
|
|
|
359
482
|
width: "min(100%, 100%)",
|
|
360
483
|
maxWidth: normalizeWidth(maxWidth),
|
|
361
484
|
borderRadius: 30,
|
|
362
|
-
border: `1px solid ${borderSoft}`,
|
|
363
|
-
background: `linear-gradient(180deg, ${surfaceRaised}, ${
|
|
364
|
-
boxShadow: `0 34px 80px ${(
|
|
365
|
-
color:
|
|
485
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
486
|
+
background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,
|
|
487
|
+
boxShadow: `0 34px 80px ${withAlpha4("#020617", 0.28)}`,
|
|
488
|
+
color: modalTheme.colors.onSurface,
|
|
366
489
|
overflow: "hidden",
|
|
367
490
|
...contentStyle
|
|
368
491
|
},
|
|
@@ -389,9 +512,9 @@ function Modal({
|
|
|
389
512
|
height: 42,
|
|
390
513
|
width: 42,
|
|
391
514
|
borderRadius: 999,
|
|
392
|
-
border: `1px solid ${borderSoft}`,
|
|
515
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
393
516
|
backgroundColor: "transparent",
|
|
394
|
-
color:
|
|
517
|
+
color: modalTheme.colors.onSurface,
|
|
395
518
|
cursor: "pointer",
|
|
396
519
|
fontSize: 20,
|
|
397
520
|
fontWeight: 700
|
|
@@ -411,7 +534,7 @@ function Modal({
|
|
|
411
534
|
justifyContent: "flex-end",
|
|
412
535
|
gap: 12,
|
|
413
536
|
padding: "0 24px 24px",
|
|
414
|
-
borderTop: `1px solid ${(
|
|
537
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onSurface, 0.06)}`
|
|
415
538
|
},
|
|
416
539
|
children: footer
|
|
417
540
|
}
|
|
@@ -422,6 +545,289 @@ function Modal({
|
|
|
422
545
|
}
|
|
423
546
|
);
|
|
424
547
|
}
|
|
548
|
+
function LegacyModal({
|
|
549
|
+
title,
|
|
550
|
+
showModal,
|
|
551
|
+
closeModal,
|
|
552
|
+
children,
|
|
553
|
+
action,
|
|
554
|
+
actionNameBtn,
|
|
555
|
+
hideActionButton = false,
|
|
556
|
+
cancelButton,
|
|
557
|
+
disableActionBtn = false,
|
|
558
|
+
isLoading = false,
|
|
559
|
+
onlyCloseButton = false,
|
|
560
|
+
hideCloseIcon = false,
|
|
561
|
+
style,
|
|
562
|
+
bodyStyle,
|
|
563
|
+
additionalActions,
|
|
564
|
+
maximized,
|
|
565
|
+
theme
|
|
566
|
+
}) {
|
|
567
|
+
const modalTheme = (0, import_react2.useMemo)(() => resolveTheme(theme), [theme]);
|
|
568
|
+
const [isMaximized, setIsMaximized] = (0, import_react2.useState)(maximized != null ? maximized : false);
|
|
569
|
+
const resolvedAction = action != null ? action : (() => null);
|
|
570
|
+
(0, import_react2.useEffect)(() => {
|
|
571
|
+
if (maximized === void 0 && isLikelyMobileViewport()) {
|
|
572
|
+
setIsMaximized(true);
|
|
573
|
+
}
|
|
574
|
+
}, [maximized]);
|
|
575
|
+
if (!showModal) {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
const actionButtons = () => {
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
580
|
+
additionalActions == null ? void 0 : additionalActions.map((item) => {
|
|
581
|
+
var _a, _b, _c;
|
|
582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
583
|
+
LegacyActionButton,
|
|
584
|
+
{
|
|
585
|
+
label: item.name,
|
|
586
|
+
onClick: item.onClick,
|
|
587
|
+
type: (_a = item.type) != null ? _a : "contained",
|
|
588
|
+
style: (_b = item.style) != null ? _b : { maxWidth: "150px" },
|
|
589
|
+
theme: modalTheme,
|
|
590
|
+
disabled: (_c = item.disable) != null ? _c : disableActionBtn || isLoading
|
|
591
|
+
},
|
|
592
|
+
item.name
|
|
593
|
+
);
|
|
594
|
+
}),
|
|
595
|
+
!hideActionButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
596
|
+
LegacyActionButton,
|
|
597
|
+
{
|
|
598
|
+
label: actionNameBtn != null ? actionNameBtn : "Save",
|
|
599
|
+
onClick: resolvedAction,
|
|
600
|
+
type: "contained",
|
|
601
|
+
style: { maxWidth: "100px" },
|
|
602
|
+
theme: modalTheme,
|
|
603
|
+
disabled: disableActionBtn || isLoading
|
|
604
|
+
}
|
|
605
|
+
) : null
|
|
606
|
+
] });
|
|
607
|
+
};
|
|
608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
609
|
+
"div",
|
|
610
|
+
{
|
|
611
|
+
"aria-labelledby": "modal-title",
|
|
612
|
+
"aria-modal": "true",
|
|
613
|
+
role: "dialog",
|
|
614
|
+
style: {
|
|
615
|
+
background: `${modalTheme.colors.background}90`,
|
|
616
|
+
backdropFilter: "blur(2px)",
|
|
617
|
+
width: "100%",
|
|
618
|
+
height: "100%",
|
|
619
|
+
position: "fixed",
|
|
620
|
+
zIndex: 999,
|
|
621
|
+
top: 0,
|
|
622
|
+
left: 0,
|
|
623
|
+
display: "flex",
|
|
624
|
+
justifyContent: "center",
|
|
625
|
+
alignItems: "center",
|
|
626
|
+
boxSizing: "border-box"
|
|
627
|
+
},
|
|
628
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
629
|
+
"div",
|
|
630
|
+
{
|
|
631
|
+
id: isLoading ? "ldg1" : void 0,
|
|
632
|
+
style: {
|
|
633
|
+
position: isMaximized ? "fixed" : "relative",
|
|
634
|
+
left: isMaximized ? 0 : void 0,
|
|
635
|
+
top: isMaximized ? 0 : void 0,
|
|
636
|
+
background: modalTheme.colors.background,
|
|
637
|
+
display: "flex",
|
|
638
|
+
alignItems: "center",
|
|
639
|
+
flexDirection: "column",
|
|
640
|
+
borderRadius: "0.8rem",
|
|
641
|
+
boxSizing: "border-box",
|
|
642
|
+
maxHeight: isMaximized ? "100vh" : "80vh",
|
|
643
|
+
maxWidth: isMaximized ? "100vw" : "80vw",
|
|
644
|
+
minWidth: isMaximized ? "100vw" : 300,
|
|
645
|
+
minHeight: isMaximized ? "100vh" : void 0,
|
|
646
|
+
width: isMaximized ? "100vw" : void 0,
|
|
647
|
+
boxShadow: "0 24px 64px rgba(15, 23, 42, 0.18)",
|
|
648
|
+
...isLoading ? { opacity: 0.5 } : null,
|
|
649
|
+
...style
|
|
650
|
+
},
|
|
651
|
+
children: [
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
653
|
+
"div",
|
|
654
|
+
{
|
|
655
|
+
style: {
|
|
656
|
+
background: modalTheme.colors.surface,
|
|
657
|
+
color: modalTheme.colors.onSurface,
|
|
658
|
+
position: "absolute",
|
|
659
|
+
top: 0,
|
|
660
|
+
zIndex: 500,
|
|
661
|
+
display: "flex",
|
|
662
|
+
justifyContent: "space-between",
|
|
663
|
+
alignItems: "center",
|
|
664
|
+
width: "100%",
|
|
665
|
+
height: "4rem",
|
|
666
|
+
padding: "1rem",
|
|
667
|
+
boxSizing: "border-box",
|
|
668
|
+
borderTopLeftRadius: "0.8rem",
|
|
669
|
+
borderTopRightRadius: "0.8rem",
|
|
670
|
+
borderBottom: `1px solid ${withAlpha4(modalTheme.colors.onBackground, 0.1)}`
|
|
671
|
+
},
|
|
672
|
+
children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { id: "modal-title", style: { fontWeight: "bold", fontSize: "1.3rem" }, children: title }),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
675
|
+
"div",
|
|
676
|
+
{
|
|
677
|
+
id: "modal-header-icons",
|
|
678
|
+
style: { display: "flex", alignItems: "center", gap: "0.5rem" },
|
|
679
|
+
children: [
|
|
680
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
681
|
+
"button",
|
|
682
|
+
{
|
|
683
|
+
"aria-label": isMaximized ? "Minimize modal" : "Maximize modal",
|
|
684
|
+
title: isMaximized ? "Minimize" : "Maximize",
|
|
685
|
+
type: "button",
|
|
686
|
+
onClick: () => setIsMaximized((current) => !current),
|
|
687
|
+
style: {
|
|
688
|
+
border: "none",
|
|
689
|
+
background: "transparent",
|
|
690
|
+
color: modalTheme.colors.onSurface,
|
|
691
|
+
cursor: "pointer",
|
|
692
|
+
fontSize: 18,
|
|
693
|
+
lineHeight: 1,
|
|
694
|
+
padding: 0
|
|
695
|
+
},
|
|
696
|
+
children: isMaximized ? "\u25A2" : "\u25A1"
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
!hideCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
700
|
+
"button",
|
|
701
|
+
{
|
|
702
|
+
"aria-label": "Close modal",
|
|
703
|
+
title: "Close",
|
|
704
|
+
type: "button",
|
|
705
|
+
onClick: isLoading ? void 0 : closeModal,
|
|
706
|
+
style: {
|
|
707
|
+
border: "none",
|
|
708
|
+
background: "transparent",
|
|
709
|
+
color: modalTheme.colors.onSurface,
|
|
710
|
+
cursor: isLoading ? "not-allowed" : "pointer",
|
|
711
|
+
fontSize: 22,
|
|
712
|
+
lineHeight: 1,
|
|
713
|
+
padding: 0,
|
|
714
|
+
opacity: isLoading ? 0.5 : 1
|
|
715
|
+
},
|
|
716
|
+
children: "\xD7"
|
|
717
|
+
}
|
|
718
|
+
) : null
|
|
719
|
+
]
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
]
|
|
723
|
+
}
|
|
724
|
+
),
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
726
|
+
"div",
|
|
727
|
+
{
|
|
728
|
+
style: {
|
|
729
|
+
scrollbarWidth: "thin",
|
|
730
|
+
width: "100%",
|
|
731
|
+
maxWidth: "100%",
|
|
732
|
+
paddingTop: "4rem",
|
|
733
|
+
paddingBottom: "4rem",
|
|
734
|
+
overflow: "auto",
|
|
735
|
+
...bodyStyle
|
|
736
|
+
},
|
|
737
|
+
children
|
|
738
|
+
}
|
|
739
|
+
),
|
|
740
|
+
onlyCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
741
|
+
"div",
|
|
742
|
+
{
|
|
743
|
+
style: {
|
|
744
|
+
background: modalTheme.colors.surface,
|
|
745
|
+
color: modalTheme.colors.onSurface,
|
|
746
|
+
position: "absolute",
|
|
747
|
+
bottom: 0,
|
|
748
|
+
width: "100%",
|
|
749
|
+
height: "4rem",
|
|
750
|
+
padding: "0.5rem",
|
|
751
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onBackground, 0.1)}`,
|
|
752
|
+
boxSizing: "border-box",
|
|
753
|
+
borderBottomLeftRadius: "0.8rem",
|
|
754
|
+
borderBottomRightRadius: "0.8rem"
|
|
755
|
+
},
|
|
756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
757
|
+
"div",
|
|
758
|
+
{
|
|
759
|
+
className: "buttons-footer",
|
|
760
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
762
|
+
LegacyActionButton,
|
|
763
|
+
{
|
|
764
|
+
label: "Close",
|
|
765
|
+
onClick: closeModal,
|
|
766
|
+
theme: modalTheme,
|
|
767
|
+
disabled: isLoading
|
|
768
|
+
}
|
|
769
|
+
)
|
|
770
|
+
}
|
|
771
|
+
)
|
|
772
|
+
}
|
|
773
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
774
|
+
"div",
|
|
775
|
+
{
|
|
776
|
+
style: {
|
|
777
|
+
background: modalTheme.colors.surface,
|
|
778
|
+
color: modalTheme.colors.onSurface,
|
|
779
|
+
position: "absolute",
|
|
780
|
+
bottom: 0,
|
|
781
|
+
width: "100%",
|
|
782
|
+
height: "4rem",
|
|
783
|
+
padding: "0.5rem",
|
|
784
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onBackground, 0.1)}`,
|
|
785
|
+
boxSizing: "border-box",
|
|
786
|
+
borderBottomLeftRadius: "0.8rem",
|
|
787
|
+
borderBottomRightRadius: "0.8rem"
|
|
788
|
+
},
|
|
789
|
+
children: cancelButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
790
|
+
"div",
|
|
791
|
+
{
|
|
792
|
+
className: "buttons-footer",
|
|
793
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
794
|
+
children: [
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
796
|
+
LegacyActionButton,
|
|
797
|
+
{
|
|
798
|
+
label: "Cancel",
|
|
799
|
+
onClick: cancelButton,
|
|
800
|
+
type: "text",
|
|
801
|
+
style: { maxWidth: "100px" },
|
|
802
|
+
theme: modalTheme,
|
|
803
|
+
disabled: false
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
actionButtons()
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
810
|
+
"div",
|
|
811
|
+
{
|
|
812
|
+
className: "buttons-footer",
|
|
813
|
+
style: { flex: 1, display: "flex", justifyContent: "end" },
|
|
814
|
+
children: actionButtons()
|
|
815
|
+
}
|
|
816
|
+
)
|
|
817
|
+
}
|
|
818
|
+
)
|
|
819
|
+
]
|
|
820
|
+
}
|
|
821
|
+
)
|
|
822
|
+
}
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
function Modal(props) {
|
|
826
|
+
if (isLegacyModalProps(props)) {
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LegacyModal, { ...props });
|
|
828
|
+
}
|
|
829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StandardModal, { ...props });
|
|
830
|
+
}
|
|
425
831
|
|
|
426
832
|
// src/components/ComposableModal.tsx
|
|
427
833
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -450,6 +856,7 @@ function ComposableModal({
|
|
|
450
856
|
footerFallback,
|
|
451
857
|
children
|
|
452
858
|
}) {
|
|
859
|
+
const theme = useUiKitTheme(sdk);
|
|
453
860
|
const slotIds = createModalSlotIds(slotBaseId);
|
|
454
861
|
const context = (0, import_react3.useMemo)(
|
|
455
862
|
() => ({
|
|
@@ -495,19 +902,19 @@ function ComposableModal({
|
|
|
495
902
|
}
|
|
496
903
|
) : null
|
|
497
904
|
] });
|
|
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)(
|
|
905
|
+
const headerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_smartsell_sales_sdk4.SlotRenderer, { id: slotIds.header, sdk, context, children: defaultHeader });
|
|
906
|
+
const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_smartsell_sales_sdk4.SlotRenderer, { id: slotIds.body, sdk, context, children });
|
|
907
|
+
const footerContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_smartsell_sales_sdk4.SlotRenderer, { id: slotIds.footer, sdk, context, children: defaultFooter });
|
|
501
908
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
502
909
|
Modal,
|
|
503
910
|
{
|
|
504
|
-
sdk,
|
|
505
911
|
isOpen,
|
|
506
912
|
onClose,
|
|
507
913
|
title,
|
|
508
914
|
description,
|
|
509
915
|
headerContent,
|
|
510
916
|
footer: footerContent,
|
|
917
|
+
theme,
|
|
511
918
|
maxWidth,
|
|
512
919
|
closeOnBackdrop,
|
|
513
920
|
closeOnEscape,
|
|
@@ -588,7 +995,7 @@ function Field({
|
|
|
588
995
|
}
|
|
589
996
|
|
|
590
997
|
// src/components/Input.tsx
|
|
591
|
-
var
|
|
998
|
+
var import_smartsell_sales_sdk5 = require("smartsell-sales-sdk");
|
|
592
999
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
593
1000
|
var getPadding = (size) => {
|
|
594
1001
|
if (size === "sm") return "10px 12px";
|
|
@@ -615,7 +1022,7 @@ function Input({
|
|
|
615
1022
|
outline: "none",
|
|
616
1023
|
color: theme.colors.onSurface,
|
|
617
1024
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
618
|
-
boxShadow: error ? `0 0 0 3px ${(0,
|
|
1025
|
+
boxShadow: error ? `0 0 0 3px ${(0, import_smartsell_sales_sdk5.withAlpha)(theme.colors.negative, 0.12)}` : `0 0 0 0 ${focusRing}`,
|
|
619
1026
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
620
1027
|
...style
|
|
621
1028
|
};
|
|
@@ -627,7 +1034,7 @@ function Input({
|
|
|
627
1034
|
}
|
|
628
1035
|
|
|
629
1036
|
// src/components/Select.tsx
|
|
630
|
-
var
|
|
1037
|
+
var import_smartsell_sales_sdk6 = require("smartsell-sales-sdk");
|
|
631
1038
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
632
1039
|
var getPadding2 = (size) => {
|
|
633
1040
|
if (size === "sm") return "10px 12px";
|
|
@@ -655,7 +1062,7 @@ function Select({
|
|
|
655
1062
|
outline: "none",
|
|
656
1063
|
color: theme.colors.onSurface,
|
|
657
1064
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
658
|
-
boxShadow: error ? `0 0 0 3px ${(0,
|
|
1065
|
+
boxShadow: error ? `0 0 0 3px ${(0, import_smartsell_sales_sdk6.withAlpha)(theme.colors.negative, 0.12)}` : `0 0 0 0 ${focusRing}`,
|
|
659
1066
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
660
1067
|
...style
|
|
661
1068
|
};
|
|
@@ -667,7 +1074,7 @@ function Select({
|
|
|
667
1074
|
}
|
|
668
1075
|
|
|
669
1076
|
// src/components/Textarea.tsx
|
|
670
|
-
var
|
|
1077
|
+
var import_smartsell_sales_sdk7 = require("smartsell-sales-sdk");
|
|
671
1078
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
672
1079
|
var getPadding3 = (size) => {
|
|
673
1080
|
if (size === "sm") return "10px 12px";
|
|
@@ -695,7 +1102,7 @@ function Textarea({
|
|
|
695
1102
|
outline: "none",
|
|
696
1103
|
color: theme.colors.onSurface,
|
|
697
1104
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
698
|
-
boxShadow: error ? `0 0 0 3px ${(0,
|
|
1105
|
+
boxShadow: error ? `0 0 0 3px ${(0, import_smartsell_sales_sdk7.withAlpha)(theme.colors.negative, 0.12)}` : `0 0 0 0 ${focusRing}`,
|
|
699
1106
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
700
1107
|
resize: "vertical",
|
|
701
1108
|
...style
|