@geotab/zenith 1.21.2-beta.0 → 1.21.2-beta.1
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 -0
- package/dist/commonHelpers/hooks/useClientReady.d.ts +1 -0
- package/dist/commonHelpers/hooks/useClientReady.js +15 -0
- package/dist/commonHelpers/hooks/usePortal.d.ts +2 -0
- package/dist/commonHelpers/hooks/usePortal.js +18 -0
- package/dist/commonHelpers/isDomEnv.d.ts +1 -0
- package/dist/commonHelpers/isDomEnv.js +11 -0
- package/dist/index.css +63 -13
- package/dist/waiting/waiting.d.ts +1 -0
- package/dist/waiting/waiting.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClientReady: () => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useClientReady = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const isDomEnv_1 = require("../isDomEnv");
|
|
6
|
+
const useClientReady = () => {
|
|
7
|
+
const [isClientReady, setIsClientReady] = (0, react_1.useState)(false);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
if ((0, isDomEnv_1.isDomEnv)()) {
|
|
10
|
+
setIsClientReady(true);
|
|
11
|
+
}
|
|
12
|
+
}, []);
|
|
13
|
+
return isClientReady;
|
|
14
|
+
};
|
|
15
|
+
exports.useClientReady = useClientReady;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePortal = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_dom_1 = require("react-dom");
|
|
6
|
+
const usePortal = (children, container, key) => {
|
|
7
|
+
const [portalContainer, setPortalContainer] = (0, react_1.useState)(container);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
if (portalContainer || !container) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
setPortalContainer(container);
|
|
13
|
+
}, [portalContainer, container]);
|
|
14
|
+
// TODO: memoization?
|
|
15
|
+
// TODO: client ready check?
|
|
16
|
+
return portalContainer ? (0, react_dom_1.createPortal)(children, portalContainer, key) : null;
|
|
17
|
+
};
|
|
18
|
+
exports.usePortal = usePortal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isDomEnv: () => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDomEnv = void 0;
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
const isDomEnv = () => {
|
|
6
|
+
var _a;
|
|
7
|
+
return !!(typeof window !== "undefined" &&
|
|
8
|
+
typeof (window === null || window === void 0 ? void 0 : window.document) !== "undefined" &&
|
|
9
|
+
typeof ((_a = window === null || window === void 0 ? void 0 : window.document) === null || _a === void 0 ? void 0 : _a.createElement) !== "undefined");
|
|
10
|
+
};
|
|
11
|
+
exports.isDomEnv = isDomEnv;
|
package/dist/index.css
CHANGED
|
@@ -2369,6 +2369,36 @@
|
|
|
2369
2369
|
width: 40px;
|
|
2370
2370
|
height: 24px;
|
|
2371
2371
|
}
|
|
2372
|
+
.zen-waiting__spinner-text {
|
|
2373
|
+
font-family: var(--main-font);
|
|
2374
|
+
font-size: 20px;
|
|
2375
|
+
font-style: normal;
|
|
2376
|
+
font-weight: 400;
|
|
2377
|
+
letter-spacing: 0;
|
|
2378
|
+
line-height: 24px;
|
|
2379
|
+
text-transform: none;
|
|
2380
|
+
color: var(--text-secondary);
|
|
2381
|
+
max-width: 144px;
|
|
2382
|
+
text-align: center;
|
|
2383
|
+
}
|
|
2384
|
+
.zen-waiting__spinner-text--drive {
|
|
2385
|
+
font-family: var(--main-font);
|
|
2386
|
+
font-size: 22px;
|
|
2387
|
+
font-style: normal;
|
|
2388
|
+
font-weight: 400;
|
|
2389
|
+
letter-spacing: 0;
|
|
2390
|
+
line-height: 28px;
|
|
2391
|
+
text-transform: none;
|
|
2392
|
+
}
|
|
2393
|
+
.zen-waiting__spinner-text--drive-tablet {
|
|
2394
|
+
font-family: var(--main-font);
|
|
2395
|
+
font-size: 24px;
|
|
2396
|
+
font-style: normal;
|
|
2397
|
+
font-weight: 400;
|
|
2398
|
+
letter-spacing: 0;
|
|
2399
|
+
line-height: 30px;
|
|
2400
|
+
text-transform: none;
|
|
2401
|
+
}
|
|
2372
2402
|
.zen-waiting__overlay {
|
|
2373
2403
|
position: absolute;
|
|
2374
2404
|
top: 0;
|
|
@@ -2383,23 +2413,43 @@
|
|
|
2383
2413
|
.zen-waiting__overlay--hidden {
|
|
2384
2414
|
background-color: transparent;
|
|
2385
2415
|
}
|
|
2386
|
-
.zen-waiting__spinner
|
|
2387
|
-
|
|
2388
|
-
margin-right: auto;
|
|
2389
|
-
display: block;
|
|
2416
|
+
.zen-waiting__spinner-container {
|
|
2417
|
+
display: flex;
|
|
2390
2418
|
min-height: 20px;
|
|
2391
2419
|
height: 100%;
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2420
|
+
width: 100%;
|
|
2421
|
+
justify-content: center;
|
|
2422
|
+
align-items: center;
|
|
2423
|
+
flex-direction: column;
|
|
2424
|
+
gap: 8px;
|
|
2396
2425
|
}
|
|
2397
|
-
.zen-waiting__spinner
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2426
|
+
.zen-waiting__spinner {
|
|
2427
|
+
display: flex;
|
|
2428
|
+
max-width: 64px;
|
|
2429
|
+
max-height: 64px;
|
|
2430
|
+
min-width: 40px;
|
|
2431
|
+
min-height: 40px;
|
|
2432
|
+
position: relative;
|
|
2401
2433
|
width: 100%;
|
|
2402
|
-
|
|
2434
|
+
height: 100%;
|
|
2435
|
+
}
|
|
2436
|
+
.zen-waiting__spinner--drive-tablet {
|
|
2437
|
+
max-width: 40px;
|
|
2438
|
+
max-height: 40px;
|
|
2439
|
+
}
|
|
2440
|
+
.zen-waiting__spinner--drive {
|
|
2441
|
+
max-width: 40px;
|
|
2442
|
+
max-height: 40px;
|
|
2443
|
+
}
|
|
2444
|
+
@media (max-width: 640px) {
|
|
2445
|
+
.zen-waiting__spinner {
|
|
2446
|
+
max-width: 40px;
|
|
2447
|
+
max-height: 40px;
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
.zen-waiting__spinner-animation {
|
|
2451
|
+
transform-origin: 32px 32px;
|
|
2452
|
+
animation: waiting 1.5s linear infinite;
|
|
2403
2453
|
}
|
|
2404
2454
|
.zen-checkbox[data-checked="true"] > .zen-checkbox__label > .zen-checkbox__box,
|
|
2405
2455
|
.zen-checkbox[data-indeterminate="true"] > .zen-checkbox__label > .zen-checkbox__box {
|
package/dist/waiting/waiting.js
CHANGED
|
@@ -4,9 +4,10 @@ exports.Waiting = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
7
|
-
const
|
|
8
|
-
const Waiting = ({ isLoading = false, delay = 400, hideOverlay = false, className = "" }) => {
|
|
7
|
+
const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
8
|
+
const Waiting = ({ isLoading = false, delay = 400, hideOverlay = false, className = "", description }) => {
|
|
9
9
|
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
10
|
+
const spinnerDriveClassName = (0, useDriveClassName_1.useDriveClassName)("zen-waiting__spinner");
|
|
10
11
|
(0, react_1.useEffect)(() => {
|
|
11
12
|
let timer;
|
|
12
13
|
if (isLoading) {
|
|
@@ -18,7 +19,7 @@ const Waiting = ({ isLoading = false, delay = 400, hideOverlay = false, classNam
|
|
|
18
19
|
return () => { timer && window.clearTimeout(timer); };
|
|
19
20
|
}, [isLoading, setVisible, delay]);
|
|
20
21
|
return visible ?
|
|
21
|
-
(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-waiting", className]), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-waiting__overlay", hideOverlay ? "zen-waiting__overlay--hidden" : ""]) }), (0, jsx_runtime_1.jsx)(
|
|
22
|
+
(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-waiting", className]), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-waiting__overlay", hideOverlay ? "zen-waiting__overlay--hidden" : ""]) }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-waiting__spinner-container", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-waiting__spinner", spinnerDriveClassName || ""]), children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: "spinnerGradient", x1: "0", y1: "0", x2: "1", y2: "0", gradientUnits: "objectBoundingBox", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", stopColor: "var(--borders-form-field--active)", stopOpacity: "1" }), (0, jsx_runtime_1.jsx)("stop", { offset: "33.33%", stopColor: "var(--borders-form-field--active)", stopOpacity: "0.8" }), (0, jsx_runtime_1.jsx)("stop", { offset: "50%", stopColor: "var(--borders-form-field--active)", stopOpacity: "0.5" }), (0, jsx_runtime_1.jsx)("stop", { offset: "66.67%", stopColor: "var(--borders-form-field--active)", stopOpacity: "0.2" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", stopColor: "var(--borders-form-field--active)", stopOpacity: "0" })] }) }), (0, jsx_runtime_1.jsx)("path", { className: "zen-waiting__spinner-animation", stroke: "url(#spinnerGradient)", strokeWidth: "6", strokeLinecap: "round", d: "M 32 4 A 28 28 0 1 1 32 60 A 28 28 0 1 1 32 4 Z" })] }) }), description && (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-waiting__spinner-text"]), children: description })] })] })
|
|
22
23
|
: null;
|
|
23
24
|
};
|
|
24
25
|
exports.Waiting = Waiting;
|