@crystaltech/hsms-shared-ui 0.5.29 → 0.5.30

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,2 +1,5 @@
1
- declare const ColorSettings: () => import("react/jsx-runtime").JSX.Element;
1
+ import { Theme } from '@mui/material';
2
+ declare const ColorSettings: ({ onColorSubmit, }: {
3
+ onColorSubmit: (theme: Theme) => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
2
5
  export default ColorSettings;
@@ -1,2 +1,6 @@
1
- declare const ThemeSetting: () => import("react/jsx-runtime").JSX.Element;
1
+ import { Theme } from '@mui/material';
2
+ declare const ThemeSetting: ({ onColorSubmit, onTypographySubmit, }: {
3
+ onColorSubmit: (theme: Theme) => void;
4
+ onTypographySubmit: (theme: Theme) => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
2
6
  export default ThemeSetting;
@@ -1,3 +1,5 @@
1
- import { default as React } from 'react';
2
- declare const TypographySettings: React.FC;
1
+ import { Theme } from '@mui/material';
2
+ declare const TypographySettings: ({ onTypographySubmit, }: {
3
+ onTypographySubmit: (theme: Theme) => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
3
5
  export default TypographySettings;
package/dist/index.es.js CHANGED
@@ -15566,36 +15566,38 @@ const ll = ({
15566
15566
  foreground: s.foreground
15567
15567
  }
15568
15568
  }
15569
- }), q3 = () => {
15570
- const [e, t] = ht(
15569
+ }), q3 = ({
15570
+ onColorSubmit: e
15571
+ }) => {
15572
+ const [t, n] = ht(
15571
15573
  JSON.parse(localStorage.getItem("theme") || "{}").palette.primary.main
15572
- ), [n, r] = ht(
15574
+ ), [r, s] = ht(
15573
15575
  JSON.parse(localStorage.getItem("theme") || "{}").palette.secondary.main
15574
- ), [s, i] = ht(
15576
+ ), [i, a] = ht(
15575
15577
  JSON.parse(localStorage.getItem("theme") || "{}").palette.navbar
15576
- ), [a, l] = ht(
15578
+ ), [l, c] = ht(
15577
15579
  JSON.parse(localStorage.getItem("theme") || "{}").palette.sidebar
15578
- ), c = (g) => {
15579
- t(g);
15580
- }, u = (g) => {
15581
- r(g);
15582
- }, d = (g) => {
15583
- i({ ...s, background: g });
15584
- }, A = (g) => {
15585
- i({ ...s, foreground: g });
15586
- }, f = (g) => {
15587
- l({ ...a, background: g });
15588
- }, h = (g) => {
15589
- l({ ...a, foreground: g });
15590
- }, v = () => {
15591
- const g = JSON.parse(localStorage.getItem("theme") || "{}"), w = U3(
15592
- g,
15593
- e,
15594
- n,
15595
- s,
15596
- a
15580
+ ), u = (w) => {
15581
+ n(w);
15582
+ }, d = (w) => {
15583
+ s(w);
15584
+ }, A = (w) => {
15585
+ a({ ...i, background: w });
15586
+ }, f = (w) => {
15587
+ a({ ...i, foreground: w });
15588
+ }, h = (w) => {
15589
+ c({ ...l, background: w });
15590
+ }, v = (w) => {
15591
+ c({ ...l, foreground: w });
15592
+ }, g = () => {
15593
+ const w = JSON.parse(localStorage.getItem("theme") || "{}"), C = U3(
15594
+ w,
15595
+ t,
15596
+ r,
15597
+ i,
15598
+ l
15597
15599
  );
15598
- localStorage.setItem("theme", JSON.stringify(w)), window.location.reload();
15600
+ localStorage.setItem("theme", JSON.stringify(C)), e(C);
15599
15601
  };
15600
15602
  return /* @__PURE__ */ p.jsxs(
15601
15603
  Tr,
@@ -15615,8 +15617,8 @@ const ll = ({
15615
15617
  so,
15616
15618
  {
15617
15619
  label: "Color",
15618
- initialColor: e,
15619
- onChange: c
15620
+ initialColor: t,
15621
+ onChange: u
15620
15622
  }
15621
15623
  ) })
15622
15624
  ] }),
@@ -15626,8 +15628,8 @@ const ll = ({
15626
15628
  so,
15627
15629
  {
15628
15630
  label: "Color",
15629
- initialColor: n,
15630
- onChange: u
15631
+ initialColor: r,
15632
+ onChange: d
15631
15633
  }
15632
15634
  ) })
15633
15635
  ] }),
@@ -15638,16 +15640,16 @@ const ll = ({
15638
15640
  so,
15639
15641
  {
15640
15642
  label: "Background",
15641
- initialColor: s.background,
15642
- onChange: d
15643
+ initialColor: i.background,
15644
+ onChange: A
15643
15645
  }
15644
15646
  ),
15645
15647
  /* @__PURE__ */ p.jsx(
15646
15648
  so,
15647
15649
  {
15648
15650
  label: "Foreground",
15649
- initialColor: s.foreground,
15650
- onChange: A
15651
+ initialColor: i.foreground,
15652
+ onChange: f
15651
15653
  }
15652
15654
  )
15653
15655
  ] })
@@ -15659,21 +15661,21 @@ const ll = ({
15659
15661
  so,
15660
15662
  {
15661
15663
  label: "Background",
15662
- initialColor: a.background,
15663
- onChange: f
15664
+ initialColor: l.background,
15665
+ onChange: h
15664
15666
  }
15665
15667
  ),
15666
15668
  /* @__PURE__ */ p.jsx(
15667
15669
  so,
15668
15670
  {
15669
15671
  label: "Foreground",
15670
- initialColor: a.foreground,
15671
- onChange: h
15672
+ initialColor: l.foreground,
15673
+ onChange: v
15672
15674
  }
15673
15675
  )
15674
15676
  ] })
15675
15677
  ] }),
15676
- /* @__PURE__ */ p.jsx(ll, { onClick: v, children: "Apply" })
15678
+ /* @__PURE__ */ p.jsx(ll, { onClick: g, children: "Apply" })
15677
15679
  ]
15678
15680
  }
15679
15681
  );
@@ -26641,33 +26643,35 @@ const yM = ({
26641
26643
  ], DM = () => JSON.parse(localStorage.getItem("theme") || "{}").typography.fontFamily.split(",").map((s) => s.trim()).map((s) => ({
26642
26644
  value: s,
26643
26645
  title: s.replace(/['"]/g, "")
26644
- })), xM = () => {
26645
- const [e, t] = ht(() => {
26646
- const c = localStorage.getItem("theme");
26647
- return c ? JSON.parse(c).typography : {};
26648
- }), [n, r] = ht(DM()), s = (c, u, d) => {
26649
- t((A) => ({
26650
- ...A,
26651
- [c]: {
26652
- ...A[c],
26653
- [u]: u === "fontWeight" ? Number(d) : `${d}rem`
26646
+ })), xM = ({
26647
+ onTypographySubmit: e
26648
+ }) => {
26649
+ const [t, n] = ht(() => {
26650
+ const u = localStorage.getItem("theme");
26651
+ return u ? JSON.parse(u).typography : {};
26652
+ }), [r, s] = ht(DM()), i = (u, d, A) => {
26653
+ n((f) => ({
26654
+ ...f,
26655
+ [u]: {
26656
+ ...f[u],
26657
+ [d]: d === "fontWeight" ? Number(A) : `${A}rem`
26654
26658
  }
26655
26659
  }));
26656
- }, i = (c, u, d) => {
26657
- if (d === "0") return;
26658
- const A = d.replace(/[^\d.]/g, "");
26659
- s(c, u, A);
26660
- }, a = () => {
26661
- const c = JSON.parse(localStorage.getItem("theme") || "{}"), d = n.map((f) => f.value).join(",").replace(/"/g, "'"), A = {
26662
- ...c,
26660
+ }, a = (u, d, A) => {
26661
+ if (A === "0") return;
26662
+ const f = A.replace(/[^\d.]/g, "");
26663
+ i(u, d, f);
26664
+ }, l = () => {
26665
+ const u = JSON.parse(localStorage.getItem("theme") || "{}"), A = r.map((h) => h.value).join(",").replace(/"/g, "'"), f = {
26666
+ ...u,
26663
26667
  typography: {
26664
- ...e,
26665
- fontFamily: d
26668
+ ...t,
26669
+ fontFamily: A
26666
26670
  }
26667
26671
  };
26668
- localStorage.setItem("theme", JSON.stringify(A)), window.location.reload(), console.log(e, A, d);
26669
- }, l = (c) => {
26670
- Array.isArray(c) ? r(c) : r(c ? [c] : []);
26672
+ localStorage.setItem("theme", JSON.stringify(f)), e(f);
26673
+ }, c = (u) => {
26674
+ Array.isArray(u) ? s(u) : s(u ? [u] : []);
26671
26675
  };
26672
26676
  return /* @__PURE__ */ p.jsxs(Je, { children: [
26673
26677
  /* @__PURE__ */ p.jsx(Ge, { variant: "h4", gutterBottom: !0, children: "Typography Settings" }),
@@ -26678,24 +26682,24 @@ const yM = ({
26678
26682
  yM,
26679
26683
  {
26680
26684
  label: "Select Font Families",
26681
- defaultValue: n,
26685
+ defaultValue: r,
26682
26686
  options: EM,
26683
- getOptionLabel: (c) => c.title,
26684
- onChange: l,
26687
+ getOptionLabel: (u) => u.title,
26688
+ onChange: c,
26685
26689
  multiple: !0
26686
26690
  }
26687
26691
  )
26688
26692
  ] }),
26689
- e && Object.keys(e).map((c) => {
26690
- if (c !== "fontFamily")
26693
+ t && Object.keys(t).map((u) => {
26694
+ if (u !== "fontFamily")
26691
26695
  return /* @__PURE__ */ p.jsxs(Fs, { size: { xs: 12, sm: 6, md: 4 }, children: [
26692
- /* @__PURE__ */ p.jsx(Ge, { variant: "h6", gutterBottom: !0, children: c }),
26696
+ /* @__PURE__ */ p.jsx(Ge, { variant: "h6", gutterBottom: !0, children: u }),
26693
26697
  /* @__PURE__ */ p.jsx(
26694
26698
  Sl,
26695
26699
  {
26696
26700
  label: "Font Size (rem)",
26697
- value: e[c].fontSize.replace(/rem$/, ""),
26698
- onChange: (u) => i(c, "fontSize", u.target.value),
26701
+ value: t[u].fontSize.replace(/rem$/, ""),
26702
+ onChange: (d) => a(u, "fontSize", d.target.value),
26699
26703
  fullWidth: !0,
26700
26704
  inputProps: { inputMode: "numeric", pattern: "[0-9]*" }
26701
26705
  }
@@ -26704,8 +26708,8 @@ const yM = ({
26704
26708
  Sl,
26705
26709
  {
26706
26710
  label: "Font Weight",
26707
- value: e[c].fontWeight,
26708
- onChange: (u) => s(c, "fontWeight", u.target.value),
26711
+ value: t[u].fontWeight,
26712
+ onChange: (d) => i(u, "fontWeight", d.target.value),
26709
26713
  fullWidth: !0,
26710
26714
  margin: "normal"
26711
26715
  }
@@ -26714,18 +26718,18 @@ const yM = ({
26714
26718
  Sl,
26715
26719
  {
26716
26720
  label: "Line Height (rem)",
26717
- value: e[c].lineHeight.replace(/rem$/, ""),
26718
- onChange: (u) => i(
26719
- c,
26721
+ value: t[u].lineHeight.replace(/rem$/, ""),
26722
+ onChange: (d) => a(
26723
+ u,
26720
26724
  "lineHeight",
26721
- u.target.value
26725
+ d.target.value
26722
26726
  ),
26723
26727
  fullWidth: !0,
26724
26728
  margin: "normal",
26725
26729
  inputProps: { inputMode: "numeric", pattern: "[0-9]*" }
26726
26730
  }
26727
26731
  )
26728
- ] }, c);
26732
+ ] }, u);
26729
26733
  })
26730
26734
  ] }),
26731
26735
  /* @__PURE__ */ p.jsx(
@@ -26733,7 +26737,7 @@ const yM = ({
26733
26737
  {
26734
26738
  variant: "contained",
26735
26739
  color: "primary",
26736
- onClick: a,
26740
+ onClick: l,
26737
26741
  sx: { marginTop: 2 },
26738
26742
  children: "Apply Settings"
26739
26743
  }
@@ -28011,16 +28015,19 @@ const WM = ({
28011
28015
  }, Gi = [
28012
28016
  { label: "Color", value: "color" },
28013
28017
  { label: "Typography", value: "typography" }
28014
- ], Jk = () => {
28015
- const [e, t] = ht(
28018
+ ], Jk = ({
28019
+ onColorSubmit: e,
28020
+ onTypographySubmit: t
28021
+ }) => {
28022
+ const [n, r] = ht(
28016
28023
  JSON.parse(localStorage.getItem("tabs") || JSON.stringify(Gi[0].value))
28017
- ), n = (r, s) => {
28018
- t(s), localStorage.setItem("tabs", JSON.stringify(s)), console.log(r);
28024
+ ), s = (i, a) => {
28025
+ r(a), localStorage.setItem("tabs", JSON.stringify(a)), console.log(i);
28019
28026
  };
28020
28027
  return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
28021
- /* @__PURE__ */ p.jsx(WM, { tabs: Gi, value: e, onChange: n }),
28022
- e === Gi[0].value && /* @__PURE__ */ p.jsx(q3, {}),
28023
- e === Gi[1].value && /* @__PURE__ */ p.jsx(xM, {})
28028
+ /* @__PURE__ */ p.jsx(WM, { tabs: Gi, value: n, onChange: s }),
28029
+ n === Gi[0].value && /* @__PURE__ */ p.jsx(q3, { onColorSubmit: e }),
28030
+ n === Gi[1].value && /* @__PURE__ */ p.jsx(xM, { onTypographySubmit: t })
28024
28031
  ] });
28025
28032
  }, KM = rt(/* @__PURE__ */ p.jsx("path", {
28026
28033
  d: "M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"