@udecode/react-utils 51.1.2 → 52.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udecode/react-utils",
3
- "version": "51.1.2",
3
+ "version": "52.0.1",
4
4
  "description": "React utils",
5
5
  "keywords": [
6
6
  "utils"
@@ -16,16 +16,11 @@
16
16
  "license": "MIT",
17
17
  "sideEffects": false,
18
18
  "exports": {
19
- ".": {
20
- "types": "./dist/index.d.ts",
21
- "import": "./dist/index.mjs",
22
- "module": "./dist/index.mjs",
23
- "require": "./dist/index.js"
24
- }
19
+ ".": "./dist/index.js",
20
+ "./package.json": "./package.json"
25
21
  },
26
- "main": "dist/index.js",
27
- "module": "dist/index.mjs",
28
- "types": "dist/index.d.ts",
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
29
24
  "files": [
30
25
  "dist/**/*"
31
26
  ],
@@ -42,7 +37,7 @@
42
37
  },
43
38
  "dependencies": {
44
39
  "@radix-ui/react-slot": "^1.2.3",
45
- "@udecode/utils": "51.1.2",
40
+ "@udecode/utils": "52.0.1",
46
41
  "clsx": "^2.1.1"
47
42
  },
48
43
  "peerDependencies": {
@@ -51,5 +46,7 @@
51
46
  },
52
47
  "publishConfig": {
53
48
  "access": "public"
54
- }
49
+ },
50
+ "type": "module",
51
+ "module": "./dist/index.js"
55
52
  }
package/dist/index.d.mts DELETED
@@ -1,155 +0,0 @@
1
- import React, { JSX, DependencyList } from 'react';
2
-
3
- declare const Box: React.ForwardRefExoticComponent<{
4
- as?: React.ElementType;
5
- asChild?: boolean;
6
- } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<any>>;
7
- type BoxProps = React.ComponentPropsWithRef<typeof Box>;
8
-
9
- declare const MemoizedChildren: React.MemoExoticComponent<({ children }: {
10
- children: React.ReactNode;
11
- }) => React.JSX.Element>;
12
-
13
- type PortalBodyProps = {
14
- children: React.ReactNode;
15
- element?: Element;
16
- };
17
- declare const PortalBody: ({ children, element, }: PortalBodyProps) => React.ReactPortal;
18
-
19
- declare const Text: React.ForwardRefExoticComponent<{
20
- as?: React.ElementType;
21
- asChild?: boolean;
22
- } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<any>>;
23
- type TextProps = React.ComponentPropsWithRef<typeof Text>;
24
-
25
- /** @see https://github.com/radix-ui/primitives/blob/b324ec2d7ddf13a2a115cb5b11478e24d2f45b87/packages/core/primitive/src/primitive.tsx#L1 */
26
- declare const composeEventHandlers: <E>(originalEventHandler?: (event: E) => void, ourEventHandler?: (event: E) => void, { checkForDefaultPrevented }?: {
27
- checkForDefaultPrevented?: boolean | undefined;
28
- }) => (event: E) => void;
29
-
30
- /**
31
- * Primitive component factory. It uses hooks for managing state and props, and
32
- * forwards references to child components. Component props:
33
- *
34
- * - `asChild`: If true, the component will be rendered as a `Slot`
35
- * {@link https://www.radix-ui.com/docs/primitives/utilities/slot}.
36
- * - `options`: Options passed to the state hook.
37
- * - `state`: Provide your state instead of using the state hook.
38
- * - `className`: Class name to be merged to the component.
39
- * - `style`: Style object to be merged to the component.
40
- * - `setProps`: Function to set props from the props hook.
41
- * - `...props`: Props to be passed to the component. Props hook return value:
42
- * - `ref`: Reference to be forwarded to the component.
43
- * - `props`: Props to be passed to the component.
44
- * - `hidden`: If true, the component will not be rendered.
45
- *
46
- * @example
47
- * const MyButton = createPrimitiveComponent(Button)({
48
- * stateHook: useButtonState,
49
- * propsHook: useButton,
50
- * });
51
- *
52
- * @param {React.ElementType} element The base component or native HTML element.
53
- * @returns {function} A primitive component.
54
- */
55
- declare const createPrimitiveComponent: <T extends React.ElementType, P extends React.ComponentPropsWithoutRef<T>>(element: T) => <SH extends (options: any) => any, PH extends (state: any) => any>({ propsHook, stateHook, }?: {
56
- propsHook?: PH;
57
- stateHook?: SH;
58
- }) => React.ForwardRefExoticComponent<React.PropsWithoutRef<{
59
- as?: React.ElementType;
60
- asChild?: boolean;
61
- className?: string;
62
- options?: Parameters<SH>[0];
63
- state?: Parameters<PH>[0];
64
- style?: React.CSSProperties;
65
- setProps?: (hookProps: NonNullable<ReturnType<PH>["props"]>) => P;
66
- } & P> & React.RefAttributes<any>>;
67
-
68
- declare function createPrimitiveElement<T extends keyof HTMLElementTagNameMap>(tag: T): React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.IntrinsicElements[T]> & React.RefAttributes<HTMLElementTagNameMap[T]>>;
69
-
70
- declare const createSlotComponent: <T extends React.ElementType, P extends React.ComponentPropsWithoutRef<T>>(element: T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<{
71
- as?: React.ElementType;
72
- asChild?: boolean;
73
- } & P> & React.RefAttributes<any>>;
74
-
75
- type PossibleRef<T> = React.Ref<T> | undefined;
76
- /**
77
- * A utility to compose multiple refs together Accepts callback refs and
78
- * React.RefObject(s)
79
- */
80
- declare const composeRefs: <T>(...refs: PossibleRef<T>[]) => (node: T) => (() => void) | undefined;
81
- /**
82
- * A custom hook that composes multiple refs Accepts callback refs and
83
- * React.RefObject(s)
84
- */
85
- declare const useComposedRef: <T>(...refs: PossibleRef<T>[]) => (node: T) => (() => void) | undefined;
86
-
87
- declare function useEffectOnce(effect: React.EffectCallback, deps: React.DependencyList): void;
88
-
89
- declare const CAN_USE_DOM: boolean;
90
- /**
91
- * Prevent warning on SSR by falling back to React.useEffect when DOM isn't
92
- * available
93
- */
94
- declare const useIsomorphicLayoutEffect: typeof React.useEffect;
95
-
96
- /**
97
- * Re-render only when the selector result changes.
98
- *
99
- * @param selector A function that derives a value from deps
100
- * @param deps Dependencies on which to run the selector
101
- * @param equalityFn Optional comparison function to detect changes in the
102
- * derived value
103
- */
104
- declare function useMemoizedSelector<R>(selector: () => R, deps: React.DependencyList, equalityFn?: (a: R, b: R) => boolean): R;
105
-
106
- declare const DEFAULT_IGNORE_CLASS = "ignore-onclickoutside";
107
- type UseOnClickOutsideCallback<T extends Event = Event> = (event: T) => void;
108
- type UseOnClickOutsideOptions = {
109
- detectIFrame?: boolean;
110
- disabled?: boolean;
111
- eventTypes?: string[];
112
- excludeScrollbar?: boolean;
113
- ignoreClass?: string[] | string;
114
- refs?: Refs;
115
- };
116
- type UseOnClickOutsideReturn = (element: El | null) => void;
117
- type El = HTMLElement;
118
- type Refs = React.RefObject<El | null>[];
119
- declare const useOnClickOutside: (callback: UseOnClickOutsideCallback, { detectIFrame, disabled, eventTypes, excludeScrollbar, ignoreClass, refs: refsOpt, }?: UseOnClickOutsideOptions) => UseOnClickOutsideReturn;
120
-
121
- /**
122
- * Create a stable version of a function that can be used in dependency arrays
123
- * without causing hooks like useEffect to re-run if the function changes.
124
- * Calling the returned function always calls the most recent version of the
125
- * function that was passed to useStableFn.
126
- *
127
- * If you do want the function to be replaced when certain dependency values
128
- * change, include those values in the dependency array of useStableFn.
129
- */
130
- declare const useStableFn: <A extends unknown[], R>(fn: (...args: A) => R, deps?: DependencyList) => (...args: A) => R;
131
-
132
- declare const useStableMemo: <T>(producer: () => T, deps?: React.DependencyList) => T;
133
-
134
- /** biome-ignore-all lint/correctness/useJsxKeyInIterable: biome */
135
-
136
- /**
137
- * Wrap a component into multiple providers. If there are any props that you
138
- * want a provider to receive, you can simply pass an array.
139
- */
140
- declare const withProviders: (...providers: any[]) => <T>(WrappedComponent: React.FC<T>) => (props: T) => any;
141
-
142
- type ElementType<P = any> = React.ComponentType<P> | {
143
- [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never;
144
- }[keyof JSX.IntrinsicElements];
145
- type ForwardRefComponent<T, P = {}> = React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
146
- type InferElementRef<T> = T extends ElementType<any> ? T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] extends React.DetailedHTMLProps<React.HTMLAttributes<infer R>, any> ? R : never : T extends React.ComponentType<any> ? T extends React.ComponentClass<any> ? InstanceType<T> : T extends React.ForwardRefExoticComponent<any> ? React.ComponentPropsWithRef<T>['ref'] extends React.Ref<infer R> ? R : never : never : never : never;
147
- /**
148
- * Shorter alternative to `React.forwardRef`.
149
- *
150
- * @generic1 Component type or element type
151
- * @generic2 Extended prop types
152
- */
153
- declare function withRef<T extends ElementType, P = {}>(renderFunction: React.ForwardRefRenderFunction<InferElementRef<T>, React.ComponentPropsWithoutRef<T> & P>): ForwardRefComponent<InferElementRef<T>, React.ComponentPropsWithoutRef<T> & P>;
154
-
155
- export { Box, type BoxProps, CAN_USE_DOM, DEFAULT_IGNORE_CLASS, MemoizedChildren, PortalBody, type PortalBodyProps, Text, type TextProps, type UseOnClickOutsideCallback, type UseOnClickOutsideOptions, type UseOnClickOutsideReturn, composeEventHandlers, composeRefs, createPrimitiveComponent, createPrimitiveElement, createSlotComponent, useComposedRef, useEffectOnce, useIsomorphicLayoutEffect, useMemoizedSelector, useOnClickOutside, useStableFn, useStableMemo, withProviders, withRef };
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/createSlotComponent.tsx","../src/Box.tsx","../src/MemoizedChildren.tsx","../src/PortalBody.tsx","../src/Text.tsx","../src/composeEventHandlers.ts","../src/createPrimitiveComponent.tsx","../src/useComposedRef.ts","../src/createPrimitiveElement.tsx","../src/useEffectOnce.ts","../src/useIsomorphicLayoutEffect.ts","../src/useMemoizedSelector.ts","../src/useOnClickOutside.ts","../src/useStableFn.ts","../src/useStableMemo.ts","../src/withProviders.tsx","../src/withRef.tsx"],"sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from './Box';\nexport * from './MemoizedChildren';\nexport * from './PortalBody';\nexport * from './Text';\nexport * from './composeEventHandlers';\nexport * from './createPrimitiveComponent';\nexport * from './createPrimitiveElement';\nexport * from './createSlotComponent';\nexport * from './useComposedRef';\nexport * from './useEffectOnce';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMemoizedSelector';\nexport * from './useOnClickOutside';\nexport * from './useStableFn';\nexport * from './useStableMemo';\nexport * from './withProviders';\nexport * from './withRef';\n","import { Slot } from '@radix-ui/react-slot';\nimport React from 'react';\n\nexport const createSlotComponent = <\n T extends React.ElementType,\n P extends React.ComponentPropsWithoutRef<T>,\n>(\n element: T\n) =>\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';\n\nexport const MemoizedChildren = React.memo(\n ({ children }: { children: React.ReactNode }) => <>{children}</>\n);\n","import type 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","import { isDefined } from '@udecode/utils';\nimport { clsx } from 'clsx';\nimport React from 'react';\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 React.forwardRef<\n any,\n {\n as?: React.ElementType;\n asChild?: boolean;\n className?: string;\n options?: Parameters<SH>[0];\n state?: Parameters<PH>[0];\n style?: React.CSSProperties;\n setProps?: (hookProps: NonNullable<ReturnType<PH>['props']>) => P;\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","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 return ref(value);\n }\n if (ref !== null && ref !== undefined) {\n (ref as React.RefObject<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 const cleanups: ((() => void) | undefined)[] = [];\n\n refs.forEach((ref) => {\n const cleanup = setRef(ref, node);\n if (typeof cleanup === 'function') {\n cleanups.push(cleanup);\n }\n });\n\n // Return a cleanup function if any refs returned cleanup functions\n if (cleanups.length > 0) {\n return () => {\n for (const cleanup of cleanups) {\n cleanup?.();\n }\n };\n }\n };\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, { type JSX } 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 function useEffectOnce(\n effect: React.EffectCallback,\n deps: React.DependencyList\n) {\n const initialized = React.useRef(false);\n const prevDepsRef = React.useRef(deps);\n\n React.useEffect(() => {\n const depsChanged = deps.some((dep, i) => dep !== prevDepsRef.current[i]);\n\n if (!initialized.current || depsChanged) {\n initialized.current = true;\n prevDepsRef.current = deps;\n effect();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\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\n/**\n * Re-render only when the selector result changes.\n *\n * @param selector A function that derives a value from deps\n * @param deps Dependencies on which to run the selector\n * @param equalityFn Optional comparison function to detect changes in the\n * derived value\n */\nexport function useMemoizedSelector<R>(\n selector: () => R,\n deps: React.DependencyList,\n equalityFn: (a: R, b: R) => boolean = (a, b) => a === b\n) {\n // Initialize our state with the initial \"selected\" value.\n const [memoizedValue, setMemoizedValue] = React.useState<R>(() => selector());\n\n // Keep a ref of the previous value so we can compare in an effect.\n const previousValueRef = React.useRef<R>(memoizedValue);\n\n React.useEffect(() => {\n // Compute a new value by calling the selector.\n const newValue = selector();\n\n // If different, update state and the ref.\n if (!equalityFn(previousValueRef.current, newValue)) {\n setMemoizedValue(newValue);\n previousValueRef.current = newValue;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return memoizedValue;\n}\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 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\nexport type 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\ntype El = HTMLElement;\n\ntype Refs = React.RefObject<El | null>[];\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 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 for (const { current } of refsOpt || refsState) {\n if (current) {\n els.push(current);\n }\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 for (const type of eventTypes) {\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 for (const type of eventTypes) {\n document.addEventListener(type, handler, getEventOptions(type));\n }\n\n if (detectIFrame) window.addEventListener('blur', blurHandler);\n\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, { type DependencyList } from 'react';\n\n/**\n * Create a stable version of a function that can be used in dependency arrays\n * without causing hooks like useEffect to re-run if the function changes.\n * Calling the returned function always calls the most recent version of the\n * function that was passed to useStableFn.\n *\n * If you do want the function to be replaced when certain dependency values\n * change, include those values in the dependency array of useStableFn.\n */\nexport const useStableFn = <A extends unknown[], R>(\n fn: (...args: A) => R,\n deps: DependencyList = []\n) => {\n const fnRef = React.useRef(fn);\n fnRef.current = fn;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback((...args: A) => fnRef.current(...args), deps);\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","/** biome-ignore-all lint/correctness/useJsxKeyInIterable: biome */\nimport 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, { type JSX } from 'react';\n\ntype ElementType<P = any> =\n | React.ComponentType<P>\n | {\n [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K]\n ? K\n : never;\n }[keyof JSX.IntrinsicElements];\n\ntype ForwardRefComponent<T, P = {}> = React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<T>\n>;\n\ntype InferElementRef<T> = T extends ElementType<any>\n ? T extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[T] extends React.DetailedHTMLProps<\n React.HTMLAttributes<infer R>,\n any\n >\n ? R\n : never\n : T extends React.ComponentType<any>\n ? T extends React.ComponentClass<any>\n ? InstanceType<T>\n : T extends React.ForwardRefExoticComponent<any>\n ? React.ComponentPropsWithRef<T>['ref'] extends React.Ref<infer R>\n ? R\n : never\n : never\n : never\n : never;\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<T extends ElementType, P = {}>(\n renderFunction: React.ForwardRefRenderFunction<\n InferElementRef<T>,\n React.ComponentPropsWithoutRef<T> & P\n >\n): ForwardRefComponent<\n InferElementRef<T>,\n React.ComponentPropsWithoutRef<T> & P\n> {\n return React.forwardRef(renderFunction as any) as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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W,cAAqB;AAC/C;","names":["React","import_react","React","ReactDOM","import_react","import_react","React","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React"]}
package/dist/index.mjs DELETED
@@ -1,325 +0,0 @@
1
- // src/createSlotComponent.tsx
2
- import { Slot } from "@radix-ui/react-slot";
3
- import React from "react";
4
- var createSlotComponent = (element) => React.forwardRef(({ as, asChild = false, ...props }, ref) => {
5
- const Comp = asChild ? Slot : as || element;
6
- return /* @__PURE__ */ React.createElement(Comp, { ref, ...props });
7
- });
8
-
9
- // src/Box.tsx
10
- var Box = createSlotComponent("div");
11
-
12
- // src/MemoizedChildren.tsx
13
- import React2 from "react";
14
- var MemoizedChildren = React2.memo(
15
- ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children)
16
- );
17
-
18
- // src/PortalBody.tsx
19
- import ReactDOM from "react-dom";
20
- var PortalBody = ({
21
- children,
22
- element
23
- }) => {
24
- const container = element || typeof window !== "undefined" ? document.body : void 0;
25
- if (!container) return children;
26
- return ReactDOM.createPortal(children, element || document.body);
27
- };
28
-
29
- // src/Text.tsx
30
- var Text = createSlotComponent("span");
31
-
32
- // src/composeEventHandlers.ts
33
- var composeEventHandlers = (originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) => (event) => {
34
- originalEventHandler?.(event);
35
- if (checkForDefaultPrevented === false || !event.defaultPrevented) {
36
- return ourEventHandler?.(event);
37
- }
38
- };
39
-
40
- // src/createPrimitiveComponent.tsx
41
- import { isDefined } from "@udecode/utils";
42
- import { clsx } from "clsx";
43
- import React4 from "react";
44
-
45
- // src/useComposedRef.ts
46
- import React3 from "react";
47
- var setRef = (ref, value) => {
48
- if (typeof ref === "function") {
49
- return ref(value);
50
- }
51
- if (ref !== null && ref !== void 0) {
52
- ref.current = value;
53
- }
54
- };
55
- var composeRefs = (...refs) => (node) => {
56
- const cleanups = [];
57
- refs.forEach((ref) => {
58
- const cleanup = setRef(ref, node);
59
- if (typeof cleanup === "function") {
60
- cleanups.push(cleanup);
61
- }
62
- });
63
- if (cleanups.length > 0) {
64
- return () => {
65
- for (const cleanup of cleanups) {
66
- cleanup?.();
67
- }
68
- };
69
- }
70
- };
71
- var useComposedRef = (...refs) => {
72
- return React3.useCallback(composeRefs(...refs), refs);
73
- };
74
-
75
- // src/createPrimitiveComponent.tsx
76
- var createPrimitiveComponent = (element) => {
77
- const Comp = createSlotComponent(element);
78
- return ({
79
- propsHook,
80
- stateHook
81
- } = {}) => React4.forwardRef(
82
- ({
83
- asChild,
84
- className: classNameProp,
85
- getClassName,
86
- options,
87
- state: stateProp,
88
- ...props
89
- }, ref) => {
90
- const state = isDefined(stateProp) ? stateProp : stateHook ? stateHook(options) : void 0;
91
- const {
92
- hidden,
93
- props: hookProps,
94
- ref: hookRef
95
- } = propsHook ? propsHook(state) : { hidden: false, props: {}, ref: null };
96
- const _ref = useComposedRef(ref, hookRef);
97
- const className = isDefined(hookProps?.className) || isDefined(classNameProp) ? clsx(hookProps?.className, classNameProp) : void 0;
98
- const style = hookProps?.style || props.style ? { ...hookProps?.style, ...props.style } : void 0;
99
- if (!asChild && hidden) return null;
100
- return /* @__PURE__ */ React4.createElement(
101
- Comp,
102
- {
103
- asChild,
104
- ref: _ref,
105
- ...hookProps,
106
- className,
107
- style,
108
- ...props,
109
- ...props.setProps?.(hookProps ?? {}) ?? {}
110
- }
111
- );
112
- }
113
- );
114
- };
115
-
116
- // src/createPrimitiveElement.tsx
117
- import React5 from "react";
118
- function createPrimitiveElement(tag) {
119
- return React5.forwardRef(
120
- function CreateComponent(props, ref) {
121
- return React5.createElement(tag, { ...props, ref });
122
- }
123
- );
124
- }
125
-
126
- // src/useEffectOnce.ts
127
- import React6 from "react";
128
- function useEffectOnce(effect, deps) {
129
- const initialized = React6.useRef(false);
130
- const prevDepsRef = React6.useRef(deps);
131
- React6.useEffect(() => {
132
- const depsChanged = deps.some((dep, i) => dep !== prevDepsRef.current[i]);
133
- if (!initialized.current || depsChanged) {
134
- initialized.current = true;
135
- prevDepsRef.current = deps;
136
- effect();
137
- }
138
- }, deps);
139
- }
140
-
141
- // src/useIsomorphicLayoutEffect.ts
142
- import React7 from "react";
143
- var CAN_USE_DOM = typeof window !== "undefined" && window.document?.createElement !== void 0;
144
- var useIsomorphicLayoutEffect = CAN_USE_DOM ? React7.useLayoutEffect : React7.useEffect;
145
-
146
- // src/useMemoizedSelector.ts
147
- import React8 from "react";
148
- function useMemoizedSelector(selector, deps, equalityFn = (a, b) => a === b) {
149
- const [memoizedValue, setMemoizedValue] = React8.useState(() => selector());
150
- const previousValueRef = React8.useRef(memoizedValue);
151
- React8.useEffect(() => {
152
- const newValue = selector();
153
- if (!equalityFn(previousValueRef.current, newValue)) {
154
- setMemoizedValue(newValue);
155
- previousValueRef.current = newValue;
156
- }
157
- }, deps);
158
- return memoizedValue;
159
- }
160
-
161
- // src/useOnClickOutside.ts
162
- import React9 from "react";
163
- var canUsePassiveEvents = () => {
164
- if (typeof window === "undefined" || typeof window.addEventListener !== "function")
165
- return false;
166
- let passive = false;
167
- const options = Object.defineProperty({}, "passive", {
168
- get() {
169
- passive = true;
170
- }
171
- });
172
- const noop = () => null;
173
- window.addEventListener("test", noop, options);
174
- window.removeEventListener("test", noop, options);
175
- return passive;
176
- };
177
- var DEFAULT_IGNORE_CLASS = "ignore-onclickoutside";
178
- var checkClass = (el, cl) => el.classList?.contains(cl);
179
- var hasIgnoreClass = (e, ignoreClass) => {
180
- let el = e.target || e;
181
- while (el) {
182
- if (Array.isArray(ignoreClass)) {
183
- if (ignoreClass.some((c) => checkClass(el, c))) return true;
184
- } else if (checkClass(el, ignoreClass)) {
185
- return true;
186
- }
187
- el = el.parentElement;
188
- }
189
- return false;
190
- };
191
- var clickedOnScrollbar = (e) => document.documentElement.clientWidth <= e.clientX || document.documentElement.clientHeight <= e.clientY;
192
- var getEventOptions = (type) => type.includes("touch") && canUsePassiveEvents() ? { passive: true } : false;
193
- var useOnClickOutside = (callback, {
194
- detectIFrame = true,
195
- disabled,
196
- eventTypes = ["mousedown", "touchstart"],
197
- excludeScrollbar,
198
- ignoreClass = DEFAULT_IGNORE_CLASS,
199
- refs: refsOpt
200
- } = {}) => {
201
- const [refsState, setRefsState] = React9.useState([]);
202
- const callbackRef = React9.useRef(callback);
203
- callbackRef.current = callback;
204
- const ref = React9.useCallback(
205
- (el) => setRefsState((prevState) => [...prevState, { current: el }]),
206
- []
207
- );
208
- React9.useEffect(
209
- () => {
210
- if (!refsOpt?.length && refsState.length === 0) return;
211
- const getEls = () => {
212
- const els = [];
213
- for (const { current } of refsOpt || refsState) {
214
- if (current) {
215
- els.push(current);
216
- }
217
- }
218
- return els;
219
- };
220
- const handler = (e) => {
221
- if (!hasIgnoreClass(e, ignoreClass) && !(excludeScrollbar && clickedOnScrollbar(e)) && getEls().every((el) => !el.contains(e.target)))
222
- callbackRef.current(e);
223
- };
224
- const blurHandler = (e) => (
225
- // On firefox the iframe becomes document.activeElement in the next event loop
226
- setTimeout(() => {
227
- const { activeElement } = document;
228
- if (activeElement?.tagName === "IFRAME" && !hasIgnoreClass(activeElement, ignoreClass) && !getEls().includes(activeElement))
229
- callbackRef.current(e);
230
- }, 0)
231
- );
232
- const removeEventListener = () => {
233
- for (const type of eventTypes) {
234
- document.removeEventListener(
235
- type,
236
- handler,
237
- getEventOptions(type)
238
- );
239
- }
240
- if (detectIFrame) window.removeEventListener("blur", blurHandler);
241
- };
242
- if (disabled) {
243
- removeEventListener();
244
- return;
245
- }
246
- for (const type of eventTypes) {
247
- document.addEventListener(type, handler, getEventOptions(type));
248
- }
249
- if (detectIFrame) window.addEventListener("blur", blurHandler);
250
- return () => removeEventListener();
251
- },
252
- // eslint-disable-next-line react-hooks/exhaustive-deps
253
- [
254
- refsState,
255
- ignoreClass,
256
- excludeScrollbar,
257
- disabled,
258
- detectIFrame,
259
- // eslint-disable-next-line react-hooks/exhaustive-deps
260
- JSON.stringify(eventTypes)
261
- ]
262
- );
263
- return ref;
264
- };
265
-
266
- // src/useStableFn.ts
267
- import React10 from "react";
268
- var useStableFn = (fn, deps = []) => {
269
- const fnRef = React10.useRef(fn);
270
- fnRef.current = fn;
271
- return React10.useCallback((...args) => fnRef.current(...args), deps);
272
- };
273
-
274
- // src/useStableMemo.ts
275
- import React11 from "react";
276
- var useStableMemo = (producer, deps) => {
277
- const [value, setValue] = React11.useState(producer);
278
- React11.useLayoutEffect(() => {
279
- setValue(producer);
280
- }, deps);
281
- return value;
282
- };
283
-
284
- // src/withProviders.tsx
285
- import React12 from "react";
286
- var withProviders = (...providers) => (WrappedComponent) => (props) => providers.reduceRight(
287
- (acc, prov) => {
288
- let Provider = prov;
289
- if (Array.isArray(prov)) {
290
- [Provider] = prov;
291
- return /* @__PURE__ */ React12.createElement(Provider, { ...prov[1] }, acc);
292
- }
293
- return /* @__PURE__ */ React12.createElement(Provider, null, acc);
294
- },
295
- /* @__PURE__ */ React12.createElement(WrappedComponent, { ...props })
296
- );
297
-
298
- // src/withRef.tsx
299
- import React13 from "react";
300
- function withRef(renderFunction) {
301
- return React13.forwardRef(renderFunction);
302
- }
303
- export {
304
- Box,
305
- CAN_USE_DOM,
306
- DEFAULT_IGNORE_CLASS,
307
- MemoizedChildren,
308
- PortalBody,
309
- Text,
310
- composeEventHandlers,
311
- composeRefs,
312
- createPrimitiveComponent,
313
- createPrimitiveElement,
314
- createSlotComponent,
315
- useComposedRef,
316
- useEffectOnce,
317
- useIsomorphicLayoutEffect,
318
- useMemoizedSelector,
319
- useOnClickOutside,
320
- useStableFn,
321
- useStableMemo,
322
- withProviders,
323
- withRef
324
- };
325
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/createSlotComponent.tsx","../src/Box.tsx","../src/MemoizedChildren.tsx","../src/PortalBody.tsx","../src/Text.tsx","../src/composeEventHandlers.ts","../src/createPrimitiveComponent.tsx","../src/useComposedRef.ts","../src/createPrimitiveElement.tsx","../src/useEffectOnce.ts","../src/useIsomorphicLayoutEffect.ts","../src/useMemoizedSelector.ts","../src/useOnClickOutside.ts","../src/useStableFn.ts","../src/useStableMemo.ts","../src/withProviders.tsx","../src/withRef.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React from 'react';\n\nexport const createSlotComponent = <\n T extends React.ElementType,\n P extends React.ComponentPropsWithoutRef<T>,\n>(\n element: T\n) =>\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';\n\nexport const MemoizedChildren = React.memo(\n ({ children }: { children: React.ReactNode }) => <>{children}</>\n);\n","import type 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","import { isDefined } from '@udecode/utils';\nimport { clsx } from 'clsx';\nimport React from 'react';\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 React.forwardRef<\n any,\n {\n as?: React.ElementType;\n asChild?: boolean;\n className?: string;\n options?: Parameters<SH>[0];\n state?: Parameters<PH>[0];\n style?: React.CSSProperties;\n setProps?: (hookProps: NonNullable<ReturnType<PH>['props']>) => P;\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","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 return ref(value);\n }\n if (ref !== null && ref !== undefined) {\n (ref as React.RefObject<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 const cleanups: ((() => void) | undefined)[] = [];\n\n refs.forEach((ref) => {\n const cleanup = setRef(ref, node);\n if (typeof cleanup === 'function') {\n cleanups.push(cleanup);\n }\n });\n\n // Return a cleanup function if any refs returned cleanup functions\n if (cleanups.length > 0) {\n return () => {\n for (const cleanup of cleanups) {\n cleanup?.();\n }\n };\n }\n };\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, { type JSX } 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 function useEffectOnce(\n effect: React.EffectCallback,\n deps: React.DependencyList\n) {\n const initialized = React.useRef(false);\n const prevDepsRef = React.useRef(deps);\n\n React.useEffect(() => {\n const depsChanged = deps.some((dep, i) => dep !== prevDepsRef.current[i]);\n\n if (!initialized.current || depsChanged) {\n initialized.current = true;\n prevDepsRef.current = deps;\n effect();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\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\n/**\n * Re-render only when the selector result changes.\n *\n * @param selector A function that derives a value from deps\n * @param deps Dependencies on which to run the selector\n * @param equalityFn Optional comparison function to detect changes in the\n * derived value\n */\nexport function useMemoizedSelector<R>(\n selector: () => R,\n deps: React.DependencyList,\n equalityFn: (a: R, b: R) => boolean = (a, b) => a === b\n) {\n // Initialize our state with the initial \"selected\" value.\n const [memoizedValue, setMemoizedValue] = React.useState<R>(() => selector());\n\n // Keep a ref of the previous value so we can compare in an effect.\n const previousValueRef = React.useRef<R>(memoizedValue);\n\n React.useEffect(() => {\n // Compute a new value by calling the selector.\n const newValue = selector();\n\n // If different, update state and the ref.\n if (!equalityFn(previousValueRef.current, newValue)) {\n setMemoizedValue(newValue);\n previousValueRef.current = newValue;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return memoizedValue;\n}\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 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\nexport type 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\ntype El = HTMLElement;\n\ntype Refs = React.RefObject<El | null>[];\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 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 for (const { current } of refsOpt || refsState) {\n if (current) {\n els.push(current);\n }\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 for (const type of eventTypes) {\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 for (const type of eventTypes) {\n document.addEventListener(type, handler, getEventOptions(type));\n }\n\n if (detectIFrame) window.addEventListener('blur', blurHandler);\n\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, { type DependencyList } from 'react';\n\n/**\n * Create a stable version of a function that can be used in dependency arrays\n * without causing hooks like useEffect to re-run if the function changes.\n * Calling the returned function always calls the most recent version of the\n * function that was passed to useStableFn.\n *\n * If you do want the function to be replaced when certain dependency values\n * change, include those values in the dependency array of useStableFn.\n */\nexport const useStableFn = <A extends unknown[], R>(\n fn: (...args: A) => R,\n deps: DependencyList = []\n) => {\n const fnRef = React.useRef(fn);\n fnRef.current = fn;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback((...args: A) => fnRef.current(...args), deps);\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","/** biome-ignore-all lint/correctness/useJsxKeyInIterable: biome */\nimport 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, { type JSX } from 'react';\n\ntype ElementType<P = any> =\n | React.ComponentType<P>\n | {\n [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K]\n ? K\n : never;\n }[keyof JSX.IntrinsicElements];\n\ntype ForwardRefComponent<T, P = {}> = React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<T>\n>;\n\ntype InferElementRef<T> = T extends ElementType<any>\n ? T extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[T] extends React.DetailedHTMLProps<\n React.HTMLAttributes<infer R>,\n any\n >\n ? R\n : never\n : T extends React.ComponentType<any>\n ? T extends React.ComponentClass<any>\n ? InstanceType<T>\n : T extends React.ForwardRefExoticComponent<any>\n ? React.ComponentPropsWithRef<T>['ref'] extends React.Ref<infer R>\n ? R\n : never\n : never\n : never\n : never;\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<T extends ElementType, P = {}>(\n renderFunction: React.ForwardRefRenderFunction<\n InferElementRef<T>,\n React.ComponentPropsWithoutRef<T> & P\n >\n): ForwardRefComponent<\n InferElementRef<T>,\n React.ComponentPropsWithoutRef<T> & P\n> {\n return React.forwardRef(renderFunction as any) as any;\n}\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,OAAO,WAAW;AAEX,IAAM,sBAAsB,CAIjC,YAEA,MAAM,WAMJ,CAAC,EAAE,IAAI,UAAU,OAAO,GAAG,MAAM,GAAG,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ACT;;;ACtKA,OAAOC,aAAoC;AAWpC,IAAM,cAAc,CACzB,IACA,OAAuB,CAAC,MACrB;AACH,QAAM,QAAQA,QAAM,OAAO,EAAE;AAC7B,QAAM,UAAU;AAEhB,SAAOA,QAAM,YAAY,IAAI,SAAY,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI;AACvE;;;ACnBA,OAAOC,aAAW;AAEX,IAAM,gBAAgB,CAC3B,UACA,SACM;AACN,QAAM,CAAC,OAAO,QAAQ,IAAIA,QAAM,SAAS,QAAQ;AAEjD,EAAAA,QAAM,gBAAgB,MAAM;AAC1B,aAAS,QAAQ;AAAA,EAEnB,GAAG,IAAI;AAEP,SAAO;AACT;;;ACbA,OAAOC,aAAW;AAMX,IAAM,gBACX,IAAI,cACJ,CAAK,qBACL,CAAC,UACC,UAAU;AAAA,EACR,CAAC,KAAK,SAAS;AACb,QAAI,WAAW;AAEf,QAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,OAAC,QAAQ,IAAI;AAEb,aAAO,gBAAAA,QAAA,cAAC,YAAU,GAAG,KAAK,CAAC,KAAI,GAAI;AAAA,IACrC;AAEA,WAAO,gBAAAA,QAAA,cAAC,gBAAU,GAAI;AAAA,EACxB;AAAA,EACA,gBAAAA,QAAA,cAAC,oBAAkB,GAAI,OAAe;AACxC;;;ACxBJ,OAAOC,aAAyB;AAuCzB,SAAS,QACd,gBAOA;AACA,SAAOA,QAAM,WAAW,cAAqB;AAC/C;","names":["React","React","React","React","React","React","React","React","React","React","React","React","React"]}