@iyulab/u-widgets 0.7.1 → 0.8.1
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/{tokens-x1kDxgG8.js → tokens-D5aWvczs.js} +16 -5
- package/dist/tokens-D5aWvczs.js.map +1 -0
- package/dist/u-widgets-charts.js +303 -227
- package/dist/u-widgets-charts.js.map +1 -1
- package/dist/u-widgets-tools.js +110 -85
- package/dist/u-widgets-tools.js.map +1 -1
- package/dist/u-widgets.d.ts +1 -1
- package/dist/u-widgets.js +46 -20
- package/dist/u-widgets.js.map +1 -1
- package/package.json +1 -1
- package/schema/u-widget.schema.json +1 -1
- package/dist/tokens-x1kDxgG8.js.map +0 -1
package/dist/u-widgets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { g as be } from "./formdown-BWJ6QGJs.js";
|
|
2
2
|
import { p as Nt, r as Ft } from "./formdown-BWJ6QGJs.js";
|
|
3
3
|
import { i as we } from "./infer-CNOiD2dS.js";
|
|
4
|
-
import { t as b, n as ye } from "./tokens-
|
|
4
|
+
import { t as b, n as ye } from "./tokens-D5aWvczs.js";
|
|
5
5
|
import { css as w, LitElement as y, nothing as l, html as o } from "lit";
|
|
6
6
|
import { property as f, customElement as x, state as S } from "lit/decorators.js";
|
|
7
7
|
const xe = /* @__PURE__ */ new Set([
|
|
@@ -473,7 +473,7 @@ I.styles = [b, w`
|
|
|
473
473
|
.metric[data-variant="success"] .metric-value { color: var(--u-widget-positive, #16a34a); }
|
|
474
474
|
.metric[data-variant="danger"] .metric-value { color: var(--u-widget-negative, #dc2626); }
|
|
475
475
|
.metric[data-variant="warning"] .metric-value { color: var(--u-widget-warning, #d97706); }
|
|
476
|
-
.metric[data-variant="info"] .metric-value { color: var(--u-widget-primary, #
|
|
476
|
+
.metric[data-variant="info"] .metric-value { color: var(--u-widget-primary, #4f46e5); }
|
|
477
477
|
.metric[data-variant="neutral"] .metric-value { color: var(--u-widget-text-secondary, #64748b); }
|
|
478
478
|
|
|
479
479
|
/* ── stat-group ── */
|
|
@@ -531,6 +531,7 @@ const Ue = {
|
|
|
531
531
|
min: 0,
|
|
532
532
|
max: 100,
|
|
533
533
|
unit: "",
|
|
534
|
+
subtitle: "",
|
|
534
535
|
thresholds: []
|
|
535
536
|
}, Re = {
|
|
536
537
|
green: "#16a34a",
|
|
@@ -562,25 +563,34 @@ let N = class extends y {
|
|
|
562
563
|
const e = this.spec.data;
|
|
563
564
|
return Number(e.value ?? 0);
|
|
564
565
|
}
|
|
566
|
+
getActiveLabel(e, t) {
|
|
567
|
+
if (t.subtitle) return t.subtitle;
|
|
568
|
+
if (!t.thresholds?.length) return "";
|
|
569
|
+
const a = [...t.thresholds].sort((i, s) => i.to - s.to);
|
|
570
|
+
for (const i of a)
|
|
571
|
+
if (e <= i.to && i.label) return i.label;
|
|
572
|
+
return a[a.length - 1].label ?? "";
|
|
573
|
+
}
|
|
565
574
|
renderGauge() {
|
|
566
|
-
const e = this.getOptions(), t = this.getValue(), a = e.max - e.min, r = a > 0 ? Math.max(0, Math.min(1, (t - e.min) / a)) : 0, i = this.getThresholdColor(t, e), s =
|
|
575
|
+
const e = this.getOptions(), t = this.getValue(), a = e.max - e.min, r = a > 0 ? Math.max(0, Math.min(1, (t - e.min) / a)) : 0, i = this.getThresholdColor(t, e), s = this.getActiveLabel(t, e), n = 100, d = 100, c = 80, p = 150, g = 240, m = p + g * r, u = ue(n, d, c, p, p + g), h = r > 0 ? ue(n, d, c, p, m) : null, v = typeof this.spec.title == "string" ? this.spec.title : "Gauge", $ = s ? `${t}${e.unit} ${s}` : `${t}${e.unit}`;
|
|
567
576
|
return o`
|
|
568
577
|
<div class="gauge-container" part="gauge"
|
|
569
578
|
role="meter"
|
|
570
579
|
aria-valuenow=${t}
|
|
571
580
|
aria-valuemin=${e.min}
|
|
572
581
|
aria-valuemax=${e.max}
|
|
573
|
-
aria-label=${
|
|
574
|
-
aria-valuetext=${
|
|
582
|
+
aria-label=${v}
|
|
583
|
+
aria-valuetext=${$}
|
|
575
584
|
>
|
|
576
585
|
<div class="gauge-wrapper">
|
|
577
586
|
<div class="gauge-center">
|
|
578
587
|
<div class="gauge-value" part="value">${t}</div>
|
|
579
588
|
${e.unit ? o`<div class="gauge-unit" part="unit">${e.unit}</div>` : l}
|
|
589
|
+
${s ? o`<div class="gauge-subtitle" part="subtitle" style="color:${i}">${s}</div>` : l}
|
|
580
590
|
</div>
|
|
581
591
|
<svg class="gauge-svg" viewBox="0 0 200 195" role="presentation" aria-hidden="true">
|
|
582
|
-
<path class="gauge-track" d="${
|
|
583
|
-
<path class="gauge-fill" d="${
|
|
592
|
+
<path class="gauge-track" d="${u}" fill="none" stroke-width="12" stroke-linecap="round"></path>
|
|
593
|
+
<path class="gauge-fill" d="${h ?? "M0 0"}" fill="none" stroke="${h ? i : "none"}" stroke-width="12" stroke-linecap="round"></path>
|
|
584
594
|
</svg>
|
|
585
595
|
</div>
|
|
586
596
|
</div>
|
|
@@ -659,6 +669,7 @@ N.styles = [b, w`
|
|
|
659
669
|
left: 50%;
|
|
660
670
|
transform: translate(-50%, -50%);
|
|
661
671
|
text-align: center;
|
|
672
|
+
width: 65%;
|
|
662
673
|
}
|
|
663
674
|
|
|
664
675
|
.gauge-value {
|
|
@@ -673,6 +684,17 @@ N.styles = [b, w`
|
|
|
673
684
|
color: var(--u-widget-text-secondary, #64748b);
|
|
674
685
|
}
|
|
675
686
|
|
|
687
|
+
.gauge-subtitle {
|
|
688
|
+
font-size: 0.6875rem;
|
|
689
|
+
font-weight: 600;
|
|
690
|
+
line-height: 1.2;
|
|
691
|
+
margin-top: 2px;
|
|
692
|
+
max-width: 100%;
|
|
693
|
+
overflow: hidden;
|
|
694
|
+
text-overflow: ellipsis;
|
|
695
|
+
white-space: nowrap;
|
|
696
|
+
}
|
|
697
|
+
|
|
676
698
|
/* ── progress bar ── */
|
|
677
699
|
.progress-container {
|
|
678
700
|
display: flex;
|
|
@@ -710,6 +732,10 @@ N.styles = [b, w`
|
|
|
710
732
|
font-size: 0.625rem;
|
|
711
733
|
}
|
|
712
734
|
|
|
735
|
+
.gauge-subtitle {
|
|
736
|
+
font-size: 0.5625rem;
|
|
737
|
+
}
|
|
738
|
+
|
|
713
739
|
.progress-info {
|
|
714
740
|
font-size: 0.75rem;
|
|
715
741
|
}
|
|
@@ -2175,26 +2201,26 @@ M.styles = [b, w`
|
|
|
2175
2201
|
}
|
|
2176
2202
|
|
|
2177
2203
|
.callout-info {
|
|
2178
|
-
background: color-mix(in srgb, var(--u-widget-primary, #
|
|
2179
|
-
border-left-color: var(--u-widget-primary, #
|
|
2204
|
+
background: color-mix(in srgb, var(--u-widget-primary, #4f46e5) 12%, var(--u-widget-bg, #fff));
|
|
2205
|
+
border-left-color: var(--u-widget-primary, #4f46e5);
|
|
2180
2206
|
color: var(--u-widget-text, #1a1a2e);
|
|
2181
2207
|
}
|
|
2182
2208
|
|
|
2183
2209
|
.callout-warning {
|
|
2184
|
-
background: color-mix(in srgb, var(--u-widget-warning, #
|
|
2185
|
-
border-left-color: var(--u-widget-warning, #
|
|
2210
|
+
background: color-mix(in srgb, var(--u-widget-warning, #d97706) 12%, var(--u-widget-bg, #fff));
|
|
2211
|
+
border-left-color: var(--u-widget-warning, #d97706);
|
|
2186
2212
|
color: var(--u-widget-text, #1a1a2e);
|
|
2187
2213
|
}
|
|
2188
2214
|
|
|
2189
2215
|
.callout-error {
|
|
2190
|
-
background: color-mix(in srgb, var(--u-widget-negative, #
|
|
2191
|
-
border-left-color: var(--u-widget-negative, #
|
|
2216
|
+
background: color-mix(in srgb, var(--u-widget-negative, #dc2626) 12%, var(--u-widget-bg, #fff));
|
|
2217
|
+
border-left-color: var(--u-widget-negative, #dc2626);
|
|
2192
2218
|
color: var(--u-widget-text, #1a1a2e);
|
|
2193
2219
|
}
|
|
2194
2220
|
|
|
2195
2221
|
.callout-success {
|
|
2196
|
-
background: color-mix(in srgb, var(--u-widget-positive, #
|
|
2197
|
-
border-left-color: var(--u-widget-positive, #
|
|
2222
|
+
background: color-mix(in srgb, var(--u-widget-positive, #16a34a) 12%, var(--u-widget-bg, #fff));
|
|
2223
|
+
border-left-color: var(--u-widget-positive, #16a34a);
|
|
2198
2224
|
color: var(--u-widget-text, #1a1a2e);
|
|
2199
2225
|
}
|
|
2200
2226
|
|
|
@@ -2994,7 +3020,7 @@ R.styles = [b, w`
|
|
|
2994
3020
|
/* Level colors */
|
|
2995
3021
|
[data-level="info"] .status-icon,
|
|
2996
3022
|
[data-level="info"] .status-value {
|
|
2997
|
-
color: var(--u-widget-primary, #
|
|
3023
|
+
color: var(--u-widget-primary, #4f46e5);
|
|
2998
3024
|
}
|
|
2999
3025
|
[data-level="success"] .status-icon,
|
|
3000
3026
|
[data-level="success"] .status-value {
|
|
@@ -3002,7 +3028,7 @@ R.styles = [b, w`
|
|
|
3002
3028
|
}
|
|
3003
3029
|
[data-level="warning"] .status-icon,
|
|
3004
3030
|
[data-level="warning"] .status-value {
|
|
3005
|
-
color: var(--u-widget-warning, #
|
|
3031
|
+
color: var(--u-widget-warning, #d97706);
|
|
3006
3032
|
}
|
|
3007
3033
|
[data-level="error"] .status-icon,
|
|
3008
3034
|
[data-level="error"] .status-value {
|
|
@@ -3949,12 +3975,12 @@ P.styles = [
|
|
|
3949
3975
|
.error-card {
|
|
3950
3976
|
padding: 10px 14px;
|
|
3951
3977
|
border-radius: 6px;
|
|
3952
|
-
border: 1px solid var(--u-widget-negative, #
|
|
3953
|
-
background: color-mix(in srgb, var(--u-widget-negative, #
|
|
3978
|
+
border: 1px solid var(--u-widget-negative, #dc2626);
|
|
3979
|
+
background: color-mix(in srgb, var(--u-widget-negative, #dc2626) 8%, var(--u-widget-bg, #fff));
|
|
3954
3980
|
font-size: 0.8125rem;
|
|
3955
3981
|
}
|
|
3956
3982
|
|
|
3957
|
-
.error-header { font-weight: 600; color: var(--u-widget-negative, #
|
|
3983
|
+
.error-header { font-weight: 600; color: var(--u-widget-negative, #dc2626); margin-bottom: 4px; }
|
|
3958
3984
|
.error-list { margin: 0; padding-left: 20px; color: var(--u-widget-text-secondary, #64748b); }
|
|
3959
3985
|
|
|
3960
3986
|
.fallback-card {
|