mimir-ui-kit 1.42.1 → 1.43.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.
Files changed (89) hide show
  1. package/dist/ProgressBar-COdzy3fY.js +67 -0
  2. package/dist/assets/CardTrail.css +1 -1
  3. package/dist/assets/MultiSelectSearch.css +1 -1
  4. package/dist/assets/Pagination.css +1 -1
  5. package/dist/assets/SelectSearch.css +1 -1
  6. package/dist/assets/Switcher.css +1 -1
  7. package/dist/assets/TabTrail.css +1 -1
  8. package/dist/assets/hooks.css +1 -0
  9. package/dist/{combobox-Dv6-ANkb.js → combobox-fIVOzEhl.js} +6 -6
  10. package/dist/components/Accordion/Accordion.d.ts +6 -0
  11. package/dist/components/Accordion/Accordion.js +202 -182
  12. package/dist/components/AnchorLink/Link.d.ts +2 -0
  13. package/dist/components/AnchorLink/Link.js +54 -42
  14. package/dist/components/CardTrail/CardTrail.js +47 -46
  15. package/dist/components/CardTrail/utils.d.ts +0 -1
  16. package/dist/components/CardTrail/utils.js +7 -8
  17. package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
  18. package/dist/components/DatePicker/DatePicker.d.ts +32 -0
  19. package/dist/components/DatePicker/DatePicker.js +125 -111
  20. package/dist/components/DatePicker/DatePickerModal.d.ts +5 -1
  21. package/dist/components/DatePicker/DatePickerModal.js +97 -75
  22. package/dist/components/DatePicker/MonthPickerModal.d.ts +5 -1
  23. package/dist/components/DatePicker/MonthPickerModal.js +96 -58
  24. package/dist/components/DatePicker/YearPickerModal.d.ts +5 -1
  25. package/dist/components/DatePicker/YearPickerModal.js +75 -57
  26. package/dist/components/Drawer/Drawer.d.ts +7 -1
  27. package/dist/components/Drawer/Drawer.js +122 -106
  28. package/dist/components/Drawer/hooks.d.ts +9 -0
  29. package/dist/components/Drawer/hooks.js +24 -0
  30. package/dist/components/Dropdown/Dropdown.d.ts +18 -1
  31. package/dist/components/Dropdown/Dropdown.js +361 -343
  32. package/dist/components/Dropdown/constants.d.ts +11 -0
  33. package/dist/components/Dropdown/constants.js +5 -0
  34. package/dist/components/Dropdown/hooks.d.ts +19 -0
  35. package/dist/components/Dropdown/hooks.js +11 -0
  36. package/dist/components/Dropdown/index.d.ts +1 -0
  37. package/dist/components/Dropdown/index.js +5 -2
  38. package/dist/components/Image/Image.d.ts +16 -0
  39. package/dist/components/Image/Image.js +65 -37
  40. package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +8 -1
  41. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +461 -302
  42. package/dist/components/MultiSelectSearch/constants.d.ts +6 -0
  43. package/dist/components/MultiSelectSearch/constants.js +7 -5
  44. package/dist/components/MultiSelectSearch/index.d.ts +1 -1
  45. package/dist/components/MultiSelectSearch/index.js +5 -4
  46. package/dist/components/MultiSelectSearch/types.d.ts +33 -1
  47. package/dist/components/MultiSelectSearch/utils.d.ts +1 -0
  48. package/dist/components/MultiSelectSearch/utils.js +31 -17
  49. package/dist/components/Pagination/Pagination.d.ts +23 -0
  50. package/dist/components/Pagination/Pagination.js +137 -99
  51. package/dist/components/RadioGroup/RadioGroup.js +3 -3
  52. package/dist/components/SelectSearch/SelectSearch.d.ts +8 -1
  53. package/dist/components/SelectSearch/SelectSearch.js +381 -220
  54. package/dist/components/SelectSearch/constants.d.ts +6 -0
  55. package/dist/components/SelectSearch/constants.js +3 -2
  56. package/dist/components/SelectSearch/index.d.ts +1 -1
  57. package/dist/components/SelectSearch/index.js +5 -4
  58. package/dist/components/SelectSearch/types.d.ts +32 -1
  59. package/dist/components/SelectSearch/utils.d.ts +2 -0
  60. package/dist/components/SelectSearch/utils.js +28 -14
  61. package/dist/components/Switcher/Switcher.js +66 -59
  62. package/dist/components/Switcher/types.d.ts +1 -0
  63. package/dist/components/TabTrail/TabTrail.d.ts +9 -0
  64. package/dist/components/TabTrail/TabTrail.js +198 -190
  65. package/dist/components/Toasts/ProgressBar.d.ts +4 -2
  66. package/dist/components/Toasts/ProgressBar.js +1 -1
  67. package/dist/components/Toasts/Toast.d.ts +5 -1
  68. package/dist/components/Toasts/Toast.js +59 -44
  69. package/dist/components/Toasts/ToastList.js +1 -1
  70. package/dist/components/Toasts/ToastsProvider.js +1 -1
  71. package/dist/components/index.d.ts +3 -2
  72. package/dist/components/index.js +154 -149
  73. package/dist/{field-BP5-U1Nr.js → field-BLi5834s.js} +2 -2
  74. package/dist/{focus-management-Dp2_vbQ3.js → focus-management-BAl0GmRk.js} +1 -1
  75. package/dist/{hidden-Dn4lM6EL.js → hidden-CkTYbiNM.js} +1 -1
  76. package/dist/hooks/useTimer/index.d.ts +2 -1
  77. package/dist/hooks/useTimer/index.js +55 -41
  78. package/dist/hooks-HgN6Yauq.js +117 -0
  79. package/dist/index.js +182 -177
  80. package/dist/{keyboard-CUMsrFX1.js → keyboard-wis2TUql.js} +2 -2
  81. package/dist/{label-DOlEWXBl.js → label-BmphTIGY.js} +2 -2
  82. package/dist/{open-closed-CkTbpRyi.js → open-closed-CJijMeI2.js} +1 -1
  83. package/dist/{portal-C_u5auU1.js → portal-BnEqSZwo.js} +2 -2
  84. package/dist/{use-active-press-BVQqDQ3V.js → use-active-press-CnDeVvQq.js} +1 -1
  85. package/dist/{use-is-mounted-D7cq4xsa.js → use-is-mounted-MBU4fiLr.js} +1 -1
  86. package/package.json +3 -1
  87. package/dist/ProgressBar-DEFs1tWq.js +0 -55
  88. package/dist/assets/Dropdown.css +0 -1
  89. package/dist/components/Pagination/types.d.ts +0 -0
@@ -6,52 +6,53 @@ import { hasHorizontalScroll as g, isScrollAtEdge as T } from "./utils.js";
6
6
  import { useMergeRefs as Q } from "../../hooks/useMergeRefs/useMergeRefs.js";
7
7
  import { useThrottledCallback as Z } from "../../hooks/useThrottledCallback/index.js";
8
8
  import { MergedButton as rr } from "../MergedButton/MergedButton.js";
9
- import '../../assets/CardTrail.css';const tr = "_pointer_c21mz_49", c = {
10
- "card-trail": "_card-trail_c21mz_3",
11
- "card-trail-header": "_card-trail-header_c21mz_7",
12
- "card-trail-header-title": "_card-trail-header-title_c21mz_15",
13
- "card-trail-header-merged-button": "_card-trail-header-merged-button_c21mz_29",
14
- "card-trail-list": "_card-trail-list_c21mz_32",
15
- "card-trail-list-item": "_card-trail-list-item_c21mz_45",
9
+ import '../../assets/CardTrail.css';const tr = "_pointer_1wzbr_50", i = {
10
+ "card-trail": "_card-trail_1wzbr_3",
11
+ "card-trail-header": "_card-trail-header_1wzbr_7",
12
+ "card-trail-header-title": "_card-trail-header-title_1wzbr_15",
13
+ "card-trail-header-merged-button": "_card-trail-header-merged-button_1wzbr_29",
14
+ "card-trail-list": "_card-trail-list_1wzbr_32",
15
+ "card-trail-list-item": "_card-trail-list-item_1wzbr_46",
16
16
  pointer: tr
17
17
  };
18
18
  let v = {};
19
- const dr = q((D, L) => {
19
+ const dr = q((w, D) => {
20
20
  const {
21
- cardClassName: z,
22
- cardTrailClassName: W,
23
- cardTrailHeaderClassName: A,
24
- cardTrailListClassName: R,
25
- cardTrailMergedButtonClassName: k,
26
- children: p,
27
- title: C,
21
+ cardClassName: L,
22
+ cardTrailClassName: z,
23
+ cardTrailHeaderClassName: W,
24
+ cardTrailListClassName: A,
25
+ cardTrailMergedButtonClassName: R,
26
+ children: b,
27
+ title: p,
28
28
  spaceBetween: o = Y,
29
- scrollStep: B = G,
30
- dividedCardWidth: I = J,
29
+ scrollStep: C = G,
30
+ dividedCardWidth: k = J,
31
31
  currentCardIndex: h = K,
32
- mergedButtonProps: i,
33
- scrollToCard: b = !1,
34
- needButtons: w = !0,
32
+ mergedButtonProps: c,
33
+ scrollToCard: B = !1,
34
+ needButtons: I = !0,
35
35
  padding: l = 0
36
- } = D, r = f(null), N = f(!0), s = f(null), [d, y] = _({
36
+ } = w, r = f(null), N = f(!0), s = f(null), [d, y] = _({
37
37
  leftButton: !0,
38
38
  rightButton: !1
39
39
  }), [M, x] = _(0), [U, E] = _(
40
40
  () => g(r == null ? void 0 : r.current)
41
- ), F = Q(r, L), H = Z(() => {
41
+ ), F = Q(r, D), H = Z(() => {
42
42
  var a;
43
43
  if (N.current) {
44
44
  N.current = !1;
45
45
  const m = r.current, V = ((a = m == null ? void 0 : m.children[h]) == null ? void 0 : a.clientWidth) ?? 0;
46
46
  x(
47
- V / I + l + o
48
- ), v = {
49
- paddingLeft: l,
50
- paddingRight: l,
51
- marginLeft: -l,
52
- marginRight: -l
53
- };
47
+ V / k + l + o
48
+ );
54
49
  }
50
+ v = {
51
+ paddingLeft: l,
52
+ paddingRight: l,
53
+ marginLeft: -l,
54
+ marginRight: -l
55
+ };
55
56
  const t = !T(r.current, "left"), e = !T(r.current, "right");
56
57
  y({
57
58
  leftButton: !t,
@@ -59,7 +60,7 @@ const dr = q((D, L) => {
59
60
  });
60
61
  }, 300), O = (t) => () => {
61
62
  var a;
62
- if (!b)
63
+ if (!B)
63
64
  return;
64
65
  const e = (a = r == null ? void 0 : r.current) == null ? void 0 : a.querySelector(
65
66
  `[data-active-card='${t}']`
@@ -74,7 +75,7 @@ const dr = q((D, L) => {
74
75
  if (!r.current || d.leftButton) return;
75
76
  const t = r.current, e = ((a = t.children[h]) == null ? void 0 : a.clientWidth) ?? 0;
76
77
  t.scrollBy({
77
- left: -(e + o) * B,
78
+ left: -(e + o) * C,
78
79
  behavior: "smooth"
79
80
  });
80
81
  }, j = () => {
@@ -82,7 +83,7 @@ const dr = q((D, L) => {
82
83
  if (!r.current || d.rightButton) return;
83
84
  const t = r.current, e = ((a = t.children[h]) == null ? void 0 : a.clientWidth) ?? 0;
84
85
  t.scrollBy({
85
- left: (e + o) * B,
86
+ left: (e + o) * C,
86
87
  behavior: "smooth"
87
88
  });
88
89
  };
@@ -94,22 +95,22 @@ const dr = q((D, L) => {
94
95
  }), s.current.observe(t), E(g(r == null ? void 0 : r.current)), () => {
95
96
  s.current && s.current.disconnect();
96
97
  };
97
- }, [p]), /* @__PURE__ */ S("section", { className: n(c["card-trail"], W), children: [
98
+ }, [b]), /* @__PURE__ */ S("section", { className: n(i["card-trail"], z), children: [
98
99
  /* @__PURE__ */ S(
99
100
  "header",
100
101
  {
101
102
  className: n(
102
- c["card-trail-header"],
103
- A
103
+ i["card-trail-header"],
104
+ W
104
105
  ),
105
106
  children: [
106
- C && /* @__PURE__ */ u("h3", { className: c["card-trail-header-title"], children: C }),
107
- U && w && /* @__PURE__ */ u(
107
+ p && /* @__PURE__ */ u("h3", { className: i["card-trail-header-title"], children: p }),
108
+ U && I && /* @__PURE__ */ u(
108
109
  rr,
109
110
  {
110
111
  buttonsWrapperClassName: n(
111
- c["card-trail-header-merged-button"],
112
- k
112
+ i["card-trail-header-merged-button"],
113
+ R
113
114
  ),
114
115
  buttons: [
115
116
  {
@@ -119,7 +120,7 @@ const dr = q((D, L) => {
119
120
  onClick: $,
120
121
  disabled: d.leftButton,
121
122
  size: "s",
122
- ...i == null ? void 0 : i.leftButton
123
+ ...c == null ? void 0 : c.leftButton
123
124
  },
124
125
  {
125
126
  isIconButton: !0,
@@ -128,7 +129,7 @@ const dr = q((D, L) => {
128
129
  onClick: j,
129
130
  size: "s",
130
131
  disabled: d.rightButton,
131
- ...i == null ? void 0 : i.rightButton
132
+ ...c == null ? void 0 : c.rightButton
132
133
  }
133
134
  ]
134
135
  }
@@ -145,18 +146,18 @@ const dr = q((D, L) => {
145
146
  scrollPadding: `0 ${M}px`,
146
147
  ...v
147
148
  },
148
- className: n(c["card-trail-list"], R),
149
+ className: n(i["card-trail-list"], A),
149
150
  ref: F,
150
- children: X.map(p, (t, e) => /* @__PURE__ */ u(
151
+ children: X.map(b, (t, e) => /* @__PURE__ */ u(
151
152
  "li",
152
153
  {
153
154
  onClick: O(e),
154
155
  "data-active-card": e,
155
156
  "data-testid": `card-trail-item-${e}`,
156
157
  className: n(
157
- c["card-trail-list-item"],
158
- { [c.pointer]: b },
159
- z
158
+ i["card-trail-list-item"],
159
+ { [i.pointer]: B },
160
+ L
160
161
  ),
161
162
  children: t
162
163
  }
@@ -7,4 +7,3 @@
7
7
  */
8
8
  export declare const isScrollAtEdge: (container: HTMLElement | null, direction: "left" | "right", tolerance?: number) => boolean;
9
9
  export declare const hasHorizontalScroll: (element: HTMLElement | null) => boolean;
10
- export declare const getCardWidth: <E extends Element>(element?: E) => number;
@@ -1,10 +1,9 @@
1
- const o = (t, l, r = 1) => {
2
- if (!t) return !0;
3
- const { scrollLeft: i, scrollWidth: s, clientWidth: c } = t;
4
- return l === "left" ? i <= r : i >= s - c - r;
5
- }, n = (t) => t ? t.scrollWidth > t.clientWidth : !1, d = (t) => t ? t.clientWidth : 0;
1
+ const c = (r, i, t = 1) => {
2
+ if (!r) return !0;
3
+ const { scrollLeft: l, scrollWidth: s, clientWidth: o } = r;
4
+ return i === "left" ? l <= t : l >= s - o - t;
5
+ }, e = (r) => r ? r.scrollWidth > r.clientWidth : !1;
6
6
  export {
7
- d as getCardWidth,
8
- n as hasHorizontalScroll,
9
- o as isScrollAtEdge
7
+ e as hasHorizontalScroll,
8
+ c as isScrollAtEdge
10
9
  };
@@ -1,10 +1,10 @@
1
1
  import { jsxs as L, jsx as p } from "react/jsx-runtime";
2
- import { W as O, p as V, o as d, $ as W, b as X, D as q, H as z, c as D } from "../../keyboard-CUMsrFX1.js";
2
+ import { W as O, p as V, o as d, $ as W, b as X, D as q, H as z, c as D } from "../../keyboard-wis2TUql.js";
3
3
  import h, { useId as J, useState as Q, useMemo as Y, useCallback as Z, forwardRef as ee } from "react";
4
- import { w as re } from "../../use-active-press-BVQqDQ3V.js";
5
- import { u as ae, a as oe, b as te, T as ce, I as ne, G as se, j as ie, p as le, K as de } from "../../label-DOlEWXBl.js";
4
+ import { w as re } from "../../use-active-press-CnDeVvQq.js";
5
+ import { u as ae, a as oe, b as te, T as ce, I as ne, G as se, j as ie, p as le, K as de } from "../../label-BmphTIGY.js";
6
6
  import { r as be } from "../../bugs-diTMAGNw.js";
7
- import { H as ue } from "../../field-BP5-U1Nr.js";
7
+ import { H as ue } from "../../field-BLi5834s.js";
8
8
  import { c as me } from "../../index-DIxK0V-G.js";
9
9
  import { Icon as fe } from "../../icons/Icon.js";
10
10
  import '../../assets/CheckboxMimir.css';let pe = "span";
@@ -49,6 +49,22 @@ export type TProps = {
49
49
  * Флаг отправки промежуточных значений в родительский компонент
50
50
  */
51
51
  sendIntermediateValues?: boolean;
52
+ /**
53
+ * Флаг отключения выбора будущих дат
54
+ */
55
+ disableFuture?: boolean;
56
+ /**
57
+ * Флаг отключения выбора прошлых дат
58
+ */
59
+ disablePast?: boolean;
60
+ /**
61
+ * Функция для определения недоступных дат
62
+ */
63
+ disabledDate?: (date: Date) => boolean;
64
+ /**
65
+ * Диапазон доступных дат [от, до]
66
+ */
67
+ validRange?: [Date | string, Date | string];
52
68
  } & TInputProps;
53
69
  export type TDatePickerValue = {
54
70
  value?: string;
@@ -107,4 +123,20 @@ export declare const DatePicker: import('react').MemoExoticComponent<import('rea
107
123
  * Флаг отправки промежуточных значений в родительский компонент
108
124
  */
109
125
  sendIntermediateValues?: boolean;
126
+ /**
127
+ * Флаг отключения выбора будущих дат
128
+ */
129
+ disableFuture?: boolean;
130
+ /**
131
+ * Флаг отключения выбора прошлых дат
132
+ */
133
+ disablePast?: boolean;
134
+ /**
135
+ * Функция для определения недоступных дат
136
+ */
137
+ disabledDate?: (date: Date) => boolean;
138
+ /**
139
+ * Диапазон доступных дат [от, до]
140
+ */
141
+ validRange?: [Date | string, Date | string];
110
142
  } & import('../Input/types').TInputProps & import('../Input').TAdditionalProps & import('react').RefAttributes<HTMLInputElement>>>;
@@ -1,164 +1,178 @@
1
- import { jsxs as R, jsx as o } from "react/jsx-runtime";
2
- import { c as u } from "../../index-DIxK0V-G.js";
3
- import { memo as tt, forwardRef as st, useState as w, useEffect as x } from "react";
4
- import { MAX_DAY as et, MAX_MONTH as it, DATE_LENGTH as rt } from "./constants.js";
5
- import { DatePickerModal as ct } from "./DatePickerModal.js";
6
- import { MonthPickerModal as at } from "./MonthPickerModal.js";
1
+ import { jsxs as E, jsx as m } from "react/jsx-runtime";
2
+ import { c as Y } from "../../index-DIxK0V-G.js";
3
+ import { memo as ot, forwardRef as ct, useState as N, useEffect as v } from "react";
4
+ import { MAX_DAY as at, MAX_MONTH as mt, DATE_LENGTH as ft } from "./constants.js";
5
+ import { DatePickerModal as pt } from "./DatePickerModal.js";
6
+ import { MonthPickerModal as dt } from "./MonthPickerModal.js";
7
7
  import { c as e } from "../../styles.module-Cuqm31CO.js";
8
- import { formatDatePart as U } from "./utils.js";
9
- import { YearPickerModal as ot } from "./YearPickerModal.js";
10
- import { useClickOutside as mt } from "../../hooks/useClickOutside/useClickOutside.js";
11
- import { Icon as X } from "../../icons/Icon.js";
12
- import { formating as n } from "../../utils/index.js";
13
- import { I as pt } from "../../Input-BU_6U1CW.js";
14
- import { EInputStatus as dt, EInputSize as E } from "../Input/constants.js";
15
- const ft = {
16
- days: ct,
17
- months: at,
18
- years: ot
19
- }, yt = tt(
20
- st(
8
+ import { formatDatePart as F } from "./utils.js";
9
+ import { YearPickerModal as yt } from "./YearPickerModal.js";
10
+ import { useClickOutside as nt } from "../../hooks/useClickOutside/useClickOutside.js";
11
+ import { Icon as G } from "../../icons/Icon.js";
12
+ import { formating as D } from "../../utils/index.js";
13
+ import { I as lt } from "../../Input-BU_6U1CW.js";
14
+ import { EInputStatus as Dt, EInputSize as K } from "../Input/constants.js";
15
+ const wt = {
16
+ days: pt,
17
+ months: dt,
18
+ years: yt
19
+ }, Nt = ot(
20
+ ct(
21
21
  ({
22
- size: S,
22
+ size: $,
23
23
  value: i,
24
- onChangeValue: t,
24
+ onChangeValue: s,
25
25
  name: c,
26
- before: $,
27
- type: p = "days",
28
- error: _,
29
- onError: d,
26
+ before: _,
27
+ type: d = "days",
28
+ error: j,
29
+ onError: y,
30
30
  onBlur: r,
31
- validateImmediately: O,
32
- variant: F,
33
- disabled: g = !1,
34
- editable: D = !1,
35
- openOnInput: Y = !0,
36
- sendIntermediateValues: G = !1,
37
- ...k
38
- }, K) => {
39
- const [A, m] = w(!1), [j, f] = w(p), [a, I] = w(
31
+ validateImmediately: g,
32
+ variant: W,
33
+ disabled: b = !1,
34
+ editable: k = !1,
35
+ openOnInput: H = !0,
36
+ sendIntermediateValues: q = !1,
37
+ disableFuture: J = !1,
38
+ disablePast: Q = !1,
39
+ disabledDate: Z,
40
+ validRange: f,
41
+ ...A
42
+ }, z) => {
43
+ const [I, p] = N(!1), [h, n] = N(d), [a, P] = N(
40
44
  () => i && !isNaN(new Date(i).getTime()) ? new Date(i) : void 0
41
- ), [P, b] = w(_), [W, T] = w("");
42
- k.status = !!P && dt.Error || k.status, x(() => {
43
- b(_);
44
- }, [_]), x(() => {
45
- I(
45
+ ), [T, u] = N(j), [R, M] = N("");
46
+ A.status = !!T && Dt.Error || A.status, v(() => {
47
+ u(j);
48
+ }, [j]), v(() => {
49
+ P(
46
50
  i && !isNaN(new Date(i).getTime()) ? new Date(i) : void 0
47
51
  );
48
- }, [i]), x(() => {
49
- a && typeof a != "string" && !isNaN(a == null ? void 0 : a.getTime()) ? T(n.Date(a, "dd/mm/yyyy")) : T("");
52
+ }, [i]), v(() => {
53
+ a && typeof a != "string" && !isNaN(a == null ? void 0 : a.getTime()) ? M(D.Date(a, "dd/mm/yyyy")) : M("");
50
54
  }, [a]);
51
- const H = i && new Date(i).getTime;
52
- x(() => {
53
- O && (H ? (b(!1), d == null || d({ name: c, active: !1 })) : (b(!0), d == null || d({ name: c, active: !0 })));
54
- }, [O, c, H]), mt({
55
- isActive: A,
56
- setActive: (s) => {
57
- m(s), f(p);
55
+ const L = i && new Date(i).getTime;
56
+ v(() => {
57
+ g && (L ? (u(!1), y == null || y({ name: c, active: !1 })) : (u(!0), y == null || y({ name: c, active: !0 })));
58
+ }, [g, c, L]), nt({
59
+ isActive: I,
60
+ setActive: (t) => {
61
+ p(t), n(d);
58
62
  },
59
63
  className: e["calendar-block"]
60
64
  });
61
- const q = () => {
62
- !g && (Y || !D) && m(!0);
63
- }, J = (s) => {
64
- isNaN(s.getTime()) || (I(s), t == null || t({
65
- value: n.Date(s, "yyyy-mm-dd"),
65
+ const C = () => {
66
+ !b && (H || !k) && p(!0);
67
+ }, B = (t) => {
68
+ isNaN(t.getTime()) || (P(t), s == null || s({
69
+ value: D.Date(t, "yyyy-mm-dd"),
66
70
  name: c
67
- })), j === "years" && (p === "years" ? (m(!1), f(p)) : f("months")), j === "months" && (p === "months" ? (m(!1), f(p)) : f("days")), I(s), t == null || t({
68
- value: n.Date(s, "yyyy-mm-dd"),
71
+ })), h === "years" && (d === "years" ? (p(!1), n(d)) : n("months")), h === "months" && (d === "months" ? (p(!1), n(d)) : n("days")), P(t), s == null || s({
72
+ value: D.Date(t, "yyyy-mm-dd"),
69
73
  name: c
70
- }), r == null || r(n.Date(s, "yyyy-mm-dd"));
71
- }, Q = (s) => {
72
- if (D) {
73
- const l = s.target.value.replace(/[^\d]/g, "");
74
- if (l.length === 0)
75
- T(""), t == null || t({ value: "", name: c }), r == null || r("");
74
+ }), r == null || r(D.Date(t, "yyyy-mm-dd"));
75
+ }, V = (t) => {
76
+ if (k) {
77
+ const o = t.target.value.replace(/[^\d]/g, "");
78
+ if (o.length === 0)
79
+ M(""), s == null || s({ value: "", name: c }), r == null || r("");
76
80
  else {
77
- const [y, M, N] = [
78
- U(l.substring(0, 2), et),
79
- U(l.substring(2, 4), it),
80
- l.substring(4, 8)
81
- ], L = [y, M, N].filter(Boolean).join("/");
82
- if (T(L), G) {
83
- const h = N ? `${N}-${M || "00"}-${y || "00"}` : [y, M, N].filter(Boolean).join("-");
84
- t == null || t({
85
- value: h,
81
+ const [l, x, w] = [
82
+ F(o.substring(0, 2), at),
83
+ F(o.substring(2, 4), mt),
84
+ o.substring(4, 8)
85
+ ], X = [l, x, w].filter(Boolean).join("/");
86
+ if (M(X), q) {
87
+ const O = w ? `${w}-${x || "00"}-${l || "00"}` : [l, x, w].filter(Boolean).join("-");
88
+ s == null || s({
89
+ value: O,
86
90
  name: c
87
91
  });
88
92
  }
89
- if (L.length === rt) {
90
- const h = parseInt(N), v = /* @__PURE__ */ new Date(
91
- `${h}-${M.padStart(2, "0")}-${y.padStart(2, "0")}`
93
+ if (X.length === ft) {
94
+ const O = parseInt(w), S = /* @__PURE__ */ new Date(
95
+ `${O}-${x.padStart(2, "0")}-${l.padStart(2, "0")}`
92
96
  );
93
- isNaN(v.getTime()) || (I(v), t == null || t({
94
- value: n.Date(v, "yyyy-mm-dd"),
97
+ isNaN(S.getTime()) || (P(S), s == null || s({
98
+ value: D.Date(S, "yyyy-mm-dd"),
95
99
  name: c
96
- }), r == null || r(n.Date(v, "yyyy-mm-dd")));
100
+ }), r == null || r(D.Date(S, "yyyy-mm-dd")));
97
101
  }
98
102
  }
99
103
  }
100
- }, Z = u(e.wrapper, A && e.active), z = u(e.input, e.inputBorderControl), C = {
101
- onChangeValue: J,
104
+ }, tt = Y(e.wrapper, I && e.active), st = Y(e.input, e.inputBorderControl);
105
+ let U;
106
+ if (f) {
107
+ let t, o;
108
+ typeof f[0] == "string" ? t = new Date(f[0]) : t = f[0], typeof f[1] == "string" ? o = new Date(f[1]) : o = f[1], U = [t, o];
109
+ }
110
+ const et = {
111
+ onChangeValue: B,
102
112
  date: a || /* @__PURE__ */ new Date(),
103
- before: typeof $ == "string" ? new Date($) : $,
104
- onChangeType: f,
105
- setIsActive: m
106
- }, B = ft[j], V = ({ isActive: s }) => /* @__PURE__ */ o("button", { onClick: (y) => {
107
- y.stopPropagation(), g || m(!s);
108
- }, className: e["icon-button"], children: s ? /* @__PURE__ */ o(
109
- X,
113
+ before: typeof _ == "string" ? new Date(_) : _,
114
+ onChangeType: n,
115
+ setIsActive: p,
116
+ disableFuture: J,
117
+ disablePast: Q,
118
+ disabledDate: Z,
119
+ validRange: U
120
+ }, it = wt[h], rt = ({ isActive: t }) => /* @__PURE__ */ m("button", { onClick: (l) => {
121
+ l.stopPropagation(), b || p(!t);
122
+ }, className: e["icon-button"], children: t ? /* @__PURE__ */ m(
123
+ G,
110
124
  {
111
- iconName: S === E.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
125
+ iconName: $ === K.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
112
126
  }
113
- ) : /* @__PURE__ */ o(
114
- X,
127
+ ) : /* @__PURE__ */ m(
128
+ G,
115
129
  {
116
- iconName: S === E.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
130
+ iconName: $ === K.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
117
131
  }
118
132
  ) });
119
- return /* @__PURE__ */ R("div", { className: e["input-field-group-datePicker"], children: [
120
- /* @__PURE__ */ R("div", { className: Z, "data-disabled": g, children: [
121
- /* @__PURE__ */ o(
133
+ return /* @__PURE__ */ E("div", { className: e["input-field-group-datePicker"], children: [
134
+ /* @__PURE__ */ E("div", { className: tt, "data-disabled": b, children: [
135
+ /* @__PURE__ */ m(
122
136
  "div",
123
137
  {
124
138
  role: "button",
125
- "data-status": k.status,
126
- className: u(e["date-wrapper"], {
127
- [e.editable]: D
139
+ "data-status": A.status,
140
+ className: Y(e["date-wrapper"], {
141
+ [e.editable]: k
128
142
  }),
129
- onClick: q,
130
- children: /* @__PURE__ */ o(
131
- pt,
143
+ onClick: C,
144
+ children: /* @__PURE__ */ m(
145
+ lt,
132
146
  {
133
- ref: K,
134
- className: z,
147
+ ref: z,
148
+ className: st,
135
149
  wrapperClassName: e["input-wrapper"],
136
- size: S,
150
+ size: $,
137
151
  type: "text",
138
- variant: F,
139
- value: W,
140
- onChange: Q,
152
+ variant: W,
153
+ value: R,
154
+ onChange: V,
141
155
  rightAddon: {
142
156
  addonType: "react-node",
143
- addonContent: /* @__PURE__ */ o(V, { isActive: A })
157
+ addonContent: /* @__PURE__ */ m(rt, { isActive: I })
144
158
  },
145
159
  rightSlotClassName: e["right-slot"],
146
160
  onFocus: () => {
147
- Y && !D && m(!0);
161
+ H && !k && p(!0);
148
162
  },
149
- ...k
163
+ ...A
150
164
  }
151
165
  )
152
166
  }
153
167
  ),
154
- A && /* @__PURE__ */ o(B, { ...C })
168
+ I && /* @__PURE__ */ m(it, { ...et })
155
169
  ] }),
156
- P && typeof P == "string" && /* @__PURE__ */ o("div", { className: e.textError, children: P })
170
+ T && typeof T == "string" && /* @__PURE__ */ m("div", { className: e.textError, children: T })
157
171
  ] });
158
172
  }
159
173
  )
160
174
  );
161
- yt.displayName = "DatePicker";
175
+ Nt.displayName = "DatePicker";
162
176
  export {
163
- yt as DatePicker
177
+ Nt as DatePicker
164
178
  };
@@ -4,6 +4,10 @@ type TProps = {
4
4
  onChangeValue: (date: Date) => void;
5
5
  setIsActive: (isActive: boolean) => void;
6
6
  onChangeType?: (s: 'days' | 'months' | 'years') => void;
7
+ disableFuture?: boolean;
8
+ disablePast?: boolean;
9
+ disabledDate?: (date: Date) => boolean;
10
+ validRange?: [Date, Date];
7
11
  };
8
- export declare const DatePickerModal: ({ date, onChangeValue, setIsActive, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const DatePickerModal: ({ date, onChangeValue, setIsActive, before, onChangeType, disableFuture, disablePast, disabledDate, validRange }: TProps) => import("react/jsx-runtime").JSX.Element;
9
13
  export {};