mimir-ui-kit 1.42.2 → 1.43.1

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 (87) hide show
  1. package/dist/ProgressBar-COdzy3fY.js +67 -0
  2. package/dist/assets/MultiSelectSearch.css +1 -1
  3. package/dist/assets/Pagination.css +1 -1
  4. package/dist/assets/SelectSearch.css +1 -1
  5. package/dist/assets/Switcher.css +1 -1
  6. package/dist/assets/TabTrail.css +1 -1
  7. package/dist/assets/hooks.css +1 -0
  8. package/dist/{combobox-Dv6-ANkb.js → combobox-fIVOzEhl.js} +6 -6
  9. package/dist/components/Accordion/Accordion.d.ts +6 -0
  10. package/dist/components/Accordion/Accordion.js +202 -182
  11. package/dist/components/AnchorLink/Link.d.ts +2 -0
  12. package/dist/components/AnchorLink/Link.js +54 -42
  13. package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
  14. package/dist/components/DatePicker/DatePicker.d.ts +32 -0
  15. package/dist/components/DatePicker/DatePicker.js +125 -111
  16. package/dist/components/DatePicker/DatePickerModal.d.ts +5 -1
  17. package/dist/components/DatePicker/DatePickerModal.js +97 -75
  18. package/dist/components/DatePicker/MonthPickerModal.d.ts +5 -1
  19. package/dist/components/DatePicker/MonthPickerModal.js +96 -58
  20. package/dist/components/DatePicker/YearPickerModal.d.ts +5 -1
  21. package/dist/components/DatePicker/YearPickerModal.js +75 -57
  22. package/dist/components/Drawer/Drawer.d.ts +7 -1
  23. package/dist/components/Drawer/Drawer.js +122 -106
  24. package/dist/components/Drawer/hooks.d.ts +9 -0
  25. package/dist/components/Drawer/hooks.js +24 -0
  26. package/dist/components/Dropdown/Dropdown.d.ts +18 -1
  27. package/dist/components/Dropdown/Dropdown.js +361 -343
  28. package/dist/components/Dropdown/constants.d.ts +11 -0
  29. package/dist/components/Dropdown/constants.js +5 -0
  30. package/dist/components/Dropdown/hooks.d.ts +19 -0
  31. package/dist/components/Dropdown/hooks.js +11 -0
  32. package/dist/components/Dropdown/index.d.ts +1 -0
  33. package/dist/components/Dropdown/index.js +5 -2
  34. package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +8 -1
  35. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +461 -302
  36. package/dist/components/MultiSelectSearch/constants.d.ts +6 -0
  37. package/dist/components/MultiSelectSearch/constants.js +7 -5
  38. package/dist/components/MultiSelectSearch/index.d.ts +1 -1
  39. package/dist/components/MultiSelectSearch/index.js +5 -4
  40. package/dist/components/MultiSelectSearch/types.d.ts +33 -1
  41. package/dist/components/MultiSelectSearch/utils.d.ts +1 -0
  42. package/dist/components/MultiSelectSearch/utils.js +31 -17
  43. package/dist/components/Pagination/Pagination.d.ts +23 -0
  44. package/dist/components/Pagination/Pagination.js +137 -99
  45. package/dist/components/RadioGroup/RadioGroup.js +3 -3
  46. package/dist/components/SelectSearch/SelectSearch.d.ts +8 -1
  47. package/dist/components/SelectSearch/SelectSearch.js +381 -220
  48. package/dist/components/SelectSearch/constants.d.ts +6 -0
  49. package/dist/components/SelectSearch/constants.js +3 -2
  50. package/dist/components/SelectSearch/index.d.ts +1 -1
  51. package/dist/components/SelectSearch/index.js +5 -4
  52. package/dist/components/SelectSearch/types.d.ts +32 -1
  53. package/dist/components/SelectSearch/utils.d.ts +2 -0
  54. package/dist/components/SelectSearch/utils.js +28 -14
  55. package/dist/components/Slider/Slider.d.ts +6 -2
  56. package/dist/components/Slider/Slider.js +123 -109
  57. package/dist/components/Slider/utils.d.ts +1 -0
  58. package/dist/components/Slider/utils.js +4 -0
  59. package/dist/components/Switcher/Switcher.js +66 -59
  60. package/dist/components/Switcher/types.d.ts +1 -0
  61. package/dist/components/TabTrail/TabTrail.d.ts +9 -0
  62. package/dist/components/TabTrail/TabTrail.js +198 -190
  63. package/dist/components/Toasts/ProgressBar.d.ts +4 -2
  64. package/dist/components/Toasts/ProgressBar.js +1 -1
  65. package/dist/components/Toasts/Toast.d.ts +5 -1
  66. package/dist/components/Toasts/Toast.js +59 -44
  67. package/dist/components/Toasts/ToastList.js +1 -1
  68. package/dist/components/Toasts/ToastsProvider.js +1 -1
  69. package/dist/components/index.d.ts +3 -2
  70. package/dist/components/index.js +154 -149
  71. package/dist/{field-BP5-U1Nr.js → field-BLi5834s.js} +2 -2
  72. package/dist/{focus-management-Dp2_vbQ3.js → focus-management-BAl0GmRk.js} +1 -1
  73. package/dist/{hidden-Dn4lM6EL.js → hidden-CkTYbiNM.js} +1 -1
  74. package/dist/hooks/useTimer/index.d.ts +2 -1
  75. package/dist/hooks/useTimer/index.js +55 -41
  76. package/dist/hooks-HgN6Yauq.js +117 -0
  77. package/dist/index.js +182 -177
  78. package/dist/{keyboard-CUMsrFX1.js → keyboard-wis2TUql.js} +2 -2
  79. package/dist/{label-DOlEWXBl.js → label-BmphTIGY.js} +2 -2
  80. package/dist/{open-closed-CkTbpRyi.js → open-closed-CJijMeI2.js} +1 -1
  81. package/dist/{portal-C_u5auU1.js → portal-BnEqSZwo.js} +2 -2
  82. package/dist/{use-active-press-BVQqDQ3V.js → use-active-press-CnDeVvQq.js} +1 -1
  83. package/dist/{use-is-mounted-D7cq4xsa.js → use-is-mounted-MBU4fiLr.js} +1 -1
  84. package/package.json +3 -1
  85. package/dist/ProgressBar-DEFs1tWq.js +0 -55
  86. package/dist/assets/Dropdown.css +0 -1
  87. package/dist/components/Pagination/types.d.ts +0 -0
@@ -1,375 +1,534 @@
1
- import { jsxs as E, jsx as n, Fragment as Y } from "react/jsx-runtime";
2
- import { c as u } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as Ne, useId as Se, useRef as P, useState as g, useEffect as y, useMemo as Ce, useCallback as Me } from "react";
4
- import { EMultiSelectSearchSize as R } from "./constants.js";
5
- import { getInitialInputValue as Z, shouldShowMenuOnTop as Ee, MULTISELECT_OPEN_EVENT as ee, mapSizeToInputSize as te, getDropdownArrowIcon as Le, dispatchMultiselectOpen as L, joinSelectedItems as oe } from "./utils.js";
6
- import { Icon as ye } from "../../icons/Icon.js";
7
- import { Button as ke } from "../Button/Button.js";
8
- import { CheckboxMimir as Te } from "../CheckboxMimir/CheckboxMimir.js";
9
- import { Chip as Oe } from "../Chip/Chip.js";
10
- import { I as ne } from "../../Input-BU_6U1CW.js";
11
- import { EInputVariant as ze } from "../Input/constants.js";
12
- import { H as Ae, U as ie, G as se, K as Ve, W as qe } from "../../combobox-Dv6-ANkb.js";
13
- import '../../assets/MultiSelectSearch.css';const xe = "_disabled_io0c8_5", De = "_container_io0c8_9", Pe = "_full_io0c8_27", Re = "_button_io0c8_39", Be = "_options_io0c8_53", Fe = "_visible_io0c8_66", Je = "_top_io0c8_69", je = "_bottom_io0c8_74", Ge = "_m_io0c8_2", He = "_l_io0c8_116", Ue = "_focused_io0c8_134", We = "_option_io0c8_53", Ke = "_chip_io0c8_163", $e = "_clear_io0c8_188", e = {
14
- "multi-select-search": "_multi-select-search_io0c8_2",
15
- disabled: xe,
16
- container: De,
17
- "container-open": "_container-open_io0c8_18",
18
- "input-container": "_input-container_io0c8_22",
19
- full: Pe,
20
- "selected-icon": "_selected-icon_io0c8_31",
21
- "selector-icon-open": "_selector-icon-open_io0c8_35",
22
- button: Re,
23
- "selector-icon": "_selector-icon_io0c8_35",
24
- options: Be,
25
- visible: Fe,
26
- top: Je,
27
- bottom: je,
28
- "no-options": "_no-options_io0c8_95",
29
- m: Ge,
30
- l: He,
31
- "multi-select-input-disabled": "_multi-select-input-disabled_io0c8_131",
32
- "multi-select-input": "_multi-select-input_io0c8_131",
33
- focused: Ue,
34
- option: We,
35
- "option-active": "_option-active_io0c8_153",
36
- "option-inner": "_option-inner_io0c8_156",
37
- chip: Ke,
38
- "chip-container": "_chip-container_io0c8_168",
39
- "chip-root": "_chip-root_io0c8_174",
40
- "right-slot": "_right-slot_io0c8_178",
41
- "required-mark": "_required-mark_io0c8_183",
42
- clear: $e,
43
- "icon-button": "_icon-button_io0c8_197"
44
- }, at = Ne(
45
- (ce, re) => {
1
+ import { jsxs as u, jsx as i, Fragment as ee } from "react/jsx-runtime";
2
+ import { u as Qe } from "../../index-D5H8gPPn.js";
3
+ import { c } from "../../index-DIxK0V-G.js";
4
+ import { forwardRef as Xe, useId as Ze, useRef as j, useState as f, useEffect as A, useMemo as te, useCallback as et } from "react";
5
+ import { EMultiSelectSearchSize as D, ELoadingIndicatorPlacement as P } from "./constants.js";
6
+ import { getInitialInputValue as ve, shouldShowMenuOnTop as tt, MULTISELECT_OPEN_EVENT as ge, prepareGroupedItems as nt, mapSizeToInputSize as ke, getDropdownArrowIcon as it, joinSelectedItems as Ie, dispatchMultiselectOpen as U } from "./utils.js";
7
+ import { Icon as ot } from "../../icons/Icon.js";
8
+ import { Button as st } from "../Button/Button.js";
9
+ import { CheckboxMimir as we } from "../CheckboxMimir/CheckboxMimir.js";
10
+ import { Chip as rt } from "../Chip/Chip.js";
11
+ import { I as ye } from "../../Input-BU_6U1CW.js";
12
+ import { EInputVariant as at } from "../Input/constants.js";
13
+ import { Loader as Ne } from "../Loader/Loader.js";
14
+ import { H as lt, U as Se, G as xe, W as Ce, K as ct } from "../../combobox-fIVOzEhl.js";
15
+ import '../../assets/MultiSelectSearch.css';const dt = "_disabled_1b2pk_5", ut = "_container_1b2pk_9", pt = "_loader_1b2pk_37", mt = "_full_1b2pk_47", ft = "_button_1b2pk_59", ht = "_options_1b2pk_73", _t = "_visible_1b2pk_86", bt = "_top_1b2pk_89", vt = "_bottom_1b2pk_94", gt = "_m_1b2pk_2", kt = "_l_1b2pk_37", It = "_focused_1b2pk_154", wt = "_option_1b2pk_73", yt = "_chip_1b2pk_183", Nt = "_clear_1b2pk_208", t = {
16
+ "multi-select-search": "_multi-select-search_1b2pk_2",
17
+ disabled: dt,
18
+ container: ut,
19
+ "container-open": "_container-open_1b2pk_18",
20
+ "group-header": "_group-header_1b2pk_22",
21
+ "sticky-active": "_sticky-active_1b2pk_33",
22
+ loader: pt,
23
+ "input-container": "_input-container_1b2pk_42",
24
+ full: mt,
25
+ "selected-icon": "_selected-icon_1b2pk_51",
26
+ "selector-icon-open": "_selector-icon-open_1b2pk_55",
27
+ button: ft,
28
+ "selector-icon": "_selector-icon_1b2pk_55",
29
+ options: ht,
30
+ visible: _t,
31
+ top: bt,
32
+ bottom: vt,
33
+ "no-options": "_no-options_1b2pk_115",
34
+ m: gt,
35
+ l: kt,
36
+ "multi-select-input-disabled": "_multi-select-input-disabled_1b2pk_151",
37
+ "multi-select-input": "_multi-select-input_1b2pk_151",
38
+ focused: It,
39
+ option: wt,
40
+ "option-active": "_option-active_1b2pk_173",
41
+ "option-inner": "_option-inner_1b2pk_176",
42
+ chip: yt,
43
+ "chip-container": "_chip-container_1b2pk_188",
44
+ "chip-root": "_chip-root_1b2pk_194",
45
+ "right-slot": "_right-slot_1b2pk_198",
46
+ "required-mark": "_required-mark_1b2pk_203",
47
+ clear: Nt,
48
+ "icon-button": "_icon-button_1b2pk_217"
49
+ }, Ft = Xe(
50
+ (Le, Ee) => {
46
51
  const {
47
- placeholder: B,
48
- size: i = R.L,
49
- value: m,
50
- onChange: s,
51
- full: le,
52
- showArrow: ae = !0,
53
- items: f = [],
54
- classNameOption: ue,
55
- displayValue: v = "name",
56
- filterOnSearch: F = !0,
57
- onSearch: k,
58
- variant: J = ze.DefaultGray,
59
- menuPlacement: w = "bottom",
60
- disabled: d = !1,
61
- searchProps: j,
62
- withClearButton: T = !1,
63
- withChip: de = !1,
64
- chipVariant: pe = "sapphire",
65
- disableInput: I = !1,
66
- autocomplete: G = "on",
67
- id: me,
68
- autoPlacement: O = !1,
69
- onIsOpen: r
70
- } = ce, _e = Se(), _ = me || `multiselect-${_e}`, N = P(null), b = P(null), z = P(!1), [l, h] = g(!1), [S, C] = g(
71
- () => Z(m, v)
72
- ), [c, M] = g(
73
- m || []
74
- ), [A, H] = g(w), [V, U] = g(!1), [he, W] = g(!1);
75
- y(() => {
76
- m && (M(m), JSON.stringify(m) !== JSON.stringify(c) && C(Z(m, v)));
77
- }, [m, v, c]);
78
- const K = Ce(() => {
79
- var o;
80
- if (!F) return f;
81
- const t = ((o = S.split(",").pop()) == null ? void 0 : o.trim().toLowerCase()) ?? "";
82
- return c.length > 0 && c[c.length - 1].name.toLowerCase() === t ? f : f.filter(
83
- (a) => a.name.toLowerCase().includes(t)
52
+ placeholder: ne,
53
+ size: s = D.L,
54
+ value: h,
55
+ onChange: a,
56
+ full: Me,
57
+ showArrow: Te = !0,
58
+ items: v = [],
59
+ classNameOption: ie,
60
+ displayValue: g = "name",
61
+ filterOnSearch: oe = !0,
62
+ onSearch: W,
63
+ variant: se = at.DefaultGray,
64
+ menuPlacement: C = "bottom",
65
+ disabled: p = !1,
66
+ searchProps: re,
67
+ withClearButton: K = !1,
68
+ withChip: Oe = !1,
69
+ chipVariant: ze = "sapphire",
70
+ disableInput: L = !1,
71
+ autocomplete: ae = "on",
72
+ id: Ve,
73
+ autoPlacement: Y = !1,
74
+ onIsOpen: d,
75
+ noOptionsText: Ae = "Нет данных",
76
+ noMatchText: De = "Ничего не найдено",
77
+ loadOnOpen: B,
78
+ loading: le,
79
+ loadingIndicatorPlacement: q = P.Both,
80
+ groupBy: _,
81
+ getGroupTitle: ce = (e) => e
82
+ } = Le, Pe = Ze(), k = Ve || `multiselect-${Pe}`, E = j(null), I = j(null), Q = j(!1), G = j(null), [l, w] = f(!1), [M, T] = f(
83
+ () => ve(h, g)
84
+ ), [r, O] = f(
85
+ h || []
86
+ ), [F, de] = f(C), [R, ue] = f(!1), [Be, pe] = f(!1), [qe, H] = f(!1), [X, Ge] = f(null), me = le !== void 0 ? le : qe;
87
+ A(() => {
88
+ h && (O(h), JSON.stringify(h) !== JSON.stringify(r) && T(ve(h, g)));
89
+ }, [h, g, r]);
90
+ const z = te(() => {
91
+ var n;
92
+ if (!oe) return v;
93
+ const e = ((n = M.split(",").pop()) == null ? void 0 : n.trim().toLowerCase()) ?? "";
94
+ return r.length > 0 && r[r.length - 1].name.toLowerCase() === e ? v : v.filter(
95
+ (o) => o.name.toLowerCase().includes(e)
84
96
  );
85
- }, [F, f, S, c]), fe = (t) => {
86
- M(t), s == null || s(t);
87
- const o = oe(t, v);
88
- C(o), h(!0), L(_), setTimeout(() => {
89
- if (b.current) {
90
- b.current.focus(), b.current.scrollLeft = b.current.scrollWidth;
91
- const a = o.length;
92
- b.current.setSelectionRange(a, a);
97
+ }, [oe, v, M, r]), Fe = (e) => {
98
+ O(e), a == null || a(e);
99
+ const n = Ie(e, g);
100
+ T(n), w(!0), U(k), setTimeout(() => {
101
+ if (I.current) {
102
+ I.current.focus(), I.current.scrollLeft = I.current.scrollWidth;
103
+ const o = n.length;
104
+ I.current.setSelectionRange(o, o);
93
105
  }
94
106
  }, 0);
95
- }, $ = (t) => {
96
- var X;
97
- if (I) return;
98
- const o = t.target.value;
99
- C(o), k == null || k(o);
100
- const a = o.split(",").map((D) => D.trim()).filter(Boolean), q = f.filter(
101
- (D) => a.includes(D[v])
107
+ }, fe = async (e) => {
108
+ var b;
109
+ if (L) return;
110
+ const n = e.target.value;
111
+ T(n), W == null || W(n);
112
+ const o = n.split(",").map((x) => x.trim()).filter(Boolean), N = v.filter(
113
+ (x) => o.includes(x[g])
102
114
  );
103
- JSON.stringify(q) !== JSON.stringify(c) && (M(q), s == null || s(q)), h(!0), L(_);
104
- const x = (X = N.current) == null ? void 0 : X.querySelector(
105
- `.${e.options}`
115
+ if (JSON.stringify(N) !== JSON.stringify(r) && (O(N), a == null || a(N)), !l && (w(!0), U(k), B))
116
+ try {
117
+ H(!0), await B();
118
+ } finally {
119
+ H(!1);
120
+ }
121
+ const S = (b = E.current) == null ? void 0 : b.querySelector(
122
+ `.${t.options}`
106
123
  );
107
- x && typeof x.scrollTo == "function" && x.scrollTo({ top: 0, behavior: "smooth" });
108
- }, ve = (t) => {
109
- const o = c.filter(
110
- (a) => a.id !== t.id
124
+ S && typeof S.scrollTo == "function" && S.scrollTo({ top: 0, behavior: "smooth" });
125
+ }, Re = (e) => {
126
+ const n = r.filter(
127
+ (o) => o.id !== e.id
111
128
  );
112
- M(o), s == null || s(o), C(oe(o, v));
113
- }, p = Me(() => {
114
- if (!O) {
115
- H(w);
129
+ O(n), a == null || a(n), T(Ie(n, g));
130
+ }, m = et(() => {
131
+ if (!Y) {
132
+ de(C);
116
133
  return;
117
134
  }
118
- const t = Ee(N, i);
119
- H(t ? "top" : w);
120
- }, [O, w, i]), Q = () => {
121
- const t = !l;
122
- t && (p(), L(_)), h(t), r == null || r(t);
123
- }, be = (t) => {
124
- t.preventDefault(), t.currentTarget.focus();
125
- const o = t.currentTarget.value.length;
126
- t.currentTarget.setSelectionRange(o, o);
127
- }, ge = () => {
128
- C(""), M([]), s == null || s([]);
129
- }, we = (t) => {
130
- t.stopPropagation(), ge();
131
- }, Ie = (t) => {
132
- if (I) {
133
- t.target.blur();
135
+ const e = tt(E, s);
136
+ de(e ? "top" : C);
137
+ }, [Y, C, s]), He = (e) => {
138
+ e.preventDefault(), e.currentTarget.focus();
139
+ const n = e.currentTarget.value.length;
140
+ e.currentTarget.setSelectionRange(n, n);
141
+ }, Je = () => {
142
+ T(""), O([]), a == null || a([]);
143
+ }, $e = (e) => {
144
+ e.stopPropagation(), Je();
145
+ }, he = async () => {
146
+ if (B)
147
+ try {
148
+ H(!0), await B();
149
+ } finally {
150
+ H(!1);
151
+ }
152
+ }, _e = async () => {
153
+ m(), w(!0), U(k), await he();
154
+ }, je = async (e) => {
155
+ if (L) {
156
+ e.target.blur();
134
157
  return;
135
158
  }
136
- p(), h(!0), L(_);
159
+ await _e();
160
+ }, be = async () => {
161
+ const e = !l;
162
+ e && (m(), U(k), await he()), w(e), d == null || d(e);
137
163
  };
138
- return y(() => {
164
+ A(() => {
139
165
  if (l) {
140
- const t = (o) => {
141
- N.current && !N.current.contains(o.target) && !o.defaultPrevented && (h(!1), r == null || r(!1));
166
+ const e = (n) => {
167
+ E.current && !E.current.contains(n.target) && !n.defaultPrevented && (w(!1), d == null || d(!1));
142
168
  };
143
- return document.addEventListener("mousedown", t), () => {
144
- document.removeEventListener("mousedown", t);
169
+ return document.addEventListener("mousedown", e), () => {
170
+ document.removeEventListener("mousedown", e);
145
171
  };
146
172
  }
147
- }, [l, r]), y(() => {
148
- const o = (a) => {
149
- a.detail === _ || !l || z.current || (z.current = !0, h(!1), r == null || r(!1), queueMicrotask(() => {
150
- z.current = !1;
173
+ }, [l, d]), A(() => {
174
+ const n = (o) => {
175
+ o.detail === k || !l || Q.current || (Q.current = !0, w(!1), d == null || d(!1), queueMicrotask(() => {
176
+ Q.current = !1;
151
177
  }));
152
178
  };
153
- return window.addEventListener(ee, o), () => window.removeEventListener(ee, o);
154
- }, [_, r, l]), y(() => {
179
+ return window.addEventListener(ge, n), () => window.removeEventListener(ge, n);
180
+ }, [k, d, l]), A(() => {
155
181
  if (l) {
156
- p(), window.addEventListener("scroll", p), window.addEventListener("resize", p);
157
- const t = requestAnimationFrame(() => {
158
- W(!0), U(!0);
182
+ m(), window.addEventListener("scroll", m), window.addEventListener("resize", m);
183
+ const e = requestAnimationFrame(() => {
184
+ pe(!0), ue(!0);
159
185
  });
160
186
  return () => {
161
- window.removeEventListener("scroll", p), window.removeEventListener("resize", p), cancelAnimationFrame(t);
187
+ window.removeEventListener("scroll", m), window.removeEventListener("resize", m), cancelAnimationFrame(e);
162
188
  };
163
189
  } else
164
- U(!1), W(!1);
165
- }, [l, w, O, i, p]), /* @__PURE__ */ E("div", { ref: N, children: [
166
- /* @__PURE__ */ n(
167
- Ae,
190
+ ue(!1), pe(!1);
191
+ }, [l, C, Y, s, m]);
192
+ const Ue = () => {
193
+ if (Te)
194
+ return {
195
+ addonType: "react-node",
196
+ addonContent: /* @__PURE__ */ u(ee, { children: [
197
+ me && (q === P.Input || q === P.Both) && /* @__PURE__ */ i(Ne, { size: "s" }),
198
+ /* @__PURE__ */ i(
199
+ Se,
200
+ {
201
+ className: c(t.button, {
202
+ [t.disabled]: p
203
+ }),
204
+ disabled: p,
205
+ onMouseDown: be,
206
+ children: /* @__PURE__ */ i(
207
+ ot,
208
+ {
209
+ iconName: s == D.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
210
+ className: c(t["selector-icon"], {
211
+ [t["selector-icon-open"]]: l
212
+ })
213
+ }
214
+ )
215
+ }
216
+ )
217
+ ] })
218
+ };
219
+ }, We = () => me && (q === P.Dropdown || q === P.Both) ? /* @__PURE__ */ u("div", { className: t.loader, children: [
220
+ /* @__PURE__ */ i(Ne, { size: "s" }),
221
+ "Загрузка..."
222
+ ] }) : Ae, V = te(() => _ ? nt(
223
+ z,
224
+ _,
225
+ ce || ((e) => e)
226
+ ) : z, [z, _, ce]), J = te(() => {
227
+ const e = [];
228
+ return V.forEach((n, o) => {
229
+ n.isGroupHeader && e.push(o);
230
+ }), e;
231
+ }, [V]), y = Qe({
232
+ count: V.length,
233
+ getScrollElement: () => G.current,
234
+ estimateSize: () => s === D.L ? 65 : 49,
235
+ overscan: 10
236
+ }), Ke = () => v.length ? z.length ? _ ? /* @__PURE__ */ u(
237
+ "div",
238
+ {
239
+ ref: G,
240
+ className: c(
241
+ t.options,
242
+ t[s],
243
+ t[F],
244
+ { [t.visible]: R }
245
+ ),
246
+ style: {
247
+ height: s === D.M ? "240px" : "320px",
248
+ overflow: "auto"
249
+ },
250
+ children: [
251
+ X !== null && /* @__PURE__ */ i(
252
+ "div",
253
+ {
254
+ className: t["group-header"],
255
+ style: {
256
+ position: "sticky",
257
+ top: 0,
258
+ zIndex: 3
259
+ },
260
+ children: V[X].name
261
+ }
262
+ ),
263
+ /* @__PURE__ */ i(
264
+ "div",
265
+ {
266
+ style: {
267
+ height: `${y.getTotalSize()}px`,
268
+ width: "100%"
269
+ },
270
+ children: y.getVirtualItems().map((e) => {
271
+ const n = V[e.index];
272
+ return /* @__PURE__ */ i(
273
+ "div",
274
+ {
275
+ "data-index": e.index,
276
+ ref: y.measureElement,
277
+ style: {
278
+ position: "absolute",
279
+ top: 0,
280
+ left: 0,
281
+ width: "100%",
282
+ transform: `translateY(${e.start}px)`
283
+ },
284
+ children: n.isGroupHeader ? /* @__PURE__ */ i(
285
+ "div",
286
+ {
287
+ className: t["group-header"],
288
+ style: {
289
+ visibility: X === e.index ? "hidden" : "visible"
290
+ },
291
+ children: n.name
292
+ }
293
+ ) : /* @__PURE__ */ i(
294
+ Ce,
295
+ {
296
+ value: n,
297
+ className: ({ focus: o }) => c(
298
+ t.option,
299
+ ie,
300
+ s && t[s],
301
+ {
302
+ [t["option-active"]]: o
303
+ }
304
+ ),
305
+ children: /* @__PURE__ */ u(ee, { children: [
306
+ /* @__PURE__ */ u("div", { className: t["option-inner"], children: [
307
+ n.name,
308
+ n.bottom && /* @__PURE__ */ i("div", { children: n.bottom })
309
+ ] }),
310
+ /* @__PURE__ */ i(
311
+ we,
312
+ {
313
+ isInteractive: !1,
314
+ checked: r.some(
315
+ (o) => o.id === n.id
316
+ )
317
+ }
318
+ )
319
+ ] })
320
+ },
321
+ n.id
322
+ )
323
+ },
324
+ e.key
325
+ );
326
+ })
327
+ }
328
+ )
329
+ ]
330
+ }
331
+ ) : /* @__PURE__ */ i(
332
+ ct,
333
+ {
334
+ className: c(
335
+ t.options,
336
+ t[s],
337
+ t[F],
338
+ { [t.visible]: R }
339
+ ),
340
+ modal: !1,
341
+ static: !0,
342
+ children: ({ option: e }) => /* @__PURE__ */ i(
343
+ Ce,
344
+ {
345
+ value: e,
346
+ className: ({ focus: n }) => c(t.option, ie, s && t[s], {
347
+ [t["option-active"]]: n
348
+ }),
349
+ children: /* @__PURE__ */ u(ee, { children: [
350
+ /* @__PURE__ */ u("div", { className: t["option-inner"], children: [
351
+ e.name,
352
+ e.bottom && /* @__PURE__ */ i("div", { children: e.bottom })
353
+ ] }),
354
+ /* @__PURE__ */ i(
355
+ we,
356
+ {
357
+ isInteractive: !1,
358
+ checked: r.some(
359
+ (n) => n.id === e.id
360
+ )
361
+ }
362
+ )
363
+ ] })
364
+ },
365
+ e.id
366
+ )
367
+ }
368
+ ) : /* @__PURE__ */ i(
369
+ "div",
370
+ {
371
+ className: c(
372
+ t.options,
373
+ t[s],
374
+ t["no-options"],
375
+ t[F],
376
+ { [t.visible]: R }
377
+ ),
378
+ children: De
379
+ }
380
+ ) : /* @__PURE__ */ i(
381
+ "div",
382
+ {
383
+ className: c(
384
+ t.options,
385
+ t[s],
386
+ t["no-options"],
387
+ t[F],
388
+ { [t.visible]: R }
389
+ ),
390
+ children: We()
391
+ }
392
+ );
393
+ return A(() => {
394
+ const e = G.current;
395
+ if (!e || !_) return;
396
+ const n = () => {
397
+ var Z, S;
398
+ const o = e.scrollTop;
399
+ let N = null;
400
+ for (let b = 0; b < J.length; b++) {
401
+ const x = J[b];
402
+ if ((((Z = y.getVirtualItems().find(($) => $.index === x)) == null ? void 0 : Z.start) || 0) <= o) {
403
+ N = x;
404
+ const $ = J[b + 1];
405
+ if ($ !== void 0 && (((S = y.getVirtualItems().find((Ye) => Ye.index === $)) == null ? void 0 : S.start) || 0) <= o)
406
+ continue;
407
+ } else
408
+ break;
409
+ }
410
+ Ge(N);
411
+ };
412
+ return e.addEventListener("scroll", n), () => e.removeEventListener("scroll", n);
413
+ }, [y, J, _, G.current]), /* @__PURE__ */ u("div", { ref: E, children: [
414
+ /* @__PURE__ */ i(
415
+ lt,
168
416
  {
169
417
  multiple: !0,
170
418
  as: "div",
171
- value: c,
172
- className: u(e["multi-select-search"], {
173
- [e.full]: le,
174
- [e.disabled]: d
419
+ value: r,
420
+ className: c(t["multi-select-search"], {
421
+ [t.full]: Me,
422
+ [t.disabled]: p
175
423
  }),
176
- onChange: fe,
177
- ref: re,
178
- disabled: d,
179
- virtual: { options: K },
180
- children: /* @__PURE__ */ E(
424
+ onChange: Fe,
425
+ ref: Ee,
426
+ disabled: p,
427
+ virtual: _ ? void 0 : { options: z },
428
+ children: /* @__PURE__ */ u(
181
429
  "div",
182
430
  {
183
- className: u(e.container, e[i], {
184
- [e["container-open"]]: l
431
+ className: c(t.container, t[s], {
432
+ [t["container-open"]]: l
185
433
  }),
186
434
  children: [
187
- I && /* @__PURE__ */ E("div", { className: e["input-container"], children: [
188
- /* @__PURE__ */ n(
189
- ie,
435
+ L && /* @__PURE__ */ u("div", { className: t["input-container"], children: [
436
+ /* @__PURE__ */ i(
437
+ Se,
190
438
  {
191
- disabled: d,
439
+ disabled: p,
192
440
  style: { width: "100%" },
193
- onClick: Q,
194
- children: /* @__PURE__ */ n(
195
- se,
441
+ onClick: be,
442
+ children: /* @__PURE__ */ i(
443
+ xe,
196
444
  {
197
- as: ne,
198
- label: B,
199
- size: te(i),
200
- className: u(e["multi-select-input"], {
201
- [e["multi-select-input-disabled"]]: I && T
445
+ as: ye,
446
+ label: ne,
447
+ size: ke(s),
448
+ className: c(t["multi-select-input"], {
449
+ [t["multi-select-input-disabled"]]: L && K
202
450
  }),
203
- onChange: $,
204
- value: S,
205
- disabled: d,
206
- variant: J,
207
- rightSlotClassName: e["right-slot"],
208
- requiredMarkClassName: e["required-mark"],
451
+ onChange: fe,
452
+ value: M,
453
+ disabled: p,
454
+ variant: se,
455
+ rightSlotClassName: t["right-slot"],
456
+ requiredMarkClassName: t["required-mark"],
209
457
  "data-testid": "select-search-input",
210
- onFocus: Ie,
458
+ onFocus: je,
211
459
  rightAddon: {
212
460
  addonType: "icon",
213
- addonContent: Le(l, i)
461
+ addonContent: it(l, s)
214
462
  },
215
- autocomplete: G,
216
- ...j
463
+ autocomplete: ae,
464
+ ...re
217
465
  }
218
466
  )
219
467
  }
220
468
  ),
221
- T && S && /* @__PURE__ */ n(
222
- ke,
469
+ K && M && /* @__PURE__ */ i(
470
+ st,
223
471
  {
224
472
  tabIndex: -1,
225
- className: u(e.clear, {
226
- [e.disabled]: d
473
+ className: c(t.clear, {
474
+ [t.disabled]: p
227
475
  }),
228
- iconButtonClassName: e["icon-button"],
476
+ iconButtonClassName: t["icon-button"],
229
477
  isIconButton: !0,
230
478
  iconName: "Close16px",
231
479
  size: "m-s",
232
480
  clear: !0,
233
- disabled: d,
481
+ disabled: p,
234
482
  variant: "secondary-gray",
235
- onClick: we,
483
+ onClick: $e,
236
484
  "data-testid": "clear-button"
237
485
  }
238
486
  )
239
487
  ] }),
240
- !I && /* @__PURE__ */ n(
241
- se,
488
+ !L && /* @__PURE__ */ i(
489
+ xe,
242
490
  {
243
- as: ne,
244
- label: B,
245
- size: te(i),
246
- className: e["multi-select-input"],
247
- rightSlotClassName: e["right-slot"],
248
- requiredMarkClassName: e["required-mark"],
249
- value: S,
250
- disabled: d,
251
- variant: J,
252
- withClearButton: T,
253
- onFocus: () => {
254
- h(!0), L(_);
255
- },
256
- onMouseDown: be,
257
- onChange: $,
258
- ref: b,
259
- rightAddon: {
260
- addonType: "react-node",
261
- addonContent: ae && /* @__PURE__ */ n(
262
- ie,
263
- {
264
- className: u(e.button, {
265
- [e.disabled]: d
266
- }),
267
- disabled: d,
268
- onMouseDown: Q,
269
- children: /* @__PURE__ */ n(
270
- ye,
271
- {
272
- iconName: i == R.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
273
- className: u(e["selector-icon"], {
274
- [e["selector-icon-open"]]: l
275
- })
276
- }
277
- )
278
- }
279
- )
280
- },
491
+ as: ye,
492
+ label: ne,
493
+ size: ke(s),
494
+ className: t["multi-select-input"],
495
+ rightSlotClassName: t["right-slot"],
496
+ requiredMarkClassName: t["required-mark"],
497
+ value: M,
498
+ disabled: p,
499
+ variant: se,
500
+ withClearButton: K,
501
+ onFocus: _e,
502
+ onMouseDown: He,
503
+ onChange: fe,
504
+ ref: I,
505
+ rightAddon: Ue(),
281
506
  "data-testid": "select-search-input",
282
- autocomplete: G,
283
- ...j
507
+ autocomplete: ae,
508
+ ...re
284
509
  }
285
510
  ),
286
- l && he && /* @__PURE__ */ n(Y, { children: f.length ? K.length ? /* @__PURE__ */ n(
287
- Ve,
288
- {
289
- className: u(
290
- e.options,
291
- e[i],
292
- e[A],
293
- { [e.visible]: V }
294
- ),
295
- modal: !1,
296
- static: !0,
297
- children: ({ option: t }) => /* @__PURE__ */ n(
298
- qe,
299
- {
300
- value: t,
301
- className: ({ focus: o }) => u(
302
- e.option,
303
- ue,
304
- i && e[i],
305
- {
306
- [e["option-active"]]: o
307
- }
308
- ),
309
- children: /* @__PURE__ */ E(Y, { children: [
310
- /* @__PURE__ */ E("div", { className: e["option-inner"], children: [
311
- t.name,
312
- t.bottom && /* @__PURE__ */ n("div", { children: t.bottom })
313
- ] }),
314
- /* @__PURE__ */ n(
315
- Te,
316
- {
317
- isInteractive: !1,
318
- checked: c.some(
319
- (o) => o.id === t.id
320
- )
321
- }
322
- )
323
- ] })
324
- },
325
- t.id
326
- )
327
- }
328
- ) : /* @__PURE__ */ n(
329
- "div",
330
- {
331
- className: u(
332
- e.options,
333
- e[i],
334
- e["no-options"],
335
- e[A],
336
- { [e.visible]: V }
337
- ),
338
- children: "Ничего не найдено"
339
- }
340
- ) : /* @__PURE__ */ n(
341
- "div",
342
- {
343
- className: u(
344
- e.options,
345
- e[i],
346
- e["no-options"],
347
- e[A],
348
- { [e.visible]: V }
349
- ),
350
- children: "Нет данных"
351
- }
352
- ) })
511
+ l && Be && Ke()
353
512
  ]
354
513
  }
355
514
  )
356
515
  }
357
516
  ),
358
- de && c.length > 0 && /* @__PURE__ */ n("div", { className: e["chip-container"], children: c.map((t) => /* @__PURE__ */ n(
359
- Oe,
517
+ Oe && r.length > 0 && /* @__PURE__ */ i("div", { className: t["chip-container"], children: r.map((e) => /* @__PURE__ */ i(
518
+ rt,
360
519
  {
361
- size: i === R.L ? "s" : "xs",
362
- variant: pe,
363
- className: e["chip-root"],
520
+ size: s === D.L ? "s" : "xs",
521
+ variant: ze,
522
+ className: t["chip-root"],
364
523
  withAction: !0,
365
- onClose: () => ve(t),
366
- children: /* @__PURE__ */ n("span", { className: e.chip, children: t.name })
524
+ onClose: () => Re(e),
525
+ children: /* @__PURE__ */ i("span", { className: t.chip, children: e.name })
367
526
  },
368
- t.id
527
+ e.id
369
528
  )) })
370
529
  ] });
371
530
  }
372
531
  );
373
532
  export {
374
- at as MultiSelectSearch
533
+ Ft as MultiSelectSearch
375
534
  };