react-simplikit 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ImpressionArea/index.d.cts +3 -3
- package/dist/hooks/useThrottle/index.cjs +4 -3
- package/dist/hooks/useToggle/index.d.cts +2 -2
- package/dist/index.cjs +4 -3
- package/esm/components/ImpressionArea/index.d.ts +3 -3
- package/esm/hooks/useThrottle/index.js +4 -3
- package/esm/hooks/useToggle/index.d.ts +2 -2
- package/esm/index.js +4 -3
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import { ElementType, Ref, ReactNode } from 'react';
|
|
3
3
|
import { UseImpressionRefOptions } from '../../hooks/useImpressionRef/index.cjs';
|
|
4
4
|
|
|
5
|
-
type Props<Tag extends ElementType> =
|
|
5
|
+
type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseImpressionRefOptions & {
|
|
6
6
|
as?: Tag;
|
|
7
7
|
ref?: Ref<HTMLElement>;
|
|
8
|
-
children?:
|
|
8
|
+
children?: ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
@@ -131,9 +131,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
131
131
|
function useThrottle(callback, wait, options) {
|
|
132
132
|
const preservedCallback = usePreservedCallback(callback);
|
|
133
133
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
134
|
-
const throttledCallback = (0, import_react3.useMemo)(
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
const throttledCallback = (0, import_react3.useMemo)(
|
|
135
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
136
|
+
[preservedOptions, preservedCallback, wait]
|
|
137
|
+
);
|
|
137
138
|
(0, import_react3.useEffect)(() => {
|
|
138
139
|
return () => {
|
|
139
140
|
throttledCallback.cancel();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
@@ -25,6 +25,6 @@ import * as React from 'react';
|
|
|
25
25
|
* );
|
|
26
26
|
* }
|
|
27
27
|
*/
|
|
28
|
-
declare function useToggle(initialValue?: boolean): [boolean,
|
|
28
|
+
declare function useToggle(initialValue?: boolean): [boolean, react.ActionDispatch<[]>];
|
|
29
29
|
|
|
30
30
|
export { useToggle };
|
package/dist/index.cjs
CHANGED
|
@@ -696,9 +696,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
696
696
|
function useThrottle(callback, wait, options) {
|
|
697
697
|
const preservedCallback = usePreservedCallback(callback);
|
|
698
698
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
699
|
-
const throttledCallback = (0, import_react20.useMemo)(
|
|
700
|
-
|
|
701
|
-
|
|
699
|
+
const throttledCallback = (0, import_react20.useMemo)(
|
|
700
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
701
|
+
[preservedOptions, preservedCallback, wait]
|
|
702
|
+
);
|
|
702
703
|
(0, import_react20.useEffect)(() => {
|
|
703
704
|
return () => {
|
|
704
705
|
throttledCallback.cancel();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import { ElementType, Ref, ReactNode } from 'react';
|
|
3
3
|
import { UseImpressionRefOptions } from '../../hooks/useImpressionRef/index.js';
|
|
4
4
|
|
|
5
|
-
type Props<Tag extends ElementType> =
|
|
5
|
+
type Props<Tag extends ElementType> = React.ComponentPropsWithoutRef<Tag> & UseImpressionRefOptions & {
|
|
6
6
|
as?: Tag;
|
|
7
7
|
ref?: Ref<HTMLElement>;
|
|
8
|
-
children?:
|
|
8
|
+
children?: ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
@@ -105,9 +105,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
105
105
|
function useThrottle(callback, wait, options) {
|
|
106
106
|
const preservedCallback = usePreservedCallback(callback);
|
|
107
107
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
108
|
-
const throttledCallback = useMemo2(
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const throttledCallback = useMemo2(
|
|
109
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
110
|
+
[preservedOptions, preservedCallback, wait]
|
|
111
|
+
);
|
|
111
112
|
useEffect2(() => {
|
|
112
113
|
return () => {
|
|
113
114
|
throttledCallback.cancel();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
@@ -25,6 +25,6 @@ import * as React from 'react';
|
|
|
25
25
|
* );
|
|
26
26
|
* }
|
|
27
27
|
*/
|
|
28
|
-
declare function useToggle(initialValue?: boolean): [boolean,
|
|
28
|
+
declare function useToggle(initialValue?: boolean): [boolean, react.ActionDispatch<[]>];
|
|
29
29
|
|
|
30
30
|
export { useToggle };
|
package/esm/index.js
CHANGED
|
@@ -647,9 +647,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
647
647
|
function useThrottle(callback, wait, options) {
|
|
648
648
|
const preservedCallback = usePreservedCallback(callback);
|
|
649
649
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
650
|
-
const throttledCallback = useMemo6(
|
|
651
|
-
|
|
652
|
-
|
|
650
|
+
const throttledCallback = useMemo6(
|
|
651
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
652
|
+
[preservedOptions, preservedCallback, wait]
|
|
653
|
+
);
|
|
653
654
|
useEffect11(() => {
|
|
654
655
|
return () => {
|
|
655
656
|
throttledCallback.cancel();
|