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