@react-spectrum/overlays 4.0.0 → 5.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.
- package/dist/import.mjs +558 -0
- package/dist/main.css +1 -1
- package/dist/main.js +223 -123
- package/dist/main.js.map +1 -1
- package/dist/module.js +224 -124
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -10
- package/src/Modal.tsx +11 -9
- package/src/OpenTransition.tsx +1 -1
- package/src/Overlay.tsx +3 -2
- package/src/Popover.tsx +11 -7
- package/src/Tray.tsx +12 -8
package/dist/module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {Provider as $fQOb3$Provider} from "@react-spectrum/provider";
|
|
3
|
-
import $fQOb3$react, {useState as $fQOb3$useState, useCallback as $fQOb3$useCallback,
|
|
3
|
+
import $fQOb3$react, {useState as $fQOb3$useState, useCallback as $fQOb3$useCallback, useRef as $fQOb3$useRef, forwardRef as $fQOb3$forwardRef} from "react";
|
|
4
4
|
import {Overlay as $fQOb3$Overlay, usePopover as $fQOb3$usePopover, DismissButton as $fQOb3$DismissButton, useModalOverlay as $fQOb3$useModalOverlay} from "@react-aria/overlays";
|
|
5
|
-
import $fQOb3$
|
|
5
|
+
import {Transition as $fQOb3$Transition} from "react-transition-group";
|
|
6
6
|
import {useDOMRef as $fQOb3$useDOMRef, useStyleProps as $fQOb3$useStyleProps, classNames as $fQOb3$classNames} from "@react-spectrum/utils";
|
|
7
7
|
import {useLayoutEffect as $fQOb3$useLayoutEffect, useViewportSize as $fQOb3$useViewportSize} from "@react-aria/utils";
|
|
8
8
|
|
|
@@ -12,25 +12,54 @@ function $parcel$interopDefault(a) {
|
|
|
12
12
|
function $parcel$export(e, n, v, s) {
|
|
13
13
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/ /// <reference types="css-module-types" />
|
|
26
|
+
/*
|
|
27
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
28
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
29
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
30
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
31
|
+
*
|
|
32
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
33
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
34
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
35
|
+
* governing permissions and limitations under the License.
|
|
36
|
+
*/ /*
|
|
37
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
38
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
39
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
40
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
41
|
+
*
|
|
42
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
43
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
44
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
45
|
+
* governing permissions and limitations under the License.
|
|
46
|
+
*/
|
|
16
47
|
|
|
17
48
|
const $bc765a7a041310da$var$OPEN_STATES = {
|
|
18
49
|
entering: false,
|
|
19
50
|
entered: true
|
|
20
51
|
};
|
|
21
52
|
function $bc765a7a041310da$export$b847a40ee92eff38(props) {
|
|
22
|
-
var
|
|
23
|
-
return
|
|
53
|
+
var child;
|
|
54
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$Transition), {
|
|
24
55
|
timeout: {
|
|
25
56
|
enter: 0,
|
|
26
57
|
exit: 350
|
|
27
58
|
},
|
|
28
59
|
...props
|
|
29
|
-
}, (state)
|
|
60
|
+
}, (state)=>(0, $fQOb3$react).Children.map(props.children, (child)=>child && /*#__PURE__*/ (0, $fQOb3$react).cloneElement(child, {
|
|
30
61
|
isOpen: !!$bc765a7a041310da$var$OPEN_STATES[state]
|
|
31
|
-
})
|
|
32
|
-
)
|
|
33
|
-
));
|
|
62
|
+
})));
|
|
34
63
|
}
|
|
35
64
|
|
|
36
65
|
|
|
@@ -38,15 +67,15 @@ function $bc765a7a041310da$export$b847a40ee92eff38(props) {
|
|
|
38
67
|
|
|
39
68
|
|
|
40
69
|
function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
41
|
-
let { children: children , isOpen: isOpen , container: container , onEnter: onEnter , onEntering: onEntering , onEntered: onEntered , onExit: onExit , onExiting: onExiting , onExited: onExited } = props;
|
|
42
|
-
let [exited, setExited] = $fQOb3$useState(!isOpen);
|
|
43
|
-
let handleEntered = $fQOb3$useCallback(()=>{
|
|
70
|
+
let { children: children , isOpen: isOpen , container: container , onEnter: onEnter , onEntering: onEntering , onEntered: onEntered , onExit: onExit , onExiting: onExiting , onExited: onExited , nodeRef: nodeRef } = props;
|
|
71
|
+
let [exited, setExited] = (0, $fQOb3$useState)(!isOpen);
|
|
72
|
+
let handleEntered = (0, $fQOb3$useCallback)(()=>{
|
|
44
73
|
setExited(false);
|
|
45
74
|
if (onEntered) onEntered();
|
|
46
75
|
}, [
|
|
47
76
|
onEntered
|
|
48
77
|
]);
|
|
49
|
-
let handleExited = $fQOb3$useCallback(()=>{
|
|
78
|
+
let handleExited = (0, $fQOb3$useCallback)(()=>{
|
|
50
79
|
setExited(true);
|
|
51
80
|
if (onExited) onExited();
|
|
52
81
|
}, [
|
|
@@ -56,16 +85,16 @@ function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
|
56
85
|
let mountOverlay = isOpen || !exited;
|
|
57
86
|
if (!mountOverlay) // Don't bother showing anything if we don't have to.
|
|
58
87
|
return null;
|
|
59
|
-
return
|
|
88
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$Overlay), {
|
|
60
89
|
portalContainer: container
|
|
61
|
-
}, /*#__PURE__*/ $fQOb3$react.createElement($fQOb3$Provider, {
|
|
90
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$Provider), {
|
|
62
91
|
ref: ref,
|
|
63
92
|
UNSAFE_style: {
|
|
64
|
-
background:
|
|
65
|
-
isolation:
|
|
93
|
+
background: "transparent",
|
|
94
|
+
isolation: "isolate"
|
|
66
95
|
},
|
|
67
96
|
isDisabled: false
|
|
68
|
-
}, /*#__PURE__*/ $fQOb3$react.createElement($bc765a7a041310da$export$b847a40ee92eff38, {
|
|
97
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $bc765a7a041310da$export$b847a40ee92eff38), {
|
|
69
98
|
in: isOpen,
|
|
70
99
|
appear: true,
|
|
71
100
|
onExit: onExit,
|
|
@@ -73,13 +102,24 @@ function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
|
73
102
|
onExited: handleExited,
|
|
74
103
|
onEnter: onEnter,
|
|
75
104
|
onEntering: onEntering,
|
|
76
|
-
onEntered: handleEntered
|
|
77
|
-
|
|
105
|
+
onEntered: handleEntered,
|
|
106
|
+
nodeRef: nodeRef
|
|
107
|
+
}, children)));
|
|
78
108
|
}
|
|
79
|
-
let $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ $fQOb3$react.forwardRef($70305dc5fb729c3b$var$Overlay);
|
|
80
|
-
|
|
109
|
+
let $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $fQOb3$react).forwardRef($70305dc5fb729c3b$var$Overlay);
|
|
81
110
|
|
|
82
111
|
|
|
112
|
+
/*
|
|
113
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
114
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
115
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
116
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
117
|
+
*
|
|
118
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
119
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
120
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
121
|
+
* governing permissions and limitations under the License.
|
|
122
|
+
*/
|
|
83
123
|
|
|
84
124
|
|
|
85
125
|
var $853e19557ad8790f$exports = {};
|
|
@@ -148,7 +188,17 @@ $645594d913f34a2a$export$cf634262e726cd19 = "spectrum-Popover--dialog_6115b8";
|
|
|
148
188
|
$645594d913f34a2a$export$d8b16c5377728262 = "spectrum-Popover--withTip_6115b8";
|
|
149
189
|
|
|
150
190
|
|
|
151
|
-
|
|
191
|
+
/*
|
|
192
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
193
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
195
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
*
|
|
197
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
198
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
199
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
200
|
+
* governing permissions and limitations under the License.
|
|
201
|
+
*/
|
|
152
202
|
|
|
153
203
|
var $c77d7b73b2bbd0fb$exports = {};
|
|
154
204
|
|
|
@@ -164,12 +214,12 @@ $c77d7b73b2bbd0fb$export$8eb3860104039b44 = "spectrum-Underlay--transparent_eb76
|
|
|
164
214
|
|
|
165
215
|
|
|
166
216
|
function $76a452f4e3df11be$export$f360afc887607b02({ isOpen: isOpen , isTransparent: isTransparent }) {
|
|
167
|
-
return
|
|
168
|
-
className: $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($c77d7b73b2bbd0fb$exports)),
|
|
169
|
-
|
|
170
|
-
|
|
217
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
218
|
+
className: (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c77d7b73b2bbd0fb$exports))), "spectrum-Underlay", {
|
|
219
|
+
"is-open": isOpen,
|
|
220
|
+
"spectrum-Underlay--transparent": isTransparent
|
|
171
221
|
})
|
|
172
|
-
})
|
|
222
|
+
});
|
|
173
223
|
}
|
|
174
224
|
|
|
175
225
|
|
|
@@ -181,35 +231,41 @@ function $76a452f4e3df11be$export$f360afc887607b02({ isOpen: isOpen , isTranspar
|
|
|
181
231
|
* the path always starts at 0 so that it perfectly overlaps the popover's border.
|
|
182
232
|
* See bottom of file for more explanation.
|
|
183
233
|
*/ let $17b503f7de08fecc$var$arrowPlacement = {
|
|
184
|
-
left:
|
|
185
|
-
right:
|
|
186
|
-
top:
|
|
187
|
-
bottom:
|
|
234
|
+
left: "right",
|
|
235
|
+
right: "right",
|
|
236
|
+
top: "bottom",
|
|
237
|
+
bottom: "bottom"
|
|
188
238
|
};
|
|
189
239
|
function $17b503f7de08fecc$var$Popover(props, ref) {
|
|
190
240
|
let { children: children , state: state , ...otherProps } = props;
|
|
191
|
-
let domRef = $fQOb3$useDOMRef(ref);
|
|
192
|
-
|
|
241
|
+
let domRef = (0, $fQOb3$useDOMRef)(ref);
|
|
242
|
+
let wrapperRef = (0, $fQOb3$useRef)(null);
|
|
243
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $70305dc5fb729c3b$export$c6fdb837b070b4ff), {
|
|
193
244
|
...otherProps,
|
|
194
|
-
isOpen: state.isOpen
|
|
195
|
-
|
|
245
|
+
isOpen: state.isOpen,
|
|
246
|
+
nodeRef: wrapperRef
|
|
247
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement($17b503f7de08fecc$var$PopoverWrapper, {
|
|
196
248
|
ref: domRef,
|
|
197
|
-
...props
|
|
198
|
-
|
|
249
|
+
...props,
|
|
250
|
+
wrapperRef: wrapperRef
|
|
251
|
+
}, children));
|
|
199
252
|
}
|
|
200
|
-
const $17b503f7de08fecc$var$PopoverWrapper = /*#__PURE__*/ $fQOb3$forwardRef((props, ref)=>{
|
|
201
|
-
let { children: children , isOpen: isOpen , hideArrow: hideArrow , isNonModal: isNonModal , state: state } = props;
|
|
202
|
-
let { styleProps: styleProps } = $fQOb3$useStyleProps(props);
|
|
203
|
-
let { popoverProps: popoverProps , arrowProps: arrowProps , underlayProps: underlayProps , placement: placement } = $fQOb3$usePopover({
|
|
253
|
+
const $17b503f7de08fecc$var$PopoverWrapper = /*#__PURE__*/ (0, $fQOb3$forwardRef)((props, ref)=>{
|
|
254
|
+
let { children: children , isOpen: isOpen , hideArrow: hideArrow , isNonModal: isNonModal , state: state , wrapperRef: wrapperRef } = props;
|
|
255
|
+
let { styleProps: styleProps } = (0, $fQOb3$useStyleProps)(props);
|
|
256
|
+
let { popoverProps: popoverProps , arrowProps: arrowProps , underlayProps: underlayProps , placement: placement } = (0, $fQOb3$usePopover)({
|
|
204
257
|
...props,
|
|
205
258
|
popoverRef: ref,
|
|
206
259
|
maxHeight: null
|
|
207
260
|
}, state);
|
|
208
|
-
|
|
261
|
+
// Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231
|
|
262
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
263
|
+
ref: wrapperRef
|
|
264
|
+
}, !isNonModal && /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $76a452f4e3df11be$export$f360afc887607b02), {
|
|
209
265
|
isTransparent: true,
|
|
210
266
|
...underlayProps,
|
|
211
267
|
isOpen: isOpen
|
|
212
|
-
}), /*#__PURE__*/ $fQOb3$react.createElement("div", {
|
|
268
|
+
}), /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
213
269
|
...styleProps,
|
|
214
270
|
...popoverProps,
|
|
215
271
|
style: {
|
|
@@ -217,39 +273,39 @@ const $17b503f7de08fecc$var$PopoverWrapper = /*#__PURE__*/ $fQOb3$forwardRef((pr
|
|
|
217
273
|
...popoverProps.style
|
|
218
274
|
},
|
|
219
275
|
ref: ref,
|
|
220
|
-
className: $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($645594d913f34a2a$exports)),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}, $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports)),
|
|
276
|
+
className: (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($645594d913f34a2a$exports))), "spectrum-Popover", `spectrum-Popover--${placement}`, {
|
|
277
|
+
"spectrum-Popover--withTip": !hideArrow,
|
|
278
|
+
"is-open": isOpen
|
|
279
|
+
}, (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports))), "spectrum-Popover", "react-spectrum-Popover"), styleProps.className),
|
|
224
280
|
role: "presentation",
|
|
225
281
|
"data-testid": "popover"
|
|
226
|
-
}, !isNonModal && /*#__PURE__*/ $fQOb3$react.createElement($fQOb3$DismissButton, {
|
|
282
|
+
}, !isNonModal && /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$DismissButton), {
|
|
227
283
|
onDismiss: state.close
|
|
228
|
-
}), children, hideArrow ? null : /*#__PURE__*/ $fQOb3$react.createElement($17b503f7de08fecc$var$Arrow, {
|
|
284
|
+
}), children, hideArrow ? null : /*#__PURE__*/ (0, $fQOb3$react).createElement($17b503f7de08fecc$var$Arrow, {
|
|
229
285
|
arrowProps: arrowProps,
|
|
230
286
|
direction: $17b503f7de08fecc$var$arrowPlacement[placement]
|
|
231
|
-
}), /*#__PURE__*/ $fQOb3$react.createElement($fQOb3$DismissButton, {
|
|
287
|
+
}), /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$DismissButton), {
|
|
232
288
|
onDismiss: state.close
|
|
233
|
-
})))
|
|
289
|
+
})));
|
|
234
290
|
});
|
|
235
291
|
let $17b503f7de08fecc$var$ROOT_2 = Math.sqrt(2);
|
|
236
292
|
function $17b503f7de08fecc$var$Arrow(props) {
|
|
237
|
-
let [size, setSize] = $fQOb3$useState(20);
|
|
238
|
-
let [borderWidth, setBorderWidth] = $fQOb3$useState(1);
|
|
239
|
-
let ref = $fQOb3$useRef();
|
|
293
|
+
let [size, setSize] = (0, $fQOb3$useState)(20);
|
|
294
|
+
let [borderWidth, setBorderWidth] = (0, $fQOb3$useState)(1);
|
|
295
|
+
let ref = (0, $fQOb3$useRef)();
|
|
240
296
|
// get the css value for the tip size and divide it by 2 for this arrow implementation
|
|
241
|
-
$fQOb3$useLayoutEffect(()=>{
|
|
297
|
+
(0, $fQOb3$useLayoutEffect)(()=>{
|
|
242
298
|
if (ref.current) {
|
|
243
|
-
let spectrumTipWidth = window.getComputedStyle(ref.current).getPropertyValue(
|
|
244
|
-
if (spectrumTipWidth !==
|
|
245
|
-
let spectrumBorderWidth = window.getComputedStyle(ref.current).getPropertyValue(
|
|
246
|
-
if (spectrumBorderWidth !==
|
|
299
|
+
let spectrumTipWidth = window.getComputedStyle(ref.current).getPropertyValue("--spectrum-popover-tip-size");
|
|
300
|
+
if (spectrumTipWidth !== "") setSize(parseInt(spectrumTipWidth, 10) / 2);
|
|
301
|
+
let spectrumBorderWidth = window.getComputedStyle(ref.current).getPropertyValue("--spectrum-popover-tip-borderWidth");
|
|
302
|
+
if (spectrumBorderWidth !== "") setBorderWidth(parseInt(spectrumBorderWidth, 10));
|
|
247
303
|
}
|
|
248
304
|
}, [
|
|
249
305
|
ref
|
|
250
306
|
]);
|
|
251
|
-
let landscape = props.direction ===
|
|
252
|
-
let mirror = props.direction ===
|
|
307
|
+
let landscape = props.direction === "top" || props.direction === "bottom";
|
|
308
|
+
let mirror = props.direction === "left" || props.direction === "top";
|
|
253
309
|
let borderDiagonal = borderWidth * $17b503f7de08fecc$var$ROOT_2;
|
|
254
310
|
let halfBorderDiagonal = borderDiagonal / 2;
|
|
255
311
|
let secondary = 2 * size + 2 * borderDiagonal;
|
|
@@ -260,44 +316,66 @@ function $17b503f7de08fecc$var$Arrow(props) {
|
|
|
260
316
|
let secondaryMiddle = secondary / 2;
|
|
261
317
|
let secondaryEnd = secondary - halfBorderDiagonal;
|
|
262
318
|
let pathData = landscape ? [
|
|
263
|
-
|
|
319
|
+
"M",
|
|
264
320
|
secondaryStart,
|
|
265
321
|
primaryStart,
|
|
266
|
-
|
|
322
|
+
"L",
|
|
267
323
|
secondaryMiddle,
|
|
268
324
|
primaryEnd,
|
|
269
|
-
|
|
325
|
+
"L",
|
|
270
326
|
secondaryEnd,
|
|
271
327
|
primaryStart
|
|
272
328
|
] : [
|
|
273
|
-
|
|
329
|
+
"M",
|
|
274
330
|
primaryStart,
|
|
275
331
|
secondaryStart,
|
|
276
|
-
|
|
332
|
+
"L",
|
|
277
333
|
primaryEnd,
|
|
278
334
|
secondaryMiddle,
|
|
279
|
-
|
|
335
|
+
"L",
|
|
280
336
|
primaryStart,
|
|
281
337
|
secondaryEnd
|
|
282
338
|
];
|
|
283
339
|
let arrowProps = props.arrowProps;
|
|
284
|
-
/* use ceil because the svg needs to always accomodate the path inside it */ return
|
|
340
|
+
/* use ceil because the svg needs to always accomodate the path inside it */ return /*#__PURE__*/ (0, $fQOb3$react).createElement("svg", {
|
|
285
341
|
xmlns: "http://www.w3.org/svg/2000",
|
|
286
342
|
width: Math.ceil(landscape ? secondary : primary),
|
|
287
343
|
height: Math.ceil(landscape ? primary : secondary),
|
|
288
344
|
style: props.style,
|
|
289
|
-
className: $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($645594d913f34a2a$exports)),
|
|
345
|
+
className: (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($645594d913f34a2a$exports))), "spectrum-Popover-tip"),
|
|
290
346
|
ref: ref,
|
|
291
347
|
...arrowProps
|
|
292
|
-
}, /*#__PURE__*/ $fQOb3$react.createElement("path", {
|
|
293
|
-
className: $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($645594d913f34a2a$exports)),
|
|
294
|
-
d: pathData.join(
|
|
295
|
-
}))
|
|
348
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement("path", {
|
|
349
|
+
className: (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($645594d913f34a2a$exports))), "spectrum-Popover-tip-triangle"),
|
|
350
|
+
d: pathData.join(" ")
|
|
351
|
+
}));
|
|
296
352
|
}
|
|
297
|
-
let $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ $fQOb3$forwardRef($17b503f7de08fecc$var$Popover);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
353
|
+
let $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $fQOb3$forwardRef)($17b503f7de08fecc$var$Popover);
|
|
354
|
+
/**
|
|
355
|
+
* More explanation on popover tips.
|
|
356
|
+
* - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.
|
|
357
|
+
* This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.
|
|
358
|
+
* - I tried creating an extra 'bandaid' path that matched the background color and would overlap the popover border.
|
|
359
|
+
* This didn't work because the border on the svg triangle didn't extend all the way to match nicely with the popover border.
|
|
360
|
+
* - I tried getting the client bounding box and setting the svg to that partial pixel value
|
|
361
|
+
* This didn't work because again the issue was inside the svg
|
|
362
|
+
* - I didn't try drawing the svg backwards
|
|
363
|
+
* This could still be tried
|
|
364
|
+
* - I tried changing the calculation of the popover placement AND the svg height/width so that they were all rounded
|
|
365
|
+
* This seems to have done the trick.
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
/*
|
|
369
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
370
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
371
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
372
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
373
|
+
*
|
|
374
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
375
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
376
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
377
|
+
* governing permissions and limitations under the License.
|
|
378
|
+
*/
|
|
301
379
|
|
|
302
380
|
var $f7ed9f5201273840$exports = {};
|
|
303
381
|
|
|
@@ -328,52 +406,68 @@ $f7ed9f5201273840$export$175dd699720b5fb7 = "spectrum-Modal--fullscreenTakeover_
|
|
|
328
406
|
|
|
329
407
|
function $842084dfa182af65$var$Modal(props, ref) {
|
|
330
408
|
let { children: children , state: state , ...otherProps } = props;
|
|
331
|
-
let domRef = $fQOb3$useDOMRef(ref);
|
|
332
|
-
|
|
409
|
+
let domRef = (0, $fQOb3$useDOMRef)(ref);
|
|
410
|
+
let wrapperRef = (0, $fQOb3$useRef)(null);
|
|
411
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $70305dc5fb729c3b$export$c6fdb837b070b4ff), {
|
|
333
412
|
...otherProps,
|
|
334
|
-
isOpen: state.isOpen
|
|
335
|
-
|
|
413
|
+
isOpen: state.isOpen,
|
|
414
|
+
nodeRef: wrapperRef
|
|
415
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement($842084dfa182af65$var$ModalWrapper, {
|
|
336
416
|
...props,
|
|
417
|
+
wrapperRef: wrapperRef,
|
|
337
418
|
ref: domRef
|
|
338
|
-
}, children))
|
|
419
|
+
}, children));
|
|
339
420
|
}
|
|
340
421
|
let $842084dfa182af65$var$typeMap = {
|
|
341
|
-
fullscreen:
|
|
342
|
-
fullscreenTakeover:
|
|
422
|
+
fullscreen: "fullscreen",
|
|
423
|
+
fullscreenTakeover: "fullscreenTakeover"
|
|
343
424
|
};
|
|
344
|
-
let $842084dfa182af65$var$ModalWrapper = /*#__PURE__*/ $fQOb3$forwardRef(function(props, ref) {
|
|
345
|
-
let { type: type , children: children , state: state , isOpen: isOpen } = props;
|
|
425
|
+
let $842084dfa182af65$var$ModalWrapper = /*#__PURE__*/ (0, $fQOb3$forwardRef)(function(props, ref) {
|
|
426
|
+
let { type: type , children: children , state: state , isOpen: isOpen , wrapperRef: wrapperRef } = props;
|
|
346
427
|
let typeVariant = $842084dfa182af65$var$typeMap[type];
|
|
347
|
-
let { styleProps: styleProps } = $fQOb3$useStyleProps(props);
|
|
348
|
-
let { modalProps: modalProps , underlayProps: underlayProps } = $fQOb3$useModalOverlay(props, state, ref);
|
|
349
|
-
let wrapperClassName = $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($f7ed9f5201273840$exports)),
|
|
350
|
-
let modalClassName = $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($f7ed9f5201273840$exports)),
|
|
351
|
-
|
|
352
|
-
}, $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports)),
|
|
428
|
+
let { styleProps: styleProps } = (0, $fQOb3$useStyleProps)(props);
|
|
429
|
+
let { modalProps: modalProps , underlayProps: underlayProps } = (0, $fQOb3$useModalOverlay)(props, state, ref);
|
|
430
|
+
let wrapperClassName = (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f7ed9f5201273840$exports))), "spectrum-Modal-wrapper", (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports))), "spectrum-Modal-wrapper", "react-spectrum-Modal-wrapper"));
|
|
431
|
+
let modalClassName = (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f7ed9f5201273840$exports))), "spectrum-Modal", {
|
|
432
|
+
"is-open": isOpen
|
|
433
|
+
}, (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports))), "spectrum-Modal", "react-spectrum-Modal"), {
|
|
353
434
|
[`spectrum-Modal--${typeVariant}`]: typeVariant
|
|
354
435
|
}, styleProps.className);
|
|
355
|
-
let viewport = $fQOb3$useViewportSize();
|
|
436
|
+
let viewport = (0, $fQOb3$useViewportSize)();
|
|
356
437
|
let style = {
|
|
357
|
-
|
|
438
|
+
"--spectrum-visual-viewport-height": viewport.height + "px"
|
|
358
439
|
};
|
|
359
|
-
|
|
440
|
+
// Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231
|
|
441
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
442
|
+
ref: wrapperRef
|
|
443
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $76a452f4e3df11be$export$f360afc887607b02), {
|
|
360
444
|
...underlayProps,
|
|
361
445
|
isOpen: isOpen
|
|
362
|
-
}), /*#__PURE__*/ $fQOb3$react.createElement("div", {
|
|
446
|
+
}), /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
363
447
|
className: wrapperClassName,
|
|
364
448
|
style: style
|
|
365
|
-
}, /*#__PURE__*/ $fQOb3$react.createElement("div", {
|
|
449
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
366
450
|
...styleProps,
|
|
367
451
|
...modalProps,
|
|
368
452
|
ref: ref,
|
|
369
453
|
className: modalClassName,
|
|
370
454
|
"data-testid": "modal"
|
|
371
|
-
}, children)))
|
|
455
|
+
}, children)));
|
|
372
456
|
});
|
|
373
|
-
let $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ $fQOb3$forwardRef($842084dfa182af65$var$Modal);
|
|
374
|
-
|
|
457
|
+
let $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $fQOb3$forwardRef)($842084dfa182af65$var$Modal);
|
|
375
458
|
|
|
376
459
|
|
|
460
|
+
/*
|
|
461
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
462
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
463
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
464
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
465
|
+
*
|
|
466
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
467
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
468
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
469
|
+
* governing permissions and limitations under the License.
|
|
470
|
+
*/
|
|
377
471
|
|
|
378
472
|
|
|
379
473
|
|
|
@@ -398,19 +492,22 @@ $930b2f4095bb11d1$export$79bfb05e59a300b = "spectrum-Tray--fixedHeight_23bf66";
|
|
|
398
492
|
|
|
399
493
|
function $1afc87f3d16a5a1c$var$Tray(props, ref) {
|
|
400
494
|
let { children: children , state: state , ...otherProps } = props;
|
|
401
|
-
let domRef = $fQOb3$useDOMRef(ref);
|
|
402
|
-
|
|
495
|
+
let domRef = (0, $fQOb3$useDOMRef)(ref);
|
|
496
|
+
let wrapperRef = (0, $fQOb3$useRef)(null);
|
|
497
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $70305dc5fb729c3b$export$c6fdb837b070b4ff), {
|
|
403
498
|
...otherProps,
|
|
404
|
-
isOpen: state.isOpen
|
|
405
|
-
|
|
499
|
+
isOpen: state.isOpen,
|
|
500
|
+
nodeRef: wrapperRef
|
|
501
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement($1afc87f3d16a5a1c$var$TrayWrapper, {
|
|
406
502
|
...props,
|
|
503
|
+
wrapperRef: wrapperRef,
|
|
407
504
|
ref: domRef
|
|
408
|
-
}, children))
|
|
505
|
+
}, children));
|
|
409
506
|
}
|
|
410
|
-
let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ $fQOb3$forwardRef(function(props, ref) {
|
|
411
|
-
let { children: children , isOpen: isOpen , isFixedHeight: isFixedHeight , state: state } = props;
|
|
412
|
-
let { styleProps: styleProps } = $fQOb3$useStyleProps(props);
|
|
413
|
-
let { modalProps: modalProps , underlayProps: underlayProps } = $fQOb3$useModalOverlay({
|
|
507
|
+
let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ (0, $fQOb3$forwardRef)(function(props, ref) {
|
|
508
|
+
let { children: children , isOpen: isOpen , isFixedHeight: isFixedHeight , state: state , wrapperRef: wrapperRef } = props;
|
|
509
|
+
let { styleProps: styleProps } = (0, $fQOb3$useStyleProps)(props);
|
|
510
|
+
let { modalProps: modalProps , underlayProps: underlayProps } = (0, $fQOb3$useModalOverlay)({
|
|
414
511
|
...props,
|
|
415
512
|
isDismissable: true
|
|
416
513
|
}, state, ref);
|
|
@@ -421,34 +518,37 @@ let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ $fQOb3$forwardRef(function
|
|
|
421
518
|
// when the address bar/bottom toolbars show and hide on scroll and vh units are fixed.
|
|
422
519
|
// Also, the visual viewport is smaller than the layout viewport when the virtual keyboard
|
|
423
520
|
// is up, so use the VisualViewport API to ensure the tray is displayed above the keyboard.
|
|
424
|
-
let viewport = $fQOb3$useViewportSize();
|
|
521
|
+
let viewport = (0, $fQOb3$useViewportSize)();
|
|
425
522
|
let wrapperStyle = {
|
|
426
|
-
|
|
523
|
+
"--spectrum-visual-viewport-height": viewport.height + "px"
|
|
427
524
|
};
|
|
428
|
-
let wrapperClassName = $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($930b2f4095bb11d1$exports)),
|
|
429
|
-
let className = $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($930b2f4095bb11d1$exports)),
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}, $fQOb3$classNames((/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports)),
|
|
433
|
-
|
|
525
|
+
let wrapperClassName = (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($930b2f4095bb11d1$exports))), "spectrum-Tray-wrapper");
|
|
526
|
+
let className = (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($930b2f4095bb11d1$exports))), "spectrum-Tray", {
|
|
527
|
+
"is-open": isOpen,
|
|
528
|
+
"spectrum-Tray--fixedHeight": isFixedHeight
|
|
529
|
+
}, (0, $fQOb3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($853e19557ad8790f$exports))), "spectrum-Tray", "react-spectrum-Tray"), styleProps.className);
|
|
530
|
+
// Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231
|
|
531
|
+
return /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
532
|
+
ref: wrapperRef
|
|
533
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $76a452f4e3df11be$export$f360afc887607b02), {
|
|
434
534
|
...underlayProps,
|
|
435
535
|
isOpen: isOpen
|
|
436
|
-
}), /*#__PURE__*/ $fQOb3$react.createElement("div", {
|
|
536
|
+
}), /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
437
537
|
className: wrapperClassName,
|
|
438
538
|
style: wrapperStyle
|
|
439
|
-
}, /*#__PURE__*/ $fQOb3$react.createElement("div", {
|
|
539
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement("div", {
|
|
440
540
|
...styleProps,
|
|
441
541
|
...modalProps,
|
|
442
542
|
className: className,
|
|
443
543
|
ref: ref,
|
|
444
544
|
"data-testid": "tray"
|
|
445
|
-
}, /*#__PURE__*/ $fQOb3$react.createElement($fQOb3$DismissButton, {
|
|
545
|
+
}, /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$DismissButton), {
|
|
446
546
|
onDismiss: state.close
|
|
447
|
-
}), children, /*#__PURE__*/ $fQOb3$react.createElement($fQOb3$DismissButton, {
|
|
547
|
+
}), children, /*#__PURE__*/ (0, $fQOb3$react).createElement((0, $fQOb3$DismissButton), {
|
|
448
548
|
onDismiss: state.close
|
|
449
|
-
}))))
|
|
549
|
+
}))));
|
|
450
550
|
});
|
|
451
|
-
let $1afc87f3d16a5a1c$export$4589ed81930b555c = /*#__PURE__*/ $fQOb3$forwardRef($1afc87f3d16a5a1c$var$Tray);
|
|
551
|
+
let $1afc87f3d16a5a1c$export$4589ed81930b555c = /*#__PURE__*/ (0, $fQOb3$forwardRef)($1afc87f3d16a5a1c$var$Tray);
|
|
452
552
|
|
|
453
553
|
|
|
454
554
|
|