@patterninc/pattern-ui 0.0.0-main.202610072037.1ac1dcec665c → 0.0.0-main.202610080441.d12ae32dfdcb
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/dist/components/Metric/Metric.js +296 -258
- package/dist/locales/en/messages.js +1 -1
- package/dist/locales/es/messages.js +1 -1
- package/dist/locales/fr/messages.js +1 -1
- package/dist/locales/pl/messages.js +1 -1
- package/dist/locales/pseudo-LOCALE/messages.js +1 -1
- package/dist/locales/zh/messages.js +1 -1
- package/package.json +1 -1
- package/src/components/Metric/Metric.tsx +70 -40
- package/src/locales/en/messages.po +6 -0
- package/src/locales/en/messages.ts +1 -1
- package/src/locales/es/messages.po +6 -0
- package/src/locales/es/messages.ts +1 -1
- package/src/locales/fr/messages.po +6 -0
- package/src/locales/fr/messages.ts +1 -1
- package/src/locales/pl/messages.po +6 -0
- package/src/locales/pl/messages.ts +1 -1
- package/src/locales/pseudo-LOCALE/messages.po +6 -0
- package/src/locales/pseudo-LOCALE/messages.ts +1 -1
- package/src/locales/zh/messages.po +6 -0
- package/src/locales/zh/messages.ts +1 -1
|
@@ -6,14 +6,16 @@ import ArrowUpIcon from "../icons/ArrowUpIcon.js";
|
|
|
6
6
|
import DotIcon from "../icons/DotIcon.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useId } from "react";
|
|
9
10
|
import { useLingui } from "@lingui/react";
|
|
10
11
|
import { cn } from "cn";
|
|
11
12
|
import { motion } from "motion/react";
|
|
12
13
|
|
|
13
14
|
//#region src/components/Metric/Metric.tsx
|
|
14
15
|
function Metric(props) {
|
|
15
|
-
const $ = c(
|
|
16
|
+
const $ = c(131);
|
|
16
17
|
const { _: _t } = useLingui();
|
|
18
|
+
const labelId = useId();
|
|
17
19
|
let children;
|
|
18
20
|
let className;
|
|
19
21
|
let deltaDirection;
|
|
@@ -22,9 +24,11 @@ function Metric(props) {
|
|
|
22
24
|
let onSuffixHoverChange;
|
|
23
25
|
let otherProps;
|
|
24
26
|
let prefixDotColor;
|
|
27
|
+
let prefixIcon;
|
|
25
28
|
let primaryMetricConfig;
|
|
26
29
|
let progressValue;
|
|
27
30
|
let secondaryMetricConfig;
|
|
31
|
+
let selected;
|
|
28
32
|
let subtext;
|
|
29
33
|
let suffix;
|
|
30
34
|
let t0;
|
|
@@ -38,7 +42,7 @@ function Metric(props) {
|
|
|
38
42
|
let targetLineAt;
|
|
39
43
|
let value;
|
|
40
44
|
if ($[0] !== props) {
|
|
41
|
-
({label, prefixDotColor, suffix, onSuffixHoverChange, targetLineAt, styleVariant: t0, pressFeedback: t1, children, className, variant: t2, value, subtext, deltaDirection, deltaSubtext, progressValue, progressColor: t3, progressColorIntensity: t4, targetLabel, emptyStateText: t5, primaryMetric: primaryMetricConfig, secondaryMetric: secondaryMetricConfig, qaTestId: t6, ...otherProps} = props);
|
|
45
|
+
({label, prefixDotColor, prefixIcon, selected, suffix, onSuffixHoverChange, targetLineAt, styleVariant: t0, pressFeedback: t1, children, className, variant: t2, value, subtext, deltaDirection, deltaSubtext, progressValue, progressColor: t3, progressColorIntensity: t4, targetLabel, emptyStateText: t5, primaryMetric: primaryMetricConfig, secondaryMetric: secondaryMetricConfig, qaTestId: t6, ...otherProps} = props);
|
|
42
46
|
$[0] = props;
|
|
43
47
|
$[1] = children;
|
|
44
48
|
$[2] = className;
|
|
@@ -48,21 +52,23 @@ function Metric(props) {
|
|
|
48
52
|
$[6] = onSuffixHoverChange;
|
|
49
53
|
$[7] = otherProps;
|
|
50
54
|
$[8] = prefixDotColor;
|
|
51
|
-
$[9] =
|
|
52
|
-
$[10] =
|
|
53
|
-
$[11] =
|
|
54
|
-
$[12] =
|
|
55
|
-
$[13] =
|
|
56
|
-
$[14] =
|
|
57
|
-
$[15] =
|
|
58
|
-
$[16] =
|
|
59
|
-
$[17] =
|
|
60
|
-
$[18] =
|
|
61
|
-
$[19] =
|
|
62
|
-
$[20] =
|
|
63
|
-
$[21] =
|
|
64
|
-
$[22] =
|
|
65
|
-
$[23] =
|
|
55
|
+
$[9] = prefixIcon;
|
|
56
|
+
$[10] = primaryMetricConfig;
|
|
57
|
+
$[11] = progressValue;
|
|
58
|
+
$[12] = secondaryMetricConfig;
|
|
59
|
+
$[13] = selected;
|
|
60
|
+
$[14] = subtext;
|
|
61
|
+
$[15] = suffix;
|
|
62
|
+
$[16] = t0;
|
|
63
|
+
$[17] = t1;
|
|
64
|
+
$[18] = t2;
|
|
65
|
+
$[19] = t3;
|
|
66
|
+
$[20] = t4;
|
|
67
|
+
$[21] = t5;
|
|
68
|
+
$[22] = t6;
|
|
69
|
+
$[23] = targetLabel;
|
|
70
|
+
$[24] = targetLineAt;
|
|
71
|
+
$[25] = value;
|
|
66
72
|
} else {
|
|
67
73
|
children = $[1];
|
|
68
74
|
className = $[2];
|
|
@@ -72,21 +78,23 @@ function Metric(props) {
|
|
|
72
78
|
onSuffixHoverChange = $[6];
|
|
73
79
|
otherProps = $[7];
|
|
74
80
|
prefixDotColor = $[8];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
prefixIcon = $[9];
|
|
82
|
+
primaryMetricConfig = $[10];
|
|
83
|
+
progressValue = $[11];
|
|
84
|
+
secondaryMetricConfig = $[12];
|
|
85
|
+
selected = $[13];
|
|
86
|
+
subtext = $[14];
|
|
87
|
+
suffix = $[15];
|
|
88
|
+
t0 = $[16];
|
|
89
|
+
t1 = $[17];
|
|
90
|
+
t2 = $[18];
|
|
91
|
+
t3 = $[19];
|
|
92
|
+
t4 = $[20];
|
|
93
|
+
t5 = $[21];
|
|
94
|
+
t6 = $[22];
|
|
95
|
+
targetLabel = $[23];
|
|
96
|
+
targetLineAt = $[24];
|
|
97
|
+
value = $[25];
|
|
90
98
|
}
|
|
91
99
|
const styleVariant = t0 === void 0 ? "weak" : t0;
|
|
92
100
|
const pressFeedback = t1 === void 0 ? false : t1;
|
|
@@ -94,12 +102,12 @@ function Metric(props) {
|
|
|
94
102
|
const progressColor = t3 === void 0 ? "neutral" : t3;
|
|
95
103
|
const progressColorIntensity = t4 === void 0 ? "light" : t4;
|
|
96
104
|
let t7;
|
|
97
|
-
if ($[
|
|
105
|
+
if ($[26] !== _t || $[27] !== t5) {
|
|
98
106
|
t7 = t5 === void 0 ? _t({ id: "tchf_I" }) : t5;
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
} else t7 = $[
|
|
107
|
+
$[26] = _t;
|
|
108
|
+
$[27] = t5;
|
|
109
|
+
$[28] = t7;
|
|
110
|
+
} else t7 = $[28];
|
|
103
111
|
const emptyStateText = t7;
|
|
104
112
|
const qaTestId = t6 === void 0 ? "metric" : t6;
|
|
105
113
|
let renderMetricContent;
|
|
@@ -118,7 +126,7 @@ function Metric(props) {
|
|
|
118
126
|
let t20;
|
|
119
127
|
let t8;
|
|
120
128
|
let t9;
|
|
121
|
-
if ($[
|
|
129
|
+
if ($[29] !== _t || $[30] !== children || $[31] !== className || $[32] !== deltaDirection || $[33] !== deltaSubtext || $[34] !== emptyStateText || $[35] !== label || $[36] !== labelId || $[37] !== onSuffixHoverChange || $[38] !== otherProps || $[39] !== prefixDotColor || $[40] !== prefixIcon || $[41] !== pressFeedback || $[42] !== primaryMetricConfig || $[43] !== progressColor || $[44] !== progressColorIntensity || $[45] !== progressValue || $[46] !== qaTestId || $[47] !== secondaryMetricConfig?.metric || $[48] !== selected || $[49] !== styleVariant || $[50] !== subtext || $[51] !== suffix || $[52] !== targetLabel || $[53] !== targetLineAt || $[54] !== value || $[55] !== variant) {
|
|
122
130
|
const primaryMetric = {
|
|
123
131
|
variant,
|
|
124
132
|
value,
|
|
@@ -140,34 +148,94 @@ function Metric(props) {
|
|
|
140
148
|
const singleMetric = hasPrimaryData ? primaryMetric : secondaryMetric;
|
|
141
149
|
const isOverallEmpty = !hasPrimaryData && !hasSecondaryData;
|
|
142
150
|
const isPrimaryProgress = primaryMetric.variant === "progress" || primaryMetric.progressValue != null;
|
|
143
|
-
const safePrimaryProgressValue = primaryMetric.progressValue ?? 0;
|
|
151
|
+
const safePrimaryProgressValue = Math.min(Math.max(primaryMetric.progressValue ?? 0, 0), 100);
|
|
144
152
|
const isWeak = styleVariant === "weak";
|
|
145
153
|
const isInverse = styleVariant === "inverse" || isOverallEmpty;
|
|
154
|
+
const isSelected = selected === true && !isOverallEmpty;
|
|
146
155
|
const progressBgColor = getSemanticStateColor(primaryMetric.progressColor ?? "neutral", primaryMetric.progressColorIntensity ?? "light");
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
let t21;
|
|
157
|
+
if ($[72] !== _t) {
|
|
158
|
+
t21 = (metric_0) => {
|
|
159
|
+
const metricIsProgress_0 = metric_0.variant === "progress" || metric_0.progressValue != null;
|
|
160
|
+
const metricIsDelta = metric_0.variant === "delta";
|
|
161
|
+
const metricValue = metricIsProgress_0 ? metric_0.value ?? `${metric_0.progressValue ?? 0}%` : metric_0.value;
|
|
162
|
+
const deltaTextColor = metric_0.deltaDirection === "increase" ? "text-positive-base" : metric_0.deltaDirection === "decrease" ? "text-negative-base" : "text-neutral-base";
|
|
163
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
164
|
+
className: "relative flex min-w-0 flex-1 flex-col justify-end overflow-hidden",
|
|
165
|
+
children: [
|
|
166
|
+
metric_0.label ? /* @__PURE__ */ jsx("span", {
|
|
167
|
+
className: "pui-text-body-medium-compact shrink-0 text-depth-black-56",
|
|
168
|
+
children: metric_0.label
|
|
169
|
+
}) : null,
|
|
170
|
+
/* @__PURE__ */ jsx("p", {
|
|
171
|
+
className: "pui-text-metric-large shrink-0 text-depth-black-80",
|
|
172
|
+
children: metricValue
|
|
173
|
+
}),
|
|
174
|
+
metric_0.variant === "default" && metric_0.subtext ? /* @__PURE__ */ jsx("p", {
|
|
175
|
+
className: "pui-text-mono-small shrink-0 text-depth-black-36",
|
|
176
|
+
children: metric_0.subtext
|
|
177
|
+
}) : null,
|
|
178
|
+
metricIsDelta && metric_0.subtext ? /* @__PURE__ */ jsxs("div", {
|
|
179
|
+
className: "flex w-full min-w-0 shrink-0 flex-wrap items-center gap-x-2 gap-y-1",
|
|
180
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
181
|
+
className: "flex shrink-0 items-center gap-0.5",
|
|
182
|
+
children: [metric_0.deltaDirection === "increase" || metric_0.deltaDirection === "decrease" ? /* @__PURE__ */ jsx("div", {
|
|
183
|
+
className: cn("flex size-4 shrink-0 items-center justify-center", deltaTextColor),
|
|
184
|
+
"aria-hidden": "true",
|
|
185
|
+
children: metric_0.deltaDirection === "increase" ? /* @__PURE__ */ jsx(ArrowUpIcon, { size: 16 }) : /* @__PURE__ */ jsx(ArrowDownIcon, { size: 16 })
|
|
186
|
+
}) : null, /* @__PURE__ */ jsxs("p", {
|
|
187
|
+
className: cn("pui-text-mono-small shrink-0", deltaTextColor),
|
|
188
|
+
children: [metric_0.deltaDirection === "increase" ? /* @__PURE__ */ jsxs("span", {
|
|
189
|
+
className: "sr-only",
|
|
190
|
+
children: [_t({ id: "xOrRQ5" }), " "]
|
|
191
|
+
}) : metric_0.deltaDirection === "decrease" ? /* @__PURE__ */ jsxs("span", {
|
|
192
|
+
className: "sr-only",
|
|
193
|
+
children: [_t({ id: "I97bfB" }), " "]
|
|
194
|
+
}) : null, metric_0.subtext]
|
|
195
|
+
})]
|
|
196
|
+
}), metric_0.deltaSubtext ? /* @__PURE__ */ jsx("p", {
|
|
197
|
+
className: "pui-text-mono-small min-w-0 text-depth-black-36",
|
|
198
|
+
children: metric_0.deltaSubtext
|
|
199
|
+
}) : null]
|
|
200
|
+
}) : null,
|
|
201
|
+
metricIsProgress_0 && metric_0.targetLabel ? /* @__PURE__ */ jsx("p", {
|
|
202
|
+
className: "pui-text-mono-small shrink-0 text-depth-black-36",
|
|
203
|
+
children: metric_0.targetLabel
|
|
204
|
+
}) : null
|
|
205
|
+
]
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
$[72] = _t;
|
|
209
|
+
$[73] = t21;
|
|
210
|
+
} else t21 = $[73];
|
|
211
|
+
renderMetricContent = t21;
|
|
212
|
+
const t22 = pressFeedback && "active:scale-95";
|
|
213
|
+
const t23 = isSelected && "border-inner-depth-black-4 bg-depth-black-4 hover:bg-depth-black-4";
|
|
214
|
+
const t24 = !isSelected && isWeak && !isOverallEmpty && "bg-depth-black-4 hover:inset-ring-1 hover:inset-ring-depth-black-4";
|
|
215
|
+
const t25 = !isSelected && isInverse && !isOverallEmpty && "border-inner-depth-black-4 bg-base-inverse hover:bg-depth-black-4 hover:shadow-none";
|
|
216
|
+
const t26 = isOverallEmpty && "dashed-border";
|
|
217
|
+
if ($[74] !== className || $[75] !== t22 || $[76] !== t23 || $[77] !== t24 || $[78] !== t25 || $[79] !== t26) {
|
|
218
|
+
t15 = cn("group relative flex min-h-29 w-full min-w-55 transform flex-col overflow-clip rounded-20 p-4 text-left transition-[transform,background-color,box-shadow] duration-200", t22, t23, t24, t25, t26, className);
|
|
219
|
+
$[74] = className;
|
|
220
|
+
$[75] = t22;
|
|
221
|
+
$[76] = t23;
|
|
222
|
+
$[77] = t24;
|
|
223
|
+
$[78] = t25;
|
|
224
|
+
$[79] = t26;
|
|
225
|
+
$[80] = t15;
|
|
226
|
+
} else t15 = $[80];
|
|
161
227
|
t16 = qaTestId;
|
|
162
|
-
t17 =
|
|
163
|
-
t18 =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
228
|
+
t17 = selected === void 0 ? void 0 : isSelected;
|
|
229
|
+
t18 = otherProps;
|
|
230
|
+
t19 = isPrimaryProgress && hasPrimaryData && children == null ? /* @__PURE__ */ jsx(motion.div, {
|
|
231
|
+
role: "progressbar",
|
|
232
|
+
"aria-valuemin": 0,
|
|
233
|
+
"aria-valuemax": 100,
|
|
234
|
+
"aria-valuenow": safePrimaryProgressValue,
|
|
235
|
+
"aria-labelledby": labelId,
|
|
236
|
+
className: cn("absolute inset-0 origin-left", progressBgColor),
|
|
169
237
|
initial: { scaleX: 0 },
|
|
170
|
-
whileInView: { scaleX:
|
|
238
|
+
whileInView: { scaleX: safePrimaryProgressValue / 100 },
|
|
171
239
|
viewport: {
|
|
172
240
|
once: true,
|
|
173
241
|
amount: .1
|
|
@@ -177,85 +245,94 @@ function Metric(props) {
|
|
|
177
245
|
delay: .4
|
|
178
246
|
}
|
|
179
247
|
}) : null;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
248
|
+
if ($[81] !== targetLineAt) {
|
|
249
|
+
t20 = targetLineAt ? /* @__PURE__ */ jsx("svg", {
|
|
250
|
+
className: "pointer-events-none absolute inset-0 z-10 size-full text-depth-black-16",
|
|
251
|
+
"aria-hidden": "true",
|
|
252
|
+
children: /* @__PURE__ */ jsx("line", {
|
|
253
|
+
x1: `${targetLineAt}%`,
|
|
254
|
+
x2: `${targetLineAt}%`,
|
|
255
|
+
y1: 0,
|
|
256
|
+
y2: "100%",
|
|
257
|
+
stroke: "currentColor",
|
|
258
|
+
strokeDasharray: "3 3"
|
|
259
|
+
})
|
|
190
260
|
}) : null;
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
} else t20 = $[
|
|
261
|
+
$[81] = targetLineAt;
|
|
262
|
+
$[82] = t20;
|
|
263
|
+
} else t20 = $[82];
|
|
194
264
|
t12 = "relative z-10 flex min-h-px min-w-px flex-1 flex-col justify-between gap-3";
|
|
195
|
-
let
|
|
196
|
-
if ($[
|
|
197
|
-
|
|
265
|
+
let t27;
|
|
266
|
+
if ($[83] !== prefixDotColor || $[84] !== prefixIcon) {
|
|
267
|
+
t27 = prefixIcon ? /* @__PURE__ */ jsx("span", {
|
|
268
|
+
className: "flex size-5 shrink-0 items-center justify-center",
|
|
269
|
+
"aria-hidden": "true",
|
|
270
|
+
children: prefixIcon
|
|
271
|
+
}) : prefixDotColor ? /* @__PURE__ */ jsx(DotIcon, {
|
|
198
272
|
size: 24,
|
|
199
273
|
color: prefixDotColor,
|
|
200
274
|
"aria-hidden": "true"
|
|
201
275
|
}) : null;
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
276
|
+
$[83] = prefixDotColor;
|
|
277
|
+
$[84] = prefixIcon;
|
|
278
|
+
$[85] = t27;
|
|
279
|
+
} else t27 = $[85];
|
|
280
|
+
let t28;
|
|
281
|
+
if ($[86] !== label || $[87] !== labelId) {
|
|
282
|
+
t28 = /* @__PURE__ */ jsx("p", {
|
|
283
|
+
id: labelId,
|
|
208
284
|
className: "pui-text-body-medium-compact min-h-px min-w-px flex-1 text-depth-black-56",
|
|
209
285
|
children: label
|
|
210
286
|
});
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
287
|
+
$[86] = label;
|
|
288
|
+
$[87] = labelId;
|
|
289
|
+
$[88] = t28;
|
|
290
|
+
} else t28 = $[88];
|
|
291
|
+
let t29;
|
|
292
|
+
if ($[89] !== t27 || $[90] !== t28) {
|
|
293
|
+
t29 = /* @__PURE__ */ jsxs("div", {
|
|
217
294
|
className: "flex min-h-px min-w-px flex-1 items-center gap-1",
|
|
218
|
-
children: [
|
|
295
|
+
children: [t27, t28]
|
|
219
296
|
});
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
} else
|
|
224
|
-
let
|
|
225
|
-
if ($[
|
|
226
|
-
|
|
297
|
+
$[89] = t27;
|
|
298
|
+
$[90] = t28;
|
|
299
|
+
$[91] = t29;
|
|
300
|
+
} else t29 = $[91];
|
|
301
|
+
let t30;
|
|
302
|
+
if ($[92] !== onSuffixHoverChange || $[93] !== suffix) {
|
|
303
|
+
t30 = suffix ? /* @__PURE__ */ jsx("span", {
|
|
227
304
|
onMouseEnter: onSuffixHoverChange ? () => onSuffixHoverChange(true) : void 0,
|
|
228
305
|
onMouseLeave: onSuffixHoverChange ? () => onSuffixHoverChange(false) : void 0,
|
|
229
306
|
children: /* @__PURE__ */ jsx(Suffix, { ...suffix })
|
|
230
307
|
}) : null;
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
} else
|
|
235
|
-
if ($[
|
|
308
|
+
$[92] = onSuffixHoverChange;
|
|
309
|
+
$[93] = suffix;
|
|
310
|
+
$[94] = t30;
|
|
311
|
+
} else t30 = $[94];
|
|
312
|
+
if ($[95] !== t29 || $[96] !== t30) {
|
|
236
313
|
t13 = /* @__PURE__ */ jsxs("div", {
|
|
237
314
|
className: "flex w-full shrink-0 items-center justify-between gap-2",
|
|
238
|
-
children: [
|
|
315
|
+
children: [t29, t30]
|
|
239
316
|
});
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
} else t13 = $[
|
|
244
|
-
if ($[
|
|
317
|
+
$[95] = t29;
|
|
318
|
+
$[96] = t30;
|
|
319
|
+
$[97] = t13;
|
|
320
|
+
} else t13 = $[97];
|
|
321
|
+
if ($[98] !== children) {
|
|
245
322
|
t14 = children != null ? /* @__PURE__ */ jsx("div", {
|
|
246
323
|
className: "relative z-10 w-full shrink-0",
|
|
247
324
|
children
|
|
248
325
|
}) : null;
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
} else t14 = $[
|
|
252
|
-
const
|
|
253
|
-
if ($[
|
|
254
|
-
t8 = cn("flex w-full flex-1 shrink-0 flex-col justify-between gap-1",
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
} else t8 = $[
|
|
258
|
-
if ($[
|
|
326
|
+
$[98] = children;
|
|
327
|
+
$[99] = t14;
|
|
328
|
+
} else t14 = $[99];
|
|
329
|
+
const t31 = showDualMetrics ? "flex-row items-end" : "flex-col items-start";
|
|
330
|
+
if ($[100] !== t31) {
|
|
331
|
+
t8 = cn("flex w-full flex-1 shrink-0 flex-col justify-between gap-1", t31);
|
|
332
|
+
$[100] = t31;
|
|
333
|
+
$[101] = t8;
|
|
334
|
+
} else t8 = $[101];
|
|
335
|
+
if ($[102] !== emptyStateText || $[103] !== isOverallEmpty) {
|
|
259
336
|
t9 = isOverallEmpty ? /* @__PURE__ */ jsx("div", {
|
|
260
337
|
className: "relative flex min-w-0 flex-1 flex-col justify-end overflow-hidden",
|
|
261
338
|
children: /* @__PURE__ */ jsx("p", {
|
|
@@ -263,71 +340,75 @@ function Metric(props) {
|
|
|
263
340
|
children: emptyStateText
|
|
264
341
|
})
|
|
265
342
|
}) : null;
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
} else t9 = $[
|
|
343
|
+
$[102] = emptyStateText;
|
|
344
|
+
$[103] = isOverallEmpty;
|
|
345
|
+
$[104] = t9;
|
|
346
|
+
} else t9 = $[104];
|
|
270
347
|
t10 = hasSingleMetric && singleMetric ? renderMetricContent(singleMetric) : null;
|
|
271
348
|
t11 = showDualMetrics ? renderMetricContent(primaryMetric) : null;
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
349
|
+
$[29] = _t;
|
|
350
|
+
$[30] = children;
|
|
351
|
+
$[31] = className;
|
|
352
|
+
$[32] = deltaDirection;
|
|
353
|
+
$[33] = deltaSubtext;
|
|
354
|
+
$[34] = emptyStateText;
|
|
355
|
+
$[35] = label;
|
|
356
|
+
$[36] = labelId;
|
|
357
|
+
$[37] = onSuffixHoverChange;
|
|
358
|
+
$[38] = otherProps;
|
|
359
|
+
$[39] = prefixDotColor;
|
|
360
|
+
$[40] = prefixIcon;
|
|
361
|
+
$[41] = pressFeedback;
|
|
362
|
+
$[42] = primaryMetricConfig;
|
|
363
|
+
$[43] = progressColor;
|
|
364
|
+
$[44] = progressColorIntensity;
|
|
365
|
+
$[45] = progressValue;
|
|
366
|
+
$[46] = qaTestId;
|
|
367
|
+
$[47] = secondaryMetricConfig?.metric;
|
|
368
|
+
$[48] = selected;
|
|
369
|
+
$[49] = styleVariant;
|
|
370
|
+
$[50] = subtext;
|
|
371
|
+
$[51] = suffix;
|
|
372
|
+
$[52] = targetLabel;
|
|
373
|
+
$[53] = targetLineAt;
|
|
374
|
+
$[54] = value;
|
|
375
|
+
$[55] = variant;
|
|
376
|
+
$[56] = renderMetricContent;
|
|
377
|
+
$[57] = secondaryMetric;
|
|
378
|
+
$[58] = showDualMetrics;
|
|
379
|
+
$[59] = t10;
|
|
380
|
+
$[60] = t11;
|
|
381
|
+
$[61] = t12;
|
|
382
|
+
$[62] = t13;
|
|
383
|
+
$[63] = t14;
|
|
384
|
+
$[64] = t15;
|
|
385
|
+
$[65] = t16;
|
|
386
|
+
$[66] = t17;
|
|
387
|
+
$[67] = t18;
|
|
388
|
+
$[68] = t19;
|
|
389
|
+
$[69] = t20;
|
|
390
|
+
$[70] = t8;
|
|
391
|
+
$[71] = t9;
|
|
311
392
|
} else {
|
|
312
|
-
renderMetricContent = $[
|
|
313
|
-
secondaryMetric = $[
|
|
314
|
-
showDualMetrics = $[
|
|
315
|
-
t10 = $[
|
|
316
|
-
t11 = $[
|
|
317
|
-
t12 = $[
|
|
318
|
-
t13 = $[
|
|
319
|
-
t14 = $[
|
|
320
|
-
t15 = $[
|
|
321
|
-
t16 = $[
|
|
322
|
-
t17 = $[
|
|
323
|
-
t18 = $[
|
|
324
|
-
t19 = $[
|
|
325
|
-
t20 = $[
|
|
326
|
-
t8 = $[
|
|
327
|
-
t9 = $[
|
|
393
|
+
renderMetricContent = $[56];
|
|
394
|
+
secondaryMetric = $[57];
|
|
395
|
+
showDualMetrics = $[58];
|
|
396
|
+
t10 = $[59];
|
|
397
|
+
t11 = $[60];
|
|
398
|
+
t12 = $[61];
|
|
399
|
+
t13 = $[62];
|
|
400
|
+
t14 = $[63];
|
|
401
|
+
t15 = $[64];
|
|
402
|
+
t16 = $[65];
|
|
403
|
+
t17 = $[66];
|
|
404
|
+
t18 = $[67];
|
|
405
|
+
t19 = $[68];
|
|
406
|
+
t20 = $[69];
|
|
407
|
+
t8 = $[70];
|
|
408
|
+
t9 = $[71];
|
|
328
409
|
}
|
|
329
410
|
let t21;
|
|
330
|
-
if ($[
|
|
411
|
+
if ($[105] !== showDualMetrics) {
|
|
331
412
|
t21 = showDualMetrics ? /* @__PURE__ */ jsx("div", {
|
|
332
413
|
className: "flex h-full min-h-0 shrink-0 flex-col self-stretch pr-1 pl-4 text-depth-black-8",
|
|
333
414
|
"aria-hidden": true,
|
|
@@ -361,19 +442,19 @@ function Metric(props) {
|
|
|
361
442
|
})
|
|
362
443
|
})
|
|
363
444
|
}) : null;
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
} else t21 = $[
|
|
445
|
+
$[105] = showDualMetrics;
|
|
446
|
+
$[106] = t21;
|
|
447
|
+
} else t21 = $[106];
|
|
367
448
|
let t22;
|
|
368
|
-
if ($[
|
|
449
|
+
if ($[107] !== renderMetricContent || $[108] !== secondaryMetric || $[109] !== showDualMetrics) {
|
|
369
450
|
t22 = showDualMetrics && secondaryMetric ? renderMetricContent(secondaryMetric) : null;
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
} else t22 = $[
|
|
451
|
+
$[107] = renderMetricContent;
|
|
452
|
+
$[108] = secondaryMetric;
|
|
453
|
+
$[109] = showDualMetrics;
|
|
454
|
+
$[110] = t22;
|
|
455
|
+
} else t22 = $[110];
|
|
375
456
|
let t23;
|
|
376
|
-
if ($[
|
|
457
|
+
if ($[111] !== t10 || $[112] !== t11 || $[113] !== t21 || $[114] !== t22 || $[115] !== t8 || $[116] !== t9) {
|
|
377
458
|
t23 = /* @__PURE__ */ jsxs("div", {
|
|
378
459
|
className: t8,
|
|
379
460
|
children: [
|
|
@@ -384,16 +465,16 @@ function Metric(props) {
|
|
|
384
465
|
t22
|
|
385
466
|
]
|
|
386
467
|
});
|
|
387
|
-
$[
|
|
388
|
-
$[
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
} else t23 = $[
|
|
468
|
+
$[111] = t10;
|
|
469
|
+
$[112] = t11;
|
|
470
|
+
$[113] = t21;
|
|
471
|
+
$[114] = t22;
|
|
472
|
+
$[115] = t8;
|
|
473
|
+
$[116] = t9;
|
|
474
|
+
$[117] = t23;
|
|
475
|
+
} else t23 = $[117];
|
|
395
476
|
let t24;
|
|
396
|
-
if ($[
|
|
477
|
+
if ($[118] !== t12 || $[119] !== t13 || $[120] !== t14 || $[121] !== t23) {
|
|
397
478
|
t24 = /* @__PURE__ */ jsxs("div", {
|
|
398
479
|
className: t12,
|
|
399
480
|
children: [
|
|
@@ -402,79 +483,36 @@ function Metric(props) {
|
|
|
402
483
|
t23
|
|
403
484
|
]
|
|
404
485
|
});
|
|
405
|
-
$[
|
|
406
|
-
$[
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
410
|
-
} else t24 = $[
|
|
486
|
+
$[118] = t12;
|
|
487
|
+
$[119] = t13;
|
|
488
|
+
$[120] = t14;
|
|
489
|
+
$[121] = t23;
|
|
490
|
+
$[122] = t24;
|
|
491
|
+
} else t24 = $[122];
|
|
411
492
|
let t25;
|
|
412
|
-
if ($[
|
|
493
|
+
if ($[123] !== t15 || $[124] !== t16 || $[125] !== t17 || $[126] !== t18 || $[127] !== t19 || $[128] !== t20 || $[129] !== t24) {
|
|
413
494
|
t25 = /* @__PURE__ */ jsxs("div", {
|
|
414
495
|
className: t15,
|
|
415
496
|
"qa-test-id": t16,
|
|
416
|
-
|
|
497
|
+
"aria-pressed": t17,
|
|
498
|
+
...t18,
|
|
417
499
|
children: [
|
|
418
|
-
t18,
|
|
419
500
|
t19,
|
|
420
501
|
t20,
|
|
421
502
|
t24
|
|
422
503
|
]
|
|
423
504
|
});
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
$[
|
|
432
|
-
} else t25 = $[
|
|
505
|
+
$[123] = t15;
|
|
506
|
+
$[124] = t16;
|
|
507
|
+
$[125] = t17;
|
|
508
|
+
$[126] = t18;
|
|
509
|
+
$[127] = t19;
|
|
510
|
+
$[128] = t20;
|
|
511
|
+
$[129] = t24;
|
|
512
|
+
$[130] = t25;
|
|
513
|
+
} else t25 = $[130];
|
|
433
514
|
return t25;
|
|
434
515
|
}
|
|
435
|
-
function _temp2(metric_0) {
|
|
436
|
-
const metricIsProgress_0 = metric_0.variant === "progress" || metric_0.progressValue != null;
|
|
437
|
-
const metricIsDelta = metric_0.variant === "delta";
|
|
438
|
-
const metricValue = metricIsProgress_0 ? metric_0.value ?? `${metric_0.progressValue ?? 0}%` : metric_0.value;
|
|
439
|
-
const deltaTextColor = metric_0.deltaDirection === "increase" ? "text-positive-base" : metric_0.deltaDirection === "decrease" ? "text-negative-base" : "text-neutral-base";
|
|
440
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
441
|
-
className: "relative flex min-w-0 flex-1 flex-col justify-end overflow-hidden",
|
|
442
|
-
children: [
|
|
443
|
-
metric_0.label ? /* @__PURE__ */ jsx("span", {
|
|
444
|
-
className: "pui-text-body-medium-compact shrink-0 text-depth-black-56",
|
|
445
|
-
children: metric_0.label
|
|
446
|
-
}) : null,
|
|
447
|
-
/* @__PURE__ */ jsx("p", {
|
|
448
|
-
className: "pui-text-metric-large shrink-0 text-depth-black-80",
|
|
449
|
-
children: metricValue
|
|
450
|
-
}),
|
|
451
|
-
metric_0.variant === "default" && metric_0.subtext ? /* @__PURE__ */ jsx("p", {
|
|
452
|
-
className: "pui-text-mono-small shrink-0 text-depth-black-36",
|
|
453
|
-
children: metric_0.subtext
|
|
454
|
-
}) : null,
|
|
455
|
-
metricIsDelta && metric_0.subtext ? /* @__PURE__ */ jsxs("div", {
|
|
456
|
-
className: "flex w-full min-w-0 shrink-0 flex-wrap items-center gap-x-2 gap-y-1",
|
|
457
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
458
|
-
className: "flex shrink-0 items-center gap-0.5",
|
|
459
|
-
children: [metric_0.deltaDirection === "increase" || metric_0.deltaDirection === "decrease" ? /* @__PURE__ */ jsx("div", {
|
|
460
|
-
className: cn("flex size-4 shrink-0 items-center justify-center", deltaTextColor),
|
|
461
|
-
children: metric_0.deltaDirection === "increase" ? /* @__PURE__ */ jsx(ArrowUpIcon, { size: 16 }) : /* @__PURE__ */ jsx(ArrowDownIcon, { size: 16 })
|
|
462
|
-
}) : null, /* @__PURE__ */ jsx("p", {
|
|
463
|
-
className: cn("pui-text-mono-small shrink-0", deltaTextColor),
|
|
464
|
-
children: metric_0.subtext
|
|
465
|
-
})]
|
|
466
|
-
}), metric_0.deltaSubtext ? /* @__PURE__ */ jsx("p", {
|
|
467
|
-
className: "pui-text-mono-small min-w-0 text-depth-black-36",
|
|
468
|
-
children: metric_0.deltaSubtext
|
|
469
|
-
}) : null]
|
|
470
|
-
}) : null,
|
|
471
|
-
metricIsProgress_0 && metric_0.targetLabel ? /* @__PURE__ */ jsx("p", {
|
|
472
|
-
className: "pui-text-mono-small shrink-0 text-depth-black-36",
|
|
473
|
-
children: metric_0.targetLabel
|
|
474
|
-
}) : null
|
|
475
|
-
]
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
516
|
function _temp(metric) {
|
|
479
517
|
if (metric == null) return true;
|
|
480
518
|
if (metric.variant === "progress" || metric.progressValue != null) return (metric.progressValue ?? 0) === 0;
|