@datavac/ui-kit 1.0.4 → 1.0.6

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/index.js CHANGED
@@ -6519,52 +6519,7 @@ function zu({ checked: e, onChange: t, size: n = "md", trackClassName: r, thumbC
6519
6519
  })]
6520
6520
  });
6521
6521
  }
6522
- //#endregion
6523
- //#region src/components/ThemeToggle/ThemeToggle.tsx
6524
- function Bu({ className: e }) {
6525
- let [t, n] = l(!1), r = (e) => {
6526
- n(e), document.documentElement.classList.toggle("dark", e);
6527
- };
6528
- return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
6529
- className: G("hidden md:flex items-center gap-2", e),
6530
- children: [
6531
- /* @__PURE__ */ d("span", {
6532
- className: G("text-xs font-sans", t ? "text-fg-muted" : "text-fg"),
6533
- children: "День"
6534
- }),
6535
- /* @__PURE__ */ d(zu, {
6536
- checked: t,
6537
- onChange: r,
6538
- size: "sm",
6539
- trackClassName: t ? "bg-neutral" : "bg-subtle",
6540
- thumbClassName: t ? "bg-accent" : "bg-neutral",
6541
- "aria-label": t ? "Включить светлую тему" : "Включить тёмную тему"
6542
- }),
6543
- /* @__PURE__ */ d("span", {
6544
- className: G("text-xs font-sans", t ? "text-fg" : "text-fg-muted"),
6545
- children: "Ночь"
6546
- })
6547
- ]
6548
- }), /* @__PURE__ */ f("button", {
6549
- role: "switch",
6550
- "aria-checked": t,
6551
- "aria-label": t ? "Включить светлую тему" : "Включить тёмную тему",
6552
- onClick: () => r(!t),
6553
- className: G("relative flex md:hidden w-[58px] h-8 rounded-pill bg-neutral overflow-hidden", e),
6554
- children: [
6555
- /* @__PURE__ */ d("span", { className: G("absolute top-[3px] w-[26px] h-[26px] bg-white rounded-full shadow transition-all duration-200", t ? "left-[29px]" : "left-[3px]") }),
6556
- /* @__PURE__ */ d("span", {
6557
- className: "absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none text-white",
6558
- children: /* @__PURE__ */ d(Lu, {})
6559
- }),
6560
- /* @__PURE__ */ d("span", {
6561
- className: "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-fg",
6562
- children: /* @__PURE__ */ d(Fu, {})
6563
- })
6564
- ]
6565
- })] });
6566
- }
6567
- var Vu = {
6522
+ var Bu = {
6568
6523
  colors: {
6569
6524
  accent: "#E30C5C",
6570
6525
  accentHover: "#B40A49",
@@ -6590,7 +6545,7 @@ var Vu = {
6590
6545
  button: "40px"
6591
6546
  },
6592
6547
  font: { sans: "'Inter Tight', sans-serif" }
6593
- }, Hu = {
6548
+ }, Vu = {
6594
6549
  colors: {
6595
6550
  accent: "#F31667",
6596
6551
  accentHover: "#B40A49",
@@ -6616,7 +6571,7 @@ var Vu = {
6616
6571
  button: "40px"
6617
6572
  },
6618
6573
  font: { sans: "'Inter Tight', sans-serif" }
6619
- }, Uu = [
6574
+ }, Hu = [
6620
6575
  {
6621
6576
  path: "colors.accent",
6622
6577
  cssVar: "--color-accent"
@@ -6701,32 +6656,31 @@ var Vu = {
6701
6656
  path: "font.sans",
6702
6657
  cssVar: "--font-sans"
6703
6658
  }
6704
- ], Wu = {
6705
- light: Vu,
6706
- dark: Hu
6659
+ ], Uu = {
6660
+ light: Bu,
6661
+ dark: Vu
6707
6662
  };
6708
- function Gu(e, t) {
6663
+ function Wu(e, t) {
6709
6664
  return t.split(".").reduce((e, t) => e[t], e);
6710
6665
  }
6711
- function Ku(e) {
6712
- return Object.fromEntries(Uu.map(({ path: t, cssVar: n }) => [n, Gu(e, t)]));
6666
+ function Gu(e) {
6667
+ return Object.fromEntries(Hu.map(({ path: t, cssVar: n }) => [n, Wu(e, t)]));
6713
6668
  }
6714
6669
  //#endregion
6715
6670
  //#region src/components/ThemeProvider/ThemeProvider.tsx
6716
- var qu = n(null);
6717
- function Ju({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0 }) {
6671
+ var Ku = n(null);
6672
+ function qu({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0 }) {
6718
6673
  let a = {
6719
- ...Wu,
6674
+ ...Uu,
6720
6675
  ...n
6721
6676
  }, [s, c] = l(() => {
6722
6677
  if (t) return t;
6723
6678
  if (typeof window < "u") {
6724
6679
  let e = localStorage.getItem("datavac-theme");
6725
6680
  if (e && a[e]) return e;
6726
- if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
6727
6681
  }
6728
6682
  return "light";
6729
- }), u = a[s] ?? Vu;
6683
+ }), u = a[s] ?? Bu;
6730
6684
  o(() => {
6731
6685
  r && document.documentElement.classList.toggle("dark", s === "dark"), localStorage.setItem("datavac-theme", s);
6732
6686
  }, [s, r]);
@@ -6735,7 +6689,7 @@ function Ju({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0
6735
6689
  }, [a]), p = i(() => {
6736
6690
  c((e) => e === "dark" ? "light" : "dark");
6737
6691
  }, []);
6738
- return /* @__PURE__ */ d(qu.Provider, {
6692
+ return /* @__PURE__ */ d(Ku.Provider, {
6739
6693
  value: {
6740
6694
  themeName: s,
6741
6695
  tokens: u,
@@ -6745,10 +6699,53 @@ function Ju({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0
6745
6699
  children: e
6746
6700
  });
6747
6701
  }
6748
- function Yu() {
6749
- let e = a(qu);
6702
+ function Ju() {
6703
+ let e = a(Ku);
6750
6704
  if (!e) throw Error("useTheme must be used within <ThemeProvider>");
6751
6705
  return e;
6752
6706
  }
6753
6707
  //#endregion
6754
- export { Tu as Accordion, Eu as AccordionItem, Mu as ArrowsIcon, yt as Badge, vt as Button, tt as Caption, bt as Chip, xt as Counter, bl as Drawer, Au as EmptyState, ju as ErrorState, Qe as Heading, Nu as InfoCircleIcon, St as Input, et as Label, Pu as MenuIcon, Fu as MoonStarsIcon, Iu as PlusIcon, Ct as SearchBar, ku as Skeleton, Ou as Spinner, Lu as SunIcon, zu as Switch, $e as Text, Ju as ThemeProvider, Bu as ThemeToggle, za as Tooltip, G as cn, Hu as darkTheme, Vu as defaultTheme, Wu as themes, Ku as tokensToCssVars, Yu as useTheme };
6708
+ //#region src/components/ThemeToggle/ThemeToggle.tsx
6709
+ function Yu({ className: e }) {
6710
+ let { themeName: t, toggleTheme: n } = Ju(), r = t === "dark";
6711
+ return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
6712
+ className: G("hidden md:flex items-center gap-2", e),
6713
+ children: [
6714
+ /* @__PURE__ */ d("span", {
6715
+ className: G("text-xs font-sans", r ? "text-fg-muted" : "text-fg"),
6716
+ children: "День"
6717
+ }),
6718
+ /* @__PURE__ */ d(zu, {
6719
+ checked: r,
6720
+ onChange: () => n(),
6721
+ size: "sm",
6722
+ trackClassName: r ? "bg-neutral" : "bg-subtle",
6723
+ thumbClassName: r ? "bg-accent" : "bg-neutral",
6724
+ "aria-label": r ? "Включить светлую тему" : "Включить тёмную тему"
6725
+ }),
6726
+ /* @__PURE__ */ d("span", {
6727
+ className: G("text-xs font-sans", r ? "text-fg" : "text-fg-muted"),
6728
+ children: "Ночь"
6729
+ })
6730
+ ]
6731
+ }), /* @__PURE__ */ f("button", {
6732
+ role: "switch",
6733
+ "aria-checked": r,
6734
+ "aria-label": r ? "Включить светлую тему" : "Включить тёмную тему",
6735
+ onClick: n,
6736
+ className: G("relative flex md:hidden w-[58px] h-8 rounded-pill bg-neutral overflow-hidden", e),
6737
+ children: [
6738
+ /* @__PURE__ */ d("span", { className: G("absolute top-[3px] w-[26px] h-[26px] bg-white rounded-full shadow transition-all duration-200", r ? "left-[29px]" : "left-[3px]") }),
6739
+ /* @__PURE__ */ d("span", {
6740
+ className: "absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none text-white",
6741
+ children: /* @__PURE__ */ d(Lu, {})
6742
+ }),
6743
+ /* @__PURE__ */ d("span", {
6744
+ className: "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-fg",
6745
+ children: /* @__PURE__ */ d(Fu, {})
6746
+ })
6747
+ ]
6748
+ })] });
6749
+ }
6750
+ //#endregion
6751
+ export { Tu as Accordion, Eu as AccordionItem, Mu as ArrowsIcon, yt as Badge, vt as Button, tt as Caption, bt as Chip, xt as Counter, bl as Drawer, Au as EmptyState, ju as ErrorState, Qe as Heading, Nu as InfoCircleIcon, St as Input, et as Label, Pu as MenuIcon, Fu as MoonStarsIcon, Iu as PlusIcon, Ct as SearchBar, ku as Skeleton, Ou as Spinner, Lu as SunIcon, zu as Switch, $e as Text, qu as ThemeProvider, Yu as ThemeToggle, za as Tooltip, G as cn, Vu as darkTheme, Bu as defaultTheme, Uu as themes, Gu as tokensToCssVars, Ju as useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datavac/ui-kit",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",