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