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.
Files changed (52) hide show
  1. package/dist/components/base/ActionCard/actionCard.module.scss.js +6 -6
  2. package/dist/components/base/Avatar/Avatar.js +24 -23
  3. package/dist/components/base/Button/button.module.scss.js +23 -23
  4. package/dist/components/base/ColorPopper/ColorPopper.d.ts +10 -1
  5. package/dist/components/base/ColorPopper/ColorPopper.d.ts.map +1 -1
  6. package/dist/components/base/ColorPopper/ColorPopper.js +88 -67
  7. package/dist/components/base/ColorPopper/types.d.ts +5 -4
  8. package/dist/components/base/ColorPopper/types.d.ts.map +1 -1
  9. package/dist/components/base/Icon/Icon.js +1 -1
  10. package/dist/components/base/ProgressBar/progressbar.module.scss.js +1 -1
  11. package/dist/components/base/Select/Select.d.ts.map +1 -1
  12. package/dist/components/base/Select/Select.js +56 -47
  13. package/dist/components/base/Select/types.d.ts +9 -4
  14. package/dist/components/base/Select/types.d.ts.map +1 -1
  15. package/dist/components/base/Textfield/textfield.module.scss.js +14 -14
  16. package/dist/components/context/Theme/ThemeContext.d.ts.map +1 -1
  17. package/dist/components/context/Theme/ThemeContext.js +19 -14
  18. package/dist/components/context/Theme/types.d.ts +12 -17
  19. package/dist/components/context/Theme/types.d.ts.map +1 -1
  20. package/dist/components/context/Theme/types.js +4 -8
  21. package/dist/components/layout/Navigation/navigation.module.scss.js +9 -9
  22. package/dist/components/layout/Sider/sider.module.scss.js +6 -6
  23. package/dist/components/layout/ThemePicker/ThemePicker.d.ts.map +1 -1
  24. package/dist/components/layout/ThemePicker/ThemePicker.js +37 -38
  25. package/dist/components/layout/ThemePicker/themePicker.module.scss.js +28 -28
  26. package/dist/components/layout/ThemeSelect/ThemeSelect.d.ts +3 -0
  27. package/dist/components/layout/ThemeSelect/ThemeSelect.d.ts.map +1 -0
  28. package/dist/components/layout/ThemeSelect/types.d.ts +10 -0
  29. package/dist/components/layout/ThemeSelect/types.d.ts.map +1 -0
  30. package/dist/components/layout/ThemeSwitch/ThemeSwitch.d.ts.map +1 -1
  31. package/dist/components/layout/ThemeSwitch/ThemeSwitch.js +40 -40
  32. package/dist/index.js +97 -95
  33. package/dist/utils/constants/theme.d.ts +19 -0
  34. package/dist/utils/constants/theme.d.ts.map +1 -0
  35. package/dist/utils/constants/theme.js +29 -0
  36. package/dist/utils/function/common.d.ts +2 -0
  37. package/dist/utils/function/common.d.ts.map +1 -0
  38. package/dist/utils/function/common.js +4 -0
  39. package/dist/utils/helper/colorHelper.d.ts +5 -0
  40. package/dist/utils/helper/colorHelper.d.ts.map +1 -0
  41. package/dist/utils/helper/colorHelper.js +24 -0
  42. package/dist/utils/helper/themeController.d.ts +2 -1
  43. package/dist/utils/helper/themeController.d.ts.map +1 -1
  44. package/dist/utils/helper/themeController.js +32 -13
  45. package/dist/utils/index.d.ts +1 -1
  46. package/dist/utils/index.d.ts.map +1 -1
  47. package/dist/xtreme-ui.css +1 -1
  48. package/package.json +4 -1
  49. package/dist/components/base/ColorPopper/colorPopper.module.scss.js +0 -11
  50. package/dist/utils/constants/commons.d.ts +0 -18
  51. package/dist/utils/constants/commons.d.ts.map +0 -1
  52. package/dist/utils/constants/commons.js +0 -15
@@ -1,22 +1,27 @@
1
1
  "use client";
2
- import { jsx as i } from "react/jsx-runtime";
3
- import { createContext as S, useState as n, useEffect as s } from "react";
4
- import { STORAGE as e } from "../../../utils/constants/commons.js";
5
- const h = {
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
- }, d = S(h), A = ({ children: u }) => {
11
- const [t, l] = n(h.themeScheme), [o, c] = n(h.themeColor);
12
- return s(() => {
13
- let m = localStorage.getItem(e.themeScheme), r = localStorage.getItem(e.themeColor);
14
- m || (m = (document == null ? void 0 : document.documentElement.getAttribute(e.themeSchemeAttr)) ?? void 0), r || (r = (document == null ? void 0 : document.documentElement.getAttribute(e.themeColorAttr)) ?? void 0), m && l(m), r && c(r);
15
- }, []), s(() => {
16
- !t || !o || (document.documentElement.setAttribute(e.themeSchemeAttr, t), document.documentElement.setAttribute(e.themeColorAttr, o), localStorage.setItem(e.themeScheme, t), localStorage.setItem(e.themeColor, o));
17
- }, [t, o]), /* @__PURE__ */ i(d.Provider, { value: { themeScheme: t, setThemeScheme: l, themeColor: o, setThemeColor: c }, children: u });
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
- d as ThemeContext,
21
- A as ThemeProvider
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
- system = "system"
14
+ auto = "auto"
15
15
  }
16
- export type TThemeScheme = keyof typeof EThemeScheme | undefined;
17
- export declare const defaultScheme = EThemeScheme.system;
18
- export declare enum EThemeColor {
19
- red = "red",
20
- pink = "pink",
21
- orange = "orange",
22
- green = "green",
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;IAC1B,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5C,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAA;CACvB,CAAA;AAED,oBAAY,YAAY;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;CACjB;AACD,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,YAAY,GAAG,SAAS,CAAC;AACjE,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,oBAAY,WAAW;IACtB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;CACjB;AACD,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,WAAW,GAAG,SAAS,CAAC;AAC/D,eAAO,MAAM,YAAY,qBAAqB,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 r = /* @__PURE__ */ ((t) => (t.light = "light", t.dark = "dark", t.system = "system", t))(r || {});
2
- const a = "system";
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
- n as EThemeColor,
7
- r as EThemeScheme,
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 = "_navigation_1vrjr_1", r = "_brand_1vrjr_10", o = "_routeList_1vrjr_19", n = "_route_1vrjr_19", _ = "_icon_1vrjr_52", a = "_label_1vrjr_59", i = "_loading_1vrjr_79", c = "_active_1vrjr_98", e = {
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: r,
4
- routeList: o,
5
- route: n,
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
- r as brand,
13
+ o as brand,
14
14
  e as default,
15
- _ as icon,
15
+ s as icon,
16
16
  a as label,
17
17
  i as loading,
18
18
  t as navigation,
19
- n as route,
20
- o as routeList
19
+ _ as route,
20
+ n as routeList
21
21
  };
@@ -1,21 +1,21 @@
1
- const e = "_sider_1dq8m_1", i = "_leftSiderContainer_1dq8m_13", t = "_rightSiderContainer_1dq8m_21", n = "_content_1dq8m_29", r = "_miniLeftSider_1dq8m_39", d = "_miniRightSider_1dq8m_46", _ = "_leftOpen_1dq8m_53", o = "_rightOpen_1dq8m_66", s = {
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: d,
7
+ miniRightSider: o,
8
8
  leftOpen: _,
9
- rightOpen: o
9
+ rightOpen: s
10
10
  };
11
11
  export {
12
12
  n as content,
13
- s as default,
13
+ d as default,
14
14
  _ as leftOpen,
15
15
  i as leftSiderContainer,
16
16
  r as miniLeftSider,
17
- d as miniRightSider,
18
- o as rightOpen,
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;AAE/E,eAAO,MAAM,WAAW,8GAuEtB,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 o } from "react/jsx-runtime";
2
+ import { jsxs as m, jsx as r } from "react/jsx-runtime";
3
3
  import { forwardRef as T } from "react";
4
- import c from "clsx";
4
+ import l from "clsx";
5
5
  import { ActionCard as C } from "../../base/ActionCard/ActionCard.js";
6
- import { Button as k } from "../../base/Button/Button.js";
7
- import { Icon as S } from "../../base/Icon/Icon.js";
8
- import { EThemeColor as $ } from "../../context/Theme/types.js";
9
- import { useXTheme as g } from "../../context/useContext.js";
10
- import { THEME_SCHEME as u } from "../../../utils/constants/commons.js";
11
- import { capitalizeFirstLetter as y } from "../../../utils/function/string.js";
12
- import e from "./themePicker.module.scss.js";
13
- import { EThemePickerGap as x, EThemePickerSize as E } from "./types.js";
14
- const P = T((a, l) => {
15
- const { className: h, size: i = "default" } = a, { themeScheme: t, setThemeScheme: n, themeColor: d, setThemeColor: p } = g(), f = c(
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: l,
21
+ ref: a,
23
22
  className: f,
24
23
  role: "region",
25
24
  style: {
26
- "--schemeSize": `${E[i]}px`,
27
- "--schemeGap": `${x[i]}px`
25
+ "--schemeSize": `${y[s]}px`,
26
+ "--schemeGap": `${x[s]}px`
28
27
  },
29
28
  children: [
30
- /* @__PURE__ */ o("div", { className: e.themeSchemes, role: "radiogroup", children: u.map(({ name: r, icon: s }, N) => /* @__PURE__ */ m(
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: c(e.themeSchemeItem, e[r], t === r && e.active),
34
- onClick: () => n(r),
32
+ className: l(o.themeSchemeItem, o[e], t === e && o.active),
33
+ onClick: () => n(e),
35
34
  children: [
36
- /* @__PURE__ */ m("div", { className: e.design, children: [
37
- /* @__PURE__ */ o("div", { className: e.navigation, children: Array.from({ length: 6 }, (I, v) => /* @__PURE__ */ o("div", { className: e.navigationItem }, `ThemeScheme-${r}-navigation-${v}`)) }),
38
- /* @__PURE__ */ m("div", { className: e.content, children: [
39
- /* @__PURE__ */ o("div", { className: e.header }),
40
- /* @__PURE__ */ o("div", { className: e.profile })
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: e.footer, children: [
44
- /* @__PURE__ */ o(S, { className: e.footerIcon, code: t === r ? "f058" : s, type: "solid" }),
45
- /* @__PURE__ */ o("span", { className: e.footerLabel, children: r })
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-${r}-${N}`
48
+ `ThemeScheme-${e}-${N}`
50
49
  )) }),
51
- /* @__PURE__ */ o("div", { className: e.themeColors, role: "radiogroup", children: Object.keys($).map((r, s) => /* @__PURE__ */ o(
52
- k,
50
+ /* @__PURE__ */ r("div", { className: o.themeColors, role: "radiogroup", children: P.map((e, i) => /* @__PURE__ */ r(
51
+ $,
53
52
  {
54
- className: e.themeColorsItem,
55
- size: i,
53
+ className: o.themeColorsItem,
54
+ size: s,
56
55
  icon: "f00c",
57
56
  iconType: "solid",
58
57
  style: {
59
- "--themeColor": `var(--color${y(r)}Accent)`,
60
- color: d === r ? "white" : "transparent"
58
+ "--themeColor": `${e.h} ${e.s}% ${e.l}%`,
59
+ color: S(e, d) ? "white" : "transparent"
61
60
  },
62
- onClick: () => p(r)
61
+ onClick: () => p(e)
63
62
  },
64
- `ThemeColor-${r}-${s}`
63
+ `ThemeColor-${e.h}${e.s}${e.l}-${i}`
65
64
  )) })
66
65
  ]
67
66
  }
68
67
  );
69
68
  });
70
- P.displayName = "ThemePicker";
69
+ I.displayName = "ThemePicker";
71
70
  export {
72
- P as ThemePicker
71
+ I as ThemePicker
73
72
  };
@@ -1,39 +1,39 @@
1
- const e = "_themePicker_71mms_1", t = "_themeSchemes_71mms_11", m = "_themeSchemeItem_71mms_18", o = "_system_71mms_30", s = "_light_71mms_51", _ = "_dark_71mms_60", n = "_design_71mms_69", c = "_navigation_71mms_77", i = "_navigationItem_71mms_89", a = "_content_71mms_102", r = "_header_71mms_112", h = "_profile_71mms_141", l = "_footer_71mms_164", f = "_footerIcon_71mms_175", g = "_footerLabel_71mms_180", d = "_active_71mms_191", v = "_themeColors_71mms_203", I = {
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: m,
5
- system: o,
6
- light: s,
7
- dark: _,
8
- design: n,
4
+ themeSchemeItem: i,
5
+ auto: o,
6
+ light: _,
7
+ dark: n,
8
+ design: r,
9
9
  navigation: c,
10
- navigationItem: i,
10
+ navigationItem: s,
11
11
  content: a,
12
- header: r,
13
- profile: h,
14
- footer: l,
15
- footerIcon: f,
16
- footerLabel: g,
17
- active: d,
18
- themeColors: v
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
- d as active,
21
+ g as active,
22
+ o as auto,
22
23
  a as content,
23
- _ as dark,
24
- I as default,
25
- n as design,
26
- l as footer,
27
- f as footerIcon,
28
- g as footerLabel,
29
- r as header,
30
- s as light,
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
- i as navigationItem,
33
- h as profile,
34
- o as system,
35
- v as themeColors,
33
+ s as navigationItem,
34
+ m as profile,
35
+ d as themeColors,
36
36
  e as themePicker,
37
- m as themeSchemeItem,
37
+ i as themeSchemeItem,
38
38
  t as themeSchemes
39
39
  };
@@ -0,0 +1,3 @@
1
+ import { TThemeSwitchProps } from './types';
2
+ export declare const ThemeSelect: import('react').ForwardRefExoticComponent<TThemeSwitchProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ //# sourceMappingURL=ThemeSelect.d.ts.map
@@ -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;AAQ5C,eAAO,MAAM,WAAW,8GAiEtB,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 N, jsx as a } from "react/jsx-runtime";
3
- import { forwardRef as O, useMemo as c } from "react";
4
- import M from "clsx";
5
- import { Button as u } from "../../base/Button/Button.js";
6
- import { Select as j } from "../../base/Select/Select.js";
7
- import { EThemeColor as T } from "../../context/Theme/types.js";
8
- import { useXTheme as I } from "../../context/useContext.js";
9
- import { useScreenType as g } from "../../hooks/useScreen.js";
10
- import { THEME_SCHEME as m } from "../../../utils/constants/commons.js";
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 k = Object.values(T).map((t) => ({
13
- value: t,
14
- label: t.charAt(0).toUpperCase() + t.slice(1)
15
- })), i = Object.values(T), H = O((t, d) => {
16
- const { className: C, type: x = "secondary", size: n = "default", iconType: s = "solid" } = t, { themeScheme: e, setThemeScheme: b, themeColor: r, setThemeColor: h } = I(), { isMobile: S, isDesktop: y } = g(), l = !S, p = c(() => m[(m.findIndex((o) => o.name === e) + 1) % m.length], [e]), v = c(() => {
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((w) => w.name === e)) == null ? void 0 : o.icon) ?? "";
19
- }, [e]), f = c(() => i[(i.findIndex((o) => o === r) + 1) % i.length], [r]), E = M(
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 || !r ? null : /* @__PURE__ */ N("div", { ref: d, className: E, children: [
25
- /* @__PURE__ */ a(
26
- u,
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: n,
31
- icon: v,
32
- iconType: s,
33
- label: l ? e === "system" ? "auto" : e : void 0,
34
- onClick: () => p.name && b(p.name)
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
- y ? /* @__PURE__ */ a(
38
- j,
37
+ b ? /* @__PURE__ */ c(
38
+ M,
39
39
  {
40
40
  clearable: !1,
41
41
  searchable: !1,
42
- size: n,
43
- options: k,
42
+ size: s,
44
43
  icon: "f53f",
45
- iconType: s,
44
+ iconType: i,
46
45
  placeholder: "Theme",
47
- value: r,
48
- onChange: h
46
+ options: H,
47
+ value: t,
48
+ onChange: p
49
49
  }
50
- ) : /* @__PURE__ */ a(
51
- u,
50
+ ) : /* @__PURE__ */ c(
51
+ d,
52
52
  {
53
53
  className: "xtrThemeColor",
54
54
  type: "primary",
55
- size: n,
55
+ size: s,
56
56
  icon: "f53f",
57
- iconType: s,
58
- label: l ? r : void 0,
59
- onClick: () => f && h(f)
57
+ iconType: i,
58
+ label: l ? void 0 : k(t),
59
+ onClick: () => T && p(T)
60
60
  }
61
61
  )
62
62
  ] });
63
63
  });
64
- H.displayName = "ThemeSwitch";
64
+ L.displayName = "ThemeSwitch";
65
65
  export {
66
- H as ThemeSwitch
66
+ L as ThemeSwitch
67
67
  };