@elliemae/ds-utilities 3.4.3-rc.1 → 3.4.3
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/cjs/capitalize.js +4 -1
- package/dist/cjs/capitalize.js.map +1 -1
- package/dist/cjs/compose.js +7 -2
- package/dist/cjs/compose.js.map +1 -1
- package/dist/cjs/deprecated/deprecatedMsg.js +4 -1
- package/dist/cjs/deprecated/deprecatedMsg.js.map +1 -1
- package/dist/cjs/deprecated/index.js +4 -1
- package/dist/cjs/deprecated/index.js.map +1 -1
- package/dist/cjs/deprecated/reactTypesUtility.js +4 -1
- package/dist/cjs/deprecated/reactTypesUtility.js.map +2 -2
- package/dist/cjs/deprecated/scrollingTimer.js +4 -1
- package/dist/cjs/deprecated/scrollingTimer.js.map +1 -1
- package/dist/cjs/deprecated/useParentElement.js +4 -1
- package/dist/cjs/deprecated/useParentElement.js.map +1 -1
- package/dist/cjs/deprecated/useSetRef.js +4 -1
- package/dist/cjs/deprecated/useSetRef.js.map +1 -1
- package/dist/cjs/deprecated/useUncontrolled.js +4 -1
- package/dist/cjs/deprecated/useUncontrolled.js.map +2 -2
- package/dist/cjs/deprecated/useWindowSize.js +4 -1
- package/dist/cjs/deprecated/useWindowSize.js.map +1 -1
- package/dist/cjs/getComponentFromProps.js +16 -7
- package/dist/cjs/getComponentFromProps.js.map +2 -2
- package/dist/cjs/hooks/index.js +4 -1
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/useCallbackAfterRender.js +4 -1
- package/dist/cjs/hooks/useCallbackAfterRender.js.map +1 -1
- package/dist/cjs/hooks/useCancellableDelayedCallback.js +10 -4
- package/dist/cjs/hooks/useCancellableDelayedCallback.js.map +1 -1
- package/dist/cjs/hooks/useDerivedStateFromProps.js +4 -1
- package/dist/cjs/hooks/useDerivedStateFromProps.js.map +1 -1
- package/dist/cjs/hooks/useExecutionTimer.js +4 -1
- package/dist/cjs/hooks/useExecutionTimer.js.map +1 -1
- package/dist/cjs/hooks/useExpandState.js +4 -1
- package/dist/cjs/hooks/useExpandState.js.map +1 -1
- package/dist/cjs/hooks/useFocusTrap.js +34 -20
- package/dist/cjs/hooks/useFocusTrap.js.map +1 -1
- package/dist/cjs/hooks/useHotkeys.js +4 -1
- package/dist/cjs/hooks/useHotkeys.js.map +2 -2
- package/dist/cjs/hooks/useHoverHandlersDelay.js +4 -1
- package/dist/cjs/hooks/useHoverHandlersDelay.js.map +1 -1
- package/dist/cjs/hooks/useIsMobile.js +4 -1
- package/dist/cjs/hooks/useIsMobile.js.map +1 -1
- package/dist/cjs/hooks/useIsShowingEllipsis.js +14 -8
- package/dist/cjs/hooks/useIsShowingEllipsis.js.map +1 -1
- package/dist/cjs/hooks/useOnBlurOut.js +15 -9
- package/dist/cjs/hooks/useOnBlurOut.js.map +1 -1
- package/dist/cjs/hooks/useOnElementResize.js +11 -5
- package/dist/cjs/hooks/useOnElementResize.js.map +1 -1
- package/dist/cjs/hooks/useOnFirstFocusIn.js +35 -23
- package/dist/cjs/hooks/useOnFirstFocusIn.js.map +1 -1
- package/dist/cjs/hooks/useOnSpecificFocus.js +15 -7
- package/dist/cjs/hooks/useOnSpecificFocus.js.map +1 -1
- package/dist/cjs/hooks/usePrevious.js +4 -1
- package/dist/cjs/hooks/usePrevious.js.map +1 -1
- package/dist/cjs/hooks/useResizeObserver.js +23 -12
- package/dist/cjs/hooks/useResizeObserver.js.map +2 -2
- package/dist/cjs/hooks/useShouldRecalculate.js +4 -1
- package/dist/cjs/hooks/useShouldRecalculate.js.map +1 -1
- package/dist/cjs/hooks/useWindowScrollerList.js +20 -14
- package/dist/cjs/hooks/useWindowScrollerList.js.map +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/objectUtilities.js +4 -1
- package/dist/cjs/objectUtilities.js.map +1 -1
- package/dist/cjs/onClickHandlerForNonInteractiveElements.js +4 -1
- package/dist/cjs/onClickHandlerForNonInteractiveElements.js.map +1 -1
- package/dist/cjs/operators.js +4 -1
- package/dist/cjs/operators.js.map +1 -1
- package/dist/cjs/platform.js +4 -1
- package/dist/cjs/platform.js.map +1 -1
- package/dist/cjs/props-helpers/defaultProps/index.js +4 -1
- package/dist/cjs/props-helpers/defaultProps/index.js.map +1 -1
- package/dist/cjs/props-helpers/defaultProps/useMemoMergePropsWithDefault.js +4 -1
- package/dist/cjs/props-helpers/defaultProps/useMemoMergePropsWithDefault.js.map +2 -2
- package/dist/cjs/props-helpers/getProps/index.js +4 -1
- package/dist/cjs/props-helpers/getProps/index.js.map +1 -1
- package/dist/cjs/props-helpers/globalProps/constants.js +7 -2
- package/dist/cjs/props-helpers/globalProps/constants.js.map +1 -1
- package/dist/cjs/props-helpers/globalProps/getGlobalAttributes.js +4 -1
- package/dist/cjs/props-helpers/globalProps/getGlobalAttributes.js.map +1 -1
- package/dist/cjs/props-helpers/globalProps/globalAttributesPropTypes.js +4 -1
- package/dist/cjs/props-helpers/globalProps/globalAttributesPropTypes.js.map +1 -1
- package/dist/cjs/props-helpers/globalProps/index.js +4 -1
- package/dist/cjs/props-helpers/globalProps/index.js.map +1 -1
- package/dist/cjs/props-helpers/globalProps/useGetGlobalAttributes.js +8 -2
- package/dist/cjs/props-helpers/globalProps/useGetGlobalAttributes.js.map +1 -1
- package/dist/cjs/props-helpers/index.js +4 -1
- package/dist/cjs/props-helpers/index.js.map +1 -1
- package/dist/cjs/props-helpers/propTypes/PropTypes.js +4 -1
- package/dist/cjs/props-helpers/propTypes/PropTypes.js.map +1 -1
- package/dist/cjs/props-helpers/propTypes/customPropTypes.js +4 -1
- package/dist/cjs/props-helpers/propTypes/customPropTypes.js.map +1 -1
- package/dist/cjs/props-helpers/propTypes/describe.js +4 -1
- package/dist/cjs/props-helpers/propTypes/describe.js.map +2 -2
- package/dist/cjs/props-helpers/propTypes/describeConversions.js +17 -4
- package/dist/cjs/props-helpers/propTypes/describeConversions.js.map +2 -2
- package/dist/cjs/props-helpers/propTypes/describeGuards.js +4 -1
- package/dist/cjs/props-helpers/propTypes/describeGuards.js.map +1 -1
- package/dist/cjs/props-helpers/propTypes/index.js +4 -1
- package/dist/cjs/props-helpers/propTypes/index.js.map +2 -2
- package/dist/cjs/props-helpers/propTypes/toTypescript.js +4 -1
- package/dist/cjs/props-helpers/propTypes/toTypescript.js.map +1 -1
- package/dist/cjs/props-helpers/propTypes/types.js +4 -1
- package/dist/cjs/props-helpers/propTypes/types.js.map +1 -1
- package/dist/cjs/props-helpers/tests/globalProps/TestComponent.js +9 -4
- package/dist/cjs/props-helpers/tests/globalProps/TestComponent.js.map +1 -1
- package/dist/cjs/props-helpers/tests/validation/test.schema.js +4 -1
- package/dist/cjs/props-helpers/tests/validation/test.schema.js.map +1 -1
- package/dist/cjs/props-helpers/tests/xstyledProps/TestComponent.js +9 -4
- package/dist/cjs/props-helpers/tests/xstyledProps/TestComponent.js.map +1 -1
- package/dist/cjs/props-helpers/useDeprecateComponent/index.js +4 -1
- package/dist/cjs/props-helpers/useDeprecateComponent/index.js.map +1 -1
- package/dist/cjs/props-helpers/validation/errorTemplates.js +12 -5
- package/dist/cjs/props-helpers/validation/errorTemplates.js.map +1 -1
- package/dist/cjs/props-helpers/validation/index.js +4 -1
- package/dist/cjs/props-helpers/validation/index.js.map +1 -1
- package/dist/cjs/props-helpers/validation/typescriptGuards.js +4 -1
- package/dist/cjs/props-helpers/validation/typescriptGuards.js.map +1 -1
- package/dist/cjs/props-helpers/validation/typescriptParsers.js +4 -1
- package/dist/cjs/props-helpers/validation/typescriptParsers.js.map +1 -1
- package/dist/cjs/props-helpers/validation/typescriptValidator.js +20 -3
- package/dist/cjs/props-helpers/validation/typescriptValidator.js.map +1 -1
- package/dist/cjs/props-helpers/xstyledProps/constants.js +7 -2
- package/dist/cjs/props-helpers/xstyledProps/constants.js.map +1 -1
- package/dist/cjs/props-helpers/xstyledProps/index.js +4 -1
- package/dist/cjs/props-helpers/xstyledProps/index.js.map +1 -1
- package/dist/cjs/props-helpers/xstyledProps/useGetXstyledProps.js +4 -1
- package/dist/cjs/props-helpers/xstyledProps/useGetXstyledProps.js.map +1 -1
- package/dist/cjs/props-helpers/xstyledProps/xstyledPropTypes.js +4 -1
- package/dist/cjs/props-helpers/xstyledProps/xstyledPropTypes.js.map +1 -1
- package/dist/cjs/reactTypesUtility.js +4 -1
- package/dist/cjs/reactTypesUtility.js.map +2 -2
- package/dist/cjs/system.js +4 -1
- package/dist/cjs/system.js.map +1 -1
- package/dist/cjs/timeUtils.js +4 -1
- package/dist/cjs/timeUtils.js.map +1 -1
- package/dist/cjs/utils.js +4 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/validations.js +4 -1
- package/dist/cjs/validations.js.map +1 -1
- package/dist/esm/capitalize.js.map +1 -1
- package/dist/esm/compose.js +3 -1
- package/dist/esm/compose.js.map +1 -1
- package/dist/esm/deprecated/deprecatedMsg.js.map +1 -1
- package/dist/esm/deprecated/index.js.map +1 -1
- package/dist/esm/deprecated/reactTypesUtility.js.map +2 -2
- package/dist/esm/deprecated/scrollingTimer.js.map +1 -1
- package/dist/esm/deprecated/useParentElement.js.map +1 -1
- package/dist/esm/deprecated/useSetRef.js.map +1 -1
- package/dist/esm/deprecated/useUncontrolled.js.map +1 -1
- package/dist/esm/deprecated/useWindowSize.js.map +1 -1
- package/dist/esm/getComponentFromProps.js +12 -6
- package/dist/esm/getComponentFromProps.js.map +2 -2
- package/dist/esm/hooks/index.js.map +2 -2
- package/dist/esm/hooks/useCallbackAfterRender.js.map +1 -1
- package/dist/esm/hooks/useCancellableDelayedCallback.js +6 -3
- package/dist/esm/hooks/useCancellableDelayedCallback.js.map +1 -1
- package/dist/esm/hooks/useDerivedStateFromProps.js.map +1 -1
- package/dist/esm/hooks/useExecutionTimer.js.map +1 -1
- package/dist/esm/hooks/useExpandState.js.map +1 -1
- package/dist/esm/hooks/useFocusTrap.js +30 -19
- package/dist/esm/hooks/useFocusTrap.js.map +1 -1
- package/dist/esm/hooks/useHotkeys.js.map +1 -1
- package/dist/esm/hooks/useHoverHandlersDelay.js.map +1 -1
- package/dist/esm/hooks/useIsMobile.js.map +1 -1
- package/dist/esm/hooks/useIsShowingEllipsis.js +10 -7
- package/dist/esm/hooks/useIsShowingEllipsis.js.map +1 -1
- package/dist/esm/hooks/useOnBlurOut.js +11 -8
- package/dist/esm/hooks/useOnBlurOut.js.map +1 -1
- package/dist/esm/hooks/useOnElementResize.js +7 -4
- package/dist/esm/hooks/useOnElementResize.js.map +1 -1
- package/dist/esm/hooks/useOnFirstFocusIn.js +31 -22
- package/dist/esm/hooks/useOnFirstFocusIn.js.map +1 -1
- package/dist/esm/hooks/useOnSpecificFocus.js +11 -6
- package/dist/esm/hooks/useOnSpecificFocus.js.map +1 -1
- package/dist/esm/hooks/usePrevious.js.map +1 -1
- package/dist/esm/hooks/useResizeObserver.js +19 -11
- package/dist/esm/hooks/useResizeObserver.js.map +1 -1
- package/dist/esm/hooks/useShouldRecalculate.js.map +1 -1
- package/dist/esm/hooks/useWindowScrollerList.js +16 -13
- package/dist/esm/hooks/useWindowScrollerList.js.map +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/objectUtilities.js.map +1 -1
- package/dist/esm/onClickHandlerForNonInteractiveElements.js.map +1 -1
- package/dist/esm/operators.js.map +1 -1
- package/dist/esm/platform.js.map +1 -1
- package/dist/esm/props-helpers/defaultProps/index.js.map +1 -1
- package/dist/esm/props-helpers/defaultProps/useMemoMergePropsWithDefault.js.map +1 -1
- package/dist/esm/props-helpers/getProps/index.js.map +1 -1
- package/dist/esm/props-helpers/globalProps/constants.js +3 -1
- package/dist/esm/props-helpers/globalProps/constants.js.map +1 -1
- package/dist/esm/props-helpers/globalProps/getGlobalAttributes.js.map +1 -1
- package/dist/esm/props-helpers/globalProps/globalAttributesPropTypes.js.map +1 -1
- package/dist/esm/props-helpers/globalProps/index.js.map +1 -1
- package/dist/esm/props-helpers/globalProps/useGetGlobalAttributes.js +4 -1
- package/dist/esm/props-helpers/globalProps/useGetGlobalAttributes.js.map +1 -1
- package/dist/esm/props-helpers/index.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/PropTypes.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/customPropTypes.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/describe.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/describeConversions.js +13 -3
- package/dist/esm/props-helpers/propTypes/describeConversions.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/describeGuards.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/index.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/toTypescript.js.map +1 -1
- package/dist/esm/props-helpers/propTypes/types.js.map +1 -1
- package/dist/esm/props-helpers/tests/globalProps/TestComponent.js +5 -3
- package/dist/esm/props-helpers/tests/globalProps/TestComponent.js.map +2 -2
- package/dist/esm/props-helpers/tests/validation/test.schema.js.map +1 -1
- package/dist/esm/props-helpers/tests/xstyledProps/TestComponent.js +5 -3
- package/dist/esm/props-helpers/tests/xstyledProps/TestComponent.js.map +2 -2
- package/dist/esm/props-helpers/useDeprecateComponent/index.js.map +1 -1
- package/dist/esm/props-helpers/validation/errorTemplates.js +8 -4
- package/dist/esm/props-helpers/validation/errorTemplates.js.map +1 -1
- package/dist/esm/props-helpers/validation/index.js.map +1 -1
- package/dist/esm/props-helpers/validation/typescriptGuards.js.map +1 -1
- package/dist/esm/props-helpers/validation/typescriptParsers.js.map +1 -1
- package/dist/esm/props-helpers/validation/typescriptValidator.js +16 -2
- package/dist/esm/props-helpers/validation/typescriptValidator.js.map +1 -1
- package/dist/esm/props-helpers/xstyledProps/constants.js +3 -1
- package/dist/esm/props-helpers/xstyledProps/constants.js.map +1 -1
- package/dist/esm/props-helpers/xstyledProps/index.js.map +1 -1
- package/dist/esm/props-helpers/xstyledProps/useGetXstyledProps.js.map +1 -1
- package/dist/esm/props-helpers/xstyledProps/xstyledPropTypes.js.map +1 -1
- package/dist/esm/reactTypesUtility.js.map +2 -2
- package/dist/esm/system.js.map +1 -1
- package/dist/esm/timeUtils.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/validations.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useFocusTrap.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, useEffect, WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '../props-helpers';\n\nconst useFocusTrapProps: { [index: string]: string } = {\n firstElementRef: 'object',\n lastElementRef: 'object',\n onKeyDown: 'function',\n};\n\nconst getVariableType = (arg: unknown): string => {\n if (Array.isArray(arg)) return 'array';\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n return typeof arg;\n};\n\nconst throwTypeError = (validPropKey: string, invalidProp: unknown): void => {\n throw new Error(\n `Warning: You are trying to pass a not valid \"${validPropKey}\" property to use a useFocusTrap hook, please provide a valid type.\n\n Received: ${getVariableType(invalidProp)}\n Expected: ${useFocusTrapProps[validPropKey]}\n `,\n );\n};\n\nconst throwRequiredError = (validPropKey: string): void => {\n throw new Error(\n `Warning: Please provide a \"${validPropKey}\" property to use a useFocusTrap hook, this property is required.`,\n );\n};\n\nconst validateProps = (componentProps: Record<string, unknown>): void => {\n if (componentProps.firstElementRef === undefined) {\n throwRequiredError('firstElementRef');\n }\n if (componentProps.lastElementRef === undefined) {\n throwRequiredError('lastElementRef');\n }\n if (componentProps.firstElementRef && typeof componentProps.firstElementRef !== 'object') {\n throwTypeError('firstElementRef', componentProps.firstElementRef);\n }\n if (componentProps.lastElementRef && typeof componentProps.lastElementRef !== 'object') {\n throwTypeError('lastElementRef', componentProps.lastElementRef);\n }\n if (componentProps.onKeyDown && typeof componentProps.onKeyDown !== 'function') {\n throwTypeError('onKeyDown', componentProps.onKeyDown);\n }\n};\n\nconst propTypes = {\n firstElementRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.node]).description(\n 'Reference to the first element in the focus trap.',\n ).isRequired,\n lastElementRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.node]).description(\n 'Reference to the second element in the focus trap.',\n ).isRequired,\n onKeyDown: PropTypes.func.description('Optional onKeyDown callback.'),\n} as WeakValidationMap<unknown>;\n\ntype UseFocusTrapFunctionT = <T extends HTMLElement = HTMLElement, K extends HTMLElement = HTMLElement>({\n firstElementRef,\n lastElementRef,\n onKeyDown,\n}: {\n firstElementRef: React.MutableRefObject<T | null>;\n lastElementRef: React.MutableRefObject<K | null>;\n onKeyDown?: (e: KeyboardEvent) => void;\n}) => (e: KeyboardEvent) => void;\n\ninterface UseFocusTrapT extends UseFocusTrapFunctionT {\n displayName: 'useFocusTrap';\n}\n\nconst useFocusTrap: UseFocusTrapT = (props) => {\n // We need to investigate how to validate references with useValidateTypescriptPropTypes.\n useEffect(() => validateProps(props), [props]);\n\n const { firstElementRef, lastElementRef, onKeyDown } = props;\n\n return useCallback(\n (e: KeyboardEvent) => {\n if (onKeyDown) onKeyDown(e);\n // we need to check all the condition before preventing default\n // because we want last-element/first-element tab/shift-tab to keep working\n\n if (e.key === 'Tab' && !e.shiftKey && e.target === lastElementRef.current && firstElementRef.current) {\n e.preventDefault();\n e.stopPropagation();\n firstElementRef.current.focus();\n }\n if (e.key === 'Tab' && e.shiftKey && e.target === firstElementRef.current && lastElementRef.current) {\n e.preventDefault();\n e.stopPropagation();\n lastElementRef.current.focus();\n }\n },\n [firstElementRef, lastElementRef, onKeyDown],\n );\n};\n\nuseFocusTrap.displayName = 'useFocusTrap';\nconst UseFocusTrapWithSchema = describe(useFocusTrap);\n\nUseFocusTrapWithSchema.propTypes = propTypes;\n\nexport { useFocusTrap, UseFocusTrapWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAiE;AACjE,2BAAoC;AAEpC,MAAM,oBAAiD;AAAA,EACrD,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,WAAW;AACb;AAEA,MAAM,kBAAkB,CAAC,QAAyB;AAChD,MAAI,MAAM,QAAQ,GAAG;AAAG,WAAO;AAC/B,MAAI,QAAQ;AAAM,WAAO;AACzB,MAAI,QAAQ;AAAW,WAAO;AAC9B,SAAO,OAAO;AAChB;AAEA,MAAM,iBAAiB,CAAC,cAAsB,gBAA+B;AAC3E,QAAM,IAAI;AAAA,IACR,gDAAgD;AAAA;AAAA,cAEtC,gBAAgB,WAAW;AAAA,cAC3B,kBAAkB;AAAA;AAAA,EAE9B;AACF;AAEA,MAAM,qBAAqB,CAAC,iBAA+B;AACzD,QAAM,IAAI;AAAA,IACR,8BAA8B;AAAA,EAChC;AACF;AAEA,MAAM,gBAAgB,CAAC,mBAAkD;AACvE,MAAI,eAAe,oBAAoB,QAAW;AAChD,uBAAmB,iBAAiB;AAAA,EACtC;AACA,MAAI,eAAe,mBAAmB,QAAW;AAC/C,uBAAmB,gBAAgB;AAAA,EACrC;AACA,MAAI,eAAe,mBAAmB,OAAO,eAAe,oBAAoB,UAAU;AACxF,mBAAe,mBAAmB,eAAe,eAAe;AAAA,EAClE;AACA,MAAI,eAAe,kBAAkB,OAAO,eAAe,mBAAmB,UAAU;AACtF,mBAAe,kBAAkB,eAAe,cAAc;AAAA,EAChE;AACA,MAAI,eAAe,aAAa,OAAO,eAAe,cAAc,YAAY;AAC9E,mBAAe,aAAa,eAAe,SAAS;AAAA,EACtD;AACF;AAEA,MAAM,YAAY;AAAA,EAChB,iBAAiB,+BAAU,UAAU,CAAC,+BAAU,MAAM,CAAC,IAAI,CAAC,GAAG,+BAAU,IAAI,CAAC,EAAE;AAAA,IAC9E;AAAA,EACF,EAAE;AAAA,EACF,gBAAgB,+BAAU,UAAU,CAAC,+BAAU,MAAM,CAAC,IAAI,CAAC,GAAG,+BAAU,IAAI,CAAC,EAAE;AAAA,IAC7E;AAAA,EACF,EAAE;AAAA,EACF,WAAW,+BAAU,KAAK,YAAY,8BAA8B;AACtE;AAgBA,MAAM,eAA8B,CAAC,UAAU;AAE7C,8BAAU,MAAM,cAAc,KAAK,GAAG,CAAC,KAAK,CAAC;AAE7C,QAAM,EAAE,iBAAiB,gBAAgB,UAAU,IAAI;AAEvD,aAAO;AAAA,IACL,CAAC,MAAqB;AACpB,UAAI;AAAW,kBAAU,CAAC;AAI1B,UAAI,EAAE,QAAQ,SAAS,CAAC,EAAE,YAAY,EAAE,WAAW,eAAe,WAAW,gBAAgB,SAAS;AACpG,UAAE,eAAe;AACjB,UAAE,gBAAgB;AAClB,wBAAgB,QAAQ,MAAM;AAAA,MAChC;AACA,UAAI,EAAE,QAAQ,SAAS,EAAE,YAAY,EAAE,WAAW,gBAAgB,WAAW,eAAe,SAAS;AACnG,UAAE,eAAe;AACjB,UAAE,gBAAgB;AAClB,uBAAe,QAAQ,MAAM;AAAA,MAC/B;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,gBAAgB,SAAS;AAAA,EAC7C;AACF;AAEA,aAAa,cAAc;AAC3B,MAAM,6BAAyB,+BAAS,YAAY;AAEpD,uBAAuB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useHotkeys_exports = {};
|
|
23
26
|
__export(useHotkeys_exports, {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useHotkeys.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import hotkeys, { KeyHandler } from 'hotkeys-js';\nimport { useCallback, useEffect } from 'react';\n\ntype Options = {\n scope?: string;\n element?: HTMLElement | null;\n keyup?: boolean | null;\n keydown?: boolean | null;\n splitKey?: string;\n};\ninterface UseHotKeysArg {\n keys: string;\n options?: Options;\n handler: KeyHandler;\n}\n\nexport const useHotkeys = ({ keys, handler, options = {} }: UseHotKeysArg, deps: unknown[] = []) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const memoizedCallback = useCallback(handler, deps);\n\n useEffect(() => {\n hotkeys(keys, options, memoizedCallback);\n\n return () => hotkeys.unbind(keys);\n }, [keys, memoizedCallback, options]);\n};\n\nexport default useHotkeys;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAoC;AACpC,mBAAuC;AAehC,MAAM,aAAa,CAAC,EAAE,MAAM,SAAS,UAAU,CAAC,EAAE,GAAkB,OAAkB,CAAC,MAAM;AAElG,QAAM,uBAAmB,0BAAY,SAAS,IAAI;AAElD,8BAAU,MAAM;AACd,0BAAAA,SAAQ,MAAM,SAAS,gBAAgB;AAEvC,WAAO,MAAM,kBAAAA,QAAQ,OAAO,IAAI;AAAA,EAClC,GAAG,CAAC,MAAM,kBAAkB,OAAO,CAAC;AACtC;AAEA,IAAO,qBAAQ;",
|
|
6
|
+
"names": ["hotkeys"]
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useHoverHandlersDelay_exports = {};
|
|
23
26
|
__export(useHoverHandlersDelay_exports, {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useHoverHandlersDelay.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useCallback, useRef } from 'react';\n\ninterface UseHoverHandlersDelayArg {\n onMouseOver: () => void;\n onMouseLeave: () => void;\n hideDelay?: number;\n showDelay?: number;\n}\n\nexport const useHoverHandlersDelay = ({\n onMouseOver,\n onMouseLeave,\n hideDelay = 300,\n showDelay = 300,\n}: UseHoverHandlersDelayArg) => {\n const hideTimer = useRef<NodeJS.Timeout>();\n const showTimer = useRef<NodeJS.Timeout>();\n\n const delayedHide = useCallback(() => {\n if (showTimer.current) clearTimeout(showTimer.current);\n hideTimer.current = setTimeout(onMouseLeave, hideDelay);\n }, [hideDelay, onMouseLeave]);\n\n const delayedShow = useCallback(() => {\n if (hideTimer.current) clearTimeout(hideTimer.current);\n showTimer.current = setTimeout(onMouseOver, showDelay);\n }, [onMouseOver, showDelay]);\n\n return {\n onMouseOver: delayedShow,\n onMouseLeave: delayedHide,\n };\n};\n\nexport default useHoverHandlersDelay;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AAS7B,MAAM,wBAAwB,CAAC;AAAA,EACpC;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AACd,MAAgC;AAC9B,QAAM,gBAAY,qBAAuB;AACzC,QAAM,gBAAY,qBAAuB;AAEzC,QAAM,kBAAc,0BAAY,MAAM;AACpC,QAAI,UAAU;AAAS,mBAAa,UAAU,OAAO;AACrD,cAAU,UAAU,WAAW,cAAc,SAAS;AAAA,EACxD,GAAG,CAAC,WAAW,YAAY,CAAC;AAE5B,QAAM,kBAAc,0BAAY,MAAM;AACpC,QAAI,UAAU;AAAS,mBAAa,UAAU,OAAO;AACrD,cAAU,UAAU,WAAW,aAAa,SAAS;AAAA,EACvD,GAAG,CAAC,aAAa,SAAS,CAAC;AAE3B,SAAO;AAAA,IACL,aAAa;AAAA,IACb,cAAc;AAAA,EAChB;AACF;AAEA,IAAO,gCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useIsMobile_exports = {};
|
|
23
26
|
__export(useIsMobile_exports, {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useIsMobile.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useState, useEffect } from 'react';\nimport { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\n\nconst theme = getDefaultTheme() as Theme;\n\nconst isMobile = (): boolean => {\n if (!window) return false;\n return Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;\n};\n\nexport const useIsMobile = (): boolean => {\n const [mobile, setMobile] = useState<boolean>(isMobile());\n\n useEffect(() => {\n function handleResize() {\n setMobile(isMobile());\n }\n window?.addEventListener('resize', handleResize);\n return () => {\n window?.removeEventListener('resize', handleResize);\n };\n }, []);\n\n if (!window) return false;\n return mobile;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AACpC,uBAAgC;AAGhC,MAAM,YAAQ,kCAAgB;AAE9B,MAAM,WAAW,MAAe;AAC9B,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO,OAAO,MAAM,YAAY,OAAO,MAAM,IAAI,EAAE,EAAE,IAAI,OAAO,cAAc;AAChF;AAEO,MAAM,cAAc,MAAe;AACxC,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkB,SAAS,CAAC;AAExD,8BAAU,MAAM;AACd,aAAS,eAAe;AACtB,gBAAU,SAAS,CAAC;AAAA,IACtB;AACA,YAAQ,iBAAiB,UAAU,YAAY;AAC/C,WAAO,MAAM;AACX,cAAQ,oBAAoB,UAAU,YAAY;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useIsShowingEllipsis_exports = {};
|
|
23
26
|
__export(useIsShowingEllipsis_exports, {
|
|
@@ -29,13 +32,16 @@ var import_react = require("react");
|
|
|
29
32
|
const useIsShowingEllipsis = () => {
|
|
30
33
|
const [element, setElement] = (0, import_react.useState)();
|
|
31
34
|
const [isShowingEllipsis, setIsShowingEllipsis] = (0, import_react.useState)(false);
|
|
32
|
-
const resizeObserver = (0, import_react.useMemo)(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const resizeObserver = (0, import_react.useMemo)(
|
|
36
|
+
() => new ResizeObserver((entries) => {
|
|
37
|
+
if (entries.length) {
|
|
38
|
+
const [textWrapperEntry] = entries;
|
|
39
|
+
const el = textWrapperEntry.target;
|
|
40
|
+
setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
39
45
|
(0, import_react.useEffect)(() => {
|
|
40
46
|
if (element) {
|
|
41
47
|
setIsShowingEllipsis(element.scrollWidth > element.clientWidth);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useIsShowingEllipsis.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useEffect, useState, useMemo } from 'react';\n\nexport const useIsShowingEllipsis = <T extends HTMLElement | null = HTMLElement | null>() => {\n const [element, setElement] = useState<T>();\n\n const [isShowingEllipsis, setIsShowingEllipsis] = useState(false);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (entries.length) {\n const [textWrapperEntry] = entries;\n const el = textWrapperEntry.target;\n setIsShowingEllipsis(el?.scrollWidth > el?.clientWidth);\n }\n }),\n [],\n );\n\n useEffect(() => {\n if (element) {\n setIsShowingEllipsis(element.scrollWidth > element.clientWidth);\n resizeObserver.observe(element);\n }\n return () => {\n if (element) {\n resizeObserver.unobserve(element);\n }\n };\n }, [resizeObserver, element]);\n\n return { setElement, isShowingEllipsis };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAEtC,MAAM,uBAAuB,MAAyD;AAC3F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAY;AAE1C,QAAM,CAAC,mBAAmB,oBAAoB,QAAI,uBAAS,KAAK;AAEhE,QAAM,qBAAiB;AAAA,IACrB,MACE,IAAI,eAAe,CAAC,YAAY;AAC9B,UAAI,QAAQ,QAAQ;AAClB,cAAM,CAAC,gBAAgB,IAAI;AAC3B,cAAM,KAAK,iBAAiB;AAC5B,6BAAqB,IAAI,cAAc,IAAI,WAAW;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,8BAAU,MAAM;AACd,QAAI,SAAS;AACX,2BAAqB,QAAQ,cAAc,QAAQ,WAAW;AAC9D,qBAAe,QAAQ,OAAO;AAAA,IAChC;AACA,WAAO,MAAM;AACX,UAAI,SAAS;AACX,uBAAe,UAAU,OAAO;AAAA,MAClC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,gBAAgB,OAAO,CAAC;AAE5B,SAAO,EAAE,YAAY,kBAAkB;AACzC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useOnBlurOut_exports = {};
|
|
23
26
|
__export(useOnBlurOut_exports, {
|
|
@@ -31,14 +34,17 @@ var import_props_helpers = require("../props-helpers");
|
|
|
31
34
|
const propTypes = {
|
|
32
35
|
onBlur: import_props_helpers.PropTypes.func.description("The function to be invoked when focus exits the wrapping container").signature("((e: React.FocusEvent, ...args: unknown[]) => void)").isRequired
|
|
33
36
|
};
|
|
34
|
-
const useOnBlurOut = ({ onBlur }) => (0, import_react.useCallback)(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
37
|
+
const useOnBlurOut = ({ onBlur }) => (0, import_react.useCallback)(
|
|
38
|
+
(e, ...args) => {
|
|
39
|
+
const { currentTarget } = e;
|
|
40
|
+
requestAnimationFrame(() => {
|
|
41
|
+
if (!currentTarget.contains(document.activeElement)) {
|
|
42
|
+
onBlur(e, ...args);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
[onBlur]
|
|
47
|
+
);
|
|
42
48
|
const UseOnBlurOutWithSchema = (0, import_props_helpers.describe)(useOnBlurOut);
|
|
43
49
|
UseOnBlurOutWithSchema.propTypes = propTypes;
|
|
44
50
|
//# sourceMappingURL=useOnBlurOut.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useOnBlurOut.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '../props-helpers';\n\nconst propTypes = {\n onBlur: PropTypes.func\n .description('The function to be invoked when focus exits the wrapping container')\n .signature('((e: React.FocusEvent, ...args: unknown[]) => void)').isRequired,\n} as WeakValidationMap<unknown>;\n\ntype OnBlurCb = (e: React.FocusEvent, ...args: unknown[]) => void;\ntype UseOnBlurOut = ({ onBlur }: { onBlur: OnBlurCb }) => OnBlurCb;\nconst useOnBlurOut: UseOnBlurOut = ({ onBlur }) =>\n useCallback<OnBlurCb>(\n (e, ...args) => {\n const { currentTarget } = e;\n // Give browser time to focus the next element\n requestAnimationFrame(() => {\n // Check if the new focused element is a child of the original container\n if (!currentTarget.contains(document.activeElement)) {\n onBlur(e, ...args);\n }\n });\n },\n [onBlur],\n );\n\nconst UseOnBlurOutWithSchema = describe(useOnBlurOut);\nUseOnBlurOutWithSchema.propTypes = propTypes;\n\nexport { useOnBlurOut, UseOnBlurOutWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsD;AACtD,2BAAoC;AAEpC,MAAM,YAAY;AAAA,EAChB,QAAQ,+BAAU,KACf,YAAY,oEAAoE,EAChF,UAAU,qDAAqD,EAAE;AACtE;AAIA,MAAM,eAA6B,CAAC,EAAE,OAAO,UAC3C;AAAA,EACE,CAAC,MAAM,SAAS;AACd,UAAM,EAAE,cAAc,IAAI;AAE1B,0BAAsB,MAAM;AAE1B,UAAI,CAAC,cAAc,SAAS,SAAS,aAAa,GAAG;AACnD,eAAO,GAAG,GAAG,IAAI;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,CAAC,MAAM;AACT;AAEF,MAAM,6BAAyB,+BAAS,YAAY;AACpD,uBAAuB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useOnElementResize_exports = {};
|
|
23
26
|
__export(useOnElementResize_exports, {
|
|
@@ -41,9 +44,12 @@ const useOnElementResize = (targetRef) => {
|
|
|
41
44
|
observer.current?.disconnect();
|
|
42
45
|
};
|
|
43
46
|
}, [targetRef]);
|
|
44
|
-
return (0, import_react.useMemo)(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
return (0, import_react.useMemo)(
|
|
48
|
+
() => ({
|
|
49
|
+
width,
|
|
50
|
+
height
|
|
51
|
+
}),
|
|
52
|
+
[width, height]
|
|
53
|
+
);
|
|
48
54
|
};
|
|
49
55
|
//# sourceMappingURL=useOnElementResize.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useOnElementResize.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useState, useEffect, useRef, useMemo } from 'react';\n\n// Custom hook to track dimension of a component\n// Taken and modified from https://stackoverflow.com/a/60218754\nexport const useOnElementResize = <T extends HTMLElement>(\n targetRef: React.RefObject<T>,\n): Record<'width' | 'height', number> => {\n const [width, setWidth] = useState(targetRef.current?.offsetWidth ?? 0);\n const [height, setHeight] = useState(targetRef.current?.offsetHeight ?? 0);\n const observer = useRef<ResizeObserver>();\n\n useEffect(() => {\n function outputsize() {\n setWidth(targetRef.current?.offsetWidth ?? 0);\n setHeight(targetRef.current?.offsetHeight ?? 0);\n }\n\n observer.current = new ResizeObserver(outputsize);\n observer.current.observe(targetRef.current as Element);\n\n return () => {\n observer.current?.disconnect();\n };\n }, [targetRef]);\n\n return useMemo(\n () => ({\n width,\n height,\n }),\n [width, height],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4D;AAIrD,MAAM,qBAAqB,CAChC,cACuC;AACvC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,UAAU,SAAS,eAAe,CAAC;AACtE,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,UAAU,SAAS,gBAAgB,CAAC;AACzE,QAAM,eAAW,qBAAuB;AAExC,8BAAU,MAAM;AACd,aAAS,aAAa;AACpB,eAAS,UAAU,SAAS,eAAe,CAAC;AAC5C,gBAAU,UAAU,SAAS,gBAAgB,CAAC;AAAA,IAChD;AAEA,aAAS,UAAU,IAAI,eAAe,UAAU;AAChD,aAAS,QAAQ,QAAQ,UAAU,OAAkB;AAErD,WAAO,MAAM;AACX,eAAS,SAAS,WAAW;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,OAAO,MAAM;AAAA,EAChB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useOnFirstFocusIn_exports = {};
|
|
23
26
|
__export(useOnFirstFocusIn_exports, {
|
|
@@ -34,28 +37,37 @@ const propTypes = {
|
|
|
34
37
|
};
|
|
35
38
|
const useOnFirstFocusIn = ({ onFirstFocus, onBlur }) => {
|
|
36
39
|
const mutableDidChildBlur = (0, import_react.useRef)(false);
|
|
37
|
-
const onFirstFocusHelper = (0, import_react.useCallback)(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
const onFirstFocusHelper = (0, import_react.useCallback)(
|
|
41
|
+
(e, ...args) => {
|
|
42
|
+
const { currentTarget } = e;
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
const isChildFocus = currentTarget.contains(document.activeElement);
|
|
45
|
+
const isFirstFocus = isChildFocus && !mutableDidChildBlur.current;
|
|
46
|
+
if (isFirstFocus) {
|
|
47
|
+
onFirstFocus(e, ...args);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
[onFirstFocus]
|
|
52
|
+
);
|
|
53
|
+
const onBlurHelper = (0, import_react.useCallback)(
|
|
54
|
+
(e, ...args) => {
|
|
55
|
+
onBlur?.(e, ...args);
|
|
56
|
+
const { currentTarget } = e;
|
|
57
|
+
requestAnimationFrame(() => {
|
|
58
|
+
const isChildBlur = currentTarget.contains(document.activeElement);
|
|
59
|
+
mutableDidChildBlur.current = isChildBlur;
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
[onBlur]
|
|
63
|
+
);
|
|
64
|
+
return (0, import_react.useMemo)(
|
|
65
|
+
() => ({
|
|
66
|
+
onFirstFocus: onFirstFocusHelper,
|
|
67
|
+
onBlur: onBlurHelper
|
|
68
|
+
}),
|
|
69
|
+
[onFirstFocusHelper, onBlurHelper]
|
|
70
|
+
);
|
|
59
71
|
};
|
|
60
72
|
const UseOnFirstFocusInWithSchema = (0, import_props_helpers.describe)(useOnFirstFocusIn);
|
|
61
73
|
UseOnFirstFocusInWithSchema.propTypes = propTypes;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useOnFirstFocusIn.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, useMemo, useRef, WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '../props-helpers';\n\nconst propTypes = {\n onFirstFocusCb: PropTypes.func\n .description('The function to be invoked when focus enters the wrapping container for the first time')\n .signature('((e: React.FocusEvent, ...args: unknown[]) => void)').isRequired,\n onBlurCb: PropTypes.func\n .description('Optional onBlur function to be invoked along the returned onBlur handler')\n .signature('((e: React.FocusEvent, ...args: unknown[]) => void)'),\n} as WeakValidationMap<unknown>;\n\ntype OnBlurCb = (e: React.FocusEvent, ...args: unknown[]) => void;\ntype OnFirstFocusCb = (e: React.FocusEvent, ...args: unknown[]) => void;\ntype UseFirstFocusIn = ({ onFirstFocus, onBlur }: { onFirstFocus: OnFirstFocusCb; onBlur: OnBlurCb }) => {\n onFirstFocus: OnFirstFocusCb;\n onBlur: OnBlurCb;\n};\n\nconst useOnFirstFocusIn: UseFirstFocusIn = ({ onFirstFocus, onBlur }) => {\n const mutableDidChildBlur = useRef(false);\n const onFirstFocusHelper = useCallback<OnFirstFocusCb>(\n (e, ...args) => {\n const { currentTarget } = e;\n // Give browser time to focus the next element\n requestAnimationFrame(() => {\n const isChildFocus = currentTarget.contains(document.activeElement);\n const isFirstFocus = isChildFocus && !mutableDidChildBlur.current;\n if (isFirstFocus) {\n onFirstFocus(e, ...args);\n }\n });\n },\n [onFirstFocus],\n );\n const onBlurHelper = useCallback<OnBlurCb>(\n (e, ...args) => {\n onBlur?.(e, ...args);\n const { currentTarget } = e;\n // Give browser time to focus the next element\n requestAnimationFrame(() => {\n const isChildBlur = currentTarget.contains(document.activeElement);\n mutableDidChildBlur.current = isChildBlur;\n });\n },\n [onBlur],\n );\n return useMemo(\n () => ({\n onFirstFocus: onFirstFocusHelper,\n onBlur: onBlurHelper,\n }),\n [onFirstFocusHelper, onBlurHelper],\n );\n};\n\nconst UseOnFirstFocusInWithSchema = describe(useOnFirstFocusIn);\nUseOnFirstFocusInWithSchema.propTypes = propTypes;\n\nexport { useOnFirstFocusIn, UseOnFirstFocusInWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAuE;AACvE,2BAAoC;AAEpC,MAAM,YAAY;AAAA,EAChB,gBAAgB,+BAAU,KACvB,YAAY,wFAAwF,EACpG,UAAU,qDAAqD,EAAE;AAAA,EACpE,UAAU,+BAAU,KACjB,YAAY,0EAA0E,EACtF,UAAU,qDAAqD;AACpE;AASA,MAAM,oBAAqC,CAAC,EAAE,cAAc,OAAO,MAAM;AACvE,QAAM,0BAAsB,qBAAO,KAAK;AACxC,QAAM,yBAAqB;AAAA,IACzB,CAAC,MAAM,SAAS;AACd,YAAM,EAAE,cAAc,IAAI;AAE1B,4BAAsB,MAAM;AAC1B,cAAM,eAAe,cAAc,SAAS,SAAS,aAAa;AAClE,cAAM,eAAe,gBAAgB,CAAC,oBAAoB;AAC1D,YAAI,cAAc;AAChB,uBAAa,GAAG,GAAG,IAAI;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AACA,QAAM,mBAAe;AAAA,IACnB,CAAC,MAAM,SAAS;AACd,eAAS,GAAG,GAAG,IAAI;AACnB,YAAM,EAAE,cAAc,IAAI;AAE1B,4BAAsB,MAAM;AAC1B,cAAM,cAAc,cAAc,SAAS,SAAS,aAAa;AACjE,4BAAoB,UAAU;AAAA,MAChC,CAAC;AAAA,IACH;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACA,aAAO;AAAA,IACL,OAAO;AAAA,MACL,cAAc;AAAA,MACd,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,oBAAoB,YAAY;AAAA,EACnC;AACF;AAEA,MAAM,kCAA8B,+BAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useOnSpecificFocus_exports = {};
|
|
23
26
|
__export(useOnSpecificFocus_exports, {
|
|
@@ -29,13 +32,18 @@ var React = __toESM(require("react"));
|
|
|
29
32
|
var import_react = require("react");
|
|
30
33
|
var import_props_helpers = require("../props-helpers");
|
|
31
34
|
const propTypes = {
|
|
32
|
-
onFocus: import_props_helpers.PropTypes.func.description(
|
|
35
|
+
onFocus: import_props_helpers.PropTypes.func.description(
|
|
36
|
+
"The function to be invoked when focusing specifically the element attached to (ignoring child focus events)"
|
|
37
|
+
).signature("((e: React.FocusEvent, ...args: unknown[]) => void)").isRequired
|
|
33
38
|
};
|
|
34
|
-
const useOnSpecificFocus = ({ onFocus }) => (0, import_react.useCallback)(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
const useOnSpecificFocus = ({ onFocus }) => (0, import_react.useCallback)(
|
|
40
|
+
(e, ...args) => {
|
|
41
|
+
const { currentTarget, target } = e;
|
|
42
|
+
if (currentTarget === target && document.activeElement === currentTarget)
|
|
43
|
+
onFocus(e, ...args);
|
|
44
|
+
},
|
|
45
|
+
[onFocus]
|
|
46
|
+
);
|
|
39
47
|
const UseOnSpecificFocusWithSchema = (0, import_props_helpers.describe)(useOnSpecificFocus);
|
|
40
48
|
UseOnSpecificFocusWithSchema.propTypes = propTypes;
|
|
41
49
|
//# sourceMappingURL=useOnSpecificFocus.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useOnSpecificFocus.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '../props-helpers';\n\nconst propTypes = {\n onFocus: PropTypes.func\n .description(\n 'The function to be invoked when focusing specifically the element attached to (ignoring child focus events)',\n )\n .signature('((e: React.FocusEvent, ...args: unknown[]) => void)').isRequired,\n} as WeakValidationMap<unknown>;\n\ntype OnFocusCb = (e: React.FocusEvent, ...args: unknown[]) => void;\ntype UseOnBlurOut = ({ onFocus }: { onFocus: OnFocusCb }) => OnFocusCb;\nconst useOnSpecificFocus: UseOnBlurOut = ({ onFocus }) =>\n useCallback<OnFocusCb>(\n (e, ...args) => {\n const { currentTarget, target } = e;\n if (currentTarget === target && document.activeElement === currentTarget) onFocus(e, ...args);\n },\n [onFocus],\n );\nconst UseOnSpecificFocusWithSchema = describe(useOnSpecificFocus);\nUseOnSpecificFocusWithSchema.propTypes = propTypes;\n\nexport { useOnSpecificFocus, UseOnSpecificFocusWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsD;AACtD,2BAAoC;AAEpC,MAAM,YAAY;AAAA,EAChB,SAAS,+BAAU,KAChB;AAAA,IACC;AAAA,EACF,EACC,UAAU,qDAAqD,EAAE;AACtE;AAIA,MAAM,qBAAmC,CAAC,EAAE,QAAQ,UAClD;AAAA,EACE,CAAC,MAAM,SAAS;AACd,UAAM,EAAE,eAAe,OAAO,IAAI;AAClC,QAAI,kBAAkB,UAAU,SAAS,kBAAkB;AAAe,cAAQ,GAAG,GAAG,IAAI;AAAA,EAC9F;AAAA,EACA,CAAC,OAAO;AACV;AACF,MAAM,mCAA+B,+BAAS,kBAAkB;AAChE,6BAA6B,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var usePrevious_exports = {};
|
|
23
26
|
__export(usePrevious_exports, {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/usePrevious.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useEffect, useRef } from 'react';\n\nexport const usePrevious = (value: unknown) => {\n const ref = useRef<unknown>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n\nexport default usePrevious;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAE3B,MAAM,cAAc,CAAC,UAAmB;AAC7C,QAAM,UAAM,qBAAgB;AAE5B,8BAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAChB,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO,IAAI;AACb;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useResizeObserver_exports = {};
|
|
23
26
|
__export(useResizeObserver_exports, {
|
|
@@ -31,17 +34,25 @@ var import_raf = __toESM(require("raf"));
|
|
|
31
34
|
var import_resize_observer_polyfill = __toESM(require("resize-observer-polyfill"));
|
|
32
35
|
const useResizeObserver = (handler, el) => {
|
|
33
36
|
const [node, setRef] = (0, import_react.useState)(el);
|
|
34
|
-
const resizeObserver = (0, import_react.useMemo)(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const resizeObserver = (0, import_react.useMemo)(
|
|
38
|
+
() => new import_resize_observer_polyfill.default((entries) => {
|
|
39
|
+
if (!Array.isArray(entries))
|
|
40
|
+
return;
|
|
41
|
+
if (!entries.length)
|
|
42
|
+
return;
|
|
43
|
+
const entry = entries[0];
|
|
44
|
+
(0, import_raf.default)(
|
|
45
|
+
() => handler(
|
|
46
|
+
{
|
|
47
|
+
width: entry.target.offsetWidth,
|
|
48
|
+
height: entry.target.offsetHeight
|
|
49
|
+
},
|
|
50
|
+
entry.target
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
}),
|
|
54
|
+
[handler]
|
|
55
|
+
);
|
|
45
56
|
const htmlEl = el || node;
|
|
46
57
|
(0, import_react.useEffect)(() => {
|
|
47
58
|
if (htmlEl)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useResizeObserver.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useEffect, useMemo, useState } from 'react';\nimport raf from 'raf';\nimport ResizeObserver from 'resize-observer-polyfill';\n\ntype HandlerT = (measures: { width: number; height: number }, element: Element) => void;\n\nexport const useResizeObserver = (handler: HandlerT, el: HTMLElement) => {\n const [node, setRef] = useState(el);\n\n const resizeObserver = useMemo(\n () =>\n new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) return;\n if (!entries.length) return;\n const entry = entries[0];\n\n // execute on the next animation frame\n raf(() =>\n handler(\n {\n width: (entry.target as HTMLElement).offsetWidth,\n height: (entry.target as HTMLElement).offsetHeight,\n },\n entry.target,\n ),\n );\n }),\n [handler],\n );\n\n const htmlEl = el || node;\n\n useEffect(() => {\n if (htmlEl) resizeObserver.observe(htmlEl);\n return () => htmlEl && resizeObserver.unobserve(htmlEl);\n }, [htmlEl, resizeObserver]);\n\n return [setRef];\n};\n\nexport default useResizeObserver;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAC7C,iBAAgB;AAChB,sCAA2B;AAIpB,MAAM,oBAAoB,CAAC,SAAmB,OAAoB;AACvE,QAAM,CAAC,MAAM,MAAM,QAAI,uBAAS,EAAE;AAElC,QAAM,qBAAiB;AAAA,IACrB,MACE,IAAI,gCAAAA,QAAe,CAAC,YAAY;AAC9B,UAAI,CAAC,MAAM,QAAQ,OAAO;AAAG;AAC7B,UAAI,CAAC,QAAQ;AAAQ;AACrB,YAAM,QAAQ,QAAQ;AAGtB,qBAAAC;AAAA,QAAI,MACF;AAAA,UACE;AAAA,YACE,OAAQ,MAAM,OAAuB;AAAA,YACrC,QAAS,MAAM,OAAuB;AAAA,UACxC;AAAA,UACA,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAC;AAAA,IACH,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,SAAS,MAAM;AAErB,8BAAU,MAAM;AACd,QAAI;AAAQ,qBAAe,QAAQ,MAAM;AACzC,WAAO,MAAM,UAAU,eAAe,UAAU,MAAM;AAAA,EACxD,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO,CAAC,MAAM;AAChB;AAEA,IAAO,4BAAQ;",
|
|
6
|
+
"names": ["ResizeObserver", "raf"]
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useShouldRecalculate_exports = {};
|
|
23
26
|
__export(useShouldRecalculate_exports, {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useShouldRecalculate.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useRef } from 'react';\n\nexport const useShouldRecalculate = (bool: boolean) => {\n const prevValueRef = useRef(0);\n if (!bool) {\n // If we need to recalculate, change the value we return\n prevValueRef.current += 1;\n } // else we return the same value as the previous render, which won't trigger a recalculation\n return prevValueRef.current;\n};\n\nexport default useShouldRecalculate;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAuB;AAEhB,MAAM,uBAAuB,CAAC,SAAkB;AACrD,QAAM,mBAAe,qBAAO,CAAC;AAC7B,MAAI,CAAC,MAAM;AAET,iBAAa,WAAW;AAAA,EAC1B;AACA,SAAO,aAAa;AACtB;AAEA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var useWindowScrollerList_exports = {};
|
|
23
26
|
__export(useWindowScrollerList_exports, {
|
|
@@ -53,19 +56,22 @@ const useWindowScrollerList = ({ listInstance, outerListRef }) => {
|
|
|
53
56
|
listOffset.current = getPositionOffset(outerListRef.current, scrollableParent.current);
|
|
54
57
|
}
|
|
55
58
|
}, [outerListRef]);
|
|
56
|
-
const handleScroll = (0, import_react.useCallback)(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
listInstance.current
|
|
68
|
-
|
|
59
|
+
const handleScroll = (0, import_react.useCallback)(
|
|
60
|
+
(e) => {
|
|
61
|
+
if (!scrollableParent.current) {
|
|
62
|
+
const containerTarget = e.target === document ? document.body : e.target;
|
|
63
|
+
scrollableParent.current = isParent(containerTarget, outerListRef.current) && containerTarget;
|
|
64
|
+
}
|
|
65
|
+
if (!scrollableParent.current)
|
|
66
|
+
return;
|
|
67
|
+
getElementOffset();
|
|
68
|
+
const scrollOffset = getScrollOffset(scrollableParent.current);
|
|
69
|
+
const scrollTop = Math.max(0, scrollOffset.top - (listOffset.current?.top ?? 0));
|
|
70
|
+
if (listInstance.current)
|
|
71
|
+
listInstance.current.scrollTo({ top: scrollTop });
|
|
72
|
+
},
|
|
73
|
+
[getElementOffset, listInstance, outerListRef]
|
|
74
|
+
);
|
|
69
75
|
(0, import_react.useEffect)(() => {
|
|
70
76
|
window.addEventListener("scroll", handleScroll, true);
|
|
71
77
|
window.addEventListener("resize", getElementOffset, true);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useWindowScrollerList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, useEffect, useRef } from 'react';\n\ninterface UseWindowScrollerListArg {\n listInstance: React.RefObject<HTMLElement>;\n outerListRef: React.RefObject<HTMLElement>;\n}\n\nfunction getScrollOffset(element = { scrollTop: 0, scrollLeft: 0 }) {\n return {\n top: element.scrollTop,\n left: element.scrollLeft,\n };\n}\n\nfunction getPositionOffset(listEl: HTMLElement, scrollableEl: HTMLElement) {\n const scrollOffset = getScrollOffset(scrollableEl);\n const elementRect = listEl.getBoundingClientRect();\n const containerRect = scrollableEl.getBoundingClientRect();\n return {\n top: elementRect.top + scrollOffset.top - containerRect.top,\n left: elementRect.left + scrollOffset.top - containerRect.left,\n };\n}\n\nfunction isParent(parentNode: EventTarget | null, childNode: HTMLElement | null): boolean {\n return (\n childNode?.parentNode === (parentNode as ParentNode) ||\n (!!childNode?.parentNode && isParent(parentNode, childNode.parentNode as HTMLElement))\n );\n}\n\nexport const useWindowScrollerList = ({ listInstance, outerListRef }: UseWindowScrollerListArg) => {\n const scrollableParent = useRef<HTMLElement | false>();\n const listOffset = useRef<ReturnType<typeof getPositionOffset>>();\n\n const getElementOffset = useCallback(() => {\n if (outerListRef.current && scrollableParent.current) {\n listOffset.current = getPositionOffset(outerListRef.current, scrollableParent.current);\n }\n }, [outerListRef]);\n\n const handleScroll: EventListener = useCallback(\n (e) => {\n if (!scrollableParent.current) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const containerTarget = e.target === document ? document.body : e.target;\n scrollableParent.current = isParent(containerTarget, outerListRef.current) && (containerTarget as HTMLElement);\n }\n\n if (!scrollableParent.current) return;\n\n getElementOffset();\n\n const scrollOffset = getScrollOffset(scrollableParent.current);\n const scrollTop = Math.max(0, scrollOffset.top - (listOffset.current?.top ?? 0));\n if (listInstance.current) listInstance.current.scrollTo({ top: scrollTop });\n },\n [getElementOffset, listInstance, outerListRef],\n );\n\n useEffect(() => {\n window.addEventListener('scroll', handleScroll, true);\n window.addEventListener('resize', getElementOffset, true);\n return () => {\n window.removeEventListener('scroll', handleScroll, true);\n window.removeEventListener('resize', getElementOffset, true);\n };\n }, [getElementOffset, handleScroll]);\n};\n\nexport default useWindowScrollerList;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsD;AAOtD,SAAS,gBAAgB,UAAU,EAAE,WAAW,GAAG,YAAY,EAAE,GAAG;AAClE,SAAO;AAAA,IACL,KAAK,QAAQ;AAAA,IACb,MAAM,QAAQ;AAAA,EAChB;AACF;AAEA,SAAS,kBAAkB,QAAqB,cAA2B;AACzE,QAAM,eAAe,gBAAgB,YAAY;AACjD,QAAM,cAAc,OAAO,sBAAsB;AACjD,QAAM,gBAAgB,aAAa,sBAAsB;AACzD,SAAO;AAAA,IACL,KAAK,YAAY,MAAM,aAAa,MAAM,cAAc;AAAA,IACxD,MAAM,YAAY,OAAO,aAAa,MAAM,cAAc;AAAA,EAC5D;AACF;AAEA,SAAS,SAAS,YAAgC,WAAwC;AACxF,SACE,WAAW,eAAgB,cAC1B,CAAC,CAAC,WAAW,cAAc,SAAS,YAAY,UAAU,UAAyB;AAExF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAc,aAAa,MAAgC;AACjG,QAAM,uBAAmB,qBAA4B;AACrD,QAAM,iBAAa,qBAA6C;AAEhE,QAAM,uBAAmB,0BAAY,MAAM;AACzC,QAAI,aAAa,WAAW,iBAAiB,SAAS;AACpD,iBAAW,UAAU,kBAAkB,aAAa,SAAS,iBAAiB,OAAO;AAAA,IACvF;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM,mBAA8B;AAAA,IAClC,CAAC,MAAM;AACL,UAAI,CAAC,iBAAiB,SAAS;AAE7B,cAAM,kBAAkB,EAAE,WAAW,WAAW,SAAS,OAAO,EAAE;AAClE,yBAAiB,UAAU,SAAS,iBAAiB,aAAa,OAAO,KAAM;AAAA,MACjF;AAEA,UAAI,CAAC,iBAAiB;AAAS;AAE/B,uBAAiB;AAEjB,YAAM,eAAe,gBAAgB,iBAAiB,OAAO;AAC7D,YAAM,YAAY,KAAK,IAAI,GAAG,aAAa,OAAO,WAAW,SAAS,OAAO,EAAE;AAC/E,UAAI,aAAa;AAAS,qBAAa,QAAQ,SAAS,EAAE,KAAK,UAAU,CAAC;AAAA,IAC5E;AAAA,IACA,CAAC,kBAAkB,cAAc,YAAY;AAAA,EAC/C;AAEA,8BAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,cAAc,IAAI;AACpD,WAAO,iBAAiB,UAAU,kBAAkB,IAAI;AACxD,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,cAAc,IAAI;AACvD,aAAO,oBAAoB,UAAU,kBAAkB,IAAI;AAAA,IAC7D;AAAA,EACF,GAAG,CAAC,kBAAkB,YAAY,CAAC;AACrC;AAEA,IAAO,gCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,7 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
22
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
26
|
var src_exports = {};
|
|
24
27
|
__export(src_exports, {
|