@react-spectrum/overlays 5.5.4 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Modal.main.js +93 -0
- package/dist/Modal.main.js.map +1 -0
- package/dist/Modal.mjs +88 -0
- package/dist/Modal.module.js +88 -0
- package/dist/Modal.module.js.map +1 -0
- package/dist/OpenTransition.main.js +44 -0
- package/dist/OpenTransition.main.js.map +1 -0
- package/dist/OpenTransition.mjs +35 -0
- package/dist/OpenTransition.module.js +35 -0
- package/dist/OpenTransition.module.js.map +1 -0
- package/dist/Overlay.main.js +75 -0
- package/dist/Overlay.main.js.map +1 -0
- package/dist/Overlay.mjs +66 -0
- package/dist/Overlay.module.js +66 -0
- package/dist/Overlay.module.js.map +1 -0
- package/dist/Popover.main.js +206 -0
- package/dist/Popover.main.js.map +1 -0
- package/dist/Popover.mjs +201 -0
- package/dist/Popover.module.js +201 -0
- package/dist/Popover.module.js.map +1 -0
- package/dist/Tray.main.js +101 -0
- package/dist/Tray.main.js.map +1 -0
- package/dist/Tray.mjs +96 -0
- package/dist/Tray.module.js +96 -0
- package/dist/Tray.module.js.map +1 -0
- package/dist/Underlay.main.js +41 -0
- package/dist/Underlay.main.js.map +1 -0
- package/dist/Underlay.mjs +36 -0
- package/dist/Underlay.module.js +36 -0
- package/dist/Underlay.module.js.map +1 -0
- package/dist/import.mjs +5 -712
- package/dist/main.js +10 -713
- package/dist/main.js.map +1 -1
- package/dist/modal_vars_css.main.js +59 -0
- package/dist/modal_vars_css.main.js.map +1 -0
- package/dist/modal_vars_css.mjs +61 -0
- package/dist/modal_vars_css.module.js +61 -0
- package/dist/modal_vars_css.module.js.map +1 -0
- package/dist/module.js +5 -712
- package/dist/module.js.map +1 -1
- package/dist/overlays.ac5ba32f.css +12 -0
- package/dist/overlays.ac5ba32f.css.map +1 -0
- package/dist/overlays_css.main.js +35 -0
- package/dist/overlays_css.main.js.map +1 -0
- package/dist/overlays_css.mjs +37 -0
- package/dist/overlays_css.module.js +37 -0
- package/dist/overlays_css.module.js.map +1 -0
- package/dist/popover_vars_css.main.js +83 -0
- package/dist/popover_vars_css.main.js.map +1 -0
- package/dist/popover_vars_css.mjs +85 -0
- package/dist/popover_vars_css.module.js +85 -0
- package/dist/popover_vars_css.module.js.map +1 -0
- package/dist/tray_vars_css.main.js +53 -0
- package/dist/tray_vars_css.main.js.map +1 -0
- package/dist/tray_vars_css.mjs +55 -0
- package/dist/tray_vars_css.module.js +55 -0
- package/dist/tray_vars_css.module.js.map +1 -0
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/underlay_vars_css.main.js +50 -0
- package/dist/underlay_vars_css.main.js.map +1 -0
- package/dist/underlay_vars_css.mjs +52 -0
- package/dist/underlay_vars_css.module.js +52 -0
- package/dist/underlay_vars_css.module.js.map +1 -0
- package/dist/vars.28c6b2d1.css +131 -0
- package/dist/vars.28c6b2d1.css.map +1 -0
- package/dist/vars.32d8c84b.css +197 -0
- package/dist/vars.32d8c84b.css.map +1 -0
- package/dist/vars.aa9f4ef9.css +183 -0
- package/dist/vars.aa9f4ef9.css.map +1 -0
- package/dist/vars.e9dc412f.css +210 -0
- package/dist/vars.e9dc412f.css.map +1 -0
- package/package.json +9 -9
- package/src/Overlay.tsx +1 -0
- package/dist/main.css +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
require("./vars.32d8c84b.css");
|
|
2
|
+
var $86571b803f942ff3$exports = require("./modal_vars_css.main.js");
|
|
3
|
+
var $2aebdc186fd41e87$exports = require("./Overlay.main.js");
|
|
4
|
+
require("./overlays.ac5ba32f.css");
|
|
5
|
+
var $e9a663ccb19ed1b0$exports = require("./overlays_css.main.js");
|
|
6
|
+
var $b900e75089bdd9cd$exports = require("./Underlay.main.js");
|
|
7
|
+
var $aM0tW$reactariaoverlays = require("@react-aria/overlays");
|
|
8
|
+
var $aM0tW$reactspectrumutils = require("@react-spectrum/utils");
|
|
9
|
+
var $aM0tW$react = require("react");
|
|
10
|
+
var $aM0tW$reactariautils = require("@react-aria/utils");
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function $parcel$export(e, n, v, s) {
|
|
18
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
$parcel$export(module.exports, "Modal", () => $fc75a6aa7a2b905b$export$2b77a92f1a5ad772);
|
|
22
|
+
/*
|
|
23
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
24
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
*
|
|
28
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
+
* governing permissions and limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
function $fc75a6aa7a2b905b$var$Modal(props, ref) {
|
|
41
|
+
let { children: children, state: state, ...otherProps } = props;
|
|
42
|
+
let domRef = (0, $aM0tW$reactspectrumutils.useDOMRef)(ref);
|
|
43
|
+
let wrapperRef = (0, $aM0tW$react.useRef)(null);
|
|
44
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($aM0tW$react))).createElement((0, $2aebdc186fd41e87$exports.Overlay), {
|
|
45
|
+
...otherProps,
|
|
46
|
+
isOpen: state.isOpen,
|
|
47
|
+
nodeRef: wrapperRef
|
|
48
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($aM0tW$react))).createElement($fc75a6aa7a2b905b$var$ModalWrapper, {
|
|
49
|
+
...props,
|
|
50
|
+
wrapperRef: wrapperRef,
|
|
51
|
+
ref: domRef
|
|
52
|
+
}, children));
|
|
53
|
+
}
|
|
54
|
+
let $fc75a6aa7a2b905b$var$typeMap = {
|
|
55
|
+
fullscreen: "fullscreen",
|
|
56
|
+
fullscreenTakeover: "fullscreenTakeover"
|
|
57
|
+
};
|
|
58
|
+
let $fc75a6aa7a2b905b$var$ModalWrapper = /*#__PURE__*/ (0, $aM0tW$react.forwardRef)(function(props, ref) {
|
|
59
|
+
let { type: type, children: children, state: state, isOpen: isOpen, wrapperRef: wrapperRef } = props;
|
|
60
|
+
let typeVariant = $fc75a6aa7a2b905b$var$typeMap[type];
|
|
61
|
+
let { styleProps: styleProps } = (0, $aM0tW$reactspectrumutils.useStyleProps)(props);
|
|
62
|
+
let { modalProps: modalProps, underlayProps: underlayProps } = (0, $aM0tW$reactariaoverlays.useModalOverlay)(props, state, ref);
|
|
63
|
+
let wrapperClassName = (0, $aM0tW$reactspectrumutils.classNames)((0, ($parcel$interopDefault($86571b803f942ff3$exports))), "spectrum-Modal-wrapper", (0, $aM0tW$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e9a663ccb19ed1b0$exports))), "spectrum-Modal-wrapper", "react-spectrum-Modal-wrapper"));
|
|
64
|
+
let modalClassName = (0, $aM0tW$reactspectrumutils.classNames)((0, ($parcel$interopDefault($86571b803f942ff3$exports))), "spectrum-Modal", {
|
|
65
|
+
"is-open": isOpen
|
|
66
|
+
}, (0, $aM0tW$reactspectrumutils.classNames)((0, ($parcel$interopDefault($e9a663ccb19ed1b0$exports))), "spectrum-Modal", "react-spectrum-Modal"), {
|
|
67
|
+
[`spectrum-Modal--${typeVariant}`]: typeVariant
|
|
68
|
+
}, styleProps.className);
|
|
69
|
+
let viewport = (0, $aM0tW$reactariautils.useViewportSize)();
|
|
70
|
+
let style = {
|
|
71
|
+
"--spectrum-visual-viewport-height": viewport.height + "px"
|
|
72
|
+
};
|
|
73
|
+
// Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231
|
|
74
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($aM0tW$react))).createElement("div", {
|
|
75
|
+
ref: wrapperRef
|
|
76
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($aM0tW$react))).createElement((0, $b900e75089bdd9cd$exports.Underlay), {
|
|
77
|
+
...underlayProps,
|
|
78
|
+
isOpen: isOpen
|
|
79
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($aM0tW$react))).createElement("div", {
|
|
80
|
+
className: wrapperClassName,
|
|
81
|
+
style: style
|
|
82
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($aM0tW$react))).createElement("div", {
|
|
83
|
+
...styleProps,
|
|
84
|
+
...modalProps,
|
|
85
|
+
ref: ref,
|
|
86
|
+
className: modalClassName,
|
|
87
|
+
"data-testid": "modal"
|
|
88
|
+
}, children)));
|
|
89
|
+
});
|
|
90
|
+
let $fc75a6aa7a2b905b$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $aM0tW$react.forwardRef)($fc75a6aa7a2b905b$var$Modal);
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=Modal.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAyBD,SAAS,4BAAM,KAAiB,EAAE,GAA2B;IAC3D,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;QAAc,GAAG,KAAK;QAAE,YAAY;QAAY,KAAK;OACnD;AAIT;AAEA,IAAI,gCAAU;IACZ,YAAY;IACZ,oBAAoB;AACtB;AAEA,IAAI,mDAAe,CAAA,GAAA,uBAAS,EAAE,SAAU,KAAwB,EAAE,GAA8B;IAC9F,IAAI,QAAC,IAAI,YAAE,QAAQ,SAAE,KAAK,UAAE,MAAM,cAAE,UAAU,EAAC,GAAG;IAClD,IAAI,cAAc,6BAAO,CAAC,KAAK;IAC/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,cAAC,UAAU,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,wCAAc,EAAE,OAAO,OAAO;IAEhE,IAAI,mBAAmB,CAAA,GAAA,oCAAS,EAC9B,CAAA,GAAA,mDAAU,GACV,0BACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb,0BACA;IAIJ,IAAI,iBAAiB,CAAA,GAAA,oCAAS,EAC5B,CAAA,GAAA,mDAAU,GACV,kBACA;QACE,WAAW;IACb,GACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb,kBACA,yBAEF;QAAC,CAAC,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC,EAAE;IAAW,GAChD,WAAW,SAAS;IAGtB,IAAI,WAAW,CAAA,GAAA,qCAAc;IAC7B,IAAI,QAAa;QACf,qCAAqC,SAAS,MAAM,GAAG;IACzD;IAEA,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,KAAK;QACL,WAAW;QACX,eAAY;OACX;AAKX;AAEA,IAAI,0DAAS,CAAA,GAAA,uBAAS,EAAE","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, 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, {forwardRef, MutableRefObject, ReactNode, RefObject, useRef} from 'react';\nimport {Underlay} from './Underlay';\nimport {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: MutableRefObject<HTMLDivElement>\n}\n\nfunction 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: RefObject<HTMLDivElement>) {\n let {type, children, state, isOpen, wrapperRef} = props;\n let typeVariant = typeMap[type];\n let {styleProps} = useStyleProps(props);\n let {modalProps, underlayProps} = useModalOverlay(props, state, ref);\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={ref}\n className={modalClassName}\n data-testid=\"modal\">\n {children}\n </div>\n </div>\n </div>\n );\n});\n\nlet _Modal = forwardRef(Modal);\nexport {_Modal as Modal};\n"],"names":[],"version":3,"file":"Modal.main.js.map"}
|
package/dist/Modal.mjs
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "./vars.32d8c84b.css";
|
|
2
|
+
import $e9TuM$modal_vars_cssmodulejs from "./modal_vars_css.mjs";
|
|
3
|
+
import {Overlay as $70305dc5fb729c3b$export$c6fdb837b070b4ff} from "./Overlay.mjs";
|
|
4
|
+
import "./overlays.ac5ba32f.css";
|
|
5
|
+
import $e9TuM$overlays_cssmodulejs from "./overlays_css.mjs";
|
|
6
|
+
import {Underlay as $76a452f4e3df11be$export$f360afc887607b02} from "./Underlay.mjs";
|
|
7
|
+
import {useModalOverlay as $e9TuM$useModalOverlay} from "@react-aria/overlays";
|
|
8
|
+
import {useDOMRef as $e9TuM$useDOMRef, useStyleProps as $e9TuM$useStyleProps, classNames as $e9TuM$classNames} from "@react-spectrum/utils";
|
|
9
|
+
import $e9TuM$react, {useRef as $e9TuM$useRef, forwardRef as $e9TuM$forwardRef} from "react";
|
|
10
|
+
import {useViewportSize as $e9TuM$useViewportSize} from "@react-aria/utils";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function $842084dfa182af65$var$Modal(props, ref) {
|
|
35
|
+
let { children: children, state: state, ...otherProps } = props;
|
|
36
|
+
let domRef = (0, $e9TuM$useDOMRef)(ref);
|
|
37
|
+
let wrapperRef = (0, $e9TuM$useRef)(null);
|
|
38
|
+
return /*#__PURE__*/ (0, $e9TuM$react).createElement((0, $70305dc5fb729c3b$export$c6fdb837b070b4ff), {
|
|
39
|
+
...otherProps,
|
|
40
|
+
isOpen: state.isOpen,
|
|
41
|
+
nodeRef: wrapperRef
|
|
42
|
+
}, /*#__PURE__*/ (0, $e9TuM$react).createElement($842084dfa182af65$var$ModalWrapper, {
|
|
43
|
+
...props,
|
|
44
|
+
wrapperRef: wrapperRef,
|
|
45
|
+
ref: domRef
|
|
46
|
+
}, children));
|
|
47
|
+
}
|
|
48
|
+
let $842084dfa182af65$var$typeMap = {
|
|
49
|
+
fullscreen: "fullscreen",
|
|
50
|
+
fullscreenTakeover: "fullscreenTakeover"
|
|
51
|
+
};
|
|
52
|
+
let $842084dfa182af65$var$ModalWrapper = /*#__PURE__*/ (0, $e9TuM$forwardRef)(function(props, ref) {
|
|
53
|
+
let { type: type, children: children, state: state, isOpen: isOpen, wrapperRef: wrapperRef } = props;
|
|
54
|
+
let typeVariant = $842084dfa182af65$var$typeMap[type];
|
|
55
|
+
let { styleProps: styleProps } = (0, $e9TuM$useStyleProps)(props);
|
|
56
|
+
let { modalProps: modalProps, underlayProps: underlayProps } = (0, $e9TuM$useModalOverlay)(props, state, ref);
|
|
57
|
+
let wrapperClassName = (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$modal_vars_cssmodulejs))), "spectrum-Modal-wrapper", (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$overlays_cssmodulejs))), "spectrum-Modal-wrapper", "react-spectrum-Modal-wrapper"));
|
|
58
|
+
let modalClassName = (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$modal_vars_cssmodulejs))), "spectrum-Modal", {
|
|
59
|
+
"is-open": isOpen
|
|
60
|
+
}, (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$overlays_cssmodulejs))), "spectrum-Modal", "react-spectrum-Modal"), {
|
|
61
|
+
[`spectrum-Modal--${typeVariant}`]: typeVariant
|
|
62
|
+
}, styleProps.className);
|
|
63
|
+
let viewport = (0, $e9TuM$useViewportSize)();
|
|
64
|
+
let style = {
|
|
65
|
+
"--spectrum-visual-viewport-height": viewport.height + "px"
|
|
66
|
+
};
|
|
67
|
+
// Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231
|
|
68
|
+
return /*#__PURE__*/ (0, $e9TuM$react).createElement("div", {
|
|
69
|
+
ref: wrapperRef
|
|
70
|
+
}, /*#__PURE__*/ (0, $e9TuM$react).createElement((0, $76a452f4e3df11be$export$f360afc887607b02), {
|
|
71
|
+
...underlayProps,
|
|
72
|
+
isOpen: isOpen
|
|
73
|
+
}), /*#__PURE__*/ (0, $e9TuM$react).createElement("div", {
|
|
74
|
+
className: wrapperClassName,
|
|
75
|
+
style: style
|
|
76
|
+
}, /*#__PURE__*/ (0, $e9TuM$react).createElement("div", {
|
|
77
|
+
...styleProps,
|
|
78
|
+
...modalProps,
|
|
79
|
+
ref: ref,
|
|
80
|
+
className: modalClassName,
|
|
81
|
+
"data-testid": "modal"
|
|
82
|
+
}, children)));
|
|
83
|
+
});
|
|
84
|
+
let $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $e9TuM$forwardRef)($842084dfa182af65$var$Modal);
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
export {$842084dfa182af65$export$2b77a92f1a5ad772 as Modal};
|
|
88
|
+
//# sourceMappingURL=Modal.mjs.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "./vars.32d8c84b.css";
|
|
2
|
+
import $e9TuM$modal_vars_cssmodulejs from "./modal_vars_css.module.js";
|
|
3
|
+
import {Overlay as $70305dc5fb729c3b$export$c6fdb837b070b4ff} from "./Overlay.module.js";
|
|
4
|
+
import "./overlays.ac5ba32f.css";
|
|
5
|
+
import $e9TuM$overlays_cssmodulejs from "./overlays_css.module.js";
|
|
6
|
+
import {Underlay as $76a452f4e3df11be$export$f360afc887607b02} from "./Underlay.module.js";
|
|
7
|
+
import {useModalOverlay as $e9TuM$useModalOverlay} from "@react-aria/overlays";
|
|
8
|
+
import {useDOMRef as $e9TuM$useDOMRef, useStyleProps as $e9TuM$useStyleProps, classNames as $e9TuM$classNames} from "@react-spectrum/utils";
|
|
9
|
+
import $e9TuM$react, {useRef as $e9TuM$useRef, forwardRef as $e9TuM$forwardRef} from "react";
|
|
10
|
+
import {useViewportSize as $e9TuM$useViewportSize} from "@react-aria/utils";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function $842084dfa182af65$var$Modal(props, ref) {
|
|
35
|
+
let { children: children, state: state, ...otherProps } = props;
|
|
36
|
+
let domRef = (0, $e9TuM$useDOMRef)(ref);
|
|
37
|
+
let wrapperRef = (0, $e9TuM$useRef)(null);
|
|
38
|
+
return /*#__PURE__*/ (0, $e9TuM$react).createElement((0, $70305dc5fb729c3b$export$c6fdb837b070b4ff), {
|
|
39
|
+
...otherProps,
|
|
40
|
+
isOpen: state.isOpen,
|
|
41
|
+
nodeRef: wrapperRef
|
|
42
|
+
}, /*#__PURE__*/ (0, $e9TuM$react).createElement($842084dfa182af65$var$ModalWrapper, {
|
|
43
|
+
...props,
|
|
44
|
+
wrapperRef: wrapperRef,
|
|
45
|
+
ref: domRef
|
|
46
|
+
}, children));
|
|
47
|
+
}
|
|
48
|
+
let $842084dfa182af65$var$typeMap = {
|
|
49
|
+
fullscreen: "fullscreen",
|
|
50
|
+
fullscreenTakeover: "fullscreenTakeover"
|
|
51
|
+
};
|
|
52
|
+
let $842084dfa182af65$var$ModalWrapper = /*#__PURE__*/ (0, $e9TuM$forwardRef)(function(props, ref) {
|
|
53
|
+
let { type: type, children: children, state: state, isOpen: isOpen, wrapperRef: wrapperRef } = props;
|
|
54
|
+
let typeVariant = $842084dfa182af65$var$typeMap[type];
|
|
55
|
+
let { styleProps: styleProps } = (0, $e9TuM$useStyleProps)(props);
|
|
56
|
+
let { modalProps: modalProps, underlayProps: underlayProps } = (0, $e9TuM$useModalOverlay)(props, state, ref);
|
|
57
|
+
let wrapperClassName = (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$modal_vars_cssmodulejs))), "spectrum-Modal-wrapper", (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$overlays_cssmodulejs))), "spectrum-Modal-wrapper", "react-spectrum-Modal-wrapper"));
|
|
58
|
+
let modalClassName = (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$modal_vars_cssmodulejs))), "spectrum-Modal", {
|
|
59
|
+
"is-open": isOpen
|
|
60
|
+
}, (0, $e9TuM$classNames)((0, ($parcel$interopDefault($e9TuM$overlays_cssmodulejs))), "spectrum-Modal", "react-spectrum-Modal"), {
|
|
61
|
+
[`spectrum-Modal--${typeVariant}`]: typeVariant
|
|
62
|
+
}, styleProps.className);
|
|
63
|
+
let viewport = (0, $e9TuM$useViewportSize)();
|
|
64
|
+
let style = {
|
|
65
|
+
"--spectrum-visual-viewport-height": viewport.height + "px"
|
|
66
|
+
};
|
|
67
|
+
// Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231
|
|
68
|
+
return /*#__PURE__*/ (0, $e9TuM$react).createElement("div", {
|
|
69
|
+
ref: wrapperRef
|
|
70
|
+
}, /*#__PURE__*/ (0, $e9TuM$react).createElement((0, $76a452f4e3df11be$export$f360afc887607b02), {
|
|
71
|
+
...underlayProps,
|
|
72
|
+
isOpen: isOpen
|
|
73
|
+
}), /*#__PURE__*/ (0, $e9TuM$react).createElement("div", {
|
|
74
|
+
className: wrapperClassName,
|
|
75
|
+
style: style
|
|
76
|
+
}, /*#__PURE__*/ (0, $e9TuM$react).createElement("div", {
|
|
77
|
+
...styleProps,
|
|
78
|
+
...modalProps,
|
|
79
|
+
ref: ref,
|
|
80
|
+
className: modalClassName,
|
|
81
|
+
"data-testid": "modal"
|
|
82
|
+
}, children)));
|
|
83
|
+
});
|
|
84
|
+
let $842084dfa182af65$export$2b77a92f1a5ad772 = /*#__PURE__*/ (0, $e9TuM$forwardRef)($842084dfa182af65$var$Modal);
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
export {$842084dfa182af65$export$2b77a92f1a5ad772 as Modal};
|
|
88
|
+
//# sourceMappingURL=Modal.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAyBD,SAAS,4BAAM,KAAiB,EAAE,GAA2B;IAC3D,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,GAA8B;IAC9F,IAAI,QAAC,IAAI,YAAE,QAAQ,SAAE,KAAK,UAAE,MAAM,cAAE,UAAU,EAAC,GAAG;IAClD,IAAI,cAAc,6BAAO,CAAC,KAAK;IAC/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,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,YAAY,CAAC,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;AAEA,IAAI,0DAAS,CAAA,GAAA,iBAAS,EAAE","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, 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, {forwardRef, MutableRefObject, ReactNode, RefObject, useRef} from 'react';\nimport {Underlay} from './Underlay';\nimport {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: MutableRefObject<HTMLDivElement>\n}\n\nfunction 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: RefObject<HTMLDivElement>) {\n let {type, children, state, isOpen, wrapperRef} = props;\n let typeVariant = typeMap[type];\n let {styleProps} = useStyleProps(props);\n let {modalProps, underlayProps} = useModalOverlay(props, state, ref);\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={ref}\n className={modalClassName}\n data-testid=\"modal\">\n {children}\n </div>\n </div>\n </div>\n );\n});\n\nlet _Modal = forwardRef(Modal);\nexport {_Modal as Modal};\n"],"names":[],"version":3,"file":"Modal.module.js.map"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var $3kGU5$react = require("react");
|
|
2
|
+
var $3kGU5$reacttransitiongroup = require("react-transition-group");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
function $parcel$interopDefault(a) {
|
|
6
|
+
return a && a.__esModule ? a.default : a;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function $parcel$export(e, n, v, s) {
|
|
10
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$parcel$export(module.exports, "OpenTransition", () => $13f51cdc44d228b9$export$b847a40ee92eff38);
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const $13f51cdc44d228b9$var$OPEN_STATES = {
|
|
27
|
+
entering: false,
|
|
28
|
+
entered: true
|
|
29
|
+
};
|
|
30
|
+
function $13f51cdc44d228b9$export$b847a40ee92eff38(props) {
|
|
31
|
+
var child;
|
|
32
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($3kGU5$react))).createElement((0, $3kGU5$reacttransitiongroup.Transition), {
|
|
33
|
+
timeout: {
|
|
34
|
+
enter: 0,
|
|
35
|
+
exit: 350
|
|
36
|
+
},
|
|
37
|
+
...props
|
|
38
|
+
}, (state)=>(0, ($parcel$interopDefault($3kGU5$react))).Children.map(props.children, (child)=>child && /*#__PURE__*/ (0, ($parcel$interopDefault($3kGU5$react))).cloneElement(child, {
|
|
39
|
+
isOpen: !!$13f51cdc44d228b9$var$OPEN_STATES[state]
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=OpenTransition.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKD,MAAM,oCAAc;IAClB,UAAU;IACV,SAAS;AACX;AAeO,SAAS,0CAAe,KAAK;QAGU;IAG5C,qBACE,0DAAC,CAAA,GAAA,sCAAS;QAAE,SAAS;YAAC,OAAO;YAAG,MAAM;QAAG;QAAI,GAAG,KAAK;OAClD,CAAC,QAAU,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,QAAQ,EAAE,CAAA,QAAS,uBAAS,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,OAAO;gBAAC,QAAQ,CAAC,CAAC,iCAAW,CAAC,MAAM;YAAA;AAG9H","sources":["packages/@react-spectrum/overlays/src/OpenTransition.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 React from 'react';\nimport {Transition} from 'react-transition-group';\n\nconst OPEN_STATES = {\n entering: false,\n entered: true\n};\n\n/**\n * Timeout issues adding css animations to enter may be related to\n * https://github.com/reactjs/react-transition-group/issues/189 or\n * https://github.com/reactjs/react-transition-group/issues/22\n * my VM isn't good enough to debug accurately and get a better answer.\n *\n * As a result, use enter 0 so that is-open is applied once entered\n * it doesn't matter if we know when the css-animation is done on entering\n * for exiting though, give time for the css-animation to play\n * before removing from the DOM\n * **note** hitting esc bypasses exit animation for anyone testing.\n */\n\nexport function OpenTransition(props) {\n // Do not apply any transition if in chromatic.\n if (process.env.CHROMATIC) {\n return React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: props.in}));\n }\n\n return (\n <Transition timeout={{enter: 0, exit: 350}} {...props}>\n {(state) => React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: !!OPEN_STATES[state]}))}\n </Transition>\n );\n}\n"],"names":[],"version":3,"file":"OpenTransition.main.js.map"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import $8XmPE$react from "react";
|
|
2
|
+
import {Transition as $8XmPE$Transition} from "react-transition-group";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const $bc765a7a041310da$var$OPEN_STATES = {
|
|
17
|
+
entering: false,
|
|
18
|
+
entered: true
|
|
19
|
+
};
|
|
20
|
+
function $bc765a7a041310da$export$b847a40ee92eff38(props) {
|
|
21
|
+
var child;
|
|
22
|
+
return /*#__PURE__*/ (0, $8XmPE$react).createElement((0, $8XmPE$Transition), {
|
|
23
|
+
timeout: {
|
|
24
|
+
enter: 0,
|
|
25
|
+
exit: 350
|
|
26
|
+
},
|
|
27
|
+
...props
|
|
28
|
+
}, (state)=>(0, $8XmPE$react).Children.map(props.children, (child)=>child && /*#__PURE__*/ (0, $8XmPE$react).cloneElement(child, {
|
|
29
|
+
isOpen: !!$bc765a7a041310da$var$OPEN_STATES[state]
|
|
30
|
+
})));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$bc765a7a041310da$export$b847a40ee92eff38 as OpenTransition};
|
|
35
|
+
//# sourceMappingURL=OpenTransition.mjs.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import $8XmPE$react from "react";
|
|
2
|
+
import {Transition as $8XmPE$Transition} from "react-transition-group";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
* governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const $bc765a7a041310da$var$OPEN_STATES = {
|
|
17
|
+
entering: false,
|
|
18
|
+
entered: true
|
|
19
|
+
};
|
|
20
|
+
function $bc765a7a041310da$export$b847a40ee92eff38(props) {
|
|
21
|
+
var child;
|
|
22
|
+
return /*#__PURE__*/ (0, $8XmPE$react).createElement((0, $8XmPE$Transition), {
|
|
23
|
+
timeout: {
|
|
24
|
+
enter: 0,
|
|
25
|
+
exit: 350
|
|
26
|
+
},
|
|
27
|
+
...props
|
|
28
|
+
}, (state)=>(0, $8XmPE$react).Children.map(props.children, (child)=>child && /*#__PURE__*/ (0, $8XmPE$react).cloneElement(child, {
|
|
29
|
+
isOpen: !!$bc765a7a041310da$var$OPEN_STATES[state]
|
|
30
|
+
})));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$bc765a7a041310da$export$b847a40ee92eff38 as OpenTransition};
|
|
35
|
+
//# sourceMappingURL=OpenTransition.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKD,MAAM,oCAAc;IAClB,UAAU;IACV,SAAS;AACX;AAeO,SAAS,0CAAe,KAAK;QAGU;IAG5C,qBACE,gCAAC,CAAA,GAAA,iBAAS;QAAE,SAAS;YAAC,OAAO;YAAG,MAAM;QAAG;QAAI,GAAG,KAAK;OAClD,CAAC,QAAU,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,QAAQ,EAAE,CAAA,QAAS,uBAAS,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,OAAO;gBAAC,QAAQ,CAAC,CAAC,iCAAW,CAAC,MAAM;YAAA;AAG9H","sources":["packages/@react-spectrum/overlays/src/OpenTransition.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 React from 'react';\nimport {Transition} from 'react-transition-group';\n\nconst OPEN_STATES = {\n entering: false,\n entered: true\n};\n\n/**\n * Timeout issues adding css animations to enter may be related to\n * https://github.com/reactjs/react-transition-group/issues/189 or\n * https://github.com/reactjs/react-transition-group/issues/22\n * my VM isn't good enough to debug accurately and get a better answer.\n *\n * As a result, use enter 0 so that is-open is applied once entered\n * it doesn't matter if we know when the css-animation is done on entering\n * for exiting though, give time for the css-animation to play\n * before removing from the DOM\n * **note** hitting esc bypasses exit animation for anyone testing.\n */\n\nexport function OpenTransition(props) {\n // Do not apply any transition if in chromatic.\n if (process.env.CHROMATIC) {\n return React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: props.in}));\n }\n\n return (\n <Transition timeout={{enter: 0, exit: 350}} {...props}>\n {(state) => React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: !!OPEN_STATES[state]}))}\n </Transition>\n );\n}\n"],"names":[],"version":3,"file":"OpenTransition.module.js.map"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var $13f51cdc44d228b9$exports = require("./OpenTransition.main.js");
|
|
2
|
+
var $5XfZ1$reactspectrumprovider = require("@react-spectrum/provider");
|
|
3
|
+
var $5XfZ1$react = require("react");
|
|
4
|
+
var $5XfZ1$reactariaoverlays = require("@react-aria/overlays");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$parcel$export(module.exports, "Overlay", () => $2aebdc186fd41e87$export$c6fdb837b070b4ff);
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function $2aebdc186fd41e87$var$Overlay(props, ref) {
|
|
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
|
+
let [exited, setExited] = (0, $5XfZ1$react.useState)(!isOpen);
|
|
33
|
+
let handleEntered = (0, $5XfZ1$react.useCallback)(()=>{
|
|
34
|
+
setExited(false);
|
|
35
|
+
if (onEntered) onEntered();
|
|
36
|
+
}, [
|
|
37
|
+
onEntered
|
|
38
|
+
]);
|
|
39
|
+
let handleExited = (0, $5XfZ1$react.useCallback)(()=>{
|
|
40
|
+
setExited(true);
|
|
41
|
+
if (onExited) onExited();
|
|
42
|
+
}, [
|
|
43
|
+
onExited
|
|
44
|
+
]);
|
|
45
|
+
// Don't un-render the overlay while it's transitioning out.
|
|
46
|
+
let mountOverlay = isOpen || !exited;
|
|
47
|
+
if (!mountOverlay) // Don't bother showing anything if we don't have to.
|
|
48
|
+
return null;
|
|
49
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($5XfZ1$react))).createElement((0, $5XfZ1$reactariaoverlays.Overlay), {
|
|
50
|
+
portalContainer: container,
|
|
51
|
+
disableFocusManagement: disableFocusManagement,
|
|
52
|
+
isExiting: !isOpen
|
|
53
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5XfZ1$react))).createElement((0, $5XfZ1$reactspectrumprovider.Provider), {
|
|
54
|
+
ref: ref,
|
|
55
|
+
UNSAFE_style: {
|
|
56
|
+
background: "transparent",
|
|
57
|
+
isolation: "isolate"
|
|
58
|
+
},
|
|
59
|
+
isDisabled: false
|
|
60
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5XfZ1$react))).createElement((0, $13f51cdc44d228b9$exports.OpenTransition), {
|
|
61
|
+
in: isOpen,
|
|
62
|
+
appear: true,
|
|
63
|
+
onExit: onExit,
|
|
64
|
+
onExiting: onExiting,
|
|
65
|
+
onExited: handleExited,
|
|
66
|
+
onEnter: onEnter,
|
|
67
|
+
onEntering: onEntering,
|
|
68
|
+
onEntered: handleEntered,
|
|
69
|
+
nodeRef: nodeRef
|
|
70
|
+
}, children)));
|
|
71
|
+
}
|
|
72
|
+
let $2aebdc186fd41e87$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, ($parcel$interopDefault($5XfZ1$react))).forwardRef($2aebdc186fd41e87$var$Overlay);
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=Overlay.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAAQ,KAAmB,EAAE,GAA2B;IAC/D,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;AAEA,IAAI,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","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\nfunction 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\nlet _Overlay = React.forwardRef(Overlay);\nexport {_Overlay as Overlay};\n"],"names":[],"version":3,"file":"Overlay.main.js.map"}
|
package/dist/Overlay.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {OpenTransition as $bc765a7a041310da$export$b847a40ee92eff38} from "./OpenTransition.mjs";
|
|
2
|
+
import {Provider as $eIXW5$Provider} from "@react-spectrum/provider";
|
|
3
|
+
import $eIXW5$react, {useState as $eIXW5$useState, useCallback as $eIXW5$useCallback} from "react";
|
|
4
|
+
import {Overlay as $eIXW5$Overlay} from "@react-aria/overlays";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
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
|
+
let [exited, setExited] = (0, $eIXW5$useState)(!isOpen);
|
|
23
|
+
let handleEntered = (0, $eIXW5$useCallback)(()=>{
|
|
24
|
+
setExited(false);
|
|
25
|
+
if (onEntered) onEntered();
|
|
26
|
+
}, [
|
|
27
|
+
onEntered
|
|
28
|
+
]);
|
|
29
|
+
let handleExited = (0, $eIXW5$useCallback)(()=>{
|
|
30
|
+
setExited(true);
|
|
31
|
+
if (onExited) onExited();
|
|
32
|
+
}, [
|
|
33
|
+
onExited
|
|
34
|
+
]);
|
|
35
|
+
// Don't un-render the overlay while it's transitioning out.
|
|
36
|
+
let mountOverlay = isOpen || !exited;
|
|
37
|
+
if (!mountOverlay) // Don't bother showing anything if we don't have to.
|
|
38
|
+
return null;
|
|
39
|
+
return /*#__PURE__*/ (0, $eIXW5$react).createElement((0, $eIXW5$Overlay), {
|
|
40
|
+
portalContainer: container,
|
|
41
|
+
disableFocusManagement: disableFocusManagement,
|
|
42
|
+
isExiting: !isOpen
|
|
43
|
+
}, /*#__PURE__*/ (0, $eIXW5$react).createElement((0, $eIXW5$Provider), {
|
|
44
|
+
ref: ref,
|
|
45
|
+
UNSAFE_style: {
|
|
46
|
+
background: "transparent",
|
|
47
|
+
isolation: "isolate"
|
|
48
|
+
},
|
|
49
|
+
isDisabled: false
|
|
50
|
+
}, /*#__PURE__*/ (0, $eIXW5$react).createElement((0, $bc765a7a041310da$export$b847a40ee92eff38), {
|
|
51
|
+
in: isOpen,
|
|
52
|
+
appear: true,
|
|
53
|
+
onExit: onExit,
|
|
54
|
+
onExiting: onExiting,
|
|
55
|
+
onExited: handleExited,
|
|
56
|
+
onEnter: onEnter,
|
|
57
|
+
onEntering: onEntering,
|
|
58
|
+
onEntered: handleEntered,
|
|
59
|
+
nodeRef: nodeRef
|
|
60
|
+
}, children)));
|
|
61
|
+
}
|
|
62
|
+
let $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $eIXW5$react).forwardRef($70305dc5fb729c3b$var$Overlay);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export {$70305dc5fb729c3b$export$c6fdb837b070b4ff as Overlay};
|
|
66
|
+
//# sourceMappingURL=Overlay.mjs.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {OpenTransition as $bc765a7a041310da$export$b847a40ee92eff38} from "./OpenTransition.module.js";
|
|
2
|
+
import {Provider as $eIXW5$Provider} from "@react-spectrum/provider";
|
|
3
|
+
import $eIXW5$react, {useState as $eIXW5$useState, useCallback as $eIXW5$useCallback} from "react";
|
|
4
|
+
import {Overlay as $eIXW5$Overlay} from "@react-aria/overlays";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
function $70305dc5fb729c3b$var$Overlay(props, ref) {
|
|
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
|
+
let [exited, setExited] = (0, $eIXW5$useState)(!isOpen);
|
|
23
|
+
let handleEntered = (0, $eIXW5$useCallback)(()=>{
|
|
24
|
+
setExited(false);
|
|
25
|
+
if (onEntered) onEntered();
|
|
26
|
+
}, [
|
|
27
|
+
onEntered
|
|
28
|
+
]);
|
|
29
|
+
let handleExited = (0, $eIXW5$useCallback)(()=>{
|
|
30
|
+
setExited(true);
|
|
31
|
+
if (onExited) onExited();
|
|
32
|
+
}, [
|
|
33
|
+
onExited
|
|
34
|
+
]);
|
|
35
|
+
// Don't un-render the overlay while it's transitioning out.
|
|
36
|
+
let mountOverlay = isOpen || !exited;
|
|
37
|
+
if (!mountOverlay) // Don't bother showing anything if we don't have to.
|
|
38
|
+
return null;
|
|
39
|
+
return /*#__PURE__*/ (0, $eIXW5$react).createElement((0, $eIXW5$Overlay), {
|
|
40
|
+
portalContainer: container,
|
|
41
|
+
disableFocusManagement: disableFocusManagement,
|
|
42
|
+
isExiting: !isOpen
|
|
43
|
+
}, /*#__PURE__*/ (0, $eIXW5$react).createElement((0, $eIXW5$Provider), {
|
|
44
|
+
ref: ref,
|
|
45
|
+
UNSAFE_style: {
|
|
46
|
+
background: "transparent",
|
|
47
|
+
isolation: "isolate"
|
|
48
|
+
},
|
|
49
|
+
isDisabled: false
|
|
50
|
+
}, /*#__PURE__*/ (0, $eIXW5$react).createElement((0, $bc765a7a041310da$export$b847a40ee92eff38), {
|
|
51
|
+
in: isOpen,
|
|
52
|
+
appear: true,
|
|
53
|
+
onExit: onExit,
|
|
54
|
+
onExiting: onExiting,
|
|
55
|
+
onExited: handleExited,
|
|
56
|
+
onEnter: onEnter,
|
|
57
|
+
onEntering: onEntering,
|
|
58
|
+
onEntered: handleEntered,
|
|
59
|
+
nodeRef: nodeRef
|
|
60
|
+
}, children)));
|
|
61
|
+
}
|
|
62
|
+
let $70305dc5fb729c3b$export$c6fdb837b070b4ff = /*#__PURE__*/ (0, $eIXW5$react).forwardRef($70305dc5fb729c3b$var$Overlay);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export {$70305dc5fb729c3b$export$c6fdb837b070b4ff as Overlay};
|
|
66
|
+
//# sourceMappingURL=Overlay.module.js.map
|