mimir-ui-kit 1.38.7 → 1.38.9

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.
@@ -1 +1 @@
1
- ._multi-select-search_17kql_2{position:relative}._multi-select-search_17kql_2._disabled_17kql_5{cursor:not-allowed}._container_17kql_9{display:block;gap:var(--select-search-gap);align-items:center;justify-content:space-between;height:var(--select-search-height);background-color:var(--black-5);border-radius:var(--select-search-radius)}._container-open_17kql_18{border-bottom:1px solid var(--citrine-100)}._input-container_17kql_22{position:relative;width:100%}._full_17kql_27{width:100%}._selected-icon_17kql_31 path{fill:var(--sapphire-100)}._selector-icon-open_17kql_35{transform:rotate(180deg)}._button_17kql_39{display:flex;align-items:center;background:none;border:none;cursor:pointer}._button_17kql_39._disabled_17kql_5{cursor:not-allowed}._button_17kql_39._disabled_17kql_5 ._selector-icon_17kql_35 path{fill:var(--white)}._options_17kql_53{position:absolute;z-index:10;width:100%;min-height:50%;max-height:var(--select-search-options-height);overflow-y:auto;font-size:var(--mimir-size-text-l);background:var(--white);box-shadow:var(--mimir-box-shadow-select-search)}._options_17kql_53._top_17kql_64{bottom:100%;margin-bottom:1px;border-radius:var(--select-search-radius) var(--select-search-radius) 0 0}._options_17kql_53._bottom_17kql_69{top:100%;margin-top:1px;border-radius:0 0 var(--select-search-radius) var(--select-search-radius)}._options_17kql_53::-webkit-scrollbar{width:3px}._options_17kql_53::-webkit-scrollbar-thumb{background-color:var(--black-80);border-radius:var(--mimir-control-radius-xs2)}._options_17kql_53::-webkit-scrollbar-track{background-color:var(--white)}@media (max-width: 600px){._options_17kql_53{max-height:var(--mimir-select-search-options-height-mobile)}}._no-options_17kql_90{height:100%;padding:var(--select-search-option-space);color:var(--black-80)}._m_17kql_2{--select-search-height: var(--mimir-select-search-height-l);--select-search-space: var(--mimir-space-xss) var(--mimir-space-m);--select-search-radius: var(--mimir-control-radius);--select-search-gap: var(--mimir-space-2xs);--select-search-btn-space: var(--mimir-space-m) var(--mimir-space-m) var(--mimir-space-m) var(--mimir-space-xs);--select-search-option-space: var(--mimir-space-2s) var(--mimir-space-m);--select-search-options-height: var( --mimir-select-search-options-height-mobile );--clear-right: var(--mimir-space-2xxl);--multi-select-input-disabled-margin-right: var(--mimir-space-l)}._l_17kql_111{--select-search-height: var(--mimir-select-search-height-xxl);--select-search-space: var(--mimir-space-xss) var(--mimir-space-m);--select-search-radius: var(--mimir-control-radius-s);--select-search-gap: var(--mimir-space-xs);--select-search-btn-space: var(--mimir-space-l) var(--mimir-space-m) var(--mimir-space-l) var(--mimir-space-xs);--select-search-option-space: var(--mimir-space-2l) var(--mimir-space-m);--select-search-options-height: var( --mimir-select-search-options-height-desktop );--clear-right: var(--mimir-space-4xl);--multi-select-input-disabled-margin-right: var(--mimir-space-1xl)}._multi-select-input-disabled_17kql_126{margin-right:var(--multi-select-input-disabled-margin-right)}._multi-select-input_17kql_126._focused_17kql_129{height:auto;min-height:var(--input-height);overflow:hidden;resize:vertical}._multi-select-input_17kql_126:last-child{padding-right:var(--mimir-space-4xl)}._option_17kql_53{display:flex;gap:var(--mimir-space-m);align-items:center;width:100%;padding:var(--select-search-option-space);cursor:pointer;transition:background-color .2s ease-in-out}._option-active_17kql_148{background-color:var(--black-5)}._option-inner_17kql_151{display:flex;flex-direction:column;gap:var(--mimir-space-xs);width:100%}._chip_17kql_158{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}._chip-container_17kql_163{display:flex;flex-wrap:wrap;gap:var(--mimir-space-2xs);margin-top:var(--mimir-space-xs)}._chip-root_17kql_169{max-width:100%}._right-slot_17kql_173{order:2;padding-top:0!important}._required-mark_17kql_178{order:1;margin-right:var(--mimir-space-xs)}._clear_17kql_183{position:absolute;top:50%;right:var(--clear-right);transform:translateY(-50%)}._clear_17kql_183._disabled_17kql_5{cursor:not-allowed}._clear_17kql_183._disabled_17kql_5 ._icon-button_17kql_192 path{fill:var(--white)}
1
+ ._multi-select-search_io0c8_2{position:relative}._multi-select-search_io0c8_2._disabled_io0c8_5{cursor:not-allowed}._container_io0c8_9{display:block;gap:var(--select-search-gap);align-items:center;justify-content:space-between;height:var(--select-search-height);background-color:var(--black-5);border-radius:var(--select-search-radius)}._container-open_io0c8_18{border-bottom:1px solid var(--citrine-100)}._input-container_io0c8_22{position:relative;width:100%}._full_io0c8_27{width:100%}._selected-icon_io0c8_31 path{fill:var(--sapphire-100)}._selector-icon-open_io0c8_35{transform:rotate(180deg)}._button_io0c8_39{display:flex;align-items:center;background:none;border:none;cursor:pointer}._button_io0c8_39._disabled_io0c8_5{cursor:not-allowed}._button_io0c8_39._disabled_io0c8_5 ._selector-icon_io0c8_35 path{fill:var(--white)}._options_io0c8_53{position:absolute;z-index:10;width:100%;min-height:50%;max-height:var(--select-search-options-height);overflow-y:auto;font-size:var(--mimir-size-text-l);background:var(--white);box-shadow:var(--mimir-box-shadow-select-search);transition:transform .2s ease-out,opacity .2s ease-out;opacity:0}._options_io0c8_53._visible_io0c8_66{opacity:1}._options_io0c8_53._top_io0c8_69{bottom:100%;margin-bottom:1px;border-radius:var(--select-search-radius) var(--select-search-radius) 0 0}._options_io0c8_53._bottom_io0c8_74{top:100%;margin-top:1px;border-radius:0 0 var(--select-search-radius) var(--select-search-radius)}._options_io0c8_53::-webkit-scrollbar{width:3px}._options_io0c8_53::-webkit-scrollbar-thumb{background-color:var(--black-80);border-radius:var(--mimir-control-radius-xs2)}._options_io0c8_53::-webkit-scrollbar-track{background-color:var(--white)}@media (max-width: 600px){._options_io0c8_53{max-height:var(--mimir-select-search-options-height-mobile)}}._no-options_io0c8_95{height:100%;padding:var(--select-search-option-space);color:var(--black-80)}._m_io0c8_2{--select-search-height: var(--mimir-select-search-height-l);--select-search-space: var(--mimir-space-xss) var(--mimir-space-m);--select-search-radius: var(--mimir-control-radius);--select-search-gap: var(--mimir-space-2xs);--select-search-btn-space: var(--mimir-space-m) var(--mimir-space-m) var(--mimir-space-m) var(--mimir-space-xs);--select-search-option-space: var(--mimir-space-2s) var(--mimir-space-m);--select-search-options-height: var( --mimir-select-search-options-height-mobile );--clear-right: var(--mimir-space-2xxl);--multi-select-input-disabled-margin-right: var(--mimir-space-l)}._l_io0c8_116{--select-search-height: var(--mimir-select-search-height-xxl);--select-search-space: var(--mimir-space-xss) var(--mimir-space-m);--select-search-radius: var(--mimir-control-radius-s);--select-search-gap: var(--mimir-space-xs);--select-search-btn-space: var(--mimir-space-l) var(--mimir-space-m) var(--mimir-space-l) var(--mimir-space-xs);--select-search-option-space: var(--mimir-space-2l) var(--mimir-space-m);--select-search-options-height: var( --mimir-select-search-options-height-desktop );--clear-right: var(--mimir-space-4xl);--multi-select-input-disabled-margin-right: var(--mimir-space-1xl)}._multi-select-input-disabled_io0c8_131{margin-right:var(--multi-select-input-disabled-margin-right)}._multi-select-input_io0c8_131._focused_io0c8_134{height:auto;min-height:var(--input-height);overflow:hidden;resize:vertical}._multi-select-input_io0c8_131:last-child{padding-right:var(--mimir-space-4xl)}._option_io0c8_53{display:flex;gap:var(--mimir-space-m);align-items:center;width:100%;padding:var(--select-search-option-space);cursor:pointer;transition:background-color .2s ease-in-out}._option-active_io0c8_153{background-color:var(--black-5)}._option-inner_io0c8_156{display:flex;flex-direction:column;gap:var(--mimir-space-xs);width:100%}._chip_io0c8_163{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}._chip-container_io0c8_168{display:flex;flex-wrap:wrap;gap:var(--mimir-space-2xs);margin-top:var(--mimir-space-xs)}._chip-root_io0c8_174{max-width:100%}._right-slot_io0c8_178{order:2;padding-top:0!important}._required-mark_io0c8_183{order:1;margin-right:var(--mimir-space-xs)}._clear_io0c8_188{position:absolute;top:50%;right:var(--clear-right);transform:translateY(-50%)}._clear_io0c8_188._disabled_io0c8_5{cursor:not-allowed}._clear_io0c8_188._disabled_io0c8_5 ._icon-button_io0c8_197 path{fill:var(--white)}
@@ -7,7 +7,7 @@ type TChildrenProps = {
7
7
  };
8
8
  export type TProps = {
9
9
  /** Заголовок аккордеона */
10
- title: string;
10
+ title: string | ReactNode;
11
11
  /** Размер аккордеона */
12
12
  size?: EAccordionSize | `${EAccordionSize}`;
13
13
  /** Преобразование заголовка в верхний регистр */
@@ -21,4 +21,5 @@ export declare const MultiSelectSearch: import('react').ForwardRefExoticComponen
21
21
  disableInput?: boolean;
22
22
  autocomplete?: "on" | "off";
23
23
  id?: string;
24
+ autoPlacement?: boolean;
24
25
  } & import('react').RefAttributes<HTMLElement>>;
@@ -1,251 +1,280 @@
1
- import { jsxs as b, jsx as o, Fragment as P } from "react/jsx-runtime";
2
- import { c as r } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as ce, useRef as F, useState as E, useEffect as L, useMemo as ae } from "react";
4
- import { EMultiSelectSearchSize as O } from "./constants.js";
5
- import { getInitialInputValue as j, MULTISELECT_OPEN_EVENT as G, mapSizeToInputSize as U, getDropdownArrowIcon as ue, dispatchMultiselectOpen as I, joinSelectedItems as W } from "./utils.js";
6
- import { Icon as de } from "../../icons/Icon.js";
7
- import { Button as pe } from "../Button/Button.js";
8
- import { CheckboxMimir as me } from "../CheckboxMimir/CheckboxMimir.js";
9
- import { Chip as _e } from "../Chip/Chip.js";
10
- import { I as H } from "../../Input-BYrIS5GU.js";
11
- import { EInputVariant as he } from "../Input/constants.js";
12
- import { H as fe, U as J, G as K, K as ke, W as qe } from "../../combobox-CVtJDVoZ.js";
13
- import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve = "_container_17kql_9", be = "_full_17kql_27", Ie = "_button_17kql_39", we = "_options_17kql_53", Ne = "_top_17kql_64", Ce = "_bottom_17kql_69", Se = "_m_17kql_2", Me = "_l_17kql_111", Ee = "_focused_17kql_129", Le = "_option_17kql_53", Oe = "_chip_17kql_158", Te = "_clear_17kql_183", t = {
14
- "multi-select-search": "_multi-select-search_17kql_2",
15
- disabled: ge,
16
- container: ve,
17
- "container-open": "_container-open_17kql_18",
18
- "input-container": "_input-container_17kql_22",
19
- full: be,
20
- "selected-icon": "_selected-icon_17kql_31",
21
- "selector-icon-open": "_selector-icon-open_17kql_35",
22
- button: Ie,
23
- "selector-icon": "_selector-icon_17kql_35",
24
- options: we,
25
- top: Ne,
26
- bottom: Ce,
27
- "no-options": "_no-options_17kql_90",
28
- m: Se,
29
- l: Me,
30
- "multi-select-input-disabled": "_multi-select-input-disabled_17kql_126",
31
- "multi-select-input": "_multi-select-input_17kql_126",
32
- focused: Ee,
33
- option: Le,
34
- "option-active": "_option-active_17kql_148",
35
- "option-inner": "_option-inner_17kql_151",
36
- chip: Oe,
37
- "chip-container": "_chip-container_17kql_163",
38
- "chip-root": "_chip-root_17kql_169",
39
- "right-slot": "_right-slot_17kql_173",
40
- "required-mark": "_required-mark_17kql_178",
41
- clear: Te,
42
- "icon-button": "_icon-button_17kql_192"
43
- }, Ue = ce(
44
- ($, Q) => {
1
+ import { jsxs as M, jsx as n, Fragment as $ } from "react/jsx-runtime";
2
+ import { c as l } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as Ie, useId as ge, useRef as Q, useState as b, useEffect as L, useMemo as Ne, useCallback as Se } from "react";
4
+ import { EMultiSelectSearchSize as x } from "./constants.js";
5
+ import { getInitialInputValue as X, shouldShowMenuOnTop as Ce, MULTISELECT_OPEN_EVENT as Y, mapSizeToInputSize as Z, getDropdownArrowIcon as Me, dispatchMultiselectOpen as E, joinSelectedItems as ee } from "./utils.js";
6
+ import { Icon as Ee } from "../../icons/Icon.js";
7
+ import { Button as Le } from "../Button/Button.js";
8
+ import { CheckboxMimir as Te } from "../CheckboxMimir/CheckboxMimir.js";
9
+ import { Chip as ke } from "../Chip/Chip.js";
10
+ import { I as te } from "../../Input-BYrIS5GU.js";
11
+ import { EInputVariant as ye } from "../Input/constants.js";
12
+ import { H as Oe, U as oe, G as ne, K as ze, W as Ae } from "../../combobox-CVtJDVoZ.js";
13
+ import '../../assets/MultiSelectSearch.css';const Ve = "_disabled_io0c8_5", xe = "_container_io0c8_9", De = "_full_io0c8_27", Pe = "_button_io0c8_39", qe = "_options_io0c8_53", Re = "_visible_io0c8_66", Be = "_top_io0c8_69", Fe = "_bottom_io0c8_74", je = "_m_io0c8_2", Ge = "_l_io0c8_116", Ue = "_focused_io0c8_134", We = "_option_io0c8_53", He = "_chip_io0c8_163", Je = "_clear_io0c8_188", t = {
14
+ "multi-select-search": "_multi-select-search_io0c8_2",
15
+ disabled: Ve,
16
+ container: xe,
17
+ "container-open": "_container-open_io0c8_18",
18
+ "input-container": "_input-container_io0c8_22",
19
+ full: De,
20
+ "selected-icon": "_selected-icon_io0c8_31",
21
+ "selector-icon-open": "_selector-icon-open_io0c8_35",
22
+ button: Pe,
23
+ "selector-icon": "_selector-icon_io0c8_35",
24
+ options: qe,
25
+ visible: Re,
26
+ top: Be,
27
+ bottom: Fe,
28
+ "no-options": "_no-options_io0c8_95",
29
+ m: je,
30
+ l: Ge,
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: He,
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: Je,
43
+ "icon-button": "_icon-button_io0c8_197"
44
+ }, ct = Ie(
45
+ (ie, se) => {
45
46
  const {
46
- placeholder: T,
47
- size: i = O.L,
48
- value: u,
47
+ placeholder: D,
48
+ size: i = x.L,
49
+ value: d,
49
50
  onChange: s,
50
- full: X,
51
- showArrow: Y = !0,
52
- items: d = [],
53
- classNameOption: Z,
54
- displayValue: p = "name",
55
- filterOnSearch: x = !0,
56
- onSearch: w,
57
- variant: y = he.DefaultGray,
58
- menuPlacement: N = "bottom",
59
- disabled: c = !1,
60
- searchProps: D,
61
- withClearButton: C = !1,
62
- withChip: ee = !1,
63
- chipVariant: te = "sapphire",
64
- disableInput: f = !1,
65
- autocomplete: z = "on",
66
- id: m = `multiselect-${Math.random().toString(36).slice(2, 11)}`
67
- } = $, S = F(null), _ = F(null), [k, h] = E(!1), [q, g] = E(
68
- () => j(u, p)
69
- ), [l, v] = E(
70
- u || []
71
- );
51
+ full: ce,
52
+ showArrow: le = !0,
53
+ items: h = [],
54
+ classNameOption: re,
55
+ displayValue: f = "name",
56
+ filterOnSearch: P = !0,
57
+ onSearch: T,
58
+ variant: q = ye.DefaultGray,
59
+ menuPlacement: w = "bottom",
60
+ disabled: r = !1,
61
+ searchProps: R,
62
+ withClearButton: k = !1,
63
+ withChip: ae = !1,
64
+ chipVariant: ue = "sapphire",
65
+ disableInput: I = !1,
66
+ autocomplete: B = "on",
67
+ id: de,
68
+ autoPlacement: y = !1
69
+ } = ie, pe = ge(), p = de || `multiselect-${pe}`, g = Q(null), v = Q(null), [m, _] = b(!1), [N, S] = b(
70
+ () => X(d, f)
71
+ ), [c, C] = b(
72
+ d || []
73
+ ), [O, F] = b(w), [z, j] = b(!1), [me, G] = b(!1);
72
74
  L(() => {
73
- u && (v(u), JSON.stringify(u) !== JSON.stringify(l) && g(j(u, p)));
74
- }, [u, p, l]);
75
- const V = ae(() => {
76
- var n;
77
- if (!x) return d;
78
- const e = ((n = q.split(",").pop()) == null ? void 0 : n.trim().toLowerCase()) ?? "";
79
- return l.length > 0 && l[l.length - 1].name.toLowerCase() === e ? d : d.filter(
75
+ d && (C(d), JSON.stringify(d) !== JSON.stringify(c) && S(X(d, f)));
76
+ }, [d, f, c]);
77
+ const U = Ne(() => {
78
+ var o;
79
+ if (!P) return h;
80
+ const e = ((o = N.split(",").pop()) == null ? void 0 : o.trim().toLowerCase()) ?? "";
81
+ return c.length > 0 && c[c.length - 1].name.toLowerCase() === e ? h : h.filter(
80
82
  (a) => a.name.toLowerCase().includes(e)
81
83
  );
82
- }, [x, d, q, l]), ne = (e) => {
83
- v(e), s == null || s(e);
84
- const n = W(e, p);
85
- g(n), h(!0), I(m), setTimeout(() => {
86
- if (_.current) {
87
- _.current.focus(), _.current.scrollLeft = _.current.scrollWidth;
88
- const a = n.length;
89
- _.current.setSelectionRange(a, a);
84
+ }, [P, h, N, c]), _e = (e) => {
85
+ C(e), s == null || s(e);
86
+ const o = ee(e, f);
87
+ S(o), _(!0), E(p), setTimeout(() => {
88
+ if (v.current) {
89
+ v.current.focus(), v.current.scrollLeft = v.current.scrollWidth;
90
+ const a = o.length;
91
+ v.current.setSelectionRange(a, a);
90
92
  }
91
93
  }, 0);
92
- }, A = (e) => {
93
- if (f) return;
94
- const n = e.target.value;
95
- g(n), w == null || w(n);
96
- const a = n.split(",").map((M) => M.trim()).filter(Boolean), R = d.filter(
97
- (M) => a.includes(M[p])
94
+ }, W = (e) => {
95
+ var K;
96
+ if (I) return;
97
+ const o = e.target.value;
98
+ S(o), T == null || T(o);
99
+ const a = o.split(",").map((V) => V.trim()).filter(Boolean), J = h.filter(
100
+ (V) => a.includes(V[f])
98
101
  );
99
- v(R), s == null || s(R), h(!0), I(m);
100
- }, oe = (e) => {
101
- const n = l.filter(
102
+ C(J), s == null || s(J), _(!0), E(p);
103
+ const A = (K = g.current) == null ? void 0 : K.querySelector(
104
+ `.${t.options}`
105
+ );
106
+ A && typeof A.scrollTo == "function" && A.scrollTo({ top: 0, behavior: "smooth" });
107
+ }, he = (e) => {
108
+ const o = c.filter(
102
109
  (a) => a.id !== e.id
103
110
  );
104
- v(n), s == null || s(n), g(W(n, p));
105
- }, B = () => {
106
- const e = !k;
107
- h(e), e && I(m);
108
- }, se = (e) => {
111
+ C(o), s == null || s(o), S(ee(o, f));
112
+ }, u = Se(() => {
113
+ if (!y) {
114
+ F(w);
115
+ return;
116
+ }
117
+ const e = Ce(g, i);
118
+ F(e ? "top" : w);
119
+ }, [y, w, i]), H = () => {
120
+ const e = !m;
121
+ e && (u(), E(p)), _(e);
122
+ }, fe = (e) => {
109
123
  e.preventDefault(), e.currentTarget.focus();
110
- const n = e.currentTarget.value.length;
111
- e.currentTarget.setSelectionRange(n, n);
112
- }, ie = () => {
113
- g(""), v([]), s == null || s([]);
114
- }, le = (e) => {
115
- e.stopPropagation(), ie();
116
- }, re = (e) => {
117
- f && e.target.blur();
124
+ const o = e.currentTarget.value.length;
125
+ e.currentTarget.setSelectionRange(o, o);
126
+ }, ve = () => {
127
+ S(""), C([]), s == null || s([]);
128
+ }, be = (e) => {
129
+ e.stopPropagation(), ve();
130
+ }, we = (e) => {
131
+ if (I) {
132
+ e.target.blur();
133
+ return;
134
+ }
135
+ u(), _(!0), E(p);
118
136
  };
119
137
  return L(() => {
120
- const e = (n) => {
121
- S.current && !S.current.contains(n.target) && !n.defaultPrevented && h(!1);
138
+ const e = (o) => {
139
+ g.current && !g.current.contains(o.target) && !o.defaultPrevented && _(!1);
122
140
  };
123
141
  return document.addEventListener("mousedown", e), () => {
124
142
  document.removeEventListener("mousedown", e);
125
143
  };
126
144
  }, []), L(() => {
127
- const e = (n) => {
128
- n.detail !== m && h(!1);
145
+ const e = (o) => {
146
+ o.detail !== p && _(!1);
129
147
  };
130
148
  return window.addEventListener(
131
- G,
149
+ Y,
132
150
  e
133
151
  ), () => {
134
152
  window.removeEventListener(
135
- G,
153
+ Y,
136
154
  e
137
155
  );
138
156
  };
139
- }, [m]), /* @__PURE__ */ b("div", { ref: S, children: [
140
- /* @__PURE__ */ o(
141
- fe,
157
+ }, [p]), L(() => {
158
+ if (m) {
159
+ u(), window.addEventListener("scroll", u), window.addEventListener("resize", u);
160
+ const e = requestAnimationFrame(() => {
161
+ G(!0), j(!0);
162
+ });
163
+ return () => {
164
+ window.removeEventListener("scroll", u), window.removeEventListener("resize", u), cancelAnimationFrame(e);
165
+ };
166
+ } else
167
+ j(!1), G(!1);
168
+ }, [m, w, y, i, u]), /* @__PURE__ */ M("div", { ref: g, children: [
169
+ /* @__PURE__ */ n(
170
+ Oe,
142
171
  {
143
172
  multiple: !0,
144
173
  as: "div",
145
- value: l,
146
- className: r(t["multi-select-search"], {
147
- [t.full]: X,
148
- [t.disabled]: c
174
+ value: c,
175
+ className: l(t["multi-select-search"], {
176
+ [t.full]: ce,
177
+ [t.disabled]: r
149
178
  }),
150
- onChange: ne,
151
- ref: Q,
152
- disabled: c,
153
- virtual: { options: V },
154
- children: /* @__PURE__ */ b(
179
+ onChange: _e,
180
+ ref: se,
181
+ disabled: r,
182
+ virtual: { options: U },
183
+ children: /* @__PURE__ */ M(
155
184
  "div",
156
185
  {
157
- className: r(t.container, t[i], {
158
- [t["container-open"]]: k
186
+ className: l(t.container, t[i], {
187
+ [t["container-open"]]: m
159
188
  }),
160
189
  children: [
161
- f && /* @__PURE__ */ b("div", { className: t["input-container"], children: [
162
- /* @__PURE__ */ o(
163
- J,
190
+ I && /* @__PURE__ */ M("div", { className: t["input-container"], children: [
191
+ /* @__PURE__ */ n(
192
+ oe,
164
193
  {
165
- disabled: c,
194
+ disabled: r,
166
195
  style: { width: "100%" },
167
- onClick: B,
168
- children: /* @__PURE__ */ o(
169
- K,
196
+ onClick: H,
197
+ children: /* @__PURE__ */ n(
198
+ ne,
170
199
  {
171
- as: H,
172
- label: T,
173
- size: U(i),
174
- className: r(t["multi-select-input"], {
175
- [t["multi-select-input-disabled"]]: f && C
200
+ as: te,
201
+ label: D,
202
+ size: Z(i),
203
+ className: l(t["multi-select-input"], {
204
+ [t["multi-select-input-disabled"]]: I && k
176
205
  }),
177
- onChange: A,
178
- value: q,
179
- disabled: c,
180
- variant: y,
206
+ onChange: W,
207
+ value: N,
208
+ disabled: r,
209
+ variant: q,
181
210
  rightSlotClassName: t["right-slot"],
182
211
  requiredMarkClassName: t["required-mark"],
183
212
  "data-testid": "select-search-input",
184
- onFocus: re,
213
+ onFocus: we,
185
214
  rightAddon: {
186
215
  addonType: "icon",
187
- addonContent: ue(k, i)
216
+ addonContent: Me(m, i)
188
217
  },
189
- autocomplete: z,
190
- ...D
218
+ autocomplete: B,
219
+ ...R
191
220
  }
192
221
  )
193
222
  }
194
223
  ),
195
- C && q && /* @__PURE__ */ o(
196
- pe,
224
+ k && N && /* @__PURE__ */ n(
225
+ Le,
197
226
  {
198
227
  tabIndex: -1,
199
- className: r(t.clear, {
200
- [t.disabled]: c
228
+ className: l(t.clear, {
229
+ [t.disabled]: r
201
230
  }),
202
231
  iconButtonClassName: t["icon-button"],
203
232
  isIconButton: !0,
204
233
  iconName: "Close16px",
205
234
  size: "m-s",
206
235
  clear: !0,
207
- disabled: c,
236
+ disabled: r,
208
237
  variant: "secondary-gray",
209
- onClick: le,
238
+ onClick: be,
210
239
  "data-testid": "clear-button"
211
240
  }
212
241
  )
213
242
  ] }),
214
- !f && /* @__PURE__ */ o(
215
- K,
243
+ !I && /* @__PURE__ */ n(
244
+ ne,
216
245
  {
217
- as: H,
218
- label: T,
219
- size: U(i),
246
+ as: te,
247
+ label: D,
248
+ size: Z(i),
220
249
  className: t["multi-select-input"],
221
250
  rightSlotClassName: t["right-slot"],
222
251
  requiredMarkClassName: t["required-mark"],
223
- value: q,
224
- disabled: c,
225
- variant: y,
226
- withClearButton: C,
252
+ value: N,
253
+ disabled: r,
254
+ variant: q,
255
+ withClearButton: k,
227
256
  onFocus: () => {
228
- h(!0), I(m);
257
+ _(!0), E(p);
229
258
  },
230
- onMouseDown: se,
231
- onChange: A,
232
- ref: _,
259
+ onMouseDown: fe,
260
+ onChange: W,
261
+ ref: v,
233
262
  rightAddon: {
234
263
  addonType: "react-node",
235
- addonContent: Y && /* @__PURE__ */ o(
236
- J,
264
+ addonContent: le && /* @__PURE__ */ n(
265
+ oe,
237
266
  {
238
- className: r(t.button, {
239
- [t.disabled]: c
267
+ className: l(t.button, {
268
+ [t.disabled]: r
240
269
  }),
241
- disabled: c,
242
- onMouseDown: B,
243
- children: /* @__PURE__ */ o(
244
- de,
270
+ disabled: r,
271
+ onMouseDown: H,
272
+ children: /* @__PURE__ */ n(
273
+ Ee,
245
274
  {
246
- iconName: i == O.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
247
- className: r(t["selector-icon"], {
248
- [t["selector-icon-open"]]: k
275
+ iconName: i == x.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
276
+ className: l(t["selector-icon"], {
277
+ [t["selector-icon-open"]]: m
249
278
  })
250
279
  }
251
280
  )
@@ -253,43 +282,44 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
253
282
  )
254
283
  },
255
284
  "data-testid": "select-search-input",
256
- autocomplete: z,
257
- ...D
285
+ autocomplete: B,
286
+ ...R
258
287
  }
259
288
  ),
260
- k && /* @__PURE__ */ o(P, { children: d.length ? V.length ? /* @__PURE__ */ o(
261
- ke,
289
+ m && me && /* @__PURE__ */ n($, { children: h.length ? U.length ? /* @__PURE__ */ n(
290
+ ze,
262
291
  {
263
- className: r(
292
+ className: l(
264
293
  t.options,
265
294
  t[i],
266
- t[N]
295
+ t[O],
296
+ { [t.visible]: z }
267
297
  ),
268
298
  modal: !1,
269
299
  static: !0,
270
- children: ({ option: e }) => /* @__PURE__ */ o(
271
- qe,
300
+ children: ({ option: e }) => /* @__PURE__ */ n(
301
+ Ae,
272
302
  {
273
303
  value: e,
274
- className: ({ focus: n }) => r(
304
+ className: ({ focus: o }) => l(
275
305
  t.option,
276
- Z,
306
+ re,
277
307
  i && t[i],
278
308
  {
279
- [t["option-active"]]: n
309
+ [t["option-active"]]: o
280
310
  }
281
311
  ),
282
- children: /* @__PURE__ */ b(P, { children: [
283
- /* @__PURE__ */ b("div", { className: t["option-inner"], children: [
312
+ children: /* @__PURE__ */ M($, { children: [
313
+ /* @__PURE__ */ M("div", { className: t["option-inner"], children: [
284
314
  e.name,
285
- e.bottom && /* @__PURE__ */ o("div", { children: e.bottom })
315
+ e.bottom && /* @__PURE__ */ n("div", { children: e.bottom })
286
316
  ] }),
287
- /* @__PURE__ */ o(
288
- me,
317
+ /* @__PURE__ */ n(
318
+ Te,
289
319
  {
290
320
  isInteractive: !1,
291
- checked: l.some(
292
- (n) => n.id === e.id
321
+ checked: c.some(
322
+ (o) => o.id === e.id
293
323
  )
294
324
  }
295
325
  )
@@ -298,25 +328,27 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
298
328
  e.id
299
329
  )
300
330
  }
301
- ) : /* @__PURE__ */ o(
331
+ ) : /* @__PURE__ */ n(
302
332
  "div",
303
333
  {
304
- className: r(
334
+ className: l(
305
335
  t.options,
306
336
  t[i],
307
337
  t["no-options"],
308
- t[N]
338
+ t[O],
339
+ { [t.visible]: z }
309
340
  ),
310
341
  children: "Ничего не найдено"
311
342
  }
312
- ) : /* @__PURE__ */ o(
343
+ ) : /* @__PURE__ */ n(
313
344
  "div",
314
345
  {
315
- className: r(
346
+ className: l(
316
347
  t.options,
317
348
  t[i],
318
349
  t["no-options"],
319
- t[N]
350
+ t[O],
351
+ { [t.visible]: z }
320
352
  ),
321
353
  children: "Нет данных"
322
354
  }
@@ -326,15 +358,15 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
326
358
  )
327
359
  }
328
360
  ),
329
- ee && l.length > 0 && /* @__PURE__ */ o("div", { className: t["chip-container"], children: l.map((e) => /* @__PURE__ */ o(
330
- _e,
361
+ ae && c.length > 0 && /* @__PURE__ */ n("div", { className: t["chip-container"], children: c.map((e) => /* @__PURE__ */ n(
362
+ ke,
331
363
  {
332
- size: i === O.L ? "s" : "xs",
333
- variant: te,
364
+ size: i === x.L ? "s" : "xs",
365
+ variant: ue,
334
366
  className: t["chip-root"],
335
367
  withAction: !0,
336
- onClose: () => oe(e),
337
- children: /* @__PURE__ */ o("span", { className: t.chip, children: e.name })
368
+ onClose: () => he(e),
369
+ children: /* @__PURE__ */ n("span", { className: t.chip, children: e.name })
338
370
  },
339
371
  e.id
340
372
  )) })
@@ -342,5 +374,5 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
342
374
  }
343
375
  );
344
376
  export {
345
- Ue as MultiSelectSearch
377
+ ct as MultiSelectSearch
346
378
  };
@@ -2,3 +2,6 @@ export declare enum EMultiSelectSearchSize {
2
2
  M = "m",
3
3
  L = "l"
4
4
  }
5
+ export declare const MOBILE_BREAKPOINT = 767;
6
+ export declare const MOBILE_MENU_HEIGHT = 264;
7
+ export declare const DESKTOP_MENU_HEIGHT = 320;
@@ -1,4 +1,8 @@
1
- var m = /* @__PURE__ */ ((r) => (r.M = "m", r.L = "l", r))(m || {});
1
+ var I = /* @__PURE__ */ ((E) => (E.M = "m", E.L = "l", E))(I || {});
2
+ const _ = 767, n = 264, o = 320;
2
3
  export {
3
- m as EMultiSelectSearchSize
4
+ o as DESKTOP_MENU_HEIGHT,
5
+ I as EMultiSelectSearchSize,
6
+ _ as MOBILE_BREAKPOINT,
7
+ n as MOBILE_MENU_HEIGHT
4
8
  };
@@ -63,4 +63,8 @@ export type TMultiSelectSearchProps = Pick<TInputProps, 'withClearButton' | 'var
63
63
  * Уникальный идентификатор мультиселекта
64
64
  */
65
65
  id?: string;
66
+ /**
67
+ * Автоматическое определение положения выпадающего меню
68
+ */
69
+ autoPlacement?: boolean;
66
70
  };
@@ -8,3 +8,4 @@ export declare const getInitialInputValue: (value: TMultiSelectOption[] | undefi
8
8
  export declare const joinSelectedItems: (items: TMultiSelectOption[], displayValue: string) => string;
9
9
  export declare const MULTISELECT_OPEN_EVENT = "multiselectOpen";
10
10
  export declare const dispatchMultiselectOpen: (id: string) => void;
11
+ export declare const shouldShowMenuOnTop: (selectRef: React.RefObject<HTMLDivElement>, size: EMultiSelectSearchSize) => boolean;
@@ -1,23 +1,28 @@
1
- import { EMultiSelectSearchSize as o } from "./constants.js";
1
+ import { EMultiSelectSearchSize as o, MOBILE_MENU_HEIGHT as u, DESKTOP_MENU_HEIGHT as w } from "./constants.js";
2
2
  import "../../Input-BYrIS5GU.js";
3
- import { EInputSize as e } from "../Input/constants.js";
4
- const w = (t) => {
3
+ import { EInputSize as r } from "../Input/constants.js";
4
+ const m = (t) => {
5
5
  switch (t) {
6
6
  case o.M:
7
- return e.M;
7
+ return r.M;
8
8
  case o.L:
9
- return e.L;
9
+ return r.L;
10
10
  default:
11
- return e.M;
11
+ return r.M;
12
12
  }
13
- }, s = (t, r) => t ? r === o.L ? "DropdownArrowUp24px" : "DropdownArrowUp16px" : r === o.L ? "DropdownArrowDown24px" : "DropdownArrowBottom16px", m = (t, r) => t && t.length > 0 ? t.map((n) => n[r]).join(", ") : "", d = (t, r) => t.map((n) => n[r]).join(", "), p = "multiselectOpen", a = (t) => {
14
- window.dispatchEvent(new CustomEvent(p, { detail: t }));
13
+ }, M = (t, e) => t ? e === o.L ? "DropdownArrowUp24px" : "DropdownArrowUp16px" : e === o.L ? "DropdownArrowDown24px" : "DropdownArrowBottom16px", h = (t, e) => t && t.length > 0 ? t.map((n) => n[e]).join(", ") : "", I = (t, e) => t.map((n) => n[e]).join(", "), l = "multiselectOpen", S = (t) => {
14
+ window.dispatchEvent(new CustomEvent(l, { detail: t }));
15
+ }, f = (t, e) => {
16
+ if (!t.current) return !1;
17
+ const n = t.current.getBoundingClientRect(), p = window.innerHeight, c = e === o.M ? u : w, i = p - n.bottom, s = n.top;
18
+ return i >= c ? !1 : s > i;
15
19
  };
16
20
  export {
17
- p as MULTISELECT_OPEN_EVENT,
18
- a as dispatchMultiselectOpen,
19
- s as getDropdownArrowIcon,
20
- m as getInitialInputValue,
21
- d as joinSelectedItems,
22
- w as mapSizeToInputSize
21
+ l as MULTISELECT_OPEN_EVENT,
22
+ S as dispatchMultiselectOpen,
23
+ M as getDropdownArrowIcon,
24
+ h as getInitialInputValue,
25
+ I as joinSelectedItems,
26
+ m as mapSizeToInputSize,
27
+ f as shouldShowMenuOnTop
23
28
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.38.7",
4
+ "version": "1.38.9",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {