highsoft-ui 1.0.60 → 1.0.62
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/dist/components/Footer/index.js +363 -336
- package/dist/components/Header/index.js +1 -1
- package/dist/components/Logo/index.js +1 -1
- package/dist/components/PrefPanel/index.js +1 -1
- package/dist/highsoft-ui.css +1 -1
- package/dist/main.js +1 -1
- package/dist/{utils-CzQFvGG2.js → utils-C7rfowvr.js} +42 -36
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +7 -5
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as r from "react";
|
|
2
2
|
import { useState as C, useEffect as A } from "react";
|
|
3
|
-
var
|
|
3
|
+
var N = (e, t, n, s, a, o, d, h) => {
|
|
4
4
|
let u = document.documentElement, v = ["light", "dark"];
|
|
5
5
|
function f(c) {
|
|
6
6
|
(Array.isArray(e) ? e : [e]).forEach((y) => {
|
|
7
|
-
let E = y === "class", L = E &&
|
|
8
|
-
E ? (u.classList.remove(...L), u.classList.add(
|
|
7
|
+
let E = y === "class", L = E && o ? a.map((b) => o[b] || b) : a;
|
|
8
|
+
E ? (u.classList.remove(...L), u.classList.add(o && o[c] ? o[c] : c)) : u.setAttribute(y, c);
|
|
9
9
|
}), k(c);
|
|
10
10
|
}
|
|
11
11
|
function k(c) {
|
|
@@ -20,28 +20,28 @@ var V = (e, t, n, s, o, a, d, h) => {
|
|
|
20
20
|
f(y);
|
|
21
21
|
} catch {
|
|
22
22
|
}
|
|
23
|
-
}, P = ["light", "dark"],
|
|
24
|
-
}, themes: [] },
|
|
23
|
+
}, P = ["light", "dark"], z = "(prefers-color-scheme: dark)", R = typeof window > "u", x = r.createContext(void 0), V = { setTheme: (e) => {
|
|
24
|
+
}, themes: [] }, W = () => {
|
|
25
25
|
var e;
|
|
26
|
-
return (e = r.useContext(x)) != null ? e :
|
|
27
|
-
}, U = (e) => r.useContext(x) ? r.createElement(r.Fragment, null, e.children) : r.createElement(
|
|
28
|
-
let [m, c] = r.useState(() =>
|
|
26
|
+
return (e = r.useContext(x)) != null ? e : V;
|
|
27
|
+
}, U = (e) => r.useContext(x) ? r.createElement(r.Fragment, null, e.children) : r.createElement($, { ...e }), _ = ["light", "dark"], $ = ({ forcedTheme: e, disableTransitionOnChange: t = !1, enableSystem: n = !0, enableColorScheme: s = !0, storageKey: a = "theme", themes: o = _, defaultTheme: d = n ? "system" : "light", attribute: h = "data-theme", value: u, children: v, nonce: f, scriptProps: k }) => {
|
|
28
|
+
let [m, c] = r.useState(() => J(a, d)), [y, E] = r.useState(() => m === "system" ? M() : m), L = u ? Object.values(u) : o, b = r.useCallback((i) => {
|
|
29
29
|
let l = i;
|
|
30
30
|
if (!l) return;
|
|
31
31
|
i === "system" && n && (l = M());
|
|
32
|
-
let g = u ? u[l] : l, I = t ?
|
|
32
|
+
let g = u ? u[l] : l, I = t ? Q(f) : null, w = document.documentElement, O = (p) => {
|
|
33
33
|
p === "class" ? (w.classList.remove(...L), g && w.classList.add(g)) : p.startsWith("data-") && (g ? w.setAttribute(p, g) : w.removeAttribute(p));
|
|
34
34
|
};
|
|
35
35
|
if (Array.isArray(h) ? h.forEach(O) : O(h), s) {
|
|
36
|
-
let p = P.includes(d) ? d : null,
|
|
37
|
-
w.style.colorScheme =
|
|
36
|
+
let p = P.includes(d) ? d : null, K = P.includes(l) ? l : p;
|
|
37
|
+
w.style.colorScheme = K;
|
|
38
38
|
}
|
|
39
39
|
I?.();
|
|
40
40
|
}, [f]), T = r.useCallback((i) => {
|
|
41
41
|
let l = typeof i == "function" ? i(m) : i;
|
|
42
42
|
c(l);
|
|
43
43
|
try {
|
|
44
|
-
localStorage.setItem(
|
|
44
|
+
localStorage.setItem(a, l);
|
|
45
45
|
} catch {
|
|
46
46
|
}
|
|
47
47
|
}, [m]), S = r.useCallback((i) => {
|
|
@@ -49,46 +49,50 @@ var V = (e, t, n, s, o, a, d, h) => {
|
|
|
49
49
|
E(l), m === "system" && n && !e && b("system");
|
|
50
50
|
}, [m, e]);
|
|
51
51
|
r.useEffect(() => {
|
|
52
|
-
let i = window.matchMedia(
|
|
52
|
+
let i = window.matchMedia(z);
|
|
53
53
|
return i.addListener(S), S(i), () => i.removeListener(S);
|
|
54
54
|
}, [S]), r.useEffect(() => {
|
|
55
55
|
let i = (l) => {
|
|
56
|
-
l.key ===
|
|
56
|
+
l.key === a && (l.newValue ? c(l.newValue) : T(d));
|
|
57
57
|
};
|
|
58
58
|
return window.addEventListener("storage", i), () => window.removeEventListener("storage", i);
|
|
59
59
|
}, [T]), r.useEffect(() => {
|
|
60
60
|
b(e ?? m);
|
|
61
61
|
}, [e, m]);
|
|
62
|
-
let
|
|
63
|
-
return r.createElement(x.Provider, { value:
|
|
64
|
-
},
|
|
65
|
-
let f = JSON.stringify([n, t,
|
|
66
|
-
return r.createElement("script", { ...v, suppressHydrationWarning: !0, nonce: typeof window > "u" ? u : "", dangerouslySetInnerHTML: { __html: `(${
|
|
67
|
-
}),
|
|
68
|
-
if (
|
|
62
|
+
let H = r.useMemo(() => ({ theme: m, setTheme: T, forcedTheme: e, resolvedTheme: m === "system" ? y : m, themes: n ? [...o, "system"] : o, systemTheme: n ? y : void 0 }), [m, T, e, y, n, o]);
|
|
63
|
+
return r.createElement(x.Provider, { value: H }, r.createElement(F, { forcedTheme: e, storageKey: a, attribute: h, enableSystem: n, enableColorScheme: s, defaultTheme: d, value: u, themes: o, nonce: f, scriptProps: k }), v);
|
|
64
|
+
}, F = r.memo(({ forcedTheme: e, storageKey: t, attribute: n, enableSystem: s, enableColorScheme: a, defaultTheme: o, value: d, themes: h, nonce: u, scriptProps: v }) => {
|
|
65
|
+
let f = JSON.stringify([n, t, o, e, h, d, s, a]).slice(1, -1);
|
|
66
|
+
return r.createElement("script", { ...v, suppressHydrationWarning: !0, nonce: typeof window > "u" ? u : "", dangerouslySetInnerHTML: { __html: `(${N.toString()})(${f})` } });
|
|
67
|
+
}), J = (e, t) => {
|
|
68
|
+
if (R) return;
|
|
69
69
|
let n;
|
|
70
70
|
try {
|
|
71
71
|
n = localStorage.getItem(e) || void 0;
|
|
72
72
|
} catch {
|
|
73
73
|
}
|
|
74
74
|
return n || t;
|
|
75
|
-
},
|
|
75
|
+
}, Q = (e) => {
|
|
76
76
|
let t = document.createElement("style");
|
|
77
77
|
return e && t.setAttribute("nonce", e), t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")), document.head.appendChild(t), () => {
|
|
78
78
|
window.getComputedStyle(document.body), setTimeout(() => {
|
|
79
79
|
document.head.removeChild(t);
|
|
80
80
|
}, 1);
|
|
81
81
|
};
|
|
82
|
-
}, M = (e) => (e || (e = window.matchMedia(
|
|
82
|
+
}, M = (e) => (e || (e = window.matchMedia(z)), e.matches ? "dark" : "light");
|
|
83
|
+
const Z = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
83
84
|
function B(e) {
|
|
85
|
+
return !!e.match(Z);
|
|
86
|
+
}
|
|
87
|
+
function G(e) {
|
|
84
88
|
const [t, n] = C(!1);
|
|
85
89
|
return A(() => {
|
|
86
90
|
const s = window.matchMedia(e);
|
|
87
91
|
n(s.matches);
|
|
88
|
-
const
|
|
89
|
-
n(
|
|
92
|
+
const a = (o) => {
|
|
93
|
+
n(o.matches);
|
|
90
94
|
};
|
|
91
|
-
return s.addEventListener("change",
|
|
95
|
+
return s.addEventListener("change", a), () => s.removeEventListener("change", a);
|
|
92
96
|
}, [e]), t;
|
|
93
97
|
}
|
|
94
98
|
function j() {
|
|
@@ -97,7 +101,7 @@ function j() {
|
|
|
97
101
|
t(!0);
|
|
98
102
|
}, []), e;
|
|
99
103
|
}
|
|
100
|
-
function
|
|
104
|
+
function X() {
|
|
101
105
|
const [e, t] = C(!1);
|
|
102
106
|
return [async (s) => {
|
|
103
107
|
if (s)
|
|
@@ -108,25 +112,27 @@ function G() {
|
|
|
108
112
|
}
|
|
109
113
|
}, e];
|
|
110
114
|
}
|
|
111
|
-
function
|
|
112
|
-
const e = j(), { resolvedTheme: t } =
|
|
115
|
+
function Y() {
|
|
116
|
+
const e = j(), { resolvedTheme: t } = W(), [n, s] = C("light");
|
|
113
117
|
return A(() => {
|
|
114
118
|
if (!t) {
|
|
115
119
|
s(document.documentElement.dataset.theme || "light");
|
|
116
|
-
const
|
|
120
|
+
const a = new MutationObserver(() => {
|
|
117
121
|
s(document.documentElement.dataset.theme || "light");
|
|
118
122
|
});
|
|
119
|
-
return
|
|
123
|
+
return a.observe(document.documentElement, {
|
|
120
124
|
attributeFilter: ["data-theme"]
|
|
121
|
-
}), () =>
|
|
125
|
+
}), () => a.disconnect();
|
|
122
126
|
}
|
|
123
127
|
}, [t]), e && t || n;
|
|
124
128
|
}
|
|
125
129
|
export {
|
|
126
130
|
U as J,
|
|
127
|
-
|
|
131
|
+
G as a,
|
|
128
132
|
j as b,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
X as c,
|
|
134
|
+
Z as e,
|
|
135
|
+
Y as u,
|
|
136
|
+
B as v,
|
|
137
|
+
W as z
|
|
132
138
|
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const emailRegex: RegExp;
|
|
2
|
+
export declare function validateEmail(email: string): boolean;
|
|
1
3
|
export declare function useMediaQuery(query: string): boolean;
|
|
2
4
|
export declare function useMounted(): boolean;
|
|
3
5
|
export declare function useClipboard(): readonly [(text?: string) => Promise<void>, boolean];
|
package/dist/utils.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as u, c as i, a as m, b as o, u as r, v as d } from "./utils-C7rfowvr.js";
|
|
2
2
|
import "react";
|
|
3
3
|
export {
|
|
4
|
-
u as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
u as emailRegex,
|
|
5
|
+
i as useClipboard,
|
|
6
|
+
m as useMediaQuery,
|
|
7
|
+
o as useMounted,
|
|
8
|
+
r as useTheme,
|
|
9
|
+
d as validateEmail
|
|
8
10
|
};
|