armtek-uikit-react 1.0.46 → 1.0.49
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/assets/Button.scss
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import useEnhancedEffect from "./useEnhancedEffect";
|
|
5
|
-
function useEventCallback
|
|
6
|
-
function useEventCallback<Args extends unknown[], Return>(fn: (...args: Args) => Return): (...args: Args) => Return;
|
|
7
|
-
function useEventCallback<Args extends unknown[], Return>(fn: (...args: Args) => Return): (...args: Args) => Return {
|
|
5
|
+
function useEventCallback(fn) {
|
|
8
6
|
const ref = React.useRef(fn);
|
|
9
7
|
useEnhancedEffect(() => {
|
|
10
8
|
ref.current = fn;
|
|
11
9
|
});
|
|
12
|
-
return React.useRef((...args
|
|
10
|
+
return React.useRef((...args) =>
|
|
13
11
|
// @ts-expect-error hide `this`
|
|
14
|
-
(0, ref.current
|
|
12
|
+
(0, ref.current)(...args)).current;
|
|
15
13
|
}
|
|
16
14
|
export default useEventCallback;
|
package/lib/hooks/useLazyRef.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
const UNINITIALIZED = {};
|
|
5
|
-
export default function useLazyRef
|
|
6
|
-
const ref = useRef(
|
|
5
|
+
export default function useLazyRef(init, initArg) {
|
|
6
|
+
const ref = useRef(UNINITIALIZED);
|
|
7
7
|
if (ref.current === UNINITIALIZED) {
|
|
8
8
|
ref.current = init(initArg);
|
|
9
9
|
}
|
package/lib/hooks/useTimeout.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
3
|
import useLazyRef from "./useLazyRef";
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
export class Timeout {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.currentId = 0;
|
|
8
|
+
this.clear = () => {
|
|
9
|
+
if (this.currentId !== 0) {
|
|
10
|
+
clearTimeout(this.currentId);
|
|
11
|
+
this.currentId = 0;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.disposeEffect = () => {
|
|
15
|
+
return this.clear;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
6
18
|
static create() {
|
|
7
19
|
return new Timeout();
|
|
8
20
|
}
|
|
9
|
-
currentId: number = 0;
|
|
10
|
-
|
|
11
21
|
/**
|
|
12
22
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
13
23
|
*/
|
|
14
|
-
start(delay
|
|
24
|
+
start(delay, fn) {
|
|
15
25
|
this.clear();
|
|
16
|
-
this.currentId =
|
|
26
|
+
this.currentId = setTimeout(() => {
|
|
17
27
|
this.currentId = 0;
|
|
18
28
|
fn();
|
|
19
|
-
}, delay)
|
|
29
|
+
}, delay);
|
|
20
30
|
}
|
|
21
|
-
clear = () => {
|
|
22
|
-
if (this.currentId !== 0) {
|
|
23
|
-
clearTimeout(this.currentId);
|
|
24
|
-
this.currentId = 0;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
disposeEffect = () => {
|
|
28
|
-
return this.clear;
|
|
29
|
-
};
|
|
30
31
|
}
|
|
31
32
|
export default function useTimeout() {
|
|
32
33
|
const timeout = useLazyRef(Timeout.create).current;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.49","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/ui/Tooltip/Tooltip.js
CHANGED