@umituz/web-design-system 4.7.0 → 4.7.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-design-system",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
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.",
|
|
@@ -512,6 +512,14 @@ describe('fleet surface supersets', () => {
|
|
|
512
512
|
expect(el.className).toContain('bg-destructive');
|
|
513
513
|
});
|
|
514
514
|
|
|
515
|
+
it('KpiCard flat delta renders muted without an icon', () => {
|
|
516
|
+
const { container } = render(<KpiCard label="Renewals" value="4" delta={{ value: '4 renew ≤45d', direction: 'flat' }} />);
|
|
517
|
+
expect(container.textContent).toContain('4 renew ≤45d');
|
|
518
|
+
const delta = container.querySelector('.text-muted-foreground + span, span.inline-flex');
|
|
519
|
+
expect(container.querySelector('svg.lucide-trending-up, svg.lucide-trending-down')).toBeNull();
|
|
520
|
+
expect(delta).not.toBeNull();
|
|
521
|
+
});
|
|
522
|
+
|
|
515
523
|
it('KpiCard onClick is interactive and fires', () => {
|
|
516
524
|
const onClick = vi.fn();
|
|
517
525
|
const { container } = render(<KpiCard label="Open" value="7" onClick={onClick} />);
|
|
@@ -14,7 +14,7 @@ export type KpiIconTone = 'primary' | 'success' | 'warning' | 'destructive' | 'i
|
|
|
14
14
|
|
|
15
15
|
export interface KpiDelta {
|
|
16
16
|
value: ReactNode;
|
|
17
|
-
direction?: 'up' | 'down';
|
|
17
|
+
direction?: 'up' | 'down' | 'flat';
|
|
18
18
|
good?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -45,8 +45,9 @@ const toneTextClasses: Record<KpiIconTone, string> = {
|
|
|
45
45
|
export const KpiCard = forwardRef<HTMLDivElement, KpiCardProps>(
|
|
46
46
|
({ className, label, value, delta, hint, icon, iconTone = 'primary', spark, sparkTone = 'primary', alert, onClick, ...props }, ref) => {
|
|
47
47
|
const deltaDirection = delta?.direction ?? (delta?.good === false ? 'down' : 'up');
|
|
48
|
+
const deltaFlat = deltaDirection === 'flat';
|
|
48
49
|
const deltaGood = delta?.good ?? deltaDirection === 'up';
|
|
49
|
-
const DeltaIcon = deltaDirection === 'up' ? TrendingUp : TrendingDown;
|
|
50
|
+
const DeltaIcon = deltaFlat ? null : deltaDirection === 'up' ? TrendingUp : TrendingDown;
|
|
50
51
|
const interactive = onClick !== undefined;
|
|
51
52
|
return (
|
|
52
53
|
<Card
|
|
@@ -81,10 +82,10 @@ export const KpiCard = forwardRef<HTMLDivElement, KpiCardProps>(
|
|
|
81
82
|
<span
|
|
82
83
|
className={cn(
|
|
83
84
|
'inline-flex items-center gap-1 font-medium',
|
|
84
|
-
deltaGood ? 'text-success' : 'text-destructive'
|
|
85
|
+
deltaFlat ? 'text-muted-foreground' : deltaGood ? 'text-success' : 'text-destructive'
|
|
85
86
|
)}
|
|
86
87
|
>
|
|
87
|
-
<DeltaIcon className="h-3.5 w-3.5" />
|
|
88
|
+
{DeltaIcon !== null && <DeltaIcon className="h-3.5 w-3.5" />}
|
|
88
89
|
{delta.value}
|
|
89
90
|
</span>
|
|
90
91
|
)}
|