@reportportal/ui-kit 0.0.1-alpha.98 → 0.0.1-alpha.99

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.
@@ -15,6 +15,7 @@ export interface DropdownProps {
15
15
  transparentBackground?: boolean;
16
16
  className?: string;
17
17
  toggleButtonClassName?: string;
18
+ selectListClassName?: string;
18
19
  label?: ReactNode;
19
20
  onChange: (value: DropdownValue | DropdownValue[]) => void;
20
21
  onFocus?: () => void;
@@ -27,6 +28,6 @@ export interface DropdownProps {
27
28
  onSelectAll?: () => void;
28
29
  formatDisplayedValue?: (value: string | undefined) => string;
29
30
  notScrollable?: boolean;
30
- footer?: ReactNode;
31
+ footer?: ReactNode | ((closeHandler: () => void) => ReactNode);
31
32
  }
32
33
  export declare const Dropdown: FC<DropdownProps>;
@@ -3,7 +3,7 @@ import B from "react-datepicker/dist/es/index.js";
3
3
  import { c as R } from "./bind-06a7ff84.js";
4
4
  import { useMemo as P, useRef as D } from "react";
5
5
  import { F as I } from "./fieldText-ba8a917c.js";
6
- import { D as E } from "./dropdown-b26b8fd8.js";
6
+ import { D as E } from "./dropdown-ec754bbe.js";
7
7
  import { S as T } from "./calendarArrow-44c7e60e.js";
8
8
  import { registerLocale as j } from "react-datepicker";
9
9
  const ie = (n, s) => {
@@ -1,5 +1,5 @@
1
- import { D as t } from "./datePicker-0aca795c.js";
2
- import { r as q } from "./datePicker-0aca795c.js";
1
+ import { D as t } from "./datePicker-efa4e2d6.js";
2
+ import { r as q } from "./datePicker-efa4e2d6.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react-datepicker/dist/es/index.js";
5
5
  import "./bind-06a7ff84.js";
@@ -10,7 +10,7 @@ import "./baseIconButton-251479f7.js";
10
10
  import "./spinLoader-c4a53718.js";
11
11
  import "./maxValueDisplay-9be01a75.js";
12
12
  import "./fieldLabel.js";
13
- import "./dropdown-b26b8fd8.js";
13
+ import "./dropdown-ec754bbe.js";
14
14
  import "@floating-ui/react-dom";
15
15
  import "downshift";
16
16
  import "rc-scrollbars";
@@ -0,0 +1,289 @@
1
+ import { jsxs as u, jsx as a, Fragment as q } from "react/jsx-runtime";
2
+ import { forwardRef as ue, useState as z, useRef as fe, useCallback as ge } from "react";
3
+ import { c as Q } from "./bind-06a7ff84.js";
4
+ import { useFloating as pe, offset as me, flip as ye } from "@floating-ui/react-dom";
5
+ import { useSelect as j } from "downshift";
6
+ import { Scrollbars as be } from "rc-scrollbars";
7
+ import { u as Ce } from "./useOnClickOutside-c332f7d3.js";
8
+ import { K as g } from "./keyCodes-f63c0e11.js";
9
+ import { B as ke } from "./baseIconButton-251479f7.js";
10
+ import { S as Oe } from "./dropdown-0260bb66.js";
11
+ import { FieldLabel as Ne } from "./fieldLabel.js";
12
+ import { C as De } from "./checkbox-ed6cc375.js";
13
+ const Ee = "_disabled_1etj7_12", we = "_hidden_1etj7_16", ve = "_hover_1etj7_22", Ke = "_selected_1etj7_34", Ae = {
14
+ "dropdown-option": "_dropdown-option_1etj7_1",
15
+ disabled: Ee,
16
+ hidden: we,
17
+ hover: ve,
18
+ selected: Ke,
19
+ "multi-select": "_multi-select_1etj7_34",
20
+ "single-option": "_single-option_1etj7_39",
21
+ "sub-option": "_sub-option_1etj7_46"
22
+ }, G = Q.bind(Ae), J = ue(
23
+ (n, t) => {
24
+ const {
25
+ option: { value: r, disabled: d, hidden: A, label: p, title: c, groupRef: i },
26
+ selected: y,
27
+ onChange: m,
28
+ render: b,
29
+ highlightHovered: C,
30
+ onMouseEnter: x,
31
+ multiSelect: h,
32
+ isPartiallyChecked: k = !1
33
+ } = n, I = (O) => {
34
+ (O.target instanceof HTMLDivElement || O.target instanceof HTMLInputElement) && (m == null || m(r));
35
+ };
36
+ return /* @__PURE__ */ u(
37
+ "div",
38
+ {
39
+ className: G("dropdown-option", {
40
+ selected: y,
41
+ disabled: d,
42
+ hidden: A,
43
+ hover: C,
44
+ "multi-select": h
45
+ }),
46
+ title: c,
47
+ onClick: I,
48
+ ref: t,
49
+ onMouseEnter: x,
50
+ children: [
51
+ h && /* @__PURE__ */ a(De, { value: !!y, partiallyChecked: k }),
52
+ /* @__PURE__ */ a("div", { className: G("single-option", { "sub-option": !!i }), children: b ? b(n) : p })
53
+ ]
54
+ }
55
+ );
56
+ }
57
+ ), xe = [
58
+ g.ENTER_KEY_CODE,
59
+ g.SPACE_KEY_CODE,
60
+ g.ARROW_DOWN_KEY_CODE
61
+ ], Ie = [g.ESCAPE_KEY_CODE, g.TAB_KEY_CODE];
62
+ var f = /* @__PURE__ */ ((n) => (n.ON_KEY_DOWN = "onKeyDown", n.ON_CLICK = "onClick", n))(f || {});
63
+ const Pe = (n, t) => {
64
+ const r = Array.isArray(t) ? t : [t];
65
+ return n.findIndex(({ value: d }) => r.includes(d));
66
+ }, Ye = (n, t) => (n % t + t) % t, H = (n, t = 0, r = 1) => {
67
+ if (!n[t].disabled)
68
+ return t;
69
+ const d = n.length;
70
+ return H(
71
+ n,
72
+ Ye(t + r, d),
73
+ r
74
+ );
75
+ }, je = (n, t) => H(n, t), He = (n, t) => H(n, t, -1), Re = "_container_5enku_1", Te = "_icon_5enku_7", Me = "_arrow_5enku_13", We = "_dropdown_5enku_19", Le = "_disabled_5enku_36", Se = "_value_5enku_43", Ve = "_error_5enku_46", $e = "_touched_5enku_46", Ue = "_opened_5enku_50", qe = "_placeholder_5enku_83", ze = "_ghost_5enku_118", Ge = "_divider_5enku_139", Je = {
76
+ container: Re,
77
+ icon: Te,
78
+ arrow: Me,
79
+ dropdown: We,
80
+ "transparent-background": "_transparent-background_5enku_33",
81
+ disabled: Le,
82
+ value: Se,
83
+ error: Ve,
84
+ touched: $e,
85
+ opened: Ue,
86
+ placeholder: qe,
87
+ "mobile-disabled": "_mobile-disabled_5enku_87",
88
+ "select-list": "_select-list_5enku_92",
89
+ "limited-width": "_limited-width_5enku_109",
90
+ "options-container": "_options-container_5enku_113",
91
+ ghost: ze,
92
+ divider: Ge
93
+ }, o = Q.bind(Je), ot = ({
94
+ multiSelect: n = !1,
95
+ value: t = n ? [] : "",
96
+ options: r = [],
97
+ disabled: d = !1,
98
+ error: A,
99
+ onChange: p,
100
+ onFocus: c,
101
+ onBlur: i,
102
+ mobileDisabled: y,
103
+ title: m,
104
+ touched: b = !1,
105
+ icon: C,
106
+ variant: x,
107
+ placeholder: h = "",
108
+ label: k = "",
109
+ renderOption: I,
110
+ transparentBackground: O = !1,
111
+ className: X,
112
+ toggleButtonClassName: Z,
113
+ selectListClassName: B,
114
+ isListWidthLimited: F = !1,
115
+ optionAll: R = { value: "all", label: "All" },
116
+ isOptionAllVisible: T = !1,
117
+ onSelectAll: ee = () => {
118
+ },
119
+ formatDisplayedValue: M,
120
+ notScrollable: te = !1,
121
+ footer: N
122
+ }) => {
123
+ const [_, D] = z(!1), W = fe(null), [ne, E] = z(null), P = n && Array.isArray(t) ? r.filter((e) => t.includes(e.value)) : null, { refs: L, floatingStyles: re } = pe({
124
+ placement: "bottom-start",
125
+ middleware: [
126
+ me(5),
127
+ ye({
128
+ fallbackPlacements: ["bottom-start", "top-start", "bottom", "top"]
129
+ })
130
+ ]
131
+ }), se = () => {
132
+ if (T && Array.isArray(t)) {
133
+ const e = r.map((s) => s.value);
134
+ p(t.length === r.length ? [] : e), ee();
135
+ }
136
+ }, w = ge(() => {
137
+ D(!1), i == null || i();
138
+ }, [i]);
139
+ Ce(W, () => {
140
+ _ && w();
141
+ });
142
+ const S = (e) => {
143
+ if (!e.disabled) {
144
+ if (n) {
145
+ const s = Array.isArray(t) ? [...t] : [], l = s.indexOf(e.value);
146
+ l === -1 ? s.push(e.value) : s.splice(l, 1), p(s);
147
+ } else
148
+ p(e.value);
149
+ D((s) => n || !s);
150
+ }
151
+ }, ae = () => r.find(({ value: e }) => e === t), V = Pe(r, t), {
152
+ getToggleButtonProps: le,
153
+ getLabelProps: de,
154
+ getMenuProps: ie,
155
+ getItemProps: oe,
156
+ setHighlightedIndex: v,
157
+ highlightedIndex: $,
158
+ selectedItem: K
159
+ } = j({
160
+ items: r,
161
+ itemToString: (e) => (e != null && e.label ? String(e.label) : h) || "",
162
+ selectedItem: ae(),
163
+ isOpen: _,
164
+ circularNavigation: !0,
165
+ defaultHighlightedIndex: V,
166
+ onHighlightedIndexChange: (e) => {
167
+ switch (e.type) {
168
+ case j.stateChangeTypes.MenuKeyDownArrowUp:
169
+ return E(f.ON_KEY_DOWN), v(He(r, e.highlightedIndex)), e;
170
+ case j.stateChangeTypes.MenuKeyDownArrowDown:
171
+ return E(f.ON_KEY_DOWN), v(je(r, e.highlightedIndex)), e;
172
+ default:
173
+ return e;
174
+ }
175
+ }
176
+ }), ce = () => {
177
+ d || (D((e) => !e), _ ? i == null || i() : c == null || c(), E(f.ON_CLICK));
178
+ }, Y = (() => {
179
+ if (n && Array.isArray(t) && r.length === t.length)
180
+ return R.label;
181
+ const e = r.reduce((s, l) => ((Array.isArray(t) && t.includes(l.value) || l.value === t) && s.push(l.label), s), []);
182
+ if (e.length > 0)
183
+ return e.join(", ");
184
+ if (!t && t !== !1 && t !== 0 || Array.isArray(t) && !t.length)
185
+ return h;
186
+ })(), _e = (e) => {
187
+ const { keyCode: s } = e;
188
+ xe.includes(s) && !_ && (e.preventDefault(), v(V), D(!0), c == null || c(), E(f.ON_KEY_DOWN));
189
+ }, he = (e) => {
190
+ const { keyCode: s } = e;
191
+ if (s === g.ENTER_KEY_CODE) {
192
+ const l = r[$];
193
+ S(l), n || w();
194
+ return;
195
+ }
196
+ Ie.includes(s) && (e.stopPropagation(), w());
197
+ }, U = () => /* @__PURE__ */ u("div", { className: o("options-container"), children: [
198
+ n && T && Array.isArray(t) && /* @__PURE__ */ u(q, { children: [
199
+ /* @__PURE__ */ a(
200
+ J,
201
+ {
202
+ option: R,
203
+ selected: t.length === r.length,
204
+ onChange: se,
205
+ multiSelect: n,
206
+ isPartiallyChecked: !!t.length
207
+ }
208
+ ),
209
+ /* @__PURE__ */ a("div", { className: o("divider") }),
210
+ " "
211
+ ] }),
212
+ r.map((e, s) => /* @__PURE__ */ a(
213
+ J,
214
+ {
215
+ ...oe({
216
+ item: e,
217
+ index: s
218
+ }),
219
+ multiSelect: n,
220
+ selected: n ? P == null ? void 0 : P.some((l) => l.value === e.value) : e.value === ((K == null ? void 0 : K.value) ?? K),
221
+ option: { title: e.label, ...e },
222
+ highlightHovered: $ === s && ne !== f.ON_CLICK,
223
+ render: I,
224
+ onChange: e.disabled ? null : () => S(e),
225
+ onMouseEnter: () => v(s)
226
+ },
227
+ e.value
228
+ )),
229
+ N && /* @__PURE__ */ u(q, { children: [
230
+ /* @__PURE__ */ a("div", { className: o("divider") }),
231
+ typeof N == "function" ? N(w) : N
232
+ ] })
233
+ ] });
234
+ return /* @__PURE__ */ u("div", { ref: W, className: o("container", X), title: m, children: [
235
+ k && /* @__PURE__ */ a(Ne, { ...de(), children: k }),
236
+ /* @__PURE__ */ u(
237
+ "button",
238
+ {
239
+ disabled: d,
240
+ ...le({
241
+ className: o("dropdown", x, Z, {
242
+ "transparent-background": O,
243
+ opened: _,
244
+ disabled: d,
245
+ error: A,
246
+ touched: b,
247
+ "mobile-disabled": y
248
+ }),
249
+ onClick: ce,
250
+ onKeyDown: _e,
251
+ ref: L.setReference
252
+ }),
253
+ type: "button",
254
+ children: [
255
+ C && /* @__PURE__ */ a("span", { className: o("icon"), children: C }),
256
+ /* @__PURE__ */ a(
257
+ "span",
258
+ {
259
+ className: o("value", {
260
+ placeholder: Y === h
261
+ }),
262
+ children: M ? M(Y) : Y
263
+ }
264
+ ),
265
+ /* @__PURE__ */ a(ke, { className: o("arrow"), tabIndex: -1, children: /* @__PURE__ */ a(Oe, {}) })
266
+ ]
267
+ }
268
+ ),
269
+ _ && /* @__PURE__ */ a(
270
+ "div",
271
+ {
272
+ style: re,
273
+ className: o(
274
+ "select-list",
275
+ { opened: _, "limited-width": F },
276
+ B
277
+ ),
278
+ ...ie({
279
+ onKeyDown: he,
280
+ ref: L.setFloating
281
+ }),
282
+ children: te ? U() : /* @__PURE__ */ a(be, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: U() })
283
+ }
284
+ )
285
+ ] });
286
+ };
287
+ export {
288
+ ot as D
289
+ };
package/dist/dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as r } from "./dropdown-b26b8fd8.js";
1
+ import { D as r } from "./dropdown-ec754bbe.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "./bind-06a7ff84.js";
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import { B as D } from "./breadcrumbs-8e5ca8d7.js";
4
4
  import { B as g } from "./bubblesLoader-f3ffa240.js";
5
5
  import { B as h } from "./button-97d9e587.js";
6
6
  import { C as y } from "./checkbox-ed6cc375.js";
7
- import { D as M } from "./datePicker-0aca795c.js";
7
+ import { D as M } from "./datePicker-efa4e2d6.js";
8
8
  import "react-datepicker";
9
- import { D as w } from "./dropdown-b26b8fd8.js";
9
+ import { D as w } from "./dropdown-ec754bbe.js";
10
10
  import { FieldLabel as k } from "./fieldLabel.js";
11
11
  import { F as R } from "./fieldNumber-c9113a7f.js";
12
12
  import { F as H } from "./fieldText-ba8a917c.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.98",
3
+ "version": "0.0.1-alpha.99",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,282 +0,0 @@
1
- import { jsxs as u, jsx as d, Fragment as U } from "react/jsx-runtime";
2
- import { forwardRef as _e, useState as q, useRef as he } from "react";
3
- import { c as J } from "./bind-06a7ff84.js";
4
- import { useFloating as fe, offset as ue, flip as ge } from "@floating-ui/react-dom";
5
- import { useSelect as P } from "downshift";
6
- import { Scrollbars as pe } from "rc-scrollbars";
7
- import { u as me } from "./useOnClickOutside-c332f7d3.js";
8
- import { K as p } from "./keyCodes-f63c0e11.js";
9
- import { B as ye } from "./baseIconButton-251479f7.js";
10
- import { S as be } from "./dropdown-0260bb66.js";
11
- import { FieldLabel as Ce } from "./fieldLabel.js";
12
- import { C as Oe } from "./checkbox-ed6cc375.js";
13
- const ke = "_disabled_1etj7_12", Ne = "_hidden_1etj7_16", De = "_hover_1etj7_22", Ee = "_selected_1etj7_34", we = {
14
- "dropdown-option": "_dropdown-option_1etj7_1",
15
- disabled: ke,
16
- hidden: Ne,
17
- hover: De,
18
- selected: Ee,
19
- "multi-select": "_multi-select_1etj7_34",
20
- "single-option": "_single-option_1etj7_39",
21
- "sub-option": "_sub-option_1etj7_46"
22
- }, z = J.bind(we), G = _e(
23
- (n, t) => {
24
- const {
25
- option: { value: r, disabled: i, hidden: v, label: m, title: c, groupRef: a },
26
- selected: b,
27
- onChange: y,
28
- render: C,
29
- highlightHovered: O,
30
- onMouseEnter: K,
31
- multiSelect: h,
32
- isPartiallyChecked: k = !1
33
- } = n, A = (N) => {
34
- (N.target instanceof HTMLDivElement || N.target instanceof HTMLInputElement) && (y == null || y(r));
35
- };
36
- return /* @__PURE__ */ u(
37
- "div",
38
- {
39
- className: z("dropdown-option", {
40
- selected: b,
41
- disabled: i,
42
- hidden: v,
43
- hover: O,
44
- "multi-select": h
45
- }),
46
- title: c,
47
- onClick: A,
48
- ref: t,
49
- onMouseEnter: K,
50
- children: [
51
- h && /* @__PURE__ */ d(Oe, { value: !!b, partiallyChecked: k }),
52
- /* @__PURE__ */ d("div", { className: z("single-option", { "sub-option": !!a }), children: C ? C(n) : m })
53
- ]
54
- }
55
- );
56
- }
57
- ), ve = [
58
- p.ENTER_KEY_CODE,
59
- p.SPACE_KEY_CODE,
60
- p.ARROW_DOWN_KEY_CODE
61
- ], Ke = [p.ESCAPE_KEY_CODE, p.TAB_KEY_CODE];
62
- var g = /* @__PURE__ */ ((n) => (n.ON_KEY_DOWN = "onKeyDown", n.ON_CLICK = "onClick", n))(g || {});
63
- const Ae = (n, t) => {
64
- const r = Array.isArray(t) ? t : [t];
65
- return n.findIndex(({ value: i }) => r.includes(i));
66
- }, xe = (n, t) => (n % t + t) % t, Y = (n, t = 0, r = 1) => {
67
- if (!n[t].disabled)
68
- return t;
69
- const i = n.length;
70
- return Y(
71
- n,
72
- xe(t + r, i),
73
- r
74
- );
75
- }, Ie = (n, t) => Y(n, t), Pe = (n, t) => Y(n, t, -1), Ye = "_container_5enku_1", je = "_icon_5enku_7", Re = "_arrow_5enku_13", Te = "_dropdown_5enku_19", He = "_disabled_5enku_36", Me = "_value_5enku_43", We = "_error_5enku_46", Le = "_touched_5enku_46", Se = "_opened_5enku_50", Ve = "_placeholder_5enku_83", $e = "_ghost_5enku_118", Ue = "_divider_5enku_139", qe = {
76
- container: Ye,
77
- icon: je,
78
- arrow: Re,
79
- dropdown: Te,
80
- "transparent-background": "_transparent-background_5enku_33",
81
- disabled: He,
82
- value: Me,
83
- error: We,
84
- touched: Le,
85
- opened: Se,
86
- placeholder: Ve,
87
- "mobile-disabled": "_mobile-disabled_5enku_87",
88
- "select-list": "_select-list_5enku_92",
89
- "limited-width": "_limited-width_5enku_109",
90
- "options-container": "_options-container_5enku_113",
91
- ghost: $e,
92
- divider: Ue
93
- }, o = J.bind(qe), dt = ({
94
- multiSelect: n = !1,
95
- value: t = n ? [] : "",
96
- options: r = [],
97
- disabled: i = !1,
98
- error: v,
99
- onChange: m,
100
- onFocus: c,
101
- onBlur: a,
102
- mobileDisabled: b,
103
- title: y,
104
- touched: C = !1,
105
- icon: O,
106
- variant: K,
107
- placeholder: h = "",
108
- label: k = "",
109
- renderOption: A,
110
- transparentBackground: N = !1,
111
- className: Q,
112
- toggleButtonClassName: X,
113
- isListWidthLimited: Z = !1,
114
- optionAll: j = { value: "all", label: "All" },
115
- isOptionAllVisible: R = !1,
116
- onSelectAll: F = () => {
117
- },
118
- formatDisplayedValue: T,
119
- notScrollable: B = !1,
120
- footer: H
121
- }) => {
122
- const [_, f] = q(!1), M = he(null), [ee, D] = q(null), x = n && Array.isArray(t) ? r.filter((e) => t.includes(e.value)) : null, { refs: W, floatingStyles: te } = fe({
123
- placement: "bottom-start",
124
- middleware: [
125
- ue(5),
126
- ge({
127
- fallbackPlacements: ["bottom-start", "top-start", "bottom", "top"]
128
- })
129
- ]
130
- }), ne = () => {
131
- if (R && Array.isArray(t)) {
132
- const e = r.map((s) => s.value);
133
- m(t.length === r.length ? [] : e), F();
134
- }
135
- };
136
- me(M, () => {
137
- _ && (f(!1), a == null || a());
138
- });
139
- const L = (e) => {
140
- if (!e.disabled) {
141
- if (n) {
142
- const s = Array.isArray(t) ? [...t] : [], l = s.indexOf(e.value);
143
- l === -1 ? s.push(e.value) : s.splice(l, 1), m(s);
144
- } else
145
- m(e.value);
146
- f((s) => n || !s);
147
- }
148
- }, re = () => r.find(({ value: e }) => e === t), S = Ae(r, t), {
149
- getToggleButtonProps: se,
150
- getLabelProps: ae,
151
- getMenuProps: de,
152
- getItemProps: le,
153
- setHighlightedIndex: E,
154
- highlightedIndex: V,
155
- selectedItem: w
156
- } = P({
157
- items: r,
158
- itemToString: (e) => (e != null && e.label ? String(e.label) : h) || "",
159
- selectedItem: re(),
160
- isOpen: _,
161
- circularNavigation: !0,
162
- defaultHighlightedIndex: S,
163
- onHighlightedIndexChange: (e) => {
164
- switch (e.type) {
165
- case P.stateChangeTypes.MenuKeyDownArrowUp:
166
- return D(g.ON_KEY_DOWN), E(Pe(r, e.highlightedIndex)), e;
167
- case P.stateChangeTypes.MenuKeyDownArrowDown:
168
- return D(g.ON_KEY_DOWN), E(Ie(r, e.highlightedIndex)), e;
169
- default:
170
- return e;
171
- }
172
- }
173
- }), ie = () => {
174
- i || (f((e) => !e), _ ? a == null || a() : c == null || c(), D(g.ON_CLICK));
175
- }, I = (() => {
176
- if (n && Array.isArray(t) && r.length === t.length)
177
- return j.label;
178
- const e = r.reduce((s, l) => ((Array.isArray(t) && t.includes(l.value) || l.value === t) && s.push(l.label), s), []);
179
- if (e.length > 0)
180
- return e.join(", ");
181
- if (!t && t !== !1 && t !== 0 || Array.isArray(t) && !t.length)
182
- return h;
183
- })(), oe = (e) => {
184
- const { keyCode: s } = e;
185
- ve.includes(s) && !_ && (e.preventDefault(), E(S), f(!0), c == null || c(), D(g.ON_KEY_DOWN));
186
- }, ce = (e) => {
187
- const { keyCode: s } = e;
188
- if (s === p.ENTER_KEY_CODE) {
189
- const l = r[V];
190
- L(l), n || (f(!1), a == null || a());
191
- return;
192
- }
193
- Ke.includes(s) && (e.stopPropagation(), f(!1), a == null || a());
194
- }, $ = () => /* @__PURE__ */ u("div", { className: o("options-container"), children: [
195
- n && R && Array.isArray(t) && /* @__PURE__ */ u(U, { children: [
196
- /* @__PURE__ */ d(
197
- G,
198
- {
199
- option: j,
200
- selected: t.length === r.length,
201
- onChange: ne,
202
- multiSelect: n,
203
- isPartiallyChecked: !!t.length
204
- }
205
- ),
206
- /* @__PURE__ */ d("div", { className: o("divider") }),
207
- " "
208
- ] }),
209
- r.map((e, s) => /* @__PURE__ */ d(
210
- G,
211
- {
212
- ...le({
213
- item: e,
214
- index: s
215
- }),
216
- multiSelect: n,
217
- selected: n ? x == null ? void 0 : x.some((l) => l.value === e.value) : e.value === ((w == null ? void 0 : w.value) ?? w),
218
- option: { title: e.label, ...e },
219
- highlightHovered: V === s && ee !== g.ON_CLICK,
220
- render: A,
221
- onChange: e.disabled ? null : () => L(e),
222
- onMouseEnter: () => E(s)
223
- },
224
- e.value
225
- )),
226
- H && /* @__PURE__ */ u(U, { children: [
227
- /* @__PURE__ */ d("div", { className: o("divider") }),
228
- H
229
- ] })
230
- ] });
231
- return /* @__PURE__ */ u("div", { ref: M, className: o("container", Q), title: y, children: [
232
- k && /* @__PURE__ */ d(Ce, { ...ae(), children: k }),
233
- /* @__PURE__ */ u(
234
- "button",
235
- {
236
- disabled: i,
237
- ...se({
238
- className: o("dropdown", K, X, {
239
- "transparent-background": N,
240
- opened: _,
241
- disabled: i,
242
- error: v,
243
- touched: C,
244
- "mobile-disabled": b
245
- }),
246
- onClick: ie,
247
- onKeyDown: oe,
248
- ref: W.setReference
249
- }),
250
- type: "button",
251
- children: [
252
- O && /* @__PURE__ */ d("span", { className: o("icon"), children: O }),
253
- /* @__PURE__ */ d(
254
- "span",
255
- {
256
- className: o("value", {
257
- placeholder: I === h
258
- }),
259
- children: T ? T(I) : I
260
- }
261
- ),
262
- /* @__PURE__ */ d(ye, { className: o("arrow"), tabIndex: -1, children: /* @__PURE__ */ d(be, {}) })
263
- ]
264
- }
265
- ),
266
- _ && /* @__PURE__ */ d(
267
- "div",
268
- {
269
- style: te,
270
- className: o("select-list", { opened: _, "limited-width": Z }),
271
- ...de({
272
- onKeyDown: ce,
273
- ref: W.setFloating
274
- }),
275
- children: B ? $() : /* @__PURE__ */ d(pe, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: $() })
276
- }
277
- )
278
- ] });
279
- };
280
- export {
281
- dt as D
282
- };