xtreme-ui 0.0.93 → 0.0.95
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/base/ActionCard/actionCard.module.scss.js +6 -6
- package/dist/components/base/Avatar/Avatar.js +24 -23
- package/dist/components/base/Button/button.module.scss.js +23 -23
- package/dist/components/base/ColorPopper/ColorPopper.d.ts +10 -1
- package/dist/components/base/ColorPopper/ColorPopper.d.ts.map +1 -1
- package/dist/components/base/ColorPopper/ColorPopper.js +88 -67
- package/dist/components/base/ColorPopper/types.d.ts +5 -4
- package/dist/components/base/ColorPopper/types.d.ts.map +1 -1
- package/dist/components/base/Icon/Icon.js +1 -1
- package/dist/components/base/ProgressBar/progressbar.module.scss.js +1 -1
- package/dist/components/base/Select/Select.d.ts.map +1 -1
- package/dist/components/base/Select/Select.js +56 -47
- package/dist/components/base/Select/types.d.ts +9 -4
- package/dist/components/base/Select/types.d.ts.map +1 -1
- package/dist/components/base/Textfield/textfield.module.scss.js +14 -14
- package/dist/components/context/Theme/ThemeContext.d.ts.map +1 -1
- package/dist/components/context/Theme/ThemeContext.js +19 -14
- package/dist/components/context/Theme/types.d.ts +12 -17
- package/dist/components/context/Theme/types.d.ts.map +1 -1
- package/dist/components/context/Theme/types.js +4 -8
- package/dist/components/layout/Navigation/navigation.module.scss.js +9 -9
- package/dist/components/layout/Sider/sider.module.scss.js +6 -6
- package/dist/components/layout/ThemePicker/ThemePicker.d.ts.map +1 -1
- package/dist/components/layout/ThemePicker/ThemePicker.js +37 -38
- package/dist/components/layout/ThemePicker/themePicker.module.scss.js +28 -28
- package/dist/components/layout/ThemeSelect/ThemeSelect.d.ts +3 -0
- package/dist/components/layout/ThemeSelect/ThemeSelect.d.ts.map +1 -0
- package/dist/components/layout/ThemeSelect/types.d.ts +10 -0
- package/dist/components/layout/ThemeSelect/types.d.ts.map +1 -0
- package/dist/components/layout/ThemeSwitch/ThemeSwitch.d.ts.map +1 -1
- package/dist/components/layout/ThemeSwitch/ThemeSwitch.js +40 -40
- package/dist/index.js +97 -95
- package/dist/utils/constants/theme.d.ts +19 -0
- package/dist/utils/constants/theme.d.ts.map +1 -0
- package/dist/utils/constants/theme.js +29 -0
- package/dist/utils/function/common.d.ts +2 -0
- package/dist/utils/function/common.d.ts.map +1 -0
- package/dist/utils/function/common.js +4 -0
- package/dist/utils/helper/colorHelper.d.ts +5 -0
- package/dist/utils/helper/colorHelper.d.ts.map +1 -0
- package/dist/utils/helper/colorHelper.js +24 -0
- package/dist/utils/helper/themeController.d.ts +2 -1
- package/dist/utils/helper/themeController.d.ts.map +1 -1
- package/dist/utils/helper/themeController.js +32 -13
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/xtreme-ui.css +1 -1
- package/package.json +4 -1
- package/dist/components/base/ColorPopper/colorPopper.module.scss.js +0 -11
- package/dist/utils/constants/commons.d.ts +0 -18
- package/dist/utils/constants/commons.d.ts.map +0 -1
- package/dist/utils/constants/commons.js +0 -15
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { STORAGE as
|
|
5
|
-
const
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as i, useState as n, useEffect as h } from "react";
|
|
4
|
+
import { STORAGE as t, defaultColorPreset as u } from "../../../utils/constants/theme.js";
|
|
5
|
+
const c = {
|
|
6
6
|
themeScheme: void 0,
|
|
7
7
|
setThemeScheme: () => null,
|
|
8
8
|
themeColor: void 0,
|
|
9
9
|
setThemeColor: () => null
|
|
10
|
-
},
|
|
11
|
-
const [
|
|
12
|
-
return
|
|
13
|
-
let m = localStorage.getItem(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
}, a = i(c), y = ({ children: S }) => {
|
|
11
|
+
const [o, l] = n(c.themeScheme), [e, s] = n(c.themeColor);
|
|
12
|
+
return h(() => {
|
|
13
|
+
let m = localStorage.getItem(t.themeScheme), r;
|
|
14
|
+
try {
|
|
15
|
+
r = JSON.parse(localStorage.getItem(t.themeColor) || "null") || u;
|
|
16
|
+
} catch {
|
|
17
|
+
r = u;
|
|
18
|
+
}
|
|
19
|
+
m || (m = (document == null ? void 0 : document.documentElement.getAttribute(t.themeSchemeAttr)) ?? void 0), m && l(m), r && s(r);
|
|
20
|
+
}, []), h(() => {
|
|
21
|
+
!o || !e || (document.documentElement.setAttribute(t.themeSchemeAttr, o), document.documentElement.style.setProperty("--H", `${e == null ? void 0 : e.h}`), document.documentElement.style.setProperty("--S", `${e == null ? void 0 : e.s}%`), document.documentElement.style.setProperty("--L", `${e == null ? void 0 : e.l}%`), localStorage.setItem(t.themeScheme, o), localStorage.setItem(t.themeColor, JSON.stringify(e)));
|
|
22
|
+
}, [o, e]), /* @__PURE__ */ d(a.Provider, { value: { themeScheme: o, setThemeScheme: l, themeColor: e, setThemeColor: s }, children: S });
|
|
18
23
|
};
|
|
19
24
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
a as ThemeContext,
|
|
26
|
+
y as ThemeProvider
|
|
22
27
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export type TThemeInitialType = {
|
|
3
|
-
themeScheme: TThemeScheme;
|
|
4
|
-
setThemeScheme: (scheme: TThemeScheme) => void;
|
|
5
|
-
themeColor: TThemeColor;
|
|
6
|
-
setThemeColor: (color: TThemeColor) => void;
|
|
3
|
+
themeScheme: TThemeScheme | undefined;
|
|
4
|
+
setThemeScheme: (scheme: TThemeScheme | undefined) => void;
|
|
5
|
+
themeColor: TThemeColor | undefined;
|
|
6
|
+
setThemeColor: (color: TThemeColor | undefined) => void;
|
|
7
7
|
};
|
|
8
8
|
export type TThemeProviderProps = {
|
|
9
9
|
children?: ReactNode;
|
|
@@ -11,18 +11,13 @@ export type TThemeProviderProps = {
|
|
|
11
11
|
export declare enum EThemeScheme {
|
|
12
12
|
light = "light",
|
|
13
13
|
dark = "dark",
|
|
14
|
-
|
|
14
|
+
auto = "auto"
|
|
15
15
|
}
|
|
16
|
-
export type TThemeScheme = keyof typeof EThemeScheme
|
|
17
|
-
export declare const defaultScheme = EThemeScheme.
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
blue = "blue",
|
|
24
|
-
violet = "violet"
|
|
25
|
-
}
|
|
26
|
-
export type TThemeColor = keyof typeof EThemeColor | undefined;
|
|
27
|
-
export declare const defaultColor = EThemeColor.violet;
|
|
16
|
+
export type TThemeScheme = keyof typeof EThemeScheme;
|
|
17
|
+
export declare const defaultScheme = EThemeScheme.auto;
|
|
18
|
+
export type TThemeColor = {
|
|
19
|
+
h: number;
|
|
20
|
+
s: number;
|
|
21
|
+
l: number;
|
|
22
|
+
};
|
|
28
23
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/context/Theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/context/Theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAC;IAC3D,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;IACpC,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;CACxD,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,oBAAY,YAAY;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;CACb;AACD,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,YAAY,CAAC;AACrD,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
3
|
-
var n = /* @__PURE__ */ ((t) => (t.red = "red", t.pink = "pink", t.orange = "orange", t.green = "green", t.blue = "blue", t.violet = "violet", t))(n || {});
|
|
4
|
-
const s = "violet";
|
|
1
|
+
var a = /* @__PURE__ */ ((t) => (t.light = "light", t.dark = "dark", t.auto = "auto", t))(a || {});
|
|
2
|
+
const r = "auto";
|
|
5
3
|
export {
|
|
6
|
-
|
|
7
|
-
r as
|
|
8
|
-
s as defaultColor,
|
|
9
|
-
a as defaultScheme
|
|
4
|
+
a as EThemeScheme,
|
|
5
|
+
r as defaultScheme
|
|
10
6
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_navigation_10g7s_1", o = "_brand_10g7s_10", n = "_routeList_10g7s_19", _ = "_route_10g7s_19", s = "_icon_10g7s_52", a = "_label_10g7s_59", i = "_loading_10g7s_79", c = "_active_10g7s_98", e = {
|
|
2
2
|
navigation: t,
|
|
3
|
-
brand:
|
|
4
|
-
routeList:
|
|
5
|
-
route:
|
|
6
|
-
icon:
|
|
3
|
+
brand: o,
|
|
4
|
+
routeList: n,
|
|
5
|
+
route: _,
|
|
6
|
+
icon: s,
|
|
7
7
|
label: a,
|
|
8
8
|
loading: i,
|
|
9
9
|
active: c
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
12
|
c as active,
|
|
13
|
-
|
|
13
|
+
o as brand,
|
|
14
14
|
e as default,
|
|
15
|
-
|
|
15
|
+
s as icon,
|
|
16
16
|
a as label,
|
|
17
17
|
i as loading,
|
|
18
18
|
t as navigation,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
_ as route,
|
|
20
|
+
n as routeList
|
|
21
21
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const e = "
|
|
1
|
+
const e = "_sider_11os5_1", i = "_leftSiderContainer_11os5_13", t = "_rightSiderContainer_11os5_21", n = "_content_11os5_29", r = "_miniLeftSider_11os5_39", o = "_miniRightSider_11os5_46", _ = "_leftOpen_11os5_53", s = "_rightOpen_11os5_66", d = {
|
|
2
2
|
sider: e,
|
|
3
3
|
leftSiderContainer: i,
|
|
4
4
|
rightSiderContainer: t,
|
|
5
5
|
content: n,
|
|
6
6
|
miniLeftSider: r,
|
|
7
|
-
miniRightSider:
|
|
7
|
+
miniRightSider: o,
|
|
8
8
|
leftOpen: _,
|
|
9
|
-
rightOpen:
|
|
9
|
+
rightOpen: s
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
12
|
n as content,
|
|
13
|
-
|
|
13
|
+
d as default,
|
|
14
14
|
_ as leftOpen,
|
|
15
15
|
i as leftSiderContainer,
|
|
16
16
|
r as miniLeftSider,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
o as miniRightSider,
|
|
18
|
+
s as rightOpen,
|
|
19
19
|
t as rightSiderContainer,
|
|
20
20
|
e as sider
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAqC,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemePicker/ThemePicker.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAqC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG/E,eAAO,MAAM,WAAW,8GAuEtB,CAAC"}
|
|
@@ -1,73 +1,72 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as m, jsx as
|
|
2
|
+
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as T } from "react";
|
|
4
|
-
import
|
|
4
|
+
import l from "clsx";
|
|
5
5
|
import { ActionCard as C } from "../../base/ActionCard/ActionCard.js";
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { THEME_SCHEME as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
e.themePicker,
|
|
6
|
+
import { Button as $ } from "../../base/Button/Button.js";
|
|
7
|
+
import { Icon as u } from "../../base/Icon/Icon.js";
|
|
8
|
+
import { useXTheme as E } from "../../context/useContext.js";
|
|
9
|
+
import { isEqual as S } from "../../../utils/function/common.js";
|
|
10
|
+
import { THEME_SCHEME as g, ThemeColorsPreset as k } from "../../../utils/constants/theme.js";
|
|
11
|
+
import o from "./themePicker.module.scss.js";
|
|
12
|
+
import { EThemePickerGap as x, EThemePickerSize as y } from "./types.js";
|
|
13
|
+
const P = Object.values(k), I = T((c, a) => {
|
|
14
|
+
const { className: h, size: s = "default" } = c, { themeScheme: t, setThemeScheme: n, themeColor: d, setThemeColor: p } = E(), f = l(
|
|
15
|
+
o.themePicker,
|
|
17
16
|
h
|
|
18
17
|
);
|
|
19
18
|
return /* @__PURE__ */ m(
|
|
20
19
|
"div",
|
|
21
20
|
{
|
|
22
|
-
ref:
|
|
21
|
+
ref: a,
|
|
23
22
|
className: f,
|
|
24
23
|
role: "region",
|
|
25
24
|
style: {
|
|
26
|
-
"--schemeSize": `${
|
|
27
|
-
"--schemeGap": `${x[
|
|
25
|
+
"--schemeSize": `${y[s]}px`,
|
|
26
|
+
"--schemeGap": `${x[s]}px`
|
|
28
27
|
},
|
|
29
28
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ r("div", { className: o.themeSchemes, role: "radiogroup", children: g.map(({ name: e, icon: i }, N) => /* @__PURE__ */ m(
|
|
31
30
|
C,
|
|
32
31
|
{
|
|
33
|
-
className:
|
|
34
|
-
onClick: () => n(
|
|
32
|
+
className: l(o.themeSchemeItem, o[e], t === e && o.active),
|
|
33
|
+
onClick: () => n(e),
|
|
35
34
|
children: [
|
|
36
|
-
/* @__PURE__ */ m("div", { className:
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */ m("div", { className:
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ m("div", { className: o.design, children: [
|
|
36
|
+
/* @__PURE__ */ r("div", { className: o.navigation, children: Array.from({ length: 6 }, (j, v) => /* @__PURE__ */ r("div", { className: o.navigationItem }, `ThemeScheme-${e}-navigation-${v}`)) }),
|
|
37
|
+
/* @__PURE__ */ m("div", { className: o.content, children: [
|
|
38
|
+
/* @__PURE__ */ r("div", { className: o.header }),
|
|
39
|
+
/* @__PURE__ */ r("div", { className: o.profile })
|
|
41
40
|
] })
|
|
42
41
|
] }),
|
|
43
|
-
/* @__PURE__ */ m("div", { className:
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ m("div", { className: o.footer, children: [
|
|
43
|
+
/* @__PURE__ */ r(u, { className: o.footerIcon, code: t === e ? "f058" : i, type: "solid" }),
|
|
44
|
+
/* @__PURE__ */ r("span", { className: o.footerLabel, children: e })
|
|
46
45
|
] })
|
|
47
46
|
]
|
|
48
47
|
},
|
|
49
|
-
`ThemeScheme-${
|
|
48
|
+
`ThemeScheme-${e}-${N}`
|
|
50
49
|
)) }),
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
50
|
+
/* @__PURE__ */ r("div", { className: o.themeColors, role: "radiogroup", children: P.map((e, i) => /* @__PURE__ */ r(
|
|
51
|
+
$,
|
|
53
52
|
{
|
|
54
|
-
className:
|
|
55
|
-
size:
|
|
53
|
+
className: o.themeColorsItem,
|
|
54
|
+
size: s,
|
|
56
55
|
icon: "f00c",
|
|
57
56
|
iconType: "solid",
|
|
58
57
|
style: {
|
|
59
|
-
"--themeColor":
|
|
60
|
-
color: d
|
|
58
|
+
"--themeColor": `${e.h} ${e.s}% ${e.l}%`,
|
|
59
|
+
color: S(e, d) ? "white" : "transparent"
|
|
61
60
|
},
|
|
62
|
-
onClick: () => p(
|
|
61
|
+
onClick: () => p(e)
|
|
63
62
|
},
|
|
64
|
-
`ThemeColor-${
|
|
63
|
+
`ThemeColor-${e.h}${e.s}${e.l}-${i}`
|
|
65
64
|
)) })
|
|
66
65
|
]
|
|
67
66
|
}
|
|
68
67
|
);
|
|
69
68
|
});
|
|
70
|
-
|
|
69
|
+
I.displayName = "ThemePicker";
|
|
71
70
|
export {
|
|
72
|
-
|
|
71
|
+
I as ThemePicker
|
|
73
72
|
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
const e = "
|
|
1
|
+
const e = "_themePicker_iibr7_1", t = "_themeSchemes_iibr7_11", i = "_themeSchemeItem_iibr7_18", o = "_auto_iibr7_30", _ = "_light_iibr7_51", n = "_dark_iibr7_60", r = "_design_iibr7_69", c = "_navigation_iibr7_77", s = "_navigationItem_iibr7_89", a = "_content_iibr7_102", h = "_header_iibr7_112", m = "_profile_iibr7_141", b = "_footer_iibr7_164", l = "_footerIcon_iibr7_175", f = "_footerLabel_iibr7_180", g = "_active_iibr7_191", d = "_themeColors_iibr7_203", v = {
|
|
2
2
|
themePicker: e,
|
|
3
3
|
themeSchemes: t,
|
|
4
|
-
themeSchemeItem:
|
|
5
|
-
|
|
6
|
-
light:
|
|
7
|
-
dark:
|
|
8
|
-
design:
|
|
4
|
+
themeSchemeItem: i,
|
|
5
|
+
auto: o,
|
|
6
|
+
light: _,
|
|
7
|
+
dark: n,
|
|
8
|
+
design: r,
|
|
9
9
|
navigation: c,
|
|
10
|
-
navigationItem:
|
|
10
|
+
navigationItem: s,
|
|
11
11
|
content: a,
|
|
12
|
-
header:
|
|
13
|
-
profile:
|
|
14
|
-
footer:
|
|
15
|
-
footerIcon:
|
|
16
|
-
footerLabel:
|
|
17
|
-
active:
|
|
18
|
-
themeColors:
|
|
12
|
+
header: h,
|
|
13
|
+
profile: m,
|
|
14
|
+
footer: b,
|
|
15
|
+
footerIcon: l,
|
|
16
|
+
footerLabel: f,
|
|
17
|
+
active: g,
|
|
18
|
+
themeColors: d
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
g as active,
|
|
22
|
+
o as auto,
|
|
22
23
|
a as content,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
n as dark,
|
|
25
|
+
v as default,
|
|
26
|
+
r as design,
|
|
27
|
+
b as footer,
|
|
28
|
+
l as footerIcon,
|
|
29
|
+
f as footerLabel,
|
|
30
|
+
h as header,
|
|
31
|
+
_ as light,
|
|
31
32
|
c as navigation,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
v as themeColors,
|
|
33
|
+
s as navigationItem,
|
|
34
|
+
m as profile,
|
|
35
|
+
d as themeColors,
|
|
36
36
|
e as themePicker,
|
|
37
|
-
|
|
37
|
+
i as themeSchemeItem,
|
|
38
38
|
t as themeSchemes
|
|
39
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSelect/ThemeSelect.tsx"],"names":[],"mappings":"AAQA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,WAAW,8GAetB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EIconType } from '../../base/Icon/types';
|
|
2
|
+
import { EButtonSize, EButtonTypes } from '../../base/Button/types';
|
|
3
|
+
export type TThemeSwitchProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
withLabel?: boolean;
|
|
6
|
+
type?: keyof typeof EButtonTypes;
|
|
7
|
+
size?: keyof typeof EButtonSize;
|
|
8
|
+
iconType?: keyof typeof EIconType;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,OAAO,WAAW,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,OAAO,SAAS,CAAC;CAClC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeSwitch.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSwitch/ThemeSwitch.tsx"],"names":[],"mappings":"AAWA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeSwitch.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/ThemeSwitch/ThemeSwitch.tsx"],"names":[],"mappings":"AAWA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS5C,eAAO,MAAM,WAAW,8GA+DtB,CAAC"}
|
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Select as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { THEME_SCHEME as m } from "../../../utils/constants/
|
|
2
|
+
import { jsxs as O, jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as v, useMemo as a } from "react";
|
|
4
|
+
import w from "clsx";
|
|
5
|
+
import { Button as d } from "../../base/Button/Button.js";
|
|
6
|
+
import { Select as M } from "../../base/Select/Select.js";
|
|
7
|
+
import { useXTheme as g } from "../../context/useContext.js";
|
|
8
|
+
import { useScreenType as j } from "../../hooks/useScreen.js";
|
|
9
|
+
import { isValidThemeColor as I, getColorLabel as k } from "../../../utils/helper/colorHelper.js";
|
|
10
|
+
import { ThemeColorsPreset as u, THEME_SCHEME as m } from "../../../utils/constants/theme.js";
|
|
11
11
|
/* empty css */
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})),
|
|
16
|
-
const { className: C, type: x = "secondary", size:
|
|
12
|
+
const H = Object.entries(u).map(([r, n]) => ({
|
|
13
|
+
label: r.charAt(0).toUpperCase() + r.slice(1),
|
|
14
|
+
value: n
|
|
15
|
+
})), h = Object.values(u), L = v((r, n) => {
|
|
16
|
+
const { className: C, type: x = "secondary", size: s = "default", iconType: i = "solid" } = r, { themeScheme: e, setThemeScheme: S, themeColor: t, setThemeColor: p } = g(), { isMobile: l, isDesktop: b } = j(), f = a(() => m[(m.findIndex((o) => o.name === e) + 1) % m.length], [e]), y = a(() => {
|
|
17
17
|
var o;
|
|
18
|
-
return ((o = m.find((
|
|
19
|
-
}, [e]),
|
|
18
|
+
return ((o = m.find((N) => N.name === e)) == null ? void 0 : o.icon) ?? "";
|
|
19
|
+
}, [e]), T = a(() => h[(h.findIndex((o) => o === t) + 1) % h.length], [t]), E = w(
|
|
20
20
|
"xtrThemeSwitch",
|
|
21
21
|
C,
|
|
22
|
-
l && "withLabel"
|
|
22
|
+
!l && "withLabel"
|
|
23
23
|
);
|
|
24
|
-
return !e || !
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
24
|
+
return !e || !I(t) ? null : /* @__PURE__ */ O("div", { ref: n, className: E, children: [
|
|
25
|
+
/* @__PURE__ */ c(
|
|
26
|
+
d,
|
|
27
27
|
{
|
|
28
28
|
className: "xtrThemeScheme",
|
|
29
29
|
type: x,
|
|
30
|
-
size:
|
|
31
|
-
icon:
|
|
32
|
-
iconType:
|
|
33
|
-
label: l ?
|
|
34
|
-
onClick: () =>
|
|
30
|
+
size: s,
|
|
31
|
+
icon: y,
|
|
32
|
+
iconType: i,
|
|
33
|
+
label: l ? void 0 : e,
|
|
34
|
+
onClick: () => f.name && S(f.name)
|
|
35
35
|
}
|
|
36
36
|
),
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
b ? /* @__PURE__ */ c(
|
|
38
|
+
M,
|
|
39
39
|
{
|
|
40
40
|
clearable: !1,
|
|
41
41
|
searchable: !1,
|
|
42
|
-
size:
|
|
43
|
-
options: k,
|
|
42
|
+
size: s,
|
|
44
43
|
icon: "f53f",
|
|
45
|
-
iconType:
|
|
44
|
+
iconType: i,
|
|
46
45
|
placeholder: "Theme",
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
options: H,
|
|
47
|
+
value: t,
|
|
48
|
+
onChange: p
|
|
49
49
|
}
|
|
50
|
-
) : /* @__PURE__ */
|
|
51
|
-
|
|
50
|
+
) : /* @__PURE__ */ c(
|
|
51
|
+
d,
|
|
52
52
|
{
|
|
53
53
|
className: "xtrThemeColor",
|
|
54
54
|
type: "primary",
|
|
55
|
-
size:
|
|
55
|
+
size: s,
|
|
56
56
|
icon: "f53f",
|
|
57
|
-
iconType:
|
|
58
|
-
label: l ?
|
|
59
|
-
onClick: () =>
|
|
57
|
+
iconType: i,
|
|
58
|
+
label: l ? void 0 : k(t),
|
|
59
|
+
onClick: () => T && p(T)
|
|
60
60
|
}
|
|
61
61
|
)
|
|
62
62
|
] });
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
L.displayName = "ThemeSwitch";
|
|
65
65
|
export {
|
|
66
|
-
|
|
66
|
+
L as ThemeSwitch
|
|
67
67
|
};
|