@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
@@ -0,0 +1,1353 @@
1
+ // src/v2/Modal.tsx
2
+ import * as React11 from "react";
3
+ import * as Dialog6 from "@radix-ui/react-dialog";
4
+ import { AnimatePresence } from "motion/react";
5
+
6
+ // src/v2/components/ModalHeader.tsx
7
+ import "react";
8
+ import * as Dialog2 from "@radix-ui/react-dialog";
9
+ import styled2 from "styled-components";
10
+ import Box from "@sproutsocial/seeds-react-box";
11
+ import Text from "@sproutsocial/seeds-react-text";
12
+ import {
13
+ COMMON as COMMON2,
14
+ FLEXBOX as FLEXBOX2,
15
+ BORDER as BORDER2,
16
+ LAYOUT as LAYOUT2
17
+ } from "@sproutsocial/seeds-react-system-props";
18
+
19
+ // src/v2/components/ModalContent.tsx
20
+ import * as React2 from "react";
21
+ import * as Dialog from "@radix-ui/react-dialog";
22
+ import { motion } from "motion/react";
23
+ import styled from "styled-components";
24
+
25
+ // src/shared/constants.ts
26
+ var DEFAULT_MODAL_WIDTH = "600px";
27
+ var DEFAULT_MODAL_BG = "container.background.base";
28
+ var BODY_PADDING = "64px";
29
+ var MODAL_SIZE_PRESETS = {
30
+ small: "400px",
31
+ medium: "600px",
32
+ large: "800px",
33
+ full: "90vw"
34
+ };
35
+ var MOBILE_BREAKPOINT = "780px";
36
+ var RAIL_BUTTON_SIZE = 44;
37
+ var RAIL_OFFSET = 12;
38
+ var RAIL_GAP = 12;
39
+ var RAIL_EXTRA_SPACE = RAIL_BUTTON_SIZE + RAIL_OFFSET;
40
+
41
+ // src/v2/components/ModalContent.tsx
42
+ import {
43
+ COMMON,
44
+ FLEXBOX,
45
+ BORDER,
46
+ LAYOUT
47
+ } from "@sproutsocial/seeds-react-system-props";
48
+
49
+ // src/v2/MotionConfig.ts
50
+ import * as React from "react";
51
+ var DURATION_MOBILE = 0.6;
52
+ var DURATION_DESKTOP = 0.3;
53
+ var desktopTransition = {
54
+ duration: DURATION_DESKTOP,
55
+ ease: "easeInOut"
56
+ };
57
+ var mobileTransition = {
58
+ duration: DURATION_MOBILE,
59
+ ease: "easeInOut"
60
+ };
61
+ var desktopModalVariants = {
62
+ initial: {
63
+ opacity: 0,
64
+ scale: 0.95,
65
+ x: "-50%",
66
+ y: "-50%",
67
+ transition: desktopTransition
68
+ },
69
+ animate: {
70
+ opacity: 1,
71
+ scale: 1,
72
+ x: "-50%",
73
+ y: "-50%",
74
+ transition: desktopTransition
75
+ },
76
+ exit: {
77
+ opacity: 0,
78
+ scale: 0.95,
79
+ x: "-50%",
80
+ y: "-50%",
81
+ transition: desktopTransition
82
+ }
83
+ };
84
+ var desktopOverlayVariants = {
85
+ initial: {
86
+ opacity: 0,
87
+ transition: desktopTransition
88
+ },
89
+ animate: {
90
+ opacity: 1,
91
+ transition: desktopTransition
92
+ },
93
+ exit: {
94
+ opacity: 0,
95
+ transition: desktopTransition
96
+ }
97
+ };
98
+ var mobileDrawerVariants = {
99
+ initial: {
100
+ opacity: 0,
101
+ x: "-50%",
102
+ y: "100%",
103
+ transition: mobileTransition
104
+ },
105
+ animate: {
106
+ opacity: 1,
107
+ x: "-50%",
108
+ y: 0,
109
+ transition: mobileTransition
110
+ },
111
+ exit: {
112
+ opacity: 0,
113
+ x: "-50%",
114
+ y: "100%",
115
+ transition: mobileTransition
116
+ }
117
+ };
118
+ var mobileOverlayVariants = {
119
+ initial: {
120
+ opacity: 0,
121
+ transition: mobileTransition
122
+ },
123
+ animate: {
124
+ opacity: 1,
125
+ transition: mobileTransition
126
+ },
127
+ exit: {
128
+ opacity: 0,
129
+ transition: mobileTransition
130
+ }
131
+ };
132
+ var draggableModalVariants = {
133
+ initial: {
134
+ opacity: 0,
135
+ transition: desktopTransition
136
+ },
137
+ animate: {
138
+ opacity: 1,
139
+ transition: desktopTransition
140
+ },
141
+ exit: {
142
+ opacity: 0,
143
+ transition: desktopTransition
144
+ }
145
+ };
146
+ function getContentVariants(isMobile, isDraggable) {
147
+ if (isDraggable) {
148
+ return draggableModalVariants;
149
+ }
150
+ return isMobile ? mobileDrawerVariants : desktopModalVariants;
151
+ }
152
+ function getOverlayVariants(isMobile) {
153
+ return isMobile ? mobileOverlayVariants : desktopOverlayVariants;
154
+ }
155
+ function useIsMobile() {
156
+ const [isMobile, setIsMobile] = React.useState(() => {
157
+ if (typeof window === "undefined") return false;
158
+ return window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT})`).matches;
159
+ });
160
+ React.useEffect(() => {
161
+ if (typeof window === "undefined") return;
162
+ const mediaQuery = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT})`);
163
+ const handler = (e) => setIsMobile(e.matches);
164
+ if (mediaQuery.addEventListener) {
165
+ mediaQuery.addEventListener("change", handler);
166
+ return () => mediaQuery.removeEventListener("change", handler);
167
+ } else if (mediaQuery.addListener) {
168
+ mediaQuery.addListener(handler);
169
+ return () => mediaQuery.removeListener(handler);
170
+ }
171
+ }, []);
172
+ return isMobile;
173
+ }
174
+
175
+ // src/v2/components/ModalContent.tsx
176
+ import { jsx } from "react/jsx-runtime";
177
+ var StyledMotionWrapper = styled(motion.div)`
178
+ position: fixed;
179
+ top: ${(props) => props.$isMobile ? "auto" : "50%"};
180
+ left: 50%;
181
+ bottom: ${(props) => props.$isMobile ? 0 : "auto"};
182
+ `;
183
+ var StyledContent = styled.div.withConfig({
184
+ shouldForwardProp: (prop) => !["isDragging", "draggable"].includes(prop)
185
+ })`
186
+ display: flex;
187
+ flex-direction: column;
188
+ border-radius: ${(props) => props.theme.radii[800]};
189
+ box-shadow: ${(props) => props.theme.shadows.high};
190
+ filter: blur(0);
191
+ background-color: ${(props) => props.theme.colors.container.background.base};
192
+ color: ${(props) => props.theme.colors.text.body};
193
+ outline: none;
194
+ width: ${DEFAULT_MODAL_WIDTH};
195
+ max-width: ${(props) => {
196
+ return `calc(100vw - ${BODY_PADDING} - ${RAIL_EXTRA_SPACE}px)`;
197
+ }};
198
+ max-height: calc(100vh - ${BODY_PADDING});
199
+
200
+ /* Mobile styles for viewport <= ${MOBILE_BREAKPOINT} */
201
+ @media (max-width: ${MOBILE_BREAKPOINT}) {
202
+ /* Full viewport width - edge to edge */
203
+ width: 100vw;
204
+ max-width: 100vw;
205
+ min-width: 100vw;
206
+
207
+ /* Height hugs content, with increased max-height to get closer to top */
208
+ /* Subtract space for rail + comfortable gap (44px rail + ~40px gap) */
209
+ height: auto;
210
+ max-height: calc(95vh - 84px);
211
+
212
+ /* Adjust border radius for mobile - rounded top, flat bottom to blend with device */
213
+ border-top-left-radius: ${(props) => props.theme.radii[800]};
214
+ border-top-right-radius: ${(props) => props.theme.radii[800]};
215
+ border-bottom-left-radius: 0;
216
+ border-bottom-right-radius: 0;
217
+
218
+ /* Mobile shadow - appears to cast upward (high-reverse) */
219
+ box-shadow: 0px -16px 32px 0px rgba(39, 51, 51, 0.24);
220
+ }
221
+
222
+ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
223
+ height: calc(100vh - ${BODY_PADDING});
224
+ }
225
+
226
+ ${COMMON}
227
+ ${FLEXBOX}
228
+ ${BORDER}
229
+ ${LAYOUT}
230
+ `;
231
+ StyledContent.displayName = "ModalContent";
232
+ var DragContext = React2.createContext(null);
233
+ var useDragContext = () => {
234
+ const context = React2.useContext(DragContext);
235
+ return context;
236
+ };
237
+ var StaticModalContent = ({
238
+ children,
239
+ label,
240
+ dataAttributes,
241
+ rest
242
+ }) => {
243
+ const isMobile = useIsMobile();
244
+ const contentVariants = getContentVariants(isMobile, false);
245
+ return /* @__PURE__ */ jsx(DragContext.Provider, { value: null, children: /* @__PURE__ */ jsx(Dialog.Content, { asChild: true, "aria-label": label, children: /* @__PURE__ */ jsx(
246
+ StyledMotionWrapper,
247
+ {
248
+ $isMobile: isMobile,
249
+ variants: contentVariants,
250
+ initial: "initial",
251
+ animate: "animate",
252
+ exit: "exit",
253
+ children: /* @__PURE__ */ jsx(StyledContent, { draggable: false, ...dataAttributes, ...rest, children })
254
+ }
255
+ ) }) });
256
+ };
257
+ var DraggableModalContent = ({
258
+ children,
259
+ label,
260
+ dataAttributes,
261
+ rest
262
+ }) => {
263
+ const [position, setPosition] = React2.useState({ x: 0, y: 0 });
264
+ const [isDragging, setIsDragging] = React2.useState(false);
265
+ const contentRef = React2.useRef(null);
266
+ const isMobile = useIsMobile();
267
+ const handleHeaderMouseDown = React2.useCallback((e) => {
268
+ const target = e.target;
269
+ if (target.tagName === "BUTTON" || target.tagName === "INPUT" || target.closest("button")) {
270
+ return;
271
+ }
272
+ e.preventDefault();
273
+ setIsDragging(true);
274
+ const rect = contentRef.current?.getBoundingClientRect();
275
+ if (!rect) return;
276
+ const offsetX = e.clientX - rect.left;
277
+ const offsetY = e.clientY - rect.top;
278
+ const handleMouseMove = (e2) => {
279
+ e2.preventDefault();
280
+ const newX = e2.clientX - offsetX;
281
+ const newY = e2.clientY - offsetY;
282
+ const isRailOnSide = window.innerWidth > 780;
283
+ const modalWidth = rect.width;
284
+ const modalHeight = rect.height;
285
+ let maxX = window.innerWidth - modalWidth;
286
+ let minX = 0;
287
+ let maxY = window.innerHeight - modalHeight;
288
+ let minY = 0;
289
+ if (isRailOnSide) {
290
+ maxX = window.innerWidth - modalWidth - RAIL_EXTRA_SPACE;
291
+ } else {
292
+ minY = RAIL_BUTTON_SIZE + RAIL_OFFSET;
293
+ }
294
+ const constrainedX = Math.max(minX, Math.min(maxX, newX));
295
+ const constrainedY = Math.max(minY, Math.min(maxY, newY));
296
+ const centerX = window.innerWidth / 2 - modalWidth / 2;
297
+ const centerY = window.innerHeight / 2 - modalHeight / 2;
298
+ setPosition({
299
+ x: constrainedX - centerX,
300
+ y: constrainedY - centerY
301
+ });
302
+ };
303
+ const handleMouseUp = () => {
304
+ setIsDragging(false);
305
+ document.removeEventListener("mousemove", handleMouseMove);
306
+ document.removeEventListener("mouseup", handleMouseUp);
307
+ };
308
+ document.addEventListener("mousemove", handleMouseMove);
309
+ document.addEventListener("mouseup", handleMouseUp);
310
+ }, []);
311
+ const dragContextValue = React2.useMemo(
312
+ () => ({
313
+ position,
314
+ isDragging,
315
+ onHeaderMouseDown: handleHeaderMouseDown,
316
+ contentRef,
317
+ draggable: true
318
+ }),
319
+ [position, isDragging, handleHeaderMouseDown]
320
+ );
321
+ const handleInteractOutside = React2.useCallback((e) => {
322
+ e.preventDefault();
323
+ }, []);
324
+ const contentVariants = getContentVariants(isMobile, true);
325
+ return /* @__PURE__ */ jsx(DragContext.Provider, { value: dragContextValue, children: /* @__PURE__ */ jsx(
326
+ Dialog.Content,
327
+ {
328
+ asChild: true,
329
+ "aria-label": label,
330
+ onInteractOutside: handleInteractOutside,
331
+ children: /* @__PURE__ */ jsx(
332
+ StyledMotionWrapper,
333
+ {
334
+ $isMobile: isMobile,
335
+ variants: contentVariants,
336
+ initial: "initial",
337
+ animate: "animate",
338
+ exit: "exit",
339
+ style: {
340
+ // Apply drag offset transforms
341
+ // For draggable modals, variants only handle opacity, so we apply transforms here
342
+ // Combined with top: 50%, left: 50%, these create the centering + drag offset
343
+ x: `calc(-50% + ${position.x}px)`,
344
+ y: `calc(-50% + ${position.y}px)`
345
+ },
346
+ children: /* @__PURE__ */ jsx(
347
+ StyledContent,
348
+ {
349
+ ref: contentRef,
350
+ draggable: true,
351
+ isDragging,
352
+ ...dataAttributes,
353
+ ...rest,
354
+ children
355
+ }
356
+ )
357
+ }
358
+ )
359
+ }
360
+ ) });
361
+ };
362
+
363
+ // src/v2/components/ModalHeader.tsx
364
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
365
+ var ModalCustomHeader = styled2(Box).withConfig({
366
+ shouldForwardProp: (prop) => !["draggable", "isDragging"].includes(prop)
367
+ })`
368
+ font-family: ${(props) => props.theme.fontFamily};
369
+ padding: ${(props) => props.theme.space[400]};
370
+ display: flex;
371
+ align-items: center;
372
+ justify-content: space-between;
373
+ flex: 0 0 auto;
374
+
375
+ /* Draggable cursor styling */
376
+ ${(props) => props.draggable && `
377
+ cursor: ${props.isDragging ? "grabbing" : "grab"};
378
+ user-select: none;
379
+ `}
380
+
381
+ ${COMMON2}
382
+ ${FLEXBOX2}
383
+ ${BORDER2}
384
+ ${LAYOUT2}
385
+ `;
386
+ ModalCustomHeader.displayName = "ModalCustomHeader";
387
+ var ModalHeader = (props) => {
388
+ const {
389
+ title,
390
+ subtitle,
391
+ titleProps = {},
392
+ subtitleProps = {},
393
+ ...rest
394
+ } = props;
395
+ const dragContext = useDragContext();
396
+ const isDraggable = dragContext?.draggable ?? false;
397
+ return /* @__PURE__ */ jsx2(
398
+ ModalCustomHeader,
399
+ {
400
+ ...rest,
401
+ onMouseDown: isDraggable ? dragContext?.onHeaderMouseDown : void 0,
402
+ draggable: isDraggable,
403
+ isDragging: dragContext?.isDragging,
404
+ children: /* @__PURE__ */ jsxs(Box, { children: [
405
+ title && /* @__PURE__ */ jsx2(Dialog2.Title, { asChild: true, ...titleProps, children: /* @__PURE__ */ jsx2(Text.Headline, { children: title }) }),
406
+ subtitle && /* @__PURE__ */ jsx2(Dialog2.Description, { asChild: true, ...subtitleProps, children: /* @__PURE__ */ jsx2(Text, { as: "div", fontSize: 200, children: subtitle }) })
407
+ ] })
408
+ }
409
+ );
410
+ };
411
+ ModalHeader.displayName = "ModalHeader";
412
+
413
+ // src/v2/components/ModalFooter.tsx
414
+ import "react";
415
+ import styled3 from "styled-components";
416
+ import Box2 from "@sproutsocial/seeds-react-box";
417
+ import {
418
+ COMMON as COMMON3,
419
+ FLEXBOX as FLEXBOX3,
420
+ BORDER as BORDER3,
421
+ LAYOUT as LAYOUT3
422
+ } from "@sproutsocial/seeds-react-system-props";
423
+
424
+ // src/v2/components/ModalCloseWrapper.tsx
425
+ import "react";
426
+ import * as Dialog3 from "@radix-ui/react-dialog";
427
+ import { jsx as jsx3 } from "react/jsx-runtime";
428
+ var ModalCloseWrapper = (props) => {
429
+ const { children, onClick, asChild = true, ...rest } = props;
430
+ const handleClick = (e) => {
431
+ onClick?.(e);
432
+ };
433
+ return /* @__PURE__ */ jsx3(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children });
434
+ };
435
+ ModalCloseWrapper.displayName = "ModalCloseWrapper";
436
+
437
+ // src/v2/components/ModalFooter.tsx
438
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
439
+ var ModalCustomFooter = styled3(Box2)`
440
+ flex: 0 0 auto;
441
+ font-family: ${(props) => props.theme.fontFamily};
442
+ background-color: ${(props) => props.theme.colors.container.background.base};
443
+ padding: ${(props) => props.theme.space[400]};
444
+ border-bottom-right-radius: ${(props) => props.theme.radii[800]};
445
+ border-bottom-left-radius: ${(props) => props.theme.radii[800]};
446
+ display: flex;
447
+ align-items: center;
448
+ justify-content: flex-end;
449
+ gap: ${(props) => props.theme.space[100]};
450
+
451
+ /* Flat bottom corners to blend with device edge on mobile */
452
+ @media (max-width: ${MOBILE_BREAKPOINT}) {
453
+ border-bottom-right-radius: 0;
454
+ border-bottom-left-radius: 0;
455
+ }
456
+
457
+ ${COMMON3}
458
+ ${FLEXBOX3}
459
+ ${BORDER3}
460
+ ${LAYOUT3}
461
+ `;
462
+ ModalCustomFooter.displayName = "ModalCustomFooter";
463
+ var ModalFooter = (props) => {
464
+ const { cancelButton, primaryButton, leftAction, ...rest } = props;
465
+ if (!cancelButton && !primaryButton && !leftAction) {
466
+ return null;
467
+ }
468
+ return /* @__PURE__ */ jsxs2(ModalCustomFooter, { ...rest, children: [
469
+ leftAction ? leftAction : null,
470
+ /* @__PURE__ */ jsxs2(Box2, { display: "flex", gap: 300, marginLeft: "auto", children: [
471
+ cancelButton && /* @__PURE__ */ jsx4(ModalCloseWrapper, { children: cancelButton }),
472
+ primaryButton && /* @__PURE__ */ jsx4(ModalCloseWrapper, { children: primaryButton })
473
+ ] })
474
+ ] });
475
+ };
476
+ ModalFooter.displayName = "ModalFooter";
477
+
478
+ // src/v2/components/ModalBody.tsx
479
+ import * as React6 from "react";
480
+ import styled4 from "styled-components";
481
+ import Box3 from "@sproutsocial/seeds-react-box";
482
+ import {
483
+ COMMON as COMMON4,
484
+ FLEXBOX as FLEXBOX4,
485
+ BORDER as BORDER4,
486
+ LAYOUT as LAYOUT4
487
+ } from "@sproutsocial/seeds-react-system-props";
488
+ import { jsx as jsx5 } from "react/jsx-runtime";
489
+ var StyledModalBody = styled4(Box3)`
490
+ font-family: ${(props) => props.theme.fontFamily};
491
+ overflow-y: auto;
492
+ flex: 1 1 auto;
493
+ padding: ${(props) => `0 ${props.theme.space[400]}`};
494
+ ${(props) => props.theme.typography[300]}
495
+ color: ${(props) => props.theme.colors.text.body};
496
+ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
497
+ flex-basis: 100%;
498
+ }
499
+
500
+ ${COMMON4}
501
+ ${FLEXBOX4}
502
+ ${BORDER4}
503
+ ${LAYOUT4}
504
+ `;
505
+ StyledModalBody.displayName = "ModalBody";
506
+ var ModalBody = React6.forwardRef(
507
+ ({ children, ...rest }, ref) => {
508
+ return /* @__PURE__ */ jsx5(StyledModalBody, { "data-qa-modal-body": true, ref, ...rest, children });
509
+ }
510
+ );
511
+ ModalBody.displayName = "ModalBody";
512
+
513
+ // src/v2/components/ModalDescription.tsx
514
+ import * as React7 from "react";
515
+ import * as Dialog4 from "@radix-ui/react-dialog";
516
+ import Box4 from "@sproutsocial/seeds-react-box";
517
+ import { jsx as jsx6 } from "react/jsx-runtime";
518
+ var ModalDescription = React7.forwardRef(({ children, descriptionProps = {}, ...rest }, ref) => {
519
+ return /* @__PURE__ */ jsx6(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ jsx6(Box4, { ref, ...rest, children }) });
520
+ });
521
+ ModalDescription.displayName = "ModalDescription";
522
+
523
+ // src/v2/components/ModalRail.tsx
524
+ import "react";
525
+ import styled5 from "styled-components";
526
+ import { jsx as jsx7 } from "react/jsx-runtime";
527
+ var Rail = styled5.div`
528
+ position: absolute;
529
+ top: ${RAIL_OFFSET}px;
530
+ right: calc(-1 * (${RAIL_BUTTON_SIZE}px + ${RAIL_OFFSET}px));
531
+ display: flex;
532
+ flex-direction: column;
533
+ gap: ${RAIL_GAP}px;
534
+ z-index: 1;
535
+
536
+ @media (max-width: ${MOBILE_BREAKPOINT}) {
537
+ /* Move rail above the modal on the right side */
538
+ top: auto;
539
+ bottom: calc(100% + ${RAIL_OFFSET}px);
540
+ right: ${RAIL_OFFSET}px;
541
+ left: auto;
542
+ /* Change to horizontal layout with reversed order */
543
+ flex-direction: row-reverse;
544
+ }
545
+ `;
546
+ var ModalRail = ({ children }) => {
547
+ return /* @__PURE__ */ jsx7(
548
+ Rail,
549
+ {
550
+ "data-slot": "modal-rail",
551
+ "data-qa-modal-rail": true,
552
+ "aria-label": "Modal quick actions",
553
+ children
554
+ }
555
+ );
556
+ };
557
+ ModalRail.displayName = "ModalRail";
558
+
559
+ // src/v2/components/ModalAction.tsx
560
+ import "react";
561
+ import * as Dialog5 from "@radix-ui/react-dialog";
562
+ import styled6 from "styled-components";
563
+ import Icon from "@sproutsocial/seeds-react-icon";
564
+
565
+ // ../../node_modules/@babel/runtime/helpers/esm/extends.js
566
+ function _extends() {
567
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
568
+ for (var e = 1; e < arguments.length; e++) {
569
+ var t = arguments[e];
570
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
571
+ }
572
+ return n;
573
+ }, _extends.apply(null, arguments);
574
+ }
575
+
576
+ // ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
577
+ function _assertThisInitialized(e) {
578
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
579
+ return e;
580
+ }
581
+
582
+ // ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
583
+ function _setPrototypeOf(t, e) {
584
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
585
+ return t2.__proto__ = e2, t2;
586
+ }, _setPrototypeOf(t, e);
587
+ }
588
+
589
+ // ../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
590
+ function _inheritsLoose(t, o) {
591
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
592
+ }
593
+
594
+ // ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
595
+ function _getPrototypeOf(t) {
596
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
597
+ return t2.__proto__ || Object.getPrototypeOf(t2);
598
+ }, _getPrototypeOf(t);
599
+ }
600
+
601
+ // ../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
602
+ function _isNativeFunction(t) {
603
+ try {
604
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
605
+ } catch (n) {
606
+ return "function" == typeof t;
607
+ }
608
+ }
609
+
610
+ // ../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
611
+ function _isNativeReflectConstruct() {
612
+ try {
613
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
614
+ }));
615
+ } catch (t2) {
616
+ }
617
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
618
+ return !!t;
619
+ })();
620
+ }
621
+
622
+ // ../../node_modules/@babel/runtime/helpers/esm/construct.js
623
+ function _construct(t, e, r) {
624
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
625
+ var o = [null];
626
+ o.push.apply(o, e);
627
+ var p = new (t.bind.apply(t, o))();
628
+ return r && _setPrototypeOf(p, r.prototype), p;
629
+ }
630
+
631
+ // ../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
632
+ function _wrapNativeSuper(t) {
633
+ var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
634
+ return _wrapNativeSuper = function _wrapNativeSuper2(t2) {
635
+ if (null === t2 || !_isNativeFunction(t2)) return t2;
636
+ if ("function" != typeof t2) throw new TypeError("Super expression must either be null or a function");
637
+ if (void 0 !== r) {
638
+ if (r.has(t2)) return r.get(t2);
639
+ r.set(t2, Wrapper);
640
+ }
641
+ function Wrapper() {
642
+ return _construct(t2, arguments, _getPrototypeOf(this).constructor);
643
+ }
644
+ return Wrapper.prototype = Object.create(t2.prototype, {
645
+ constructor: {
646
+ value: Wrapper,
647
+ enumerable: false,
648
+ writable: true,
649
+ configurable: true
650
+ }
651
+ }), _setPrototypeOf(Wrapper, t2);
652
+ }, _wrapNativeSuper(t);
653
+ }
654
+
655
+ // ../../node_modules/polished/dist/polished.esm.js
656
+ var ERRORS = {
657
+ "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",
658
+ "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",
659
+ "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
660
+ "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
661
+ "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
662
+ "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",
663
+ "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",
664
+ "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
665
+ "9": "Please provide a number of steps to the modularScale helper.\n\n",
666
+ "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
667
+ "11": 'Invalid value passed as base to modularScale, expected number or em string but got "%s"\n\n',
668
+ "12": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.\n\n',
669
+ "13": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.\n\n',
670
+ "14": 'Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
671
+ "15": 'Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
672
+ "16": "You must provide a template to this method.\n\n",
673
+ "17": "You passed an unsupported selector state to this method.\n\n",
674
+ "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
675
+ "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
676
+ "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
677
+ "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
678
+ "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
679
+ "23": "fontFace expects a name of a font-family.\n\n",
680
+ "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
681
+ "25": "fontFace expects localFonts to be an array.\n\n",
682
+ "26": "fontFace expects fileFormats to be an array.\n\n",
683
+ "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
684
+ "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
685
+ "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
686
+ "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
687
+ "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
688
+ "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",
689
+ "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
690
+ "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
691
+ "35": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
692
+ "36": "Property must be a string value.\n\n",
693
+ "37": "Syntax Error at %s.\n\n",
694
+ "38": "Formula contains a function that needs parentheses at %s.\n\n",
695
+ "39": "Formula is missing closing parenthesis at %s.\n\n",
696
+ "40": "Formula has too many closing parentheses at %s.\n\n",
697
+ "41": "All values in a formula must have the same unit or be unitless.\n\n",
698
+ "42": "Please provide a number of steps to the modularScale helper.\n\n",
699
+ "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
700
+ "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
701
+ "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
702
+ "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
703
+ "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
704
+ "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
705
+ "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
706
+ "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
707
+ "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
708
+ "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
709
+ "53": "fontFace expects localFonts to be an array.\n\n",
710
+ "54": "fontFace expects fileFormats to be an array.\n\n",
711
+ "55": "fontFace expects a name of a font-family.\n\n",
712
+ "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
713
+ "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
714
+ "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
715
+ "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
716
+ "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
717
+ "61": "Property must be a string value.\n\n",
718
+ "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
719
+ "63": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
720
+ "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
721
+ "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",
722
+ "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
723
+ "67": "You must provide a template to this method.\n\n",
724
+ "68": "You passed an unsupported selector state to this method.\n\n",
725
+ "69": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.\n\n',
726
+ "70": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.\n\n',
727
+ "71": 'Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.\n\n',
728
+ "72": 'Passed invalid base value %s to %s(), please pass a value like "12px" or 12.\n\n',
729
+ "73": "Please provide a valid CSS variable.\n\n",
730
+ "74": "CSS variable not found.\n\n",
731
+ "75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
732
+ };
733
+ function format() {
734
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
735
+ args[_key] = arguments[_key];
736
+ }
737
+ var a = args[0];
738
+ var b = [];
739
+ var c;
740
+ for (c = 1; c < args.length; c += 1) {
741
+ b.push(args[c]);
742
+ }
743
+ b.forEach(function(d) {
744
+ a = a.replace(/%[a-z]/, d);
745
+ });
746
+ return a;
747
+ }
748
+ var PolishedError = /* @__PURE__ */ function(_Error) {
749
+ _inheritsLoose(PolishedError2, _Error);
750
+ function PolishedError2(code) {
751
+ var _this;
752
+ if (process.env.NODE_ENV === "production") {
753
+ _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;
754
+ } else {
755
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
756
+ args[_key2 - 1] = arguments[_key2];
757
+ }
758
+ _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
759
+ }
760
+ return _assertThisInitialized(_this);
761
+ }
762
+ return PolishedError2;
763
+ }(/* @__PURE__ */ _wrapNativeSuper(Error));
764
+ function colorToInt(color) {
765
+ return Math.round(color * 255);
766
+ }
767
+ function convertToInt(red, green, blue) {
768
+ return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
769
+ }
770
+ function hslToRgb(hue, saturation, lightness, convert) {
771
+ if (convert === void 0) {
772
+ convert = convertToInt;
773
+ }
774
+ if (saturation === 0) {
775
+ return convert(lightness, lightness, lightness);
776
+ }
777
+ var huePrime = (hue % 360 + 360) % 360 / 60;
778
+ var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
779
+ var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
780
+ var red = 0;
781
+ var green = 0;
782
+ var blue = 0;
783
+ if (huePrime >= 0 && huePrime < 1) {
784
+ red = chroma;
785
+ green = secondComponent;
786
+ } else if (huePrime >= 1 && huePrime < 2) {
787
+ red = secondComponent;
788
+ green = chroma;
789
+ } else if (huePrime >= 2 && huePrime < 3) {
790
+ green = chroma;
791
+ blue = secondComponent;
792
+ } else if (huePrime >= 3 && huePrime < 4) {
793
+ green = secondComponent;
794
+ blue = chroma;
795
+ } else if (huePrime >= 4 && huePrime < 5) {
796
+ red = secondComponent;
797
+ blue = chroma;
798
+ } else if (huePrime >= 5 && huePrime < 6) {
799
+ red = chroma;
800
+ blue = secondComponent;
801
+ }
802
+ var lightnessModification = lightness - chroma / 2;
803
+ var finalRed = red + lightnessModification;
804
+ var finalGreen = green + lightnessModification;
805
+ var finalBlue = blue + lightnessModification;
806
+ return convert(finalRed, finalGreen, finalBlue);
807
+ }
808
+ var namedColorMap = {
809
+ aliceblue: "f0f8ff",
810
+ antiquewhite: "faebd7",
811
+ aqua: "00ffff",
812
+ aquamarine: "7fffd4",
813
+ azure: "f0ffff",
814
+ beige: "f5f5dc",
815
+ bisque: "ffe4c4",
816
+ black: "000",
817
+ blanchedalmond: "ffebcd",
818
+ blue: "0000ff",
819
+ blueviolet: "8a2be2",
820
+ brown: "a52a2a",
821
+ burlywood: "deb887",
822
+ cadetblue: "5f9ea0",
823
+ chartreuse: "7fff00",
824
+ chocolate: "d2691e",
825
+ coral: "ff7f50",
826
+ cornflowerblue: "6495ed",
827
+ cornsilk: "fff8dc",
828
+ crimson: "dc143c",
829
+ cyan: "00ffff",
830
+ darkblue: "00008b",
831
+ darkcyan: "008b8b",
832
+ darkgoldenrod: "b8860b",
833
+ darkgray: "a9a9a9",
834
+ darkgreen: "006400",
835
+ darkgrey: "a9a9a9",
836
+ darkkhaki: "bdb76b",
837
+ darkmagenta: "8b008b",
838
+ darkolivegreen: "556b2f",
839
+ darkorange: "ff8c00",
840
+ darkorchid: "9932cc",
841
+ darkred: "8b0000",
842
+ darksalmon: "e9967a",
843
+ darkseagreen: "8fbc8f",
844
+ darkslateblue: "483d8b",
845
+ darkslategray: "2f4f4f",
846
+ darkslategrey: "2f4f4f",
847
+ darkturquoise: "00ced1",
848
+ darkviolet: "9400d3",
849
+ deeppink: "ff1493",
850
+ deepskyblue: "00bfff",
851
+ dimgray: "696969",
852
+ dimgrey: "696969",
853
+ dodgerblue: "1e90ff",
854
+ firebrick: "b22222",
855
+ floralwhite: "fffaf0",
856
+ forestgreen: "228b22",
857
+ fuchsia: "ff00ff",
858
+ gainsboro: "dcdcdc",
859
+ ghostwhite: "f8f8ff",
860
+ gold: "ffd700",
861
+ goldenrod: "daa520",
862
+ gray: "808080",
863
+ green: "008000",
864
+ greenyellow: "adff2f",
865
+ grey: "808080",
866
+ honeydew: "f0fff0",
867
+ hotpink: "ff69b4",
868
+ indianred: "cd5c5c",
869
+ indigo: "4b0082",
870
+ ivory: "fffff0",
871
+ khaki: "f0e68c",
872
+ lavender: "e6e6fa",
873
+ lavenderblush: "fff0f5",
874
+ lawngreen: "7cfc00",
875
+ lemonchiffon: "fffacd",
876
+ lightblue: "add8e6",
877
+ lightcoral: "f08080",
878
+ lightcyan: "e0ffff",
879
+ lightgoldenrodyellow: "fafad2",
880
+ lightgray: "d3d3d3",
881
+ lightgreen: "90ee90",
882
+ lightgrey: "d3d3d3",
883
+ lightpink: "ffb6c1",
884
+ lightsalmon: "ffa07a",
885
+ lightseagreen: "20b2aa",
886
+ lightskyblue: "87cefa",
887
+ lightslategray: "789",
888
+ lightslategrey: "789",
889
+ lightsteelblue: "b0c4de",
890
+ lightyellow: "ffffe0",
891
+ lime: "0f0",
892
+ limegreen: "32cd32",
893
+ linen: "faf0e6",
894
+ magenta: "f0f",
895
+ maroon: "800000",
896
+ mediumaquamarine: "66cdaa",
897
+ mediumblue: "0000cd",
898
+ mediumorchid: "ba55d3",
899
+ mediumpurple: "9370db",
900
+ mediumseagreen: "3cb371",
901
+ mediumslateblue: "7b68ee",
902
+ mediumspringgreen: "00fa9a",
903
+ mediumturquoise: "48d1cc",
904
+ mediumvioletred: "c71585",
905
+ midnightblue: "191970",
906
+ mintcream: "f5fffa",
907
+ mistyrose: "ffe4e1",
908
+ moccasin: "ffe4b5",
909
+ navajowhite: "ffdead",
910
+ navy: "000080",
911
+ oldlace: "fdf5e6",
912
+ olive: "808000",
913
+ olivedrab: "6b8e23",
914
+ orange: "ffa500",
915
+ orangered: "ff4500",
916
+ orchid: "da70d6",
917
+ palegoldenrod: "eee8aa",
918
+ palegreen: "98fb98",
919
+ paleturquoise: "afeeee",
920
+ palevioletred: "db7093",
921
+ papayawhip: "ffefd5",
922
+ peachpuff: "ffdab9",
923
+ peru: "cd853f",
924
+ pink: "ffc0cb",
925
+ plum: "dda0dd",
926
+ powderblue: "b0e0e6",
927
+ purple: "800080",
928
+ rebeccapurple: "639",
929
+ red: "f00",
930
+ rosybrown: "bc8f8f",
931
+ royalblue: "4169e1",
932
+ saddlebrown: "8b4513",
933
+ salmon: "fa8072",
934
+ sandybrown: "f4a460",
935
+ seagreen: "2e8b57",
936
+ seashell: "fff5ee",
937
+ sienna: "a0522d",
938
+ silver: "c0c0c0",
939
+ skyblue: "87ceeb",
940
+ slateblue: "6a5acd",
941
+ slategray: "708090",
942
+ slategrey: "708090",
943
+ snow: "fffafa",
944
+ springgreen: "00ff7f",
945
+ steelblue: "4682b4",
946
+ tan: "d2b48c",
947
+ teal: "008080",
948
+ thistle: "d8bfd8",
949
+ tomato: "ff6347",
950
+ turquoise: "40e0d0",
951
+ violet: "ee82ee",
952
+ wheat: "f5deb3",
953
+ white: "fff",
954
+ whitesmoke: "f5f5f5",
955
+ yellow: "ff0",
956
+ yellowgreen: "9acd32"
957
+ };
958
+ function nameToHex(color) {
959
+ if (typeof color !== "string") return color;
960
+ var normalizedColorName = color.toLowerCase();
961
+ return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
962
+ }
963
+ var hexRegex = /^#[a-fA-F0-9]{6}$/;
964
+ var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
965
+ var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
966
+ var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
967
+ var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
968
+ 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;
969
+ 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;
970
+ 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;
971
+ function parseToRgb(color) {
972
+ if (typeof color !== "string") {
973
+ throw new PolishedError(3);
974
+ }
975
+ var normalizedColor = nameToHex(color);
976
+ if (normalizedColor.match(hexRegex)) {
977
+ return {
978
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
979
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
980
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
981
+ };
982
+ }
983
+ if (normalizedColor.match(hexRgbaRegex)) {
984
+ var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
985
+ return {
986
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
987
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
988
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
989
+ alpha
990
+ };
991
+ }
992
+ if (normalizedColor.match(reducedHexRegex)) {
993
+ return {
994
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
995
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
996
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
997
+ };
998
+ }
999
+ if (normalizedColor.match(reducedRgbaHexRegex)) {
1000
+ var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
1001
+ return {
1002
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
1003
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
1004
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
1005
+ alpha: _alpha
1006
+ };
1007
+ }
1008
+ var rgbMatched = rgbRegex.exec(normalizedColor);
1009
+ if (rgbMatched) {
1010
+ return {
1011
+ red: parseInt("" + rgbMatched[1], 10),
1012
+ green: parseInt("" + rgbMatched[2], 10),
1013
+ blue: parseInt("" + rgbMatched[3], 10)
1014
+ };
1015
+ }
1016
+ var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
1017
+ if (rgbaMatched) {
1018
+ return {
1019
+ red: parseInt("" + rgbaMatched[1], 10),
1020
+ green: parseInt("" + rgbaMatched[2], 10),
1021
+ blue: parseInt("" + rgbaMatched[3], 10),
1022
+ alpha: parseFloat("" + rgbaMatched[4])
1023
+ };
1024
+ }
1025
+ var hslMatched = hslRegex.exec(normalizedColor);
1026
+ if (hslMatched) {
1027
+ var hue = parseInt("" + hslMatched[1], 10);
1028
+ var saturation = parseInt("" + hslMatched[2], 10) / 100;
1029
+ var lightness = parseInt("" + hslMatched[3], 10) / 100;
1030
+ var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
1031
+ var hslRgbMatched = rgbRegex.exec(rgbColorString);
1032
+ if (!hslRgbMatched) {
1033
+ throw new PolishedError(4, normalizedColor, rgbColorString);
1034
+ }
1035
+ return {
1036
+ red: parseInt("" + hslRgbMatched[1], 10),
1037
+ green: parseInt("" + hslRgbMatched[2], 10),
1038
+ blue: parseInt("" + hslRgbMatched[3], 10)
1039
+ };
1040
+ }
1041
+ var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
1042
+ if (hslaMatched) {
1043
+ var _hue = parseInt("" + hslaMatched[1], 10);
1044
+ var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
1045
+ var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
1046
+ var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
1047
+ var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
1048
+ if (!_hslRgbMatched) {
1049
+ throw new PolishedError(4, normalizedColor, _rgbColorString);
1050
+ }
1051
+ return {
1052
+ red: parseInt("" + _hslRgbMatched[1], 10),
1053
+ green: parseInt("" + _hslRgbMatched[2], 10),
1054
+ blue: parseInt("" + _hslRgbMatched[3], 10),
1055
+ alpha: parseFloat("" + hslaMatched[4])
1056
+ };
1057
+ }
1058
+ throw new PolishedError(5);
1059
+ }
1060
+ var reduceHexValue = function reduceHexValue2(value) {
1061
+ if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
1062
+ return "#" + value[1] + value[3] + value[5];
1063
+ }
1064
+ return value;
1065
+ };
1066
+ function numberToHex(value) {
1067
+ var hex = value.toString(16);
1068
+ return hex.length === 1 ? "0" + hex : hex;
1069
+ }
1070
+ function rgb(value, green, blue) {
1071
+ if (typeof value === "number" && typeof green === "number" && typeof blue === "number") {
1072
+ return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
1073
+ } else if (typeof value === "object" && green === void 0 && blue === void 0) {
1074
+ return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
1075
+ }
1076
+ throw new PolishedError(6);
1077
+ }
1078
+ function rgba(firstValue, secondValue, thirdValue, fourthValue) {
1079
+ if (typeof firstValue === "string" && typeof secondValue === "number") {
1080
+ var rgbValue = parseToRgb(firstValue);
1081
+ return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
1082
+ } else if (typeof firstValue === "number" && typeof secondValue === "number" && typeof thirdValue === "number" && typeof fourthValue === "number") {
1083
+ return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
1084
+ } else if (typeof firstValue === "object" && secondValue === void 0 && thirdValue === void 0 && fourthValue === void 0) {
1085
+ return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
1086
+ }
1087
+ throw new PolishedError(7);
1088
+ }
1089
+ function curried(f, length, acc) {
1090
+ return function fn() {
1091
+ var combined = acc.concat(Array.prototype.slice.call(arguments));
1092
+ return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
1093
+ };
1094
+ }
1095
+ function curry(f) {
1096
+ return curried(f, f.length, []);
1097
+ }
1098
+ function guard(lowerBoundary, upperBoundary, value) {
1099
+ return Math.max(lowerBoundary, Math.min(upperBoundary, value));
1100
+ }
1101
+ function transparentize(amount, color) {
1102
+ if (color === "transparent") return color;
1103
+ var parsedColor = parseToRgb(color);
1104
+ var alpha = typeof parsedColor.alpha === "number" ? parsedColor.alpha : 1;
1105
+ var colorWithAlpha = _extends({}, parsedColor, {
1106
+ alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
1107
+ });
1108
+ return rgba(colorWithAlpha);
1109
+ }
1110
+ var curriedTransparentize = /* @__PURE__ */ curry(transparentize);
1111
+
1112
+ // ../seeds-react-mixins/dist/esm/index.js
1113
+ import { css } from "styled-components";
1114
+ import { theme } from "@sproutsocial/seeds-react-theme";
1115
+ var visuallyHidden = css`
1116
+ position: absolute;
1117
+ width: 1px;
1118
+ height: 1px;
1119
+ padding: 0;
1120
+ margin: -1px;
1121
+ overflow: hidden;
1122
+ clip: rect(0 0 0 0);
1123
+ border: 0;
1124
+ `;
1125
+ var focusRing = css`
1126
+ box-shadow: 0 0 0 1px ${theme.colors.button.primary.background.base},
1127
+ 0 0px 0px 4px
1128
+ ${curriedTransparentize(0.7, theme.colors.button.primary.background.base)};
1129
+ outline: none;
1130
+
1131
+ &::-moz-focus-inner {
1132
+ border: 0;
1133
+ }
1134
+ `;
1135
+ var pill = css`
1136
+ min-width: ${theme.space[600]};
1137
+ min-height: ${theme.space[600]};
1138
+ padding: ${theme.space[300]};
1139
+ border-radius: ${theme.radii.pill};
1140
+ `;
1141
+ var disabled = css`
1142
+ opacity: 0.4;
1143
+ pointer-events: none;
1144
+ `;
1145
+
1146
+ // src/v2/components/ModalAction.tsx
1147
+ import { jsx as jsx8 } from "react/jsx-runtime";
1148
+ var RailButton = styled6.button`
1149
+ width: ${RAIL_BUTTON_SIZE}px;
1150
+ height: ${(props) => props.theme.space[500]};
1151
+ display: inline-grid;
1152
+ place-items: center;
1153
+ border-radius: ${(props) => props.theme.radii.outer};
1154
+ border: none;
1155
+ background: ${(props) => props.theme.colors.button.overlay.background.base};
1156
+ color: ${(props) => props.theme.colors.button.overlay.text.base};
1157
+ cursor: pointer;
1158
+ outline: none;
1159
+ transition: all ${(props) => props.theme.duration.fast}
1160
+ ${(props) => props.theme.easing.ease_inout};
1161
+
1162
+ &:hover {
1163
+ background: ${(props) => props.theme.colors.button.overlay.background.hover};
1164
+ }
1165
+
1166
+ &:hover,
1167
+ &:active {
1168
+ transform: none;
1169
+ }
1170
+
1171
+ &:focus-visible {
1172
+ ${focusRing}
1173
+ }
1174
+
1175
+ &:disabled {
1176
+ opacity: 0.5;
1177
+ cursor: not-allowed;
1178
+ }
1179
+ `;
1180
+ var ModalAction = ({
1181
+ "aria-label": ariaLabel,
1182
+ iconName,
1183
+ disabled: disabled2,
1184
+ actionType,
1185
+ onClick,
1186
+ ...rest
1187
+ }) => {
1188
+ const button = /* @__PURE__ */ jsx8(
1189
+ RailButton,
1190
+ {
1191
+ "aria-label": ariaLabel,
1192
+ title: ariaLabel,
1193
+ disabled: disabled2,
1194
+ onClick,
1195
+ ...rest,
1196
+ children: iconName && /* @__PURE__ */ jsx8(Icon, { name: iconName, size: "small", "aria-label": ariaLabel })
1197
+ }
1198
+ );
1199
+ if (actionType === "close") {
1200
+ return /* @__PURE__ */ jsx8(Dialog5.Close, { asChild: true, children: button });
1201
+ }
1202
+ return button;
1203
+ };
1204
+ ModalAction.displayName = "ModalAction";
1205
+
1206
+ // src/v2/components/ModalOverlay.tsx
1207
+ import "react";
1208
+ import styled7 from "styled-components";
1209
+ import { motion as motion2 } from "motion/react";
1210
+ import {
1211
+ COMMON as COMMON5,
1212
+ BORDER as BORDER5,
1213
+ LAYOUT as LAYOUT5,
1214
+ POSITION
1215
+ } from "@sproutsocial/seeds-react-system-props";
1216
+ var StyledMotionOverlay = styled7(motion2.div)`
1217
+ position: fixed;
1218
+ top: 0px;
1219
+ left: 0px;
1220
+ right: 0px;
1221
+ bottom: 0px;
1222
+ `;
1223
+ var StyledOverlay = styled7.div.withConfig({
1224
+ shouldForwardProp: (prop) => !["allowInteraction"].includes(prop)
1225
+ })`
1226
+ width: 100%;
1227
+ height: 100%;
1228
+ background-color: ${(props) => props.theme.colors.overlay.background.base};
1229
+
1230
+ /* Allow clicking through overlay when modal is draggable */
1231
+ ${(props) => props.allowInteraction && `
1232
+ pointer-events: none;
1233
+ `}
1234
+
1235
+ ${COMMON5}
1236
+ ${BORDER5}
1237
+ ${LAYOUT5}
1238
+ ${POSITION}
1239
+ `;
1240
+ StyledOverlay.displayName = "ModalOverlay";
1241
+
1242
+ // src/v2/Modal.tsx
1243
+ import { Fragment, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
1244
+ var Modal = (props) => {
1245
+ const {
1246
+ children,
1247
+ modalTrigger,
1248
+ draggable = false,
1249
+ open,
1250
+ defaultOpen,
1251
+ onOpenChange,
1252
+ "aria-label": label,
1253
+ title,
1254
+ subtitle,
1255
+ description,
1256
+ data = {},
1257
+ showOverlay = true,
1258
+ actions,
1259
+ closeButtonAriaLabel = "Close",
1260
+ ...rest
1261
+ } = props;
1262
+ const [isOpen, setIsOpen] = React11.useState(defaultOpen ?? false);
1263
+ const handleOpenChange = React11.useCallback(
1264
+ (newOpen) => {
1265
+ setIsOpen(newOpen);
1266
+ onOpenChange?.(newOpen);
1267
+ },
1268
+ [onOpenChange]
1269
+ );
1270
+ const dataAttributes = React11.useMemo(() => {
1271
+ const attrs = {};
1272
+ Object.entries(data).forEach(([key, value]) => {
1273
+ attrs[`data-${key}`] = String(value);
1274
+ });
1275
+ attrs["data-qa-modal"] = "";
1276
+ if (open !== void 0) {
1277
+ attrs["data-qa-modal-open"] = String(open);
1278
+ }
1279
+ return attrs;
1280
+ }, [data, open]);
1281
+ const shouldRenderHeader = Boolean(title || subtitle);
1282
+ const isMobile = useIsMobile();
1283
+ const overlayVariants = getOverlayVariants(isMobile);
1284
+ const ModalContentComponent = draggable ? DraggableModalContent : StaticModalContent;
1285
+ return /* @__PURE__ */ jsxs3(
1286
+ Dialog6.Root,
1287
+ {
1288
+ open,
1289
+ defaultOpen,
1290
+ onOpenChange: handleOpenChange,
1291
+ modal: !draggable,
1292
+ children: [
1293
+ modalTrigger && /* @__PURE__ */ jsx9(Dialog6.Trigger, { asChild: true, children: modalTrigger }),
1294
+ /* @__PURE__ */ jsx9(Dialog6.Portal, { forceMount: true, children: /* @__PURE__ */ jsx9(AnimatePresence, { mode: "wait", children: (open ?? isOpen) && /* @__PURE__ */ jsxs3(Fragment, { children: [
1295
+ showOverlay && /* @__PURE__ */ jsx9(Dialog6.Overlay, { asChild: true, children: /* @__PURE__ */ jsx9(
1296
+ StyledMotionOverlay,
1297
+ {
1298
+ variants: overlayVariants,
1299
+ initial: "initial",
1300
+ animate: "animate",
1301
+ exit: "exit",
1302
+ children: /* @__PURE__ */ jsx9(StyledOverlay, { allowInteraction: draggable })
1303
+ }
1304
+ ) }),
1305
+ /* @__PURE__ */ jsxs3(
1306
+ ModalContentComponent,
1307
+ {
1308
+ label,
1309
+ dataAttributes,
1310
+ draggable,
1311
+ rest,
1312
+ children: [
1313
+ /* @__PURE__ */ jsxs3(ModalRail, { children: [
1314
+ /* @__PURE__ */ jsx9(
1315
+ ModalAction,
1316
+ {
1317
+ actionType: "close",
1318
+ "aria-label": closeButtonAriaLabel,
1319
+ iconName: "x-outline"
1320
+ }
1321
+ ),
1322
+ actions?.map((action, idx) => /* @__PURE__ */ jsx9(ModalAction, { ...action }, idx))
1323
+ ] }),
1324
+ shouldRenderHeader && /* @__PURE__ */ jsx9(ModalHeader, { title, subtitle }),
1325
+ description && /* @__PURE__ */ jsx9(ModalDescription, { children: description }),
1326
+ children
1327
+ ]
1328
+ }
1329
+ )
1330
+ ] }) }) })
1331
+ ]
1332
+ }
1333
+ );
1334
+ };
1335
+ var Modal_default = Modal;
1336
+
1337
+ export {
1338
+ DEFAULT_MODAL_WIDTH,
1339
+ DEFAULT_MODAL_BG,
1340
+ BODY_PADDING,
1341
+ MODAL_SIZE_PRESETS,
1342
+ ModalCustomHeader,
1343
+ ModalHeader,
1344
+ ModalCloseWrapper,
1345
+ ModalCustomFooter,
1346
+ ModalFooter,
1347
+ ModalBody,
1348
+ ModalDescription,
1349
+ ModalRail,
1350
+ ModalAction,
1351
+ Modal_default
1352
+ };
1353
+ //# sourceMappingURL=chunk-ETVICNHP.js.map