@sproutsocial/seeds-react-modal 2.5.10 → 2.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +16 -16
- package/CHANGELOG.md +119 -0
- package/dist/{ModalExternalTrigger-BnbJk9zY.d.mts → ModalExternalTrigger-Bciv1N-P.d.mts} +0 -1
- package/dist/{ModalExternalTrigger-BnbJk9zY.d.ts → ModalExternalTrigger-Bciv1N-P.d.ts} +0 -1
- package/dist/esm/{chunk-XQ2A6HDC.js → chunk-KZ6XTIWT.js} +47 -157
- package/dist/esm/chunk-KZ6XTIWT.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -160
- package/dist/index.js.map +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.d.ts +1 -1
- package/dist/v2/index.js +50 -160
- package/dist/v2/index.js.map +1 -1
- package/package.json +9 -9
- package/src/shared/constants.ts +0 -3
- package/src/v2/Modal.tsx +14 -5
- package/src/v2/ModalV2.stories.tsx +10 -27
- package/src/v2/MotionConfig.ts +5 -97
- package/src/v2/components/ModalAction.tsx +1 -1
- package/src/v2/components/ModalContent.tsx +11 -58
- package/src/v2/components/ModalFooter.tsx +0 -7
- package/src/v2/components/ModalRail.tsx +1 -13
- package/dist/esm/chunk-XQ2A6HDC.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,34 +8,34 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m38.32 KB[39m
|
|
12
12
|
[32mCJS[39m [1mdist/v1/index.js [22m[32m10.31 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/v2/index.js [22m[
|
|
14
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
+
[32mCJS[39m [1mdist/v2/index.js [22m[32m29.85 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m76.00 KB[39m
|
|
15
15
|
[32mCJS[39m [1mdist/v1/index.js.map [22m[32m14.56 KB[39m
|
|
16
|
-
[32mCJS[39m [1mdist/v2/index.js.map [22m[
|
|
17
|
-
[32mCJS[39m ⚡️ Build success in
|
|
18
|
-
[32mESM[39m [1mdist/esm/
|
|
16
|
+
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m61.12 KB[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 70ms
|
|
18
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m733.00 B[39m
|
|
19
|
+
[32mESM[39m [1mdist/esm/chunk-KZ6XTIWT.js [22m[32m24.80 KB[39m
|
|
19
20
|
[32mESM[39m [1mdist/esm/chunk-72GBDCA2.js [22m[32m7.57 KB[39m
|
|
21
|
+
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m746.00 B[39m
|
|
20
22
|
[32mESM[39m [1mdist/esm/v1/index.js [22m[32m165.00 B[39m
|
|
21
|
-
[32mESM[39m [1mdist/esm/index.js
|
|
22
|
-
[32mESM[39m [1mdist/esm/chunk-
|
|
23
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m1.16 KB[39m
|
|
24
|
+
[32mESM[39m [1mdist/esm/chunk-72GBDCA2.js.map [22m[32m14.38 KB[39m
|
|
25
|
+
[32mESM[39m [1mdist/esm/chunk-KZ6XTIWT.js.map [22m[32m60.04 KB[39m
|
|
23
26
|
[32mESM[39m [1mdist/esm/v2/index.js.map [22m[32m71.00 B[39m
|
|
24
27
|
[32mESM[39m [1mdist/esm/v1/index.js.map [22m[32m71.00 B[39m
|
|
25
|
-
[32mESM[39m
|
|
26
|
-
[32mESM[39m [1mdist/esm/index.js.map [22m[32m1.16 KB[39m
|
|
27
|
-
[32mESM[39m [1mdist/esm/chunk-XQ2A6HDC.js.map [22m[32m66.27 KB[39m
|
|
28
|
-
[32mESM[39m ⚡️ Build success in 29ms
|
|
28
|
+
[32mESM[39m ⚡️ Build success in 70ms
|
|
29
29
|
[34mDTS[39m Build start
|
|
30
|
-
[32mDTS[39m ⚡️ Build success in
|
|
30
|
+
[32mDTS[39m ⚡️ Build success in 4230ms
|
|
31
31
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.07 KB[39m
|
|
32
32
|
[32mDTS[39m [1mdist/v1/index.d.ts [22m[32m413.00 B[39m
|
|
33
33
|
[32mDTS[39m [1mdist/v2/index.d.ts [22m[32m1.16 KB[39m
|
|
34
34
|
[32mDTS[39m [1mdist/Modal-DTeKLfEI.d.ts [22m[32m2.52 KB[39m
|
|
35
|
-
[32mDTS[39m [1mdist/ModalExternalTrigger-
|
|
35
|
+
[32mDTS[39m [1mdist/ModalExternalTrigger-Bciv1N-P.d.ts [22m[32m23.37 KB[39m
|
|
36
36
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.08 KB[39m
|
|
37
37
|
[32mDTS[39m [1mdist/v1/index.d.mts [22m[32m415.00 B[39m
|
|
38
38
|
[32mDTS[39m [1mdist/v2/index.d.mts [22m[32m1.16 KB[39m
|
|
39
39
|
[32mDTS[39m [1mdist/Modal-DTeKLfEI.d.mts [22m[32m2.52 KB[39m
|
|
40
|
-
[32mDTS[39m [1mdist/ModalExternalTrigger-
|
|
41
|
-
Done in
|
|
40
|
+
[32mDTS[39m [1mdist/ModalExternalTrigger-Bciv1N-P.d.mts [22m[32m23.37 KB[39m
|
|
41
|
+
Done in 5.20s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,124 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-modal
|
|
2
2
|
|
|
3
|
+
## 2.5.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [69c9d02]
|
|
8
|
+
- @sproutsocial/seeds-react-icon@2.4.0
|
|
9
|
+
- @sproutsocial/seeds-react-button@2.2.1
|
|
10
|
+
|
|
11
|
+
## 2.5.21
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [edc1819]
|
|
16
|
+
- @sproutsocial/seeds-react-text@1.4.3
|
|
17
|
+
|
|
18
|
+
## 2.5.20
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [456a20f]
|
|
23
|
+
- Updated dependencies [5892f44]
|
|
24
|
+
- @sproutsocial/seeds-react-button@2.2.0
|
|
25
|
+
- @sproutsocial/seeds-react-system-props@3.1.1
|
|
26
|
+
- @sproutsocial/seeds-react-box@1.1.21
|
|
27
|
+
- @sproutsocial/seeds-react-icon@2.3.13
|
|
28
|
+
- @sproutsocial/seeds-react-text@1.4.2
|
|
29
|
+
|
|
30
|
+
## 2.5.19
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [5114a32]
|
|
35
|
+
- Updated dependencies [a0fe3d3]
|
|
36
|
+
- @sproutsocial/seeds-react-theme@4.1.0
|
|
37
|
+
- @sproutsocial/seeds-react-button@2.1.3
|
|
38
|
+
- @sproutsocial/seeds-react-box@1.1.20
|
|
39
|
+
- @sproutsocial/seeds-react-icon@2.3.12
|
|
40
|
+
|
|
41
|
+
## 2.5.18
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- cdae6fb: Temporarily remove Modal v2's mobile bottom-sheet behavior. The bottom sheet was a
|
|
46
|
+
CSS/Motion illusion keyed to a Modal-specific 780px breakpoint, which conflicted with the
|
|
47
|
+
shared 640px breakpoint used by Drawer/Panel/PeekIn (where a Modal rendered "on desktop"
|
|
48
|
+
could independently snap to a bottom sheet in the 641–780px range). Modal now renders as a
|
|
49
|
+
centered dialog at every viewport. No public API changes — `TypeModalProps`, all exported
|
|
50
|
+
sub-components, and the hooks are unchanged. The real Drawer-based mobile bottom sheet will
|
|
51
|
+
be reintroduced post-migration using the shared `useIsMobile` breakpoint.
|
|
52
|
+
|
|
53
|
+
## 2.5.17
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [cb27f07]
|
|
58
|
+
- @sproutsocial/seeds-react-button@2.1.2
|
|
59
|
+
|
|
60
|
+
## 2.5.16
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [40d2dfe]
|
|
65
|
+
- @sproutsocial/seeds-react-button@2.1.1
|
|
66
|
+
|
|
67
|
+
## 2.5.15
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [132ef9d]
|
|
72
|
+
- Updated dependencies [132ef9d]
|
|
73
|
+
- Updated dependencies [132ef9d]
|
|
74
|
+
- @sproutsocial/seeds-react-button@2.1.0
|
|
75
|
+
- @sproutsocial/seeds-react-theme@4.0.0
|
|
76
|
+
- @sproutsocial/seeds-react-system-props@3.1.0
|
|
77
|
+
- @sproutsocial/seeds-react-box@1.1.19
|
|
78
|
+
- @sproutsocial/seeds-react-icon@2.3.11
|
|
79
|
+
- @sproutsocial/seeds-react-text@1.4.1
|
|
80
|
+
|
|
81
|
+
## 2.5.14
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- @sproutsocial/seeds-react-icon@2.3.10
|
|
86
|
+
- @sproutsocial/seeds-react-button@2.0.8
|
|
87
|
+
|
|
88
|
+
## 2.5.13
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Updated dependencies [47c62b3]
|
|
93
|
+
- @sproutsocial/seeds-react-theme@3.7.1
|
|
94
|
+
- @sproutsocial/seeds-react-box@1.1.18
|
|
95
|
+
- @sproutsocial/seeds-react-icon@2.3.9
|
|
96
|
+
- @sproutsocial/seeds-react-button@2.0.7
|
|
97
|
+
|
|
98
|
+
## 2.5.12
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [06da9c2]
|
|
103
|
+
- @sproutsocial/seeds-react-theme@3.7.0
|
|
104
|
+
- @sproutsocial/seeds-react-box@1.1.17
|
|
105
|
+
- @sproutsocial/seeds-react-icon@2.3.8
|
|
106
|
+
- @sproutsocial/seeds-react-button@2.0.6
|
|
107
|
+
|
|
108
|
+
## 2.5.11
|
|
109
|
+
|
|
110
|
+
### Patch Changes
|
|
111
|
+
|
|
112
|
+
- 277bfb0: Fix a batch of UX and accessibility issues in the v3 combobox / searchable-select components (`SingleCombobox`, `MultiCombobox`, `SingleSearchableSelect`, `MultiSearchableSelect`, `SingleSelect`, `MultiSelect`), plus a related Modal v2 fix:
|
|
113
|
+
|
|
114
|
+
- **New `isInvalid` prop** renders the red error border on the input group / trigger and the error color on the chevron, and forwards `aria-invalid` to the underlying input.
|
|
115
|
+
- **`required` is now forwarded as `aria-required`** so screen readers correctly announce required state.
|
|
116
|
+
- **Token chips have a visible gap** (`theme.space[200]`) in `MultiCombobox` instead of butting up against each other.
|
|
117
|
+
- **Escape on a closed combobox no longer clears the input and selection.** A new `useSuppressEscapeClear` hook stops the synthetic Escape event in capture phase when the popup is closed, suppressing Base UI's default clear-on-escape behavior while leaving popup-open Escape and Modal-Escape unaffected.
|
|
118
|
+
- **Escape inside a Modal / Drawer only closes the dropdown**, not the surrounding dialog. Fixed in Modal v2: when an open Base UI popup is detected inside the dialog, the modal's escape handler defers to the popup's own escape handling.
|
|
119
|
+
- **Focus stays on the input when removing a token** in `MultiCombobox` (previously punted to the modal container).
|
|
120
|
+
- **The clear (X) button and token-remove buttons are keyboard-focusable** and render a `:focus-visible` focus ring.
|
|
121
|
+
|
|
3
122
|
## 2.5.10
|
|
4
123
|
|
|
5
124
|
### Patch Changes
|
|
@@ -325,7 +325,6 @@ type TypeModalProps = TypeModalPropsWithTitle | TypeModalPropsWithSubtitleOnly |
|
|
|
325
325
|
* - Controlled and uncontrolled state modes
|
|
326
326
|
* - Optional draggable behavior for side-by-side interaction
|
|
327
327
|
* - Floating action rail for quick actions like close, expand, etc.
|
|
328
|
-
* - Responsive bottom sheet layout on mobile
|
|
329
328
|
*
|
|
330
329
|
* @example
|
|
331
330
|
* // Simple uncontrolled modal
|
|
@@ -325,7 +325,6 @@ type TypeModalProps = TypeModalPropsWithTitle | TypeModalPropsWithSubtitleOnly |
|
|
|
325
325
|
* - Controlled and uncontrolled state modes
|
|
326
326
|
* - Optional draggable behavior for side-by-side interaction
|
|
327
327
|
* - Floating action rail for quick actions like close, expand, etc.
|
|
328
|
-
* - Responsive bottom sheet layout on mobile
|
|
329
328
|
*
|
|
330
329
|
* @example
|
|
331
330
|
* // Simple uncontrolled modal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/v2/Modal.tsx
|
|
2
|
-
import * as
|
|
2
|
+
import * as React11 from "react";
|
|
3
3
|
import * as Dialog6 from "@radix-ui/react-dialog";
|
|
4
4
|
import { AnimatePresence } from "motion/react";
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "@sproutsocial/seeds-react-system-props";
|
|
18
18
|
|
|
19
19
|
// src/v2/components/ModalContent.tsx
|
|
20
|
-
import * as
|
|
20
|
+
import * as React from "react";
|
|
21
21
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
22
22
|
import { motion } from "motion/react";
|
|
23
23
|
import styled from "styled-components";
|
|
@@ -33,7 +33,6 @@ var MODAL_SIZE_PRESETS = {
|
|
|
33
33
|
large: "800px",
|
|
34
34
|
full: "90vw"
|
|
35
35
|
};
|
|
36
|
-
var MOBILE_BREAKPOINT = "780px";
|
|
37
36
|
var RAIL_BUTTON_SIZE = 44;
|
|
38
37
|
var RAIL_OFFSET = 12;
|
|
39
38
|
var RAIL_GAP = 12;
|
|
@@ -48,17 +47,11 @@ import {
|
|
|
48
47
|
} from "@sproutsocial/seeds-react-system-props";
|
|
49
48
|
|
|
50
49
|
// src/v2/MotionConfig.ts
|
|
51
|
-
import * as React from "react";
|
|
52
|
-
var DURATION_MOBILE = 0.6;
|
|
53
50
|
var DURATION_DESKTOP = 0.3;
|
|
54
51
|
var desktopTransition = {
|
|
55
52
|
duration: DURATION_DESKTOP,
|
|
56
53
|
ease: "easeInOut"
|
|
57
54
|
};
|
|
58
|
-
var mobileTransition = {
|
|
59
|
-
duration: DURATION_MOBILE,
|
|
60
|
-
ease: "easeInOut"
|
|
61
|
-
};
|
|
62
55
|
var desktopModalVariants = {
|
|
63
56
|
initial: {
|
|
64
57
|
opacity: 0,
|
|
@@ -96,40 +89,6 @@ var desktopOverlayVariants = {
|
|
|
96
89
|
transition: desktopTransition
|
|
97
90
|
}
|
|
98
91
|
};
|
|
99
|
-
var mobileDrawerVariants = {
|
|
100
|
-
initial: {
|
|
101
|
-
opacity: 0,
|
|
102
|
-
x: "-50%",
|
|
103
|
-
y: "100%",
|
|
104
|
-
transition: mobileTransition
|
|
105
|
-
},
|
|
106
|
-
animate: {
|
|
107
|
-
opacity: 1,
|
|
108
|
-
x: "-50%",
|
|
109
|
-
y: 0,
|
|
110
|
-
transition: mobileTransition
|
|
111
|
-
},
|
|
112
|
-
exit: {
|
|
113
|
-
opacity: 0,
|
|
114
|
-
x: "-50%",
|
|
115
|
-
y: "100%",
|
|
116
|
-
transition: mobileTransition
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
var mobileOverlayVariants = {
|
|
120
|
-
initial: {
|
|
121
|
-
opacity: 0,
|
|
122
|
-
transition: mobileTransition
|
|
123
|
-
},
|
|
124
|
-
animate: {
|
|
125
|
-
opacity: 1,
|
|
126
|
-
transition: mobileTransition
|
|
127
|
-
},
|
|
128
|
-
exit: {
|
|
129
|
-
opacity: 0,
|
|
130
|
-
transition: mobileTransition
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
92
|
var draggableModalVariants = {
|
|
134
93
|
initial: {
|
|
135
94
|
opacity: 0,
|
|
@@ -144,42 +103,19 @@ var draggableModalVariants = {
|
|
|
144
103
|
transition: desktopTransition
|
|
145
104
|
}
|
|
146
105
|
};
|
|
147
|
-
function getContentVariants(
|
|
148
|
-
|
|
149
|
-
return draggableModalVariants;
|
|
150
|
-
}
|
|
151
|
-
return isMobile ? mobileDrawerVariants : desktopModalVariants;
|
|
106
|
+
function getContentVariants(isDraggable) {
|
|
107
|
+
return isDraggable ? draggableModalVariants : desktopModalVariants;
|
|
152
108
|
}
|
|
153
|
-
function getOverlayVariants(
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
function useIsMobile() {
|
|
157
|
-
const [isMobile, setIsMobile] = React.useState(() => {
|
|
158
|
-
if (typeof window === "undefined") return false;
|
|
159
|
-
return window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT})`).matches;
|
|
160
|
-
});
|
|
161
|
-
React.useEffect(() => {
|
|
162
|
-
if (typeof window === "undefined") return;
|
|
163
|
-
const mediaQuery = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT})`);
|
|
164
|
-
const handler = (e) => setIsMobile(e.matches);
|
|
165
|
-
if (mediaQuery.addEventListener) {
|
|
166
|
-
mediaQuery.addEventListener("change", handler);
|
|
167
|
-
return () => mediaQuery.removeEventListener("change", handler);
|
|
168
|
-
} else if (mediaQuery.addListener) {
|
|
169
|
-
mediaQuery.addListener(handler);
|
|
170
|
-
return () => mediaQuery.removeListener(handler);
|
|
171
|
-
}
|
|
172
|
-
}, []);
|
|
173
|
-
return isMobile;
|
|
109
|
+
function getOverlayVariants() {
|
|
110
|
+
return desktopOverlayVariants;
|
|
174
111
|
}
|
|
175
112
|
|
|
176
113
|
// src/v2/components/ModalContent.tsx
|
|
177
114
|
import { jsx } from "react/jsx-runtime";
|
|
178
115
|
var StyledMotionWrapper = styled(motion.div)`
|
|
179
116
|
position: fixed;
|
|
180
|
-
top:
|
|
117
|
+
top: 50%;
|
|
181
118
|
left: 50%;
|
|
182
|
-
bottom: ${(props) => props.$isMobile ? 0 : "auto"};
|
|
183
119
|
z-index: ${(props) => props.$zIndex ? props.$zIndex + 1 : 7};
|
|
184
120
|
`;
|
|
185
121
|
var StyledContent = styled.div.withConfig({
|
|
@@ -194,33 +130,10 @@ var StyledContent = styled.div.withConfig({
|
|
|
194
130
|
color: ${(props) => props.theme.colors.text.body};
|
|
195
131
|
outline: none;
|
|
196
132
|
width: ${DEFAULT_MODAL_WIDTH};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}};
|
|
133
|
+
/* Account for rail space on the side; shrinks to fit small viewports */
|
|
134
|
+
max-width: calc(100vw - ${BODY_PADDING} - ${RAIL_EXTRA_SPACE}px);
|
|
200
135
|
max-height: calc(100vh - ${BODY_PADDING});
|
|
201
136
|
|
|
202
|
-
/* Mobile styles for viewport <= ${MOBILE_BREAKPOINT} */
|
|
203
|
-
@media (max-width: ${MOBILE_BREAKPOINT}) {
|
|
204
|
-
/* Full viewport width - edge to edge */
|
|
205
|
-
width: 100vw;
|
|
206
|
-
max-width: 100vw;
|
|
207
|
-
min-width: 100vw;
|
|
208
|
-
|
|
209
|
-
/* Height hugs content, with increased max-height to get closer to top */
|
|
210
|
-
/* Subtract space for rail + comfortable gap (44px rail + ~40px gap) */
|
|
211
|
-
height: auto;
|
|
212
|
-
max-height: calc(95vh - 84px);
|
|
213
|
-
|
|
214
|
-
/* Adjust border radius for mobile - rounded top, flat bottom to blend with device */
|
|
215
|
-
border-top-left-radius: ${(props) => props.theme.radii[800]};
|
|
216
|
-
border-top-right-radius: ${(props) => props.theme.radii[800]};
|
|
217
|
-
border-bottom-left-radius: 0;
|
|
218
|
-
border-bottom-right-radius: 0;
|
|
219
|
-
|
|
220
|
-
/* Mobile shadow - appears to cast upward (high-reverse) */
|
|
221
|
-
box-shadow: 0px -16px 32px 0px rgba(39, 51, 51, 0.24);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
137
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
225
138
|
height: calc(100vh - ${BODY_PADDING});
|
|
226
139
|
}
|
|
@@ -231,9 +144,9 @@ var StyledContent = styled.div.withConfig({
|
|
|
231
144
|
${LAYOUT}
|
|
232
145
|
`;
|
|
233
146
|
StyledContent.displayName = "ModalContent";
|
|
234
|
-
var DragContext =
|
|
147
|
+
var DragContext = React.createContext(null);
|
|
235
148
|
var useDragContext = () => {
|
|
236
|
-
const context =
|
|
149
|
+
const context = React.useContext(DragContext);
|
|
237
150
|
return context;
|
|
238
151
|
};
|
|
239
152
|
var StaticModalContent = ({
|
|
@@ -244,12 +157,10 @@ var StaticModalContent = ({
|
|
|
244
157
|
rest,
|
|
245
158
|
dialogContentProps
|
|
246
159
|
}) => {
|
|
247
|
-
const
|
|
248
|
-
const contentVariants = getContentVariants(isMobile, false);
|
|
160
|
+
const contentVariants = getContentVariants(false);
|
|
249
161
|
return /* @__PURE__ */ jsx(DragContext.Provider, { value: null, children: /* @__PURE__ */ jsx(Dialog.Content, { asChild: true, "aria-label": label, ...dialogContentProps, children: /* @__PURE__ */ jsx(
|
|
250
162
|
StyledMotionWrapper,
|
|
251
163
|
{
|
|
252
|
-
$isMobile: isMobile,
|
|
253
164
|
$zIndex: zIndex,
|
|
254
165
|
variants: contentVariants,
|
|
255
166
|
initial: "initial",
|
|
@@ -276,11 +187,10 @@ var DraggableModalContent = ({
|
|
|
276
187
|
rest,
|
|
277
188
|
dialogContentProps
|
|
278
189
|
}) => {
|
|
279
|
-
const [position, setPosition] =
|
|
280
|
-
const [isDragging, setIsDragging] =
|
|
281
|
-
const contentRef =
|
|
282
|
-
const
|
|
283
|
-
const handleHeaderMouseDown = React2.useCallback((e) => {
|
|
190
|
+
const [position, setPosition] = React.useState({ x: 0, y: 0 });
|
|
191
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
192
|
+
const contentRef = React.useRef(null);
|
|
193
|
+
const handleHeaderMouseDown = React.useCallback((e) => {
|
|
284
194
|
const target = e.target;
|
|
285
195
|
if (target.tagName === "BUTTON" || target.tagName === "INPUT" || target.closest("button")) {
|
|
286
196
|
return;
|
|
@@ -295,18 +205,12 @@ var DraggableModalContent = ({
|
|
|
295
205
|
e2.preventDefault();
|
|
296
206
|
const newX = e2.clientX - offsetX;
|
|
297
207
|
const newY = e2.clientY - offsetY;
|
|
298
|
-
const isRailOnSide = window.innerWidth > 780;
|
|
299
208
|
const modalWidth = rect.width;
|
|
300
209
|
const modalHeight = rect.height;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (isRailOnSide) {
|
|
306
|
-
maxX = window.innerWidth - modalWidth - RAIL_EXTRA_SPACE;
|
|
307
|
-
} else {
|
|
308
|
-
minY = RAIL_BUTTON_SIZE + RAIL_OFFSET;
|
|
309
|
-
}
|
|
210
|
+
const minX = 0;
|
|
211
|
+
const maxX = window.innerWidth - modalWidth - RAIL_EXTRA_SPACE;
|
|
212
|
+
const minY = 0;
|
|
213
|
+
const maxY = window.innerHeight - modalHeight;
|
|
310
214
|
const constrainedX = Math.max(minX, Math.min(maxX, newX));
|
|
311
215
|
const constrainedY = Math.max(minY, Math.min(maxY, newY));
|
|
312
216
|
const centerX = window.innerWidth / 2 - modalWidth / 2;
|
|
@@ -324,7 +228,7 @@ var DraggableModalContent = ({
|
|
|
324
228
|
document.addEventListener("mousemove", handleMouseMove);
|
|
325
229
|
document.addEventListener("mouseup", handleMouseUp);
|
|
326
230
|
}, []);
|
|
327
|
-
const dragContextValue =
|
|
231
|
+
const dragContextValue = React.useMemo(
|
|
328
232
|
() => ({
|
|
329
233
|
position,
|
|
330
234
|
isDragging,
|
|
@@ -334,10 +238,10 @@ var DraggableModalContent = ({
|
|
|
334
238
|
}),
|
|
335
239
|
[position, isDragging, handleHeaderMouseDown]
|
|
336
240
|
);
|
|
337
|
-
const handleInteractOutside =
|
|
241
|
+
const handleInteractOutside = React.useCallback((e) => {
|
|
338
242
|
e.preventDefault();
|
|
339
243
|
}, []);
|
|
340
|
-
const contentVariants = getContentVariants(
|
|
244
|
+
const contentVariants = getContentVariants(true);
|
|
341
245
|
return /* @__PURE__ */ jsx(DragContext.Provider, { value: dragContextValue, children: /* @__PURE__ */ jsx(
|
|
342
246
|
Dialog.Content,
|
|
343
247
|
{
|
|
@@ -348,7 +252,6 @@ var DraggableModalContent = ({
|
|
|
348
252
|
children: /* @__PURE__ */ jsx(
|
|
349
253
|
StyledMotionWrapper,
|
|
350
254
|
{
|
|
351
|
-
$isMobile: isMobile,
|
|
352
255
|
$zIndex: zIndex,
|
|
353
256
|
variants: contentVariants,
|
|
354
257
|
initial: "initial",
|
|
@@ -444,7 +347,7 @@ import {
|
|
|
444
347
|
} from "@sproutsocial/seeds-react-system-props";
|
|
445
348
|
|
|
446
349
|
// src/v2/components/ModalCloseWrapper.tsx
|
|
447
|
-
import * as
|
|
350
|
+
import * as React3 from "react";
|
|
448
351
|
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
449
352
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
450
353
|
var ModalCloseWrapper = (props) => {
|
|
@@ -452,7 +355,7 @@ var ModalCloseWrapper = (props) => {
|
|
|
452
355
|
const handleClick = (e) => {
|
|
453
356
|
onClick?.(e);
|
|
454
357
|
};
|
|
455
|
-
return /* @__PURE__ */ jsx3(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children:
|
|
358
|
+
return /* @__PURE__ */ jsx3(Dialog3.Close, { asChild, onClick: handleClick, ...rest, children: React3.isValidElement(children) ? React3.cloneElement(children, {
|
|
456
359
|
"data-slot": "modal-close-wrapper",
|
|
457
360
|
"data-qa-modal-close-wrapper": "",
|
|
458
361
|
...children.props || {}
|
|
@@ -474,12 +377,6 @@ var ModalCustomFooter = styled3(Box2)`
|
|
|
474
377
|
justify-content: flex-end;
|
|
475
378
|
gap: ${(props) => props.theme.space[100]};
|
|
476
379
|
|
|
477
|
-
/* Flat bottom corners to blend with device edge on mobile */
|
|
478
|
-
@media (max-width: ${MOBILE_BREAKPOINT}) {
|
|
479
|
-
border-bottom-right-radius: 0;
|
|
480
|
-
border-bottom-left-radius: 0;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
380
|
${COMMON3}
|
|
484
381
|
${FLEXBOX3}
|
|
485
382
|
${BORDER3}
|
|
@@ -509,7 +406,7 @@ var ModalFooter = (props) => {
|
|
|
509
406
|
ModalFooter.displayName = "ModalFooter";
|
|
510
407
|
|
|
511
408
|
// src/v2/components/ModalBody.tsx
|
|
512
|
-
import * as
|
|
409
|
+
import * as React5 from "react";
|
|
513
410
|
import styled4 from "styled-components";
|
|
514
411
|
import Box3 from "@sproutsocial/seeds-react-box";
|
|
515
412
|
import {
|
|
@@ -536,7 +433,7 @@ var StyledModalBody = styled4(Box3)`
|
|
|
536
433
|
${LAYOUT4}
|
|
537
434
|
`;
|
|
538
435
|
StyledModalBody.displayName = "ModalBody";
|
|
539
|
-
var ModalBody =
|
|
436
|
+
var ModalBody = React5.forwardRef(
|
|
540
437
|
({ children, ...rest }, ref) => {
|
|
541
438
|
return /* @__PURE__ */ jsx5(
|
|
542
439
|
StyledModalBody,
|
|
@@ -553,11 +450,11 @@ var ModalBody = React6.forwardRef(
|
|
|
553
450
|
ModalBody.displayName = "ModalBody";
|
|
554
451
|
|
|
555
452
|
// src/v2/components/ModalDescription.tsx
|
|
556
|
-
import * as
|
|
453
|
+
import * as React6 from "react";
|
|
557
454
|
import * as Dialog4 from "@radix-ui/react-dialog";
|
|
558
455
|
import Box4 from "@sproutsocial/seeds-react-box";
|
|
559
456
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
560
|
-
var ModalDescription =
|
|
457
|
+
var ModalDescription = React6.forwardRef(({ children, descriptionProps = {}, ...rest }, ref) => {
|
|
561
458
|
return /* @__PURE__ */ jsx6(Dialog4.Description, { asChild: true, ...descriptionProps, children: /* @__PURE__ */ jsx6(
|
|
562
459
|
Box4,
|
|
563
460
|
{
|
|
@@ -583,16 +480,6 @@ var Rail = styled5.div`
|
|
|
583
480
|
flex-direction: column;
|
|
584
481
|
gap: ${RAIL_GAP}px;
|
|
585
482
|
z-index: 1;
|
|
586
|
-
|
|
587
|
-
@media (max-width: ${MOBILE_BREAKPOINT}) {
|
|
588
|
-
/* Move rail above the modal on the right side */
|
|
589
|
-
top: auto;
|
|
590
|
-
bottom: calc(100% + ${RAIL_OFFSET}px);
|
|
591
|
-
right: ${RAIL_OFFSET}px;
|
|
592
|
-
left: auto;
|
|
593
|
-
/* Change to horizontal layout with reversed order */
|
|
594
|
-
flex-direction: row-reverse;
|
|
595
|
-
}
|
|
596
483
|
`;
|
|
597
484
|
var ModalRail = ({ children }) => {
|
|
598
485
|
return /* @__PURE__ */ jsx7(
|
|
@@ -734,11 +621,11 @@ var ModalAction = ({
|
|
|
734
621
|
ModalAction.displayName = "ModalAction";
|
|
735
622
|
|
|
736
623
|
// src/v2/components/ModalExternalTrigger.tsx
|
|
737
|
-
import * as
|
|
624
|
+
import * as React9 from "react";
|
|
738
625
|
import { Button } from "@sproutsocial/seeds-react-button";
|
|
739
626
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
740
|
-
var ModalExternalTrigger =
|
|
741
|
-
const handleClick =
|
|
627
|
+
var ModalExternalTrigger = React9.forwardRef(({ isOpen, onTrigger, modalId, onClick, ...buttonProps }, ref) => {
|
|
628
|
+
const handleClick = React9.useCallback(
|
|
742
629
|
(e) => {
|
|
743
630
|
onClick?.(e);
|
|
744
631
|
if (!e.defaultPrevented) {
|
|
@@ -830,15 +717,15 @@ var Modal = (props) => {
|
|
|
830
717
|
disableEscapeKeyClose = false,
|
|
831
718
|
...rest
|
|
832
719
|
} = props;
|
|
833
|
-
const [isOpen, setIsOpen] =
|
|
834
|
-
const handleOpenChange =
|
|
720
|
+
const [isOpen, setIsOpen] = React11.useState(defaultOpen ?? false);
|
|
721
|
+
const handleOpenChange = React11.useCallback(
|
|
835
722
|
(newOpen) => {
|
|
836
723
|
setIsOpen(newOpen);
|
|
837
724
|
onOpenChange?.(newOpen);
|
|
838
725
|
},
|
|
839
726
|
[onOpenChange]
|
|
840
727
|
);
|
|
841
|
-
const dataAttributes =
|
|
728
|
+
const dataAttributes = React11.useMemo(() => {
|
|
842
729
|
const attrs = {};
|
|
843
730
|
Object.entries(data).forEach(([key, value]) => {
|
|
844
731
|
attrs[`data-${key}`] = String(value);
|
|
@@ -850,10 +737,9 @@ var Modal = (props) => {
|
|
|
850
737
|
return attrs;
|
|
851
738
|
}, [data, open]);
|
|
852
739
|
const shouldRenderHeader = Boolean(title || subtitle);
|
|
853
|
-
const
|
|
854
|
-
const overlayVariants = getOverlayVariants(isMobile);
|
|
740
|
+
const overlayVariants = getOverlayVariants();
|
|
855
741
|
const ModalContentComponent = draggable ? DraggableModalContent : StaticModalContent;
|
|
856
|
-
const wrappedOnInteractOutside =
|
|
742
|
+
const wrappedOnInteractOutside = React11.useCallback(
|
|
857
743
|
(e) => {
|
|
858
744
|
if (disableOutsideClickClose) {
|
|
859
745
|
e.preventDefault();
|
|
@@ -862,12 +748,16 @@ var Modal = (props) => {
|
|
|
862
748
|
},
|
|
863
749
|
[disableOutsideClickClose, onInteractOutside]
|
|
864
750
|
);
|
|
865
|
-
const wrappedOnEscapeKeyDown =
|
|
751
|
+
const wrappedOnEscapeKeyDown = React11.useCallback(
|
|
866
752
|
(e) => {
|
|
867
753
|
const hasOpenPopout = document.querySelector("[data-qa-popout]") !== null;
|
|
868
754
|
if (hasOpenPopout) {
|
|
869
755
|
e.preventDefault();
|
|
870
756
|
}
|
|
757
|
+
const hasOpenBaseUIPopup = document.querySelector("[role='dialog'] [data-open]") !== null;
|
|
758
|
+
if (hasOpenBaseUIPopup) {
|
|
759
|
+
e.preventDefault();
|
|
760
|
+
}
|
|
871
761
|
if (disableEscapeKeyClose) {
|
|
872
762
|
e.preventDefault();
|
|
873
763
|
}
|
|
@@ -945,7 +835,7 @@ var Modal = (props) => {
|
|
|
945
835
|
);
|
|
946
836
|
};
|
|
947
837
|
function useModalTriggerProps(isOpen, modalId) {
|
|
948
|
-
return
|
|
838
|
+
return React11.useMemo(
|
|
949
839
|
() => ({
|
|
950
840
|
"aria-haspopup": "dialog",
|
|
951
841
|
"aria-expanded": isOpen,
|
|
@@ -955,8 +845,8 @@ function useModalTriggerProps(isOpen, modalId) {
|
|
|
955
845
|
);
|
|
956
846
|
}
|
|
957
847
|
function useModalExternalTrigger(modalId) {
|
|
958
|
-
const triggerRef =
|
|
959
|
-
const triggerProps =
|
|
848
|
+
const triggerRef = React11.useRef(null);
|
|
849
|
+
const triggerProps = React11.useCallback(
|
|
960
850
|
(isOpen) => ({
|
|
961
851
|
"aria-haspopup": "dialog",
|
|
962
852
|
"aria-expanded": isOpen,
|
|
@@ -964,7 +854,7 @@ function useModalExternalTrigger(modalId) {
|
|
|
964
854
|
}),
|
|
965
855
|
[modalId]
|
|
966
856
|
);
|
|
967
|
-
const onCloseAutoFocus =
|
|
857
|
+
const onCloseAutoFocus = React11.useCallback((e) => {
|
|
968
858
|
e.preventDefault();
|
|
969
859
|
triggerRef.current?.focus();
|
|
970
860
|
}, []);
|
|
@@ -991,4 +881,4 @@ export {
|
|
|
991
881
|
useModalExternalTrigger,
|
|
992
882
|
Modal_default
|
|
993
883
|
};
|
|
994
|
-
//# sourceMappingURL=chunk-
|
|
884
|
+
//# sourceMappingURL=chunk-KZ6XTIWT.js.map
|