@epam/ai-dial-ui-kit 0.16.0-dev.47 → 0.16.0-dev.49
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 +2 -0
- package/dist/CHANGELOG.md +3 -0
- package/dist/{DateCellRenderer-uqWWm9rI.cjs → DateCellRenderer-C3KzulHA.cjs} +2 -2
- package/dist/components/New/Analytics/Bar/Bar.js +7 -7
- package/dist/components/New/Analytics/BarGroup/BarGroup.js +4 -4
- package/dist/components/New/Analytics/Histogram/Histogram.js +12 -12
- package/dist/components/New/LabelledText/LabelledText.js +43 -0
- package/dist/components/New/Steps/Steps.js +84 -0
- package/dist/components-manifest.json +227 -551
- package/dist/constants/public-class-names.js +4 -0
- package/dist/dial-ui-kit.cjs +3 -3
- package/dist/dial-ui-kit.js +374 -382
- package/dist/grid.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/migration-guides/0.16.0/legacy-analytics-and-steps-removal.md +54 -0
- package/dist/migration-guides/README.md +1 -0
- package/dist/src/components/{Analytics → New/Analytics}/Bar/utils.d.ts +1 -1
- package/dist/src/components/{Analytics → New/Analytics}/Histogram/utils.d.ts +1 -1
- package/dist/src/components/New/Analytics/index.d.ts +11 -0
- package/dist/src/components/New/LabelledText/LabelledText.d.ts +48 -0
- package/dist/src/components/New/Steps/Steps.d.ts +55 -0
- package/dist/src/constants/public-class-names.d.ts +4 -0
- package/dist/src/index.d.ts +7 -14
- package/package.json +1 -1
- package/dist/components/Analytics/Bar/Bar.js +0 -80
- package/dist/components/Analytics/BarGroup/BarGroup.js +0 -142
- package/dist/components/Analytics/Card/Card.js +0 -87
- package/dist/components/Analytics/ErrorTag/ErrorTag.js +0 -19
- package/dist/components/Analytics/Histogram/Histogram.js +0 -200
- package/dist/components/Steps/Step.js +0 -34
- package/dist/components/Steps/Steps.js +0 -27
- package/dist/components/Steps/utils.js +0 -42
- package/dist/src/components/Analytics/Bar/Bar.d.ts +0 -86
- package/dist/src/components/Analytics/BarGroup/BarGroup.d.ts +0 -103
- package/dist/src/components/Analytics/Card/Card.d.ts +0 -91
- package/dist/src/components/Analytics/ErrorTag/ErrorTag.d.ts +0 -22
- package/dist/src/components/Analytics/Histogram/Histogram.d.ts +0 -59
- package/dist/src/components/Analytics/index.d.ts +0 -13
- package/dist/src/components/Steps/Step.d.ts +0 -9
- package/dist/src/components/Steps/Steps.d.ts +0 -26
- package/dist/src/components/Steps/utils.d.ts +0 -3
- /package/dist/components/{Analytics → New/Analytics}/Bar/utils.js +0 -0
- /package/dist/components/{Analytics → New/Analytics}/Histogram/utils.js +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Step, StepStatus } from '../../../models/step';
|
|
3
|
+
export interface StepsProps {
|
|
4
|
+
/** Ordered steps to render. */
|
|
5
|
+
steps: Step[];
|
|
6
|
+
/** `id` of the active step. */
|
|
7
|
+
currentStep: string;
|
|
8
|
+
/** Fired with the `id` of the step the user may move to. */
|
|
9
|
+
onChangeStep: (step: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Already-translated text announced for a step's status, appended to the
|
|
12
|
+
* step's accessible name. Defaults to `'Completed'` / `'Error'`.
|
|
13
|
+
*/
|
|
14
|
+
statusLabels?: Partial<Record<StepStatus, string>>;
|
|
15
|
+
/** Accessible name for the list of steps. */
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
/** Additional CSS classes for the root element. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A row of numbered steps for a multi-step flow, marking the active one and
|
|
22
|
+
* flagging completed and failed steps.
|
|
23
|
+
* aliases: StepWizard|ProgressSteps|Stepper
|
|
24
|
+
* Design system 2.0
|
|
25
|
+
*
|
|
26
|
+
* A step's number turns into a check once it is completed and the user has moved
|
|
27
|
+
* on, and into an alert icon while a failed step is the active one. A step can
|
|
28
|
+
* only be entered when every step before it is `StepStatus.VALID`; going back is
|
|
29
|
+
* always allowed.
|
|
30
|
+
*
|
|
31
|
+
* The list is an ordered list, the active step carries `aria-current="step"`,
|
|
32
|
+
* and a completed or failed step announces its status after its name.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Steps
|
|
37
|
+
* ariaLabel="Create deployment"
|
|
38
|
+
* steps={[
|
|
39
|
+
* { id: 'general', name: 'General', status: StepStatus.VALID },
|
|
40
|
+
* { id: 'limits', name: 'Limits', status: StepStatus.ERROR },
|
|
41
|
+
* { id: 'review', name: 'Review' },
|
|
42
|
+
* ]}
|
|
43
|
+
* currentStep="general"
|
|
44
|
+
* onChangeStep={setCurrentStep}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param steps - Ordered steps to render.
|
|
49
|
+
* @param currentStep - `id` of the active step.
|
|
50
|
+
* @param onChangeStep - Fired with the `id` of the step the user may move to.
|
|
51
|
+
* @param [statusLabels] - Translated status text announced after a step's name.
|
|
52
|
+
* @param [ariaLabel] - Accessible name for the list of steps.
|
|
53
|
+
* @param [className] - Additional CSS classes for the root element.
|
|
54
|
+
*/
|
|
55
|
+
export declare const Steps: FC<StepsProps>;
|
|
@@ -32,6 +32,10 @@ export declare const DIAL_KIT_CLASS: {
|
|
|
32
32
|
readonly errorText: "dial-kit-error-text";
|
|
33
33
|
/** The `Label` root, which wraps the `label` element and its info button. */
|
|
34
34
|
readonly label: "dial-kit-label";
|
|
35
|
+
/** The root of a `LabelledText`, wrapping its caption and value. */
|
|
36
|
+
readonly labelledText: "dial-kit-labelled-text";
|
|
37
|
+
/** The `ol` root of a `Steps`, holding one button per step. */
|
|
38
|
+
readonly steps: "dial-kit-steps";
|
|
35
39
|
/** The root of an `AnalyticsCard`: the box holding its title, value and description. */
|
|
36
40
|
readonly analyticsCard: "dial-kit-analytics-card";
|
|
37
41
|
/** The root of an `AnalyticsBar`: the title row and track, stacked or inline. */
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
export { DialCaptionText, DialErrorText, } from './components/CaptionText/CaptionText';
|
|
2
|
-
export { DialAnalyticsCard } from './components/Analytics';
|
|
3
|
-
export type { DialAnalyticsCardProps } from './components/Analytics';
|
|
4
|
-
export { AnalyticsCardVariant } from './types/analytics';
|
|
5
|
-
export { DialAnalyticsBar } from './components/Analytics';
|
|
6
|
-
export type { DialAnalyticsBarProps } from './components/Analytics';
|
|
7
|
-
export { DEFAULT_ANALYTICS_BAR_COLOR_MAP } from './components/Analytics';
|
|
8
|
-
export type { AnalyticsBarColorStop, AnalyticsCardCompareItem, } from './models/analytics';
|
|
9
|
-
export { DialAnalyticsErrorTag } from './components/Analytics';
|
|
10
|
-
export type { DialAnalyticsErrorTagProps } from './components/Analytics';
|
|
11
|
-
export { DialAnalyticsBarGroup } from './components/Analytics';
|
|
12
|
-
export type { DialAnalyticsBarGroupProps } from './components/Analytics';
|
|
13
|
-
export { DialAnalyticsHistogram } from './components/Analytics';
|
|
14
|
-
export type { DialAnalyticsHistogramProps } from './components/Analytics';
|
|
15
2
|
export { DialLabel } from './components/Label/Label';
|
|
16
3
|
export { DialAccordion } from './components/Accordion/Accordion';
|
|
17
4
|
export type { DialAccordionProps } from './components/Accordion/Accordion';
|
|
@@ -21,7 +8,6 @@ export { Spinner } from './components/Spinner/Spinner';
|
|
|
21
8
|
export type { SpinnerProps } from './components/Spinner/Spinner';
|
|
22
9
|
export { ProgressBar } from './components/ProgressBar/ProgressBar';
|
|
23
10
|
export type { ProgressBarProps } from './components/ProgressBar/ProgressBar';
|
|
24
|
-
export { DialSteps } from './components/Steps/Steps';
|
|
25
11
|
export { DialNoDataContent } from './components/NoDataContent/NoDataContent';
|
|
26
12
|
export type { DialNoDataContentProps } from './components/NoDataContent/NoDataContent';
|
|
27
13
|
export { DialLabelledText } from './components/LabelledText/LabelledText';
|
|
@@ -124,15 +110,22 @@ export type { MultiSelectTagsProps } from './components/New/Select/MultiSelectTa
|
|
|
124
110
|
export { InfoButton } from './components/New/InfoButton/InfoButton';
|
|
125
111
|
export type { InfoButtonProps } from './components/New/InfoButton/InfoButton';
|
|
126
112
|
export type { LabelProps } from './components/New/Label/Label';
|
|
113
|
+
export { Steps } from './components/New/Steps/Steps';
|
|
114
|
+
export type { StepsProps } from './components/New/Steps/Steps';
|
|
127
115
|
export { AnalyticsCard } from './components/New/Analytics/Card/Card';
|
|
128
116
|
export type { AnalyticsCardProps } from './components/New/Analytics/Card/Card';
|
|
117
|
+
export { AnalyticsCardVariant } from './types/analytics';
|
|
129
118
|
export { AnalyticsBar } from './components/New/Analytics/Bar/Bar';
|
|
130
119
|
export type { AnalyticsBarProps } from './components/New/Analytics/Bar/Bar';
|
|
120
|
+
export { DEFAULT_ANALYTICS_BAR_COLOR_MAP } from './components/New/Analytics/Bar/utils';
|
|
121
|
+
export type { AnalyticsBarColorStop, AnalyticsCardCompareItem, } from './models/analytics';
|
|
131
122
|
export { AnalyticsBarGroup } from './components/New/Analytics/BarGroup/BarGroup';
|
|
132
123
|
export type { AnalyticsBarGroupProps } from './components/New/Analytics/BarGroup/BarGroup';
|
|
133
124
|
export { AnalyticsHistogram } from './components/New/Analytics/Histogram/Histogram';
|
|
134
125
|
export type { AnalyticsHistogramProps } from './components/New/Analytics/Histogram/Histogram';
|
|
135
126
|
export { Label } from './components/New/Label/Label';
|
|
127
|
+
export type { LabelledTextProps } from './components/New/LabelledText/LabelledText';
|
|
128
|
+
export { LabelledText } from './components/New/LabelledText/LabelledText';
|
|
136
129
|
export { Textarea, TextareaResize } from './components/New/Textarea/Textarea';
|
|
137
130
|
export { Input } from './components/New/Input/Input';
|
|
138
131
|
export type { InputProps } from './components/New/Input/Input';
|
package/package.json
CHANGED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx as l, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import { DialAnalyticsErrorTag as C } from "../ErrorTag/ErrorTag.js";
|
|
3
|
-
import { DialLoader as D } from "../../Loader/Loader.js";
|
|
4
|
-
import { mergeClasses as r } from "../../../utils/merge-classes.js";
|
|
5
|
-
import { getAnalyticsBarColor as T, DEFAULT_ANALYTICS_BAR_COLOR_MAP as _, getAnalyticsBarRatio as j } from "./utils.js";
|
|
6
|
-
const L = ({
|
|
7
|
-
value: a,
|
|
8
|
-
maxValue: c = 1,
|
|
9
|
-
error: e,
|
|
10
|
-
isLoading: s,
|
|
11
|
-
title: i,
|
|
12
|
-
valueLabel: p,
|
|
13
|
-
colorMap: u = _,
|
|
14
|
-
className: m,
|
|
15
|
-
titleClassName: w,
|
|
16
|
-
valueClassName: y,
|
|
17
|
-
inline: o,
|
|
18
|
-
ariaLabel: v
|
|
19
|
-
}) => {
|
|
20
|
-
const n = a == null, N = !!(e || s || !n), d = j(n ? 0 : a, c), b = T(d, u), g = p ?? (n ? "—" : a), A = v ?? (typeof i == "string" ? i : void 0), B = e || s, f = e ? /* @__PURE__ */ l(C, {}) : s ? /* @__PURE__ */ l(D, { fullWidth: !1 }) : /* @__PURE__ */ l(
|
|
21
|
-
"span",
|
|
22
|
-
{
|
|
23
|
-
className: r(
|
|
24
|
-
"shrink-0 tabular-nums text-end",
|
|
25
|
-
o ? "dial-small-text min-w-[5ch] text-primary" : "dial-small-semi-text text-primary",
|
|
26
|
-
y
|
|
27
|
-
),
|
|
28
|
-
children: g
|
|
29
|
-
}
|
|
30
|
-
), h = N ? /* @__PURE__ */ l(
|
|
31
|
-
"div",
|
|
32
|
-
{
|
|
33
|
-
role: "progressbar",
|
|
34
|
-
"aria-valuenow": e || s || typeof a != "number" ? void 0 : a,
|
|
35
|
-
"aria-valuemin": 0,
|
|
36
|
-
"aria-valuemax": c,
|
|
37
|
-
"aria-label": A,
|
|
38
|
-
className: r(
|
|
39
|
-
"w-full overflow-hidden rounded-xs",
|
|
40
|
-
o ? "h-1" : "h-2",
|
|
41
|
-
e ? "bg-error" : "bg-layer-1"
|
|
42
|
-
),
|
|
43
|
-
children: !B && /* @__PURE__ */ l(
|
|
44
|
-
"div",
|
|
45
|
-
{
|
|
46
|
-
className: "h-full rounded-xs transition-[width] duration-300",
|
|
47
|
-
style: { width: `${d * 100}%`, backgroundColor: b }
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
) : null, x = /* @__PURE__ */ l(
|
|
52
|
-
"span",
|
|
53
|
-
{
|
|
54
|
-
className: r("dial-small-text text-primary", w),
|
|
55
|
-
children: i
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
return o ? /* @__PURE__ */ t(
|
|
59
|
-
"div",
|
|
60
|
-
{
|
|
61
|
-
className: r("flex flex-row items-center gap-2", m),
|
|
62
|
-
children: [
|
|
63
|
-
/* @__PURE__ */ l("div", { className: "w-1/2 min-w-0", children: x }),
|
|
64
|
-
/* @__PURE__ */ t("div", { className: "flex w-1/2 flex-row items-center gap-2", children: [
|
|
65
|
-
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: h }),
|
|
66
|
-
f
|
|
67
|
-
] })
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
) : /* @__PURE__ */ t("div", { className: r("flex flex-col gap-1", m), children: [
|
|
71
|
-
/* @__PURE__ */ t("div", { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
72
|
-
x,
|
|
73
|
-
f
|
|
74
|
-
] }),
|
|
75
|
-
h
|
|
76
|
-
] });
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
L as DialAnalyticsBar
|
|
80
|
-
};
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as f, Fragment as J } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment as Q } from "react";
|
|
3
|
-
import { DialAccordion as R } from "../../Accordion/Accordion.js";
|
|
4
|
-
import { DialAnalyticsBar as b } from "../Bar/Bar.js";
|
|
5
|
-
import { DialLoader as U } from "../../Loader/Loader.js";
|
|
6
|
-
import { DialTooltip as x } from "../../Tooltip/Tooltip.js";
|
|
7
|
-
import { mergeClasses as i } from "../../../utils/merge-classes.js";
|
|
8
|
-
const k = ({
|
|
9
|
-
title: g,
|
|
10
|
-
titleTooltip: h,
|
|
11
|
-
description: S,
|
|
12
|
-
data: a,
|
|
13
|
-
compareData: r,
|
|
14
|
-
compareLabels: m,
|
|
15
|
-
maxValue: p,
|
|
16
|
-
colorMap: d,
|
|
17
|
-
defaultExpanded: E = !0,
|
|
18
|
-
nonCollapsible: G,
|
|
19
|
-
isLoading: K,
|
|
20
|
-
onBarClick: o,
|
|
21
|
-
inline: c,
|
|
22
|
-
barTitleClassName: N,
|
|
23
|
-
barValueClassName: P,
|
|
24
|
-
barClassName: v,
|
|
25
|
-
barDescriptions: C,
|
|
26
|
-
className: T
|
|
27
|
-
}) => {
|
|
28
|
-
const W = Object.entries(a), q = c ? i("text-secondary", N) : N, j = m ? "dial-tiny-text text-secondary" : void 0, z = h ? /* @__PURE__ */ t(x, { tooltip: h, children: g }) : g, H = r ? [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(r)])] : [], y = "cursor-pointer rounded-xs text-left focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-primary", F = "group flex flex-col gap-1.5", I = i(
|
|
29
|
-
"flex flex-col gap-1.5 pl-2",
|
|
30
|
-
o && "group-hover:bg-accent-primary-alpha group-focus-visible:bg-accent-primary-alpha",
|
|
31
|
-
v
|
|
32
|
-
);
|
|
33
|
-
return /* @__PURE__ */ t(
|
|
34
|
-
R,
|
|
35
|
-
{
|
|
36
|
-
title: z,
|
|
37
|
-
description: S,
|
|
38
|
-
defaultExpanded: E,
|
|
39
|
-
nonCollapsible: G,
|
|
40
|
-
className: T,
|
|
41
|
-
children: /* @__PURE__ */ t(
|
|
42
|
-
"div",
|
|
43
|
-
{
|
|
44
|
-
className: i(
|
|
45
|
-
"flex flex-col",
|
|
46
|
-
r ? "gap-4" : c ? "gap-2" : "gap-3"
|
|
47
|
-
),
|
|
48
|
-
children: K ? /* @__PURE__ */ t(U, { fullWidth: !1, className: "self-center" }) : r ? H.map((e) => {
|
|
49
|
-
const l = e in a ? a[e] : null, n = e in r ? r[e] : null, s = typeof l == "number" && typeof n == "number" ? parseFloat((n - l).toFixed(3)) : null, L = s != null && s !== 0, A = L && s > 0, D = L ? A ? `+${s}` : String(s) : null, O = C?.[e], $ = /* @__PURE__ */ t("span", { className: "dial-small-text text-secondary", children: e }), w = /* @__PURE__ */ f(J, { children: [
|
|
50
|
-
/* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
|
|
51
|
-
O ? /* @__PURE__ */ t(x, { tooltip: O, children: $ }) : $,
|
|
52
|
-
D != null && /* @__PURE__ */ t(
|
|
53
|
-
"span",
|
|
54
|
-
{
|
|
55
|
-
className: i(
|
|
56
|
-
"dial-tiny-semi-text rounded-[120px] border border-transparent px-2",
|
|
57
|
-
A ? "bg-success text-success" : "bg-error text-error"
|
|
58
|
-
),
|
|
59
|
-
children: D
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
] }),
|
|
63
|
-
/* @__PURE__ */ f("div", { className: I, children: [
|
|
64
|
-
/* @__PURE__ */ t(
|
|
65
|
-
b,
|
|
66
|
-
{
|
|
67
|
-
title: m?.[0],
|
|
68
|
-
value: l,
|
|
69
|
-
maxValue: p,
|
|
70
|
-
colorMap: d,
|
|
71
|
-
inline: c,
|
|
72
|
-
titleClassName: j,
|
|
73
|
-
ariaLabel: e
|
|
74
|
-
}
|
|
75
|
-
),
|
|
76
|
-
/* @__PURE__ */ t(
|
|
77
|
-
b,
|
|
78
|
-
{
|
|
79
|
-
title: m?.[1],
|
|
80
|
-
value: n,
|
|
81
|
-
maxValue: p,
|
|
82
|
-
colorMap: d,
|
|
83
|
-
inline: c,
|
|
84
|
-
titleClassName: j,
|
|
85
|
-
ariaLabel: `${e} compare`
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
] })
|
|
89
|
-
] });
|
|
90
|
-
return o ? /* @__PURE__ */ t(
|
|
91
|
-
"button",
|
|
92
|
-
{
|
|
93
|
-
type: "button",
|
|
94
|
-
onClick: () => o(e, l),
|
|
95
|
-
className: i(
|
|
96
|
-
F,
|
|
97
|
-
y
|
|
98
|
-
),
|
|
99
|
-
children: w
|
|
100
|
-
},
|
|
101
|
-
e
|
|
102
|
-
) : /* @__PURE__ */ t("div", { className: F, children: w }, e);
|
|
103
|
-
}) : W.map(([e, l]) => {
|
|
104
|
-
const n = /* @__PURE__ */ t(
|
|
105
|
-
b,
|
|
106
|
-
{
|
|
107
|
-
title: e,
|
|
108
|
-
value: l,
|
|
109
|
-
maxValue: p,
|
|
110
|
-
colorMap: d,
|
|
111
|
-
inline: c,
|
|
112
|
-
titleClassName: q,
|
|
113
|
-
valueClassName: P,
|
|
114
|
-
className: v
|
|
115
|
-
}
|
|
116
|
-
), u = o ? /* @__PURE__ */ t(
|
|
117
|
-
"button",
|
|
118
|
-
{
|
|
119
|
-
type: "button",
|
|
120
|
-
onClick: () => o(e, l),
|
|
121
|
-
className: y,
|
|
122
|
-
children: n
|
|
123
|
-
}
|
|
124
|
-
) : n, s = C?.[e];
|
|
125
|
-
return s ? /* @__PURE__ */ t(
|
|
126
|
-
x,
|
|
127
|
-
{
|
|
128
|
-
tooltip: s,
|
|
129
|
-
triggerClassName: "flex flex-col",
|
|
130
|
-
children: u
|
|
131
|
-
},
|
|
132
|
-
e
|
|
133
|
-
) : /* @__PURE__ */ t(Q, { children: u }, e);
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
};
|
|
140
|
-
export {
|
|
141
|
-
k as DialAnalyticsBarGroup
|
|
142
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { DialAnalyticsErrorTag as u } from "../ErrorTag/ErrorTag.js";
|
|
3
|
-
import { DialEllipsisTooltip as m } from "../../EllipsisTooltip/EllipsisTooltip.js";
|
|
4
|
-
import { DialLoader as g } from "../../Loader/Loader.js";
|
|
5
|
-
import { AnalyticsCardVariant as c } from "../../../types/analytics.js";
|
|
6
|
-
import { mergeClasses as x } from "../../../utils/merge-classes.js";
|
|
7
|
-
const b = {
|
|
8
|
-
[c.Default]: {
|
|
9
|
-
container: "bg-layer-3",
|
|
10
|
-
title: "dial-small-text text-secondary",
|
|
11
|
-
value: "dial-display2-text text-primary",
|
|
12
|
-
showDescription: !0
|
|
13
|
-
},
|
|
14
|
-
[c.Compact]: {
|
|
15
|
-
container: "bg-layer-2",
|
|
16
|
-
title: "dial-tiny-text text-secondary",
|
|
17
|
-
value: "dial-body-semi-text text-primary",
|
|
18
|
-
showDescription: !1
|
|
19
|
-
}
|
|
20
|
-
}, E = ({
|
|
21
|
-
title: o,
|
|
22
|
-
value: p,
|
|
23
|
-
description: i,
|
|
24
|
-
variant: f = c.Default,
|
|
25
|
-
error: r,
|
|
26
|
-
isLoading: n,
|
|
27
|
-
className: y,
|
|
28
|
-
delta: t,
|
|
29
|
-
deltaPositive: d,
|
|
30
|
-
deltaUnit: h,
|
|
31
|
-
compareValues: l
|
|
32
|
-
}) => {
|
|
33
|
-
const a = b[f], v = d !== void 0 ? d : (t ?? 0) >= 0, N = t === void 0 ? null : `${t >= 0 ? `+${t}` : String(t)}${h ?? ""}`;
|
|
34
|
-
return /* @__PURE__ */ s(
|
|
35
|
-
"div",
|
|
36
|
-
{
|
|
37
|
-
className: x(
|
|
38
|
-
"flex flex-col rounded-lg border border-secondary p-4",
|
|
39
|
-
r || n ? "gap-2" : "gap-1",
|
|
40
|
-
a.container,
|
|
41
|
-
y
|
|
42
|
-
),
|
|
43
|
-
children: [
|
|
44
|
-
t !== void 0 ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
45
|
-
/* @__PURE__ */ e("span", { className: a.title, children: o }),
|
|
46
|
-
/* @__PURE__ */ e(
|
|
47
|
-
"span",
|
|
48
|
-
{
|
|
49
|
-
className: x(
|
|
50
|
-
"dial-tiny-semi-text rounded-[120px] border border-transparent px-2",
|
|
51
|
-
v ? "bg-success text-success" : "bg-error text-error"
|
|
52
|
-
),
|
|
53
|
-
children: N
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
] }) : /* @__PURE__ */ e("span", { className: a.title, children: o }),
|
|
57
|
-
r ? /* @__PURE__ */ e(u, { className: "self-start" }) : n ? /* @__PURE__ */ e(g, { fullWidth: !1, className: "self-start" }) : l ? /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
58
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
59
|
-
/* @__PURE__ */ e(
|
|
60
|
-
m,
|
|
61
|
-
{
|
|
62
|
-
text: l[0].title,
|
|
63
|
-
className: "dial-tiny-text text-secondary"
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
/* @__PURE__ */ e("span", { className: a.value, children: l[0].value })
|
|
67
|
-
] }),
|
|
68
|
-
/* @__PURE__ */ e("div", { className: "h-4 w-px flex-shrink-0 bg-controls-disable-accent" }),
|
|
69
|
-
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
70
|
-
/* @__PURE__ */ e(
|
|
71
|
-
m,
|
|
72
|
-
{
|
|
73
|
-
text: l[1].title,
|
|
74
|
-
className: "dial-tiny-text text-secondary"
|
|
75
|
-
}
|
|
76
|
-
),
|
|
77
|
-
/* @__PURE__ */ e("span", { className: a.value, children: l[1].value })
|
|
78
|
-
] })
|
|
79
|
-
] }) : /* @__PURE__ */ e("span", { className: a.value, children: p }),
|
|
80
|
-
!r && !n && a.showDescription && i != null && i !== !1 && /* @__PURE__ */ e("span", { className: "dial-tiny-text text-secondary", children: i })
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
export {
|
|
86
|
-
E as DialAnalyticsCard
|
|
87
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { DialTag as t } from "../../Tag/Tag.js";
|
|
3
|
-
import { mergeClasses as a } from "../../../utils/merge-classes.js";
|
|
4
|
-
const l = ({
|
|
5
|
-
label: r = "Error",
|
|
6
|
-
className: o
|
|
7
|
-
}) => /* @__PURE__ */ e(
|
|
8
|
-
t,
|
|
9
|
-
{
|
|
10
|
-
label: r,
|
|
11
|
-
className: a(
|
|
12
|
-
"dial-tiny-semi-text cursor-default rounded-[120px] border-transparent bg-error text-error",
|
|
13
|
-
o
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
export {
|
|
18
|
-
l as DialAnalyticsErrorTag
|
|
19
|
-
};
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { DEFAULT_ANALYTICS_BAR_COLOR_MAP as D } from "../Bar/utils.js";
|
|
3
|
-
import { DialLoader as I } from "../../Loader/Loader.js";
|
|
4
|
-
import { DialTooltip as w } from "../../Tooltip/Tooltip.js";
|
|
5
|
-
import { mergeClasses as H } from "../../../utils/merge-classes.js";
|
|
6
|
-
import { buildHistogramColumns as A, formatHistogramColumnLabel as _, getHistogramYTicks as S, getHistogramYMax as B } from "./utils.js";
|
|
7
|
-
const u = 128, O = (s, i) => {
|
|
8
|
-
const l = _(s, i);
|
|
9
|
-
return s === i ? `scored ${l}` : `scored between ${l}`;
|
|
10
|
-
}, T = (s, i, l, o, d) => /* @__PURE__ */ n("div", { className: "flex flex-col gap-0.5", children: [
|
|
11
|
-
s && /* @__PURE__ */ t("strong", { children: s }),
|
|
12
|
-
/* @__PURE__ */ n("span", { children: [
|
|
13
|
-
i,
|
|
14
|
-
" out of ",
|
|
15
|
-
l,
|
|
16
|
-
" ",
|
|
17
|
-
o
|
|
18
|
-
] }),
|
|
19
|
-
/* @__PURE__ */ t("span", { children: O(d.from, d.to) })
|
|
20
|
-
] }), W = ({
|
|
21
|
-
title: s,
|
|
22
|
-
values: i,
|
|
23
|
-
colorMap: l = D,
|
|
24
|
-
valueTitle: o = "values",
|
|
25
|
-
showCount: d,
|
|
26
|
-
isLoading: L,
|
|
27
|
-
className: j,
|
|
28
|
-
compareValues: h,
|
|
29
|
-
valueSetLabel: M,
|
|
30
|
-
compareValueSetLabel: Y
|
|
31
|
-
}) => {
|
|
32
|
-
const k = A(i, l), y = h ? A(h, l) : void 0, c = i.length, p = h?.length ?? 0, N = Math.max(c, p), b = B(N), m = S(N), v = (e) => e.map((r) => ({
|
|
33
|
-
...r,
|
|
34
|
-
ratio: b > 0 ? r.count / b : 0
|
|
35
|
-
})), f = v(k), $ = y ? v(y) : void 0, C = (e, r, a, x) => {
|
|
36
|
-
if (e.count === 0)
|
|
37
|
-
return /* @__PURE__ */ t("div", { className: "flex h-full flex-1 items-end", "aria-hidden": "true", children: /* @__PURE__ */ t(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
className: "min-h-2 w-full rounded-xs",
|
|
41
|
-
style: { height: `${e.ratio * 100}%` }
|
|
42
|
-
}
|
|
43
|
-
) });
|
|
44
|
-
const g = x ? {
|
|
45
|
-
backgroundImage: `repeating-linear-gradient(135deg, ${e.color} 0px, ${e.color} 1px, transparent 1px, transparent 4px)`,
|
|
46
|
-
borderColor: e.color
|
|
47
|
-
} : { backgroundColor: e.color };
|
|
48
|
-
return /* @__PURE__ */ t(
|
|
49
|
-
w,
|
|
50
|
-
{
|
|
51
|
-
placement: "bottom",
|
|
52
|
-
tooltip: r,
|
|
53
|
-
triggerClassName: "flex h-full flex-1 items-end",
|
|
54
|
-
children: /* @__PURE__ */ t(
|
|
55
|
-
"div",
|
|
56
|
-
{
|
|
57
|
-
role: "img",
|
|
58
|
-
"aria-label": a,
|
|
59
|
-
className: "flex min-h-2 w-full items-center justify-center rounded-xs border border-transparent",
|
|
60
|
-
style: { height: `${e.ratio * 100}%`, ...g },
|
|
61
|
-
children: d && /* @__PURE__ */ t("span", { className: "dial-tiny-semi-text text-primary", children: e.count })
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
return /* @__PURE__ */ n("div", { className: H("flex flex-col gap-2", j), children: [
|
|
68
|
-
/* @__PURE__ */ t("span", { className: "dial-small-text text-primary", children: s }),
|
|
69
|
-
L ? /* @__PURE__ */ t(
|
|
70
|
-
"div",
|
|
71
|
-
{
|
|
72
|
-
className: "flex items-center justify-center",
|
|
73
|
-
style: { height: u },
|
|
74
|
-
children: /* @__PURE__ */ t(I, { fullWidth: !1 })
|
|
75
|
-
}
|
|
76
|
-
) : /* @__PURE__ */ n("div", { className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1", children: [
|
|
77
|
-
/* @__PURE__ */ t(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
"data-histogram-y-axis": !0,
|
|
81
|
-
"aria-hidden": "true",
|
|
82
|
-
className: "relative",
|
|
83
|
-
style: { height: u },
|
|
84
|
-
children: m.map((e, r) => /* @__PURE__ */ t(
|
|
85
|
-
"span",
|
|
86
|
-
{
|
|
87
|
-
className: "dial-tiny-text absolute right-0 whitespace-nowrap text-secondary",
|
|
88
|
-
style: {
|
|
89
|
-
top: `${r / (m.length - 1) * 100}%`,
|
|
90
|
-
transform: "translateY(-50%)"
|
|
91
|
-
},
|
|
92
|
-
children: e
|
|
93
|
-
},
|
|
94
|
-
e
|
|
95
|
-
))
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ n("div", { className: "relative min-w-0", children: [
|
|
99
|
-
m.map((e, r) => /* @__PURE__ */ t(
|
|
100
|
-
"div",
|
|
101
|
-
{
|
|
102
|
-
"data-histogram-grid": !0,
|
|
103
|
-
className: "pointer-events-none absolute inset-x-0 border-t border-primary",
|
|
104
|
-
style: { top: `${r / (m.length - 1) * 100}%` }
|
|
105
|
-
},
|
|
106
|
-
e
|
|
107
|
-
)),
|
|
108
|
-
/* @__PURE__ */ t(
|
|
109
|
-
"div",
|
|
110
|
-
{
|
|
111
|
-
className: "relative flex items-end gap-1",
|
|
112
|
-
style: { height: u },
|
|
113
|
-
children: $ ? f.map((e, r) => {
|
|
114
|
-
const a = $[r], x = `${e.count} out of ${c} ${o}`, g = `${a.count} out of ${p} ${o}`;
|
|
115
|
-
return /* @__PURE__ */ n("div", { className: "flex h-full flex-1 items-end", children: [
|
|
116
|
-
C(
|
|
117
|
-
e,
|
|
118
|
-
T(
|
|
119
|
-
M,
|
|
120
|
-
e.count,
|
|
121
|
-
c,
|
|
122
|
-
o,
|
|
123
|
-
e
|
|
124
|
-
),
|
|
125
|
-
x,
|
|
126
|
-
!0
|
|
127
|
-
),
|
|
128
|
-
C(
|
|
129
|
-
a,
|
|
130
|
-
T(
|
|
131
|
-
Y,
|
|
132
|
-
a.count,
|
|
133
|
-
p,
|
|
134
|
-
o,
|
|
135
|
-
a
|
|
136
|
-
),
|
|
137
|
-
g,
|
|
138
|
-
!1
|
|
139
|
-
)
|
|
140
|
-
] }, r);
|
|
141
|
-
}) : f.map((e, r) => {
|
|
142
|
-
const a = `${e.count} out of ${c} ${o}`;
|
|
143
|
-
return e.count === 0 ? /* @__PURE__ */ t(
|
|
144
|
-
"div",
|
|
145
|
-
{
|
|
146
|
-
className: "flex h-full flex-1 items-end",
|
|
147
|
-
"aria-hidden": "true",
|
|
148
|
-
children: /* @__PURE__ */ t(
|
|
149
|
-
"div",
|
|
150
|
-
{
|
|
151
|
-
className: "min-h-2 w-full rounded-xs",
|
|
152
|
-
style: { height: `${e.ratio * 100}%` }
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
},
|
|
156
|
-
r
|
|
157
|
-
) : /* @__PURE__ */ t(
|
|
158
|
-
w,
|
|
159
|
-
{
|
|
160
|
-
placement: "bottom",
|
|
161
|
-
tooltip: a,
|
|
162
|
-
triggerClassName: "flex h-full flex-1 items-end",
|
|
163
|
-
children: /* @__PURE__ */ t(
|
|
164
|
-
"div",
|
|
165
|
-
{
|
|
166
|
-
role: "img",
|
|
167
|
-
"aria-label": a,
|
|
168
|
-
className: H(
|
|
169
|
-
"flex min-h-2 w-full items-center justify-center rounded-xs border",
|
|
170
|
-
"border-transparent"
|
|
171
|
-
),
|
|
172
|
-
style: {
|
|
173
|
-
height: `${e.ratio * 100}%`,
|
|
174
|
-
backgroundColor: e.color
|
|
175
|
-
},
|
|
176
|
-
children: d && e.count > 0 && /* @__PURE__ */ t("span", { className: "dial-tiny-semi-text text-primary", children: e.count })
|
|
177
|
-
}
|
|
178
|
-
)
|
|
179
|
-
},
|
|
180
|
-
r
|
|
181
|
-
);
|
|
182
|
-
})
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
] }),
|
|
186
|
-
/* @__PURE__ */ t("div", {}),
|
|
187
|
-
/* @__PURE__ */ t("div", { "data-histogram-x-axis": !0, className: "flex gap-1", children: f.map((e, r) => /* @__PURE__ */ t(
|
|
188
|
-
"span",
|
|
189
|
-
{
|
|
190
|
-
className: "dial-caption-text flex-1 text-center text-secondary",
|
|
191
|
-
children: _(e.from, e.to)
|
|
192
|
-
},
|
|
193
|
-
r
|
|
194
|
-
)) })
|
|
195
|
-
] })
|
|
196
|
-
] });
|
|
197
|
-
};
|
|
198
|
-
export {
|
|
199
|
-
W as DialAnalyticsHistogram
|
|
200
|
-
};
|