@cere/cere-design-system 0.0.44 → 0.1.0

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 (154) hide show
  1. package/dist/WorkflowNode-BnxXO6t_.d.mts +46 -0
  2. package/dist/WorkflowNode-BnxXO6t_.d.ts +46 -0
  3. package/dist/buttons.d.mts +114 -0
  4. package/dist/buttons.d.ts +114 -0
  5. package/dist/buttons.js +19 -0
  6. package/dist/buttons.js.map +1 -0
  7. package/dist/buttons.mjs +19 -0
  8. package/dist/buttons.mjs.map +1 -0
  9. package/dist/carousel.d.mts +51 -0
  10. package/dist/carousel.d.ts +51 -0
  11. package/dist/carousel.js +185 -0
  12. package/dist/carousel.js.map +1 -0
  13. package/dist/carousel.mjs +185 -0
  14. package/dist/carousel.mjs.map +1 -0
  15. package/dist/charts.d.mts +209 -0
  16. package/dist/charts.d.ts +209 -0
  17. package/dist/charts.js +20 -0
  18. package/dist/charts.js.map +1 -0
  19. package/dist/charts.mjs +20 -0
  20. package/dist/charts.mjs.map +1 -0
  21. package/dist/chunk-27JEWSWA.mjs +233 -0
  22. package/dist/chunk-27JEWSWA.mjs.map +1 -0
  23. package/dist/chunk-2EBCST6X.js +25 -0
  24. package/dist/chunk-2EBCST6X.js.map +1 -0
  25. package/dist/chunk-3WCMINE5.mjs +490 -0
  26. package/dist/chunk-3WCMINE5.mjs.map +1 -0
  27. package/dist/chunk-463SRKKD.js +111 -0
  28. package/dist/chunk-463SRKKD.js.map +1 -0
  29. package/dist/chunk-5ASG6G6U.mjs +40 -0
  30. package/dist/chunk-5ASG6G6U.mjs.map +1 -0
  31. package/dist/chunk-6EUAU67C.mjs +374 -0
  32. package/dist/chunk-6EUAU67C.mjs.map +1 -0
  33. package/dist/chunk-AIY6222Q.js +11 -0
  34. package/dist/chunk-AIY6222Q.js.map +1 -0
  35. package/dist/chunk-AJBM7IE6.mjs +2366 -0
  36. package/dist/chunk-AJBM7IE6.mjs.map +1 -0
  37. package/dist/chunk-ATIFLPH6.mjs +278 -0
  38. package/dist/chunk-ATIFLPH6.mjs.map +1 -0
  39. package/dist/chunk-BIZK6FUD.js +37 -0
  40. package/dist/chunk-BIZK6FUD.js.map +1 -0
  41. package/dist/chunk-CCN6M4LI.js +103 -0
  42. package/dist/chunk-CCN6M4LI.js.map +1 -0
  43. package/dist/chunk-CUCKULYC.mjs +2658 -0
  44. package/dist/chunk-CUCKULYC.mjs.map +1 -0
  45. package/dist/chunk-CWJ4OU6W.mjs +45 -0
  46. package/dist/chunk-CWJ4OU6W.mjs.map +1 -0
  47. package/dist/chunk-EOF3QNPF.js +2366 -0
  48. package/dist/chunk-EOF3QNPF.js.map +1 -0
  49. package/dist/chunk-FFZ5S7PQ.mjs +146 -0
  50. package/dist/chunk-FFZ5S7PQ.mjs.map +1 -0
  51. package/dist/chunk-FN5YL4BK.js +278 -0
  52. package/dist/chunk-FN5YL4BK.js.map +1 -0
  53. package/dist/chunk-HLH2VWXL.js +2658 -0
  54. package/dist/chunk-HLH2VWXL.js.map +1 -0
  55. package/dist/chunk-IE6GCHDI.mjs +530 -0
  56. package/dist/chunk-IE6GCHDI.mjs.map +1 -0
  57. package/dist/chunk-JBHRAAN3.js +31 -0
  58. package/dist/chunk-JBHRAAN3.js.map +1 -0
  59. package/dist/chunk-JS4IB5IU.mjs +162 -0
  60. package/dist/chunk-JS4IB5IU.mjs.map +1 -0
  61. package/dist/chunk-KF2Y7HO3.js +595 -0
  62. package/dist/chunk-KF2Y7HO3.js.map +1 -0
  63. package/dist/chunk-KPDYKK3V.js +162 -0
  64. package/dist/chunk-KPDYKK3V.js.map +1 -0
  65. package/dist/chunk-KVBMZNWT.mjs +103 -0
  66. package/dist/chunk-KVBMZNWT.mjs.map +1 -0
  67. package/dist/chunk-L2TIGA7I.js +530 -0
  68. package/dist/chunk-L2TIGA7I.js.map +1 -0
  69. package/dist/chunk-MNM6HE72.js +146 -0
  70. package/dist/chunk-MNM6HE72.js.map +1 -0
  71. package/dist/chunk-NXTVJ6PY.js +374 -0
  72. package/dist/chunk-NXTVJ6PY.js.map +1 -0
  73. package/dist/chunk-OWWDNDF4.js +40 -0
  74. package/dist/chunk-OWWDNDF4.js.map +1 -0
  75. package/dist/chunk-PHMNZK2R.mjs +18 -0
  76. package/dist/chunk-PHMNZK2R.mjs.map +1 -0
  77. package/dist/chunk-PWF2NJDB.mjs +377 -0
  78. package/dist/chunk-PWF2NJDB.mjs.map +1 -0
  79. package/dist/chunk-QBCRH7YF.mjs +37 -0
  80. package/dist/chunk-QBCRH7YF.mjs.map +1 -0
  81. package/dist/chunk-QD6RLAO2.mjs +11 -0
  82. package/dist/chunk-QD6RLAO2.mjs.map +1 -0
  83. package/dist/chunk-QY65OUAC.mjs +111 -0
  84. package/dist/chunk-QY65OUAC.mjs.map +1 -0
  85. package/dist/chunk-QYYQYZHV.js +45 -0
  86. package/dist/chunk-QYYQYZHV.js.map +1 -0
  87. package/dist/chunk-T7LPABOL.mjs +595 -0
  88. package/dist/chunk-T7LPABOL.mjs.map +1 -0
  89. package/dist/chunk-THQKYTQE.js +490 -0
  90. package/dist/chunk-THQKYTQE.js.map +1 -0
  91. package/dist/chunk-U2QHFISG.js +18 -0
  92. package/dist/chunk-U2QHFISG.js.map +1 -0
  93. package/dist/chunk-UPGFBPFX.mjs +25 -0
  94. package/dist/chunk-UPGFBPFX.mjs.map +1 -0
  95. package/dist/chunk-X7E6GMFL.js +233 -0
  96. package/dist/chunk-X7E6GMFL.js.map +1 -0
  97. package/dist/chunk-XF66WQZE.mjs +1535 -0
  98. package/dist/chunk-XF66WQZE.mjs.map +1 -0
  99. package/dist/chunk-YQOZPLTY.js +1535 -0
  100. package/dist/chunk-YQOZPLTY.js.map +1 -0
  101. package/dist/chunk-ZGCN5WCG.js +377 -0
  102. package/dist/chunk-ZGCN5WCG.js.map +1 -0
  103. package/dist/chunk-ZP26PGMS.mjs +31 -0
  104. package/dist/chunk-ZP26PGMS.mjs.map +1 -0
  105. package/dist/feedback.d.mts +356 -0
  106. package/dist/feedback.d.ts +356 -0
  107. package/dist/feedback.js +43 -0
  108. package/dist/feedback.js.map +1 -0
  109. package/dist/feedback.mjs +43 -0
  110. package/dist/feedback.mjs.map +1 -0
  111. package/dist/icons.d.mts +22 -0
  112. package/dist/icons.d.ts +22 -0
  113. package/dist/icons.js +23 -0
  114. package/dist/icons.js.map +1 -0
  115. package/dist/icons.mjs +23 -0
  116. package/dist/icons.mjs.map +1 -0
  117. package/dist/index.d.mts +171 -3069
  118. package/dist/index.d.ts +171 -3069
  119. package/dist/index.js +320 -10077
  120. package/dist/index.js.map +1 -1
  121. package/dist/index.mjs +262 -9978
  122. package/dist/index.mjs.map +1 -1
  123. package/dist/inputs.d.mts +109 -0
  124. package/dist/inputs.d.ts +109 -0
  125. package/dist/inputs.js +43 -0
  126. package/dist/inputs.js.map +1 -0
  127. package/dist/inputs.mjs +43 -0
  128. package/dist/inputs.mjs.map +1 -0
  129. package/dist/layout.d.mts +927 -0
  130. package/dist/layout.d.ts +927 -0
  131. package/dist/layout.js +122 -0
  132. package/dist/layout.js.map +1 -0
  133. package/dist/layout.mjs +122 -0
  134. package/dist/layout.mjs.map +1 -0
  135. package/dist/navigation.d.mts +716 -0
  136. package/dist/navigation.d.ts +716 -0
  137. package/dist/navigation.js +58 -0
  138. package/dist/navigation.js.map +1 -0
  139. package/dist/navigation.mjs +58 -0
  140. package/dist/navigation.mjs.map +1 -0
  141. package/dist/third-party.d.mts +637 -0
  142. package/dist/third-party.d.ts +637 -0
  143. package/dist/third-party.js +45 -0
  144. package/dist/third-party.js.map +1 -0
  145. package/dist/third-party.mjs +45 -0
  146. package/dist/third-party.mjs.map +1 -0
  147. package/dist/tokens.css +2 -1
  148. package/dist/utilities.d.mts +39 -0
  149. package/dist/utilities.d.ts +39 -0
  150. package/dist/utilities.js +19 -0
  151. package/dist/utilities.js.map +1 -0
  152. package/dist/utilities.mjs +19 -0
  153. package/dist/utilities.mjs.map +1 -0
  154. package/package.json +55 -1
@@ -0,0 +1,595 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkAIY6222Qjs = require('./chunk-AIY6222Q.js');
4
+
5
+
6
+ var _chunkFN5YL4BKjs = require('./chunk-FN5YL4BK.js');
7
+
8
+ // src/components/charts/ChartWidget/ChartWidget.tsx
9
+ var _material = require('@mui/material');
10
+ var _xcharts = require('@mui/x-charts');
11
+ var _bytesize = require('byte-size'); var _bytesize2 = _interopRequireDefault(_bytesize);
12
+ var _datefns = require('date-fns');
13
+ var _jsxruntime = require('react/jsx-runtime');
14
+ var Chart = _material.styled.call(void 0, (0, _material.Box))(() => ({
15
+ height: 200
16
+ }));
17
+ var ChartWidget = ({
18
+ title,
19
+ value,
20
+ history,
21
+ formatValue = (value2) => _bytesize2.default.call(void 0, value2 || 0).toString()
22
+ }) => {
23
+ const theme = _material.useTheme.call(void 0, );
24
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { spacing: 1, children: [
25
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "caption", color: "text.secondary", children: title }),
26
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { fontWeight: "bold", children: value }),
27
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Chart, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
28
+ _xcharts.LineChart,
29
+ {
30
+ dataset: history || [],
31
+ axisHighlight: { x: "none", y: "none" },
32
+ grid: { horizontal: true, vertical: false },
33
+ margin: { top: 10, right: 20, bottom: 40, left: 40 },
34
+ colors: [theme.palette.primary.main],
35
+ slots: {
36
+ noDataOverlay: () => null
37
+ },
38
+ yAxis: [
39
+ {
40
+ dataKey: "value",
41
+ disableLine: true,
42
+ disableTicks: true,
43
+ min: _optionalChain([history, 'optionalAccess', _ => _.length]) ? void 0 : 0,
44
+ max: _optionalChain([history, 'optionalAccess', _2 => _2.length]) ? void 0 : 100,
45
+ tickNumber: _optionalChain([history, 'optionalAccess', _3 => _3.length]) ? void 0 : 5,
46
+ valueFormatter: (value2) => formatValue(value2 || 0),
47
+ tickLabelStyle: {
48
+ fontSize: 10
49
+ }
50
+ }
51
+ ],
52
+ xAxis: [
53
+ {
54
+ dataKey: "date",
55
+ min: history && Math.min(...history.map((record) => +record.date)),
56
+ max: history && Math.max(...history.map((record) => +record.date)),
57
+ disableLine: true,
58
+ disableTicks: true,
59
+ valueFormatter: (date) => _datefns.format.call(void 0, date, "do MMM"),
60
+ tickPlacement: "end",
61
+ tickNumber: 1,
62
+ tickLabelStyle: {
63
+ fontSize: 10,
64
+ transform: "translate(-16px, 16px) rotate(-30deg)"
65
+ }
66
+ }
67
+ ],
68
+ series: [
69
+ {
70
+ curve: "linear",
71
+ dataKey: "value",
72
+ showMark: false,
73
+ valueFormatter: (value2) => formatValue(value2 || 0)
74
+ }
75
+ ]
76
+ }
77
+ ) })
78
+ ] });
79
+ };
80
+
81
+ // src/components/charts/MetricsChart/MetricsChart.tsx
82
+
83
+
84
+ var _hooks = require('@mui/x-charts/hooks');
85
+
86
+
87
+ // src/components/charts/MetricsChart/PeriodSelect.tsx
88
+
89
+
90
+ var options = [
91
+ /**
92
+ * TODO: Enable the options below when the backend supports them
93
+ */
94
+ // { value: 'hour', label: 'Last hour' },
95
+ // { value: 'day', label: '24 hours' },
96
+ { value: "week", label: "1 week" },
97
+ { value: "month", label: "1 month" }
98
+ ];
99
+ var PeriodSelect = ({ value, onChange }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
100
+ _material.TextField,
101
+ {
102
+ select: true,
103
+ size: "small",
104
+ value,
105
+ defaultValue: options[0].value,
106
+ onChange: (e) => _optionalChain([onChange, 'optionalCall', _4 => _4(e.target.value)]),
107
+ children: options.map(({ value: value2, label }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: value2, children: label }, value2))
108
+ }
109
+ );
110
+
111
+ // src/components/charts/MetricsChart/MetricsChart.tsx
112
+ var _react = require('react');
113
+
114
+ var mapPeriodToFromDate = (period = "month") => {
115
+ const date = /* @__PURE__ */ new Date();
116
+ if (period === "hour") {
117
+ return _datefns.subHours.call(void 0, date, 1);
118
+ }
119
+ if (period === "day") {
120
+ return _datefns.subHours.call(void 0, date, 24);
121
+ }
122
+ if (period === "week") {
123
+ return _datefns.startOfDay.call(void 0, _datefns.subWeeks.call(void 0, date, 1));
124
+ }
125
+ return _datefns.startOfDay.call(void 0, _datefns.subMonths.call(void 0, date, 1));
126
+ };
127
+ var Chart2 = _material.styled.call(void 0, (0, _xcharts.LineChart))({
128
+ height: 320,
129
+ marginBottom: 16
130
+ });
131
+ var NoDataRect = _material.styled.call(void 0, "rect")({
132
+ fill: _chunkFN5YL4BKjs.deploymentSurfaceTokens.highlightBg
133
+ });
134
+ var LoadingText = _material.styled.call(void 0, "text")(({ theme }) => ({
135
+ stroke: "none",
136
+ fill: theme.palette.text.primary,
137
+ shapeRendering: "crispEdges",
138
+ textAnchor: "middle",
139
+ dominantBaseline: "middle"
140
+ }));
141
+ var MetricsChart = ({ history = [] }) => {
142
+ const theme = _material.useTheme.call(void 0, );
143
+ const [period, setPeriod] = _react.useState.call(void 0, "week");
144
+ const periodFrom = _react.useMemo.call(void 0, () => mapPeriodToFromDate(period), [period]);
145
+ const periodHistory = _react.useMemo.call(void 0,
146
+ () => history.filter((record) => record.recordTime > periodFrom),
147
+ [history, periodFrom]
148
+ );
149
+ const total = _react.useMemo.call(void 0,
150
+ () => periodHistory.reduce(
151
+ (acc, record) => ({
152
+ gets: acc.gets + record.gets,
153
+ puts: acc.puts + record.puts,
154
+ storedBytes: acc.storedBytes + record.storedBytes,
155
+ transferredBytes: acc.transferredBytes + record.transferredBytes
156
+ }),
157
+ { gets: 0, puts: 0, storedBytes: 0, transferredBytes: 0 }
158
+ ),
159
+ [periodHistory]
160
+ );
161
+ const NoDataOverlay = () => {
162
+ const yScale = _hooks.useYScale.call(void 0, );
163
+ const { left, width, height } = _hooks.useDrawingArea.call(void 0, );
164
+ const [, top] = yScale.range();
165
+ const padding = { top: 8, bottom: 8, left: 20, right: 20 };
166
+ const text = "No data for selected period";
167
+ const textWidth = 211;
168
+ const textHeight = 24;
169
+ const backgroundWidth = textWidth + padding.left + padding.right;
170
+ const backgroundHeight = textHeight + padding.top + padding.bottom;
171
+ const rectX = left + (width - backgroundWidth) / 2;
172
+ const rectY = top + (height - backgroundHeight) / 2;
173
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "g", { children: [
174
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoDataRect, { x: rectX, y: rectY, width: backgroundWidth, height: backgroundHeight }),
175
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingText, { style: { ...theme.typography.subtitle1 }, x: left + width / 2, y: top + height / 2, children: text })
176
+ ] });
177
+ };
178
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Card, { children: [
179
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CardHeader, { title: "GET / PUT Requests", action: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PeriodSelect, { value: period, onChange: setPeriod }) }),
180
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.CardMedia, { children: [
181
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
182
+ Chart2,
183
+ {
184
+ skipAnimation: true,
185
+ dataset: periodHistory || [],
186
+ axisHighlight: { x: "none", y: "none" },
187
+ grid: { horizontal: true, vertical: false },
188
+ margin: { top: 10, right: 20, bottom: 40, left: 40 },
189
+ colors: [theme.palette.primary.main, theme.palette.success.main],
190
+ slots: {
191
+ noDataOverlay: NoDataOverlay
192
+ },
193
+ slotProps: {
194
+ noDataOverlay: {
195
+ style: {
196
+ ...theme.typography.h4
197
+ }
198
+ }
199
+ },
200
+ yAxis: periodHistory.length ? [
201
+ {
202
+ min: periodHistory.length ? void 0 : 0,
203
+ max: periodHistory.length ? void 0 : 100,
204
+ tickNumber: periodHistory.length ? void 0 : 5,
205
+ disableLine: true,
206
+ disableTicks: true,
207
+ tickLabelStyle: {
208
+ fontSize: 10
209
+ }
210
+ }
211
+ ] : [],
212
+ xAxis: [
213
+ {
214
+ dataKey: "recordTime",
215
+ min: periodFrom,
216
+ max: /* @__PURE__ */ new Date(),
217
+ disableLine: false,
218
+ disableTicks: false,
219
+ valueFormatter: (date) => _datefns.format.call(void 0, date, "do MMM"),
220
+ tickMinStep: 3600 * 1e3 * 24,
221
+ // min step: 24h
222
+ tickLabelStyle: {
223
+ fontSize: 10,
224
+ transform: "translate(-16px, 16px) rotate(-30deg)"
225
+ }
226
+ }
227
+ ],
228
+ series: [
229
+ {
230
+ curve: "linear",
231
+ dataKey: "gets",
232
+ showMark: false
233
+ },
234
+ {
235
+ curve: "linear",
236
+ dataKey: "puts",
237
+ showMark: false
238
+ }
239
+ ]
240
+ }
241
+ ),
242
+ periodHistory.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", spacing: 2, marginY: 3, justifyContent: "center", children: [
243
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
244
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { sx: { width: 14, height: 14, borderRadius: "4px", backgroundColor: theme.palette.primary.main } }),
245
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", children: "Get" })
246
+ ] }),
247
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
248
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { sx: { width: 14, height: 14, borderRadius: "4px", backgroundColor: theme.palette.success.main } }),
249
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", children: "Put" })
250
+ ] })
251
+ ] })
252
+ ] }),
253
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.CardMedia, { children: [
254
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, { flexItem: true }),
255
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", spacing: 2, padding: 2, children: [
256
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", spacing: 1, children: [
257
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", color: "secondary", children: "GET Requests per account" }),
258
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h3", children: total.gets })
259
+ ] }),
260
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", spacing: 1, children: [
261
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", color: "secondary", children: "PUT Requests per account" }),
262
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h3", children: total.puts })
263
+ ] }),
264
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", spacing: 1, children: [
265
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", color: "secondary", children: "Total Consumed per account" }),
266
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAIY6222Qjs.BytesSize, { bytes: total.transferredBytes }) })
267
+ ] }),
268
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", spacing: 1, children: [
269
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", color: "secondary", children: "Total Stored per account" }),
270
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAIY6222Qjs.BytesSize, { bytes: total.storedBytes }) })
271
+ ] })
272
+ ] })
273
+ ] })
274
+ ] });
275
+ };
276
+
277
+ // src/components/charts/TimeSeriesGraph/TimeSeriesGraph.tsx
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+ // src/components/charts/TimeSeriesGraph/TimeRangeSelect.tsx
295
+
296
+
297
+ var TimeRangeSelect = ({ options: options2, value, onChange }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
298
+ _material.TextField,
299
+ {
300
+ select: true,
301
+ size: "small",
302
+ value: _nullishCoalesce(value, () => ( (options2.length > 0 ? options2[0].value : ""))),
303
+ onChange: (e) => _optionalChain([onChange, 'optionalCall', _5 => _5(e.target.value)]),
304
+ "aria-label": "Time range selector",
305
+ sx: { minWidth: 120 },
306
+ children: options2.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: option.value, children: option.label }, option.value))
307
+ }
308
+ );
309
+
310
+ // src/components/charts/TimeSeriesGraph/SummaryStats.tsx
311
+
312
+
313
+ var formatSummaryValue = (value, unit) => {
314
+ const displayValue = typeof value === "number" ? value.toLocaleString() : value;
315
+ return unit ? `${displayValue} ${unit}` : displayValue;
316
+ };
317
+ var SummaryStats = ({ items }) => {
318
+ if (items.length === 0) {
319
+ return null;
320
+ }
321
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
322
+ _material.Stack,
323
+ {
324
+ direction: "row",
325
+ spacing: 3,
326
+ padding: 2,
327
+ flexWrap: "wrap",
328
+ useFlexGap: true,
329
+ role: "list",
330
+ "aria-label": "Summary statistics",
331
+ children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
332
+ _material.Stack,
333
+ {
334
+ direction: "row",
335
+ alignItems: "center",
336
+ spacing: 1,
337
+ role: "listitem",
338
+ children: [
339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", color: "text.secondary", children: item.label }),
340
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h5", fontWeight: 600, children: formatSummaryValue(item.value, item.unit) })
341
+ ]
342
+ },
343
+ item.label
344
+ ))
345
+ }
346
+ );
347
+ };
348
+
349
+ // src/components/charts/TimeSeriesGraph/TimeSeriesGraph.tsx
350
+
351
+ var ChartContainer = _material.styled.call(void 0, (0, _material.Box))({
352
+ position: "relative",
353
+ height: 320
354
+ });
355
+ var LoadingOverlay = _material.styled.call(void 0, (0, _material.Box))(({ theme }) => ({
356
+ position: "absolute",
357
+ inset: 0,
358
+ display: "flex",
359
+ alignItems: "center",
360
+ justifyContent: "center",
361
+ backgroundColor: "rgba(255, 255, 255, 0.7)",
362
+ zIndex: 1,
363
+ borderRadius: theme.shape.borderRadius
364
+ }));
365
+ var LegendDot = _material.styled.call(void 0, _material.Box, {
366
+ shouldForwardProp: (prop) => prop !== "dotColor"
367
+ })(({ dotColor }) => ({
368
+ width: 14,
369
+ height: 14,
370
+ borderRadius: 4,
371
+ backgroundColor: dotColor,
372
+ flexShrink: 0
373
+ }));
374
+ var formatYAxisValue = (value) => {
375
+ const absValue = Math.abs(value);
376
+ if (absValue >= 1e9) {
377
+ return `${(value / 1e9).toFixed(absValue % 1e9 === 0 ? 0 : 1)}B`;
378
+ }
379
+ if (absValue >= 1e6) {
380
+ return `${(value / 1e6).toFixed(absValue % 1e6 === 0 ? 0 : 1)}M`;
381
+ }
382
+ if (absValue >= 1e3) {
383
+ return `${(value / 1e3).toFixed(absValue % 1e3 === 0 ? 0 : 1)}K`;
384
+ }
385
+ return String(value);
386
+ };
387
+ var TWENTY_FOUR_HOURS_MS = 24 * 60 * 60 * 1e3;
388
+ var inferXAxisFormat = (min, max) => {
389
+ if (!min || !max) return "do MMM";
390
+ const spanMs = max.getTime() - min.getTime();
391
+ return spanMs <= TWENTY_FOUR_HOURS_MS ? "HH:mm" : "do MMM";
392
+ };
393
+ var buildDataset = (series, hiddenSeries) => {
394
+ const timestampMap = /* @__PURE__ */ new Map();
395
+ series.forEach((s) => {
396
+ if (hiddenSeries.has(s.name)) return;
397
+ s.data.forEach((dp) => {
398
+ const ts = dp.timestamp.getTime();
399
+ if (!timestampMap.has(ts)) {
400
+ timestampMap.set(ts, { timestamp: dp.timestamp });
401
+ }
402
+ timestampMap.get(ts)[s.name] = dp.value;
403
+ });
404
+ });
405
+ return Array.from(timestampMap.values()).sort(
406
+ (a, b) => a.timestamp.getTime() - b.timestamp.getTime()
407
+ );
408
+ };
409
+ var TimeSeriesGraph = ({
410
+ title,
411
+ series,
412
+ timeRangeOptions,
413
+ selectedTimeRange,
414
+ onTimeRangeChange,
415
+ summaryItems,
416
+ showSummary = true,
417
+ headerAction,
418
+ loading = false,
419
+ xAxisFormat
420
+ }) => {
421
+ const theme = _material.useTheme.call(void 0, );
422
+ const [hiddenSeries, setHiddenSeries] = _react.useState.call(void 0, /* @__PURE__ */ new Set());
423
+ const dataset = _react.useMemo.call(void 0, () => buildDataset(series, hiddenSeries), [series, hiddenSeries]);
424
+ const visibleSeries = _react.useMemo.call(void 0,
425
+ () => series.filter((s) => !hiddenSeries.has(s.name)),
426
+ [series, hiddenSeries]
427
+ );
428
+ const chartColors = _react.useMemo.call(void 0, () => visibleSeries.map((s) => s.color), [visibleSeries]);
429
+ const handleLegendToggle = _react.useCallback.call(void 0, (seriesName) => {
430
+ setHiddenSeries((prev) => {
431
+ const next = new Set(prev);
432
+ if (next.has(seriesName)) {
433
+ next.delete(seriesName);
434
+ } else {
435
+ next.add(seriesName);
436
+ }
437
+ return next;
438
+ });
439
+ }, []);
440
+ const timeBounds = _react.useMemo.call(void 0, () => {
441
+ if (dataset.length === 0) return { min: void 0, max: void 0 };
442
+ const timestamps = dataset.map((row) => row.timestamp.getTime());
443
+ return {
444
+ min: new Date(Math.min(...timestamps)),
445
+ max: new Date(Math.max(...timestamps))
446
+ };
447
+ }, [dataset]);
448
+ const resolvedXAxisFormat = _react.useMemo.call(void 0,
449
+ () => _nullishCoalesce(xAxisFormat, () => ( inferXAxisFormat(timeBounds.min, timeBounds.max))),
450
+ [xAxisFormat, timeBounds.min, timeBounds.max]
451
+ );
452
+ const hasData = dataset.length > 0;
453
+ const shouldShowSummary = showSummary && summaryItems && summaryItems.length > 0;
454
+ const headerActionElement = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
455
+ headerAction,
456
+ timeRangeOptions && timeRangeOptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
457
+ TimeRangeSelect,
458
+ {
459
+ options: timeRangeOptions,
460
+ value: selectedTimeRange,
461
+ onChange: onTimeRangeChange
462
+ }
463
+ )
464
+ ] });
465
+ const showHeader = !!title || !!headerAction || timeRangeOptions && timeRangeOptions.length > 0;
466
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
467
+ _material.Card,
468
+ {
469
+ "aria-label": title ? `Line chart showing ${title}` : "Line chart",
470
+ role: "figure",
471
+ children: [
472
+ showHeader && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
473
+ _material.CardHeader,
474
+ {
475
+ title,
476
+ titleTypographyProps: {
477
+ variant: "subtitle1",
478
+ fontWeight: 500
479
+ },
480
+ action: headerActionElement
481
+ }
482
+ ),
483
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.CardMedia, { children: [
484
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ChartContainer, { children: [
485
+ loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingOverlay, { role: "status", "aria-label": "Loading chart data", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 40 }) }),
486
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
487
+ _xcharts.LineChart,
488
+ {
489
+ dataset,
490
+ axisHighlight: { x: "line", y: "none" },
491
+ grid: { horizontal: true, vertical: false },
492
+ margin: { top: 10, right: 20, bottom: 40, left: 50 },
493
+ colors: chartColors.length > 0 ? chartColors : [theme.palette.primary.main],
494
+ slots: {
495
+ noDataOverlay: () => null
496
+ },
497
+ tooltip: { trigger: hasData ? "axis" : "none" },
498
+ yAxis: [
499
+ {
500
+ disableLine: true,
501
+ disableTicks: true,
502
+ min: hasData ? void 0 : 0,
503
+ max: hasData ? void 0 : 100,
504
+ tickNumber: hasData ? void 0 : 5,
505
+ valueFormatter: (value) => formatYAxisValue(value || 0),
506
+ tickLabelStyle: {
507
+ fontSize: 10
508
+ }
509
+ }
510
+ ],
511
+ xAxis: [
512
+ {
513
+ dataKey: "timestamp",
514
+ scaleType: "time",
515
+ min: timeBounds.min,
516
+ max: timeBounds.max,
517
+ disableLine: true,
518
+ disableTicks: true,
519
+ valueFormatter: (date) => _datefns.format.call(void 0, date, resolvedXAxisFormat),
520
+ tickLabelStyle: {
521
+ fontSize: 10
522
+ }
523
+ }
524
+ ],
525
+ series: visibleSeries.map((s) => ({
526
+ curve: "linear",
527
+ dataKey: s.name,
528
+ label: s.name,
529
+ showMark: false,
530
+ connectNulls: false
531
+ })),
532
+ slotProps: {
533
+ legend: { hidden: true }
534
+ }
535
+ }
536
+ )
537
+ ] }),
538
+ series.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
539
+ _material.Stack,
540
+ {
541
+ direction: "row",
542
+ spacing: 2,
543
+ justifyContent: "center",
544
+ paddingY: 1,
545
+ flexWrap: "wrap",
546
+ useFlexGap: true,
547
+ role: "list",
548
+ "aria-label": "Chart legend",
549
+ children: series.map((s) => {
550
+ const isHidden = hiddenSeries.has(s.name);
551
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
552
+ _material.Stack,
553
+ {
554
+ direction: "row",
555
+ spacing: 1,
556
+ alignItems: "center",
557
+ role: "listitem",
558
+ onClick: () => handleLegendToggle(s.name),
559
+ sx: {
560
+ cursor: "pointer",
561
+ opacity: isHidden ? 0.4 : 1,
562
+ transition: "opacity 0.2s ease",
563
+ userSelect: "none"
564
+ },
565
+ "aria-pressed": !isHidden,
566
+ "aria-label": `Toggle ${s.name} visibility`,
567
+ children: [
568
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LegendDot, { dotColor: s.color }),
569
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", children: s.name })
570
+ ]
571
+ },
572
+ s.name
573
+ );
574
+ })
575
+ }
576
+ )
577
+ ] }),
578
+ shouldShowSummary && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
579
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}),
580
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SummaryStats, { items: summaryItems })
581
+ ] })
582
+ ]
583
+ }
584
+ );
585
+ };
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+ exports.ChartWidget = ChartWidget; exports.PeriodSelect = PeriodSelect; exports.MetricsChart = MetricsChart; exports.TimeRangeSelect = TimeRangeSelect; exports.SummaryStats = SummaryStats; exports.TimeSeriesGraph = TimeSeriesGraph;
595
+ //# sourceMappingURL=chunk-KF2Y7HO3.js.map