@sproutsocial/seeds-react-modal 1.1.0 → 2.0.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.
Files changed (45) hide show
  1. package/.turbo/turbo-build.log +23 -23
  2. package/CHANGELOG.md +182 -0
  3. package/dist/ModalAction-BB7qJtQj.d.mts +445 -0
  4. package/dist/ModalAction-BB7qJtQj.d.ts +445 -0
  5. package/dist/esm/chunk-ETVICNHP.js +1353 -0
  6. package/dist/esm/chunk-ETVICNHP.js.map +1 -0
  7. package/dist/esm/index.js +11 -11
  8. package/dist/esm/index.js.map +1 -1
  9. package/dist/esm/v2/index.js +12 -20
  10. package/dist/index.d.mts +2 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +1154 -546
  13. package/dist/index.js.map +1 -1
  14. package/dist/v2/index.d.mts +4 -11
  15. package/dist/v2/index.d.ts +4 -11
  16. package/dist/v2/index.js +1152 -545
  17. package/dist/v2/index.js.map +1 -1
  18. package/package.json +8 -7
  19. package/src/index.ts +11 -12
  20. package/src/shared/constants.ts +11 -7
  21. package/src/v2/Modal.tsx +169 -0
  22. package/src/v2/ModalTypes.ts +343 -0
  23. package/src/v2/ModalV2.stories.tsx +413 -128
  24. package/src/v2/MotionConfig.ts +185 -0
  25. package/src/v2/components/ModalAction.tsx +94 -0
  26. package/src/v2/components/ModalBody.tsx +54 -0
  27. package/src/v2/components/ModalCloseWrapper.tsx +35 -0
  28. package/src/v2/components/ModalContent.tsx +288 -11
  29. package/src/v2/components/ModalDescription.tsx +14 -2
  30. package/src/v2/components/ModalFooter.tsx +94 -13
  31. package/src/v2/components/ModalHeader.tsx +77 -34
  32. package/src/v2/components/ModalOverlay.tsx +52 -0
  33. package/src/v2/components/ModalRail.tsx +35 -99
  34. package/src/v2/components/index.ts +11 -7
  35. package/src/v2/index.ts +13 -16
  36. package/dist/ModalRail-5PeilhW7.d.mts +0 -186
  37. package/dist/ModalRail-5PeilhW7.d.ts +0 -186
  38. package/dist/esm/chunk-4ITF4DBY.js +0 -717
  39. package/dist/esm/chunk-4ITF4DBY.js.map +0 -1
  40. package/src/v2/ModalV2.tsx +0 -388
  41. package/src/v2/ModalV2Styles.tsx +0 -180
  42. package/src/v2/ModalV2Types.ts +0 -154
  43. package/src/v2/components/ModalClose.tsx +0 -29
  44. package/src/v2/components/ModalCloseButton.tsx +0 -100
  45. package/src/v2/components/ModalTrigger.tsx +0 -39
package/dist/index.js CHANGED
@@ -32,15 +32,15 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  Modal: () => v1_default,
34
34
  ModalAction: () => ModalAction,
35
- ModalClose: () => ModalClose,
36
- ModalCloseButton: () => ModalCloseButton2,
37
- ModalContent: () => ModalContent2,
35
+ ModalBody: () => ModalBody,
36
+ ModalCloseWrapper: () => ModalCloseWrapper,
37
+ ModalCustomFooter: () => ModalCustomFooter,
38
+ ModalCustomHeader: () => ModalCustomHeader,
38
39
  ModalDescription: () => ModalDescription,
39
40
  ModalFooter: () => ModalFooter2,
40
41
  ModalHeader: () => ModalHeader2,
41
42
  ModalRail: () => ModalRail,
42
- ModalTrigger: () => ModalTrigger,
43
- ModalV2: () => ModalV2_default,
43
+ ModalV2: () => Modal_default2,
44
44
  default: () => src_default
45
45
  });
46
46
  module.exports = __toCommonJS(src_exports);
@@ -217,8 +217,8 @@ var Modal = (props) => {
217
217
  label,
218
218
  onClose,
219
219
  closeButtonLabel,
220
- width: width3 = "800px",
221
- zIndex: zIndex3 = 6,
220
+ width: width2 = "800px",
221
+ zIndex: zIndex2 = 6,
222
222
  data = {},
223
223
  ...rest
224
224
  } = props;
@@ -239,8 +239,8 @@ var Modal = (props) => {
239
239
  shouldReturnFocusAfterClose: true,
240
240
  closeTimeoutMS: 200,
241
241
  role: "dialog",
242
- width: width3,
243
- zIndex: zIndex3,
242
+ width: width2,
243
+ zIndex: zIndex2,
244
244
  data: {
245
245
  "qa-modal": "",
246
246
  "qa-modal-isopen": isOpen,
@@ -277,137 +277,358 @@ var Modal_default = Modal;
277
277
  // src/v1/index.ts
278
278
  var v1_default = Modal_default;
279
279
 
280
- // src/v2/ModalV2.tsx
281
- var React12 = __toESM(require("react"));
282
- var Dialog8 = __toESM(require("@radix-ui/react-dialog"));
280
+ // src/v2/Modal.tsx
281
+ var React13 = __toESM(require("react"));
282
+ var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
283
+ var import_react6 = require("motion/react");
283
284
 
284
- // src/v2/ModalV2Styles.tsx
285
- var import_react3 = require("react");
286
- var import_styled_components2 = __toESM(require("styled-components"));
287
- var import_styled_system2 = require("styled-system");
288
- var Dialog = __toESM(require("@radix-ui/react-dialog"));
289
- var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
285
+ // src/v2/components/ModalHeader.tsx
286
+ var React5 = require("react");
287
+ var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
288
+ var import_styled_components3 = __toESM(require("styled-components"));
290
289
  var import_seeds_react_box3 = __toESM(require("@sproutsocial/seeds-react-box"));
290
+ var import_seeds_react_text2 = __toESM(require("@sproutsocial/seeds-react-text"));
291
+ var import_seeds_react_system_props3 = require("@sproutsocial/seeds-react-system-props");
292
+
293
+ // src/v2/components/ModalContent.tsx
294
+ var React4 = __toESM(require("react"));
295
+ var Dialog = __toESM(require("@radix-ui/react-dialog"));
296
+ var import_react3 = require("motion/react");
297
+ var import_styled_components2 = __toESM(require("styled-components"));
291
298
 
292
299
  // src/shared/constants.ts
293
- var DEFAULT_MODAL_Z_INDEX = 6;
294
- var DEFAULT_OVERLAY_Z_INDEX_OFFSET = -1;
295
300
  var DEFAULT_MODAL_WIDTH = "600px";
296
- var DEFAULT_MODAL_BG = "container.background.base";
297
301
  var BODY_PADDING2 = "64px";
298
- var MODAL_SIZE_PRESETS = {
299
- small: "400px",
300
- medium: "600px",
301
- large: "800px",
302
- full: "90vw"
303
- };
304
- var MODAL_PRIORITY_Z_INDEX = {
305
- low: 100,
306
- medium: 1e3,
307
- high: 2e3
308
- };
309
-
310
- // src/v2/ModalV2Styles.tsx
311
- var StyledOverlay = (0, import_styled_components2.default)(Dialog.Overlay)`
312
- position: fixed;
313
- top: 0px;
314
- left: 0px;
315
- right: 0px;
316
- bottom: 0px;
317
- background-color: ${(props) => props.theme.colors.overlay.background.base};
318
- opacity: 0;
319
- will-change: opacity;
320
- transition: opacity ${(props) => props.theme.duration.medium}
321
- ${(props) => props.theme.easing.ease_inout};
322
- z-index: ${(props) => props.zIndex ? props.zIndex + DEFAULT_OVERLAY_Z_INDEX_OFFSET : 999};
323
-
324
- /* Allow clicking through overlay when modal is draggable */
325
- ${(props) => props.allowInteraction && `
326
- pointer-events: none;
327
- `}
302
+ var MOBILE_BREAKPOINT = "780px";
303
+ var RAIL_BUTTON_SIZE = 44;
304
+ var RAIL_OFFSET = 12;
305
+ var RAIL_GAP = 12;
306
+ var RAIL_EXTRA_SPACE = RAIL_BUTTON_SIZE + RAIL_OFFSET;
328
307
 
329
- ${import_styled_system2.zIndex}
308
+ // src/v2/components/ModalContent.tsx
309
+ var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
330
310
 
331
- &[data-state="open"] {
332
- opacity: 1;
311
+ // src/v2/MotionConfig.ts
312
+ var React3 = __toESM(require("react"));
313
+ var DURATION_MOBILE = 0.6;
314
+ var DURATION_DESKTOP = 0.3;
315
+ var desktopTransition = {
316
+ duration: DURATION_DESKTOP,
317
+ ease: "easeInOut"
318
+ };
319
+ var mobileTransition = {
320
+ duration: DURATION_MOBILE,
321
+ ease: "easeInOut"
322
+ };
323
+ var desktopModalVariants = {
324
+ initial: {
325
+ opacity: 0,
326
+ scale: 0.95,
327
+ x: "-50%",
328
+ y: "-50%",
329
+ transition: desktopTransition
330
+ },
331
+ animate: {
332
+ opacity: 1,
333
+ scale: 1,
334
+ x: "-50%",
335
+ y: "-50%",
336
+ transition: desktopTransition
337
+ },
338
+ exit: {
339
+ opacity: 0,
340
+ scale: 0.95,
341
+ x: "-50%",
342
+ y: "-50%",
343
+ transition: desktopTransition
333
344
  }
334
- &[data-state="closed"] {
335
- opacity: 0;
345
+ };
346
+ var desktopOverlayVariants = {
347
+ initial: {
348
+ opacity: 0,
349
+ transition: desktopTransition
350
+ },
351
+ animate: {
352
+ opacity: 1,
353
+ transition: desktopTransition
354
+ },
355
+ exit: {
356
+ opacity: 0,
357
+ transition: desktopTransition
336
358
  }
337
- `;
338
- var StyledContent = (0, import_styled_components2.default)(Dialog.Content)`
359
+ };
360
+ var mobileDrawerVariants = {
361
+ initial: {
362
+ opacity: 0,
363
+ x: "-50%",
364
+ y: "100%",
365
+ transition: mobileTransition
366
+ },
367
+ animate: {
368
+ opacity: 1,
369
+ x: "-50%",
370
+ y: 0,
371
+ transition: mobileTransition
372
+ },
373
+ exit: {
374
+ opacity: 0,
375
+ x: "-50%",
376
+ y: "100%",
377
+ transition: mobileTransition
378
+ }
379
+ };
380
+ var mobileOverlayVariants = {
381
+ initial: {
382
+ opacity: 0,
383
+ transition: mobileTransition
384
+ },
385
+ animate: {
386
+ opacity: 1,
387
+ transition: mobileTransition
388
+ },
389
+ exit: {
390
+ opacity: 0,
391
+ transition: mobileTransition
392
+ }
393
+ };
394
+ var draggableModalVariants = {
395
+ initial: {
396
+ opacity: 0,
397
+ transition: desktopTransition
398
+ },
399
+ animate: {
400
+ opacity: 1,
401
+ transition: desktopTransition
402
+ },
403
+ exit: {
404
+ opacity: 0,
405
+ transition: desktopTransition
406
+ }
407
+ };
408
+ function getContentVariants(isMobile, isDraggable) {
409
+ if (isDraggable) {
410
+ return draggableModalVariants;
411
+ }
412
+ return isMobile ? mobileDrawerVariants : desktopModalVariants;
413
+ }
414
+ function getOverlayVariants(isMobile) {
415
+ return isMobile ? mobileOverlayVariants : desktopOverlayVariants;
416
+ }
417
+ function useIsMobile() {
418
+ const [isMobile, setIsMobile] = React3.useState(() => {
419
+ if (typeof window === "undefined") return false;
420
+ return window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT})`).matches;
421
+ });
422
+ React3.useEffect(() => {
423
+ if (typeof window === "undefined") return;
424
+ const mediaQuery = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT})`);
425
+ const handler = (e) => setIsMobile(e.matches);
426
+ if (mediaQuery.addEventListener) {
427
+ mediaQuery.addEventListener("change", handler);
428
+ return () => mediaQuery.removeEventListener("change", handler);
429
+ } else if (mediaQuery.addListener) {
430
+ mediaQuery.addListener(handler);
431
+ return () => mediaQuery.removeListener(handler);
432
+ }
433
+ }, []);
434
+ return isMobile;
435
+ }
436
+
437
+ // src/v2/components/ModalContent.tsx
438
+ var import_jsx_runtime3 = require("react/jsx-runtime");
439
+ var StyledMotionWrapper = (0, import_styled_components2.default)(import_react3.motion.div)`
339
440
  position: fixed;
340
- ${(props) => props.draggable ? `
341
- top: 50%;
342
- left: 50%;
343
- transform: translate(-50%, -50%);
344
- ` : `
345
- top: 50%;
346
- left: 50%;
347
- transform: translate(-50%, -50%);
348
- `}
441
+ top: ${(props) => props.$isMobile ? "auto" : "50%"};
442
+ left: 50%;
443
+ bottom: ${(props) => props.$isMobile ? 0 : "auto"};
444
+ `;
445
+ var StyledContent = import_styled_components2.default.div.withConfig({
446
+ shouldForwardProp: (prop) => !["isDragging", "draggable"].includes(prop)
447
+ })`
349
448
  display: flex;
350
449
  flex-direction: column;
351
- border-radius: ${(props) => props.theme.radii[600]};
352
- box-shadow: ${(props) => props.theme.shadows.medium};
450
+ border-radius: ${(props) => props.theme.radii[800]};
451
+ box-shadow: ${(props) => props.theme.shadows.high};
353
452
  filter: blur(0);
453
+ background-color: ${(props) => props.theme.colors.container.background.base};
354
454
  color: ${(props) => props.theme.colors.text.body};
355
455
  outline: none;
456
+ width: ${DEFAULT_MODAL_WIDTH};
356
457
  max-width: ${(props) => {
357
- const railSize = props.railSize ?? 44;
358
- const railOffset = props.railOffset ?? 12;
359
- const railExtraSpace = railSize + railOffset;
360
- return `calc(100vw - ${BODY_PADDING2} - ${railExtraSpace}px)`;
458
+ return `calc(100vw - ${BODY_PADDING2} - ${RAIL_EXTRA_SPACE}px)`;
361
459
  }};
362
460
  max-height: calc(100vh - ${BODY_PADDING2});
363
- z-index: ${(props) => props.zIndex || 1e3};
364
461
 
365
- /* When viewport is <= 400px, rail is above modal, so restore full width */
366
- @media (max-width: 400px) {
367
- max-width: calc(100vw - ${BODY_PADDING2});
462
+ /* Mobile styles for viewport <= ${MOBILE_BREAKPOINT} */
463
+ @media (max-width: ${MOBILE_BREAKPOINT}) {
464
+ /* Full viewport width - edge to edge */
465
+ width: 100vw;
466
+ max-width: 100vw;
467
+ min-width: 100vw;
468
+
469
+ /* Height hugs content, with increased max-height to get closer to top */
470
+ /* Subtract space for rail + comfortable gap (44px rail + ~40px gap) */
471
+ height: auto;
472
+ max-height: calc(95vh - 84px);
473
+
474
+ /* Adjust border radius for mobile - rounded top, flat bottom to blend with device */
475
+ border-top-left-radius: ${(props) => props.theme.radii[800]};
476
+ border-top-right-radius: ${(props) => props.theme.radii[800]};
477
+ border-bottom-left-radius: 0;
478
+ border-bottom-right-radius: 0;
479
+
480
+ /* Mobile shadow - appears to cast upward (high-reverse) */
481
+ box-shadow: 0px -16px 32px 0px rgba(39, 51, 51, 0.24);
368
482
  }
369
483
 
370
484
  @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
371
485
  height: calc(100vh - ${BODY_PADDING2});
372
486
  }
373
487
 
374
- ${import_styled_system2.width}
375
488
  ${import_seeds_react_system_props2.COMMON}
376
-
377
- /* Enhanced Radix Dialog animations */
378
- opacity: 0;
379
- ${(props) => !props.draggable ? `
380
- transform: translate(-50%, -50%) scale(0.95);
381
- transition: opacity ${props.theme.duration.medium} ${props.theme.easing.ease_inout},
382
- transform ${props.theme.duration.medium} ${props.theme.easing.ease_inout};
383
- ` : `
384
- transition: opacity ${props.theme.duration.medium} ${props.theme.easing.ease_inout};
385
- `}
386
-
387
- &[data-state="open"] {
388
- opacity: 1;
389
- ${(props) => !props.draggable ? `transform: translate(-50%, -50%) scale(1);` : ``}
390
- }
391
- &[data-state="closed"] {
392
- opacity: 0;
393
- ${(props) => !props.draggable ? `transform: translate(-50%, -50%) scale(0.95);` : ``}
394
- }
395
- `;
396
- var Content3 = (0, import_styled_components2.default)(import_seeds_react_box3.default)`
397
- font-family: ${(props) => props.theme.fontFamily};
398
- min-height: 80px;
399
- overflow-y: auto;
400
- flex: 1 1 auto;
401
- padding: 0 ${(props) => props.theme.space[300]}
402
- ${(props) => props.theme.space[300]} ${(props) => props.theme.space[300]};
403
- @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
404
- flex-basis: 100%;
405
- }
489
+ ${import_seeds_react_system_props2.FLEXBOX}
490
+ ${import_seeds_react_system_props2.BORDER}
491
+ ${import_seeds_react_system_props2.LAYOUT}
406
492
  `;
407
- var Header2 = (0, import_styled_components2.default)(import_seeds_react_box3.default)`
493
+ StyledContent.displayName = "ModalContent";
494
+ var DragContext = React4.createContext(null);
495
+ var useDragContext = () => {
496
+ const context = React4.useContext(DragContext);
497
+ return context;
498
+ };
499
+ var StaticModalContent = ({
500
+ children,
501
+ label,
502
+ dataAttributes,
503
+ rest
504
+ }) => {
505
+ const isMobile = useIsMobile();
506
+ const contentVariants = getContentVariants(isMobile, false);
507
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DragContext.Provider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Dialog.Content, { asChild: true, "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
508
+ StyledMotionWrapper,
509
+ {
510
+ $isMobile: isMobile,
511
+ variants: contentVariants,
512
+ initial: "initial",
513
+ animate: "animate",
514
+ exit: "exit",
515
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StyledContent, { draggable: false, ...dataAttributes, ...rest, children })
516
+ }
517
+ ) }) });
518
+ };
519
+ var DraggableModalContent = ({
520
+ children,
521
+ label,
522
+ dataAttributes,
523
+ rest
524
+ }) => {
525
+ const [position, setPosition] = React4.useState({ x: 0, y: 0 });
526
+ const [isDragging, setIsDragging] = React4.useState(false);
527
+ const contentRef = React4.useRef(null);
528
+ const isMobile = useIsMobile();
529
+ const handleHeaderMouseDown = React4.useCallback((e) => {
530
+ const target = e.target;
531
+ if (target.tagName === "BUTTON" || target.tagName === "INPUT" || target.closest("button")) {
532
+ return;
533
+ }
534
+ e.preventDefault();
535
+ setIsDragging(true);
536
+ const rect = contentRef.current?.getBoundingClientRect();
537
+ if (!rect) return;
538
+ const offsetX = e.clientX - rect.left;
539
+ const offsetY = e.clientY - rect.top;
540
+ const handleMouseMove = (e2) => {
541
+ e2.preventDefault();
542
+ const newX = e2.clientX - offsetX;
543
+ const newY = e2.clientY - offsetY;
544
+ const isRailOnSide = window.innerWidth > 780;
545
+ const modalWidth = rect.width;
546
+ const modalHeight = rect.height;
547
+ let maxX = window.innerWidth - modalWidth;
548
+ let minX = 0;
549
+ let maxY = window.innerHeight - modalHeight;
550
+ let minY = 0;
551
+ if (isRailOnSide) {
552
+ maxX = window.innerWidth - modalWidth - RAIL_EXTRA_SPACE;
553
+ } else {
554
+ minY = RAIL_BUTTON_SIZE + RAIL_OFFSET;
555
+ }
556
+ const constrainedX = Math.max(minX, Math.min(maxX, newX));
557
+ const constrainedY = Math.max(minY, Math.min(maxY, newY));
558
+ const centerX = window.innerWidth / 2 - modalWidth / 2;
559
+ const centerY = window.innerHeight / 2 - modalHeight / 2;
560
+ setPosition({
561
+ x: constrainedX - centerX,
562
+ y: constrainedY - centerY
563
+ });
564
+ };
565
+ const handleMouseUp = () => {
566
+ setIsDragging(false);
567
+ document.removeEventListener("mousemove", handleMouseMove);
568
+ document.removeEventListener("mouseup", handleMouseUp);
569
+ };
570
+ document.addEventListener("mousemove", handleMouseMove);
571
+ document.addEventListener("mouseup", handleMouseUp);
572
+ }, []);
573
+ const dragContextValue = React4.useMemo(
574
+ () => ({
575
+ position,
576
+ isDragging,
577
+ onHeaderMouseDown: handleHeaderMouseDown,
578
+ contentRef,
579
+ draggable: true
580
+ }),
581
+ [position, isDragging, handleHeaderMouseDown]
582
+ );
583
+ const handleInteractOutside = React4.useCallback((e) => {
584
+ e.preventDefault();
585
+ }, []);
586
+ const contentVariants = getContentVariants(isMobile, true);
587
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DragContext.Provider, { value: dragContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
588
+ Dialog.Content,
589
+ {
590
+ asChild: true,
591
+ "aria-label": label,
592
+ onInteractOutside: handleInteractOutside,
593
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
594
+ StyledMotionWrapper,
595
+ {
596
+ $isMobile: isMobile,
597
+ variants: contentVariants,
598
+ initial: "initial",
599
+ animate: "animate",
600
+ exit: "exit",
601
+ style: {
602
+ // Apply drag offset transforms
603
+ // For draggable modals, variants only handle opacity, so we apply transforms here
604
+ // Combined with top: 50%, left: 50%, these create the centering + drag offset
605
+ x: `calc(-50% + ${position.x}px)`,
606
+ y: `calc(-50% + ${position.y}px)`
607
+ },
608
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
609
+ StyledContent,
610
+ {
611
+ ref: contentRef,
612
+ draggable: true,
613
+ isDragging,
614
+ ...dataAttributes,
615
+ ...rest,
616
+ children
617
+ }
618
+ )
619
+ }
620
+ )
621
+ }
622
+ ) });
623
+ };
624
+
625
+ // src/v2/components/ModalHeader.tsx
626
+ var import_jsx_runtime4 = require("react/jsx-runtime");
627
+ var ModalCustomHeader = (0, import_styled_components3.default)(import_seeds_react_box3.default).withConfig({
628
+ shouldForwardProp: (prop) => !["draggable", "isDragging"].includes(prop)
629
+ })`
408
630
  font-family: ${(props) => props.theme.fontFamily};
409
- padding: ${(props) => props.theme.space[400]}
410
- ${(props) => props.theme.space[300]};
631
+ padding: ${(props) => props.theme.space[400]};
411
632
  display: flex;
412
633
  align-items: center;
413
634
  justify-content: space-between;
@@ -418,140 +639,33 @@ var Header2 = (0, import_styled_components2.default)(import_seeds_react_box3.def
418
639
  cursor: ${props.isDragging ? "grabbing" : "grab"};
419
640
  user-select: none;
420
641
  `}
421
- `;
422
- var Footer2 = (0, import_styled_components2.default)(import_seeds_react_box3.default)`
423
- flex: 0 0 auto;
424
- font-family: ${(props) => props.theme.fontFamily};
425
- padding: ${(props) => props.theme.space[400]}
426
- ${(props) => props.theme.space[300]};
427
- border-bottom-right-radius: ${(props) => props.theme.radii[500]};
428
- border-bottom-left-radius: ${(props) => props.theme.radii[500]};
429
- display: flex;
430
- align-items: center;
431
- justify-content: flex-end;
432
- gap: ${(props) => props.theme.space[100]};
433
- `;
434
- StyledOverlay.displayName = "ModalOverlay";
435
- StyledContent.displayName = "ModalContent";
436
- Content3.displayName = "ModalContent";
437
- Header2.displayName = "ModalHeader";
438
- Footer2.displayName = "ModalFooter";
439
-
440
- // src/v2/components/ModalHeader.tsx
441
- var React5 = __toESM(require("react"));
442
- var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
443
- var import_seeds_react_box4 = __toESM(require("@sproutsocial/seeds-react-box"));
444
- var import_seeds_react_text2 = __toESM(require("@sproutsocial/seeds-react-text"));
445
-
446
- // src/v2/components/ModalCloseButton.tsx
447
- var React4 = __toESM(require("react"));
448
- var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
449
- var import_styled_components3 = __toESM(require("styled-components"));
450
- var import_seeds_react_icon2 = __toESM(require("@sproutsocial/seeds-react-icon"));
451
- var import_jsx_runtime3 = require("react/jsx-runtime");
452
- var CloseButtonWrapper = import_styled_components3.default.button`
453
- width: ${(p) => p.size || 44}px;
454
- height: ${(p) => p.size || 44}px;
455
- display: inline-grid;
456
- place-items: center;
457
- border-radius: 8px;
458
- border: none;
459
- background: rgba(22, 32, 32, 0.56);
460
- color: #ffffff;
461
- cursor: pointer;
462
- outline: none;
463
- transition: all 0.2s ease;
464
-
465
- ${(p) => p.position === "absolute" && `
466
- position: absolute;
467
- top: 0px;
468
- ${p.side || "right"}: ${p.offset || -48}px;
469
- z-index: 1;
470
- `}
471
-
472
- &:hover {
473
- background: rgba(22, 32, 32, 0.7);
474
- transform: translateY(-1px);
475
- }
476
-
477
- &:active {
478
- transform: translateY(0);
479
- }
480
642
 
481
- &:focus-visible {
482
- box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #205bc3;
483
- }
484
-
485
- &:disabled {
486
- opacity: 0.5;
487
- cursor: not-allowed;
488
- }
643
+ ${import_seeds_react_system_props3.COMMON}
644
+ ${import_seeds_react_system_props3.FLEXBOX}
645
+ ${import_seeds_react_system_props3.BORDER}
646
+ ${import_seeds_react_system_props3.LAYOUT}
489
647
  `;
490
- var ModalCloseButton2 = (props) => {
491
- const {
492
- children,
493
- onClick,
494
- asChild,
495
- closeButtonLabel = "Close modal",
496
- size = 44,
497
- position = "absolute",
498
- side = "right",
499
- offset = -48,
500
- ...rest
501
- } = props;
502
- const handleClick = (e) => {
503
- onClick?.(e);
504
- };
505
- if (asChild) {
506
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Dialog2.Close, { asChild: true, children: React4.cloneElement(children, {
507
- onClick: handleClick,
508
- ...rest
509
- }) });
510
- }
511
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Dialog2.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
512
- CloseButtonWrapper,
513
- {
514
- onClick: handleClick,
515
- size,
516
- position,
517
- side,
518
- offset,
519
- "aria-label": closeButtonLabel,
520
- title: closeButtonLabel,
521
- ...rest,
522
- children: children || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_seeds_react_icon2.default, { name: "x-outline", size: "small" })
523
- }
524
- ) });
525
- };
526
- ModalCloseButton2.displayName = "ModalCloseButton";
527
-
528
- // src/v2/components/ModalHeader.tsx
529
- var import_jsx_runtime4 = require("react/jsx-runtime");
648
+ ModalCustomHeader.displayName = "ModalCustomHeader";
530
649
  var ModalHeader2 = (props) => {
531
650
  const {
532
651
  title,
533
652
  subtitle,
534
- children,
535
653
  titleProps = {},
536
654
  subtitleProps = {},
537
- showInlineClose,
538
655
  ...rest
539
656
  } = props;
540
657
  const dragContext = useDragContext();
541
658
  const isDraggable = dragContext?.draggable ?? false;
542
659
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
543
- Header2,
660
+ ModalCustomHeader,
544
661
  {
545
662
  ...rest,
546
663
  onMouseDown: isDraggable ? dragContext?.onHeaderMouseDown : void 0,
547
664
  draggable: isDraggable,
548
665
  isDragging: dragContext?.isDragging,
549
- children: children ? children : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(React5.Fragment, { children: [
550
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_seeds_react_box4.default, { children: [
551
- title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog3.Title, { asChild: true, ...titleProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_text2.default.Headline, { children: title }) }),
552
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog3.Description, { asChild: true, ...subtitleProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_text2.default, { as: "div", fontSize: 200, children: subtitle }) })
553
- ] }),
554
- showInlineClose && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_box4.default, { display: "flex", alignItems: "center", justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ModalCloseButton2, { position: "relative", offset: 0 }) })
666
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_seeds_react_box3.default, { children: [
667
+ title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog2.Title, { asChild: true, ...titleProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_text2.default.Headline, { children: title }) }),
668
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Dialog2.Description, { asChild: true, ...subtitleProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_seeds_react_text2.default, { as: "div", fontSize: 200, children: subtitle }) })
555
669
  ] })
556
670
  }
557
671
  );
@@ -559,123 +673,755 @@ var ModalHeader2 = (props) => {
559
673
  ModalHeader2.displayName = "ModalHeader";
560
674
 
561
675
  // src/v2/components/ModalFooter.tsx
676
+ var React7 = require("react");
677
+ var import_styled_components4 = __toESM(require("styled-components"));
678
+ var import_seeds_react_box4 = __toESM(require("@sproutsocial/seeds-react-box"));
679
+ var import_seeds_react_system_props4 = require("@sproutsocial/seeds-react-system-props");
680
+
681
+ // src/v2/components/ModalCloseWrapper.tsx
562
682
  var React6 = require("react");
683
+ var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
563
684
  var import_jsx_runtime5 = require("react/jsx-runtime");
564
- var ModalFooter2 = (props) => {
565
- const { bg = DEFAULT_MODAL_BG, children, ...rest } = props;
566
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
567
- Footer2,
568
- {
569
- bg,
570
- borderTop: 500,
571
- borderColor: "container.border.base",
572
- ...rest,
573
- children
574
- }
575
- );
685
+ var ModalCloseWrapper = (props) => {
686
+ const { children, onClick, asChild = true, ...rest } = props;
687
+ const handleClick = (e) => {
688
+ onClick?.(e);
689
+ };
690
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children });
576
691
  };
577
- ModalFooter2.displayName = "ModalFooter";
692
+ ModalCloseWrapper.displayName = "ModalCloseWrapper";
578
693
 
579
- // src/v2/components/ModalContent.tsx
580
- var React7 = __toESM(require("react"));
694
+ // src/v2/components/ModalFooter.tsx
581
695
  var import_jsx_runtime6 = require("react/jsx-runtime");
582
- var ModalContent2 = React7.forwardRef(({ children, ...rest }, ref) => {
583
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Content3, { "data-qa-modal": true, ref, ...rest, children });
584
- });
585
- ModalContent2.displayName = "ModalContent";
696
+ var ModalCustomFooter = (0, import_styled_components4.default)(import_seeds_react_box4.default)`
697
+ flex: 0 0 auto;
698
+ font-family: ${(props) => props.theme.fontFamily};
699
+ background-color: ${(props) => props.theme.colors.container.background.base};
700
+ padding: ${(props) => props.theme.space[400]};
701
+ border-bottom-right-radius: ${(props) => props.theme.radii[800]};
702
+ border-bottom-left-radius: ${(props) => props.theme.radii[800]};
703
+ display: flex;
704
+ align-items: center;
705
+ justify-content: flex-end;
706
+ gap: ${(props) => props.theme.space[100]};
586
707
 
587
- // src/v2/components/ModalDescription.tsx
708
+ /* Flat bottom corners to blend with device edge on mobile */
709
+ @media (max-width: ${MOBILE_BREAKPOINT}) {
710
+ border-bottom-right-radius: 0;
711
+ border-bottom-left-radius: 0;
712
+ }
713
+
714
+ ${import_seeds_react_system_props4.COMMON}
715
+ ${import_seeds_react_system_props4.FLEXBOX}
716
+ ${import_seeds_react_system_props4.BORDER}
717
+ ${import_seeds_react_system_props4.LAYOUT}
718
+ `;
719
+ ModalCustomFooter.displayName = "ModalCustomFooter";
720
+ var ModalFooter2 = (props) => {
721
+ const { cancelButton, primaryButton, leftAction, ...rest } = props;
722
+ if (!cancelButton && !primaryButton && !leftAction) {
723
+ return null;
724
+ }
725
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ModalCustomFooter, { ...rest, children: [
726
+ leftAction ? leftAction : null,
727
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_seeds_react_box4.default, { display: "flex", gap: 300, marginLeft: "auto", children: [
728
+ cancelButton && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalCloseWrapper, { children: cancelButton }),
729
+ primaryButton && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalCloseWrapper, { children: primaryButton })
730
+ ] })
731
+ ] });
732
+ };
733
+ ModalFooter2.displayName = "ModalFooter";
734
+
735
+ // src/v2/components/ModalBody.tsx
588
736
  var React8 = __toESM(require("react"));
589
- var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
737
+ var import_styled_components5 = __toESM(require("styled-components"));
590
738
  var import_seeds_react_box5 = __toESM(require("@sproutsocial/seeds-react-box"));
739
+ var import_seeds_react_system_props5 = require("@sproutsocial/seeds-react-system-props");
591
740
  var import_jsx_runtime7 = require("react/jsx-runtime");
592
- var ModalDescription = React8.forwardRef(({ children, descriptionProps = {}, ...rest }, ref) => {
593
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_seeds_react_box5.default, { ref, ...rest, children }) });
594
- });
595
- ModalDescription.displayName = "ModalDescription";
741
+ var StyledModalBody = (0, import_styled_components5.default)(import_seeds_react_box5.default)`
742
+ font-family: ${(props) => props.theme.fontFamily};
743
+ overflow-y: auto;
744
+ flex: 1 1 auto;
745
+ padding: ${(props) => `0 ${props.theme.space[400]}`};
746
+ ${(props) => props.theme.typography[300]}
747
+ color: ${(props) => props.theme.colors.text.body};
748
+ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
749
+ flex-basis: 100%;
750
+ }
596
751
 
597
- // src/v2/components/ModalTrigger.tsx
752
+ ${import_seeds_react_system_props5.COMMON}
753
+ ${import_seeds_react_system_props5.FLEXBOX}
754
+ ${import_seeds_react_system_props5.BORDER}
755
+ ${import_seeds_react_system_props5.LAYOUT}
756
+ `;
757
+ StyledModalBody.displayName = "ModalBody";
758
+ var ModalBody = React8.forwardRef(
759
+ ({ children, ...rest }, ref) => {
760
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyledModalBody, { "data-qa-modal-body": true, ref, ...rest, children });
761
+ }
762
+ );
763
+ ModalBody.displayName = "ModalBody";
764
+
765
+ // src/v2/components/ModalDescription.tsx
598
766
  var React9 = __toESM(require("react"));
599
- var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
600
- var import_seeds_react_button2 = __toESM(require("@sproutsocial/seeds-react-button"));
767
+ var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
768
+ var import_seeds_react_box6 = __toESM(require("@sproutsocial/seeds-react-box"));
601
769
  var import_jsx_runtime8 = require("react/jsx-runtime");
602
- var ModalTrigger = (props) => {
603
- const { children, onClick, asChild, ...rest } = props;
604
- const handleClick = (e) => {
605
- onClick?.(e);
606
- };
607
- if (asChild) {
608
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog5.Trigger, { asChild: true, children: React9.cloneElement(children, {
609
- onClick: handleClick,
610
- ...rest
611
- }) });
612
- }
613
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog5.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_seeds_react_button2.default, { onClick: handleClick, ...rest, children }) });
614
- };
615
- ModalTrigger.displayName = "ModalTrigger";
770
+ 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)(import_seeds_react_box6.default, { ref, ...rest, children }) });
772
+ });
773
+ ModalDescription.displayName = "ModalDescription";
616
774
 
617
- // src/v2/components/ModalClose.tsx
775
+ // src/v2/components/ModalRail.tsx
618
776
  var React10 = require("react");
619
- var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
777
+ var import_styled_components6 = __toESM(require("styled-components"));
620
778
  var import_jsx_runtime9 = require("react/jsx-runtime");
621
- var ModalClose = (props) => {
622
- const { children, onClick, asChild = false, ...rest } = props;
623
- const handleClick = (e) => {
624
- onClick?.(e);
625
- };
626
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog6.Close, { asChild, onClick: handleClick, ...rest, children });
627
- };
628
- ModalClose.displayName = "ModalClose";
629
-
630
- // src/v2/components/ModalRail.tsx
631
- var React11 = __toESM(require("react"));
632
- var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
633
- var import_styled_components4 = __toESM(require("styled-components"));
634
- var import_seeds_react_icon3 = __toESM(require("@sproutsocial/seeds-react-icon"));
635
- var import_jsx_runtime10 = require("react/jsx-runtime");
636
- var Rail = import_styled_components4.default.div`
779
+ var Rail = import_styled_components6.default.div`
637
780
  position: absolute;
638
- top: ${(p) => p.offset}px;
639
- ${(p) => p.side === "right" ? `right: calc(-1 * (${p.size}px + ${p.offset}px));` : `left: calc(-1 * (${p.size}px + ${p.offset}px));`}
781
+ top: ${RAIL_OFFSET}px;
782
+ right: calc(-1 * (${RAIL_BUTTON_SIZE}px + ${RAIL_OFFSET}px));
640
783
  display: flex;
641
784
  flex-direction: column;
642
- gap: ${(p) => p.gap}px;
785
+ gap: ${RAIL_GAP}px;
643
786
  z-index: 1;
644
787
 
645
- @media (max-width: 400px) {
788
+ @media (max-width: ${MOBILE_BREAKPOINT}) {
646
789
  /* Move rail above the modal on the right side */
647
790
  top: auto;
648
- bottom: calc(100% + ${(p) => p.offset}px);
649
- right: ${(p) => p.offset}px;
791
+ bottom: calc(100% + ${RAIL_OFFSET}px);
792
+ right: ${RAIL_OFFSET}px;
650
793
  left: auto;
651
794
  /* Change to horizontal layout with reversed order */
652
795
  flex-direction: row-reverse;
653
796
  }
654
797
  `;
655
- var RailBtn = import_styled_components4.default.button`
656
- width: ${(p) => p.size}px;
657
- height: ${(p) => p.size}px;
798
+ var ModalRail = ({ children }) => {
799
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
800
+ Rail,
801
+ {
802
+ "data-slot": "modal-rail",
803
+ "data-qa-modal-rail": true,
804
+ "aria-label": "Modal quick actions",
805
+ children
806
+ }
807
+ );
808
+ };
809
+ ModalRail.displayName = "ModalRail";
810
+
811
+ // src/v2/components/ModalAction.tsx
812
+ var React11 = require("react");
813
+ var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
814
+ var import_styled_components8 = __toESM(require("styled-components"));
815
+ var import_seeds_react_icon2 = __toESM(require("@sproutsocial/seeds-react-icon"));
816
+
817
+ // ../../node_modules/@babel/runtime/helpers/esm/extends.js
818
+ function _extends() {
819
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
820
+ for (var e = 1; e < arguments.length; e++) {
821
+ var t = arguments[e];
822
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
823
+ }
824
+ return n;
825
+ }, _extends.apply(null, arguments);
826
+ }
827
+
828
+ // ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
829
+ function _assertThisInitialized(e) {
830
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
831
+ return e;
832
+ }
833
+
834
+ // ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
835
+ function _setPrototypeOf(t, e) {
836
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
837
+ return t2.__proto__ = e2, t2;
838
+ }, _setPrototypeOf(t, e);
839
+ }
840
+
841
+ // ../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
842
+ function _inheritsLoose(t, o) {
843
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
844
+ }
845
+
846
+ // ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
847
+ function _getPrototypeOf(t) {
848
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
849
+ return t2.__proto__ || Object.getPrototypeOf(t2);
850
+ }, _getPrototypeOf(t);
851
+ }
852
+
853
+ // ../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
854
+ function _isNativeFunction(t) {
855
+ try {
856
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
857
+ } catch (n) {
858
+ return "function" == typeof t;
859
+ }
860
+ }
861
+
862
+ // ../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
863
+ function _isNativeReflectConstruct() {
864
+ try {
865
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
866
+ }));
867
+ } catch (t2) {
868
+ }
869
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
870
+ return !!t;
871
+ })();
872
+ }
873
+
874
+ // ../../node_modules/@babel/runtime/helpers/esm/construct.js
875
+ function _construct(t, e, r) {
876
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
877
+ var o = [null];
878
+ o.push.apply(o, e);
879
+ var p = new (t.bind.apply(t, o))();
880
+ return r && _setPrototypeOf(p, r.prototype), p;
881
+ }
882
+
883
+ // ../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
884
+ function _wrapNativeSuper(t) {
885
+ var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
886
+ return _wrapNativeSuper = function _wrapNativeSuper2(t2) {
887
+ if (null === t2 || !_isNativeFunction(t2)) return t2;
888
+ if ("function" != typeof t2) throw new TypeError("Super expression must either be null or a function");
889
+ if (void 0 !== r) {
890
+ if (r.has(t2)) return r.get(t2);
891
+ r.set(t2, Wrapper);
892
+ }
893
+ function Wrapper() {
894
+ return _construct(t2, arguments, _getPrototypeOf(this).constructor);
895
+ }
896
+ return Wrapper.prototype = Object.create(t2.prototype, {
897
+ constructor: {
898
+ value: Wrapper,
899
+ enumerable: false,
900
+ writable: true,
901
+ configurable: true
902
+ }
903
+ }), _setPrototypeOf(Wrapper, t2);
904
+ }, _wrapNativeSuper(t);
905
+ }
906
+
907
+ // ../../node_modules/polished/dist/polished.esm.js
908
+ var ERRORS = {
909
+ "1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
910
+ "2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
911
+ "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
912
+ "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
913
+ "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
914
+ "6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
915
+ "7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
916
+ "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
917
+ "9": "Please provide a number of steps to the modularScale helper.\n\n",
918
+ "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
919
+ "11": 'Invalid value passed as base to modularScale, expected number or em string but got "%s"\n\n',
920
+ "12": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.\n\n',
921
+ "13": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.\n\n',
922
+ "14": 'Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
923
+ "15": 'Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
924
+ "16": "You must provide a template to this method.\n\n",
925
+ "17": "You passed an unsupported selector state to this method.\n\n",
926
+ "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
927
+ "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
928
+ "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
929
+ "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
930
+ "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
931
+ "23": "fontFace expects a name of a font-family.\n\n",
932
+ "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
933
+ "25": "fontFace expects localFonts to be an array.\n\n",
934
+ "26": "fontFace expects fileFormats to be an array.\n\n",
935
+ "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
936
+ "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
937
+ "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
938
+ "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
939
+ "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
940
+ "32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
941
+ "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
942
+ "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
943
+ "35": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
944
+ "36": "Property must be a string value.\n\n",
945
+ "37": "Syntax Error at %s.\n\n",
946
+ "38": "Formula contains a function that needs parentheses at %s.\n\n",
947
+ "39": "Formula is missing closing parenthesis at %s.\n\n",
948
+ "40": "Formula has too many closing parentheses at %s.\n\n",
949
+ "41": "All values in a formula must have the same unit or be unitless.\n\n",
950
+ "42": "Please provide a number of steps to the modularScale helper.\n\n",
951
+ "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
952
+ "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
953
+ "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
954
+ "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
955
+ "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
956
+ "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
957
+ "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
958
+ "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
959
+ "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
960
+ "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
961
+ "53": "fontFace expects localFonts to be an array.\n\n",
962
+ "54": "fontFace expects fileFormats to be an array.\n\n",
963
+ "55": "fontFace expects a name of a font-family.\n\n",
964
+ "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
965
+ "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
966
+ "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
967
+ "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
968
+ "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
969
+ "61": "Property must be a string value.\n\n",
970
+ "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
971
+ "63": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
972
+ "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
973
+ "65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
974
+ "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
975
+ "67": "You must provide a template to this method.\n\n",
976
+ "68": "You passed an unsupported selector state to this method.\n\n",
977
+ "69": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.\n\n',
978
+ "70": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.\n\n',
979
+ "71": 'Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.\n\n',
980
+ "72": 'Passed invalid base value %s to %s(), please pass a value like "12px" or 12.\n\n',
981
+ "73": "Please provide a valid CSS variable.\n\n",
982
+ "74": "CSS variable not found.\n\n",
983
+ "75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
984
+ };
985
+ function format() {
986
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
987
+ args[_key] = arguments[_key];
988
+ }
989
+ var a = args[0];
990
+ var b = [];
991
+ var c;
992
+ for (c = 1; c < args.length; c += 1) {
993
+ b.push(args[c]);
994
+ }
995
+ b.forEach(function(d) {
996
+ a = a.replace(/%[a-z]/, d);
997
+ });
998
+ return a;
999
+ }
1000
+ var PolishedError = /* @__PURE__ */ function(_Error) {
1001
+ _inheritsLoose(PolishedError2, _Error);
1002
+ function PolishedError2(code) {
1003
+ var _this;
1004
+ if (process.env.NODE_ENV === "production") {
1005
+ _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
1006
+ } else {
1007
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1008
+ args[_key2 - 1] = arguments[_key2];
1009
+ }
1010
+ _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
1011
+ }
1012
+ return _assertThisInitialized(_this);
1013
+ }
1014
+ return PolishedError2;
1015
+ }(/* @__PURE__ */ _wrapNativeSuper(Error));
1016
+ function colorToInt(color) {
1017
+ return Math.round(color * 255);
1018
+ }
1019
+ function convertToInt(red, green, blue) {
1020
+ return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
1021
+ }
1022
+ function hslToRgb(hue, saturation, lightness, convert) {
1023
+ if (convert === void 0) {
1024
+ convert = convertToInt;
1025
+ }
1026
+ if (saturation === 0) {
1027
+ return convert(lightness, lightness, lightness);
1028
+ }
1029
+ var huePrime = (hue % 360 + 360) % 360 / 60;
1030
+ var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
1031
+ var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
1032
+ var red = 0;
1033
+ var green = 0;
1034
+ var blue = 0;
1035
+ if (huePrime >= 0 && huePrime < 1) {
1036
+ red = chroma;
1037
+ green = secondComponent;
1038
+ } else if (huePrime >= 1 && huePrime < 2) {
1039
+ red = secondComponent;
1040
+ green = chroma;
1041
+ } else if (huePrime >= 2 && huePrime < 3) {
1042
+ green = chroma;
1043
+ blue = secondComponent;
1044
+ } else if (huePrime >= 3 && huePrime < 4) {
1045
+ green = secondComponent;
1046
+ blue = chroma;
1047
+ } else if (huePrime >= 4 && huePrime < 5) {
1048
+ red = secondComponent;
1049
+ blue = chroma;
1050
+ } else if (huePrime >= 5 && huePrime < 6) {
1051
+ red = chroma;
1052
+ blue = secondComponent;
1053
+ }
1054
+ var lightnessModification = lightness - chroma / 2;
1055
+ var finalRed = red + lightnessModification;
1056
+ var finalGreen = green + lightnessModification;
1057
+ var finalBlue = blue + lightnessModification;
1058
+ return convert(finalRed, finalGreen, finalBlue);
1059
+ }
1060
+ var namedColorMap = {
1061
+ aliceblue: "f0f8ff",
1062
+ antiquewhite: "faebd7",
1063
+ aqua: "00ffff",
1064
+ aquamarine: "7fffd4",
1065
+ azure: "f0ffff",
1066
+ beige: "f5f5dc",
1067
+ bisque: "ffe4c4",
1068
+ black: "000",
1069
+ blanchedalmond: "ffebcd",
1070
+ blue: "0000ff",
1071
+ blueviolet: "8a2be2",
1072
+ brown: "a52a2a",
1073
+ burlywood: "deb887",
1074
+ cadetblue: "5f9ea0",
1075
+ chartreuse: "7fff00",
1076
+ chocolate: "d2691e",
1077
+ coral: "ff7f50",
1078
+ cornflowerblue: "6495ed",
1079
+ cornsilk: "fff8dc",
1080
+ crimson: "dc143c",
1081
+ cyan: "00ffff",
1082
+ darkblue: "00008b",
1083
+ darkcyan: "008b8b",
1084
+ darkgoldenrod: "b8860b",
1085
+ darkgray: "a9a9a9",
1086
+ darkgreen: "006400",
1087
+ darkgrey: "a9a9a9",
1088
+ darkkhaki: "bdb76b",
1089
+ darkmagenta: "8b008b",
1090
+ darkolivegreen: "556b2f",
1091
+ darkorange: "ff8c00",
1092
+ darkorchid: "9932cc",
1093
+ darkred: "8b0000",
1094
+ darksalmon: "e9967a",
1095
+ darkseagreen: "8fbc8f",
1096
+ darkslateblue: "483d8b",
1097
+ darkslategray: "2f4f4f",
1098
+ darkslategrey: "2f4f4f",
1099
+ darkturquoise: "00ced1",
1100
+ darkviolet: "9400d3",
1101
+ deeppink: "ff1493",
1102
+ deepskyblue: "00bfff",
1103
+ dimgray: "696969",
1104
+ dimgrey: "696969",
1105
+ dodgerblue: "1e90ff",
1106
+ firebrick: "b22222",
1107
+ floralwhite: "fffaf0",
1108
+ forestgreen: "228b22",
1109
+ fuchsia: "ff00ff",
1110
+ gainsboro: "dcdcdc",
1111
+ ghostwhite: "f8f8ff",
1112
+ gold: "ffd700",
1113
+ goldenrod: "daa520",
1114
+ gray: "808080",
1115
+ green: "008000",
1116
+ greenyellow: "adff2f",
1117
+ grey: "808080",
1118
+ honeydew: "f0fff0",
1119
+ hotpink: "ff69b4",
1120
+ indianred: "cd5c5c",
1121
+ indigo: "4b0082",
1122
+ ivory: "fffff0",
1123
+ khaki: "f0e68c",
1124
+ lavender: "e6e6fa",
1125
+ lavenderblush: "fff0f5",
1126
+ lawngreen: "7cfc00",
1127
+ lemonchiffon: "fffacd",
1128
+ lightblue: "add8e6",
1129
+ lightcoral: "f08080",
1130
+ lightcyan: "e0ffff",
1131
+ lightgoldenrodyellow: "fafad2",
1132
+ lightgray: "d3d3d3",
1133
+ lightgreen: "90ee90",
1134
+ lightgrey: "d3d3d3",
1135
+ lightpink: "ffb6c1",
1136
+ lightsalmon: "ffa07a",
1137
+ lightseagreen: "20b2aa",
1138
+ lightskyblue: "87cefa",
1139
+ lightslategray: "789",
1140
+ lightslategrey: "789",
1141
+ lightsteelblue: "b0c4de",
1142
+ lightyellow: "ffffe0",
1143
+ lime: "0f0",
1144
+ limegreen: "32cd32",
1145
+ linen: "faf0e6",
1146
+ magenta: "f0f",
1147
+ maroon: "800000",
1148
+ mediumaquamarine: "66cdaa",
1149
+ mediumblue: "0000cd",
1150
+ mediumorchid: "ba55d3",
1151
+ mediumpurple: "9370db",
1152
+ mediumseagreen: "3cb371",
1153
+ mediumslateblue: "7b68ee",
1154
+ mediumspringgreen: "00fa9a",
1155
+ mediumturquoise: "48d1cc",
1156
+ mediumvioletred: "c71585",
1157
+ midnightblue: "191970",
1158
+ mintcream: "f5fffa",
1159
+ mistyrose: "ffe4e1",
1160
+ moccasin: "ffe4b5",
1161
+ navajowhite: "ffdead",
1162
+ navy: "000080",
1163
+ oldlace: "fdf5e6",
1164
+ olive: "808000",
1165
+ olivedrab: "6b8e23",
1166
+ orange: "ffa500",
1167
+ orangered: "ff4500",
1168
+ orchid: "da70d6",
1169
+ palegoldenrod: "eee8aa",
1170
+ palegreen: "98fb98",
1171
+ paleturquoise: "afeeee",
1172
+ palevioletred: "db7093",
1173
+ papayawhip: "ffefd5",
1174
+ peachpuff: "ffdab9",
1175
+ peru: "cd853f",
1176
+ pink: "ffc0cb",
1177
+ plum: "dda0dd",
1178
+ powderblue: "b0e0e6",
1179
+ purple: "800080",
1180
+ rebeccapurple: "639",
1181
+ red: "f00",
1182
+ rosybrown: "bc8f8f",
1183
+ royalblue: "4169e1",
1184
+ saddlebrown: "8b4513",
1185
+ salmon: "fa8072",
1186
+ sandybrown: "f4a460",
1187
+ seagreen: "2e8b57",
1188
+ seashell: "fff5ee",
1189
+ sienna: "a0522d",
1190
+ silver: "c0c0c0",
1191
+ skyblue: "87ceeb",
1192
+ slateblue: "6a5acd",
1193
+ slategray: "708090",
1194
+ slategrey: "708090",
1195
+ snow: "fffafa",
1196
+ springgreen: "00ff7f",
1197
+ steelblue: "4682b4",
1198
+ tan: "d2b48c",
1199
+ teal: "008080",
1200
+ thistle: "d8bfd8",
1201
+ tomato: "ff6347",
1202
+ turquoise: "40e0d0",
1203
+ violet: "ee82ee",
1204
+ wheat: "f5deb3",
1205
+ white: "fff",
1206
+ whitesmoke: "f5f5f5",
1207
+ yellow: "ff0",
1208
+ yellowgreen: "9acd32"
1209
+ };
1210
+ function nameToHex(color) {
1211
+ if (typeof color !== "string") return color;
1212
+ var normalizedColorName = color.toLowerCase();
1213
+ return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
1214
+ }
1215
+ var hexRegex = /^#[a-fA-F0-9]{6}$/;
1216
+ var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
1217
+ var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
1218
+ var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
1219
+ var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
1220
+ var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
1221
+ var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
1222
+ var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
1223
+ function parseToRgb(color) {
1224
+ if (typeof color !== "string") {
1225
+ throw new PolishedError(3);
1226
+ }
1227
+ var normalizedColor = nameToHex(color);
1228
+ if (normalizedColor.match(hexRegex)) {
1229
+ return {
1230
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
1231
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
1232
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
1233
+ };
1234
+ }
1235
+ if (normalizedColor.match(hexRgbaRegex)) {
1236
+ var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
1237
+ return {
1238
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
1239
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
1240
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
1241
+ alpha
1242
+ };
1243
+ }
1244
+ if (normalizedColor.match(reducedHexRegex)) {
1245
+ return {
1246
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
1247
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
1248
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
1249
+ };
1250
+ }
1251
+ if (normalizedColor.match(reducedRgbaHexRegex)) {
1252
+ var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
1253
+ return {
1254
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
1255
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
1256
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
1257
+ alpha: _alpha
1258
+ };
1259
+ }
1260
+ var rgbMatched = rgbRegex.exec(normalizedColor);
1261
+ if (rgbMatched) {
1262
+ return {
1263
+ red: parseInt("" + rgbMatched[1], 10),
1264
+ green: parseInt("" + rgbMatched[2], 10),
1265
+ blue: parseInt("" + rgbMatched[3], 10)
1266
+ };
1267
+ }
1268
+ var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
1269
+ if (rgbaMatched) {
1270
+ return {
1271
+ red: parseInt("" + rgbaMatched[1], 10),
1272
+ green: parseInt("" + rgbaMatched[2], 10),
1273
+ blue: parseInt("" + rgbaMatched[3], 10),
1274
+ alpha: parseFloat("" + rgbaMatched[4])
1275
+ };
1276
+ }
1277
+ var hslMatched = hslRegex.exec(normalizedColor);
1278
+ if (hslMatched) {
1279
+ var hue = parseInt("" + hslMatched[1], 10);
1280
+ var saturation = parseInt("" + hslMatched[2], 10) / 100;
1281
+ var lightness = parseInt("" + hslMatched[3], 10) / 100;
1282
+ var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
1283
+ var hslRgbMatched = rgbRegex.exec(rgbColorString);
1284
+ if (!hslRgbMatched) {
1285
+ throw new PolishedError(4, normalizedColor, rgbColorString);
1286
+ }
1287
+ return {
1288
+ red: parseInt("" + hslRgbMatched[1], 10),
1289
+ green: parseInt("" + hslRgbMatched[2], 10),
1290
+ blue: parseInt("" + hslRgbMatched[3], 10)
1291
+ };
1292
+ }
1293
+ var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
1294
+ if (hslaMatched) {
1295
+ var _hue = parseInt("" + hslaMatched[1], 10);
1296
+ var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
1297
+ var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
1298
+ var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
1299
+ var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
1300
+ if (!_hslRgbMatched) {
1301
+ throw new PolishedError(4, normalizedColor, _rgbColorString);
1302
+ }
1303
+ return {
1304
+ red: parseInt("" + _hslRgbMatched[1], 10),
1305
+ green: parseInt("" + _hslRgbMatched[2], 10),
1306
+ blue: parseInt("" + _hslRgbMatched[3], 10),
1307
+ alpha: parseFloat("" + hslaMatched[4])
1308
+ };
1309
+ }
1310
+ throw new PolishedError(5);
1311
+ }
1312
+ var reduceHexValue = function reduceHexValue2(value) {
1313
+ if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
1314
+ return "#" + value[1] + value[3] + value[5];
1315
+ }
1316
+ return value;
1317
+ };
1318
+ function numberToHex(value) {
1319
+ var hex = value.toString(16);
1320
+ return hex.length === 1 ? "0" + hex : hex;
1321
+ }
1322
+ function rgb(value, green, blue) {
1323
+ if (typeof value === "number" && typeof green === "number" && typeof blue === "number") {
1324
+ return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
1325
+ } else if (typeof value === "object" && green === void 0 && blue === void 0) {
1326
+ return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
1327
+ }
1328
+ throw new PolishedError(6);
1329
+ }
1330
+ function rgba(firstValue, secondValue, thirdValue, fourthValue) {
1331
+ if (typeof firstValue === "string" && typeof secondValue === "number") {
1332
+ var rgbValue = parseToRgb(firstValue);
1333
+ return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
1334
+ } else if (typeof firstValue === "number" && typeof secondValue === "number" && typeof thirdValue === "number" && typeof fourthValue === "number") {
1335
+ return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
1336
+ } else if (typeof firstValue === "object" && secondValue === void 0 && thirdValue === void 0 && fourthValue === void 0) {
1337
+ return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
1338
+ }
1339
+ throw new PolishedError(7);
1340
+ }
1341
+ function curried(f, length, acc) {
1342
+ return function fn() {
1343
+ var combined = acc.concat(Array.prototype.slice.call(arguments));
1344
+ return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
1345
+ };
1346
+ }
1347
+ function curry(f) {
1348
+ return curried(f, f.length, []);
1349
+ }
1350
+ function guard(lowerBoundary, upperBoundary, value) {
1351
+ return Math.max(lowerBoundary, Math.min(upperBoundary, value));
1352
+ }
1353
+ function transparentize(amount, color) {
1354
+ if (color === "transparent") return color;
1355
+ var parsedColor = parseToRgb(color);
1356
+ var alpha = typeof parsedColor.alpha === "number" ? parsedColor.alpha : 1;
1357
+ var colorWithAlpha = _extends({}, parsedColor, {
1358
+ alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
1359
+ });
1360
+ return rgba(colorWithAlpha);
1361
+ }
1362
+ var curriedTransparentize = /* @__PURE__ */ curry(transparentize);
1363
+
1364
+ // ../seeds-react-mixins/dist/esm/index.js
1365
+ var import_styled_components7 = require("styled-components");
1366
+ var import_seeds_react_theme = require("@sproutsocial/seeds-react-theme");
1367
+ var visuallyHidden = import_styled_components7.css`
1368
+ position: absolute;
1369
+ width: 1px;
1370
+ height: 1px;
1371
+ padding: 0;
1372
+ margin: -1px;
1373
+ overflow: hidden;
1374
+ clip: rect(0 0 0 0);
1375
+ border: 0;
1376
+ `;
1377
+ var focusRing = import_styled_components7.css`
1378
+ box-shadow: 0 0 0 1px ${import_seeds_react_theme.theme.colors.button.primary.background.base},
1379
+ 0 0px 0px 4px
1380
+ ${curriedTransparentize(0.7, import_seeds_react_theme.theme.colors.button.primary.background.base)};
1381
+ outline: none;
1382
+
1383
+ &::-moz-focus-inner {
1384
+ border: 0;
1385
+ }
1386
+ `;
1387
+ var pill = import_styled_components7.css`
1388
+ min-width: ${import_seeds_react_theme.theme.space[600]};
1389
+ min-height: ${import_seeds_react_theme.theme.space[600]};
1390
+ padding: ${import_seeds_react_theme.theme.space[300]};
1391
+ border-radius: ${import_seeds_react_theme.theme.radii.pill};
1392
+ `;
1393
+ var disabled = import_styled_components7.css`
1394
+ opacity: 0.4;
1395
+ pointer-events: none;
1396
+ `;
1397
+
1398
+ // src/v2/components/ModalAction.tsx
1399
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1400
+ var RailButton = import_styled_components8.default.button`
1401
+ width: ${RAIL_BUTTON_SIZE}px;
1402
+ height: ${(props) => props.theme.space[500]};
658
1403
  display: inline-grid;
659
1404
  place-items: center;
660
- border-radius: 8px;
1405
+ border-radius: ${(props) => props.theme.radii.outer};
661
1406
  border: none;
662
- background: rgba(22, 32, 32, 0.56);
663
- color: #ffffff;
1407
+ background: ${(props) => props.theme.colors.button.overlay.background.base};
1408
+ color: ${(props) => props.theme.colors.button.overlay.text.base};
664
1409
  cursor: pointer;
665
1410
  outline: none;
666
- transition: all 0.2s ease;
1411
+ transition: all ${(props) => props.theme.duration.fast}
1412
+ ${(props) => props.theme.easing.ease_inout};
667
1413
 
668
1414
  &:hover {
669
- background: rgba(22, 32, 32, 0.7);
670
- transform: translateY(-1px);
1415
+ background: ${(props) => props.theme.colors.button.overlay.background.hover};
671
1416
  }
672
1417
 
1418
+ &:hover,
673
1419
  &:active {
674
- transform: translateY(0);
1420
+ transform: none;
675
1421
  }
676
1422
 
677
1423
  &:focus-visible {
678
- box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #205bc3;
1424
+ ${focusRing}
679
1425
  }
680
1426
 
681
1427
  &:disabled {
@@ -683,171 +1429,65 @@ var RailBtn = import_styled_components4.default.button`
683
1429
  cursor: not-allowed;
684
1430
  }
685
1431
  `;
686
- var ModalRail = ({
687
- side = "right",
688
- offset = 12,
689
- gap = 12,
690
- size = 44,
691
- children
692
- }) => {
693
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
694
- Rail,
695
- {
696
- "data-slot": "modal-rail",
697
- side,
698
- offset,
699
- gap,
700
- size,
701
- "aria-label": "Modal quick actions",
702
- children: React11.Children.map(
703
- children,
704
- (child) => React11.isValidElement(child) ? React11.cloneElement(child, { size }) : child
705
- )
706
- }
707
- );
708
- };
709
1432
  var ModalAction = ({
710
1433
  "aria-label": ariaLabel,
711
1434
  iconName,
712
- disabled,
713
- size = 44,
1435
+ disabled: disabled2,
714
1436
  actionType,
715
1437
  onClick,
716
1438
  ...rest
717
1439
  }) => {
718
- const Btn = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
719
- RailBtn,
1440
+ const button = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1441
+ RailButton,
720
1442
  {
721
- size,
722
1443
  "aria-label": ariaLabel,
723
1444
  title: ariaLabel,
724
- disabled,
1445
+ disabled: disabled2,
1446
+ onClick,
725
1447
  ...rest,
726
- children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_seeds_react_icon3.default, { name: iconName, size: "small" }) : ariaLabel
1448
+ children: iconName && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_seeds_react_icon2.default, { name: iconName, size: "small", "aria-label": ariaLabel })
727
1449
  }
728
1450
  );
729
- return actionType === "close" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog7.Close, { asChild: true, children: Btn }) : React11.cloneElement(Btn, { onClick });
1451
+ if (actionType === "close") {
1452
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog5.Close, { asChild: true, children: button });
1453
+ }
1454
+ return button;
730
1455
  };
1456
+ ModalAction.displayName = "ModalAction";
1457
+
1458
+ // src/v2/components/ModalOverlay.tsx
1459
+ var import_react4 = require("react");
1460
+ var import_styled_components9 = __toESM(require("styled-components"));
1461
+ var import_react5 = require("motion/react");
1462
+ var import_seeds_react_system_props6 = require("@sproutsocial/seeds-react-system-props");
1463
+ var StyledMotionOverlay = (0, import_styled_components9.default)(import_react5.motion.div)`
1464
+ position: fixed;
1465
+ top: 0px;
1466
+ left: 0px;
1467
+ right: 0px;
1468
+ bottom: 0px;
1469
+ `;
1470
+ var StyledOverlay = import_styled_components9.default.div.withConfig({
1471
+ shouldForwardProp: (prop) => !["allowInteraction"].includes(prop)
1472
+ })`
1473
+ width: 100%;
1474
+ height: 100%;
1475
+ background-color: ${(props) => props.theme.colors.overlay.background.base};
731
1476
 
732
- // src/v2/ModalV2.tsx
1477
+ /* Allow clicking through overlay when modal is draggable */
1478
+ ${(props) => props.allowInteraction && `
1479
+ pointer-events: none;
1480
+ `}
1481
+
1482
+ ${import_seeds_react_system_props6.COMMON}
1483
+ ${import_seeds_react_system_props6.BORDER}
1484
+ ${import_seeds_react_system_props6.LAYOUT}
1485
+ ${import_seeds_react_system_props6.POSITION}
1486
+ `;
1487
+ StyledOverlay.displayName = "ModalOverlay";
1488
+
1489
+ // src/v2/Modal.tsx
733
1490
  var import_jsx_runtime11 = require("react/jsx-runtime");
734
- var DragContext = React12.createContext(null);
735
- var useDragContext = () => {
736
- const context = React12.useContext(DragContext);
737
- return context;
738
- };
739
- var DraggableModalContent = ({
740
- children,
741
- computedWidth,
742
- bg,
743
- computedZIndex,
744
- label,
745
- dataAttributes,
746
- draggable,
747
- rest,
748
- railProps
749
- }) => {
750
- const [position, setPosition] = React12.useState({ x: 0, y: 0 });
751
- const [isDragging, setIsDragging] = React12.useState(false);
752
- const contentRef = React12.useRef(null);
753
- const railSize = railProps?.size ?? 44;
754
- const railOffset = railProps?.offset ?? 12;
755
- const railSide = railProps?.side ?? "right";
756
- const railExtraSpace = railSize + railOffset;
757
- const handleHeaderMouseDown = React12.useCallback(
758
- (e) => {
759
- if (!draggable) return;
760
- const target = e.target;
761
- if (target.tagName === "BUTTON" || target.tagName === "INPUT" || target.closest("button")) {
762
- return;
763
- }
764
- e.preventDefault();
765
- setIsDragging(true);
766
- const rect = contentRef.current?.getBoundingClientRect();
767
- if (!rect) return;
768
- const offsetX = e.clientX - rect.left;
769
- const offsetY = e.clientY - rect.top;
770
- const handleMouseMove = (e2) => {
771
- e2.preventDefault();
772
- const newX = e2.clientX - offsetX;
773
- const newY = e2.clientY - offsetY;
774
- const isRailOnSide = window.innerWidth > 400;
775
- const modalWidth = rect.width;
776
- const modalHeight = rect.height;
777
- let maxX = window.innerWidth - modalWidth;
778
- let minX = 0;
779
- let maxY = window.innerHeight - modalHeight;
780
- let minY = 0;
781
- if (isRailOnSide) {
782
- if (railSide === "right") {
783
- maxX = window.innerWidth - modalWidth - railExtraSpace;
784
- } else {
785
- minX = railExtraSpace;
786
- }
787
- } else {
788
- minY = railSize + railOffset;
789
- }
790
- const constrainedX = Math.max(minX, Math.min(maxX, newX));
791
- const constrainedY = Math.max(minY, Math.min(maxY, newY));
792
- const centerX = window.innerWidth / 2 - modalWidth / 2;
793
- const centerY = window.innerHeight / 2 - modalHeight / 2;
794
- setPosition({
795
- x: constrainedX - centerX,
796
- y: constrainedY - centerY
797
- });
798
- };
799
- const handleMouseUp = () => {
800
- setIsDragging(false);
801
- document.removeEventListener("mousemove", handleMouseMove);
802
- document.removeEventListener("mouseup", handleMouseUp);
803
- };
804
- document.addEventListener("mousemove", handleMouseMove);
805
- document.addEventListener("mouseup", handleMouseUp);
806
- },
807
- [draggable, railSide, railExtraSpace]
808
- );
809
- const dragContextValue = React12.useMemo(
810
- () => ({
811
- position,
812
- isDragging,
813
- onHeaderMouseDown: handleHeaderMouseDown,
814
- contentRef,
815
- draggable: draggable ?? false
816
- }),
817
- [position, isDragging, handleHeaderMouseDown, draggable]
818
- );
819
- const handleInteractOutside = React12.useCallback(
820
- (e) => {
821
- if (draggable) {
822
- e.preventDefault();
823
- }
824
- },
825
- [draggable]
826
- );
827
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DragContext.Provider, { value: draggable ? dragContextValue : null, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
828
- StyledContent,
829
- {
830
- ref: contentRef,
831
- width: computedWidth,
832
- bg,
833
- zIndex: computedZIndex,
834
- "aria-label": label,
835
- draggable,
836
- isDragging,
837
- railSize,
838
- railOffset,
839
- railSide,
840
- onInteractOutside: handleInteractOutside,
841
- style: draggable ? {
842
- transform: `translate(calc(-50% + ${position.x}px), calc(-50% + ${position.y}px))`,
843
- transition: isDragging ? "none" : void 0
844
- } : void 0,
845
- ...dataAttributes,
846
- ...rest,
847
- children
848
- }
849
- ) });
850
- };
851
1491
  var Modal2 = (props) => {
852
1492
  const {
853
1493
  children,
@@ -860,37 +1500,21 @@ var Modal2 = (props) => {
860
1500
  title,
861
1501
  subtitle,
862
1502
  description,
863
- size,
864
- priority,
865
1503
  data = {},
866
- bg = DEFAULT_MODAL_BG,
867
1504
  showOverlay = true,
868
1505
  actions,
869
- railProps,
1506
+ closeButtonAriaLabel = "Close",
870
1507
  ...rest
871
1508
  } = props;
872
- const handleOpenChange = React12.useCallback(
1509
+ const [isOpen, setIsOpen] = React13.useState(defaultOpen ?? false);
1510
+ const handleOpenChange = React13.useCallback(
873
1511
  (newOpen) => {
1512
+ setIsOpen(newOpen);
874
1513
  onOpenChange?.(newOpen);
875
1514
  },
876
1515
  [onOpenChange]
877
1516
  );
878
- const computedWidth = React12.useMemo(() => {
879
- if (size) {
880
- if (typeof size === "string" && size in MODAL_SIZE_PRESETS) {
881
- return MODAL_SIZE_PRESETS[size];
882
- }
883
- return size;
884
- }
885
- return DEFAULT_MODAL_WIDTH;
886
- }, [size]);
887
- const computedZIndex = React12.useMemo(() => {
888
- if (priority) {
889
- return MODAL_PRIORITY_Z_INDEX[priority];
890
- }
891
- return DEFAULT_MODAL_Z_INDEX;
892
- }, [priority]);
893
- const dataAttributes = React12.useMemo(() => {
1517
+ const dataAttributes = React13.useMemo(() => {
894
1518
  const attrs = {};
895
1519
  Object.entries(data).forEach(([key, value]) => {
896
1520
  attrs[`data-${key}`] = String(value);
@@ -902,76 +1526,60 @@ var Modal2 = (props) => {
902
1526
  return attrs;
903
1527
  }, [data, open]);
904
1528
  const shouldRenderHeader = Boolean(title || subtitle);
905
- const dialogRootProps = React12.useMemo(() => {
906
- const props2 = {};
907
- if (open !== void 0) {
908
- props2.open = open;
909
- } else if (defaultOpen !== void 0) {
910
- props2.defaultOpen = defaultOpen;
911
- } else {
912
- props2.defaultOpen = false;
913
- }
914
- if (onOpenChange) {
915
- props2.onOpenChange = handleOpenChange;
916
- }
917
- if (draggable) {
918
- props2.modal = false;
1529
+ const isMobile = useIsMobile();
1530
+ const overlayVariants = getOverlayVariants(isMobile);
1531
+ const ModalContentComponent = draggable ? DraggableModalContent : StaticModalContent;
1532
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1533
+ Dialog6.Root,
1534
+ {
1535
+ open,
1536
+ defaultOpen,
1537
+ onOpenChange: handleOpenChange,
1538
+ modal: !draggable,
1539
+ children: [
1540
+ modalTrigger && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog6.Trigger, { asChild: true, children: modalTrigger }),
1541
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog6.Portal, { forceMount: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react6.AnimatePresence, { mode: "wait", children: (open ?? isOpen) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1542
+ showOverlay && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog6.Overlay, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1543
+ StyledMotionOverlay,
1544
+ {
1545
+ variants: overlayVariants,
1546
+ initial: "initial",
1547
+ animate: "animate",
1548
+ exit: "exit",
1549
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledOverlay, { allowInteraction: draggable })
1550
+ }
1551
+ ) }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1553
+ ModalContentComponent,
1554
+ {
1555
+ label,
1556
+ dataAttributes,
1557
+ draggable,
1558
+ rest,
1559
+ children: [
1560
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(ModalRail, { children: [
1561
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1562
+ ModalAction,
1563
+ {
1564
+ actionType: "close",
1565
+ "aria-label": closeButtonAriaLabel,
1566
+ iconName: "x-outline"
1567
+ }
1568
+ ),
1569
+ actions?.map((action, idx) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalAction, { ...action }, idx))
1570
+ ] }),
1571
+ shouldRenderHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalHeader2, { title, subtitle }),
1572
+ description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalDescription, { children: description }),
1573
+ children
1574
+ ]
1575
+ }
1576
+ )
1577
+ ] }) }) })
1578
+ ]
919
1579
  }
920
- return props2;
921
- }, [open, defaultOpen, handleOpenChange, onOpenChange, draggable]);
922
- const triggers = [];
923
- const content = [];
924
- if (modalTrigger) {
925
- triggers.push(
926
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog8.Trigger, { asChild: true, children: modalTrigger }, "modal-trigger")
927
- );
928
- content.push(children);
929
- } else {
930
- React12.Children.forEach(children, (child) => {
931
- if (React12.isValidElement(child) && child.type === ModalTrigger) {
932
- triggers.push(child);
933
- } else {
934
- content.push(child);
935
- }
936
- });
937
- }
938
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Dialog8.Root, { ...dialogRootProps, children: [
939
- triggers,
940
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Dialog8.Portal, { children: [
941
- showOverlay && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledOverlay, { zIndex: computedZIndex, allowInteraction: draggable }),
942
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
943
- DraggableModalContent,
944
- {
945
- computedWidth,
946
- bg,
947
- computedZIndex,
948
- label,
949
- dataAttributes,
950
- draggable,
951
- rest,
952
- railProps,
953
- children: [
954
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(ModalRail, { ...railProps, children: [
955
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
956
- ModalAction,
957
- {
958
- actionType: "close",
959
- "aria-label": "Close",
960
- iconName: "x-outline"
961
- }
962
- ),
963
- actions?.map((action, idx) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalAction, { ...action }, idx))
964
- ] }),
965
- shouldRenderHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalHeader2, { title, subtitle }),
966
- description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ModalDescription, { children: description }),
967
- content
968
- ]
969
- }
970
- )
971
- ] })
972
- ] });
1580
+ );
973
1581
  };
974
- var ModalV2_default = Modal2;
1582
+ var Modal_default2 = Modal2;
975
1583
 
976
1584
  // src/index.ts
977
1585
  var src_default = v1_default;
@@ -979,14 +1587,14 @@ var src_default = v1_default;
979
1587
  0 && (module.exports = {
980
1588
  Modal,
981
1589
  ModalAction,
982
- ModalClose,
983
- ModalCloseButton,
984
- ModalContent,
1590
+ ModalBody,
1591
+ ModalCloseWrapper,
1592
+ ModalCustomFooter,
1593
+ ModalCustomHeader,
985
1594
  ModalDescription,
986
1595
  ModalFooter,
987
1596
  ModalHeader,
988
1597
  ModalRail,
989
- ModalTrigger,
990
1598
  ModalV2
991
1599
  });
992
1600
  //# sourceMappingURL=index.js.map