@react-spectrum/utils 3.11.7 → 3.11.9

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/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React, { ReactNode, CSSProperties, HTMLAttributes, JSXElementConstructor, ReactElement, RefObject } from "react";
2
- import { ColorVersion, DimensionValue, Direction, Responsive, StyleProps, ViewStyleProps, DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue } from "@react-types/shared";
1
+ import React, { ReactNode, CSSProperties, HTMLAttributes, JSXElementConstructor, ReactElement } from "react";
2
+ import { ColorVersion, DimensionValue, Direction, Responsive, StyleProps, ViewStyleProps, DOMRef, DOMRefValue, FocusableElement, FocusableRef, FocusableRefValue, RefObject } from "@react-types/shared";
3
3
  interface Breakpoints {
4
4
  S?: number;
5
5
  M?: number;
@@ -42,19 +42,19 @@ export function classNames(cssModule: {
42
42
  }, ...values: Array<string | Object | undefined>): string;
43
43
  export function getWrappedElement(children: string | ReactElement | ReactNode): ReactElement<any, JSXElementConstructor<any>>;
44
44
  export function useMediaQuery(query: string): boolean;
45
- export function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T>): DOMRefValue<T>;
46
- export function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef: RefObject<T>, focusableRef?: RefObject<FocusableElement>): FocusableRefValue<T>;
47
- export function useDOMRef<T extends HTMLElement = HTMLElement>(ref: DOMRef<T>): RefObject<T>;
48
- export function useFocusableRef<T extends HTMLElement = HTMLElement>(ref: FocusableRef<T>, focusableRef?: RefObject<FocusableElement>): RefObject<T>;
49
- export function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T>>): RefObject<T>;
50
- export function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T>>): RefObject<T>;
45
+ export function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>): DOMRefValue<T>;
46
+ export function createFocusableRef<T extends HTMLElement = HTMLElement>(domRef: RefObject<T | null>, focusableRef?: RefObject<FocusableElement | null>): FocusableRefValue<T>;
47
+ export function useDOMRef<T extends HTMLElement = HTMLElement>(ref: DOMRef<T>): RefObject<T | null>;
48
+ export function useFocusableRef<T extends HTMLElement = HTMLElement>(ref: FocusableRef<T>, focusableRef?: RefObject<FocusableElement | null>): RefObject<T | null>;
49
+ export function unwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T> | null>): RefObject<T | null>;
50
+ export function useUnwrapDOMRef<T extends HTMLElement>(ref: RefObject<DOMRefValue<T> | null>): RefObject<T | null>;
51
51
  export function useSlotProps<T>(props: T & {
52
52
  id?: string;
53
53
  }, defaultSlot?: string): T;
54
54
  export function cssModuleToSlots(cssModule: any): {};
55
55
  export function SlotProvider(props: any): React.JSX.Element;
56
56
  export function ClearSlots(props: any): React.JSX.Element;
57
- export function useHasChild(query: string, ref: RefObject<HTMLElement>): boolean;
57
+ export function useHasChild(query: string, ref: RefObject<HTMLElement | null>): boolean;
58
58
  export function useIsMobileDevice(): boolean;
59
59
  export { useValueEffect } from '@react-aria/utils';
60
60
  export { useResizeObserver } from '@react-aria/utils';
@@ -1 +1 @@
1
- {"mappings":";;AAGA;IACE,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;IACE,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAKD;IACE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,mCAAmC,KAAK,EAAE,uBAAuB,qBAWhE;AAED,sCAAsC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CAoDxE;AAED,iCAAiC,iBAAiB,CAEjD;AC1ED,kBAAkB,MAAM,GAAG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D,qCAAqC,OAAO,CAO3C;ACSD,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useIsMobileDevice.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport type {StyleHandlers} from './styleProps';\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from './classNames';\nexport {getWrappedElement} from './getWrappedElement';\nexport {useMediaQuery} from './useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from './useDOMRef';\nexport {\n baseStyleProps,\n viewStyleProps,\n dimensionValue,\n responsiveDimensionValue,\n convertStyleProps,\n useStyleProps,\n passthroughStyle,\n getResponsiveProp\n} from './styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';\nexport {useHasChild} from './useHasChild';\nexport {useIsMobileDevice} from './useIsMobileDevice';\nexport {useValueEffect} from '@react-aria/utils';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';\nexport {useResizeObserver} from '@react-aria/utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAGA;IACE,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;IACE,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAKD;IACE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,mCAAmC,KAAK,EAAE,uBAAuB,qBAWhE;AAED,sCAAsC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CAoDxE;AAED,iCAAiC,iBAAiB,CAEjD;AC1ED,kBAAkB,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC;AACpD,iBAAiB,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAAC,CAAC;AAClE,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAClE;IACE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;CACzC;AAED,OAAO,MAAM,gBAAgB,aAuC5B,CAAC;AAEF,OAAO,MAAM,gBAAgB,aAwC5B,CAA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,gBAAgB,GAAG,IAAI,CAAU,GAAG,kBAAkB,CAAC,CAAC,CASpL;AAED,0BAA0B,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAIlG;AAED,gCAAgC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAIjK;AAED,6BAA6B,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAM9G;AAED,gCAAgC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAElH;ACnCD,6BAA6B,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAKjF;AAED,iCAAiC,SAAS,KAAA,MAKzC;AAED,6BAA6B,KAAK,KAAA,qBAmBjC;AAED,2BAA2B,KAAK,KAAA,qBAa/B;ACrDD,4BAA4B,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,WAM5E;ACND,qCAAqC,OAAO,CAO3C;ACSD,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useIsMobileDevice.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport type {StyleHandlers} from './styleProps';\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from './classNames';\nexport {getWrappedElement} from './getWrappedElement';\nexport {useMediaQuery} from './useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from './useDOMRef';\nexport {\n baseStyleProps,\n viewStyleProps,\n dimensionValue,\n responsiveDimensionValue,\n convertStyleProps,\n useStyleProps,\n passthroughStyle,\n getResponsiveProp\n} from './styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';\nexport {useHasChild} from './useHasChild';\nexport {useIsMobileDevice} from './useIsMobileDevice';\nexport {useValueEffect} from '@react-aria/utils';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';\nexport {useResizeObserver} from '@react-aria/utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1 +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,mBAAK,EAAK;IACvB,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAM,0CAAa;IAC5C,OAAO;AACT;AAEO,SAAS,0CAAqD,GAAoB,EAAE,YAA0C;IACnI,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAK;IACvB,CAAA,GAAA,gCAAkB,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,oBAAM,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.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAAkD,GAAwB;IACxF,OAAO;QACL;YACE,OAAO,IAAI,OAAO;QACpB;IACF;AACF;AAEO,SAAS,0CAAwD,MAA2B,EAAE,eAAmD,MAAM;IAC5J,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,mBAAK,EAAK;IACvB,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAM,0CAAa;IAC5C,OAAO;AACT;AAEO,SAAS,0CAAqD,GAAoB,EAAE,YAAiD;IAC1I,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAK;IACvB,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAM,0CAAmB,QAAQ;IAC1D,OAAO;AACT;AAEO,SAAS,0CAAoC,GAAqC;IACvF,OAAO;QACL,IAAI,WAAU;YACZ,OAAO,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,iBAAiB;QACrD;IACF;AACF;AAEO,SAAS,0CAAuC,GAAqC;IAC1F,OAAO,CAAA,GAAA,oBAAM,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, RefObject} from '@react-types/shared';\nimport {useImperativeHandle, useMemo, useRef} from 'react';\n\nexport function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>): 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 | null>, focusableRef: RefObject<FocusableElement | null> = 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 | null> {\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 | null>): RefObject<T | null> {\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> | null>): RefObject<T | null> {\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> | null>) : RefObject<T | null> {\n return useMemo(() => unwrapDOMRef(ref), [ref]);\n}\n"],"names":[],"version":3,"file":"useDOMRef.main.js.map"}
@@ -1 +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"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAKM,SAAS,0CAAkD,GAAwB;IACxF,OAAO;QACL;YACE,OAAO,IAAI,OAAO;QACpB;IACF;AACF;AAEO,SAAS,0CAAwD,MAA2B,EAAE,eAAmD,MAAM;IAC5J,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,YAAiD;IAC1I,IAAI,SAAS,CAAA,GAAA,aAAK,EAAK;IACvB,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,0CAAmB,QAAQ;IAC1D,OAAO;AACT;AAEO,SAAS,0CAAoC,GAAqC;IACvF,OAAO;QACL,IAAI,WAAU;YACZ,OAAO,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC,iBAAiB;QACrD;IACF;AACF;AAEO,SAAS,0CAAuC,GAAqC;IAC1F,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, RefObject} from '@react-types/shared';\nimport {useImperativeHandle, useMemo, useRef} from 'react';\n\nexport function createDOMRef<T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>): 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 | null>, focusableRef: RefObject<FocusableElement | null> = 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 | null> {\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 | null>): RefObject<T | null> {\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> | null>): RefObject<T | null> {\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> | null>) : RefObject<T | null> {\n return useMemo(() => unwrapDOMRef(ref), [ref]);\n}\n"],"names":[],"version":3,"file":"useDOMRef.module.js.map"}
@@ -1,5 +1,5 @@
1
- var $egdoP$react = require("react");
2
1
  var $egdoP$reactariautils = require("@react-aria/utils");
2
+ var $egdoP$react = require("react");
3
3
 
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
@@ -1 +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"}
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"}
@@ -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.
@@ -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.
@@ -1 +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"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/utils",
3
- "version": "3.11.7",
3
+ "version": "3.11.9",
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.11.1",
28
- "@react-aria/ssr": "^3.9.4",
29
- "@react-aria/utils": "^3.24.1",
30
- "@react-types/shared": "^3.23.1",
27
+ "@react-aria/i18n": "^3.12.1",
28
+ "@react-aria/ssr": "^3.9.5",
29
+ "@react-aria/utils": "^3.25.1",
30
+ "@react-types/shared": "^3.24.1",
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": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
40
+ "gitHead": "f0aa6aacee60af265dc8994b9274ccf072a850aa"
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 {RefObject, useImperativeHandle, useMemo, useRef} from 'react';
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>>): RefObject<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>>) : RefObject<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
  }
@@ -10,10 +10,11 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {RefObject, useState} from 'react';
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)));