@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.
@@ -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(120);
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] = primaryMetricConfig;
52
- $[10] = progressValue;
53
- $[11] = secondaryMetricConfig;
54
- $[12] = subtext;
55
- $[13] = suffix;
56
- $[14] = t0;
57
- $[15] = t1;
58
- $[16] = t2;
59
- $[17] = t3;
60
- $[18] = t4;
61
- $[19] = t5;
62
- $[20] = t6;
63
- $[21] = targetLabel;
64
- $[22] = targetLineAt;
65
- $[23] = value;
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
- primaryMetricConfig = $[9];
76
- progressValue = $[10];
77
- secondaryMetricConfig = $[11];
78
- subtext = $[12];
79
- suffix = $[13];
80
- t0 = $[14];
81
- t1 = $[15];
82
- t2 = $[16];
83
- t3 = $[17];
84
- t4 = $[18];
85
- t5 = $[19];
86
- t6 = $[20];
87
- targetLabel = $[21];
88
- targetLineAt = $[22];
89
- value = $[23];
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 ($[24] !== _t || $[25] !== t5) {
105
+ if ($[26] !== _t || $[27] !== t5) {
98
106
  t7 = t5 === void 0 ? _t({ id: "tchf_I" }) : t5;
99
- $[24] = _t;
100
- $[25] = t5;
101
- $[26] = t7;
102
- } else t7 = $[26];
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 ($[27] !== children || $[28] !== className || $[29] !== deltaDirection || $[30] !== deltaSubtext || $[31] !== emptyStateText || $[32] !== label || $[33] !== onSuffixHoverChange || $[34] !== otherProps || $[35] !== prefixDotColor || $[36] !== pressFeedback || $[37] !== primaryMetricConfig || $[38] !== progressColor || $[39] !== progressColorIntensity || $[40] !== progressValue || $[41] !== qaTestId || $[42] !== secondaryMetricConfig?.metric || $[43] !== styleVariant || $[44] !== subtext || $[45] !== suffix || $[46] !== targetLabel || $[47] !== targetLineAt || $[48] !== value || $[49] !== variant) {
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
- renderMetricContent = _temp2;
148
- const t21 = pressFeedback && "active:scale-[0.98]";
149
- const t22 = isWeak && !isOverallEmpty && "bg-depth-black-4 hover:bg-depth-black-8";
150
- const t23 = isInverse && !isOverallEmpty && "border-inner-depth-black-4 bg-base-inverse hover:bg-depth-black-4 hover:shadow-none";
151
- const t24 = isOverallEmpty && "dashed-border";
152
- if ($[66] !== className || $[67] !== t21 || $[68] !== t22 || $[69] !== t23 || $[70] !== t24) {
153
- 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] duration-200", t21, t22, t23, t24, className);
154
- $[66] = className;
155
- $[67] = t21;
156
- $[68] = t22;
157
- $[69] = t23;
158
- $[70] = t24;
159
- $[71] = t15;
160
- } else t15 = $[71];
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 = otherProps;
163
- t18 = isPrimaryProgress && hasPrimaryData && children == null ? /* @__PURE__ */ jsx(motion.div, {
164
- className: cn("absolute inset-y-0 left-0 transition-[width] duration-300 ease-out", progressBgColor, "after:absolute after:inset-0 after:bg-depth-black-0 after:transition-colors after:duration-200 group-hover:after:bg-depth-black-8"),
165
- style: {
166
- width: `${safePrimaryProgressValue}%`,
167
- transformOrigin: "left"
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: 1 },
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
- t19 = isPrimaryProgress && hasPrimaryData && children == null ? /* @__PURE__ */ jsx("div", {
181
- className: cn("absolute inset-y-0 flex w-0 -translate-x-1/2 items-center justify-center transition-[width] duration-300 ease-out"),
182
- style: { width: `${safePrimaryProgressValue}%` },
183
- children: /* @__PURE__ */ jsx("div", { className: "h-full w-px border-depth-black-16" })
184
- }) : null;
185
- if ($[72] !== targetLineAt) {
186
- t20 = targetLineAt ? /* @__PURE__ */ jsx("div", {
187
- className: "pointer-events-none absolute inset-y-0 z-10 -translate-x-1/2",
188
- style: { left: `${targetLineAt}%` },
189
- children: /* @__PURE__ */ jsx("div", { className: "h-full w-px border-l border-dashed border-depth-black-16" })
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
- $[72] = targetLineAt;
192
- $[73] = t20;
193
- } else t20 = $[73];
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 t25;
196
- if ($[74] !== prefixDotColor) {
197
- t25 = prefixDotColor ? /* @__PURE__ */ jsx(DotIcon, {
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
- $[74] = prefixDotColor;
203
- $[75] = t25;
204
- } else t25 = $[75];
205
- let t26;
206
- if ($[76] !== label) {
207
- t26 = /* @__PURE__ */ jsx("p", {
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
- $[76] = label;
212
- $[77] = t26;
213
- } else t26 = $[77];
214
- let t27;
215
- if ($[78] !== t25 || $[79] !== t26) {
216
- t27 = /* @__PURE__ */ jsxs("div", {
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: [t25, t26]
295
+ children: [t27, t28]
219
296
  });
220
- $[78] = t25;
221
- $[79] = t26;
222
- $[80] = t27;
223
- } else t27 = $[80];
224
- let t28;
225
- if ($[81] !== onSuffixHoverChange || $[82] !== suffix) {
226
- t28 = suffix ? /* @__PURE__ */ jsx("span", {
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
- $[81] = onSuffixHoverChange;
232
- $[82] = suffix;
233
- $[83] = t28;
234
- } else t28 = $[83];
235
- if ($[84] !== t27 || $[85] !== t28) {
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: [t27, t28]
315
+ children: [t29, t30]
239
316
  });
240
- $[84] = t27;
241
- $[85] = t28;
242
- $[86] = t13;
243
- } else t13 = $[86];
244
- if ($[87] !== children) {
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
- $[87] = children;
250
- $[88] = t14;
251
- } else t14 = $[88];
252
- const t29 = showDualMetrics ? "flex-row items-end" : "flex-col items-start";
253
- if ($[89] !== t29) {
254
- t8 = cn("flex w-full flex-1 shrink-0 flex-col justify-between gap-1", t29);
255
- $[89] = t29;
256
- $[90] = t8;
257
- } else t8 = $[90];
258
- if ($[91] !== emptyStateText || $[92] !== isOverallEmpty) {
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
- $[91] = emptyStateText;
267
- $[92] = isOverallEmpty;
268
- $[93] = t9;
269
- } else t9 = $[93];
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
- $[27] = children;
273
- $[28] = className;
274
- $[29] = deltaDirection;
275
- $[30] = deltaSubtext;
276
- $[31] = emptyStateText;
277
- $[32] = label;
278
- $[33] = onSuffixHoverChange;
279
- $[34] = otherProps;
280
- $[35] = prefixDotColor;
281
- $[36] = pressFeedback;
282
- $[37] = primaryMetricConfig;
283
- $[38] = progressColor;
284
- $[39] = progressColorIntensity;
285
- $[40] = progressValue;
286
- $[41] = qaTestId;
287
- $[42] = secondaryMetricConfig?.metric;
288
- $[43] = styleVariant;
289
- $[44] = subtext;
290
- $[45] = suffix;
291
- $[46] = targetLabel;
292
- $[47] = targetLineAt;
293
- $[48] = value;
294
- $[49] = variant;
295
- $[50] = renderMetricContent;
296
- $[51] = secondaryMetric;
297
- $[52] = showDualMetrics;
298
- $[53] = t10;
299
- $[54] = t11;
300
- $[55] = t12;
301
- $[56] = t13;
302
- $[57] = t14;
303
- $[58] = t15;
304
- $[59] = t16;
305
- $[60] = t17;
306
- $[61] = t18;
307
- $[62] = t19;
308
- $[63] = t20;
309
- $[64] = t8;
310
- $[65] = t9;
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 = $[50];
313
- secondaryMetric = $[51];
314
- showDualMetrics = $[52];
315
- t10 = $[53];
316
- t11 = $[54];
317
- t12 = $[55];
318
- t13 = $[56];
319
- t14 = $[57];
320
- t15 = $[58];
321
- t16 = $[59];
322
- t17 = $[60];
323
- t18 = $[61];
324
- t19 = $[62];
325
- t20 = $[63];
326
- t8 = $[64];
327
- t9 = $[65];
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 ($[94] !== showDualMetrics) {
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
- $[94] = showDualMetrics;
365
- $[95] = t21;
366
- } else t21 = $[95];
445
+ $[105] = showDualMetrics;
446
+ $[106] = t21;
447
+ } else t21 = $[106];
367
448
  let t22;
368
- if ($[96] !== renderMetricContent || $[97] !== secondaryMetric || $[98] !== showDualMetrics) {
449
+ if ($[107] !== renderMetricContent || $[108] !== secondaryMetric || $[109] !== showDualMetrics) {
369
450
  t22 = showDualMetrics && secondaryMetric ? renderMetricContent(secondaryMetric) : null;
370
- $[96] = renderMetricContent;
371
- $[97] = secondaryMetric;
372
- $[98] = showDualMetrics;
373
- $[99] = t22;
374
- } else t22 = $[99];
451
+ $[107] = renderMetricContent;
452
+ $[108] = secondaryMetric;
453
+ $[109] = showDualMetrics;
454
+ $[110] = t22;
455
+ } else t22 = $[110];
375
456
  let t23;
376
- if ($[100] !== t10 || $[101] !== t11 || $[102] !== t21 || $[103] !== t22 || $[104] !== t8 || $[105] !== t9) {
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
- $[100] = t10;
388
- $[101] = t11;
389
- $[102] = t21;
390
- $[103] = t22;
391
- $[104] = t8;
392
- $[105] = t9;
393
- $[106] = t23;
394
- } else t23 = $[106];
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 ($[107] !== t12 || $[108] !== t13 || $[109] !== t14 || $[110] !== t23) {
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
- $[107] = t12;
406
- $[108] = t13;
407
- $[109] = t14;
408
- $[110] = t23;
409
- $[111] = t24;
410
- } else t24 = $[111];
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 ($[112] !== t15 || $[113] !== t16 || $[114] !== t17 || $[115] !== t18 || $[116] !== t19 || $[117] !== t20 || $[118] !== t24) {
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
- ...t17,
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
- $[112] = t15;
425
- $[113] = t16;
426
- $[114] = t17;
427
- $[115] = t18;
428
- $[116] = t19;
429
- $[117] = t20;
430
- $[118] = t24;
431
- $[119] = t25;
432
- } else t25 = $[119];
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;