highsoft-ui 1.0.46 → 1.0.48

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.
@@ -1,85 +0,0 @@
1
- import * as t from "react";
2
- var K = (e, i, a, u, m, l, d, h) => {
3
- let c = document.documentElement, v = ["light", "dark"];
4
- function f(r) {
5
- (Array.isArray(e) ? e : [e]).forEach((y) => {
6
- let S = y === "class", k = S && l ? m.map((b) => l[b] || b) : m;
7
- S ? (c.classList.remove(...k), c.classList.add(l && l[r] ? l[r] : r)) : c.setAttribute(y, r);
8
- }), C(r);
9
- }
10
- function C(r) {
11
- h && v.includes(r) && (c.style.colorScheme = r);
12
- }
13
- function s() {
14
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
15
- }
16
- if (u) f(u);
17
- else try {
18
- let r = localStorage.getItem(i) || a, y = d && r === "system" ? s() : r;
19
- f(y);
20
- } catch {
21
- }
22
- }, I = ["light", "dark"], P = "(prefers-color-scheme: dark)", N = typeof window > "u", A = t.createContext(void 0), V = { setTheme: (e) => {
23
- }, themes: [] }, $ = () => {
24
- var e;
25
- return (e = t.useContext(A)) != null ? e : V;
26
- }, j = (e) => t.useContext(A) ? t.createElement(t.Fragment, null, e.children) : t.createElement(_, { ...e }), W = ["light", "dark"], _ = ({ forcedTheme: e, disableTransitionOnChange: i = !1, enableSystem: a = !0, enableColorScheme: u = !0, storageKey: m = "theme", themes: l = W, defaultTheme: d = a ? "system" : "light", attribute: h = "data-theme", value: c, children: v, nonce: f, scriptProps: C }) => {
27
- let [s, r] = t.useState(() => J(m, d)), [y, S] = t.useState(() => s === "system" ? L() : s), k = c ? Object.values(c) : l, b = t.useCallback((n) => {
28
- let o = n;
29
- if (!o) return;
30
- n === "system" && a && (o = L());
31
- let g = c ? c[o] : o, x = i ? R(f) : null, w = document.documentElement, M = (p) => {
32
- p === "class" ? (w.classList.remove(...k), g && w.classList.add(g)) : p.startsWith("data-") && (g ? w.setAttribute(p, g) : w.removeAttribute(p));
33
- };
34
- if (Array.isArray(h) ? h.forEach(M) : M(h), u) {
35
- let p = I.includes(d) ? d : null, H = I.includes(o) ? o : p;
36
- w.style.colorScheme = H;
37
- }
38
- x == null || x();
39
- }, [f]), E = t.useCallback((n) => {
40
- let o = typeof n == "function" ? n(s) : n;
41
- r(o);
42
- try {
43
- localStorage.setItem(m, o);
44
- } catch {
45
- }
46
- }, [s]), T = t.useCallback((n) => {
47
- let o = L(n);
48
- S(o), s === "system" && a && !e && b("system");
49
- }, [s, e]);
50
- t.useEffect(() => {
51
- let n = window.matchMedia(P);
52
- return n.addListener(T), T(n), () => n.removeListener(T);
53
- }, [T]), t.useEffect(() => {
54
- let n = (o) => {
55
- o.key === m && (o.newValue ? r(o.newValue) : E(d));
56
- };
57
- return window.addEventListener("storage", n), () => window.removeEventListener("storage", n);
58
- }, [E]), t.useEffect(() => {
59
- b(e ?? s);
60
- }, [e, s]);
61
- let O = t.useMemo(() => ({ theme: s, setTheme: E, forcedTheme: e, resolvedTheme: s === "system" ? y : s, themes: a ? [...l, "system"] : l, systemTheme: a ? y : void 0 }), [s, E, e, y, a, l]);
62
- return t.createElement(A.Provider, { value: O }, t.createElement(z, { forcedTheme: e, storageKey: m, attribute: h, enableSystem: a, enableColorScheme: u, defaultTheme: d, value: c, themes: l, nonce: f, scriptProps: C }), v);
63
- }, z = t.memo(({ forcedTheme: e, storageKey: i, attribute: a, enableSystem: u, enableColorScheme: m, defaultTheme: l, value: d, themes: h, nonce: c, scriptProps: v }) => {
64
- let f = JSON.stringify([a, i, l, e, h, d, u, m]).slice(1, -1);
65
- return t.createElement("script", { ...v, suppressHydrationWarning: !0, nonce: typeof window > "u" ? c : "", dangerouslySetInnerHTML: { __html: `(${K.toString()})(${f})` } });
66
- }), J = (e, i) => {
67
- if (N) return;
68
- let a;
69
- try {
70
- a = localStorage.getItem(e) || void 0;
71
- } catch {
72
- }
73
- return a || i;
74
- }, R = (e) => {
75
- let i = document.createElement("style");
76
- return e && i.setAttribute("nonce", e), i.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(i), () => {
77
- window.getComputedStyle(document.body), setTimeout(() => {
78
- document.head.removeChild(i);
79
- }, 1);
80
- };
81
- }, L = (e) => (e || (e = window.matchMedia(P)), e.matches ? "dark" : "light");
82
- export {
83
- j as J,
84
- $ as z
85
- };
@@ -1,89 +0,0 @@
1
- import { jsx as _, jsxs as u } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { c as g } from "./clsx-OuTLNxxd.js";
4
- function r() {
5
- return r = Object.assign ? Object.assign.bind() : function(s) {
6
- for (var n = 1; n < arguments.length; n++) {
7
- var e = arguments[n];
8
- for (var o in e) ({}).hasOwnProperty.call(e, o) && (s[o] = e[o]);
9
- }
10
- return s;
11
- }, r.apply(null, arguments);
12
- }
13
- var m = function(n) {
14
- return /* @__PURE__ */ _("svg", r({
15
- xmlns: "http://www.w3.org/2000/svg",
16
- width: 24,
17
- height: 24,
18
- fill: "none",
19
- viewBox: "0 0 24 24"
20
- }, n, {
21
- children: /* @__PURE__ */ _("path", {
22
- stroke: "currentColor",
23
- strokeLinecap: "round",
24
- strokeLinejoin: "round",
25
- strokeWidth: 2,
26
- d: "M12 2v4m0 12v4M6 12H2m20 0h-4m1.0784 7.0784L16.25 16.25M19.0784 5 16.25 7.8283m-11.3284 11.25L7.75 16.25M4.9216 5 7.75 7.8283"
27
- })
28
- }));
29
- };
30
- const f = "_button_1d72z_270", h = "_content_1d72z_312", b = "_neutral_1d72z_318", w = "_loading_1d72z_336", v = "_white_1d72z_342", x = "_transparent_1d72z_366", L = "_plain_1d72z_390", j = "_brand_1d72z_414", k = "_success_1d72z_438", M = "_attention_1d72z_462", y = "_danger_1d72z_486", B = "_full_1d72z_624", N = "_loader_1d72z_632", O = "_spin_1d72z_1", t = {
31
- button: f,
32
- content: h,
33
- neutral: b,
34
- loading: w,
35
- white: v,
36
- transparent: x,
37
- plain: L,
38
- brand: j,
39
- success: k,
40
- attention: M,
41
- danger: y,
42
- "size-50": "_size-50_1d72z_510",
43
- "size-100": "_size-100_1d72z_529",
44
- "size-200": "_size-200_1d72z_548",
45
- "size-300": "_size-300_1d72z_567",
46
- "size-400": "_size-400_1d72z_586",
47
- "size-500": "_size-500_1d72z_605",
48
- full: B,
49
- loader: N,
50
- spin: O
51
- }, R = p(
52
- ({
53
- children: s,
54
- variant: n = "neutral",
55
- size: e = 200,
56
- fullWidth: o = !1,
57
- loading: a,
58
- as: i = "button",
59
- disabled: d,
60
- className: c,
61
- ...l
62
- }, z) => /* @__PURE__ */ u(
63
- i,
64
- {
65
- className: g(
66
- "hsui-button",
67
- c,
68
- t.button,
69
- t[n],
70
- t[`size-${e}`],
71
- {
72
- [t.full]: o,
73
- [t.loading]: a
74
- }
75
- ),
76
- disabled: d || a,
77
- ref: z,
78
- ...l,
79
- children: [
80
- a && /* @__PURE__ */ _("span", { className: t.loader, children: /* @__PURE__ */ _(m, {}) }),
81
- /* @__PURE__ */ _("span", { className: t.content, children: s })
82
- ]
83
- }
84
- )
85
- );
86
- export {
87
- R as B,
88
- r as _
89
- };