@uxf/core 11.18.0 → 11.20.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/README.md +1 -1
- package/components/hide.d.ts +3 -0
- package/components/hide.js +3 -0
- package/components/show.d.ts +3 -0
- package/components/show.js +3 -0
- package/hooks/_useSimulatedButton.d.ts +3 -0
- package/hooks/_useSimulatedButton.js +3 -0
- package/hooks/useAnchorProps.d.ts +6 -0
- package/hooks/useAnchorProps.js +3 -0
- package/hooks/useBodyScrollLock.d.ts +6 -0
- package/hooks/useBodyScrollLock.js +3 -0
- package/hooks/useButtonProps.d.ts +6 -0
- package/hooks/useButtonProps.js +3 -0
- package/hooks/useClickableProps.d.ts +6 -0
- package/hooks/useClickableProps.js +3 -0
- package/hooks/useFocusReturn.d.ts +3 -0
- package/hooks/useFocusReturn.js +3 -0
- package/hooks/useFocusTrap.d.ts +3 -0
- package/hooks/useFocusTrap.js +3 -0
- package/hooks/useInputFocus.d.ts +3 -0
- package/hooks/useInputFocus.js +3 -0
- package/hooks/useIsMounted.d.ts +3 -0
- package/hooks/useIsMounted.js +3 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/hooks/useIsomorphicLayoutEffect.js +3 -0
- package/hooks/useKey.d.ts +9 -0
- package/hooks/useKey.js +3 -0
- package/hooks/useLatest.d.ts +3 -0
- package/hooks/useLatest.js +3 -0
- package/hooks/useMinWindowWidth.d.ts +3 -0
- package/hooks/useMinWindowWidth.js +3 -0
- package/hooks/useMouseDragToScroll.d.ts +3 -0
- package/hooks/useMouseDragToScroll.js +3 -0
- package/hooks/useOnMount.d.ts +3 -0
- package/hooks/useOnMount.js +3 -0
- package/hooks/useOnUnmount.d.ts +3 -0
- package/hooks/useOnUnmount.js +3 -0
- package/hooks/useOnUpdate.d.ts +3 -0
- package/hooks/useOnUpdate.js +3 -0
- package/hooks/usePagination.d.ts +3 -0
- package/hooks/usePagination.js +3 -0
- package/hooks/usePrevious.d.ts +3 -0
- package/hooks/usePrevious.js +3 -0
- package/hooks/useRafState.d.ts +3 -0
- package/hooks/useRafState.js +3 -0
- package/hooks/useWindowScroll.d.ts +3 -0
- package/hooks/useWindowScroll.js +3 -0
- package/hooks/useWindowSize.d.ts +3 -0
- package/hooks/useWindowSize.js +3 -0
- package/package.json +1 -1
- package/utils/image.d.ts +10 -1
- package/utils/image.js +8 -2
- package/utils/is-not-empty.d.ts +1 -0
- package/utils/is-not-empty.js +8 -0
- package/utils/is-not-empty.test.d.ts +1 -0
- package/utils/is-not-empty.test.js +9 -0
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ cookie.set("cookie-name", "value", /* ttl in seconds (optional) */, /* options (
|
|
|
74
74
|
cookie.delete("cookie-name", /* options (optional) */);
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
## Hooks
|
|
77
|
+
## Hooks - @deprecated - will be moved to @uxf/core-react
|
|
78
78
|
|
|
79
79
|
```tsx
|
|
80
80
|
import { useBodyScrollLock } from "@uxf/core/hooks/useBodyScrollLock";
|
package/components/hide.d.ts
CHANGED
package/components/hide.js
CHANGED
|
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Hide = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
10
|
+
*/
|
|
8
11
|
function Hide(props) {
|
|
9
12
|
if (props.when) {
|
|
10
13
|
return null;
|
package/components/show.d.ts
CHANGED
package/components/show.js
CHANGED
|
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Show = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
10
|
+
*/
|
|
8
11
|
function Show(props) {
|
|
9
12
|
if (!props.when) {
|
|
10
13
|
return null;
|
|
@@ -8,6 +8,9 @@ interface Props<T extends HTMLElement> {
|
|
|
8
8
|
onKeyUp?: KeyboardEventHandler<T>;
|
|
9
9
|
submit?: boolean;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
13
|
+
*/
|
|
11
14
|
export declare function _useSimulatedButton<T extends HTMLElement>({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp, submit, }: Props<T>): {
|
|
12
15
|
onClick: MouseEventHandler<T>;
|
|
13
16
|
onKeyDown: KeyboardEventHandler<T>;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports._useSimulatedButton = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onClick, onKeyDown, onKeyUp, submit, }) {
|
|
6
9
|
const _onClick = (0, react_1.useCallback)((e) => {
|
|
7
10
|
var _a;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
4
|
+
*/
|
|
2
5
|
export interface UseAnchorProps {
|
|
3
6
|
analyticsCallback?: () => void;
|
|
4
7
|
disabled?: boolean;
|
|
5
8
|
loading?: boolean;
|
|
6
9
|
type?: "submit";
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
13
|
+
*/
|
|
8
14
|
export declare function useAnchorProps<T extends AnchorHTMLAttributes<HTMLAnchorElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, disabled, download, href, hrefLang, loading, media, onClick, onKeyDown, onKeyUp, ping, referrerPolicy, rel, role, tabIndex, target, type, ...restProps }: UseAnchorProps & T): T;
|
package/hooks/useAnchorProps.js
CHANGED
|
@@ -4,6 +4,9 @@ exports.useAnchorProps = void 0;
|
|
|
4
4
|
const classes_1 = require("../constants/classes");
|
|
5
5
|
const cx_1 = require("../utils/cx");
|
|
6
6
|
const _useSimulatedButton_1 = require("./_useSimulatedButton");
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
9
|
+
*/
|
|
7
10
|
function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, disabled, download, href, hrefLang, loading, media, onClick, onKeyDown, onKeyUp, ping, referrerPolicy, rel, role, tabIndex, target, type, ...restProps }) {
|
|
8
11
|
const isBusy = loading ? loading : Boolean(ariaBusy);
|
|
9
12
|
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
2
|
import { BodyScrollOptions } from "../utils/bodyScrollLock";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
5
|
+
*/
|
|
3
6
|
export interface UseBodyScrollLockOptions extends BodyScrollOptions {
|
|
4
7
|
clearAllOnClose?: boolean;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
11
|
+
*/
|
|
6
12
|
export declare function useBodyScrollLock<T extends HTMLElement>(containerRef: RefObject<T>, isOpen: boolean, { allowTouchMove, clearAllOnClose, reserveScrollBarGap }?: Partial<UseBodyScrollLockOptions>): void;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useBodyScrollLock = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const bodyScrollLock_1 = require("../utils/bodyScrollLock");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClose, reserveScrollBarGap } = {}) {
|
|
7
10
|
(0, react_1.useEffect)(() => {
|
|
8
11
|
const node = containerRef.current;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
4
|
+
*/
|
|
2
5
|
export interface UseButtonProps {
|
|
3
6
|
analyticsCallback?: () => void;
|
|
4
7
|
loading?: boolean;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
11
|
+
*/
|
|
6
12
|
export declare function useButtonProps<T extends ButtonHTMLAttributes<HTMLButtonElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, autoFocus, analyticsCallback, className, disabled, formAction, formEncType, formMethod, formNoValidate, formTarget, loading, name, onClick, role, tabIndex, type, value, ...restProps }: UseButtonProps & T): T;
|
package/hooks/useButtonProps.js
CHANGED
|
@@ -4,6 +4,9 @@ exports.useButtonProps = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const classes_1 = require("../constants/classes");
|
|
6
6
|
const cx_1 = require("../utils/cx");
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
9
|
+
*/
|
|
7
10
|
function useButtonProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, autoFocus, analyticsCallback, className, disabled, formAction, formEncType, formMethod, formNoValidate, formTarget, loading, name, onClick, role, tabIndex, type, value, ...restProps }) {
|
|
8
11
|
const isBusy = loading ? loading : Boolean(ariaBusy);
|
|
9
12
|
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
4
|
+
*/
|
|
2
5
|
export interface UseClickableProps {
|
|
3
6
|
analyticsCallback?: () => void;
|
|
4
7
|
disabled?: boolean;
|
|
5
8
|
loading?: boolean;
|
|
6
9
|
type?: "submit";
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
13
|
+
*/
|
|
8
14
|
export declare function useClickableProps<T extends HTMLAttributes<HTMLElement>>({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, disabled, loading, onClick, onKeyDown, onKeyUp, role, tabIndex, type, ...restProps }: UseClickableProps & T): T;
|
|
@@ -4,6 +4,9 @@ exports.useClickableProps = void 0;
|
|
|
4
4
|
const classes_1 = require("../constants/classes");
|
|
5
5
|
const cx_1 = require("../utils/cx");
|
|
6
6
|
const _useSimulatedButton_1 = require("./_useSimulatedButton");
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
9
|
+
*/
|
|
7
10
|
function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabled, analyticsCallback, className, disabled, loading, onClick, onKeyDown, onKeyUp, role, tabIndex, type, ...restProps }) {
|
|
8
11
|
const isBusy = loading ? loading : Boolean(ariaBusy);
|
|
9
12
|
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
|
package/hooks/useFocusReturn.js
CHANGED
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useFocusReturn = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useOnUpdate_1 = require("./useOnUpdate");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
function useFocusReturn(opened, transitionDuration = 0, shouldReturnFocus = true) {
|
|
7
10
|
const lastActiveElement = (0, react_1.useRef)();
|
|
8
11
|
const returnFocus = () => {
|
package/hooks/useFocusTrap.d.ts
CHANGED
package/hooks/useFocusTrap.js
CHANGED
|
@@ -85,6 +85,9 @@ function createAriaHider(containerNode, selector = "body > :not(script)") {
|
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
90
|
+
*/
|
|
88
91
|
function useFocusTrap(active = true) {
|
|
89
92
|
const ref = (0, react_1.useRef)();
|
|
90
93
|
const restoreAria = (0, react_1.useRef)();
|
package/hooks/useInputFocus.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { FocusEventHandler, MouseEventHandler, RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
4
|
+
*/
|
|
2
5
|
export declare function useInputFocus<T extends HTMLInputElement | HTMLTextAreaElement | HTMLElement>(focusRef: RefObject<T>, onBlur?: FocusEventHandler<T>, onFocus?: FocusEventHandler<T>): {
|
|
3
6
|
focused: boolean;
|
|
4
7
|
focus: MouseEventHandler<HTMLElement>;
|
package/hooks/useInputFocus.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useInputFocus = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useInputFocus(focusRef, onBlur, onFocus) {
|
|
6
9
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
7
10
|
const focus = (0, react_1.useCallback)(() => {
|
package/hooks/useIsMounted.d.ts
CHANGED
package/hooks/useIsMounted.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useIsMounted = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useIsMounted() {
|
|
6
9
|
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
7
10
|
(0, react_1.useEffect)(() => setIsMounted(true), []);
|
|
@@ -3,4 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useIsomorphicLayoutEffect = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const isBrowser_1 = require("../utils/isBrowser");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
exports.useIsomorphicLayoutEffect = isBrowser_1.isBrowser ? react_1.useLayoutEffect : react_1.useEffect;
|
package/hooks/useKey.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { RefObject } from "react";
|
|
2
2
|
type KeyPredicate = (e: KeyboardEvent) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
5
|
+
*/
|
|
3
6
|
export type KeyFilter = null | undefined | string | KeyPredicate;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
9
|
+
*/
|
|
4
10
|
export interface UseKeyOptions<T extends HTMLElement> {
|
|
5
11
|
disabled?: boolean;
|
|
6
12
|
targetRef?: RefObject<T>;
|
|
7
13
|
type: "keydown" | "keyup" | "keypress";
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
17
|
+
*/
|
|
9
18
|
export declare function useKey<T extends HTMLElement>(keyFilter: KeyFilter, callback: (e: KeyboardEvent) => void, { disabled, targetRef, type }?: Partial<UseKeyOptions<T>>): void;
|
|
10
19
|
export {};
|
package/hooks/useKey.js
CHANGED
|
@@ -7,6 +7,9 @@ const createKeyPredicate = (keyFilter) => typeof keyFilter === "function"
|
|
|
7
7
|
: typeof keyFilter === "string"
|
|
8
8
|
? (e) => e.key === keyFilter
|
|
9
9
|
: () => false;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
12
|
+
*/
|
|
10
13
|
function useKey(keyFilter, callback, { disabled, targetRef, type = "keydown" } = {}) {
|
|
11
14
|
(0, react_1.useEffect)(() => {
|
|
12
15
|
if (disabled) {
|
package/hooks/useLatest.d.ts
CHANGED
package/hooks/useLatest.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLatest = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useLatest(current) {
|
|
6
9
|
const storedValue = (0, react_1.useRef)(current);
|
|
7
10
|
storedValue.current = current;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useMinWindowWidth = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useRafState_1 = require("./useRafState");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
function useMinWindowWidth(minWidth, debounce = 0) {
|
|
7
10
|
const [state, setState] = (0, useRafState_1.useRafState)();
|
|
8
11
|
(0, react_1.useEffect)(() => {
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMouseDragToScroll = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useMouseDragToScroll(containerRef) {
|
|
6
9
|
const position = (0, react_1.useRef)({ left: 0, top: 0, x: 0, y: 0 });
|
|
7
10
|
const [style, setStyle] = (0, react_1.useState)();
|
package/hooks/useOnMount.d.ts
CHANGED
package/hooks/useOnMount.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOnMount = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useOnMount(effect) {
|
|
6
9
|
(0, react_1.useEffect)(() => {
|
|
7
10
|
return effect();
|
package/hooks/useOnUnmount.d.ts
CHANGED
package/hooks/useOnUnmount.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOnUnmount = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useOnUnmount(effect) {
|
|
6
9
|
const effectRef = (0, react_1.useRef)(effect);
|
|
7
10
|
// update the ref each render so if it changed the newest callback will be invoked
|
package/hooks/useOnUpdate.d.ts
CHANGED
package/hooks/useOnUpdate.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOnUpdate = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function useOnUpdate(effect, deps) {
|
|
6
9
|
const firstRun = (0, react_1.useRef)(true);
|
|
7
10
|
(0, react_1.useEffect)(() => {
|
package/hooks/usePagination.d.ts
CHANGED
package/hooks/usePagination.js
CHANGED
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.usePagination = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const pagination_1 = require("../utils/pagination");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
const usePagination = (config) => {
|
|
7
10
|
return (0, react_1.useMemo)(() => (0, pagination_1.paginationGenerate)(config),
|
|
8
11
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/hooks/usePrevious.d.ts
CHANGED
package/hooks/usePrevious.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePrevious = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
7
|
+
*/
|
|
5
8
|
function usePrevious(current) {
|
|
6
9
|
const storedValue = (0, react_1.useRef)(current);
|
|
7
10
|
(0, react_1.useEffect)(() => {
|
package/hooks/useRafState.d.ts
CHANGED
package/hooks/useRafState.js
CHANGED
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useRafState = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useOnUnmount_1 = require("./useOnUnmount");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
function useRafState(initialState) {
|
|
7
10
|
const frame = (0, react_1.useRef)(0);
|
|
8
11
|
const [state, setState] = (0, react_1.useState)(initialState);
|
package/hooks/useWindowScroll.js
CHANGED
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useWindowScroll = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useRafState_1 = require("./useRafState");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
function useWindowScroll() {
|
|
7
10
|
const [state, setState] = (0, useRafState_1.useRafState)();
|
|
8
11
|
(0, react_1.useEffect)(() => {
|
package/hooks/useWindowSize.d.ts
CHANGED
package/hooks/useWindowSize.js
CHANGED
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useWindowSize = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useRafState_1 = require("./useRafState");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use import from @uxf/core-react instead.
|
|
8
|
+
*/
|
|
6
9
|
function useWindowSize() {
|
|
7
10
|
const [state, setState] = (0, useRafState_1.useRafState)();
|
|
8
11
|
(0, react_1.useEffect)(() => {
|
package/package.json
CHANGED
package/utils/image.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { ImageSource, ResizerImageProps } from "./resizer";
|
|
2
|
+
import { ImageResponse, ImageSource, ResizerImageProps, StaticImageData } from "./resizer";
|
|
3
3
|
export type Dimension = number | "auto";
|
|
4
4
|
export type Format = "avif" | "webp" | "original";
|
|
5
5
|
export type Quality = number | Record<Format, number>;
|
|
6
|
+
export declare function toImageResponse(src: any): ImageResponse | undefined;
|
|
7
|
+
export declare function toStaticImageData(src: any): StaticImageData | undefined;
|
|
8
|
+
export declare function parseImgExtension(src: string): string | undefined;
|
|
6
9
|
export declare function getSvgImgUrl(src: ImageSource): string | undefined;
|
|
7
10
|
export declare function getImgQuality(quality: Quality | undefined, format: Format): number | undefined;
|
|
8
11
|
export declare function getImgUniqueIdentifier(src: ImageSource): string | undefined;
|
|
@@ -12,6 +15,9 @@ export type GetImgSrcSetOptions = ResizerImageProps & {
|
|
|
12
15
|
maxHiDpi?: 3 | 2 | 1;
|
|
13
16
|
};
|
|
14
17
|
export declare function getImgSrcSet(src?: ImageSource, width?: Dimension, height?: Dimension, options?: GetImgSrcSetOptions): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use import from @uxf/ui instead.
|
|
20
|
+
*/
|
|
15
21
|
export type ImageSourcesOptions = Omit<GetImgSrcSetOptions, "quality" | "toFormat"> & {
|
|
16
22
|
isAvifDisabled?: boolean;
|
|
17
23
|
isWebPDisabled?: boolean;
|
|
@@ -25,5 +31,8 @@ interface ImageSourcesProps {
|
|
|
25
31
|
src: ImageSource;
|
|
26
32
|
width: Dimension;
|
|
27
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use import from @uxf/ui instead.
|
|
36
|
+
*/
|
|
28
37
|
export declare const ImgSources: FC<ImageSourcesProps>;
|
|
29
38
|
export {};
|
package/utils/image.js
CHANGED
|
@@ -3,21 +3,24 @@ 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.ImgSources = exports.getImgSrcSet = exports.getImgElementWidth = exports.getImgElementHeight = exports.getImgUniqueIdentifier = exports.getImgQuality = exports.getSvgImgUrl = void 0;
|
|
6
|
+
exports.ImgSources = exports.getImgSrcSet = exports.getImgElementWidth = exports.getImgElementHeight = exports.getImgUniqueIdentifier = exports.getImgQuality = exports.getSvgImgUrl = exports.parseImgExtension = exports.toStaticImageData = exports.toImageResponse = void 0;
|
|
7
|
+
const hide_1 = require("@uxf/core-react/components/hide");
|
|
7
8
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const hide_1 = require("../components/hide");
|
|
9
9
|
const file_1 = require("./file");
|
|
10
10
|
const resizer_1 = require("./resizer");
|
|
11
11
|
function toImageResponse(src) {
|
|
12
12
|
return typeof src !== "string" && "uuid" in src ? src : undefined;
|
|
13
13
|
}
|
|
14
|
+
exports.toImageResponse = toImageResponse;
|
|
14
15
|
function toStaticImageData(src) {
|
|
15
16
|
return typeof src !== "string" && "src" in src ? src : undefined;
|
|
16
17
|
}
|
|
18
|
+
exports.toStaticImageData = toStaticImageData;
|
|
17
19
|
function parseImgExtension(src) {
|
|
18
20
|
const ext = src.slice(src.lastIndexOf(".") + 1);
|
|
19
21
|
return ext.length > 1 ? ext : undefined;
|
|
20
22
|
}
|
|
23
|
+
exports.parseImgExtension = parseImgExtension;
|
|
21
24
|
function getSvgImgUrl(src) {
|
|
22
25
|
if (typeof src === "string" && parseImgExtension(src) === "svg") {
|
|
23
26
|
return src;
|
|
@@ -98,6 +101,9 @@ function getImgSrcSet(src, width, height, options = {}) {
|
|
|
98
101
|
return (0, resizer_1.resizerImageUrl)(src, w, h, { toFormat, ...restOptions });
|
|
99
102
|
}
|
|
100
103
|
exports.getImgSrcSet = getImgSrcSet;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Use import from @uxf/ui instead.
|
|
106
|
+
*/
|
|
101
107
|
const ImgSources = (props) => {
|
|
102
108
|
var _a, _b, _c, _d, _e;
|
|
103
109
|
if (!props.src) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isNotEmpty(value: any[] | string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const is_not_empty_1 = require("./is-not-empty");
|
|
4
|
+
test("is-not-empty", () => {
|
|
5
|
+
expect((0, is_not_empty_1.isNotEmpty)(["1"])).toBeTruthy();
|
|
6
|
+
expect((0, is_not_empty_1.isNotEmpty)([])).toBeFalsy();
|
|
7
|
+
expect((0, is_not_empty_1.isNotEmpty)("not-empty")).toBeTruthy();
|
|
8
|
+
expect((0, is_not_empty_1.isNotEmpty)("")).toBeFalsy();
|
|
9
|
+
});
|