@sproutsocial/seeds-react-modal 2.1.1 → 2.2.0
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/.turbo/turbo-build.log +16 -16
- package/CHANGELOG.md +30 -0
- package/dist/{ModalAction-BB7qJtQj.d.mts → ModalAction-gIgCE73I.d.mts} +163 -189
- package/dist/{ModalAction-BB7qJtQj.d.ts → ModalAction-gIgCE73I.d.ts} +163 -189
- package/dist/esm/{chunk-ETVICNHP.js → chunk-52SXX6AG.js} +65 -10
- package/dist/esm/chunk-52SXX6AG.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -9
- package/dist/index.js.map +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.d.ts +1 -1
- package/dist/v2/index.js +64 -9
- package/dist/v2/index.js.map +1 -1
- package/package.json +7 -7
- package/src/v2/Modal.tsx +14 -2
- package/src/v2/ModalTypes.ts +191 -201
- package/src/v2/ModalV2.stories.tsx +106 -66
- package/src/v2/components/ModalAction.tsx +4 -0
- package/src/v2/components/ModalBody.tsx +6 -1
- package/src/v2/components/ModalCloseWrapper.tsx +7 -1
- package/src/v2/components/ModalContent.tsx +19 -4
- package/src/v2/components/ModalDescription.tsx +6 -1
- package/src/v2/components/ModalFooter.tsx +1 -1
- package/src/v2/components/ModalHeader.tsx +2 -0
- package/src/v2/components/ModalOverlay.tsx +2 -1
- package/dist/esm/chunk-ETVICNHP.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -441,6 +441,7 @@ var StyledMotionWrapper = (0, import_styled_components2.default)(import_react3.m
|
|
|
441
441
|
top: ${(props) => props.$isMobile ? "auto" : "50%"};
|
|
442
442
|
left: 50%;
|
|
443
443
|
bottom: ${(props) => props.$isMobile ? 0 : "auto"};
|
|
444
|
+
z-index: ${(props) => props.$zIndex ? props.$zIndex + 1 : 7};
|
|
444
445
|
`;
|
|
445
446
|
var StyledContent = import_styled_components2.default.div.withConfig({
|
|
446
447
|
shouldForwardProp: (prop) => !["isDragging", "draggable"].includes(prop)
|
|
@@ -500,6 +501,7 @@ var StaticModalContent = ({
|
|
|
500
501
|
children,
|
|
501
502
|
label,
|
|
502
503
|
dataAttributes,
|
|
504
|
+
zIndex: zIndex2,
|
|
503
505
|
rest
|
|
504
506
|
}) => {
|
|
505
507
|
const isMobile = useIsMobile();
|
|
@@ -508,11 +510,21 @@ var StaticModalContent = ({
|
|
|
508
510
|
StyledMotionWrapper,
|
|
509
511
|
{
|
|
510
512
|
$isMobile: isMobile,
|
|
513
|
+
$zIndex: zIndex2,
|
|
511
514
|
variants: contentVariants,
|
|
512
515
|
initial: "initial",
|
|
513
516
|
animate: "animate",
|
|
514
517
|
exit: "exit",
|
|
515
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
519
|
+
StyledContent,
|
|
520
|
+
{
|
|
521
|
+
"data-slot": "modal-content",
|
|
522
|
+
draggable: false,
|
|
523
|
+
...dataAttributes,
|
|
524
|
+
...rest,
|
|
525
|
+
children
|
|
526
|
+
}
|
|
527
|
+
)
|
|
516
528
|
}
|
|
517
529
|
) }) });
|
|
518
530
|
};
|
|
@@ -520,6 +532,7 @@ var DraggableModalContent = ({
|
|
|
520
532
|
children,
|
|
521
533
|
label,
|
|
522
534
|
dataAttributes,
|
|
535
|
+
zIndex: zIndex2,
|
|
523
536
|
rest
|
|
524
537
|
}) => {
|
|
525
538
|
const [position, setPosition] = React4.useState({ x: 0, y: 0 });
|
|
@@ -594,6 +607,7 @@ var DraggableModalContent = ({
|
|
|
594
607
|
StyledMotionWrapper,
|
|
595
608
|
{
|
|
596
609
|
$isMobile: isMobile,
|
|
610
|
+
$zIndex: zIndex2,
|
|
597
611
|
variants: contentVariants,
|
|
598
612
|
initial: "initial",
|
|
599
613
|
animate: "animate",
|
|
@@ -608,6 +622,7 @@ var DraggableModalContent = ({
|
|
|
608
622
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
609
623
|
StyledContent,
|
|
610
624
|
{
|
|
625
|
+
"data-slot": "modal-content",
|
|
611
626
|
ref: contentRef,
|
|
612
627
|
draggable: true,
|
|
613
628
|
isDragging,
|
|
@@ -659,6 +674,8 @@ var ModalHeader2 = (props) => {
|
|
|
659
674
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
660
675
|
ModalCustomHeader,
|
|
661
676
|
{
|
|
677
|
+
"data-slot": "modal-header",
|
|
678
|
+
"data-qa-modal-header": true,
|
|
662
679
|
...rest,
|
|
663
680
|
onMouseDown: isDraggable ? dragContext?.onHeaderMouseDown : void 0,
|
|
664
681
|
draggable: isDraggable,
|
|
@@ -679,7 +696,7 @@ var import_seeds_react_box4 = __toESM(require("@sproutsocial/seeds-react-box"));
|
|
|
679
696
|
var import_seeds_react_system_props4 = require("@sproutsocial/seeds-react-system-props");
|
|
680
697
|
|
|
681
698
|
// src/v2/components/ModalCloseWrapper.tsx
|
|
682
|
-
var React6 = require("react");
|
|
699
|
+
var React6 = __toESM(require("react"));
|
|
683
700
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
684
701
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
685
702
|
var ModalCloseWrapper = (props) => {
|
|
@@ -687,7 +704,11 @@ var ModalCloseWrapper = (props) => {
|
|
|
687
704
|
const handleClick = (e) => {
|
|
688
705
|
onClick?.(e);
|
|
689
706
|
};
|
|
690
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children
|
|
707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children: React6.isValidElement(children) ? React6.cloneElement(children, {
|
|
708
|
+
"data-slot": "modal-close-wrapper",
|
|
709
|
+
"data-qa-modal-close-wrapper": "",
|
|
710
|
+
...children.props || {}
|
|
711
|
+
}) : children });
|
|
691
712
|
};
|
|
692
713
|
ModalCloseWrapper.displayName = "ModalCloseWrapper";
|
|
693
714
|
|
|
@@ -722,7 +743,7 @@ var ModalFooter2 = (props) => {
|
|
|
722
743
|
if (!cancelButton && !primaryButton && !leftAction) {
|
|
723
744
|
return null;
|
|
724
745
|
}
|
|
725
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ModalCustomFooter, { ...rest, children: [
|
|
746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ModalCustomFooter, { "data-slot": "modal-footer", "data-qa-modal-footer": true, ...rest, children: [
|
|
726
747
|
leftAction ? leftAction : null,
|
|
727
748
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_seeds_react_box4.default, { display: "flex", gap: 300, marginLeft: "auto", children: [
|
|
728
749
|
cancelButton && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalCloseWrapper, { children: cancelButton }),
|
|
@@ -757,7 +778,16 @@ var StyledModalBody = (0, import_styled_components5.default)(import_seeds_react_
|
|
|
757
778
|
StyledModalBody.displayName = "ModalBody";
|
|
758
779
|
var ModalBody = React8.forwardRef(
|
|
759
780
|
({ children, ...rest }, ref) => {
|
|
760
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
782
|
+
StyledModalBody,
|
|
783
|
+
{
|
|
784
|
+
"data-slot": "modal-body",
|
|
785
|
+
"data-qa-modal-body": true,
|
|
786
|
+
ref,
|
|
787
|
+
...rest,
|
|
788
|
+
children
|
|
789
|
+
}
|
|
790
|
+
);
|
|
761
791
|
}
|
|
762
792
|
);
|
|
763
793
|
ModalBody.displayName = "ModalBody";
|
|
@@ -768,7 +798,16 @@ var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
|
768
798
|
var import_seeds_react_box6 = __toESM(require("@sproutsocial/seeds-react-box"));
|
|
769
799
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
770
800
|
var ModalDescription = React9.forwardRef(({ children, descriptionProps = {}, ...rest }, ref) => {
|
|
771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
802
|
+
import_seeds_react_box6.default,
|
|
803
|
+
{
|
|
804
|
+
"data-slot": "modal-description",
|
|
805
|
+
"data-qa-modal-description": true,
|
|
806
|
+
ref,
|
|
807
|
+
...rest,
|
|
808
|
+
children
|
|
809
|
+
}
|
|
810
|
+
) });
|
|
772
811
|
});
|
|
773
812
|
ModalDescription.displayName = "ModalDescription";
|
|
774
813
|
|
|
@@ -1440,6 +1479,9 @@ var ModalAction = ({
|
|
|
1440
1479
|
const button = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1441
1480
|
RailButton,
|
|
1442
1481
|
{
|
|
1482
|
+
"data-slot": "modal-action",
|
|
1483
|
+
"data-qa-modal-action": true,
|
|
1484
|
+
"data-qa-modal-action-type": actionType || "button",
|
|
1443
1485
|
"aria-label": ariaLabel,
|
|
1444
1486
|
title: ariaLabel,
|
|
1445
1487
|
disabled: disabled2,
|
|
@@ -1466,6 +1508,7 @@ var StyledMotionOverlay = (0, import_styled_components9.default)(import_react5.m
|
|
|
1466
1508
|
left: 0px;
|
|
1467
1509
|
right: 0px;
|
|
1468
1510
|
bottom: 0px;
|
|
1511
|
+
z-index: ${(props) => props.$zIndex ?? 6};
|
|
1469
1512
|
`;
|
|
1470
1513
|
var StyledOverlay = import_styled_components9.default.div.withConfig({
|
|
1471
1514
|
shouldForwardProp: (prop) => !["allowInteraction"].includes(prop)
|
|
@@ -1504,6 +1547,8 @@ var Modal2 = (props) => {
|
|
|
1504
1547
|
showOverlay = true,
|
|
1505
1548
|
actions,
|
|
1506
1549
|
closeButtonAriaLabel = "Close",
|
|
1550
|
+
closeButtonProps,
|
|
1551
|
+
zIndex: zIndex2 = 6,
|
|
1507
1552
|
...rest
|
|
1508
1553
|
} = props;
|
|
1509
1554
|
const [isOpen, setIsOpen] = React13.useState(defaultOpen ?? false);
|
|
@@ -1542,11 +1587,19 @@ var Modal2 = (props) => {
|
|
|
1542
1587
|
showOverlay && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog6.Overlay, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1543
1588
|
StyledMotionOverlay,
|
|
1544
1589
|
{
|
|
1590
|
+
$zIndex: zIndex2,
|
|
1545
1591
|
variants: overlayVariants,
|
|
1546
1592
|
initial: "initial",
|
|
1547
1593
|
animate: "animate",
|
|
1548
1594
|
exit: "exit",
|
|
1549
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1596
|
+
StyledOverlay,
|
|
1597
|
+
{
|
|
1598
|
+
"data-slot": "modal-overlay",
|
|
1599
|
+
"data-qa-modal-overlay": true,
|
|
1600
|
+
allowInteraction: draggable
|
|
1601
|
+
}
|
|
1602
|
+
)
|
|
1550
1603
|
}
|
|
1551
1604
|
) }),
|
|
1552
1605
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
@@ -1555,6 +1608,7 @@ var Modal2 = (props) => {
|
|
|
1555
1608
|
label,
|
|
1556
1609
|
dataAttributes,
|
|
1557
1610
|
draggable,
|
|
1611
|
+
zIndex: zIndex2,
|
|
1558
1612
|
rest,
|
|
1559
1613
|
children: [
|
|
1560
1614
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(ModalRail, { children: [
|
|
@@ -1562,8 +1616,9 @@ var Modal2 = (props) => {
|
|
|
1562
1616
|
ModalAction,
|
|
1563
1617
|
{
|
|
1564
1618
|
actionType: "close",
|
|
1565
|
-
"
|
|
1566
|
-
|
|
1619
|
+
iconName: "x-outline",
|
|
1620
|
+
...closeButtonProps,
|
|
1621
|
+
"aria-label": closeButtonProps?.["aria-label"] ?? closeButtonAriaLabel
|
|
1567
1622
|
}
|
|
1568
1623
|
),
|
|
1569
1624
|
actions?.map((action, idx) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalAction, { ...action }, idx))
|