@datavac/ui-kit 1.1.0 → 1.2.0

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.d.ts CHANGED
@@ -8,6 +8,8 @@ export { Input, SearchBar } from './components/Input';
8
8
  export { Tooltip } from './components/Tooltip';
9
9
  export { Drawer } from './components/Drawer';
10
10
  export { Accordion, AccordionItem } from './components/Accordion';
11
+ export { Card } from './components/Card';
12
+ export type { CardProps } from './components/Card';
11
13
  export { Spinner, Skeleton } from './components/Spinner';
12
14
  export { EmptyState, ErrorState } from './components/States';
13
15
  export { ThemeToggle } from './components/ThemeToggle';
package/dist/index.js CHANGED
@@ -6330,21 +6330,35 @@ function Eu({ title: e, children: t, value: n }) {
6330
6330
  });
6331
6331
  }
6332
6332
  //#endregion
6333
- //#region src/components/Spinner/Spinner.tsx
6333
+ //#region src/components/Card/Card.tsx
6334
6334
  var Du = {
6335
+ none: "",
6336
+ sm: "p-4",
6337
+ md: "p-5",
6338
+ lg: "px-8 py-6"
6339
+ }, Ou = r(({ className: e, padding: t = "md", shadow: n = !0, children: r, ...i }, a) => /* @__PURE__ */ d("div", {
6340
+ ref: a,
6341
+ className: G("bg-card rounded-card", n && "shadow-[0_4px_50px_rgba(0,0,0,0.03)]", Du[t], e),
6342
+ ...i,
6343
+ children: r
6344
+ }));
6345
+ Ou.displayName = "Card";
6346
+ //#endregion
6347
+ //#region src/components/Spinner/Spinner.tsx
6348
+ var ku = {
6335
6349
  sm: "w-4 h-4 border-[1.5px]",
6336
6350
  md: "w-6 h-6 border-2",
6337
6351
  lg: "w-10 h-10 border-[3px]"
6338
6352
  };
6339
- function Ou({ size: e = "md", className: t }) {
6353
+ function Au({ size: e = "md", className: t }) {
6340
6354
  return /* @__PURE__ */ d("div", {
6341
6355
  role: "status",
6342
6356
  "aria-label": "Загрузка",
6343
6357
  className: G("flex items-center justify-center", t),
6344
- children: /* @__PURE__ */ d("div", { className: G("rounded-full border-subtle border-t-accent animate-spin", Du[e]) })
6358
+ children: /* @__PURE__ */ d("div", { className: G("rounded-full border-subtle border-t-accent animate-spin", ku[e]) })
6345
6359
  });
6346
6360
  }
6347
- function ku({ className: e, ...t }) {
6361
+ function ju({ className: e, ...t }) {
6348
6362
  return /* @__PURE__ */ d("div", {
6349
6363
  className: G("rounded-input bg-subtle animate-pulse", e),
6350
6364
  ...t
@@ -6352,7 +6366,7 @@ function ku({ className: e, ...t }) {
6352
6366
  }
6353
6367
  //#endregion
6354
6368
  //#region src/components/States/States.tsx
6355
- function Au({ message: e = "Ничего не найдено", className: t }) {
6369
+ function Mu({ message: e = "Ничего не найдено", className: t }) {
6356
6370
  return /* @__PURE__ */ d("div", {
6357
6371
  className: G("flex flex-col items-center justify-center py-16 text-center", t),
6358
6372
  children: /* @__PURE__ */ d("p", {
@@ -6361,7 +6375,7 @@ function Au({ message: e = "Ничего не найдено", className: t }) {
6361
6375
  })
6362
6376
  });
6363
6377
  }
6364
- function ju({ message: e = "Произошла ошибка", className: t }) {
6378
+ function Nu({ message: e = "Произошла ошибка", className: t }) {
6365
6379
  return /* @__PURE__ */ d("div", {
6366
6380
  className: G("flex flex-col items-center justify-center py-16 text-center", t),
6367
6381
  children: /* @__PURE__ */ d("p", {
@@ -6372,7 +6386,7 @@ function ju({ message: e = "Произошла ошибка", className: t }) {
6372
6386
  }
6373
6387
  //#endregion
6374
6388
  //#region src/icons/index.tsx
6375
- function Mu({ width: e = 12, height: t = 12, ...n }) {
6389
+ function Pu({ width: e = 12, height: t = 12, ...n }) {
6376
6390
  return /* @__PURE__ */ d("svg", {
6377
6391
  viewBox: "0 0 12 12",
6378
6392
  width: e,
@@ -6388,7 +6402,7 @@ function Mu({ width: e = 12, height: t = 12, ...n }) {
6388
6402
  })
6389
6403
  });
6390
6404
  }
6391
- function Nu({ width: e = 17, height: t = 17, ...n }) {
6405
+ function Fu({ width: e = 17, height: t = 17, ...n }) {
6392
6406
  return /* @__PURE__ */ d("svg", {
6393
6407
  viewBox: "0 0 17 17",
6394
6408
  width: e,
@@ -6404,7 +6418,7 @@ function Nu({ width: e = 17, height: t = 17, ...n }) {
6404
6418
  })
6405
6419
  });
6406
6420
  }
6407
- function Pu({ width: e = 14, height: t = 10, ...n }) {
6421
+ function Iu({ width: e = 14, height: t = 10, ...n }) {
6408
6422
  return /* @__PURE__ */ f("svg", {
6409
6423
  viewBox: "0 0 14 10",
6410
6424
  width: e,
@@ -6436,7 +6450,7 @@ function Pu({ width: e = 14, height: t = 10, ...n }) {
6436
6450
  ]
6437
6451
  });
6438
6452
  }
6439
- function Fu({ width: e = 16, height: t = 16, ...n }) {
6453
+ function Lu({ width: e = 16, height: t = 16, ...n }) {
6440
6454
  return /* @__PURE__ */ d("svg", {
6441
6455
  viewBox: "0 0 16 16",
6442
6456
  width: e,
@@ -6452,7 +6466,7 @@ function Fu({ width: e = 16, height: t = 16, ...n }) {
6452
6466
  })
6453
6467
  });
6454
6468
  }
6455
- function Iu({ width: e = 24, height: t = 24, ...n }) {
6469
+ function Ru({ width: e = 24, height: t = 24, ...n }) {
6456
6470
  return /* @__PURE__ */ d("svg", {
6457
6471
  viewBox: "0 0 24 24",
6458
6472
  width: e,
@@ -6468,7 +6482,7 @@ function Iu({ width: e = 24, height: t = 24, ...n }) {
6468
6482
  })
6469
6483
  });
6470
6484
  }
6471
- function Lu({ width: e = 16, height: t = 16, ...n }) {
6485
+ function zu({ width: e = 16, height: t = 16, ...n }) {
6472
6486
  return /* @__PURE__ */ d("svg", {
6473
6487
  viewBox: "0 0 16 16",
6474
6488
  width: e,
@@ -6486,7 +6500,7 @@ function Lu({ width: e = 16, height: t = 16, ...n }) {
6486
6500
  }
6487
6501
  //#endregion
6488
6502
  //#region src/components/Switch/Switch.tsx
6489
- var Ru = {
6503
+ var Bu = {
6490
6504
  sm: {
6491
6505
  track: "w-8 h-5",
6492
6506
  thumb: "top-0.5 w-4 h-4",
@@ -6500,8 +6514,8 @@ var Ru = {
6500
6514
  off: "left-[3px]"
6501
6515
  }
6502
6516
  };
6503
- function zu({ checked: e, onChange: t, size: n = "md", trackClassName: r, thumbClassName: i, id: a, disabled: o, className: s, "aria-label": c, "aria-labelledby": l }) {
6504
- let { track: u, thumb: p, on: m, off: h } = Ru[n];
6517
+ function Vu({ checked: e, onChange: t, size: n = "md", trackClassName: r, thumbClassName: i, id: a, disabled: o, className: s, "aria-label": c, "aria-labelledby": l }) {
6518
+ let { track: u, thumb: p, on: m, off: h } = Bu[n];
6505
6519
  return /* @__PURE__ */ f("label", {
6506
6520
  className: G("inline-flex items-center cursor-pointer", o && "opacity-40 cursor-not-allowed", s),
6507
6521
  children: [/* @__PURE__ */ d("input", {
@@ -6520,7 +6534,7 @@ function zu({ checked: e, onChange: t, size: n = "md", trackClassName: r, thumbC
6520
6534
  })]
6521
6535
  });
6522
6536
  }
6523
- var Bu = {
6537
+ var Hu = {
6524
6538
  colors: {
6525
6539
  accent: "#E30C5C",
6526
6540
  accentHover: "#B40A49",
@@ -6546,7 +6560,7 @@ var Bu = {
6546
6560
  button: "40px"
6547
6561
  },
6548
6562
  font: { sans: "'Inter Tight', sans-serif" }
6549
- }, Vu = {
6563
+ }, Uu = {
6550
6564
  colors: {
6551
6565
  accent: "#F31667",
6552
6566
  accentHover: "#B40A49",
@@ -6572,7 +6586,7 @@ var Bu = {
6572
6586
  button: "40px"
6573
6587
  },
6574
6588
  font: { sans: "'Inter Tight', sans-serif" }
6575
- }, Hu = [
6589
+ }, Wu = [
6576
6590
  {
6577
6591
  path: "colors.accent",
6578
6592
  cssVar: "--color-accent"
@@ -6657,24 +6671,24 @@ var Bu = {
6657
6671
  path: "font.sans",
6658
6672
  cssVar: "--font-sans"
6659
6673
  }
6660
- ], Uu = {
6661
- light: Bu,
6662
- dark: Vu
6674
+ ], Gu = {
6675
+ light: Hu,
6676
+ dark: Uu
6663
6677
  };
6664
- function Wu(e, t) {
6678
+ function Ku(e, t) {
6665
6679
  return t.split(".").reduce((e, t) => e[t], e);
6666
6680
  }
6667
- function Gu(e) {
6668
- return Object.fromEntries(Hu.map(({ path: t, cssVar: n }) => [n, Wu(e, t)]));
6681
+ function qu(e) {
6682
+ return Object.fromEntries(Wu.map(({ path: t, cssVar: n }) => [n, Ku(e, t)]));
6669
6683
  }
6670
6684
  //#endregion
6671
6685
  //#region src/components/ThemeProvider/ThemeProvider.tsx
6672
- var Ku = n(null);
6673
- function qu({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0 }) {
6686
+ var Ju = n(null);
6687
+ function Yu({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0 }) {
6674
6688
  let a = c(() => ({
6675
- ...Uu,
6689
+ ...Gu,
6676
6690
  ...n
6677
- }), [n]), [s, u] = l(t ?? "light"), f = a[s] ?? Bu;
6691
+ }), [n]), [s, u] = l(t ?? "light"), f = a[s] ?? Hu;
6678
6692
  o(() => {
6679
6693
  let e = localStorage.getItem("datavac-theme");
6680
6694
  !e || !a[e] || u(e);
@@ -6686,7 +6700,7 @@ function qu({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0
6686
6700
  }, [a]), m = i(() => {
6687
6701
  u((e) => e === "dark" ? "light" : "dark");
6688
6702
  }, []);
6689
- return /* @__PURE__ */ d(Ku.Provider, {
6703
+ return /* @__PURE__ */ d(Ju.Provider, {
6690
6704
  value: {
6691
6705
  themeName: s,
6692
6706
  tokens: f,
@@ -6696,23 +6710,25 @@ function qu({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0
6696
6710
  children: e
6697
6711
  });
6698
6712
  }
6699
- function Ju() {
6700
- let e = a(Ku);
6713
+ function Xu() {
6714
+ let e = a(Ju);
6701
6715
  if (!e) throw Error("useTheme must be used within <ThemeProvider>");
6702
6716
  return e;
6703
6717
  }
6704
6718
  //#endregion
6705
6719
  //#region src/components/ThemeToggle/ThemeToggle.tsx
6706
- function Yu({ className: e }) {
6707
- let { themeName: t, toggleTheme: n } = Ju(), r = t === "dark";
6708
- return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
6720
+ function Zu({ className: e }) {
6721
+ let { themeName: t, toggleTheme: n } = Xu(), r = t === "dark", [i, a] = l(!1);
6722
+ return o(() => {
6723
+ a(!0);
6724
+ }, []), i ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
6709
6725
  className: G("hidden md:flex items-center gap-2", e),
6710
6726
  children: [
6711
6727
  /* @__PURE__ */ d("span", {
6712
6728
  className: G("text-xs font-sans", r ? "text-fg-muted" : "text-fg"),
6713
6729
  children: "День"
6714
6730
  }),
6715
- /* @__PURE__ */ d(zu, {
6731
+ /* @__PURE__ */ d(Vu, {
6716
6732
  checked: r,
6717
6733
  onChange: () => n(),
6718
6734
  size: "sm",
@@ -6735,14 +6751,14 @@ function Yu({ className: e }) {
6735
6751
  /* @__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]") }),
6736
6752
  /* @__PURE__ */ d("span", {
6737
6753
  className: "absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none text-white",
6738
- children: /* @__PURE__ */ d(Lu, {})
6754
+ children: /* @__PURE__ */ d(zu, {})
6739
6755
  }),
6740
6756
  /* @__PURE__ */ d("span", {
6741
6757
  className: "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-fg",
6742
- children: /* @__PURE__ */ d(Fu, {})
6758
+ children: /* @__PURE__ */ d(Lu, {})
6743
6759
  })
6744
6760
  ]
6745
- })] });
6761
+ })] }) : null;
6746
6762
  }
6747
6763
  //#endregion
6748
- 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 };
6764
+ export { Tu as Accordion, Eu as AccordionItem, Pu as ArrowsIcon, yt as Badge, vt as Button, tt as Caption, Ou as Card, bt as Chip, xt as Counter, bl as Drawer, Mu as EmptyState, Nu as ErrorState, Qe as Heading, Fu as InfoCircleIcon, St as Input, et as Label, Iu as MenuIcon, Lu as MoonStarsIcon, Ru as PlusIcon, Ct as SearchBar, ju as Skeleton, Au as Spinner, zu as SunIcon, Vu as Switch, $e as Text, Yu as ThemeProvider, Zu as ThemeToggle, za as Tooltip, G as cn, Uu as darkTheme, Hu as defaultTheme, Gu as themes, qu as tokensToCssVars, Xu as useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datavac/ui-kit",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",