@contentful/f36-modal 4.14.0 → 4.16.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.
- package/CHANGELOG.md +34 -0
- package/dist/main.js +119 -118
- package/dist/main.js.map +1 -1
- package/dist/module.js +119 -118
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/module.js
CHANGED
|
@@ -21,19 +21,19 @@ import $ggPfR$reactdom from "react-dom";
|
|
|
21
21
|
|
|
22
22
|
function $cdc4e74e8b16090b$export$4bef00d568400c9b() {
|
|
23
23
|
return {
|
|
24
|
-
root: /*#__PURE__*/ $ggPfR$css({
|
|
25
|
-
position:
|
|
26
|
-
padding: `${$ggPfR$contentfulf36tokens.spacingM} ${$ggPfR$contentfulf36tokens.spacingM} ${$ggPfR$contentfulf36tokens.spacingM} ${$ggPfR$contentfulf36tokens.spacingL}`,
|
|
27
|
-
borderRadius: `${$ggPfR$contentfulf36tokens.borderRadiusMedium} ${$ggPfR$contentfulf36tokens.borderRadiusMedium} 0 0`,
|
|
28
|
-
borderBottom: `1px solid ${$ggPfR$contentfulf36tokens.gray300}`
|
|
24
|
+
root: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
25
|
+
position: "relative",
|
|
26
|
+
padding: `${(0, $ggPfR$contentfulf36tokens).spacingM} ${(0, $ggPfR$contentfulf36tokens).spacingM} ${(0, $ggPfR$contentfulf36tokens).spacingM} ${(0, $ggPfR$contentfulf36tokens).spacingL}`,
|
|
27
|
+
borderRadius: `${(0, $ggPfR$contentfulf36tokens).borderRadiusMedium} ${(0, $ggPfR$contentfulf36tokens).borderRadiusMedium} 0 0`,
|
|
28
|
+
borderBottom: `1px solid ${(0, $ggPfR$contentfulf36tokens).gray300}`
|
|
29
29
|
}),
|
|
30
|
-
buttonContainer: /*#__PURE__*/ $ggPfR$css({
|
|
31
|
-
position:
|
|
32
|
-
width: $ggPfR$contentfulf36tokens.spacing2Xl,
|
|
33
|
-
height: $ggPfR$contentfulf36tokens.spacingL,
|
|
30
|
+
buttonContainer: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
31
|
+
position: "relative",
|
|
32
|
+
width: (0, $ggPfR$contentfulf36tokens).spacing2Xl,
|
|
33
|
+
height: (0, $ggPfR$contentfulf36tokens).spacingL,
|
|
34
34
|
button: {
|
|
35
|
-
position:
|
|
36
|
-
top: `calc(-1 * ${$ggPfR$contentfulf36tokens.spacing2Xs})`,
|
|
35
|
+
position: "absolute",
|
|
36
|
+
top: `calc(-1 * ${(0, $ggPfR$contentfulf36tokens).spacing2Xs})`,
|
|
37
37
|
right: 0
|
|
38
38
|
}
|
|
39
39
|
})
|
|
@@ -41,25 +41,25 @@ function $cdc4e74e8b16090b$export$4bef00d568400c9b() {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
const $08ed4541188cb150$export$f50a68e3694789ee = ({ onClose: onClose , title: title , testId: testId =
|
|
45
|
-
const styles = $cdc4e74e8b16090b$export$4bef00d568400c9b();
|
|
46
|
-
return /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Flex, {
|
|
44
|
+
const $08ed4541188cb150$export$f50a68e3694789ee = ({ onClose: onClose , title: title , testId: testId = "cf-ui-modal-header" , className: className , ...otherProps })=>{
|
|
45
|
+
const styles = (0, $cdc4e74e8b16090b$export$4bef00d568400c9b)();
|
|
46
|
+
return /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Flex), {
|
|
47
47
|
...otherProps,
|
|
48
|
-
className: $ggPfR$cx(styles.root, className),
|
|
48
|
+
className: (0, $ggPfR$cx)(styles.root, className),
|
|
49
49
|
testId: testId,
|
|
50
50
|
alignItems: "center",
|
|
51
51
|
justifyContent: "space-between"
|
|
52
|
-
}, /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Subheading, {
|
|
52
|
+
}, /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Subheading), {
|
|
53
53
|
as: "h2",
|
|
54
54
|
isTruncated: true,
|
|
55
55
|
marginBottom: "none"
|
|
56
|
-
}, title), onClose && /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Flex, {
|
|
56
|
+
}, title), onClose && /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Flex), {
|
|
57
57
|
alignItems: "center",
|
|
58
58
|
className: styles.buttonContainer
|
|
59
|
-
}, /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Button, {
|
|
59
|
+
}, /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Button), {
|
|
60
60
|
variant: "transparent",
|
|
61
61
|
"aria-label": "Close",
|
|
62
|
-
startIcon: /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$CloseIcon, {
|
|
62
|
+
startIcon: /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$CloseIcon), {
|
|
63
63
|
size: "small"
|
|
64
64
|
}),
|
|
65
65
|
onClick: ()=>{
|
|
@@ -68,7 +68,7 @@ const $08ed4541188cb150$export$f50a68e3694789ee = ({ onClose: onClose , title: t
|
|
|
68
68
|
size: "small"
|
|
69
69
|
})));
|
|
70
70
|
};
|
|
71
|
-
$08ed4541188cb150$export$f50a68e3694789ee.displayName =
|
|
71
|
+
$08ed4541188cb150$export$f50a68e3694789ee.displayName = "ModalHeader";
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
|
|
@@ -78,106 +78,106 @@ $08ed4541188cb150$export$f50a68e3694789ee.displayName = 'ModalHeader';
|
|
|
78
78
|
|
|
79
79
|
function $d20e7c3da09cc1c0$export$5168abbf3ad664a0() {
|
|
80
80
|
return {
|
|
81
|
-
root: /*#__PURE__*/ $ggPfR$css({
|
|
82
|
-
padding: `${$ggPfR$contentfulf36tokens.spacingM} ${$ggPfR$contentfulf36tokens.spacingL}`,
|
|
83
|
-
color: $ggPfR$contentfulf36tokens.gray700,
|
|
84
|
-
fontSize: $ggPfR$contentfulf36tokens.fontSizeM,
|
|
85
|
-
fontFamily: $ggPfR$contentfulf36tokens.fontStackPrimary,
|
|
86
|
-
lineHeight: $ggPfR$contentfulf36tokens.lineHeightM,
|
|
87
|
-
overflowY:
|
|
88
|
-
overflowX:
|
|
89
|
-
boxSizing:
|
|
81
|
+
root: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
82
|
+
padding: `${(0, $ggPfR$contentfulf36tokens).spacingM} ${(0, $ggPfR$contentfulf36tokens).spacingL}`,
|
|
83
|
+
color: (0, $ggPfR$contentfulf36tokens).gray700,
|
|
84
|
+
fontSize: (0, $ggPfR$contentfulf36tokens).fontSizeM,
|
|
85
|
+
fontFamily: (0, $ggPfR$contentfulf36tokens).fontStackPrimary,
|
|
86
|
+
lineHeight: (0, $ggPfR$contentfulf36tokens).lineHeightM,
|
|
87
|
+
overflowY: "auto",
|
|
88
|
+
overflowX: "auto",
|
|
89
|
+
boxSizing: "border-box"
|
|
90
90
|
})
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
const $2e16b6f9c0e7012d$export$6da19a24bf249f17 = ({ testId: testId =
|
|
96
|
-
const styles = $d20e7c3da09cc1c0$export$5168abbf3ad664a0();
|
|
97
|
-
return /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Box, {
|
|
95
|
+
const $2e16b6f9c0e7012d$export$6da19a24bf249f17 = ({ testId: testId = "cf-ui-modal-content" , className: className , children: children , ...otherProps })=>{
|
|
96
|
+
const styles = (0, $d20e7c3da09cc1c0$export$5168abbf3ad664a0)();
|
|
97
|
+
return /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Box), {
|
|
98
98
|
...otherProps,
|
|
99
99
|
as: "div",
|
|
100
|
-
className: $ggPfR$cx(styles.root, className),
|
|
100
|
+
className: (0, $ggPfR$cx)(styles.root, className),
|
|
101
101
|
testId: testId
|
|
102
102
|
}, children);
|
|
103
103
|
};
|
|
104
|
-
$2e16b6f9c0e7012d$export$6da19a24bf249f17.displayName =
|
|
104
|
+
$2e16b6f9c0e7012d$export$6da19a24bf249f17.displayName = "ModalContent";
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
function $f482f3cd8cb551fb$export$9af97f4b0b4c597a(props) {
|
|
111
|
-
const modal = $ggPfR$cx(/*#__PURE__*/ $ggPfR$css({
|
|
112
|
-
margin: $ggPfR$contentfulf36tokens.spacing2Xl,
|
|
113
|
-
backgroundColor: $ggPfR$contentfulf36tokens.colorWhite,
|
|
114
|
-
borderRadius: props.size ===
|
|
115
|
-
boxShadow: $ggPfR$contentfulf36tokens.boxShadowHeavy,
|
|
116
|
-
maxHeight: `calc(100vh - 1rem * (100 / ${$ggPfR$contentfulf36tokens.fontBaseDefault}))`,
|
|
117
|
-
maxWidth: `calc(100vw - 1rem * (100 / ${$ggPfR$contentfulf36tokens.fontBaseDefault}))`,
|
|
118
|
-
overflow:
|
|
119
|
-
display:
|
|
120
|
-
flexDirection:
|
|
121
|
-
}), props.allowHeightOverflow ? /*#__PURE__*/ $ggPfR$css({
|
|
111
|
+
const modal = (0, $ggPfR$cx)(/*#__PURE__*/ (0, $ggPfR$css)({
|
|
112
|
+
margin: (0, $ggPfR$contentfulf36tokens).spacing2Xl,
|
|
113
|
+
backgroundColor: (0, $ggPfR$contentfulf36tokens).colorWhite,
|
|
114
|
+
borderRadius: props.size === "zen" ? 0 : (0, $ggPfR$contentfulf36tokens).borderRadiusMedium,
|
|
115
|
+
boxShadow: (0, $ggPfR$contentfulf36tokens).boxShadowHeavy,
|
|
116
|
+
maxHeight: `calc(100vh - 1rem * (100 / ${(0, $ggPfR$contentfulf36tokens).fontBaseDefault}))`,
|
|
117
|
+
maxWidth: `calc(100vw - 1rem * (100 / ${(0, $ggPfR$contentfulf36tokens).fontBaseDefault}))`,
|
|
118
|
+
overflow: "hidden",
|
|
119
|
+
display: "flex",
|
|
120
|
+
flexDirection: "column"
|
|
121
|
+
}), props.allowHeightOverflow ? /*#__PURE__*/ (0, $ggPfR$css)({
|
|
122
122
|
name: "1evlo53",
|
|
123
123
|
styles: "overflow:auto;max-height:none;"
|
|
124
|
-
}) : null, props.size ===
|
|
124
|
+
}) : null, props.size === "zen" ? /*#__PURE__*/ (0, $ggPfR$css)({
|
|
125
125
|
name: "11c88st",
|
|
126
126
|
styles: "max-width:none;max-height:none;margin:0;height:100%;width:100%;"
|
|
127
127
|
}) : null, props.className);
|
|
128
128
|
return {
|
|
129
|
-
portal: /*#__PURE__*/ $ggPfR$css({
|
|
129
|
+
portal: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
130
130
|
name: "13o7eu2",
|
|
131
131
|
styles: "display:block;"
|
|
132
132
|
}),
|
|
133
133
|
base: {
|
|
134
|
-
root: $ggPfR$cx(/*#__PURE__*/ $ggPfR$css({
|
|
135
|
-
zIndex: $ggPfR$contentfulf36tokens.zIndexModalContent,
|
|
136
|
-
position:
|
|
134
|
+
root: (0, $ggPfR$cx)(/*#__PURE__*/ (0, $ggPfR$css)({
|
|
135
|
+
zIndex: (0, $ggPfR$contentfulf36tokens).zIndexModalContent,
|
|
136
|
+
position: "relative",
|
|
137
137
|
padding: 0,
|
|
138
|
-
display:
|
|
139
|
-
margin:
|
|
140
|
-
textAlign:
|
|
141
|
-
outline:
|
|
142
|
-
transform: props.size ===
|
|
143
|
-
transition: `transform ${$ggPfR$contentfulf36tokens.transitionDurationDefault} ${$ggPfR$contentfulf36tokens.transitionEasingDefault}`
|
|
144
|
-
}), props.size ===
|
|
138
|
+
display: "inline-block",
|
|
139
|
+
margin: "0 auto",
|
|
140
|
+
textAlign: "left",
|
|
141
|
+
outline: "none",
|
|
142
|
+
transform: props.size === "zen" ? "scale(1)" : "scale(0.85)",
|
|
143
|
+
transition: `transform ${(0, $ggPfR$contentfulf36tokens).transitionDurationDefault} ${(0, $ggPfR$contentfulf36tokens).transitionEasingDefault}`
|
|
144
|
+
}), props.size === "zen" ? /*#__PURE__*/ (0, $ggPfR$css)({
|
|
145
145
|
name: "uwwqev",
|
|
146
146
|
styles: "width:100%;height:100%;"
|
|
147
147
|
}) : null),
|
|
148
|
-
afterOpen: /*#__PURE__*/ $ggPfR$css({
|
|
148
|
+
afterOpen: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
149
149
|
name: "plgkgv",
|
|
150
150
|
styles: "transform:scale(1) !important;"
|
|
151
151
|
}),
|
|
152
|
-
beforeClose: /*#__PURE__*/ $ggPfR$css({
|
|
153
|
-
transform: props.size ===
|
|
152
|
+
beforeClose: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
153
|
+
transform: props.size === "zen" ? "scale(1)" : "scale(0.85)"
|
|
154
154
|
})
|
|
155
155
|
},
|
|
156
156
|
modalOverlay: {
|
|
157
|
-
root: $ggPfR$cx(/*#__PURE__*/ $ggPfR$css({
|
|
158
|
-
display:
|
|
159
|
-
alignItems:
|
|
160
|
-
flexWrap:
|
|
157
|
+
root: (0, $ggPfR$cx)(/*#__PURE__*/ (0, $ggPfR$css)({
|
|
158
|
+
display: "flex",
|
|
159
|
+
alignItems: "baseline",
|
|
160
|
+
flexWrap: "wrap",
|
|
161
161
|
top: 0,
|
|
162
162
|
right: 0,
|
|
163
163
|
bottom: 0,
|
|
164
164
|
left: 0,
|
|
165
|
-
zIndex: $ggPfR$contentfulf36tokens.zIndexModal,
|
|
165
|
+
zIndex: (0, $ggPfR$contentfulf36tokens).zIndexModal,
|
|
166
166
|
opacity: 0,
|
|
167
|
-
transition: `opacity ${$ggPfR$contentfulf36tokens.transitionDurationDefault} ${$ggPfR$contentfulf36tokens.transitionEasingDefault}`,
|
|
168
|
-
position:
|
|
169
|
-
overflowY:
|
|
170
|
-
backgroundColor:
|
|
171
|
-
textAlign:
|
|
172
|
-
}), props.position ===
|
|
167
|
+
transition: `opacity ${(0, $ggPfR$contentfulf36tokens).transitionDurationDefault} ${(0, $ggPfR$contentfulf36tokens).transitionEasingDefault}`,
|
|
168
|
+
position: "fixed",
|
|
169
|
+
overflowY: "auto",
|
|
170
|
+
backgroundColor: "rgba(12, 20, 28, 0.74902)",
|
|
171
|
+
textAlign: "center"
|
|
172
|
+
}), props.position === "center" ? /*#__PURE__*/ (0, $ggPfR$css)({
|
|
173
173
|
name: "1qe4tyl",
|
|
174
174
|
styles: "align-items:center;justify-content:center;"
|
|
175
|
-
}) : null),
|
|
176
|
-
afterOpen: /*#__PURE__*/ $ggPfR$css({
|
|
175
|
+
}) : null, props.overlayClassName),
|
|
176
|
+
afterOpen: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
177
177
|
name: "whh5e5",
|
|
178
178
|
styles: "opacity:1;"
|
|
179
179
|
}),
|
|
180
|
-
beforeClose: /*#__PURE__*/ $ggPfR$css({
|
|
180
|
+
beforeClose: /*#__PURE__*/ (0, $ggPfR$css)({
|
|
181
181
|
name: "q7lffx",
|
|
182
182
|
styles: "opacity:0;"
|
|
183
183
|
})
|
|
@@ -188,23 +188,24 @@ function $f482f3cd8cb551fb$export$9af97f4b0b4c597a(props) {
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
const $bfd2aa2f2cc9e088$var$ModalSizesMapper = {
|
|
191
|
-
medium:
|
|
192
|
-
small:
|
|
193
|
-
large:
|
|
194
|
-
fullWidth:
|
|
195
|
-
zen:
|
|
191
|
+
medium: "520px",
|
|
192
|
+
small: "400px",
|
|
193
|
+
large: "700px",
|
|
194
|
+
fullWidth: "100vw",
|
|
195
|
+
zen: "100vw"
|
|
196
196
|
};
|
|
197
197
|
function $bfd2aa2f2cc9e088$var$focusFirstWithinNode(node) {
|
|
198
198
|
if (node && node.querySelectorAll) {
|
|
199
|
-
const elements = node.querySelectorAll(
|
|
199
|
+
const elements = node.querySelectorAll("input, button");
|
|
200
200
|
if (elements.length > 0) {
|
|
201
201
|
const firstElement = elements[0]; // @ts-expect-error focus might be missing
|
|
202
|
-
if (typeof firstElement.focus ===
|
|
202
|
+
if (typeof firstElement.focus === "function") // @ts-expect-error focus might be missing
|
|
203
203
|
firstElement.focus();
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
const $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772 = ({ allowHeightOverflow: allowHeightOverflow = false , position: position =
|
|
207
|
+
const $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772 = ({ allowHeightOverflow: allowHeightOverflow = false , position: position = "center" , shouldCloseOnEscapePress: shouldCloseOnEscapePress = true , shouldCloseOnOverlayClick: shouldCloseOnOverlayClick = true , size: size = "medium" , testId: testId = "cf-ui-modal" , topOffset: topOffset = "50px" , aria: aria , ...otherProps })=>{
|
|
208
|
+
var ref2, ref1;
|
|
208
209
|
const contentRef = $ggPfR$useRef(null);
|
|
209
210
|
const props = {
|
|
210
211
|
...otherProps,
|
|
@@ -216,11 +217,12 @@ const $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772 = ({ allowHeightOverflow: allowH
|
|
|
216
217
|
testId: testId,
|
|
217
218
|
topOffset: topOffset
|
|
218
219
|
};
|
|
219
|
-
const styles = $f482f3cd8cb551fb$export$9af97f4b0b4c597a({
|
|
220
|
+
const styles = (0, $f482f3cd8cb551fb$export$9af97f4b0b4c597a)({
|
|
220
221
|
position: position,
|
|
221
222
|
size: size,
|
|
222
223
|
allowHeightOverflow: allowHeightOverflow,
|
|
223
|
-
className: otherProps.className
|
|
224
|
+
className: otherProps.className,
|
|
225
|
+
overlayClassName: (ref2 = otherProps.overlayProps) === null || ref2 === void 0 ? void 0 : ref2.className
|
|
224
226
|
});
|
|
225
227
|
$ggPfR$useEffect(()=>{
|
|
226
228
|
if (props.isShown) setTimeout(()=>{
|
|
@@ -233,13 +235,13 @@ const $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772 = ({ allowHeightOverflow: allowH
|
|
|
233
235
|
props.initialFocusRef
|
|
234
236
|
]);
|
|
235
237
|
const renderDefault = ()=>{
|
|
236
|
-
return /*#__PURE__*/ $ggPfR$createElement($ggPfR$Fragment, null, otherProps.title && /*#__PURE__*/ $ggPfR$createElement($08ed4541188cb150$export$f50a68e3694789ee, {
|
|
238
|
+
return /*#__PURE__*/ $ggPfR$createElement($ggPfR$Fragment, null, otherProps.title && /*#__PURE__*/ $ggPfR$createElement((0, $08ed4541188cb150$export$f50a68e3694789ee), {
|
|
237
239
|
title: otherProps.title,
|
|
238
240
|
onClose: props.onClose,
|
|
239
241
|
...otherProps.modalHeaderProps
|
|
240
|
-
}), /*#__PURE__*/ $ggPfR$createElement($2e16b6f9c0e7012d$export$6da19a24bf249f17, otherProps.modalContentProps, otherProps.children));
|
|
242
|
+
}), /*#__PURE__*/ $ggPfR$createElement((0, $2e16b6f9c0e7012d$export$6da19a24bf249f17), otherProps.modalContentProps, otherProps.children));
|
|
241
243
|
};
|
|
242
|
-
return /*#__PURE__*/ $ggPfR$createElement($ggPfR$reactmodal, {
|
|
244
|
+
return /*#__PURE__*/ $ggPfR$createElement((0, $ggPfR$reactmodal), {
|
|
243
245
|
ariaHideApp: false,
|
|
244
246
|
aria: aria,
|
|
245
247
|
onRequestClose: props.onClose,
|
|
@@ -252,8 +254,9 @@ const $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772 = ({ allowHeightOverflow: allowH
|
|
|
252
254
|
portalClassName: styles.portal,
|
|
253
255
|
style: {
|
|
254
256
|
content: {
|
|
255
|
-
top: position ===
|
|
256
|
-
}
|
|
257
|
+
top: position === "center" ? 0 : topOffset
|
|
258
|
+
},
|
|
259
|
+
overlay: (ref1 = otherProps.overlayProps) === null || ref1 === void 0 ? void 0 : ref1.style
|
|
257
260
|
},
|
|
258
261
|
className: {
|
|
259
262
|
base: styles.base.root,
|
|
@@ -269,16 +272,16 @@ const $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772 = ({ allowHeightOverflow: allowH
|
|
|
269
272
|
contentRef: (ref)=>{
|
|
270
273
|
contentRef.current = ref;
|
|
271
274
|
}
|
|
272
|
-
}, /*#__PURE__*/ $ggPfR$createElement($ggPfR$Box, {
|
|
275
|
+
}, /*#__PURE__*/ $ggPfR$createElement((0, $ggPfR$Box), {
|
|
273
276
|
testId: testId,
|
|
274
277
|
style: {
|
|
275
278
|
width: $bfd2aa2f2cc9e088$var$ModalSizesMapper[size] || size
|
|
276
279
|
},
|
|
277
280
|
className: styles.modal,
|
|
278
281
|
"data-modal-root": true
|
|
279
|
-
}, typeof otherProps.children ===
|
|
282
|
+
}, typeof otherProps.children === "function" ? otherProps.children(props) : renderDefault()));
|
|
280
283
|
};
|
|
281
|
-
$bfd2aa2f2cc9e088$export$2b77a92f1a5ad772.displayName =
|
|
284
|
+
$bfd2aa2f2cc9e088$export$2b77a92f1a5ad772.displayName = "Modal";
|
|
282
285
|
|
|
283
286
|
|
|
284
287
|
|
|
@@ -286,8 +289,8 @@ $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772.displayName = 'Modal';
|
|
|
286
289
|
|
|
287
290
|
|
|
288
291
|
|
|
289
|
-
const $12733d8c9bae35ea$export$c63fb08199be8e0e = ({ testId: testId =
|
|
290
|
-
return /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Flex, {
|
|
292
|
+
const $12733d8c9bae35ea$export$c63fb08199be8e0e = ({ testId: testId = "cf-ui-modal-controls" , className: className , children: children , ...otherProps })=>{
|
|
293
|
+
return /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Flex), {
|
|
291
294
|
...otherProps,
|
|
292
295
|
className: className,
|
|
293
296
|
testId: testId,
|
|
@@ -295,26 +298,26 @@ const $12733d8c9bae35ea$export$c63fb08199be8e0e = ({ testId: testId = 'cf-ui-mod
|
|
|
295
298
|
justifyContent: "flex-end",
|
|
296
299
|
margin: "spacingL",
|
|
297
300
|
marginTop: "none"
|
|
298
|
-
}, /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$ButtonGroup, {
|
|
301
|
+
}, /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$ButtonGroup), {
|
|
299
302
|
variant: "spaced",
|
|
300
303
|
spacing: "spacingS"
|
|
301
304
|
}, children));
|
|
302
305
|
};
|
|
303
|
-
$12733d8c9bae35ea$export$c63fb08199be8e0e.displayName =
|
|
306
|
+
$12733d8c9bae35ea$export$c63fb08199be8e0e.displayName = "ModalControls";
|
|
304
307
|
|
|
305
308
|
|
|
306
|
-
const $d7b21827f6622ba3$export$2b77a92f1a5ad772 = $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772;
|
|
307
|
-
$d7b21827f6622ba3$export$2b77a92f1a5ad772.Content = $2e16b6f9c0e7012d$export$6da19a24bf249f17;
|
|
308
|
-
$d7b21827f6622ba3$export$2b77a92f1a5ad772.Header = $08ed4541188cb150$export$f50a68e3694789ee;
|
|
309
|
-
$d7b21827f6622ba3$export$2b77a92f1a5ad772.Controls = $12733d8c9bae35ea$export$c63fb08199be8e0e;
|
|
309
|
+
const $d7b21827f6622ba3$export$2b77a92f1a5ad772 = (0, $bfd2aa2f2cc9e088$export$2b77a92f1a5ad772);
|
|
310
|
+
$d7b21827f6622ba3$export$2b77a92f1a5ad772.Content = (0, $2e16b6f9c0e7012d$export$6da19a24bf249f17);
|
|
311
|
+
$d7b21827f6622ba3$export$2b77a92f1a5ad772.Header = (0, $08ed4541188cb150$export$f50a68e3694789ee);
|
|
312
|
+
$d7b21827f6622ba3$export$2b77a92f1a5ad772.Controls = (0, $12733d8c9bae35ea$export$c63fb08199be8e0e);
|
|
310
313
|
|
|
311
314
|
|
|
312
315
|
|
|
313
316
|
|
|
314
317
|
|
|
315
|
-
const $78040759975f86df$export$427af6990c8ff682 = ({ allowHeightOverflow: allowHeightOverflow = false , cancelLabel: cancelLabel =
|
|
316
|
-
const cancelRef = $ggPfR$react.useRef(null);
|
|
317
|
-
const confirmButton = confirmLabel ? /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Button, {
|
|
318
|
+
const $78040759975f86df$export$427af6990c8ff682 = ({ allowHeightOverflow: allowHeightOverflow = false , cancelLabel: cancelLabel = "Cancel" , cancelTestId: cancelTestId = "cf-ui-modal-confirm-cancel-button" , children: children , confirmLabel: confirmLabel = "Confirm" , confirmTestId: confirmTestId = "cf-ui-modal-confirm-confirm-button" , intent: intent = "positive" , isConfirmDisabled: isConfirmDisabled = false , isConfirmLoading: isConfirmLoading = false , isShown: isShown , modalContentProps: modalContentProps , modalControlsProps: modalControlsProps , modalHeaderProps: modalHeaderProps , onCancel: onCancel , onConfirm: onConfirm , shouldCloseOnEscapePress: shouldCloseOnEscapePress = true , shouldCloseOnOverlayClick: shouldCloseOnOverlayClick = true , size: size = "medium" , testId: testId = "cf-ui-modal-confirm" , title: title = "Are you sure?" , initialFocusRef: initialFocusRef })=>{
|
|
319
|
+
const cancelRef = (0, $ggPfR$react).useRef(null);
|
|
320
|
+
const confirmButton = confirmLabel ? /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Button), {
|
|
318
321
|
testId: confirmTestId,
|
|
319
322
|
isDisabled: isConfirmDisabled,
|
|
320
323
|
isLoading: isConfirmLoading,
|
|
@@ -322,14 +325,14 @@ const $78040759975f86df$export$427af6990c8ff682 = ({ allowHeightOverflow: allowH
|
|
|
322
325
|
size: "small",
|
|
323
326
|
onClick: ()=>onConfirm()
|
|
324
327
|
}, confirmLabel) : null;
|
|
325
|
-
const cancelButton = cancelLabel ? /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$Button, {
|
|
328
|
+
const cancelButton = cancelLabel ? /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$Button), {
|
|
326
329
|
testId: cancelTestId,
|
|
327
330
|
variant: "secondary",
|
|
328
331
|
onClick: onCancel,
|
|
329
332
|
size: "small",
|
|
330
333
|
ref: initialFocusRef || cancelRef
|
|
331
334
|
}, cancelLabel) : null;
|
|
332
|
-
return /*#__PURE__*/ $ggPfR$react.createElement($d7b21827f6622ba3$export$2b77a92f1a5ad772, {
|
|
335
|
+
return /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $d7b21827f6622ba3$export$2b77a92f1a5ad772), {
|
|
333
336
|
testId: testId,
|
|
334
337
|
isShown: isShown,
|
|
335
338
|
onClose: onCancel,
|
|
@@ -339,13 +342,13 @@ const $78040759975f86df$export$427af6990c8ff682 = ({ allowHeightOverflow: allowH
|
|
|
339
342
|
allowHeightOverflow: allowHeightOverflow,
|
|
340
343
|
initialFocusRef: cancelRef
|
|
341
344
|
}, ()=>{
|
|
342
|
-
return /*#__PURE__*/ $ggPfR$react.createElement($ggPfR$react.Fragment, null, /*#__PURE__*/ $ggPfR$react.createElement($d7b21827f6622ba3$export$2b77a92f1a5ad772.Header, {
|
|
343
|
-
title: title ||
|
|
345
|
+
return /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $ggPfR$react).Fragment, null, /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $d7b21827f6622ba3$export$2b77a92f1a5ad772).Header, {
|
|
346
|
+
title: title || "",
|
|
344
347
|
...modalHeaderProps
|
|
345
|
-
}), /*#__PURE__*/ $ggPfR$react.createElement($d7b21827f6622ba3$export$2b77a92f1a5ad772.Content, modalContentProps, children), /*#__PURE__*/ $ggPfR$react.createElement($d7b21827f6622ba3$export$2b77a92f1a5ad772.Controls, modalControlsProps, cancelButton, confirmButton));
|
|
348
|
+
}), /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $d7b21827f6622ba3$export$2b77a92f1a5ad772).Content, modalContentProps, children), /*#__PURE__*/ (0, $ggPfR$react).createElement((0, $d7b21827f6622ba3$export$2b77a92f1a5ad772).Controls, modalControlsProps, cancelButton, confirmButton));
|
|
346
349
|
});
|
|
347
350
|
};
|
|
348
|
-
$78040759975f86df$export$427af6990c8ff682.displayName =
|
|
351
|
+
$78040759975f86df$export$427af6990c8ff682.displayName = "ModalConfirm";
|
|
349
352
|
|
|
350
353
|
|
|
351
354
|
|
|
@@ -357,8 +360,8 @@ const $1dc787d4cf525536$var$getRoot = (rootElId)=>{
|
|
|
357
360
|
let rootDom = document.getElementById(rootElId);
|
|
358
361
|
if (rootDom !== null) return rootDom;
|
|
359
362
|
// Otherwise create it
|
|
360
|
-
rootDom = document.createElement(
|
|
361
|
-
rootDom.setAttribute(
|
|
363
|
+
rootDom = document.createElement("div");
|
|
364
|
+
rootDom.setAttribute("id", rootElId);
|
|
362
365
|
document.body.appendChild(rootDom);
|
|
363
366
|
return rootDom;
|
|
364
367
|
};
|
|
@@ -370,9 +373,8 @@ function $1dc787d4cf525536$var$closeAll() {
|
|
|
370
373
|
isShown: false
|
|
371
374
|
};
|
|
372
375
|
render(config);
|
|
373
|
-
await new Promise((resolveDelay)=>setTimeout(resolveDelay, delay)
|
|
374
|
-
);
|
|
375
|
-
$ggPfR$reactdom.unmountComponentAtNode($1dc787d4cf525536$var$getRoot(rootElId));
|
|
376
|
+
await new Promise((resolveDelay)=>setTimeout(resolveDelay, delay));
|
|
377
|
+
(0, $ggPfR$reactdom).unmountComponentAtNode($1dc787d4cf525536$var$getRoot(rootElId));
|
|
376
378
|
$1dc787d4cf525536$var$openModalsIds.delete(rootElId);
|
|
377
379
|
});
|
|
378
380
|
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -389,7 +391,7 @@ function $1dc787d4cf525536$var$open(componentRenderer, options = {}) {
|
|
|
389
391
|
isShown: true
|
|
390
392
|
};
|
|
391
393
|
function render({ onClose: onClose , isShown: isShown }) {
|
|
392
|
-
$ggPfR$reactdom.render(componentRenderer({
|
|
394
|
+
(0, $ggPfR$reactdom).render(componentRenderer({
|
|
393
395
|
onClose: onClose,
|
|
394
396
|
isShown: isShown
|
|
395
397
|
}), rootDom);
|
|
@@ -400,9 +402,8 @@ function $1dc787d4cf525536$var$open(componentRenderer, options = {}) {
|
|
|
400
402
|
isShown: false
|
|
401
403
|
};
|
|
402
404
|
render(currentConfig);
|
|
403
|
-
await new Promise((resolveDelay)=>setTimeout(resolveDelay, options.delay)
|
|
404
|
-
);
|
|
405
|
-
$ggPfR$reactdom.unmountComponentAtNode(rootDom);
|
|
405
|
+
await new Promise((resolveDelay)=>setTimeout(resolveDelay, options.delay));
|
|
406
|
+
(0, $ggPfR$reactdom).unmountComponentAtNode(rootDom);
|
|
406
407
|
rootDom.remove();
|
|
407
408
|
$1dc787d4cf525536$var$openModalsIds.delete(rootElId);
|
|
408
409
|
resolve(arg);
|