@pallasoft/ps-core-components 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { Client } from '@pallasoft/ps-utilities';
3
+ export const usePsDebouncedValue = (value, waitMs) => {
4
+ const [settled, setSettled] = useState(value);
5
+ useEffect(() => {
6
+ const debounced = Client.DebounceService.create((next) => setSettled(next), waitMs);
7
+ debounced.run(value);
8
+ return debounced.cancel;
9
+ }, [value, waitMs]);
10
+ return settled;
11
+ };
package/dist/esm/index.js CHANGED
@@ -43,6 +43,7 @@ export * from './hooks/use-ps-viewport';
43
43
  export * from './interfaces/ps-component-props';
44
44
  export * from './models/ps-voice-orb';
45
45
  export * from './models/ps-navigation-progress';
46
+ export * from './hooks/use-ps-debounced-value';
46
47
  export * from './hooks/use-ps-navigation-progress';
47
48
  export * from './models/ps-draggable-grid';
48
49
  export * from './constants/ps-draggable-grid';
@@ -0,0 +1 @@
1
+ export declare const usePsDebouncedValue: <T>(value: T, waitMs: number) => T;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePsDebouncedValue = void 0;
4
+ const react_1 = require("react");
5
+ const ps_utilities_1 = require("@pallasoft/ps-utilities");
6
+ const usePsDebouncedValue = (value, waitMs) => {
7
+ const [settled, setSettled] = (0, react_1.useState)(value);
8
+ (0, react_1.useEffect)(() => {
9
+ const debounced = ps_utilities_1.Client.DebounceService.create((next) => setSettled(next), waitMs);
10
+ debounced.run(value);
11
+ return debounced.cancel;
12
+ }, [value, waitMs]);
13
+ return settled;
14
+ };
15
+ exports.usePsDebouncedValue = usePsDebouncedValue;
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export * from './hooks/use-ps-viewport';
43
43
  export * from './interfaces/ps-component-props';
44
44
  export * from './models/ps-voice-orb';
45
45
  export * from './models/ps-navigation-progress';
46
+ export * from './hooks/use-ps-debounced-value';
46
47
  export * from './hooks/use-ps-navigation-progress';
47
48
  export * from './models/ps-draggable-grid';
48
49
  export * from './constants/ps-draggable-grid';
package/dist/index.js CHANGED
@@ -59,6 +59,7 @@ __exportStar(require("./hooks/use-ps-viewport"), exports);
59
59
  __exportStar(require("./interfaces/ps-component-props"), exports);
60
60
  __exportStar(require("./models/ps-voice-orb"), exports);
61
61
  __exportStar(require("./models/ps-navigation-progress"), exports);
62
+ __exportStar(require("./hooks/use-ps-debounced-value"), exports);
62
63
  __exportStar(require("./hooks/use-ps-navigation-progress"), exports);
63
64
  __exportStar(require("./models/ps-draggable-grid"), exports);
64
65
  __exportStar(require("./constants/ps-draggable-grid"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-core-components",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -36,6 +36,7 @@
36
36
  "@dnd-kit/utilities": "^3.2.2",
37
37
  "@pallasoft/ps-design-system": "^1.3.0",
38
38
  "@pallasoft/ps-icons": "^1.1.0",
39
+ "@pallasoft/ps-utilities": "^2.2.0",
39
40
  "@portabletext/react": "^3.2.4",
40
41
  "@portabletext/types": "^2.0.13",
41
42
  "@radix-ui/react-accordion": "^1.2.12",