@udecode/react-utils 33.0.0 → 37.0.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/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/createSlotComponent.tsx","../src/Box.tsx","../src/PortalBody.tsx","../src/Text.tsx","../src/composeEventHandlers.ts","../src/createPrimitiveComponent.tsx","../src/useComposedRef.ts","../src/createPrimitiveElement.tsx","../src/useIsomorphicLayoutEffect.ts","../src/useOnClickOutside.ts","../src/useStableMemo.ts","../src/withProviders.tsx","../src/withRef.tsx"],"sourcesContent":["/** @file Automatically generated by barrelsby. */\n\nexport * from './Box';\nexport * from './PortalBody';\nexport * from './Text';\nexport * from './composeEventHandlers';\nexport * from './createPrimitiveComponent';\nexport * from './createPrimitiveElement';\nexport * from './createSlotComponent';\nexport * from './useComposedRef';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useOnClickOutside';\nexport * from './useStableMemo';\nexport * from './withProviders';\nexport * from './withRef';\n","import React from 'react';\n\nimport { Slot } from '@radix-ui/react-slot';\n\nexport const createSlotComponent = <\n T extends React.ElementType,\n P extends React.ComponentPropsWithoutRef<T>,\n>(\n element: T\n) =>\n // eslint-disable-next-line react/display-name\n React.forwardRef<\n any,\n {\n as?: React.ElementType;\n asChild?: boolean;\n } & P\n >(({ as, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : (as as T) || element;\n\n return <Comp ref={ref} {...props} />;\n });\n","import type React from 'react';\n\nimport { createSlotComponent } from './createSlotComponent';\n\nexport const Box = createSlotComponent('div');\n\nexport type BoxProps = React.ComponentPropsWithRef<typeof Box>;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\n\nexport type PortalBodyProps = { children: React.ReactNode; element?: Element };\n\nexport const PortalBody: ({\n children,\n element,\n}: PortalBodyProps) => React.ReactPortal = ({\n children,\n element,\n}: PortalBodyProps) => {\n const container =\n element || typeof window !== 'undefined' ? document.body : undefined;\n\n if (!container) return (<>{children}</>) as any;\n\n return ReactDOM.createPortal(children, element || document.body);\n};\n","import type React from 'react';\n\nimport { createSlotComponent } from './createSlotComponent';\n\nexport const Text = createSlotComponent('span');\n\nexport type TextProps = React.ComponentPropsWithRef<typeof Text>;\n","/** @see https://github.com/radix-ui/primitives/blob/b324ec2d7ddf13a2a115cb5b11478e24d2f45b87/packages/core/primitive/src/primitive.tsx#L1 */\nexport const composeEventHandlers =\n <E>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {}\n ) =>\n (event: E) => {\n originalEventHandler?.(event);\n\n if (\n checkForDefaultPrevented === false ||\n !(event as unknown as Event).defaultPrevented\n ) {\n return ourEventHandler?.(event);\n }\n };\n","/* eslint-disable react/display-name */\n\nimport React from 'react';\n\nimport { isDefined } from '@udecode/utils';\nimport { clsx } from 'clsx';\n\nimport { createSlotComponent } from './createSlotComponent';\nimport { useComposedRef } from './useComposedRef';\n\n/**\n * Primitive component factory. It uses hooks for managing state and props, and\n * forwards references to child components. Component props:\n *\n * - `asChild`: If true, the component will be rendered as a `Slot`\n * {@link https://www.radix-ui.com/docs/primitives/utilities/slot}.\n * - `options`: Options passed to the state hook.\n * - `state`: Provide your state instead of using the state hook.\n * - `className`: Class name to be merged to the component.\n * - `style`: Style object to be merged to the component.\n * - `setProps`: Function to set props from the props hook.\n * - `...props`: Props to be passed to the component. Props hook return value:\n * - `ref`: Reference to be forwarded to the component.\n * - `props`: Props to be passed to the component.\n * - `hidden`: If true, the component will not be rendered.\n *\n * @example\n * const MyButton = createPrimitiveComponent(Button)({\n * stateHook: useButtonState,\n * propsHook: useButton,\n * });\n *\n * @param {React.ElementType} element The base component or native HTML element.\n * @returns {function} A primitive component.\n */\nexport const createPrimitiveComponent = <\n T extends React.ElementType,\n P extends React.ComponentPropsWithoutRef<T>,\n>(\n element: T\n) => {\n const Comp = createSlotComponent<T, P>(element);\n\n return <SH extends (options: any) => any, PH extends (state: any) => any>({\n propsHook,\n stateHook,\n }: {\n propsHook?: PH;\n stateHook?: SH;\n } = {}) => {\n return React.forwardRef<\n any,\n {\n as?: React.ElementType;\n asChild?: boolean;\n className?: string;\n options?: Parameters<SH>[0];\n setProps?: (hookProps: NonNullable<ReturnType<PH>['props']>) => P;\n state?: Parameters<PH>[0];\n style?: React.CSSProperties;\n } & P\n >(\n (\n {\n asChild,\n className: classNameProp,\n getClassName,\n options,\n state: stateProp,\n ...props\n },\n ref\n ) => {\n const state = isDefined(stateProp)\n ? stateProp\n : stateHook\n ? stateHook(options as any)\n : undefined;\n const {\n hidden,\n props: hookProps,\n ref: hookRef,\n } = propsHook\n ? propsHook(state)\n : { hidden: false, props: {}, ref: null };\n\n const _ref = useComposedRef(ref, hookRef);\n const className =\n isDefined(hookProps?.className) || isDefined(classNameProp)\n ? clsx(hookProps?.className, classNameProp)\n : undefined;\n const style =\n hookProps?.style || props.style\n ? { ...hookProps?.style, ...props.style }\n : undefined;\n\n if (!asChild && hidden) return null;\n\n return (\n <Comp\n asChild={asChild}\n ref={_ref}\n {...hookProps}\n className={className}\n style={style}\n {...props}\n {...(props.setProps?.(hookProps ?? {}) ?? {})}\n />\n );\n }\n );\n };\n};\n","import React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value This utility takes care of different types\n * of refs: callback refs and React.RefObject(s)\n */\nconst setRef = <T>(ref: PossibleRef<T>, value: T) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n};\n\n/**\n * A utility to compose multiple refs together Accepts callback refs and\n * React.RefObject(s)\n */\nexport const composeRefs =\n <T>(...refs: PossibleRef<T>[]) =>\n (node: T) =>\n refs.forEach((ref) => setRef(ref, node));\n\n/**\n * A custom hook that composes multiple refs Accepts callback refs and\n * React.RefObject(s)\n */\nexport const useComposedRef = <T>(...refs: PossibleRef<T>[]) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n};\n","import React from 'react';\n\nexport function createPrimitiveElement<T extends keyof HTMLElementTagNameMap>(\n tag: T\n) {\n return React.forwardRef<HTMLElementTagNameMap[T], JSX.IntrinsicElements[T]>(\n function CreateComponent(props, ref) {\n return React.createElement(tag, { ...props, ref });\n }\n );\n}\n","import React from 'react';\n\nexport const CAN_USE_DOM =\n typeof window !== 'undefined' && window.document?.createElement !== undefined;\n\n/**\n * Prevent warning on SSR by falling back to React.useEffect when DOM isn't\n * available\n */\nexport const useIsomorphicLayoutEffect = CAN_USE_DOM\n ? React.useLayoutEffect\n : React.useEffect;\n","import React from 'react';\n\nconst canUsePassiveEvents = (): boolean => {\n if (\n typeof window === 'undefined' ||\n typeof window.addEventListener !== 'function'\n )\n return false;\n\n let passive = false;\n const options = Object.defineProperty({}, 'passive', {\n // eslint-disable-next-line getter-return\n get() {\n passive = true;\n },\n });\n const noop = () => null;\n\n window.addEventListener('test', noop, options);\n window.removeEventListener('test', noop, options);\n\n return passive;\n};\n\nexport const DEFAULT_IGNORE_CLASS = 'ignore-onclickoutside';\n\nexport type UseOnClickOutsideCallback<T extends Event = Event> = (\n event: T\n) => void;\n\ntype El = HTMLElement;\ntype Refs = React.RefObject<El>[];\n\nexport interface UseOnClickOutsideOptions {\n detectIFrame?: boolean;\n disabled?: boolean;\n eventTypes?: string[];\n excludeScrollbar?: boolean;\n ignoreClass?: string | string[];\n refs?: Refs;\n}\n\nexport type UseOnClickOutsideReturn = (element: El | null) => void;\n\nconst checkClass = (el: HTMLElement, cl: string): boolean =>\n el.classList?.contains(cl);\n\nconst hasIgnoreClass = (e: any, ignoreClass: string | string[]): boolean => {\n let el = e.target || e;\n\n while (el) {\n if (Array.isArray(ignoreClass)) {\n // eslint-disable-next-line no-loop-func\n if (ignoreClass.some((c) => checkClass(el, c))) return true;\n } else if (checkClass(el, ignoreClass)) {\n return true;\n }\n\n el = el.parentElement;\n }\n\n return false;\n};\n\nconst clickedOnScrollbar = (e: MouseEvent): boolean =>\n document.documentElement.clientWidth <= e.clientX ||\n document.documentElement.clientHeight <= e.clientY;\n\nconst getEventOptions = (type: string): { passive: boolean } | boolean =>\n type.includes('touch') && canUsePassiveEvents() ? { passive: true } : false;\n\nexport const useOnClickOutside = (\n callback: UseOnClickOutsideCallback,\n {\n detectIFrame = true,\n disabled,\n eventTypes = ['mousedown', 'touchstart'],\n excludeScrollbar,\n ignoreClass = DEFAULT_IGNORE_CLASS,\n refs: refsOpt,\n }: UseOnClickOutsideOptions = {}\n): UseOnClickOutsideReturn => {\n const [refsState, setRefsState] = React.useState<Refs>([]);\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n const ref: UseOnClickOutsideReturn = React.useCallback(\n (el) => setRefsState((prevState) => [...prevState, { current: el }]),\n []\n );\n\n React.useEffect(\n () => {\n if (!refsOpt?.length && refsState.length === 0) return;\n\n const getEls = () => {\n const els: El[] = [];\n (refsOpt || refsState).forEach(\n ({ current }) => current && els.push(current)\n );\n\n return els;\n };\n\n const handler = (e: any) => {\n if (\n !hasIgnoreClass(e, ignoreClass) &&\n !(excludeScrollbar && clickedOnScrollbar(e)) &&\n getEls().every((el) => !el.contains(e.target))\n )\n callbackRef.current(e);\n };\n\n const blurHandler = (e: FocusEvent) =>\n // On firefox the iframe becomes document.activeElement in the next event loop\n setTimeout(() => {\n const { activeElement } = document;\n\n if (\n activeElement?.tagName === 'IFRAME' &&\n !hasIgnoreClass(activeElement, ignoreClass) &&\n !getEls().includes(activeElement as HTMLIFrameElement)\n )\n callbackRef.current(e);\n }, 0);\n\n const removeEventListener = () => {\n eventTypes.forEach((type) =>\n document.removeEventListener(\n type,\n handler,\n getEventOptions(type) as any\n )\n );\n\n if (detectIFrame) window.removeEventListener('blur', blurHandler);\n };\n\n if (disabled) {\n removeEventListener();\n\n return;\n }\n\n eventTypes.forEach((type) =>\n document.addEventListener(type, handler, getEventOptions(type))\n );\n\n if (detectIFrame) window.addEventListener('blur', blurHandler);\n\n // eslint-disable-next-line consistent-return\n return () => removeEventListener();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n refsState,\n ignoreClass,\n excludeScrollbar,\n disabled,\n detectIFrame,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(eventTypes),\n ]\n );\n\n return ref;\n};\n","import React from 'react';\n\nexport const useStableMemo = <T>(\n producer: () => T,\n deps?: React.DependencyList\n): T => {\n const [value, setValue] = React.useState(producer);\n\n React.useLayoutEffect(() => {\n setValue(producer);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return value;\n};\n","import React from 'react';\n\n/**\n * Wrap a component into multiple providers. If there are any props that you\n * want a provider to receive, you can simply pass an array.\n */\nexport const withProviders =\n (...providers: any[]) =>\n <T,>(WrappedComponent: React.FC<T>) =>\n (props: T) =>\n providers.reduceRight(\n (acc, prov) => {\n let Provider = prov;\n\n if (Array.isArray(prov)) {\n [Provider] = prov;\n\n return <Provider {...prov[1]}>{acc}</Provider>;\n }\n\n return <Provider>{acc}</Provider>;\n },\n <WrappedComponent {...(props as any)} />\n );\n","import React from 'react';\n\n/**\n * Shorter alternative to `React.forwardRef`.\n *\n * @generic1 Component type or element type\n * @generic2 Extended prop types\n */\nexport function withRef<\n T extends React.ComponentType<any> | keyof HTMLElementTagNameMap,\n E = {},\n>(\n renderFunction: React.ForwardRefRenderFunction<\n React.ElementRef<T>,\n E & Omit<React.ComponentPropsWithoutRef<T>, keyof E>\n >\n) {\n return React.forwardRef(renderFunction);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBA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C,iBAAkB;AAQX,SAAS,QAId,gBAIA;AACA,SAAO,eAAAC,QAAM,WAAW,cAAc;AACxC;","names":["React","_a","import_react","React","ReactDOM","import_react","import_react","React","React","_a","_b","import_react","React","import_react","React","import_react","_a","React","import_react","React","import_react","React","import_react","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/createSlotComponent.tsx","../src/Box.tsx","../src/PortalBody.tsx","../src/Text.tsx","../src/composeEventHandlers.ts","../src/createPrimitiveComponent.tsx","../src/useComposedRef.ts","../src/createPrimitiveElement.tsx","../src/useIsomorphicLayoutEffect.ts","../src/useOnClickOutside.ts","../src/useStableMemo.ts","../src/withProviders.tsx","../src/withRef.tsx"],"sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from './Box';\nexport * from './PortalBody';\nexport * from './Text';\nexport * from './composeEventHandlers';\nexport * from './createPrimitiveComponent';\nexport * from './createPrimitiveElement';\nexport * from './createSlotComponent';\nexport * from './useComposedRef';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useOnClickOutside';\nexport * from './useStableMemo';\nexport * from './withProviders';\nexport * from './withRef';\n","import React from 'react';\n\nimport { Slot } from '@radix-ui/react-slot';\n\nexport const createSlotComponent = <\n T extends React.ElementType,\n P extends React.ComponentPropsWithoutRef<T>,\n>(\n element: T\n) =>\n // eslint-disable-next-line react/display-name\n React.forwardRef<\n any,\n {\n as?: React.ElementType;\n asChild?: boolean;\n } & P\n >(({ as, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : (as as T) || element;\n\n return <Comp ref={ref} {...props} />;\n });\n","import type React from 'react';\n\nimport { createSlotComponent } from './createSlotComponent';\n\nexport const Box = createSlotComponent('div');\n\nexport type BoxProps = React.ComponentPropsWithRef<typeof Box>;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\n\nexport type PortalBodyProps = { children: React.ReactNode; element?: Element };\n\nexport const PortalBody: ({\n children,\n element,\n}: PortalBodyProps) => React.ReactPortal = ({\n children,\n element,\n}: PortalBodyProps) => {\n const container =\n element || typeof window !== 'undefined' ? document.body : undefined;\n\n if (!container) return (<>{children}</>) as any;\n\n return ReactDOM.createPortal(children, element || document.body);\n};\n","import type React from 'react';\n\nimport { createSlotComponent } from './createSlotComponent';\n\nexport const Text = createSlotComponent('span');\n\nexport type TextProps = React.ComponentPropsWithRef<typeof Text>;\n","/** @see https://github.com/radix-ui/primitives/blob/b324ec2d7ddf13a2a115cb5b11478e24d2f45b87/packages/core/primitive/src/primitive.tsx#L1 */\nexport const composeEventHandlers =\n <E>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {}\n ) =>\n (event: E) => {\n originalEventHandler?.(event);\n\n if (\n checkForDefaultPrevented === false ||\n !(event as unknown as Event).defaultPrevented\n ) {\n return ourEventHandler?.(event);\n }\n };\n","/* eslint-disable react/display-name */\n\nimport React from 'react';\n\nimport { isDefined } from '@udecode/utils';\nimport { clsx } from 'clsx';\n\nimport { createSlotComponent } from './createSlotComponent';\nimport { useComposedRef } from './useComposedRef';\n\n/**\n * Primitive component factory. It uses hooks for managing state and props, and\n * forwards references to child components. Component props:\n *\n * - `asChild`: If true, the component will be rendered as a `Slot`\n * {@link https://www.radix-ui.com/docs/primitives/utilities/slot}.\n * - `options`: Options passed to the state hook.\n * - `state`: Provide your state instead of using the state hook.\n * - `className`: Class name to be merged to the component.\n * - `style`: Style object to be merged to the component.\n * - `setProps`: Function to set props from the props hook.\n * - `...props`: Props to be passed to the component. Props hook return value:\n * - `ref`: Reference to be forwarded to the component.\n * - `props`: Props to be passed to the component.\n * - `hidden`: If true, the component will not be rendered.\n *\n * @example\n * const MyButton = createPrimitiveComponent(Button)({\n * stateHook: useButtonState,\n * propsHook: useButton,\n * });\n *\n * @param {React.ElementType} element The base component or native HTML element.\n * @returns {function} A primitive component.\n */\nexport const createPrimitiveComponent = <\n T extends React.ElementType,\n P extends React.ComponentPropsWithoutRef<T>,\n>(\n element: T\n) => {\n const Comp = createSlotComponent<T, P>(element);\n\n return <SH extends (options: any) => any, PH extends (state: any) => any>({\n propsHook,\n stateHook,\n }: {\n propsHook?: PH;\n stateHook?: SH;\n } = {}) => {\n return React.forwardRef<\n any,\n {\n as?: React.ElementType;\n asChild?: boolean;\n className?: string;\n options?: Parameters<SH>[0];\n setProps?: (hookProps: NonNullable<ReturnType<PH>['props']>) => P;\n state?: Parameters<PH>[0];\n style?: React.CSSProperties;\n } & P\n >(\n (\n {\n asChild,\n className: classNameProp,\n getClassName,\n options,\n state: stateProp,\n ...props\n },\n ref\n ) => {\n const state = isDefined(stateProp)\n ? stateProp\n : stateHook\n ? stateHook(options as any)\n : undefined;\n const {\n hidden,\n props: hookProps,\n ref: hookRef,\n } = propsHook\n ? propsHook(state)\n : { hidden: false, props: {}, ref: null };\n\n const _ref = useComposedRef(ref, hookRef);\n const className =\n isDefined(hookProps?.className) || isDefined(classNameProp)\n ? clsx(hookProps?.className, classNameProp)\n : undefined;\n const style =\n hookProps?.style || props.style\n ? { ...hookProps?.style, ...props.style }\n : undefined;\n\n if (!asChild && hidden) return null;\n\n return (\n <Comp\n asChild={asChild}\n ref={_ref}\n {...hookProps}\n className={className}\n style={style}\n {...props}\n {...(props.setProps?.(hookProps ?? {}) ?? {})}\n />\n );\n }\n );\n };\n};\n","import React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value This utility takes care of different types\n * of refs: callback refs and React.RefObject(s)\n */\nconst setRef = <T>(ref: PossibleRef<T>, value: T) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n};\n\n/**\n * A utility to compose multiple refs together Accepts callback refs and\n * React.RefObject(s)\n */\nexport const composeRefs =\n <T>(...refs: PossibleRef<T>[]) =>\n (node: T) =>\n refs.forEach((ref) => setRef(ref, node));\n\n/**\n * A custom hook that composes multiple refs Accepts callback refs and\n * React.RefObject(s)\n */\nexport const useComposedRef = <T>(...refs: PossibleRef<T>[]) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n};\n","import React from 'react';\n\nexport function createPrimitiveElement<T extends keyof HTMLElementTagNameMap>(\n tag: T\n) {\n return React.forwardRef<HTMLElementTagNameMap[T], JSX.IntrinsicElements[T]>(\n function CreateComponent(props, ref) {\n return React.createElement(tag, { ...props, ref });\n }\n );\n}\n","import React from 'react';\n\nexport const CAN_USE_DOM =\n typeof window !== 'undefined' && window.document?.createElement !== undefined;\n\n/**\n * Prevent warning on SSR by falling back to React.useEffect when DOM isn't\n * available\n */\nexport const useIsomorphicLayoutEffect = CAN_USE_DOM\n ? React.useLayoutEffect\n : React.useEffect;\n","import React from 'react';\n\nconst canUsePassiveEvents = (): boolean => {\n if (\n typeof window === 'undefined' ||\n typeof window.addEventListener !== 'function'\n )\n return false;\n\n let passive = false;\n const options = Object.defineProperty({}, 'passive', {\n // eslint-disable-next-line getter-return\n get() {\n passive = true;\n },\n });\n const noop = () => null;\n\n window.addEventListener('test', noop, options);\n window.removeEventListener('test', noop, options);\n\n return passive;\n};\n\nexport const DEFAULT_IGNORE_CLASS = 'ignore-onclickoutside';\n\nexport type UseOnClickOutsideCallback<T extends Event = Event> = (\n event: T\n) => void;\n\ntype El = HTMLElement;\ntype Refs = React.RefObject<El>[];\n\nexport interface UseOnClickOutsideOptions {\n detectIFrame?: boolean;\n disabled?: boolean;\n eventTypes?: string[];\n excludeScrollbar?: boolean;\n ignoreClass?: string | string[];\n refs?: Refs;\n}\n\nexport type UseOnClickOutsideReturn = (element: El | null) => void;\n\nconst checkClass = (el: HTMLElement, cl: string): boolean =>\n el.classList?.contains(cl);\n\nconst hasIgnoreClass = (e: any, ignoreClass: string | string[]): boolean => {\n let el = e.target || e;\n\n while (el) {\n if (Array.isArray(ignoreClass)) {\n // eslint-disable-next-line no-loop-func\n if (ignoreClass.some((c) => checkClass(el, c))) return true;\n } else if (checkClass(el, ignoreClass)) {\n return true;\n }\n\n el = el.parentElement;\n }\n\n return false;\n};\n\nconst clickedOnScrollbar = (e: MouseEvent): boolean =>\n document.documentElement.clientWidth <= e.clientX ||\n document.documentElement.clientHeight <= e.clientY;\n\nconst getEventOptions = (type: string): { passive: boolean } | boolean =>\n type.includes('touch') && canUsePassiveEvents() ? { passive: true } : false;\n\nexport const useOnClickOutside = (\n callback: UseOnClickOutsideCallback,\n {\n detectIFrame = true,\n disabled,\n eventTypes = ['mousedown', 'touchstart'],\n excludeScrollbar,\n ignoreClass = DEFAULT_IGNORE_CLASS,\n refs: refsOpt,\n }: UseOnClickOutsideOptions = {}\n): UseOnClickOutsideReturn => {\n const [refsState, setRefsState] = React.useState<Refs>([]);\n const callbackRef = React.useRef(callback);\n callbackRef.current = callback;\n\n const ref: UseOnClickOutsideReturn = React.useCallback(\n (el) => setRefsState((prevState) => [...prevState, { current: el }]),\n []\n );\n\n React.useEffect(\n () => {\n if (!refsOpt?.length && refsState.length === 0) return;\n\n const getEls = () => {\n const els: El[] = [];\n (refsOpt || refsState).forEach(\n ({ current }) => current && els.push(current)\n );\n\n return els;\n };\n\n const handler = (e: any) => {\n if (\n !hasIgnoreClass(e, ignoreClass) &&\n !(excludeScrollbar && clickedOnScrollbar(e)) &&\n getEls().every((el) => !el.contains(e.target))\n )\n callbackRef.current(e);\n };\n\n const blurHandler = (e: FocusEvent) =>\n // On firefox the iframe becomes document.activeElement in the next event loop\n setTimeout(() => {\n const { activeElement } = document;\n\n if (\n activeElement?.tagName === 'IFRAME' &&\n !hasIgnoreClass(activeElement, ignoreClass) &&\n !getEls().includes(activeElement as HTMLIFrameElement)\n )\n callbackRef.current(e);\n }, 0);\n\n const removeEventListener = () => {\n eventTypes.forEach((type) =>\n document.removeEventListener(\n type,\n handler,\n getEventOptions(type) as any\n )\n );\n\n if (detectIFrame) window.removeEventListener('blur', blurHandler);\n };\n\n if (disabled) {\n removeEventListener();\n\n return;\n }\n\n eventTypes.forEach((type) =>\n document.addEventListener(type, handler, getEventOptions(type))\n );\n\n if (detectIFrame) window.addEventListener('blur', blurHandler);\n\n // eslint-disable-next-line consistent-return\n return () => removeEventListener();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n refsState,\n ignoreClass,\n excludeScrollbar,\n disabled,\n detectIFrame,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(eventTypes),\n ]\n );\n\n return ref;\n};\n","import React from 'react';\n\nexport const useStableMemo = <T>(\n producer: () => T,\n deps?: React.DependencyList\n): T => {\n const [value, setValue] = React.useState(producer);\n\n React.useLayoutEffect(() => {\n setValue(producer);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return value;\n};\n","import React from 'react';\n\n/**\n * Wrap a component into multiple providers. If there are any props that you\n * want a provider to receive, you can simply pass an array.\n */\nexport const withProviders =\n (...providers: any[]) =>\n <T,>(WrappedComponent: React.FC<T>) =>\n (props: T) =>\n providers.reduceRight(\n (acc, prov) => {\n let Provider = prov;\n\n if (Array.isArray(prov)) {\n [Provider] = prov;\n\n return <Provider {...prov[1]}>{acc}</Provider>;\n }\n\n return <Provider>{acc}</Provider>;\n },\n <WrappedComponent {...(props as any)} />\n );\n","import React from 'react';\n\n/**\n * Shorter alternative to `React.forwardRef`.\n *\n * @generic1 Component type or element type\n * @generic2 Extended prop types\n */\nexport function withRef<\n T extends React.ComponentType<any> | keyof HTMLElementTagNameMap,\n E = {},\n>(\n renderFunction: React.ForwardRefRenderFunction<\n React.ElementRef<T>,\n E & Omit<React.ComponentPropsWithoutRef<T>, keyof E>\n >\n) {\n return React.forwardRef(renderFunction);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;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AAkB;AAQX,SAAS,QAId,gBAIA;AACA,SAAO,eAAAC,QAAM,WAAW,cAAc;AACxC;","names":["React","_a","import_react","React","ReactDOM","import_react","import_react","React","React","_a","_b","import_react","React","import_react","React","import_react","_a","React","import_react","React","import_react","React","import_react","React"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udecode/react-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.0.0",
|
|
4
4
|
"description": "Udecode React utils",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@radix-ui/react-slot": "^1.0.2",
|
|
42
|
-
"@udecode/utils": "
|
|
42
|
+
"@udecode/utils": "37.0.0",
|
|
43
43
|
"clsx": "^1.2.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|