@hybridcore/ui 1.6.29 → 1.6.30
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/components/charts/line/logic.js +124 -101
- package/dist/components/data-list/logic.js +131 -137
- package/dist/components/metric-card/MetricChart.js +60 -58
- package/dist/components/metric-card/index.js +53 -40
- package/dist/components/metric-card/logic.js +66 -57
- package/dist/components/metric-card/styled.js +13 -9
- package/dist/components/paginated-list/helpers.js +8 -0
- package/dist/components/paginated-list/index.js +144 -61
- package/dist/components/paginated-list/logic.js +84 -47
- package/dist/components/paginated-list/styled.js +154 -17
- package/dist/hooks/useInfinitePaging.js +51 -0
- package/dist/main.d.ts +115 -3
- package/package.json +1 -1
|
@@ -1,56 +1,93 @@
|
|
|
1
|
-
import { useThemeProps as
|
|
2
|
-
import { useState as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useThemeProps as Y } from "@mui/material";
|
|
2
|
+
import { useState as w } from "react";
|
|
3
|
+
import Z from "../../hooks/useInfinitePaging.js";
|
|
4
|
+
const ae = (I) => {
|
|
5
|
+
const h = Y({ props: I, name: "HCPaginatedList" }), {
|
|
6
|
+
title: R,
|
|
7
|
+
data: r = [],
|
|
8
|
+
payload: s,
|
|
8
9
|
totalCount: x,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
variant: l = "list",
|
|
11
|
+
itemIcon: b,
|
|
12
|
+
metaSeparator: v = "•",
|
|
13
|
+
maxCards: C = 4,
|
|
14
|
+
cardsLayout: g = "rail",
|
|
15
|
+
infinite: D = !1,
|
|
16
|
+
resetKey: M,
|
|
17
|
+
loadingMore: N = !1,
|
|
18
|
+
rowsPerPage: S = 10,
|
|
19
|
+
onViewAll: T,
|
|
20
|
+
onChange: a,
|
|
21
|
+
onItemClick: i,
|
|
22
|
+
selectionMode: p = !1,
|
|
23
|
+
selected: c = [],
|
|
24
|
+
onSelectionChange: f,
|
|
25
|
+
sx: y,
|
|
26
|
+
...E
|
|
27
|
+
} = h, [G, m] = w(0), [A, H] = w(S), [K, O] = w([]), d = (s == null ? void 0 : s.pageNumber) !== void 0 ? s.pageNumber : G, o = (s == null ? void 0 : s.rows) !== void 0 ? s.rows : A, V = (e, t) => {
|
|
28
|
+
m(t), a && a({ ...s, pageNumber: t, rows: o });
|
|
29
|
+
}, _ = (e) => {
|
|
30
|
+
const t = parseInt(e.target.value, 10);
|
|
31
|
+
H(t), m(0), a && a({ ...s, pageNumber: 0, rows: t });
|
|
32
|
+
}, j = (e) => {
|
|
33
|
+
const n = c.indexOf(e.id) === -1 ? [...c, e.id] : c.filter((u) => u !== e.id);
|
|
34
|
+
f == null || f(n, e);
|
|
35
|
+
}, k = (e) => () => {
|
|
36
|
+
if (p) {
|
|
37
|
+
j(e);
|
|
27
38
|
return;
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
(n) => n.includes(e.id) ? n.filter((
|
|
40
|
+
i == null || i(e);
|
|
41
|
+
}, q = (e) => (t) => {
|
|
42
|
+
p || (t.stopPropagation(), O(
|
|
43
|
+
(n) => n.includes(e.id) ? n.filter((u) => u !== e.id) : [...n, e.id]
|
|
33
44
|
));
|
|
34
|
-
},
|
|
45
|
+
}, z = a ? x || 0 : r.length, P = l === "cards" && g === "grid" && D, {
|
|
46
|
+
displayData: B,
|
|
47
|
+
hasMore: F,
|
|
48
|
+
isLoadingMore: J,
|
|
49
|
+
scrollRef: Q,
|
|
50
|
+
sentinelRef: U
|
|
51
|
+
} = Z({
|
|
52
|
+
data: r,
|
|
53
|
+
totalCount: x,
|
|
54
|
+
page: d,
|
|
55
|
+
rowsPerPage: o,
|
|
56
|
+
payload: s,
|
|
57
|
+
onChange: a,
|
|
58
|
+
resetKey: M,
|
|
59
|
+
loadingMore: N,
|
|
60
|
+
enabled: P
|
|
61
|
+
}), W = a ? r : r.slice(d * o, (d + 1) * o), L = P ? B : W, X = { ...h };
|
|
35
62
|
return {
|
|
36
|
-
title:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
title: R,
|
|
64
|
+
variant: l,
|
|
65
|
+
itemIcon: b,
|
|
66
|
+
metaSeparator: v,
|
|
67
|
+
onViewAll: T,
|
|
68
|
+
cardsLayout: g,
|
|
69
|
+
isInfinite: P,
|
|
70
|
+
hasMore: F,
|
|
71
|
+
isLoadingMore: J,
|
|
72
|
+
refs: { scrollRef: Q, sentinelRef: U },
|
|
73
|
+
// The rail is a preview and caps itself; the grid is the whole page and does not.
|
|
74
|
+
displayData: l === "cards" && g === "rail" ? L.slice(0, C) : L,
|
|
75
|
+
count: z,
|
|
76
|
+
page: d,
|
|
77
|
+
rowsPerPage: o,
|
|
78
|
+
expanded: K,
|
|
79
|
+
selectionMode: p,
|
|
80
|
+
selected: c,
|
|
81
|
+
handleChangePage: V,
|
|
82
|
+
handleChangeRowsPerPage: _,
|
|
83
|
+
handleItemClick: k,
|
|
84
|
+
handleExpandToggle: q,
|
|
85
|
+
onItemClick: i,
|
|
86
|
+
ownerState: X,
|
|
87
|
+
sx: y,
|
|
88
|
+
other: E
|
|
52
89
|
};
|
|
53
90
|
};
|
|
54
91
|
export {
|
|
55
|
-
|
|
92
|
+
ae as usePaginatedListLogic
|
|
56
93
|
};
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
const
|
|
1
|
+
import { styled as a, Paper as o, Box as e, List as s, Button as d, Typography as i } from "@mui/material";
|
|
2
|
+
const g = a(o, {
|
|
3
3
|
name: "HCPaginatedList",
|
|
4
4
|
slot: "Root"
|
|
5
5
|
})(() => ({
|
|
6
6
|
display: "flex",
|
|
7
7
|
flexDirection: "column",
|
|
8
8
|
height: "100%"
|
|
9
|
-
})),
|
|
9
|
+
})), c = a(e, {
|
|
10
10
|
name: "HCPaginatedList",
|
|
11
11
|
slot: "Header"
|
|
12
|
-
})(({ theme:
|
|
12
|
+
})(({ theme: t }) => ({
|
|
13
13
|
flex: "0 0 auto",
|
|
14
|
-
padding:
|
|
15
|
-
|
|
14
|
+
padding: t.spacing(1.25, 2),
|
|
15
|
+
// The `cards` variant hangs "View all" off the right of the title line; the
|
|
16
|
+
// list variant has a title and nothing else, so the row is harmless there.
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "space-between",
|
|
20
|
+
gap: t.spacing(1)
|
|
21
|
+
})), p = a(e, {
|
|
16
22
|
name: "HCPaginatedList",
|
|
17
23
|
slot: "Content"
|
|
18
24
|
})(() => ({
|
|
@@ -22,32 +28,163 @@ const s = t(n, {
|
|
|
22
28
|
flex: "1 1 auto",
|
|
23
29
|
minHeight: 0,
|
|
24
30
|
overflow: "hidden"
|
|
25
|
-
})),
|
|
31
|
+
})), C = a(s, {
|
|
26
32
|
name: "HCPaginatedList",
|
|
27
33
|
slot: "List"
|
|
28
34
|
})(() => ({
|
|
29
35
|
flex: 1,
|
|
30
36
|
overflowY: "auto"
|
|
31
|
-
})),
|
|
37
|
+
})), f = a("div", {
|
|
32
38
|
name: "HCPaginatedList",
|
|
33
39
|
slot: "Pagination"
|
|
34
|
-
})(({ theme:
|
|
35
|
-
borderTop: `1px solid ${
|
|
40
|
+
})(({ theme: t }) => ({
|
|
41
|
+
borderTop: `1px solid ${t.palette.divider}`,
|
|
36
42
|
".MuiToolbar-root": {
|
|
37
43
|
minHeight: 24,
|
|
38
|
-
paddingLeft:
|
|
44
|
+
paddingLeft: t.spacing(1)
|
|
39
45
|
},
|
|
40
46
|
".MuiTablePagination-actions .MuiButtonBase-root": {
|
|
41
|
-
padding:
|
|
47
|
+
padding: t.spacing(0.5)
|
|
42
48
|
},
|
|
43
49
|
".MuiTablePagination-displayedRows": {
|
|
44
50
|
lineHeight: 1
|
|
45
51
|
}
|
|
52
|
+
})), x = a(d, {
|
|
53
|
+
name: "HCPaginatedList",
|
|
54
|
+
slot: "ViewAll"
|
|
55
|
+
})(() => ({
|
|
56
|
+
textTransform: "none",
|
|
57
|
+
flex: "0 0 auto"
|
|
58
|
+
})), l = 320, L = a(e, {
|
|
59
|
+
name: "HCPaginatedList",
|
|
60
|
+
slot: "CardRail",
|
|
61
|
+
shouldForwardProp: (t) => t !== "grid"
|
|
62
|
+
})(({ theme: t, grid: n }) => ({
|
|
63
|
+
minHeight: 0,
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "stretch",
|
|
66
|
+
gap: t.spacing(2),
|
|
67
|
+
...n ? {
|
|
68
|
+
// Wraps and lets the *page* scroll. No `overflow` here on purpose: the rail
|
|
69
|
+
// has no bounded height, so `auto` would produce no scrollbar and leave the
|
|
70
|
+
// sentinel permanently in view, pulling page after page.
|
|
71
|
+
flex: "1 1 auto",
|
|
72
|
+
flexWrap: "wrap",
|
|
73
|
+
alignContent: "flex-start"
|
|
74
|
+
} : {
|
|
75
|
+
flex: "0 0 auto",
|
|
76
|
+
overflow: "hidden"
|
|
77
|
+
}
|
|
78
|
+
})), P = a(e, {
|
|
79
|
+
name: "HCPaginatedList",
|
|
80
|
+
slot: "Card"
|
|
81
|
+
})(({ theme: t }) => ({
|
|
82
|
+
// Equal shares of the row: the rail does not scroll, so cards divide the width
|
|
83
|
+
// rather than spilling out of it. `flex-basis: 0` stops a long title widening its
|
|
84
|
+
// card; the grid overrides the basis so cards wrap instead of shrinking to slivers.
|
|
85
|
+
flex: "1 1 0",
|
|
86
|
+
minWidth: 0,
|
|
87
|
+
// Height follows the content, capped so one long summary cannot make a card
|
|
88
|
+
// twice its neighbours.
|
|
89
|
+
maxHeight: l,
|
|
90
|
+
display: "flex",
|
|
91
|
+
flexDirection: "column",
|
|
92
|
+
gap: t.spacing(1),
|
|
93
|
+
padding: t.spacing(2),
|
|
94
|
+
borderRadius: t.shape.borderRadius,
|
|
95
|
+
backgroundColor: t.palette.background.paper,
|
|
96
|
+
overflow: "hidden"
|
|
97
|
+
})), m = a(e, {
|
|
98
|
+
name: "HCPaginatedList",
|
|
99
|
+
slot: "CardHeader"
|
|
100
|
+
})(({ theme: t }) => ({
|
|
101
|
+
display: "flex",
|
|
102
|
+
alignItems: "flex-start",
|
|
103
|
+
gap: t.spacing(1)
|
|
104
|
+
})), H = a(e, {
|
|
105
|
+
name: "HCPaginatedList",
|
|
106
|
+
slot: "CardIcon"
|
|
107
|
+
})(() => ({
|
|
108
|
+
flex: "0 0 auto",
|
|
109
|
+
display: "flex",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
justifyContent: "center"
|
|
112
|
+
})), u = a(i, {
|
|
113
|
+
name: "HCPaginatedList",
|
|
114
|
+
slot: "CardTitle"
|
|
115
|
+
})(() => ({
|
|
116
|
+
// Clamped, not truncated: a one-line ellipsis loses too much of a headline.
|
|
117
|
+
display: "-webkit-box",
|
|
118
|
+
WebkitBoxOrient: "vertical",
|
|
119
|
+
WebkitLineClamp: 3,
|
|
120
|
+
overflow: "hidden"
|
|
121
|
+
})), y = a(i, {
|
|
122
|
+
name: "HCPaginatedList",
|
|
123
|
+
slot: "CardDescription"
|
|
124
|
+
})(({ theme: t }) => ({
|
|
125
|
+
// `0 1 auto`, not `1`: a short summary ends under itself instead of pushing the
|
|
126
|
+
// footer to the cap. Growing it also stopped the clamp from biting.
|
|
127
|
+
flex: "0 1 auto",
|
|
128
|
+
minHeight: 0,
|
|
129
|
+
color: t.palette.text.secondary,
|
|
130
|
+
display: "-webkit-box",
|
|
131
|
+
WebkitBoxOrient: "vertical",
|
|
132
|
+
WebkitLineClamp: 5,
|
|
133
|
+
overflow: "hidden",
|
|
134
|
+
// `-webkit-box-orient` is non-standard and some prefixers drop it, leaving the
|
|
135
|
+
// clamp inert; the height cap makes the cut deterministic either way.
|
|
136
|
+
maxHeight: "calc(5 * 1.5em)"
|
|
137
|
+
})), b = a(e, {
|
|
138
|
+
name: "HCPaginatedList",
|
|
139
|
+
slot: "CardFooter"
|
|
140
|
+
})(() => ({
|
|
141
|
+
flex: "0 0 auto",
|
|
142
|
+
// Pushed to the card's foot so the date and the arrow sit on one line across
|
|
143
|
+
// the whole rail, whatever each summary's length.
|
|
144
|
+
marginTop: "auto",
|
|
145
|
+
paddingTop: 8,
|
|
146
|
+
display: "flex",
|
|
147
|
+
alignItems: "center",
|
|
148
|
+
justifyContent: "space-between",
|
|
149
|
+
gap: 8
|
|
150
|
+
})), w = a(i, {
|
|
151
|
+
name: "HCPaginatedList",
|
|
152
|
+
slot: "CardMeta"
|
|
153
|
+
})(({ theme: t }) => ({
|
|
154
|
+
color: t.palette.text.secondary,
|
|
155
|
+
whiteSpace: "nowrap"
|
|
156
|
+
})), h = a(e, {
|
|
157
|
+
name: "HCPaginatedList",
|
|
158
|
+
slot: "CardAction"
|
|
159
|
+
})(({ theme: t }) => ({
|
|
160
|
+
display: "flex",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
color: t.palette.text.secondary
|
|
163
|
+
})), v = a(e, {
|
|
164
|
+
name: "HCPaginatedList",
|
|
165
|
+
slot: "LoadMore"
|
|
166
|
+
})(({ theme: t }) => ({
|
|
167
|
+
flex: "1 0 100%",
|
|
168
|
+
display: "flex",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
justifyContent: "center",
|
|
171
|
+
minHeight: t.spacing(5)
|
|
46
172
|
}));
|
|
47
173
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
174
|
+
P as PaginatedListCard,
|
|
175
|
+
h as PaginatedListCardAction,
|
|
176
|
+
y as PaginatedListCardDescription,
|
|
177
|
+
b as PaginatedListCardFooter,
|
|
178
|
+
m as PaginatedListCardHeader,
|
|
179
|
+
H as PaginatedListCardIcon,
|
|
180
|
+
w as PaginatedListCardMeta,
|
|
181
|
+
L as PaginatedListCardRail,
|
|
182
|
+
u as PaginatedListCardTitle,
|
|
183
|
+
p as PaginatedListContent,
|
|
184
|
+
c as PaginatedListHeader,
|
|
185
|
+
C as PaginatedListList,
|
|
186
|
+
v as PaginatedListLoadMore,
|
|
187
|
+
f as PaginatedListPagination,
|
|
188
|
+
g as PaginatedListRoot,
|
|
189
|
+
x as PaginatedListViewAll
|
|
53
190
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useRef as o, useState as $, useMemo as k, useCallback as j, useEffect as E } from "react";
|
|
2
|
+
const q = "120px", F = ({
|
|
3
|
+
data: r,
|
|
4
|
+
totalCount: L,
|
|
5
|
+
page: s,
|
|
6
|
+
rowsPerPage: u,
|
|
7
|
+
payload: v,
|
|
8
|
+
onChange: l,
|
|
9
|
+
resetKey: N,
|
|
10
|
+
loading: O = !1,
|
|
11
|
+
loadingMore: B = !1,
|
|
12
|
+
enabled: t = !0
|
|
13
|
+
}) => {
|
|
14
|
+
const I = o(null), p = o(null), e = !!l, [x, y] = $(u), f = o(/* @__PURE__ */ new Map()), M = o(null), R = `${N ?? ""}`, A = o(R), c = o(null);
|
|
15
|
+
A.current !== R && (A.current = R, f.current.clear(), c.current = null, M.current = null), t && e && r !== M.current && (M.current = r, s === 0 && f.current.clear(), f.current.set(s, r), c.current === s && (c.current = null));
|
|
16
|
+
const D = k(() => !t || !e ? r : Array.from(f.current.keys()).sort((n, i) => n - i).flatMap((n) => f.current.get(n) ?? []), [t, e, r, s]), G = e ? L ?? 0 : r.length, S = k(() => t ? e ? D : r.slice(0, x) : r, [t, e, D, r, x]), m = t && S.length < G, _ = j(() => {
|
|
17
|
+
if (!e) {
|
|
18
|
+
y((i) => i + u);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const n = s + 1;
|
|
22
|
+
c.current === null && (c.current = n, l == null || l({
|
|
23
|
+
...v,
|
|
24
|
+
pageNumber: n,
|
|
25
|
+
rows: u
|
|
26
|
+
}));
|
|
27
|
+
}, [e, u, s, l, v]);
|
|
28
|
+
return E(() => {
|
|
29
|
+
if (!t || !m || O) return;
|
|
30
|
+
const n = p.current;
|
|
31
|
+
if (!n || typeof IntersectionObserver > "u") return;
|
|
32
|
+
const i = new IntersectionObserver(
|
|
33
|
+
(T) => {
|
|
34
|
+
T.some((V) => V.isIntersecting) && _();
|
|
35
|
+
},
|
|
36
|
+
{ root: I.current, rootMargin: q }
|
|
37
|
+
);
|
|
38
|
+
return i.observe(n), () => i.disconnect();
|
|
39
|
+
}, [t, m, O, _]), E(() => {
|
|
40
|
+
t && !e && y(u);
|
|
41
|
+
}, [t, e, u, R, r.length]), {
|
|
42
|
+
displayData: S,
|
|
43
|
+
hasMore: m,
|
|
44
|
+
isLoadingMore: B || c.current !== null,
|
|
45
|
+
scrollRef: I,
|
|
46
|
+
sentinelRef: p
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
F as default
|
|
51
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -286,6 +286,24 @@ export declare interface ChartProps {
|
|
|
286
286
|
* timeline. Date-dimension charts only.
|
|
287
287
|
*/
|
|
288
288
|
skipEmptyDates?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Fill the band between the line and the axis, fading from the series' own
|
|
291
|
+
* color down to transparent. Off by default: without it the chart draws a
|
|
292
|
+
* stroke only, which is the look every consumer had before this prop existed.
|
|
293
|
+
*
|
|
294
|
+
* Applies to **single-series** line charts only. A gradient under every line of
|
|
295
|
+
* a multi-series chart buries the lines beneath it, so the fill is skipped there
|
|
296
|
+
* even when this is on — which lets a deployment turn it on theme-wide without
|
|
297
|
+
* having to exempt its multi-series panels one by one.
|
|
298
|
+
*
|
|
299
|
+
* Line-type charts only.
|
|
300
|
+
*/
|
|
301
|
+
areaFill?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Dash pattern for the line stroke as am5 `[dash, gap]` pixel lengths, e.g.
|
|
304
|
+
* `[6, 4]`. Unset draws a solid line. Line-type charts only.
|
|
305
|
+
*/
|
|
306
|
+
strokeDasharray?: number[];
|
|
289
307
|
sx?: SxProps<Theme>;
|
|
290
308
|
}
|
|
291
309
|
|
|
@@ -1558,7 +1576,7 @@ export { Map_2 as Map }
|
|
|
1558
1576
|
export declare const MetricCard: (props: MetricCardProps) => JSX_2.Element;
|
|
1559
1577
|
|
|
1560
1578
|
export declare type MetricCardComponentOverride<Theme = unknown> = {
|
|
1561
|
-
defaultProps?: MetricCardProps
|
|
1579
|
+
defaultProps?: Partial<MetricCardProps>;
|
|
1562
1580
|
styleOverrides?: ComponentsOverrides_2<Theme>["HCMetricCard"];
|
|
1563
1581
|
};
|
|
1564
1582
|
|
|
@@ -1607,11 +1625,27 @@ export declare interface MetricCardProps {
|
|
|
1607
1625
|
showChart?: boolean;
|
|
1608
1626
|
chartType?: MetricChartType;
|
|
1609
1627
|
|
|
1628
|
+
// Color of the sparkline — line stroke, column fill and the gradient stops all
|
|
1629
|
+
// derive from it. Defaults to `theme.palette.divider`, the muted look the card
|
|
1630
|
+
// shipped with. Set it per deployment through
|
|
1631
|
+
// `components.HCMetricCard.defaultProps` to brand the chart.
|
|
1632
|
+
chartColor?: string;
|
|
1633
|
+
|
|
1634
|
+
// How the area under a line sparkline is filled:
|
|
1635
|
+
// "gradient" — fades from the series colour down to transparent
|
|
1636
|
+
// "solid" — a flat translucent wash
|
|
1637
|
+
// "none" — stroke only
|
|
1638
|
+
// Defaults to "gradient" for the `panel` layout and "solid" for `overlay`, the look
|
|
1639
|
+
// each layout already had.
|
|
1640
|
+
chartFill?: MetricChartFill;
|
|
1641
|
+
|
|
1610
1642
|
sx?: SxProps<Theme>;
|
|
1611
1643
|
}
|
|
1612
1644
|
|
|
1613
1645
|
export declare type MetricChangeType = "percentage" | "absolute";
|
|
1614
1646
|
|
|
1647
|
+
declare type MetricChartFill = "none" | "solid" | "gradient";
|
|
1648
|
+
|
|
1615
1649
|
export declare interface MetricChartSnapshot {
|
|
1616
1650
|
metric: string;
|
|
1617
1651
|
value: number;
|
|
@@ -1778,6 +1812,9 @@ export declare type PackedCirclesProps = ChartProps;
|
|
|
1778
1812
|
|
|
1779
1813
|
export declare const PaginatedList: (inProps: PaginatedListProps) => JSX_2.Element;
|
|
1780
1814
|
|
|
1815
|
+
/** How the `cards` variant arranges itself — see `PaginatedListProps.cardsLayout`. */
|
|
1816
|
+
declare type PaginatedListCardsLayout = "rail" | "grid";
|
|
1817
|
+
|
|
1781
1818
|
export declare type PaginatedListComponentOverride<Theme = unknown> = {
|
|
1782
1819
|
defaultProps?: Partial<PaginatedListProps>;
|
|
1783
1820
|
styleOverrides?: ComponentsOverrides_2<Theme>["HCPaginatedList"];
|
|
@@ -1788,11 +1825,63 @@ export declare interface PaginatedListItem {
|
|
|
1788
1825
|
title: string;
|
|
1789
1826
|
description: string;
|
|
1790
1827
|
icon?: React.ReactNode;
|
|
1828
|
+
/**
|
|
1829
|
+
* Footnote line under the card — a date, a source, an author. Empty segments drop
|
|
1830
|
+
* out so a missing field leaves no dangling separator. Same contract as
|
|
1831
|
+
* `DataListItem.meta`, so a list moved between the two keeps its mapping.
|
|
1832
|
+
* `cards` variant only.
|
|
1833
|
+
*/
|
|
1834
|
+
meta?: (string | number | null | undefined)[];
|
|
1791
1835
|
}
|
|
1792
1836
|
|
|
1793
1837
|
export declare interface PaginatedListProps {
|
|
1794
1838
|
title?: string;
|
|
1795
1839
|
data: PaginatedListItem[];
|
|
1840
|
+
variant?: PaginatedListVariant;
|
|
1841
|
+
/**
|
|
1842
|
+
* Mark for cards carrying no `icon` of their own — a widget's mapping has no field
|
|
1843
|
+
* for one, so the deployment names it. A component, not an element, so a theme file
|
|
1844
|
+
* needs no JSX; sized and tinted by the `cardIcon` slot. `cards` variant only.
|
|
1845
|
+
*/
|
|
1846
|
+
itemIcon?: React.ElementType;
|
|
1847
|
+
/** Joins `item.meta` segments. Matches `DataListProps.metaSeparator`. */
|
|
1848
|
+
metaSeparator?: string;
|
|
1849
|
+
/**
|
|
1850
|
+
* How many cards the rail draws; the rest is reached through `onViewAll` rather
|
|
1851
|
+
* than a sideways scroll. Ignored under `cardsLayout: "grid"`.
|
|
1852
|
+
*/
|
|
1853
|
+
maxCards?: number;
|
|
1854
|
+
/**
|
|
1855
|
+
* How the cards are arranged. `rail` (default) is one capped row with no pager — a
|
|
1856
|
+
* preview. `grid` wraps every card onto as many rows as it takes and brings the
|
|
1857
|
+
* pager back. One setting rather than separate wrap/cap/pager flags: the three
|
|
1858
|
+
* always move together.
|
|
1859
|
+
*/
|
|
1860
|
+
cardsLayout?: PaginatedListCardsLayout;
|
|
1861
|
+
/**
|
|
1862
|
+
* Reveal rows as the grid is scrolled instead of drawing a pager. `grid` layout
|
|
1863
|
+
* only — a rail shows one screenful by design and has nothing to scroll into.
|
|
1864
|
+
*/
|
|
1865
|
+
infinite?: boolean;
|
|
1866
|
+
/**
|
|
1867
|
+
* Server-side infinite scroll accumulates the pages it receives. Change this
|
|
1868
|
+
* whenever the query behind `data` changes — a new filter, sort or search — and
|
|
1869
|
+
* the accumulated rows are dropped so the grid restarts at the first page.
|
|
1870
|
+
*/
|
|
1871
|
+
resetKey?: string | number;
|
|
1872
|
+
/** Set while a page request is in flight, to draw the footer spinner. */
|
|
1873
|
+
loadingMore?: boolean;
|
|
1874
|
+
/**
|
|
1875
|
+
* Rows per page when the payload does not say. A grid needs more than a column to
|
|
1876
|
+
* fill a screen, and an unfilled screen leaves the sentinel in view — which fetches
|
|
1877
|
+
* the next page before the reader moves. Matches `DataListProps.rowsPerPage`.
|
|
1878
|
+
*/
|
|
1879
|
+
rowsPerPage?: number;
|
|
1880
|
+
/**
|
|
1881
|
+
* Renders the header's "View all" affordance. Omitted, the affordance is not
|
|
1882
|
+
* drawn at all — the rail simply shows its page. `cards` variant only.
|
|
1883
|
+
*/
|
|
1884
|
+
onViewAll?: () => void;
|
|
1796
1885
|
totalCount?: number;
|
|
1797
1886
|
payload?: Partial<FV.SearchDTO>;
|
|
1798
1887
|
onChange?: (params: Partial<FV.SearchDTO>) => void;
|
|
@@ -1815,6 +1904,13 @@ export declare interface PaginatedListSnapshot {
|
|
|
1815
1904
|
data: PaginatedListItem[];
|
|
1816
1905
|
}
|
|
1817
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* How the list presents its items. `list` (default) is the paginated column the
|
|
1909
|
+
* widget shipped with; `cards` is a row of cards that hands the rest to `onViewAll`.
|
|
1910
|
+
* Chosen through `HCPaginatedList.defaultProps`, so call sites stay brand-agnostic.
|
|
1911
|
+
*/
|
|
1912
|
+
declare type PaginatedListVariant = "list" | "cards";
|
|
1913
|
+
|
|
1818
1914
|
export declare const PhoneInput: (props: PhoneInputProps) => JSX_2.Element;
|
|
1819
1915
|
|
|
1820
1916
|
export declare type PhoneInputComponentOverride<Theme = unknown> = {
|
|
@@ -3353,7 +3449,7 @@ declare module "@mui/material/styles" {
|
|
|
3353
3449
|
}
|
|
3354
3450
|
|
|
3355
3451
|
interface ComponentsPropsList {
|
|
3356
|
-
HCMetricCard: MetricCardProps
|
|
3452
|
+
HCMetricCard: Partial<MetricCardProps>;
|
|
3357
3453
|
}
|
|
3358
3454
|
|
|
3359
3455
|
interface Components<Theme = unknown> {
|
|
@@ -3933,7 +4029,23 @@ declare module "@mui/material/styles" {
|
|
|
3933
4029
|
|
|
3934
4030
|
declare module "@mui/material/styles" {
|
|
3935
4031
|
interface ComponentNameToClassKey {
|
|
3936
|
-
HCPaginatedList:
|
|
4032
|
+
HCPaginatedList:
|
|
4033
|
+
| "root"
|
|
4034
|
+
| "header"
|
|
4035
|
+
| "content"
|
|
4036
|
+
| "list"
|
|
4037
|
+
| "pagination"
|
|
4038
|
+
| "viewAll"
|
|
4039
|
+
| "cardRail"
|
|
4040
|
+
| "card"
|
|
4041
|
+
| "cardHeader"
|
|
4042
|
+
| "cardIcon"
|
|
4043
|
+
| "cardTitle"
|
|
4044
|
+
| "cardDescription"
|
|
4045
|
+
| "cardFooter"
|
|
4046
|
+
| "cardMeta"
|
|
4047
|
+
| "cardAction"
|
|
4048
|
+
| "loadMore";
|
|
3937
4049
|
}
|
|
3938
4050
|
|
|
3939
4051
|
interface ComponentsPropsList {
|