@uxf/core 11.31.0 → 11.32.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/constants/empty-array.d.ts +1 -0
- package/constants/empty-array.js +4 -0
- package/constants/empty-object.d.ts +1 -0
- package/constants/empty-object.js +4 -0
- package/cookie/index.js +2 -1
- package/date/is-time-string.js +1 -2
- package/date/to-date-string.js +1 -2
- package/date/to-datetime-string.js +1 -2
- package/date/to-time-string.js +1 -2
- package/hooks/_useSimulatedButton.js +1 -2
- package/hooks/useAnchorProps.js +4 -4
- package/hooks/useBodyScrollLock.js +1 -2
- package/hooks/useButtonProps.js +1 -2
- package/hooks/useClickableProps.js +4 -4
- package/hooks/useFocusReturn.js +2 -3
- package/hooks/useFocusTrap.js +1 -2
- package/hooks/useInputFocus.js +1 -2
- package/hooks/useIsMounted.js +1 -2
- package/hooks/useKey.js +1 -2
- package/hooks/useLatest.d.ts +0 -1
- package/hooks/useLatest.js +1 -2
- package/hooks/useMinWindowWidth.js +1 -2
- package/hooks/useMouseDragToScroll.js +1 -2
- package/hooks/useOnMount.js +1 -2
- package/hooks/useOnUnmount.js +1 -2
- package/hooks/useOnUpdate.js +1 -2
- package/hooks/usePrevious.d.ts +0 -1
- package/hooks/usePrevious.js +1 -2
- package/hooks/useRafState.js +1 -2
- package/hooks/useTabs.js +1 -2
- package/hooks/useWindowScroll.js +1 -2
- package/hooks/useWindowSize.js +1 -2
- package/package.json +3 -3
- package/types/index.d.ts +1 -0
- package/utils/assert-not-nil.js +1 -2
- package/utils/bodyScrollLock.js +10 -10
- package/utils/buildArray.js +1 -2
- package/utils/camelCaseToDash.js +1 -2
- package/utils/composeRefs.js +1 -2
- package/utils/copy-to-clipboard.js +7 -3
- package/utils/cx.js +1 -2
- package/utils/cxa.d.ts +1 -1
- package/utils/cxa.js +1 -2
- package/utils/file.js +1 -2
- package/utils/filter-nullish.js +1 -2
- package/utils/image.js +16 -17
- package/utils/is-empty.js +1 -2
- package/utils/is-nil.js +1 -2
- package/utils/is-not-empty.js +1 -2
- package/utils/is-not-nil.js +1 -2
- package/utils/isBrowser.js +1 -1
- package/utils/last.js +1 -2
- package/utils/noop.d.ts +2 -0
- package/utils/noop.js +5 -0
- package/utils/pagination.js +10 -7
- package/utils/resizer.js +2 -2
- package/utils/slugify.js +1 -2
- package/utils/sort-object-keys.js +1 -2
- package/utils/throw-error.d.ts +1 -0
- package/utils/throw-error.js +6 -0
- package/utils/trimTrailingZeros.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
|
/**
|
|
9
9
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -14,4 +14,3 @@ function Hide(props) {
|
|
|
14
14
|
}
|
|
15
15
|
return react_1.default.createElement(react_1.default.Fragment, null, props.children);
|
|
16
16
|
}
|
|
17
|
-
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
|
/**
|
|
9
9
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -14,4 +14,3 @@ function Show(props) {
|
|
|
14
14
|
}
|
|
15
15
|
return react_1.default.createElement(react_1.default.Fragment, null, props.children);
|
|
16
16
|
}
|
|
17
|
-
exports.Show = Show;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EMPTY_ARRAY: [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EMPTY_OBJECT: Record<string, never>;
|
package/cookie/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Cookie = void 0;
|
|
4
|
+
const is_not_empty_1 = require("../utils/is-not-empty");
|
|
4
5
|
class Cookie {
|
|
5
6
|
constructor(ctx = null) {
|
|
6
7
|
this.ctx = ctx;
|
|
@@ -9,7 +10,7 @@ class Cookie {
|
|
|
9
10
|
return new Cookie(ctx);
|
|
10
11
|
}
|
|
11
12
|
has(name) {
|
|
12
|
-
return
|
|
13
|
+
return (0, is_not_empty_1.isNotEmpty)(this.get(name));
|
|
13
14
|
}
|
|
14
15
|
set(name, value, ttl = 3600, options = {}) {
|
|
15
16
|
const date = new Date();
|
package/date/is-time-string.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTimeString =
|
|
3
|
+
exports.isTimeString = isTimeString;
|
|
4
4
|
const is_nil_1 = require("../utils/is-nil");
|
|
5
5
|
function isTimeString(value) {
|
|
6
6
|
if ((0, is_nil_1.isNil)(value)) {
|
|
@@ -8,4 +8,3 @@ function isTimeString(value) {
|
|
|
8
8
|
}
|
|
9
9
|
return /(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)/.test(value);
|
|
10
10
|
}
|
|
11
|
-
exports.isTimeString = isTimeString;
|
package/date/to-date-string.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toDateString =
|
|
3
|
+
exports.toDateString = toDateString;
|
|
4
4
|
const is_nil_1 = require("../utils/is-nil");
|
|
5
5
|
function toDateString(value) {
|
|
6
6
|
if ((0, is_nil_1.isNil)(value)) {
|
|
@@ -8,4 +8,3 @@ function toDateString(value) {
|
|
|
8
8
|
}
|
|
9
9
|
return value.toISOString().substring(0, 10);
|
|
10
10
|
}
|
|
11
|
-
exports.toDateString = toDateString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toDatetimeString =
|
|
3
|
+
exports.toDatetimeString = toDatetimeString;
|
|
4
4
|
const is_nil_1 = require("../utils/is-nil");
|
|
5
5
|
function toDatetimeString(value) {
|
|
6
6
|
if ((0, is_nil_1.isNil)(value)) {
|
|
@@ -18,4 +18,3 @@ function toDatetimeString(value) {
|
|
|
18
18
|
const timezone = `${offsetSign}${offsetHours}:${offsetMinutes}`;
|
|
19
19
|
return `${value.getFullYear()}-${month}-${day}T${hours}:${minutes}:${seconds}${timezone}`;
|
|
20
20
|
}
|
|
21
|
-
exports.toDatetimeString = toDatetimeString;
|
package/date/to-time-string.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toTimeString =
|
|
3
|
+
exports.toTimeString = toTimeString;
|
|
4
4
|
const is_nil_1 = require("../utils/is-nil");
|
|
5
5
|
function toTimeString(value) {
|
|
6
6
|
if ((0, is_nil_1.isNil)(value)) {
|
|
@@ -8,4 +8,3 @@ function toTimeString(value) {
|
|
|
8
8
|
}
|
|
9
9
|
return `${value.getHours().toString().padStart(2, "0")}:${value.getMinutes().toString().padStart(2, "0")}:${value.getSeconds().toString().padStart(2, "0")}`;
|
|
10
10
|
}
|
|
11
|
-
exports.toTimeString = toTimeString;
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -49,4 +49,3 @@ function _useSimulatedButton({ analyticsCallback, isClickable, isHyperlink, onCl
|
|
|
49
49
|
}, [isClickable, onKeyDown]);
|
|
50
50
|
return { onClick: _onClick, onKeyDown: _onKeyDown, onKeyUp: _onKeyUp };
|
|
51
51
|
}
|
|
52
|
-
exports._useSimulatedButton = _useSimulatedButton;
|
package/hooks/useAnchorProps.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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("../constants/classes");
|
|
5
5
|
const cx_1 = require("../utils/cx");
|
|
6
|
+
const is_not_nil_1 = require("../utils/is-not-nil");
|
|
6
7
|
const _useSimulatedButton_1 = require("./_useSimulatedButton");
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -12,13 +13,13 @@ function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabl
|
|
|
12
13
|
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
|
|
13
14
|
const isBusyOrDisabled = isBusy || isDisabled;
|
|
14
15
|
const submit = type === "submit";
|
|
15
|
-
const isButton = submit ||
|
|
16
|
+
const isButton = submit || (0, is_not_nil_1.isNotNil)(onClick);
|
|
16
17
|
const tabIndexInteractive = isBusyOrDisabled ? -1 : tabIndex;
|
|
17
18
|
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, disabled && classes_1.CLASSES.IS_DISABLED, className];
|
|
18
19
|
const simulatedButton = (0, _useSimulatedButton_1._useSimulatedButton)({
|
|
19
20
|
analyticsCallback,
|
|
20
21
|
isClickable: !isBusyOrDisabled || isButton,
|
|
21
|
-
isHyperlink: !isBusyOrDisabled ||
|
|
22
|
+
isHyperlink: !isBusyOrDisabled || Boolean(href),
|
|
22
23
|
onClick,
|
|
23
24
|
onKeyDown,
|
|
24
25
|
onKeyUp,
|
|
@@ -65,4 +66,3 @@ function useAnchorProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabl
|
|
|
65
66
|
...restProps,
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
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 react_1 = require("react");
|
|
5
5
|
const bodyScrollLock_1 = require("../utils/bodyScrollLock");
|
|
6
6
|
/**
|
|
@@ -35,4 +35,3 @@ function useBodyScrollLock(containerRef, isOpen, { allowTouchMove, clearAllOnClo
|
|
|
35
35
|
};
|
|
36
36
|
}, [allowTouchMove, clearAllOnClose, containerRef, isOpen, reserveScrollBarGap]);
|
|
37
37
|
}
|
|
38
|
-
exports.useBodyScrollLock = useBodyScrollLock;
|
package/hooks/useButtonProps.js
CHANGED
|
@@ -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 react_1 = require("react");
|
|
5
5
|
const classes_1 = require("../constants/classes");
|
|
6
6
|
const cx_1 = require("../utils/cx");
|
|
@@ -59,4 +59,3 @@ function useButtonProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDisabl
|
|
|
59
59
|
...restProps,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
exports.useButtonProps = useButtonProps;
|
|
@@ -1,8 +1,9 @@
|
|
|
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("../constants/classes");
|
|
5
5
|
const cx_1 = require("../utils/cx");
|
|
6
|
+
const is_not_nil_1 = require("../utils/is-not-nil");
|
|
6
7
|
const _useSimulatedButton_1 = require("./_useSimulatedButton");
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -12,7 +13,7 @@ function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDis
|
|
|
12
13
|
const isDisabled = disabled ? disabled : Boolean(ariaDisabled);
|
|
13
14
|
const isBusyOrDisabled = isBusy || isDisabled;
|
|
14
15
|
const submit = type === "submit";
|
|
15
|
-
const isButton = submit ||
|
|
16
|
+
const isButton = submit || (0, is_not_nil_1.isNotNil)(onClick);
|
|
16
17
|
const _className = [isBusy && classes_1.CLASSES.IS_LOADING, isDisabled && classes_1.CLASSES.IS_DISABLED, className];
|
|
17
18
|
const simulatedButton = (0, _useSimulatedButton_1._useSimulatedButton)({
|
|
18
19
|
analyticsCallback,
|
|
@@ -32,7 +33,7 @@ function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDis
|
|
|
32
33
|
onKeyDown: simulatedButton.onKeyDown,
|
|
33
34
|
onKeyUp: simulatedButton.onKeyUp,
|
|
34
35
|
role: role || "button",
|
|
35
|
-
tabIndex: isBusyOrDisabled ? -1 : tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0,
|
|
36
|
+
tabIndex: isBusyOrDisabled ? -1 : (tabIndex !== null && tabIndex !== void 0 ? tabIndex : 0),
|
|
36
37
|
...restProps,
|
|
37
38
|
};
|
|
38
39
|
}
|
|
@@ -43,4 +44,3 @@ function useClickableProps({ ["aria-busy"]: ariaBusy, ["aria-disabled"]: ariaDis
|
|
|
43
44
|
...restProps,
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
exports.useClickableProps = useClickableProps;
|
package/hooks/useFocusReturn.js
CHANGED
|
@@ -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 useOnUpdate_1 = require("./useOnUpdate");
|
|
6
6
|
/**
|
|
@@ -32,7 +32,6 @@ function useFocusReturn(opened, transitionDuration = 0, shouldReturnFocus = true
|
|
|
32
32
|
clearTimeout(timeout);
|
|
33
33
|
document.removeEventListener("keydown", clearFocusTimeout);
|
|
34
34
|
};
|
|
35
|
-
}, [opened]);
|
|
35
|
+
}, [opened, shouldReturnFocus, transitionDuration]);
|
|
36
36
|
return returnFocus;
|
|
37
37
|
}
|
|
38
|
-
exports.useFocusReturn = useFocusReturn;
|
package/hooks/useFocusTrap.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 useOnUnmount_1 = require("./useOnUnmount");
|
|
6
6
|
const TABBABLE_NODES = /input|select|textarea|button|object/;
|
|
@@ -146,4 +146,3 @@ function useFocusTrap(active = true) {
|
|
|
146
146
|
(0, useOnUnmount_1.useOnUnmount)(() => clearTimeout(timer.current));
|
|
147
147
|
return setRef;
|
|
148
148
|
}
|
|
149
|
-
exports.useFocusTrap = useFocusTrap;
|
package/hooks/useInputFocus.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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -27,4 +27,3 @@ function useInputFocus(focusRef, onBlur, onFocus) {
|
|
|
27
27
|
}, [onBlur]);
|
|
28
28
|
return { focused, focus, onBlur: _onBlur, onFocus: _onFocus };
|
|
29
29
|
}
|
|
30
|
-
exports.useInputFocus = useInputFocus;
|
package/hooks/useIsMounted.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -10,4 +10,3 @@ function useIsMounted() {
|
|
|
10
10
|
(0, react_1.useEffect)(() => setIsMounted(true), []);
|
|
11
11
|
return isMounted;
|
|
12
12
|
}
|
|
13
|
-
exports.useIsMounted = useIsMounted;
|
package/hooks/useKey.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
|
|
@@ -28,4 +28,3 @@ function useKey(keyFilter, callback, { disabled, targetRef, type = "keydown" } =
|
|
|
28
28
|
};
|
|
29
29
|
}, [callback, disabled, keyFilter, targetRef, type]);
|
|
30
30
|
}
|
|
31
|
-
exports.useKey = useKey;
|
package/hooks/useLatest.d.ts
CHANGED
package/hooks/useLatest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -10,4 +10,3 @@ function useLatest(current) {
|
|
|
10
10
|
storedValue.current = current;
|
|
11
11
|
return storedValue;
|
|
12
12
|
}
|
|
13
|
-
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 useRafState_1 = require("./useRafState");
|
|
6
6
|
/**
|
|
@@ -29,4 +29,3 @@ function useMinWindowWidth(minWidth, debounce = 0) {
|
|
|
29
29
|
}, [debounce, minWidth, setState]);
|
|
30
30
|
return state;
|
|
31
31
|
}
|
|
32
|
-
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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -39,4 +39,3 @@ function useMouseDragToScroll(containerRef) {
|
|
|
39
39
|
}, [containerRef]);
|
|
40
40
|
return style;
|
|
41
41
|
}
|
|
42
|
-
exports.useMouseDragToScroll = useMouseDragToScroll;
|
package/hooks/useOnMount.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -10,4 +10,3 @@ function useOnMount(effect) {
|
|
|
10
10
|
return effect();
|
|
11
11
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
12
12
|
}
|
|
13
|
-
exports.useOnMount = useOnMount;
|
package/hooks/useOnUnmount.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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -15,4 +15,3 @@ function useOnUnmount(effect) {
|
|
|
15
15
|
};
|
|
16
16
|
}, []);
|
|
17
17
|
}
|
|
18
|
-
exports.useOnUnmount = useOnUnmount;
|
package/hooks/useOnUpdate.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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -15,4 +15,3 @@ function useOnUpdate(effect, deps) {
|
|
|
15
15
|
return effect();
|
|
16
16
|
}, deps); // eslint-disable-line react-hooks/exhaustive-deps
|
|
17
17
|
}
|
|
18
|
-
exports.useOnUpdate = useOnUpdate;
|
package/hooks/usePrevious.d.ts
CHANGED
package/hooks/usePrevious.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
|
/**
|
|
6
6
|
* @deprecated Use import from @uxf/core-react instead.
|
|
@@ -12,4 +12,3 @@ function usePrevious(current) {
|
|
|
12
12
|
});
|
|
13
13
|
return storedValue;
|
|
14
14
|
}
|
|
15
|
-
exports.usePrevious = usePrevious;
|
package/hooks/useRafState.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 useOnUnmount_1 = require("./useOnUnmount");
|
|
6
6
|
/**
|
|
@@ -18,4 +18,3 @@ function useRafState(initialState) {
|
|
|
18
18
|
(0, useOnUnmount_1.useOnUnmount)(() => cancelAnimationFrame(frame.current));
|
|
19
19
|
return [state, setRafState];
|
|
20
20
|
}
|
|
21
|
-
exports.useRafState = useRafState;
|
package/hooks/useTabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTabs =
|
|
3
|
+
exports.useTabs = useTabs;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useKey_1 = require("./useKey");
|
|
6
6
|
const useOnUpdate_1 = require("./useOnUpdate");
|
|
@@ -41,4 +41,3 @@ function useTabs({ activeTab, id, tabListRef, tabsCount }) {
|
|
|
41
41
|
tabTitleIdPrefix,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
exports.useTabs = useTabs;
|
package/hooks/useWindowScroll.js
CHANGED
|
@@ -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 useRafState_1 = require("./useRafState");
|
|
6
6
|
/**
|
|
@@ -22,4 +22,3 @@ function useWindowScroll() {
|
|
|
22
22
|
}, [setState]);
|
|
23
23
|
return state;
|
|
24
24
|
}
|
|
25
|
-
exports.useWindowScroll = useWindowScroll;
|
package/hooks/useWindowSize.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 useRafState_1 = require("./useRafState");
|
|
6
6
|
/**
|
|
@@ -19,4 +19,3 @@ function useWindowSize() {
|
|
|
19
19
|
}, [setState]);
|
|
20
20
|
return state;
|
|
21
21
|
}
|
|
22
|
-
exports.useWindowSize = useWindowSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.32.0",
|
|
4
4
|
"description": "UXF Core",
|
|
5
5
|
"author": "Petr Vejvoda <vejvoda@uxf.cz>",
|
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/core#readme",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"react": ">=18.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/react": "18.
|
|
30
|
-
"react": "18.
|
|
29
|
+
"@types/react": "18.3.5",
|
|
30
|
+
"react": "18.3.1"
|
|
31
31
|
},
|
|
32
32
|
"gitHead": "a2dee6aa67621f6eda17e63e88d0edf14f88455a"
|
|
33
33
|
}
|
package/types/index.d.ts
CHANGED
package/utils/assert-not-nil.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertNotNil =
|
|
3
|
+
exports.assertNotNil = assertNotNil;
|
|
4
4
|
const is_nil_1 = require("./is-nil");
|
|
5
5
|
function assertNotNil(value, errorMessage = "Value is nil.") {
|
|
6
6
|
if ((0, is_nil_1.isNil)(value)) {
|
|
7
7
|
throw new Error(errorMessage);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
exports.assertNotNil = assertNotNil;
|
package/utils/bodyScrollLock.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Forked from "body-scroll-lock" https://github.com/willmcpo/body-scroll-lock
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.enableBodyScroll = exports.clearAllBodyScrollLocks = exports.disableBodyScroll = void 0;
|
|
5
|
-
|
|
6
|
-
return void null;
|
|
7
|
-
}
|
|
5
|
+
const noop_1 = require("./noop");
|
|
8
6
|
// Older browsers don't support event options, feature detect it.
|
|
9
7
|
let hasPassiveEvents = false;
|
|
10
8
|
if (typeof window !== "undefined") {
|
|
@@ -14,8 +12,8 @@ if (typeof window !== "undefined") {
|
|
|
14
12
|
return undefined;
|
|
15
13
|
},
|
|
16
14
|
};
|
|
17
|
-
window.addEventListener("testPassive", noop, passiveTestOptions);
|
|
18
|
-
window.removeEventListener("testPassive", noop);
|
|
15
|
+
window.addEventListener("testPassive", noop_1.noop, passiveTestOptions);
|
|
16
|
+
window.removeEventListener("testPassive", noop_1.noop);
|
|
19
17
|
}
|
|
20
18
|
const isIosDevice = typeof window !== "undefined" &&
|
|
21
19
|
typeof window.navigator !== "undefined" &&
|
|
@@ -29,7 +27,7 @@ let previousBodyOverflowSetting;
|
|
|
29
27
|
let previousBodyPosition;
|
|
30
28
|
let previousBodyPaddingRight;
|
|
31
29
|
// returns true if `el` should be allowed to receive touchmove events.
|
|
32
|
-
const allowTouchMove = (el) => locks.some((lock) =>
|
|
30
|
+
const allowTouchMove = (el) => locks.some((lock) => { var _a, _b; return Boolean((_b = (_a = lock.options) === null || _a === void 0 ? void 0 : _a.allowTouchMove) === null || _b === void 0 ? void 0 : _b.call(_a, el)); });
|
|
33
31
|
const preventDefault = (rawEvent) => {
|
|
34
32
|
const e = typeof rawEvent !== "undefined" ? rawEvent : window.event;
|
|
35
33
|
// For the case whereby consumers adds a touchmove event listener to document.
|
|
@@ -51,7 +49,7 @@ const preventDefault = (rawEvent) => {
|
|
|
51
49
|
const setOverflowHidden = (options) => {
|
|
52
50
|
// If previousBodyPaddingRight is already set, don't set it again.
|
|
53
51
|
if (previousBodyPaddingRight === undefined) {
|
|
54
|
-
const reserveScrollBarGap =
|
|
52
|
+
const reserveScrollBarGap = (options === null || options === void 0 ? void 0 : options.reserveScrollBarGap) === true;
|
|
55
53
|
const scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
56
54
|
if (reserveScrollBarGap && scrollBarGap > 0) {
|
|
57
55
|
const computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"), 10);
|
|
@@ -119,7 +117,8 @@ const restorePositionSetting = () => {
|
|
|
119
117
|
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
|
|
120
118
|
const isTargetElementTotallyScrolled = (targetElement) => targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
|
|
121
119
|
const handleScroll = (event, targetElement) => {
|
|
122
|
-
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const clientY = (_b = (_a = event.targetTouches.item(0)) === null || _a === void 0 ? void 0 : _a.clientY) !== null && _b !== void 0 ? _b : 0 - initialClientY;
|
|
123
122
|
if (event.target && allowTouchMove(event.target)) {
|
|
124
123
|
return false;
|
|
125
124
|
}
|
|
@@ -147,7 +146,7 @@ const disableBodyScroll = (targetElement, options) => {
|
|
|
147
146
|
}
|
|
148
147
|
const lock = {
|
|
149
148
|
targetElement,
|
|
150
|
-
options
|
|
149
|
+
options,
|
|
151
150
|
};
|
|
152
151
|
locks = [...locks, lock];
|
|
153
152
|
if (isIosDevice) {
|
|
@@ -158,9 +157,10 @@ const disableBodyScroll = (targetElement, options) => {
|
|
|
158
157
|
}
|
|
159
158
|
if (isIosDevice) {
|
|
160
159
|
targetElement.ontouchstart = (event) => {
|
|
160
|
+
var _a, _b;
|
|
161
161
|
if (event.targetTouches.length === 1) {
|
|
162
162
|
// detect single touch.
|
|
163
|
-
initialClientY = event.targetTouches
|
|
163
|
+
initialClientY = (_b = (_a = event.targetTouches.item(0)) === null || _a === void 0 ? void 0 : _a.clientY) !== null && _b !== void 0 ? _b : 0;
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
targetElement.ontouchmove = (event) => {
|
package/utils/buildArray.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildArray =
|
|
3
|
+
exports.buildArray = buildArray;
|
|
4
4
|
function buildArray(initial) {
|
|
5
5
|
const initialArray = (initial ? [...initial] : []);
|
|
6
6
|
const proxiedArray = new Proxy(initialArray, {
|
|
@@ -24,4 +24,3 @@ function buildArray(initial) {
|
|
|
24
24
|
});
|
|
25
25
|
return proxiedArray;
|
|
26
26
|
}
|
|
27
|
-
exports.buildArray = buildArray;
|
package/utils/camelCaseToDash.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelCaseToDash =
|
|
3
|
+
exports.camelCaseToDash = camelCaseToDash;
|
|
4
4
|
function camelCaseToDash(content) {
|
|
5
5
|
return content.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
6
|
}
|
|
7
|
-
exports.camelCaseToDash = camelCaseToDash;
|
package/utils/composeRefs.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
|
/**
|
|
5
5
|
* @deprecated Use import from @uxf/core-react instead.
|
|
6
6
|
*/
|
|
@@ -16,4 +16,3 @@ function composeRefs(...refs) {
|
|
|
16
16
|
ref.current = value;
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
exports.composeRefs = composeRefs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyToClipboard =
|
|
3
|
+
exports.copyToClipboard = copyToClipboard;
|
|
4
4
|
function copyToClipboardFallback(text) {
|
|
5
5
|
const textArea = document.createElement("textarea");
|
|
6
6
|
textArea.value = text;
|
|
@@ -17,7 +17,12 @@ function copyToClipboardFallback(text) {
|
|
|
17
17
|
async function copyToClipboard(text) {
|
|
18
18
|
const isSupported = typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.writeText === "function";
|
|
19
19
|
try {
|
|
20
|
-
|
|
20
|
+
if (isSupported) {
|
|
21
|
+
await navigator.clipboard.writeText(text);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
copyToClipboardFallback(text);
|
|
25
|
+
}
|
|
21
26
|
return true;
|
|
22
27
|
}
|
|
23
28
|
catch (e) {
|
|
@@ -26,4 +31,3 @@ async function copyToClipboard(text) {
|
|
|
26
31
|
return false;
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
|
-
exports.copyToClipboard = copyToClipboard;
|
package/utils/cx.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cx =
|
|
3
|
+
exports.cx = cx;
|
|
4
4
|
function cx(...classes) {
|
|
5
5
|
let i = 0, tmp, str = "";
|
|
6
6
|
for (; i < classes.length; i++) {
|
|
@@ -12,4 +12,3 @@ function cx(...classes) {
|
|
|
12
12
|
}
|
|
13
13
|
return str;
|
|
14
14
|
}
|
|
15
|
-
exports.cx = cx;
|
package/utils/cxa.d.ts
CHANGED
package/utils/cxa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cxa =
|
|
3
|
+
exports.cxa = cxa;
|
|
4
4
|
function toVal(mix) {
|
|
5
5
|
let k;
|
|
6
6
|
let y;
|
|
@@ -51,4 +51,3 @@ function cxa(...classes) {
|
|
|
51
51
|
}
|
|
52
52
|
return str;
|
|
53
53
|
}
|
|
54
|
-
exports.cxa = cxa;
|
package/utils/file.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFileUrl =
|
|
3
|
+
exports.getFileUrl = getFileUrl;
|
|
4
4
|
function getFileUrl(file) {
|
|
5
5
|
const ch1 = file.uuid.charAt(0);
|
|
6
6
|
const ch2 = file.uuid.charAt(1);
|
|
@@ -8,4 +8,3 @@ function getFileUrl(file) {
|
|
|
8
8
|
? `/upload/${file.namespace}/${ch1}/${ch2}/${file.uuid}.${file.extension}`
|
|
9
9
|
: `/upload/${ch1}/${ch2}/${file.uuid}.${file.extension}`;
|
|
10
10
|
}
|
|
11
|
-
exports.getFileUrl = getFileUrl;
|
package/utils/filter-nullish.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterNullish =
|
|
3
|
+
exports.filterNullish = filterNullish;
|
|
4
4
|
const is_not_nil_1 = require("./is-not-nil");
|
|
5
5
|
function filterNullish(val) {
|
|
6
6
|
return val.filter(is_not_nil_1.isNotNil);
|
|
7
7
|
}
|
|
8
|
-
exports.filterNullish = filterNullish;
|
package/utils/image.js
CHANGED
|
@@ -3,7 +3,17 @@ 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.
|
|
6
|
+
exports.isSrcString = isSrcString;
|
|
7
|
+
exports.isSrcImageResponse = isSrcImageResponse;
|
|
8
|
+
exports.isSrcStaticImageData = isSrcStaticImageData;
|
|
9
|
+
exports.parseImgExtension = parseImgExtension;
|
|
10
|
+
exports.getSvgImgUrl = getSvgImgUrl;
|
|
11
|
+
exports.getImgQuality = getImgQuality;
|
|
12
|
+
exports.getImgUniqueIdentifier = getImgUniqueIdentifier;
|
|
13
|
+
exports.getImgElementHeight = getImgElementHeight;
|
|
14
|
+
exports.getImgElementWidth = getImgElementWidth;
|
|
15
|
+
exports.getImgSrcSet = getImgSrcSet;
|
|
16
|
+
exports.ImgSources = ImgSources;
|
|
7
17
|
const hide_1 = require("@uxf/core-react/components/hide");
|
|
8
18
|
const react_1 = __importDefault(require("react"));
|
|
9
19
|
const file_1 = require("./file");
|
|
@@ -13,20 +23,16 @@ const resizer_1 = require("./resizer");
|
|
|
13
23
|
function isSrcString(src) {
|
|
14
24
|
return typeof src === "string";
|
|
15
25
|
}
|
|
16
|
-
exports.isSrcString = isSrcString;
|
|
17
26
|
function isSrcImageResponse(src) {
|
|
18
27
|
return !isSrcString(src) && "uuid" in src;
|
|
19
28
|
}
|
|
20
|
-
exports.isSrcImageResponse = isSrcImageResponse;
|
|
21
29
|
function isSrcStaticImageData(src) {
|
|
22
30
|
return !isSrcString(src) && "src" in src;
|
|
23
31
|
}
|
|
24
|
-
exports.isSrcStaticImageData = isSrcStaticImageData;
|
|
25
32
|
function parseImgExtension(src) {
|
|
26
33
|
const ext = src.slice(src.lastIndexOf(".") + 1);
|
|
27
34
|
return ext.length > 1 ? ext : undefined;
|
|
28
35
|
}
|
|
29
|
-
exports.parseImgExtension = parseImgExtension;
|
|
30
36
|
function isSvgExtension(src) {
|
|
31
37
|
return parseImgExtension(src) === "svg";
|
|
32
38
|
}
|
|
@@ -42,14 +48,12 @@ function getSvgImgUrl(src) {
|
|
|
42
48
|
}
|
|
43
49
|
return undefined;
|
|
44
50
|
}
|
|
45
|
-
exports.getSvgImgUrl = getSvgImgUrl;
|
|
46
51
|
function getImgQuality(quality, format) {
|
|
47
52
|
if (typeof quality === "number") {
|
|
48
53
|
return quality;
|
|
49
54
|
}
|
|
50
55
|
return quality ? quality[format] : undefined;
|
|
51
56
|
}
|
|
52
|
-
exports.getImgQuality = getImgQuality;
|
|
53
57
|
function getImgUniqueIdentifier(src) {
|
|
54
58
|
return isSrcString(src)
|
|
55
59
|
? src
|
|
@@ -59,7 +63,6 @@ function getImgUniqueIdentifier(src) {
|
|
|
59
63
|
? src.src
|
|
60
64
|
: undefined;
|
|
61
65
|
}
|
|
62
|
-
exports.getImgUniqueIdentifier = getImgUniqueIdentifier;
|
|
63
66
|
function getImgElementHeight(src, width, height) {
|
|
64
67
|
var _a, _b;
|
|
65
68
|
if (isSrcString(src) || (0, is_not_nil_1.isNotNil)(height)) {
|
|
@@ -68,7 +71,6 @@ function getImgElementHeight(src, width, height) {
|
|
|
68
71
|
const calculatedHeight = Math.floor((((_a = src.height) !== null && _a !== void 0 ? _a : 0) / ((_b = src.width) !== null && _b !== void 0 ? _b : 0)) * (width !== null && width !== void 0 ? width : 0));
|
|
69
72
|
return calculatedHeight === 0 ? undefined : calculatedHeight;
|
|
70
73
|
}
|
|
71
|
-
exports.getImgElementHeight = getImgElementHeight;
|
|
72
74
|
function getImgElementWidth(src, width, height) {
|
|
73
75
|
var _a, _b;
|
|
74
76
|
if (isSrcString(src) || (0, is_not_nil_1.isNotNil)(width)) {
|
|
@@ -77,7 +79,6 @@ function getImgElementWidth(src, width, height) {
|
|
|
77
79
|
const calculatedWidth = Math.floor(((_a = src.width) !== null && _a !== void 0 ? _a : 0) / ((_b = src.height) !== null && _b !== void 0 ? _b : 0)) * (height !== null && height !== void 0 ? height : 0);
|
|
78
80
|
return calculatedWidth === 0 ? undefined : calculatedWidth;
|
|
79
81
|
}
|
|
80
|
-
exports.getImgElementWidth = getImgElementWidth;
|
|
81
82
|
function isDimensionNumber(value) {
|
|
82
83
|
return typeof value === "number";
|
|
83
84
|
}
|
|
@@ -123,12 +124,11 @@ function getImgSrcSet(src, width, height, options = {}) {
|
|
|
123
124
|
}
|
|
124
125
|
return (0, resizer_1.resizerImageUrl)(src, w, h, { toFormat, ...restOptions });
|
|
125
126
|
}
|
|
126
|
-
exports.getImgSrcSet = getImgSrcSet;
|
|
127
127
|
/**
|
|
128
128
|
* @deprecated Use import from @uxf/ui instead.
|
|
129
129
|
*/
|
|
130
130
|
function ImgSources(props) {
|
|
131
|
-
var _a, _b
|
|
131
|
+
var _a, _b;
|
|
132
132
|
if (isSrcString(props.src) && (0, is_empty_1.isEmpty)(props.src)) {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
@@ -144,19 +144,18 @@ function ImgSources(props) {
|
|
|
144
144
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
145
145
|
react_1.default.createElement(hide_1.Hide, { when: Boolean((_a = props.options) === null || _a === void 0 ? void 0 : _a.isAvifDisabled) },
|
|
146
146
|
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
|
|
147
|
-
...
|
|
147
|
+
...props.options,
|
|
148
148
|
quality: getImgQuality(props.quality, "avif"),
|
|
149
149
|
toFormat: "avif",
|
|
150
150
|
}), type: "image/avif" })),
|
|
151
|
-
react_1.default.createElement(hide_1.Hide, { when: Boolean((
|
|
151
|
+
react_1.default.createElement(hide_1.Hide, { when: Boolean((_b = props.options) === null || _b === void 0 ? void 0 : _b.isWebPDisabled) },
|
|
152
152
|
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
|
|
153
|
-
...
|
|
153
|
+
...props.options,
|
|
154
154
|
quality: getImgQuality(props.quality, "webp"),
|
|
155
155
|
toFormat: "webp",
|
|
156
156
|
}), type: "image/webp" })),
|
|
157
157
|
react_1.default.createElement("source", { media: media, srcSet: getImgSrcSet(props.src, props.width, props.height, {
|
|
158
|
-
...
|
|
158
|
+
...props.options,
|
|
159
159
|
quality: getImgQuality(props.quality, "original"),
|
|
160
160
|
}) })));
|
|
161
161
|
}
|
|
162
|
-
exports.ImgSources = ImgSources;
|
package/utils/is-empty.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isEmpty =
|
|
3
|
+
exports.isEmpty = isEmpty;
|
|
4
4
|
function isEmpty(value) {
|
|
5
5
|
if (Array.isArray(value)) {
|
|
6
6
|
return value.length === 0;
|
|
7
7
|
}
|
|
8
8
|
return value === "";
|
|
9
9
|
}
|
|
10
|
-
exports.isEmpty = isEmpty;
|
package/utils/is-nil.js
CHANGED
package/utils/is-not-empty.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNotEmpty =
|
|
3
|
+
exports.isNotEmpty = isNotEmpty;
|
|
4
4
|
const is_empty_1 = require("./is-empty");
|
|
5
5
|
function isNotEmpty(value) {
|
|
6
6
|
return !(0, is_empty_1.isEmpty)(value);
|
|
7
7
|
}
|
|
8
|
-
exports.isNotEmpty = isNotEmpty;
|
package/utils/is-not-nil.js
CHANGED
package/utils/isBrowser.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isBrowser = void 0;
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
5
|
-
exports.isBrowser =
|
|
5
|
+
exports.isBrowser = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
|
package/utils/last.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.last =
|
|
3
|
+
exports.last = last;
|
|
4
4
|
function last(value) {
|
|
5
5
|
if (value.length === 0) {
|
|
6
6
|
return undefined;
|
|
7
7
|
}
|
|
8
8
|
return value[value.length - 1];
|
|
9
9
|
}
|
|
10
|
-
exports.last = last;
|
package/utils/noop.d.ts
ADDED
package/utils/noop.js
ADDED
package/utils/pagination.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.paginationGenerate = void 0;
|
|
4
|
+
const empty_array_1 = require("../constants/empty-array");
|
|
5
|
+
const is_not_nil_1 = require("./is-not-nil");
|
|
4
6
|
const FIRST = ["first"];
|
|
5
7
|
const LAST = ["last"];
|
|
6
8
|
const PREVIOUS = ["previous"];
|
|
@@ -24,18 +26,19 @@ const paginationGenerate = (config) => {
|
|
|
24
26
|
count - boundaryCount - siblingCount * 2 - 1),
|
|
25
27
|
// Greater than startPages
|
|
26
28
|
boundaryCount + 2);
|
|
29
|
+
const firstEndPage = endPages.at(0);
|
|
27
30
|
const siblingsEnd = Math.min(Math.max(
|
|
28
31
|
// Natural end
|
|
29
32
|
page + siblingCount,
|
|
30
33
|
// Upper boundary when page is low
|
|
31
34
|
boundaryCount + siblingCount * 2 + 2),
|
|
32
35
|
// Less than endPages
|
|
33
|
-
|
|
36
|
+
(0, is_not_nil_1.isNotNil)(firstEndPage) ? firstEndPage - 2 : count - 1);
|
|
34
37
|
// Basic list of items to render
|
|
35
38
|
// e.g. itemList = ['first', 'previous', 1, 'ellipsis', 4, 5, 6, 'ellipsis', 10, 'next', 'last']
|
|
36
39
|
return [
|
|
37
|
-
...(showFirstButton ? FIRST :
|
|
38
|
-
...(hidePrevButton ?
|
|
40
|
+
...(showFirstButton ? FIRST : empty_array_1.EMPTY_ARRAY),
|
|
41
|
+
...(hidePrevButton ? empty_array_1.EMPTY_ARRAY : PREVIOUS),
|
|
39
42
|
...startPages,
|
|
40
43
|
// Start ellipsis
|
|
41
44
|
// eslint-disable-next-line no-nested-ternary
|
|
@@ -43,7 +46,7 @@ const paginationGenerate = (config) => {
|
|
|
43
46
|
? START_ELLIPSIS
|
|
44
47
|
: boundaryCount + 1 < count - boundaryCount
|
|
45
48
|
? [boundaryCount + 1]
|
|
46
|
-
:
|
|
49
|
+
: empty_array_1.EMPTY_ARRAY),
|
|
47
50
|
// Sibling pages
|
|
48
51
|
...range(siblingsStart, siblingsEnd),
|
|
49
52
|
// End ellipsis
|
|
@@ -52,10 +55,10 @@ const paginationGenerate = (config) => {
|
|
|
52
55
|
? END_ELLIPSIS
|
|
53
56
|
: count - boundaryCount > boundaryCount
|
|
54
57
|
? [count - boundaryCount]
|
|
55
|
-
:
|
|
58
|
+
: empty_array_1.EMPTY_ARRAY),
|
|
56
59
|
...endPages,
|
|
57
|
-
...(hideNextButton ?
|
|
58
|
-
...(showLastButton ? LAST :
|
|
60
|
+
...(hideNextButton ? empty_array_1.EMPTY_ARRAY : NEXT),
|
|
61
|
+
...(showLastButton ? LAST : empty_array_1.EMPTY_ARRAY),
|
|
59
62
|
];
|
|
60
63
|
};
|
|
61
64
|
exports.paginationGenerate = paginationGenerate;
|
package/utils/resizer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resizerImageUrl = void 0;
|
|
4
|
+
exports.resizerGetDefaultConfig = resizerGetDefaultConfig;
|
|
4
5
|
const fitMapper = {
|
|
5
6
|
cover: "cv",
|
|
6
7
|
fill: "f",
|
|
@@ -81,4 +82,3 @@ function resizerGetDefaultConfig(generatedFilesUrl, staticFilesUrl) {
|
|
|
81
82
|
},
|
|
82
83
|
];
|
|
83
84
|
}
|
|
84
|
-
exports.resizerGetDefaultConfig = resizerGetDefaultConfig;
|
package/utils/slugify.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slugify =
|
|
3
|
+
exports.slugify = slugify;
|
|
4
4
|
function slugify(content) {
|
|
5
5
|
const a = "àáäâãåăæąçćčđďèéěėëêęǵḧìíïîįłḿǹńňñòóöôœøṕŕřßśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;";
|
|
6
6
|
const b = "aaaaaaaaacccddeeeeeeeghiiiiilmnnnnooooooprrssssttuuuuuuuuuwxyyzzz------";
|
|
@@ -16,4 +16,3 @@ function slugify(content) {
|
|
|
16
16
|
.replace(/^-+/, "") // Trim - from start of text
|
|
17
17
|
.replace(/-+$/, ""); // Trim - from end of text
|
|
18
18
|
}
|
|
19
|
-
exports.slugify = slugify;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortObjectKeys =
|
|
3
|
+
exports.sortObjectKeys = sortObjectKeys;
|
|
4
4
|
function sortObjectKeys(object) {
|
|
5
5
|
const sortedObject = {};
|
|
6
6
|
const keys = Object.keys(object);
|
|
@@ -15,4 +15,3 @@ function sortObjectKeys(object) {
|
|
|
15
15
|
});
|
|
16
16
|
return sortedObject;
|
|
17
17
|
}
|
|
18
|
-
exports.sortObjectKeys = sortObjectKeys;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function throwError(message?: string): never;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.trimTrailingZeros =
|
|
3
|
+
exports.trimTrailingZeros = trimTrailingZeros;
|
|
4
4
|
function trimTrailingZeros(value) {
|
|
5
5
|
return value.replace(/\.?0+$/, "");
|
|
6
6
|
}
|
|
7
|
-
exports.trimTrailingZeros = trimTrailingZeros;
|