@sproutsocial/seeds-react-modal 2.1.2 → 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.
@@ -1,4 +1,4 @@
1
- export { M as Modal, g as ModalAction, d as ModalBody, e as ModalCloseWrapper, p as ModalCloseWrapperProps, i as ModalCustomFooter, h as ModalCustomHeader, a as ModalDescription, c as ModalFooter, b as ModalHeader, f as ModalRail, o as TypeModalActionProps, l as TypeModalBodyProps, m as TypeModalDescriptionProps, k as TypeModalFooterProps, j as TypeModalHeaderProps, T as TypeModalProps, n as TypeModalRailProps } from '../ModalAction-BB7qJtQj.mjs';
1
+ export { M as Modal, g as ModalAction, d as ModalBody, e as ModalCloseWrapper, p as ModalCloseWrapperProps, i as ModalCustomFooter, h as ModalCustomHeader, a as ModalDescription, c as ModalFooter, b as ModalHeader, f as ModalRail, o as TypeModalActionProps, l as TypeModalBodyProps, m as TypeModalDescriptionProps, k as TypeModalFooterProps, j as TypeModalHeaderProps, T as TypeModalProps, n as TypeModalRailProps } from '../ModalAction-gIgCE73I.mjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'styled-components';
4
4
  import '@sproutsocial/seeds-react-box';
@@ -1,4 +1,4 @@
1
- export { M as Modal, g as ModalAction, d as ModalBody, e as ModalCloseWrapper, p as ModalCloseWrapperProps, i as ModalCustomFooter, h as ModalCustomHeader, a as ModalDescription, c as ModalFooter, b as ModalHeader, f as ModalRail, o as TypeModalActionProps, l as TypeModalBodyProps, m as TypeModalDescriptionProps, k as TypeModalFooterProps, j as TypeModalHeaderProps, T as TypeModalProps, n as TypeModalRailProps } from '../ModalAction-BB7qJtQj.js';
1
+ export { M as Modal, g as ModalAction, d as ModalBody, e as ModalCloseWrapper, p as ModalCloseWrapperProps, i as ModalCustomFooter, h as ModalCustomHeader, a as ModalDescription, c as ModalFooter, b as ModalHeader, f as ModalRail, o as TypeModalActionProps, l as TypeModalBodyProps, m as TypeModalDescriptionProps, k as TypeModalFooterProps, j as TypeModalHeaderProps, T as TypeModalProps, n as TypeModalRailProps } from '../ModalAction-gIgCE73I.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'styled-components';
4
4
  import '@sproutsocial/seeds-react-box';
package/dist/v2/index.js CHANGED
@@ -218,6 +218,7 @@ var StyledMotionWrapper = (0, import_styled_components.default)(import_react.mot
218
218
  top: ${(props) => props.$isMobile ? "auto" : "50%"};
219
219
  left: 50%;
220
220
  bottom: ${(props) => props.$isMobile ? 0 : "auto"};
221
+ z-index: ${(props) => props.$zIndex ? props.$zIndex + 1 : 7};
221
222
  `;
222
223
  var StyledContent = import_styled_components.default.div.withConfig({
223
224
  shouldForwardProp: (prop) => !["isDragging", "draggable"].includes(prop)
@@ -277,6 +278,7 @@ var StaticModalContent = ({
277
278
  children,
278
279
  label,
279
280
  dataAttributes,
281
+ zIndex,
280
282
  rest
281
283
  }) => {
282
284
  const isMobile = useIsMobile();
@@ -285,11 +287,21 @@ var StaticModalContent = ({
285
287
  StyledMotionWrapper,
286
288
  {
287
289
  $isMobile: isMobile,
290
+ $zIndex: zIndex,
288
291
  variants: contentVariants,
289
292
  initial: "initial",
290
293
  animate: "animate",
291
294
  exit: "exit",
292
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledContent, { draggable: false, ...dataAttributes, ...rest, children })
295
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
296
+ StyledContent,
297
+ {
298
+ "data-slot": "modal-content",
299
+ draggable: false,
300
+ ...dataAttributes,
301
+ ...rest,
302
+ children
303
+ }
304
+ )
293
305
  }
294
306
  ) }) });
295
307
  };
@@ -297,6 +309,7 @@ var DraggableModalContent = ({
297
309
  children,
298
310
  label,
299
311
  dataAttributes,
312
+ zIndex,
300
313
  rest
301
314
  }) => {
302
315
  const [position, setPosition] = React2.useState({ x: 0, y: 0 });
@@ -371,6 +384,7 @@ var DraggableModalContent = ({
371
384
  StyledMotionWrapper,
372
385
  {
373
386
  $isMobile: isMobile,
387
+ $zIndex: zIndex,
374
388
  variants: contentVariants,
375
389
  initial: "initial",
376
390
  animate: "animate",
@@ -385,6 +399,7 @@ var DraggableModalContent = ({
385
399
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
386
400
  StyledContent,
387
401
  {
402
+ "data-slot": "modal-content",
388
403
  ref: contentRef,
389
404
  draggable: true,
390
405
  isDragging,
@@ -436,6 +451,8 @@ var ModalHeader = (props) => {
436
451
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
437
452
  ModalCustomHeader,
438
453
  {
454
+ "data-slot": "modal-header",
455
+ "data-qa-modal-header": true,
439
456
  ...rest,
440
457
  onMouseDown: isDraggable ? dragContext?.onHeaderMouseDown : void 0,
441
458
  draggable: isDraggable,
@@ -456,7 +473,7 @@ var import_seeds_react_box2 = __toESM(require("@sproutsocial/seeds-react-box"));
456
473
  var import_seeds_react_system_props3 = require("@sproutsocial/seeds-react-system-props");
457
474
 
458
475
  // src/v2/components/ModalCloseWrapper.tsx
459
- var React4 = require("react");
476
+ var React4 = __toESM(require("react"));
460
477
  var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
461
478
  var import_jsx_runtime3 = require("react/jsx-runtime");
462
479
  var ModalCloseWrapper = (props) => {
@@ -464,7 +481,11 @@ var ModalCloseWrapper = (props) => {
464
481
  const handleClick = (e) => {
465
482
  onClick?.(e);
466
483
  };
467
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children });
484
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children: React4.isValidElement(children) ? React4.cloneElement(children, {
485
+ "data-slot": "modal-close-wrapper",
486
+ "data-qa-modal-close-wrapper": "",
487
+ ...children.props || {}
488
+ }) : children });
468
489
  };
469
490
  ModalCloseWrapper.displayName = "ModalCloseWrapper";
470
491
 
@@ -499,7 +520,7 @@ var ModalFooter = (props) => {
499
520
  if (!cancelButton && !primaryButton && !leftAction) {
500
521
  return null;
501
522
  }
502
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(ModalCustomFooter, { ...rest, children: [
523
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(ModalCustomFooter, { "data-slot": "modal-footer", "data-qa-modal-footer": true, ...rest, children: [
503
524
  leftAction ? leftAction : null,
504
525
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_seeds_react_box2.default, { display: "flex", gap: 300, marginLeft: "auto", children: [
505
526
  cancelButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ModalCloseWrapper, { children: cancelButton }),
@@ -534,7 +555,16 @@ var StyledModalBody = (0, import_styled_components4.default)(import_seeds_react_
534
555
  StyledModalBody.displayName = "ModalBody";
535
556
  var ModalBody = React6.forwardRef(
536
557
  ({ children, ...rest }, ref) => {
537
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledModalBody, { "data-qa-modal-body": true, ref, ...rest, children });
558
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
559
+ StyledModalBody,
560
+ {
561
+ "data-slot": "modal-body",
562
+ "data-qa-modal-body": true,
563
+ ref,
564
+ ...rest,
565
+ children
566
+ }
567
+ );
538
568
  }
539
569
  );
540
570
  ModalBody.displayName = "ModalBody";
@@ -545,7 +575,16 @@ var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
545
575
  var import_seeds_react_box4 = __toESM(require("@sproutsocial/seeds-react-box"));
546
576
  var import_jsx_runtime6 = require("react/jsx-runtime");
547
577
  var ModalDescription = React7.forwardRef(({ children, descriptionProps = {}, ...rest }, ref) => {
548
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_seeds_react_box4.default, { ref, ...rest, children }) });
578
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
579
+ import_seeds_react_box4.default,
580
+ {
581
+ "data-slot": "modal-description",
582
+ "data-qa-modal-description": true,
583
+ ref,
584
+ ...rest,
585
+ children
586
+ }
587
+ ) });
549
588
  });
550
589
  ModalDescription.displayName = "ModalDescription";
551
590
 
@@ -1217,6 +1256,9 @@ var ModalAction = ({
1217
1256
  const button = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1218
1257
  RailButton,
1219
1258
  {
1259
+ "data-slot": "modal-action",
1260
+ "data-qa-modal-action": true,
1261
+ "data-qa-modal-action-type": actionType || "button",
1220
1262
  "aria-label": ariaLabel,
1221
1263
  title: ariaLabel,
1222
1264
  disabled: disabled2,
@@ -1243,6 +1285,7 @@ var StyledMotionOverlay = (0, import_styled_components8.default)(import_react3.m
1243
1285
  left: 0px;
1244
1286
  right: 0px;
1245
1287
  bottom: 0px;
1288
+ z-index: ${(props) => props.$zIndex ?? 6};
1246
1289
  `;
1247
1290
  var StyledOverlay = import_styled_components8.default.div.withConfig({
1248
1291
  shouldForwardProp: (prop) => !["allowInteraction"].includes(prop)
@@ -1281,6 +1324,8 @@ var Modal = (props) => {
1281
1324
  showOverlay = true,
1282
1325
  actions,
1283
1326
  closeButtonAriaLabel = "Close",
1327
+ closeButtonProps,
1328
+ zIndex = 6,
1284
1329
  ...rest
1285
1330
  } = props;
1286
1331
  const [isOpen, setIsOpen] = React11.useState(defaultOpen ?? false);
@@ -1319,11 +1364,19 @@ var Modal = (props) => {
1319
1364
  showOverlay && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog6.Overlay, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1320
1365
  StyledMotionOverlay,
1321
1366
  {
1367
+ $zIndex: zIndex,
1322
1368
  variants: overlayVariants,
1323
1369
  initial: "initial",
1324
1370
  animate: "animate",
1325
1371
  exit: "exit",
1326
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StyledOverlay, { allowInteraction: draggable })
1372
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1373
+ StyledOverlay,
1374
+ {
1375
+ "data-slot": "modal-overlay",
1376
+ "data-qa-modal-overlay": true,
1377
+ allowInteraction: draggable
1378
+ }
1379
+ )
1327
1380
  }
1328
1381
  ) }),
1329
1382
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
@@ -1332,6 +1385,7 @@ var Modal = (props) => {
1332
1385
  label,
1333
1386
  dataAttributes,
1334
1387
  draggable,
1388
+ zIndex,
1335
1389
  rest,
1336
1390
  children: [
1337
1391
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalRail, { children: [
@@ -1339,8 +1393,9 @@ var Modal = (props) => {
1339
1393
  ModalAction,
1340
1394
  {
1341
1395
  actionType: "close",
1342
- "aria-label": closeButtonAriaLabel,
1343
- iconName: "x-outline"
1396
+ iconName: "x-outline",
1397
+ ...closeButtonProps,
1398
+ "aria-label": closeButtonProps?.["aria-label"] ?? closeButtonAriaLabel
1344
1399
  }
1345
1400
  ),
1346
1401
  actions?.map((action, idx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModalAction, { ...action }, idx))