@ironsource/shared-ui 2.1.11-rc.1 → 2.1.11-rc.4

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,5 +1,5 @@
1
1
  import { useToggle as Ve } from "../../../composables/useToggle.js";
2
- import { inject as ke, ref as i, computed as r, watch as A, useSlots as _e, toRaw as P, nextTick as C, provide as Ge, onMounted as He } from "vue";
2
+ import { inject as ke, ref as i, computed as r, watch as A, useSlots as _e, toRaw as P, nextTick as N, provide as Ge, onMounted as He } from "vue";
3
3
  import { isObjectInArray as ee } from "../../../utils/array.js";
4
4
  import { objectsEqual as Be } from "../../../utils/object.js";
5
5
  import { useClamp as Le, useVirtualList as Ue, onClickOutside as le } from "@vueuse/core";
@@ -12,12 +12,12 @@ const ll = (l, b, h) => {
12
12
  sortOutGroups: G,
13
13
  flattenAndMarkGroupOptions: ae,
14
14
  isGroup: H,
15
- selectAllWithGroups: ue,
16
- isIndeterminateGrouped: ne,
15
+ selectAllWithGroups: ne,
16
+ isIndeterminateGrouped: ue,
17
17
  allSelectedGrouped: ie,
18
18
  areAllPreviousSelected: re
19
19
  } = Xe(l), oe = (e, t) => l.multi ? l.comparingKey ? e.findIndex(
20
- (n) => n[l.comparingKey] === t[l.comparingKey]
20
+ (u) => u[l.comparingKey] === t[l.comparingKey]
21
21
  ) > -1 : ee(e, t) : l.comparingKey ? e[l.comparingKey] === t[l.comparingKey] : P(e) === t;
22
22
  let B;
23
23
  ((e) => {
@@ -25,21 +25,21 @@ const ll = (l, b, h) => {
25
25
  })(B || (B = {}));
26
26
  const a = i(
27
27
  l.selected
28
- ), R = je(), u = r({
28
+ ), C = je(), n = r({
29
29
  get() {
30
- return R?.value?.value ?? a.value;
30
+ return C?.value?.value ?? a.value;
31
31
  },
32
32
  set(e) {
33
- R.onChange?.(e), R.onClose?.(), b("update:selected", e);
33
+ C.onChange?.(e), C.onClose?.(), b("update:selected", e);
34
34
  }
35
35
  });
36
36
  A(
37
37
  () => l.selected,
38
38
  () => {
39
- a.value = l.selected, s.value = l.selected;
39
+ a.value = l.selected, d.value = l.selected;
40
40
  }
41
41
  );
42
- const ce = _e(), w = i(null), O = i(null), L = i(null), E = i(null), U = i(null), I = i(null), se = i(), q = i(null), $ = i(null), j = i(null), de = 8, ve = r(() => I.value ? I.value.getBoundingClientRect().height + de + l.distance : 0), X = i(!1), f = i([]), x = i(-1), S = i(""), s = i(l.selected || []), z = () => I.value?.focus(), [g, fe, ge] = Ve({
42
+ const ce = _e(), w = i(null), O = i(null), L = i(null), R = i(null), U = i(null), I = i(null), se = i(), q = i(null), $ = i(null), j = i(null), de = 8, ve = r(() => I.value ? I.value.getBoundingClientRect().height + de + l.distance : 0), X = i(!1), f = i([]), x = i(-1), m = i(""), d = i(l.selected || []), z = () => I.value?.focus(), [g, fe, ge] = Ve({
43
43
  disabled: l.disabled,
44
44
  initialValue: l.defaultOpen
45
45
  });
@@ -58,46 +58,46 @@ const ll = (l, b, h) => {
58
58
  set(e) {
59
59
  b("update:isOpen", e);
60
60
  }
61
- }), he = r(() => o.value.length - 1), v = Le(0, 0, he), J = r(() => u.value ? l.displayValue(u.value) : ""), Oe = (e) => {
61
+ }), he = r(() => o.value.length - 1), v = Le(0, 0, he), J = r(() => n.value ? l.displayValue(n.value) : ""), Oe = (e) => {
62
62
  if (!e.value.length && !l.multiOptionsPlaceholderPrefix && !l.multiOptionsPlaceholderSuffix)
63
63
  return l.placeholder;
64
64
  const t = !l.multiOptionsPlaceholderPrefix && !l.multiOptionsPlaceholderSuffix ? `${e.value.length} selected` : `${l.multiOptionsPlaceholderPrefix ?? ""}${e.value.length ?? "0"}${l.multiOptionsPlaceholderSuffix ?? ""}`;
65
65
  return e.value.length == 1 && l.displayValue ? l.displayValue(e.value[0]) : t;
66
- }, Se = r(() => {
66
+ }, me = r(() => {
67
67
  if (!l.multi)
68
- return u.value ? l.displayValue(u.value) : l.placeholder;
68
+ return n.value ? l.displayValue(n.value) : l.placeholder;
69
69
  if (Array.isArray(a.value))
70
70
  return Oe(a);
71
- }), K = r(() => {
71
+ }), E = r(() => {
72
72
  if (Array.isArray(a.value))
73
73
  return l.groupedOptions ? ie(o, a) : a.value.length === o.value.length;
74
- }), me = r(() => !l.multi || !Array.isArray(a.value) ? !1 : l.groupedOptions ? ne(
74
+ }), Se = r(() => !l.multi || !Array.isArray(a.value) ? !1 : l.groupedOptions ? ue(
75
75
  o,
76
76
  a
77
77
  ) : a.value.length > 0 && a.value.length < o.value.length), M = (e) => {
78
- S.value = e;
78
+ m.value = e;
79
79
  }, D = r(() => l.groupedOptions ? ae(l.options) : l.options), be = r(() => {
80
80
  if (re(
81
81
  D,
82
- s
82
+ d
83
83
  ))
84
84
  return D.value;
85
85
  const e = {
86
86
  selected: [],
87
87
  notSelected: []
88
88
  };
89
- P(D).value.forEach((n) => {
90
- const d = (l.comparingKey ? s.value.findIndex(
91
- (k) => k[l.comparingKey] === n[l.comparingKey]
92
- ) > -1 : s.value.includes(n)) ? "selected" : "notSelected";
93
- e[d].push(n);
89
+ P(D).value.forEach((u) => {
90
+ const s = (l.comparingKey ? d.value.findIndex(
91
+ (k) => k[l.comparingKey] === u[l.comparingKey]
92
+ ) > -1 : d.value.includes(u)) ? "selected" : "notSelected";
93
+ e[s].push(u);
94
94
  });
95
95
  const t = l.groupedOptions ? G(e.notSelected) : e.notSelected;
96
96
  return [].concat(e.selected, t);
97
97
  }), o = r(() => {
98
- const e = Array.isArray(s.value) && l.multi && h.VERSION === 4 && !te ? be.value : D.value;
98
+ const e = Array.isArray(d.value) && l.multi && h.VERSION === 4 && !te ? be.value : D.value;
99
99
  if (l.onSearch) {
100
- const t = e.filter((n) => l.groupedOptions && H(n) ? n : l.onSearch(n, S.value));
100
+ const t = e.filter((u) => l.groupedOptions && H(u) ? u : l.onSearch(u, m.value));
101
101
  return l.groupedOptions ? G(t) : t;
102
102
  } else
103
103
  return e;
@@ -107,7 +107,7 @@ const ll = (l, b, h) => {
107
107
  list: Z,
108
108
  containerProps: F,
109
109
  wrapperProps: Pe,
110
- scrollTo: N
110
+ scrollTo: K
111
111
  } = Ue(o, {
112
112
  itemHeight: Y.value,
113
113
  overscan: l.disableVirtualScroll ? 1 / 0 : 2
@@ -118,39 +118,39 @@ const ll = (l, b, h) => {
118
118
  W(e);
119
119
  }
120
120
  ), A([x], async () => {
121
- await C();
121
+ await N();
122
122
  }), A(
123
123
  [g, v, x],
124
124
  async ([e], [t]) => {
125
- g.value && (await C(), x.value !== -1 && e !== t && setTimeout(() => {
126
- l.multi && h.VERSION === 4 || N(x.value);
125
+ g.value && (await N(), x.value !== -1 && e !== t && setTimeout(() => {
126
+ l.multi && h.VERSION === 4 || K(x.value);
127
127
  }), v.value && setTimeout(() => {
128
- N(v.value);
128
+ K(v.value);
129
129
  }));
130
130
  }
131
- ), A(S, () => {
132
- b("onsearch", S.value), N(0);
131
+ ), A(m, () => {
132
+ b("onsearch", m.value), K(0);
133
133
  });
134
- const m = (e, t = !1) => {
135
- l.disabled || (W(e), C(() => {
134
+ const S = (e, t = !1) => {
135
+ l.disabled || (W(e), N(() => {
136
136
  g.value && b("opened"), g.value || b("closed"), w.value && t && w.value.focus();
137
137
  }));
138
138
  };
139
139
  A(g, (e) => {
140
140
  if (e) {
141
- S.value = "", Q.value && Array.isArray(u.value) && (s.value = P(u.value).slice());
141
+ m.value = "", Q.value && Array.isArray(n.value) && (d.value = P(n.value).slice());
142
142
  return;
143
143
  }
144
144
  z();
145
145
  });
146
146
  const Te = () => {
147
- if (K.value) {
147
+ if (E.value) {
148
148
  a.value = [];
149
149
  return;
150
150
  }
151
151
  if (Array.isArray(a.value)) {
152
152
  if (l.groupedOptions)
153
- ue(o, a);
153
+ ne(o, a);
154
154
  else {
155
155
  if (a.value.length === o.value.length) {
156
156
  a.value = [];
@@ -161,17 +161,17 @@ const ll = (l, b, h) => {
161
161
  b("selectAll");
162
162
  }
163
163
  }, we = () => {
164
- Te(), h.VERSION !== 4 && (u.value = a.value);
164
+ Te(), h.VERSION !== 4 && (n.value = a.value);
165
165
  }, Ie = (e = !0) => {
166
- a.value = [], e && (u.value = [], s.value = []), b("clear");
166
+ a.value = [], e && (n.value = [], d.value = []), b("clear");
167
167
  }, V = (e, t) => {
168
168
  if (e = P(e), h.VERSION === 4 ? e[l.disabledOptionKey] : f.value[t]?.disabled)
169
169
  return;
170
170
  if (x.value = t, c.mode !== T.Multi) {
171
- l.keepOpen || m(!1), c.goToOption(
171
+ l.keepOpen || S(!1), c.goToOption(
172
172
  0
173
173
  /* None */
174
- ), u.value = e, M(""), z(), c.type === _.Search && O.value && (O.value.value = l.displayValue(e));
174
+ ), n.value = e, M(""), z(), c.type === _.Search && O.value && (O.value.value = l.displayValue(e));
175
175
  return;
176
176
  }
177
177
  if (!Array.isArray(a.value))
@@ -179,11 +179,9 @@ const ll = (l, b, h) => {
179
179
  O.value?.focus();
180
180
  const y = P(a.value);
181
181
  if (ee(y, e) || l.comparingKey && y.findIndex(
182
- (d) => d[l.comparingKey] === e[l.comparingKey]
182
+ (s) => s[l.comparingKey] === e[l.comparingKey]
183
183
  ) > -1) {
184
- a.value = y.filter(
185
- (d) => !Be(d, e)
186
- );
184
+ a.value = y.filter((s) => l.comparingKey ? s[l.comparingKey] !== e[l.comparingKey] : !Be(s, e));
187
185
  return;
188
186
  } else {
189
187
  a.value = [...y, e];
@@ -192,16 +190,16 @@ const ll = (l, b, h) => {
192
190
  }, xe = (e) => f.value[e]?.disabled, c = {
193
191
  activeIndex: v,
194
192
  options: f,
195
- selectedOption: u,
193
+ selectedOption: n,
196
194
  labelRef: U,
197
- activeOption: E,
195
+ activeOption: R,
198
196
  listRef: w,
199
197
  clearable: l.clearable,
200
198
  type: ce.input ? _.Search : _.Dropdown,
201
199
  mode: l.multi ? T.Multi : T.Single,
202
- query: S,
200
+ query: m,
203
201
  selectedValue: J,
204
- toggle: m,
202
+ toggle: S,
205
203
  disabled: l.disabled,
206
204
  open: g,
207
205
  mandatory: l.mandatory,
@@ -209,23 +207,23 @@ const ll = (l, b, h) => {
209
207
  placeholder: l.placeholder,
210
208
  select: V,
211
209
  clearSelection: () => {
212
- M(""), u.value = c.mode === T.Single ? null : [], s.value = c.mode === T.Single ? null : [], O.value && (O.value.value = "");
210
+ M(""), n.value = c.mode === T.Single ? null : [], d.value = c.mode === T.Single ? null : [], O.value && (O.value.value = "");
213
211
  },
214
212
  search: M,
215
213
  goToOption: async (e) => {
216
214
  if (!g.value)
217
215
  return;
218
216
  let t = v.value + e;
219
- const n = f.value.filter(
220
- (d) => d.disabled
221
- ).length, y = o.value.length - n;
217
+ const u = f.value.filter(
218
+ (s) => s.disabled
219
+ ).length, y = o.value.length - u;
222
220
  for (t > y && (t = y + 1); ; ) {
223
221
  if (!f.value[t]?.disabled) {
224
- E.value = o.value[t], v.value = t;
222
+ R.value = o.value[t], v.value = t;
225
223
  return;
226
224
  }
227
225
  if ((e === 1 || e === 10) && (t = t + 1), (e === -1 || e === -10) && (t = t + -1), !!xe(v.value)) {
228
- E.value = o.value[t], v.value = t;
226
+ R.value = o.value[t], v.value = t;
229
227
  return;
230
228
  }
231
229
  }
@@ -233,8 +231,8 @@ const ll = (l, b, h) => {
233
231
  registerInput: (e) => {
234
232
  O.value = e.value;
235
233
  },
236
- registerOption: (e, t, n) => {
237
- f.value = [...f.value, { id: e, disabled: t, hasSubtitle: n }];
234
+ registerOption: (e, t, u) => {
235
+ f.value = [...f.value, { id: e, disabled: t, hasSubtitle: u }];
238
236
  },
239
237
  unRegisterOption(e) {
240
238
  f.value = f.value.filter((t) => t.id !== e);
@@ -260,24 +258,24 @@ const ll = (l, b, h) => {
260
258
  O.value && (O.value.value = c.query.value = "");
261
259
  };
262
260
  He(async () => {
263
- l.autoFocus && (await C(), setTimeout(() => {
261
+ l.autoFocus && (await N(), setTimeout(() => {
264
262
  L.value.focus();
265
263
  })), c.goToOption(0);
266
264
  });
267
- const Ne = () => {
268
- X.value = K.value, u.value = a.value, Array.isArray(u.value) && (s.value = P(u.value).slice()), b("apply", u.value), m(!1), De();
265
+ const Ke = () => {
266
+ X.value = E.value, n.value = a.value, Array.isArray(n.value) && (d.value = P(n.value).slice()), b("apply", n.value), S(!1), De();
269
267
  }, p = () => {
270
- Q.value && Array.isArray(s.value) && (u.value = P(s.value).slice()), S.value = "", m(!1);
271
- }, Ce = (e) => {
268
+ Q.value && Array.isArray(d.value) && (n.value = P(d.value).slice()), m.value = "", S(!1);
269
+ }, Ne = (e) => {
272
270
  if (!l.disableKeyboardEvents)
273
271
  switch (e.key) {
274
272
  case "Space":
275
273
  case "Enter":
276
274
  case "ArrowUp":
277
275
  case "ArrowDown":
278
- m(!0), e.preventDefault();
276
+ S(!0), e.preventDefault();
279
277
  }
280
- }, Re = (e) => {
278
+ }, Ce = (e) => {
281
279
  if (!l.disableKeyboardEvents)
282
280
  switch (e.key) {
283
281
  case "ArrowUp": {
@@ -295,7 +293,7 @@ const ll = (l, b, h) => {
295
293
  break;
296
294
  }
297
295
  case "Escape": {
298
- m(!1), e.preventDefault();
296
+ S(!1), e.preventDefault();
299
297
  break;
300
298
  }
301
299
  case "PageUp": {
@@ -314,52 +312,52 @@ const ll = (l, b, h) => {
314
312
  }
315
313
  case "Enter": {
316
314
  if (!g.value) {
317
- m(!0);
315
+ S(!0);
318
316
  return;
319
317
  }
320
- V(o.value[v.value], v.value), c.mode === T.Single && !l.keepOpen && m(!1), e.preventDefault();
318
+ V(o.value[v.value], v.value), c.mode === T.Single && !l.keepOpen && S(!1), e.preventDefault();
321
319
  break;
322
320
  }
323
321
  }
324
- }, Ee = r(() => {
322
+ }, Re = r(() => {
325
323
  if (l.loading)
326
324
  return 8.5;
327
- const e = l.customNumberOfDisplayedOptions || Z.value.reduce((k, Ke) => {
328
- const Me = l.overrideOptionCountCalculation ? l.overrideOptionCountCalculation(Ke.data) : 1;
325
+ const e = l.customNumberOfDisplayedOptions || Z.value.reduce((k, Ee) => {
326
+ const Me = l.overrideOptionCountCalculation ? l.overrideOptionCountCalculation(Ee.data) : 1;
329
327
  return k + Me;
330
- }, 0), t = l.multi && l.showSelectAll && !S.value ? 1 : 0, n = e > h.MAX_NUMBER_OF_OPTIONS, y = e + t;
331
- let d = n ? h.MAX_NUMBER_OF_OPTIONS + 0.1 : y;
332
- return l.noResultsText && d === 0 && (d = d + 1), $e(
333
- d * Y.value + h.PADDING_PX
328
+ }, 0), t = l.multi && l.showSelectAll && !m.value ? 1 : 0, u = e > h.MAX_NUMBER_OF_OPTIONS, y = e + t;
329
+ let s = u ? h.MAX_NUMBER_OF_OPTIONS + 0.1 : y;
330
+ return l.noResultsText && s === 0 && (s = s + 1), $e(
331
+ s * Y.value + h.PADDING_PX
334
332
  );
335
333
  });
336
334
  return {
337
- onKeydown: Re,
335
+ onKeydown: Ce,
338
336
  location: ve,
339
337
  open: g,
340
- toggleMenu: m,
341
- onButtonKeydown: Ce,
342
- displayedValue: Se,
338
+ toggleMenu: S,
339
+ onButtonKeydown: Ne,
340
+ displayedValue: me,
343
341
  labelRef: U,
344
- query: S,
342
+ query: m,
345
343
  containerProps: F,
346
- calculateTableHeight: Ee,
344
+ calculateTableHeight: Re,
347
345
  wrapperProps: Pe,
348
346
  filteredOptions: o,
349
- allSelected: K,
347
+ allSelected: E,
350
348
  allSelectedApplied: X,
351
- isIndeterminate: me,
349
+ isIndeterminate: Se,
352
350
  onSelectAll: we,
353
351
  virtualOptions: Z,
354
352
  isSelected: oe,
355
- selectedOption: u,
356
- selectedOptionPrevious: s,
353
+ selectedOption: n,
354
+ selectedOptionPrevious: d,
357
355
  selectedValue: J,
358
356
  onSelect: V,
359
357
  activeIndex: v,
360
358
  onCancel: p,
361
- onApply: Ne,
362
- scrollTo: N,
359
+ onApply: Ke,
360
+ scrollTo: K,
363
361
  onClickOutside: le,
364
362
  listRef: w,
365
363
  buttonRef: I,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironsource/shared-ui",
3
- "version": "2.1.11-rc.1",
3
+ "version": "2.1.11-rc.4",
4
4
  "engines": {
5
5
  "npm": ">=7.0.0",
6
6
  "node": ">=16.0.0"
@@ -209,7 +209,7 @@
209
209
  "./text": "./components/typography/Text.vue.js",
210
210
  "./heading": "./components/typography/Heading.vue.js",
211
211
  "./popover": "./components/popover/v3/Popover.vue.js",
212
- "./popove/v4": "./components/popover/v4/index.js",
212
+ "./popover/v4": "./components/popover/v4/index.js",
213
213
  "./input": "./components/input/v3/Input.vue.js",
214
214
  "./input/v4": "./components/input/v4/index.js",
215
215
  "./dollarInput": "./components/input/v3/DollarInput.vue.js",