mimir-ui-kit 1.43.12 → 1.43.14

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.
@@ -28,4 +28,5 @@ export declare const SelectSearch: import('react').ForwardRefExoticComponent<Pic
28
28
  groupBy?: string;
29
29
  getGroupTitle?: (groupValue: string) => string;
30
30
  optionLayout?: import('./types').TOptionLayout;
31
+ autoPlacement?: boolean;
31
32
  } & import('react').RefAttributes<HTMLElement>>;
@@ -1,171 +1,185 @@
1
- import { jsx as r, jsxs as c, Fragment as V } from "react/jsx-runtime";
2
- import { u as zt } from "../../index-D5H8gPPn.js";
1
+ import { jsx as s, jsxs as c, Fragment as A } from "react/jsx-runtime";
2
+ import { u as Ae } from "../../index-D5H8gPPn.js";
3
3
  import { c as i } from "../../index-DIxK0V-G.js";
4
- import { forwardRef as Lt, useRef as Dt, useState as E, useMemo as q, useEffect as st, useCallback as Vt } from "react";
5
- import { ESelectSearchSize as l, ELoadingIndicatorPlacement as x } from "./constants.js";
6
- import { prepareGroupedItems as Et, mapSizeToInputSize as it, getDropdownArrowIcon as Tt } from "./utils.js";
7
- import { Icon as P } from "../../icons/Icon.js";
8
- import { Button as Bt } from "../Button/Button.js";
9
- import { I as at } from "../../Input-BU_6U1CW.js";
10
- import { EInputVariant as At } from "../Input/constants.js";
11
- import { Loader as ct } from "../Loader/Loader.js";
12
- import { H as Gt, U as lt, G as dt, W as ut, K as Mt } from "../../combobox-fIVOzEhl.js";
13
- import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_container_1rthm_13", jt = "_full_1rthm_26", Ft = "_button_1rthm_38", Ht = "_options_1rthm_52", $t = "_top_1rthm_63", Kt = "_bottom_1rthm_69", Ut = "_s_1rthm_2", Wt = "_m_1rthm_110", Qt = "_l_1rthm_123", Yt = "_loader_1rthm_161", Jt = "_option_1rthm_52", Rt = "_clear_1rthm_200", t = {
4
+ import { forwardRef as Be, useRef as ue, useState as x, useMemo as F, useCallback as me, useEffect as H } from "react";
5
+ import { ESelectSearchSize as l, ELoadingIndicatorPlacement as I } from "./constants.js";
6
+ import { prepareGroupedItems as Pe, shouldShowMenuOnTop as Ge, mapSizeToInputSize as pe, getDropdownArrowIcon as qe } from "./utils.js";
7
+ import { Icon as $ } from "../../icons/Icon.js";
8
+ import { Button as je } from "../Button/Button.js";
9
+ import { I as he } from "../../Input-BU_6U1CW.js";
10
+ import { EInputVariant as Fe } from "../Input/constants.js";
11
+ import { Loader as _e } from "../Loader/Loader.js";
12
+ import { H as He, U as fe, G as ve, W as ge, K as $e } from "../../combobox-fIVOzEhl.js";
13
+ import '../../assets/SelectSearch.css';const Ke = "_disabled_1rthm_6", Ue = "_container_1rthm_13", We = "_full_1rthm_26", Qe = "_button_1rthm_38", Re = "_options_1rthm_52", Ye = "_top_1rthm_63", Je = "_bottom_1rthm_69", Xe = "_s_1rthm_2", Ze = "_m_1rthm_110", et = "_l_1rthm_123", tt = "_loader_1rthm_161", nt = "_option_1rthm_52", ot = "_clear_1rthm_200", t = {
14
14
  "select-search": "_select-search_1rthm_2",
15
- disabled: qt,
16
- container: Pt,
15
+ disabled: Ke,
16
+ container: Ue,
17
17
  "container-open": "_container-open_1rthm_22",
18
- full: jt,
18
+ full: We,
19
19
  "selected-icon": "_selected-icon_1rthm_30",
20
20
  "selector-icon-open": "_selector-icon-open_1rthm_34",
21
- button: Ft,
21
+ button: Qe,
22
22
  "selector-icon": "_selector-icon_1rthm_34",
23
- options: Ht,
24
- top: $t,
25
- bottom: Kt,
23
+ options: Re,
24
+ top: Ye,
25
+ bottom: Je,
26
26
  "no-options": "_no-options_1rthm_75",
27
- s: Ut,
28
- m: Wt,
29
- l: Qt,
27
+ s: Xe,
28
+ m: Ze,
29
+ l: et,
30
30
  "select-search-input": "_select-search-input_1rthm_136",
31
31
  "select-search-input-disabled": "_select-search-input-disabled_1rthm_139",
32
32
  "group-header": "_group-header_1rthm_146",
33
33
  "sticky-active": "_sticky-active_1rthm_157",
34
- loader: Yt,
34
+ loader: tt,
35
35
  "input-container": "_input-container_1rthm_166",
36
- option: Jt,
36
+ option: nt,
37
37
  "option-active": "_option-active_1rthm_180",
38
38
  "option-inner": "_option-inner_1rthm_183",
39
39
  "right-slot": "_right-slot_1rthm_190",
40
40
  "required-mark": "_required-mark_1rthm_195",
41
- clear: Rt,
41
+ clear: ot,
42
42
  "icon-button": "_icon-button_1rthm_209"
43
- }, Xt = Lt(
44
- (mt, pt) => {
43
+ }, st = Be(
44
+ (be, ye) => {
45
45
  const {
46
- placeholder: j,
46
+ placeholder: K,
47
47
  size: o = l.L,
48
48
  value: d,
49
49
  onChange: a,
50
- full: ht,
51
- showArrow: _t = !0,
50
+ full: Ne,
51
+ showArrow: Se = !0,
52
52
  items: g = [],
53
- classNameOption: F,
54
- classNameOptionInner: H,
55
- displayValue: S = "name",
56
- filterOnSearch: $ = !0,
57
- onSearch: I,
58
- variant: K = At.DefaultGray,
59
- menuPlacement: k = "bottom",
53
+ classNameOption: U,
54
+ classNameOptionInner: W,
55
+ displayValue: w = "name",
56
+ filterOnSearch: Q = !0,
57
+ onSearch: k,
58
+ variant: R = Fe.DefaultGray,
59
+ menuPlacement: C = "bottom",
60
60
  disabled: u = !1,
61
- searchProps: U,
62
- withClearButton: T = !1,
63
- disableInput: h = !1,
64
- autocomplete: W = "on",
65
- immediate: ft = !1,
66
- noOptionsText: gt = "Нет данных",
67
- noMatchText: vt = "Ничего не найдено",
68
- loadOnOpen: B,
69
- loading: Q,
70
- loadingIndicatorPlacement: w = x.Dropdown,
71
- groupBy: p,
72
- getGroupTitle: Y = (e) => e,
73
- optionLayout: bt = "name-bottom"
74
- } = mt, A = (e) => {
61
+ searchProps: Y,
62
+ withClearButton: B = !1,
63
+ disableInput: _ = !1,
64
+ autocomplete: J = "on",
65
+ immediate: xe = !1,
66
+ noOptionsText: Ie = "Нет данных",
67
+ noMatchText: we = "Ничего не найдено",
68
+ loadOnOpen: P,
69
+ loading: X,
70
+ loadingIndicatorPlacement: L = I.Dropdown,
71
+ groupBy: h,
72
+ getGroupTitle: Z = (e) => e,
73
+ optionLayout: ke = "name-bottom",
74
+ autoPlacement: z = !1
75
+ } = be, G = (e) => {
75
76
  if (!e) return "";
76
- const n = e[S];
77
+ const n = e[w];
77
78
  return typeof n == "string" ? n : String(n || "");
78
- }, yt = (e) => {
79
- const n = e[S];
79
+ }, Ce = (e) => {
80
+ const n = e[w];
80
81
  return typeof n == "string" ? n : String(n || "");
81
- }, G = A(d), C = Dt(null), [_, v] = E(G), [m, b] = E(d), [Nt, J] = E(!1), [M, xt] = E(null), R = Q !== void 0 ? Q : Nt, y = q(() => {
82
- if (!$)
82
+ }, q = G(d), O = ue(null), ee = ue(null), [f, b] = x(q), [m, y] = x(d), [Le, te] = x(!1), [j, ze] = x(null), [E, ne] = x(C), oe = X !== void 0 ? X : Le, N = F(() => {
83
+ if (!Q)
83
84
  return g;
84
- const e = String(_ || "").trim().toLowerCase();
85
- return e ? g.filter((n) => yt(n).toLowerCase().includes(e)) : g;
86
- }, [_, g, $, S]), N = q(() => p ? Et(
87
- y,
88
- p,
89
- Y || ((e) => e)
90
- ) : y, [y, p, Y]), O = q(() => {
85
+ const e = String(f || "").trim().toLowerCase();
86
+ return e ? g.filter((n) => Ce(n).toLowerCase().includes(e)) : g;
87
+ }, [f, g, Q, w]), S = F(() => h ? Pe(
88
+ N,
89
+ h,
90
+ Z || ((e) => e)
91
+ ) : N, [N, h, Z]), D = F(() => {
91
92
  const e = [];
92
- return N.forEach((n, s) => {
93
- n.isGroupHeader && e.push(s);
93
+ return S.forEach((n, r) => {
94
+ n.isGroupHeader && e.push(r);
94
95
  }), e;
95
- }, [N]), f = zt({
96
- count: N.length,
97
- getScrollElement: () => C.current,
96
+ }, [S]), v = Ae({
97
+ count: S.length,
98
+ getScrollElement: () => O.current,
98
99
  estimateSize: () => o === l.L ? 65 : 49,
99
100
  overscan: 10
100
- });
101
- st(() => {
102
- const e = C.current;
103
- if (!e || !p) return;
101
+ }), p = me(() => {
102
+ if (!z) {
103
+ ne(C);
104
+ return;
105
+ }
106
+ const e = Ge(ee, o);
107
+ ne(e ? "top" : C);
108
+ }, [z, C, o]);
109
+ H(() => {
110
+ if (z)
111
+ return p(), window.addEventListener("scroll", p), window.addEventListener("resize", p), () => {
112
+ window.removeEventListener("scroll", p), window.removeEventListener("resize", p);
113
+ };
114
+ }, [z, p]), H(() => {
115
+ const e = O.current;
116
+ if (!e || !h) return;
104
117
  const n = () => {
105
- var nt, ot;
106
- const s = e.scrollTop;
107
- let z = null;
108
- for (let L = 0; L < O.length; L++) {
109
- const rt = O[L];
110
- if ((((nt = f.getVirtualItems().find((D) => D.index === rt)) == null ? void 0 : nt.start) || 0) <= s) {
111
- z = rt;
112
- const D = O[L + 1];
113
- if (D !== void 0 && (((ot = f.getVirtualItems().find((Ot) => Ot.index === D)) == null ? void 0 : ot.start) || 0) <= s)
118
+ var ce, le;
119
+ const r = e.scrollTop;
120
+ let V = null;
121
+ for (let M = 0; M < D.length; M++) {
122
+ const de = D[M];
123
+ if ((((ce = v.getVirtualItems().find((T) => T.index === de)) == null ? void 0 : ce.start) || 0) <= r) {
124
+ V = de;
125
+ const T = D[M + 1];
126
+ if (T !== void 0 && (((le = v.getVirtualItems().find((Te) => Te.index === T)) == null ? void 0 : le.start) || 0) <= r)
114
127
  continue;
115
128
  } else
116
129
  break;
117
130
  }
118
- xt(z);
131
+ ze(V);
119
132
  };
120
133
  return e.addEventListener("scroll", n), () => e.removeEventListener("scroll", n);
121
- }, [f, O, p, C.current]);
122
- const X = async () => {
123
- if (B)
134
+ }, [v, D, h, O.current]);
135
+ const se = async () => {
136
+ if (P)
124
137
  try {
125
- J(!0), await B();
138
+ te(!0), await P();
126
139
  } finally {
127
- J(!1);
140
+ te(!1);
128
141
  }
129
- }, St = (e) => {
142
+ }, Oe = (e) => {
130
143
  if (e) {
131
- const n = A(e);
132
- v(n), b(e), a == null || a(e);
144
+ const n = G(e);
145
+ b(n), y(e), a == null || a(e);
133
146
  } else
134
- v(""), b(null), a == null || a({ id: "", name: "" });
135
- }, Z = Vt(
147
+ b(""), y(null), a == null || a({ id: "", name: "" });
148
+ }, re = me(
136
149
  (e) => {
137
- if (h) return;
150
+ if (_) return;
138
151
  const n = e.target.value;
139
- v(n), I == null || I(n), m && n !== A(m) && b(null), !n && d && (a == null || a({ id: "", name: "" }));
152
+ b(n), k == null || k(n), m && n !== G(m) && y(null), !n && d && (a == null || a({ id: "", name: "" }));
140
153
  },
141
- [h, a, I, d, m, S]
142
- ), It = () => {
143
- v(""), b(null), a == null || a({ id: "", name: "" });
144
- }, tt = async (e) => {
145
- h && e.target.blur(), B && await X();
154
+ [_, a, k, d, m, w]
155
+ ), Ee = () => {
156
+ b(""), y(null), a == null || a({ id: "", name: "" });
157
+ }, ie = async (e) => {
158
+ _ && e.target.blur(), p(), P && await se();
146
159
  };
147
- st(() => {
160
+ H(() => {
148
161
  const e = !d || typeof d == "object" && !Object.keys(d).length;
149
- v(e ? "" : G), b(e ? null : d);
150
- }, [d, G]);
151
- const kt = () => R && (w === x.Dropdown || w === x.Both) ? /* @__PURE__ */ c("div", { className: t.loader, children: [
152
- /* @__PURE__ */ r(ct, { size: "s" }),
162
+ b(e ? "" : q), y(e ? null : d);
163
+ }, [d, q]);
164
+ const De = () => oe && (L === I.Dropdown || L === I.Both) ? /* @__PURE__ */ c("div", { className: t.loader, children: [
165
+ /* @__PURE__ */ s(_e, { size: "s" }),
153
166
  "Загрузка..."
154
- ] }) : gt, wt = (e) => {
155
- if (_t)
167
+ ] }) : Ie, Ve = (e) => {
168
+ if (Se)
156
169
  return {
157
170
  addonType: "react-node",
158
- addonContent: /* @__PURE__ */ c(V, { children: [
159
- R && (w === x.Input || w === x.Both) && /* @__PURE__ */ r(ct, { size: "s" }),
160
- /* @__PURE__ */ r(
161
- lt,
171
+ addonContent: /* @__PURE__ */ c(A, { children: [
172
+ oe && (L === I.Input || L === I.Both) && /* @__PURE__ */ s(_e, { size: "s" }),
173
+ /* @__PURE__ */ s(
174
+ fe,
162
175
  {
163
176
  className: i(t.button, {
164
177
  [t.disabled]: u
165
178
  }),
166
179
  disabled: u,
167
- children: /* @__PURE__ */ r(
168
- P,
180
+ onClick: p,
181
+ children: /* @__PURE__ */ s(
182
+ $,
169
183
  {
170
184
  iconName: o == l.M || o == l.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
171
185
  className: i(t["selector-icon"], {
@@ -177,27 +191,31 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
177
191
  )
178
192
  ] })
179
193
  };
180
- }, et = (e) => {
181
- const n = e.name, s = e.bottom && /* @__PURE__ */ r("div", { children: e.bottom });
182
- return bt === "bottom-name" ? /* @__PURE__ */ c(V, { children: [
183
- s,
194
+ }, ae = (e) => {
195
+ const n = e.name, r = e.bottom && /* @__PURE__ */ s("div", { children: e.bottom });
196
+ return ke === "bottom-name" ? /* @__PURE__ */ c(A, { children: [
197
+ r,
184
198
  n
185
- ] }) : /* @__PURE__ */ c(V, { children: [
199
+ ] }) : /* @__PURE__ */ c(A, { children: [
186
200
  n,
187
- s
201
+ r
188
202
  ] });
189
- }, Ct = (e) => g.length ? y.length ? p ? /* @__PURE__ */ c(
203
+ }, Me = (e) => g.length ? N.length ? h ? /* @__PURE__ */ c(
190
204
  "div",
191
205
  {
192
- ref: C,
206
+ ref: O,
193
207
  "data-testid": "select-search-options",
194
- className: i(t.options, t[o], t[k]),
208
+ className: i(
209
+ t.options,
210
+ t[o],
211
+ t[E]
212
+ ),
195
213
  style: {
196
214
  height: o === l.M || o === l.S ? "240px" : "320px",
197
215
  overflow: "auto"
198
216
  },
199
217
  children: [
200
- M !== null && /* @__PURE__ */ r(
218
+ j !== null && /* @__PURE__ */ s(
201
219
  "div",
202
220
  {
203
221
  className: t["group-header"],
@@ -206,23 +224,23 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
206
224
  top: 0,
207
225
  zIndex: 3
208
226
  },
209
- children: N[M].name
227
+ children: S[j].name
210
228
  }
211
229
  ),
212
- /* @__PURE__ */ r(
230
+ /* @__PURE__ */ s(
213
231
  "div",
214
232
  {
215
233
  style: {
216
- height: `${f.getTotalSize()}px`,
234
+ height: `${v.getTotalSize()}px`,
217
235
  width: "100%"
218
236
  },
219
- children: f.getVirtualItems().map((n) => {
220
- const s = N[n.index];
221
- return /* @__PURE__ */ r(
237
+ children: v.getVirtualItems().map((n) => {
238
+ const r = S[n.index];
239
+ return /* @__PURE__ */ s(
222
240
  "div",
223
241
  {
224
242
  "data-index": n.index,
225
- ref: f.measureElement,
243
+ ref: v.measureElement,
226
244
  style: {
227
245
  position: "absolute",
228
246
  top: 0,
@@ -230,41 +248,41 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
230
248
  width: "100%",
231
249
  transform: `translateY(${n.start}px)`
232
250
  },
233
- children: s.isGroupHeader ? /* @__PURE__ */ r(
251
+ children: r.isGroupHeader ? /* @__PURE__ */ s(
234
252
  "div",
235
253
  {
236
254
  className: t["group-header"],
237
255
  style: {
238
- visibility: M === n.index ? "hidden" : "visible"
256
+ visibility: j === n.index ? "hidden" : "visible"
239
257
  },
240
- children: s.name
258
+ children: r.name
241
259
  }
242
260
  ) : /* @__PURE__ */ c(
243
- ut,
261
+ ge,
244
262
  {
245
- value: s,
246
- className: ({ focus: z }) => i(
263
+ value: r,
264
+ className: ({ focus: V }) => i(
247
265
  t.option,
248
- F,
266
+ U,
249
267
  o && t[o],
250
268
  {
251
- [t["option-active"]]: z
269
+ [t["option-active"]]: V
252
270
  }
253
271
  ),
254
- "data-testid": `select-search-option-${s.id}`,
272
+ "data-testid": `select-search-option-${r.id}`,
255
273
  children: [
256
- /* @__PURE__ */ r(
274
+ /* @__PURE__ */ s(
257
275
  "div",
258
276
  {
259
277
  className: i(
260
278
  t["option-inner"],
261
- H
279
+ W
262
280
  ),
263
- children: et(s)
281
+ children: ae(r)
264
282
  }
265
283
  ),
266
- m && m.id === s.id && /* @__PURE__ */ r(
267
- P,
284
+ m && m.id === r.id && /* @__PURE__ */ s(
285
+ $,
268
286
  {
269
287
  iconName: o === l.M || o === l.S ? "Done16px" : "Done24px",
270
288
  className: t["selected-icon"]
@@ -272,7 +290,7 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
272
290
  )
273
291
  ]
274
292
  },
275
- s.id
293
+ r.id
276
294
  )
277
295
  },
278
296
  n.key
@@ -282,38 +300,42 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
282
300
  )
283
301
  ]
284
302
  }
285
- ) : /* @__PURE__ */ r(
286
- Mt,
303
+ ) : /* @__PURE__ */ s(
304
+ $e,
287
305
  {
288
- className: i(t.options, t[o], t[k]),
306
+ className: i(
307
+ t.options,
308
+ t[o],
309
+ t[E]
310
+ ),
289
311
  "data-testid": "select-search-options",
290
312
  style: { width: "100%" },
291
313
  static: !0,
292
314
  children: ({ option: n }) => /* @__PURE__ */ c(
293
- ut,
315
+ ge,
294
316
  {
295
317
  value: n,
296
- className: ({ focus: s }) => i(
318
+ className: ({ focus: r }) => i(
297
319
  t.option,
298
- F,
320
+ U,
299
321
  {
300
- [t["option-active"]]: s
322
+ [t["option-active"]]: r
301
323
  },
302
324
  o && t[o]
303
325
  ),
304
326
  children: [
305
- /* @__PURE__ */ r(
327
+ /* @__PURE__ */ s(
306
328
  "div",
307
329
  {
308
330
  className: i(
309
331
  t["option-inner"],
310
- H
332
+ W
311
333
  ),
312
- children: et(n)
334
+ children: ae(n)
313
335
  }
314
336
  ),
315
- m && m.id === n.id && /* @__PURE__ */ r(
316
- P,
337
+ m && m.id === n.id && /* @__PURE__ */ s(
338
+ $,
317
339
  {
318
340
  iconName: o === l.M || o === l.S ? "Done16px" : "Done24px",
319
341
  className: t["selected-icon"]
@@ -324,89 +346,90 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
324
346
  n.id
325
347
  )
326
348
  }
327
- ) : /* @__PURE__ */ r(
349
+ ) : /* @__PURE__ */ s(
328
350
  "div",
329
351
  {
330
352
  className: i(
331
353
  t.options,
332
354
  t[o],
333
355
  t["no-options"],
334
- t[k]
356
+ t[E]
335
357
  ),
336
358
  "data-headlessui-state": e ? "open" : "closed",
337
- children: vt
359
+ children: we
338
360
  }
339
- ) : /* @__PURE__ */ r(
361
+ ) : /* @__PURE__ */ s(
340
362
  "div",
341
363
  {
342
364
  className: i(
343
365
  t.options,
344
366
  t[o],
345
367
  t["no-options"],
346
- t[k]
368
+ t[E]
347
369
  ),
348
370
  "data-headlessui-state": e ? "open" : "closed",
349
- children: kt()
371
+ children: De()
350
372
  }
351
373
  );
352
- return /* @__PURE__ */ r(
353
- Gt,
374
+ return /* @__PURE__ */ s(
375
+ He,
354
376
  {
355
377
  as: "div",
356
378
  value: m,
357
379
  className: i(t["select-search"], {
358
- [t.full]: ht,
380
+ [t.full]: Ne,
359
381
  [t.disabled]: u
360
382
  }),
361
- onChange: St,
362
- ref: pt,
383
+ onChange: Oe,
384
+ ref: ye,
363
385
  disabled: u,
364
- virtual: p ? void 0 : { options: y },
365
- immediate: ft,
366
- children: ({ open: e }) => /* @__PURE__ */ c(V, { children: [
386
+ virtual: h ? void 0 : { options: N },
387
+ immediate: xe,
388
+ children: ({ open: e }) => /* @__PURE__ */ c(A, { children: [
367
389
  /* @__PURE__ */ c(
368
390
  "div",
369
391
  {
392
+ ref: ee,
370
393
  className: i(t.container, t[o], {
371
394
  [t["container-open"]]: e
372
395
  }),
373
396
  children: [
374
- h && /* @__PURE__ */ c("div", { className: t["input-container"], children: [
375
- /* @__PURE__ */ r(
376
- lt,
397
+ _ && /* @__PURE__ */ c("div", { className: t["input-container"], children: [
398
+ /* @__PURE__ */ s(
399
+ fe,
377
400
  {
378
401
  disabled: u,
379
402
  style: { width: "100%" },
380
- onClick: X,
381
- children: /* @__PURE__ */ r(
382
- dt,
403
+ onClick: se,
404
+ children: /* @__PURE__ */ s(
405
+ ve,
383
406
  {
384
- as: at,
385
- label: j,
386
- size: it(o),
407
+ as: he,
408
+ label: K,
409
+ size: pe(o),
387
410
  className: i(t["select-search-input"], {
388
- [t["select-search-input-disabled"]]: h && T
411
+ [t["select-search-input-disabled"]]: _ && B
389
412
  }),
390
- onChange: Z,
391
- value: _,
413
+ onChange: re,
414
+ value: f,
392
415
  disabled: u,
393
- variant: K,
416
+ variant: R,
394
417
  rightSlotClassName: t["right-slot"],
395
418
  requiredMarkClassName: t["required-mark"],
396
419
  "data-testid": "select-search-input",
397
- onFocus: tt,
420
+ onFocus: ie,
398
421
  rightAddon: {
399
422
  addonType: "icon",
400
- addonContent: Tt(e, o)
423
+ addonContent: qe(e, o)
401
424
  },
402
- autocomplete: W,
403
- ...U
425
+ autocomplete: J,
426
+ ...Y
404
427
  }
405
428
  )
406
429
  }
407
430
  ),
408
- T && _ && /* @__PURE__ */ r(
409
- Bt,
431
+ B && f && /* @__PURE__ */ s(
432
+ je,
410
433
  {
411
434
  tabIndex: -1,
412
435
  className: i(t.clear, {
@@ -420,43 +443,43 @@ import '../../assets/SelectSearch.css';const qt = "_disabled_1rthm_6", Pt = "_co
420
443
  disabled: u,
421
444
  variant: "secondary-gray",
422
445
  onClick: (n) => {
423
- n.stopPropagation(), It();
446
+ n.stopPropagation(), Ee();
424
447
  },
425
448
  "data-testid": "clear-button"
426
449
  }
427
450
  )
428
451
  ] }),
429
- !h && /* @__PURE__ */ r(
430
- dt,
452
+ !_ && /* @__PURE__ */ s(
453
+ ve,
431
454
  {
432
- as: at,
433
- label: j,
434
- size: it(o),
455
+ as: he,
456
+ label: K,
457
+ size: pe(o),
435
458
  className: t["select-search-input"],
436
459
  rightSlotClassName: t["right-slot"],
437
460
  requiredMarkClassName: t["required-mark"],
438
- value: _,
461
+ value: f,
439
462
  disabled: u,
440
- variant: K,
441
- withClearButton: T && !!_,
442
- onChange: Z,
443
- rightAddon: wt(e),
463
+ variant: R,
464
+ withClearButton: B && !!f,
465
+ onChange: re,
466
+ rightAddon: Ve(e),
444
467
  "data-testid": "select-search-input",
445
- onFocus: tt,
446
- autocomplete: W,
447
- ...U
468
+ onFocus: ie,
469
+ autocomplete: J,
470
+ ...Y
448
471
  }
449
472
  )
450
473
  ]
451
474
  }
452
475
  ),
453
- e && Ct(e)
476
+ e && Me(e)
454
477
  ] })
455
478
  }
456
479
  );
457
480
  }
458
481
  );
459
- Xt.displayName = "SelectSearch";
482
+ st.displayName = "SelectSearch";
460
483
  export {
461
- Xt as SelectSearch
484
+ st as SelectSearch
462
485
  };
@@ -9,3 +9,5 @@ export declare enum ELoadingIndicatorPlacement {
9
9
  Both = "both",
10
10
  None = "none"
11
11
  }
12
+ export declare const MOBILE_MENU_HEIGHT = 240;
13
+ export declare const DESKTOP_MENU_HEIGHT = 320;
@@ -1,5 +1,8 @@
1
- var r = /* @__PURE__ */ ((p) => (p.S = "s", p.M = "m", p.L = "l", p))(r || {}), u = /* @__PURE__ */ ((p) => (p.Input = "input", p.Dropdown = "dropdown", p.Both = "both", p.None = "none", p))(u || {});
1
+ var p = /* @__PURE__ */ ((o) => (o.S = "s", o.M = "m", o.L = "l", o))(p || {}), r = /* @__PURE__ */ ((o) => (o.Input = "input", o.Dropdown = "dropdown", o.Both = "both", o.None = "none", o))(r || {});
2
+ const u = 240, H = 320;
2
3
  export {
3
- u as ELoadingIndicatorPlacement,
4
- r as ESelectSearchSize
4
+ H as DESKTOP_MENU_HEIGHT,
5
+ r as ELoadingIndicatorPlacement,
6
+ p as ESelectSearchSize,
7
+ u as MOBILE_MENU_HEIGHT
5
8
  };
@@ -95,4 +95,8 @@ export type TSelectSearchProps = Pick<TInputProps, 'withClearButton' | 'variant'
95
95
  * @default 'name-bottom'
96
96
  */
97
97
  optionLayout?: TOptionLayout;
98
+ /**
99
+ * Автоматическое определение положения выпадающего меню
100
+ */
101
+ autoPlacement?: boolean;
98
102
  };
@@ -5,3 +5,4 @@ import { EInputSize } from '../Input';
5
5
  export declare const mapSizeToInputSize: (size: ESelectSearchSize) => EInputSize;
6
6
  export declare const getDropdownArrowIcon: (isOpen: boolean, size: ESelectSearchSize) => "DropdownArrowBottom16px" | "DropdownArrowUp16px" | "DropdownArrowUp24px" | "DropdownArrowDown24px";
7
7
  export declare const prepareGroupedItems: (items: TSelectOption[], groupBy: string, getGroupTitle: (value: string) => string) => TSelectOption[];
8
+ export declare const shouldShowMenuOnTop: (selectRef: React.RefObject<HTMLDivElement>, size: ESelectSearchSize) => boolean;
@@ -1,33 +1,38 @@
1
- import { ESelectSearchSize as t } from "./constants.js";
1
+ import { ESelectSearchSize as t, MOBILE_MENU_HEIGHT as i, DESKTOP_MENU_HEIGHT as a } from "./constants.js";
2
2
  import "../../Input-BU_6U1CW.js";
3
- import { EInputSize as n } from "../Input/constants.js";
4
- const w = (r) => {
3
+ import { EInputSize as s } from "../Input/constants.js";
4
+ const h = (r) => {
5
5
  switch (r) {
6
6
  case t.S:
7
- return n.S;
7
+ return s.S;
8
8
  case t.M:
9
- return n.M;
9
+ return s.M;
10
10
  case t.L:
11
- return n.L;
11
+ return s.L;
12
12
  default:
13
- return n.M;
13
+ return s.M;
14
14
  }
15
- }, S = (r, o) => r ? o === t.L ? "DropdownArrowUp24px" : "DropdownArrowUp16px" : o === t.L ? "DropdownArrowDown24px" : "DropdownArrowBottom16px", f = (r, o, a) => {
15
+ }, l = (r, o) => r ? o === t.L ? "DropdownArrowUp24px" : "DropdownArrowUp16px" : o === t.L ? "DropdownArrowDown24px" : "DropdownArrowBottom16px", f = (r, o, u) => {
16
16
  if (!r.length || !o) return r;
17
- const p = [], u = /* @__PURE__ */ new Set();
18
- for (const s of r) {
19
- const e = String(s[o] || "Без группы");
20
- u.has(e) || (u.add(e), p.push({
17
+ const n = [], c = /* @__PURE__ */ new Set();
18
+ for (const p of r) {
19
+ const e = String(p[o] || "Без группы");
20
+ c.has(e) || (c.add(e), n.push({
21
21
  id: `group-header-${e}`,
22
- name: a(e),
22
+ name: u(e),
23
23
  isGroupHeader: !0,
24
24
  originalValue: e
25
- })), p.push(s);
25
+ })), n.push(p);
26
26
  }
27
- return p;
27
+ return n;
28
+ }, g = (r, o) => {
29
+ if (!r.current) return !1;
30
+ const u = r.current.getBoundingClientRect(), n = window.innerHeight, c = o === t.M || o === t.S ? i : a, p = n - u.bottom, e = u.top;
31
+ return p >= c ? !1 : e > p;
28
32
  };
29
33
  export {
30
- S as getDropdownArrowIcon,
31
- w as mapSizeToInputSize,
32
- f as prepareGroupedItems
34
+ l as getDropdownArrowIcon,
35
+ h as mapSizeToInputSize,
36
+ f as prepareGroupedItems,
37
+ g as shouldShowMenuOnTop
33
38
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.43.12",
4
+ "version": "1.43.14",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {