@hybridcore/ui 1.6.6 → 1.6.7

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.
@@ -1,16 +1,16 @@
1
- import { styled as a, alpha as C, Stack as g, Typography as s } from "@mui/material";
1
+ import { styled as i, alpha as C, Stack as g, Typography as d } from "@mui/material";
2
2
  import { Widget as f } from "../widget/styled.js";
3
- import { variantColor as d, resolvePaletteColor as p, trendColor as u } from "./helpers.js";
3
+ import { variantColor as s, resolvePaletteColor as p, trendColor as u } from "./helpers.js";
4
4
  const e = {
5
5
  shouldForwardProp: (o) => o !== "ownerState"
6
- }, v = a(f.Root, {
6
+ }, v = i(f.Root, {
7
7
  name: "HCMetricCard",
8
8
  slot: "Root",
9
9
  ...e
10
- })(({ theme: o, ownerState: i }) => {
11
- const n = d(o, i.variant), t = i.layout === "panel";
10
+ })(({ theme: o, ownerState: n }) => {
11
+ const t = s(o, n.variant), a = n.layout === "panel";
12
12
  let r;
13
- return n ? r = C(n, 0.05) : t && (r = o.palette.background.default), {
13
+ return t ? r = C(t, 0.05) : a && (r = o.palette.background.default), {
14
14
  position: "relative",
15
15
  overflow: "hidden",
16
16
  padding: o.spacing(1.5, 2),
@@ -19,7 +19,7 @@ const e = {
19
19
  padding: o.spacing(1.5)
20
20
  }
21
21
  };
22
- }), y = a(g, {
22
+ }), y = i(g, {
23
23
  name: "HCMetricCard",
24
24
  slot: "Content"
25
25
  })(() => ({
@@ -27,46 +27,55 @@ const e = {
27
27
  width: "100%",
28
28
  minWidth: 0,
29
29
  zIndex: 1
30
- })), m = a(s, {
30
+ })), m = i(d, {
31
31
  name: "HCMetricCard",
32
32
  slot: "Label"
33
33
  })(({ theme: o }) => ({
34
34
  color: o.palette.text.secondary,
35
35
  marginBottom: o.spacing(0.5),
36
36
  fontWeight: 500
37
- })), k = a(s, {
37
+ })), k = i(d, {
38
38
  name: "HCMetricCard",
39
39
  slot: "Value",
40
40
  ...e
41
- })(({ theme: o, ownerState: i }) => {
42
- const n = p(o, i.calculatedValueColor), t = p(o, i.calculatedValueBg);
41
+ })(({ theme: o, ownerState: n }) => {
42
+ const t = p(o, n.calculatedValueColor), a = p(o, n.calculatedValueBg);
43
43
  return {
44
- color: n ?? d(o, i.variant) ?? o.palette.text.primary,
44
+ color: t ?? s(o, n.variant) ?? o.palette.text.primary,
45
45
  fontWeight: 500,
46
46
  marginBottom: o.spacing(0.5),
47
47
  whiteSpace: "nowrap",
48
- ...t && {
49
- backgroundColor: t,
48
+ ...a && {
49
+ backgroundColor: a,
50
50
  borderRadius: o.shape.borderRadius,
51
51
  padding: o.spacing(0, 0.75)
52
52
  },
53
53
  [o.breakpoints.down("md")]: { fontSize: "1.35rem" },
54
54
  [o.breakpoints.up("md")]: { fontSize: "2rem" }
55
55
  };
56
- }), I = a("div", {
56
+ }), w = i(d, {
57
+ name: "HCMetricCard",
58
+ slot: "SecondValue"
59
+ })(({ theme: o }) => ({
60
+ color: o.palette.text.secondary,
61
+ fontWeight: 400,
62
+ whiteSpace: "nowrap",
63
+ [o.breakpoints.down("md")]: { fontSize: "0.95rem" },
64
+ [o.breakpoints.up("md")]: { fontSize: "1.25rem" }
65
+ })), H = i("div", {
57
66
  name: "HCMetricCard",
58
67
  slot: "TrendContainer",
59
68
  ...e
60
- })(({ theme: o, ownerState: i }) => {
61
- const n = u(o, i.calculatedTrend), t = i.layout === "panel";
69
+ })(({ theme: o, ownerState: n }) => {
70
+ const t = u(o, n.calculatedTrend), a = n.layout === "panel";
62
71
  return {
63
72
  display: "inline-flex",
64
73
  alignItems: "center",
65
74
  gap: o.spacing(0.5),
66
75
  fontWeight: 500,
67
- color: n,
68
- ...t ? {
69
- backgroundColor: C(n, 0.14),
76
+ color: t,
77
+ ...a ? {
78
+ backgroundColor: C(t, 0.14),
70
79
  borderRadius: 999,
71
80
  padding: o.spacing(0.25, 1),
72
81
  fontSize: "0.8125rem",
@@ -79,7 +88,7 @@ const e = {
79
88
  }
80
89
  }
81
90
  };
82
- }), H = a(s, {
91
+ }), I = i(d, {
83
92
  name: "HCMetricCard",
84
93
  slot: "Description"
85
94
  })(({ theme: o }) => ({
@@ -87,37 +96,37 @@ const e = {
87
96
  display: "block",
88
97
  position: "relative",
89
98
  zIndex: 1
90
- })), P = a("div", {
99
+ })), S = i("div", {
91
100
  name: "HCMetricCard",
92
101
  slot: "Icon",
93
102
  ...e
94
- })(({ theme: o, ownerState: i }) => ({
103
+ })(({ theme: o, ownerState: n }) => ({
95
104
  display: "flex",
96
105
  alignItems: "center",
97
106
  justifyContent: "center",
98
- color: d(o, i.variant) ?? o.palette.text.secondary,
99
- marginRight: i.iconPosition === "left" ? o.spacing(2) : 0,
100
- marginLeft: i.iconPosition === "right" ? o.spacing(2) : 0,
107
+ color: s(o, n.variant) ?? o.palette.text.secondary,
108
+ marginRight: n.iconPosition === "left" ? o.spacing(2) : 0,
109
+ marginLeft: n.iconPosition === "right" ? o.spacing(2) : 0,
101
110
  [o.breakpoints.down("sm")]: {
102
111
  position: "absolute",
103
112
  top: o.spacing(2),
104
113
  left: o.spacing(2),
105
114
  margin: 0
106
115
  }
107
- })), R = a("div", {
116
+ })), z = i("div", {
108
117
  name: "HCMetricCard",
109
118
  slot: "CornerIcon",
110
119
  ...e
111
- })(({ theme: o, ownerState: i }) => {
112
- var l, c;
113
- const n = {}, t = (l = i.iconPosition) != null && l.startsWith("top") ? "top" : "bottom", r = (c = i.iconPosition) != null && c.endsWith("left") ? "left" : "right";
114
- return n[t] = o.spacing(2), n[r] = o.spacing(2), {
120
+ })(({ theme: o, ownerState: n }) => {
121
+ var c, l;
122
+ const t = {}, a = (c = n.iconPosition) != null && c.startsWith("top") ? "top" : "bottom", r = (l = n.iconPosition) != null && l.endsWith("left") ? "left" : "right";
123
+ return t[a] = o.spacing(2), t[r] = o.spacing(2), {
115
124
  position: "absolute",
116
- ...n,
117
- color: d(o, i.variant) ?? o.palette.text.secondary,
125
+ ...t,
126
+ color: s(o, n.variant) ?? o.palette.text.secondary,
118
127
  zIndex: 2
119
128
  };
120
- }), w = a("div", {
129
+ }), P = i("div", {
121
130
  name: "HCMetricCard",
122
131
  slot: "Chart"
123
132
  })(({ theme: o }) => ({
@@ -130,7 +139,7 @@ const e = {
130
139
  alignItems: "flex-end",
131
140
  overflow: "hidden",
132
141
  borderRadius: o.shape.borderRadius
133
- })), z = a("div", {
142
+ })), R = i("div", {
134
143
  name: "HCMetricCard",
135
144
  slot: "Panel"
136
145
  })(({ theme: o }) => ({
@@ -147,7 +156,7 @@ const e = {
147
156
  backgroundColor: o.palette.background.paper,
148
157
  boxShadow: o.shadows[1],
149
158
  overflow: "hidden"
150
- })), S = a("div", {
159
+ })), W = i("div", {
151
160
  name: "HCMetricCard",
152
161
  slot: "SideChart"
153
162
  })(() => ({
@@ -160,15 +169,16 @@ const e = {
160
169
  alignItems: "flex-end"
161
170
  }));
162
171
  export {
163
- w as MetricCardChartContainer,
172
+ P as MetricCardChartContainer,
164
173
  y as MetricCardContent,
165
- R as MetricCardCornerIconContainer,
166
- H as MetricCardDescription,
167
- P as MetricCardIconContainer,
174
+ z as MetricCardCornerIconContainer,
175
+ I as MetricCardDescription,
176
+ S as MetricCardIconContainer,
168
177
  m as MetricCardLabel,
169
- z as MetricCardPanel,
178
+ R as MetricCardPanel,
170
179
  v as MetricCardRoot,
171
- S as MetricCardSideChart,
172
- I as MetricCardTrendContainer,
180
+ w as MetricCardSecondValue,
181
+ W as MetricCardSideChart,
182
+ H as MetricCardTrendContainer,
173
183
  k as MetricCardValue
174
184
  };
@@ -1,4 +1,4 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
2
  import { Typography as i, Divider as f, TableContainer as I, Table as R, TableHead as j, TableRow as g, TableCell as r, TableBody as w, Box as D, IconButton as G } from "@mui/material";
3
3
  import { useSimplePivotTableLogic as J } from "./logic.js";
4
4
  import { SimplePivotTableRoot as M, SimplePivotTableHeader as O, SimplePivotTableContent as V, SimplePivotTableFooter as X, SimplePivotTableScrollHint as q } from "./styled.js";
@@ -19,7 +19,7 @@ const Z = (s) => {
19
19
  formatDimensionValue: y,
20
20
  formatCell: C,
21
21
  getCellStyle: F,
22
- ownerState: t,
22
+ ownerState: o,
23
23
  scrollRef: N,
24
24
  canScroll: k,
25
25
  scrollModifierLabel: P,
@@ -33,18 +33,18 @@ const Z = (s) => {
33
33
  data: h,
34
34
  summaries: v
35
35
  };
36
- return /* @__PURE__ */ o(
36
+ return /* @__PURE__ */ t(
37
37
  M,
38
38
  {
39
- ownerState: t,
39
+ ownerState: o,
40
40
  sx: H,
41
41
  "data-snapshot": JSON.stringify(W),
42
42
  ...L,
43
43
  children: [
44
- /* @__PURE__ */ e(O, { ownerState: t, children: /* @__PURE__ */ e(i, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: m }) }),
44
+ /* @__PURE__ */ e(O, { ownerState: o, children: /* @__PURE__ */ e(i, { sx: { paddingLeft: "0.5rem" }, variant: "h3", children: m }) }),
45
45
  /* @__PURE__ */ e(f, {}),
46
- /* @__PURE__ */ e(V, { ownerState: t, children: /* @__PURE__ */ e(I, { ref: N, children: /* @__PURE__ */ o(R, { size: "small", stickyHeader: !0, children: [
47
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ o(g, { children: [
46
+ /* @__PURE__ */ e(V, { ownerState: o, children: /* @__PURE__ */ e(I, { ref: N, children: /* @__PURE__ */ t(R, { size: "small", stickyHeader: !0, children: [
47
+ /* @__PURE__ */ e(j, { children: /* @__PURE__ */ t(g, { children: [
48
48
  n.map((l) => /* @__PURE__ */ e(r, { children: /* @__PURE__ */ e(i, { variant: "caption", fontWeight: 600, children: x(l) }) }, l.value)),
49
49
  c.map((l) => /* @__PURE__ */ e(
50
50
  r,
@@ -62,7 +62,7 @@ const Z = (s) => {
62
62
  l.dataFieldName
63
63
  ))
64
64
  ] }) }),
65
- /* @__PURE__ */ e(w, { children: h.map((l, z) => /* @__PURE__ */ o(
65
+ /* @__PURE__ */ e(w, { children: h.map((l, z) => /* @__PURE__ */ t(
66
66
  g,
67
67
  {
68
68
  hover: !0,
@@ -90,7 +90,7 @@ const Z = (s) => {
90
90
  {
91
91
  variant: "body2",
92
92
  fontWeight: 500,
93
- color: u.color ?? "primary.main",
93
+ color: u.color ?? "text.primary",
94
94
  children: C(l[a.dataFieldName], a.format)
95
95
  }
96
96
  )
@@ -104,13 +104,13 @@ const Z = (s) => {
104
104
  )) })
105
105
  ] }) }) }),
106
106
  /* @__PURE__ */ e(f, {}),
107
- /* @__PURE__ */ o(X, { ownerState: t, children: [
108
- k && /* @__PURE__ */ e(q, { ownerState: t, children: /* @__PURE__ */ o(i, { variant: "caption", children: [
107
+ /* @__PURE__ */ t(X, { ownerState: o, children: [
108
+ k && /* @__PURE__ */ e(q, { ownerState: o, children: /* @__PURE__ */ t(i, { variant: "caption", children: [
109
109
  "Hold ",
110
110
  P,
111
111
  " to scroll"
112
112
  ] }) }),
113
- d ? /* @__PURE__ */ o(
113
+ d ? /* @__PURE__ */ t(
114
114
  D,
115
115
  {
116
116
  sx: {
@@ -122,7 +122,7 @@ const Z = (s) => {
122
122
  },
123
123
  children: [
124
124
  /* @__PURE__ */ e(i, { variant: "caption", fontWeight: 600, children: d.name }),
125
- d.items.map((l) => /* @__PURE__ */ o(i, { variant: "caption", color: "text.secondary", children: [
125
+ d.items.map((l) => /* @__PURE__ */ t(i, { variant: "caption", color: "text.secondary", children: [
126
126
  l.label,
127
127
  ": ",
128
128
  l.value
package/dist/main.d.ts CHANGED
@@ -260,6 +260,15 @@ export declare interface ChartProps {
260
260
  * a custom theme to override per-deployment.
261
261
  */
262
262
  colors?: readonly string[];
263
+ /**
264
+ * Controls whether a line series bridges gaps in the data. When `true` (the
265
+ * default) the line is drawn continuously across missing points. When `false`,
266
+ * the line breaks wherever data is missing — on a date axis a gap is detected
267
+ * when the spacing between adjacent points exceeds the base interval, so
268
+ * absent dates become visible breaks instead of a straight fill. Line-type
269
+ * charts only.
270
+ */
271
+ connectMissingData?: boolean;
263
272
  sx?: SxProps<Theme>;
264
273
  }
265
274
 
@@ -1191,6 +1200,12 @@ export declare interface MetricCardDataPoint {
1191
1200
  export declare interface MetricCardProps {
1192
1201
  label: string;
1193
1202
  value: MetricCardDataPoint[];
1203
+ // Optional denominator series rendered as a muted "value / secondValue" pair.
1204
+ // Like `value`, only the latest point is shown; it never picks up conditional
1205
+ // coloring. Formatted by `secondValueFormat` when set, else falls back to
1206
+ // `format` (so a "/ " separator can be carried as `secondValueFormat.prefix`).
1207
+ secondValue?: MetricCardDataPoint[];
1208
+ secondValueFormat?: ValueFormat;
1194
1209
  description?: string;
1195
1210
  variant?: MetricVariant;
1196
1211
  loading?: boolean;
@@ -1634,9 +1649,11 @@ export declare type RelativeDatePreset =
1634
1649
  export declare const removeNotification: (id: string) => void;
1635
1650
 
1636
1651
  /**
1637
- * Resolve the color/background contributed by the first matching conditional
1638
- * rule. Returns an empty object when the value is non-numeric or nothing
1639
- * matches, so callers can spread it safely.
1652
+ * Resolve a value's text/background color: the format's base `color`/
1653
+ * `backgroundColor` apply unconditionally, then the first matching conditional
1654
+ * rule overrides them per-field (a rule that only sets one color keeps the base
1655
+ * for the other). Returns an empty object when nothing is configured, so callers
1656
+ * can spread it safely.
1640
1657
  */
1641
1658
  export declare const resolveConditionalStyle: (value: unknown, format?: ValueFormat) => {
1642
1659
  color?: string;
@@ -2176,7 +2193,12 @@ export declare interface ValueFormat {
2176
2193
  suffix?: string;
2177
2194
  /** Fixed number of fraction digits; defaults to "up to 2" when unset. */
2178
2195
  decimals?: number;
2179
- /** First matching rule wins. */
2196
+ /** Base text color applied unconditionally (theme token path or CSS color). A
2197
+ * matching `conditionalRules` entry overrides it. */
2198
+ color?: string;
2199
+ /** Base background color applied unconditionally. A matching rule overrides it. */
2200
+ backgroundColor?: string;
2201
+ /** First matching rule wins; its colors override the base `color`/`backgroundColor`. */
2180
2202
  conditionalRules?: ConditionalRule[];
2181
2203
  }
2182
2204
 
@@ -3321,6 +3343,7 @@ declare module "@mui/material/styles" {
3321
3343
  | "content"
3322
3344
  | "label"
3323
3345
  | "value"
3346
+ | "secondValue"
3324
3347
  | "trendContainer"
3325
3348
  | "description"
3326
3349
  | "icon"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.6.6",
4
+ "version": "1.6.7",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",