@react-spectrum/overlays 5.7.0 → 5.7.1
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/Modal.main.js +3 -4
- package/dist/Modal.main.js.map +1 -1
- package/dist/Modal.mjs +4 -5
- package/dist/Modal.module.js +4 -5
- package/dist/Modal.module.js.map +1 -1
- package/dist/Overlay.main.js +2 -3
- package/dist/Overlay.main.js.map +1 -1
- package/dist/Overlay.mjs +2 -3
- package/dist/Overlay.module.js +2 -3
- package/dist/Overlay.module.js.map +1 -1
- package/dist/Popover.main.js +4 -5
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +5 -6
- package/dist/Popover.module.js +5 -6
- package/dist/Popover.module.js.map +1 -1
- package/dist/Tray.main.js +2 -3
- package/dist/Tray.main.js.map +1 -1
- package/dist/Tray.mjs +3 -4
- package/dist/Tray.module.js +3 -4
- package/dist/Tray.module.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/{vars.bf55d9e0.css → vars.a1de7c32.css} +3 -3
- package/dist/{vars.bf55d9e0.css.map → vars.a1de7c32.css.map} +1 -1
- package/package.json +9 -9
- package/src/Modal.tsx +2 -5
- package/src/Overlay.tsx +2 -5
- package/src/Popover.tsx +2 -5
- package/src/Tray.tsx +2 -5
package/dist/Modal.main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require("./vars.
|
|
1
|
+
require("./vars.a1de7c32.css");
|
|
2
2
|
var $86571b803f942ff3$exports = require("./modal_vars_css.main.js");
|
|
3
3
|
var $2aebdc186fd41e87$exports = require("./Overlay.main.js");
|
|
4
4
|
require("./overlays.f8d97b78.css");
|
|
@@ -37,7 +37,7 @@ $parcel$export(module.exports, "Modal", () => $fc75a6aa7a2b905b$export$2b77a92f1
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const $fc75a6aa7a2b905b$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $aM0tW$react.forwardRef)(function Modal(props, ref) {
|
|
41
41
|
let { children: children, state: state, ...otherProps } = props;
|
|
42
42
|
let domRef = (0, $aM0tW$reactspectrumutils.useDOMRef)(ref);
|
|
43
43
|
let wrapperRef = (0, $aM0tW$react.useRef)(null);
|
|
@@ -50,7 +50,7 @@ function $fc75a6aa7a2b905b$var$Modal(props, ref) {
|
|
|
50
50
|
wrapperRef: wrapperRef,
|
|
51
51
|
ref: domRef
|
|
52
52
|
}, children));
|
|
53
|
-
}
|
|
53
|
+
});
|
|
54
54
|
let $fc75a6aa7a2b905b$var$typeMap = {
|
|
55
55
|
fullscreen: 'fullscreen',
|
|
56
56
|
fullscreenTakeover: 'fullscreenTakeover'
|
|
@@ -88,7 +88,6 @@ let $fc75a6aa7a2b905b$var$ModalWrapper = /*#__PURE__*/ (0, $aM0tW$react.forwardR
|
|
|
88
88
|
"data-testid": "modal"
|
|
89
89
|
}, children)));
|
|
90
90
|
});
|
|
91
|
-
let $fc75a6aa7a2b905b$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $aM0tW$react.forwardRef)($fc75a6aa7a2b905b$var$Modal);
|
|
92
91
|
|
|
93
92
|
|
|
94
93
|
//# sourceMappingURL=Modal.main.js.map
|
package/dist/Modal.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA0BM,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,KAAiB,EAAE,GAA2B;IAC3F,IAAI,YAAC,QAAQ,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IACvC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAkB;IA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ACvC,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,KAAK;QACL,WAAW;QACX,eAAY;OACX;AAKX","sources":["packages/@react-spectrum/overlays/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, useModalOverlay} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport modalStyles from '@adobe/spectrum-css-temp/components/modal/vars.css';\nimport {Overlay} from './Overlay';\nimport {OverlayProps} from '@react-types/overlays';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef} from 'react';\nimport {Underlay} from './Underlay';\nimport {useObjectRef, useViewportSize} from '@react-aria/utils';\n\ninterface ModalProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {\n children: ReactNode,\n state: OverlayTriggerState,\n type?: 'modal' | 'fullscreen' | 'fullscreenTakeover'\n}\n\ninterface ModalWrapperProps extends ModalProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>,\n children: ReactNode\n}\n\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let {children, state, ...otherProps} = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <ModalWrapper {...props} wrapperRef={wrapperRef} ref={domRef}>\n {children}\n </ModalWrapper>\n </Overlay>\n );\n});\n\nlet typeMap = {\n fullscreen: 'fullscreen',\n fullscreenTakeover: 'fullscreenTakeover'\n};\n\nlet ModalWrapper = forwardRef(function (props: ModalWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {type, children, state, isOpen, wrapperRef} = props;\n let typeVariant = type != null ? typeMap[type] : undefined;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n let {modalProps, underlayProps} = useModalOverlay(props, state, objRef);\n\n let wrapperClassName = classNames(\n modalStyles,\n 'spectrum-Modal-wrapper',\n classNames(\n overrideStyles,\n 'spectrum-Modal-wrapper',\n 'react-spectrum-Modal-wrapper'\n )\n );\n\n let modalClassName = classNames(\n modalStyles,\n 'spectrum-Modal',\n {\n 'is-open': isOpen\n },\n classNames(\n overrideStyles,\n 'spectrum-Modal',\n 'react-spectrum-Modal'\n ),\n {[`spectrum-Modal--${typeVariant}`]: typeVariant},\n styleProps.className\n );\n\n let viewport = useViewportSize();\n let style: any = {\n '--spectrum-visual-viewport-height': viewport.height + 'px'\n };\n\n // Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n <Underlay {...underlayProps} isOpen={isOpen} />\n <div className={wrapperClassName} style={style}>\n <div\n {...styleProps}\n {...modalProps}\n ref={objRef}\n className={modalClassName}\n data-testid=\"modal\">\n {children}\n </div>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Modal.main.js.map"}
|
package/dist/Modal.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./vars.
|
|
1
|
+
import "./vars.a1de7c32.css";
|
|
2
2
|
import $e9TuM$modal_vars_cssmodulejs from "./modal_vars_css.mjs";
|
|
3
3
|
import {Overlay as $70305dc5fb729c3b$export$c6fdb837b070b4ff} from "./Overlay.mjs";
|
|
4
4
|
import "./overlays.f8d97b78.css";
|
|
@@ -6,7 +6,7 @@ import $e9TuM$overlays_cssmodulejs from "./overlays_css.mjs";
|
|
|
6
6
|
import {Underlay as $76a452f4e3df11be$export$f360afc887607b02} from "./Underlay.mjs";
|
|
7
7
|
import {useModalOverlay as $e9TuM$useModalOverlay} from "@react-aria/overlays";
|
|
8
8
|
import {useDOMRef as $e9TuM$useDOMRef, useStyleProps as $e9TuM$useStyleProps, classNames as $e9TuM$classNames} from "@react-spectrum/utils";
|
|
9
|
-
import $e9TuM$react, {
|
|
9
|
+
import $e9TuM$react, {forwardRef as $e9TuM$forwardRef, useRef as $e9TuM$useRef} from "react";
|
|
10
10
|
import {useObjectRef as $e9TuM$useObjectRef, useViewportSize as $e9TuM$useViewportSize} from "@react-aria/utils";
|
|
11
11
|
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ function $parcel$interopDefault(a) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $e9TuM$forwardRef)(function Modal(props, ref) {
|
|
35
35
|
let { children: children, state: state, ...otherProps } = props;
|
|
36
36
|
let domRef = (0, $e9TuM$useDOMRef)(ref);
|
|
37
37
|
let wrapperRef = (0, $e9TuM$useRef)(null);
|
|
@@ -44,7 +44,7 @@ function $842084dfa182af65$var$Modal(props, ref) {
|
|
|
44
44
|
wrapperRef: wrapperRef,
|
|
45
45
|
ref: domRef
|
|
46
46
|
}, children));
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
let $842084dfa182af65$var$typeMap = {
|
|
49
49
|
fullscreen: 'fullscreen',
|
|
50
50
|
fullscreenTakeover: 'fullscreenTakeover'
|
|
@@ -82,7 +82,6 @@ let $842084dfa182af65$var$ModalWrapper = /*#__PURE__*/ (0, $e9TuM$forwardRef)(fu
|
|
|
82
82
|
"data-testid": "modal"
|
|
83
83
|
}, children)));
|
|
84
84
|
});
|
|
85
|
-
let $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $e9TuM$forwardRef)($842084dfa182af65$var$Modal);
|
|
86
85
|
|
|
87
86
|
|
|
88
87
|
export {$842084dfa182af65$export$2b77a92f1a5ad772 as Modal};
|
package/dist/Modal.module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./vars.
|
|
1
|
+
import "./vars.a1de7c32.css";
|
|
2
2
|
import $e9TuM$modal_vars_cssmodulejs from "./modal_vars_css.module.js";
|
|
3
3
|
import {Overlay as $70305dc5fb729c3b$export$c6fdb837b070b4ff} from "./Overlay.module.js";
|
|
4
4
|
import "./overlays.f8d97b78.css";
|
|
@@ -6,7 +6,7 @@ import $e9TuM$overlays_cssmodulejs from "./overlays_css.module.js";
|
|
|
6
6
|
import {Underlay as $76a452f4e3df11be$export$f360afc887607b02} from "./Underlay.module.js";
|
|
7
7
|
import {useModalOverlay as $e9TuM$useModalOverlay} from "@react-aria/overlays";
|
|
8
8
|
import {useDOMRef as $e9TuM$useDOMRef, useStyleProps as $e9TuM$useStyleProps, classNames as $e9TuM$classNames} from "@react-spectrum/utils";
|
|
9
|
-
import $e9TuM$react, {
|
|
9
|
+
import $e9TuM$react, {forwardRef as $e9TuM$forwardRef, useRef as $e9TuM$useRef} from "react";
|
|
10
10
|
import {useObjectRef as $e9TuM$useObjectRef, useViewportSize as $e9TuM$useViewportSize} from "@react-aria/utils";
|
|
11
11
|
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ function $parcel$interopDefault(a) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $e9TuM$forwardRef)(function Modal(props, ref) {
|
|
35
35
|
let { children: children, state: state, ...otherProps } = props;
|
|
36
36
|
let domRef = (0, $e9TuM$useDOMRef)(ref);
|
|
37
37
|
let wrapperRef = (0, $e9TuM$useRef)(null);
|
|
@@ -44,7 +44,7 @@ function $842084dfa182af65$var$Modal(props, ref) {
|
|
|
44
44
|
wrapperRef: wrapperRef,
|
|
45
45
|
ref: domRef
|
|
46
46
|
}, children));
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
let $842084dfa182af65$var$typeMap = {
|
|
49
49
|
fullscreen: 'fullscreen',
|
|
50
50
|
fullscreenTakeover: 'fullscreenTakeover'
|
|
@@ -82,7 +82,6 @@ let $842084dfa182af65$var$ModalWrapper = /*#__PURE__*/ (0, $e9TuM$forwardRef)(fu
|
|
|
82
82
|
"data-testid": "modal"
|
|
83
83
|
}, children)));
|
|
84
84
|
});
|
|
85
|
-
let $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $e9TuM$forwardRef)($842084dfa182af65$var$Modal);
|
|
86
85
|
|
|
87
86
|
|
|
88
87
|
export {$842084dfa182af65$export$2b77a92f1a5ad772 as Modal};
|
package/dist/Modal.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA0BM,MAAM,0DAAQ,CAAA,GAAA,iBAAS,EAAE,SAAS,MAAM,KAAiB,EAAE,GAA2B;IAC3F,IAAI,YAAC,QAAQ,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IACvC,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,aAAa,CAAA,GAAA,aAAK,EAAkB;IAExC,qBACE,gCAAC,CAAA,GAAA,yCAAM;QAAG,GAAG,UAAU;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;qBACtD,gCAAC;QAAc,GAAG,KAAK;QAAE,YAAY;QAAY,KAAK;OACnD;AAIT;AAEA,IAAI,gCAAU;IACZ,YAAY;IACZ,oBAAoB;AACtB;AAEA,IAAI,mDAAe,CAAA,GAAA,iBAAS,EAAE,SAAU,KAAwB,EAAE,GAAwC;IACxG,IAAI,QAAC,IAAI,YAAE,QAAQ,SAAE,KAAK,UAAE,MAAM,cAAE,UAAU,EAAC,GAAG;IAClD,IAAI,cAAc,QAAQ,OAAO,6BAAO,CAAC,KAAK,GAAG;IACjD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE;IAC1B,IAAI,cAAC,UAAU,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,OAAO;IAEhE,IAAI,mBAAmB,CAAA,GAAA,iBAAS,EAC9B,CAAA,GAAA,uDAAU,GACV,0BACA,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,qDAAa,GACb,0BACA;IAIJ,IAAI,iBAAiB,CAAA,GAAA,iBAAS,EAC5B,CAAA,GAAA,uDAAU,GACV,kBACA;QACE,WAAW;IACb,GACA,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,qDAAa,GACb,kBACA,yBAEF;QAAC,CAAC,CAAC,gBAAgB,EAAE,aAAa,CAAC,EAAE;IAAW,GAChD,WAAW,SAAS;IAGtB,IAAI,WAAW,CAAA,GAAA,sBAAc;IAC7B,IAAI,QAAa;QACf,qCAAqC,SAAS,MAAM,GAAG;IACzD;IAEA,4LAA4L;IAC5L,qBACE,gCAAC;QAAI,KAAK;qBACR,gCAAC,CAAA,GAAA,yCAAO;QAAG,GAAG,aAAa;QAAE,QAAQ;sBACrC,gCAAC;QAAI,WAAW;QAAkB,OAAO;qBACvC,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,KAAK;QACL,WAAW;QACX,eAAY;OACX;AAKX","sources":["packages/@react-spectrum/overlays/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, useModalOverlay} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport modalStyles from '@adobe/spectrum-css-temp/components/modal/vars.css';\nimport {Overlay} from './Overlay';\nimport {OverlayProps} from '@react-types/overlays';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef} from 'react';\nimport {Underlay} from './Underlay';\nimport {useObjectRef, useViewportSize} from '@react-aria/utils';\n\ninterface ModalProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {\n children: ReactNode,\n state: OverlayTriggerState,\n type?: 'modal' | 'fullscreen' | 'fullscreenTakeover'\n}\n\ninterface ModalWrapperProps extends ModalProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>,\n children: ReactNode\n}\n\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let {children, state, ...otherProps} = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <ModalWrapper {...props} wrapperRef={wrapperRef} ref={domRef}>\n {children}\n </ModalWrapper>\n </Overlay>\n );\n});\n\nlet typeMap = {\n fullscreen: 'fullscreen',\n fullscreenTakeover: 'fullscreenTakeover'\n};\n\nlet ModalWrapper = forwardRef(function (props: ModalWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {type, children, state, isOpen, wrapperRef} = props;\n let typeVariant = type != null ? typeMap[type] : undefined;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n let {modalProps, underlayProps} = useModalOverlay(props, state, objRef);\n\n let wrapperClassName = classNames(\n modalStyles,\n 'spectrum-Modal-wrapper',\n classNames(\n overrideStyles,\n 'spectrum-Modal-wrapper',\n 'react-spectrum-Modal-wrapper'\n )\n );\n\n let modalClassName = classNames(\n modalStyles,\n 'spectrum-Modal',\n {\n 'is-open': isOpen\n },\n classNames(\n overrideStyles,\n 'spectrum-Modal',\n 'react-spectrum-Modal'\n ),\n {[`spectrum-Modal--${typeVariant}`]: typeVariant},\n styleProps.className\n );\n\n let viewport = useViewportSize();\n let style: any = {\n '--spectrum-visual-viewport-height': viewport.height + 'px'\n };\n\n // Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n <Underlay {...underlayProps} isOpen={isOpen} />\n <div className={wrapperClassName} style={style}>\n <div\n {...styleProps}\n {...modalProps}\n ref={objRef}\n className={modalClassName}\n data-testid=\"modal\">\n {children}\n </div>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Modal.module.js.map"}
|
package/dist/Overlay.main.js
CHANGED
|
@@ -27,7 +27,7 @@ $parcel$export(module.exports, "Overlay", () => $2aebdc186fd41e87$export$c6fdb83
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const $2aebdc186fd41e87$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, ($parcel$interopDefault($5XfZ1$react))).forwardRef(function Overlay(props, ref) {
|
|
31
31
|
let { children: children, isOpen: isOpen, disableFocusManagement: disableFocusManagement, container: container, onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, nodeRef: nodeRef } = props;
|
|
32
32
|
let [exited, setExited] = (0, $5XfZ1$react.useState)(!isOpen);
|
|
33
33
|
let handleEntered = (0, $5XfZ1$react.useCallback)(()=>{
|
|
@@ -68,8 +68,7 @@ function $2aebdc186fd41e87$var$Overlay(props, ref) {
|
|
|
68
68
|
onEntered: handleEntered,
|
|
69
69
|
nodeRef: nodeRef
|
|
70
70
|
}, children)));
|
|
71
|
-
}
|
|
72
|
-
let $2aebdc186fd41e87$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, ($parcel$interopDefault($5XfZ1$react))).forwardRef($2aebdc186fd41e87$var$Overlay);
|
|
71
|
+
});
|
|
73
72
|
|
|
74
73
|
|
|
75
74
|
//# sourceMappingURL=Overlay.main.js.map
|
package/dist/Overlay.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASM,MAAM,0DAAU,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACvG,IAAI,YACF,QAAQ,UACR,MAAM,0BACN,sBAAsB,aACtB,SAAS,WACT,OAAO,cACP,UAAU,aACV,SAAS,UACT,MAAM,aACN,SAAS,YACT,QAAQ,WACR,OAAO,EACR,GAAG;IAEJ,IAAI,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,qBAAO,EAAE,CAAC;IAEpC,IAAI,gBAAgB,CAAA,GAAA,wBAAU,EAAE;QAC9B,UAAU;QACV,IAAI,WACF;IAEJ,GAAG;QAAC;KAAU;IAEd,IAAI,eAAe,CAAA,GAAA,wBAAU,EAAE;QAC7B,UAAU;QACV,IAAI,UACF;IAEJ,GAAG;QAAC;KAAS;IAEb,4DAA4D;IAC5D,IAAI,eAAe,UAAU,CAAC;IAC9B,IAAI,CAAC,cACH,qDAAqD;IACrD,OAAO;IAGT,qBACE,0DAAC,CAAA,GAAA,gCAAe;QAAE,iBAAiB;QAAW,wBAAwB;QAAwB,WAAW,CAAC;qBACxG,0DAAC,CAAA,GAAA,qCAAO;QAAE,KAAK;QAAK,cAAc;YAAC,YAAY;YAAe,WAAW;QAAS;QAAG,YAAY;qBAC/F,0DAAC,CAAA,GAAA,wCAAa;QACZ,IAAI;QACJ,QAAA;QACA,QAAQ;QACR,WAAW;QACX,UAAU;QACV,SAAS;QACT,YAAY;QACZ,WAAW;QACX,SAAS;OACR;AAKX","sources":["packages/@react-spectrum/overlays/src/Overlay.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMRef} from '@react-types/shared';\nimport {OpenTransition} from './OpenTransition';\nimport {OverlayProps} from '@react-types/overlays';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useCallback, useState} from 'react';\nimport {Overlay as ReactAriaOverlay} from '@react-aria/overlays';\n\nexport const Overlay = React.forwardRef(function Overlay(props: OverlayProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n isOpen,\n disableFocusManagement,\n container,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n nodeRef\n } = props;\n\n let [exited, setExited] = useState(!isOpen);\n\n let handleEntered = useCallback(() => {\n setExited(false);\n if (onEntered) {\n onEntered();\n }\n }, [onEntered]);\n\n let handleExited = useCallback(() => {\n setExited(true);\n if (onExited) {\n onExited();\n }\n }, [onExited]);\n\n // Don't un-render the overlay while it's transitioning out.\n let mountOverlay = isOpen || !exited;\n if (!mountOverlay) {\n // Don't bother showing anything if we don't have to.\n return null;\n }\n\n return (\n <ReactAriaOverlay portalContainer={container} disableFocusManagement={disableFocusManagement} isExiting={!isOpen}>\n <Provider ref={ref} UNSAFE_style={{background: 'transparent', isolation: 'isolate'}} isDisabled={false}>\n <OpenTransition\n in={isOpen}\n appear\n onExit={onExit}\n onExiting={onExiting}\n onExited={handleExited}\n onEnter={onEnter}\n onEntering={onEntering}\n onEntered={handleEntered}\n nodeRef={nodeRef}>\n {children}\n </OpenTransition>\n </Provider>\n </ReactAriaOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Overlay.main.js.map"}
|
package/dist/Overlay.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {Overlay as $eIXW5$Overlay} from "@react-aria/overlays";
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $eIXW5$react).forwardRef(function Overlay(props, ref) {
|
|
21
21
|
let { children: children, isOpen: isOpen, disableFocusManagement: disableFocusManagement, container: container, onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, nodeRef: nodeRef } = props;
|
|
22
22
|
let [exited, setExited] = (0, $eIXW5$useState)(!isOpen);
|
|
23
23
|
let handleEntered = (0, $eIXW5$useCallback)(()=>{
|
|
@@ -58,8 +58,7 @@ function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
|
58
58
|
onEntered: handleEntered,
|
|
59
59
|
nodeRef: nodeRef
|
|
60
60
|
}, children)));
|
|
61
|
-
}
|
|
62
|
-
let $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $eIXW5$react).forwardRef($70305dc5fb729c3b$var$Overlay);
|
|
61
|
+
});
|
|
63
62
|
|
|
64
63
|
|
|
65
64
|
export {$70305dc5fb729c3b$export$c6fdb837b070b4ff as Overlay};
|
package/dist/Overlay.module.js
CHANGED
|
@@ -17,7 +17,7 @@ import {Overlay as $eIXW5$Overlay} from "@react-aria/overlays";
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $eIXW5$react).forwardRef(function Overlay(props, ref) {
|
|
21
21
|
let { children: children, isOpen: isOpen, disableFocusManagement: disableFocusManagement, container: container, onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, nodeRef: nodeRef } = props;
|
|
22
22
|
let [exited, setExited] = (0, $eIXW5$useState)(!isOpen);
|
|
23
23
|
let handleEntered = (0, $eIXW5$useCallback)(()=>{
|
|
@@ -58,8 +58,7 @@ function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
|
58
58
|
onEntered: handleEntered,
|
|
59
59
|
nodeRef: nodeRef
|
|
60
60
|
}, children)));
|
|
61
|
-
}
|
|
62
|
-
let $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $eIXW5$react).forwardRef($70305dc5fb729c3b$var$Overlay);
|
|
61
|
+
});
|
|
63
62
|
|
|
64
63
|
|
|
65
64
|
export {$70305dc5fb729c3b$export$c6fdb837b070b4ff as Overlay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AASM,MAAM,0DAAU,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACvG,IAAI,YACF,QAAQ,UACR,MAAM,0BACN,sBAAsB,aACtB,SAAS,WACT,OAAO,cACP,UAAU,aACV,SAAS,UACT,MAAM,aACN,SAAS,YACT,QAAQ,WACR,OAAO,EACR,GAAG;IAEJ,IAAI,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,eAAO,EAAE,CAAC;IAEpC,IAAI,gBAAgB,CAAA,GAAA,kBAAU,EAAE;QAC9B,UAAU;QACV,IAAI,WACF;IAEJ,GAAG;QAAC;KAAU;IAEd,IAAI,eAAe,CAAA,GAAA,kBAAU,EAAE;QAC7B,UAAU;QACV,IAAI,UACF;IAEJ,GAAG;QAAC;KAAS;IAEb,4DAA4D;IAC5D,IAAI,eAAe,UAAU,CAAC;IAC9B,IAAI,CAAC,cACH,qDAAqD;IACrD,OAAO;IAGT,qBACE,gCAAC,CAAA,GAAA,cAAe;QAAE,iBAAiB;QAAW,wBAAwB;QAAwB,WAAW,CAAC;qBACxG,gCAAC,CAAA,GAAA,eAAO;QAAE,KAAK;QAAK,cAAc;YAAC,YAAY;YAAe,WAAW;QAAS;QAAG,YAAY;qBAC/F,gCAAC,CAAA,GAAA,yCAAa;QACZ,IAAI;QACJ,QAAA;QACA,QAAQ;QACR,WAAW;QACX,UAAU;QACV,SAAS;QACT,YAAY;QACZ,WAAW;QACX,SAAS;OACR;AAKX","sources":["packages/@react-spectrum/overlays/src/Overlay.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMRef} from '@react-types/shared';\nimport {OpenTransition} from './OpenTransition';\nimport {OverlayProps} from '@react-types/overlays';\nimport {Provider} from '@react-spectrum/provider';\nimport React, {useCallback, useState} from 'react';\nimport {Overlay as ReactAriaOverlay} from '@react-aria/overlays';\n\nexport const Overlay = React.forwardRef(function Overlay(props: OverlayProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n isOpen,\n disableFocusManagement,\n container,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n nodeRef\n } = props;\n\n let [exited, setExited] = useState(!isOpen);\n\n let handleEntered = useCallback(() => {\n setExited(false);\n if (onEntered) {\n onEntered();\n }\n }, [onEntered]);\n\n let handleExited = useCallback(() => {\n setExited(true);\n if (onExited) {\n onExited();\n }\n }, [onExited]);\n\n // Don't un-render the overlay while it's transitioning out.\n let mountOverlay = isOpen || !exited;\n if (!mountOverlay) {\n // Don't bother showing anything if we don't have to.\n return null;\n }\n\n return (\n <ReactAriaOverlay portalContainer={container} disableFocusManagement={disableFocusManagement} isExiting={!isOpen}>\n <Provider ref={ref} UNSAFE_style={{background: 'transparent', isolation: 'isolate'}} isDisabled={false}>\n <OpenTransition\n in={isOpen}\n appear\n onExit={onExit}\n onExiting={onExiting}\n onExited={handleExited}\n onEnter={onEnter}\n onEntering={onEntering}\n onEntered={handleEntered}\n nodeRef={nodeRef}>\n {children}\n </OpenTransition>\n </Provider>\n </ReactAriaOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Overlay.module.js.map"}
|
package/dist/Popover.main.js
CHANGED
|
@@ -51,7 +51,7 @@ $parcel$export(module.exports, "Popover", () => $f02bba55a62f20dd$export$5b6b194
|
|
|
51
51
|
top: 'bottom',
|
|
52
52
|
bottom: 'bottom'
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
const $f02bba55a62f20dd$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $cgMBg$react.forwardRef)(function Popover(props, ref) {
|
|
55
55
|
let { children: children, state: state, ...otherProps } = props;
|
|
56
56
|
let domRef = (0, $cgMBg$reactspectrumutils.useDOMRef)(ref);
|
|
57
57
|
let wrapperRef = (0, $cgMBg$react.useRef)(null);
|
|
@@ -64,7 +64,7 @@ function $f02bba55a62f20dd$var$Popover(props, ref) {
|
|
|
64
64
|
...props,
|
|
65
65
|
wrapperRef: wrapperRef
|
|
66
66
|
}, children));
|
|
67
|
-
}
|
|
67
|
+
});
|
|
68
68
|
const $f02bba55a62f20dd$var$PopoverWrapper = /*#__PURE__*/ (0, $cgMBg$react.forwardRef)((props, ref)=>{
|
|
69
69
|
let { children: children, isOpen: isOpen, hideArrow: hideArrow, isNonModal: isNonModal, enableBothDismissButtons: enableBothDismissButtons, state: state, wrapperRef: wrapperRef, onDismissButtonPress: onDismissButtonPress = ()=>state.close() } = props;
|
|
70
70
|
let { styleProps: styleProps } = (0, $cgMBg$reactspectrumutils.useStyleProps)(props);
|
|
@@ -188,9 +188,7 @@ function $f02bba55a62f20dd$var$Arrow(props) {
|
|
|
188
188
|
className: (0, $cgMBg$reactspectrumutils.classNames)((0, ($parcel$interopDefault($16e1dca4664d0b1c$exports))), 'spectrum-Popover-tip-triangle'),
|
|
189
189
|
d: pathData.join(' ')
|
|
190
190
|
}));
|
|
191
|
-
}
|
|
192
|
-
let $f02bba55a62f20dd$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $cgMBg$react.forwardRef)($f02bba55a62f20dd$var$Popover);
|
|
193
|
-
/**
|
|
191
|
+
} /**
|
|
194
192
|
* More explanation on popover tips.
|
|
195
193
|
* - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.
|
|
196
194
|
* This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.
|
|
@@ -204,4 +202,5 @@ let $f02bba55a62f20dd$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $cgMBg$react.f
|
|
|
204
202
|
* This seems to have done the trick.
|
|
205
203
|
*/
|
|
206
204
|
|
|
205
|
+
|
|
207
206
|
//# sourceMappingURL=Popover.main.js.map
|
package/dist/Popover.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA6CD;;;;;;CAMC,GACD,IAAI,uCAAiB;IACnB,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;AACV;AAEA,SAAS,8BAAQ,KAAmB,EAAE,GAA2B;IAC/D,IAAI,YACF,QAAQ,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 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPopoverProps, DismissButton, PopoverAria, usePopover} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {FocusWithinProps, useFocusWithin} from '@react-aria/interactions';\nimport {mergeProps, useLayoutEffect, useObjectRef} from '@react-aria/utils';\nimport {Overlay} from './Overlay';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/popover/vars.css';\nimport {Underlay} from './Underlay';\n\ninterface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef' | 'maxHeight'>, FocusWithinProps, StyleProps {\n children: ReactNode,\n hideArrow?: boolean,\n state: OverlayTriggerState,\n shouldContainFocus?: boolean,\n onEntering?: () => void,\n onEnter?: () => void,\n onEntered?: () => void,\n onExiting?: () => void,\n onExited?: () => void,\n onExit?: () => void,\n container?: HTMLElement,\n disableFocusManagement?: boolean,\n enableBothDismissButtons?: boolean,\n onDismissButtonPress?: () => void\n}\n\ninterface PopoverWrapperProps extends PopoverProps, FocusWithinProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>\n}\n\ninterface ArrowProps {\n arrowProps: PopoverAria['arrowProps'],\n isLandscape: boolean,\n arrowRef?: RefObject<SVGSVGElement | null>,\n primary: number,\n secondary: number,\n borderDiagonal: number\n}\n\n/**\n * Arrow placement can be done pointing right or down because those paths start at 0, x or y. Because the\n * other two don't, they start at a fractional pixel value, it introduces rounding differences between browsers and\n * between display types (retina with subpixels vs not retina). By flipping them with CSS we can ensure that\n * the path always starts at 0 so that it perfectly overlaps the popover's border.\n * See bottom of file for more explanation.\n */\nlet arrowPlacement = {\n left: 'right',\n right: 'right',\n top: 'bottom',\n bottom: 'bottom'\n};\n\nfunction Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <PopoverWrapper ref={domRef} {...props} wrapperRef={wrapperRef}>\n {children}\n </PopoverWrapper>\n </Overlay>\n );\n}\n\nconst PopoverWrapper = forwardRef((props: PopoverWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) => {\n let {\n children,\n isOpen,\n hideArrow,\n isNonModal,\n enableBothDismissButtons,\n state,\n wrapperRef,\n onDismissButtonPress = () => state.close()\n } = props;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n\n let {size, borderWidth, arrowRef} = useArrowSize();\n const borderRadius = usePopoverBorderRadius(objRef);\n let borderDiagonal = borderWidth * Math.SQRT2;\n let primary = size + borderDiagonal;\n let secondary = primary * 2;\n let {\n popoverProps,\n arrowProps,\n underlayProps,\n placement\n } = usePopover({\n ...props,\n popoverRef: objRef,\n maxHeight: undefined,\n arrowSize: hideArrow ? 0 : secondary,\n arrowBoundaryOffset: borderRadius\n }, state);\n let {focusWithinProps} = useFocusWithin(props);\n\n // Attach Transition's nodeRef to outermost wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n {!isNonModal && <Underlay isTransparent {...mergeProps(underlayProps)} isOpen={isOpen} /> }\n <div\n {...styleProps}\n {...mergeProps(popoverProps, focusWithinProps)}\n style={{\n ...styleProps.style,\n ...popoverProps.style\n }}\n ref={objRef}\n className={\n classNames(\n styles,\n 'spectrum-Popover',\n `spectrum-Popover--${placement}`,\n {\n 'spectrum-Popover--withTip': !hideArrow,\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n classNames(\n overrideStyles,\n 'spectrum-Popover',\n 'react-spectrum-Popover'\n ),\n styleProps.className\n )\n }\n role=\"presentation\"\n data-testid=\"popover\">\n {(!isNonModal || enableBothDismissButtons) && <DismissButton onDismiss={onDismissButtonPress} />}\n {children}\n {hideArrow ? null : (\n <Arrow\n arrowProps={arrowProps}\n isLandscape={placement != null ? arrowPlacement[placement] === 'bottom' : false}\n arrowRef={arrowRef}\n primary={primary}\n secondary={secondary}\n borderDiagonal={borderDiagonal} />\n )}\n <DismissButton onDismiss={onDismissButtonPress} />\n </div>\n </div>\n );\n});\n\nfunction usePopoverBorderRadius(popoverRef: RefObject<HTMLDivElement | null>) {\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (popoverRef.current) {\n let spectrumBorderRadius = window.getComputedStyle(popoverRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [popoverRef]);\n return borderRadius;\n}\n\nfunction useArrowSize() {\n let [size, setSize] = useState(20);\n let [borderWidth, setBorderWidth] = useState(1);\n let arrowRef = useRef<SVGSVGElement>(null);\n // get the css value for the tip size and divide it by 2 for this arrow implementation\n useLayoutEffect(() => {\n if (arrowRef.current) {\n let spectrumTipWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-size');\n if (spectrumTipWidth !== '') {\n setSize(parseInt(spectrumTipWidth, 10) / 2);\n }\n\n let spectrumBorderWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-borderWidth');\n if (spectrumBorderWidth !== '') {\n setBorderWidth(parseInt(spectrumBorderWidth, 10));\n }\n }\n }, []);\n return {size, borderWidth, arrowRef};\n}\n\nfunction Arrow(props: ArrowProps) {\n let {primary, secondary, isLandscape, arrowProps, borderDiagonal, arrowRef} = props;\n let halfBorderDiagonal = borderDiagonal / 2;\n\n let primaryStart = 0;\n let primaryEnd = primary - halfBorderDiagonal;\n\n let secondaryStart = halfBorderDiagonal;\n let secondaryMiddle = secondary / 2;\n let secondaryEnd = secondary - halfBorderDiagonal;\n\n let pathData = isLandscape ? [\n 'M', secondaryStart, primaryStart,\n 'L', secondaryMiddle, primaryEnd,\n 'L', secondaryEnd, primaryStart\n ] : [\n 'M', primaryStart, secondaryStart,\n 'L', primaryEnd, secondaryMiddle,\n 'L', primaryStart, secondaryEnd\n ];\n\n /* use ceil because the svg needs to always accommodate the path inside it */\n return (\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n width={Math.ceil(isLandscape ? secondary : primary)}\n height={Math.ceil(isLandscape ? primary : secondary)}\n className={classNames(styles, 'spectrum-Popover-tip')}\n ref={arrowRef}\n {...arrowProps}>\n <path className={classNames(styles, 'spectrum-Popover-tip-triangle')} d={pathData.join(' ')} />\n </svg>\n );\n}\n\nlet _Popover = forwardRef(Popover);\nexport {_Popover as Popover};\n\n/**\n * More explanation on popover tips.\n * - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.\n * This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.\n * - I tried creating an extra 'bandaid' path that matched the background color and would overlap the popover border.\n * This didn't work because the border on the svg triangle didn't extend all the way to match nicely with the popover border.\n * - I tried getting the client bounding box and setting the svg to that partial pixel value\n * This didn't work because again the issue was inside the svg\n * - I didn't try drawing the svg backwards\n * This could still be tried\n * - I tried changing the calculation of the popover placement AND the svg height/width so that they were all rounded\n * This seems to have done the trick.\n */\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA6CD;;;;;;CAMC,GACD,IAAI,uC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SAAS,IAAI,CAAC;;AAG7F,EAEA;;;;;;;;;;;;CAYC","sources":["packages/@react-spectrum/overlays/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPopoverProps, DismissButton, PopoverAria, usePopover} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {FocusWithinProps, useFocusWithin} from '@react-aria/interactions';\nimport {mergeProps, useLayoutEffect, useObjectRef} from '@react-aria/utils';\nimport {Overlay} from './Overlay';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/popover/vars.css';\nimport {Underlay} from './Underlay';\n\ninterface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef' | 'maxHeight'>, FocusWithinProps, StyleProps {\n children: ReactNode,\n hideArrow?: boolean,\n state: OverlayTriggerState,\n shouldContainFocus?: boolean,\n onEntering?: () => void,\n onEnter?: () => void,\n onEntered?: () => void,\n onExiting?: () => void,\n onExited?: () => void,\n onExit?: () => void,\n container?: HTMLElement,\n disableFocusManagement?: boolean,\n enableBothDismissButtons?: boolean,\n onDismissButtonPress?: () => void\n}\n\ninterface PopoverWrapperProps extends PopoverProps, FocusWithinProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>\n}\n\ninterface ArrowProps {\n arrowProps: PopoverAria['arrowProps'],\n isLandscape: boolean,\n arrowRef?: RefObject<SVGSVGElement | null>,\n primary: number,\n secondary: number,\n borderDiagonal: number\n}\n\n/**\n * Arrow placement can be done pointing right or down because those paths start at 0, x or y. Because the\n * other two don't, they start at a fractional pixel value, it introduces rounding differences between browsers and\n * between display types (retina with subpixels vs not retina). By flipping them with CSS we can ensure that\n * the path always starts at 0 so that it perfectly overlaps the popover's border.\n * See bottom of file for more explanation.\n */\nlet arrowPlacement = {\n left: 'right',\n right: 'right',\n top: 'bottom',\n bottom: 'bottom'\n};\n\nexport const Popover = forwardRef(function Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <PopoverWrapper ref={domRef} {...props} wrapperRef={wrapperRef}>\n {children}\n </PopoverWrapper>\n </Overlay>\n );\n});\n\nconst PopoverWrapper = forwardRef((props: PopoverWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) => {\n let {\n children,\n isOpen,\n hideArrow,\n isNonModal,\n enableBothDismissButtons,\n state,\n wrapperRef,\n onDismissButtonPress = () => state.close()\n } = props;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n\n let {size, borderWidth, arrowRef} = useArrowSize();\n const borderRadius = usePopoverBorderRadius(objRef);\n let borderDiagonal = borderWidth * Math.SQRT2;\n let primary = size + borderDiagonal;\n let secondary = primary * 2;\n let {\n popoverProps,\n arrowProps,\n underlayProps,\n placement\n } = usePopover({\n ...props,\n popoverRef: objRef,\n maxHeight: undefined,\n arrowSize: hideArrow ? 0 : secondary,\n arrowBoundaryOffset: borderRadius\n }, state);\n let {focusWithinProps} = useFocusWithin(props);\n\n // Attach Transition's nodeRef to outermost wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n {!isNonModal && <Underlay isTransparent {...mergeProps(underlayProps)} isOpen={isOpen} /> }\n <div\n {...styleProps}\n {...mergeProps(popoverProps, focusWithinProps)}\n style={{\n ...styleProps.style,\n ...popoverProps.style\n }}\n ref={objRef}\n className={\n classNames(\n styles,\n 'spectrum-Popover',\n `spectrum-Popover--${placement}`,\n {\n 'spectrum-Popover--withTip': !hideArrow,\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n classNames(\n overrideStyles,\n 'spectrum-Popover',\n 'react-spectrum-Popover'\n ),\n styleProps.className\n )\n }\n role=\"presentation\"\n data-testid=\"popover\">\n {(!isNonModal || enableBothDismissButtons) && <DismissButton onDismiss={onDismissButtonPress} />}\n {children}\n {hideArrow ? null : (\n <Arrow\n arrowProps={arrowProps}\n isLandscape={placement != null ? arrowPlacement[placement] === 'bottom' : false}\n arrowRef={arrowRef}\n primary={primary}\n secondary={secondary}\n borderDiagonal={borderDiagonal} />\n )}\n <DismissButton onDismiss={onDismissButtonPress} />\n </div>\n </div>\n );\n});\n\nfunction usePopoverBorderRadius(popoverRef: RefObject<HTMLDivElement | null>) {\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (popoverRef.current) {\n let spectrumBorderRadius = window.getComputedStyle(popoverRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [popoverRef]);\n return borderRadius;\n}\n\nfunction useArrowSize() {\n let [size, setSize] = useState(20);\n let [borderWidth, setBorderWidth] = useState(1);\n let arrowRef = useRef<SVGSVGElement>(null);\n // get the css value for the tip size and divide it by 2 for this arrow implementation\n useLayoutEffect(() => {\n if (arrowRef.current) {\n let spectrumTipWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-size');\n if (spectrumTipWidth !== '') {\n setSize(parseInt(spectrumTipWidth, 10) / 2);\n }\n\n let spectrumBorderWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-borderWidth');\n if (spectrumBorderWidth !== '') {\n setBorderWidth(parseInt(spectrumBorderWidth, 10));\n }\n }\n }, []);\n return {size, borderWidth, arrowRef};\n}\n\nfunction Arrow(props: ArrowProps) {\n let {primary, secondary, isLandscape, arrowProps, borderDiagonal, arrowRef} = props;\n let halfBorderDiagonal = borderDiagonal / 2;\n\n let primaryStart = 0;\n let primaryEnd = primary - halfBorderDiagonal;\n\n let secondaryStart = halfBorderDiagonal;\n let secondaryMiddle = secondary / 2;\n let secondaryEnd = secondary - halfBorderDiagonal;\n\n let pathData = isLandscape ? [\n 'M', secondaryStart, primaryStart,\n 'L', secondaryMiddle, primaryEnd,\n 'L', secondaryEnd, primaryStart\n ] : [\n 'M', primaryStart, secondaryStart,\n 'L', primaryEnd, secondaryMiddle,\n 'L', primaryStart, secondaryEnd\n ];\n\n /* use ceil because the svg needs to always accommodate the path inside it */\n return (\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n width={Math.ceil(isLandscape ? secondary : primary)}\n height={Math.ceil(isLandscape ? primary : secondary)}\n className={classNames(styles, 'spectrum-Popover-tip')}\n ref={arrowRef}\n {...arrowProps}>\n <path className={classNames(styles, 'spectrum-Popover-tip-triangle')} d={pathData.join(' ')} />\n </svg>\n );\n}\n\n/**\n * More explanation on popover tips.\n * - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.\n * This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.\n * - I tried creating an extra 'bandaid' path that matched the background color and would overlap the popover border.\n * This didn't work because the border on the svg triangle didn't extend all the way to match nicely with the popover border.\n * - I tried getting the client bounding box and setting the svg to that partial pixel value\n * This didn't work because again the issue was inside the svg\n * - I didn't try drawing the svg backwards\n * This could still be tried\n * - I tried changing the calculation of the popover placement AND the svg height/width so that they were all rounded\n * This seems to have done the trick.\n */\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
|
package/dist/Popover.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {usePopover as $4kQ6h$usePopover, DismissButton as $4kQ6h$DismissButton}
|
|
|
8
8
|
import {useDOMRef as $4kQ6h$useDOMRef, useStyleProps as $4kQ6h$useStyleProps, classNames as $4kQ6h$classNames} from "@react-spectrum/utils";
|
|
9
9
|
import {useFocusWithin as $4kQ6h$useFocusWithin} from "@react-aria/interactions";
|
|
10
10
|
import {useObjectRef as $4kQ6h$useObjectRef, mergeProps as $4kQ6h$mergeProps, useLayoutEffect as $4kQ6h$useLayoutEffect} from "@react-aria/utils";
|
|
11
|
-
import $4kQ6h$react, {
|
|
11
|
+
import $4kQ6h$react, {forwardRef as $4kQ6h$forwardRef, useRef as $4kQ6h$useRef, useState as $4kQ6h$useState} from "react";
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
function $parcel$interopDefault(a) {
|
|
@@ -45,7 +45,7 @@ function $parcel$interopDefault(a) {
|
|
|
45
45
|
top: 'bottom',
|
|
46
46
|
bottom: 'bottom'
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4kQ6h$forwardRef)(function Popover(props, ref) {
|
|
49
49
|
let { children: children, state: state, ...otherProps } = props;
|
|
50
50
|
let domRef = (0, $4kQ6h$useDOMRef)(ref);
|
|
51
51
|
let wrapperRef = (0, $4kQ6h$useRef)(null);
|
|
@@ -58,7 +58,7 @@ function $17b503f7de08fecc$var$Popover(props, ref) {
|
|
|
58
58
|
...props,
|
|
59
59
|
wrapperRef: wrapperRef
|
|
60
60
|
}, children));
|
|
61
|
-
}
|
|
61
|
+
});
|
|
62
62
|
const $17b503f7de08fecc$var$PopoverWrapper = /*#__PURE__*/ (0, $4kQ6h$forwardRef)((props, ref)=>{
|
|
63
63
|
let { children: children, isOpen: isOpen, hideArrow: hideArrow, isNonModal: isNonModal, enableBothDismissButtons: enableBothDismissButtons, state: state, wrapperRef: wrapperRef, onDismissButtonPress: onDismissButtonPress = ()=>state.close() } = props;
|
|
64
64
|
let { styleProps: styleProps } = (0, $4kQ6h$useStyleProps)(props);
|
|
@@ -182,9 +182,7 @@ function $17b503f7de08fecc$var$Arrow(props) {
|
|
|
182
182
|
className: (0, $4kQ6h$classNames)((0, ($parcel$interopDefault($4kQ6h$popover_vars_cssmodulejs))), 'spectrum-Popover-tip-triangle'),
|
|
183
183
|
d: pathData.join(' ')
|
|
184
184
|
}));
|
|
185
|
-
}
|
|
186
|
-
let $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4kQ6h$forwardRef)($17b503f7de08fecc$var$Popover);
|
|
187
|
-
/**
|
|
185
|
+
} /**
|
|
188
186
|
* More explanation on popover tips.
|
|
189
187
|
* - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.
|
|
190
188
|
* This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.
|
|
@@ -198,5 +196,6 @@ let $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4kQ6h$forward
|
|
|
198
196
|
* This seems to have done the trick.
|
|
199
197
|
*/
|
|
200
198
|
|
|
199
|
+
|
|
201
200
|
export {$17b503f7de08fecc$export$5b6b19405a83ff9d as Popover};
|
|
202
201
|
//# sourceMappingURL=Popover.module.js.map
|
package/dist/Popover.module.js
CHANGED
|
@@ -8,7 +8,7 @@ import {usePopover as $4kQ6h$usePopover, DismissButton as $4kQ6h$DismissButton}
|
|
|
8
8
|
import {useDOMRef as $4kQ6h$useDOMRef, useStyleProps as $4kQ6h$useStyleProps, classNames as $4kQ6h$classNames} from "@react-spectrum/utils";
|
|
9
9
|
import {useFocusWithin as $4kQ6h$useFocusWithin} from "@react-aria/interactions";
|
|
10
10
|
import {useObjectRef as $4kQ6h$useObjectRef, mergeProps as $4kQ6h$mergeProps, useLayoutEffect as $4kQ6h$useLayoutEffect} from "@react-aria/utils";
|
|
11
|
-
import $4kQ6h$react, {
|
|
11
|
+
import $4kQ6h$react, {forwardRef as $4kQ6h$forwardRef, useRef as $4kQ6h$useRef, useState as $4kQ6h$useState} from "react";
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
function $parcel$interopDefault(a) {
|
|
@@ -45,7 +45,7 @@ function $parcel$interopDefault(a) {
|
|
|
45
45
|
top: 'bottom',
|
|
46
46
|
bottom: 'bottom'
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4kQ6h$forwardRef)(function Popover(props, ref) {
|
|
49
49
|
let { children: children, state: state, ...otherProps } = props;
|
|
50
50
|
let domRef = (0, $4kQ6h$useDOMRef)(ref);
|
|
51
51
|
let wrapperRef = (0, $4kQ6h$useRef)(null);
|
|
@@ -58,7 +58,7 @@ function $17b503f7de08fecc$var$Popover(props, ref) {
|
|
|
58
58
|
...props,
|
|
59
59
|
wrapperRef: wrapperRef
|
|
60
60
|
}, children));
|
|
61
|
-
}
|
|
61
|
+
});
|
|
62
62
|
const $17b503f7de08fecc$var$PopoverWrapper = /*#__PURE__*/ (0, $4kQ6h$forwardRef)((props, ref)=>{
|
|
63
63
|
let { children: children, isOpen: isOpen, hideArrow: hideArrow, isNonModal: isNonModal, enableBothDismissButtons: enableBothDismissButtons, state: state, wrapperRef: wrapperRef, onDismissButtonPress: onDismissButtonPress = ()=>state.close() } = props;
|
|
64
64
|
let { styleProps: styleProps } = (0, $4kQ6h$useStyleProps)(props);
|
|
@@ -182,9 +182,7 @@ function $17b503f7de08fecc$var$Arrow(props) {
|
|
|
182
182
|
className: (0, $4kQ6h$classNames)((0, ($parcel$interopDefault($4kQ6h$popover_vars_cssmodulejs))), 'spectrum-Popover-tip-triangle'),
|
|
183
183
|
d: pathData.join(' ')
|
|
184
184
|
}));
|
|
185
|
-
}
|
|
186
|
-
let $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4kQ6h$forwardRef)($17b503f7de08fecc$var$Popover);
|
|
187
|
-
/**
|
|
185
|
+
} /**
|
|
188
186
|
* More explanation on popover tips.
|
|
189
187
|
* - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.
|
|
190
188
|
* This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.
|
|
@@ -198,5 +196,6 @@ let $17b503f7de08fecc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4kQ6h$forward
|
|
|
198
196
|
* This seems to have done the trick.
|
|
199
197
|
*/
|
|
200
198
|
|
|
199
|
+
|
|
201
200
|
export {$17b503f7de08fecc$export$5b6b19405a83ff9d as Popover};
|
|
202
201
|
//# sourceMappingURL=Popover.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA6CD;;;;;;CAMC,GACD,IAAI,uCAAiB;IACnB,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;AACV;AAEA,SAAS,8BAAQ,KAAmB,EAAE,GAA2B;IAC/D,IAAI,YACF,QAAQ,SACR,KAAK,EACL,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,aAAa,CAAA,GAAA,aAAK,EAAkB;IAExC,qBACE,gCAAC,CAAA,GAAA,yCAAM;QAAG,GAAG,UAAU;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;qBACtD,gCAAC;QAAe,KAAK;QAAS,GAAG,KAAK;QAAE,YAAY;OACjD;AAIT;AAEA,MAAM,qDAAiB,CAAA,GAAA,iBAAS,EAAE,CAAC,OAA4B;IAC7D,IAAI,YACF,QAAQ,UACR,MAAM,aACN,SAAS,cACT,UAAU,4BACV,wBAAwB,SACxB,KAAK,cACL,UAAU,wBACV,uBAAuB,IAAM,MAAM,KAAK,IACzC,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mBAAW,E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AAI,eAAe,YAAY;IAE/B,IAAI,WAAW,cAAc;QAC3B;QAAK;QAAgB;QACrB;QAAK;QAAiB;QACtB;QAAK;QAAc;KACpB,GAAG;QACF;QAAK;QAAc;QACnB;QAAK;QAAY;QACjB;QAAK;QAAc;KACpB;IAED,2EAA2E,GAC3E,qBACE,gCAAC;QACC,OAAM;QACN,OAAO,KAAK,IAAI,CAAC,cAAc,YAAY;QAC3C,QAAQ,KAAK,IAAI,CAAC,cAAc,UAAU;QAC1C,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;QAC9B,KAAK;QACJ,GAAG,UAAU;qBACd,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;QAAkC,GAAG,SAAS,IAAI,CAAC;;AAG7F;AAEA,IAAI,0DAAW,CAAA,GAAA,iBAAS,EAAE;CAG1B;;;;;;;;;;;;CAYC","sources":["packages/@react-spectrum/overlays/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPopoverProps, DismissButton, PopoverAria, usePopover} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {FocusWithinProps, useFocusWithin} from '@react-aria/interactions';\nimport {mergeProps, useLayoutEffect, useObjectRef} from '@react-aria/utils';\nimport {Overlay} from './Overlay';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/popover/vars.css';\nimport {Underlay} from './Underlay';\n\ninterface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef' | 'maxHeight'>, FocusWithinProps, StyleProps {\n children: ReactNode,\n hideArrow?: boolean,\n state: OverlayTriggerState,\n shouldContainFocus?: boolean,\n onEntering?: () => void,\n onEnter?: () => void,\n onEntered?: () => void,\n onExiting?: () => void,\n onExited?: () => void,\n onExit?: () => void,\n container?: HTMLElement,\n disableFocusManagement?: boolean,\n enableBothDismissButtons?: boolean,\n onDismissButtonPress?: () => void\n}\n\ninterface PopoverWrapperProps extends PopoverProps, FocusWithinProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>\n}\n\ninterface ArrowProps {\n arrowProps: PopoverAria['arrowProps'],\n isLandscape: boolean,\n arrowRef?: RefObject<SVGSVGElement | null>,\n primary: number,\n secondary: number,\n borderDiagonal: number\n}\n\n/**\n * Arrow placement can be done pointing right or down because those paths start at 0, x or y. Because the\n * other two don't, they start at a fractional pixel value, it introduces rounding differences between browsers and\n * between display types (retina with subpixels vs not retina). By flipping them with CSS we can ensure that\n * the path always starts at 0 so that it perfectly overlaps the popover's border.\n * See bottom of file for more explanation.\n */\nlet arrowPlacement = {\n left: 'right',\n right: 'right',\n top: 'bottom',\n bottom: 'bottom'\n};\n\nfunction Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <PopoverWrapper ref={domRef} {...props} wrapperRef={wrapperRef}>\n {children}\n </PopoverWrapper>\n </Overlay>\n );\n}\n\nconst PopoverWrapper = forwardRef((props: PopoverWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) => {\n let {\n children,\n isOpen,\n hideArrow,\n isNonModal,\n enableBothDismissButtons,\n state,\n wrapperRef,\n onDismissButtonPress = () => state.close()\n } = props;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n\n let {size, borderWidth, arrowRef} = useArrowSize();\n const borderRadius = usePopoverBorderRadius(objRef);\n let borderDiagonal = borderWidth * Math.SQRT2;\n let primary = size + borderDiagonal;\n let secondary = primary * 2;\n let {\n popoverProps,\n arrowProps,\n underlayProps,\n placement\n } = usePopover({\n ...props,\n popoverRef: objRef,\n maxHeight: undefined,\n arrowSize: hideArrow ? 0 : secondary,\n arrowBoundaryOffset: borderRadius\n }, state);\n let {focusWithinProps} = useFocusWithin(props);\n\n // Attach Transition's nodeRef to outermost wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n {!isNonModal && <Underlay isTransparent {...mergeProps(underlayProps)} isOpen={isOpen} /> }\n <div\n {...styleProps}\n {...mergeProps(popoverProps, focusWithinProps)}\n style={{\n ...styleProps.style,\n ...popoverProps.style\n }}\n ref={objRef}\n className={\n classNames(\n styles,\n 'spectrum-Popover',\n `spectrum-Popover--${placement}`,\n {\n 'spectrum-Popover--withTip': !hideArrow,\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n classNames(\n overrideStyles,\n 'spectrum-Popover',\n 'react-spectrum-Popover'\n ),\n styleProps.className\n )\n }\n role=\"presentation\"\n data-testid=\"popover\">\n {(!isNonModal || enableBothDismissButtons) && <DismissButton onDismiss={onDismissButtonPress} />}\n {children}\n {hideArrow ? null : (\n <Arrow\n arrowProps={arrowProps}\n isLandscape={placement != null ? arrowPlacement[placement] === 'bottom' : false}\n arrowRef={arrowRef}\n primary={primary}\n secondary={secondary}\n borderDiagonal={borderDiagonal} />\n )}\n <DismissButton onDismiss={onDismissButtonPress} />\n </div>\n </div>\n );\n});\n\nfunction usePopoverBorderRadius(popoverRef: RefObject<HTMLDivElement | null>) {\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (popoverRef.current) {\n let spectrumBorderRadius = window.getComputedStyle(popoverRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [popoverRef]);\n return borderRadius;\n}\n\nfunction useArrowSize() {\n let [size, setSize] = useState(20);\n let [borderWidth, setBorderWidth] = useState(1);\n let arrowRef = useRef<SVGSVGElement>(null);\n // get the css value for the tip size and divide it by 2 for this arrow implementation\n useLayoutEffect(() => {\n if (arrowRef.current) {\n let spectrumTipWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-size');\n if (spectrumTipWidth !== '') {\n setSize(parseInt(spectrumTipWidth, 10) / 2);\n }\n\n let spectrumBorderWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-borderWidth');\n if (spectrumBorderWidth !== '') {\n setBorderWidth(parseInt(spectrumBorderWidth, 10));\n }\n }\n }, []);\n return {size, borderWidth, arrowRef};\n}\n\nfunction Arrow(props: ArrowProps) {\n let {primary, secondary, isLandscape, arrowProps, borderDiagonal, arrowRef} = props;\n let halfBorderDiagonal = borderDiagonal / 2;\n\n let primaryStart = 0;\n let primaryEnd = primary - halfBorderDiagonal;\n\n let secondaryStart = halfBorderDiagonal;\n let secondaryMiddle = secondary / 2;\n let secondaryEnd = secondary - halfBorderDiagonal;\n\n let pathData = isLandscape ? [\n 'M', secondaryStart, primaryStart,\n 'L', secondaryMiddle, primaryEnd,\n 'L', secondaryEnd, primaryStart\n ] : [\n 'M', primaryStart, secondaryStart,\n 'L', primaryEnd, secondaryMiddle,\n 'L', primaryStart, secondaryEnd\n ];\n\n /* use ceil because the svg needs to always accommodate the path inside it */\n return (\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n width={Math.ceil(isLandscape ? secondary : primary)}\n height={Math.ceil(isLandscape ? primary : secondary)}\n className={classNames(styles, 'spectrum-Popover-tip')}\n ref={arrowRef}\n {...arrowProps}>\n <path className={classNames(styles, 'spectrum-Popover-tip-triangle')} d={pathData.join(' ')} />\n </svg>\n );\n}\n\nlet _Popover = forwardRef(Popover);\nexport {_Popover as Popover};\n\n/**\n * More explanation on popover tips.\n * - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.\n * This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.\n * - I tried creating an extra 'bandaid' path that matched the background color and would overlap the popover border.\n * This didn't work because the border on the svg triangle didn't extend all the way to match nicely with the popover border.\n * - I tried getting the client bounding box and setting the svg to that partial pixel value\n * This didn't work because again the issue was inside the svg\n * - I didn't try drawing the svg backwards\n * This could still be tried\n * - I tried changing the calculation of the popover placement AND the svg height/width so that they were all rounded\n * This seems to have done the trick.\n */\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA6CD;;;;;;CAMC,GACD,IAAI,uCAAiB;IACnB,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;AACV;AAEO,MAAM,0DAAU,CAAA,GAAA,iBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACjG,IAAI,YACF,QAAQ,SACR,KAAK,EACL,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,aAAa,CAAA,GAAA,aAAK,EAAkB;IAExC,qBACE,gCAAC,CAAA,GAAA,yCAAM;QAAG,GAAG,UAAU;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;qBACtD,gCAAC;QAAe,KAAK;QAAS,GAAG,KAAK;QAAE,YAAY;OACjD;AAIT;AAEA,MAAM,qDAAiB,CAAA,GAAA,iBAAS,EAAE,CAAC,OAA4B;IAC7D,IAAI,YACF,QAAQ,UACR,MAAM,aACN,SAAS,cACT,UAAU,4BACV,wBAAwB,SACxB,KAAK,cACL,UAAU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AQ,EAAC,GAAG;IAC9E,IAAI,qBAAqB,iBAAiB;IAE1C,IAAI,eAAe;IACnB,IAAI,aAAa,UAAU;IAE3B,IAAI,iBAAiB;IACrB,IAAI,kBAAkB,YAAY;IAClC,IAAI,eAAe,YAAY;IAE/B,IAAI,WAAW,cAAc;QAC3B;QAAK;QAAgB;QACrB;QAAK;QAAiB;QACtB;QAAK;QAAc;KACpB,GAAG;QACF;QAAK;QAAc;QACnB;QAAK;QAAY;QACjB;QAAK;QAAc;KACpB;IAED,2EAA2E,GAC3E,qBACE,gCAAC;QACC,OAAM;QACN,OAAO,KAAK,IAAI,CAAC,cAAc,YAAY;QAC3C,QAAQ,KAAK,IAAI,CAAC,cAAc,UAAU;QAC1C,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;QAC9B,KAAK;QACJ,GAAG,UAAU;qBACd,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yDAAK,GAAG;QAAkC,GAAG,SAAS,IAAI,CAAC;;AAG7F,EAEA;;;;;;;;;;;;CAYC","sources":["packages/@react-spectrum/overlays/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPopoverProps, DismissButton, PopoverAria, usePopover} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {FocusWithinProps, useFocusWithin} from '@react-aria/interactions';\nimport {mergeProps, useLayoutEffect, useObjectRef} from '@react-aria/utils';\nimport {Overlay} from './Overlay';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/popover/vars.css';\nimport {Underlay} from './Underlay';\n\ninterface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef' | 'maxHeight'>, FocusWithinProps, StyleProps {\n children: ReactNode,\n hideArrow?: boolean,\n state: OverlayTriggerState,\n shouldContainFocus?: boolean,\n onEntering?: () => void,\n onEnter?: () => void,\n onEntered?: () => void,\n onExiting?: () => void,\n onExited?: () => void,\n onExit?: () => void,\n container?: HTMLElement,\n disableFocusManagement?: boolean,\n enableBothDismissButtons?: boolean,\n onDismissButtonPress?: () => void\n}\n\ninterface PopoverWrapperProps extends PopoverProps, FocusWithinProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>\n}\n\ninterface ArrowProps {\n arrowProps: PopoverAria['arrowProps'],\n isLandscape: boolean,\n arrowRef?: RefObject<SVGSVGElement | null>,\n primary: number,\n secondary: number,\n borderDiagonal: number\n}\n\n/**\n * Arrow placement can be done pointing right or down because those paths start at 0, x or y. Because the\n * other two don't, they start at a fractional pixel value, it introduces rounding differences between browsers and\n * between display types (retina with subpixels vs not retina). By flipping them with CSS we can ensure that\n * the path always starts at 0 so that it perfectly overlaps the popover's border.\n * See bottom of file for more explanation.\n */\nlet arrowPlacement = {\n left: 'right',\n right: 'right',\n top: 'bottom',\n bottom: 'bottom'\n};\n\nexport const Popover = forwardRef(function Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n state,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <PopoverWrapper ref={domRef} {...props} wrapperRef={wrapperRef}>\n {children}\n </PopoverWrapper>\n </Overlay>\n );\n});\n\nconst PopoverWrapper = forwardRef((props: PopoverWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) => {\n let {\n children,\n isOpen,\n hideArrow,\n isNonModal,\n enableBothDismissButtons,\n state,\n wrapperRef,\n onDismissButtonPress = () => state.close()\n } = props;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n\n let {size, borderWidth, arrowRef} = useArrowSize();\n const borderRadius = usePopoverBorderRadius(objRef);\n let borderDiagonal = borderWidth * Math.SQRT2;\n let primary = size + borderDiagonal;\n let secondary = primary * 2;\n let {\n popoverProps,\n arrowProps,\n underlayProps,\n placement\n } = usePopover({\n ...props,\n popoverRef: objRef,\n maxHeight: undefined,\n arrowSize: hideArrow ? 0 : secondary,\n arrowBoundaryOffset: borderRadius\n }, state);\n let {focusWithinProps} = useFocusWithin(props);\n\n // Attach Transition's nodeRef to outermost wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n {!isNonModal && <Underlay isTransparent {...mergeProps(underlayProps)} isOpen={isOpen} /> }\n <div\n {...styleProps}\n {...mergeProps(popoverProps, focusWithinProps)}\n style={{\n ...styleProps.style,\n ...popoverProps.style\n }}\n ref={objRef}\n className={\n classNames(\n styles,\n 'spectrum-Popover',\n `spectrum-Popover--${placement}`,\n {\n 'spectrum-Popover--withTip': !hideArrow,\n 'is-open': isOpen,\n [`is-open--${placement}`]: isOpen\n },\n classNames(\n overrideStyles,\n 'spectrum-Popover',\n 'react-spectrum-Popover'\n ),\n styleProps.className\n )\n }\n role=\"presentation\"\n data-testid=\"popover\">\n {(!isNonModal || enableBothDismissButtons) && <DismissButton onDismiss={onDismissButtonPress} />}\n {children}\n {hideArrow ? null : (\n <Arrow\n arrowProps={arrowProps}\n isLandscape={placement != null ? arrowPlacement[placement] === 'bottom' : false}\n arrowRef={arrowRef}\n primary={primary}\n secondary={secondary}\n borderDiagonal={borderDiagonal} />\n )}\n <DismissButton onDismiss={onDismissButtonPress} />\n </div>\n </div>\n );\n});\n\nfunction usePopoverBorderRadius(popoverRef: RefObject<HTMLDivElement | null>) {\n let [borderRadius, setBorderRadius] = useState(0);\n useLayoutEffect(() => {\n if (popoverRef.current) {\n let spectrumBorderRadius = window.getComputedStyle(popoverRef.current).borderRadius;\n if (spectrumBorderRadius !== '') {\n setBorderRadius(parseInt(spectrumBorderRadius, 10));\n }\n }\n }, [popoverRef]);\n return borderRadius;\n}\n\nfunction useArrowSize() {\n let [size, setSize] = useState(20);\n let [borderWidth, setBorderWidth] = useState(1);\n let arrowRef = useRef<SVGSVGElement>(null);\n // get the css value for the tip size and divide it by 2 for this arrow implementation\n useLayoutEffect(() => {\n if (arrowRef.current) {\n let spectrumTipWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-size');\n if (spectrumTipWidth !== '') {\n setSize(parseInt(spectrumTipWidth, 10) / 2);\n }\n\n let spectrumBorderWidth = window.getComputedStyle(arrowRef.current)\n .getPropertyValue('--spectrum-popover-tip-borderWidth');\n if (spectrumBorderWidth !== '') {\n setBorderWidth(parseInt(spectrumBorderWidth, 10));\n }\n }\n }, []);\n return {size, borderWidth, arrowRef};\n}\n\nfunction Arrow(props: ArrowProps) {\n let {primary, secondary, isLandscape, arrowProps, borderDiagonal, arrowRef} = props;\n let halfBorderDiagonal = borderDiagonal / 2;\n\n let primaryStart = 0;\n let primaryEnd = primary - halfBorderDiagonal;\n\n let secondaryStart = halfBorderDiagonal;\n let secondaryMiddle = secondary / 2;\n let secondaryEnd = secondary - halfBorderDiagonal;\n\n let pathData = isLandscape ? [\n 'M', secondaryStart, primaryStart,\n 'L', secondaryMiddle, primaryEnd,\n 'L', secondaryEnd, primaryStart\n ] : [\n 'M', primaryStart, secondaryStart,\n 'L', primaryEnd, secondaryMiddle,\n 'L', primaryStart, secondaryEnd\n ];\n\n /* use ceil because the svg needs to always accommodate the path inside it */\n return (\n <svg\n xmlns=\"http://www.w3.org/svg/2000\"\n width={Math.ceil(isLandscape ? secondary : primary)}\n height={Math.ceil(isLandscape ? primary : secondary)}\n className={classNames(styles, 'spectrum-Popover-tip')}\n ref={arrowRef}\n {...arrowProps}>\n <path className={classNames(styles, 'spectrum-Popover-tip-triangle')} d={pathData.join(' ')} />\n </svg>\n );\n}\n\n/**\n * More explanation on popover tips.\n * - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.\n * This did not work because the problem was in the svg partial pixel end of the path in the popover right and popover bottom.\n * - I tried creating an extra 'bandaid' path that matched the background color and would overlap the popover border.\n * This didn't work because the border on the svg triangle didn't extend all the way to match nicely with the popover border.\n * - I tried getting the client bounding box and setting the svg to that partial pixel value\n * This didn't work because again the issue was inside the svg\n * - I didn't try drawing the svg backwards\n * This could still be tried\n * - I tried changing the calculation of the popover placement AND the svg height/width so that they were all rounded\n * This seems to have done the trick.\n */\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
|
package/dist/Tray.main.js
CHANGED
|
@@ -37,7 +37,7 @@ $parcel$export(module.exports, "Tray", () => $6b386deda21be662$export$4589ed8193
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const $6b386deda21be662$export$4589ed81930b555c = /*#__PURE__*/ (0, $fWgpJ$react.forwardRef)(function Tray(props, ref) {
|
|
41
41
|
let { children: children, state: state, ...otherProps } = props;
|
|
42
42
|
let domRef = (0, $fWgpJ$reactspectrumutils.useDOMRef)(ref);
|
|
43
43
|
let wrapperRef = (0, $fWgpJ$react.useRef)(null);
|
|
@@ -50,7 +50,7 @@ function $6b386deda21be662$var$Tray(props, ref) {
|
|
|
50
50
|
wrapperRef: wrapperRef,
|
|
51
51
|
ref: domRef
|
|
52
52
|
}, children));
|
|
53
|
-
}
|
|
53
|
+
});
|
|
54
54
|
let $6b386deda21be662$var$TrayWrapper = /*#__PURE__*/ (0, $fWgpJ$react.forwardRef)(function(props, ref) {
|
|
55
55
|
let { children: children, isOpen: isOpen, isFixedHeight: isFixedHeight, state: state, wrapperRef: wrapperRef } = props;
|
|
56
56
|
let { styleProps: styleProps } = (0, $fWgpJ$reactspectrumutils.useStyleProps)(props);
|
|
@@ -96,7 +96,6 @@ let $6b386deda21be662$var$TrayWrapper = /*#__PURE__*/ (0, $fWgpJ$react.forwardRe
|
|
|
96
96
|
onDismiss: state.close
|
|
97
97
|
}))));
|
|
98
98
|
});
|
|
99
|
-
let $6b386deda21be662$export$4589ed81930b555c = /*#__PURE__*/ (0, $fWgpJ$react.forwardRef)($6b386deda21be662$var$Tray);
|
|
100
99
|
|
|
101
100
|
|
|
102
101
|
//# sourceMappingURL=Tray.main.js.map
|
package/dist/Tray.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAyBM,MAAM,0DAAO,CAAA,GAAA,uBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAA2B;IACxF,IAAI,YAAC,QAAQ,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IACvC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAkB;IAExC,qBACE,0DAAC,CAAA,GAAA,iCAAM;QAAG,GAAG,UAAU;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;qBACtD,0DAAC;QAAa,GAAG,KAAK;QAAE,YAAY;QAAY,KAAK;OAClD;AAIT;AAEA,IAAI,kDAAc,CAAA,GAAA,uBAAS,EAAE,SAAU,KAAuB,EAAE,GAAwC;IACtG,IAAI,YACF,QAAQ,UACR,MAAM,iBACN,aAAa,SACb,KAAK,cACL,UAAU,EACX,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,kCAAW,EAAE;IAE1B,IAAI,cAAC,UAAU,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,wCAAc,EAAE;QAChD,GAAG,KAAK;QACR,eAAe;IACjB,GAAG,OAAO;IAEV,oFAAoF;IACpF,sFAAsF;IACtF,6EAA6E;IAC7E,sFAAsF;IACtF,uFAAuF;IACvF,0FAA0F;IAC1F,2FAA2F;IAC3F,IAAI,WAAW,CAAA,GAAA,qCAAc;IAC7B,IAAI,eAAoB;QACtB,qCAAqC,SAAS,MAAM,GAAG;IACzD;IAEA,IAAI,mBAAmB,CAAA,GAAA,oCAAS,EAC9B,CAAA,GAAA,mDAAS,GACT;IAGF,IAAI,YAAY,CAAA,GAAA,oCAAS,EACvB,CAAA,GAAA,mDAAS,GACT,iBACA;QACE,WAAW;QACX,8BAA8B;IAChC,GACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb,iBACA,wBAEF,WAAW,SAAS;IAGtB,4LAA4L;IAC5L,qBACE,0DAAC;QAAI,KAAK;qBACR,0DAAC,CAAA,GAAA,kCAAO;QAAG,GAAG,aAAa;QAAE,QAAQ;sBACrC,0DAAC;QAAI,WAAW;QAAkB,OAAO;qBACvC,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,WAAW;QACX,KAAK;QACL,eAAY;qBACZ,0DAAC,CAAA,GAAA,sCAAY;QAAE,WAAW,MAAM,KAAK;QACpC,wBACD,0DAAC,CAAA,GAAA,sCAAY;QAAE,WAAW,MAAM,KAAK;;AAK/C","sources":["packages/@react-spectrum/overlays/src/Tray.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, DismissButton, useModalOverlay} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {Overlay} from './Overlay';\nimport {OverlayProps} from '@react-types/overlays';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef} from 'react';\nimport trayStyles from '@adobe/spectrum-css-temp/components/tray/vars.css';\nimport {Underlay} from './Underlay';\nimport {useObjectRef, useViewportSize} from '@react-aria/utils';\n\ninterface TrayProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {\n children: ReactNode,\n state: OverlayTriggerState,\n isFixedHeight?: boolean\n}\n\ninterface TrayWrapperProps extends TrayProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>\n}\n\nexport const Tray = forwardRef(function Tray(props: TrayProps, ref: DOMRef<HTMLDivElement>) {\n let {children, state, ...otherProps} = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <TrayWrapper {...props} wrapperRef={wrapperRef} ref={domRef}>\n {children}\n </TrayWrapper>\n </Overlay>\n );\n});\n\nlet TrayWrapper = forwardRef(function (props: TrayWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n children,\n isOpen,\n isFixedHeight,\n state,\n wrapperRef\n } = props;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n\n let {modalProps, underlayProps} = useModalOverlay({\n ...props,\n isDismissable: true\n }, state, objRef);\n\n // We need to measure the window's height in JS rather than using percentages in CSS\n // so that contents (e.g. menu) can inherit the max-height properly. Using percentages\n // does not work properly because there is nothing to base the percentage on.\n // We cannot use vh units because mobile browsers adjust the window height dynamically\n // when the address bar/bottom toolbars show and hide on scroll and vh units are fixed.\n // Also, the visual viewport is smaller than the layout viewport when the virtual keyboard\n // is up, so use the VisualViewport API to ensure the tray is displayed above the keyboard.\n let viewport = useViewportSize();\n let wrapperStyle: any = {\n '--spectrum-visual-viewport-height': viewport.height + 'px'\n };\n\n let wrapperClassName = classNames(\n trayStyles,\n 'spectrum-Tray-wrapper'\n );\n\n let className = classNames(\n trayStyles,\n 'spectrum-Tray',\n {\n 'is-open': isOpen,\n 'spectrum-Tray--fixedHeight': isFixedHeight\n },\n classNames(\n overrideStyles,\n 'spectrum-Tray',\n 'react-spectrum-Tray'\n ),\n styleProps.className\n );\n\n // Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n <Underlay {...underlayProps} isOpen={isOpen} />\n <div className={wrapperClassName} style={wrapperStyle}>\n <div\n {...styleProps}\n {...modalProps}\n className={className}\n ref={objRef}\n data-testid=\"tray\">\n <DismissButton onDismiss={state.close} />\n {children}\n <DismissButton onDismiss={state.close} />\n </div>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Tray.main.js.map"}
|
package/dist/Tray.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import $3XF9U$tray_vars_cssmodulejs from "./tray_vars_css.mjs";
|
|
|
6
6
|
import {Underlay as $76a452f4e3df11be$export$f360afc887607b02} from "./Underlay.mjs";
|
|
7
7
|
import {useModalOverlay as $3XF9U$useModalOverlay, DismissButton as $3XF9U$DismissButton} from "@react-aria/overlays";
|
|
8
8
|
import {useDOMRef as $3XF9U$useDOMRef, useStyleProps as $3XF9U$useStyleProps, classNames as $3XF9U$classNames} from "@react-spectrum/utils";
|
|
9
|
-
import $3XF9U$react, {
|
|
9
|
+
import $3XF9U$react, {forwardRef as $3XF9U$forwardRef, useRef as $3XF9U$useRef} from "react";
|
|
10
10
|
import {useObjectRef as $3XF9U$useObjectRef, useViewportSize as $3XF9U$useViewportSize} from "@react-aria/utils";
|
|
11
11
|
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ function $parcel$interopDefault(a) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const $1afc87f3d16a5a1c$export$4589ed81930b555c = /*#__PURE__*/ (0, $3XF9U$forwardRef)(function Tray(props, ref) {
|
|
35
35
|
let { children: children, state: state, ...otherProps } = props;
|
|
36
36
|
let domRef = (0, $3XF9U$useDOMRef)(ref);
|
|
37
37
|
let wrapperRef = (0, $3XF9U$useRef)(null);
|
|
@@ -44,7 +44,7 @@ function $1afc87f3d16a5a1c$var$Tray(props, ref) {
|
|
|
44
44
|
wrapperRef: wrapperRef,
|
|
45
45
|
ref: domRef
|
|
46
46
|
}, children));
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ (0, $3XF9U$forwardRef)(function(props, ref) {
|
|
49
49
|
let { children: children, isOpen: isOpen, isFixedHeight: isFixedHeight, state: state, wrapperRef: wrapperRef } = props;
|
|
50
50
|
let { styleProps: styleProps } = (0, $3XF9U$useStyleProps)(props);
|
|
@@ -90,7 +90,6 @@ let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ (0, $3XF9U$forwardRef)(fun
|
|
|
90
90
|
onDismiss: state.close
|
|
91
91
|
}))));
|
|
92
92
|
});
|
|
93
|
-
let $1afc87f3d16a5a1c$export$4589ed81930b555c = /*#__PURE__*/ (0, $3XF9U$forwardRef)($1afc87f3d16a5a1c$var$Tray);
|
|
94
93
|
|
|
95
94
|
|
|
96
95
|
export {$1afc87f3d16a5a1c$export$4589ed81930b555c as Tray};
|
package/dist/Tray.module.js
CHANGED
|
@@ -6,7 +6,7 @@ import $3XF9U$tray_vars_cssmodulejs from "./tray_vars_css.module.js";
|
|
|
6
6
|
import {Underlay as $76a452f4e3df11be$export$f360afc887607b02} from "./Underlay.module.js";
|
|
7
7
|
import {useModalOverlay as $3XF9U$useModalOverlay, DismissButton as $3XF9U$DismissButton} from "@react-aria/overlays";
|
|
8
8
|
import {useDOMRef as $3XF9U$useDOMRef, useStyleProps as $3XF9U$useStyleProps, classNames as $3XF9U$classNames} from "@react-spectrum/utils";
|
|
9
|
-
import $3XF9U$react, {
|
|
9
|
+
import $3XF9U$react, {forwardRef as $3XF9U$forwardRef, useRef as $3XF9U$useRef} from "react";
|
|
10
10
|
import {useObjectRef as $3XF9U$useObjectRef, useViewportSize as $3XF9U$useViewportSize} from "@react-aria/utils";
|
|
11
11
|
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ function $parcel$interopDefault(a) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const $1afc87f3d16a5a1c$export$4589ed81930b555c = /*#__PURE__*/ (0, $3XF9U$forwardRef)(function Tray(props, ref) {
|
|
35
35
|
let { children: children, state: state, ...otherProps } = props;
|
|
36
36
|
let domRef = (0, $3XF9U$useDOMRef)(ref);
|
|
37
37
|
let wrapperRef = (0, $3XF9U$useRef)(null);
|
|
@@ -44,7 +44,7 @@ function $1afc87f3d16a5a1c$var$Tray(props, ref) {
|
|
|
44
44
|
wrapperRef: wrapperRef,
|
|
45
45
|
ref: domRef
|
|
46
46
|
}, children));
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ (0, $3XF9U$forwardRef)(function(props, ref) {
|
|
49
49
|
let { children: children, isOpen: isOpen, isFixedHeight: isFixedHeight, state: state, wrapperRef: wrapperRef } = props;
|
|
50
50
|
let { styleProps: styleProps } = (0, $3XF9U$useStyleProps)(props);
|
|
@@ -90,7 +90,6 @@ let $1afc87f3d16a5a1c$var$TrayWrapper = /*#__PURE__*/ (0, $3XF9U$forwardRef)(fun
|
|
|
90
90
|
onDismiss: state.close
|
|
91
91
|
}))));
|
|
92
92
|
});
|
|
93
|
-
let $1afc87f3d16a5a1c$export$4589ed81930b555c = /*#__PURE__*/ (0, $3XF9U$forwardRef)($1afc87f3d16a5a1c$var$Tray);
|
|
94
93
|
|
|
95
94
|
|
|
96
95
|
export {$1afc87f3d16a5a1c$export$4589ed81930b555c as Tray};
|
package/dist/Tray.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAyBM,MAAM,0DAAO,CAAA,GAAA,iBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAA2B;IACxF,IAAI,YAAC,QAAQ,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IACvC,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,aAAa,CAAA,GAAA,aAAK,EAAkB;IAExC,qBACE,gCAAC,CAAA,GAAA,yCAAM;QAAG,GAAG,UAAU;QAAE,QAAQ,MAAM,MAAM;QAAE,SAAS;qBACtD,gCAAC;QAAa,GAAG,KAAK;QAAE,YAAY;QAAY,KAAK;OAClD;AAIT;AAEA,IAAI,kDAAc,CAAA,GAAA,iBAAS,EAAE,SAAU,KAAuB,EAAE,GAAwC;IACtG,IAAI,YACF,QAAQ,UACR,MAAM,iBACN,aAAa,SACb,KAAK,cACL,UAAU,EACX,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE;IAE1B,IAAI,cAAC,UAAU,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,sBAAc,EAAE;QAChD,GAAG,KAAK;QACR,eAAe;IACjB,GAAG,OAAO;IAEV,oFAAoF;IACpF,sFAAsF;IACtF,6EAA6E;IAC7E,sFAAsF;IACtF,uFAAuF;IACvF,0FAA0F;IAC1F,2FAA2F;IAC3F,IAAI,WAAW,CAAA,GAAA,sBAAc;IAC7B,IAAI,eAAoB;QACtB,qCAAqC,SAAS,MAAM,GAAG;IACzD;IAEA,IAAI,mBAAmB,CAAA,GAAA,iBAAS,EAC9B,CAAA,GAAA,sDAAS,GACT;IAGF,IAAI,YAAY,CAAA,GAAA,iBAAS,EACvB,CAAA,GAAA,sDAAS,GACT,iBACA;QACE,WAAW;QACX,8BAA8B;IAChC,GACA,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,qDAAa,GACb,iBACA,wBAEF,WAAW,SAAS;IAGtB,4LAA4L;IAC5L,qBACE,gCAAC;QAAI,KAAK;qBACR,gCAAC,CAAA,GAAA,yCAAO;QAAG,GAAG,aAAa;QAAE,QAAQ;sBACrC,gCAAC;QAAI,WAAW;QAAkB,OAAO;qBACvC,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,WAAW;QACX,KAAK;QACL,eAAY;qBACZ,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QACpC,wBACD,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;AAK/C","sources":["packages/@react-spectrum/overlays/src/Tray.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, DismissButton, useModalOverlay} from '@react-aria/overlays';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {Overlay} from './Overlay';\nimport {OverlayProps} from '@react-types/overlays';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef} from 'react';\nimport trayStyles from '@adobe/spectrum-css-temp/components/tray/vars.css';\nimport {Underlay} from './Underlay';\nimport {useObjectRef, useViewportSize} from '@react-aria/utils';\n\ninterface TrayProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {\n children: ReactNode,\n state: OverlayTriggerState,\n isFixedHeight?: boolean\n}\n\ninterface TrayWrapperProps extends TrayProps {\n isOpen?: boolean,\n wrapperRef: RefObject<HTMLDivElement | null>\n}\n\nexport const Tray = forwardRef(function Tray(props: TrayProps, ref: DOMRef<HTMLDivElement>) {\n let {children, state, ...otherProps} = props;\n let domRef = useDOMRef(ref);\n let wrapperRef = useRef<HTMLDivElement>(null);\n\n return (\n <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n <TrayWrapper {...props} wrapperRef={wrapperRef} ref={domRef}>\n {children}\n </TrayWrapper>\n </Overlay>\n );\n});\n\nlet TrayWrapper = forwardRef(function (props: TrayWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n children,\n isOpen,\n isFixedHeight,\n state,\n wrapperRef\n } = props;\n let {styleProps} = useStyleProps(props);\n let objRef = useObjectRef(ref);\n\n let {modalProps, underlayProps} = useModalOverlay({\n ...props,\n isDismissable: true\n }, state, objRef);\n\n // We need to measure the window's height in JS rather than using percentages in CSS\n // so that contents (e.g. menu) can inherit the max-height properly. Using percentages\n // does not work properly because there is nothing to base the percentage on.\n // We cannot use vh units because mobile browsers adjust the window height dynamically\n // when the address bar/bottom toolbars show and hide on scroll and vh units are fixed.\n // Also, the visual viewport is smaller than the layout viewport when the virtual keyboard\n // is up, so use the VisualViewport API to ensure the tray is displayed above the keyboard.\n let viewport = useViewportSize();\n let wrapperStyle: any = {\n '--spectrum-visual-viewport-height': viewport.height + 'px'\n };\n\n let wrapperClassName = classNames(\n trayStyles,\n 'spectrum-Tray-wrapper'\n );\n\n let className = classNames(\n trayStyles,\n 'spectrum-Tray',\n {\n 'is-open': isOpen,\n 'spectrum-Tray--fixedHeight': isFixedHeight\n },\n classNames(\n overrideStyles,\n 'spectrum-Tray',\n 'react-spectrum-Tray'\n ),\n styleProps.className\n );\n\n // Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n return (\n <div ref={wrapperRef}>\n <Underlay {...underlayProps} isOpen={isOpen} />\n <div className={wrapperClassName} style={wrapperStyle}>\n <div\n {...styleProps}\n {...modalProps}\n className={className}\n ref={objRef}\n data-testid=\"tray\">\n <DismissButton onDismiss={state.close} />\n {children}\n <DismissButton onDismiss={state.close} />\n </div>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Tray.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { OverlayTriggerState } from "@react-stately/overlays";
|
|
|
17
17
|
* **note** hitting esc bypasses exit animation for anyone testing.
|
|
18
18
|
*/
|
|
19
19
|
export function OpenTransition(props: any): any;
|
|
20
|
-
export
|
|
20
|
+
export const Overlay: React.ForwardRefExoticComponent<OverlayProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
|
|
21
21
|
interface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef' | 'maxHeight'>, FocusWithinProps, StyleProps {
|
|
22
22
|
children: ReactNode;
|
|
23
23
|
hideArrow?: boolean;
|
|
@@ -34,18 +34,18 @@ interface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef' | 'maxHeight'
|
|
|
34
34
|
enableBothDismissButtons?: boolean;
|
|
35
35
|
onDismissButtonPress?: () => void;
|
|
36
36
|
}
|
|
37
|
-
export
|
|
37
|
+
export const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
|
|
38
38
|
interface ModalProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {
|
|
39
39
|
children: ReactNode;
|
|
40
40
|
state: OverlayTriggerState;
|
|
41
41
|
type?: 'modal' | 'fullscreen' | 'fullscreenTakeover';
|
|
42
42
|
}
|
|
43
|
-
export
|
|
43
|
+
export const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
|
|
44
44
|
interface TrayProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {
|
|
45
45
|
children: ReactNode;
|
|
46
46
|
state: OverlayTriggerState;
|
|
47
47
|
isFixedHeight?: boolean;
|
|
48
48
|
}
|
|
49
|
-
export
|
|
49
|
+
export const Tray: React.ForwardRefExoticComponent<TrayProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
|
|
50
50
|
|
|
51
51
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAoBA;;;;;;;;;;;GAWG;AAEH,+BAA+B,KAAK,KAAA,OAWnC;
|
|
1
|
+
{"mappings":";;;;;;AAoBA;;;;;;;;;;;GAWG;AAEH,+BAA+B,KAAK,KAAA,OAWnC;ACzBD,OAAO,MAAM,yGAwDX,CAAC;AEnDH,sBAAuB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,WAAW,CAAC,EAAE,gBAAgB,EAAE,UAAU;IAC7G,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAA;CAClC;AA8BD,OAAO,MAAM,yGAgBX,CAAC;AC7DH,oBAAqB,SAAQ,qBAAqB,EAAE,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,oBAAoB,CAAC;IAClH,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,oBAAoB,CAAA;CACrD;AAQD,OAAO,MAAM,qGAYX,CAAC;ACxBH,mBAAoB,SAAQ,qBAAqB,EAAE,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,oBAAoB,CAAC;IACjH,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAOD,OAAO,MAAM,mGAYX,CAAC","sources":["packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/OpenTransition.tsx","packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/Overlay.tsx","packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/Underlay.tsx","packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/Popover.tsx","packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/Modal.tsx","packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/Tray.tsx","packages/@react-spectrum/overlays/src/packages/@react-spectrum/overlays/src/index.ts","packages/@react-spectrum/overlays/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {Overlay} from './Overlay';\nexport {Popover} from './Popover';\nexport {Modal} from './Modal';\nexport {Tray} from './Tray';\nexport {OpenTransition} from './OpenTransition';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
|
|
111
111
|
.OdG0hG_spectrum-Modal-wrapper {
|
|
112
112
|
box-sizing: border-box;
|
|
113
|
+
width: 100vw;
|
|
113
114
|
height: var(--spectrum-visual-viewport-height);
|
|
114
115
|
visibility: hidden;
|
|
115
116
|
pointer-events: none;
|
|
@@ -117,7 +118,6 @@
|
|
|
117
118
|
transition: visibility 0s linear var(--spectrum-global-animation-duration-100, .13s);
|
|
118
119
|
justify-content: center;
|
|
119
120
|
align-items: center;
|
|
120
|
-
width: 100vw;
|
|
121
121
|
display: flex;
|
|
122
122
|
position: fixed;
|
|
123
123
|
top: 0;
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
transform: translateY(var(--spectrum-dialog-entry-animation-distance, var(--spectrum-global-dimension-size-250)));
|
|
133
133
|
z-index: 2;
|
|
134
134
|
max-height: calc(var(--spectrum-visual-viewport-height) * .9);
|
|
135
|
+
max-width: 90vw;
|
|
135
136
|
min-width: var(--spectrum-dialog-min-width, var(--spectrum-global-dimension-static-size-3600));
|
|
136
137
|
border-radius: var(--spectrum-dialog-border-radius, var(--spectrum-global-dimension-size-50));
|
|
137
138
|
border-width: var(--spectrum-popover-border-size, var(--spectrum-alias-border-size-thin));
|
|
138
139
|
pointer-events: auto;
|
|
139
140
|
transition: opacity var(--spectrum-dialog-exit-animation-duration, var(--spectrum-global-animation-duration-100)) cubic-bezier(.5, 0, 1, 1) 0s, visibility 0s linear calc(0s + var(--spectrum-dialog-exit-animation-duration, var(--spectrum-global-animation-duration-100))), transform 0s linear calc(0s + var(--spectrum-dialog-exit-animation-duration, var(--spectrum-global-animation-duration-100)));
|
|
140
141
|
outline: none;
|
|
141
|
-
max-width: 90vw;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
.OdG0hG_is-open {
|
|
@@ -194,4 +194,4 @@
|
|
|
194
194
|
background: var(--spectrum-dialog-background-color, var(--spectrum-alias-background-color-default));
|
|
195
195
|
border-color: var(--spectrum-alias-border-color-transparent, transparent);
|
|
196
196
|
}
|
|
197
|
-
/*# sourceMappingURL=vars.
|
|
197
|
+
/*# sourceMappingURL=vars.a1de7c32.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ;;;;;;;AAYA;;;;;;;AAWA;;;;AAIA;;;;AAUA;;;;AAIA;;;;AAMA;;;;;;;;;;;;;;;;AA4BE;;;;AAKF;;;;;;;;;;;;;AAyBA;;;;;AAYA;EAEE;;;;;;;;EAQE;;;;;AAQJ;;;;;;;;;AAYA;;;;;;;;;;;AAeE;;;;AAMF;EACE;;;;;AAiBF","sources":["packages/@adobe/spectrum-css-temp/components/modal/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.
|
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ;;;;;;;AAYA;;;;;;;AAWA;;;;AAIA;;;;AAUA;;;;AAIA;;;;AAMA;;;;;;;;;;;;;;;;AA4BE;;;;AAKF;;;;;;;;;;;;;AAyBA;;;;;AAYA;EAEE;;;;;;;;EAQE;;;;;AAQJ;;;;;;;;;AAYA;;;;;;;;;;;AAeE;;;;AAMF;EACE;;;;;AAiBF","sources":["packages/@adobe/spectrum-css-temp/components/modal/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.a1de7c32.css.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/overlays",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/interactions": "^3.
|
|
40
|
-
"@react-aria/overlays": "^3.
|
|
41
|
-
"@react-aria/utils": "^3.
|
|
42
|
-
"@react-spectrum/utils": "^3.12.
|
|
43
|
-
"@react-stately/overlays": "^3.6.
|
|
44
|
-
"@react-types/overlays": "^3.8.
|
|
45
|
-
"@react-types/shared": "^3.
|
|
39
|
+
"@react-aria/interactions": "^3.23.0",
|
|
40
|
+
"@react-aria/overlays": "^3.25.0",
|
|
41
|
+
"@react-aria/utils": "^3.27.0",
|
|
42
|
+
"@react-spectrum/utils": "^3.12.1",
|
|
43
|
+
"@react-stately/overlays": "^3.6.13",
|
|
44
|
+
"@react-types/overlays": "^3.8.12",
|
|
45
|
+
"@react-types/shared": "^3.27.0",
|
|
46
46
|
"@swc/helpers": "^0.5.0",
|
|
47
47
|
"react-transition-group": "^4.4.5"
|
|
48
48
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
|
|
61
61
|
}
|
package/src/Modal.tsx
CHANGED
|
@@ -34,7 +34,7 @@ interface ModalWrapperProps extends ModalProps {
|
|
|
34
34
|
children: ReactNode
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {
|
|
37
|
+
export const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {
|
|
38
38
|
let {children, state, ...otherProps} = props;
|
|
39
39
|
let domRef = useDOMRef(ref);
|
|
40
40
|
let wrapperRef = useRef<HTMLDivElement>(null);
|
|
@@ -46,7 +46,7 @@ function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {
|
|
|
46
46
|
</ModalWrapper>
|
|
47
47
|
</Overlay>
|
|
48
48
|
);
|
|
49
|
-
}
|
|
49
|
+
});
|
|
50
50
|
|
|
51
51
|
let typeMap = {
|
|
52
52
|
fullscreen: 'fullscreen',
|
|
@@ -107,6 +107,3 @@ let ModalWrapper = forwardRef(function (props: ModalWrapperProps, ref: Forwarded
|
|
|
107
107
|
</div>
|
|
108
108
|
);
|
|
109
109
|
});
|
|
110
|
-
|
|
111
|
-
let _Modal = forwardRef(Modal);
|
|
112
|
-
export {_Modal as Modal};
|
package/src/Overlay.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import {Provider} from '@react-spectrum/provider';
|
|
|
17
17
|
import React, {useCallback, useState} from 'react';
|
|
18
18
|
import {Overlay as ReactAriaOverlay} from '@react-aria/overlays';
|
|
19
19
|
|
|
20
|
-
function Overlay(props: OverlayProps, ref: DOMRef<HTMLDivElement>) {
|
|
20
|
+
export const Overlay = React.forwardRef(function Overlay(props: OverlayProps, ref: DOMRef<HTMLDivElement>) {
|
|
21
21
|
let {
|
|
22
22
|
children,
|
|
23
23
|
isOpen,
|
|
@@ -73,7 +73,4 @@ function Overlay(props: OverlayProps, ref: DOMRef<HTMLDivElement>) {
|
|
|
73
73
|
</Provider>
|
|
74
74
|
</ReactAriaOverlay>
|
|
75
75
|
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
let _Overlay = React.forwardRef(Overlay);
|
|
79
|
-
export {_Overlay as Overlay};
|
|
76
|
+
});
|
package/src/Popover.tsx
CHANGED
|
@@ -67,7 +67,7 @@ let arrowPlacement = {
|
|
|
67
67
|
bottom: 'bottom'
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
function Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {
|
|
70
|
+
export const Popover = forwardRef(function Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {
|
|
71
71
|
let {
|
|
72
72
|
children,
|
|
73
73
|
state,
|
|
@@ -83,7 +83,7 @@ function Popover(props: PopoverProps, ref: DOMRef<HTMLDivElement>) {
|
|
|
83
83
|
</PopoverWrapper>
|
|
84
84
|
</Overlay>
|
|
85
85
|
);
|
|
86
|
-
}
|
|
86
|
+
});
|
|
87
87
|
|
|
88
88
|
const PopoverWrapper = forwardRef((props: PopoverWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) => {
|
|
89
89
|
let {
|
|
@@ -238,9 +238,6 @@ function Arrow(props: ArrowProps) {
|
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
let _Popover = forwardRef(Popover);
|
|
242
|
-
export {_Popover as Popover};
|
|
243
|
-
|
|
244
241
|
/**
|
|
245
242
|
* More explanation on popover tips.
|
|
246
243
|
* - I tried changing the calculation of the popover placement in an effort to get it squarely onto the pixel grid.
|
package/src/Tray.tsx
CHANGED
|
@@ -33,7 +33,7 @@ interface TrayWrapperProps extends TrayProps {
|
|
|
33
33
|
wrapperRef: RefObject<HTMLDivElement | null>
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function Tray(props: TrayProps, ref: DOMRef<HTMLDivElement>) {
|
|
36
|
+
export const Tray = forwardRef(function Tray(props: TrayProps, ref: DOMRef<HTMLDivElement>) {
|
|
37
37
|
let {children, state, ...otherProps} = props;
|
|
38
38
|
let domRef = useDOMRef(ref);
|
|
39
39
|
let wrapperRef = useRef<HTMLDivElement>(null);
|
|
@@ -45,7 +45,7 @@ function Tray(props: TrayProps, ref: DOMRef<HTMLDivElement>) {
|
|
|
45
45
|
</TrayWrapper>
|
|
46
46
|
</Overlay>
|
|
47
47
|
);
|
|
48
|
-
}
|
|
48
|
+
});
|
|
49
49
|
|
|
50
50
|
let TrayWrapper = forwardRef(function (props: TrayWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) {
|
|
51
51
|
let {
|
|
@@ -114,6 +114,3 @@ let TrayWrapper = forwardRef(function (props: TrayWrapperProps, ref: ForwardedRe
|
|
|
114
114
|
</div>
|
|
115
115
|
);
|
|
116
116
|
});
|
|
117
|
-
|
|
118
|
-
let _Tray = forwardRef(Tray);
|
|
119
|
-
export {_Tray as Tray};
|