@uxf/core-react 13.0.0 → 14.0.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 +80 -53
- package/clickable/_use-simulated-button.js +9 -5
- package/hooks/use-debounce.js +4 -2
- package/hooks/use-debounce.test.d.ts +1 -0
- package/hooks/use-debounce.test.js +63 -0
- package/hooks/use-focus-return.js +3 -2
- package/hooks/use-focus-trap.js +3 -4
- package/hooks/use-is-hydrated.d.ts +10 -0
- package/hooks/use-is-hydrated.js +18 -0
- package/hooks/use-is-hydrated.test.d.ts +1 -0
- package/hooks/use-is-hydrated.test.js +33 -0
- package/hooks/use-is-mounted.d.ts +5 -0
- package/hooks/use-is-mounted.js +5 -0
- package/hooks/use-isomorphic-layout-effect.d.ts +4 -0
- package/hooks/use-isomorphic-layout-effect.js +4 -0
- package/hooks/use-key.js +12 -11
- package/hooks/use-key.test.d.ts +1 -0
- package/hooks/use-key.test.js +65 -0
- package/hooks/use-latest.d.ts +5 -0
- package/hooks/use-latest.js +5 -0
- package/hooks/use-media-query.d.ts +10 -1
- package/hooks/use-media-query.js +16 -17
- package/hooks/use-media-query.test.d.ts +1 -0
- package/hooks/use-media-query.test.js +55 -0
- package/hooks/use-min-window-width.js +3 -2
- package/hooks/use-on-unmount.d.ts +1 -0
- package/hooks/use-on-unmount.js +4 -7
- package/hooks/use-on-unmount.test.d.ts +1 -0
- package/hooks/use-on-unmount.test.js +16 -0
- package/hooks/use-on-update.d.ts +8 -0
- package/hooks/use-on-update.js +15 -3
- package/hooks/use-on-update.test.d.ts +1 -0
- package/hooks/use-on-update.test.js +75 -0
- package/hooks/use-previous.d.ts +5 -0
- package/hooks/use-previous.js +5 -0
- package/hooks/use-window-scroll.js +3 -5
- package/hooks/use-window-scroll.test.js +3 -1
- package/hooks/use-window-size.js +3 -2
- package/hooks/use-window-size.test.js +3 -1
- package/package.json +9 -3
- package/swipeable/use-swipeable.js +47 -32
- package/swipeable/use-swipeable.test.d.ts +1 -0
- package/swipeable/use-swipeable.test.js +59 -0
- package/translations/replace-variables.js +4 -1
- package/translations/replace-variables.test.d.ts +1 -0
- package/translations/replace-variables.test.js +13 -0
- package/components/viewport-height-polyfill.d.ts +0 -2
- package/components/viewport-height-polyfill.js +0 -58
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.ViewportHeightPolyfill = ViewportHeightPolyfill;
|
|
38
|
-
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
39
|
-
const react_1 = __importStar(require("react"));
|
|
40
|
-
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
41
|
-
const use_on_mount_1 = require("@uxf/core-react/hooks/use-on-mount");
|
|
42
|
-
function ViewportHeightPolyfill() {
|
|
43
|
-
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
44
|
-
const [viewportHeight, setViewportHeight] = (0, react_1.useState)();
|
|
45
|
-
(0, use_on_mount_1.useOnMount)(() => {
|
|
46
|
-
if (!CSS.supports("height: 100dvh")) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const updateViewportHeight = () => setViewportHeight(window.innerHeight);
|
|
50
|
-
updateViewportHeight();
|
|
51
|
-
window.addEventListener("resize", updateViewportHeight);
|
|
52
|
-
return () => window.removeEventListener("resize", updateViewportHeight);
|
|
53
|
-
});
|
|
54
|
-
if (isMounted && (0, is_not_nil_1.isNotNil)(viewportHeight)) {
|
|
55
|
-
return react_1.default.createElement("style", null, `:root { --viewport-height: ${viewportHeight}px; }`);
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|