@react-spectrum/utils 3.11.6 → 3.11.8
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/BreakpointProvider.main.js +7 -7
- package/dist/BreakpointProvider.mjs +8 -8
- package/dist/BreakpointProvider.module.js +7 -7
- package/dist/Slots.main.js +1 -1
- package/dist/Slots.mjs +2 -2
- package/dist/Slots.module.js +1 -1
- package/dist/classNames.main.js +2 -2
- package/dist/classNames.mjs +3 -3
- package/dist/classNames.module.js +2 -2
- package/dist/getWrappedElement.main.js +1 -1
- package/dist/getWrappedElement.mjs +2 -2
- package/dist/getWrappedElement.module.js +1 -1
- package/dist/styleProps.main.js +103 -103
- package/dist/styleProps.mjs +104 -104
- package/dist/styleProps.module.js +103 -103
- package/dist/types.d.ts +9 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/useDOMRef.main.js.map +1 -1
- package/dist/useDOMRef.mjs +1 -1
- package/dist/useDOMRef.module.js.map +1 -1
- package/dist/useHasChild.main.js +1 -1
- package/dist/useHasChild.main.js.map +1 -1
- package/dist/useHasChild.mjs +2 -2
- package/dist/useHasChild.module.js +1 -1
- package/dist/useHasChild.module.js.map +1 -1
- package/dist/useIsMobileDevice.main.js +1 -1
- package/dist/useIsMobileDevice.mjs +2 -2
- package/dist/useIsMobileDevice.module.js +1 -1
- package/dist/useMediaQuery.main.js +1 -1
- package/dist/useMediaQuery.mjs +2 -2
- package/dist/useMediaQuery.module.js +1 -1
- package/package.json +7 -7
- package/src/useDOMRef.ts +8 -8
- package/src/useHasChild.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAY,KAAa,EAAE,GAAkC;IAC3E,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} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement | null>) {\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"}
|
package/dist/useHasChild.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {useState as $iRbeG$useState} from "react";
|
|
2
1
|
import {useLayoutEffect as $iRbeG$useLayoutEffect} from "@react-aria/utils";
|
|
2
|
+
import {useState as $iRbeG$useState} from "react";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -27,4 +27,4 @@ function $54cda195bd4173fb$export$e52e2242b6d0f1d4(query, ref) {
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
export {$54cda195bd4173fb$export$e52e2242b6d0f1d4 as useHasChild};
|
|
30
|
-
//# sourceMappingURL=useHasChild.
|
|
30
|
+
//# sourceMappingURL=useHasChild.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAY,KAAa,EAAE,GAAkC;IAC3E,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} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\nexport function useHasChild(query: string, ref: RefObject<HTMLElement | null>) {\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"}
|
|
@@ -20,7 +20,7 @@ $parcel$export(module.exports, "useIsMobileDevice", () => $e9c08f6fb6c823d1$expo
|
|
|
20
20
|
const $e9c08f6fb6c823d1$var$MOBILE_SCREEN_WIDTH = 700;
|
|
21
21
|
function $e9c08f6fb6c823d1$export$736bf165441b18c7() {
|
|
22
22
|
let isSSR = (0, $fkNaJ$reactariassr.useIsSSR)();
|
|
23
|
-
if (isSSR || typeof window ===
|
|
23
|
+
if (isSSR || typeof window === 'undefined') return false;
|
|
24
24
|
return window.screen.width <= $e9c08f6fb6c823d1$var$MOBILE_SCREEN_WIDTH;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -14,10 +14,10 @@ import {useIsSSR as $hET1I$useIsSSR} from "@react-aria/ssr";
|
|
|
14
14
|
const $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH = 700;
|
|
15
15
|
function $fdbe26a36ce1c672$export$736bf165441b18c7() {
|
|
16
16
|
let isSSR = (0, $hET1I$useIsSSR)();
|
|
17
|
-
if (isSSR || typeof window ===
|
|
17
|
+
if (isSSR || typeof window === 'undefined') return false;
|
|
18
18
|
return window.screen.width <= $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
export {$fdbe26a36ce1c672$export$736bf165441b18c7 as useIsMobileDevice};
|
|
23
|
-
//# sourceMappingURL=useIsMobileDevice.
|
|
23
|
+
//# sourceMappingURL=useIsMobileDevice.module.js.map
|
|
@@ -14,7 +14,7 @@ import {useIsSSR as $hET1I$useIsSSR} from "@react-aria/ssr";
|
|
|
14
14
|
const $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH = 700;
|
|
15
15
|
function $fdbe26a36ce1c672$export$736bf165441b18c7() {
|
|
16
16
|
let isSSR = (0, $hET1I$useIsSSR)();
|
|
17
|
-
if (isSSR || typeof window ===
|
|
17
|
+
if (isSSR || typeof window === 'undefined') return false;
|
|
18
18
|
return window.screen.width <= $fdbe26a36ce1c672$var$MOBILE_SCREEN_WIDTH;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -20,7 +20,7 @@ $parcel$export(module.exports, "useMediaQuery", () => $471052aafc9c8aac$export$3
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
function $471052aafc9c8aac$export$32d5543ab307c01(query) {
|
|
23
|
-
let supportsMatchMedia = typeof window !==
|
|
23
|
+
let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
24
24
|
let [matches, setMatches] = (0, $6azN1$react.useState)(()=>supportsMatchMedia ? window.matchMedia(query).matches : false);
|
|
25
25
|
(0, $6azN1$react.useEffect)(()=>{
|
|
26
26
|
if (!supportsMatchMedia) return;
|
package/dist/useMediaQuery.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import {useIsSSR as $8zXGn$useIsSSR} from "@react-aria/ssr";
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
function $3df547e395c4522f$export$32d5543ab307c01(query) {
|
|
17
|
-
let supportsMatchMedia = typeof window !==
|
|
17
|
+
let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
18
18
|
let [matches, setMatches] = (0, $8zXGn$useState)(()=>supportsMatchMedia ? window.matchMedia(query).matches : false);
|
|
19
19
|
(0, $8zXGn$useEffect)(()=>{
|
|
20
20
|
if (!supportsMatchMedia) return;
|
|
@@ -38,4 +38,4 @@ function $3df547e395c4522f$export$32d5543ab307c01(query) {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
export {$3df547e395c4522f$export$32d5543ab307c01 as useMediaQuery};
|
|
41
|
-
//# sourceMappingURL=useMediaQuery.
|
|
41
|
+
//# sourceMappingURL=useMediaQuery.module.js.map
|
|
@@ -14,7 +14,7 @@ import {useIsSSR as $8zXGn$useIsSSR} from "@react-aria/ssr";
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
function $3df547e395c4522f$export$32d5543ab307c01(query) {
|
|
17
|
-
let supportsMatchMedia = typeof window !==
|
|
17
|
+
let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
18
18
|
let [matches, setMatches] = (0, $8zXGn$useState)(()=>supportsMatchMedia ? window.matchMedia(query).matches : false);
|
|
19
19
|
(0, $8zXGn$useEffect)(()=>{
|
|
20
20
|
if (!supportsMatchMedia) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/utils",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.8",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"url": "https://github.com/adobe/react-spectrum"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@react-aria/i18n": "^3.
|
|
28
|
-
"@react-aria/ssr": "^3.9.
|
|
29
|
-
"@react-aria/utils": "^3.
|
|
30
|
-
"@react-types/shared": "^3.
|
|
27
|
+
"@react-aria/i18n": "^3.12.0",
|
|
28
|
+
"@react-aria/ssr": "^3.9.5",
|
|
29
|
+
"@react-aria/utils": "^3.25.0",
|
|
30
|
+
"@react-types/shared": "^3.24.0",
|
|
31
31
|
"@swc/helpers": "^0.5.0",
|
|
32
32
|
"clsx": "^2.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
35
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206"
|
|
41
41
|
}
|
package/src/useDOMRef.ts
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue} from '@react-types/shared';
|
|
14
|
-
import {
|
|
13
|
+
import {DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue, RefObject} from '@react-types/shared';
|
|
14
|
+
import {useImperativeHandle, useMemo, useRef} from 'react';
|
|
15
15
|
|
|
16
|
-
export function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T>): DOMRefValue<T> {
|
|
16
|
+
export function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>): DOMRefValue<T> {
|
|
17
17
|
return {
|
|
18
18
|
UNSAFE_getDOMNode() {
|
|
19
19
|
return ref.current;
|
|
@@ -21,7 +21,7 @@ export function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef: RefObject<T>, focusableRef: RefObject<FocusableElement> = domRef): FocusableRefValue<T> {
|
|
24
|
+
export function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef: RefObject<T | null>, focusableRef: RefObject<FocusableElement | null> = domRef): FocusableRefValue<T> {
|
|
25
25
|
return {
|
|
26
26
|
...createDOMRef(domRef),
|
|
27
27
|
focus() {
|
|
@@ -32,19 +32,19 @@ export function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef:
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function useDOMRef<T extends HTMLElement = HTMLElement>(ref: DOMRef<T>): RefObject<T> {
|
|
35
|
+
export function useDOMRef<T extends HTMLElement = HTMLElement>(ref: DOMRef<T>): RefObject<T | null> {
|
|
36
36
|
let domRef = useRef<T>(null);
|
|
37
37
|
useImperativeHandle(ref, () => createDOMRef(domRef));
|
|
38
38
|
return domRef;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function useFocusableRef<T extends HTMLElement = HTMLElement>(ref: FocusableRef<T>, focusableRef?: RefObject<FocusableElement>): RefObject<T> {
|
|
41
|
+
export function useFocusableRef<T extends HTMLElement = HTMLElement>(ref: FocusableRef<T>, focusableRef?: RefObject<FocusableElement | null>): RefObject<T | null> {
|
|
42
42
|
let domRef = useRef<T>(null);
|
|
43
43
|
useImperativeHandle(ref, () => createFocusableRef(domRef, focusableRef));
|
|
44
44
|
return domRef;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T
|
|
47
|
+
export function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T> | null>): RefObject<T | null> {
|
|
48
48
|
return {
|
|
49
49
|
get current() {
|
|
50
50
|
return ref.current && ref.current.UNSAFE_getDOMNode();
|
|
@@ -52,6 +52,6 @@ export function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T
|
|
55
|
+
export function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T> | null>) : RefObject<T | null> {
|
|
56
56
|
return useMemo(() => unwrapDOMRef(ref), [ref]);
|
|
57
57
|
}
|
package/src/useHasChild.ts
CHANGED
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {RefObject
|
|
13
|
+
import {RefObject} from '@react-types/shared';
|
|
14
14
|
import {useLayoutEffect} from '@react-aria/utils';
|
|
15
|
+
import {useState} from 'react';
|
|
15
16
|
|
|
16
|
-
export function useHasChild(query: string, ref: RefObject<HTMLElement>) {
|
|
17
|
+
export function useHasChild(query: string, ref: RefObject<HTMLElement | null>) {
|
|
17
18
|
let [hasChild, setHasChild] = useState(true);
|
|
18
19
|
useLayoutEffect(() => {
|
|
19
20
|
setHasChild(!!(ref.current && ref.current.querySelector(query)));
|