@ironsource/shared-ui 2.2.0-rc.23 → 2.2.0-rc.25

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 (26) hide show
  1. package/TagsFieldChip.vue_vue_type_style_index_0_scoped_d186b7ef_lang.css +1 -0
  2. package/components/dropdown/v3/SearchInput.vue2.js +82 -1
  3. package/components/dropdown/v4/AppDropdownTrigger.vue2.js +185 -1
  4. package/components/dropdown/v4/ButtonDropdownTrigger.vue2.js +70 -1
  5. package/components/dropdown/v4/ButtonFilterDropdownTrigger.vue2.js +54 -1
  6. package/components/dropdown/v4/ChipDropdownTrigger.vue2.js +126 -1
  7. package/components/dropdown/v4/ConditionalDropdown.vue2.js +275 -1
  8. package/components/dropdown/v4/DefaultDropdownTrigger.vue2.js +156 -1
  9. package/components/dropdown/v4/DropdownV4.vue2.js +583 -1
  10. package/components/dropdown/v4/GroupOption.vue2.js +29 -1
  11. package/components/dropdown/v4/IconButtonDropdownTrigger.vue2.js +23 -1
  12. package/components/dropdown/v4/OptionV4.vue2.js +300 -1
  13. package/components/dropdown/v4/TreeDropdown.vue2.js +272 -1
  14. package/components/emptyState/v3/EmptyState.vue2.js +91 -1
  15. package/components/emptyState/v4/EmptyStateV4.vue2.js +86 -1
  16. package/components/table-cells/v3/Editable.vue.js +7 -0
  17. package/components/table-cells/v3/Editable.vue2.js +1 -10
  18. package/components/tag/Tag.vue.d.ts +100 -0
  19. package/components/tag/index.d.ts +141 -0
  20. package/components/tagsField/TagsFieldChip.vue.d.ts +0 -43
  21. package/components/tagsField/TagsFieldChip.vue.js +5 -5
  22. package/components/tagsField/TagsFieldChip.vue2.js +55 -101
  23. package/components/tagsField/index.d.ts +0 -74
  24. package/index.js +1 -1
  25. package/package.json +1 -1
  26. package/TagsFieldChip.vue_vue_type_style_index_0_scoped_cbb21c6a_lang.css +0 -1
@@ -1 +1,275 @@
1
- import "../../../ConditionalDropdown.vue_vue_type_style_index_0_scoped_8cc86a27_lang.css";
1
+ import "../../../ConditionalDropdown.vue_vue_type_style_index_0_scoped_8cc86a27_lang.css"; import { defineComponent as H, computed as b, ref as r, watch as g, onMounted as J, resolveComponent as X, openBlock as B, createBlock as Y, unref as p, createSlots as Z, withCtx as f, createVNode as y, mergeProps as _, createElementVNode as ee, isRef as te, normalizeProps as F, guardReactiveProps as I, createElementBlock as le, createTextVNode as oe, toDisplayString as ne, createCommentVNode as ae, renderSlot as ie } from "vue";
2
+ import U from "./DropdownV4.vue.js";
3
+ import "./DefaultDropdownTrigger.vue.js";
4
+ import "./IconButtonDropdownTrigger.vue.js";
5
+ import ue from "./ChipDropdownTrigger.vue.js";
6
+ import "./AppDropdownTrigger.vue.js";
7
+ import "./ButtonDropdownTrigger.vue.js";
8
+ import se from "./ButtonFilterDropdownTrigger.vue.js";
9
+ import "./TreeDropdown.vue.js";
10
+ import "./OptionV4.vue.js";
11
+ import "./ConditionalDropdown.vue.js";
12
+ import re from "../../search/v4/SearchV4.vue.js";
13
+ import de from "../../typography/v4/Typography.vue.js";
14
+ import { useDebounceFn as ce } from "@vueuse/core";
15
+ const pe = { class: "conditional-container" }, ve = {
16
+ key: 0,
17
+ class: "custom-list-area"
18
+ }, Ne = /* @__PURE__ */ H({
19
+ __name: "ConditionalDropdown",
20
+ props: {
21
+ selectedCondition: null,
22
+ appliedSelections: null,
23
+ conditionalOptions: null,
24
+ label: { default: "" },
25
+ testId: { default: "" },
26
+ comparingKey: { default: "id" },
27
+ fetchFnCallback: null,
28
+ optionNameKey: { default: "name" },
29
+ minCharsToStart: { default: 3 },
30
+ isOpen: { type: Boolean, default: !1 },
31
+ searchQuery: { default: "" },
32
+ loadMoreFn: { type: Function, default: null },
33
+ infiniteLoading: { type: Boolean, default: !1 },
34
+ fetchDataDebounceTime: { default: 400 },
35
+ autoFocusSearch: { type: Boolean, default: !0 },
36
+ groupedOptions: { type: Boolean, default: !1 },
37
+ optionFlagKey: { default: "" },
38
+ optionIconKey: { default: "" },
39
+ optionImageKey: { default: "" },
40
+ optionIconType: { default: null },
41
+ loadingOverride: { type: Boolean, default: !1 },
42
+ triggerShownValuesCount: { default: 1 }
43
+ },
44
+ emits: ["update:selectedCondition", "update:appliedSelections", "clear", "closed"],
45
+ setup(a, { emit: h }) {
46
+ const e = a, S = b({
47
+ get: () => e.appliedSelections,
48
+ set: (t) => {
49
+ h("update:appliedSelections", t);
50
+ }
51
+ }), T = r(
52
+ e.selectedCondition || e.conditionalOptions[0]
53
+ ), i = b({
54
+ get: () => T.value || e.conditionalOptions[0],
55
+ set: (t) => {
56
+ T.value = t;
57
+ }
58
+ });
59
+ g(
60
+ () => e.selectedCondition,
61
+ (t) => {
62
+ t && t.value !== i.value?.value && (i.value = t, k());
63
+ }
64
+ );
65
+ const A = () => {
66
+ const { appliedSelections: t } = e;
67
+ return t ? Array.isArray(t) ? t : [t] : [];
68
+ }, D = r(null), v = r(!0), o = r([]), u = r(A()), N = r(!0), c = r(!1), w = r(!1), s = r(e.searchQuery), M = r(""), C = r(e.label), K = r([]), E = b(() => (!s.value || s.value?.length < e.minCharsToStart) && !o.value.length ? `Enter at least ${e.minCharsToStart} characters to begin` : "No results found"), Q = b(() => {
69
+ const t = v.value ? 4 : 4.5, l = o.value.length > 4 ? o.value.length : t;
70
+ if (e.groupedOptions) {
71
+ let d = 0;
72
+ return o.value.forEach((n) => {
73
+ n.options && (d = d + n.options.length);
74
+ }), d > 4 ? d : t;
75
+ }
76
+ return l > t ? l : t;
77
+ }), V = (t, l) => {
78
+ if (e.infiniteLoading && i.value.multi && Array.isArray(u.value) && u.value.length && t && l.length) {
79
+ const d = [], n = u.value.filter(
80
+ (m) => m[e.optionNameKey].includes(t)
81
+ );
82
+ return l.forEach((m) => {
83
+ n.find(
84
+ (G) => G[e.comparingKey] === m[e.comparingKey]
85
+ ) && d.push(m[e.comparingKey]);
86
+ }), n.filter(
87
+ (m) => !d.includes(m[e.comparingKey])
88
+ );
89
+ }
90
+ return [];
91
+ }, L = async (t) => {
92
+ try {
93
+ c.value = !0;
94
+ const l = await e.fetchFnCallback(t), d = V(
95
+ t,
96
+ l
97
+ );
98
+ o.value = [...d, ...l], c.value = !1;
99
+ } catch (l) {
100
+ c.value = !1, console.error("Error fetching data:", l);
101
+ }
102
+ }, $ = async () => {
103
+ if (e.infiniteLoading)
104
+ try {
105
+ w.value = !0;
106
+ const t = await e.loadMoreFn();
107
+ w.value = !1, Array.isArray(t) && (o.value = [...o.value, ...t]);
108
+ } catch (t) {
109
+ w.value = !1, console.error("Error fetching data:", t);
110
+ }
111
+ }, x = ce(
112
+ L,
113
+ e.fetchDataDebounceTime
114
+ ), O = (t) => {
115
+ t.length >= e.minCharsToStart ? (x(t), D.value?.scrollTo(0)) : e.infiniteLoading && i.value.multi ? o.value = K.value || [] : o.value = [];
116
+ }, R = () => {
117
+ s.value && o.value.length && !c.value && !i.value.multi ? o.value[0].conditionalOptions ? o.value[0] = {
118
+ [e.optionNameKey]: s.value,
119
+ conditionalOptions: !0,
120
+ conditionalName: i.value.label,
121
+ [e.comparingKey]: s.value
122
+ } : o.value = [
123
+ {
124
+ [e.optionNameKey]: s.value,
125
+ conditionalOptions: !0,
126
+ conditionalName: i.value.label,
127
+ [e.comparingKey]: s.value
128
+ },
129
+ ...o.value
130
+ ] : o.value.length && o.value[0].conditionalOptions && o.value.shift();
131
+ }, k = () => {
132
+ v.value && u.value.length === 0 ? C.value = e.label : C.value = `${e.label} ${i.value.label.toLowerCase()}`;
133
+ };
134
+ g(s, () => {
135
+ O(s.value);
136
+ }), g([i, o], () => {
137
+ R();
138
+ }), g(
139
+ () => e.loadingOverride,
140
+ (t, l) => {
141
+ !t && l && !e.infiniteLoading && L(e.searchQuery);
142
+ }
143
+ );
144
+ const z = () => {
145
+ v.value && u.value.length === 0 ? (S.value = [], i.value = null) : (M.value = s.value, S.value = v.value ? [...u.value] : { ...u.value }, N.value = v.value), h("update:selectedCondition", i.value), k();
146
+ };
147
+ g(i, (t, l) => {
148
+ i.value.multi ? (c.value = !0, !l.multi && t.multi && (Array.isArray(e.appliedSelections) ? u.value = e.appliedSelections : u.value = [e.appliedSelections]), setTimeout(() => {
149
+ c.value = !1, v.value = !0;
150
+ }, 100)) : (!l.multi && !t.multi && (c.value = !0), setTimeout(() => {
151
+ !l.multi && !t.multi && (c.value = !1), v.value = !1;
152
+ }, 100));
153
+ }), g(S, () => {
154
+ u.value = A();
155
+ });
156
+ const P = (t) => {
157
+ K.value = t;
158
+ }, j = () => {
159
+ u.value = [], S.value = [], i.value = null, h("update:selectedCondition", null), C.value = e.label, s.value = "", h("clear");
160
+ }, W = (t) => {
161
+ i.value === null && (i.value = e.conditionalOptions[0]), t && i.value.multi && e.infiniteLoading && u.value && (o.value = u.value, s.value && O(s.value));
162
+ };
163
+ J(() => {
164
+ (e.searchQuery || !e.infiniteLoading || e.minCharsToStart === 0) && O(e.searchQuery), e.appliedSelections && Array.isArray(e.appliedSelections) && (o.value = e.appliedSelections, u.value = e.appliedSelections, K.value = e.appliedSelections), k();
165
+ });
166
+ const q = () => {
167
+ h("closed");
168
+ };
169
+ return (t, l) => {
170
+ const d = X("ButtonDropdownTrigger");
171
+ return B(), Y(p(U), {
172
+ ref_key: "dropdownRef",
173
+ ref: D,
174
+ selected: u.value,
175
+ "onUpdate:selected": l[2] || (l[2] = (n) => u.value = n),
176
+ "predefined-trigger": "chip",
177
+ "display-value": (n) => n?.[a.optionNameKey],
178
+ multi: v.value,
179
+ options: o.value,
180
+ placeholder: C.value,
181
+ "search-placeholder": "Search",
182
+ "option-name-key": a.optionNameKey,
183
+ "with-conditions": "",
184
+ "inline-search": "",
185
+ "custom-number-of-displayed-options": p(Q),
186
+ "options-list-width": "330px",
187
+ loading: c.value || a.loadingOverride,
188
+ "load-more-loading": w.value,
189
+ "comparing-key": a.comparingKey,
190
+ "is-open": a.isOpen,
191
+ "infinite-loading": a.infiniteLoading,
192
+ "show-select-all": !a.infiniteLoading && !s.value,
193
+ "grouped-options": a.groupedOptions,
194
+ "option-flag-key": a.optionFlagKey,
195
+ "option-image-key": a.optionImageKey,
196
+ "option-icon-key": a.optionIconKey,
197
+ "option-icon-type": a.optionIconType,
198
+ "trigger-shown-values-count": a.triggerShownValuesCount,
199
+ "test-id": a.testId,
200
+ "onUpdate:isOpen": W,
201
+ onOnsearch: O,
202
+ onApply: z,
203
+ onLoadMore: $,
204
+ onUnsavedSelectionUpdate: P,
205
+ onClosed: q
206
+ }, Z({
207
+ "dropdown-trigger": f(({ defaultTriggerProps: n }) => [
208
+ y(p(ue), _(n, {
209
+ label: C.value,
210
+ "selected-option": p(S),
211
+ multi: N.value,
212
+ "cancel-all-selected-display": "",
213
+ "test-id": a.testId,
214
+ "display-value-in-quotes": !Array.isArray(u.value) && u.value.conditionalOptions,
215
+ "shown-values-count": a.triggerShownValuesCount,
216
+ onClear: j
217
+ }), null, 16, ["label", "selected-option", "multi", "test-id", "display-value-in-quotes", "shown-values-count"])
218
+ ]),
219
+ "dropdown-conditions": f(() => [
220
+ ee("div", pe, [
221
+ y(p(U), {
222
+ selected: p(i),
223
+ "onUpdate:selected": l[0] || (l[0] = (n) => te(i) ? i.value = n : null),
224
+ options: a.conditionalOptions,
225
+ "option-name-key": "label",
226
+ "display-value": (n) => n?.label,
227
+ container: ".conditional-container",
228
+ size: "small",
229
+ "test-id": `${a.testId}-conditions`
230
+ }, {
231
+ "dropdown-trigger": f(({ buttonTriggerProps: n }) => [
232
+ y(d, F(I(n)), null, 16),
233
+ y(p(se), F(I(n)), null, 16)
234
+ ]),
235
+ _: 1
236
+ }, 8, ["selected", "options", "display-value", "test-id"])
237
+ ])
238
+ ]),
239
+ "inline-search": f(() => [
240
+ y(p(re), {
241
+ modelValue: s.value,
242
+ "onUpdate:modelValue": l[1] || (l[1] = (n) => s.value = n),
243
+ class: "inline-search",
244
+ placeholder: "Search",
245
+ variant: "transparent",
246
+ size: "md",
247
+ "auto-focus": a.autoFocusSearch
248
+ }, null, 8, ["modelValue", "auto-focus"])
249
+ ]),
250
+ "custom-list-area": f(() => [
251
+ !o.value.length && !c.value ? (B(), le("div", ve, [
252
+ y(de, { variant: "body1" }, {
253
+ default: f(() => [
254
+ oe(ne(p(E)), 1)
255
+ ]),
256
+ _: 1
257
+ })
258
+ ])) : ae("", !0)
259
+ ]),
260
+ _: 2
261
+ }, [
262
+ t.$slots["option-end"] ? {
263
+ name: "option-end",
264
+ fn: f(({ option: n }) => [
265
+ ie(t.$slots, "option-end", { option: n }, void 0, !0)
266
+ ]),
267
+ key: "0"
268
+ } : void 0
269
+ ]), 1032, ["selected", "display-value", "multi", "options", "placeholder", "option-name-key", "custom-number-of-displayed-options", "loading", "load-more-loading", "comparing-key", "is-open", "infinite-loading", "show-select-all", "grouped-options", "option-flag-key", "option-image-key", "option-icon-key", "option-icon-type", "trigger-shown-values-count", "test-id"]);
270
+ };
271
+ }
272
+ });
273
+ export {
274
+ Ne as default
275
+ };
@@ -1 +1,156 @@
1
- import "../../../DefaultDropdownTrigger.vue_vue_type_style_index_0_scoped_a6900fa6_lang.css";
1
+ import "../../../DefaultDropdownTrigger.vue_vue_type_style_index_0_scoped_a6900fa6_lang.css"; import { defineComponent as I, computed as f, openBlock as o, createElementBlock as d, createBlock as T, createCommentVNode as n, createElementVNode as p, mergeProps as y, unref as l, renderSlot as r, createVNode as s, withCtx as g, createTextVNode as x, toDisplayString as B } from "vue";
2
+ import w from "../../typography/v4/Typography.vue.js";
3
+ import { DropdownTestIdModifiers as c } from "../../../testids/index.js";
4
+ import m from "../../icon/v4/IconV4.vue.js";
5
+ import $ from "../../icon/v4/IconFlag.vue.js";
6
+ import K from "../../shared/FieldLabel.vue.js";
7
+ import { useTestIdAttrs as V } from "../../../utils/testIds.js";
8
+ import A from "../../statusDot/StatusDot.vue.js";
9
+ import E from "../../tooltip/v4/TooltipV4.vue.js";
10
+ const D = { class: "default-dropdown-wrapper" }, N = { class: "content" }, S = {
11
+ key: 0,
12
+ class: "image"
13
+ }, P = ["src"], C = {
14
+ key: 1,
15
+ class: "flag"
16
+ }, F = {
17
+ key: 2,
18
+ class: "start-icon"
19
+ }, z = {
20
+ key: 3,
21
+ class: "status-dot"
22
+ }, H = {
23
+ key: 0,
24
+ class: "inline-error"
25
+ }, L = { key: 1 }, R = { class: "caret-down" }, Z = /* @__PURE__ */ I({
26
+ __name: "DefaultDropdownTrigger",
27
+ props: {
28
+ placeholder: { default: "Select" },
29
+ selectedOption: { default: null },
30
+ options: { default: null },
31
+ multi: { type: Boolean, default: !1 },
32
+ size: { default: "medium" },
33
+ open: { type: Boolean, default: !1 },
34
+ disabled: { type: Boolean, default: !1 },
35
+ testId: { default: "" },
36
+ label: { default: "" },
37
+ mandatory: { type: Boolean, default: !1 },
38
+ hoverHelpText: { default: "" },
39
+ hoverHelpTextPlacement: { default: "top" },
40
+ feedbackVariant: { default: null },
41
+ feedbackText: { default: "" },
42
+ showFeedbackIcon: { type: Boolean, default: !1 },
43
+ loading: { type: Boolean, default: !1 },
44
+ singleAppSelection: { type: Boolean, default: !1 },
45
+ brandIconType: { default: null },
46
+ displayValue: null,
47
+ optionNameKey: { default: null },
48
+ optionImageKey: { default: null },
49
+ optionIconKey: { default: null },
50
+ optionIconType: { default: null },
51
+ showAllSelectedText: { type: Boolean, default: !0 },
52
+ allSelected: { type: Boolean, default: !1 },
53
+ optionFlagKey: { default: null },
54
+ statusDotType: { default: null },
55
+ inlineError: { type: Boolean, default: !1 },
56
+ inlineErrorText: { default: "" },
57
+ inlineErrorTextPlacement: { default: "top" }
58
+ },
59
+ emits: ["click"],
60
+ setup(e, { emit: v }) {
61
+ const t = e, k = f(
62
+ () => t.feedbackVariant ? `state-${t.feedbackVariant}` : ""
63
+ ), b = () => {
64
+ v("click");
65
+ }, u = V(t.testId, c), O = f(() => t.multi ? !Array.isArray(t.selectedOption) || !t.selectedOption?.length ? t.placeholder : t.showAllSelectedText && t.allSelected ? `All selected (${t.selectedOption.length})` : t.selectedOption?.length === 1 && t.displayValue ? t.displayValue(t.selectedOption[0]) : `${t.selectedOption.length} selected` : t.selectedOption ? t.displayValue(t.selectedOption) : t.placeholder), i = f(() => {
66
+ if (!t.selectedOption)
67
+ return null;
68
+ if (!t.multi)
69
+ return t.selectedOption;
70
+ if (Array.isArray(t.selectedOption))
71
+ return t.selectedOption.length === 1 ? t.selectedOption[0] : null;
72
+ });
73
+ return (a, h) => (o(), d("div", D, [
74
+ e.label ? (o(), T(K, {
75
+ key: 0,
76
+ label: e.label,
77
+ mandatory: e.mandatory,
78
+ "hover-help-text": e.hoverHelpText,
79
+ "hover-help-text-placement": e.hoverHelpTextPlacement,
80
+ disabled: e.disabled,
81
+ "test-id": e.testId,
82
+ class: "dropdown-field-label"
83
+ }, null, 8, ["label", "mandatory", "hover-help-text", "hover-help-text-placement", "disabled", "test-id"])) : n("", !0),
84
+ p("div", y({
85
+ class: ["dropdown-trigger", [e.size, l(k), { open: e.open, disabled: e.disabled }]]
86
+ }, l(u)[l(c).BUTTON_WRAPPER], {
87
+ onClick: h[0] || (h[0] = (U) => b())
88
+ }), [
89
+ p("div", N, [
90
+ a.$slots.image || l(i) && e.optionImageKey ? (o(), d("div", S, [
91
+ r(a.$slots, "image", {}, () => [
92
+ e.optionImageKey ? (o(), d("img", {
93
+ key: 0,
94
+ src: l(i)[e.optionImageKey]
95
+ }, null, 8, P)) : n("", !0)
96
+ ], !0)
97
+ ])) : n("", !0),
98
+ a.$slots.flag || l(i) && e.optionFlagKey ? (o(), d("div", C, [
99
+ r(a.$slots, "flag", {}, () => [
100
+ e.optionFlagKey ? (o(), T(l($), {
101
+ key: 0,
102
+ "country-code": l(i)[e.optionFlagKey]
103
+ }, null, 8, ["country-code"])) : n("", !0)
104
+ ], !0)
105
+ ])) : n("", !0),
106
+ a.$slots["icon-start"] || l(i) && e.optionIconKey ? (o(), d("div", F, [
107
+ r(a.$slots, "icon-start", {}, () => [
108
+ s(l(m), {
109
+ type: e.optionIconType,
110
+ name: l(i)[e.optionIconKey],
111
+ size: "20px"
112
+ }, null, 8, ["type", "name"])
113
+ ], !0)
114
+ ])) : n("", !0),
115
+ e.statusDotType ? (o(), d("div", z, [
116
+ s(l(A), { type: e.statusDotType }, null, 8, ["type"])
117
+ ])) : n("", !0),
118
+ r(a.$slots, "displayed-value", {}, () => [
119
+ s(l(w), y({ variant: "body1" }, l(u)[l(c).BUTTON_CONTENT], { class: "displayed-value" }), {
120
+ default: g(() => [
121
+ x(B(l(O)), 1)
122
+ ]),
123
+ _: 1
124
+ }, 16)
125
+ ], !0)
126
+ ]),
127
+ e.inlineError && e.inlineErrorText ? (o(), d("div", H, [
128
+ s(l(E), y({
129
+ text: e.inlineErrorText,
130
+ placement: e.inlineErrorTextPlacement
131
+ }, l(u)[l(c).TOOLTIP]), {
132
+ default: g(() => [
133
+ s(l(m), {
134
+ name: "warning-circle",
135
+ size: "16px"
136
+ })
137
+ ]),
138
+ _: 1
139
+ }, 16, ["text", "placement"])
140
+ ])) : n("", !0),
141
+ a.$slots["end-icon"] ? (o(), d("div", L, [
142
+ r(a.$slots, "end-icon", {}, void 0, !0)
143
+ ])) : n("", !0),
144
+ p("div", R, [
145
+ s(l(m), {
146
+ name: "caret-down",
147
+ size: "20px"
148
+ })
149
+ ])
150
+ ], 16)
151
+ ]));
152
+ }
153
+ });
154
+ export {
155
+ Z as default
156
+ };