@companix/uikit 0.0.33 → 0.0.35

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 (90) hide show
  1. package/dist/Avatar/Avatar.scss +64 -0
  2. package/dist/Avatar/helpers.d.ts +10 -0
  3. package/dist/Avatar/index.d.ts +8 -0
  4. package/dist/Avatar/types.d.ts +2 -0
  5. package/dist/Icon/index.d.ts +2 -3
  6. package/dist/Segments/Segments.scss +57 -0
  7. package/dist/Segments/index.d.ts +11 -0
  8. package/dist/bundle.es.js +86 -80
  9. package/dist/bundle.es10.js +78 -39
  10. package/dist/bundle.es11.js +26 -36
  11. package/dist/bundle.es12.js +75 -56
  12. package/dist/bundle.es13.js +39 -19
  13. package/dist/bundle.es14.js +36 -33
  14. package/dist/bundle.es15.js +54 -23
  15. package/dist/bundle.es16.js +21 -45
  16. package/dist/bundle.es17.js +29 -19
  17. package/dist/bundle.es18.js +21 -25
  18. package/dist/bundle.es19.js +45 -38
  19. package/dist/bundle.es2.js +42 -45
  20. package/dist/bundle.es20.js +21 -14
  21. package/dist/bundle.es21.js +28 -33
  22. package/dist/bundle.es22.js +38 -21
  23. package/dist/bundle.es23.js +12 -38
  24. package/dist/bundle.es24.js +32 -114
  25. package/dist/bundle.es25.js +20 -120
  26. package/dist/bundle.es26.js +40 -72
  27. package/dist/bundle.es27.js +115 -32
  28. package/dist/bundle.es28.js +120 -11
  29. package/dist/bundle.es29.js +71 -83
  30. package/dist/bundle.es3.js +2 -8
  31. package/dist/bundle.es30.js +31 -20
  32. package/dist/bundle.es31.js +11 -6
  33. package/dist/bundle.es32.js +83 -32
  34. package/dist/bundle.es33.js +21 -21
  35. package/dist/bundle.es34.js +6 -10
  36. package/dist/bundle.es35.js +33 -23
  37. package/dist/bundle.es36.js +20 -37
  38. package/dist/bundle.es37.js +10 -50
  39. package/dist/bundle.es38.js +22 -40
  40. package/dist/bundle.es39.js +38 -8
  41. package/dist/bundle.es4.js +44 -10
  42. package/dist/bundle.es40.js +48 -21
  43. package/dist/bundle.es41.js +42 -86
  44. package/dist/bundle.es42.js +8 -17
  45. package/dist/bundle.es43.js +24 -19
  46. package/dist/bundle.es44.js +24 -24
  47. package/dist/bundle.es45.js +77 -29
  48. package/dist/bundle.es46.js +18 -3
  49. package/dist/bundle.es47.js +20 -5
  50. package/dist/bundle.es48.js +24 -14
  51. package/dist/bundle.es49.js +39 -14
  52. package/dist/bundle.es5.js +8 -85
  53. package/dist/bundle.es50.js +3 -3
  54. package/dist/bundle.es51.js +5 -3
  55. package/dist/bundle.es52.js +13 -69
  56. package/dist/bundle.es53.js +13 -67
  57. package/dist/bundle.es54.js +3 -70
  58. package/dist/bundle.es55.js +3 -12
  59. package/dist/bundle.es56.js +68 -41
  60. package/dist/bundle.es57.js +67 -14
  61. package/dist/bundle.es58.js +69 -31
  62. package/dist/bundle.es59.js +12 -70
  63. package/dist/bundle.es6.js +11 -85
  64. package/dist/bundle.es60.js +43 -20
  65. package/dist/bundle.es61.js +15 -2
  66. package/dist/bundle.es62.js +32 -14
  67. package/dist/bundle.es63.js +69 -19
  68. package/dist/bundle.es64.js +14 -2
  69. package/dist/bundle.es65.js +17 -18
  70. package/dist/bundle.es67.js +76 -20
  71. package/dist/bundle.es68.js +45 -72
  72. package/dist/bundle.es69.js +20 -49
  73. package/dist/bundle.es7.js +84 -79
  74. package/dist/bundle.es70.js +2 -2
  75. package/dist/bundle.es71.js +21 -14
  76. package/dist/bundle.es72.js +2 -3
  77. package/dist/bundle.es73.js +20 -3
  78. package/dist/bundle.es74.js +14 -20
  79. package/dist/bundle.es75.js +2 -2
  80. package/dist/bundle.es76.js +3 -20
  81. package/dist/bundle.es77.js +3 -2
  82. package/dist/bundle.es78.js +22 -0
  83. package/dist/bundle.es79.js +4 -0
  84. package/dist/bundle.es8.js +83 -24
  85. package/dist/bundle.es80.js +22 -0
  86. package/dist/bundle.es81.js +4 -0
  87. package/dist/bundle.es9.js +20 -73
  88. package/dist/index.d.ts +6 -0
  89. package/dist/index.scss +2 -0
  90. package/package.json +2 -1
@@ -1,87 +1,13 @@
1
- import { jsxs as x, jsx as c } from "react/jsx-runtime";
2
- import L from "classnames";
3
- import { useRef as d, useMemo as f, useCallback as n, useEffect as T, useLayoutEffect as H } from "react";
4
- import { getContainers as p, pc as h, px as v } from "@companix/utils-browser";
5
- const C = ({
6
- children: b,
7
- thumbClassName: y,
8
- scrollableClassName: g,
9
- thumbMargin: R = 0,
10
- trackWidth: w = 20
11
- }) => {
12
- const l = d(null), t = d(null), r = f(() => ({ positons: { top: 0, y: 0 }, scrollRatio: 0 }), []), i = f(() => ({
13
- start() {
14
- document.addEventListener("mousemove", a), document.addEventListener("mouseup", m);
15
- },
16
- clear() {
17
- document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", m);
18
- }
19
- }), []);
20
- T(() => {
21
- const o = new ResizeObserver(u);
22
- return t.current && p(t.current, (e) => {
23
- o.observe(e);
24
- }), () => {
25
- t.current && p(t.current, (e) => {
26
- o.unobserve(e);
27
- });
28
- };
29
- }, []), H(() => {
30
- u();
31
- }, []);
32
- const u = n(() => {
33
- const { current: o } = t, { current: e } = l;
34
- if (e && o) {
35
- const s = o.clientHeight / o.scrollHeight;
36
- e.style.height = h(s * 100), e.style.display = s === 1 ? "none" : "block", r.scrollRatio = s;
37
- }
38
- }, []), a = n(({ clientY: o }) => {
39
- const { current: e } = t;
40
- if (e) {
41
- const s = o - r.positons.y;
42
- e.scrollTop = r.positons.top + s / r.scrollRatio;
43
- }
44
- }, []), m = n(() => {
45
- i.clear();
46
- }, []), E = n(({ clientY: o }) => {
47
- const { current: e } = t;
48
- e && (r.positons = {
49
- top: e.scrollTop,
50
- y: o
51
- }), i.start();
52
- }, []), M = () => {
53
- requestAnimationFrame(() => {
54
- const { current: o } = t, { current: e } = l;
55
- e && o && (e.style.top = h(o.scrollTop * 100 / o.scrollHeight));
56
- });
57
- };
58
- return /* @__PURE__ */ x("div", { className: "relative h-full overflow-hidden", children: [
59
- /* @__PURE__ */ c(
60
- "div",
61
- {
62
- className: L("hidden-scroll h-full overflow-y-scroll", g),
63
- onScroll: M,
64
- ref: t,
65
- children: b
66
- }
67
- ),
68
- /* @__PURE__ */ c(
69
- "div",
70
- {
71
- className: "absolute right-0 top-0 box-border h-full",
72
- style: { width: v(w), padding: v(R) },
73
- children: /* @__PURE__ */ c(
74
- "div",
75
- {
76
- onMouseDown: E,
77
- className: `${y} relative w-full rounded-full`,
78
- ref: l
79
- }
80
- )
81
- }
82
- )
83
- ] });
84
- };
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import n from "classnames";
3
+ const d = ({ size: r = 40, className: t, width: e = 2, color: i = "inherit" }) => /* @__PURE__ */ o(
4
+ "div",
5
+ {
6
+ style: { width: `${r}px`, height: `${r}px`, color: i, borderWidth: `${e}px` },
7
+ className: n("spinner-border", t),
8
+ role: "status"
9
+ }
10
+ );
85
11
  export {
86
- C as ImitateScroll
12
+ d as Spinner
87
13
  };
@@ -1,22 +1,45 @@
1
- import { __exports as e } from "./bundle.es61.js";
2
- var v;
3
- function d() {
4
- return v ? e : (v = 1, (function(a) {
5
- Object.defineProperty(a, "__esModule", { value: !0 });
6
- var c = "fas", n = "check", r = 448, f = 512, i = [10003, 10004], h = "f00c", u = "M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z";
7
- a.definition = {
8
- prefix: c,
9
- iconName: n,
10
- icon: [
11
- r,
12
- f,
13
- i,
14
- h,
15
- u
16
- ]
17
- }, a.faCheck = a.definition, a.prefix = c, a.iconName = n, a.width = r, a.height = f, a.ligatures = i, a.unicode = h, a.svgPathData = u, a.aliases = i;
18
- })(e), e);
19
- }
1
+ import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es58.js";
2
+ import { useMemo as s } from "react";
3
+ import { range as l } from "@companix/utils-js";
4
+ const p = { day: 31, month: 12, year: 2050 }, u = { day: 1, month: 1, year: 1900 }, I = ({ min: t = u, max: e = p, now: r }) => {
5
+ const h = s(() => l(e.year, t.year).map((n) => ({
6
+ title: n.toString(),
7
+ value: n
8
+ })), [e.year, t.year]), d = s(() => {
9
+ const n = f.map((o, a) => ({
10
+ title: o,
11
+ value: a + 1
12
+ }));
13
+ if (t.month && r.year === t.year) {
14
+ const o = n.findIndex(({ value: a }) => a === t.month);
15
+ n.splice(0, o);
16
+ }
17
+ if (e.month && r.year === e.year) {
18
+ const o = n.findIndex(({ value: a }) => a === e.month);
19
+ n.splice(o + 1, n.length);
20
+ }
21
+ return n;
22
+ }, [r.year, t.year, t.month, e.year, e.month]), c = s(() => {
23
+ if (r.month === 0)
24
+ return [];
25
+ const n = i(r.month, r.year), o = Array.from({ length: n }, (a, y) => ({
26
+ title: `${y + 1}`,
27
+ value: y + 1
28
+ }));
29
+ if (t.day && r.month === t.month && r.year === t.year) {
30
+ const a = o.findIndex(({ value: y }) => y === t.day);
31
+ o.splice(0, a);
32
+ }
33
+ if (e.day && r.month === e.month && r.year === e.year) {
34
+ const a = o.findIndex(({ value: y }) => y === e.day);
35
+ o.splice(a + 1, o.length);
36
+ }
37
+ return o;
38
+ }, [r.month, r.year, t, e]);
39
+ return { years: h, months: d, days: c };
40
+ };
20
41
  export {
21
- d as __require
42
+ p as defaultMax,
43
+ u as defaultMin,
44
+ I as useCalendarOptions
22
45
  };
@@ -1,4 +1,17 @@
1
- var a = {};
1
+ const r = (e, o) => {
2
+ let t;
3
+ try {
4
+ t = localStorage.getItem(e) || void 0;
5
+ } catch {
6
+ }
7
+ return t ?? o;
8
+ }, m = (e) => (e || (e = window.matchMedia("(prefers-color-scheme: dark)")), e.matches ? "dark" : "light"), s = (e) => {
9
+ const [o, t] = ["theme-light", "theme-dark"];
10
+ let c = e;
11
+ e === "system" && (c = m()), document.documentElement.classList.remove(o, t), document.documentElement.classList.add(c === "dark" ? t : o), document.documentElement.style.colorScheme = c;
12
+ };
2
13
  export {
3
- a as __exports
14
+ r as getColorScheme,
15
+ m as getSystemColorScheme,
16
+ s as updateDOM
4
17
  };
@@ -1,16 +1,34 @@
1
- import { useRef as l, useCallback as p } from "react";
2
- import { useEffectWithLayout as d } from "./bundle.es71.js";
3
- const g = (r, f) => {
4
- const c = l(null), i = l(null), o = { Right: c, Left: i }, u = p((t) => {
5
- if (r.current) {
6
- const n = r.current.style, e = o[t];
7
- e.current && e.current.clientWidth ? n[`padding${t}`] !== `${e.current.clientWidth}px` && (n[`padding${t}`] = `${e.current.clientWidth}px`) : n[`padding${t}`] && (n[`padding${t}`] = "");
8
- }
9
- }, []);
10
- return d(() => {
11
- u("Left"), u("Right");
12
- }, f), { rightRef: c, leftRef: i };
13
- };
1
+ import { jsx as s, Fragment as p } from "react/jsx-runtime";
2
+ import { forwardRef as f, useState as u, useImperativeHandle as c } from "react";
3
+ import { AlertDialog as x } from "./bundle.es22.js";
4
+ const g = f((a, l) => {
5
+ const [i, n] = u([]);
6
+ c(
7
+ l,
8
+ () => ({
9
+ showAlert: (e) => {
10
+ n((t) => [...t, e]);
11
+ }
12
+ }),
13
+ []
14
+ );
15
+ const d = (e) => {
16
+ n((t) => {
17
+ const r = [...t], o = r.findIndex((m) => m.id === e);
18
+ return o !== -1 && r.splice(o, 1), r;
19
+ });
20
+ };
21
+ return /* @__PURE__ */ s(p, { children: i.map(({ id: e, ...t }) => /* @__PURE__ */ s(
22
+ x,
23
+ {
24
+ defaultOpen: !0,
25
+ onUnMounted: () => d(e),
26
+ ...a,
27
+ ...t
28
+ },
29
+ `alert-${e}`
30
+ )) });
31
+ });
14
32
  export {
15
- g as useInputPadding
33
+ g as Viewport
16
34
  };
@@ -1,22 +1,72 @@
1
- import { __exports as e } from "./bundle.es64.js";
2
- var c;
3
- function d() {
4
- return c ? e : (c = 1, (function(a) {
5
- Object.defineProperty(a, "__esModule", { value: !0 });
6
- var n = "fas", r = "chevron-down", v = 448, o = 512, i = [], f = "f078", h = "M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z";
7
- a.definition = {
8
- prefix: n,
9
- iconName: r,
10
- icon: [
11
- v,
12
- o,
13
- i,
14
- f,
15
- h
1
+ import { jsxs as y, jsx as I } from "react/jsx-runtime";
2
+ import { forwardRef as $, useState as b, useMemo as C, useImperativeHandle as w, useCallback as P, createElement as j } from "react";
3
+ import * as c from "@radix-ui/react-toast";
4
+ import { customCSS as k } from "@companix/utils-browser";
5
+ import { Toast as E } from "./bundle.es40.js";
6
+ var u = /* @__PURE__ */ ((r) => (r["top-center"] = "up", r["top-left"] = "left", r["top-right"] = "right", r["bottom-center"] = "down", r["bottom-left"] = "left", r["bottom-right"] = "right", r))(u || {});
7
+ const M = $((r, h) => {
8
+ const { side: l = "top", align: f = "center", gap: d = 14, duration: g, swipeThreshold: x, closeIcon: T } = r, [i, p] = b([]), a = C(() => ({}), []);
9
+ w(
10
+ h,
11
+ () => ({
12
+ showToast: (t) => {
13
+ p((o) => {
14
+ const e = [...o], n = o.findIndex((s) => s.id === t.id);
15
+ return n === -1 ? e.push(t) : e[n] = t, e;
16
+ });
17
+ }
18
+ }),
19
+ []
20
+ );
21
+ const m = P((t) => {
22
+ t.forEach(({ id: o }, e) => {
23
+ let n = 0;
24
+ for (let s = e + 1; s < t.length; s++)
25
+ a[t[s].id] && (n += a[t[s].id].clientHeight + d);
26
+ a[o] && a[o].style.setProperty("--offset", `${n}px`);
27
+ });
28
+ }, []), v = (t) => {
29
+ p((o) => {
30
+ const e = [...o], n = e.findIndex((s) => s.id === t);
31
+ return n !== -1 && e.splice(n, 1), e;
32
+ });
33
+ };
34
+ return /* @__PURE__ */ y(
35
+ c.Provider,
36
+ {
37
+ swipeThreshold: x,
38
+ swipeDirection: u[`${l}-${f}`],
39
+ children: [
40
+ i.map(({ id: t, ...o }) => /* @__PURE__ */ j(
41
+ E,
42
+ {
43
+ ...o,
44
+ id: t,
45
+ key: `toaster-${t}`,
46
+ duration: o.duration ?? g,
47
+ closeIcon: T,
48
+ onInitialized: (e) => {
49
+ a[t] = e, m(i);
50
+ },
51
+ onClosing: () => {
52
+ delete a[t], m(i);
53
+ },
54
+ onClosed: () => v(t)
55
+ }
56
+ )),
57
+ /* @__PURE__ */ I(
58
+ c.Viewport,
59
+ {
60
+ "data-side": l,
61
+ "data-align": f,
62
+ className: "toaster-viewport",
63
+ style: k({ "--toasters-gap": `${d}px` })
64
+ }
65
+ )
16
66
  ]
17
- }, a.faChevronDown = a.definition, a.prefix = n, a.iconName = r, a.width = v, a.height = o, a.ligatures = i, a.unicode = f, a.svgPathData = h, a.aliases = i;
18
- })(e), e);
19
- }
67
+ }
68
+ );
69
+ });
20
70
  export {
21
- d as __require
71
+ M as Viewport
22
72
  };
@@ -1,4 +1,16 @@
1
- var o = {};
1
+ import { useRef as l, useCallback as p } from "react";
2
+ import { useEffectWithLayout as d } from "./bundle.es74.js";
3
+ const g = (r, f) => {
4
+ const c = l(null), i = l(null), o = { Right: c, Left: i }, u = p((t) => {
5
+ if (r.current) {
6
+ const n = r.current.style, e = o[t];
7
+ e.current && e.current.clientWidth ? n[`padding${t}`] !== `${e.current.clientWidth}px` && (n[`padding${t}`] = `${e.current.clientWidth}px`) : n[`padding${t}`] && (n[`padding${t}`] = "");
8
+ }
9
+ }, []);
10
+ return d(() => {
11
+ u("Left"), u("Right");
12
+ }, f), { rightRef: c, leftRef: i };
13
+ };
2
14
  export {
3
- o as __exports
15
+ g as useInputPadding
4
16
  };
@@ -1,23 +1,22 @@
1
- import { __exports as a } from "./bundle.es66.js";
2
- import { __require as n } from "./bundle.es67.js";
3
- var r;
4
- function f() {
5
- return r ? a : (r = 1, (function(e) {
6
- Object.defineProperty(e, "__esModule", { value: !0 });
7
- var i = /* @__PURE__ */ n();
8
- e.definition = {
9
- prefix: i.prefix,
10
- iconName: i.iconName,
1
+ import { __exports as e } from "./bundle.es66.js";
2
+ var v;
3
+ function d() {
4
+ return v ? e : (v = 1, (function(a) {
5
+ Object.defineProperty(a, "__esModule", { value: !0 });
6
+ var c = "fas", n = "check", r = 448, f = 512, i = [10003, 10004], h = "f00c", u = "M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z";
7
+ a.definition = {
8
+ prefix: c,
9
+ iconName: n,
11
10
  icon: [
12
- i.width,
13
- i.height,
14
- i.aliases,
15
- i.unicode,
16
- i.svgPathData
11
+ r,
12
+ f,
13
+ i,
14
+ h,
15
+ u
17
16
  ]
18
- }, e.faClose = e.definition, e.prefix = i.prefix, e.iconName = i.iconName, e.width = i.width, e.height = i.height, e.ligatures = i.aliases, e.unicode = i.unicode, e.svgPathData = i.svgPathData, e.aliases = i.aliases;
19
- })(a), a);
17
+ }, a.faCheck = a.definition, a.prefix = c, a.iconName = n, a.width = r, a.height = f, a.ligatures = i, a.unicode = h, a.svgPathData = u, a.aliases = i;
18
+ })(e), e);
20
19
  }
21
20
  export {
22
- f as __require
21
+ d as __require
23
22
  };
@@ -1,22 +1,78 @@
1
- import { __exports as e } from "./bundle.es70.js";
2
- var t;
3
- function d() {
4
- return t ? e : (t = 1, (function(a) {
5
- Object.defineProperty(a, "__esModule", { value: !0 });
6
- var r = "fas", n = "xmark", c = 384, f = 512, i = [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], u = "f00d", m = "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z";
7
- a.definition = {
8
- prefix: r,
9
- iconName: n,
10
- icon: [
11
- c,
12
- f,
13
- i,
14
- u,
15
- m
16
- ]
17
- }, a.faXmark = a.definition, a.prefix = r, a.iconName = n, a.width = c, a.height = f, a.ligatures = i, a.unicode = u, a.svgPathData = m, a.aliases = i;
18
- })(e), e);
19
- }
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
+ import { useCallback as h, useMemo as d } from "react";
3
+ import { Select as p } from "./bundle.es12.js";
4
+ import { getMonths as Y, getYears as k, DEFAULT_MAX_YEAR as u, DEFAULT_MIN_YEAR as g } from "./bundle.es58.js";
5
+ import { Icon as C } from "./bundle.es33.js";
6
+ import { f as z } from "./bundle.es76.js";
7
+ import { f as L } from "./bundle.es77.js";
8
+ import { setMonth as R, setYear as T } from "./bundle.es57.js";
9
+ const S = ({
10
+ viewDate: n,
11
+ onChange: m,
12
+ isMonthDisabled: a,
13
+ isYearDisabled: c,
14
+ onNextMonth: v,
15
+ onPrevMonth: x
16
+ }) => {
17
+ const r = n.getFullYear(), e = n.getMonth(), i = "ru", N = h(
18
+ (t) => {
19
+ m(R(n, t));
20
+ },
21
+ [m, n]
22
+ ), E = h(
23
+ (t) => {
24
+ m(T(n, t));
25
+ },
26
+ [m, n]
27
+ ), M = d(() => Y(i).map((t) => ({
28
+ ...t,
29
+ className: "capitalize",
30
+ disabled: a && a(t.value)
31
+ })), [i, a]), A = d(() => k(r, 100).map((t) => ({
32
+ ...t,
33
+ disabled: c && c(t.value)
34
+ })), [r, c]);
35
+ let l = e === 11 && r === u;
36
+ a && !l && (l = a(
37
+ e === 11 ? 0 : e + 1,
38
+ e === 11 ? Math.min(r + 1, u) : r
39
+ ));
40
+ let s = e === 0 && r === g;
41
+ return a && !s && (s = a(
42
+ e === 0 ? 11 : e - 1,
43
+ e === 0 ? Math.max(r - 1, g) : r
44
+ )), /* @__PURE__ */ f("div", { className: "calendar-header", children: [
45
+ !s && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: x, children: /* @__PURE__ */ o(C, { icon: L.faChevronLeft }) }),
46
+ /* @__PURE__ */ f("div", { className: "calendar-pickers", children: [
47
+ /* @__PURE__ */ o(
48
+ p,
49
+ {
50
+ fill: !0,
51
+ options: A,
52
+ size: "sm",
53
+ value: r,
54
+ minimalOptions: !0,
55
+ matchTarget: "min-width",
56
+ onChange: (t) => E(t)
57
+ }
58
+ ),
59
+ /* @__PURE__ */ o(
60
+ p,
61
+ {
62
+ fill: !0,
63
+ options: M,
64
+ size: "sm",
65
+ className: "capitalize",
66
+ value: e,
67
+ minimalOptions: !0,
68
+ matchTarget: "min-width",
69
+ onChange: (t) => N(t)
70
+ }
71
+ )
72
+ ] }),
73
+ !l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: v, children: /* @__PURE__ */ o(C, { icon: z.faChevronRight }) })
74
+ ] });
75
+ };
20
76
  export {
21
- d as __require
77
+ S as CalendarHeader
22
78
  };
@@ -1,78 +1,51 @@
1
- import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
- import { useCallback as h, useMemo as d } from "react";
3
- import { Select as p } from "./bundle.es9.js";
4
- import { getMonths as Y, getYears as k, DEFAULT_MAX_YEAR as u, DEFAULT_MIN_YEAR as g } from "./bundle.es54.js";
5
- import { Icon as C } from "./bundle.es30.js";
6
- import { f as z } from "./bundle.es72.js";
7
- import { f as L } from "./bundle.es73.js";
8
- import { setMonth as R, setYear as T } from "./bundle.es53.js";
9
- const S = ({
10
- viewDate: n,
11
- onChange: m,
12
- isMonthDisabled: a,
13
- isYearDisabled: c,
14
- onNextMonth: v,
15
- onPrevMonth: x
1
+ import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es57.js";
2
+ import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es58.js";
3
+ import { useState as U, useCallback as M } from "react";
4
+ const X = ({
5
+ value: p,
6
+ disablePast: r,
7
+ disableFuture: c,
8
+ shouldDisableDate: E,
9
+ minDateTime: l,
10
+ maxDateTime: s
16
11
  }) => {
17
- const r = n.getFullYear(), e = n.getMonth(), i = "ru", N = h(
18
- (t) => {
19
- m(R(n, t));
12
+ const [e, u] = U(p || /* @__PURE__ */ new Date()), _ = M(() => {
13
+ u(L(e));
14
+ }, [e]), C = M(() => {
15
+ u(N(e, 1));
16
+ }, [e]), D = R({
17
+ disableFuture: c,
18
+ disablePast: r,
19
+ shouldDisableDate: E,
20
+ minDateTime: l,
21
+ maxDateTime: s
22
+ }), k = M(
23
+ (o, t) => {
24
+ const n = /* @__PURE__ */ new Date();
25
+ t = t || e.getFullYear();
26
+ const h = l ? l.getMonth() : 0, Y = s ? s.getMonth() : 11, F = l?.getFullYear() || w, f = s?.getFullYear() || A;
27
+ let g = t >= F && t <= f ? t === F && h > o || t === f && o > Y : !0;
28
+ return c && (g = g || (t === n.getFullYear() ? o > n.getMonth() : t > n.getFullYear())), r && (g = g || (t === n.getFullYear() ? o < n.getMonth() : t < n.getFullYear())), g;
20
29
  },
21
- [m, n]
22
- ), E = h(
23
- (t) => {
24
- m(T(n, t));
30
+ [c, r, e, l, s]
31
+ ), v = M(
32
+ (o) => {
33
+ const t = /* @__PURE__ */ new Date(), n = l?.getFullYear() || w, h = s?.getFullYear() || A;
34
+ let Y = n > o || o > h;
35
+ return c && (Y = Y || o > t.getFullYear()), r && (Y = Y || o < t.getFullYear()), Y;
25
36
  },
26
- [m, n]
27
- ), M = d(() => Y(i).map((t) => ({
28
- ...t,
29
- className: "capitalize",
30
- disabled: a && a(t.value)
31
- })), [i, a]), A = d(() => k(r, 100).map((t) => ({
32
- ...t,
33
- disabled: c && c(t.value)
34
- })), [r, c]);
35
- let l = e === 11 && r === u;
36
- a && !l && (l = a(
37
- e === 11 ? 0 : e + 1,
38
- e === 11 ? Math.min(r + 1, u) : r
39
- ));
40
- let s = e === 0 && r === g;
41
- return a && !s && (s = a(
42
- e === 0 ? 11 : e - 1,
43
- e === 0 ? Math.max(r - 1, g) : r
44
- )), /* @__PURE__ */ f("div", { className: "calendar-header", children: [
45
- !s && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: x, children: /* @__PURE__ */ o(C, { icon: L.faChevronLeft }) }),
46
- /* @__PURE__ */ f("div", { className: "calendar-pickers", children: [
47
- /* @__PURE__ */ o(
48
- p,
49
- {
50
- fill: !0,
51
- options: A,
52
- size: "sm",
53
- value: r,
54
- minimalOptions: !0,
55
- matchTarget: "min-width",
56
- onChange: (t) => E(t)
57
- }
58
- ),
59
- /* @__PURE__ */ o(
60
- p,
61
- {
62
- fill: !0,
63
- options: M,
64
- size: "sm",
65
- className: "capitalize",
66
- value: e,
67
- minimalOptions: !0,
68
- matchTarget: "min-width",
69
- onChange: (t) => N(t)
70
- }
71
- )
72
- ] }),
73
- !l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: v, children: /* @__PURE__ */ o(C, { icon: z.faChevronRight }) })
74
- ] });
37
+ [c, r, l, s]
38
+ );
39
+ return {
40
+ viewDate: e,
41
+ setViewDate: u,
42
+ setPrevMonth: _,
43
+ setNextMonth: C,
44
+ isDayDisabled: D,
45
+ isMonthDisabled: k,
46
+ isYearDisabled: v
47
+ };
75
48
  };
76
49
  export {
77
- S as CalendarHeader
50
+ X as useCalendar
78
51
  };