@epam/ai-dial-ui-kit 0.16.0-dev.46 → 0.16.0-dev.48
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.
- package/README.md +5 -0
- package/dist/{DateCellRenderer-Bx79kGGv.cjs → DateCellRenderer-B2BORgHD.cjs} +1 -1
- package/dist/components/New/Analytics/Bar/Bar.js +104 -0
- package/dist/components/New/Analytics/BarGroup/BarGroup.js +143 -0
- package/dist/components/New/Analytics/Card/Card.js +99 -0
- package/dist/components/New/Analytics/Histogram/Histogram.js +212 -0
- package/dist/components/New/LabelledText/LabelledText.js +43 -0
- package/dist/components-manifest.json +423 -8
- package/dist/constants/public-class-names.js +10 -0
- package/dist/dial-ui-kit.cjs +3 -3
- package/dist/dial-ui-kit.js +233 -223
- package/dist/grid.cjs +1 -1
- package/dist/src/components/New/Analytics/Bar/Bar.d.ts +86 -0
- package/dist/src/components/New/Analytics/BarGroup/BarGroup.d.ts +103 -0
- package/dist/src/components/New/Analytics/Card/Card.d.ts +91 -0
- package/dist/src/components/New/Analytics/Histogram/Histogram.d.ts +59 -0
- package/dist/src/components/New/LabelledText/LabelledText.d.ts +48 -0
- package/dist/src/constants/public-class-names.d.ts +10 -0
- package/dist/src/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { DIAL_KIT_CLASS as h } from "../../../../constants/public-class-names.js";
|
|
3
|
+
import { Badge as S } from "../../Badge/Badge.js";
|
|
4
|
+
import { BadgeColor as _, BadgeVariant as R } from "../../../../types/badge.js";
|
|
5
|
+
import { Spinner as T } from "../../../Spinner/Spinner.js";
|
|
6
|
+
import { mergeClasses as r } from "../../../../utils/merge-classes.js";
|
|
7
|
+
import { getAnalyticsBarColor as j, DEFAULT_ANALYTICS_BAR_COLOR_MAP as k, getAnalyticsBarRatio as F } from "../../../Analytics/Bar/utils.js";
|
|
8
|
+
const K = ({
|
|
9
|
+
value: e,
|
|
10
|
+
maxValue: c = 1,
|
|
11
|
+
error: l,
|
|
12
|
+
isLoading: t,
|
|
13
|
+
title: i,
|
|
14
|
+
valueLabel: u,
|
|
15
|
+
colorMap: w = k,
|
|
16
|
+
className: m,
|
|
17
|
+
titleClassName: y,
|
|
18
|
+
valueClassName: v,
|
|
19
|
+
inline: o,
|
|
20
|
+
ariaLabel: g
|
|
21
|
+
}) => {
|
|
22
|
+
const n = e == null, N = !!(l || t || !n), d = F(n ? 0 : e, c), b = j(d, w), A = u ?? (n ? "—" : e), B = g ?? (typeof i == "string" ? i : void 0), C = l || t, f = l ? /* @__PURE__ */ a(
|
|
23
|
+
S,
|
|
24
|
+
{
|
|
25
|
+
label: "Error",
|
|
26
|
+
variant: R.Filled,
|
|
27
|
+
color: _.Red,
|
|
28
|
+
textClassName: "dial-tiny-semi-text"
|
|
29
|
+
}
|
|
30
|
+
) : t ? /* @__PURE__ */ a(T, { size: 18, fullWidth: !1 }) : /* @__PURE__ */ a(
|
|
31
|
+
"span",
|
|
32
|
+
{
|
|
33
|
+
className: r(
|
|
34
|
+
"shrink-0 tabular-nums text-end",
|
|
35
|
+
o ? "dial-small-text min-w-[5ch] text-primary" : "dial-small-semi-text text-primary",
|
|
36
|
+
v
|
|
37
|
+
),
|
|
38
|
+
children: A
|
|
39
|
+
}
|
|
40
|
+
), x = N ? /* @__PURE__ */ a(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
role: "progressbar",
|
|
44
|
+
"aria-valuenow": l || t || typeof e != "number" ? void 0 : e,
|
|
45
|
+
"aria-valuemin": 0,
|
|
46
|
+
"aria-valuemax": c,
|
|
47
|
+
"aria-label": B,
|
|
48
|
+
className: r(
|
|
49
|
+
"w-full overflow-hidden rounded-xs",
|
|
50
|
+
o ? "h-1" : "h-2",
|
|
51
|
+
l ? "bg-error" : "bg-layer-1"
|
|
52
|
+
),
|
|
53
|
+
children: !C && /* @__PURE__ */ a(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "h-full rounded-xs transition-[width] duration-300",
|
|
57
|
+
style: { width: `${d * 100}%`, backgroundColor: b }
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
) : null, p = /* @__PURE__ */ a(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
className: r("dial-small-text text-primary", y),
|
|
65
|
+
children: i
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
return o ? /* @__PURE__ */ s(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: r(
|
|
72
|
+
"flex flex-row items-center gap-2",
|
|
73
|
+
m,
|
|
74
|
+
h.analyticsBar
|
|
75
|
+
),
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ a("div", { className: "w-1/2 min-w-0", children: p }),
|
|
78
|
+
/* @__PURE__ */ s("div", { className: "flex w-1/2 flex-row items-center gap-2", children: [
|
|
79
|
+
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: x }),
|
|
80
|
+
f
|
|
81
|
+
] })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
) : /* @__PURE__ */ s(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: r(
|
|
88
|
+
"flex flex-col gap-1",
|
|
89
|
+
m,
|
|
90
|
+
h.analyticsBar
|
|
91
|
+
),
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ s("div", { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
94
|
+
p,
|
|
95
|
+
f
|
|
96
|
+
] }),
|
|
97
|
+
x
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
K as AnalyticsBar
|
|
104
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as e, jsxs as f, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as J } from "react";
|
|
3
|
+
import { Accordion as Q } from "../../Accordion/Accordion.js";
|
|
4
|
+
import { AnalyticsBar as b } from "../Bar/Bar.js";
|
|
5
|
+
import { DIAL_KIT_CLASS as R } from "../../../../constants/public-class-names.js";
|
|
6
|
+
import { Spinner as U } from "../../../Spinner/Spinner.js";
|
|
7
|
+
import { Tooltip as x } from "../../Tooltip/Tooltip.js";
|
|
8
|
+
import { mergeClasses as o } from "../../../../utils/merge-classes.js";
|
|
9
|
+
const et = ({
|
|
10
|
+
title: g,
|
|
11
|
+
titleTooltip: h,
|
|
12
|
+
description: G,
|
|
13
|
+
data: i,
|
|
14
|
+
compareData: r,
|
|
15
|
+
compareLabels: m,
|
|
16
|
+
maxValue: p,
|
|
17
|
+
colorMap: u,
|
|
18
|
+
defaultExpanded: I = !0,
|
|
19
|
+
nonCollapsible: K,
|
|
20
|
+
isLoading: T,
|
|
21
|
+
onBarClick: c,
|
|
22
|
+
inline: a,
|
|
23
|
+
barTitleClassName: N,
|
|
24
|
+
barValueClassName: _,
|
|
25
|
+
barClassName: v,
|
|
26
|
+
barDescriptions: C,
|
|
27
|
+
className: z
|
|
28
|
+
}) => {
|
|
29
|
+
const E = Object.entries(i), P = a ? o("text-secondary", N) : N, j = m ? "dial-tiny-text text-secondary" : void 0, W = h ? /* @__PURE__ */ e(x, { tooltip: h, children: g }) : g, q = r ? [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(r)])] : [], y = "cursor-pointer rounded-xs text-left focus-visible:outline focus-visible:outline-focus", A = "group flex flex-col gap-1.5", B = o(
|
|
30
|
+
"flex flex-col gap-1.5 pl-2",
|
|
31
|
+
c && "group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",
|
|
32
|
+
v
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ e(
|
|
35
|
+
Q,
|
|
36
|
+
{
|
|
37
|
+
title: W,
|
|
38
|
+
description: G,
|
|
39
|
+
defaultExpanded: I,
|
|
40
|
+
nonCollapsible: K,
|
|
41
|
+
className: o(z, R.analyticsBarGroup),
|
|
42
|
+
children: /* @__PURE__ */ e(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: o(
|
|
46
|
+
"flex flex-col",
|
|
47
|
+
r ? "gap-4" : a ? "gap-2" : "gap-3"
|
|
48
|
+
),
|
|
49
|
+
children: T ? /* @__PURE__ */ e(U, { size: 18, fullWidth: !1, className: "self-center" }) : r ? q.map((t) => {
|
|
50
|
+
const l = t in i ? i[t] : null, n = t in r ? r[t] : null, s = typeof l == "number" && typeof n == "number" ? parseFloat((n - l).toFixed(3)) : null, F = s != null && s !== 0, L = F && s > 0, S = F ? L ? `+${s}` : String(s) : null, O = C?.[t], $ = /* @__PURE__ */ e("span", { className: "dial-small-text text-secondary", children: t }), w = /* @__PURE__ */ f(H, { children: [
|
|
51
|
+
/* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
|
|
52
|
+
O ? /* @__PURE__ */ e(x, { tooltip: O, children: $ }) : $,
|
|
53
|
+
S != null && /* @__PURE__ */ e(
|
|
54
|
+
"span",
|
|
55
|
+
{
|
|
56
|
+
className: o(
|
|
57
|
+
"dial-tiny-semi-text rounded-[120px] border border-transparent px-2",
|
|
58
|
+
L ? "bg-success text-success" : "bg-error text-error"
|
|
59
|
+
),
|
|
60
|
+
children: S
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ f("div", { className: B, children: [
|
|
65
|
+
/* @__PURE__ */ e(
|
|
66
|
+
b,
|
|
67
|
+
{
|
|
68
|
+
title: m?.[0],
|
|
69
|
+
value: l,
|
|
70
|
+
maxValue: p,
|
|
71
|
+
colorMap: u,
|
|
72
|
+
inline: a,
|
|
73
|
+
titleClassName: j,
|
|
74
|
+
ariaLabel: t
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ e(
|
|
78
|
+
b,
|
|
79
|
+
{
|
|
80
|
+
title: m?.[1],
|
|
81
|
+
value: n,
|
|
82
|
+
maxValue: p,
|
|
83
|
+
colorMap: u,
|
|
84
|
+
inline: a,
|
|
85
|
+
titleClassName: j,
|
|
86
|
+
ariaLabel: `${t} compare`
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] })
|
|
90
|
+
] });
|
|
91
|
+
return c ? /* @__PURE__ */ e(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
type: "button",
|
|
95
|
+
onClick: () => c(t, l),
|
|
96
|
+
className: o(
|
|
97
|
+
A,
|
|
98
|
+
y
|
|
99
|
+
),
|
|
100
|
+
children: w
|
|
101
|
+
},
|
|
102
|
+
t
|
|
103
|
+
) : /* @__PURE__ */ e("div", { className: A, children: w }, t);
|
|
104
|
+
}) : E.map(([t, l]) => {
|
|
105
|
+
const n = /* @__PURE__ */ e(
|
|
106
|
+
b,
|
|
107
|
+
{
|
|
108
|
+
title: t,
|
|
109
|
+
value: l,
|
|
110
|
+
maxValue: p,
|
|
111
|
+
colorMap: u,
|
|
112
|
+
inline: a,
|
|
113
|
+
titleClassName: P,
|
|
114
|
+
valueClassName: _,
|
|
115
|
+
className: v
|
|
116
|
+
}
|
|
117
|
+
), d = c ? /* @__PURE__ */ e(
|
|
118
|
+
"button",
|
|
119
|
+
{
|
|
120
|
+
type: "button",
|
|
121
|
+
onClick: () => c(t, l),
|
|
122
|
+
className: y,
|
|
123
|
+
children: n
|
|
124
|
+
}
|
|
125
|
+
) : n, s = C?.[t];
|
|
126
|
+
return s ? /* @__PURE__ */ e(
|
|
127
|
+
x,
|
|
128
|
+
{
|
|
129
|
+
tooltip: s,
|
|
130
|
+
triggerClassName: "flex flex-col",
|
|
131
|
+
children: d
|
|
132
|
+
},
|
|
133
|
+
t
|
|
134
|
+
) : /* @__PURE__ */ e(J, { children: d }, t);
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
et as AnalyticsBarGroup
|
|
143
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { DIAL_KIT_CLASS as g } from "../../../../constants/public-class-names.js";
|
|
3
|
+
import { Badge as u } from "../../Badge/Badge.js";
|
|
4
|
+
import { BadgeColor as b, BadgeVariant as C } from "../../../../types/badge.js";
|
|
5
|
+
import { EllipsisTooltip as m } from "../../EllipsisTooltip/EllipsisTooltip.js";
|
|
6
|
+
import { Spinner as D } from "../../../Spinner/Spinner.js";
|
|
7
|
+
import { AnalyticsCardVariant as c } from "../../../../types/analytics.js";
|
|
8
|
+
import { mergeClasses as x } from "../../../../utils/merge-classes.js";
|
|
9
|
+
const w = {
|
|
10
|
+
[c.Default]: {
|
|
11
|
+
container: "bg-layer-3",
|
|
12
|
+
title: "dial-small-text text-secondary",
|
|
13
|
+
value: "dial-display2-text text-primary",
|
|
14
|
+
showDescription: !0
|
|
15
|
+
},
|
|
16
|
+
[c.Compact]: {
|
|
17
|
+
container: "bg-layer-2",
|
|
18
|
+
title: "dial-tiny-text text-secondary",
|
|
19
|
+
value: "dial-body-semi-text text-primary",
|
|
20
|
+
showDescription: !1
|
|
21
|
+
}
|
|
22
|
+
}, _ = ({
|
|
23
|
+
title: o,
|
|
24
|
+
value: p,
|
|
25
|
+
description: i,
|
|
26
|
+
variant: f = c.Default,
|
|
27
|
+
error: r,
|
|
28
|
+
isLoading: n,
|
|
29
|
+
className: y,
|
|
30
|
+
delta: a,
|
|
31
|
+
deltaPositive: d,
|
|
32
|
+
deltaUnit: h,
|
|
33
|
+
compareValues: l
|
|
34
|
+
}) => {
|
|
35
|
+
const t = w[f], v = d !== void 0 ? d : (a ?? 0) >= 0, N = a === void 0 ? null : `${a >= 0 ? `+${a}` : String(a)}${h ?? ""}`;
|
|
36
|
+
return /* @__PURE__ */ s(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: x(
|
|
40
|
+
"flex flex-col rounded-lg border border-secondary p-4",
|
|
41
|
+
r || n ? "gap-2" : "gap-1",
|
|
42
|
+
t.container,
|
|
43
|
+
y,
|
|
44
|
+
g.analyticsCard
|
|
45
|
+
),
|
|
46
|
+
children: [
|
|
47
|
+
a !== void 0 ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
48
|
+
/* @__PURE__ */ e("span", { className: t.title, children: o }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
className: x(
|
|
53
|
+
"dial-tiny-semi-text rounded-[120px] border border-transparent px-2",
|
|
54
|
+
v ? "bg-success text-success" : "bg-error text-error"
|
|
55
|
+
),
|
|
56
|
+
children: N
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }) : /* @__PURE__ */ e("span", { className: t.title, children: o }),
|
|
60
|
+
r ? /* @__PURE__ */ e(
|
|
61
|
+
u,
|
|
62
|
+
{
|
|
63
|
+
label: "Error",
|
|
64
|
+
variant: C.Filled,
|
|
65
|
+
color: b.Red,
|
|
66
|
+
textClassName: "dial-tiny-semi-text",
|
|
67
|
+
className: "self-start"
|
|
68
|
+
}
|
|
69
|
+
) : n ? /* @__PURE__ */ e(D, { size: 18, fullWidth: !1, className: "self-start" }) : l ? /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
70
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
71
|
+
/* @__PURE__ */ e(
|
|
72
|
+
m,
|
|
73
|
+
{
|
|
74
|
+
text: l[0].title,
|
|
75
|
+
className: "dial-tiny-text text-secondary"
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ e("span", { className: t.value, children: l[0].value })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-px flex-shrink-0 bg-controls-disable-accent" }),
|
|
81
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
82
|
+
/* @__PURE__ */ e(
|
|
83
|
+
m,
|
|
84
|
+
{
|
|
85
|
+
text: l[1].title,
|
|
86
|
+
className: "dial-tiny-text text-secondary"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ e("span", { className: t.value, children: l[1].value })
|
|
90
|
+
] })
|
|
91
|
+
] }) : /* @__PURE__ */ e("span", { className: t.value, children: p }),
|
|
92
|
+
!r && !n && t.showDescription && i != null && i !== !1 && /* @__PURE__ */ e("span", { className: "dial-tiny-text text-secondary", children: i })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
_ as AnalyticsCard
|
|
99
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_ANALYTICS_BAR_COLOR_MAP as Y } from "../../../Analytics/Bar/utils.js";
|
|
3
|
+
import { DIAL_KIT_CLASS as k } from "../../../../constants/public-class-names.js";
|
|
4
|
+
import { Spinner as P } from "../../../Spinner/Spinner.js";
|
|
5
|
+
import { TooltipPlacement as w } from "../../../../types/tooltip.js";
|
|
6
|
+
import { Tooltip as A } from "../../Tooltip/Tooltip.js";
|
|
7
|
+
import { mergeClasses as H } from "../../../../utils/merge-classes.js";
|
|
8
|
+
import { buildHistogramColumns as T, formatHistogramColumnLabel as L, getHistogramYTicks as O, getHistogramYMax as R } from "../../../Analytics/Histogram/utils.js";
|
|
9
|
+
const u = 128, D = (s, i) => {
|
|
10
|
+
const l = L(s, i);
|
|
11
|
+
return s === i ? `scored ${l}` : `scored between ${l}`;
|
|
12
|
+
}, _ = (s, i, l, o, c) => /* @__PURE__ */ n("div", { className: "flex flex-col gap-0.5", children: [
|
|
13
|
+
s && /* @__PURE__ */ t("strong", { children: s }),
|
|
14
|
+
/* @__PURE__ */ n("span", { children: [
|
|
15
|
+
i,
|
|
16
|
+
" out of ",
|
|
17
|
+
l,
|
|
18
|
+
" ",
|
|
19
|
+
o
|
|
20
|
+
] }),
|
|
21
|
+
/* @__PURE__ */ t("span", { children: D(c.from, c.to) })
|
|
22
|
+
] }), q = ({
|
|
23
|
+
title: s,
|
|
24
|
+
values: i,
|
|
25
|
+
colorMap: l = Y,
|
|
26
|
+
valueTitle: o = "values",
|
|
27
|
+
showCount: c,
|
|
28
|
+
isLoading: S,
|
|
29
|
+
className: I,
|
|
30
|
+
compareValues: h,
|
|
31
|
+
valueSetLabel: j,
|
|
32
|
+
compareValueSetLabel: B
|
|
33
|
+
}) => {
|
|
34
|
+
const M = T(i, l), y = h ? T(h, l) : void 0, d = i.length, p = h?.length ?? 0, N = Math.max(d, p), b = R(N), m = O(N), v = (e) => e.map((r) => ({
|
|
35
|
+
...r,
|
|
36
|
+
ratio: b > 0 ? r.count / b : 0
|
|
37
|
+
})), f = v(M), $ = y ? v(y) : void 0, C = (e, r, a, x) => {
|
|
38
|
+
if (e.count === 0)
|
|
39
|
+
return /* @__PURE__ */ t("div", { className: "flex h-full flex-1 items-end", "aria-hidden": "true", children: /* @__PURE__ */ t(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: "min-h-2 w-full rounded-xs",
|
|
43
|
+
style: { height: `${e.ratio * 100}%` }
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
const g = x ? {
|
|
47
|
+
backgroundImage: `repeating-linear-gradient(135deg, ${e.color} 0px, ${e.color} 1px, transparent 1px, transparent 4px)`,
|
|
48
|
+
borderColor: e.color
|
|
49
|
+
} : { backgroundColor: e.color };
|
|
50
|
+
return /* @__PURE__ */ t(
|
|
51
|
+
A,
|
|
52
|
+
{
|
|
53
|
+
placement: w.Bottom,
|
|
54
|
+
tooltip: r,
|
|
55
|
+
triggerClassName: "flex h-full flex-1 items-end",
|
|
56
|
+
children: /* @__PURE__ */ t(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
role: "img",
|
|
60
|
+
"aria-label": a,
|
|
61
|
+
className: "flex min-h-2 w-full items-center justify-center rounded-xs border border-transparent",
|
|
62
|
+
style: { height: `${e.ratio * 100}%`, ...g },
|
|
63
|
+
children: c && /* @__PURE__ */ t("span", { className: "dial-tiny-semi-text text-primary", children: e.count })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ n(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: H(
|
|
73
|
+
"flex flex-col gap-2",
|
|
74
|
+
I,
|
|
75
|
+
k.analyticsHistogram
|
|
76
|
+
),
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ t("span", { className: "dial-small-text text-primary", children: s }),
|
|
79
|
+
S ? /* @__PURE__ */ t(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "flex items-center justify-center",
|
|
83
|
+
style: { height: u },
|
|
84
|
+
children: /* @__PURE__ */ t(P, { size: 18, fullWidth: !1 })
|
|
85
|
+
}
|
|
86
|
+
) : /* @__PURE__ */ n("div", { className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1", children: [
|
|
87
|
+
/* @__PURE__ */ t(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
"data-histogram-y-axis": !0,
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
className: "relative",
|
|
93
|
+
style: { height: u },
|
|
94
|
+
children: m.map((e, r) => /* @__PURE__ */ t(
|
|
95
|
+
"span",
|
|
96
|
+
{
|
|
97
|
+
className: "dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",
|
|
98
|
+
style: {
|
|
99
|
+
top: `${r / (m.length - 1) * 100}%`,
|
|
100
|
+
transform: "translateY(-50%)"
|
|
101
|
+
},
|
|
102
|
+
children: e
|
|
103
|
+
},
|
|
104
|
+
e
|
|
105
|
+
))
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ n("div", { className: "relative min-w-0", children: [
|
|
109
|
+
m.map((e, r) => /* @__PURE__ */ t(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
"data-histogram-grid": !0,
|
|
113
|
+
className: "pointer-events-none absolute inset-x-0 border-t border-primary",
|
|
114
|
+
style: { top: `${r / (m.length - 1) * 100}%` }
|
|
115
|
+
},
|
|
116
|
+
e
|
|
117
|
+
)),
|
|
118
|
+
/* @__PURE__ */ t(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
className: "relative flex items-end gap-1",
|
|
122
|
+
style: { height: u },
|
|
123
|
+
children: $ ? f.map((e, r) => {
|
|
124
|
+
const a = $[r], x = `${e.count} out of ${d} ${o}`, g = `${a.count} out of ${p} ${o}`;
|
|
125
|
+
return /* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-end", children: [
|
|
126
|
+
C(
|
|
127
|
+
e,
|
|
128
|
+
_(
|
|
129
|
+
j,
|
|
130
|
+
e.count,
|
|
131
|
+
d,
|
|
132
|
+
o,
|
|
133
|
+
e
|
|
134
|
+
),
|
|
135
|
+
x,
|
|
136
|
+
!0
|
|
137
|
+
),
|
|
138
|
+
C(
|
|
139
|
+
a,
|
|
140
|
+
_(
|
|
141
|
+
B,
|
|
142
|
+
a.count,
|
|
143
|
+
p,
|
|
144
|
+
o,
|
|
145
|
+
a
|
|
146
|
+
),
|
|
147
|
+
g,
|
|
148
|
+
!1
|
|
149
|
+
)
|
|
150
|
+
] }, r);
|
|
151
|
+
}) : f.map((e, r) => {
|
|
152
|
+
const a = `${e.count} out of ${d} ${o}`;
|
|
153
|
+
return e.count === 0 ? /* @__PURE__ */ t(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
className: "flex h-full flex-1 items-end",
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
children: /* @__PURE__ */ t(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
className: "min-h-2 w-full rounded-xs",
|
|
162
|
+
style: { height: `${e.ratio * 100}%` }
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
},
|
|
166
|
+
r
|
|
167
|
+
) : /* @__PURE__ */ t(
|
|
168
|
+
A,
|
|
169
|
+
{
|
|
170
|
+
placement: w.Bottom,
|
|
171
|
+
tooltip: a,
|
|
172
|
+
triggerClassName: "flex h-full flex-1 items-end",
|
|
173
|
+
children: /* @__PURE__ */ t(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
role: "img",
|
|
177
|
+
"aria-label": a,
|
|
178
|
+
className: H(
|
|
179
|
+
"flex min-h-2 w-full items-center justify-center rounded-xs border",
|
|
180
|
+
"border-transparent"
|
|
181
|
+
),
|
|
182
|
+
style: {
|
|
183
|
+
height: `${e.ratio * 100}%`,
|
|
184
|
+
backgroundColor: e.color
|
|
185
|
+
},
|
|
186
|
+
children: c && e.count > 0 && /* @__PURE__ */ t("span", { className: "dial-tiny-semi-text text-primary", children: e.count })
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
},
|
|
190
|
+
r
|
|
191
|
+
);
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
] }),
|
|
196
|
+
/* @__PURE__ */ t("div", {}),
|
|
197
|
+
/* @__PURE__ */ t("div", { "data-histogram-x-axis": !0, className: "flex gap-1", children: f.map((e, r) => /* @__PURE__ */ t(
|
|
198
|
+
"span",
|
|
199
|
+
{
|
|
200
|
+
className: "dial-caption-text flex-1 text-center text-secondary",
|
|
201
|
+
children: L(e.from, e.to)
|
|
202
|
+
},
|
|
203
|
+
r
|
|
204
|
+
)) })
|
|
205
|
+
] })
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
export {
|
|
211
|
+
q as AnalyticsHistogram
|
|
212
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { EllipsisTooltip as p } from "../EllipsisTooltip/EllipsisTooltip.js";
|
|
3
|
+
import { Label as x } from "../Label/Label.js";
|
|
4
|
+
import { DIAL_KIT_CLASS as f } from "../../../constants/public-class-names.js";
|
|
5
|
+
import { mergeClasses as n } from "../../../utils/merge-classes.js";
|
|
6
|
+
const b = ({
|
|
7
|
+
label: s,
|
|
8
|
+
text: l,
|
|
9
|
+
tooltip: t,
|
|
10
|
+
children: e,
|
|
11
|
+
postfix: a,
|
|
12
|
+
className: r
|
|
13
|
+
}) => {
|
|
14
|
+
const i = !!e || l != null;
|
|
15
|
+
return /* @__PURE__ */ m(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: n(
|
|
19
|
+
"flex flex-col gap-1",
|
|
20
|
+
!e && "max-w-[200px]",
|
|
21
|
+
r,
|
|
22
|
+
f.labelledText
|
|
23
|
+
),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ o(x, { label: s }),
|
|
26
|
+
i && /* @__PURE__ */ m("div", { className: "flex min-w-0 items-center gap-2 text-primary", children: [
|
|
27
|
+
e ?? /* @__PURE__ */ o(
|
|
28
|
+
p,
|
|
29
|
+
{
|
|
30
|
+
text: l,
|
|
31
|
+
customTooltipContent: t,
|
|
32
|
+
className: "dial-small-text min-w-0 flex-1"
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
!e && a
|
|
36
|
+
] })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
b as LabelledText
|
|
43
|
+
};
|