@primereact/hooks 11.0.0-alpha.1 → 11.0.0-alpha.2

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/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from './use-attr-selector';
2
+ export * from './use-controlled-state';
3
+ export * from './use-event-listener';
2
4
  export * from './use-id';
5
+ export * from './use-match-media';
3
6
  export * from './use-mount-effect';
7
+ export * from './use-previous';
4
8
  export * from './use-props';
5
9
  export * from './use-unmount-effect';
6
10
  export * from './use-update-effect';
package/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var l=Object.defineProperty;var i=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var p=(t,r,e)=>r in t?l(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,R=(t,r)=>{for(var e in r||(r={}))P.call(r,e)&&p(t,e,r[e]);if(i)for(var e of i(r))x.call(r,e)&&p(t,e,r[e]);return t};import*as n from"react";function E(t=""){let r=n.useId();return n.useMemo(()=>`${t}${r.replaceAll(/:|«|»/g,"")}`.trim().toLowerCase(),[r,t])}import*as o from"react";function w(t){let r=o.useId(),[e,s]=o.useState(t||`pr_id_${r.replaceAll(/:|«|»/g,"")}`);return o.useEffect(()=>{s(t||`pr_id_${r.replaceAll(/:|«|»/g,"")}`)},[t,r]),e}import*as a from"react";function b(t){let r=a.useRef(!1);a.useEffect(()=>{r.current||(r.current=!0,t==null||t())},[])}import*as m from"react";function T(t={},r={}){return m.useMemo(()=>{let e={props:R({},r),attrs:{}};return Object.entries(t).forEach(([s,u])=>{s in r?e.props[s]=u:e.attrs[s]=u}),e},[t,r])}import*as f from"react";function S(t){f.useEffect(()=>()=>{t==null||t()},[])}import*as c from"react";function $(t,r){let e=c.useRef(!1);c.useEffect(()=>{if(!e.current){e.current=!0;return}return t==null?void 0:t()},r)}import*as d from"react";function M(){return d.useCallback(r=>{document.startViewTransition?document.startViewTransition(()=>{r()}):r()},[])}export{E as useAttrSelector,w as useId,b as useMountEffect,T as useProps,S as useUnmountEffect,$ as useUpdateEffect,M as useViewTransition};
1
+ var h=Object.defineProperty;var b=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var M=(e,t,n)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))A.call(t,n)&&M(e,n,t[n]);if(b)for(var n of b(t))H.call(t,n)&&M(e,n,t[n]);return e};import*as T from"react";function _(e=""){let t=T.useId();return T.useMemo(()=>`${e}${t.replaceAll(/:|«|»/g,"")}`.trim().toLowerCase(),[t,e])}import{resolve as $}from"@primeuix/utils";import*as v from"react";function j({value:e,defaultValue:t,onChange:n}){let[r,o]=v.useState(t!=null?t:e),s=e!==void 0,u=s?e:r,f=v.useCallback(a=>{let[d,i]=$(a,u,s);n==null||n(i),s||o(d)},[u,s,n]);return[u,f,s]}import{getTargetElement as U,isNotEmpty as I}from"@primeuix/utils";import*as c from"react";import*as g from"react";function P(e){let t=g.useRef(null);return g.useEffect(()=>(t.current=e,()=>{t.current=null}),[e]),t.current}function G({target:e="document",type:t,listener:n,options:r,when:o=!0}){let s=c.useRef(null),u=c.useRef(null),f=P(n),a=P(r),d=(l={})=>{let{target:R}=l;I(R)&&(i(),(l.when||o)&&(s.current=U(R))),!u.current&&s.current&&(u.current=E=>n&&n(E),s.current.addEventListener(t,u.current,r))},i=()=>{var l;u.current&&((l=s.current)==null||l.removeEventListener(t,u.current,r),u.current=null)},k=()=>{i(),f=null,a=null},w=c.useCallback(()=>{o?s.current=U(e):(i(),s.current=null)},[e,o]);return c.useEffect(()=>()=>{k()},[]),c.useEffect(()=>{w()},[w]),c.useEffect(()=>{let l=`${f}`!=`${n}`,R=a!==r,E=u.current;E&&(l||R)?(i(),o&&d()):E||k()},[n,r,o]),[d,i]}import*as p from"react";function K(e){let t=p.useId(),[n,r]=p.useState(e||`pr_id_${t.replaceAll(/:|«|»/g,"")}`);return p.useEffect(()=>{r(e||`pr_id_${t.replaceAll(/:|«|»/g,"")}`)},[e,t]),n}import*as m from"react";function X(e,t=!0){let[n,r]=m.useState(!1),o=m.useRef(null),s=a=>r(a.matches),u=()=>{var a;return(a=o.current)==null?void 0:a.addEventListener("change",s)},f=()=>{var a;return((a=o.current)==null?void 0:a.removeEventListener("change",s))&&(o.current=null)};return m.useEffect(()=>(t&&(o.current=window.matchMedia(e),r(o.current.matches),u()),()=>{f()}),[e,t]),n}import*as L from"react";function Z(e){let t=L.useRef(!1);L.useEffect(()=>{t.current||(t.current=!0,e==null||e())},[])}import*as C from"react";function ee(e={},t={}){return C.useMemo(()=>{let n={props:y({},t),attrs:{}};return Object.entries(e).forEach(([r,o])=>{r in t?n.props[r]=o:n.attrs[r]=o}),n},[e,t])}import*as O from"react";function re(e){O.useEffect(()=>()=>{e==null||e()},[])}import*as x from"react";function se(e,t){let n=x.useRef(!1);x.useEffect(()=>{if(!n.current){n.current=!0;return}return e==null?void 0:e()},t)}import*as S from"react";function ae(){return S.useCallback(t=>{document.startViewTransition?document.startViewTransition(()=>{t()}):t()},[])}export{_ as useAttrSelector,j as useControlledState,G as useEventListener,K as useId,X as useMatchMedia,Z as useMountEffect,P as usePrevious,ee as useProps,re as useUnmountEffect,se as useUpdateEffect,ae as useViewTransition};
2
2
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-attr-selector/index.ts","../src/use-id/index.ts","../src/use-mount-effect/index.ts","../src/use-props/index.ts","../src/use-unmount-effect/index.ts","../src/use-update-effect/index.ts","../src/use-view-transition/index.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Generates a unique attribute selector based on the provided prefix.\n *\n * @param prefix - The prefix to prepend to the generated selector.\n * @returns A unique string combining the prefix and the selector.\n *\n * @example\n * ```ts\n * const selector = useAttrSelector('foo');\n * console.log(selector); // e.g., 'foo0'\n * ```\n */\nexport function useAttrSelector(prefix: string = ''): string {\n const id = React.useId();\n\n return React.useMemo(() => `${prefix}${id.replaceAll(/:|«|»/g, '')}`.trim().toLowerCase(), [id, prefix]);\n}\n","import * as React from 'react';\n\n/**\n * Generates a unique identifier.\n *\n * @param initialValue Optional initial value for the ID.\n * @returns The generated or provided ID.\n *\n * @example\n * ```tsx\n * const id = useId('foo');\n * console.log(id); // 'foo'\n * ```\n *\n * @example\n * ```tsx\n * const defaultId = useId();\n * console.log(defaultId); // e.g., 'pr_id_0'\n * ```\n */\nexport function useId(initialValue?: string): string {\n const idx = React.useId();\n const [idState, setIdState] = React.useState<string>(initialValue || `pr_id_${idx.replaceAll(/:|«|»/g, '')}`);\n\n React.useEffect(() => {\n setIdState(initialValue || `pr_id_${idx.replaceAll(/:|«|»/g, '')}`);\n }, [initialValue, idx]);\n\n return idState;\n}\n","import * as React from 'react';\n\n/**\n * Custom hook that runs a mount effect only once.\n * This is similar to `useEffect`, but it only runs on mount.\n *\n * @param {React.EffectCallback} effect the callback function\n * @returns {void}\n *\n * @example\n * ```tsx\n * const MyComponent = () => {\n * useMountEffect(() => {\n * console.log('Mounted');\n * });\n * };\n * ```\n */\nexport function useMountEffect(effect: React.EffectCallback): void {\n const mounted = React.useRef<boolean>(false);\n\n React.useEffect(() => {\n if (!mounted.current) {\n mounted.current = true;\n\n effect?.();\n }\n }, []);\n}\n","import * as React from 'react';\n\n/**\n * Used to merge and differentiate incoming props with the default props.\n * - Keys that exist in both `props1` and `props2` are placed in `props`, with values from `props1`.\n * - Keys that exist in `props1` but not in `props2` are placed in `attrs`.\n *\n * @template P1 The type of the incoming set of props.\n * @template P2 The type of the default set of props.\n *\n * @param props1 The incoming set of props (e.g., user-defined or dynamic props).\n * @param props2 The default set of props (e.g., default props).\n * @returns An object containing:\n * - `props`: A new object containing keys that exist in both `props1` and `props2`, using values from `props1`.\n * - `attrs`: A new object containing keys that exist only in `props1`, excluding any keys from `props2`.\n *\n * @example\n * ```ts\n * const { props, attrs } = useProps({ id: 'foo', className: 'bar' }, { className: 'baz' });\n *\n * console.log(props); // { className: 'bar' }\n * console.log(attrs); // { id: 'foo' }\n * ```\n */\nexport function useProps<P1, P2>(props1: P1 = {} as P1, props2: P2 = {} as P2) {\n type Props = Pick<P1 & P2, keyof P2>;\n type Attrs = Omit<P1, keyof P2>;\n type Result = { props: Props; attrs: Attrs };\n\n return React.useMemo(() => {\n const result: Result = { props: { ...props2 } as Props, attrs: {} as Attrs };\n\n Object.entries(props1 as Record<string, unknown>).forEach(([key, value]) => {\n if (key in (props2 as Record<string, unknown>)) {\n (result.props as Record<string, unknown>)[key] = value;\n } else {\n (result.attrs as Record<string, unknown>)[key] = value;\n }\n });\n\n return result;\n }, [props1, props2]);\n}\n","import * as React from 'react';\n\n/**\n * Custom hook that runs an unmount effect only once.\n * This is similar to `useEffect`, but it only runs on unmount.\n *\n * @param {React.EffectCallback} effect the callback function\n * @returns {void}\n *\n * @example\n * ```tsx\n * const Component = () => {\n * useUnmountEffect(() => {\n * console.log('Unmounted');\n * });\n * };\n * ```\n */\nexport function useUnmountEffect(effect: React.EffectCallback): void {\n React.useEffect(() => {\n return () => {\n effect?.();\n };\n }, []);\n}\n","import * as React from 'react';\n\n/**\n * Custom hook that runs an update effect whenever dependencies change.\n * This is similar to `useEffect`, but it does not run on mount.\n *\n * @param {React.EffectCallback} effect the callback function\n * @param {React.DependencyList} dependencies the dependencies\n * @returns {void}\n *\n * @example\n * ```tsx\n * const Component = ({ value }) => {\n * useUpdateEffect(() => {\n * console.log('Updated');\n * }, [value]);\n * };\n * ```\n */\nexport function useUpdateEffect(effect: React.EffectCallback, dependencies?: React.DependencyList): void {\n const mounted = React.useRef<boolean>(false);\n\n React.useEffect(() => {\n if (!mounted.current) {\n mounted.current = true;\n\n return;\n }\n\n return effect?.();\n }, dependencies);\n}\n","import * as React from 'react';\n\n/**\n * Starts a view transition.\n *\n * @returns A function that starts a view transition.\n *\n * @example\n * ```tsx\n * const Component = () => {\n * const startTransition = useViewTransition();\n *\n * const handleClick = () => {\n * startTransition(() => {\n * // Perform some work\n * });\n * };\n *\n * return <button onClick={handleClick}>Click me</button>;\n * };\n */\nexport function useViewTransition() {\n const startTransition = React.useCallback((callback: () => void) => {\n if (document.startViewTransition) {\n document.startViewTransition(() => {\n callback();\n });\n } else {\n callback();\n }\n }, []);\n\n return startTransition;\n}\n"],"mappings":"yVAAA,UAAYA,MAAW,QAchB,SAASC,EAAgBC,EAAiB,GAAY,CACzD,IAAMC,EAAW,QAAM,EAEvB,OAAa,UAAQ,IAAM,GAAGD,CAAM,GAAGC,EAAG,WAAW,SAAU,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,EAAG,CAACA,EAAID,CAAM,CAAC,CAC3G,CClBA,UAAYE,MAAW,QAoBhB,SAASC,EAAMC,EAA+B,CACjD,IAAMC,EAAY,QAAM,EAClB,CAACC,EAASC,CAAU,EAAU,WAAiBH,GAAgB,SAASC,EAAI,WAAW,SAAU,EAAE,CAAC,EAAE,EAE5G,OAAM,YAAU,IAAM,CAClBE,EAAWH,GAAgB,SAASC,EAAI,WAAW,SAAU,EAAE,CAAC,EAAE,CACtE,EAAG,CAACD,EAAcC,CAAG,CAAC,EAEfC,CACX,CC7BA,UAAYE,MAAW,QAkBhB,SAASC,EAAeC,EAAoC,CAC/D,IAAMC,EAAgB,SAAgB,EAAK,EAErC,YAAU,IAAM,CACbA,EAAQ,UACTA,EAAQ,QAAU,GAElBD,GAAA,MAAAA,IAER,EAAG,CAAC,CAAC,CACT,CC5BA,UAAYE,MAAW,QAwBhB,SAASC,EAAiBC,EAAa,CAAC,EAASC,EAAa,CAAC,EAAS,CAK3E,OAAa,UAAQ,IAAM,CACvB,IAAMC,EAAiB,CAAE,MAAOC,EAAA,GAAKF,GAAmB,MAAO,CAAC,CAAW,EAE3E,cAAO,QAAQD,CAAiC,EAAE,QAAQ,CAAC,CAACI,EAAKC,CAAK,IAAM,CACpED,KAAQH,EACPC,EAAO,MAAkCE,CAAG,EAAIC,EAEhDH,EAAO,MAAkCE,CAAG,EAAIC,CAEzD,CAAC,EAEMH,CACX,EAAG,CAACF,EAAQC,CAAM,CAAC,CACvB,CC1CA,UAAYK,MAAW,QAkBhB,SAASC,EAAiBC,EAAoC,CAC3D,YAAU,IACL,IAAM,CACTA,GAAA,MAAAA,GACJ,EACD,CAAC,CAAC,CACT,CCxBA,UAAYC,MAAW,QAmBhB,SAASC,EAAgBC,EAA8BC,EAA2C,CACrG,IAAMC,EAAgB,SAAgB,EAAK,EAErC,YAAU,IAAM,CAClB,GAAI,CAACA,EAAQ,QAAS,CAClBA,EAAQ,QAAU,GAElB,MACJ,CAEA,OAAOF,GAAA,YAAAA,GACX,EAAGC,CAAY,CACnB,CC/BA,UAAYE,MAAW,QAqBhB,SAASC,GAAoB,CAWhC,OAV8B,cAAaC,GAAyB,CAC5D,SAAS,oBACT,SAAS,oBAAoB,IAAM,CAC/BA,EAAS,CACb,CAAC,EAEDA,EAAS,CAEjB,EAAG,CAAC,CAAC,CAGT","names":["React","useAttrSelector","prefix","id","React","useId","initialValue","idx","idState","setIdState","React","useMountEffect","effect","mounted","React","useProps","props1","props2","result","__spreadValues","key","value","React","useUnmountEffect","effect","React","useUpdateEffect","effect","dependencies","mounted","React","useViewTransition","callback"]}
1
+ {"version":3,"sources":["../src/use-attr-selector/index.ts","../src/use-controlled-state/index.ts","../src/use-event-listener/index.ts","../src/use-previous/index.ts","../src/use-id/index.ts","../src/use-match-media/index.ts","../src/use-mount-effect/index.ts","../src/use-props/index.ts","../src/use-unmount-effect/index.ts","../src/use-update-effect/index.ts","../src/use-view-transition/index.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Generates a unique attribute selector based on the provided prefix.\n *\n * @param prefix - The prefix to prepend to the generated selector.\n * @returns A unique string combining the prefix and the selector.\n *\n * @example\n * ```ts\n * const selector = useAttrSelector('foo');\n * console.log(selector); // e.g., 'foo0'\n * ```\n */\nexport function useAttrSelector(prefix: string = ''): string {\n const id = React.useId();\n\n return React.useMemo(() => `${prefix}${id.replaceAll(/:|«|»/g, '')}`.trim().toLowerCase(), [id, prefix]);\n}\n","import { resolve } from '@primeuix/utils';\nimport * as React from 'react';\n\n/**\n * The options for the `useControlledState` hook.\n */\nexport interface UseControlledStateOptions<T = unknown, E = unknown> {\n /**\n * The value of the controlled state.\n */\n value?: T | undefined;\n /**\n * The default value of the uncontrolled state.\n */\n defaultValue?: T | undefined;\n /**\n * Callback function that is called when the value changes.\n */\n onChange?: (newValue: E) => void;\n}\n\n/**\n * The return type of the `useControlledState` hook.\n * A tuple containing the current value and a function to update it.\n */\nexport type UseControlledStateReturnType<T = unknown> = [T | undefined, (inValue: unknown | ((prev?: T) => unknown)) => void, boolean];\n\n/**\n * A custom hook that manages controlled and uncontrolled state.\n *\n * @param {UseControlledStateOptions} options - The options for the controlled state.\n * @returns A tuple containing the current value and a function to update it.\n *\n * @example\n * ```tsx\n * const ControlledComponent = () => {\n * const [controlledValue, setControlledValue] = React.useState('');\n *\n * const [value, setValue] = useControlledState({\n * value: controlledValue,\n * defaultValue: 'initial value',\n * onChange: (newValue) => {\n * setControlledValue(newValue);\n * }\n * });\n *\n * return <Component value={value} onChange={(e) => setValue(e.target.value)} />;\n * };\n * ```\n */\nexport function useControlledState<T = unknown, E = T>({ value, defaultValue, onChange }: UseControlledStateOptions<T, E>): UseControlledStateReturnType<T | undefined> {\n const [valueState, setValueState] = React.useState<T | undefined>(defaultValue ?? value);\n\n const isControlled = value !== undefined;\n const computedValue = isControlled ? (value as T) : valueState;\n\n const setValue = React.useCallback(\n (inValue: unknown | ((prev?: T) => unknown)) => {\n // @todo - update resolve to accept multiple parameters\n const [newValue, onChangeParam] = resolve(inValue, computedValue, isControlled) as [T, E];\n\n onChange?.(onChangeParam);\n\n if (!isControlled) {\n setValueState(newValue);\n }\n },\n [computedValue, isControlled, onChange]\n );\n\n return [computedValue, setValue, isControlled];\n}\n","import { getTargetElement, isNotEmpty } from '@primeuix/utils';\nimport * as React from 'react';\nimport { usePrevious } from '../use-previous';\n\n/**\n * The options for the `useEventListener` hook.\n */\nexport interface UseEventListenerOptions<T = keyof HTMLElementEventMap> {\n /**\n * The target element to bind the event listener to.\n * @default 'document'\n */\n target?: 'document' | 'window' | 'body' | HTMLElement | (() => HTMLElement) | React.Ref<HTMLElement> | string | null;\n /**\n * The event type to listen for.\n */\n type: T | string;\n /**\n * The event listener callback.\n */\n listener: EventListener;\n /**\n * The event listener options\n */\n options?: AddEventListenerOptions | boolean;\n /**\n * A boolean indicating whether the event listener should be active.\n */\n when?: boolean;\n}\n\n/**\n * The return type of the `useEventListener` hook.\n * A tuple containing functions;\n * 1. `bind` function is used to bind the event listener.\n * 2. `unbind` function is used to unbind the event listener.\n */\nexport type UseEventListenerReturnType = [(options?: Partial<Omit<UseEventListenerOptions, 'target'>> & { target?: UseEventListenerOptions['target'] | Document | null }) => void, () => void];\n\n/**\n * Listens for the specified event type on the target element.\n *\n * @param {UseEventListenerOptions} options - The options for the event listener.\n * @returns A tuple containing functions;\n * 1. `bind` function is used to bind the event listener.\n * 2. `unbind` function is used to unbind the event listener.\n *\n * @example\n * ```tsx\n * const Component = () => {\n * const [bind, unbind] = useEventListener({\n * target: 'document',\n * type: 'click',\n * listener: (event) => {\n * console.log(event);\n * },\n * when: true\n * });\n *\n * return <div>Click me</div>;\n * };\n *\n * @example\n * ```tsx\n * const Component = () => {\n * const [bind, unbind] = useEventListener({\n * target: () => document.querySelector('.element'),\n * type: 'mouseover',\n * listener: (event) => {\n * console.log(event);\n * }\n * });\n *\n * return <div>MouseOver to `.element`</div>;\n * };\n * ```\n */\nexport function useEventListener({ target = 'document', type, listener, options, when = true }: UseEventListenerOptions): UseEventListenerReturnType {\n const targetRef = React.useRef<HTMLElement | null>(null);\n const listenerRef = React.useRef<EventListener | null>(null);\n let prevListener = usePrevious(listener);\n let prevOptions = usePrevious(options);\n\n const bind = (bindOptions: Partial<Omit<UseEventListenerOptions, 'target'>> & { target?: UseEventListenerOptions['target'] | Document | null } = {}) => {\n const { target: bindTarget } = bindOptions;\n\n if (isNotEmpty(bindTarget)) {\n unbind();\n\n if (bindOptions.when || when) {\n targetRef.current = getTargetElement(bindTarget) as HTMLElement;\n }\n }\n\n if (!listenerRef.current && targetRef.current) {\n listenerRef.current = (event: Event) => listener && listener(event);\n targetRef.current.addEventListener(type, listenerRef.current, options);\n }\n };\n\n const unbind = () => {\n if (listenerRef.current) {\n targetRef.current?.removeEventListener(type, listenerRef.current, options);\n listenerRef.current = null;\n }\n };\n\n const dispose = () => {\n unbind();\n // Prevent memory leak by releasing\n prevListener = null;\n prevOptions = null;\n };\n\n const updateTarget = React.useCallback(() => {\n if (when) {\n targetRef.current = getTargetElement(target) as HTMLElement;\n } else {\n unbind();\n targetRef.current = null;\n }\n }, [target, when]);\n\n React.useEffect(() => {\n return () => {\n dispose();\n };\n }, []);\n\n React.useEffect(() => {\n updateTarget();\n }, [updateTarget]);\n\n React.useEffect(() => {\n const listenerChanged = `${prevListener}` !== `${listener}`;\n const optionsChanged = prevOptions !== options;\n const listenerExists = listenerRef.current;\n\n if (listenerExists && (listenerChanged || optionsChanged)) {\n unbind();\n\n if (when) {\n bind();\n }\n } else if (!listenerExists) {\n dispose();\n }\n }, [listener, options, when]);\n\n return [bind, unbind];\n}\n","import * as React from 'react';\n\n/**\n * Returns the previous value of the provided value.\n *\n * @param value - The value to track.\n * @returns The previous value of the provided value.\n *\n * @example\n * ```tsx\n * const [count, setCount] = React.useState(5);\n * const prevCount = usePrevious(count);\n *\n * console.log(prevCount); // undefined\n *\n * setCount(10);\n *\n * console.log(prevCount); // 5\n * ```\n */\nexport function usePrevious<T>(value: T): T | null | undefined {\n const ref = React.useRef<T | null>(null);\n\n React.useEffect(() => {\n ref.current = value;\n\n return () => {\n ref.current = null;\n };\n }, [value]);\n\n return ref.current;\n}\n","import * as React from 'react';\n\n/**\n * Generates a unique identifier.\n *\n * @param initialValue Optional initial value for the ID.\n * @returns The generated or provided ID.\n *\n * @example\n * ```tsx\n * const id = useId('foo');\n * console.log(id); // 'foo'\n * ```\n *\n * @example\n * ```tsx\n * const defaultId = useId();\n * console.log(defaultId); // e.g., 'pr_id_0'\n * ```\n */\nexport function useId(initialValue?: string): string {\n const idx = React.useId();\n const [idState, setIdState] = React.useState<string>(initialValue || `pr_id_${idx.replaceAll(/:|«|»/g, '')}`);\n\n React.useEffect(() => {\n setIdState(initialValue || `pr_id_${idx.replaceAll(/:|«|»/g, '')}`);\n }, [initialValue, idx]);\n\n return idState;\n}\n","import * as React from 'react';\n\n/**\n * Listens for the specified media query.\n *\n * @param query - The media query to match.\n * @param when - A boolean indicating whether the media query should be active.\n * @returns A boolean indicating whether the media query matches.\n *\n * @example\n * ```tsx\n * const Component = () => {\n * const isMobile = useMatchMedia('(max-width: 768px)');\n *\n * return <div>{isMobile ? 'Mobile' : 'Desktop'}</div>;\n * };\n */\nexport function useMatchMedia(query: string, when: boolean = true): boolean {\n const [matches, setMatches] = React.useState(false);\n const matchMedia = React.useRef<MediaQueryList | null>(null);\n\n const handleChange = (event: MediaQueryListEvent) => setMatches(event.matches);\n const bind = () => matchMedia.current?.addEventListener('change', handleChange);\n const unbind = () => matchMedia.current?.removeEventListener('change', handleChange) && (matchMedia.current = null);\n\n React.useEffect(() => {\n if (when) {\n matchMedia.current = window.matchMedia(query);\n setMatches(matchMedia.current.matches);\n\n bind();\n }\n\n return () => {\n unbind();\n };\n }, [query, when]);\n\n return matches;\n}\n","import * as React from 'react';\n\n/**\n * Custom hook that runs a mount effect only once.\n * This is similar to `useEffect`, but it only runs on mount.\n *\n * @param {React.EffectCallback} effect the callback function\n * @returns {void}\n *\n * @example\n * ```tsx\n * const MyComponent = () => {\n * useMountEffect(() => {\n * console.log('Mounted');\n * });\n * };\n * ```\n */\nexport function useMountEffect(effect: React.EffectCallback): void {\n const mounted = React.useRef<boolean>(false);\n\n React.useEffect(() => {\n if (!mounted.current) {\n mounted.current = true;\n\n effect?.();\n }\n }, []);\n}\n","import * as React from 'react';\n\n/**\n * Used to merge and differentiate incoming props with the default props.\n * - Keys that exist in both `props1` and `props2` are placed in `props`, with values from `props1`.\n * - Keys that exist in `props1` but not in `props2` are placed in `attrs`.\n *\n * @template P1 The type of the incoming set of props.\n * @template P2 The type of the default set of props.\n *\n * @param props1 The incoming set of props (e.g., user-defined or dynamic props).\n * @param props2 The default set of props (e.g., default props).\n * @returns An object containing:\n * - `props`: A new object containing keys that exist in both `props1` and `props2`, using values from `props1`.\n * - `attrs`: A new object containing keys that exist only in `props1`, excluding any keys from `props2`.\n *\n * @example\n * ```ts\n * const { props, attrs } = useProps({ id: 'foo', className: 'bar' }, { className: 'baz' });\n *\n * console.log(props); // { className: 'bar' }\n * console.log(attrs); // { id: 'foo' }\n * ```\n */\nexport function useProps<P1, P2>(props1: P1 = {} as P1, props2: P2 = {} as P2) {\n type Props = Pick<P1 & P2, keyof P2>;\n type Attrs = Omit<P1, keyof P2>;\n type Result = { props: Props; attrs: Attrs };\n\n return React.useMemo(() => {\n const result: Result = { props: { ...props2 } as Props, attrs: {} as Attrs };\n\n Object.entries(props1 as Record<string, unknown>).forEach(([key, value]) => {\n if (key in (props2 as Record<string, unknown>)) {\n (result.props as Record<string, unknown>)[key] = value;\n } else {\n (result.attrs as Record<string, unknown>)[key] = value;\n }\n });\n\n return result;\n }, [props1, props2]);\n}\n","import * as React from 'react';\n\n/**\n * Custom hook that runs an unmount effect only once.\n * This is similar to `useEffect`, but it only runs on unmount.\n *\n * @param {React.EffectCallback} effect the callback function\n * @returns {void}\n *\n * @example\n * ```tsx\n * const Component = () => {\n * useUnmountEffect(() => {\n * console.log('Unmounted');\n * });\n * };\n * ```\n */\nexport function useUnmountEffect(effect: React.EffectCallback): void {\n React.useEffect(() => {\n return () => {\n effect?.();\n };\n }, []);\n}\n","import * as React from 'react';\n\n/**\n * Custom hook that runs an update effect whenever dependencies change.\n * This is similar to `useEffect`, but it does not run on mount.\n *\n * @param {React.EffectCallback} effect the callback function\n * @param {React.DependencyList} dependencies the dependencies\n * @returns {void}\n *\n * @example\n * ```tsx\n * const Component = ({ value }) => {\n * useUpdateEffect(() => {\n * console.log('Updated');\n * }, [value]);\n * };\n * ```\n */\nexport function useUpdateEffect(effect: React.EffectCallback, dependencies?: React.DependencyList): void {\n const mounted = React.useRef<boolean>(false);\n\n React.useEffect(() => {\n if (!mounted.current) {\n mounted.current = true;\n\n return;\n }\n\n return effect?.();\n }, dependencies);\n}\n","import * as React from 'react';\n\n/**\n * Starts a view transition.\n *\n * @returns A function that starts a view transition.\n *\n * @example\n * ```tsx\n * const Component = () => {\n * const startTransition = useViewTransition();\n *\n * const handleClick = () => {\n * startTransition(() => {\n * // Perform some work\n * });\n * };\n *\n * return <button onClick={handleClick}>Click me</button>;\n * };\n */\nexport function useViewTransition() {\n const startTransition = React.useCallback((callback: () => void) => {\n if (document.startViewTransition) {\n document.startViewTransition(() => {\n callback();\n });\n } else {\n callback();\n }\n }, []);\n\n return startTransition;\n}\n"],"mappings":"yVAAA,UAAYA,MAAW,QAchB,SAASC,EAAgBC,EAAiB,GAAY,CACzD,IAAMC,EAAW,QAAM,EAEvB,OAAa,UAAQ,IAAM,GAAGD,CAAM,GAAGC,EAAG,WAAW,SAAU,EAAE,CAAC,GAAG,KAAK,EAAE,YAAY,EAAG,CAACA,EAAID,CAAM,CAAC,CAC3G,CClBA,OAAS,WAAAE,MAAe,kBACxB,UAAYC,MAAW,QAiDhB,SAASC,EAAuC,CAAE,MAAAC,EAAO,aAAAC,EAAc,SAAAC,CAAS,EAAiF,CACpK,GAAM,CAACC,EAAYC,CAAa,EAAU,WAAwBH,GAAA,KAAAA,EAAgBD,CAAK,EAEjFK,EAAeL,IAAU,OACzBM,EAAgBD,EAAgBL,EAAcG,EAE9CI,EAAiB,cAClBC,GAA+C,CAE5C,GAAM,CAACC,EAAUC,CAAa,EAAIb,EAAQW,EAASF,EAAeD,CAAY,EAE9EH,GAAA,MAAAA,EAAWQ,GAENL,GACD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","useControlledState","value","defaultValue","onChange","valueState","setValueState","isControlled","computedValue","setValue","inValue","newValue","onChangeParam","getTargetElement","isNotEmpty","React","React","usePrevious","value","ref","useEventListener","target","type","listener","options","when","targetRef","listenerRef","prevListener","usePrevious","prevOptions","bind","bindOptions","bindTarget","isNotEmpty","unbind","getTargetElement","event","_a","dispose","updateTarget","listenerChanged","optionsChanged","listenerExists","React","useId","initialValue","idx","idState","setIdState","React","useMatchMedia","query","when","matches","setMatches","matchMedia","handleChange","event","bind","_a","unbind","React","useMountEffect","effect","mounted","React","useProps","props1","props2","result","__spreadValues","key","value","React","useUnmountEffect","effect","React","useUpdateEffect","effect","dependencies","mounted","React","useViewTransition","callback"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primereact/hooks",
3
- "version": "11.0.0-alpha.1",
3
+ "version": "11.0.0-alpha.2",
4
4
  "author": "PrimeTek Informatics",
5
5
  "description": "",
6
6
  "homepage": "https://primereact.org/",
@@ -32,6 +32,6 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@primeuix/utils": "^0.6.0-beta.2"
35
+ "@primeuix/utils": "^0.6.0"
36
36
  }
37
37
  }
@@ -0,0 +1,58 @@
1
+ export interface UseIntersectionObserverOptions extends IntersectionObserverInit {
2
+ /**
3
+ * Skip creating the IntersectionObserver
4
+ * @default false
5
+ */
6
+ disabled?: boolean;
7
+ /**
8
+ * Callback function that will be called when intersection changes
9
+ */
10
+ onIntersect?: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;
11
+ /**
12
+ * If the IntersectionObserver API isn't available, set this fallback behavior
13
+ */
14
+ fallback?: () => void;
15
+ }
16
+ export interface UseIntersectionObserverResult {
17
+ /** The current intersection entries */
18
+ entries: IntersectionObserverEntry[];
19
+ /** Whether any of the observed elements are intersecting */
20
+ isIntersecting: boolean;
21
+ /** Function to start observing an element */
22
+ observe: (element: Element) => void;
23
+ /** Function to stop observing an element */
24
+ unobserve: (element: Element) => void;
25
+ /** Function to stop observing all elements */
26
+ disconnect: () => void;
27
+ /** The IntersectionObserver instance */
28
+ observer: IntersectionObserver | null;
29
+ }
30
+ /**
31
+ * Low-level hook for IntersectionObserver API.
32
+ * Provides direct access to observe/unobserve methods and entries.
33
+ *
34
+ * @param options - Configuration options for the IntersectionObserver
35
+ * @returns Object containing observer methods and current entries
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * const Component = () => {
40
+ * const ref = useRef(null);
41
+ * const { observe, isIntersecting, entries } = useIntersectionObserver({
42
+ * threshold: 0.5,
43
+ * onIntersect: (entries) => {
44
+ * console.log('Intersection changed:', entries);
45
+ * }
46
+ * });
47
+ *
48
+ * useEffect(() => {
49
+ * if (ref.current) {
50
+ * observe(ref.current);
51
+ * }
52
+ * }, [observe]);
53
+ *
54
+ * return <div ref={ref}>Content</div>;
55
+ * };
56
+ * ```
57
+ */
58
+ export declare function useIntersectionObserver(options?: UseIntersectionObserverOptions): UseIntersectionObserverResult;
@@ -0,0 +1,2 @@
1
+ var d=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var I=(s,o)=>{var c={};for(var t in s)k.call(s,t)&&o.indexOf(t)<0&&(c[t]=s[t]);if(s!=null&&d)for(var t of d(s))o.indexOf(t)<0&&g.call(s,t)&&(c[t]=s[t]);return c};import*as r from"react";function x(s={}){let v=s,{disabled:o=!1,onIntersect:c,fallback:t}=v,i=I(v,["disabled","onIntersect","fallback"]),[a,b]=r.useState([]),n=r.useRef(null),u=r.useRef(new Set),l=r.useRef(c);r.useEffect(()=>{l.current=c},[c]);let R=r.useMemo(()=>a.some(e=>e.isIntersecting),[a]);r.useEffect(()=>{if(!o){if(typeof window.IntersectionObserver=="undefined"){t&&t();return}return n.current=new IntersectionObserver((e,f)=>{b(e),l.current&&l.current(e,f)},i),u.current.forEach(e=>{n.current&&n.current.observe(e)}),()=>{n.current&&(n.current.disconnect(),n.current=null)}}},[o,t,i.root,i.rootMargin,i.threshold]);let O=r.useCallback(e=>{e&&(u.current.add(e),n.current&&n.current.observe(e))},[]),E=r.useCallback(e=>{e&&(u.current.delete(e),n.current&&n.current.unobserve(e),b(f=>f.filter(m=>m.target!==e)))},[]),p=r.useCallback(()=>{n.current&&n.current.disconnect(),u.current.clear(),b([])},[]);return{entries:a,isIntersecting:R,observe:O,unobserve:E,disconnect:p,observer:n.current}}export{x as useIntersectionObserver};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/use-intersection-observer/index.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface UseIntersectionObserverOptions extends IntersectionObserverInit {\n /**\n * Skip creating the IntersectionObserver\n * @default false\n */\n disabled?: boolean;\n /**\n * Callback function that will be called when intersection changes\n */\n onIntersect?: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;\n /**\n * If the IntersectionObserver API isn't available, set this fallback behavior\n */\n fallback?: () => void;\n}\n\nexport interface UseIntersectionObserverResult {\n /** The current intersection entries */\n entries: IntersectionObserverEntry[];\n /** Whether any of the observed elements are intersecting */\n isIntersecting: boolean;\n /** Function to start observing an element */\n observe: (element: Element) => void;\n /** Function to stop observing an element */\n unobserve: (element: Element) => void;\n /** Function to stop observing all elements */\n disconnect: () => void;\n /** The IntersectionObserver instance */\n observer: IntersectionObserver | null;\n}\n\n/**\n * Low-level hook for IntersectionObserver API.\n * Provides direct access to observe/unobserve methods and entries.\n *\n * @param options - Configuration options for the IntersectionObserver\n * @returns Object containing observer methods and current entries\n *\n * @example\n * ```tsx\n * const Component = () => {\n * const ref = useRef(null);\n * const { observe, isIntersecting, entries } = useIntersectionObserver({\n * threshold: 0.5,\n * onIntersect: (entries) => {\n * console.log('Intersection changed:', entries);\n * }\n * });\n *\n * useEffect(() => {\n * if (ref.current) {\n * observe(ref.current);\n * }\n * }, [observe]);\n *\n * return <div ref={ref}>Content</div>;\n * };\n * ```\n */\n\nexport function useIntersectionObserver(options: UseIntersectionObserverOptions = {}): UseIntersectionObserverResult {\n const { disabled = false, onIntersect, fallback, ...observerOptions } = options;\n\n const [entries, setEntries] = React.useState<IntersectionObserverEntry[]>([]);\n const observerRef = React.useRef<IntersectionObserver | null>(null);\n const elementsRef = React.useRef<Set<Element>>(new Set());\n\n const callbackRef = React.useRef(onIntersect);\n\n React.useEffect(() => {\n callbackRef.current = onIntersect;\n }, [onIntersect]);\n\n const isIntersecting = React.useMemo(() => {\n return entries.some((entry) => entry.isIntersecting);\n }, [entries]);\n\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n\n if (typeof window.IntersectionObserver === 'undefined') {\n if (fallback) {\n fallback();\n }\n\n return;\n }\n\n observerRef.current = new IntersectionObserver((observerEntries, observer) => {\n setEntries(observerEntries);\n\n if (callbackRef.current) {\n callbackRef.current(observerEntries, observer);\n }\n }, observerOptions);\n\n elementsRef.current.forEach((element) => {\n if (observerRef.current) {\n observerRef.current.observe(element);\n }\n });\n\n return () => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n };\n }, [disabled, fallback, observerOptions.root, observerOptions.rootMargin, observerOptions.threshold]);\n\n const observe = React.useCallback((element: Element) => {\n if (!element) return;\n\n elementsRef.current.add(element);\n\n if (observerRef.current) {\n observerRef.current.observe(element);\n }\n }, []);\n\n const unobserve = React.useCallback((element: Element) => {\n if (!element) return;\n\n elementsRef.current.delete(element);\n\n if (observerRef.current) {\n observerRef.current.unobserve(element);\n }\n\n setEntries((prev) => prev.filter((entry) => entry.target !== element));\n }, []);\n\n const disconnect = React.useCallback(() => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n }\n\n elementsRef.current.clear();\n setEntries([]);\n }, []);\n\n return {\n entries,\n isIntersecting,\n observe,\n unobserve,\n disconnect,\n observer: observerRef.current\n };\n}\n"],"mappings":"mRAAA,UAAYA,MAAW,QA8DhB,SAASC,EAAwBC,EAA0C,CAAC,EAAkC,CACjH,IAAwEC,EAAAD,EAAhE,UAAAE,EAA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AAO,CAAC,EACzE,EAAG,CAAC,CAAC,EAECI,EAAmB,cAAY,IAAM,CACnCX,EAAY,SACZA,EAAY,QAAQ,WAAW,EAGnCC,EAAY,QAAQ,MAAM,EAC1BF,EAAW,CAAC,CAAC,CACjB,EAAG,CAAC,CAAC,EAEL,MAAO,CACH,QAAAD,EACA,eAAAK,EACA,QAAAK,EACA,UAAAC,EACA,WAAAE,EACA,SAAUX,EAAY,OAC1B,CACJ","names":["React","useIntersectionObserver","options","_a","disabled","onIntersect","fallback","observerOptions","__objRest","entries","setEntries","observerRef","elementsRef","callbackRef","isIntersecting","entry","observerEntries","observer","element","observe","unobserve","prev","disconnect"]}
File without changes