@ironsource/shared-ui 2.2.0-rc.48 → 2.2.0-rc.50

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 (92) hide show
  1. package/ChipDropdownTrigger.vue_vue_type_style_index_0_scoped_38354f10_lang.css +1 -0
  2. package/DataGridMenu.vue_vue_type_style_index_0_scoped_ddfaf207_lang.css +1 -0
  3. package/DateRangeV4.vue_vue_type_style_index_0_scoped_f8826716_lang.css +1 -0
  4. package/DropdownV4.vue_vue_type_style_index_0_scoped_526bf0a1_lang.css +1 -0
  5. package/FieldLabel.vue_vue_type_style_index_0_scoped_921d4087_lang.css +1 -0
  6. package/HelpText.vue_vue_type_style_index_0_scoped_641c2356_lang.css +1 -0
  7. package/IconButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_99e51ecc_lang.css +1 -0
  8. package/InlineCopy.vue_vue_type_style_index_0_scoped_9fa1921a_lang.css +1 -0
  9. package/Link.vue_vue_type_style_index_0_scoped_fe0e7f6f_lang.css +1 -0
  10. package/OptionV4.vue_vue_type_style_index_0_scoped_771e1980_lang.css +1 -0
  11. package/README.md +2 -2
  12. package/SearchV4.vue_vue_type_style_index_0_scoped_d6c42f4b_lang.css +1 -0
  13. package/TabsV4.vue_vue_type_style_index_0_scoped_f9433b11_lang.css +1 -0
  14. package/TextField.vue_vue_type_style_index_0_scoped_28fab783_lang.css +1 -0
  15. package/ToggleV4.vue_vue_type_style_index_0_scoped_a4aa32fb_lang.css +1 -0
  16. package/TooltipV4.vue_vue_type_style_index_0_scoped_a8aebfee_lang.css +1 -0
  17. package/components/autocomplete/index.d.ts +16 -16
  18. package/components/columnPicker/ColumnPicker.vue.d.ts +1 -1
  19. package/components/columnPicker/index.d.ts +20 -20
  20. package/components/dateRange/v4/DateRangeV4.vue.js +2 -2
  21. package/components/dateRange/v4/DateRangeV4.vue2.js +27 -28
  22. package/components/dropdown/common/Dropdown.common.js +274 -351
  23. package/components/dropdown/v3/Dropdown.vue.d.ts +5 -5
  24. package/components/dropdown/v3/index.d.ts +77 -77
  25. package/components/dropdown/v4/ChipDropdownTrigger.vue.js +3 -3
  26. package/components/dropdown/v4/ChipDropdownTrigger.vue2.js +32 -38
  27. package/components/dropdown/v4/ConditionalDropdown.vue.d.ts +1 -1
  28. package/components/dropdown/v4/DropdownV4.vue.d.ts +41 -50
  29. package/components/dropdown/v4/DropdownV4.vue.js +2 -2
  30. package/components/dropdown/v4/DropdownV4.vue2.js +216 -237
  31. package/components/dropdown/v4/IconButtonDropdownTrigger.vue.d.ts +0 -5
  32. package/components/dropdown/v4/IconButtonDropdownTrigger.vue.js +3 -3
  33. package/components/dropdown/v4/IconButtonDropdownTrigger.vue2.js +9 -12
  34. package/components/dropdown/v4/OptionV4.vue.js +3 -3
  35. package/components/dropdown/v4/OptionV4.vue2.js +12 -12
  36. package/components/dropdown/v4/TreeDropdown.vue.d.ts +1 -1
  37. package/components/dropdown/v4/index.d.ts +2102 -2130
  38. package/components/helpText/HelpText.vue.js +3 -3
  39. package/components/helpText/HelpText.vue2.js +10 -11
  40. package/components/includeExclude/IncludeExclude.vue.d.ts +2 -2
  41. package/components/includeExclude/IncludeExcludeDragDrop.vue.d.ts +2 -2
  42. package/components/includeExclude/index.d.ts +54 -54
  43. package/components/inlineCopy/InlineCopy.vue.d.ts +0 -5
  44. package/components/inlineCopy/InlineCopy.vue.js +3 -3
  45. package/components/inlineCopy/InlineCopy.vue2.js +53 -54
  46. package/components/inlineCopy/index.d.ts +0 -9
  47. package/components/input/v4/TextField.vue.d.ts +0 -5
  48. package/components/input/v4/TextField.vue.js +2 -2
  49. package/components/input/v4/TextField.vue2.js +19 -22
  50. package/components/input/v4/index.d.ts +1 -20
  51. package/components/link/Link.vue.js +5 -5
  52. package/components/link/Link.vue2.js +21 -30
  53. package/components/search/v4/SearchV4.vue.d.ts +0 -5
  54. package/components/search/v4/SearchV4.vue.js +5 -5
  55. package/components/search/v4/SearchV4.vue2.js +18 -23
  56. package/components/search/v4/index.d.ts +0 -9
  57. package/components/shared/FieldLabel.vue.js +3 -3
  58. package/components/shared/FieldLabel.vue2.js +8 -9
  59. package/components/table/v4/DataGridMenu.vue.d.ts +0 -5
  60. package/components/table/v4/DataGridMenu.vue.js +5 -5
  61. package/components/table/v4/DataGridMenu.vue2.js +22 -28
  62. package/components/table/v4/index.d.ts +0 -9
  63. package/components/tabs/v4/TabsV4.vue.d.ts +0 -5
  64. package/components/tabs/v4/TabsV4.vue.js +3 -3
  65. package/components/tabs/v4/TabsV4.vue2.js +43 -74
  66. package/components/tabs/v4/index.d.ts +1 -20
  67. package/components/toggle/v4/ToggleV4.vue.d.ts +0 -5
  68. package/components/toggle/v4/ToggleV4.vue.js +3 -3
  69. package/components/toggle/v4/ToggleV4.vue2.js +41 -50
  70. package/components/toggle/v4/index.d.ts +1 -20
  71. package/components/tooltip/v4/TooltipV4.vue.d.ts +1 -14
  72. package/components/tooltip/v4/TooltipV4.vue.js +2 -2
  73. package/components/tooltip/v4/TooltipV4.vue2.js +63 -85
  74. package/components/tooltip/v4/index.d.ts +4 -51
  75. package/index.d.ts +2404 -2722
  76. package/index.js +1 -1
  77. package/package.json +1 -5
  78. package/ChipDropdownTrigger.vue_vue_type_style_index_0_scoped_5a645cc9_lang.css +0 -1
  79. package/DataGridMenu.vue_vue_type_style_index_0_scoped_b7e65177_lang.css +0 -1
  80. package/DateRangeV4.vue_vue_type_style_index_0_scoped_bb44cdf8_lang.css +0 -1
  81. package/DropdownV4.vue_vue_type_style_index_0_scoped_f44f2402_lang.css +0 -1
  82. package/FieldLabel.vue_vue_type_style_index_0_scoped_960ea8b1_lang.css +0 -1
  83. package/HelpText.vue_vue_type_style_index_0_scoped_b5caf7cd_lang.css +0 -1
  84. package/IconButtonDropdownTrigger.vue_vue_type_style_index_0_scoped_2a5345ef_lang.css +0 -1
  85. package/InlineCopy.vue_vue_type_style_index_0_scoped_8cb01c9d_lang.css +0 -1
  86. package/Link.vue_vue_type_style_index_0_scoped_c4345b08_lang.css +0 -1
  87. package/OptionV4.vue_vue_type_style_index_0_scoped_d48a9318_lang.css +0 -1
  88. package/SearchV4.vue_vue_type_style_index_0_scoped_e1a33934_lang.css +0 -1
  89. package/TabsV4.vue_vue_type_style_index_0_scoped_9747c9da_lang.css +0 -1
  90. package/TextField.vue_vue_type_style_index_0_scoped_f4275491_lang.css +0 -1
  91. package/ToggleV4.vue_vue_type_style_index_0_scoped_fbbae882_lang.css +0 -1
  92. package/TooltipV4.vue_vue_type_style_index_0_scoped_22e25f74_lang.css +0 -1
@@ -1,476 +1,399 @@
1
- import { useToggle as je } from "../../../composables/useToggle.js";
2
- import { inject as ze, ref as s, computed as c, watch as A, useSlots as We, toRaw as T, nextTick as R, provide as Fe, onMounted as Je } from "vue";
3
- import { isObjectInArray as se } from "../../../utils/array.js";
4
- import { objectsEqual as Qe } from "../../../utils/object.js";
5
- import { useClamp as Ye, useVirtualList as Ze, onClickOutside as de, useInfiniteScroll as pe } from "@vueuse/core";
6
- import { Mode as N, Type as q, DropdownContext as et } from "./DropdownContext.js";
7
- import { pxToRem as tt } from "../../../utils/style.js";
8
- import { useEditableContext as lt } from "../../table-cells/common/EditableContext.js";
9
- import { useGroupedOptions as at } from "./useGroupedOptions.js";
10
- const vt = (t, v, g) => {
11
- const X = ze("isTreeDropdown", !1), {
12
- sortOutGroups: $,
13
- flattenAndMarkGroupOptions: k,
14
- isGroup: j,
15
- selectAllWithGroups: fe,
16
- isIndeterminateGrouped: ve,
17
- allSelectedGrouped: z,
18
- areAllPreviousSelected: ge,
19
- groupedChildOptionsLength: ye
20
- } = at(t), W = (e, l) => t.multi && Array.isArray(e) ? t.comparingKey ? e?.findIndex(
21
- (a) => a[t.comparingKey] === l[t.comparingKey]
22
- ) > -1 : se(e, l) : t.comparingKey ? e?.[t.comparingKey] === l[t.comparingKey] : e === l;
23
- let F;
24
- ((e) => {
25
- e[e.None = 0] = "None", e[e.Next = 1] = "Next", e[e.Previous = -1] = "Previous", e[e.NextPage = 10] = "NextPage", e[e.PrevPage = -10] = "PrevPage";
26
- })(F || (F = {}));
27
- const n = s(
28
- t.selected
29
- ), _ = lt(), r = c({
1
+ import { useToggle as ke } from "../../../composables/useToggle.js";
2
+ import { inject as Ge, ref as r, computed as c, watch as b, useSlots as Le, toRaw as w, nextTick as N, provide as Ue, onMounted as Be } from "vue";
3
+ import { isObjectInArray as ue } from "../../../utils/array.js";
4
+ import { objectsEqual as He } from "../../../utils/object.js";
5
+ import { useClamp as qe, useVirtualList as Xe, onClickOutside as ie, useInfiniteScroll as $e } from "@vueuse/core";
6
+ import { Mode as x, Type as U, DropdownContext as je } from "./DropdownContext.js";
7
+ import { pxToRem as ze } from "../../../utils/style.js";
8
+ import { useEditableContext as We } from "../../table-cells/common/EditableContext.js";
9
+ import { useGroupedOptions as Je } from "./useGroupedOptions.js";
10
+ const nl = (e, d, y) => {
11
+ const B = Ge("isTreeDropdown", !1), {
12
+ sortOutGroups: H,
13
+ flattenAndMarkGroupOptions: q,
14
+ isGroup: X,
15
+ selectAllWithGroups: re,
16
+ isIndeterminateGrouped: oe,
17
+ allSelectedGrouped: $,
18
+ areAllPreviousSelected: ce,
19
+ groupedChildOptionsLength: se
20
+ } = Je(e), de = (l, t) => e.multi && Array.isArray(l) ? e.comparingKey ? l?.findIndex(
21
+ (i) => i[e.comparingKey] === t[e.comparingKey]
22
+ ) > -1 : ue(l, t) : e.comparingKey ? l?.[e.comparingKey] === t[e.comparingKey] : l === t;
23
+ let j;
24
+ ((l) => {
25
+ l[l.None = 0] = "None", l[l.Next = 1] = "Next", l[l.Previous = -1] = "Previous", l[l.NextPage = 10] = "NextPage", l[l.PrevPage = -10] = "PrevPage";
26
+ })(j || (j = {}));
27
+ const a = r(
28
+ e.selected
29
+ ), K = We(), n = c({
30
30
  get() {
31
- return _?.value?.value ?? n.value;
31
+ return K?.value?.value ?? a.value;
32
32
  },
33
- set(e) {
34
- _.onChange?.(e), _.onClose?.(), v("update:selected", e);
33
+ set(l) {
34
+ K.onChange?.(l), K.onClose?.(), d("update:selected", l);
35
35
  }
36
36
  });
37
- A(
38
- () => t.selected,
37
+ b(
38
+ () => e.selected,
39
39
  () => {
40
- n.value = t.selected, y.value = t.selected;
40
+ a.value = e.selected, v.value = e.selected;
41
41
  }
42
42
  );
43
- const he = We(), x = s(null), S = s(null), D = s(null), V = s(null), J = s(null), I = s(null), be = s(), Q = s(null), Y = s(null), Z = s(null), me = 8, Oe = c(() => I.value ? I.value.getBoundingClientRect().height + me + t.distance : 0), C = s(!1), O = s([]), P = s(-1), b = s(""), y = s(t.selected || []), p = () => I.value?.focus(), [h, Se, Ae] = je({
44
- disabled: t.disabled,
45
- initialValue: t.defaultOpen
43
+ const ve = Le(), D = r(null), m = r(null), z = r(null), R = r(null), W = r(null), M = r(null), fe = r(), J = r(null), Q = r(null), Y = r(null), ge = 8, ye = c(() => M.value ? M.value.getBoundingClientRect().height + ge + e.distance : 0), C = r(!1), h = r([]), T = r(-1), O = r(""), v = r(e.selected || []), Z = () => M.value?.focus(), [S, he, Oe] = ke({
44
+ disabled: e.disabled,
45
+ initialValue: e.defaultOpen
46
46
  });
47
- A(
48
- () => t.disabled,
49
- (e) => {
50
- e !== void 0 && Ae(e);
47
+ b(
48
+ () => e.disabled,
49
+ (l) => {
50
+ l !== void 0 && Oe(l);
51
51
  }
52
52
  );
53
- const ee = (e) => {
54
- Te.value = Se(e);
55
- }, Te = c({
53
+ const F = (l) => {
54
+ Se.value = he(l);
55
+ }, Se = c({
56
56
  get() {
57
- return t.isOpen;
57
+ return e.isOpen;
58
58
  },
59
- set(e) {
60
- v("update:isOpen", e);
59
+ set(l) {
60
+ d("update:isOpen", l);
61
61
  }
62
- }), xe = c(() => o.value.length - 1), te = c(
63
- () => g.VERSION === 4 && t.showSelectAll !== !1 && t.multi && !b.value && !t.loading && !!t.options.length && !(t.minSelections || t.maxSelections)
64
- ), Ie = c(() => te.value ? -1 : 0), d = Ye(0, Ie, xe), le = c(() => r.value ? t.displayValue(r.value) : ""), Pe = (e) => {
65
- if (!e.value.length && !t.multiOptionsPlaceholderPrefix && !t.multiOptionsPlaceholderSuffix)
66
- return t.placeholder;
67
- const l = !t.multiOptionsPlaceholderPrefix && !t.multiOptionsPlaceholderSuffix ? `${e.value.length} selected` : `${t.multiOptionsPlaceholderPrefix ?? ""}${e.value.length ?? "0"}${t.multiOptionsPlaceholderSuffix ?? ""}`;
68
- return e.value.length == 1 && t.displayValue ? t.displayValue(e.value[0]) : l;
69
- }, Ke = c(() => {
70
- if (!t.multi)
71
- return r.value ? t.displayValue(r.value) : t.placeholder;
72
- if (Array.isArray(n.value))
73
- return Pe(n);
74
- }), G = c(() => {
75
- if (Array.isArray(n.value))
76
- return t.groupedOptions ? z(o, n) : n.value.length === o.value.length;
77
- }), we = c(() => !t.multi || !Array.isArray(n.value) ? !1 : t.groupedOptions ? ve(
62
+ }), me = c(() => o.value.length - 1), g = qe(0, 0, me), p = c(() => n.value ? e.displayValue(n.value) : ""), Ae = (l) => {
63
+ if (!l.value.length && !e.multiOptionsPlaceholderPrefix && !e.multiOptionsPlaceholderSuffix)
64
+ return e.placeholder;
65
+ const t = !e.multiOptionsPlaceholderPrefix && !e.multiOptionsPlaceholderSuffix ? `${l.value.length} selected` : `${e.multiOptionsPlaceholderPrefix ?? ""}${l.value.length ?? "0"}${e.multiOptionsPlaceholderSuffix ?? ""}`;
66
+ return l.value.length == 1 && e.displayValue ? e.displayValue(l.value[0]) : t;
67
+ }, be = c(() => {
68
+ if (!e.multi)
69
+ return n.value ? e.displayValue(n.value) : e.placeholder;
70
+ if (Array.isArray(a.value))
71
+ return Ae(a);
72
+ }), E = c(() => {
73
+ if (Array.isArray(a.value))
74
+ return e.groupedOptions ? $(o, a) : a.value.length === o.value.length;
75
+ }), Te = c(() => !e.multi || !Array.isArray(a.value) ? !1 : e.groupedOptions ? oe(
78
76
  o,
79
- n
80
- ) : n.value.length > 0 && n.value.length < o.value.length), L = (e) => {
81
- b.value = e;
82
- }, K = c(() => t.groupedOptions ? k(t.options) : t.options), Ne = c(() => {
83
- if (t.groupedOptions && !t.resortGroupedOptions || ge(
84
- K,
85
- y
77
+ a
78
+ ) : a.value.length > 0 && a.value.length < o.value.length), _ = (l) => {
79
+ O.value = l;
80
+ }, P = c(() => e.groupedOptions ? q(e.options) : e.options), Pe = c(() => {
81
+ if (e.groupedOptions && !e.resortGroupedOptions || ce(
82
+ P,
83
+ v
86
84
  ))
87
- return K.value;
88
- const e = {
85
+ return P.value;
86
+ const l = {
89
87
  selected: [],
90
88
  notSelected: []
91
89
  };
92
- T(K).value.forEach((a) => {
93
- const u = (t.comparingKey ? y.value.findIndex(
94
- (w) => w[t.comparingKey] === a[t.comparingKey]
95
- ) > -1 : y.value.includes(a)) ? "selected" : "notSelected";
96
- e[u].push(a);
90
+ w(P).value.forEach((i) => {
91
+ const u = (e.comparingKey ? v.value.findIndex(
92
+ (L) => L[e.comparingKey] === i[e.comparingKey]
93
+ ) > -1 : v.value.includes(i)) ? "selected" : "notSelected";
94
+ l[u].push(i);
97
95
  });
98
- const l = t.groupedOptions ? $(e.notSelected) : e.notSelected;
99
- return [].concat(e.selected, l);
96
+ const t = e.groupedOptions ? H(l.notSelected) : l.notSelected;
97
+ return [].concat(l.selected, t);
100
98
  }), o = c(() => {
101
- const e = Array.isArray(y.value) && t.multi && g.VERSION === 4 && !X ? Ne.value : K.value;
102
- if (t.onSearch) {
103
- const l = e.filter((a) => t.groupedOptions && j(a) ? a : t.onSearch(a, b.value));
104
- return t.groupedOptions ? $(l) : l;
99
+ const l = Array.isArray(v.value) && e.multi && y.VERSION === 4 && !B ? Pe.value : P.value;
100
+ if (e.onSearch) {
101
+ const t = l.filter((i) => e.groupedOptions && X(i) ? i : e.onSearch(i, O.value));
102
+ return e.groupedOptions ? H(t) : t;
105
103
  } else
106
- return e;
107
- }), De = c(() => O.value[0]?.hasSubtitle), ae = c(() => f.mode === N.Multi), ne = c(
108
- () => De.value ? g.MULTILINE_LIST_HEIGHT : g.LIST_HEIGHT
104
+ return l;
105
+ }), Ie = c(() => h.value[0]?.hasSubtitle), ee = c(() => s.mode === x.Multi), le = c(
106
+ () => Ie.value ? y.MULTILINE_LIST_HEIGHT : y.LIST_HEIGHT
109
107
  ), {
110
- list: U,
111
- containerProps: E,
112
- wrapperProps: Ce,
113
- scrollTo: B
114
- } = Ze(o, {
115
- itemHeight: ne.value,
116
- overscan: t.disableVirtualScroll ? 1 / 0 : 2
108
+ list: V,
109
+ containerProps: k,
110
+ wrapperProps: we,
111
+ scrollTo: I
112
+ } = Xe(o, {
113
+ itemHeight: le.value,
114
+ overscan: e.disableVirtualScroll ? 1 / 0 : 2
117
115
  });
118
- A(
119
- () => t.isOpen,
120
- (e) => {
121
- ee(e);
116
+ b(
117
+ () => e.isOpen,
118
+ (l) => {
119
+ F(l);
122
120
  }
123
- ), A([P], async () => {
124
- await R();
125
- });
126
- const M = (e) => {
127
- e == null || e < 0 || E.ref?.value && B(e);
128
- };
129
- A(
130
- [h, d, P],
131
- async ([e, l], [a, i]) => {
132
- h.value && (await R(), P.value !== -1 && e !== a && setTimeout(() => {
133
- if (!(t.multi && g.VERSION === 4))
134
- if (M(P.value), t.groupedOptions) {
135
- const u = K.value.findIndex(
136
- (w) => w === r.value
121
+ ), b([T], async () => {
122
+ await N();
123
+ }), b(
124
+ [S, g, T],
125
+ async ([l], [t]) => {
126
+ S.value && (await N(), T.value !== -1 && l !== t && setTimeout(() => {
127
+ if (!(e.multi && y.VERSION === 4))
128
+ if (I(T.value), e.groupedOptions) {
129
+ const i = P.value.findIndex(
130
+ (f) => f === n.value
137
131
  );
138
- M(u);
132
+ I(i);
139
133
  } else
140
- M(P.value);
141
- }), d.value && (l !== i || e !== a) && setTimeout(() => {
142
- M(d.value);
134
+ I(T.value);
135
+ }), g.value && setTimeout(() => {
136
+ I(g.value);
143
137
  }));
144
138
  }
145
- ), A(b, () => {
146
- v("onsearch", b.value), B(0);
139
+ ), b(O, () => {
140
+ d("onsearch", O.value), I(0);
147
141
  });
148
- const m = (e, l = !1) => {
149
- t.disabled || (ee(e), R(() => {
150
- h.value && v("opened"), h.value || v("closed"), x.value && l && x.value.focus();
142
+ const A = (l, t = !1) => {
143
+ e.disabled || (F(l), N(() => {
144
+ S.value && d("opened"), S.value || d("closed"), D.value && t && D.value.focus();
151
145
  }));
152
146
  };
153
- A(h, (e) => {
154
- if (e) {
155
- b.value = "";
156
- const l = o.value.findIndex(
157
- (a) => W(T(r.value), a)
158
- );
159
- d.value = l > -1 ? l : 0, ae.value && Array.isArray(r.value) && (y.value = T(r.value).slice());
147
+ b(S, (l) => {
148
+ if (l) {
149
+ O.value = "", ee.value && Array.isArray(n.value) && (v.value = w(n.value).slice());
160
150
  return;
161
151
  }
162
- p();
152
+ Z();
163
153
  });
164
- const Ee = () => {
165
- if (G.value) {
166
- n.value = [];
154
+ const xe = () => {
155
+ if (E.value) {
156
+ a.value = [];
167
157
  return;
168
158
  }
169
- if (Array.isArray(n.value)) {
170
- if (t.groupedOptions)
171
- fe(o, n);
159
+ if (Array.isArray(a.value)) {
160
+ if (e.groupedOptions)
161
+ re(o, a);
172
162
  else {
173
- if (n.value.length === o.value.length) {
174
- n.value = [];
163
+ if (a.value.length === o.value.length) {
164
+ a.value = [];
175
165
  return;
176
166
  }
177
- n.value = o.value;
167
+ a.value = o.value;
178
168
  }
179
- v("selectAll");
169
+ d("selectAll");
180
170
  }
181
- }, ie = () => {
182
- Ee(), g.VERSION !== 4 && (r.value = n.value);
183
- }, Me = (e = !0) => {
184
- n.value = [], e ? (r.value = [], y.value = [], v("clear")) : t.dynamicFilterMode || v("clear");
185
- }, H = (e, l) => {
186
- if (e = T(e), g.VERSION === 4 ? e[t.disabledOptionKey] : O.value[l]?.disabled)
171
+ }, De = () => {
172
+ xe(), y.VERSION !== 4 && (n.value = a.value);
173
+ }, Me = (l = !0) => {
174
+ a.value = [], l ? (n.value = [], v.value = [], d("clear")) : e.dynamicFilterMode || d("clear");
175
+ }, G = (l, t) => {
176
+ if (l = w(l), y.VERSION === 4 ? l[e.disabledOptionKey] : h.value[t]?.disabled)
187
177
  return;
188
- if (P.value = l, !t.multi) {
189
- t.keepOpen || m(!1), f.goToOption(
178
+ if (T.value = t, !e.multi) {
179
+ e.keepOpen || A(!1), s.goToOption(
190
180
  0
191
181
  /* None */
192
- ), r.value = e, L(""), p(), f.type === q.Search && S.value && (S.value.value = t.displayValue(e)), re();
182
+ ), n.value = l, _(""), Z(), s.type === U.Search && m.value && (m.value.value = e.displayValue(l)), ae();
193
183
  return;
194
184
  }
195
- if (!Array.isArray(n.value))
185
+ if (!Array.isArray(a.value))
196
186
  return;
197
- S.value?.focus();
198
- const i = T(n.value);
199
- if (se(i, e) || t.comparingKey && i.findIndex(
200
- (u) => u[t.comparingKey] === e[t.comparingKey]
187
+ m.value?.focus();
188
+ const f = w(a.value);
189
+ if (ue(f, l) || e.comparingKey && f.findIndex(
190
+ (u) => u[e.comparingKey] === l[e.comparingKey]
201
191
  ) > -1) {
202
- n.value = i.filter((u) => t.comparingKey ? u[t.comparingKey] !== e[t.comparingKey] : !Qe(u, e));
192
+ a.value = f.filter((u) => e.comparingKey ? u[e.comparingKey] !== l[e.comparingKey] : !He(u, l));
203
193
  return;
204
194
  } else {
205
- n.value = [...i, e];
195
+ a.value = [...f, l];
206
196
  return;
207
197
  }
208
- }, Re = (e) => O.value[e]?.disabled, f = {
209
- activeIndex: d,
210
- options: O,
211
- selectedOption: r,
212
- labelRef: J,
213
- activeOption: V,
214
- listRef: x,
215
- clearable: t.clearable,
216
- type: he.input ? q.Search : q.Dropdown,
217
- mode: t.multi ? N.Multi : N.Single,
218
- query: b,
219
- selectedValue: le,
220
- toggle: m,
221
- disabled: t.disabled,
222
- open: h,
223
- mandatory: t.mandatory,
224
- size: t.size,
225
- placeholder: t.placeholder,
226
- select: H,
198
+ }, Ce = (l) => h.value[l]?.disabled, s = {
199
+ activeIndex: g,
200
+ options: h,
201
+ selectedOption: n,
202
+ labelRef: W,
203
+ activeOption: R,
204
+ listRef: D,
205
+ clearable: e.clearable,
206
+ type: ve.input ? U.Search : U.Dropdown,
207
+ mode: e.multi ? x.Multi : x.Single,
208
+ query: O,
209
+ selectedValue: p,
210
+ toggle: A,
211
+ disabled: e.disabled,
212
+ open: S,
213
+ mandatory: e.mandatory,
214
+ size: e.size,
215
+ placeholder: e.placeholder,
216
+ select: G,
227
217
  clearSelection: () => {
228
- L(""), r.value = f.mode === N.Single ? null : [], y.value = f.mode === N.Single ? null : [], S.value && (S.value.value = "");
218
+ _(""), n.value = s.mode === x.Single ? null : [], v.value = s.mode === x.Single ? null : [], m.value && (m.value.value = "");
229
219
  },
230
- search: L,
231
- goToOption: async (e) => {
232
- if (!h.value)
220
+ search: _,
221
+ goToOption: async (l) => {
222
+ if (!S.value)
233
223
  return;
234
- let l = d.value + e;
235
- const a = O.value.filter(
224
+ let t = g.value + l;
225
+ const i = h.value.filter(
236
226
  (u) => u.disabled
237
- ).length, i = o.value.length - a;
238
- for (l > i && (l = i + 1); ; ) {
239
- if (!O.value[l]?.disabled) {
240
- V.value = o.value[l], d.value = l;
227
+ ).length, f = o.value.length - i;
228
+ for (t > f && (t = f + 1); ; ) {
229
+ if (!h.value[t]?.disabled) {
230
+ R.value = o.value[t], g.value = t;
241
231
  return;
242
232
  }
243
- if ((e === 1 || e === 10) && (l = l + 1), (e === -1 || e === -10) && (l = l + -1), !!Re(d.value)) {
244
- V.value = o.value[l], d.value = l;
233
+ if ((l === 1 || l === 10) && (t = t + 1), (l === -1 || l === -10) && (t = t + -1), !!Ce(g.value)) {
234
+ R.value = o.value[t], g.value = t;
245
235
  return;
246
236
  }
247
237
  }
248
238
  },
249
- registerInput: (e) => {
250
- S.value = e.value;
239
+ registerInput: (l) => {
240
+ m.value = l.value;
251
241
  },
252
- registerOption: (e, l, a) => {
253
- O.value = [...O.value, { id: e, disabled: l, hasSubtitle: a }];
242
+ registerOption: (l, t, i) => {
243
+ h.value = [...h.value, { id: l, disabled: t, hasSubtitle: i }];
254
244
  },
255
- unRegisterOption(e) {
256
- O.value = O.value.filter((l) => l.id !== e);
245
+ unRegisterOption(l) {
246
+ h.value = h.value.filter((t) => t.id !== l);
257
247
  }
258
248
  };
259
- Fe(et, f), de(
260
- x,
249
+ Ue(je, s), ie(
250
+ D,
261
251
  () => {
262
- h.value && ce();
252
+ S.value && ne();
263
253
  },
264
254
  {
265
255
  ignore: [
266
- I,
256
+ M,
257
+ J,
267
258
  Q,
268
259
  Y,
269
- Z,
270
- S,
271
- E.ref
260
+ m,
261
+ k.ref
272
262
  ]
273
263
  }
274
264
  );
275
- const ke = () => {
276
- S.value && (S.value.value = f.query.value = "");
277
- }, ue = () => {
278
- t.multi && !X && (t.groupedOptions ? C.value = z(
265
+ const Ne = () => {
266
+ m.value && (m.value.value = s.query.value = "");
267
+ }, te = () => {
268
+ e.multi && !B && (e.groupedOptions ? C.value = $(
279
269
  o,
280
- n
281
- ) : C.value = t.options.length === t.selected.length);
270
+ a
271
+ ) : C.value = e.options.length === e.selected.length);
282
272
  };
283
- Je(async () => {
284
- t.autoFocus && (await R(), setTimeout(() => {
285
- D.value.focus();
286
- })), f.goToOption(0), ue();
287
- }), A([() => t.options, () => t.selected], () => {
288
- ue();
273
+ Be(async () => {
274
+ e.autoFocus && (await N(), setTimeout(() => {
275
+ z.value.focus();
276
+ })), s.goToOption(0), te();
277
+ }), b([() => e.options, () => e.selected], () => {
278
+ te();
289
279
  });
290
- const re = () => {
291
- t.multi && (r.value = n.value, Array.isArray(r.value) && (y.value = T(r.value).slice(), C.value = t.groupedOptions ? ye(t.options) === r.value.length : t.options.length === r.value.length)), v("apply", r.value), v("allSelectedChanged", G.value), m(!1), ke();
292
- }, ce = () => {
293
- ae.value && Array.isArray(y.value) && (r.value = T(y.value).slice()), b.value = "", m(!1);
294
- }, _e = (e) => {
295
- if (!t.disableKeyboardEvents)
296
- switch (e.key) {
280
+ const ae = () => {
281
+ e.multi && (n.value = a.value, Array.isArray(n.value) && (v.value = w(n.value).slice(), C.value = e.groupedOptions ? se(e.options) === n.value.length : e.options.length === n.value.length)), d("apply", n.value), d("allSelectedChanged", E.value), A(!1), Ne();
282
+ }, ne = () => {
283
+ ee.value && Array.isArray(v.value) && (n.value = w(v.value).slice()), O.value = "", A(!1);
284
+ }, Ke = (l) => {
285
+ if (!e.disableKeyboardEvents)
286
+ switch (l.key) {
297
287
  case "Space":
298
288
  case "Enter":
299
289
  case "ArrowUp":
300
290
  case "ArrowDown":
301
- m(!0), e.preventDefault();
291
+ A(!0), l.preventDefault();
302
292
  }
303
- }, Ve = (e) => {
304
- const l = e.target;
305
- if (!l)
306
- return !1;
307
- const a = l.tagName;
308
- return a === "INPUT" || a === "TEXTAREA" || l.isContentEditable ? !0 : !(!(a === "BUTTON" || a === "A" || l.getAttribute?.("role") === "button") || I.value?.contains?.(l));
309
- }, Ge = (e) => {
310
- const l = e.target;
311
- if (!l)
312
- return !1;
313
- const a = l.tagName;
314
- return !(!(a === "BUTTON" || a === "A" || l.getAttribute?.("role") === "button") || I.value?.contains?.(l));
315
- }, oe = () => {
316
- if (d.value === -1 && te.value) {
317
- ie();
318
- return;
319
- }
320
- const e = o.value[d.value];
321
- e !== void 0 && (Ue(e) || (H(e, d.value), f.mode === N.Single && !t.keepOpen && m(!1)));
322
- }, Le = c(() => {
323
- if (!t.comparingKey || !(t.minSelections || t.maxSelections))
324
- return [];
325
- const e = T(r.value);
326
- if (!Array.isArray(e))
327
- return [];
328
- if (e.length <= t.minSelections)
329
- return e.map((l) => l[t.comparingKey]);
330
- if (t.maxSelections && e.length >= t.maxSelections) {
331
- const l = t.groupedOptions ? k(t.options) : t.options, a = e.map((i) => i[t.comparingKey]);
332
- return l.filter((i) => i && !a.includes(i[t.comparingKey])).map((i) => i[t.comparingKey]);
333
- }
334
- return [];
335
- }), Ue = (e) => e ? e[t.disabledOptionKey] ? !0 : !!t.comparingKey && Le.value.includes(e[t.comparingKey]) : !1, Be = () => {
336
- const e = [];
337
- return D.value && e.push(D.value), x.value && e.push(
338
- ...Array.from(
339
- x.value.querySelectorAll(
340
- 'a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'
341
- )
342
- )
343
- ), e.filter((l) => l === D.value || l.offsetParent !== null);
344
- }, He = (e) => {
345
- if (!t.disableKeyboardEvents)
346
- switch (e.key) {
347
- case "Tab": {
348
- if (!h.value)
349
- break;
350
- const l = Be();
351
- if (l.length <= 1) {
352
- m(!1);
353
- return;
354
- }
355
- e.preventDefault();
356
- const a = document.activeElement, i = l.indexOf(a), u = e.shiftKey ? -1 : 1;
357
- l[((i === -1 ? 0 : i) + u + l.length) % l.length]?.focus();
358
- break;
359
- }
293
+ }, Re = (l) => {
294
+ if (!e.disableKeyboardEvents)
295
+ switch (l.key) {
360
296
  case "ArrowUp": {
361
- f.goToOption(
297
+ s.goToOption(
362
298
  -1
363
299
  /* Previous */
364
- ), e.preventDefault(), e.stopPropagation();
300
+ ), l.preventDefault(), l.stopPropagation();
365
301
  break;
366
302
  }
367
303
  case "ArrowDown": {
368
- f.goToOption(
304
+ s.goToOption(
369
305
  1
370
306
  /* Next */
371
- ), e.preventDefault(), e.stopPropagation();
307
+ ), l.preventDefault(), l.stopPropagation();
372
308
  break;
373
309
  }
374
310
  case "Escape": {
375
- m(!1), e.preventDefault();
311
+ A(!1), l.preventDefault();
376
312
  break;
377
313
  }
378
314
  case "PageUp": {
379
- f.goToOption(
315
+ s.goToOption(
380
316
  10
381
317
  /* NextPage */
382
- ), e.preventDefault();
318
+ ), l.preventDefault();
383
319
  break;
384
320
  }
385
321
  case "PageDown": {
386
- f.goToOption(
322
+ s.goToOption(
387
323
  -10
388
324
  /* PrevPage */
389
- ), e.preventDefault();
390
- break;
391
- }
392
- case " ":
393
- case "Spacebar": {
394
- if (Ve(e) || g.VERSION !== 4)
395
- break;
396
- if (e.preventDefault(), !h.value) {
397
- m(!0);
398
- break;
399
- }
400
- oe();
325
+ ), l.preventDefault();
401
326
  break;
402
327
  }
403
328
  case "Enter": {
404
- if (Ge(e))
405
- break;
406
- if (!h.value) {
407
- m(!0);
329
+ if (!S.value) {
330
+ A(!0);
408
331
  return;
409
332
  }
410
- e.preventDefault(), oe();
333
+ G(o.value[g.value], g.value), s.mode === x.Single && !e.keepOpen && A(!1), l.preventDefault();
411
334
  break;
412
335
  }
413
336
  }
414
- }, qe = c(() => {
415
- if (t.loading)
337
+ }, Ee = c(() => {
338
+ if (e.loading)
416
339
  return 8.5;
417
- const e = t.loadMoreLoading && g.MAX_NUMBER_OF_OPTIONS || t.customNumberOfDisplayedOptions || U.value.reduce((w, Xe) => {
418
- const $e = t.overrideOptionCountCalculation ? t.overrideOptionCountCalculation(Xe.data) : 1;
419
- return w + $e;
420
- }, 0), l = t.multi && t.showSelectAll && !b.value ? 1 : 0, a = e > g.MAX_NUMBER_OF_OPTIONS, i = e + l;
421
- let u = a ? g.MAX_NUMBER_OF_OPTIONS + 0.1 : i;
422
- return t.loadMoreLoading && t.multi && (U.value.length ? u = u + 0.1 : u = u - 0.9), t.noResultsText && u === 0 && (u = u + 1), t.withConditions && b.value && (u = u + 1), tt(
423
- u * ne.value + g.PADDING_PX
340
+ const l = e.loadMoreLoading && y.MAX_NUMBER_OF_OPTIONS || e.customNumberOfDisplayedOptions || V.value.reduce((L, _e) => {
341
+ const Ve = e.overrideOptionCountCalculation ? e.overrideOptionCountCalculation(_e.data) : 1;
342
+ return L + Ve;
343
+ }, 0), t = e.multi && e.showSelectAll && !O.value ? 1 : 0, i = l > y.MAX_NUMBER_OF_OPTIONS, f = l + t;
344
+ let u = i ? y.MAX_NUMBER_OF_OPTIONS + 0.1 : f;
345
+ return e.loadMoreLoading && e.multi && (V.value.length ? u = u + 0.1 : u = u - 0.9), e.noResultsText && u === 0 && (u = u + 1), e.withConditions && O.value && (u = u + 1), ze(
346
+ u * le.value + y.PADDING_PX
424
347
  );
425
348
  });
426
- return pe(
427
- E.ref,
349
+ return $e(
350
+ k.ref,
428
351
  () => {
429
- !t.loadMoreLoading && t.infiniteLoading && v("loadMore");
352
+ !e.loadMoreLoading && e.infiniteLoading && d("loadMore");
430
353
  },
431
- { distance: t.infiniteScrollThreshold }
432
- ), A(n, () => {
433
- v("unsavedSelectionUpdate", n.value);
354
+ { distance: e.infiniteScrollThreshold }
355
+ ), b(a, () => {
356
+ d("unsavedSelectionUpdate", a.value);
434
357
  }), {
435
- onKeydown: He,
436
- location: Oe,
437
- open: h,
438
- toggleMenu: m,
439
- onButtonKeydown: _e,
440
- displayedValue: Ke,
441
- labelRef: J,
442
- query: b,
443
- containerProps: E,
444
- calculateTableHeight: qe,
445
- wrapperProps: Ce,
358
+ onKeydown: Re,
359
+ location: ye,
360
+ open: S,
361
+ toggleMenu: A,
362
+ onButtonKeydown: Ke,
363
+ displayedValue: be,
364
+ labelRef: W,
365
+ query: O,
366
+ containerProps: k,
367
+ calculateTableHeight: Ee,
368
+ wrapperProps: we,
446
369
  filteredOptions: o,
447
- allSelected: G,
370
+ allSelected: E,
448
371
  allSelectedApplied: C,
449
- isIndeterminate: we,
450
- onSelectAll: ie,
451
- virtualOptions: U,
452
- isSelected: W,
453
- selectedOption: r,
454
- selectedOptionPrevious: y,
455
- selectedValue: le,
456
- onSelect: H,
457
- activeIndex: d,
458
- onCancel: ce,
459
- onApply: re,
460
- scrollTo: B,
461
- onClickOutside: de,
462
- listRef: x,
463
- buttonRef: I,
464
- apply: Q,
465
- cancel: Y,
466
- el: D,
467
- triggerRef: be,
468
- clearAll: Z,
372
+ isIndeterminate: Te,
373
+ onSelectAll: De,
374
+ virtualOptions: V,
375
+ isSelected: de,
376
+ selectedOption: n,
377
+ selectedOptionPrevious: v,
378
+ selectedValue: p,
379
+ onSelect: G,
380
+ activeIndex: g,
381
+ onCancel: ne,
382
+ onApply: ae,
383
+ scrollTo: I,
384
+ onClickOutside: ie,
385
+ listRef: D,
386
+ buttonRef: M,
387
+ apply: J,
388
+ cancel: Q,
389
+ el: z,
390
+ triggerRef: fe,
391
+ clearAll: Y,
469
392
  onClearAllSelections: Me,
470
- isGroup: j,
471
- flattenAndMarkGroupOptions: k
393
+ isGroup: X,
394
+ flattenAndMarkGroupOptions: q
472
395
  };
473
396
  };
474
397
  export {
475
- vt as dropdownCommon
398
+ nl as dropdownCommon
476
399
  };