@datavac/ui-kit 1.0.5 → 1.0.7
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 +71 -77
- package/package.json +8 -7
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
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
6574
|
+
}, Hu = [
|
|
6620
6575
|
{
|
|
6621
6576
|
path: "colors.accent",
|
|
6622
6577
|
cssVar: "--color-accent"
|
|
@@ -6701,53 +6656,92 @@ var Vu = {
|
|
|
6701
6656
|
path: "font.sans",
|
|
6702
6657
|
cssVar: "--font-sans"
|
|
6703
6658
|
}
|
|
6704
|
-
],
|
|
6705
|
-
light:
|
|
6706
|
-
dark:
|
|
6659
|
+
], Uu = {
|
|
6660
|
+
light: Bu,
|
|
6661
|
+
dark: Vu
|
|
6707
6662
|
};
|
|
6708
|
-
function
|
|
6663
|
+
function Wu(e, t) {
|
|
6709
6664
|
return t.split(".").reduce((e, t) => e[t], e);
|
|
6710
6665
|
}
|
|
6711
|
-
function
|
|
6712
|
-
return Object.fromEntries(
|
|
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
|
|
6717
|
-
function
|
|
6718
|
-
let a = {
|
|
6719
|
-
...
|
|
6671
|
+
var Ku = n(null);
|
|
6672
|
+
function qu({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0 }) {
|
|
6673
|
+
let a = c(() => ({
|
|
6674
|
+
...Uu,
|
|
6720
6675
|
...n
|
|
6721
|
-
}, [s,
|
|
6722
|
-
if (t) return t;
|
|
6723
|
-
if (typeof window < "u") {
|
|
6724
|
-
let e = localStorage.getItem("datavac-theme");
|
|
6725
|
-
if (e && a[e]) return e;
|
|
6726
|
-
}
|
|
6727
|
-
return "light";
|
|
6728
|
-
}), u = a[s] ?? Vu;
|
|
6676
|
+
}), [n]), [s, u] = l(t ?? "light"), f = a[s] ?? Bu;
|
|
6729
6677
|
o(() => {
|
|
6678
|
+
let e = localStorage.getItem("datavac-theme");
|
|
6679
|
+
!e || !a[e] || u(e);
|
|
6680
|
+
}, [a]), o(() => {
|
|
6730
6681
|
r && document.documentElement.classList.toggle("dark", s === "dark"), localStorage.setItem("datavac-theme", s);
|
|
6731
6682
|
}, [s, r]);
|
|
6732
|
-
let
|
|
6733
|
-
a[e] &&
|
|
6734
|
-
}, [a]),
|
|
6735
|
-
|
|
6683
|
+
let p = i((e) => {
|
|
6684
|
+
a[e] && u(e);
|
|
6685
|
+
}, [a]), m = i(() => {
|
|
6686
|
+
u((e) => e === "dark" ? "light" : "dark");
|
|
6736
6687
|
}, []);
|
|
6737
|
-
return /* @__PURE__ */ d(
|
|
6688
|
+
return /* @__PURE__ */ d(Ku.Provider, {
|
|
6738
6689
|
value: {
|
|
6739
6690
|
themeName: s,
|
|
6740
|
-
tokens:
|
|
6741
|
-
setTheme:
|
|
6742
|
-
toggleTheme:
|
|
6691
|
+
tokens: f,
|
|
6692
|
+
setTheme: p,
|
|
6693
|
+
toggleTheme: m
|
|
6743
6694
|
},
|
|
6744
6695
|
children: e
|
|
6745
6696
|
});
|
|
6746
6697
|
}
|
|
6747
|
-
function
|
|
6748
|
-
let e = a(
|
|
6698
|
+
function Ju() {
|
|
6699
|
+
let e = a(Ku);
|
|
6749
6700
|
if (!e) throw Error("useTheme must be used within <ThemeProvider>");
|
|
6750
6701
|
return e;
|
|
6751
6702
|
}
|
|
6752
6703
|
//#endregion
|
|
6753
|
-
|
|
6704
|
+
//#region src/components/ThemeToggle/ThemeToggle.tsx
|
|
6705
|
+
function Yu({ className: e }) {
|
|
6706
|
+
let { themeName: t, toggleTheme: n } = Ju(), r = t === "dark";
|
|
6707
|
+
return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
|
|
6708
|
+
className: G("hidden md:flex items-center gap-2", e),
|
|
6709
|
+
children: [
|
|
6710
|
+
/* @__PURE__ */ d("span", {
|
|
6711
|
+
className: G("text-xs font-sans", r ? "text-fg-muted" : "text-fg"),
|
|
6712
|
+
children: "День"
|
|
6713
|
+
}),
|
|
6714
|
+
/* @__PURE__ */ d(zu, {
|
|
6715
|
+
checked: r,
|
|
6716
|
+
onChange: () => n(),
|
|
6717
|
+
size: "sm",
|
|
6718
|
+
trackClassName: r ? "bg-neutral" : "bg-subtle",
|
|
6719
|
+
thumbClassName: r ? "bg-accent" : "bg-neutral",
|
|
6720
|
+
"aria-label": r ? "Включить светлую тему" : "Включить тёмную тему"
|
|
6721
|
+
}),
|
|
6722
|
+
/* @__PURE__ */ d("span", {
|
|
6723
|
+
className: G("text-xs font-sans", r ? "text-fg" : "text-fg-muted"),
|
|
6724
|
+
children: "Ночь"
|
|
6725
|
+
})
|
|
6726
|
+
]
|
|
6727
|
+
}), /* @__PURE__ */ f("button", {
|
|
6728
|
+
role: "switch",
|
|
6729
|
+
"aria-checked": r,
|
|
6730
|
+
"aria-label": r ? "Включить светлую тему" : "Включить тёмную тему",
|
|
6731
|
+
onClick: n,
|
|
6732
|
+
className: G("relative flex md:hidden w-[58px] h-8 rounded-pill bg-neutral overflow-hidden", e),
|
|
6733
|
+
children: [
|
|
6734
|
+
/* @__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]") }),
|
|
6735
|
+
/* @__PURE__ */ d("span", {
|
|
6736
|
+
className: "absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none text-white",
|
|
6737
|
+
children: /* @__PURE__ */ d(Lu, {})
|
|
6738
|
+
}),
|
|
6739
|
+
/* @__PURE__ */ d("span", {
|
|
6740
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-fg",
|
|
6741
|
+
children: /* @__PURE__ */ d(Fu, {})
|
|
6742
|
+
})
|
|
6743
|
+
]
|
|
6744
|
+
})] });
|
|
6745
|
+
}
|
|
6746
|
+
//#endregion
|
|
6747
|
+
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.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -58,12 +58,6 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@chromatic-com/storybook": "^5.1.2",
|
|
61
|
-
"@storybook/addon-vitest": "^10.3.6",
|
|
62
|
-
"@testing-library/dom": "^10.4.1",
|
|
63
|
-
"@vitest/browser": "^4.1.5",
|
|
64
|
-
"playwright": "^1.59.1",
|
|
65
|
-
"react": "^19.0.0",
|
|
66
|
-
"react-dom": "^19.0.0",
|
|
67
61
|
"@commitlint/cli": "^20.5.3",
|
|
68
62
|
"@commitlint/config-conventional": "^20.5.3",
|
|
69
63
|
"@eslint/js": "^10.0.1",
|
|
@@ -71,9 +65,12 @@
|
|
|
71
65
|
"@semantic-release/git": "^10.0.1",
|
|
72
66
|
"@storybook/addon-a11y": "^10.3.6",
|
|
73
67
|
"@storybook/addon-docs": "^10.3.6",
|
|
68
|
+
"@storybook/addon-themes": "^10.3.6",
|
|
69
|
+
"@storybook/addon-vitest": "^10.3.6",
|
|
74
70
|
"@storybook/react": "^10.3.6",
|
|
75
71
|
"@storybook/react-vite": "^10.3.6",
|
|
76
72
|
"@tailwindcss/vite": "^4.2.4",
|
|
73
|
+
"@testing-library/dom": "^10.4.1",
|
|
77
74
|
"@testing-library/jest-dom": "^6.9.1",
|
|
78
75
|
"@testing-library/react": "^16.3.2",
|
|
79
76
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -81,6 +78,7 @@
|
|
|
81
78
|
"@types/react": "^19.2.14",
|
|
82
79
|
"@types/react-dom": "^19.2.3",
|
|
83
80
|
"@vitejs/plugin-react": "^6.0.1",
|
|
81
|
+
"@vitest/browser": "^4.1.5",
|
|
84
82
|
"@vitest/browser-playwright": "^4.1.5",
|
|
85
83
|
"@vitest/coverage-v8": "^4.1.5",
|
|
86
84
|
"eslint": "^10.3.0",
|
|
@@ -91,7 +89,10 @@
|
|
|
91
89
|
"globals": "^17.6.0",
|
|
92
90
|
"jsdom": "^29.1.1",
|
|
93
91
|
"lint-staged": "^17.0.2",
|
|
92
|
+
"playwright": "^1.59.1",
|
|
94
93
|
"prettier": "^3.8.3",
|
|
94
|
+
"react": "^19.0.0",
|
|
95
|
+
"react-dom": "^19.0.0",
|
|
95
96
|
"semantic-release": "^25.0.3",
|
|
96
97
|
"storybook": "^10.3.6",
|
|
97
98
|
"tailwindcss": "^4.2.4",
|