@react-spectrum/s2 1.3.0 → 1.3.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/private/Modal.cjs +12 -0
- package/dist/private/Modal.cjs.map +1 -1
- package/dist/private/Modal.css +30 -0
- package/dist/private/Modal.css.map +1 -1
- package/dist/private/Modal.mjs +12 -0
- package/dist/private/Modal.mjs.map +1 -1
- package/dist/private/Popover.cjs +12 -0
- package/dist/private/Popover.cjs.map +1 -1
- package/dist/private/Popover.css +28 -0
- package/dist/private/Popover.css.map +1 -1
- package/dist/private/Popover.mjs +12 -0
- package/dist/private/Popover.mjs.map +1 -1
- package/dist/private/Provider.cjs +12 -0
- package/dist/private/Provider.cjs.map +1 -1
- package/dist/private/Provider.css +37 -0
- package/dist/private/Provider.css.map +1 -1
- package/dist/private/Provider.mjs +12 -0
- package/dist/private/Provider.mjs.map +1 -1
- package/dist/private/TableView.cjs +12 -0
- package/dist/private/TableView.cjs.map +1 -1
- package/dist/private/TableView.css +28 -0
- package/dist/private/TableView.css.map +1 -1
- package/dist/private/TableView.mjs +12 -0
- package/dist/private/TableView.mjs.map +1 -1
- package/dist/private/Tooltip.cjs +12 -0
- package/dist/private/Tooltip.cjs.map +1 -1
- package/dist/private/Tooltip.css +28 -0
- package/dist/private/Tooltip.css.map +1 -1
- package/dist/private/Tooltip.mjs +12 -0
- package/dist/private/Tooltip.mjs.map +1 -1
- package/dist/types/src/style-utils.d.ts +26 -0
- package/package.json +3 -2
- package/page.css +11 -0
- package/page.css.map +1 -1
- package/src/page.macro.ts +26 -0
- package/src/style-utils.ts +30 -1
- package/style/__tests__/style-macro.test.js +71 -71
- package/style/dist/style-utils.cjs +30 -1
- package/style/dist/style-utils.cjs.map +1 -1
- package/style/dist/style-utils.mjs +30 -1
- package/style/dist/style-utils.mjs.map +1 -1
package/dist/private/Modal.cjs
CHANGED
|
@@ -34,6 +34,18 @@ const $8e678305a8c10028$var$modalOverlayStyles = function anonymous(props) {
|
|
|
34
34
|
else if (props.colorScheme === "light") rules += ' -ICUGx-_pb13';
|
|
35
35
|
else if (props.colorScheme === "light dark") rules += ' -ICUGx-_pc13';
|
|
36
36
|
rules += ' _pK8eoyd13';
|
|
37
|
+
if (props.colorScheme === "dark") rules += ' -NvXmrd-_ZLmU13';
|
|
38
|
+
else if (props.colorScheme === "light") rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
39
|
+
else if (props.colorScheme === "light dark") {
|
|
40
|
+
rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
41
|
+
rules += ' -NvXmrd-D1v0V_ZLmU13';
|
|
42
|
+
}
|
|
43
|
+
if (props.colorScheme === "dark") rules += ' -j9blY-_ZN8Gi4c13';
|
|
44
|
+
else if (props.colorScheme === "light") rules += ' -j9blY-_ZLmU13';
|
|
45
|
+
else if (props.colorScheme === "light dark") {
|
|
46
|
+
rules += ' -j9blY-_ZLmU13';
|
|
47
|
+
rules += ' -j9blY-D1v0V_ZN8Gi4c13';
|
|
48
|
+
}
|
|
37
49
|
rules += ' _Pa13';
|
|
38
50
|
rules += ' Wr13';
|
|
39
51
|
rules += ' _Er13';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmBD,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmBD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBN,MAAM;;;;;;;;;;;;;AAmBC,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,MAAiB,EAAE,GAA2B;IAC3F,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,4CAAiB;IAC9C,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,sCAAQ;IAElC,0DAA0D;IAC1D,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC;QACzB,OAA4C,OAAO,GAAG;QACvD,IAAI,IAAI;YACN,GAAG,IAAI,GAAG;YACV,GAAG,GAAG,GAAG;QACX;IACF,GAAG;QAAC;QAAQ;QAAW;KAAO;IAE9B,qBACE,gCAAC,CAAA,GAAA,4CAAW;QACT,GAAG,MAAK;QACT,WAAW,CAAA,cAAe,yCAAmB;gBAAC,GAAG,WAAW;6BAAE;YAAW;kBACzE,cAAA,gCAAC;YAAI,WAAW,mCAAa;gBAAC,MAAM,OAAM,IAAI;YAAA;YAAI,OAAO;gBAAC,eAAe;YAAM;sBAC7E,cAAA,gCAAC,CAAA,GAAA,qCAAO;gBACL,GAAG,MAAK;gBACT,KAAK;gBACL,WAAW,CAAA,cAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAuEvB;wBAAC,GAAG,WAAW;wBAAE,MAAM,OAAM,IAAI;oBAAA;;;;AAI9C","sources":["packages/@react-spectrum/s2/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {ColorSchemeContext} from './Provider';\nimport {DOMRef, GlobalDOMAttributes} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal} from 'react-aria-components/Modal';\nimport {setColorScheme, style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\n\ninterface ModalProps extends Omit<ModalOverlayProps, 'className' | 'style' | 'render' | keyof GlobalDOMAttributes> {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst modalOverlayStyles = style({\n ...setColorScheme(),\n position: 'absolute',\n top: 0,\n left: 0,\n width: 'full',\n height: '--page-height',\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n transition: 'opacity',\n transitionDuration: {\n default: 250,\n isExiting: 130\n }\n});\n\nconst modalWrapper = style({\n position: 'sticky',\n top: 0,\n left: 0,\n width: 'full',\n height: '--visual-viewport-height',\n display: 'flex',\n alignItems: {\n default: 'center',\n size: {\n fullscreenTakeover: 'start'\n }\n },\n justifyContent: 'center'\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <div className={modalWrapper({size: props.size})} style={{containerType: 'size'} as any}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 400,\n M: 480,\n L: 640,\n XL: 960,\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '90vw',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '90%',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n paddingBottom: {\n size: {\n // Extend background behind the iOS Safari toolbar and keyboard.\n fullscreenTakeover: '[100vh]'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n isEntering: 20\n },\n transition: '[opacity, translate]',\n transitionDuration: {\n default: 250,\n isExiting: 130\n },\n transitionDelay: {\n default: 160,\n isExiting: 0\n },\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </div>\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
|
package/dist/private/Modal.css
CHANGED
|
@@ -15,6 +15,22 @@
|
|
|
15
15
|
color-scheme: var(--s2-color-scheme);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
.-NvXmrd-_ZN8Gi4c13 {
|
|
19
|
+
--lightningcss-light: initial;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.-NvXmrd-_ZLmU13 {
|
|
23
|
+
--lightningcss-light: ;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.-j9blY-_ZLmU13 {
|
|
27
|
+
--lightningcss-dark: ;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.-j9blY-_ZN8Gi4c13 {
|
|
31
|
+
--lightningcss-dark: initial;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
._Pa13 {
|
|
19
35
|
position: absolute;
|
|
20
36
|
}
|
|
@@ -212,4 +228,18 @@
|
|
|
212
228
|
outline-color: #0000;
|
|
213
229
|
}
|
|
214
230
|
}
|
|
231
|
+
|
|
232
|
+
@layer _.b;
|
|
233
|
+
|
|
234
|
+
@layer _.b.D1v0V {
|
|
235
|
+
@media (prefers-color-scheme: dark) {
|
|
236
|
+
.-NvXmrd-D1v0V_ZLmU13 {
|
|
237
|
+
--lightningcss-light: ;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.-j9blY-D1v0V_ZN8Gi4c13 {
|
|
241
|
+
--lightningcss-dark: initial;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
215
245
|
/*# sourceMappingURL=Modal.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC6B2B;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoBN;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyCe;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA","sources":["be2ce4448c91abb5","packages/@react-spectrum/s2/src/Modal.tsx"],"sourcesContent":["@import \"003d01b6d2f33501\";\n@import \"15edcb25b251bc58\";\n@import \"1ef8b667afb08263\";\n","/*\n * Copyright 2024 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 {ColorSchemeContext} from './Provider';\nimport {DOMRef, GlobalDOMAttributes} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal} from 'react-aria-components/Modal';\nimport {setColorScheme, style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\n\ninterface ModalProps extends Omit<ModalOverlayProps, 'className' | 'style' | 'render' | keyof GlobalDOMAttributes> {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst modalOverlayStyles = style({\n ...setColorScheme(),\n position: 'absolute',\n top: 0,\n left: 0,\n width: 'full',\n height: '--page-height',\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n transition: 'opacity',\n transitionDuration: {\n default: 250,\n isExiting: 130\n }\n});\n\nconst modalWrapper = style({\n position: 'sticky',\n top: 0,\n left: 0,\n width: 'full',\n height: '--visual-viewport-height',\n display: 'flex',\n alignItems: {\n default: 'center',\n size: {\n fullscreenTakeover: 'start'\n }\n },\n justifyContent: 'center'\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <div className={modalWrapper({size: props.size})} style={{containerType: 'size'} as any}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 400,\n M: 480,\n L: 640,\n XL: 960,\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '90vw',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '90%',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n paddingBottom: {\n size: {\n // Extend background behind the iOS Safari toolbar and keyboard.\n fullscreenTakeover: '[100vh]'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n isEntering: 20\n },\n transition: '[opacity, translate]',\n transitionDuration: {\n default: 250,\n isExiting: 130\n },\n transitionDelay: {\n default: 160,\n isExiting: 0\n },\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </div>\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.css.map"}
|
|
1
|
+
{"mappings":"AC6B2B;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAoBN;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyCe;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA7DT;;AAAA;EAAA;IAAA;;;;IAAA","sources":["be2ce4448c91abb5","packages/@react-spectrum/s2/src/Modal.tsx"],"sourcesContent":["@import \"003d01b6d2f33501\";\n@import \"15edcb25b251bc58\";\n@import \"1ef8b667afb08263\";\n","/*\n * Copyright 2024 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 {ColorSchemeContext} from './Provider';\nimport {DOMRef, GlobalDOMAttributes} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal} from 'react-aria-components/Modal';\nimport {setColorScheme, style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\n\ninterface ModalProps extends Omit<ModalOverlayProps, 'className' | 'style' | 'render' | keyof GlobalDOMAttributes> {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst modalOverlayStyles = style({\n ...setColorScheme(),\n position: 'absolute',\n top: 0,\n left: 0,\n width: 'full',\n height: '--page-height',\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n transition: 'opacity',\n transitionDuration: {\n default: 250,\n isExiting: 130\n }\n});\n\nconst modalWrapper = style({\n position: 'sticky',\n top: 0,\n left: 0,\n width: 'full',\n height: '--visual-viewport-height',\n display: 'flex',\n alignItems: {\n default: 'center',\n size: {\n fullscreenTakeover: 'start'\n }\n },\n justifyContent: 'center'\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <div className={modalWrapper({size: props.size})} style={{containerType: 'size'} as any}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 400,\n M: 480,\n L: 640,\n XL: 960,\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '90vw',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '90%',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n paddingBottom: {\n size: {\n // Extend background behind the iOS Safari toolbar and keyboard.\n fullscreenTakeover: '[100vh]'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n isEntering: 20\n },\n transition: '[opacity, translate]',\n transitionDuration: {\n default: 250,\n isExiting: 130\n },\n transitionDelay: {\n default: 160,\n isExiting: 0\n },\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </div>\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.css.map"}
|
package/dist/private/Modal.mjs
CHANGED
|
@@ -28,6 +28,18 @@ const $c46d159bd615e407$var$modalOverlayStyles = function anonymous(props) {
|
|
|
28
28
|
else if (props.colorScheme === "light") rules += ' -ICUGx-_pb13';
|
|
29
29
|
else if (props.colorScheme === "light dark") rules += ' -ICUGx-_pc13';
|
|
30
30
|
rules += ' _pK8eoyd13';
|
|
31
|
+
if (props.colorScheme === "dark") rules += ' -NvXmrd-_ZLmU13';
|
|
32
|
+
else if (props.colorScheme === "light") rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
33
|
+
else if (props.colorScheme === "light dark") {
|
|
34
|
+
rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
35
|
+
rules += ' -NvXmrd-D1v0V_ZLmU13';
|
|
36
|
+
}
|
|
37
|
+
if (props.colorScheme === "dark") rules += ' -j9blY-_ZN8Gi4c13';
|
|
38
|
+
else if (props.colorScheme === "light") rules += ' -j9blY-_ZLmU13';
|
|
39
|
+
else if (props.colorScheme === "light dark") {
|
|
40
|
+
rules += ' -j9blY-_ZLmU13';
|
|
41
|
+
rules += ' -j9blY-D1v0V_ZN8Gi4c13';
|
|
42
|
+
}
|
|
31
43
|
rules += ' _Pa13';
|
|
32
44
|
rules += ' Wr13';
|
|
33
45
|
rules += ' _Er13';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmBD,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmBD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBN,MAAM;;;;;;;;;;;;;AAmBC,MAAM,0DAAQ,CAAA,GAAA,iBAAS,EAAE,SAAS,MAAM,MAAiB,EAAE,GAA2B;IAC3F,IAAI,SAAS,CAAA,GAAA,yCAAQ,EAAE;IACvB,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAiB;IAC9C,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAElC,0DAA0D;IAC1D,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE,CAAC;QACzB,OAA4C,OAAO,GAAG;QACvD,IAAI,IAAI;YACN,GAAG,IAAI,GAAG;YACV,GAAG,GAAG,GAAG;QACX;IACF,GAAG;QAAC;QAAQ;QAAW;KAAO;IAE9B,qBACE,gBAAC,CAAA,GAAA,mBAAW;QACT,GAAG,MAAK;QACT,WAAW,CAAA,cAAe,yCAAmB;gBAAC,GAAG,WAAW;6BAAE;YAAW;kBACzE,cAAA,gBAAC;YAAI,WAAW,mCAAa;gBAAC,MAAM,OAAM,IAAI;YAAA;YAAI,OAAO;gBAAC,eAAe;YAAM;sBAC7E,cAAA,gBAAC,CAAA,GAAA,YAAO;gBACL,GAAG,MAAK;gBACT,KAAK;gBACL,WAAW,CAAA,cAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAuEvB;wBAAC,GAAG,WAAW;wBAAE,MAAM,OAAM,IAAI;oBAAA;;;;AAI9C","sources":["packages/@react-spectrum/s2/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {ColorSchemeContext} from './Provider';\nimport {DOMRef, GlobalDOMAttributes} from '@react-types/shared';\nimport {forwardRef, MutableRefObject, useCallback, useContext} from 'react';\nimport {ModalOverlay, ModalOverlayProps, Modal as RACModal} from 'react-aria-components/Modal';\nimport {setColorScheme, style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\n\ninterface ModalProps extends Omit<ModalOverlayProps, 'className' | 'style' | 'render' | keyof GlobalDOMAttributes> {\n /**\n * The size of the Modal.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL' | 'fullscreen' | 'fullscreenTakeover'\n}\n\nconst modalOverlayStyles = style({\n ...setColorScheme(),\n position: 'absolute',\n top: 0,\n left: 0,\n width: 'full',\n height: '--page-height',\n isolation: 'isolate',\n backgroundColor: 'transparent-black-500',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n transition: 'opacity',\n transitionDuration: {\n default: 250,\n isExiting: 130\n }\n});\n\nconst modalWrapper = style({\n position: 'sticky',\n top: 0,\n left: 0,\n width: 'full',\n height: '--visual-viewport-height',\n display: 'flex',\n alignItems: {\n default: 'center',\n size: {\n fullscreenTakeover: 'start'\n }\n },\n justifyContent: 'center'\n});\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = forwardRef(function Modal(props: ModalProps, ref: DOMRef<HTMLDivElement>) {\n let domRef = useDOMRef(ref);\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let modalRef = useCallback((el: HTMLDivElement) => {\n (domRef as MutableRefObject<HTMLDivElement>).current = el;\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction, domRef]);\n\n return (\n <ModalOverlay\n {...props}\n className={renderProps => modalOverlayStyles({...renderProps, colorScheme})}>\n <div className={modalWrapper({size: props.size})} style={{containerType: 'size'} as any}>\n <RACModal\n {...props}\n ref={modalRef}\n className={renderProps => style({\n display: 'flex',\n flexDirection: 'column',\n borderRadius: {\n default: 'xl',\n size: {\n fullscreenTakeover: 'none'\n }\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 400,\n M: 480,\n L: 640,\n XL: 960,\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n height: {\n size: {\n fullscreen: 'calc(100% - 40px)',\n fullscreenTakeover: 'full'\n }\n },\n maxWidth: {\n default: '90vw',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n maxHeight: {\n default: '90%',\n size: {\n fullscreen: 'none',\n fullscreenTakeover: 'none'\n }\n },\n paddingBottom: {\n size: {\n // Extend background behind the iOS Safari toolbar and keyboard.\n fullscreenTakeover: '[100vh]'\n }\n },\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: 'layer-2'\n },\n backgroundColor: '--s2-container-bg',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n isEntering: 20\n },\n transition: '[opacity, translate]',\n transitionDuration: {\n default: 250,\n isExiting: 130\n },\n transitionDelay: {\n default: 160,\n isExiting: 0\n },\n // Transparent outline for WHCM.\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: 'transparent'\n })({...renderProps, size: props.size})} />\n </div>\n </ModalOverlay>\n );\n});\n"],"names":[],"version":3,"file":"Modal.mjs.map"}
|
package/dist/private/Popover.cjs
CHANGED
|
@@ -54,6 +54,18 @@ let $493371ef39bf7a55$var$popover = function anonymous(props, overrides) {
|
|
|
54
54
|
else if (props.colorScheme === "light") rules += ' -ICUGx-_pb13';
|
|
55
55
|
else if (props.colorScheme === "light dark") rules += ' -ICUGx-_pc13';
|
|
56
56
|
rules += ' _pK8eoyd13';
|
|
57
|
+
if (props.colorScheme === "dark") rules += ' -NvXmrd-_ZLmU13';
|
|
58
|
+
else if (props.colorScheme === "light") rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
59
|
+
else if (props.colorScheme === "light dark") {
|
|
60
|
+
rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
61
|
+
rules += ' -NvXmrd-D1v0V_ZLmU13';
|
|
62
|
+
}
|
|
63
|
+
if (props.colorScheme === "dark") rules += ' -j9blY-_ZN8Gi4c13';
|
|
64
|
+
else if (props.colorScheme === "light") rules += ' -j9blY-_ZLmU13';
|
|
65
|
+
else if (props.colorScheme === "light dark") {
|
|
66
|
+
rules += ' -j9blY-_ZLmU13';
|
|
67
|
+
rules += ' -j9blY-D1v0V_ZN8Gi4c13';
|
|
68
|
+
}
|
|
57
69
|
rules += ' -Ovbhqd-g_g13';
|
|
58
70
|
rules += ' -Ovbhqd-lga13';
|
|
59
71
|
rules += ' gEzkoQe13';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"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","sources":["packages/@react-spectrum/s2/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {Popover as AriaPopover, PopoverProps as AriaPopoverProps, OverlayArrow} from 'react-aria-components/Popover';\nimport {ColorSchemeContext} from './Provider';\nimport {composeRenderProps} from 'react-aria-components/composeRenderProps';\nimport {ContextValue} from 'react-aria-components/slots';\nimport {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {DialogProps, OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};\nimport {lightDark, setColorScheme, style} from '../style' with {type: 'macro'};\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,\n 'arrowSize' |\n 'isNonModal' |\n 'arrowBoundaryOffset' |\n 'isKeyboardDismissDisabled' |\n 'shouldCloseOnInteractOutside' |\n 'shouldUpdatePosition' |\n 'style' |\n 'className' |\n 'render' |\n keyof GlobalDOMAttributes\n> {\n /**\n * The styles of the popover.\n */\n styles?: StyleString,\n /**\n * Whether a popover's arrow should be hidden.\n *\n * @default false\n */\n hideArrow?: boolean,\n /**\n * The size of the Popover. If not specified, the popover fits its contents.\n */\n size?: 'S' | 'M' | 'L'\n /** The type of overlay that should be rendered when on a mobile device. */\n // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in\n}\n\nlet popover = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'layer-2',\n forcedColors: 'Background'\n }\n },\n backgroundColor: '--s2-container-bg',\n borderRadius: 'lg',\n filter: {\n isArrowShown: 'elevated'\n },\n // Use box-shadow instead of filter when an arrow is not shown.\n // This fixes the shadow stacking problem with submenus.\n boxShadow: {\n default: 'elevated',\n isArrowShown: 'none'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576\n }\n },\n // Don't be larger than full screen minus 2 * containerPadding\n maxWidth: 'calc(100vw - 24px)',\n boxSizing: 'border-box',\n display: 'flex',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n transition: '[opacity, translate]',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n isolation: 'isolate',\n pointerEvents: {\n isExiting: 'none'\n }\n}, getAllowedOverrides());\n// TODO: animations and real Popover Arrow\n\nlet arrow = style({\n display: 'block',\n fill: '--s2-container-bg',\n width: 18,\n height: 9,\n rotate: {\n default: 180,\n placement: {\n top: 0,\n bottom: 180,\n left: -90,\n right: 90\n }\n },\n translateX: {\n placement: {\n left: '-25%',\n right: '25%'\n }\n },\n strokeWidth: 1,\n stroke: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n }\n});\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InPopoverContext = createContext(false);\n\nexport const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n hideArrow = false,\n UNSAFE_className = '',\n UNSAFE_style,\n styles,\n size\n } = props;\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let popoverRef = useCallback((el: HTMLDivElement) => {\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction]);\n // Memoed so it doesn't break ComboBox/Picker scrolling\n let mergedRef = useMemo(() => mergeRefs(popoverRef, ref), [ref, popoverRef]);\n\n // On small devices, show a modal (or eventually a tray) instead of a popover.\n // TODO: reverted this until we have trays.\n // let isMobile = useIsMobileDevice();\n // if (isMobile && process.env.NODE_ENV !== 'test') {\n // let mappedChildren = typeof children === 'function'\n // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})\n // : children;\n\n // return (\n // <Modal size={size} isDismissable>\n // {composeRenderProps(mappedChildren, (children, {state}) => (\n // <>\n // {children}\n // {/* Add additional dismiss button at the end to match popovers. */}\n // <DismissButton onDismiss={state.close} />\n // </>\n // ))}\n // </Modal>\n // );\n // }\n\n // TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results\n // containerPadding not working as expected\n return (\n <AriaPopover\n {...props}\n offset={(props.offset ?? 8) + (hideArrow ? 0 : 8)}\n ref={mergedRef}\n style={{\n ...UNSAFE_style,\n // Override default z-index from useOverlayPosition. We use isolation: isolate instead.\n zIndex: undefined\n }}\n className={(renderProps) => UNSAFE_className + mergeStyles(popover({...renderProps, size, isArrowShown: !hideArrow, colorScheme, isSubmenu: renderProps.trigger === 'SubmenuTrigger'}), styles)}>\n {composeRenderProps(props.children, (children, renderProps) => (\n <>\n {!hideArrow && (\n <OverlayArrow className=\"\">\n <svg viewBox=\"0 0 18 10\" className={arrow(renderProps)}>\n <path transform=\"translate(0 -1)\" d=\"M1 1L7.93799 8.52588C8.07224 8.67448 8.23607 8.79362 8.41895 8.87524C8.60182 8.95687 8.79973 8.9993 9 9C9.19984 8.99882 9.39724 8.95606 9.57959 8.87427C9.76193 8.79248 9.9253 8.67336 10.0591 8.5249L17 1\" />\n </svg>\n </OverlayArrow>\n )}\n <InPopoverContext.Provider value>\n {children}\n </InPopoverContext.Provider>\n </>\n ))}\n </AriaPopover>\n );\n});\n\ntype PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;\nexport interface PopoverDialogProps extends Pick<PopoverProps,\n'size' |\n'hideArrow'|\n'placement' |\n'shouldFlip' |\n'containerPadding' |\n'offset' |\n'crossOffset' |\n'triggerRef' |\n'isOpen' |\n'onOpenChange'\n>, Omit<DialogProps, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /**\n * The children of the popover.\n */\n children?: ReactNode,\n /**\n * The amount of padding around the contents of the dialog.\n * @default 'default'\n */\n padding?: 'default' | 'none',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: PopoverStylesProp\n}\n\nconst innerDivStyle = style({\n padding: {\n padding: {\n default: 8,\n none: 0\n }\n },\n boxSizing: 'border-box',\n outlineStyle: 'none',\n borderRadius: 'inherit',\n overflow: 'auto',\n position: 'relative',\n width: 'full',\n maxSize: 'inherit'\n}, getAllowedOverrides({height: true}));\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = forwardRef(function Popover(props: PopoverDialogProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PopoverContext);\n let domRef = useDOMRef(ref);\n let {\n UNSAFE_className,\n UNSAFE_style,\n styles,\n padding = 'default',\n ...otherProps\n } = props;\n\n return (\n <PopoverBase {...otherProps} ref={domRef}>\n {composeRenderProps(props.children, (children) => (\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className || '') + innerDivStyle({padding}, styles)}>\n {/* Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. */}\n <OverlayTriggerStateContext.Provider value={null}>\n {children}\n </OverlayTriggerStateContext.Provider>\n </div>\n ))}\n </PopoverBase>\n );\n});\n"],"names":[],"version":3,"file":"Popover.cjs.map"}
|
|
1
|
+
{"mappings":"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","sources":["packages/@react-spectrum/s2/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {Popover as AriaPopover, PopoverProps as AriaPopoverProps, OverlayArrow} from 'react-aria-components/Popover';\nimport {ColorSchemeContext} from './Provider';\nimport {composeRenderProps} from 'react-aria-components/composeRenderProps';\nimport {ContextValue} from 'react-aria-components/slots';\nimport {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {DialogProps, OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};\nimport {lightDark, setColorScheme, style} from '../style' with {type: 'macro'};\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,\n 'arrowSize' |\n 'isNonModal' |\n 'arrowBoundaryOffset' |\n 'isKeyboardDismissDisabled' |\n 'shouldCloseOnInteractOutside' |\n 'shouldUpdatePosition' |\n 'style' |\n 'className' |\n 'render' |\n keyof GlobalDOMAttributes\n> {\n /**\n * The styles of the popover.\n */\n styles?: StyleString,\n /**\n * Whether a popover's arrow should be hidden.\n *\n * @default false\n */\n hideArrow?: boolean,\n /**\n * The size of the Popover. If not specified, the popover fits its contents.\n */\n size?: 'S' | 'M' | 'L'\n /** The type of overlay that should be rendered when on a mobile device. */\n // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in\n}\n\nlet popover = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'layer-2',\n forcedColors: 'Background'\n }\n },\n backgroundColor: '--s2-container-bg',\n borderRadius: 'lg',\n filter: {\n isArrowShown: 'elevated'\n },\n // Use box-shadow instead of filter when an arrow is not shown.\n // This fixes the shadow stacking problem with submenus.\n boxShadow: {\n default: 'elevated',\n isArrowShown: 'none'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576\n }\n },\n // Don't be larger than full screen minus 2 * containerPadding\n maxWidth: 'calc(100vw - 24px)',\n boxSizing: 'border-box',\n display: 'flex',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n transition: '[opacity, translate]',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n isolation: 'isolate',\n pointerEvents: {\n isExiting: 'none'\n }\n}, getAllowedOverrides());\n// TODO: animations and real Popover Arrow\n\nlet arrow = style({\n display: 'block',\n fill: '--s2-container-bg',\n width: 18,\n height: 9,\n rotate: {\n default: 180,\n placement: {\n top: 0,\n bottom: 180,\n left: -90,\n right: 90\n }\n },\n translateX: {\n placement: {\n left: '-25%',\n right: '25%'\n }\n },\n strokeWidth: 1,\n stroke: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n }\n});\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InPopoverContext = createContext(false);\n\nexport const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n hideArrow = false,\n UNSAFE_className = '',\n UNSAFE_style,\n styles,\n size\n } = props;\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let popoverRef = useCallback((el: HTMLDivElement) => {\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction]);\n // Memoed so it doesn't break ComboBox/Picker scrolling\n let mergedRef = useMemo(() => mergeRefs(popoverRef, ref), [ref, popoverRef]);\n\n // On small devices, show a modal (or eventually a tray) instead of a popover.\n // TODO: reverted this until we have trays.\n // let isMobile = useIsMobileDevice();\n // if (isMobile && process.env.NODE_ENV !== 'test') {\n // let mappedChildren = typeof children === 'function'\n // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})\n // : children;\n\n // return (\n // <Modal size={size} isDismissable>\n // {composeRenderProps(mappedChildren, (children, {state}) => (\n // <>\n // {children}\n // {/* Add additional dismiss button at the end to match popovers. */}\n // <DismissButton onDismiss={state.close} />\n // </>\n // ))}\n // </Modal>\n // );\n // }\n\n // TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results\n // containerPadding not working as expected\n return (\n <AriaPopover\n {...props}\n offset={(props.offset ?? 8) + (hideArrow ? 0 : 8)}\n ref={mergedRef}\n style={{\n ...UNSAFE_style,\n // Override default z-index from useOverlayPosition. We use isolation: isolate instead.\n zIndex: undefined\n }}\n className={(renderProps) => UNSAFE_className + mergeStyles(popover({...renderProps, size, isArrowShown: !hideArrow, colorScheme, isSubmenu: renderProps.trigger === 'SubmenuTrigger'}), styles)}>\n {composeRenderProps(props.children, (children, renderProps) => (\n <>\n {!hideArrow && (\n <OverlayArrow className=\"\">\n <svg viewBox=\"0 0 18 10\" className={arrow(renderProps)}>\n <path transform=\"translate(0 -1)\" d=\"M1 1L7.93799 8.52588C8.07224 8.67448 8.23607 8.79362 8.41895 8.87524C8.60182 8.95687 8.79973 8.9993 9 9C9.19984 8.99882 9.39724 8.95606 9.57959 8.87427C9.76193 8.79248 9.9253 8.67336 10.0591 8.5249L17 1\" />\n </svg>\n </OverlayArrow>\n )}\n <InPopoverContext.Provider value>\n {children}\n </InPopoverContext.Provider>\n </>\n ))}\n </AriaPopover>\n );\n});\n\ntype PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;\nexport interface PopoverDialogProps extends Pick<PopoverProps,\n'size' |\n'hideArrow'|\n'placement' |\n'shouldFlip' |\n'containerPadding' |\n'offset' |\n'crossOffset' |\n'triggerRef' |\n'isOpen' |\n'onOpenChange'\n>, Omit<DialogProps, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /**\n * The children of the popover.\n */\n children?: ReactNode,\n /**\n * The amount of padding around the contents of the dialog.\n * @default 'default'\n */\n padding?: 'default' | 'none',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: PopoverStylesProp\n}\n\nconst innerDivStyle = style({\n padding: {\n padding: {\n default: 8,\n none: 0\n }\n },\n boxSizing: 'border-box',\n outlineStyle: 'none',\n borderRadius: 'inherit',\n overflow: 'auto',\n position: 'relative',\n width: 'full',\n maxSize: 'inherit'\n}, getAllowedOverrides({height: true}));\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = forwardRef(function Popover(props: PopoverDialogProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PopoverContext);\n let domRef = useDOMRef(ref);\n let {\n UNSAFE_className,\n UNSAFE_style,\n styles,\n padding = 'default',\n ...otherProps\n } = props;\n\n return (\n <PopoverBase {...otherProps} ref={domRef}>\n {composeRenderProps(props.children, (children) => (\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className || '') + innerDivStyle({padding}, styles)}>\n {/* Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. */}\n <OverlayTriggerStateContext.Provider value={null}>\n {children}\n </OverlayTriggerStateContext.Provider>\n </div>\n ))}\n </PopoverBase>\n );\n});\n"],"names":[],"version":3,"file":"Popover.cjs.map"}
|
package/dist/private/Popover.css
CHANGED
|
@@ -15,6 +15,22 @@
|
|
|
15
15
|
color-scheme: var(--s2-color-scheme);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
.-NvXmrd-_ZN8Gi4c13 {
|
|
19
|
+
--lightningcss-light: initial;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.-NvXmrd-_ZLmU13 {
|
|
23
|
+
--lightningcss-light: ;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.-j9blY-_ZLmU13 {
|
|
27
|
+
--lightningcss-dark: ;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.-j9blY-_ZN8Gi4c13 {
|
|
31
|
+
--lightningcss-dark: initial;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
.-Ovbhqd-g_g13 {
|
|
19
35
|
--s2-container-bg: light-dark(#fff, #222);
|
|
20
36
|
}
|
|
@@ -267,6 +283,18 @@
|
|
|
267
283
|
|
|
268
284
|
@layer _.b;
|
|
269
285
|
|
|
286
|
+
@layer _.b.D1v0V {
|
|
287
|
+
@media (prefers-color-scheme: dark) {
|
|
288
|
+
.-NvXmrd-D1v0V_ZLmU13 {
|
|
289
|
+
--lightningcss-light: ;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.-j9blY-D1v0V_ZN8Gi4c13 {
|
|
293
|
+
--lightningcss-dark: initial;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
270
298
|
@layer _.b.l {
|
|
271
299
|
@media (forced-colors: active) {
|
|
272
300
|
.-Ovbhqd-lga13 {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC0Dc;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgFF;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAiIU;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAjNR;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAgFF","sources":["6d7a68425d879d5d","packages/@react-spectrum/s2/src/Popover.tsx"],"sourcesContent":["@import \"0dd0ca29757a362f\";\n@import \"81768260922dd838\";\n@import \"1f6a63d51b6d4755\";\n","/*\n * Copyright 2024 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 {Popover as AriaPopover, PopoverProps as AriaPopoverProps, OverlayArrow} from 'react-aria-components/Popover';\nimport {ColorSchemeContext} from './Provider';\nimport {composeRenderProps} from 'react-aria-components/composeRenderProps';\nimport {ContextValue} from 'react-aria-components/slots';\nimport {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {DialogProps, OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};\nimport {lightDark, setColorScheme, style} from '../style' with {type: 'macro'};\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,\n 'arrowSize' |\n 'isNonModal' |\n 'arrowBoundaryOffset' |\n 'isKeyboardDismissDisabled' |\n 'shouldCloseOnInteractOutside' |\n 'shouldUpdatePosition' |\n 'style' |\n 'className' |\n 'render' |\n keyof GlobalDOMAttributes\n> {\n /**\n * The styles of the popover.\n */\n styles?: StyleString,\n /**\n * Whether a popover's arrow should be hidden.\n *\n * @default false\n */\n hideArrow?: boolean,\n /**\n * The size of the Popover. If not specified, the popover fits its contents.\n */\n size?: 'S' | 'M' | 'L'\n /** The type of overlay that should be rendered when on a mobile device. */\n // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in\n}\n\nlet popover = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'layer-2',\n forcedColors: 'Background'\n }\n },\n backgroundColor: '--s2-container-bg',\n borderRadius: 'lg',\n filter: {\n isArrowShown: 'elevated'\n },\n // Use box-shadow instead of filter when an arrow is not shown.\n // This fixes the shadow stacking problem with submenus.\n boxShadow: {\n default: 'elevated',\n isArrowShown: 'none'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576\n }\n },\n // Don't be larger than full screen minus 2 * containerPadding\n maxWidth: 'calc(100vw - 24px)',\n boxSizing: 'border-box',\n display: 'flex',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n transition: '[opacity, translate]',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n isolation: 'isolate',\n pointerEvents: {\n isExiting: 'none'\n }\n}, getAllowedOverrides());\n// TODO: animations and real Popover Arrow\n\nlet arrow = style({\n display: 'block',\n fill: '--s2-container-bg',\n width: 18,\n height: 9,\n rotate: {\n default: 180,\n placement: {\n top: 0,\n bottom: 180,\n left: -90,\n right: 90\n }\n },\n translateX: {\n placement: {\n left: '-25%',\n right: '25%'\n }\n },\n strokeWidth: 1,\n stroke: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n }\n});\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InPopoverContext = createContext(false);\n\nexport const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n hideArrow = false,\n UNSAFE_className = '',\n UNSAFE_style,\n styles,\n size\n } = props;\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let popoverRef = useCallback((el: HTMLDivElement) => {\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction]);\n // Memoed so it doesn't break ComboBox/Picker scrolling\n let mergedRef = useMemo(() => mergeRefs(popoverRef, ref), [ref, popoverRef]);\n\n // On small devices, show a modal (or eventually a tray) instead of a popover.\n // TODO: reverted this until we have trays.\n // let isMobile = useIsMobileDevice();\n // if (isMobile && process.env.NODE_ENV !== 'test') {\n // let mappedChildren = typeof children === 'function'\n // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})\n // : children;\n\n // return (\n // <Modal size={size} isDismissable>\n // {composeRenderProps(mappedChildren, (children, {state}) => (\n // <>\n // {children}\n // {/* Add additional dismiss button at the end to match popovers. */}\n // <DismissButton onDismiss={state.close} />\n // </>\n // ))}\n // </Modal>\n // );\n // }\n\n // TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results\n // containerPadding not working as expected\n return (\n <AriaPopover\n {...props}\n offset={(props.offset ?? 8) + (hideArrow ? 0 : 8)}\n ref={mergedRef}\n style={{\n ...UNSAFE_style,\n // Override default z-index from useOverlayPosition. We use isolation: isolate instead.\n zIndex: undefined\n }}\n className={(renderProps) => UNSAFE_className + mergeStyles(popover({...renderProps, size, isArrowShown: !hideArrow, colorScheme, isSubmenu: renderProps.trigger === 'SubmenuTrigger'}), styles)}>\n {composeRenderProps(props.children, (children, renderProps) => (\n <>\n {!hideArrow && (\n <OverlayArrow className=\"\">\n <svg viewBox=\"0 0 18 10\" className={arrow(renderProps)}>\n <path transform=\"translate(0 -1)\" d=\"M1 1L7.93799 8.52588C8.07224 8.67448 8.23607 8.79362 8.41895 8.87524C8.60182 8.95687 8.79973 8.9993 9 9C9.19984 8.99882 9.39724 8.95606 9.57959 8.87427C9.76193 8.79248 9.9253 8.67336 10.0591 8.5249L17 1\" />\n </svg>\n </OverlayArrow>\n )}\n <InPopoverContext.Provider value>\n {children}\n </InPopoverContext.Provider>\n </>\n ))}\n </AriaPopover>\n );\n});\n\ntype PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;\nexport interface PopoverDialogProps extends Pick<PopoverProps,\n'size' |\n'hideArrow'|\n'placement' |\n'shouldFlip' |\n'containerPadding' |\n'offset' |\n'crossOffset' |\n'triggerRef' |\n'isOpen' |\n'onOpenChange'\n>, Omit<DialogProps, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /**\n * The children of the popover.\n */\n children?: ReactNode,\n /**\n * The amount of padding around the contents of the dialog.\n * @default 'default'\n */\n padding?: 'default' | 'none',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: PopoverStylesProp\n}\n\nconst innerDivStyle = style({\n padding: {\n padding: {\n default: 8,\n none: 0\n }\n },\n boxSizing: 'border-box',\n outlineStyle: 'none',\n borderRadius: 'inherit',\n overflow: 'auto',\n position: 'relative',\n width: 'full',\n maxSize: 'inherit'\n}, getAllowedOverrides({height: true}));\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = forwardRef(function Popover(props: PopoverDialogProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PopoverContext);\n let domRef = useDOMRef(ref);\n let {\n UNSAFE_className,\n UNSAFE_style,\n styles,\n padding = 'default',\n ...otherProps\n } = props;\n\n return (\n <PopoverBase {...otherProps} ref={domRef}>\n {composeRenderProps(props.children, (children) => (\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className || '') + innerDivStyle({padding}, styles)}>\n {/* Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. */}\n <OverlayTriggerStateContext.Provider value={null}>\n {children}\n </OverlayTriggerStateContext.Provider>\n </div>\n ))}\n </PopoverBase>\n );\n});\n"],"names":[],"version":3,"file":"Popover.css.map"}
|
|
1
|
+
{"mappings":"AC0Dc;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgFF;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAiIU;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAjNR;;AAAA;EAAA;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAgFF","sources":["6d7a68425d879d5d","packages/@react-spectrum/s2/src/Popover.tsx"],"sourcesContent":["@import \"0dd0ca29757a362f\";\n@import \"81768260922dd838\";\n@import \"1f6a63d51b6d4755\";\n","/*\n * Copyright 2024 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 {Popover as AriaPopover, PopoverProps as AriaPopoverProps, OverlayArrow} from 'react-aria-components/Popover';\nimport {ColorSchemeContext} from './Provider';\nimport {composeRenderProps} from 'react-aria-components/composeRenderProps';\nimport {ContextValue} from 'react-aria-components/slots';\nimport {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {DialogProps, OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};\nimport {lightDark, setColorScheme, style} from '../style' with {type: 'macro'};\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,\n 'arrowSize' |\n 'isNonModal' |\n 'arrowBoundaryOffset' |\n 'isKeyboardDismissDisabled' |\n 'shouldCloseOnInteractOutside' |\n 'shouldUpdatePosition' |\n 'style' |\n 'className' |\n 'render' |\n keyof GlobalDOMAttributes\n> {\n /**\n * The styles of the popover.\n */\n styles?: StyleString,\n /**\n * Whether a popover's arrow should be hidden.\n *\n * @default false\n */\n hideArrow?: boolean,\n /**\n * The size of the Popover. If not specified, the popover fits its contents.\n */\n size?: 'S' | 'M' | 'L'\n /** The type of overlay that should be rendered when on a mobile device. */\n // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in\n}\n\nlet popover = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'layer-2',\n forcedColors: 'Background'\n }\n },\n backgroundColor: '--s2-container-bg',\n borderRadius: 'lg',\n filter: {\n isArrowShown: 'elevated'\n },\n // Use box-shadow instead of filter when an arrow is not shown.\n // This fixes the shadow stacking problem with submenus.\n boxShadow: {\n default: 'elevated',\n isArrowShown: 'none'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576\n }\n },\n // Don't be larger than full screen minus 2 * containerPadding\n maxWidth: 'calc(100vw - 24px)',\n boxSizing: 'border-box',\n display: 'flex',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n transition: '[opacity, translate]',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n isolation: 'isolate',\n pointerEvents: {\n isExiting: 'none'\n }\n}, getAllowedOverrides());\n// TODO: animations and real Popover Arrow\n\nlet arrow = style({\n display: 'block',\n fill: '--s2-container-bg',\n width: 18,\n height: 9,\n rotate: {\n default: 180,\n placement: {\n top: 0,\n bottom: 180,\n left: -90,\n right: 90\n }\n },\n translateX: {\n placement: {\n left: '-25%',\n right: '25%'\n }\n },\n strokeWidth: 1,\n stroke: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n }\n});\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InPopoverContext = createContext(false);\n\nexport const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n hideArrow = false,\n UNSAFE_className = '',\n UNSAFE_style,\n styles,\n size\n } = props;\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let popoverRef = useCallback((el: HTMLDivElement) => {\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction]);\n // Memoed so it doesn't break ComboBox/Picker scrolling\n let mergedRef = useMemo(() => mergeRefs(popoverRef, ref), [ref, popoverRef]);\n\n // On small devices, show a modal (or eventually a tray) instead of a popover.\n // TODO: reverted this until we have trays.\n // let isMobile = useIsMobileDevice();\n // if (isMobile && process.env.NODE_ENV !== 'test') {\n // let mappedChildren = typeof children === 'function'\n // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})\n // : children;\n\n // return (\n // <Modal size={size} isDismissable>\n // {composeRenderProps(mappedChildren, (children, {state}) => (\n // <>\n // {children}\n // {/* Add additional dismiss button at the end to match popovers. */}\n // <DismissButton onDismiss={state.close} />\n // </>\n // ))}\n // </Modal>\n // );\n // }\n\n // TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results\n // containerPadding not working as expected\n return (\n <AriaPopover\n {...props}\n offset={(props.offset ?? 8) + (hideArrow ? 0 : 8)}\n ref={mergedRef}\n style={{\n ...UNSAFE_style,\n // Override default z-index from useOverlayPosition. We use isolation: isolate instead.\n zIndex: undefined\n }}\n className={(renderProps) => UNSAFE_className + mergeStyles(popover({...renderProps, size, isArrowShown: !hideArrow, colorScheme, isSubmenu: renderProps.trigger === 'SubmenuTrigger'}), styles)}>\n {composeRenderProps(props.children, (children, renderProps) => (\n <>\n {!hideArrow && (\n <OverlayArrow className=\"\">\n <svg viewBox=\"0 0 18 10\" className={arrow(renderProps)}>\n <path transform=\"translate(0 -1)\" d=\"M1 1L7.93799 8.52588C8.07224 8.67448 8.23607 8.79362 8.41895 8.87524C8.60182 8.95687 8.79973 8.9993 9 9C9.19984 8.99882 9.39724 8.95606 9.57959 8.87427C9.76193 8.79248 9.9253 8.67336 10.0591 8.5249L17 1\" />\n </svg>\n </OverlayArrow>\n )}\n <InPopoverContext.Provider value>\n {children}\n </InPopoverContext.Provider>\n </>\n ))}\n </AriaPopover>\n );\n});\n\ntype PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;\nexport interface PopoverDialogProps extends Pick<PopoverProps,\n'size' |\n'hideArrow'|\n'placement' |\n'shouldFlip' |\n'containerPadding' |\n'offset' |\n'crossOffset' |\n'triggerRef' |\n'isOpen' |\n'onOpenChange'\n>, Omit<DialogProps, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /**\n * The children of the popover.\n */\n children?: ReactNode,\n /**\n * The amount of padding around the contents of the dialog.\n * @default 'default'\n */\n padding?: 'default' | 'none',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: PopoverStylesProp\n}\n\nconst innerDivStyle = style({\n padding: {\n padding: {\n default: 8,\n none: 0\n }\n },\n boxSizing: 'border-box',\n outlineStyle: 'none',\n borderRadius: 'inherit',\n overflow: 'auto',\n position: 'relative',\n width: 'full',\n maxSize: 'inherit'\n}, getAllowedOverrides({height: true}));\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = forwardRef(function Popover(props: PopoverDialogProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PopoverContext);\n let domRef = useDOMRef(ref);\n let {\n UNSAFE_className,\n UNSAFE_style,\n styles,\n padding = 'default',\n ...otherProps\n } = props;\n\n return (\n <PopoverBase {...otherProps} ref={domRef}>\n {composeRenderProps(props.children, (children) => (\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className || '') + innerDivStyle({padding}, styles)}>\n {/* Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. */}\n <OverlayTriggerStateContext.Provider value={null}>\n {children}\n </OverlayTriggerStateContext.Provider>\n </div>\n ))}\n </PopoverBase>\n );\n});\n"],"names":[],"version":3,"file":"Popover.css.map"}
|
package/dist/private/Popover.mjs
CHANGED
|
@@ -46,6 +46,18 @@ let $88b746eba92c8d0d$var$popover = function anonymous(props, overrides) {
|
|
|
46
46
|
else if (props.colorScheme === "light") rules += ' -ICUGx-_pb13';
|
|
47
47
|
else if (props.colorScheme === "light dark") rules += ' -ICUGx-_pc13';
|
|
48
48
|
rules += ' _pK8eoyd13';
|
|
49
|
+
if (props.colorScheme === "dark") rules += ' -NvXmrd-_ZLmU13';
|
|
50
|
+
else if (props.colorScheme === "light") rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
51
|
+
else if (props.colorScheme === "light dark") {
|
|
52
|
+
rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
53
|
+
rules += ' -NvXmrd-D1v0V_ZLmU13';
|
|
54
|
+
}
|
|
55
|
+
if (props.colorScheme === "dark") rules += ' -j9blY-_ZN8Gi4c13';
|
|
56
|
+
else if (props.colorScheme === "light") rules += ' -j9blY-_ZLmU13';
|
|
57
|
+
else if (props.colorScheme === "light dark") {
|
|
58
|
+
rules += ' -j9blY-_ZLmU13';
|
|
59
|
+
rules += ' -j9blY-D1v0V_ZN8Gi4c13';
|
|
60
|
+
}
|
|
49
61
|
rules += ' -Ovbhqd-g_g13';
|
|
50
62
|
rules += ' -Ovbhqd-lga13';
|
|
51
63
|
rules += ' gEzkoQe13';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"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","sources":["packages/@react-spectrum/s2/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {Popover as AriaPopover, PopoverProps as AriaPopoverProps, OverlayArrow} from 'react-aria-components/Popover';\nimport {ColorSchemeContext} from './Provider';\nimport {composeRenderProps} from 'react-aria-components/composeRenderProps';\nimport {ContextValue} from 'react-aria-components/slots';\nimport {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {DialogProps, OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};\nimport {lightDark, setColorScheme, style} from '../style' with {type: 'macro'};\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,\n 'arrowSize' |\n 'isNonModal' |\n 'arrowBoundaryOffset' |\n 'isKeyboardDismissDisabled' |\n 'shouldCloseOnInteractOutside' |\n 'shouldUpdatePosition' |\n 'style' |\n 'className' |\n 'render' |\n keyof GlobalDOMAttributes\n> {\n /**\n * The styles of the popover.\n */\n styles?: StyleString,\n /**\n * Whether a popover's arrow should be hidden.\n *\n * @default false\n */\n hideArrow?: boolean,\n /**\n * The size of the Popover. If not specified, the popover fits its contents.\n */\n size?: 'S' | 'M' | 'L'\n /** The type of overlay that should be rendered when on a mobile device. */\n // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in\n}\n\nlet popover = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'layer-2',\n forcedColors: 'Background'\n }\n },\n backgroundColor: '--s2-container-bg',\n borderRadius: 'lg',\n filter: {\n isArrowShown: 'elevated'\n },\n // Use box-shadow instead of filter when an arrow is not shown.\n // This fixes the shadow stacking problem with submenus.\n boxShadow: {\n default: 'elevated',\n isArrowShown: 'none'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576\n }\n },\n // Don't be larger than full screen minus 2 * containerPadding\n maxWidth: 'calc(100vw - 24px)',\n boxSizing: 'border-box',\n display: 'flex',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n transition: '[opacity, translate]',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n isolation: 'isolate',\n pointerEvents: {\n isExiting: 'none'\n }\n}, getAllowedOverrides());\n// TODO: animations and real Popover Arrow\n\nlet arrow = style({\n display: 'block',\n fill: '--s2-container-bg',\n width: 18,\n height: 9,\n rotate: {\n default: 180,\n placement: {\n top: 0,\n bottom: 180,\n left: -90,\n right: 90\n }\n },\n translateX: {\n placement: {\n left: '-25%',\n right: '25%'\n }\n },\n strokeWidth: 1,\n stroke: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n }\n});\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InPopoverContext = createContext(false);\n\nexport const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n hideArrow = false,\n UNSAFE_className = '',\n UNSAFE_style,\n styles,\n size\n } = props;\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let popoverRef = useCallback((el: HTMLDivElement) => {\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction]);\n // Memoed so it doesn't break ComboBox/Picker scrolling\n let mergedRef = useMemo(() => mergeRefs(popoverRef, ref), [ref, popoverRef]);\n\n // On small devices, show a modal (or eventually a tray) instead of a popover.\n // TODO: reverted this until we have trays.\n // let isMobile = useIsMobileDevice();\n // if (isMobile && process.env.NODE_ENV !== 'test') {\n // let mappedChildren = typeof children === 'function'\n // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})\n // : children;\n\n // return (\n // <Modal size={size} isDismissable>\n // {composeRenderProps(mappedChildren, (children, {state}) => (\n // <>\n // {children}\n // {/* Add additional dismiss button at the end to match popovers. */}\n // <DismissButton onDismiss={state.close} />\n // </>\n // ))}\n // </Modal>\n // );\n // }\n\n // TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results\n // containerPadding not working as expected\n return (\n <AriaPopover\n {...props}\n offset={(props.offset ?? 8) + (hideArrow ? 0 : 8)}\n ref={mergedRef}\n style={{\n ...UNSAFE_style,\n // Override default z-index from useOverlayPosition. We use isolation: isolate instead.\n zIndex: undefined\n }}\n className={(renderProps) => UNSAFE_className + mergeStyles(popover({...renderProps, size, isArrowShown: !hideArrow, colorScheme, isSubmenu: renderProps.trigger === 'SubmenuTrigger'}), styles)}>\n {composeRenderProps(props.children, (children, renderProps) => (\n <>\n {!hideArrow && (\n <OverlayArrow className=\"\">\n <svg viewBox=\"0 0 18 10\" className={arrow(renderProps)}>\n <path transform=\"translate(0 -1)\" d=\"M1 1L7.93799 8.52588C8.07224 8.67448 8.23607 8.79362 8.41895 8.87524C8.60182 8.95687 8.79973 8.9993 9 9C9.19984 8.99882 9.39724 8.95606 9.57959 8.87427C9.76193 8.79248 9.9253 8.67336 10.0591 8.5249L17 1\" />\n </svg>\n </OverlayArrow>\n )}\n <InPopoverContext.Provider value>\n {children}\n </InPopoverContext.Provider>\n </>\n ))}\n </AriaPopover>\n );\n});\n\ntype PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;\nexport interface PopoverDialogProps extends Pick<PopoverProps,\n'size' |\n'hideArrow'|\n'placement' |\n'shouldFlip' |\n'containerPadding' |\n'offset' |\n'crossOffset' |\n'triggerRef' |\n'isOpen' |\n'onOpenChange'\n>, Omit<DialogProps, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /**\n * The children of the popover.\n */\n children?: ReactNode,\n /**\n * The amount of padding around the contents of the dialog.\n * @default 'default'\n */\n padding?: 'default' | 'none',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: PopoverStylesProp\n}\n\nconst innerDivStyle = style({\n padding: {\n padding: {\n default: 8,\n none: 0\n }\n },\n boxSizing: 'border-box',\n outlineStyle: 'none',\n borderRadius: 'inherit',\n overflow: 'auto',\n position: 'relative',\n width: 'full',\n maxSize: 'inherit'\n}, getAllowedOverrides({height: true}));\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = forwardRef(function Popover(props: PopoverDialogProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PopoverContext);\n let domRef = useDOMRef(ref);\n let {\n UNSAFE_className,\n UNSAFE_style,\n styles,\n padding = 'default',\n ...otherProps\n } = props;\n\n return (\n <PopoverBase {...otherProps} ref={domRef}>\n {composeRenderProps(props.children, (children) => (\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className || '') + innerDivStyle({padding}, styles)}>\n {/* Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. */}\n <OverlayTriggerStateContext.Provider value={null}>\n {children}\n </OverlayTriggerStateContext.Provider>\n </div>\n ))}\n </PopoverBase>\n );\n});\n"],"names":[],"version":3,"file":"Popover.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgDD,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EJ,0CAA0C;AAE1C,IAAI;;;;;;;;;;;;;;;;;;;;;;;AA2BG,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2D;AAC9F,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAE;AAEvC,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAmB,EAAE,GAAwC;IACtH,IAAI,aACF,YAAY,yBACZ,mBAAmB,kBACnB,YAAY,UACZ,MAAM,QACN,IAAI,EACL,GAAG;IACJ,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAiB;IAC9C,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAElC,0DAA0D;IAC1D,IAAI,aAAa,CAAA,GAAA,kBAAU,EAAE,CAAC;QAC5B,IAAI,IAAI;YACN,GAAG,IAAI,GAAG;YACV,GAAG,GAAG,GAAG;QACX;IACF,GAAG;QAAC;QAAQ;KAAU;IACtB,uDAAuD;IACvD,IAAI,YAAY,CAAA,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,gBAAQ,EAAE,YAAY,MAAM;QAAC;QAAK;KAAW;IAE3E,8EAA8E;IAC9E,2CAA2C;IAC3C,sCAAsC;IACtC,qDAAqD;IACrD,wDAAwD;IACxD,2HAA2H;IAC3H,kBAAkB;IAElB,aAAa;IACb,wCAAwC;IACxC,qEAAqE;IACrE,aAAa;IACb,uBAAuB;IACvB,gFAAgF;IAChF,sDAAsD;IACtD,cAAc;IACd,YAAY;IACZ,eAAe;IACf,OAAO;IACP,IAAI;IAEJ,yHAAyH;IACzH,2CAA2C;IAC3C,qBACE,gBAAC,CAAA,GAAA,cAAU;QACR,GAAG,KAAK;QACT,QAAQ,AAAC,CAAA,MAAM,MAAM,IAAI,CAAA,IAAM,CAAA,YAAY,IAAI,CAAA;QAC/C,KAAK;QACL,OAAO;YACL,GAAG,YAAY;YACf,uFAAuF;YACvF,QAAQ;QACV;QACA,WAAW,CAAC,cAAgB,mBAAmB,CAAA,GAAA,yCAAU,EAAE,8BAAQ;gBAAC,GAAG,WAAW;sBAAE;gBAAM,cAAc,CAAC;6BAAW;gBAAa,WAAW,YAAY,OAAO,KAAK;YAAgB,IAAI;kBACvL,CAAA,GAAA,yBAAiB,EAAE,MAAM,QAAQ,EAAE,CAAC,UAAU,4BAC7C;;oBACG,CAAC,2BACA,gBAAC,CAAA,GAAA,mBAAW;wBAAE,WAAU;kCACtB,cAAA,gBAAC;4BAAI,SAAQ;4BAAY,WAAW,4BAAM;sCACxC,cAAA,gBAAC;gCAAK,WAAU;gCAAkB,GAAE;;;;kCAI1C,gBAAC,0CAAiB,QAAQ;wBAAC,KAAK;kCAC7B;;;;;AAMb;AA4BA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBC,MAAM,0DAAU,CAAA,GAAA,iBAAS,EAAE,SAAS,QAAQ,KAAyB,EAAE,GAA2B;IACvG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,yCAAQ,EAAE;IACvB,IAAI,oBACF,gBAAgB,gBAChB,YAAY,UACZ,MAAM,WACN,UAAU,WACV,GAAG,YACJ,GAAG;IAEJ,qBACE,gBAAC;QAAa,GAAG,UAAU;QAAE,KAAK;kBAC/B,CAAA,GAAA,yBAAiB,EAAE,MAAM,QAAQ,EAAE,CAAC,yBACnC,gBAAC;gBACC,OAAO;gBACP,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,oCAAc;6BAAC;gBAAO,GAAG;0BAE/D,cAAA,gBAAC,CAAA,GAAA,iCAAyB,EAAE,QAAQ;oBAAC,OAAO;8BACzC;;;;AAMb","sources":["packages/@react-spectrum/s2/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {Popover as AriaPopover, PopoverProps as AriaPopoverProps, OverlayArrow} from 'react-aria-components/Popover';\nimport {ColorSchemeContext} from './Provider';\nimport {composeRenderProps} from 'react-aria-components/composeRenderProps';\nimport {ContextValue} from 'react-aria-components/slots';\nimport {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {DialogProps, OverlayTriggerStateContext} from 'react-aria-components/Dialog';\nimport {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';\nimport {getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};\nimport {lightDark, setColorScheme, style} from '../style' with {type: 'macro'};\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types' with {type: 'macro'};\nimport {useDOMRef} from './useDOMRef';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,\n 'arrowSize' |\n 'isNonModal' |\n 'arrowBoundaryOffset' |\n 'isKeyboardDismissDisabled' |\n 'shouldCloseOnInteractOutside' |\n 'shouldUpdatePosition' |\n 'style' |\n 'className' |\n 'render' |\n keyof GlobalDOMAttributes\n> {\n /**\n * The styles of the popover.\n */\n styles?: StyleString,\n /**\n * Whether a popover's arrow should be hidden.\n *\n * @default false\n */\n hideArrow?: boolean,\n /**\n * The size of the Popover. If not specified, the popover fits its contents.\n */\n size?: 'S' | 'M' | 'L'\n /** The type of overlay that should be rendered when on a mobile device. */\n // mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover' // TODO: add tray back in\n}\n\nlet popover = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n default: 'layer-2',\n forcedColors: 'Background'\n }\n },\n backgroundColor: '--s2-container-bg',\n borderRadius: 'lg',\n filter: {\n isArrowShown: 'elevated'\n },\n // Use box-shadow instead of filter when an arrow is not shown.\n // This fixes the shadow stacking problem with submenus.\n boxShadow: {\n default: 'elevated',\n isArrowShown: 'none'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n },\n width: {\n size: {\n // Copied from designs, not sure if correct.\n S: 336,\n M: 416,\n L: 576\n }\n },\n // Don't be larger than full screen minus 2 * containerPadding\n maxWidth: 'calc(100vw - 24px)',\n boxSizing: 'border-box',\n display: 'flex',\n opacity: {\n isEntering: 0,\n isExiting: 0\n },\n translateY: {\n placement: {\n top: {\n isEntering: 4,\n isExiting: 4\n },\n bottom: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n translateX: {\n placement: {\n left: {\n isEntering: 4,\n isExiting: 4\n },\n right: {\n isEntering: -4,\n isExiting: -4\n }\n },\n isSubmenu: 0\n },\n transition: '[opacity, translate]',\n transitionDuration: 200,\n transitionTimingFunction: {\n isExiting: 'in'\n },\n isolation: 'isolate',\n pointerEvents: {\n isExiting: 'none'\n }\n}, getAllowedOverrides());\n// TODO: animations and real Popover Arrow\n\nlet arrow = style({\n display: 'block',\n fill: '--s2-container-bg',\n width: 18,\n height: 9,\n rotate: {\n default: 180,\n placement: {\n top: 0,\n bottom: 180,\n left: -90,\n right: 90\n }\n },\n translateX: {\n placement: {\n left: '-25%',\n right: '25%'\n }\n },\n strokeWidth: 1,\n stroke: {\n default: lightDark('transparent-white-25', 'gray-200'),\n forcedColors: 'ButtonBorder'\n }\n});\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InPopoverContext = createContext(false);\n\nexport const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, ref: ForwardedRef<HTMLDivElement | null>) {\n let {\n hideArrow = false,\n UNSAFE_className = '',\n UNSAFE_style,\n styles,\n size\n } = props;\n let colorScheme = useContext(ColorSchemeContext);\n let {locale, direction} = useLocale();\n\n // TODO: should we pass through lang and dir props in RAC?\n let popoverRef = useCallback((el: HTMLDivElement) => {\n if (el) {\n el.lang = locale;\n el.dir = direction;\n }\n }, [locale, direction]);\n // Memoed so it doesn't break ComboBox/Picker scrolling\n let mergedRef = useMemo(() => mergeRefs(popoverRef, ref), [ref, popoverRef]);\n\n // On small devices, show a modal (or eventually a tray) instead of a popover.\n // TODO: reverted this until we have trays.\n // let isMobile = useIsMobileDevice();\n // if (isMobile && process.env.NODE_ENV !== 'test') {\n // let mappedChildren = typeof children === 'function'\n // ? (renderProps: ModalRenderProps) => children({...renderProps, defaultChildren: null, trigger, placement: 'bottom'})\n // : children;\n\n // return (\n // <Modal size={size} isDismissable>\n // {composeRenderProps(mappedChildren, (children, {state}) => (\n // <>\n // {children}\n // {/* Add additional dismiss button at the end to match popovers. */}\n // <DismissButton onDismiss={state.close} />\n // </>\n // ))}\n // </Modal>\n // );\n // }\n\n // TODO: this still isn't the final popover 'tip', copying various ones out of the designs files yields different results\n // containerPadding not working as expected\n return (\n <AriaPopover\n {...props}\n offset={(props.offset ?? 8) + (hideArrow ? 0 : 8)}\n ref={mergedRef}\n style={{\n ...UNSAFE_style,\n // Override default z-index from useOverlayPosition. We use isolation: isolate instead.\n zIndex: undefined\n }}\n className={(renderProps) => UNSAFE_className + mergeStyles(popover({...renderProps, size, isArrowShown: !hideArrow, colorScheme, isSubmenu: renderProps.trigger === 'SubmenuTrigger'}), styles)}>\n {composeRenderProps(props.children, (children, renderProps) => (\n <>\n {!hideArrow && (\n <OverlayArrow className=\"\">\n <svg viewBox=\"0 0 18 10\" className={arrow(renderProps)}>\n <path transform=\"translate(0 -1)\" d=\"M1 1L7.93799 8.52588C8.07224 8.67448 8.23607 8.79362 8.41895 8.87524C8.60182 8.95687 8.79973 8.9993 9 9C9.19984 8.99882 9.39724 8.95606 9.57959 8.87427C9.76193 8.79248 9.9253 8.67336 10.0591 8.5249L17 1\" />\n </svg>\n </OverlayArrow>\n )}\n <InPopoverContext.Provider value>\n {children}\n </InPopoverContext.Provider>\n </>\n ))}\n </AriaPopover>\n );\n});\n\ntype PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;\nexport interface PopoverDialogProps extends Pick<PopoverProps,\n'size' |\n'hideArrow'|\n'placement' |\n'shouldFlip' |\n'containerPadding' |\n'offset' |\n'crossOffset' |\n'triggerRef' |\n'isOpen' |\n'onOpenChange'\n>, Omit<DialogProps, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /**\n * The children of the popover.\n */\n children?: ReactNode,\n /**\n * The amount of padding around the contents of the dialog.\n * @default 'default'\n */\n padding?: 'default' | 'none',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: PopoverStylesProp\n}\n\nconst innerDivStyle = style({\n padding: {\n padding: {\n default: 8,\n none: 0\n }\n },\n boxSizing: 'border-box',\n outlineStyle: 'none',\n borderRadius: 'inherit',\n overflow: 'auto',\n position: 'relative',\n width: 'full',\n maxSize: 'inherit'\n}, getAllowedOverrides({height: true}));\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = forwardRef(function Popover(props: PopoverDialogProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, PopoverContext);\n let domRef = useDOMRef(ref);\n let {\n UNSAFE_className,\n UNSAFE_style,\n styles,\n padding = 'default',\n ...otherProps\n } = props;\n\n return (\n <PopoverBase {...otherProps} ref={domRef}>\n {composeRenderProps(props.children, (children) => (\n <div\n style={UNSAFE_style}\n className={(UNSAFE_className || '') + innerDivStyle({padding}, styles)}>\n {/* Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. */}\n <OverlayTriggerStateContext.Provider value={null}>\n {children}\n </OverlayTriggerStateContext.Provider>\n </div>\n ))}\n </PopoverBase>\n );\n});\n"],"names":[],"version":3,"file":"Popover.mjs.map"}
|
|
@@ -59,6 +59,18 @@ let $914a06b3a1c679bc$var$providerStyles = function anonymous(props) {
|
|
|
59
59
|
else if (props.colorScheme === "light") rules += ' -ICUGx-_pb13';
|
|
60
60
|
else if (props.colorScheme === "light dark") rules += ' -ICUGx-_pc13';
|
|
61
61
|
rules += ' _pK8eoyd13';
|
|
62
|
+
if (props.colorScheme === "dark") rules += ' -NvXmrd-_ZLmU13';
|
|
63
|
+
else if (props.colorScheme === "light") rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
64
|
+
else if (props.colorScheme === "light dark") {
|
|
65
|
+
rules += ' -NvXmrd-_ZN8Gi4c13';
|
|
66
|
+
rules += ' -NvXmrd-D1v0V_ZLmU13';
|
|
67
|
+
}
|
|
68
|
+
if (props.colorScheme === "dark") rules += ' -j9blY-_ZN8Gi4c13';
|
|
69
|
+
else if (props.colorScheme === "light") rules += ' -j9blY-_ZLmU13';
|
|
70
|
+
else if (props.colorScheme === "light dark") {
|
|
71
|
+
rules += ' -j9blY-_ZLmU13';
|
|
72
|
+
rules += ' -j9blY-D1v0V_ZN8Gi4c13';
|
|
73
|
+
}
|
|
62
74
|
if (props.background === "layer-2") rules += ' -Ovbhqd-g_g13';
|
|
63
75
|
else if (props.background === "layer-1") rules += ' -Ovbhqd-gqlRAZb13';
|
|
64
76
|
else if (props.background === "base") rules += ' -Ovbhqd-gX13';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiDM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAqC;AAM5E,SAAS,0CAAS,KAAoB;IAC3C,IAAI,uBAAS,gCAAC;QAAe,GAAG,KAAK;;IACrC,IAAI,oBAAoB,CAAA,GAAA,uBAAS,EAAE;IACnC,IAAI,cAAc,MAAM,WAAW,IAAI;IACvC,uBAAS,gCAAC,0CAAmB,QAAQ;QAAC,OAAO;kBAAc;;IAE3D,IAAI,MAAM,MAAM,EACd,uBAAS,gCAAC,CAAA,GAAA,yCAAW;QAAE,QAAQ,MAAM,MAAM;kBAAG;;IAGhD,IAAI,MAAM,MAAM,EACd,uBAAS,gCAAC,CAAA,GAAA,mDAAa;QAAG,GAAG,MAAM,MAAM;kBAAG;;IAG9C,OAAO;AACT;;AAIA,IAAI
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiDM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAqC;AAM5E,SAAS,0CAAS,KAAoB;IAC3C,IAAI,uBAAS,gCAAC;QAAe,GAAG,KAAK;;IACrC,IAAI,oBAAoB,CAAA,GAAA,uBAAS,EAAE;IACnC,IAAI,cAAc,MAAM,WAAW,IAAI;IACvC,uBAAS,gCAAC,0CAAmB,QAAQ;QAAC,OAAO;kBAAc;;IAE3D,IAAI,MAAM,MAAM,EACd,uBAAS,gCAAC,CAAA,GAAA,yCAAW;QAAE,QAAQ,MAAM,MAAM;kBAAG;;IAGhD,IAAI,MAAM,MAAM,EACd,uBAAS,gCAAC,CAAA,GAAA,mDAAa;QAAG,GAAG,MAAM,MAAM;kBAAG;;IAG9C,OAAO;AACT;;AAIA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBJ,SAAS,oCAAc,KAAoB;IACzC,IAAI,EACF,aAAa,UAAU,KAAK,gBAC5B,YAAY,oBACZ,mBAAmB,YACnB,MAAM,YACN,QAAQ,cACR,mFAAmF;IACnF,aAAa,YAAY,SAAS,SAAS,wBAC3C,WAAW,EACZ,GAAG;IACJ,IAAI,UAAC,MAAM,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,sCAAQ;IAClC,qBACE,iCAAC;QACE,GAAG,CAAA,GAAA,6CAAa,EAAE,MAAM;QACzB,MAAM;QACN,KAAK;QACL,OAAO;QACP,WAAW,mBAAmB,CAAA,GAAA,qCAAU,EACtC,QACA,qCAAe;wBAAC;yBAAY;QAAW;;0BAEzC,gCAAC,CAAA,GAAA,+BAAI;YACJ;;;AAGP","sources":["packages/@react-spectrum/s2/src/Provider.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {createContext, JSX, ReactNode, useContext} from 'react';\nimport {DOMProps, Href, RouterOptions} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {Fonts} from './Fonts';\nimport {generateDefaultColorSchemeStyles} from './page.macro' with {type: 'macro'};\nimport {I18nProvider, useLocale} from 'react-aria/I18nProvider';\nimport {mergeStyles} from '../style/runtime';\nimport {RouterProvider} from 'react-aria/private/utils/openLink';\nimport {setColorScheme, style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils' with {type: 'macro'};\n\nexport type ColorScheme = 'light' | 'dark';\ninterface Router {\n navigate: (path: string, routerOptions: RouterOptions | undefined) => void,\n useHref?: (href: Href) => string\n}\n\nexport interface ProviderProps extends UnsafeStyles, DOMProps {\n /** The content of the Provider. */\n children: ReactNode,\n /**\n * The locale for your application as a [BCP 47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code.\n * Defaults to the browser/OS language setting.\n * @default 'en-US'\n */\n locale?: string,\n /**\n * Provides a client side router to all nested React Spectrum links to enable client side navigation.\n */\n router?: Router,\n /**\n * The color scheme for your application.\n * Defaults to operating system preferences.\n */\n colorScheme?: ColorScheme,\n /** The background for this provider. If not provided, the background is transparent. */\n background?: 'base' | 'layer-1' | 'layer-2',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /**\n * The DOM element to render.\n * @default div\n */\n elementType?: keyof JSX.IntrinsicElements\n}\n\nexport const ColorSchemeContext = createContext<ColorScheme | 'light dark' | null>(null);\n\n/**\n * Provider is the container for all React Spectrum components.\n * It loads the font and sets the colorScheme, locale, and other application level settings.\n */\nexport function Provider(props: ProviderProps): JSX.Element {\n let result = <ProviderInner {...props} />;\n let parentColorScheme = useContext(ColorSchemeContext);\n let colorScheme = props.colorScheme || parentColorScheme;\n result = <ColorSchemeContext.Provider value={colorScheme}>{result}</ColorSchemeContext.Provider>;\n\n if (props.locale) {\n result = <I18nProvider locale={props.locale}>{result}</I18nProvider>;\n }\n\n if (props.router) {\n result = <RouterProvider {...props.router}>{result}</RouterProvider>;\n }\n\n return result;\n}\n\ngenerateDefaultColorSchemeStyles();\n\nlet providerStyles = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n background: {\n base: 'base',\n 'layer-1': 'layer-1',\n 'layer-2': 'layer-2'\n }\n }\n },\n backgroundColor: {\n // Don't set a background unless one is requested.\n background: {\n base: '--s2-container-bg',\n 'layer-1': '--s2-container-bg',\n 'layer-2': '--s2-container-bg'\n }\n },\n isolation: 'isolate'\n});\n\nfunction ProviderInner(props: ProviderProps) {\n let {\n elementType: Element = 'div',\n UNSAFE_style,\n UNSAFE_className = '',\n styles,\n children,\n // Set a default background if the provider is rendered as the root <html> element.\n background = Element === 'html' ? 'base' : undefined,\n colorScheme\n } = props;\n let {locale, direction} = useLocale();\n return (\n <Element\n {...filterDOMProps(props)}\n lang={locale}\n dir={direction}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(\n styles,\n providerStyles({background, colorScheme})\n )}>\n <Fonts />\n {children}\n </Element>\n );\n}\n"],"names":[],"version":3,"file":"Provider.cjs.map"}
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
--s2-color-scheme: light dark;
|
|
4
4
|
--s2-scale: 1;
|
|
5
5
|
--s2-font-size-base: 14;
|
|
6
|
+
--lightningcss-light: initial;
|
|
7
|
+
--lightningcss-dark: ;
|
|
8
|
+
|
|
9
|
+
@media (prefers-color-scheme: dark) {
|
|
10
|
+
--lightningcss-light: ;
|
|
11
|
+
--lightningcss-dark: initial;
|
|
12
|
+
}
|
|
6
13
|
|
|
7
14
|
@media not ((hover: hover) and (pointer: fine)) {
|
|
8
15
|
--s2-scale: 1.25;
|
|
@@ -26,6 +33,22 @@
|
|
|
26
33
|
color-scheme: var(--s2-color-scheme);
|
|
27
34
|
}
|
|
28
35
|
|
|
36
|
+
.-NvXmrd-_ZN8Gi4c13 {
|
|
37
|
+
--lightningcss-light: initial;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.-NvXmrd-_ZLmU13 {
|
|
41
|
+
--lightningcss-light: ;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.-j9blY-_ZLmU13 {
|
|
45
|
+
--lightningcss-dark: ;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.-j9blY-_ZN8Gi4c13 {
|
|
49
|
+
--lightningcss-dark: initial;
|
|
50
|
+
}
|
|
51
|
+
|
|
29
52
|
.-Ovbhqd-gX13 {
|
|
30
53
|
--s2-container-bg: light-dark(#fff, #111);
|
|
31
54
|
}
|
|
@@ -48,4 +71,18 @@
|
|
|
48
71
|
isolation: isolate;
|
|
49
72
|
}
|
|
50
73
|
}
|
|
74
|
+
|
|
75
|
+
@layer _.b;
|
|
76
|
+
|
|
77
|
+
@layer _.b.D1v0V {
|
|
78
|
+
@media (prefers-color-scheme: dark) {
|
|
79
|
+
.-NvXmrd-D1v0V_ZLmU13 {
|
|
80
|
+
--lightningcss-light: ;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.-j9blY-D1v0V_ZN8Gi4c13 {
|
|
84
|
+
--lightningcss-dark: initial;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
51
88
|
/*# sourceMappingURL=Provider.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACkFA;EAAA
|
|
1
|
+
{"mappings":"ACkFA;EAAA;;;;;;;IAAA;MAAA;;;;IAAA;MAAA;;;;;EAEqB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;AAAA;;AAAA;EAAA;IAAA;;;;IAAA","sources":["4752c64624f60d5a","packages/@react-spectrum/s2/src/Provider.tsx"],"sourcesContent":["@import \"60fcf4ad83e6776f\";\n@import \"ac1adcd813d529e0\";\n","/*\n * Copyright 2024 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 {createContext, JSX, ReactNode, useContext} from 'react';\nimport {DOMProps, Href, RouterOptions} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {Fonts} from './Fonts';\nimport {generateDefaultColorSchemeStyles} from './page.macro' with {type: 'macro'};\nimport {I18nProvider, useLocale} from 'react-aria/I18nProvider';\nimport {mergeStyles} from '../style/runtime';\nimport {RouterProvider} from 'react-aria/private/utils/openLink';\nimport {setColorScheme, style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils' with {type: 'macro'};\n\nexport type ColorScheme = 'light' | 'dark';\ninterface Router {\n navigate: (path: string, routerOptions: RouterOptions | undefined) => void,\n useHref?: (href: Href) => string\n}\n\nexport interface ProviderProps extends UnsafeStyles, DOMProps {\n /** The content of the Provider. */\n children: ReactNode,\n /**\n * The locale for your application as a [BCP 47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code.\n * Defaults to the browser/OS language setting.\n * @default 'en-US'\n */\n locale?: string,\n /**\n * Provides a client side router to all nested React Spectrum links to enable client side navigation.\n */\n router?: Router,\n /**\n * The color scheme for your application.\n * Defaults to operating system preferences.\n */\n colorScheme?: ColorScheme,\n /** The background for this provider. If not provided, the background is transparent. */\n background?: 'base' | 'layer-1' | 'layer-2',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /**\n * The DOM element to render.\n * @default div\n */\n elementType?: keyof JSX.IntrinsicElements\n}\n\nexport const ColorSchemeContext = createContext<ColorScheme | 'light dark' | null>(null);\n\n/**\n * Provider is the container for all React Spectrum components.\n * It loads the font and sets the colorScheme, locale, and other application level settings.\n */\nexport function Provider(props: ProviderProps): JSX.Element {\n let result = <ProviderInner {...props} />;\n let parentColorScheme = useContext(ColorSchemeContext);\n let colorScheme = props.colorScheme || parentColorScheme;\n result = <ColorSchemeContext.Provider value={colorScheme}>{result}</ColorSchemeContext.Provider>;\n\n if (props.locale) {\n result = <I18nProvider locale={props.locale}>{result}</I18nProvider>;\n }\n\n if (props.router) {\n result = <RouterProvider {...props.router}>{result}</RouterProvider>;\n }\n\n return result;\n}\n\ngenerateDefaultColorSchemeStyles();\n\nlet providerStyles = style({\n ...setColorScheme(),\n '--s2-container-bg': {\n type: 'backgroundColor',\n value: {\n background: {\n base: 'base',\n 'layer-1': 'layer-1',\n 'layer-2': 'layer-2'\n }\n }\n },\n backgroundColor: {\n // Don't set a background unless one is requested.\n background: {\n base: '--s2-container-bg',\n 'layer-1': '--s2-container-bg',\n 'layer-2': '--s2-container-bg'\n }\n },\n isolation: 'isolate'\n});\n\nfunction ProviderInner(props: ProviderProps) {\n let {\n elementType: Element = 'div',\n UNSAFE_style,\n UNSAFE_className = '',\n styles,\n children,\n // Set a default background if the provider is rendered as the root <html> element.\n background = Element === 'html' ? 'base' : undefined,\n colorScheme\n } = props;\n let {locale, direction} = useLocale();\n return (\n <Element\n {...filterDOMProps(props)}\n lang={locale}\n dir={direction}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(\n styles,\n providerStyles({background, colorScheme})\n )}>\n <Fonts />\n {children}\n </Element>\n );\n}\n"],"names":[],"version":3,"file":"Provider.css.map"}
|