@react-spectrum/utils 3.11.4 → 3.11.6

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.
Files changed (53) hide show
  1. package/dist/BreakpointProvider.main.js +75 -0
  2. package/dist/BreakpointProvider.main.js.map +1 -0
  3. package/dist/BreakpointProvider.mjs +64 -0
  4. package/dist/BreakpointProvider.module.js +64 -0
  5. package/dist/BreakpointProvider.module.js.map +1 -0
  6. package/dist/Slots.main.js +73 -0
  7. package/dist/Slots.main.js.map +1 -0
  8. package/dist/Slots.mjs +61 -0
  9. package/dist/Slots.module.js +61 -0
  10. package/dist/Slots.module.js.map +1 -0
  11. package/dist/classNames.main.js +50 -0
  12. package/dist/classNames.main.js.map +1 -0
  13. package/dist/classNames.mjs +39 -0
  14. package/dist/classNames.module.js +39 -0
  15. package/dist/classNames.module.js.map +1 -0
  16. package/dist/getWrappedElement.main.js +32 -0
  17. package/dist/getWrappedElement.main.js.map +1 -0
  18. package/dist/getWrappedElement.mjs +23 -0
  19. package/dist/getWrappedElement.module.js +23 -0
  20. package/dist/getWrappedElement.module.js.map +1 -0
  21. package/dist/import.mjs +10 -742
  22. package/dist/main.js +37 -773
  23. package/dist/main.js.map +1 -1
  24. package/dist/module.js +10 -742
  25. package/dist/module.js.map +1 -1
  26. package/dist/styleProps.main.js +468 -0
  27. package/dist/styleProps.main.js.map +1 -0
  28. package/dist/styleProps.mjs +456 -0
  29. package/dist/styleProps.module.js +456 -0
  30. package/dist/styleProps.module.js.map +1 -0
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/useDOMRef.main.js +64 -0
  33. package/dist/useDOMRef.main.js.map +1 -0
  34. package/dist/useDOMRef.mjs +54 -0
  35. package/dist/useDOMRef.module.js +54 -0
  36. package/dist/useDOMRef.module.js.map +1 -0
  37. package/dist/useHasChild.main.js +35 -0
  38. package/dist/useHasChild.main.js.map +1 -0
  39. package/dist/useHasChild.mjs +30 -0
  40. package/dist/useHasChild.module.js +30 -0
  41. package/dist/useHasChild.module.js.map +1 -0
  42. package/dist/useIsMobileDevice.main.js +28 -0
  43. package/dist/useIsMobileDevice.main.js.map +1 -0
  44. package/dist/useIsMobileDevice.mjs +23 -0
  45. package/dist/useIsMobileDevice.module.js +23 -0
  46. package/dist/useIsMobileDevice.module.js.map +1 -0
  47. package/dist/useMediaQuery.main.js +46 -0
  48. package/dist/useMediaQuery.main.js.map +1 -0
  49. package/dist/useMediaQuery.mjs +41 -0
  50. package/dist/useMediaQuery.module.js +41 -0
  51. package/dist/useMediaQuery.module.js.map +1 -0
  52. package/package.json +6 -6
  53. package/src/styleProps.ts +16 -0
@@ -0,0 +1,54 @@
1
+ import {useRef as $39jWF$useRef, useImperativeHandle as $39jWF$useImperativeHandle, useMemo as $39jWF$useMemo} from "react";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $98e5a8ae0e6415af$export$a5795cc979dfae80(ref) {
15
+ return {
16
+ UNSAFE_getDOMNode () {
17
+ return ref.current;
18
+ }
19
+ };
20
+ }
21
+ function $98e5a8ae0e6415af$export$79d69eee6ae4b329(domRef, focusableRef = domRef) {
22
+ return {
23
+ ...$98e5a8ae0e6415af$export$a5795cc979dfae80(domRef),
24
+ focus () {
25
+ if (focusableRef.current) focusableRef.current.focus();
26
+ }
27
+ };
28
+ }
29
+ function $98e5a8ae0e6415af$export$c2c55ef9111cafd8(ref) {
30
+ let domRef = (0, $39jWF$useRef)(null);
31
+ (0, $39jWF$useImperativeHandle)(ref, ()=>$98e5a8ae0e6415af$export$a5795cc979dfae80(domRef));
32
+ return domRef;
33
+ }
34
+ function $98e5a8ae0e6415af$export$96a734597687c040(ref, focusableRef) {
35
+ let domRef = (0, $39jWF$useRef)(null);
36
+ (0, $39jWF$useImperativeHandle)(ref, ()=>$98e5a8ae0e6415af$export$79d69eee6ae4b329(domRef, focusableRef));
37
+ return domRef;
38
+ }
39
+ function $98e5a8ae0e6415af$export$c7e28c72a4823176(ref) {
40
+ return {
41
+ get current () {
42
+ return ref.current && ref.current.UNSAFE_getDOMNode();
43
+ }
44
+ };
45
+ }
46
+ function $98e5a8ae0e6415af$export$1d5cc31d9d8df817(ref) {
47
+ return (0, $39jWF$useMemo)(()=>$98e5a8ae0e6415af$export$c7e28c72a4823176(ref), [
48
+ ref
49
+ ]);
50
+ }
51
+
52
+
53
+ export {$98e5a8ae0e6415af$export$a5795cc979dfae80 as createDOMRef, $98e5a8ae0e6415af$export$79d69eee6ae4b329 as createFocusableRef, $98e5a8ae0e6415af$export$c2c55ef9111cafd8 as useDOMRef, $98e5a8ae0e6415af$export$96a734597687c040 as useFocusableRef, $98e5a8ae0e6415af$export$c7e28c72a4823176 as unwrapDOMRef, $98e5a8ae0e6415af$export$1d5cc31d9d8df817 as useUnwrapDOMRef};
54
+ //# sourceMappingURL=useDOMRef.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAAkD,GAAiB;IACjF,OAAO;QACL;YACE,OAAO,IAAI,OAAO;QACpB;IACF;AACF;AAEO,SAAS,0CAAwD,MAAoB,EAAE,eAA4C,MAAM;IAC9I,OAAO;QACL,GAAG,0CAAa,OAAO;QACvB;YACE,IAAI,aAAa,OAAO,EACtB,aAAa,OAAO,CAAC,KAAK;QAE9B;IACF;AACF;AAEO,SAAS,0CAA+C,GAAc;IAC3E,IAAI,SAAS,CAAA,GAAA,aAAK,EAAK;IACvB,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,0CAAa;IAC5C,OAAO;AACT;AAEO,SAAS,0CAAqD,GAAoB,EAAE,YAA0C;IACnI,IAAI,SAAS,CAAA,GAAA,aAAK,EAAK;IACvB,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,0CAAmB,QAAQ;IAC1D,OAAO;AACT;AAEO,SAAS,0CAAoC,GAA8B;IAChF,OAAO;QACL,IAAI,WAAU;YACZ,OAAO,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,iBAAiB;QACrD;IACF;AACF;AAEO,SAAS,0CAAuC,GAA8B;IACnF,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,0CAAa,MAAM;QAAC;KAAI;AAC/C","sources":["packages/@react-spectrum/utils/src/useDOMRef.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {RefObject, useImperativeHandle, useMemo, useRef} from 'react';\n\nexport function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T>): DOMRefValue<T> {\n return {\n UNSAFE_getDOMNode() {\n return ref.current;\n }\n };\n}\n\nexport function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef: RefObject<T>, focusableRef: RefObject<FocusableElement> = domRef): FocusableRefValue<T> {\n return {\n ...createDOMRef(domRef),\n focus() {\n if (focusableRef.current) {\n focusableRef.current.focus();\n }\n }\n };\n}\n\nexport function useDOMRef<T extends HTMLElement = HTMLElement>(ref: DOMRef<T>): RefObject<T> {\n let domRef = useRef<T>(null);\n useImperativeHandle(ref, () => createDOMRef(domRef));\n return domRef;\n}\n\nexport function useFocusableRef<T extends HTMLElement = HTMLElement>(ref: FocusableRef<T>, focusableRef?: RefObject<FocusableElement>): RefObject<T> {\n let domRef = useRef<T>(null);\n useImperativeHandle(ref, () => createFocusableRef(domRef, focusableRef));\n return domRef;\n}\n\nexport function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T>>): RefObject<T> {\n return {\n get current() {\n return ref.current && ref.current.UNSAFE_getDOMNode();\n }\n };\n}\n\nexport function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T>>) : RefObject<T> {\n return useMemo(() => unwrapDOMRef(ref), [ref]);\n}\n"],"names":[],"version":3,"file":"useDOMRef.module.js.map"}
@@ -0,0 +1,35 @@
1
+ var $egdoP$react = require("react");
2
+ var $egdoP$reactariautils = require("@react-aria/utils");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useHasChild", () => $67043c48a01bef79$export$e52e2242b6d0f1d4);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ function $67043c48a01bef79$export$e52e2242b6d0f1d4(query, ref) {
23
+ let [hasChild, setHasChild] = (0, $egdoP$react.useState)(true);
24
+ (0, $egdoP$reactariautils.useLayoutEffect)(()=>{
25
+ setHasChild(!!(ref.current && ref.current.querySelector(query)));
26
+ }, [
27
+ setHasChild,
28
+ query,
29
+ ref
30
+ ]);
31
+ return hasChild;
32
+ }
33
+
34
+
35
+ //# sourceMappingURL=useHasChild.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,0CAAY,KAAa,EAAE,GAA2B;IACpE,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,CAAA,GAAA,qCAAc,EAAE;QACd,YAAY,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,MAAK;IAC/D,GAAG;QAAC;QAAa;QAAO;KAAI;IAC5B,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/useHasChild.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject, useState} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement>) {\n let [hasChild, setHasChild] = useState(true);\n useLayoutEffect(() => {\n setHasChild(!!(ref.current && ref.current.querySelector(query)));\n }, [setHasChild, query, ref]);\n return hasChild;\n}\n"],"names":[],"version":3,"file":"useHasChild.main.js.map"}
@@ -0,0 +1,30 @@
1
+ import {useState as $iRbeG$useState} from "react";
2
+ import {useLayoutEffect as $iRbeG$useLayoutEffect} from "@react-aria/utils";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $54cda195bd4173fb$export$e52e2242b6d0f1d4(query, ref) {
17
+ let [hasChild, setHasChild] = (0, $iRbeG$useState)(true);
18
+ (0, $iRbeG$useLayoutEffect)(()=>{
19
+ setHasChild(!!(ref.current && ref.current.querySelector(query)));
20
+ }, [
21
+ setHasChild,
22
+ query,
23
+ ref
24
+ ]);
25
+ return hasChild;
26
+ }
27
+
28
+
29
+ export {$54cda195bd4173fb$export$e52e2242b6d0f1d4 as useHasChild};
30
+ //# sourceMappingURL=useHasChild.mjs.map
@@ -0,0 +1,30 @@
1
+ import {useState as $iRbeG$useState} from "react";
2
+ import {useLayoutEffect as $iRbeG$useLayoutEffect} from "@react-aria/utils";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $54cda195bd4173fb$export$e52e2242b6d0f1d4(query, ref) {
17
+ let [hasChild, setHasChild] = (0, $iRbeG$useState)(true);
18
+ (0, $iRbeG$useLayoutEffect)(()=>{
19
+ setHasChild(!!(ref.current && ref.current.querySelector(query)));
20
+ }, [
21
+ setHasChild,
22
+ query,
23
+ ref
24
+ ]);
25
+ return hasChild;
26
+ }
27
+
28
+
29
+ export {$54cda195bd4173fb$export$e52e2242b6d0f1d4 as useHasChild};
30
+ //# sourceMappingURL=useHasChild.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,0CAAY,KAAa,EAAE,GAA2B;IACpE,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,CAAA,GAAA,sBAAc,EAAE;QACd,YAAY,CAAC,CAAE,CAAA,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,MAAK;IAC/D,GAAG;QAAC;QAAa;QAAO;KAAI;IAC5B,OAAO;AACT","sources":["packages/@react-spectrum/utils/src/useHasChild.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject, useState} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement>) {\n let [hasChild, setHasChild] = useState(true);\n useLayoutEffect(() => {\n setHasChild(!!(ref.current && ref.current.querySelector(query)));\n }, [setHasChild, query, ref]);\n return hasChild;\n}\n"],"names":[],"version":3,"file":"useHasChild.module.js.map"}
@@ -0,0 +1,28 @@
1
+ var $fkNaJ$reactariassr = require("@react-aria/ssr");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "useIsMobileDevice", () => $e9c08f6fb6c823d1$export$736bf165441b18c7);
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+ const $e9c08f6fb6c823d1$var$MOBILE_SCREEN_WIDTH = 700;
21
+ function $e9c08f6fb6c823d1$export$736bf165441b18c7() {
22
+ let isSSR = (0, $fkNaJ$reactariassr.useIsSSR)();
23
+ if (isSSR || typeof window === "undefined") return false;
24
+ return window.screen.width <= $e9c08f6fb6c823d1$var$MOBILE_SCREEN_WIDTH;
25
+ }
26
+
27
+
28
+ //# sourceMappingURL=useIsMobileDevice.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAID,MAAM,4CAAsB;AAErB,SAAS;IACd,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,IAAI,SAAS,OAAO,WAAW,aAC7B,OAAO;IAGT,OAAO,OAAO,MAAM,CAAC,KAAK,IAAI;AAChC","sources":["packages/@react-spectrum/utils/src/useIsMobileDevice.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useIsSSR} from '@react-aria/ssr';\n\nconst MOBILE_SCREEN_WIDTH = 700;\n\nexport function useIsMobileDevice(): boolean {\n let isSSR = useIsSSR();\n if (isSSR || typeof window === 'undefined') {\n return false;\n }\n\n return window.screen.width <= MOBILE_SCREEN_WIDTH;\n}\n"],"names":[],"version":3,"file":"useIsMobileDevice.main.js.map"}
@@ -0,0 +1,23 @@
1
+ import {useIsSSR as $hET1I$useIsSSR} from "@react-aria/ssr";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ const $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH = 700;
15
+ function $fdbe26a36ce1c672$export$736bf165441b18c7() {
16
+ let isSSR = (0, $hET1I$useIsSSR)();
17
+ if (isSSR || typeof window === "undefined") return false;
18
+ return window.screen.width <= $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH;
19
+ }
20
+
21
+
22
+ export {$fdbe26a36ce1c672$export$736bf165441b18c7 as useIsMobileDevice};
23
+ //# sourceMappingURL=useIsMobileDevice.mjs.map
@@ -0,0 +1,23 @@
1
+ import {useIsSSR as $hET1I$useIsSSR} from "@react-aria/ssr";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ const $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH = 700;
15
+ function $fdbe26a36ce1c672$export$736bf165441b18c7() {
16
+ let isSSR = (0, $hET1I$useIsSSR)();
17
+ if (isSSR || typeof window === "undefined") return false;
18
+ return window.screen.width <= $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH;
19
+ }
20
+
21
+
22
+ export {$fdbe26a36ce1c672$export$736bf165441b18c7 as useIsMobileDevice};
23
+ //# sourceMappingURL=useIsMobileDevice.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAID,MAAM,4CAAsB;AAErB,SAAS;IACd,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,IAAI,SAAS,OAAO,WAAW,aAC7B,OAAO;IAGT,OAAO,OAAO,MAAM,CAAC,KAAK,IAAI;AAChC","sources":["packages/@react-spectrum/utils/src/useIsMobileDevice.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useIsSSR} from '@react-aria/ssr';\n\nconst MOBILE_SCREEN_WIDTH = 700;\n\nexport function useIsMobileDevice(): boolean {\n let isSSR = useIsSSR();\n if (isSSR || typeof window === 'undefined') {\n return false;\n }\n\n return window.screen.width <= MOBILE_SCREEN_WIDTH;\n}\n"],"names":[],"version":3,"file":"useIsMobileDevice.module.js.map"}
@@ -0,0 +1,46 @@
1
+ var $6azN1$react = require("react");
2
+ var $6azN1$reactariassr = require("@react-aria/ssr");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useMediaQuery", () => $471052aafc9c8aac$export$32d5543ab307c01);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ function $471052aafc9c8aac$export$32d5543ab307c01(query) {
23
+ let supportsMatchMedia = typeof window !== "undefined" && typeof window.matchMedia === "function";
24
+ let [matches, setMatches] = (0, $6azN1$react.useState)(()=>supportsMatchMedia ? window.matchMedia(query).matches : false);
25
+ (0, $6azN1$react.useEffect)(()=>{
26
+ if (!supportsMatchMedia) return;
27
+ let mq = window.matchMedia(query);
28
+ let onChange = (evt)=>{
29
+ setMatches(evt.matches);
30
+ };
31
+ mq.addListener(onChange);
32
+ return ()=>{
33
+ mq.removeListener(onChange);
34
+ };
35
+ }, [
36
+ supportsMatchMedia,
37
+ query
38
+ ]);
39
+ // If in SSR, the media query should never match. Once the page hydrates,
40
+ // this will update and the real value will be returned.
41
+ let isSSR = (0, $6azN1$reactariassr.useIsSSR)();
42
+ return isSSR ? false : matches;
43
+ }
44
+
45
+
46
+ //# sourceMappingURL=useMediaQuery.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@react-spectrum/utils/src/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport function useMediaQuery(query: string) {\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let [matches, setMatches] = useState(() =>\n supportsMatchMedia\n ? window.matchMedia(query).matches\n : false\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let mq = window.matchMedia(query);\n let onChange = (evt) => {\n setMatches(evt.matches);\n };\n\n mq.addListener(onChange);\n return () => {\n mq.removeListener(onChange);\n };\n }, [supportsMatchMedia, query]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.main.js.map"}
@@ -0,0 +1,41 @@
1
+ import {useState as $8zXGn$useState, useEffect as $8zXGn$useEffect} from "react";
2
+ import {useIsSSR as $8zXGn$useIsSSR} from "@react-aria/ssr";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $3df547e395c4522f$export$32d5543ab307c01(query) {
17
+ let supportsMatchMedia = typeof window !== "undefined" && typeof window.matchMedia === "function";
18
+ let [matches, setMatches] = (0, $8zXGn$useState)(()=>supportsMatchMedia ? window.matchMedia(query).matches : false);
19
+ (0, $8zXGn$useEffect)(()=>{
20
+ if (!supportsMatchMedia) return;
21
+ let mq = window.matchMedia(query);
22
+ let onChange = (evt)=>{
23
+ setMatches(evt.matches);
24
+ };
25
+ mq.addListener(onChange);
26
+ return ()=>{
27
+ mq.removeListener(onChange);
28
+ };
29
+ }, [
30
+ supportsMatchMedia,
31
+ query
32
+ ]);
33
+ // If in SSR, the media query should never match. Once the page hydrates,
34
+ // this will update and the real value will be returned.
35
+ let isSSR = (0, $8zXGn$useIsSSR)();
36
+ return isSSR ? false : matches;
37
+ }
38
+
39
+
40
+ export {$3df547e395c4522f$export$32d5543ab307c01 as useMediaQuery};
41
+ //# sourceMappingURL=useMediaQuery.mjs.map
@@ -0,0 +1,41 @@
1
+ import {useState as $8zXGn$useState, useEffect as $8zXGn$useEffect} from "react";
2
+ import {useIsSSR as $8zXGn$useIsSSR} from "@react-aria/ssr";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $3df547e395c4522f$export$32d5543ab307c01(query) {
17
+ let supportsMatchMedia = typeof window !== "undefined" && typeof window.matchMedia === "function";
18
+ let [matches, setMatches] = (0, $8zXGn$useState)(()=>supportsMatchMedia ? window.matchMedia(query).matches : false);
19
+ (0, $8zXGn$useEffect)(()=>{
20
+ if (!supportsMatchMedia) return;
21
+ let mq = window.matchMedia(query);
22
+ let onChange = (evt)=>{
23
+ setMatches(evt.matches);
24
+ };
25
+ mq.addListener(onChange);
26
+ return ()=>{
27
+ mq.removeListener(onChange);
28
+ };
29
+ }, [
30
+ supportsMatchMedia,
31
+ query
32
+ ]);
33
+ // If in SSR, the media query should never match. Once the page hydrates,
34
+ // this will update and the real value will be returned.
35
+ let isSSR = (0, $8zXGn$useIsSSR)();
36
+ return isSSR ? false : matches;
37
+ }
38
+
39
+
40
+ export {$3df547e395c4522f$export$32d5543ab307c01 as useMediaQuery};
41
+ //# sourceMappingURL=useMediaQuery.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKM,SAAS,yCAAc,KAAa;IACzC,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE,IACnC,qBACI,OAAO,UAAU,CAAC,OAAO,OAAO,GAChC;IAGN,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,KAAK,OAAO,UAAU,CAAC;QAC3B,IAAI,WAAW,CAAC;YACd,WAAW,IAAI,OAAO;QACxB;QAEA,GAAG,WAAW,CAAC;QACf,OAAO;YACL,GAAG,cAAc,CAAC;QACpB;IACF,GAAG;QAAC;QAAoB;KAAM;IAE9B,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,OAAO,QAAQ,QAAQ;AACzB","sources":["packages/@react-spectrum/utils/src/useMediaQuery.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport function useMediaQuery(query: string) {\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let [matches, setMatches] = useState(() =>\n supportsMatchMedia\n ? window.matchMedia(query).matches\n : false\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let mq = window.matchMedia(query);\n let onChange = (evt) => {\n setMatches(evt.matches);\n };\n\n mq.addListener(onChange);\n return () => {\n mq.removeListener(onChange);\n };\n }, [supportsMatchMedia, query]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? false : matches;\n}\n"],"names":[],"version":3,"file":"useMediaQuery.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/utils",
3
- "version": "3.11.4",
3
+ "version": "3.11.6",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -24,10 +24,10 @@
24
24
  "url": "https://github.com/adobe/react-spectrum"
25
25
  },
26
26
  "dependencies": {
27
- "@react-aria/i18n": "^3.10.1",
28
- "@react-aria/ssr": "^3.9.1",
29
- "@react-aria/utils": "^3.23.1",
30
- "@react-types/shared": "^3.22.0",
27
+ "@react-aria/i18n": "^3.11.0",
28
+ "@react-aria/ssr": "^3.9.3",
29
+ "@react-aria/utils": "^3.24.0",
30
+ "@react-types/shared": "^3.23.0",
31
31
  "@swc/helpers": "^0.5.0",
32
32
  "clsx": "^2.0.0"
33
33
  },
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "f040ff62678e6a31375b96c05396df0bae660350"
40
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
41
41
  }
package/src/styleProps.ts CHANGED
@@ -128,6 +128,10 @@ export function dimensionValue(value: DimensionValue) {
128
128
  return value + 'px';
129
129
  }
130
130
 
131
+ if (!value) {
132
+ return undefined;
133
+ }
134
+
131
135
  if (UNIT_RE.test(value)) {
132
136
  return value;
133
137
  }
@@ -154,10 +158,18 @@ function colorValue(value: ColorValue, type: ColorType = 'default', version = 5)
154
158
  }
155
159
 
156
160
  function backgroundColorValue(value: BackgroundColorValue, version = 5) {
161
+ if (!value) {
162
+ return undefined;
163
+ }
164
+
157
165
  return `var(--spectrum-alias-background-color-${value}, ${colorValue(value as ColorValue, 'background', version)})`;
158
166
  }
159
167
 
160
168
  function borderColorValue(value: BorderColorValue, version = 5) {
169
+ if (!value) {
170
+ return undefined;
171
+ }
172
+
161
173
  if (value === 'default') {
162
174
  return 'var(--spectrum-alias-border-color)';
163
175
  }
@@ -172,6 +184,10 @@ function borderSizeValue(value?: BorderSizeValue | null) {
172
184
  }
173
185
 
174
186
  function borderRadiusValue(value: BorderRadiusValue) {
187
+ if (!value) {
188
+ return undefined;
189
+ }
190
+
175
191
  return `var(--spectrum-alias-border-radius-${value})`;
176
192
  }
177
193