@umituz/web-design-system 4.10.0 → 4.11.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-design-system",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Web Design System - Tailwind v4 authored, precompiled CSS shipped. Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications.",
|
|
@@ -511,6 +511,11 @@ describe('fleet surface supersets', () => {
|
|
|
511
511
|
expect(container.querySelector('.text-destructive')).not.toBeNull();
|
|
512
512
|
});
|
|
513
513
|
|
|
514
|
+
it('KpiCard valueTone paints the metric value', () => {
|
|
515
|
+
const { container } = render(<KpiCard label="Overdue" value="7" valueTone="destructive" />);
|
|
516
|
+
expect(container.querySelector('.text-2xl')!.className).toContain('text-destructive');
|
|
517
|
+
});
|
|
518
|
+
|
|
514
519
|
it('KpiCard alert applies destructive emphasis', () => {
|
|
515
520
|
const { container } = render(<KpiCard label="Offline" value="3" alert />);
|
|
516
521
|
const el = container.firstChild as HTMLElement;
|
|
@@ -25,6 +25,8 @@ export interface KpiCardProps extends HTMLAttributes<HTMLDivElement>, BaseProps
|
|
|
25
25
|
hint?: ReactNode;
|
|
26
26
|
icon?: ReactNode;
|
|
27
27
|
iconTone?: KpiIconTone;
|
|
28
|
+
/** Paints the metric value itself, e.g. red for an over-budget figure. */
|
|
29
|
+
valueTone?: KpiIconTone;
|
|
28
30
|
spark?: readonly number[];
|
|
29
31
|
sparkTone?: KpiIconTone;
|
|
30
32
|
/** Danger emphasis for metrics that need attention, e.g. open incidents. */
|
|
@@ -43,7 +45,7 @@ const toneTextClasses: Record<KpiIconTone, string> = {
|
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
export const KpiCard = forwardRef<HTMLDivElement, KpiCardProps>(
|
|
46
|
-
({ className, label, value, delta, hint, icon, iconTone = 'primary', spark, sparkTone = 'primary', alert, onClick, ...props }, ref) => {
|
|
48
|
+
({ className, label, value, delta, hint, icon, iconTone = 'primary', valueTone, spark, sparkTone = 'primary', alert, onClick, ...props }, ref) => {
|
|
47
49
|
const deltaDirection = delta?.direction ?? (delta?.good === false ? 'down' : 'up');
|
|
48
50
|
const deltaFlat = deltaDirection === 'flat';
|
|
49
51
|
const deltaGood = delta?.good ?? deltaDirection === 'up';
|
|
@@ -67,7 +69,7 @@ export const KpiCard = forwardRef<HTMLDivElement, KpiCardProps>(
|
|
|
67
69
|
<div className="flex items-start justify-between gap-3">
|
|
68
70
|
<div className="min-w-0">
|
|
69
71
|
<p className="truncate text-sm font-medium text-muted-foreground">{label}</p>
|
|
70
|
-
<p className=
|
|
72
|
+
<p className={cn('mt-1 text-2xl font-semibold leading-none tracking-tight', valueTone === 'success' && 'text-success', valueTone === 'warning' && 'text-warning', valueTone === 'destructive' && 'text-destructive', valueTone === 'info' && 'text-info', valueTone === 'violet' && 'text-violet-600', valueTone === 'muted' && 'text-muted-foreground')}>{value}</p>
|
|
71
73
|
</div>
|
|
72
74
|
{icon !== undefined && (
|
|
73
75
|
<span className={cn('flex h-9 w-9 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4', toneTextClasses[iconTone])}>
|