@uxf/core-react 11.31.0 → 11.33.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.
- package/components/hide.js +1 -2
- package/components/show.js +1 -2
- package/hooks/_use-simulated-button.d.ts +2 -2
- package/hooks/_use-simulated-button.js +4 -5
- package/hooks/use-anchor-props.d.ts +3 -3
- package/hooks/use-anchor-props.js +13 -13
- package/hooks/use-body-scroll-lock.js +1 -2
- package/hooks/use-button-props.js +1 -2
- package/hooks/use-clickable-props.d.ts +3 -3
- package/hooks/use-clickable-props.js +12 -12
- package/hooks/use-focus-return.js +2 -3
- package/hooks/use-focus-trap.js +1 -2
- package/hooks/use-input-focus.js +1 -2
- package/hooks/use-is-mounted.js +1 -2
- package/hooks/use-key.js +1 -2
- package/hooks/use-latest.d.ts +0 -1
- package/hooks/use-latest.js +1 -2
- package/hooks/use-min-window-width.js +1 -2
- package/hooks/use-mouse-drag-to-scroll.js +1 -2
- package/hooks/use-on-mount.js +1 -2
- package/hooks/use-on-unmount.js +1 -2
- package/hooks/use-on-update.js +1 -2
- package/hooks/use-previous.d.ts +0 -1
- package/hooks/use-previous.js +1 -2
- package/hooks/use-raf-state.js +1 -2
- package/hooks/use-window-scroll.js +1 -2
- package/hooks/use-window-size.js +1 -2
- package/package.json +4 -4
- package/utils/compose-refs.js +1 -2
package/components/hide.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Hide =
|
|
6
|
+
exports.Hide = Hide;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
function Hide(props) {
|
|
9
9
|
if (props.when) {
|
|
@@ -11,4 +11,3 @@ function Hide(props) {
|
|
|
11
11
|
}
|
|
12
12
|
return react_1.default.createElement(react_1.default.Fragment, null, props.children);
|
|
13
13
|
}
|
|
14
|
-
exports.Hide = Hide;
|
package/components/show.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Show =
|
|
6
|
+
exports.Show = Show;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
function Show(props) {
|
|
9
9
|
if (!props.when) {
|
|
@@ -11,4 +11,3 @@ function Show(props) {
|
|
|
11
11
|
}
|
|
12
12
|
return react_1.default.createElement(react_1.default.Fragment, null, props.children);
|
|
13
13
|
}
|
|
14
|
-
exports.Show = Show;
|
|
@@ -6,9 +6,9 @@ interface Props<T extends HTMLElement> {
|
|
|
6
6
|
onClick?: MouseEventHandler<T>;
|
|
7
7
|
onKeyDown?: KeyboardEventHandler<T>;
|
|
8
8
|
onKeyUp?: KeyboardEventHandler<T>;
|
|
9
|
-
|
|
9
|
+
isSubmitType?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare function _useSimulatedButton<T extends HTMLElement>({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp,
|
|
11
|
+
export declare function _useSimulatedButton<T extends HTMLElement>({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp, isSubmitType, }: Props<T>): {
|
|
12
12
|
onClick: MouseEventHandler<T>;
|
|
13
13
|
onKeyDown: KeyboardEventHandler<T>;
|
|
14
14
|
onKeyUp: KeyboardEventHandler<T>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._useSimulatedButton =
|
|
3
|
+
exports._useSimulatedButton = _useSimulatedButton;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp,
|
|
5
|
+
function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp, isSubmitType, }) {
|
|
6
6
|
const _onClick = (0, react_1.useCallback)((e) => {
|
|
7
7
|
var _a;
|
|
8
8
|
if ((isClickable || isHyperlink) && analyticsCallback) {
|
|
9
9
|
analyticsCallback();
|
|
10
10
|
}
|
|
11
11
|
if (isClickable) {
|
|
12
|
-
if (
|
|
12
|
+
if (isSubmitType) {
|
|
13
13
|
const closestForm = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest("form");
|
|
14
14
|
if (closestForm) {
|
|
15
15
|
closestForm.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }));
|
|
@@ -22,7 +22,7 @@ function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onCl
|
|
|
22
22
|
else {
|
|
23
23
|
e.preventDefault();
|
|
24
24
|
}
|
|
25
|
-
}, [analyticsCallback, isClickable, isHyperlink, onClick,
|
|
25
|
+
}, [analyticsCallback, isClickable, isHyperlink, onClick, isSubmitType]);
|
|
26
26
|
const _onKeyUp = (0, react_1.useCallback)((e) => {
|
|
27
27
|
if (isClickable && (e.key === "Enter" || e.key === " ")) {
|
|
28
28
|
e.target.dispatchEvent(new MouseEvent("click", {
|
|
@@ -46,4 +46,3 @@ function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onCl
|
|
|
46
46
|
}, [isClickable, onKeyDown]);
|
|
47
47
|
return { onClick: _onClick, onKeyDown: _onKeyDown, onKeyUp: _onKeyUp };
|
|
48
48
|
}
|
|
49
|
-
exports._useSimulatedButton = _useSimulatedButton;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes } from "react";
|
|
2
2
|
export interface UseAnchorProps {
|
|
3
3
|
analyticsCallback?: () => void;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
isLoading?: boolean;
|
|
6
6
|
type?: "submit";
|
|
7
7
|
}
|
|
8
|
-
export declare function useAnchorProps<T extends AnchorHTMLAttributes<HTMLAnchorElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className,
|
|
8
|
+
export declare function useAnchorProps<T extends AnchorHTMLAttributes<HTMLAnchorElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, isDisabled, download, href, hrefLang, isLoading, media, onClick, onKeyDown, onKeyUp, ping, referrerPolicy, rel, role, tabIndex, target, type, ...restProps }: UseAnchorProps & T): T;
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAnchorProps =
|
|
3
|
+
exports.useAnchorProps = useAnchorProps;
|
|
4
4
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
5
5
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
6
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
6
7
|
const _use_simulated_button_1 = require("./_use-simulated-button");
|
|
7
|
-
function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className,
|
|
8
|
-
const isBusy =
|
|
9
|
-
const
|
|
10
|
-
const isBusyOrDisabled = isBusy ||
|
|
11
|
-
const
|
|
12
|
-
const isButton =
|
|
8
|
+
function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, isDisabled, download, href, hrefLang, isLoading, media, onClick, onKeyDown, onKeyUp, ping, referrerPolicy, rel, role, tabIndex, target, type, ...restProps }) {
|
|
9
|
+
const isBusy = Boolean(isLoading || ariaBusy);
|
|
10
|
+
const isDisabledOrAriaDisabled = Boolean(isDisabled || ariaDisabled);
|
|
11
|
+
const isBusyOrDisabled = isBusy || isDisabledOrAriaDisabled;
|
|
12
|
+
const isSubmitType = type === "submit";
|
|
13
|
+
const isButton = isSubmitType || (0, is_not_nil_1.isNotNil)(onClick);
|
|
13
14
|
const tabIndexInteractive = isBusyOrDisabled ? -1 : tabIndex;
|
|
14
|
-
const _className = [isBusy && classes_1.CLASSES.IS_LOADING,
|
|
15
|
+
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabledOrAriaDisabled && classes_1.CLASSES.IS_DISABLED, className];
|
|
15
16
|
const simulatedButton = (0, _use_simulated_button_1._useSimulatedButton)({
|
|
16
17
|
analyticsCallback,
|
|
17
18
|
isClickable: !isBusyOrDisabled || isButton,
|
|
18
|
-
isHyperlink: !isBusyOrDisabled ||
|
|
19
|
+
isHyperlink: !isBusyOrDisabled || Boolean(href),
|
|
19
20
|
onClick,
|
|
20
21
|
onKeyDown,
|
|
21
22
|
onKeyUp,
|
|
22
|
-
|
|
23
|
+
isSubmitType,
|
|
23
24
|
});
|
|
24
25
|
if (href) {
|
|
25
26
|
return {
|
|
26
27
|
"aria-busy": isBusy,
|
|
27
|
-
"aria-disabled":
|
|
28
|
+
"aria-disabled": isDisabledOrAriaDisabled,
|
|
28
29
|
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
|
|
29
30
|
download,
|
|
30
31
|
href,
|
|
@@ -45,7 +46,7 @@ function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabl
|
|
|
45
46
|
if (isButton) {
|
|
46
47
|
return {
|
|
47
48
|
"aria-busy": isBusy,
|
|
48
|
-
"aria-disabled":
|
|
49
|
+
"aria-disabled": isDisabledOrAriaDisabled,
|
|
49
50
|
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
|
|
50
51
|
onClick: simulatedButton.onClick,
|
|
51
52
|
onKeyDown: simulatedButton.onKeyDown,
|
|
@@ -62,4 +63,3 @@ function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabl
|
|
|
62
63
|
...restProps,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
exports.useAnchorProps = useAnchorProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useBodyScrollLock =
|
|
3
|
+
exports.useBodyScrollLock = useBodyScrollLock;
|
|
4
4
|
const bodyScrollLock_1 = require("@uxf/core/utils/bodyScrollLock");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClose, reserveScrollBarGap } = {}) {
|
|
@@ -32,4 +32,3 @@ function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClo
|
|
|
32
32
|
};
|
|
33
33
|
}, [allowTouchMove, clearAllOnClose, containerRef, isOpen, reserveScrollBarGap]);
|
|
34
34
|
}
|
|
35
|
-
exports.useBodyScrollLock = useBodyScrollLock;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useButtonProps =
|
|
3
|
+
exports.useButtonProps = useButtonProps;
|
|
4
4
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
5
5
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -56,4 +56,3 @@ function useButtonProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabl
|
|
|
56
56
|
...restProps,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
exports.useButtonProps = useButtonProps;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface UseClickableProps {
|
|
3
3
|
analyticsCallback?: () => void;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
isLoading?: boolean;
|
|
6
6
|
type?: "submit";
|
|
7
7
|
}
|
|
8
|
-
export declare function useClickableProps<T extends HTMLAttributes<HTMLElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className,
|
|
8
|
+
export declare function useClickableProps<T extends HTMLAttributes<HTMLElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, isDisabled, isLoading, onClick, onKeyDown, onKeyUp, role, tabIndex, type, ...restProps }: UseClickableProps & T): T;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useClickableProps =
|
|
3
|
+
exports.useClickableProps = useClickableProps;
|
|
4
4
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
5
5
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
6
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
6
7
|
const _use_simulated_button_1 = require("./_use-simulated-button");
|
|
7
|
-
function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className,
|
|
8
|
-
const isBusy =
|
|
9
|
-
const
|
|
10
|
-
const isBusyOrDisabled = isBusy ||
|
|
11
|
-
const
|
|
12
|
-
const isButton =
|
|
13
|
-
const _className = [isBusy && classes_1.CLASSES.IS_LOADING,
|
|
8
|
+
function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, isDisabled, isLoading, onClick, onKeyDown, onKeyUp, role, tabIndex, type, ...restProps }) {
|
|
9
|
+
const isBusy = Boolean(isLoading || ariaBusy);
|
|
10
|
+
const isDisabledOrAriaDisabled = Boolean(isDisabled || ariaDisabled);
|
|
11
|
+
const isBusyOrDisabled = isBusy || isDisabledOrAriaDisabled;
|
|
12
|
+
const isSubmitType = type === "submit";
|
|
13
|
+
const isButton = isSubmitType || (0, is_not_nil_1.isNotNil)(onClick);
|
|
14
|
+
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabledOrAriaDisabled && classes_1.CLASSES.IS_DISABLED, className];
|
|
14
15
|
const simulatedButton = (0, _use_simulated_button_1._useSimulatedButton)({
|
|
15
16
|
analyticsCallback,
|
|
16
17
|
isClickable: !isBusyOrDisabled || isButton,
|
|
@@ -18,18 +19,18 @@ function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDis
|
|
|
18
19
|
onClick,
|
|
19
20
|
onKeyDown,
|
|
20
21
|
onKeyUp,
|
|
21
|
-
|
|
22
|
+
isSubmitType,
|
|
22
23
|
});
|
|
23
24
|
if (isButton) {
|
|
24
25
|
return {
|
|
25
26
|
"aria-busy": isBusy,
|
|
26
|
-
"aria-disabled":
|
|
27
|
+
"aria-disabled": isDisabledOrAriaDisabled,
|
|
27
28
|
className: (0, cx_1.cx)(classes_1.CLASSES.IS_HOVERABLE, ..._className),
|
|
28
29
|
onClick: simulatedButton.onClick,
|
|
29
30
|
onKeyDown: simulatedButton.onKeyDown,
|
|
30
31
|
onKeyUp: simulatedButton.onKeyUp,
|
|
31
32
|
role: role || "button",
|
|
32
|
-
tabIndex: isBusyOrDisabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0,
|
|
33
|
+
tabIndex: isBusyOrDisabled ? -1 : (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0),
|
|
33
34
|
...restProps,
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -40,4 +41,3 @@ function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDis
|
|
|
40
41
|
...restProps,
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
exports.useClickableProps = useClickableProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFocusReturn =
|
|
3
|
+
exports.useFocusReturn = useFocusReturn;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_on_update_1 = require("./use-on-update");
|
|
6
6
|
function useFocusReturn(opened, transitionDuration = 0, shouldReturnFocus = true) {
|
|
@@ -29,7 +29,6 @@ function useFocusReturn(opened, transitionDuration = 0, shouldReturnFocus = true
|
|
|
29
29
|
clearTimeout(timeout);
|
|
30
30
|
document.removeEventListener("keydown", clearFocusTimeout);
|
|
31
31
|
};
|
|
32
|
-
}, [opened]);
|
|
32
|
+
}, [opened, shouldReturnFocus, transitionDuration]);
|
|
33
33
|
return returnFocus;
|
|
34
34
|
}
|
|
35
|
-
exports.useFocusReturn = useFocusReturn;
|
package/hooks/use-focus-trap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFocusTrap =
|
|
3
|
+
exports.useFocusTrap = useFocusTrap;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_on_unmount_1 = require("./use-on-unmount");
|
|
6
6
|
const TABBABLE_NODES = /input|select|textarea|button|object/;
|
|
@@ -143,4 +143,3 @@ function useFocusTrap(active = true) {
|
|
|
143
143
|
(0, use_on_unmount_1.useOnUnmount)(() => clearTimeout(timer.current));
|
|
144
144
|
return setRef;
|
|
145
145
|
}
|
|
146
|
-
exports.useFocusTrap = useFocusTrap;
|
package/hooks/use-input-focus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useInputFocus =
|
|
3
|
+
exports.useInputFocus = useInputFocus;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useInputFocus(focusRef, onBlur, onFocus) {
|
|
6
6
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
@@ -24,4 +24,3 @@ function useInputFocus(focusRef, onBlur, onFocus) {
|
|
|
24
24
|
}, [onBlur]);
|
|
25
25
|
return { focused, focus, onBlur: _onBlur, onFocus: _onFocus };
|
|
26
26
|
}
|
|
27
|
-
exports.useInputFocus = useInputFocus;
|
package/hooks/use-is-mounted.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsMounted =
|
|
3
|
+
exports.useIsMounted = useIsMounted;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useIsMounted() {
|
|
6
6
|
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
7
7
|
(0, react_1.useEffect)(() => setIsMounted(true), []);
|
|
8
8
|
return isMounted;
|
|
9
9
|
}
|
|
10
|
-
exports.useIsMounted = useIsMounted;
|
package/hooks/use-key.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useKey =
|
|
3
|
+
exports.useKey = useKey;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const createKeyPredicate = (keyFilter) => typeof keyFilter === "function"
|
|
6
6
|
? keyFilter
|
|
@@ -25,4 +25,3 @@ function useKey(keyFilter, callback, { disabled, targetRef, type = "keydown" } =
|
|
|
25
25
|
};
|
|
26
26
|
}, [callback, disabled, keyFilter, targetRef, type]);
|
|
27
27
|
}
|
|
28
|
-
exports.useKey = useKey;
|
package/hooks/use-latest.d.ts
CHANGED
package/hooks/use-latest.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLatest =
|
|
3
|
+
exports.useLatest = useLatest;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useLatest(current) {
|
|
6
6
|
const storedValue = (0, react_1.useRef)(current);
|
|
7
7
|
storedValue.current = current;
|
|
8
8
|
return storedValue;
|
|
9
9
|
}
|
|
10
|
-
exports.useLatest = useLatest;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMinWindowWidth =
|
|
3
|
+
exports.useMinWindowWidth = useMinWindowWidth;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_raf_state_1 = require("./use-raf-state");
|
|
6
6
|
function useMinWindowWidth(minWidth, debounce = 0) {
|
|
@@ -26,4 +26,3 @@ function useMinWindowWidth(minWidth, debounce = 0) {
|
|
|
26
26
|
}, [debounce, minWidth, setState]);
|
|
27
27
|
return state;
|
|
28
28
|
}
|
|
29
|
-
exports.useMinWindowWidth = useMinWindowWidth;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMouseDragToScroll =
|
|
3
|
+
exports.useMouseDragToScroll = useMouseDragToScroll;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useMouseDragToScroll(containerRef) {
|
|
6
6
|
const position = (0, react_1.useRef)({ left: 0, top: 0, x: 0, y: 0 });
|
|
@@ -36,4 +36,3 @@ function useMouseDragToScroll(containerRef) {
|
|
|
36
36
|
}, [containerRef]);
|
|
37
37
|
return style;
|
|
38
38
|
}
|
|
39
|
-
exports.useMouseDragToScroll = useMouseDragToScroll;
|
package/hooks/use-on-mount.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnMount =
|
|
3
|
+
exports.useOnMount = useOnMount;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useOnMount(effect) {
|
|
6
6
|
(0, react_1.useEffect)(() => {
|
|
7
7
|
return effect();
|
|
8
8
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9
9
|
}
|
|
10
|
-
exports.useOnMount = useOnMount;
|
package/hooks/use-on-unmount.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnUnmount =
|
|
3
|
+
exports.useOnUnmount = useOnUnmount;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useOnUnmount(effect) {
|
|
6
6
|
const effectRef = (0, react_1.useRef)(effect);
|
|
@@ -12,4 +12,3 @@ function useOnUnmount(effect) {
|
|
|
12
12
|
};
|
|
13
13
|
}, []);
|
|
14
14
|
}
|
|
15
|
-
exports.useOnUnmount = useOnUnmount;
|
package/hooks/use-on-update.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnUpdate =
|
|
3
|
+
exports.useOnUpdate = useOnUpdate;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useOnUpdate(effect, deps) {
|
|
6
6
|
const firstRun = (0, react_1.useRef)(true);
|
|
@@ -12,4 +12,3 @@ function useOnUpdate(effect, deps) {
|
|
|
12
12
|
return effect();
|
|
13
13
|
}, deps); // eslint-disable-line react-hooks/exhaustive-deps
|
|
14
14
|
}
|
|
15
|
-
exports.useOnUpdate = useOnUpdate;
|
package/hooks/use-previous.d.ts
CHANGED
package/hooks/use-previous.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePrevious =
|
|
3
|
+
exports.usePrevious = usePrevious;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function usePrevious(current) {
|
|
6
6
|
const storedValue = (0, react_1.useRef)(current);
|
|
@@ -9,4 +9,3 @@ function usePrevious(current) {
|
|
|
9
9
|
});
|
|
10
10
|
return storedValue;
|
|
11
11
|
}
|
|
12
|
-
exports.usePrevious = usePrevious;
|
package/hooks/use-raf-state.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRafState =
|
|
3
|
+
exports.useRafState = useRafState;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_on_unmount_1 = require("./use-on-unmount");
|
|
6
6
|
function useRafState(initialState) {
|
|
@@ -15,4 +15,3 @@ function useRafState(initialState) {
|
|
|
15
15
|
(0, use_on_unmount_1.useOnUnmount)(() => cancelAnimationFrame(frame.current));
|
|
16
16
|
return [state, setRafState];
|
|
17
17
|
}
|
|
18
|
-
exports.useRafState = useRafState;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useWindowScroll =
|
|
3
|
+
exports.useWindowScroll = useWindowScroll;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_raf_state_1 = require("./use-raf-state");
|
|
6
6
|
function useWindowScroll() {
|
|
@@ -19,4 +19,3 @@ function useWindowScroll() {
|
|
|
19
19
|
}, [setState]);
|
|
20
20
|
return state;
|
|
21
21
|
}
|
|
22
|
-
exports.useWindowScroll = useWindowScroll;
|
package/hooks/use-window-size.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useWindowSize =
|
|
3
|
+
exports.useWindowSize = useWindowSize;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const use_raf_state_1 = require("./use-raf-state");
|
|
6
6
|
function useWindowSize() {
|
|
@@ -16,4 +16,3 @@ function useWindowSize() {
|
|
|
16
16
|
}, [setState]);
|
|
17
17
|
return state;
|
|
18
18
|
}
|
|
19
|
-
exports.useWindowSize = useWindowSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/core-react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.33.0",
|
|
4
4
|
"description": "UXF Core",
|
|
5
5
|
"author": "UX Fans s.r.o",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@uxf/core": "11.
|
|
15
|
+
"@uxf/core": "11.32.0"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": ">=18.2.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/react": "18.
|
|
22
|
-
"react": "18.
|
|
21
|
+
"@types/react": "18.3.5",
|
|
22
|
+
"react": "18.3.1"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/utils/compose-refs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.composeRefs =
|
|
3
|
+
exports.composeRefs = composeRefs;
|
|
4
4
|
function composeRefs(...refs) {
|
|
5
5
|
return (value) => refs.forEach((ref) => {
|
|
6
6
|
if (!ref) {
|
|
@@ -13,4 +13,3 @@ function composeRefs(...refs) {
|
|
|
13
13
|
ref.current = value;
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
exports.composeRefs = composeRefs;
|