@ironsource/shared-ui 2.1.7-rc.4 → 2.1.7-rc.5

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 (40) hide show
  1. package/Chart.vue_vue_type_style_index_0_scoped_f06a4764_lang.css +1 -0
  2. package/ChartHeader.vue_vue_type_style_index_0_scoped_88d4532f_lang.css +1 -0
  3. package/ChartLegend.vue_vue_type_style_index_0_scoped_efc608f9_lang.css +1 -0
  4. package/ChartLoader.vue_vue_type_style_index_0_scoped_142c444a_lang.css +1 -0
  5. package/ChartTooltip.vue_vue_type_style_index_0_scoped_ec636f18_lang.css +1 -0
  6. package/SortableItem.vue_vue_type_style_index_0_scoped_9dd4d372_lang.css +1 -0
  7. package/SortableItemLabel.vue_vue_type_style_index_0_scoped_1386ae20_lang.css +1 -0
  8. package/SortableList.vue_vue_type_style_index_0_scoped_21842d59_lang.css +1 -0
  9. package/components/chart/Chart.vue.js +7 -0
  10. package/components/chart/Chart.vue2.js +281 -0
  11. package/components/chart/ChartHeader.vue.js +7 -0
  12. package/components/chart/ChartHeader.vue2.js +51 -0
  13. package/components/chart/ChartLegend.vue.js +7 -0
  14. package/components/chart/ChartLegend.vue2.js +65 -0
  15. package/components/chart/ChartLoader.vue.js +25 -0
  16. package/components/chart/ChartLoader.vue2.js +0 -0
  17. package/components/chart/ChartTooltip.vue.js +7 -0
  18. package/components/chart/ChartTooltip.vue2.js +81 -0
  19. package/components/chart/composables/useChartValues.js +32 -0
  20. package/components/chart/composables/useTooltipPosition.js +22 -0
  21. package/components/chart/consts.js +21 -0
  22. package/components/chart/index.js +6 -0
  23. package/components/chart/plugins/HoverVerticalLine.js +12 -0
  24. package/components/chart/types.js +4 -0
  25. package/components/chart/utils/formatNumber.js +11 -0
  26. package/components/chart/utils/utils.js +12 -0
  27. package/components/sortableList/SortableItem.vue.js +7 -0
  28. package/components/sortableList/SortableItem.vue2.js +140 -0
  29. package/components/sortableList/SortableItemLabel.vue.js +7 -0
  30. package/components/sortableList/SortableItemLabel.vue2.js +60 -0
  31. package/components/sortableList/SortableList.vue.js +7 -0
  32. package/components/sortableList/SortableList.vue2.js +120 -0
  33. package/components/sortableList/composables/useHoverEffect.js +19 -0
  34. package/components/sortableList/consts.js +4 -0
  35. package/components/sortableList/index.js +6 -0
  36. package/index.d.ts +593 -0
  37. package/index.js +131 -126
  38. package/package.json +9 -1
  39. package/testids/index.js +5 -4
  40. package/utils/search.js +4 -0
@@ -0,0 +1,12 @@
1
+ const i = {
2
+ id: "hoverVerticalLine",
3
+ beforeDraw: (t) => {
4
+ if (t.getActiveElements().length) {
5
+ const o = t.getActiveElements()[0], n = t.chartArea, e = t.ctx;
6
+ e.save(), e.beginPath(), e.moveTo(o.element.x, n.top), e.lineTo(o.element.x, n.bottom), e.lineWidth = 1, e.strokeStyle = "rgba(0,0,0, 0.1)", e.stroke(), e.restore();
7
+ }
8
+ }
9
+ };
10
+ export {
11
+ i as HoverVerticalLine
12
+ };
@@ -0,0 +1,4 @@
1
+ var a = /* @__PURE__ */ ((e) => (e.Line = "line", e.Bar = "bar", e.StackedLine = "stackedLine", e.StackedBar = "stackedBar", e))(a || {});
2
+ export {
3
+ a as ChartType
4
+ };
@@ -0,0 +1,11 @@
1
+ const s = "N/A", r = (n, e, t) => n.toLocaleString("en", {
2
+ minimumFractionDigits: e,
3
+ maximumFractionDigits: t
4
+ }), u = (n, e = s) => {
5
+ const t = Number(n), a = t % 1 !== 0;
6
+ return isNaN(t) && e ? e : Math.abs(t) >= 1e12 ? "∞" : Math.abs(t) >= 1e9 ? `${r(t / 1e9, 0, 1)}B` : Math.abs(t) >= 1e6 ? `${r(t / 1e6, 0, 1)}M` : Math.abs(t) >= 1e3 ? `${r(t / 1e3, 0, 1)}K` : a && Math.abs(t) >= 100 ? r(t, 0, 0) : a && Math.abs(t) >= 10 ? r(t, 0, 1) : a ? r(t, 2, 2) : r(t, 0, 0);
7
+ };
8
+ export {
9
+ s as DEFAULT_FALLBACK,
10
+ u as formatNumber
11
+ };
@@ -0,0 +1,12 @@
1
+ import { format as f } from "date-fns";
2
+ import { formatNumber as m } from "./formatNumber.js";
3
+ const p = (r, t, e) => {
4
+ if (e === 0)
5
+ return 0;
6
+ const n = t - r, o = n / e * 0.4;
7
+ return (n + o) / e;
8
+ }, M = (r, t) => t === "number" ? m(r) : t === "date" ? f(new Date(r), "MMM dd") : t === "dateLong" ? f(new Date(r), "dd MMM yyyy") : String(r);
9
+ export {
10
+ p as calcStepSize,
11
+ M as formatValue
12
+ };
@@ -0,0 +1,7 @@
1
+ import o from "./SortableItem.vue2.js";
2
+ /* empty css */import e from "../../_virtual/_plugin-vue_export-helper.js";
3
+ // import "../../SortableItem.vue_vue_type_style_index_0_scoped_9dd4d372_lang.css"; //*');
4
+ const s = /* @__PURE__ */ e(o, [["__scopeId", "data-v-9dd4d372"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,140 @@
1
+ import "../../SortableItem.vue_vue_type_style_index_0_scoped_9dd4d372_lang.css"; import { defineComponent as P, computed as x, watch as E, ref as $, openBlock as o, createElementBlock as a, normalizeClass as f, unref as e, withModifiers as c, createElementVNode as r, createVNode as h, createBlock as s, withCtx as b, createTextVNode as w, toDisplayString as F, createCommentVNode as u, renderSlot as z, mergeProps as S, normalizeProps as I, Fragment as R, renderList as D } from "vue";
2
+ import V from "../typography/v4/Typography.vue.js";
3
+ import m from "../icon/v4/IconV4.vue.js";
4
+ import L from "../icon/v4/IconFlag.vue.js";
5
+ import j from "./SortableItemLabel.vue.js";
6
+ import { useVirtualList as q } from "@vueuse/core";
7
+ import { matchString as A } from "../../utils/search.js";
8
+ import { useHoverEffect as G } from "./composables/useHoverEffect.js";
9
+ const J = { class: "draggable-handle" }, K = { class: "item__prefix" }, U = ["onClick"], W = { class: "item__text" }, X = ["onClick"], re = /* @__PURE__ */ P({
10
+ __name: "SortableItem",
11
+ props: {
12
+ item: null,
13
+ index: { default: null },
14
+ isOpen: { type: Boolean, default: !1 },
15
+ isSelected: { type: Boolean, default: !1 },
16
+ selectedChildId: { default: null },
17
+ searchQuery: { default: null },
18
+ searchHandler: { type: Function, default: null },
19
+ displayValue: null
20
+ },
21
+ emits: ["toggle", "select", "selectChild"],
22
+ setup(t, { emit: y }) {
23
+ const n = t, Q = () => {
24
+ y("toggle", !n.isOpen);
25
+ }, g = x(() => (n.item.children || []).filter(
26
+ (l) => n.searchHandler ? n.searchHandler(l, n.searchQuery) : A(l.displayText, n.searchQuery)
27
+ )), p = x(() => g.value.length > 0), B = (d) => d.id === n.selectedChildId, {
28
+ list: H,
29
+ containerProps: M,
30
+ wrapperProps: T,
31
+ scrollTo: N
32
+ } = q(g, {
33
+ itemHeight: 34
34
+ });
35
+ E(
36
+ () => n.searchQuery,
37
+ () => N(0)
38
+ );
39
+ const k = $(null), { handleMouseout: v, handleMouseover: C } = G(
40
+ k,
41
+ "sortable-item--hovered"
42
+ );
43
+ return (d, l) => (o(), a("div", {
44
+ ref_key: "itemRef",
45
+ ref: k,
46
+ class: f(["sortable-item", { "sortable-item--selected": t.isSelected }]),
47
+ onMouseover: l[1] || (l[1] = //@ts-ignore
48
+ (...i) => e(C) && e(C)(...i)),
49
+ onMouseout: l[2] || (l[2] = //@ts-ignore
50
+ (...i) => e(v) && e(v)(...i)),
51
+ onClick: l[3] || (l[3] = c((i) => y("select"), ["stop"]))
52
+ }, [
53
+ r("div", {
54
+ class: f(["item", { "drag-allowed": !t.item.isLocked && !t.searchQuery }])
55
+ }, [
56
+ r("div", J, [
57
+ h(e(m), {
58
+ name: "dots-six-vertical",
59
+ width: "20px",
60
+ type: "bold"
61
+ })
62
+ ]),
63
+ r("div", K, [
64
+ t.item.isLocked ? (o(), s(e(m), {
65
+ key: 1,
66
+ class: "locked-icon",
67
+ name: "lock",
68
+ width: "16px"
69
+ })) : (o(), s(e(V), {
70
+ key: 0,
71
+ class: "order-num",
72
+ variant: "subtitle2"
73
+ }, {
74
+ default: b(() => [
75
+ w(F(t.index + 1) + ". ", 1)
76
+ ]),
77
+ _: 1
78
+ }))
79
+ ]),
80
+ e(p) && !t.searchQuery ? (o(), a("div", {
81
+ key: 0,
82
+ class: "expand-icon",
83
+ onClick: c(Q, ["stop"])
84
+ }, [
85
+ t.isOpen ? (o(), s(e(m), {
86
+ key: 0,
87
+ name: "caret-down",
88
+ width: "16px"
89
+ })) : (o(), s(e(m), {
90
+ key: 1,
91
+ name: "caret-right",
92
+ width: "16px"
93
+ }))
94
+ ], 8, U)) : u("", !0),
95
+ r("div", W, [
96
+ t.item.countryFlag ? (o(), s(e(L), {
97
+ key: 0,
98
+ class: "country-flag",
99
+ "country-code": t.item.countryFlag
100
+ }, null, 8, ["country-code"])) : u("", !0),
101
+ h(j, {
102
+ "display-value": t.displayValue,
103
+ item: t.item
104
+ }, null, 8, ["display-value", "item"])
105
+ ]),
106
+ r("div", {
107
+ class: "item__menu",
108
+ onClick: l[0] || (l[0] = c(() => {
109
+ }, ["stop"]))
110
+ }, [
111
+ z(d.$slots, "menu", {}, void 0, !0)
112
+ ])
113
+ ], 2),
114
+ r("div", S(e(M), { class: "child-list" }), [
115
+ e(p) && t.isOpen ? (o(), a("ul", I(S({ key: 0 }, e(T))), [
116
+ (o(!0), a(R, null, D(e(H), ({ data: i, index: O }) => (o(), a("li", {
117
+ key: O,
118
+ class: f({ selected: B(i) }),
119
+ onClick: c((Y) => y("selectChild", i), ["stop"])
120
+ }, [
121
+ i.countryFlag ? (o(), s(e(L), {
122
+ key: 0,
123
+ class: "country-flag",
124
+ "country-code": i.countryFlag
125
+ }, null, 8, ["country-code"])) : u("", !0),
126
+ h(e(V), { variant: "body2" }, {
127
+ default: b(() => [
128
+ w(F(t.displayValue(i)), 1)
129
+ ]),
130
+ _: 2
131
+ }, 1024)
132
+ ], 10, X))), 128))
133
+ ], 16)) : u("", !0)
134
+ ], 16)
135
+ ], 34));
136
+ }
137
+ });
138
+ export {
139
+ re as default
140
+ };
@@ -0,0 +1,7 @@
1
+ import e from "./SortableItemLabel.vue2.js";
2
+ /* empty css */import o from "../../_virtual/_plugin-vue_export-helper.js";
3
+ // import "../../SortableItemLabel.vue_vue_type_style_index_0_scoped_1386ae20_lang.css"; //*');
4
+ const s = /* @__PURE__ */ o(e, [["__scopeId", "data-v-1386ae20"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,60 @@
1
+ import "../../SortableItemLabel.vue_vue_type_style_index_0_scoped_1386ae20_lang.css"; import { defineComponent as m, openBlock as a, createBlock as u, unref as l, withCtx as t, createElementVNode as p, createElementBlock as c, Fragment as h, renderList as f, createVNode as i, createTextVNode as o, toDisplayString as r, normalizeClass as x } from "vue";
2
+ import n from "../typography/v4/Typography.vue.js";
3
+ import y from "../tooltip/v4/TooltipV4.vue.js";
4
+ const _ = { class: "tooltip-content" }, k = /* @__PURE__ */ m({
5
+ __name: "SortableItemLabel",
6
+ props: {
7
+ item: null,
8
+ displayValue: null
9
+ },
10
+ setup(e) {
11
+ return (b, T) => (a(), u(l(y), {
12
+ class: "item-label",
13
+ placement: "right",
14
+ disabled: !e.item.helpText
15
+ }, {
16
+ tooltip: t(() => [
17
+ p("div", _, [
18
+ (a(!0), c(h, null, f(e.item.helpText, (s, d) => (a(), c("div", {
19
+ key: d,
20
+ class: "help"
21
+ }, [
22
+ i(l(n), {
23
+ class: "help__title",
24
+ variant: "h5"
25
+ }, {
26
+ default: t(() => [
27
+ o(r(s.title), 1)
28
+ ]),
29
+ _: 2
30
+ }, 1024),
31
+ i(l(n), {
32
+ class: "help__text",
33
+ variant: "body2"
34
+ }, {
35
+ default: t(() => [
36
+ o(r(s.text), 1)
37
+ ]),
38
+ _: 2
39
+ }, 1024)
40
+ ]))), 128))
41
+ ])
42
+ ]),
43
+ default: t(() => [
44
+ i(l(n), {
45
+ variant: "body2",
46
+ class: x({ "decorated-text": e.item.helpText?.length })
47
+ }, {
48
+ default: t(() => [
49
+ o(r(e.displayValue(e.item)), 1)
50
+ ]),
51
+ _: 1
52
+ }, 8, ["class"])
53
+ ]),
54
+ _: 1
55
+ }, 8, ["disabled"]));
56
+ }
57
+ });
58
+ export {
59
+ k as default
60
+ };
@@ -0,0 +1,7 @@
1
+ import o from "./SortableList.vue2.js";
2
+ /* empty css */import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ // import "../../SortableList.vue_vue_type_style_index_0_scoped_21842d59_lang.css"; //*');
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-21842d59"]]);
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,120 @@
1
+ import "../../SortableList.vue_vue_type_style_index_0_scoped_21842d59_lang.css"; import { defineComponent as $, computed as p, ref as F, openBlock as c, createElementBlock as m, mergeProps as v, unref as t, createBlock as y, isRef as E, createCommentVNode as P, createVNode as w, withCtx as C, Fragment as x, renderList as B, renderSlot as D, createElementVNode as G } from "vue";
2
+ import { VueDraggable as U } from "vue-draggable-plus";
3
+ import R from "./SortableItem.vue.js";
4
+ import M from "../search/v4/SearchV4.vue.js";
5
+ import { useVModel as K } from "@vueuse/core";
6
+ import { matchString as q } from "../../utils/search.js";
7
+ import { useTestIdAttrs as Q } from "../../utils/testIds.js";
8
+ import { SortableListTestIdModifiers as f } from "../../testids/index.js";
9
+ import { DRAG_CURSOR_CSS_CLASS as H } from "./consts.js";
10
+ const le = /* @__PURE__ */ $({
11
+ __name: "SortableList",
12
+ props: {
13
+ items: { default: () => [] },
14
+ displayValue: { type: Function, default: (d) => d.displayText || d.toString() },
15
+ openId: { default: null },
16
+ selectedId: { default: null },
17
+ selectedChildId: { default: null },
18
+ search: { default: null },
19
+ showSearch: { type: Boolean, default: !1 },
20
+ searchPlaceholder: { default: "Search" },
21
+ searchHandler: { type: Function, default: null },
22
+ testId: { default: "" }
23
+ },
24
+ emits: ["update:items", "update:openId", "update:selectedId", "update:selectedChildId", "update:search", "clearSearch"],
25
+ setup(d, { emit: s }) {
26
+ const r = d, o = K(r, "search", s), S = p(() => !!o.value?.trim()), L = p(() => S.value ? r.items.filter((l) => {
27
+ const a = l.children || [], e = o.value;
28
+ return r.searchHandler ? r.searchHandler(l, e) : q(l.displayText, e) || // match parent item
29
+ a.some((n) => q(n.displayText, e));
30
+ }) : r.items), u = p({
31
+ get() {
32
+ return L.value.filter((l) => !l.isLocked);
33
+ },
34
+ set(l) {
35
+ s("update:items", [...l, ...V.value]);
36
+ }
37
+ }), V = p(
38
+ () => L.value.filter((l) => l.isLocked)
39
+ ), I = F(!1), N = (l) => {
40
+ I.value = !0, setTimeout(() => l.target.classList.add(H), 50);
41
+ }, O = (l) => {
42
+ I.value = !1, l.target.classList.remove(H);
43
+ }, T = (l) => (S.value || l.id === r.openId) && !I.value, b = (l, a) => {
44
+ a ? s("update:openId", l.id) : s("update:openId", null);
45
+ }, i = (l) => l.id === r.selectedId, k = (l) => {
46
+ s("update:selectedId", l.id), s("update:selectedChildId", null);
47
+ }, A = (l, a) => {
48
+ s("update:selectedChildId", l.id), s("update:selectedId", a.id), s("update:openId", a.id);
49
+ }, g = Q(r.testId, f);
50
+ return (l, a) => (c(), m("div", v({ class: "sortable-list-container" }, t(g)[t(f).CONTAINER]), [
51
+ d.showSearch ? (c(), y(t(M), {
52
+ key: 0,
53
+ modelValue: t(o),
54
+ "onUpdate:modelValue": a[0] || (a[0] = (e) => E(o) ? o.value = e : null),
55
+ class: "list-search",
56
+ placeholder: d.searchPlaceholder,
57
+ "test-id": d.testId,
58
+ onOnClear: a[1] || (a[1] = (e) => s("clearSearch"))
59
+ }, null, 8, ["modelValue", "placeholder", "test-id"])) : P("", !0),
60
+ w(t(U), v({
61
+ modelValue: t(u),
62
+ "onUpdate:modelValue": a[2] || (a[2] = (e) => E(u) ? u.value = e : null),
63
+ class: "sortable-list",
64
+ filter: ".expand-icon",
65
+ animation: 150,
66
+ handle: ".draggable-handle",
67
+ disabled: t(S)
68
+ }, t(g)[t(f).DRAGGABLE_LIST], {
69
+ onStart: N,
70
+ onEnd: O
71
+ }), {
72
+ default: C(() => [
73
+ (c(!0), m(x, null, B(t(u), (e, n) => (c(), y(R, {
74
+ key: e.id,
75
+ item: e,
76
+ index: n,
77
+ "is-open": T(e),
78
+ "is-selected": i(e),
79
+ "selected-child-id": i(e) ? d.selectedChildId : null,
80
+ "display-value": d.displayValue,
81
+ "search-query": t(o),
82
+ "search-handler": d.searchHandler,
83
+ onToggle: (h) => b(e, h),
84
+ onSelect: (h) => k(e),
85
+ onSelectChild: (h) => A(h, e)
86
+ }, {
87
+ menu: C(() => [
88
+ D(l.$slots, "menu", { item: e }, void 0, !0)
89
+ ]),
90
+ _: 2
91
+ }, 1032, ["item", "index", "is-open", "is-selected", "selected-child-id", "display-value", "search-query", "search-handler", "onToggle", "onSelect", "onSelectChild"]))), 128))
92
+ ]),
93
+ _: 3
94
+ }, 16, ["modelValue", "disabled"]),
95
+ G("div", v({ class: "locked-list" }, t(g)[t(f).LOCKED_LIST]), [
96
+ (c(!0), m(x, null, B(t(V), (e) => (c(), y(R, {
97
+ key: e.id,
98
+ item: e,
99
+ "is-open": T(e),
100
+ "is-selected": i(e),
101
+ "selected-child-id": i(e) ? d.selectedChildId : null,
102
+ "display-value": d.displayValue,
103
+ "search-query": t(o),
104
+ "on-search": d.searchHandler,
105
+ onToggle: (n) => b(e, n),
106
+ onSelect: (n) => k(e),
107
+ onSelectChild: (n) => A(n, e)
108
+ }, {
109
+ menu: C(() => [
110
+ D(l.$slots, "menu", { item: e }, void 0, !0)
111
+ ]),
112
+ _: 2
113
+ }, 1032, ["item", "is-open", "is-selected", "selected-child-id", "display-value", "search-query", "on-search", "onToggle", "onSelect", "onSelectChild"]))), 128))
114
+ ], 16)
115
+ ], 16));
116
+ }
117
+ });
118
+ export {
119
+ le as default
120
+ };
@@ -0,0 +1,19 @@
1
+ import { computed as t } from "vue";
2
+ const d = (e, r) => {
3
+ const s = t(() => e.value ? Array.from(e.value.parentElement?.children || []) : []);
4
+ return {
5
+ handleMouseover: (n) => {
6
+ s.value.forEach(
7
+ (o) => o.classList.remove(r)
8
+ ), s.value.some(
9
+ (o) => o.classList.contains("sortable-chosen")
10
+ ) || n.currentTarget.classList.add(r);
11
+ },
12
+ handleMouseout: () => {
13
+ e.value.classList.remove(r);
14
+ }
15
+ };
16
+ };
17
+ export {
18
+ d as useHoverEffect
19
+ };
@@ -0,0 +1,4 @@
1
+ const r = "force-grabbing-cursor";
2
+ export {
3
+ r as DRAG_CURSOR_CSS_CLASS
4
+ };
@@ -0,0 +1,6 @@
1
+ import t from "./SortableList.vue.js";
2
+ const r = () => [t];
3
+ export {
4
+ t as SortableList,
5
+ r as SortableListTypes
6
+ };