@willbooster/shared-lib-react 3.2.15 → 3.2.16

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.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react");exports.useInterval=function(r,t){const s=e.useRef(),u=e.useRef(r);u.current=r;const c=e.useCallback((()=>{globalThis.clearInterval(s.current)}),[]);return e.useEffect((()=>(void 0!==t&&(s.current=globalThis.setInterval((()=>u.current()),t)),c)),[t]),c};
1
+ "use strict";var e=require("react");exports.useInterval=function(r,t){const s=e.useRef(void 0),u=e.useRef(r);u.current=r;const c=e.useCallback((()=>{globalThis.clearInterval(s.current)}),[]);return e.useEffect((()=>(void 0!==t&&(s.current=globalThis.setInterval((()=>u.current()),t)),c)),[t]),c};
2
2
  //# sourceMappingURL=useInterval.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInterval.cjs","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\n/**\n * A custom React hook that sets up an interval and returns a function to clear it.\n *\n * This hook ensures that the latest callback is always used, even if it changes between renders.\n * The interval can be dynamically started, stopped, or adjusted by changing the `milliseconds` parameter.\n *\n * @param callback - The function to be called at each interval. It is guaranteed to be the most recent version.\n * @param milliseconds - The interval duration in milliseconds. If undefined, the interval is cleared.\n * @returns A function to manually clear the interval.\n *\n * @example\n * const clearInterval = useInterval(() => {\n * console.log('This will run every 1000ms');\n * }, 1000);\n *\n * // To manually stop the interval:\n * clearInterval();\n */\nexport function useInterval(callback: () => void, milliseconds?: number): () => void {\n const timerId = useRef<number | NodeJS.Timeout>();\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n\n const clearInterval = useCallback(() => {\n globalThis.clearInterval(timerId.current);\n }, []);\n\n useEffect(() => {\n if (milliseconds !== undefined) {\n timerId.current = globalThis.setInterval(() => callbackRef.current(), milliseconds);\n }\n return clearInterval;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [milliseconds]);\n\n return clearInterval;\n}\n"],"names":["callback","milliseconds","timerId","useRef","callbackRef","current","clearInterval","useCallback","globalThis","useEffect","undefined","setInterval"],"mappings":"wDAoBO,SAAqBA,EAAsBC,GAChD,MAAMC,EAAUC,EAAAA,SACVC,EAAcD,SAAOH,GAC3BI,EAAYC,QAAUL,EAEtB,MAAMM,EAAgBC,EAAAA,aAAY,KAChCC,WAAWF,cAAcJ,EAAQG,QAAQ,GACxC,IAUH,OARAI,EAAAA,WAAU,UACaC,IAAjBT,IACFC,EAAQG,QAAUG,WAAWG,aAAY,IAAMP,EAAYC,WAAWJ,IAEjEK,IAEN,CAACL,IAEGK,CACT"}
1
+ {"version":3,"file":"useInterval.cjs","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\n/**\n * A custom React hook that sets up an interval and returns a function to clear it.\n *\n * This hook ensures that the latest callback is always used, even if it changes between renders.\n * The interval can be dynamically started, stopped, or adjusted by changing the `milliseconds` parameter.\n *\n * @param callback - The function to be called at each interval. It is guaranteed to be the most recent version.\n * @param milliseconds - The interval duration in milliseconds. If undefined, the interval is cleared.\n * @returns A function to manually clear the interval.\n *\n * @example\n * const clearInterval = useInterval(() => {\n * console.log('This will run every 1000ms');\n * }, 1000);\n *\n * // To manually stop the interval:\n * clearInterval();\n */\nexport function useInterval(callback: () => void, milliseconds?: number): () => void {\n const timerId = useRef<number | NodeJS.Timeout>(undefined);\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n\n const clearInterval = useCallback(() => {\n globalThis.clearInterval(timerId.current);\n }, []);\n\n useEffect(() => {\n if (milliseconds !== undefined) {\n timerId.current = globalThis.setInterval(() => callbackRef.current(), milliseconds);\n }\n return clearInterval;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [milliseconds]);\n\n return clearInterval;\n}\n"],"names":["callback","milliseconds","timerId","useRef","undefined","callbackRef","current","clearInterval","useCallback","globalThis","useEffect","setInterval"],"mappings":"wDAoBO,SAAqBA,EAAsBC,GAChD,MAAMC,EAAUC,EAAMA,YAA0BC,GAC1CC,EAAcF,EAAMA,OAACH,GAC3BK,EAAYC,QAAUN,EAEtB,MAAMO,EAAgBC,EAAAA,aAAY,KAChCC,WAAWF,cAAcL,EAAQI,QAAQ,GACxC,IAUH,OARAI,EAAAA,WAAU,UACaN,IAAjBH,IACFC,EAAQI,QAAUG,WAAWE,aAAY,IAAMN,EAAYC,WAAWL,IAEjEM,IAEN,CAACN,IAEGM,CACT"}
@@ -1,2 +1,2 @@
1
- import{useRef as r,useCallback as t,useEffect as e}from"react";function n(n,c){const o=r(),l=r(n);l.current=n;const a=t((()=>{globalThis.clearInterval(o.current)}),[]);return e((()=>(void 0!==c&&(o.current=globalThis.setInterval((()=>l.current()),c)),a)),[c]),a}export{n as useInterval};
1
+ import{useRef as r,useCallback as t,useEffect as e}from"react";function n(n,o){const c=r(void 0),l=r(n);l.current=n;const a=t((()=>{globalThis.clearInterval(c.current)}),[]);return e((()=>(void 0!==o&&(c.current=globalThis.setInterval((()=>l.current()),o)),a)),[o]),a}export{n as useInterval};
2
2
  //# sourceMappingURL=useInterval.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInterval.js","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\n/**\n * A custom React hook that sets up an interval and returns a function to clear it.\n *\n * This hook ensures that the latest callback is always used, even if it changes between renders.\n * The interval can be dynamically started, stopped, or adjusted by changing the `milliseconds` parameter.\n *\n * @param callback - The function to be called at each interval. It is guaranteed to be the most recent version.\n * @param milliseconds - The interval duration in milliseconds. If undefined, the interval is cleared.\n * @returns A function to manually clear the interval.\n *\n * @example\n * const clearInterval = useInterval(() => {\n * console.log('This will run every 1000ms');\n * }, 1000);\n *\n * // To manually stop the interval:\n * clearInterval();\n */\nexport function useInterval(callback: () => void, milliseconds?: number): () => void {\n const timerId = useRef<number | NodeJS.Timeout>();\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n\n const clearInterval = useCallback(() => {\n globalThis.clearInterval(timerId.current);\n }, []);\n\n useEffect(() => {\n if (milliseconds !== undefined) {\n timerId.current = globalThis.setInterval(() => callbackRef.current(), milliseconds);\n }\n return clearInterval;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [milliseconds]);\n\n return clearInterval;\n}\n"],"names":["useInterval","callback","milliseconds","timerId","useRef","callbackRef","current","clearInterval","useCallback","globalThis","useEffect","undefined","setInterval"],"mappings":"+DAoBO,SAASA,EAAYC,EAAsBC,GAChD,MAAMC,EAAUC,IACVC,EAAcD,EAAOH,GAC3BI,EAAYC,QAAUL,EAEtB,MAAMM,EAAgBC,GAAY,KAChCC,WAAWF,cAAcJ,EAAQG,QAAQ,GACxC,IAUH,OARAI,GAAU,UACaC,IAAjBT,IACFC,EAAQG,QAAUG,WAAWG,aAAY,IAAMP,EAAYC,WAAWJ,IAEjEK,IAEN,CAACL,IAEGK,CACT"}
1
+ {"version":3,"file":"useInterval.js","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\n/**\n * A custom React hook that sets up an interval and returns a function to clear it.\n *\n * This hook ensures that the latest callback is always used, even if it changes between renders.\n * The interval can be dynamically started, stopped, or adjusted by changing the `milliseconds` parameter.\n *\n * @param callback - The function to be called at each interval. It is guaranteed to be the most recent version.\n * @param milliseconds - The interval duration in milliseconds. If undefined, the interval is cleared.\n * @returns A function to manually clear the interval.\n *\n * @example\n * const clearInterval = useInterval(() => {\n * console.log('This will run every 1000ms');\n * }, 1000);\n *\n * // To manually stop the interval:\n * clearInterval();\n */\nexport function useInterval(callback: () => void, milliseconds?: number): () => void {\n const timerId = useRef<number | NodeJS.Timeout>(undefined);\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n\n const clearInterval = useCallback(() => {\n globalThis.clearInterval(timerId.current);\n }, []);\n\n useEffect(() => {\n if (milliseconds !== undefined) {\n timerId.current = globalThis.setInterval(() => callbackRef.current(), milliseconds);\n }\n return clearInterval;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [milliseconds]);\n\n return clearInterval;\n}\n"],"names":["useInterval","callback","milliseconds","timerId","useRef","undefined","callbackRef","current","clearInterval","useCallback","globalThis","useEffect","setInterval"],"mappings":"+DAoBO,SAASA,EAAYC,EAAsBC,GAChD,MAAMC,EAAUC,OAAgCC,GAC1CC,EAAcF,EAAOH,GAC3BK,EAAYC,QAAUN,EAEtB,MAAMO,EAAgBC,GAAY,KAChCC,WAAWF,cAAcL,EAAQI,QAAQ,GACxC,IAUH,OARAI,GAAU,UACaN,IAAjBH,IACFC,EAAQI,QAAUG,WAAWE,aAAY,IAAMN,EAAYC,WAAWL,IAEjEM,IAEN,CAACN,IAEGM,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"useNoHydrationError.cjs","sources":["../../src/hooks/useNoHydrationError.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction emptyFunction(): void {}\nfunction emptySubscribe(): () => void {\n return emptyFunction;\n}\n\n// cf. https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store\nexport function useNoHydrationError<T>(clientValue: T, ssrValue: T): T {\n return useSyncExternalStore(\n emptySubscribe,\n () => clientValue,\n () => ssrValue\n );\n}\n"],"names":["emptyFunction","emptySubscribe","clientValue","ssrValue","useSyncExternalStore"],"mappings":"oCAEA,SAASA,IAAuB,CAChC,SAASC,IACP,OAAOD,CACT,6BAGO,SAAgCE,EAAgBC,GACrD,OAAOC,EAAoBA,qBACzBH,GACA,IAAMC,IACN,IAAMC,GAEV"}
1
+ {"version":3,"file":"useNoHydrationError.cjs","sources":["../../src/hooks/useNoHydrationError.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction emptyFunction(): void {}\nfunction emptySubscribe(): () => void {\n return emptyFunction;\n}\n\n// cf. https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store\nexport function useNoHydrationError<T>(clientValue: T, ssrValue: T): T {\n return useSyncExternalStore(\n emptySubscribe,\n () => clientValue,\n () => ssrValue\n );\n}\n"],"names":["emptyFunction","emptySubscribe","clientValue","ssrValue","useSyncExternalStore"],"mappings":"oCAEA,SAASA,IAAsB,CAC/B,SAASC,IACP,OAAOD,CACT,6BAGO,SAAgCE,EAAgBC,GACrD,OAAOC,EAAoBA,qBACzBH,GACA,IAAMC,IACN,IAAMC,GAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"useNoHydrationError.js","sources":["../../src/hooks/useNoHydrationError.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction emptyFunction(): void {}\nfunction emptySubscribe(): () => void {\n return emptyFunction;\n}\n\n// cf. https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store\nexport function useNoHydrationError<T>(clientValue: T, ssrValue: T): T {\n return useSyncExternalStore(\n emptySubscribe,\n () => clientValue,\n () => ssrValue\n );\n}\n"],"names":["emptyFunction","emptySubscribe","useNoHydrationError","clientValue","ssrValue","useSyncExternalStore"],"mappings":"6CAEA,SAASA,IAAuB,CAChC,SAASC,IACP,OAAOD,CACT,CAGO,SAASE,EAAuBC,EAAgBC,GACrD,OAAOC,EACLJ,GACA,IAAME,IACN,IAAMC,GAEV"}
1
+ {"version":3,"file":"useNoHydrationError.js","sources":["../../src/hooks/useNoHydrationError.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction emptyFunction(): void {}\nfunction emptySubscribe(): () => void {\n return emptyFunction;\n}\n\n// cf. https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store\nexport function useNoHydrationError<T>(clientValue: T, ssrValue: T): T {\n return useSyncExternalStore(\n emptySubscribe,\n () => clientValue,\n () => ssrValue\n );\n}\n"],"names":["emptyFunction","emptySubscribe","useNoHydrationError","clientValue","ssrValue","useSyncExternalStore"],"mappings":"6CAEA,SAASA,IAAsB,CAC/B,SAASC,IACP,OAAOD,CACT,CAGO,SAASE,EAAuBC,EAAgBC,GACrD,OAAOC,EACLJ,GACA,IAAME,IACN,IAAMC,GAEV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/shared-lib-react",
3
- "version": "3.2.15",
3
+ "version": "3.2.16",
4
4
  "license": "Apache-2.0",
5
5
  "author": "WillBooster Inc.",
6
6
  "sideEffects": false,
@@ -46,36 +46,36 @@
46
46
  "@storybook/testing-library": "0.2.2",
47
47
  "@types/eslint": "8.56.10",
48
48
  "@types/micromatch": "4.0.9",
49
- "@types/react": "18.3.18",
50
- "@types/react-dom": "18.3.5",
51
- "@typescript-eslint/eslint-plugin": "8.18.1",
52
- "@typescript-eslint/parser": "8.18.1",
49
+ "@types/react": "19.0.2",
50
+ "@types/react-dom": "19.0.2",
51
+ "@typescript-eslint/eslint-plugin": "8.19.0",
52
+ "@typescript-eslint/parser": "8.19.0",
53
53
  "@willbooster/eslint-config-ts-react": "10.2.1",
54
54
  "@willbooster/prettier-config": "9.1.3",
55
55
  "babel-loader": "9.2.1",
56
- "build-ts": "13.1.8",
56
+ "build-ts": "13.1.9",
57
57
  "eslint": "8.57.0",
58
58
  "eslint-config-prettier": "9.1.0",
59
59
  "eslint-import-resolver-typescript": "3.7.0",
60
60
  "eslint-plugin-import": "2.31.0",
61
- "eslint-plugin-react": "7.37.2",
61
+ "eslint-plugin-react": "7.37.3",
62
62
  "eslint-plugin-react-hooks": "5.1.0",
63
63
  "eslint-plugin-sort-class-members": "1.21.0",
64
64
  "eslint-plugin-sort-destructure-keys": "2.0.0",
65
- "eslint-plugin-storybook": "0.11.1",
65
+ "eslint-plugin-storybook": "0.11.2",
66
66
  "eslint-plugin-unicorn": "56.0.1",
67
- "lint-staged": "15.2.11",
67
+ "lint-staged": "15.3.0",
68
68
  "micromatch": "4.0.8",
69
69
  "prettier": "3.4.2",
70
- "react": "18.3.1",
71
- "react-dom": "18.3.1",
70
+ "react": "19.0.0",
71
+ "react-dom": "19.0.0",
72
72
  "sort-package-json": "2.12.0",
73
73
  "typescript": "5.7.2",
74
74
  "vitest": "2.1.8"
75
75
  },
76
76
  "peerDependencies": {
77
- "react": "~18.2.0 || ~18.3.0",
78
- "react-dom": "~18.2.0 || ~18.3.0"
77
+ "react": "~18.2.0 || ~18.3.0 || ~19.0.0",
78
+ "react-dom": "~18.2.0 || ~18.3.0 || ~19.0.0"
79
79
  },
80
80
  "publishConfig": {
81
81
  "access": "public"