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
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
|
},
|
|
@@ -332,7 +455,8 @@ function Modal({
|
|
|
332
455
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
333
456
|
"div",
|
|
334
457
|
{
|
|
335
|
-
"aria-
|
|
458
|
+
"aria-label": headerContent ? typeof title === "string" ? title : "Dialog" : void 0,
|
|
459
|
+
"aria-labelledby": headerContent ? void 0 : title ? titleId : void 0,
|
|
336
460
|
"aria-modal": "true",
|
|
337
461
|
role: "dialog",
|
|
338
462
|
onMouseDown: (event) => {
|
|
@@ -348,7 +472,7 @@ function Modal({
|
|
|
348
472
|
alignItems: "center",
|
|
349
473
|
justifyContent: "center",
|
|
350
474
|
padding: 16,
|
|
351
|
-
backgroundColor: overlay,
|
|
475
|
+
backgroundColor: modalTheme.overlay,
|
|
352
476
|
backdropFilter: "blur(8px)"
|
|
353
477
|
},
|
|
354
478
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -358,10 +482,10 @@ function Modal({
|
|
|
358
482
|
width: "min(100%, 100%)",
|
|
359
483
|
maxWidth: normalizeWidth(maxWidth),
|
|
360
484
|
borderRadius: 30,
|
|
361
|
-
border: `1px solid ${borderSoft}`,
|
|
362
|
-
background: `linear-gradient(180deg, ${surfaceRaised}, ${
|
|
363
|
-
boxShadow: `0 34px 80px ${(
|
|
364
|
-
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,
|
|
365
489
|
overflow: "hidden",
|
|
366
490
|
...contentStyle
|
|
367
491
|
},
|
|
@@ -388,9 +512,9 @@ function Modal({
|
|
|
388
512
|
height: 42,
|
|
389
513
|
width: 42,
|
|
390
514
|
borderRadius: 999,
|
|
391
|
-
border: `1px solid ${borderSoft}`,
|
|
515
|
+
border: `1px solid ${modalTheme.borderSoft}`,
|
|
392
516
|
backgroundColor: "transparent",
|
|
393
|
-
color:
|
|
517
|
+
color: modalTheme.colors.onSurface,
|
|
394
518
|
cursor: "pointer",
|
|
395
519
|
fontSize: 20,
|
|
396
520
|
fontWeight: 700
|
|
@@ -410,7 +534,7 @@ function Modal({
|
|
|
410
534
|
justifyContent: "flex-end",
|
|
411
535
|
gap: 12,
|
|
412
536
|
padding: "0 24px 24px",
|
|
413
|
-
borderTop: `1px solid ${(
|
|
537
|
+
borderTop: `1px solid ${withAlpha4(modalTheme.colors.onSurface, 0.06)}`
|
|
414
538
|
},
|
|
415
539
|
children: footer
|
|
416
540
|
}
|
|
@@ -421,6 +545,289 @@ function Modal({
|
|
|
421
545
|
}
|
|
422
546
|
);
|
|
423
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
|
+
}
|
|
424
831
|
|
|
425
832
|
// src/components/ComposableModal.tsx
|
|
426
833
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -449,6 +856,7 @@ function ComposableModal({
|
|
|
449
856
|
footerFallback,
|
|
450
857
|
children
|
|
451
858
|
}) {
|
|
859
|
+
const theme = useUiKitTheme(sdk);
|
|
452
860
|
const slotIds = createModalSlotIds(slotBaseId);
|
|
453
861
|
const context = (0, import_react3.useMemo)(
|
|
454
862
|
() => ({
|
|
@@ -468,19 +876,45 @@ function ComposableModal({
|
|
|
468
876
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { sdk, variant: "outline", tone: "neutral", onClick: onClose, disabled: isBusy, children: cancelLabel }),
|
|
469
877
|
onConfirm ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { sdk, onClick: onConfirm, disabled: isBusy, children: confirmLabel }) : null
|
|
470
878
|
] });
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
|
|
879
|
+
const defaultHeader = headerFallback != null ? headerFallback : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
881
|
+
"h2",
|
|
882
|
+
{
|
|
883
|
+
style: {
|
|
884
|
+
margin: 0,
|
|
885
|
+
fontSize: 30,
|
|
886
|
+
fontWeight: 800,
|
|
887
|
+
lineHeight: 1.1
|
|
888
|
+
},
|
|
889
|
+
children: title
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
893
|
+
"p",
|
|
894
|
+
{
|
|
895
|
+
style: {
|
|
896
|
+
margin: 0,
|
|
897
|
+
fontSize: 15,
|
|
898
|
+
lineHeight: 1.6,
|
|
899
|
+
opacity: 0.78
|
|
900
|
+
},
|
|
901
|
+
children: description
|
|
902
|
+
}
|
|
903
|
+
) : null
|
|
904
|
+
] });
|
|
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 });
|
|
474
908
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
475
909
|
Modal,
|
|
476
910
|
{
|
|
477
|
-
sdk,
|
|
478
911
|
isOpen,
|
|
479
912
|
onClose,
|
|
480
913
|
title,
|
|
481
914
|
description,
|
|
482
915
|
headerContent,
|
|
483
916
|
footer: footerContent,
|
|
917
|
+
theme,
|
|
484
918
|
maxWidth,
|
|
485
919
|
closeOnBackdrop,
|
|
486
920
|
closeOnEscape,
|
|
@@ -561,7 +995,7 @@ function Field({
|
|
|
561
995
|
}
|
|
562
996
|
|
|
563
997
|
// src/components/Input.tsx
|
|
564
|
-
var
|
|
998
|
+
var import_smartsell_sales_sdk5 = require("smartsell-sales-sdk");
|
|
565
999
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
566
1000
|
var getPadding = (size) => {
|
|
567
1001
|
if (size === "sm") return "10px 12px";
|
|
@@ -588,7 +1022,7 @@ function Input({
|
|
|
588
1022
|
outline: "none",
|
|
589
1023
|
color: theme.colors.onSurface,
|
|
590
1024
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
591
|
-
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}`,
|
|
592
1026
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
593
1027
|
...style
|
|
594
1028
|
};
|
|
@@ -600,7 +1034,7 @@ function Input({
|
|
|
600
1034
|
}
|
|
601
1035
|
|
|
602
1036
|
// src/components/Select.tsx
|
|
603
|
-
var
|
|
1037
|
+
var import_smartsell_sales_sdk6 = require("smartsell-sales-sdk");
|
|
604
1038
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
605
1039
|
var getPadding2 = (size) => {
|
|
606
1040
|
if (size === "sm") return "10px 12px";
|
|
@@ -628,7 +1062,7 @@ function Select({
|
|
|
628
1062
|
outline: "none",
|
|
629
1063
|
color: theme.colors.onSurface,
|
|
630
1064
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
631
|
-
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}`,
|
|
632
1066
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
633
1067
|
...style
|
|
634
1068
|
};
|
|
@@ -640,7 +1074,7 @@ function Select({
|
|
|
640
1074
|
}
|
|
641
1075
|
|
|
642
1076
|
// src/components/Textarea.tsx
|
|
643
|
-
var
|
|
1077
|
+
var import_smartsell_sales_sdk7 = require("smartsell-sales-sdk");
|
|
644
1078
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
645
1079
|
var getPadding3 = (size) => {
|
|
646
1080
|
if (size === "sm") return "10px 12px";
|
|
@@ -668,7 +1102,7 @@ function Textarea({
|
|
|
668
1102
|
outline: "none",
|
|
669
1103
|
color: theme.colors.onSurface,
|
|
670
1104
|
backgroundColor: disabled ? surfaceMuted : theme.colors.surface,
|
|
671
|
-
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}`,
|
|
672
1106
|
transition: "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease",
|
|
673
1107
|
resize: "vertical",
|
|
674
1108
|
...style
|