urfu-ui-kit-react 2.1.7-next.1 → 2.1.7-next.3

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 (66) hide show
  1. package/README.md +2 -2
  2. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  3. package/dist/components/Calendar/Calendar.js +232 -194
  4. package/dist/components/Calendar/Calendar.types.d.ts +21 -0
  5. package/dist/components/Calendar/Calendar.types.d.ts.map +1 -1
  6. package/dist/components/Calendar/CalendarSelect.js +38 -38
  7. package/dist/components/Calendar/MaskedDateInput.d.ts +2 -0
  8. package/dist/components/Calendar/MaskedDateInput.d.ts.map +1 -1
  9. package/dist/components/Calendar/MaskedDateInput.js +120 -113
  10. package/dist/components/ColumnSettings/ColumnSettings.d.ts.map +1 -1
  11. package/dist/components/ColumnSettings/ColumnSettings.js +22 -21
  12. package/dist/components/ConfirmModal/ConfirmModal.d.ts +0 -1
  13. package/dist/components/ConfirmModal/ConfirmModal.d.ts.map +1 -1
  14. package/dist/components/ConfirmModal/ConfirmModal.js +11 -12
  15. package/dist/components/Drawer/Drawer.d.ts.map +1 -1
  16. package/dist/components/Drawer/Drawer.js +23 -22
  17. package/dist/components/ErrorScreen/ErrorScreen.js +117 -115
  18. package/dist/components/ErrorScreen/ErrorScreenIllustration.js +28 -28
  19. package/dist/components/InputExpandTextarea/InputExpandTextarea.js +1 -1
  20. package/dist/components/InputTime/InputTime.js +12 -12
  21. package/dist/components/Menu/Menu.js +11 -11
  22. package/dist/components/Modal/Modal.js +33 -33
  23. package/dist/components/Pagination/Pagination.js +22 -22
  24. package/dist/components/Preloader/Preloader.d.ts.map +1 -1
  25. package/dist/components/Preloader/Preloader.js +13 -13
  26. package/dist/components/Search/Search.d.ts.map +1 -1
  27. package/dist/components/Search/Search.js +28 -23
  28. package/dist/components/Select/Select.d.ts +2 -0
  29. package/dist/components/Select/Select.d.ts.map +1 -1
  30. package/dist/components/Select/Select.js +21 -19
  31. package/dist/components/Switch/Switch.d.ts.map +1 -1
  32. package/dist/components/Switch/Switch.js +8 -8
  33. package/dist/components/Table/Filter/FilterStringBox.js +8 -8
  34. package/dist/components/Table/Filter/SelectFilter.d.ts.map +1 -1
  35. package/dist/components/Table/Filter/SelectFilter.js +24 -22
  36. package/dist/components/Table/Filter/useFilterOptionsPreload.js +2 -2
  37. package/dist/components/Table/Table.types.d.ts +1 -1
  38. package/dist/components/Table/Table.types.d.ts.map +1 -1
  39. package/dist/components/Table/TableHead.js +6 -6
  40. package/dist/components/Table/TableMobileCard.d.ts.map +1 -1
  41. package/dist/components/Table/TableMobileCard.js +27 -26
  42. package/dist/components/Table/TableMobileView.js +46 -46
  43. package/dist/components/Table/TableRow.js +1 -1
  44. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  45. package/dist/components/Tabs/Tabs.js +25 -24
  46. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  47. package/dist/components/Tooltip/Tooltip.js +37 -36
  48. package/dist/dev/index.js +16 -16
  49. package/dist/dev/types/vanilla/src/dev/panelStyles.d.ts +1 -1
  50. package/dist/hooks/useAutoId.js +3 -3
  51. package/dist/index.d.ts +4 -4
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/shared/kitCopy.js +1 -1
  54. package/dist/shared/kitRegistry.d.ts +2 -2
  55. package/dist/shared/optionStateColors.d.ts +2 -2
  56. package/dist/shared/optionStateColors.js +4 -4
  57. package/dist/style-no-fonts.css +1 -1
  58. package/dist/style.css +1 -1
  59. package/dist/style.layer.css +2 -2
  60. package/dist/style.shell.css +3 -3
  61. package/dist/urfu-ui-kit-react.js +12 -12
  62. package/dist/utils/describeError.d.ts +27 -0
  63. package/dist/utils/describeError.d.ts.map +1 -1
  64. package/dist/vanilla/core/dateMask.js +1 -1
  65. package/dist/vanilla/core/describeError.js +42 -37
  66. package/package.json +1 -1
package/README.md CHANGED
@@ -90,9 +90,9 @@ npm run docsb
90
90
  1. Обновить историю версий и документацию затронутых компонентов.
91
91
  2. Проверить lint, тесты, сборку библиотеки и документации; проверить локальные tarball в потребителях.
92
92
  3. Vanilla берётся из соседней папки монорепозитория `packages/vanilla` и собирается внутрь пакета: зависимости `urfu-ui-kit-vanilla` нет, в npm vanilla отдельно не выходит (с 20.10.2026). Собирать и тестировать кит — только в полном checkout монорепозитория.
93
- 4. Публикацию выполняет владелец выпуска. Обновление документации само по себе не меняет версию пакета.
93
+ 4. Публикацию выполняет CI: версию поднимают вручную в `package.json` и `docs/versioning.md` и вливают в `main`, CI кладёт её в очередь npm, владелец пакета в npm подтверждает с 2FA, затем CI ставит тег `react-vX.Y.Z` и выкладывает документацию — [docs/ci.md](../../docs/ci.md#выпуск-версии). Обновление документации само по себе не меняет версию пакета.
94
94
 
95
- Версию поднимают вручную в `package.json` и `docs/versioning.md` и коммитят. `npm run pub` номер не меняет: прогоняет тесты, сборку и контракт пакета, публикует версию из `package.json` и ставит тег `react-vX.Y.Z`; повторный запуск после сбоя публикует ту же версию. `npm run pub:next` — то же для предварительной версии `X.Y.Z-next.N` с тегом `next`.
95
+ Запасной путь, если CI недоступен, — `npm run pub` в этой папке. Он номер не меняет: прогоняет тесты, сборку и контракт пакета, публикует версию из `package.json` и ставит тег `react-vX.Y.Z`; повторный запуск после сбоя публикует ту же версию. `npm run pub:next` — то же для предварительной версии `X.Y.Z-next.N` с тегом `next`.
96
96
 
97
97
  **Важно:** это публичная библиотека; все изменения API ломают потребителей (meetings, youth-science, kpis-npr). Избегайте breaking changes без координации.
98
98
 
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8F,MAAM,OAAO,CAAC;AAInH,OAAO,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAwB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AASjF,OAAO,iBAAiB,CAAC;AAgEzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsZjD,CAAC"}
1
+ {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/Calendar/Calendar.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8F,MAAM,OAAO,CAAC;AAInH,OAAO,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAwB,kBAAkB,EAAiB,MAAM,kBAAkB,CAAC;AAShG,OAAO,iBAAiB,CAAC;AAgEzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkejD,CAAC"}
@@ -1,40 +1,42 @@
1
- import { jsx as r, jsxs as h, Fragment as Se } from "react/jsx-runtime";
2
- import { getFieldAccessibility$u as De } from "../../shared/fieldAccessibility.js";
3
- import { useRef as Ie, useState as f, useInsertionEffect as Oe, useEffect as O, useMemo as Pe, useContext as Me, createContext as ze } from "react";
4
- import { createPortal as Ae } from "react-dom";
5
- import Ne, { registerLocale$u as Ee } from "../../vendor/react-datepicker/dist/es/index.js";
1
+ import { jsx as o, jsxs as P, Fragment as ze } from "react/jsx-runtime";
2
+ import { getFieldAccessibility$u as We } from "../../shared/fieldAccessibility.js";
3
+ import { useRef as ne, useState as v, useInsertionEffect as Ge, useEffect as _, useMemo as F, useContext as Ve, createContext as Ke } from "react";
4
+ import { createPortal as Ye } from "react-dom";
5
+ import Je, { registerLocale$u as Qe } from "../../vendor/react-datepicker/dist/es/index.js";
6
6
  /* empty css */
7
- import { MaskedDateInput$u as $e } from "./MaskedDateInput.js";
8
- import { Tooltip$u as je } from "../Tooltip/Tooltip.js";
9
- import { ru$u as Fe } from "../../vendor/date-fns/locale/ru.js";
7
+ import { MaskedDateInput$u as Xe } from "./MaskedDateInput.js";
8
+ import { Tooltip$u as Ze } from "../Tooltip/Tooltip.js";
9
+ import { ru$u as Ue } from "../../vendor/date-fns/locale/ru.js";
10
10
  /* empty css */
11
- import { useMountTransition$u as Le } from "../../hooks/useMountTransition.js";
12
- import { POPUP_TRANSITION_MS$u as Te } from "../../shared/popupTransition.js";
13
- import { useAutoId$u as Re } from "../../hooks/useAutoId.js";
14
- import { isCompact$u as _e, sizeClassName$u as qe } from "../../shared/size.js";
15
- import { getPortalScopeProps$u as Be } from "../../shared/uiKitDefaults.js";
16
- import { CalendarSelect$u as G } from "./CalendarSelect.js";
17
- import { resolveValidation$u as We } from "../../vanilla/core/validation.js";
18
- import { getYear$u as P } from "../../vendor/date-fns/getYear.js";
19
- import { getMonth$u as Ge } from "../../vendor/date-fns/getMonth.js";
20
- Ee(
11
+ import { useMountTransition$u as Re } from "../../hooks/useMountTransition.js";
12
+ import { POPUP_TRANSITION_MS$u as et } from "../../shared/popupTransition.js";
13
+ import { useAutoId$u as tt } from "../../hooks/useAutoId.js";
14
+ import { isCompact$u as rt, sizeClassName$u as ot } from "../../shared/size.js";
15
+ import { getPortalScopeProps$u as nt } from "../../shared/uiKitDefaults.js";
16
+ import { CalendarSelect$u as ae } from "./CalendarSelect.js";
17
+ import { resolveValidation$u as at } from "../../vanilla/core/validation.js";
18
+ import { getYear$u as B } from "../../vendor/date-fns/getYear.js";
19
+ import { getMonth$u as it } from "../../vendor/date-fns/getMonth.js";
20
+ import { differenceInCalendarDays$u as ie } from "../../vendor/date-fns/differenceInCalendarDays.js";
21
+ import { isSameDay$u as lt } from "../../vendor/date-fns/isSameDay.js";
22
+ Qe(
21
23
  "ru",
22
- Fe
24
+ Ue
23
25
  );
24
- const H = (a) => {
25
- if (!a) return null;
26
- const l = new Date(a);
27
- return l.setHours(12, 0, 0, 0), l;
26
+ const b = (c) => {
27
+ if (!c) return null;
28
+ const u = new Date(c);
29
+ return u.setHours(12, 0, 0, 0), u;
28
30
  };
29
- function He(a, l, w = 1) {
31
+ function ct(c, u, N = 1) {
30
32
  return {
31
33
  *[Symbol.iterator]() {
32
- for (let s = a; s < l; s += w)
33
- yield s;
34
+ for (let p = c; p < u; p += N)
35
+ yield p;
34
36
  }
35
37
  };
36
38
  }
37
- const x = [
39
+ const O = [
38
40
  "Январь",
39
41
  "Февраль",
40
42
  "Март",
@@ -47,125 +49,161 @@ const x = [
47
49
  "Октябрь",
48
50
  "Ноябрь",
49
51
  "Декабрь"
50
- ], Ve = [
51
- ...He(P(/* @__PURE__ */ new Date()) - 100, P(/* @__PURE__ */ new Date()) + 15, 1)
52
- ], V = ze(null), Ye = ({ children: a }) => {
53
- const l = Me(V);
54
- return l ? Ae(/* @__PURE__ */ r("div", { children: a }), l) : /* @__PURE__ */ r(Se, { children: a });
55
- }, mt = ({
56
- "aria-label": a,
57
- "aria-labelledby": l,
58
- "aria-describedby": w,
59
- title: s = "",
60
- selected: g,
61
- onChange: d,
62
- isFilter: Y,
63
- placeholder: J = "Выберите дату",
64
- inline: k,
65
- portalOn: M = !1,
66
- open: z,
67
- greyIcon: K,
68
- isClearable: y,
69
- setOptionState: A,
70
- tableView: N,
71
- size: E,
72
- id: Q,
73
- required: $ = !1,
74
- validationText: X = "Заполните поле",
75
- validationOn: Z,
76
- error: U,
77
- validationOnWithoutText: ee,
78
- absoluteValidationText: te,
79
- lineUp: C = !1,
80
- rowGap: re = 4,
81
- columnGap: oe = 20,
82
- styleInputContainer: ie,
83
- styleTitle: ne,
84
- disabled: j,
85
- wheelEdit: ae = !1,
86
- showHint: le = !1,
87
- hintText: ce = "Используйте колесо мыши или стрелки ↑↓ для изменения значения",
88
- tooltipMaxWidth: se = 300
52
+ ], st = [
53
+ ...ct(B(/* @__PURE__ */ new Date()) - 100, B(/* @__PURE__ */ new Date()) + 15, 1)
54
+ ], le = Ke(null), ut = ({ children: c }) => {
55
+ const u = Ve(le);
56
+ return u ? Ye(/* @__PURE__ */ o("div", { children: c }), u) : /* @__PURE__ */ o(ze, { children: c });
57
+ }, Tt = ({
58
+ "aria-label": c,
59
+ "aria-labelledby": u,
60
+ "aria-describedby": N,
61
+ title: p = "",
62
+ selected: T,
63
+ onChange: f,
64
+ range: d = !1,
65
+ startDate: H,
66
+ endDate: q,
67
+ onRangeChange: A,
68
+ isFilter: ce,
69
+ placeholder: se,
70
+ inline: E,
71
+ portalOn: z = !1,
72
+ open: W,
73
+ greyIcon: ue,
74
+ isClearable: x,
75
+ setOptionState: G,
76
+ tableView: V,
77
+ size: K,
78
+ id: de,
79
+ required: Y = !1,
80
+ validationText: pe = "Заполните поле",
81
+ validationOn: me,
82
+ error: fe,
83
+ validationOnWithoutText: ye,
84
+ absoluteValidationText: ve,
85
+ lineUp: $ = !1,
86
+ rowGap: be = 4,
87
+ columnGap: he = 20,
88
+ styleInputContainer: ge,
89
+ styleTitle: xe,
90
+ disabled: J,
91
+ wheelEdit: we = !1,
92
+ showHint: ke = !1,
93
+ hintText: Ce = "Используйте колесо мыши или стрелки ↑↓ для изменения значения",
94
+ tooltipMaxWidth: De = 300
89
95
  }) => {
90
- const ue = _e(E, N), de = qe(E, N), b = We({ error: U, validationOn: Z, validationOnWithoutText: ee, validationText: X }), u = Re(Q, "u-calendar"), F = `u-calendar-portal-${u}`, S = Ie(null), [pe] = f(
96
+ const Se = rt(K, V), Ie = ot(K, V), w = at({ error: fe, validationOn: me, validationOnWithoutText: ye, validationText: pe }), m = tt(de, "u-calendar"), Q = `u-calendar-portal-${m}`, j = ne(null), X = ne(null), [Me] = v(
91
97
  () => typeof document > "u" ? null : document.createElement("div")
92
- ), i = M && !k ? pe : null, v = De(u, s, $, b, {
93
- "aria-label": a,
94
- "aria-labelledby": l,
95
- "aria-describedby": w
96
- }), [m, D] = f(!1), {
97
- shouldRender: I,
98
- status: me,
99
- isAnimated: fe
100
- } = Le({
101
- isOpen: !!(z || m),
102
- duration: Te
103
- }), ye = fe && me === "exiting";
104
- Oe(() => {
105
- if (!i || !I) return;
106
- i.id = F;
107
- const e = Be()["data-u-kit"];
108
- return e ? i.setAttribute("data-u-kit", e) : i.removeAttribute("data-u-kit"), document.body.appendChild(i), () => i.remove();
109
- }, [i, I, F]);
110
- const [L, p] = f(null), [be, ve] = f(!1), [he, xe] = f(!1);
111
- O(() => {
98
+ ), a = z && !E ? Me : null, k = We(m, p, Y, w, {
99
+ "aria-label": c,
100
+ "aria-labelledby": u,
101
+ "aria-describedby": N
102
+ }), [h, C] = v(!1), {
103
+ shouldRender: D,
104
+ status: Pe,
105
+ isAnimated: _e
106
+ } = Re({
107
+ isOpen: !!(W || h),
108
+ duration: et
109
+ }), Oe = _e && Pe === "exiting";
110
+ Ge(() => {
111
+ if (!a || !D) return;
112
+ a.id = Q;
113
+ const e = nt()["data-u-kit"];
114
+ return e ? a.setAttribute("data-u-kit", e) : a.removeAttribute("data-u-kit"), document.body.appendChild(a), () => a.remove();
115
+ }, [a, D, Q]);
116
+ const [Z, y] = v(null), [Ne, Te] = v(!1), [Ae, Ee] = v(!1);
117
+ _(() => {
112
118
  const e = () => {
113
- xe(window.innerWidth <= 900);
119
+ Ee(window.innerWidth <= 900);
114
120
  };
115
121
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
116
122
  }, []);
117
- const T = Pe(() => H(g), [g]), R = (e, t) => {
118
- const n = (t == null ? void 0 : t.type) === "click" || (t == null ? void 0 : t.type) === "keydown" ? "calendar" : "input";
123
+ const U = F(() => b(T), [T]), R = (e, t) => {
124
+ const r = (t == null ? void 0 : t.type) === "click" || (t == null ? void 0 : t.type) === "keydown" ? "calendar" : "input";
119
125
  if (!e) {
120
- d == null || d("", { source: n });
126
+ f == null || f("", { source: r });
121
127
  return;
122
128
  }
123
- const c = H(e);
124
- d == null || d(c, { source: n });
129
+ const i = b(e);
130
+ f == null || f(i, { source: r });
131
+ }, l = F(() => b(H), [H]), s = F(() => b(q), [q]), $e = (e, t) => {
132
+ var M;
133
+ const r = (t == null ? void 0 : t.type) === "click" || (t == null ? void 0 : t.type) === "keydown" ? "calendar" : "input", [i, g] = e ?? [null, null];
134
+ A == null || A([b(i), b(g)], { source: r }), r === "calendar" && i && g && C(!1);
135
+ const I = g ?? i;
136
+ r === "input" && I && ((M = X.current) == null || M.setPreSelection(I));
125
137
  };
126
- O(() => {
138
+ _(() => {
127
139
  const e = (t) => {
128
- const n = S.current, c = n == null ? void 0 : n.querySelector(":scope > div > div > input");
129
- m && (c && c.focus(), n && !n.contains(t.target) && !(i != null && i.contains(t.target)) && (D(!1), c && c.blur()));
140
+ const r = j.current, i = r == null ? void 0 : r.querySelector(":scope > div > div > input");
141
+ h && (i && i.focus(), r && !r.contains(t.target) && !(a != null && a.contains(t.target)) && (C(!1), i && i.blur()));
130
142
  };
131
143
  return document.addEventListener("click", e), () => {
132
144
  document.removeEventListener("click", e);
133
145
  };
134
- }, [m, i]), O(() => {
146
+ }, [h, a]), _(() => {
135
147
  var e;
136
- if (y) {
137
- const t = ((e = S.current) == null ? void 0 : e.querySelectorAll(".react-datepicker__close-icon")) ?? [];
138
- for (const n of t)
139
- n.innerHTML = '<i class="u-selectbox-select-icon-cross u-calendar-clear-icon"></i>';
148
+ if (x) {
149
+ const t = ((e = j.current) == null ? void 0 : e.querySelectorAll(".react-datepicker__close-icon")) ?? [];
150
+ for (const r of t)
151
+ r.innerHTML = '<i class="u-selectbox-select-icon-cross u-calendar-clear-icon"></i>';
140
152
  }
141
- }, [g]);
142
- const _ = (e) => typeof e == "number" ? `calc(${e} * var(--u-preset-unit, 1px))` : String(e), we = (e) => typeof e == "number" ? `calc(${e} * var(--u-unit, 1px))` : String(e), q = (e) => {
153
+ }, [T, l == null ? void 0 : l.getTime(), s == null ? void 0 : s.getTime()]);
154
+ const ee = (e) => typeof e == "number" ? `calc(${e} * var(--u-preset-unit, 1px))` : String(e), je = (e) => typeof e == "number" ? `calc(${e} * var(--u-unit, 1px))` : String(e), te = (e) => {
143
155
  const t = e.target;
144
- t.closest(".react-datepicker") && !t.closest(".react-datepicker__day") || D(!m);
145
- }, B = /* @__PURE__ */ r(
146
- Ne,
156
+ t.closest(".react-datepicker") && (d || !t.closest(".react-datepicker__day")) || C(!h);
157
+ }, Le = d ? {
158
+ selectsRange: !0,
159
+ // Клик раньше выбранного начала завершает период «кликнутый день — прежнее начало», как и в Vue.
160
+ swapRange: !0,
161
+ startDate: l,
162
+ endDate: s,
163
+ onChange: (e, t) => $e(e, t)
164
+ } : {
165
+ selected: U,
166
+ onChange: (e, t) => R(e, t)
167
+ }, [S, L] = v(null), Fe = (l == null ? void 0 : l.getTime()) ?? null, Be = (s == null ? void 0 : s.getTime()) ?? null;
168
+ _(() => {
169
+ L(null);
170
+ }, [Fe, Be, D]);
171
+ const He = (e) => {
172
+ if (!l || s) return "";
173
+ const t = S === null ? 0 : ie(l, S);
174
+ if (S !== null && t > 0) {
175
+ const r = ie(e, S);
176
+ return r === 0 ? "react-datepicker__day--in-selecting-range react-datepicker__day--selecting-range-start" : r === t ? "react-datepicker__day--in-selecting-range react-datepicker__day--selecting-range-end" : r > 0 && r < t ? "react-datepicker__day--in-selecting-range" : "";
177
+ }
178
+ return lt(e, l) ? "u-calendar-day--range-pending" : "";
179
+ }, qe = d ? !!(l || s) : !!U, re = /* @__PURE__ */ o(
180
+ Je,
147
181
  {
148
- ariaLabelledBy: v["aria-labelledby"],
149
- ariaDescribedBy: v["aria-describedby"],
150
- ariaInvalid: v["aria-invalid"] ? "true" : void 0,
151
- ariaRequired: v["aria-required"] ? "true" : void 0,
152
- open: k ? z || m : I,
153
- inline: k,
154
- popperContainer: i ? Ye : void 0,
182
+ ref: X,
183
+ ariaLabelledBy: k["aria-labelledby"],
184
+ ariaDescribedBy: k["aria-describedby"],
185
+ ariaInvalid: k["aria-invalid"] ? "true" : void 0,
186
+ ariaRequired: k["aria-required"] ? "true" : void 0,
187
+ open: E ? W || h : D,
188
+ inline: E,
189
+ popperContainer: a ? ut : void 0,
155
190
  popperPlacement: "bottom-end",
156
- popperClassName: [ye ? "u-calendar-popper--closing" : "", M ? "u-calendar-popper--portal" : ""].filter(Boolean).join(" ") || void 0,
157
- isClearable: y,
191
+ popperClassName: [Oe ? "u-calendar-popper--closing" : "", z ? "u-calendar-popper--portal" : ""].filter(Boolean).join(" ") || void 0,
192
+ dayClassName: d ? He : void 0,
193
+ onDayMouseEnter: d ? (e) => L(s ? null : e.getTime()) : void 0,
194
+ onMonthMouseLeave: d ? () => L(null) : void 0,
195
+ isClearable: x,
158
196
  ariaLabelClose: "Очистить",
159
- disabled: j,
197
+ disabled: J,
160
198
  renderCustomHeader: ({
161
199
  date: e,
162
200
  changeYear: t,
163
- changeMonth: n,
164
- decreaseMonth: c,
165
- increaseMonth: ge,
166
- prevMonthButtonDisabled: ke,
167
- nextMonthButtonDisabled: Ce
168
- }) => /* @__PURE__ */ h(
201
+ changeMonth: r,
202
+ decreaseMonth: i,
203
+ increaseMonth: g,
204
+ prevMonthButtonDisabled: I,
205
+ nextMonthButtonDisabled: M
206
+ }) => /* @__PURE__ */ P(
169
207
  "div",
170
208
  {
171
209
  style: {
@@ -178,26 +216,26 @@ const x = [
178
216
  alignItems: "center"
179
217
  },
180
218
  children: [
181
- /* @__PURE__ */ r(
219
+ /* @__PURE__ */ o(
182
220
  "button",
183
221
  {
184
222
  style: {
185
223
  width: "calc(25 * var(--u-unit, 1px))",
186
- color: "#1E4391",
224
+ color: "var(--u-color-primary, #1E4391)",
187
225
  display: "flex",
188
226
  // Без внутреннего отступа: стрелка прижата к краю карточки,
189
227
  // а не поджата к году и месяцу.
190
228
  padding: 0,
191
229
  cursor: "pointer"
192
230
  },
193
- onClick: (o) => {
194
- o.preventDefault(), o.stopPropagation(), p(null), c();
231
+ onClick: (n) => {
232
+ n.preventDefault(), n.stopPropagation(), y(null), i();
195
233
  },
196
- disabled: ke,
197
- children: /* @__PURE__ */ r("i", { className: "u-icon icon-left", style: { fontSize: "calc(20 * var(--u-unit, 1px))" } })
234
+ disabled: I,
235
+ children: /* @__PURE__ */ o("i", { className: "u-icon icon-left", style: { fontSize: "calc(20 * var(--u-unit, 1px))" } })
198
236
  }
199
237
  ),
200
- /* @__PURE__ */ h(
238
+ /* @__PURE__ */ P(
201
239
  "div",
202
240
  {
203
241
  style: {
@@ -208,149 +246,149 @@ const x = [
208
246
  gap: "calc(8 * var(--u-unit, 1px))"
209
247
  },
210
248
  children: [
211
- /* @__PURE__ */ r(
212
- G,
249
+ /* @__PURE__ */ o(
250
+ ae,
213
251
  {
214
- value: P(e),
215
- options: Ve.map((o) => ({ value: o, label: o })),
216
- onChange: (o) => t(Number(o)),
252
+ value: B(e),
253
+ options: st.map((n) => ({ value: n, label: n })),
254
+ onChange: (n) => t(Number(n)),
217
255
  fallbackValue: (/* @__PURE__ */ new Date()).getFullYear(),
218
256
  width: 45,
219
- isOpen: L === "year",
220
- onOpen: () => p("year"),
221
- onClose: () => p(null)
257
+ isOpen: Z === "year",
258
+ onOpen: () => y("year"),
259
+ onClose: () => y(null)
222
260
  }
223
261
  ),
224
- /* @__PURE__ */ r(
225
- G,
262
+ /* @__PURE__ */ o(
263
+ ae,
226
264
  {
227
- value: x[Ge(e)],
228
- options: x.map((o) => ({ value: o, label: o })),
229
- onChange: (o) => {
230
- const W = String(o);
231
- n(x.indexOf(W)), A && A(W);
265
+ value: O[it(e)],
266
+ options: O.map((n) => ({ value: n, label: n })),
267
+ onChange: (n) => {
268
+ const oe = String(n);
269
+ r(O.indexOf(oe)), G && G(oe);
232
270
  },
233
- fallbackValue: x[(/* @__PURE__ */ new Date()).getMonth()],
271
+ fallbackValue: O[(/* @__PURE__ */ new Date()).getMonth()],
234
272
  width: 85,
235
- isOpen: L === "month",
236
- onOpen: () => p("month"),
237
- onClose: () => p(null)
273
+ isOpen: Z === "month",
274
+ onOpen: () => y("month"),
275
+ onClose: () => y(null)
238
276
  }
239
277
  )
240
278
  ]
241
279
  }
242
280
  ),
243
- /* @__PURE__ */ r(
281
+ /* @__PURE__ */ o(
244
282
  "button",
245
283
  {
246
284
  style: {
247
285
  width: "calc(25 * var(--u-unit, 1px))",
248
- color: "#1E4391",
286
+ color: "var(--u-color-primary, #1E4391)",
249
287
  display: "flex",
250
288
  justifyContent: "flex-end",
251
289
  padding: 0,
252
290
  cursor: "pointer"
253
291
  },
254
- onClick: (o) => {
255
- o.preventDefault(), o.stopPropagation(), p(null), ge();
292
+ onClick: (n) => {
293
+ n.preventDefault(), n.stopPropagation(), y(null), g();
256
294
  },
257
- disabled: Ce,
258
- children: /* @__PURE__ */ r("i", { className: "u-icon icon-right", style: { fontSize: "calc(20 * var(--u-unit, 1px))" } })
295
+ disabled: M,
296
+ children: /* @__PURE__ */ o("i", { className: "u-icon icon-right", style: { fontSize: "calc(20 * var(--u-unit, 1px))" } })
259
297
  }
260
298
  )
261
299
  ]
262
300
  }
263
301
  ),
264
- placeholderText: J,
265
- customInput: /* @__PURE__ */ r(
266
- $e,
302
+ placeholderText: se ?? (d ? "Выберите период" : "Выберите дату"),
303
+ customInput: /* @__PURE__ */ o(
304
+ Xe,
267
305
  {
268
- "aria-label": a,
269
- id: `custom-input-mask-${u}`,
270
- isClearable: y,
271
- wheelEdit: ae,
306
+ "aria-label": c,
307
+ id: `custom-input-mask-${m}`,
308
+ isClearable: x,
309
+ range: d,
310
+ wheelEdit: we && !d,
272
311
  onWheelDate: (e) => R(e),
273
- onOpenCalendar: () => D(!0),
274
- onFocusChange: ve
312
+ onOpenCalendar: () => C(!0),
313
+ onFocusChange: Te
275
314
  }
276
315
  ),
277
- selected: T,
278
- onChange: (e, t) => R(e, t),
316
+ ...Le,
279
317
  strictParsing: !0,
280
318
  locale: "ru",
281
- className: (Y ? "custom-input dpc-filter custom-input-filter" : ue ? "custom-input dpc-table custom-input-table" : `${K ? "dpc-grey" : "dpc"} custom-input`) + (b.hasError ? " u-input-required" : "") + // react-datepicker рисует крестик и у disabled-поля — отступ под него тоже есть, как во Vue.
282
- (y && T ? " dpc--clearable" : ""),
319
+ className: (ce ? "custom-input dpc-filter custom-input-filter" : Se ? "custom-input dpc-table custom-input-table" : `${ue ? "dpc-grey" : "dpc"} custom-input`) + (w.hasError ? " u-input-required" : "") + // react-datepicker рисует крестик и у disabled-поля — отступ под него тоже есть, как во Vue.
320
+ (x && qe ? " dpc--clearable" : ""),
283
321
  dateFormat: "dd.MM.yyyy"
284
322
  }
285
323
  );
286
- return /* @__PURE__ */ r(V.Provider, { value: i, children: /* @__PURE__ */ h(
324
+ return /* @__PURE__ */ o(le.Provider, { value: a, children: /* @__PURE__ */ P(
287
325
  "div",
288
326
  {
289
- ref: S,
290
- id: `u-datepicker${u}`,
291
- className: de || void 0,
327
+ ref: j,
328
+ id: `u-datepicker${m}`,
329
+ className: Ie || void 0,
292
330
  style: { display: "flex", flexDirection: "column", rowGap: "calc(4 * var(--u-preset-unit, 1px))" },
293
331
  children: [
294
- /* @__PURE__ */ h(
332
+ /* @__PURE__ */ P(
295
333
  "div",
296
334
  {
297
335
  style: Object.assign(
298
336
  {
299
337
  display: "flex",
300
- flexDirection: C ? "row" : "column",
301
- rowGap: C ? null : _(re),
302
- columnGap: C ? _(oe) : null
338
+ flexDirection: $ ? "row" : "column",
339
+ rowGap: $ ? null : ee(be),
340
+ columnGap: $ ? ee(he) : null
303
341
  },
304
- ie
342
+ ge
305
343
  ),
306
344
  children: [
307
- s && /* @__PURE__ */ r(
345
+ p && /* @__PURE__ */ o(
308
346
  "div",
309
347
  {
310
- id: `${u}-label`,
311
- className: `${$ ? "u-required" : ""} u-react-input-title`,
348
+ id: `${m}-label`,
349
+ className: `${Y ? "u-required" : ""} u-react-input-title`,
312
350
  style: Object.assign(
313
351
  {
314
352
  color: "var(--u-field-title-color, #545454)",
315
353
  fontSize: "var(--u-field-label-size-main, calc(14 * var(--u-unit, 1px)))"
316
354
  },
317
- ne
355
+ xe
318
356
  ),
319
- children: s
357
+ children: p
320
358
  }
321
359
  ),
322
- le ? /* @__PURE__ */ r(
323
- je,
360
+ ke ? /* @__PURE__ */ o(
361
+ Ze,
324
362
  {
325
363
  portalOn: !0,
326
- id: `calendar-hint-${u || "default"}`,
364
+ id: `calendar-hint-${m || "default"}`,
327
365
  position: "top",
328
- isActive: be && !j && !he,
366
+ isActive: Ne && !J && !Ae,
329
367
  showWhenActive: !0,
330
368
  tooltipStyle: {
331
- maxWidth: we(se),
369
+ maxWidth: je(De),
332
370
  width: "auto",
333
371
  whiteSpace: "normal",
334
372
  overflowWrap: "break-word"
335
373
  },
336
- tooltipText: ce,
337
- children: /* @__PURE__ */ r("div", { style: { width: "100%" }, onClick: q, children: B })
374
+ tooltipText: Ce,
375
+ children: /* @__PURE__ */ o("div", { style: { width: "100%" }, onClick: te, children: re })
338
376
  }
339
- ) : /* @__PURE__ */ r("div", { style: { width: "100%" }, onClick: q, children: B })
377
+ ) : /* @__PURE__ */ o("div", { style: { width: "100%" }, onClick: te, children: re })
340
378
  ]
341
379
  }
342
380
  ),
343
- b.showText && /* @__PURE__ */ r(
381
+ w.showText && /* @__PURE__ */ o(
344
382
  "h5",
345
383
  {
346
- id: `${u}-error`,
384
+ id: `${m}-error`,
347
385
  className: "h5 clr-red-main",
348
- style: te ? { position: "absolute", bottom: "calc(-20 * var(--u-unit, 1px))" } : { position: "relative" },
349
- children: b.text
386
+ style: ve ? { position: "absolute", bottom: "calc(-20 * var(--u-unit, 1px))" } : { position: "relative" },
387
+ children: w.text
350
388
  }
351
389
  )
352
390
  ]
353
391
  }
354
392
  ) });
355
393
  };
356
- export { mt as Calendar$u };
394
+ export { Tt as Calendar$u };
@@ -3,8 +3,29 @@ import type { CSSProperties, ReactNode } from 'react';
3
3
  import type { ComponentSize } from '../../shared/size';
4
4
  /** Откуда изменение даты: выбор в календаре или набор в поле (клавиатура, колесо, стрелки). */
5
5
  export type CalendarChangeSource = 'calendar' | 'input';
6
+ /** Период: начало и конец; пока конец не выбран (или не набран), он `null`. */
7
+ export type CalendarRange = [Date | null, Date | null];
6
8
  export type CalendarProperties = FieldAccessibilityProperties & Partial<{
7
9
  title: string;
10
+ /**
11
+ * Период вместо одной даты: одно поле «дд.мм.гггг - дд.мм.гггг» и один попап. Первый
12
+ * щелчок по дню ставит начало, второй — конец (клик раньше начала даёт период «кликнутый
13
+ * день — прежнее начало») и закрывает попап. Значения — `startDate`/`endDate`, изменения — `onRangeChange`;
14
+ * `selected` и `onChange` в этом режиме не используются. Колесо и стрелки (`wheelEdit`)
15
+ * в периоде не работают.
16
+ */
17
+ range: boolean;
18
+ /** Начало периода (`range`): Date, строка или число, которые понимает `new Date()`. */
19
+ startDate: Date | string | number | null;
20
+ /** Конец периода (`range`): Date, строка или число, которые понимает `new Date()`. */
21
+ endDate: Date | string | number | null;
22
+ /**
23
+ * `([начало, конец], { source })` в режиме `range`. Из набранного в поле конец приходит
24
+ * `null`, пока не набрана полная вторая дата; очистка крестиком — `[null, null]`.
25
+ */
26
+ onRangeChange(range: CalendarRange, meta?: {
27
+ source: CalendarChangeSource;
28
+ }): void;
8
29
  /** Выбранная дата: Date, строка или число, которые понимает `new Date()`; пусто — без значения. */
9
30
  selected: Date | string | number | null;
10
31
  /** `(date, { source })`: из набранного приходит только полная дата дд.мм.гггг; `source` — см. CalendarChangeSource. */