@humain/ui 2.1.63 → 2.1.65

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.
Files changed (160) hide show
  1. package/dist/components/organisms/ai/AIToolCall/AIToolCall.d.ts +9 -3
  2. package/dist/components/organisms/ai/AIToolRun/index.d.ts +1 -1
  3. package/dist/components/organisms/ai/AIToolRun/validation.d.ts +24 -3
  4. package/dist/components/organisms/ai/_shared/format-ai-duration.d.ts +1 -0
  5. package/dist/components/organisms/ai/_shared/workflow-step-renderer.d.ts +1 -0
  6. package/dist/index.js +52 -52
  7. package/dist/index151.js +1 -1
  8. package/dist/index174.js +7 -339
  9. package/dist/index174.js.map +1 -1
  10. package/dist/index175.js +310 -137
  11. package/dist/index175.js.map +1 -1
  12. package/dist/index176.js +148 -174
  13. package/dist/index176.js.map +1 -1
  14. package/dist/index177.js +186 -78
  15. package/dist/index177.js.map +1 -1
  16. package/dist/index178.js +74 -124
  17. package/dist/index178.js.map +1 -1
  18. package/dist/index179.js +133 -1
  19. package/dist/index179.js.map +1 -0
  20. package/dist/index180.js +2 -201
  21. package/dist/index181.js +201 -0
  22. package/dist/{index180.js.map → index181.js.map} +1 -1
  23. package/dist/index183.js +130 -166
  24. package/dist/index183.js.map +1 -1
  25. package/dist/index184.js +195 -983
  26. package/dist/index184.js.map +1 -1
  27. package/dist/index185.js +1069 -369
  28. package/dist/index185.js.map +1 -1
  29. package/dist/index186.js +395 -197
  30. package/dist/index186.js.map +1 -1
  31. package/dist/index187.js +198 -243
  32. package/dist/index187.js.map +1 -1
  33. package/dist/index188.js +263 -3
  34. package/dist/index188.js.map +1 -1
  35. package/dist/index189.js +3 -209
  36. package/dist/index189.js.map +1 -1
  37. package/dist/index190.js +190 -777
  38. package/dist/index190.js.map +1 -1
  39. package/dist/index191.js +771 -252
  40. package/dist/index191.js.map +1 -1
  41. package/dist/index192.js +250 -65
  42. package/dist/index192.js.map +1 -1
  43. package/dist/index193.js +72 -523
  44. package/dist/index193.js.map +1 -1
  45. package/dist/index194.js +537 -144
  46. package/dist/index194.js.map +1 -1
  47. package/dist/index195.js +139 -720
  48. package/dist/index195.js.map +1 -1
  49. package/dist/index196.js +707 -167
  50. package/dist/index196.js.map +1 -1
  51. package/dist/index197.js +175 -151
  52. package/dist/index197.js.map +1 -1
  53. package/dist/index198.js +152 -487
  54. package/dist/index198.js.map +1 -1
  55. package/dist/index199.js +472 -225
  56. package/dist/index199.js.map +1 -1
  57. package/dist/index200.js +236 -260
  58. package/dist/index200.js.map +1 -1
  59. package/dist/index201.js +265 -215
  60. package/dist/index201.js.map +1 -1
  61. package/dist/index202.js +207 -307
  62. package/dist/index202.js.map +1 -1
  63. package/dist/index203.js +302 -135
  64. package/dist/index203.js.map +1 -1
  65. package/dist/index204.js +140 -271
  66. package/dist/index204.js.map +1 -1
  67. package/dist/index205.js +263 -253
  68. package/dist/index205.js.map +1 -1
  69. package/dist/index206.js +244 -137
  70. package/dist/index206.js.map +1 -1
  71. package/dist/index207.js +100 -238
  72. package/dist/index207.js.map +1 -1
  73. package/dist/index208.js +278 -74
  74. package/dist/index208.js.map +1 -1
  75. package/dist/index209.js +56 -97
  76. package/dist/index209.js.map +1 -1
  77. package/dist/index210.js +142 -47
  78. package/dist/index210.js.map +1 -1
  79. package/dist/index211.js +38 -84
  80. package/dist/index211.js.map +1 -1
  81. package/dist/index212.js +72 -252
  82. package/dist/index212.js.map +1 -1
  83. package/dist/index213.js +274 -26
  84. package/dist/index213.js.map +1 -1
  85. package/dist/index214.js +29 -94
  86. package/dist/index214.js.map +1 -1
  87. package/dist/index215.js +98 -25
  88. package/dist/index215.js.map +1 -1
  89. package/dist/index216.js +20 -565
  90. package/dist/index216.js.map +1 -1
  91. package/dist/index217.js +564 -17
  92. package/dist/index217.js.map +1 -1
  93. package/dist/index218.js +20 -23
  94. package/dist/index218.js.map +1 -1
  95. package/dist/index219.js +20 -95
  96. package/dist/index219.js.map +1 -1
  97. package/dist/index220.js +92 -88
  98. package/dist/index220.js.map +1 -1
  99. package/dist/index221.js +97 -29
  100. package/dist/index221.js.map +1 -1
  101. package/dist/index222.js +24 -470
  102. package/dist/index222.js.map +1 -1
  103. package/dist/index223.js +446 -196
  104. package/dist/index223.js.map +1 -1
  105. package/dist/index224.js +199 -729
  106. package/dist/index224.js.map +1 -1
  107. package/dist/index225.js +750 -61
  108. package/dist/index225.js.map +1 -1
  109. package/dist/index226.js +58 -181
  110. package/dist/index226.js.map +1 -1
  111. package/dist/index227.js +175 -259
  112. package/dist/index227.js.map +1 -1
  113. package/dist/index228.js +246 -172
  114. package/dist/index228.js.map +1 -1
  115. package/dist/index229.js +195 -32
  116. package/dist/index229.js.map +1 -1
  117. package/dist/index230.js +12 -40
  118. package/dist/index230.js.map +1 -1
  119. package/dist/index231.js +23 -26
  120. package/dist/index231.js.map +1 -1
  121. package/dist/index232.js +45 -22
  122. package/dist/index232.js.map +1 -1
  123. package/dist/index233.js +27 -48
  124. package/dist/index233.js.map +1 -1
  125. package/dist/index234.js +52 -26
  126. package/dist/index234.js.map +1 -1
  127. package/dist/index235.js +40 -225
  128. package/dist/index235.js.map +1 -1
  129. package/dist/index236.js +217 -39
  130. package/dist/index236.js.map +1 -1
  131. package/dist/index237.js +50 -0
  132. package/dist/index237.js.map +1 -0
  133. package/dist/styles.css +1 -1
  134. package/dist/wc/AIToolCall.js +218 -0
  135. package/dist/wc/AIToolCall.js.map +1 -0
  136. package/dist/wc/hf-ai-tool-call.js +34 -219
  137. package/dist/wc/hf-ai-tool-call.js.map +1 -1
  138. package/dist/wc/hf-ai-tool-run.js +673 -576
  139. package/dist/wc/hf-ai-tool-run.js.map +1 -1
  140. package/dist/wc/workflow-step-renderer.js +79 -78
  141. package/dist/wc/workflow-step-renderer.js.map +1 -1
  142. package/dist/wc-react/AIToolCall.js +218 -0
  143. package/dist/wc-react/AIToolCall.js.map +1 -0
  144. package/dist/wc-react/hf-ai-tool-call.js +32 -217
  145. package/dist/wc-react/hf-ai-tool-call.js.map +1 -1
  146. package/dist/wc-react/hf-ai-tool-run.js +698 -601
  147. package/dist/wc-react/hf-ai-tool-run.js.map +1 -1
  148. package/dist/wc-react/workflow-step-renderer.js +58 -57
  149. package/dist/wc-react/workflow-step-renderer.js.map +1 -1
  150. package/package.json +1 -1
  151. package/skills/humain-ui/SKILL.md +1 -1
  152. package/skills/humain-ui-wc/SKILL.md +1 -1
  153. package/skills/humain-ui-wc.skill +0 -0
  154. package/skills/humain-ui.skill +0 -0
  155. package/dist/index182.js +0 -143
  156. package/dist/index182.js.map +0 -1
  157. package/dist/wc/wrench.js +0 -10
  158. package/dist/wc/wrench.js.map +0 -1
  159. package/dist/wc-react/wrench.js +0 -10
  160. package/dist/wc-react/wrench.js.map +0 -1
package/dist/index199.js CHANGED
@@ -1,258 +1,505 @@
1
1
  import { cn } from "./index2.js";
2
- import { Progress } from "./index17.js";
3
- import { Avatar } from "./index70.js";
2
+ import { Button } from "./index5.js";
3
+ import { ChartContainer } from "./index22.js";
4
+ import { useReducedMotion } from "./index61.js";
4
5
  import { cva } from "class-variance-authority";
5
- import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from "lucide-react";
6
+ import { ArrowUp, ArrowUpRight, Eye, MoreVertical, TrendingUp } from "lucide-react";
6
7
  import * as React from "react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- //#region src/components/organisms/content/NotificationItem/NotificationItem.tsx
9
- var notificationItemVariants = cva("relative flex gap-4 items-start overflow-hidden p-4 rounded-xl border bg-card shadow-sm", {
10
- variants: { variant: {
11
- primary: "",
12
- success: "",
13
- warning: "",
14
- error: "",
15
- gray: "",
16
- avatar: "",
17
- image: "",
18
- progress: "",
19
- none: ""
20
- } },
21
- defaultVariants: { variant: "primary" }
22
- });
23
- var outlineIconVariants = cva("", {
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Area, AreaChart, Line, LineChart } from "recharts";
10
+ //#region src/components/organisms/content/MetricItem/MetricItem.tsx
11
+ var MINI_CHART_MARGIN = {
12
+ top: 0,
13
+ right: 0,
14
+ bottom: 0,
15
+ left: 0
16
+ };
17
+ function getFiniteMetricNumber(value, fallback = 0) {
18
+ return Number.isFinite(value) ? value : fallback;
19
+ }
20
+ function getFinitePositiveMetricNumber(value, fallback) {
21
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
22
+ }
23
+ function getFinitePositiveMetricNumberOrUndefined(value) {
24
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
25
+ }
26
+ function formatMetricValue(value) {
27
+ return typeof value === "number" ? getFiniteMetricNumber(value).toLocaleString() : value;
28
+ }
29
+ var metricMiniChartVariants = cva("relative shrink-0", {
24
30
  variants: { variant: {
25
- primary: "border-primary text-primary",
26
- success: "border-success text-success",
27
- warning: "border-warning text-warning",
28
- error: "border-destructive text-destructive"
31
+ line: "",
32
+ area: "",
33
+ layers: ""
29
34
  } },
30
- defaultVariants: { variant: "primary" }
35
+ defaultVariants: { variant: "line" }
31
36
  });
32
- /** Featured icon with concentric circle outlines */
33
- var OutlineIcon = ({ variant }) => {
34
- const iconClasses = outlineIconVariants({ variant });
35
- const Icon = {
36
- primary: Info,
37
- success: CheckCircle,
38
- warning: AlertTriangle,
39
- error: AlertCircle
40
- }[variant];
41
- return /* @__PURE__ */ jsxs("div", {
42
- className: "relative size-5 shrink-0",
43
- children: [
44
- /* @__PURE__ */ jsx("div", { className: cn("absolute -inset-[45%] rounded-full border-2 opacity-10", iconClasses) }),
45
- /* @__PURE__ */ jsx("div", { className: cn("absolute -inset-[20%] rounded-full border-2 opacity-30", iconClasses) }),
46
- /* @__PURE__ */ jsx(Icon, { className: cn("size-5", iconClasses) })
47
- ]
48
- });
49
- };
50
- /** Modern boxed featured icon */
51
- var BoxedIcon = ({ children }) => /* @__PURE__ */ jsx("div", {
52
- className: "flex size-10 shrink-0 items-center justify-center rounded-lg border border-border bg-card shadow-sm",
53
- children: /* @__PURE__ */ jsx("div", {
54
- className: "text-secondary-foreground",
55
- children
56
- })
57
- });
58
- /** Close button */
59
- var CloseButton = ({ onClick }) => /* @__PURE__ */ jsx("button", {
60
- type: "button",
61
- onClick,
62
- className: "absolute end-1 top-1 flex size-11 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-muted-foreground",
63
- "aria-label": "Close notification",
64
- children: /* @__PURE__ */ jsx(X, { className: "size-5" })
65
- });
66
- /** Action buttons */
67
- var ActionButtons = ({ primaryAction, secondaryAction, stacked = false }) => {
68
- if (!primaryAction && !secondaryAction) return null;
69
- if (stacked) return /* @__PURE__ */ jsxs("div", {
70
- className: "flex flex-col gap-2",
71
- children: [primaryAction && /* @__PURE__ */ jsx("button", {
72
- type: "button",
73
- onClick: primaryAction.onClick,
74
- className: "w-full rounded-lg bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground hover:bg-primary/90 transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",
75
- children: primaryAction.label
76
- }), secondaryAction && /* @__PURE__ */ jsx("button", {
77
- type: "button",
78
- onClick: secondaryAction.onClick,
79
- className: "w-full rounded-lg border border-border bg-card px-3 py-2 text-sm font-semibold text-secondary-foreground hover:bg-surface-2 transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",
80
- children: secondaryAction.label
81
- })]
82
- });
37
+ function MetricMiniChart({ data, color, width, height = 56, variant = "line", showMarker = true, trend = "positive", className, ...props }) {
38
+ const gradientId = React.useId();
39
+ const shouldAnimate = !useReducedMotion();
40
+ const chartColor = color || (trend === "positive" ? "var(--success)" : "var(--destructive)");
41
+ const chartWidth = getFinitePositiveMetricNumberOrUndefined(width);
42
+ const chartHeight = getFinitePositiveMetricNumber(height, 56);
43
+ const safeData = React.useMemo(() => data.map((value) => getFiniteMetricNumber(value)), [data]);
44
+ const chartData = React.useMemo(() => safeData.map((value, index) => ({
45
+ index,
46
+ value
47
+ })), [safeData]);
48
+ const chartConfig = React.useMemo(() => ({ value: { color: chartColor } }), [chartColor]);
49
+ const lastValue = safeData[safeData.length - 1] ?? 0;
50
+ const markerTop = React.useMemo(() => {
51
+ const maxValue = safeData.length > 0 ? Math.max(...safeData) : 0;
52
+ return maxValue <= 0 ? 50 : Math.max(10, Math.min(90, 100 - lastValue / maxValue * 100));
53
+ }, [safeData, lastValue]);
54
+ const rootStyle = React.useMemo(() => ({
55
+ width: chartWidth,
56
+ height: chartHeight
57
+ }), [chartHeight, chartWidth]);
83
58
  return /* @__PURE__ */ jsxs("div", {
84
- className: "flex items-center gap-3",
85
- children: [primaryAction && /* @__PURE__ */ jsx("button", {
86
- type: "button",
87
- onClick: primaryAction.onClick,
88
- className: "min-h-9 py-1.5 text-sm font-semibold text-primary hover:text-primary/80 rounded-sm transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",
89
- children: primaryAction.label
90
- }), secondaryAction && /* @__PURE__ */ jsx("button", {
91
- type: "button",
92
- onClick: secondaryAction.onClick,
93
- className: "min-h-9 py-1.5 text-sm font-semibold text-secondary-foreground hover:text-foreground rounded-sm transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",
94
- children: secondaryAction.label
59
+ "data-slot": "metric-mini-chart",
60
+ "aria-hidden": "true",
61
+ inert: true,
62
+ className: cn(metricMiniChartVariants({ variant }), className),
63
+ style: rootStyle,
64
+ ...props,
65
+ children: [/* @__PURE__ */ jsx(ChartContainer, {
66
+ config: chartConfig,
67
+ className: "size-full",
68
+ children: variant === "layers" ? /* @__PURE__ */ jsxs(AreaChart, {
69
+ data: chartData,
70
+ margin: MINI_CHART_MARGIN,
71
+ children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
72
+ id: `fillArea${gradientId}`,
73
+ x1: "0",
74
+ y1: "0",
75
+ x2: "0",
76
+ y2: "1",
77
+ children: [/* @__PURE__ */ jsx("stop", {
78
+ offset: "0%",
79
+ stopColor: chartColor,
80
+ stopOpacity: .3
81
+ }), /* @__PURE__ */ jsx("stop", {
82
+ offset: "100%",
83
+ stopColor: chartColor,
84
+ stopOpacity: .05
85
+ })]
86
+ }) }), /* @__PURE__ */ jsx(Area, {
87
+ type: "monotone",
88
+ dataKey: "value",
89
+ stroke: chartColor,
90
+ strokeWidth: 2,
91
+ fill: `url(#fillArea${gradientId})`,
92
+ isAnimationActive: shouldAnimate
93
+ })]
94
+ }) : /* @__PURE__ */ jsxs(LineChart, {
95
+ data: chartData,
96
+ margin: MINI_CHART_MARGIN,
97
+ children: [variant === "area" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
98
+ id: `fillLine${gradientId}`,
99
+ x1: "0",
100
+ y1: "0",
101
+ x2: "0",
102
+ y2: "1",
103
+ children: [/* @__PURE__ */ jsx("stop", {
104
+ offset: "0%",
105
+ stopColor: chartColor,
106
+ stopOpacity: .15
107
+ }), /* @__PURE__ */ jsx("stop", {
108
+ offset: "100%",
109
+ stopColor: chartColor,
110
+ stopOpacity: .02
111
+ })]
112
+ }) }), /* @__PURE__ */ jsx(Area, {
113
+ type: "monotone",
114
+ dataKey: "value",
115
+ stroke: "none",
116
+ fill: `url(#fillLine${gradientId})`,
117
+ isAnimationActive: shouldAnimate
118
+ })] }), /* @__PURE__ */ jsx(Line, {
119
+ type: "monotone",
120
+ dataKey: "value",
121
+ stroke: chartColor,
122
+ strokeWidth: 2,
123
+ dot: false,
124
+ isAnimationActive: shouldAnimate
125
+ })]
126
+ })
127
+ }), showMarker && variant === "line" && /* @__PURE__ */ jsxs("div", {
128
+ className: "absolute",
129
+ style: {
130
+ right: 0,
131
+ top: `${markerTop}%`,
132
+ transform: "translate(50%, -50%)"
133
+ },
134
+ children: [/* @__PURE__ */ jsx("div", {
135
+ className: "size-[19px] rounded-full opacity-20",
136
+ style: { backgroundColor: chartColor }
137
+ }), /* @__PURE__ */ jsx("div", {
138
+ className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-[10px] rounded-full bg-background border-2",
139
+ style: { borderColor: chartColor }
140
+ })]
95
141
  })]
96
142
  });
97
- };
98
- function NotificationLeadingElement({ variant, icon, avatarProps, imageSrc, imageAlt }) {
99
- switch (variant) {
100
- case "primary":
101
- case "success":
102
- case "warning":
103
- case "error": return /* @__PURE__ */ jsx(OutlineIcon, { variant });
104
- case "gray": return icon ? /* @__PURE__ */ jsx(BoxedIcon, { children: icon }) : /* @__PURE__ */ jsx(BoxedIcon, { children: /* @__PURE__ */ jsx(Info, { className: "size-5" }) });
105
- case "avatar": return /* @__PURE__ */ jsx("div", {
106
- className: "relative",
107
- children: /* @__PURE__ */ jsx(Avatar, {
108
- size: "md",
109
- indicator: "online",
110
- ...avatarProps
111
- })
112
- });
113
- case "image": return imageSrc ? /* @__PURE__ */ jsx("div", {
114
- className: "size-[72px] shrink-0 overflow-hidden rounded-lg",
115
- children: /* @__PURE__ */ jsx("img", {
116
- src: imageSrc,
117
- alt: imageAlt || "Notification image",
118
- loading: "lazy",
119
- className: "size-full object-cover"
120
- })
121
- }) : null;
122
- case "progress": return icon ? /* @__PURE__ */ jsx(BoxedIcon, { children: icon }) : /* @__PURE__ */ jsx(BoxedIcon, { children: /* @__PURE__ */ jsx(Info, { className: "size-5" }) });
123
- default: return null;
124
- }
125
143
  }
126
- function NotificationContent({ variant, title, supportingText, timestamp, imageSrc, imageAlt, progressValue, progressLabel, primaryAction, secondaryAction, stackedActions }) {
127
- const hasActions = primaryAction || secondaryAction;
128
- if (variant === "progress") return /* @__PURE__ */ jsxs("div", {
129
- className: "flex min-w-0 flex-1 flex-col gap-4 pe-10",
144
+ MetricMiniChart.displayName = "MetricMiniChart";
145
+ var metricChangeVariants = cva("inline-flex items-center gap-0.5", {
146
+ variants: {
147
+ variant: {
148
+ default: "",
149
+ badge: "bg-background border border-border rounded-md shadow-xs px-1.5 py-0.5"
150
+ },
151
+ trend: {
152
+ positive: "",
153
+ negative: ""
154
+ }
155
+ },
156
+ defaultVariants: {
157
+ variant: "default",
158
+ trend: "positive"
159
+ }
160
+ });
161
+ function MetricChange({ value, variant = "default", trend = "positive", icon = "arrow", className, ...props }) {
162
+ const iconColor = trend === "positive" ? "var(--success)" : "var(--destructive)";
163
+ const textColor = variant === "badge" ? "text-secondary-foreground" : trend === "positive" ? "text-success" : "text-destructive";
164
+ const IconComponent = icon === "none" ? null : icon === "trend" ? TrendingUp : icon === "arrow-right" ? ArrowUpRight : ArrowUp;
165
+ const iconSize = variant === "badge" ? 12 : 16;
166
+ return /* @__PURE__ */ jsxs("div", {
167
+ className: cn(metricChangeVariants({
168
+ variant,
169
+ trend
170
+ }), className),
171
+ ...props,
130
172
  children: [
131
- /* @__PURE__ */ jsxs("div", {
132
- className: "flex flex-col gap-1",
133
- children: [/* @__PURE__ */ jsx("h3", {
134
- className: "text-sm font-semibold text-foreground",
135
- children: title
136
- }), supportingText && /* @__PURE__ */ jsx("p", {
137
- className: "text-sm text-secondary-foreground",
138
- children: supportingText
139
- })]
173
+ IconComponent && /* @__PURE__ */ jsx(IconComponent, {
174
+ "aria-hidden": "true",
175
+ width: iconSize,
176
+ height: iconSize,
177
+ color: iconColor,
178
+ className: cn(trend === "negative" && "rotate-180")
140
179
  }),
141
- /* @__PURE__ */ jsx(Progress, {
142
- value: progressValue,
143
- size: "md",
144
- showValue: true,
145
- labelPosition: "inline",
146
- valueFormat: (value) => progressLabel || `${value}%`
180
+ /* @__PURE__ */ jsx("span", {
181
+ className: "sr-only",
182
+ children: trend === "positive" ? "Increased" : "Decreased"
147
183
  }),
148
- hasActions && /* @__PURE__ */ jsx(ActionButtons, {
149
- primaryAction,
150
- secondaryAction,
151
- stacked: stackedActions
184
+ /* @__PURE__ */ jsx("span", {
185
+ className: cn("text-sm font-medium", textColor),
186
+ children: value
152
187
  })
153
188
  ]
154
189
  });
155
- if (variant === "avatar") return /* @__PURE__ */ jsxs("div", {
156
- className: "flex min-w-0 flex-1 flex-col gap-3 pe-10",
157
- children: [/* @__PURE__ */ jsxs("div", {
158
- className: "flex flex-col gap-1",
159
- children: [/* @__PURE__ */ jsxs("div", {
160
- className: "flex items-center gap-2",
161
- children: [/* @__PURE__ */ jsx("h3", {
162
- className: "text-sm font-semibold text-foreground",
190
+ }
191
+ MetricChange.displayName = "MetricChange";
192
+ var metricItemVariants = cva("relative flex flex-col gap-2 p-5 bg-background rounded-xl border border-border shadow-xs transition-shadow duration-200 ease-out hover:shadow-sm motion-reduce:transition-none", {
193
+ variants: {
194
+ type: {
195
+ simple: "",
196
+ "icon-01": "",
197
+ "icon-02": "",
198
+ "icon-03": "",
199
+ "icon-04": "flex-row items-center",
200
+ "chart-01": "",
201
+ "chart-02": "",
202
+ "chart-03": "",
203
+ "chart-04": "p-0 bg-transparent border-0 shadow-none"
204
+ },
205
+ breakpoint: {
206
+ desktop: "",
207
+ mobile: ""
208
+ }
209
+ },
210
+ defaultVariants: {
211
+ type: "simple",
212
+ breakpoint: "desktop"
213
+ }
214
+ });
215
+ var MetricItem = React.memo(function MetricItem({ title, value, changeValue, changeTrend = "positive", changeIcon, comparisonText, subtitle, showDropdown = false, showActions = false, onViewReport, onDropdownClick, icon, iconBgColor, iconColor, chartData, featuredIconVariant = "circle", type = "simple", breakpoint = "desktop", className, children, ...props }) {
216
+ const displayIcon = icon || /* @__PURE__ */ jsx(TrendingUp, {
217
+ width: 24,
218
+ height: 24
219
+ });
220
+ const displayValue = formatMetricValue(value);
221
+ const defaultIconBgColor = type === "icon-01" ? featuredIconVariant === "modern" ? "var(--muted)" : "var(--success-muted)" : type === "icon-02" || type === "icon-03" || type === "icon-04" ? "var(--muted)" : "var(--success-muted)";
222
+ const defaultIconColor = type === "icon-01" ? featuredIconVariant === "modern" ? "var(--secondary-foreground)" : "var(--success)" : type === "icon-02" ? "var(--secondary-foreground)" : "var(--success)";
223
+ const finalIconBgColor = iconBgColor || defaultIconBgColor;
224
+ const finalIconColor = iconColor || defaultIconColor;
225
+ if (type === "chart-04") return /* @__PURE__ */ jsx("div", {
226
+ "data-slot": "metric-item",
227
+ className: cn(metricItemVariants({
228
+ type,
229
+ breakpoint
230
+ }), className),
231
+ ...props,
232
+ children: /* @__PURE__ */ jsxs("div", {
233
+ className: "flex flex-col gap-0.5 w-full",
234
+ children: [/* @__PURE__ */ jsx("div", {
235
+ className: "flex items-center px-5 pt-3 pb-2 w-full",
236
+ children: /* @__PURE__ */ jsx("p", {
237
+ className: "flex-1 text-sm font-semibold text-foreground",
163
238
  children: title
164
- }), timestamp && /* @__PURE__ */ jsx("span", {
165
- className: "text-sm text-text-quaternary",
166
- children: timestamp
167
- })]
168
- }), supportingText && /* @__PURE__ */ jsx("p", {
169
- className: "text-sm text-secondary-foreground",
170
- children: supportingText
239
+ })
240
+ }), /* @__PURE__ */ jsxs("div", {
241
+ className: "relative bg-background border border-border rounded-xl shadow-xs p-5 flex flex-col gap-5",
242
+ children: [
243
+ /* @__PURE__ */ jsxs("div", {
244
+ className: "flex flex-wrap items-center gap-3",
245
+ children: [/* @__PURE__ */ jsx("p", {
246
+ className: "text-display-sm font-semibold text-foreground",
247
+ children: displayValue
248
+ }), changeValue && /* @__PURE__ */ jsxs("div", {
249
+ className: "flex items-center gap-2",
250
+ children: [/* @__PURE__ */ jsx(MetricChange, {
251
+ value: changeValue,
252
+ trend: changeTrend,
253
+ icon: changeIcon ?? "trend"
254
+ }), comparisonText && /* @__PURE__ */ jsx("span", {
255
+ className: "text-sm font-medium text-muted-foreground",
256
+ children: comparisonText
257
+ })]
258
+ })]
259
+ }),
260
+ children ? children : chartData ? /* @__PURE__ */ jsx(MetricMiniChart, {
261
+ data: chartData,
262
+ width: void 0,
263
+ height: 56,
264
+ variant: "line",
265
+ showMarker: false,
266
+ trend: changeTrend,
267
+ className: "w-full"
268
+ }) : null,
269
+ showDropdown && /* @__PURE__ */ jsx("button", {
270
+ type: "button",
271
+ "aria-label": "More options",
272
+ className: "absolute top-2 end-2 p-3 cursor-pointer rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background transition-colors duration-150 ease-out hover:text-foreground",
273
+ onClick: onDropdownClick,
274
+ children: /* @__PURE__ */ jsx(MoreVertical, {
275
+ width: 20,
276
+ height: 20,
277
+ className: "text-muted-foreground"
278
+ })
279
+ })
280
+ ]
171
281
  })]
172
- }), hasActions && /* @__PURE__ */ jsx(ActionButtons, {
173
- primaryAction,
174
- secondaryAction,
175
- stacked: stackedActions
176
- })]
282
+ })
177
283
  });
178
- if (variant === "image") return /* @__PURE__ */ jsxs("div", {
179
- className: "flex min-w-0 flex-1 flex-col gap-3 pe-10",
284
+ return /* @__PURE__ */ jsxs("div", {
285
+ "data-slot": "metric-item",
286
+ className: cn(metricItemVariants({
287
+ type,
288
+ breakpoint
289
+ }), className),
290
+ ...props,
180
291
  children: [
181
- /* @__PURE__ */ jsxs("div", {
182
- className: "flex flex-col gap-1",
183
- children: [/* @__PURE__ */ jsx("h3", {
184
- className: "text-sm font-semibold text-foreground",
292
+ type === "icon-01" && /* @__PURE__ */ jsxs("div", {
293
+ className: cn("flex items-center justify-center shrink-0 relative overflow-clip", featuredIconVariant === "modern" ? "rounded-[10px] border border-border shadow-xs" : featuredIconVariant === "square" ? "rounded-[10px] border border-border shadow-xs" : "rounded-full"),
294
+ style: {
295
+ width: 48,
296
+ height: 48,
297
+ backgroundColor: finalIconBgColor,
298
+ color: finalIconColor
299
+ },
300
+ children: [displayIcon, featuredIconVariant === "modern" && /* @__PURE__ */ jsx("div", {
301
+ className: "absolute inset-0 pointer-events-none rounded-[10px]",
302
+ style: { boxShadow: "var(--shadow-inset-ring)" }
303
+ })]
304
+ }),
305
+ (type === "icon-02" || type === "icon-03") && /* @__PURE__ */ jsxs("div", {
306
+ className: "flex items-center gap-3 w-full",
307
+ children: [/* @__PURE__ */ jsx("div", {
308
+ className: cn("flex items-center justify-center shrink-0", type === "icon-02" ? "rounded-full" : "rounded-lg border border-border shadow-xs"),
309
+ style: {
310
+ width: 48,
311
+ height: 48,
312
+ backgroundColor: finalIconBgColor,
313
+ color: finalIconColor
314
+ },
315
+ children: icon || /* @__PURE__ */ jsx(Eye, {
316
+ width: 24,
317
+ height: 24
318
+ })
319
+ }), /* @__PURE__ */ jsx("p", {
320
+ className: "flex-1 text-base font-semibold text-foreground",
185
321
  children: title
186
- }), supportingText && /* @__PURE__ */ jsx("p", {
187
- className: "text-sm text-secondary-foreground",
188
- children: supportingText
189
322
  })]
190
323
  }),
191
- imageSrc && /* @__PURE__ */ jsx("div", {
192
- className: "w-full aspect-video overflow-hidden rounded-lg",
193
- children: /* @__PURE__ */ jsx("img", {
194
- src: imageSrc,
195
- alt: imageAlt || "Notification image",
196
- loading: "lazy",
197
- className: "size-full object-cover"
324
+ type === "icon-04" && /* @__PURE__ */ jsx("div", {
325
+ className: cn("flex items-center justify-center shrink-0 rounded-md border border-border shadow-xs"),
326
+ style: {
327
+ width: 40,
328
+ height: 40,
329
+ backgroundColor: finalIconBgColor,
330
+ color: finalIconColor
331
+ },
332
+ children: icon || /* @__PURE__ */ jsx(TrendingUp, {
333
+ width: 20,
334
+ height: 20
198
335
  })
199
336
  }),
200
- hasActions && /* @__PURE__ */ jsx(ActionButtons, {
201
- primaryAction,
202
- secondaryAction,
203
- stacked: stackedActions
204
- })
205
- ]
206
- });
207
- return /* @__PURE__ */ jsxs("div", {
208
- className: "flex min-w-0 flex-1 flex-col gap-3 pe-10 pt-0.5",
209
- children: [/* @__PURE__ */ jsxs("div", {
210
- className: "flex flex-col gap-1",
211
- children: [/* @__PURE__ */ jsx("h3", {
212
- className: "text-sm font-semibold text-foreground",
213
- children: title
214
- }), supportingText && /* @__PURE__ */ jsx("p", {
215
- className: "text-sm text-secondary-foreground",
216
- children: supportingText
217
- })]
218
- }), hasActions && /* @__PURE__ */ jsx(ActionButtons, {
219
- primaryAction,
220
- secondaryAction
221
- })]
222
- });
223
- }
224
- var NotificationItem = React.memo(function NotificationItem({ variant = "primary", title, supportingText, showCloseButton = true, onClose, primaryAction, secondaryAction, icon, avatarProps, timestamp, imageSrc, imageAlt, progressValue = 0, progressLabel, stackedActions = false, className, ...props }) {
225
- return /* @__PURE__ */ jsxs("article", {
226
- "data-slot": "notification-item",
227
- className: cn(notificationItemVariants({ variant }), "transition-shadow duration-200 ease-out hover:shadow-md motion-reduce:transition-none", className),
228
- ...props,
229
- children: [
230
- /* @__PURE__ */ jsx(NotificationLeadingElement, {
231
- variant,
232
- icon,
233
- avatarProps,
234
- imageSrc,
235
- imageAlt
337
+ type !== "icon-02" && type !== "icon-03" && /* @__PURE__ */ jsxs("div", {
338
+ className: cn("flex flex-col gap-2", type === "icon-04" ? "flex-1 min-w-0" : "w-full"),
339
+ children: [type === "chart-01" || type === "chart-02" ? /* @__PURE__ */ jsx("p", {
340
+ className: "text-base font-semibold text-foreground",
341
+ children: title
342
+ }) : type === "icon-04" || type === "icon-01" ? /* @__PURE__ */ jsx("p", {
343
+ className: "text-sm font-semibold text-muted-foreground",
344
+ children: title
345
+ }) : /* @__PURE__ */ jsx("p", {
346
+ className: "text-sm font-medium text-muted-foreground",
347
+ children: title
348
+ }), type === "simple" || type === "icon-01" || type === "icon-04" ? /* @__PURE__ */ jsxs("div", {
349
+ className: "flex flex-wrap items-center justify-between gap-3 w-full",
350
+ children: [/* @__PURE__ */ jsx("p", {
351
+ className: "text-display-sm font-semibold text-foreground",
352
+ children: displayValue
353
+ }), changeValue && comparisonText ? /* @__PURE__ */ jsxs("div", {
354
+ className: "flex items-center gap-2",
355
+ children: [/* @__PURE__ */ jsx(MetricChange, {
356
+ value: changeValue,
357
+ trend: changeTrend,
358
+ icon: "arrow"
359
+ }), /* @__PURE__ */ jsx("span", {
360
+ className: "text-sm font-medium text-muted-foreground",
361
+ children: comparisonText
362
+ })]
363
+ }) : changeValue ? /* @__PURE__ */ jsx(MetricChange, {
364
+ value: changeValue,
365
+ trend: changeTrend,
366
+ icon: changeIcon ?? "arrow-right",
367
+ variant: "badge"
368
+ }) : subtitle ? /* @__PURE__ */ jsx("span", {
369
+ className: "text-sm font-medium text-muted-foreground",
370
+ children: subtitle
371
+ }) : null]
372
+ }) : null]
373
+ }),
374
+ type === "chart-01" && /* @__PURE__ */ jsxs("div", {
375
+ className: "flex items-end gap-4 w-full",
376
+ children: [/* @__PURE__ */ jsxs("div", {
377
+ className: "flex-1 flex flex-col gap-3",
378
+ children: [/* @__PURE__ */ jsx("p", {
379
+ className: "text-display-sm font-semibold text-foreground",
380
+ children: displayValue
381
+ }), (changeValue || comparisonText) && /* @__PURE__ */ jsxs("div", {
382
+ className: "flex items-center gap-2",
383
+ children: [changeValue && /* @__PURE__ */ jsx(MetricChange, {
384
+ value: changeValue,
385
+ trend: changeTrend,
386
+ icon: "arrow"
387
+ }), comparisonText && /* @__PURE__ */ jsx("span", {
388
+ className: "text-sm font-medium text-muted-foreground truncate",
389
+ children: comparisonText
390
+ })]
391
+ })]
392
+ }), chartData && /* @__PURE__ */ jsx(MetricMiniChart, {
393
+ data: chartData,
394
+ width: 112,
395
+ height: 56,
396
+ variant: "line",
397
+ trend: changeTrend
398
+ })]
236
399
  }),
237
- /* @__PURE__ */ jsx(NotificationContent, {
238
- variant,
239
- title,
240
- supportingText,
241
- timestamp,
242
- imageSrc,
243
- imageAlt,
244
- progressValue,
245
- progressLabel,
246
- primaryAction,
247
- secondaryAction,
248
- stackedActions
400
+ type === "chart-02" && /* @__PURE__ */ jsxs("div", {
401
+ className: "flex items-end gap-4 w-full",
402
+ children: [/* @__PURE__ */ jsxs("div", {
403
+ className: "flex-1 flex items-start gap-2",
404
+ children: [/* @__PURE__ */ jsx("p", {
405
+ className: "text-display-md font-semibold text-foreground",
406
+ children: displayValue
407
+ }), changeValue && /* @__PURE__ */ jsx(MetricChange, {
408
+ value: changeValue,
409
+ trend: changeTrend,
410
+ icon: "trend"
411
+ })]
412
+ }), chartData && /* @__PURE__ */ jsx(MetricMiniChart, {
413
+ data: chartData,
414
+ width: 128,
415
+ height: 56,
416
+ variant: "layers",
417
+ showMarker: false,
418
+ trend: changeTrend
419
+ })]
249
420
  }),
250
- showCloseButton && /* @__PURE__ */ jsx(CloseButton, { onClick: onClose })
421
+ type === "chart-03" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
422
+ className: "flex flex-col gap-2 w-full",
423
+ children: [/* @__PURE__ */ jsx("p", {
424
+ className: "text-sm font-medium text-muted-foreground",
425
+ children: title
426
+ }), /* @__PURE__ */ jsxs("div", {
427
+ className: "flex flex-wrap items-center justify-between gap-3 w-full",
428
+ children: [/* @__PURE__ */ jsx("p", {
429
+ className: "text-display-sm font-semibold text-foreground",
430
+ children: displayValue
431
+ }), (changeValue || comparisonText) && /* @__PURE__ */ jsxs("div", {
432
+ className: "flex items-center gap-2",
433
+ children: [changeValue && /* @__PURE__ */ jsx(MetricChange, {
434
+ value: changeValue,
435
+ trend: changeTrend,
436
+ icon: "trend"
437
+ }), comparisonText && /* @__PURE__ */ jsx("span", {
438
+ className: "text-sm font-medium text-muted-foreground",
439
+ children: comparisonText
440
+ })]
441
+ })]
442
+ })]
443
+ }), chartData && /* @__PURE__ */ jsx(MetricMiniChart, {
444
+ data: chartData,
445
+ height: 72,
446
+ variant: "area",
447
+ showMarker: false,
448
+ trend: changeTrend,
449
+ className: "w-full"
450
+ })] }),
451
+ (type === "icon-02" || type === "icon-03") && /* @__PURE__ */ jsxs("div", {
452
+ className: "flex items-end gap-4 w-full",
453
+ children: [/* @__PURE__ */ jsxs("div", {
454
+ className: "flex-1 flex flex-col gap-3",
455
+ children: [/* @__PURE__ */ jsx("p", {
456
+ className: "text-display-md font-semibold text-foreground",
457
+ children: displayValue
458
+ }), (changeValue || comparisonText) && /* @__PURE__ */ jsxs("div", {
459
+ className: "flex items-center gap-2",
460
+ children: [changeValue && /* @__PURE__ */ jsx(MetricChange, {
461
+ value: changeValue,
462
+ trend: changeTrend,
463
+ icon: type === "icon-03" ? "trend" : "arrow"
464
+ }), comparisonText && /* @__PURE__ */ jsx("span", {
465
+ className: "text-sm font-medium text-muted-foreground truncate",
466
+ children: comparisonText
467
+ })]
468
+ })]
469
+ }), chartData && /* @__PURE__ */ jsx(MetricMiniChart, {
470
+ data: chartData,
471
+ width: 112,
472
+ height: 56,
473
+ variant: "line",
474
+ trend: changeTrend
475
+ })]
476
+ }),
477
+ showDropdown && /* @__PURE__ */ jsx("button", {
478
+ type: "button",
479
+ "aria-label": "More options",
480
+ className: "absolute top-2 end-2 cursor-pointer rounded-sm p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background transition-colors duration-150 ease-out hover:text-foreground",
481
+ onClick: onDropdownClick,
482
+ children: /* @__PURE__ */ jsx(MoreVertical, {
483
+ width: 20,
484
+ height: 20,
485
+ className: "text-muted-foreground"
486
+ })
487
+ }),
488
+ showActions && /* @__PURE__ */ jsx("div", {
489
+ className: "flex items-center gap-2 pt-2",
490
+ children: /* @__PURE__ */ jsx(Button, {
491
+ appearance: "outline",
492
+ variant: "secondary",
493
+ size: "sm",
494
+ onClick: onViewReport,
495
+ children: "View report"
496
+ })
497
+ })
251
498
  ]
252
499
  });
253
500
  });
254
- NotificationItem.displayName = "NotificationItem";
501
+ MetricItem.displayName = "MetricItem";
255
502
  //#endregion
256
- export { NotificationItem, notificationItemVariants };
503
+ export { MetricChange, MetricItem, MetricMiniChart, metricChangeVariants, metricItemVariants, metricMiniChartVariants };
257
504
 
258
505
  //# sourceMappingURL=index199.js.map