@axzydev/axzy_ui_system 1.7.1 → 1.7.3
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/index.cjs +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/segmented-control/segmented-control.tsx +3 -0
- package/src/components/molecules/card/card.tsx +12 -0
- package/src/components/molecules/stat-card/stat-card.props.ts +7 -0
- package/src/components/molecules/stat-card/stat-card.tsx +28 -0
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ export default function ITSegmentedControl({
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<div
|
|
37
|
+
role="group"
|
|
37
38
|
className={clsx(
|
|
38
39
|
"inline-flex rounded-xl bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700",
|
|
39
40
|
container,
|
|
@@ -46,6 +47,8 @@ export default function ITSegmentedControl({
|
|
|
46
47
|
return (
|
|
47
48
|
<button
|
|
48
49
|
key={opt.value}
|
|
50
|
+
type="button"
|
|
51
|
+
aria-pressed={isActive}
|
|
49
52
|
onClick={() => !disabled && onChange(opt.value)}
|
|
50
53
|
disabled={disabled}
|
|
51
54
|
className={clsx(
|
|
@@ -73,6 +73,18 @@ export default function ITCard({
|
|
|
73
73
|
onClick={onClick}
|
|
74
74
|
onMouseEnter={() => onClick && setIsHovered(true)}
|
|
75
75
|
onMouseLeave={() => onClick && setIsHovered(false)}
|
|
76
|
+
role={onClick ? "button" : undefined}
|
|
77
|
+
tabIndex={onClick ? 0 : undefined}
|
|
78
|
+
onKeyDown={
|
|
79
|
+
onClick
|
|
80
|
+
? (e) => {
|
|
81
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
onClick();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
: undefined
|
|
87
|
+
}
|
|
76
88
|
className={clsx("overflow-hidden flex flex-col", className)}
|
|
77
89
|
style={containerStyle}
|
|
78
90
|
>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties } from "react";
|
|
2
|
+
import { ColorsTypes } from "@/types/colors.types";
|
|
2
3
|
|
|
3
4
|
export interface ITStatCardProps {
|
|
4
5
|
/** The metric label displayed above the value. */
|
|
@@ -7,6 +8,12 @@ export interface ITStatCardProps {
|
|
|
7
8
|
value: string | number;
|
|
8
9
|
/** Optional trend indicator text (e.g. "+12%", "-3"). */
|
|
9
10
|
trend?: string;
|
|
11
|
+
/** Optional secondary line under the value (context, not a trend). */
|
|
12
|
+
hint?: string;
|
|
13
|
+
/** Optional progress 0–100 rendered under the hint. */
|
|
14
|
+
progress?: number;
|
|
15
|
+
/** Semantic color for the progress bar. @default "primary" */
|
|
16
|
+
progressColor?: ColorsTypes;
|
|
10
17
|
/** Direction of the trend, used to color the trend badge. */
|
|
11
18
|
trendDirection?: "up" | "down" | "neutral";
|
|
12
19
|
/** Icon element rendered next to the label in the top-right corner. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
2
|
import { ITStatCardProps } from "./stat-card.props";
|
|
3
3
|
import ITText from "@/components/atoms/text/text";
|
|
4
|
+
import ITProgress from "@/components/atoms/progress/progress";
|
|
4
5
|
|
|
5
6
|
const trendColors = {
|
|
6
7
|
up: "text-emerald-600 bg-emerald-50 dark:text-emerald-400 dark:bg-emerald-950/30",
|
|
@@ -23,6 +24,9 @@ export default function ITStatCard({
|
|
|
23
24
|
value,
|
|
24
25
|
trend,
|
|
25
26
|
trendDirection = trend && trend.startsWith("-") ? "down" : "neutral",
|
|
27
|
+
hint,
|
|
28
|
+
progress,
|
|
29
|
+
progressColor = "primary",
|
|
26
30
|
icon,
|
|
27
31
|
color = "bg-primary-50 dark:bg-primary-950/20",
|
|
28
32
|
className,
|
|
@@ -36,6 +40,16 @@ export default function ITStatCard({
|
|
|
36
40
|
onClick={onClick}
|
|
37
41
|
role={onClick ? "button" : undefined}
|
|
38
42
|
tabIndex={onClick ? 0 : undefined}
|
|
43
|
+
onKeyDown={
|
|
44
|
+
onClick
|
|
45
|
+
? (e) => {
|
|
46
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
onClick();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
: undefined
|
|
52
|
+
}
|
|
39
53
|
>
|
|
40
54
|
<div className="flex items-start justify-between mb-1">
|
|
41
55
|
<ITText as="span" className="text-xs font-medium text-slate-400 dark:text-slate-500">{label}</ITText>
|
|
@@ -49,6 +63,20 @@ export default function ITStatCard({
|
|
|
49
63
|
</ITText>
|
|
50
64
|
)}
|
|
51
65
|
</div>
|
|
66
|
+
{hint && (
|
|
67
|
+
<ITText as="p" className="mt-1 text-[11px] leading-snug text-slate-500 dark:text-slate-400">
|
|
68
|
+
{hint}
|
|
69
|
+
</ITText>
|
|
70
|
+
)}
|
|
71
|
+
{progress !== undefined && (
|
|
72
|
+
<ITProgress
|
|
73
|
+
value={progress}
|
|
74
|
+
max={100}
|
|
75
|
+
color={progressColor}
|
|
76
|
+
size="sm"
|
|
77
|
+
className="mt-2"
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
52
80
|
</div>
|
|
53
81
|
);
|
|
54
82
|
}
|