@react-aria/utils 3.24.1 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +4 -2
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/mergeRefs.main.js +1 -1
- package/dist/mergeRefs.main.js.map +1 -1
- package/dist/mergeRefs.mjs +1 -1
- package/dist/mergeRefs.module.js +1 -1
- package/dist/mergeRefs.module.js.map +1 -1
- package/dist/module.js +4 -2
- package/dist/module.js.map +1 -1
- package/dist/openLink.main.js +4 -3
- package/dist/openLink.main.js.map +1 -1
- package/dist/openLink.mjs +4 -3
- package/dist/openLink.module.js +4 -3
- package/dist/openLink.module.js.map +1 -1
- package/dist/platform.main.js +25 -18
- package/dist/platform.main.js.map +1 -1
- package/dist/platform.mjs +25 -18
- package/dist/platform.module.js +25 -18
- package/dist/platform.module.js.map +1 -1
- package/dist/types.d.ts +35 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/useEvent.main.js.map +1 -1
- package/dist/useEvent.module.js.map +1 -1
- package/dist/useFormReset.main.js.map +1 -1
- package/dist/useFormReset.module.js.map +1 -1
- package/dist/useLoadMore.main.js +72 -0
- package/dist/useLoadMore.main.js.map +1 -0
- package/dist/useLoadMore.mjs +67 -0
- package/dist/useLoadMore.module.js +67 -0
- package/dist/useLoadMore.module.js.map +1 -0
- package/dist/useResizeObserver.main.js +6 -3
- package/dist/useResizeObserver.main.js.map +1 -1
- package/dist/useResizeObserver.mjs +6 -3
- package/dist/useResizeObserver.module.js +6 -3
- package/dist/useResizeObserver.module.js.map +1 -1
- package/dist/useSyncRef.main.js.map +1 -1
- package/dist/useSyncRef.module.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +2 -1
- package/src/mergeRefs.ts +2 -2
- package/src/openLink.tsx +3 -2
- package/src/platform.ts +32 -18
- package/src/useEvent.ts +4 -3
- package/src/useFormReset.ts +4 -2
- package/src/useLoadMore.ts +82 -0
- package/src/useResizeObserver.ts +8 -5
- package/src/useSyncRef.ts +3 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { ForwardedRef, MutableRefObject, ReactNode, HTMLAttributes, EffectCallback,
|
|
2
|
-
import { AriaLabelingProps, DOMProps, LinkDOMProps, FocusableElement, Href, RouterOptions, Orientation } from "@react-types/shared";
|
|
1
|
+
import React, { ForwardedRef, MutableRefObject, ReactNode, HTMLAttributes, EffectCallback, Dispatch, RefObject as _RefObject1 } from "react";
|
|
2
|
+
import { AriaLabelingProps, DOMProps, LinkDOMProps, FocusableElement, Href, RouterOptions, Orientation, RefObject } from "@react-types/shared";
|
|
3
3
|
export const useLayoutEffect: typeof React.useLayoutEffect;
|
|
4
4
|
/**
|
|
5
5
|
* If a default is not provided, generate an id.
|
|
@@ -45,7 +45,7 @@ export function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersectio
|
|
|
45
45
|
/**
|
|
46
46
|
* Merges multiple refs into one. Works with either callback or object refs.
|
|
47
47
|
*/
|
|
48
|
-
export function mergeRefs<T>(...refs: Array<ForwardedRef<T> | MutableRefObject<T
|
|
48
|
+
export function mergeRefs<T>(...refs: Array<ForwardedRef<T> | MutableRefObject<T> | null | undefined>): ForwardedRef<T>;
|
|
49
49
|
interface Options {
|
|
50
50
|
/**
|
|
51
51
|
* If labelling associated aria properties should be included in the filter.
|
|
@@ -66,15 +66,15 @@ interface Options {
|
|
|
66
66
|
export function filterDOMProps(props: DOMProps & AriaLabelingProps & LinkDOMProps, opts?: Options): DOMProps & AriaLabelingProps;
|
|
67
67
|
export function focusWithoutScrolling(element: FocusableElement): void;
|
|
68
68
|
export function getOffset(element: any, reverse: any, orientation?: string): any;
|
|
69
|
-
export
|
|
70
|
-
export
|
|
71
|
-
export
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export
|
|
75
|
-
export
|
|
76
|
-
export
|
|
77
|
-
export
|
|
69
|
+
export const isMac: () => boolean;
|
|
70
|
+
export const isIPhone: () => boolean;
|
|
71
|
+
export const isIPad: () => boolean;
|
|
72
|
+
export const isIOS: () => boolean;
|
|
73
|
+
export const isAppleDevice: () => boolean;
|
|
74
|
+
export const isWebKit: () => boolean;
|
|
75
|
+
export const isChrome: () => boolean;
|
|
76
|
+
export const isAndroid: () => boolean;
|
|
77
|
+
export const isFirefox: () => boolean;
|
|
78
78
|
interface Router {
|
|
79
79
|
isNative: boolean;
|
|
80
80
|
open: (target: Element, modifiers: Modifiers, href: Href, routerOptions: RouterOptions | undefined) => void;
|
|
@@ -99,7 +99,7 @@ interface Modifiers {
|
|
|
99
99
|
}
|
|
100
100
|
export function shouldClientNavigate(link: HTMLAnchorElement, modifiers: Modifiers): boolean;
|
|
101
101
|
export function openLink(target: HTMLAnchorElement, modifiers: Modifiers, setOpening?: boolean): void;
|
|
102
|
-
export function
|
|
102
|
+
export function useSyntheticLinkProps(props: LinkDOMProps): {
|
|
103
103
|
'data-href': string;
|
|
104
104
|
'data-target': React.HTMLAttributeAnchorTarget;
|
|
105
105
|
'data-rel': string;
|
|
@@ -156,14 +156,15 @@ export function useLabels(props: DOMProps & AriaLabelingProps, defaultLabel?: st
|
|
|
156
156
|
export function useObjectRef<T>(forwardedRef?: ((instance: T | null) => void) | MutableRefObject<T | null> | null): MutableRefObject<T | null>;
|
|
157
157
|
export function useUpdateEffect(effect: EffectCallback, dependencies: any[]): void;
|
|
158
158
|
type useResizeObserverOptionsType<T> = {
|
|
159
|
-
ref: RefObject<T | undefined> | undefined;
|
|
159
|
+
ref: RefObject<T | undefined | null> | undefined;
|
|
160
|
+
box?: ResizeObserverBoxOptions;
|
|
160
161
|
onResize: () => void;
|
|
161
162
|
};
|
|
162
163
|
export function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>): void;
|
|
163
164
|
interface ContextValue<T> {
|
|
164
165
|
ref?: MutableRefObject<T | null>;
|
|
165
166
|
}
|
|
166
|
-
export function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T>): void;
|
|
167
|
+
export function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>): void;
|
|
167
168
|
export function isScrollable(node: Element, checkForOverflow?: boolean): boolean;
|
|
168
169
|
export function getScrollParent(node: Element, checkForOverflow?: boolean): Element;
|
|
169
170
|
export function getScrollParents(node: Element, checkForOverflow?: boolean): Element[];
|
|
@@ -174,7 +175,7 @@ interface ViewportSize {
|
|
|
174
175
|
export function useViewportSize(): ViewportSize;
|
|
175
176
|
export function useDescription(description?: string): AriaLabelingProps;
|
|
176
177
|
export function useEffectEvent<T extends Function>(fn?: T): T;
|
|
177
|
-
export function useEvent<K extends keyof GlobalEventHandlersEventMap>(ref: RefObject<EventTarget>, event: K, handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
178
|
+
export function useEvent<K extends keyof GlobalEventHandlersEventMap>(ref: RefObject<EventTarget | null>, event: K | (string & {}), handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
178
179
|
type SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;
|
|
179
180
|
export function useValueEffect<S>(defaultValue: S | (() => S)): [S, Dispatch<SetValueAction<S>>];
|
|
180
181
|
interface ScrollIntoViewportOpts {
|
|
@@ -196,7 +197,24 @@ export function scrollIntoViewport(targetElement: Element, opts?: ScrollIntoView
|
|
|
196
197
|
export function isVirtualClick(event: MouseEvent | PointerEvent): boolean;
|
|
197
198
|
export function isVirtualPointerEvent(event: PointerEvent): boolean;
|
|
198
199
|
export function useDeepMemo<T>(value: T, isEqual: (a: T, b: T) => boolean): T;
|
|
199
|
-
export function useFormReset<T>(ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>, initialValue: T, onReset: (value: T) => void): void;
|
|
200
|
+
export function useFormReset<T>(ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null>, initialValue: T, onReset: (value: T) => void): void;
|
|
201
|
+
interface LoadMoreProps {
|
|
202
|
+
/** Whether data is currently being loaded. */
|
|
203
|
+
isLoading?: boolean;
|
|
204
|
+
/** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */
|
|
205
|
+
onLoadMore?: () => void;
|
|
206
|
+
/**
|
|
207
|
+
* The amount of offset from the bottom of your scrollable region that should trigger load more.
|
|
208
|
+
* Uses a percentage value relative to the scroll body's client height. Load more is then triggered
|
|
209
|
+
* when your current scroll position's distance from the bottom of the currently loaded list of items is less than
|
|
210
|
+
* or equal to the provided value. (e.g. 1 = 100% of the scroll region's height).
|
|
211
|
+
* @default 1
|
|
212
|
+
*/
|
|
213
|
+
scrollOffset?: number;
|
|
214
|
+
/** The data currently loaded. */
|
|
215
|
+
items?: any[];
|
|
216
|
+
}
|
|
217
|
+
export function useLoadMore(props: LoadMoreProps, ref: _RefObject1<HTMLElement | null>): void;
|
|
200
218
|
export { clamp, snapValueToStep } from '@react-stately/utils';
|
|
201
219
|
|
|
202
220
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAiBA,OAAO,MAAM,6CAED,CAAC;ACOb;;;GAGG;AACH,sBAAsB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAgChD;AAED;;;GAGG;AACH,yBAAyB,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBzD;AAED;;;;GAIG;AACH,0BAA0B,QAAQ,GAAE,aAAa,CAAC,GAAG,CAAM,GAAG,MAAM,CAcnE;AC/FD;;GAEG;AACH,sBAAsB,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAQnE;ACvBD,OAAO,MAAM,uBAAwB,OAAO,GAAG,IAAI,GAAG,SAAS,KAAG,QAEjE,CAAC;AAEF,OAAO,MAAM,qBACP,CAAC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D,+BAA+B,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAcxE;AAED,sCAAsC,KAAK,EAAE,YAAY,WAgBxD;ACzCD,4BAA4B,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,CAU5E;ACZD,6BAA6B,CAAC,EAC5B,GAAG,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC,EAC1E,YAAY,EAAE,CAAC,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAgB5B;ACKD,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC","sources":["packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLayoutEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useId.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/chain.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/domHelpers.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeRefs.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/filterDOMProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/focusWithoutScrolling.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getOffset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/platform.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/openLink.tsx","packages/@react-aria/utils/src/packages/@react-aria/utils/src/runAfterTransition.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDrag1D.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useGlobalListeners.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLabels.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useObjectRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useUpdateEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useResizeObserver.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useSyncRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isScrollable.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParents.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useViewportSize.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDescription.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEffectEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useValueEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/scrollIntoView.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isVirtualEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDeepMemo.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useFormReset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/index.ts","packages/@react-aria/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,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 */\nexport {useId, mergeIds, useSlotId} from './useId';\nexport {chain} from './chain';\nexport {getOwnerDocument, getOwnerWindow} from './domHelpers';\nexport {mergeProps} from './mergeProps';\nexport {mergeRefs} from './mergeRefs';\nexport {filterDOMProps} from './filterDOMProps';\nexport {focusWithoutScrolling} from './focusWithoutScrolling';\nexport {getOffset} from './getOffset';\nexport {openLink, getSyntheticLinkProps, RouterProvider, shouldClientNavigate, useRouter, useLinkProps} from './openLink';\nexport {runAfterTransition} from './runAfterTransition';\nexport {useDrag1D} from './useDrag1D';\nexport {useGlobalListeners} from './useGlobalListeners';\nexport {useLabels} from './useLabels';\nexport {useObjectRef} from './useObjectRef';\nexport {useUpdateEffect} from './useUpdateEffect';\nexport {useLayoutEffect} from './useLayoutEffect';\nexport {useResizeObserver} from './useResizeObserver';\nexport {useSyncRef} from './useSyncRef';\nexport {getScrollParent} from './getScrollParent';\nexport {getScrollParents} from './getScrollParents';\nexport {isScrollable} from './isScrollable';\nexport {useViewportSize} from './useViewportSize';\nexport {useDescription} from './useDescription';\nexport {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid, isFirefox} from './platform';\nexport {useEvent} from './useEvent';\nexport {useValueEffect} from './useValueEffect';\nexport {scrollIntoView, scrollIntoViewport} from './scrollIntoView';\nexport {clamp, snapValueToStep} from '@react-stately/utils';\nexport {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';\nexport {useEffectEvent} from './useEffectEvent';\nexport {useDeepMemo} from './useDeepMemo';\nexport {useFormReset} from './useFormReset';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
1
|
+
{"mappings":";;AAiBA,OAAO,MAAM,6CAED,CAAC;ACOb;;;GAGG;AACH,sBAAsB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAgChD;AAED;;;GAGG;AACH,yBAAyB,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBzD;AAED;;;;GAIG;AACH,0BAA0B,QAAQ,GAAE,aAAa,CAAC,GAAG,CAAM,GAAG,MAAM,CAcnE;AC/FD;;GAEG;AACH,sBAAsB,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IA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AG,EAAE,YAAU,WAAW,GAAG,IAAI,CAAC,QA+CnF;AC3CD,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC","sources":["packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLayoutEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useId.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/chain.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/domHelpers.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeRefs.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/filterDOMProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/focusWithoutScrolling.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getOffset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/platform.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/openLink.tsx","packages/@react-aria/utils/src/packages/@react-aria/utils/src/runAfterTransition.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDrag1D.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useGlobalListeners.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLabels.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useObjectRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useUpdateEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useResizeObserver.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useSyncRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isScrollable.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParents.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useViewportSize.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDescription.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEffectEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useValueEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/scrollIntoView.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isVirtualEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDeepMemo.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useFormReset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLoadMore.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/index.ts","packages/@react-aria/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,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 */\nexport {useId, mergeIds, useSlotId} from './useId';\nexport {chain} from './chain';\nexport {getOwnerDocument, getOwnerWindow} from './domHelpers';\nexport {mergeProps} from './mergeProps';\nexport {mergeRefs} from './mergeRefs';\nexport {filterDOMProps} from './filterDOMProps';\nexport {focusWithoutScrolling} from './focusWithoutScrolling';\nexport {getOffset} from './getOffset';\nexport {openLink, useSyntheticLinkProps, RouterProvider, shouldClientNavigate, useRouter, useLinkProps} from './openLink';\nexport {runAfterTransition} from './runAfterTransition';\nexport {useDrag1D} from './useDrag1D';\nexport {useGlobalListeners} from './useGlobalListeners';\nexport {useLabels} from './useLabels';\nexport {useObjectRef} from './useObjectRef';\nexport {useUpdateEffect} from './useUpdateEffect';\nexport {useLayoutEffect} from './useLayoutEffect';\nexport {useResizeObserver} from './useResizeObserver';\nexport {useSyncRef} from './useSyncRef';\nexport {getScrollParent} from './getScrollParent';\nexport {getScrollParents} from './getScrollParents';\nexport {isScrollable} from './isScrollable';\nexport {useViewportSize} from './useViewportSize';\nexport {useDescription} from './useDescription';\nexport {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid, isFirefox} from './platform';\nexport {useEvent} from './useEvent';\nexport {useValueEffect} from './useValueEffect';\nexport {scrollIntoView, scrollIntoViewport} from './scrollIntoView';\nexport {clamp, snapValueToStep} from '@react-stately/utils';\nexport {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';\nexport {useEffectEvent} from './useEffectEvent';\nexport {useDeepMemo} from './useDeepMemo';\nexport {useFormReset} from './useFormReset';\nexport {useLoadMore} from './useLoadMore';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CACd,GAAkC,EAClC,KAAwB,EACxB,OAAqE,EACrE,OAA2C;IAE3C,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;IACjC,IAAI,aAAa,WAAW;IAE5B,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,cAAc,CAAC,IAAI,OAAO,EAC5B;QAGF,IAAI,UAAU,IAAI,OAAO;QACzB,QAAQ,gBAAgB,CAAC,OAAO,aAA8B;QAC9D,OAAO;YACL,QAAQ,mBAAmB,CAAC,OAAO,aAA8B;QACnE;IACF,GAAG;QAAC;QAAK;QAAO;QAAS;QAAY;KAAY;AACnD","sources":["packages/@react-aria/utils/src/useEvent.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {useEffect} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\nexport function useEvent<K extends keyof GlobalEventHandlersEventMap>(\n ref: RefObject<EventTarget | null>,\n event: K | (string & {}),\n handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n let handleEvent = useEffectEvent(handler);\n let isDisabled = handler == null;\n\n useEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n\n let element = ref.current;\n element.addEventListener(event, handleEvent as EventListener, options);\n return () => {\n element.removeEventListener(event, handleEvent as EventListener, options);\n };\n }, [ref, event, options, isDisabled, handleEvent]);\n}\n"],"names":[],"version":3,"file":"useEvent.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CACd,GAAkC,EAClC,KAAwB,EACxB,OAAqE,EACrE,OAA2C;IAE3C,IAAI,cAAc,CAAA,GAAA,yCAAa,EAAE;IACjC,IAAI,aAAa,WAAW;IAE5B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,cAAc,CAAC,IAAI,OAAO,EAC5B;QAGF,IAAI,UAAU,IAAI,OAAO;QACzB,QAAQ,gBAAgB,CAAC,OAAO,aAA8B;QAC9D,OAAO;YACL,QAAQ,mBAAmB,CAAC,OAAO,aAA8B;QACnE;IACF,GAAG;QAAC;QAAK;QAAO;QAAS;QAAY;KAAY;AACnD","sources":["packages/@react-aria/utils/src/useEvent.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {useEffect} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\nexport function useEvent<K extends keyof GlobalEventHandlersEventMap>(\n ref: RefObject<EventTarget | null>,\n event: K | (string & {}),\n handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n let handleEvent = useEffectEvent(handler);\n let isDisabled = handler == null;\n\n useEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n\n let element = ref.current;\n element.addEventListener(event, handleEvent as EventListener, options);\n return () => {\n element.removeEventListener(event, handleEvent as EventListener, options);\n };\n }, [ref, event, options, isDisabled, handleEvent]);\n}\n"],"names":[],"version":3,"file":"useEvent.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CACd,GAAiF,EACjF,YAAe,EACf,OAA2B;IAE3B,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAE;IACxB,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,IAAI,SACF,QAAQ,WAAW,OAAO;IAE9B;IAEA,CAAA,GAAA,sBAAQ,EAAE;YACG;QAAX,IAAI,OAAO,gBAAA,2BAAA,eAAA,IAAK,OAAO,cAAZ,mCAAA,aAAc,IAAI;QAC7B,iBAAA,2BAAA,KAAM,gBAAgB,CAAC,SAAS;QAChC,OAAO;YACL,iBAAA,2BAAA,KAAM,mBAAmB,CAAC,SAAS;QACrC;IACF,GAAG;QAAC;QAAK;KAAY;AACvB","sources":["packages/@react-aria/utils/src/useFormReset.ts"],"sourcesContent":["/*\n * Copyright 2023 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 {useEffect, useRef} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\nexport function useFormReset<T>(\n ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null>,\n initialValue: T,\n onReset: (value: T) => void\n) {\n let resetValue = useRef(initialValue);\n let handleReset = useEffectEvent(() => {\n if (onReset) {\n onReset(resetValue.current);\n }\n });\n\n useEffect(() => {\n let form = ref?.current?.form;\n form?.addEventListener('reset', handleReset);\n return () => {\n form?.removeEventListener('reset', handleReset);\n };\n }, [ref, handleReset]);\n}\n"],"names":[],"version":3,"file":"useFormReset.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CACd,GAAiF,EACjF,YAAe,EACf,OAA2B;IAE3B,IAAI,aAAa,CAAA,GAAA,aAAK,EAAE;IACxB,IAAI,cAAc,CAAA,GAAA,yCAAa,EAAE;QAC/B,IAAI,SACF,QAAQ,WAAW,OAAO;IAE9B;IAEA,CAAA,GAAA,gBAAQ,EAAE;YACG;QAAX,IAAI,OAAO,gBAAA,2BAAA,eAAA,IAAK,OAAO,cAAZ,mCAAA,aAAc,IAAI;QAC7B,iBAAA,2BAAA,KAAM,gBAAgB,CAAC,SAAS;QAChC,OAAO;YACL,iBAAA,2BAAA,KAAM,mBAAmB,CAAC,SAAS;QACrC;IACF,GAAG;QAAC;QAAK;KAAY;AACvB","sources":["packages/@react-aria/utils/src/useFormReset.ts"],"sourcesContent":["/*\n * Copyright 2023 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 {useEffect, useRef} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\nexport function useFormReset<T>(\n ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null>,\n initialValue: T,\n onReset: (value: T) => void\n) {\n let resetValue = useRef(initialValue);\n let handleReset = useEffectEvent(() => {\n if (onReset) {\n onReset(resetValue.current);\n }\n });\n\n useEffect(() => {\n let form = ref?.current?.form;\n form?.addEventListener('reset', handleReset);\n return () => {\n form?.removeEventListener('reset', handleReset);\n };\n }, [ref, handleReset]);\n}\n"],"names":[],"version":3,"file":"useFormReset.module.js.map"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var $2a8c0bb1629926c8$exports = require("./useEvent.main.js");
|
|
2
|
+
var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
|
|
3
|
+
var $4Zukt$react = require("react");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$export(e, n, v, s) {
|
|
7
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$parcel$export(module.exports, "useLoadMore", () => $faa6ccd6fb62f877$export$7717c92ee915373e);
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $faa6ccd6fb62f877$export$7717c92ee915373e(props, ref) {
|
|
25
|
+
let { isLoading: isLoading, onLoadMore: onLoadMore, scrollOffset: scrollOffset = 1, items: items } = props;
|
|
26
|
+
// Handle scrolling, and call onLoadMore when nearing the bottom.
|
|
27
|
+
let isLoadingRef = (0, $4Zukt$react.useRef)(isLoading);
|
|
28
|
+
let prevProps = (0, $4Zukt$react.useRef)(props);
|
|
29
|
+
let onScroll = (0, $4Zukt$react.useCallback)(()=>{
|
|
30
|
+
if (ref.current && !isLoadingRef.current && onLoadMore) {
|
|
31
|
+
let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;
|
|
32
|
+
if (shouldLoadMore) {
|
|
33
|
+
isLoadingRef.current = true;
|
|
34
|
+
onLoadMore();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, [
|
|
38
|
+
onLoadMore,
|
|
39
|
+
ref,
|
|
40
|
+
scrollOffset
|
|
41
|
+
]);
|
|
42
|
+
let lastItems = (0, $4Zukt$react.useRef)(items);
|
|
43
|
+
(0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
|
|
44
|
+
// Only update isLoadingRef if props object actually changed,
|
|
45
|
+
// not if a local state change occurred.
|
|
46
|
+
if (props !== prevProps.current) {
|
|
47
|
+
isLoadingRef.current = isLoading;
|
|
48
|
+
prevProps.current = props;
|
|
49
|
+
}
|
|
50
|
+
// TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.
|
|
51
|
+
// We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called
|
|
52
|
+
// while the data from the last onLoadMore is being processed by RAC collection.
|
|
53
|
+
let shouldLoadMore = (ref === null || ref === void 0 ? void 0 : ref.current) && !isLoadingRef.current && onLoadMore && (!items || items !== lastItems.current) && ref.current.clientHeight === ref.current.scrollHeight;
|
|
54
|
+
if (shouldLoadMore) {
|
|
55
|
+
isLoadingRef.current = true;
|
|
56
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
|
57
|
+
}
|
|
58
|
+
lastItems.current = items;
|
|
59
|
+
}, [
|
|
60
|
+
isLoading,
|
|
61
|
+
onLoadMore,
|
|
62
|
+
props,
|
|
63
|
+
ref
|
|
64
|
+
]);
|
|
65
|
+
// TODO: maybe this should still just return scroll props?
|
|
66
|
+
// Test against case where the ref isn't defined when this is called
|
|
67
|
+
// Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll
|
|
68
|
+
(0, $2a8c0bb1629926c8$exports.useEvent)(ref, 'scroll', onScroll);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=useLoadMore.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAwBM,SAAS,0CAAY,KAAoB,EAAE,GAAkC;IAClF,IAAI,aAAC,SAAS,cAAE,UAAU,gBAAE,eAAe,UAAG,KAAK,EAAC,GAAG;IAEvD,iEAAiE;IACjE,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAC1B,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE;QACzB,IAAI,IAAI,OAAO,IAAI,CAAC,aAAa,OAAO,IAAI,YAAY;YACtD,IAAI,iBAAiB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,OAAO,CAAC,YAAY,GAAG;YAE9H,IAAI,gBAAgB;gBAClB,aAAa,OAAO,GAAG;gBACvB;YACF;QACF;IACF,GAAG;QAAC;QAAY;QAAK;KAAa;IAElC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,yCAAc,EAAE;QACd,6DAA6D;QAC7D,wCAAwC;QACxC,IAAI,UAAU,UAAU,OAAO,EAAE;YAC/B,aAAa,OAAO,GAAG;YACvB,UAAU,OAAO,GAAG;QACtB;QAEA,0HAA0H;QAC1H,4HAA4H;QAC5H,gFAAgF;QAChF,IAAI,iBAAiB,CAAA,gBAAA,0BAAA,IAAK,OAAO,KAC5B,CAAC,aAAa,OAAO,IACrB,cACC,CAAA,CAAC,SAAS,UAAU,UAAU,OAAO,AAAD,KACrC,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,OAAO,CAAC,YAAY;QAE1D,IAAI,gBAAgB;YAClB,aAAa,OAAO,GAAG;YACvB,uBAAA,iCAAA;QACF;QAEA,UAAU,OAAO,GAAG;IACtB,GAAG;QAAC;QAAW;QAAY;QAAO;KAAI;IAEtC,0DAA0D;IAC1D,oEAAoE;IACpE,kHAAkH;IAClH,CAAA,GAAA,kCAAO,EAAE,KAAK,UAAU;AAC1B","sources":["packages/@react-aria/utils/src/useLoadMore.ts"],"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 {RefObject, useCallback, useRef} from 'react';\nimport {useEvent} from './useEvent';\n// eslint-disable-next-line rulesdir/useLayoutEffectRule\nimport {useLayoutEffect} from './useLayoutEffect';\n\nexport interface LoadMoreProps {\n /** Whether data is currently being loaded. */\n isLoading?: boolean,\n /** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */\n onLoadMore?: () => void,\n /**\n * The amount of offset from the bottom of your scrollable region that should trigger load more.\n * Uses a percentage value relative to the scroll body's client height. Load more is then triggered\n * when your current scroll position's distance from the bottom of the currently loaded list of items is less than\n * or equal to the provided value. (e.g. 1 = 100% of the scroll region's height).\n * @default 1\n */\n scrollOffset?: number,\n /** The data currently loaded. */\n items?: any[]\n}\n\nexport function useLoadMore(props: LoadMoreProps, ref: RefObject<HTMLElement | null>) {\n let {isLoading, onLoadMore, scrollOffset = 1, items} = props;\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onScroll = useCallback(() => {\n if (ref.current && !isLoadingRef.current && onLoadMore) {\n let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, ref, scrollOffset]);\n\n let lastItems = useRef(items);\n useLayoutEffect(() => {\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n // TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.\n // We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called\n // while the data from the last onLoadMore is being processed by RAC collection.\n let shouldLoadMore = ref?.current\n && !isLoadingRef.current\n && onLoadMore\n && (!items || items !== lastItems.current)\n && ref.current.clientHeight === ref.current.scrollHeight;\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore?.();\n }\n\n lastItems.current = items;\n }, [isLoading, onLoadMore, props, ref]);\n\n // TODO: maybe this should still just return scroll props?\n // Test against case where the ref isn't defined when this is called\n // Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll\n useEvent(ref, 'scroll', onScroll);\n}\n"],"names":[],"version":3,"file":"useLoadMore.main.js.map"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {useEvent as $e9faafb641e167db$export$90fc3a17d93f704c} from "./useEvent.mjs";
|
|
2
|
+
import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.mjs";
|
|
3
|
+
import {useRef as $hDRkU$useRef, useCallback as $hDRkU$useCallback} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function $26f7f3da73fcd9d6$export$7717c92ee915373e(props, ref) {
|
|
19
|
+
let { isLoading: isLoading, onLoadMore: onLoadMore, scrollOffset: scrollOffset = 1, items: items } = props;
|
|
20
|
+
// Handle scrolling, and call onLoadMore when nearing the bottom.
|
|
21
|
+
let isLoadingRef = (0, $hDRkU$useRef)(isLoading);
|
|
22
|
+
let prevProps = (0, $hDRkU$useRef)(props);
|
|
23
|
+
let onScroll = (0, $hDRkU$useCallback)(()=>{
|
|
24
|
+
if (ref.current && !isLoadingRef.current && onLoadMore) {
|
|
25
|
+
let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;
|
|
26
|
+
if (shouldLoadMore) {
|
|
27
|
+
isLoadingRef.current = true;
|
|
28
|
+
onLoadMore();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
onLoadMore,
|
|
33
|
+
ref,
|
|
34
|
+
scrollOffset
|
|
35
|
+
]);
|
|
36
|
+
let lastItems = (0, $hDRkU$useRef)(items);
|
|
37
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
38
|
+
// Only update isLoadingRef if props object actually changed,
|
|
39
|
+
// not if a local state change occurred.
|
|
40
|
+
if (props !== prevProps.current) {
|
|
41
|
+
isLoadingRef.current = isLoading;
|
|
42
|
+
prevProps.current = props;
|
|
43
|
+
}
|
|
44
|
+
// TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.
|
|
45
|
+
// We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called
|
|
46
|
+
// while the data from the last onLoadMore is being processed by RAC collection.
|
|
47
|
+
let shouldLoadMore = (ref === null || ref === void 0 ? void 0 : ref.current) && !isLoadingRef.current && onLoadMore && (!items || items !== lastItems.current) && ref.current.clientHeight === ref.current.scrollHeight;
|
|
48
|
+
if (shouldLoadMore) {
|
|
49
|
+
isLoadingRef.current = true;
|
|
50
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
|
51
|
+
}
|
|
52
|
+
lastItems.current = items;
|
|
53
|
+
}, [
|
|
54
|
+
isLoading,
|
|
55
|
+
onLoadMore,
|
|
56
|
+
props,
|
|
57
|
+
ref
|
|
58
|
+
]);
|
|
59
|
+
// TODO: maybe this should still just return scroll props?
|
|
60
|
+
// Test against case where the ref isn't defined when this is called
|
|
61
|
+
// Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll
|
|
62
|
+
(0, $e9faafb641e167db$export$90fc3a17d93f704c)(ref, 'scroll', onScroll);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export {$26f7f3da73fcd9d6$export$7717c92ee915373e as useLoadMore};
|
|
67
|
+
//# sourceMappingURL=useLoadMore.module.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {useEvent as $e9faafb641e167db$export$90fc3a17d93f704c} from "./useEvent.module.js";
|
|
2
|
+
import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.module.js";
|
|
3
|
+
import {useRef as $hDRkU$useRef, useCallback as $hDRkU$useCallback} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function $26f7f3da73fcd9d6$export$7717c92ee915373e(props, ref) {
|
|
19
|
+
let { isLoading: isLoading, onLoadMore: onLoadMore, scrollOffset: scrollOffset = 1, items: items } = props;
|
|
20
|
+
// Handle scrolling, and call onLoadMore when nearing the bottom.
|
|
21
|
+
let isLoadingRef = (0, $hDRkU$useRef)(isLoading);
|
|
22
|
+
let prevProps = (0, $hDRkU$useRef)(props);
|
|
23
|
+
let onScroll = (0, $hDRkU$useCallback)(()=>{
|
|
24
|
+
if (ref.current && !isLoadingRef.current && onLoadMore) {
|
|
25
|
+
let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;
|
|
26
|
+
if (shouldLoadMore) {
|
|
27
|
+
isLoadingRef.current = true;
|
|
28
|
+
onLoadMore();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
onLoadMore,
|
|
33
|
+
ref,
|
|
34
|
+
scrollOffset
|
|
35
|
+
]);
|
|
36
|
+
let lastItems = (0, $hDRkU$useRef)(items);
|
|
37
|
+
(0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
38
|
+
// Only update isLoadingRef if props object actually changed,
|
|
39
|
+
// not if a local state change occurred.
|
|
40
|
+
if (props !== prevProps.current) {
|
|
41
|
+
isLoadingRef.current = isLoading;
|
|
42
|
+
prevProps.current = props;
|
|
43
|
+
}
|
|
44
|
+
// TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.
|
|
45
|
+
// We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called
|
|
46
|
+
// while the data from the last onLoadMore is being processed by RAC collection.
|
|
47
|
+
let shouldLoadMore = (ref === null || ref === void 0 ? void 0 : ref.current) && !isLoadingRef.current && onLoadMore && (!items || items !== lastItems.current) && ref.current.clientHeight === ref.current.scrollHeight;
|
|
48
|
+
if (shouldLoadMore) {
|
|
49
|
+
isLoadingRef.current = true;
|
|
50
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
|
51
|
+
}
|
|
52
|
+
lastItems.current = items;
|
|
53
|
+
}, [
|
|
54
|
+
isLoading,
|
|
55
|
+
onLoadMore,
|
|
56
|
+
props,
|
|
57
|
+
ref
|
|
58
|
+
]);
|
|
59
|
+
// TODO: maybe this should still just return scroll props?
|
|
60
|
+
// Test against case where the ref isn't defined when this is called
|
|
61
|
+
// Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll
|
|
62
|
+
(0, $e9faafb641e167db$export$90fc3a17d93f704c)(ref, 'scroll', onScroll);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export {$26f7f3da73fcd9d6$export$7717c92ee915373e as useLoadMore};
|
|
67
|
+
//# sourceMappingURL=useLoadMore.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAwBM,SAAS,0CAAY,KAAoB,EAAE,GAAkC;IAClF,IAAI,aAAC,SAAS,cAAE,UAAU,gBAAE,eAAe,UAAG,KAAK,EAAC,GAAG;IAEvD,iEAAiE;IACjE,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QACzB,IAAI,IAAI,OAAO,IAAI,CAAC,aAAa,OAAO,IAAI,YAAY;YACtD,IAAI,iBAAiB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,OAAO,CAAC,YAAY,GAAG;YAE9H,IAAI,gBAAgB;gBAClB,aAAa,OAAO,GAAG;gBACvB;YACF;QACF;IACF,GAAG;QAAC;QAAY;QAAK;KAAa;IAElC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,yCAAc,EAAE;QACd,6DAA6D;QAC7D,wCAAwC;QACxC,IAAI,UAAU,UAAU,OAAO,EAAE;YAC/B,aAAa,OAAO,GAAG;YACvB,UAAU,OAAO,GAAG;QACtB;QAEA,0HAA0H;QAC1H,4HAA4H;QAC5H,gFAAgF;QAChF,IAAI,iBAAiB,CAAA,gBAAA,0BAAA,IAAK,OAAO,KAC5B,CAAC,aAAa,OAAO,IACrB,cACC,CAAA,CAAC,SAAS,UAAU,UAAU,OAAO,AAAD,KACrC,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,OAAO,CAAC,YAAY;QAE1D,IAAI,gBAAgB;YAClB,aAAa,OAAO,GAAG;YACvB,uBAAA,iCAAA;QACF;QAEA,UAAU,OAAO,GAAG;IACtB,GAAG;QAAC;QAAW;QAAY;QAAO;KAAI;IAEtC,0DAA0D;IAC1D,oEAAoE;IACpE,kHAAkH;IAClH,CAAA,GAAA,yCAAO,EAAE,KAAK,UAAU;AAC1B","sources":["packages/@react-aria/utils/src/useLoadMore.ts"],"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 {RefObject, useCallback, useRef} from 'react';\nimport {useEvent} from './useEvent';\n// eslint-disable-next-line rulesdir/useLayoutEffectRule\nimport {useLayoutEffect} from './useLayoutEffect';\n\nexport interface LoadMoreProps {\n /** Whether data is currently being loaded. */\n isLoading?: boolean,\n /** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */\n onLoadMore?: () => void,\n /**\n * The amount of offset from the bottom of your scrollable region that should trigger load more.\n * Uses a percentage value relative to the scroll body's client height. Load more is then triggered\n * when your current scroll position's distance from the bottom of the currently loaded list of items is less than\n * or equal to the provided value. (e.g. 1 = 100% of the scroll region's height).\n * @default 1\n */\n scrollOffset?: number,\n /** The data currently loaded. */\n items?: any[]\n}\n\nexport function useLoadMore(props: LoadMoreProps, ref: RefObject<HTMLElement | null>) {\n let {isLoading, onLoadMore, scrollOffset = 1, items} = props;\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onScroll = useCallback(() => {\n if (ref.current && !isLoadingRef.current && onLoadMore) {\n let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, ref, scrollOffset]);\n\n let lastItems = useRef(items);\n useLayoutEffect(() => {\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n // TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.\n // We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called\n // while the data from the last onLoadMore is being processed by RAC collection.\n let shouldLoadMore = ref?.current\n && !isLoadingRef.current\n && onLoadMore\n && (!items || items !== lastItems.current)\n && ref.current.clientHeight === ref.current.scrollHeight;\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore?.();\n }\n\n lastItems.current = items;\n }, [isLoading, onLoadMore, props, ref]);\n\n // TODO: maybe this should still just return scroll props?\n // Test against case where the ref isn't defined when this is called\n // Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll\n useEvent(ref, 'scroll', onScroll);\n}\n"],"names":[],"version":3,"file":"useLoadMore.module.js.map"}
|
|
@@ -11,7 +11,7 @@ function $37733e1652f47193$var$hasResizeObserver() {
|
|
|
11
11
|
return typeof window.ResizeObserver !== 'undefined';
|
|
12
12
|
}
|
|
13
13
|
function $37733e1652f47193$export$683480f191c0e3ea(options) {
|
|
14
|
-
const { ref: ref, onResize: onResize } = options;
|
|
14
|
+
const { ref: ref, box: box, onResize: onResize } = options;
|
|
15
15
|
(0, $aM4zL$react.useEffect)(()=>{
|
|
16
16
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
17
17
|
if (!element) return;
|
|
@@ -25,14 +25,17 @@ function $37733e1652f47193$export$683480f191c0e3ea(options) {
|
|
|
25
25
|
if (!entries.length) return;
|
|
26
26
|
onResize();
|
|
27
27
|
});
|
|
28
|
-
resizeObserverInstance.observe(element
|
|
28
|
+
resizeObserverInstance.observe(element, {
|
|
29
|
+
box: box
|
|
30
|
+
});
|
|
29
31
|
return ()=>{
|
|
30
32
|
if (element) resizeObserverInstance.unobserve(element);
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
}, [
|
|
34
36
|
onResize,
|
|
35
|
-
ref
|
|
37
|
+
ref,
|
|
38
|
+
box
|
|
36
39
|
]);
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAIA,SAAS;IACP,OAAO,OAAO,OAAO,cAAc,KAAK;AAC1C;AAQO,SAAS,0CAAqC,OAAwC;IAC3F,MAAM,OAAC,GAAG,OAAE,GAAG,YAAE,QAAQ,EAAC,GAAG;IAE7B,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,UAAU,gBAAA,0BAAA,IAAK,OAAO;QAC1B,IAAI,CAAC,SACH;QAGF,IAAI,CAAC,2CAAqB;YACxB,OAAO,gBAAgB,CAAC,UAAU,UAAU;YAC5C,OAAO;gBACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;YACjD;QACF,OAAO;YAEL,MAAM,yBAAyB,IAAI,OAAO,cAAc,CAAC,CAAC;gBACxD,IAAI,CAAC,QAAQ,MAAM,EACjB;gBAGF;YACF;YACA,uBAAuB,OAAO,CAAC,SAAS;qBAAC;YAAG;YAE5C,OAAO;gBACL,IAAI,SACF,uBAAuB,SAAS,CAAC;YAErC;QACF;IAEF,GAAG;QAAC;QAAU;QAAK;KAAI;AACzB","sources":["packages/@react-aria/utils/src/useResizeObserver.ts"],"sourcesContent":["\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined | null> | undefined,\n box?: ResizeObserverBoxOptions,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>) {\n const {ref, box, onResize} = options;\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResize();\n });\n resizeObserverInstance.observe(element, {box});\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [onResize, ref, box]);\n}\n"],"names":[],"version":3,"file":"useResizeObserver.main.js.map"}
|
|
@@ -5,7 +5,7 @@ function $9daab02d461809db$var$hasResizeObserver() {
|
|
|
5
5
|
return typeof window.ResizeObserver !== 'undefined';
|
|
6
6
|
}
|
|
7
7
|
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
8
|
-
const { ref: ref, onResize: onResize } = options;
|
|
8
|
+
const { ref: ref, box: box, onResize: onResize } = options;
|
|
9
9
|
(0, $Vsl8o$useEffect)(()=>{
|
|
10
10
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
11
11
|
if (!element) return;
|
|
@@ -19,14 +19,17 @@ function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
|
19
19
|
if (!entries.length) return;
|
|
20
20
|
onResize();
|
|
21
21
|
});
|
|
22
|
-
resizeObserverInstance.observe(element
|
|
22
|
+
resizeObserverInstance.observe(element, {
|
|
23
|
+
box: box
|
|
24
|
+
});
|
|
23
25
|
return ()=>{
|
|
24
26
|
if (element) resizeObserverInstance.unobserve(element);
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
}, [
|
|
28
30
|
onResize,
|
|
29
|
-
ref
|
|
31
|
+
ref,
|
|
32
|
+
box
|
|
30
33
|
]);
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -5,7 +5,7 @@ function $9daab02d461809db$var$hasResizeObserver() {
|
|
|
5
5
|
return typeof window.ResizeObserver !== 'undefined';
|
|
6
6
|
}
|
|
7
7
|
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
8
|
-
const { ref: ref, onResize: onResize } = options;
|
|
8
|
+
const { ref: ref, box: box, onResize: onResize } = options;
|
|
9
9
|
(0, $Vsl8o$useEffect)(()=>{
|
|
10
10
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
11
11
|
if (!element) return;
|
|
@@ -19,14 +19,17 @@ function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
|
19
19
|
if (!entries.length) return;
|
|
20
20
|
onResize();
|
|
21
21
|
});
|
|
22
|
-
resizeObserverInstance.observe(element
|
|
22
|
+
resizeObserverInstance.observe(element, {
|
|
23
|
+
box: box
|
|
24
|
+
});
|
|
23
25
|
return ()=>{
|
|
24
26
|
if (element) resizeObserverInstance.unobserve(element);
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
}, [
|
|
28
30
|
onResize,
|
|
29
|
-
ref
|
|
31
|
+
ref,
|
|
32
|
+
box
|
|
30
33
|
]);
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;
|
|
1
|
+
{"mappings":";;;AAIA,SAAS;IACP,OAAO,OAAO,OAAO,cAAc,KAAK;AAC1C;AAQO,SAAS,0CAAqC,OAAwC;IAC3F,MAAM,OAAC,GAAG,OAAE,GAAG,YAAE,QAAQ,EAAC,GAAG;IAE7B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,UAAU,gBAAA,0BAAA,IAAK,OAAO;QAC1B,IAAI,CAAC,SACH;QAGF,IAAI,CAAC,2CAAqB;YACxB,OAAO,gBAAgB,CAAC,UAAU,UAAU;YAC5C,OAAO;gBACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;YACjD;QACF,OAAO;YAEL,MAAM,yBAAyB,IAAI,OAAO,cAAc,CAAC,CAAC;gBACxD,IAAI,CAAC,QAAQ,MAAM,EACjB;gBAGF;YACF;YACA,uBAAuB,OAAO,CAAC,SAAS;qBAAC;YAAG;YAE5C,OAAO;gBACL,IAAI,SACF,uBAAuB,SAAS,CAAC;YAErC;QACF;IAEF,GAAG;QAAC;QAAU;QAAK;KAAI;AACzB","sources":["packages/@react-aria/utils/src/useResizeObserver.ts"],"sourcesContent":["\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined | null> | undefined,\n box?: ResizeObserverBoxOptions,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>) {\n const {ref, box, onResize} = options;\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResize();\n });\n resizeObserverInstance.observe(element, {box});\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [onResize, ref, box]);\n}\n"],"names":[],"version":3,"file":"useResizeObserver.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAWM,SAAS,0CAAc,OAAgC,EAAE,GAAyB;IACvF,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,WAAW,QAAQ,GAAG,IAAI,KAAK;YACjC,QAAQ,GAAG,CAAC,OAAO,GAAG,IAAI,OAAO;YACjC,OAAO;gBACL,IAAI,QAAQ,GAAG,EACb,QAAQ,GAAG,CAAC,OAAO,GAAG;YAE1B;QACF;IACF;AACF","sources":["packages/@react-aria/utils/src/useSyncRef.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 {MutableRefObject} from 'react';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from './';\n\ninterface ContextValue<T> {\n ref?: MutableRefObject<T | null>\n}\n\n// Syncs ref from context with ref passed to hook\nexport function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>) {\n useLayoutEffect(() => {\n if (context && context.ref && ref) {\n context.ref.current = ref.current;\n return () => {\n if (context.ref) {\n context.ref.current = null;\n }\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"useSyncRef.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAWM,SAAS,0CAAc,OAAgC,EAAE,GAAyB;IACvF,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,WAAW,QAAQ,GAAG,IAAI,KAAK;YACjC,QAAQ,GAAG,CAAC,OAAO,GAAG,IAAI,OAAO;YACjC,OAAO;gBACL,IAAI,QAAQ,GAAG,EACb,QAAQ,GAAG,CAAC,OAAO,GAAG;YAE1B;QACF;IACF;AACF","sources":["packages/@react-aria/utils/src/useSyncRef.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 {MutableRefObject} from 'react';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from './';\n\ninterface ContextValue<T> {\n ref?: MutableRefObject<T | null>\n}\n\n// Syncs ref from context with ref passed to hook\nexport function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>) {\n useLayoutEffect(() => {\n if (context && context.ref && ref) {\n context.ref.current = ref.current;\n return () => {\n if (context.ref) {\n context.ref.current = null;\n }\n };\n }\n });\n}\n"],"names":[],"version":3,"file":"useSyncRef.module.js.map"}
|