@ironsource/shared-ui 2.1.5-rc.1 → 2.1.5-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ export declare const dropdownCommon: (props: any, emit: any, commonOptions: any)
28
28
  virtualOptions: Ref<UseVirtualListItem<unknown>[]>;
29
29
  isSelected: (arr: any, element: any) => boolean;
30
30
  selectedOption: import("vue").WritableComputedRef<unknown>;
31
- selectedOptionPrevious: Ref<any[]>;
31
+ selectedOptionPrevious: Ref<unknown>;
32
32
  selectedValue: import("vue").ComputedRef<any>;
33
33
  onSelect: (option: any, index?: number) => void;
34
34
  activeIndex: Ref<number>;
@@ -1,13 +1,13 @@
1
- import { useToggle as Oe } from "../../../composables/useToggle.js";
2
- import { ref as n, computed as r, watch as O, useSlots as Pe, toRaw as b, nextTick as D, provide as Te, onMounted as we } from "vue";
1
+ import { useToggle as me } from "../../../composables/useToggle.js";
2
+ import { ref as n, computed as r, watch as m, useSlots as Pe, toRaw as A, nextTick as D, provide as Te, onMounted as we } from "vue";
3
3
  import { isObjectInArray as Q } from "../../../utils/array.js";
4
4
  import { objectsEqual as xe } from "../../../utils/object.js";
5
5
  import { useClamp as Ie, useVirtualList as De, onClickOutside as W } from "@vueuse/core";
6
- import { Mode as A, Type as _, DropdownContext as Ne } from "./DropdownContext.js";
6
+ import { Mode as O, Type as _, DropdownContext as Ne } from "./DropdownContext.js";
7
7
  import { pxToRem as Re } from "../../../utils/style.js";
8
8
  import { useEditableContext as Ee } from "../../table-cells/common/EditableContext.js";
9
- const Ue = (l, P, m) => {
10
- const Y = (e, t) => l.multi ? Q(e, t) : b(e) === t;
9
+ const Ue = (l, P, b) => {
10
+ const Y = (e, t) => l.multi ? Q(e, t) : A(e) === t;
11
11
  let k;
12
12
  ((e) => {
13
13
  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";
@@ -22,17 +22,17 @@ const Ue = (l, P, m) => {
22
22
  N.onChange?.(e), N.onClose?.(), P("update:selected", e);
23
23
  }
24
24
  });
25
- O(
25
+ m(
26
26
  () => l.selected,
27
27
  () => {
28
28
  a.value = l.selected;
29
29
  }
30
30
  );
31
- const Z = Pe(), T = n(null), f = n(null), V = n(null), R = n(null), H = n(null), w = n(null), F = n(), B = n(null), L = n(null), U = n(null), ee = 8, le = r(() => w.value ? w.value.getBoundingClientRect().height + ee + l.distance : 0), c = n([]), x = n(-1), I = n(""), g = n([]), q = () => w.value?.focus(), [v, te, ae] = Oe({
31
+ const Z = Pe(), T = n(null), f = n(null), V = n(null), R = n(null), H = n(null), w = n(null), F = n(), B = n(null), L = n(null), U = n(null), ee = 8, le = r(() => w.value ? w.value.getBoundingClientRect().height + ee + l.distance : 0), c = n([]), x = n(-1), I = n(""), g = n([]), q = () => w.value?.focus(), [v, te, ae] = me({
32
32
  disabled: l.disabled,
33
33
  initialValue: l.defaultOpen
34
34
  });
35
- O(
35
+ m(
36
36
  () => l.disabled,
37
37
  (e) => {
38
38
  e !== void 0 && ae(e);
@@ -63,19 +63,19 @@ const Ue = (l, P, m) => {
63
63
  }), oe = r(() => !l.multi || !Array.isArray(a.value) ? !1 : a.value.length > 0 && a.value.length < s.value.length), E = (e) => {
64
64
  I.value = e;
65
65
  }, se = r(() => {
66
- const e = b(g.value), t = {
66
+ const e = A(g.value), t = {
67
67
  selected: [],
68
68
  notSelected: []
69
69
  };
70
- return b(l.options).forEach((y) => {
70
+ return A(l.options).forEach((y) => {
71
71
  const d = e.includes(y) ? "selected" : "notSelected";
72
72
  t[d].push(y);
73
73
  }), [].concat(t.selected, t.notSelected);
74
74
  }), s = r(() => {
75
- const e = Array.isArray(g.value) && l.multi && m.VERSION === 4 ? se.value : l.options;
75
+ const e = Array.isArray(g.value) && l.multi && b.VERSION === 4 ? se.value : l.options;
76
76
  return l.onSearch ? e.filter((t) => l.onSearch(t, I.value)) : e;
77
- }), ce = r(() => c.value[0]?.hasSubtitle), X = r(() => i.mode === A.Multi), j = r(
78
- () => ce.value ? m.MULTILINE_LIST_HEIGHT : m.LIST_HEIGHT
77
+ }), ce = r(() => c.value[0]?.hasSubtitle), X = r(() => i.mode === O.Multi), j = r(
78
+ () => ce.value ? b.MULTILINE_LIST_HEIGHT : b.LIST_HEIGHT
79
79
  ), {
80
80
  list: z,
81
81
  containerProps: p,
@@ -85,18 +85,18 @@ const Ue = (l, P, m) => {
85
85
  itemHeight: j.value,
86
86
  overscan: 2
87
87
  });
88
- O(
88
+ m(
89
89
  () => l.isOpen,
90
90
  (e) => {
91
91
  G(e);
92
92
  }
93
- ), O([x], async () => {
93
+ ), m([x], async () => {
94
94
  await D();
95
- }), O(
95
+ }), m(
96
96
  [v, o, x],
97
97
  async ([e], [t]) => {
98
98
  v.value && (await D(), x.value !== -1 && e !== t && setTimeout(() => {
99
- l.multi && m.VERSION === 4 || M(x.value);
99
+ l.multi && b.VERSION === 4 || M(x.value);
100
100
  }), o.value && setTimeout(() => {
101
101
  M(o.value);
102
102
  }));
@@ -107,16 +107,14 @@ const Ue = (l, P, m) => {
107
107
  v.value && P("opened"), v.value || P("closed"), T.value && t && T.value.focus();
108
108
  }));
109
109
  };
110
- O(v, (e) => {
110
+ m(v, (e) => {
111
111
  if (e) {
112
- X.value && Array.isArray(u.value) && (g.value = b(u.value).slice());
112
+ X.value && Array.isArray(u.value) && (g.value = A(u.value).slice());
113
113
  return;
114
114
  }
115
115
  q();
116
116
  });
117
117
  const de = () => {
118
- fe(), u.value = a.value;
119
- }, fe = () => {
120
118
  if ($.value) {
121
119
  a.value = [];
122
120
  return;
@@ -128,12 +126,14 @@ const Ue = (l, P, m) => {
128
126
  }
129
127
  a.value = s.value;
130
128
  }
129
+ }, fe = () => {
130
+ de(), b.VERSION !== 4 && (u.value = a.value);
131
131
  }, ge = (e = !0) => {
132
132
  a.value = [], e && (u.value = [], g.value = []);
133
133
  }, C = (e, t) => {
134
- if (e = b(e), c.value[t]?.disabled)
134
+ if (e = A(e), c.value[t]?.disabled)
135
135
  return;
136
- if (x.value = t, i.mode !== A.Multi) {
136
+ if (x.value = t, i.mode !== O.Multi) {
137
137
  l.keepOpen || h(!1), i.goToOption(
138
138
  0
139
139
  /* None */
@@ -143,7 +143,7 @@ const Ue = (l, P, m) => {
143
143
  if (!Array.isArray(a.value))
144
144
  return;
145
145
  f.value?.focus();
146
- const S = b(a.value);
146
+ const S = A(a.value);
147
147
  if (Q(S, e)) {
148
148
  a.value = S.filter(
149
149
  (d) => !xe(d, e)
@@ -162,7 +162,7 @@ const Ue = (l, P, m) => {
162
162
  listRef: T,
163
163
  clearable: l.clearable,
164
164
  type: Z.input ? _.Search : _.Dropdown,
165
- mode: l.multi ? A.Multi : A.Single,
165
+ mode: l.multi ? O.Multi : O.Single,
166
166
  query: I,
167
167
  selectedValue: K,
168
168
  toggle: h,
@@ -173,7 +173,7 @@ const Ue = (l, P, m) => {
173
173
  placeholder: l.placeholder,
174
174
  select: C,
175
175
  clearSelection: () => {
176
- E(""), u.value = i.mode === A.Single ? null : [], g.value = i.mode === A.Single ? null : [], f.value && (f.value.value = "");
176
+ E(""), u.value = i.mode === O.Single ? null : [], g.value = i.mode === O.Single ? null : [], f.value && (f.value.value = "");
177
177
  },
178
178
  search: E,
179
179
  goToOption: async (e) => {
@@ -229,9 +229,9 @@ const Ue = (l, P, m) => {
229
229
  })), i.goToOption(0);
230
230
  });
231
231
  const Se = () => {
232
- u.value = a.value, Array.isArray(u.value) && (g.value = b(u.value).slice()), P("apply", u.value), h(!1), ye();
232
+ u.value = a.value, Array.isArray(u.value) && (g.value = A(u.value).slice()), P("apply", u.value), h(!1), ye();
233
233
  }, J = () => {
234
- X.value && Array.isArray(g.value) && (u.value = b(g.value).slice()), I.value = "", h(!1);
234
+ X.value && Array.isArray(g.value) && (u.value = A(g.value).slice()), I.value = "", h(!1);
235
235
  }, be = (e) => {
236
236
  if (!l.disableKeyboardEvents)
237
237
  switch (e.key) {
@@ -241,7 +241,7 @@ const Ue = (l, P, m) => {
241
241
  case "ArrowDown":
242
242
  h(!0), e.preventDefault();
243
243
  }
244
- }, me = (e) => {
244
+ }, Ae = (e) => {
245
245
  if (!l.disableKeyboardEvents)
246
246
  switch (e.key) {
247
247
  case "ArrowUp": {
@@ -281,19 +281,19 @@ const Ue = (l, P, m) => {
281
281
  h(!0);
282
282
  return;
283
283
  }
284
- C(s.value[o.value], o.value), i.mode === A.Single && !l.keepOpen && h(!1), e.preventDefault();
284
+ C(s.value[o.value], o.value), i.mode === O.Single && !l.keepOpen && h(!1), e.preventDefault();
285
285
  break;
286
286
  }
287
287
  }
288
- }, Ae = r(() => {
289
- const e = z.value.length, t = l.multi && l.showSelectAll ? 1 : 0, y = e > m.MAX_NUMBER_OF_OPTIONS, S = e + t;
290
- let d = y ? m.MAX_NUMBER_OF_OPTIONS + 0.1 : S;
288
+ }, Oe = r(() => {
289
+ const e = z.value.length, t = l.multi && l.showSelectAll ? 1 : 0, y = e > b.MAX_NUMBER_OF_OPTIONS, S = e + t;
290
+ let d = y ? b.MAX_NUMBER_OF_OPTIONS + 0.1 : S;
291
291
  return l.noResultsText && d === 0 && (d = d + 1), Re(
292
- d * j.value + m.PADDING_PX
292
+ d * j.value + b.PADDING_PX
293
293
  );
294
294
  });
295
295
  return {
296
- onKeydown: me,
296
+ onKeydown: Ae,
297
297
  location: le,
298
298
  open: v,
299
299
  toggleMenu: h,
@@ -302,12 +302,12 @@ const Ue = (l, P, m) => {
302
302
  labelRef: H,
303
303
  query: I,
304
304
  containerProps: p,
305
- calculateTableHeight: Ae,
305
+ calculateTableHeight: Oe,
306
306
  wrapperProps: ve,
307
307
  filteredOptions: s,
308
308
  allSelected: $,
309
309
  isIndeterminate: oe,
310
- onSelectAll: de,
310
+ onSelectAll: fe,
311
311
  virtualOptions: z,
312
312
  isSelected: Y,
313
313
  selectedOption: u,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironsource/shared-ui",
3
- "version": "2.1.5-rc.1",
3
+ "version": "2.1.5-rc.2",
4
4
  "engines": {
5
5
  "npm": ">=7.0.0",
6
6
  "node": ">=16.0.0"