@alphakits/ui 2.0.12 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/badge/component.d.ts +1 -1
  2. package/dist/box/component.d.ts +2 -2
  3. package/dist/calendar/typings.d.ts +42 -0
  4. package/dist/calendar/use-calendar.d.ts +2 -40
  5. package/dist/calendar/use-calendar.js +1 -1
  6. package/dist/calendar/use-calendar.js.map +1 -1
  7. package/dist/calendar-input/component.d.ts +1 -1
  8. package/dist/checkbox/component.js +12 -15
  9. package/dist/checkbox/component.js.map +1 -1
  10. package/dist/checkbox-lists/component.d.ts +2 -2
  11. package/dist/collapsable-row/addons.d.ts +3 -3
  12. package/dist/copy-button/component.d.ts +2 -1
  13. package/dist/date-switcher/component.d.ts +2 -2
  14. package/dist/flex/component.d.ts +2 -2
  15. package/dist/footer/component.js +32 -38
  16. package/dist/footer/component.js.map +1 -1
  17. package/dist/footer/index.module.css +1 -1
  18. package/dist/footer/index.module.css.js +16 -14
  19. package/dist/footer/index.module.css.js.map +1 -1
  20. package/dist/form/component.d.ts +2 -2
  21. package/dist/form/templates/base-form/index.d.ts +1 -1
  22. package/dist/form/templates/rest-form/form.d.ts +2 -1
  23. package/dist/form/templates/rest-form/index.d.ts +2 -2
  24. package/dist/form/templates/rest-form/index.js.map +1 -1
  25. package/dist/grid/component.d.ts +20 -5
  26. package/dist/grid/component.js +49 -7
  27. package/dist/grid/component.js.map +1 -1
  28. package/dist/grid/index.js +4 -2
  29. package/dist/grid/index.module.css +1 -0
  30. package/dist/grid/index.module.css.js +11 -0
  31. package/dist/grid/{row/index.module.css.js.map → index.module.css.js.map} +1 -1
  32. package/dist/hooks/useClickOutside/index.d.ts +1 -1
  33. package/dist/hooks/useClickOutside/index.js.map +1 -1
  34. package/dist/hooks/useFocus/index.d.ts +1 -1
  35. package/dist/hooks/useFocus/index.js.map +1 -1
  36. package/dist/hooks/usePrevious/index.js +3 -3
  37. package/dist/hooks/usePrevious/index.js.map +1 -1
  38. package/dist/image/use-image-render-component.d.ts +1 -1
  39. package/dist/image-gallery/component.d.ts +2 -2
  40. package/dist/index.js +254 -252
  41. package/dist/input/component.js +56 -60
  42. package/dist/input/component.js.map +1 -1
  43. package/dist/input/index.module.css +1 -1
  44. package/dist/input-autocomplete/autocomplete-field/index.d.ts +2 -1
  45. package/dist/input-autocomplete/autocomplete-field/index.js.map +1 -1
  46. package/dist/input-autocomplete/component.d.ts +3 -3
  47. package/dist/input-ghost/component.d.ts +1 -1
  48. package/dist/masked-input/component.d.ts +1 -1
  49. package/dist/menu/component.d.ts +3 -2
  50. package/dist/menu/component.js.map +1 -1
  51. package/dist/menu/hooks/use-menu.d.ts +1 -1
  52. package/dist/menu/hooks/use-menu.js +6 -6
  53. package/dist/menu/hooks/use-menu.js.map +1 -1
  54. package/dist/modal/components/modals/modal.d.ts +2 -1
  55. package/dist/notification/component.js +33 -37
  56. package/dist/notification/component.js.map +1 -1
  57. package/dist/notification/utils/index.d.ts +1 -1
  58. package/dist/notification/utils/index.js.map +1 -1
  59. package/dist/page-loading/component.d.ts +2 -2
  60. package/dist/picker-button/component.d.ts +1 -1
  61. package/dist/picker-button/field/Component.d.ts +2 -1
  62. package/dist/portal/utils.d.ts +1 -1
  63. package/dist/portal/utils.js.map +1 -1
  64. package/dist/radio-groups/component.d.ts +2 -2
  65. package/dist/select/components/arrow/component.d.ts +2 -1
  66. package/dist/select/components/base-select/component.js +262 -259
  67. package/dist/select/components/base-select/component.js.map +1 -1
  68. package/dist/select/components/checkmark/component.d.ts +2 -1
  69. package/dist/select/components/field/component.d.ts +2 -1
  70. package/dist/select/components/field/component.js.map +1 -1
  71. package/dist/select/components/native-select/component.js.map +1 -1
  72. package/dist/select/components/optgroup/component.d.ts +2 -1
  73. package/dist/select/components/select-search/index.d.ts +1 -1
  74. package/dist/select/components/virtual-options-list/component.d.ts +2 -1
  75. package/dist/select/presets/use-lazy-loading/index.d.ts +4 -4
  76. package/dist/select/presets/use-lazy-loading/index.js +20 -20
  77. package/dist/select/presets/use-lazy-loading/index.js.map +1 -1
  78. package/dist/select/presets/use-select-with-loading/hook.d.ts +3 -2
  79. package/dist/select/presets/use-select-with-loading/hook.js +7 -7
  80. package/dist/select/presets/use-select-with-loading/hook.js.map +1 -1
  81. package/dist/select/typings.d.ts +1 -1
  82. package/dist/select/utils.d.ts +2 -2
  83. package/dist/select/utils.js +17 -15
  84. package/dist/select/utils.js.map +1 -1
  85. package/dist/sidepanel/component.d.ts +1 -0
  86. package/dist/sidepanel/component.js.map +1 -1
  87. package/dist/space/Item.d.ts +1 -1
  88. package/dist/status/component.d.ts +2 -1
  89. package/dist/status/component.js.map +1 -1
  90. package/dist/switch/component.d.ts +1 -1
  91. package/dist/table/components/cells/index.d.ts +2 -1
  92. package/dist/table/components/empty-list/index.d.ts +2 -2
  93. package/dist/table/components/error/index.d.ts +2 -2
  94. package/dist/table/components/loading/index.d.ts +1 -1
  95. package/dist/table/components/table-header/index.d.ts +1 -1
  96. package/dist/table/components/table-header/index.js.map +1 -1
  97. package/dist/table/table.d.ts +2 -2
  98. package/dist/table/table.js.map +1 -1
  99. package/dist/table/utils/get-tags.d.ts +3 -2
  100. package/dist/table/utils/get-tags.js.map +1 -1
  101. package/dist/table/utils/prepare-rows.d.ts +2 -1
  102. package/dist/table/utils/prepare-rows.js.map +1 -1
  103. package/dist/textarea/component.js +68 -75
  104. package/dist/textarea/component.js.map +1 -1
  105. package/dist/theme-provider/component.d.ts +1 -0
  106. package/dist/theme-provider/component.js.map +1 -1
  107. package/dist/toast/component.d.ts +1 -1
  108. package/dist/toast-notifier/component.js +39 -40
  109. package/dist/toast-notifier/component.js.map +1 -1
  110. package/dist/tooltip/component.d.ts +2 -2
  111. package/dist/tooltip/component.js +4 -4
  112. package/dist/tooltip/component.js.map +1 -1
  113. package/dist/tooltip/node-resolver.d.ts +26 -0
  114. package/dist/tooltip/node-resolver.js +14 -0
  115. package/dist/tooltip/node-resolver.js.map +1 -0
  116. package/dist/typography/title/component.d.ts +2 -2
  117. package/dist/with-suffix/component.d.ts +1 -1
  118. package/package.json +8 -12
  119. package/dist/calendar/typings.js +0 -2
  120. package/dist/calendar/typings.js.map +0 -1
  121. package/dist/grid/col/component.d.ts +0 -52
  122. package/dist/grid/col/component.js +0 -39
  123. package/dist/grid/col/component.js.map +0 -1
  124. package/dist/grid/col/index.d.ts +0 -1
  125. package/dist/grid/col/index.js +0 -5
  126. package/dist/grid/col/index.js.map +0 -1
  127. package/dist/grid/col/index.module.css +0 -1
  128. package/dist/grid/col/index.module.css.js +0 -519
  129. package/dist/grid/col/index.module.css.js.map +0 -1
  130. package/dist/grid/gutters.module.css +0 -1
  131. package/dist/grid/gutters.module.css.js +0 -50
  132. package/dist/grid/gutters.module.css.js.map +0 -1
  133. package/dist/grid/row/component.d.ts +0 -41
  134. package/dist/grid/row/component.js +0 -43
  135. package/dist/grid/row/component.js.map +0 -1
  136. package/dist/grid/row/index.d.ts +0 -1
  137. package/dist/grid/row/index.js +0 -5
  138. package/dist/grid/row/index.js.map +0 -1
  139. package/dist/grid/row/index.module.css +0 -1
  140. package/dist/grid/row/index.module.css.js +0 -25
  141. package/dist/grid/typings.d.ts +0 -15
  142. package/dist/grid/typings.js +0 -2
  143. package/dist/grid/typings.js.map +0 -1
  144. package/dist/grid/utils/index.d.ts +0 -2
  145. package/dist/grid/utils/index.js +0 -31
  146. package/dist/grid/utils/index.js.map +0 -1
  147. package/dist/select/typings.js +0 -2
  148. package/dist/select/typings.js.map +0 -1
@@ -1,174 +1,187 @@
1
- import { jsx as l, jsxs as Xe } from "react/jsx-runtime";
2
- import Ye, { forwardRef as Ze, useRef as k, useMemo as et, useCallback as R, useEffect as T } from "react";
3
- import se from "react-merge-refs";
4
- import oe from "classnames";
5
- import { useMultipleSelection as ce, useCombobox as j } from "downshift";
6
- import { ResizeObserver as tt } from "resize-observer";
7
- import { getDataTestId as $ } from "../../../__internal/utils/getDataTestId.js";
8
- import { Popover as rt } from "../../../popover/component.js";
9
- import { processOptions as nt } from "../../utils.js";
10
- import { NativeSelect as st } from "../native-select/component.js";
1
+ import { jsx as l, jsxs as ot } from "react/jsx-runtime";
2
+ import ct, { forwardRef as it, useRef as I, useMemo as N, useCallback as H, useEffect as U } from "react";
3
+ import ae from "react-merge-refs";
4
+ import le from "classnames";
5
+ import { useMultipleSelection as de, useCombobox as V } from "downshift";
6
+ import { ResizeObserver as at } from "resize-observer";
7
+ import { getDataTestId as _ } from "../../../__internal/utils/getDataTestId.js";
8
+ import { Popover as lt } from "../../../popover/component.js";
9
+ import { processOptions as dt } from "../../utils.js";
10
+ import { NativeSelect as ut } from "../native-select/component.js";
11
11
  import P from "./index.module.css.js";
12
- const pt = Ze(
12
+ const ue = (c) => {
13
+ var u;
14
+ return c ? (u = c.key) == null ? void 0 : u.toString() : "";
15
+ }, fe = (c) => {
16
+ const u = I(c);
17
+ return u.current = c, u;
18
+ }, xt = it(
13
19
  ({
14
- dataTestId: v = "",
15
- className: ie,
16
- fieldClassName: le,
17
- filteredOptions: N,
18
- popoverOuterClassname: ae,
19
- optionsListClassName: de,
20
- optionClassName: A,
21
- options: g,
22
- actionButton: B,
23
- autocomplete: y = !1,
24
- multiple: u = !1,
25
- allowUnselect: H = !1,
26
- disabled: a = !1,
27
- closeOnSelect: U = !u,
28
- circularNavigation: ue = !1,
29
- nativeSelect: w = !1,
30
- defaultOpen: V = !1,
31
- open: M,
32
- popoverPosition: fe = "bottom-start",
33
- offset: me,
34
- withArrow: ge,
35
- preventFlip: he = !0,
36
- optionsListWidth: _ = "field",
37
- name: f,
38
- id: pe,
39
- required: Ie,
40
- selected: S,
41
- size: E = "m",
42
- optionsSize: q = E,
43
- error: ye,
44
- hint: we,
45
- block: be = !0,
20
+ dataTestId: c = "",
21
+ className: u,
22
+ fieldClassName: pe,
23
+ filteredOptions: S,
24
+ popoverOuterClassname: me,
25
+ optionsListClassName: he,
26
+ optionClassName: q,
27
+ options: w,
28
+ actionButton: z,
29
+ autocomplete: b = !1,
30
+ multiple: h = !1,
31
+ allowUnselect: E = !1,
32
+ disabled: f = !1,
33
+ closeOnSelect: G = !h,
34
+ circularNavigation: ge = !1,
35
+ nativeSelect: k = !1,
36
+ defaultOpen: J = !1,
37
+ open: K,
38
+ popoverPosition: ye = "bottom-start",
39
+ offset: Ie,
40
+ withArrow: we,
41
+ preventFlip: be = !0,
42
+ optionsListWidth: Q = "field",
43
+ name: g,
44
+ id: ke,
45
+ required: ve,
46
+ selected: C,
47
+ size: L = "m",
48
+ optionsSize: X = L,
49
+ error: xe,
50
+ hint: Pe,
51
+ block: Ce = !0,
46
52
  label: O,
47
- placeholder: xe,
48
- fieldProps: ke = {},
49
- optionsListProps: Re = {},
50
- optionProps: z = {},
51
- valueRenderer: Pe,
52
- onChange: G,
53
- onOpen: J,
54
- onFocus: K,
55
- onBlur: L,
56
- onScroll: Ce,
57
- Arrow: Q,
58
- Field: De = () => null,
59
- OptionsList: Te = () => null,
60
- Optgroup: ve = () => null,
61
- Option: X = () => null,
62
- updatePopover: Ne,
63
- zIndexPopover: Me,
64
- showEmptyOptionsList: Se = !1,
65
- visibleOptions: Ee
66
- }, Oe) => {
67
- const b = k(null), Y = k(null), h = k(null), Z = (e) => {
68
- var t;
69
- return e ? (t = e.key) == null ? void 0 : t.toString() : "";
70
- }, { flatOptions: d, selectedOptions: Ke } = et(
71
- () => nt(g || [], S),
72
- [g, S]
73
- ), ee = {
74
- itemToString: Z,
75
- onSelectedItemsChange: (e) => {
76
- if (G) {
53
+ placeholder: De,
54
+ fieldProps: Re = {},
55
+ optionsListProps: Te = {},
56
+ optionProps: Y = {},
57
+ valueRenderer: Me,
58
+ onChange: Ne,
59
+ onOpen: Se,
60
+ onFocus: W,
61
+ onBlur: F,
62
+ onScroll: Ee,
63
+ Arrow: Z,
64
+ Field: Ke = () => null,
65
+ OptionsList: Le = () => null,
66
+ Optgroup: Oe = () => null,
67
+ Option: ee = () => null,
68
+ updatePopover: We,
69
+ zIndexPopover: Fe,
70
+ showEmptyOptionsList: je = !1,
71
+ visibleOptions: Ae
72
+ }, Be) => {
73
+ var ce, ie;
74
+ const v = I(null), te = I(null), x = I(null), ne = I(null), y = I(null), D = fe(Ne), R = fe(Se), { flatOptions: i, selectedOptions: re } = N(
75
+ () => dt(w || [], C),
76
+ [w, C]
77
+ ), se = N(() => {
78
+ const e = /* @__PURE__ */ new Map();
79
+ return i.forEach((t, r) => {
80
+ e.set(t.key, r);
81
+ }), e;
82
+ }, [i]), $e = N(
83
+ () => ({
84
+ itemToString: ue,
85
+ onSelectedItemsChange: (e) => {
86
+ var r;
77
87
  const { selectedItems: t = [] } = e;
78
- G({
88
+ (r = D.current) == null || r.call(D, {
79
89
  selectedMultiple: t,
80
90
  selected: t.length ? t[0] : null,
81
- name: f
91
+ name: g
82
92
  });
83
- }
84
- },
85
- stateReducer: (e, t) => {
86
- const { type: c, changes: r } = t;
87
- return !H && c === ce.stateChangeTypes.DropdownKeyDownBackspace ? e : r;
88
- }
89
- };
90
- S !== void 0 && (ee.selectedItems = Ke);
91
- const {
92
- selectedItems: n,
93
- addSelectedItem: Le,
94
- setSelectedItems: F,
95
- removeSelectedItem: Fe,
96
- getDropdownProps: We
97
- } = ce(ee), {
98
- isOpen: o,
99
- getMenuProps: je,
100
- getInputProps: $e,
101
- getItemProps: te,
102
- getComboboxProps: Ae,
103
- getLabelProps: Be,
104
- highlightedIndex: C,
105
- toggleMenu: W,
93
+ },
94
+ stateReducer: (e, t) => {
95
+ const { type: r, changes: n } = t;
96
+ return !E && r === de.stateChangeTypes.DropdownKeyDownBackspace ? e : n;
97
+ },
98
+ ...C !== void 0 ? { selectedItems: re } : {}
99
+ }),
100
+ [E, g, C, re, D]
101
+ ), {
102
+ selectedItems: o,
103
+ addSelectedItem: He,
104
+ setSelectedItems: j,
105
+ removeSelectedItem: Ue,
106
+ getDropdownProps: Ve
107
+ } = de($e), A = N(
108
+ () => new Set(o.map((e) => e.key)),
109
+ [o]
110
+ ), {
111
+ isOpen: a,
112
+ getMenuProps: _e,
113
+ getInputProps: qe,
114
+ getItemProps: oe,
115
+ getComboboxProps: ze,
116
+ getLabelProps: Ge,
117
+ highlightedIndex: T,
118
+ toggleMenu: B,
106
119
  openMenu: p
107
- } = j({
108
- id: pe,
109
- isOpen: M,
110
- circularNavigation: ue,
111
- items: d,
112
- itemToString: Z,
113
- defaultHighlightedIndex: n.length === 0 ? -1 : void 0,
120
+ } = V({
121
+ id: ke,
122
+ isOpen: K,
123
+ circularNavigation: ge,
124
+ items: i,
125
+ itemToString: ue,
126
+ defaultHighlightedIndex: o.length === 0 ? -1 : void 0,
114
127
  onIsOpenChange: (e) => {
115
- J && setTimeout(() => {
116
- J({ open: e.isOpen, name: f });
128
+ R.current && setTimeout(() => {
129
+ var t;
130
+ (t = R.current) == null || t.call(R, { open: e.isOpen, name: g });
117
131
  }, 0);
118
132
  },
119
133
  stateReducer: (e, t) => {
120
- const { type: c, changes: r } = t, { selectedItem: i } = r;
121
- switch (c) {
122
- case j.stateChangeTypes.InputKeyDownEnter:
123
- case j.stateChangeTypes.ItemClick:
124
- if (i && !i.disabled) {
125
- const D = n.includes(i), s = H || u && n.length > 1;
126
- D && s && Fe(i), D || (u ? Le(i) : F([i]));
134
+ const { type: r, changes: n } = t, { selectedItem: d } = n;
135
+ switch (r) {
136
+ case V.stateChangeTypes.InputKeyDownEnter:
137
+ case V.stateChangeTypes.ItemClick:
138
+ if (d && !d.disabled) {
139
+ const M = A.has(d.key), s = E || h && o.length > 1;
140
+ M && s && Ue(d), M || (h ? He(d) : j([d]));
127
141
  }
128
142
  return {
129
- ...r,
130
- isOpen: !U,
131
- highlightedIndex: e.isOpen && !U ? e.highlightedIndex : r.highlightedIndex
143
+ ...n,
144
+ isOpen: !G,
145
+ highlightedIndex: e.isOpen && !G ? e.highlightedIndex : n.highlightedIndex
132
146
  };
133
147
  default:
134
- return r;
148
+ return n;
135
149
  }
136
150
  }
137
- }), He = je(
138
- { ref: h },
151
+ }), Je = _e(
152
+ { ref: x },
139
153
  { suppressRefError: !0 }
140
- ), m = $e(We({ ref: se([Oe, Y]) })), Ue = (e) => {
141
- K == null || K(e), y && !o && p();
142
- }, Ve = (e) => {
143
- var r;
154
+ ), m = qe(Ve({ ref: ae([Be, te]) })), Qe = (e) => {
155
+ W == null || W(e), b && !a && p();
156
+ }, Xe = (e) => {
157
+ var n;
144
158
  const t = e.relatedTarget || document.activeElement;
145
- !!(t && ((r = h.current) != null && r.contains(t))) || (L == null || L(e), m.onBlur(e));
146
- }, _e = (e) => {
147
- m.onKeyDown(e), y && !o && e.key.length === 1 && p(), [" ", "Enter"].includes(e.key) && !y && !w && e.target.tagName !== "INPUT" && (e.preventDefault(), (!o || C === -1) && W());
148
- }, qe = (e) => {
149
- h.current && h.current.contains(e.target) || (!y || e.target.tagName !== "INPUT" ? W() : p());
150
- }, re = R(
159
+ !!(t && ((n = x.current) != null && n.contains(t))) || (F == null || F(e), m.onBlur(e));
160
+ }, Ye = (e) => {
161
+ m.onKeyDown(e), b && !a && e.key.length === 1 && p(), [" ", "Enter"].includes(e.key) && !b && !k && e.target.tagName !== "INPUT" && (e.preventDefault(), (!a || T === -1) && B());
162
+ }, Ze = (e) => {
163
+ var t;
164
+ (t = x.current) != null && t.contains(e.target) || (!b || e.target.tagName !== "INPUT" ? B() : p());
165
+ }, et = H(
151
166
  (e) => {
152
- F(
153
- [...e == null ? void 0 : e.target.options].reduce(
154
- (t, c, r) => c.selected ? t.concat(d[r]) : t,
167
+ j(
168
+ Array.from(e.target.options).reduce(
169
+ (t, r, n) => r.selected ? t.concat(i[n]) : t,
155
170
  []
156
171
  )
157
172
  );
158
173
  },
159
- [d, F]
160
- ), ze = R(
161
- ({ option: e, index: t, ...c }) => {
174
+ [i, j]
175
+ ), tt = H(
176
+ ({ option: e, index: t, ...r }) => {
162
177
  if (!e) return null;
163
- const r = d.findIndex((s) => s.key === (e == null ? void 0 : e.key)), i = r === -1 ? null : d[r];
164
- if (!i) return null;
165
- const D = te({
166
- item: i,
167
- index: r,
178
+ const n = se.get(e.key);
179
+ if (n === void 0) return null;
180
+ const d = i[n], M = oe({
181
+ item: d,
182
+ index: n,
168
183
  disabled: e.disabled,
169
- // десктоп
170
184
  onMouseDown: (s) => s.preventDefault(),
171
- // мобилки: не даём событию «пробить» до поля и повторно открыть меню
172
185
  onPointerDown: (s) => {
173
186
  s.preventDefault(), s.stopPropagation();
174
187
  },
@@ -179,151 +192,141 @@ const pt = Ze(
179
192
  s.stopPropagation();
180
193
  }
181
194
  });
182
- return /* @__PURE__ */ l(Ye.Fragment, { children: X({
183
- ...z,
184
- ...c,
185
- className: A,
186
- innerProps: D,
195
+ return /* @__PURE__ */ l(ct.Fragment, { children: ee({
196
+ ...Y,
197
+ ...r,
198
+ className: q,
199
+ innerProps: M,
187
200
  index: t,
188
201
  option: e,
189
- size: q,
202
+ size: X,
190
203
  disabled: e.disabled,
191
- highlighted: r === C,
192
- selected: n.includes(e)
204
+ highlighted: n === T,
205
+ selected: A.has(e.key)
193
206
  }) }, e.key);
194
207
  },
195
208
  [
196
- z,
197
- d,
198
- A,
199
- te,
209
+ Y,
210
+ i,
211
+ se,
200
212
  q,
201
- C,
202
- n,
203
- X
213
+ oe,
214
+ X,
215
+ T,
216
+ A,
217
+ ee
204
218
  ]
205
219
  );
206
- T(() => {
207
- V && p();
208
- }, [V, p]), T(() => {
209
- M === !0 && p();
210
- }, [M]);
211
- const ne = k(null), I = k(null), x = R(() => {
212
- if (!h.current) return;
213
- const e = _ === "field" ? "width" : "minWidth", t = b.current ? Math.round(b.current.getBoundingClientRect().width) : 0;
214
- ne.current !== t && (ne.current = t, h.current.style[e] = `${t}px`);
215
- }, [_]);
216
- T(() => {
217
- if (!o) return;
218
- const e = new tt(() => {
219
- I.current && window.clearTimeout(I.current), I.current = window.setTimeout(() => {
220
- x();
221
- }, 50);
222
- });
223
- return b.current && e.observe(b.current), x(), () => {
224
- e.disconnect(), I.current && window.clearTimeout(I.current), I.current = null;
220
+ U(() => {
221
+ J && p();
222
+ }, [J, p]), U(() => {
223
+ K === !0 && p();
224
+ }, [K, p]);
225
+ const $ = H(() => {
226
+ if (!x.current || !v.current) return;
227
+ const e = Q === "field" ? "width" : "minWidth", t = Math.round(v.current.getBoundingClientRect().width);
228
+ ne.current !== t && (ne.current = t, x.current.style[e] = `${t}px`);
229
+ }, [Q]);
230
+ U(() => {
231
+ if (!a || !v.current) return;
232
+ const e = () => {
233
+ y.current && window.clearTimeout(y.current), y.current = window.setTimeout($, 50);
234
+ }, t = new at(e);
235
+ return t.observe(v.current), $(), () => {
236
+ t.disconnect(), y.current && window.clearTimeout(y.current), y.current = null;
225
237
  };
226
- }, [o, x]), T(() => {
227
- o && x();
228
- }, [o, g, n, x]);
229
- const Ge = R(
230
- () => n.map((e) => /* @__PURE__ */ l("input", { type: "hidden", name: f, value: e.key }, e.key)),
231
- [n, f]
232
- ), Je = R(() => {
238
+ }, [a, $, w, o]);
239
+ const nt = h ? o.map((e) => {
233
240
  var t;
234
- const e = u ? n.map((c) => {
235
- var r;
236
- return (r = c.key) == null ? void 0 : r.toString();
237
- }) : (t = (n[0] || {}).key) == null ? void 0 : t.toString();
238
- return /* @__PURE__ */ l(
239
- st,
240
- {
241
- className: P.nativeSelect,
242
- disabled: a,
243
- multiple: u,
244
- name: f,
245
- value: e,
246
- onChange: re,
247
- options: g
248
- }
249
- );
250
- }, [u, n, a, f, re, g]), Qe = d.length > 0 || Se || !!B;
251
- return /* @__PURE__ */ Xe(
241
+ return (t = e.key) == null ? void 0 : t.toString();
242
+ }) : (ie = (ce = o[0]) == null ? void 0 : ce.key) == null ? void 0 : ie.toString(), rt = i.length > 0 || je || !!z, st = O ? /* @__PURE__ */ l("span", { ...Ge(), children: ve ? `${O} *` : O }) : void 0;
243
+ return /* @__PURE__ */ ot(
252
244
  "div",
253
245
  {
254
- ...Ae({
255
- ref: b,
256
- ...a && { "aria-disabled": !0 },
257
- className: oe(P.component, { [P.block]: be }, ie)
246
+ ...ze({
247
+ ref: v,
248
+ ...f && { "aria-disabled": !0 },
249
+ className: le(P.component, { [P.block]: Ce }, u)
258
250
  }),
259
- onKeyDown: a ? void 0 : _e,
251
+ onKeyDown: f ? void 0 : Ye,
260
252
  tabIndex: -1,
261
253
  id: "slect_wrapper",
262
- "data-test-id": $("combobox", v),
254
+ "data-test-id": _("combobox", c),
263
255
  children: [
264
- w && Je(),
256
+ k && /* @__PURE__ */ l(
257
+ ut,
258
+ {
259
+ className: P.nativeSelect,
260
+ disabled: f,
261
+ multiple: h,
262
+ name: g,
263
+ value: nt,
264
+ onChange: et,
265
+ options: w
266
+ }
267
+ ),
265
268
  /* @__PURE__ */ l(
266
- De,
269
+ Ke,
267
270
  {
268
- selectedMultiple: n,
269
- selected: n[0],
270
- multiple: u,
271
- open: o,
272
- disabled: a,
273
- size: E,
274
- placeholder: xe,
275
- label: O && /* @__PURE__ */ l("span", { ...Be(), children: Ie ? `${O} *` : O }),
276
- Arrow: Q && /* @__PURE__ */ l(Q, { open: o }),
277
- error: ye,
278
- hint: we,
279
- valueRenderer: Pe,
280
- className: le,
271
+ selectedMultiple: o,
272
+ selected: o[0],
273
+ multiple: h,
274
+ open: a,
275
+ disabled: f,
276
+ size: L,
277
+ placeholder: De,
278
+ label: st,
279
+ Arrow: Z && /* @__PURE__ */ l(Z, { open: a }),
280
+ error: xe,
281
+ hint: Pe,
282
+ valueRenderer: Me,
283
+ className: pe,
281
284
  innerProps: {
282
- onBlur: Ve,
283
- onFocus: a ? void 0 : Ue,
284
- onClick: a ? void 0 : qe,
285
- tabIndex: w || a ? -1 : 0,
286
- ref: se([m.ref]),
285
+ onBlur: Xe,
286
+ onFocus: f ? void 0 : Qe,
287
+ onClick: f ? void 0 : Ze,
288
+ tabIndex: k || f ? -1 : 0,
289
+ ref: ae([m.ref]),
287
290
  id: m.id,
288
291
  "aria-labelledby": m["aria-labelledby"],
289
292
  "aria-controls": m["aria-controls"],
290
- "aria-autocomplete": y ? m["aria-autocomplete"] : void 0
293
+ "aria-autocomplete": b ? m["aria-autocomplete"] : void 0
291
294
  },
292
- dataTestId: $("field", v),
293
- ...ke
295
+ dataTestId: _("field", c),
296
+ ...Re
294
297
  }
295
298
  ),
296
- f && !w && Ge(),
297
- !w && /* @__PURE__ */ l(
298
- rt,
299
+ g && !k && o.map((e) => /* @__PURE__ */ l("input", { type: "hidden", name: g, value: e.key }, e.key)),
300
+ !k && /* @__PURE__ */ l(
301
+ lt,
299
302
  {
300
- open: o,
303
+ open: a,
301
304
  withTransition: !1,
302
- anchorElement: Y.current,
303
- position: fe,
304
- offset: me,
305
- withArrow: ge,
306
- preventFlip: he,
307
- className: ae,
305
+ anchorElement: te.current,
306
+ position: ye,
307
+ offset: Ie,
308
+ withArrow: we,
309
+ preventFlip: be,
310
+ className: me,
308
311
  popperClassName: P.popoverInner,
309
- update: Ne,
310
- zIndex: Me,
311
- children: Qe && /* @__PURE__ */ l("div", { ...He, className: oe(de, P.optionsList), children: /* @__PURE__ */ l(
312
- Te,
312
+ update: We,
313
+ zIndex: Fe,
314
+ children: rt && /* @__PURE__ */ l("div", { ...Je, className: le(he, P.optionsList), children: /* @__PURE__ */ l(
315
+ Le,
313
316
  {
314
- ...Re,
315
- flatOptions: d,
316
- highlightedIndex: C,
317
- open: o,
318
- size: E,
319
- toggleMenu: W,
320
- actionButton: B,
321
- options: N != null ? N : g,
322
- Optgroup: ve,
323
- Option: ze,
324
- visibleOptions: Ee,
325
- onScroll: Ce,
326
- dataTestId: $("options-list", v)
317
+ ...Te,
318
+ flatOptions: i,
319
+ highlightedIndex: T,
320
+ open: a,
321
+ size: L,
322
+ toggleMenu: B,
323
+ actionButton: z,
324
+ options: S != null ? S : w,
325
+ Optgroup: Oe,
326
+ Option: tt,
327
+ visibleOptions: Ae,
328
+ onScroll: Ee,
329
+ dataTestId: _("options-list", c)
327
330
  }
328
331
  ) })
329
332
  }
@@ -334,6 +337,6 @@ const pt = Ze(
334
337
  }
335
338
  );
336
339
  export {
337
- pt as BaseSelect
340
+ xt as BaseSelect
338
341
  };
339
342
  //# sourceMappingURL=component.js.map