@stealthscale/component-collections 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -5700
- package/dist/pages/data-list/data-list.js +351 -0
- package/dist/pages/data-list/data-list.props.js +3 -0
- package/dist/pages/listbox/listbox.js +1277 -0
- package/dist/pages/listbox/listbox.props.js +3 -0
- package/dist/pages/pages.json +105 -0
- package/dist/pages/sortable/sortable.js +576 -0
- package/dist/pages/sortable/sortable.props.js +3 -0
- package/dist/pages/status-matrix/status-matrix.js +1403 -0
- package/dist/pages/status-matrix/status-matrix.props.js +3 -0
- package/dist/pages/swipe-actions/swipe-actions.js +212 -0
- package/dist/pages/swipe-actions/swipe-actions.props.js +3 -0
- package/dist/pages/table/table.js +1701 -0
- package/dist/pages/table/table.props.js +3 -0
- package/dist/pages/timeline/timeline.js +380 -0
- package/dist/pages/timeline/timeline.props.js +3 -0
- package/dist/pages/transfer/transfer.js +465 -0
- package/dist/pages/transfer/transfer.props.js +3 -0
- package/dist/pages/tree-view/tree-view.js +1059 -0
- package/dist/pages/tree-view/tree-view.props.js +3 -0
- package/dist/shared-DVn824MJ.js +5701 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/data-list.json +64 -0
- package/locales/en/specimen/listbox.json +98 -0
- package/locales/en/specimen/sortable.json +65 -0
- package/locales/en/specimen/status-matrix.json +47 -0
- package/locales/en/specimen/swipe-actions.json +32 -0
- package/locales/en/specimen/table.json +94 -0
- package/locales/en/specimen/timeline.json +72 -0
- package/locales/en/specimen/transfer.json +34 -0
- package/locales/en/specimen/tree-view.json +107 -0
- package/package.json +9 -8
- /package/dist/{recipe-C1oaF8pO.js → recipes-C1oaF8pO.js} +0 -0
|
@@ -0,0 +1,1403 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { j as StatusMatrix } from "../../shared-DVn824MJ.js";
|
|
3
|
+
import { c as recipe } from "../../recipes-C1oaF8pO.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { scenesOf, specimen, useWords } from "@stealthscale/specimen";
|
|
8
|
+
import { CheckIcon, CircleDashedIcon, LoaderIcon, MinusIcon, TriangleAlertIcon, XIcon } from "lucide-react";
|
|
9
|
+
import { Text } from "@stealthscale/component-typography";
|
|
10
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
11
|
+
//#region src/status-matrix/examples/empty.example.tsx
|
|
12
|
+
var empty_example_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
Empty: () => Empty,
|
|
14
|
+
source: () => source$4
|
|
15
|
+
});
|
|
16
|
+
const SITES$2 = [
|
|
17
|
+
"Dublin",
|
|
18
|
+
"Reston",
|
|
19
|
+
"Osaka"
|
|
20
|
+
];
|
|
21
|
+
function Empty() {
|
|
22
|
+
const $ = c(36);
|
|
23
|
+
const { t } = useWords("status-matrix");
|
|
24
|
+
let t0;
|
|
25
|
+
if ($[0] !== t) {
|
|
26
|
+
t0 = t("checks");
|
|
27
|
+
$[0] = t;
|
|
28
|
+
$[1] = t0;
|
|
29
|
+
} else t0 = $[1];
|
|
30
|
+
let t1;
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
33
|
+
t1 = [];
|
|
34
|
+
t2 = SITES$2.map(_temp$4);
|
|
35
|
+
$[2] = t1;
|
|
36
|
+
$[3] = t2;
|
|
37
|
+
} else {
|
|
38
|
+
t1 = $[2];
|
|
39
|
+
t2 = $[3];
|
|
40
|
+
}
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[4] !== t) {
|
|
43
|
+
t3 = t("corner");
|
|
44
|
+
$[4] = t;
|
|
45
|
+
$[5] = t3;
|
|
46
|
+
} else t3 = $[5];
|
|
47
|
+
let t4;
|
|
48
|
+
if ($[6] !== t) {
|
|
49
|
+
t4 = t("nothing");
|
|
50
|
+
$[6] = t;
|
|
51
|
+
$[7] = t4;
|
|
52
|
+
} else t4 = $[7];
|
|
53
|
+
let t5;
|
|
54
|
+
if ($[8] !== t) {
|
|
55
|
+
t5 = t("worst");
|
|
56
|
+
$[8] = t;
|
|
57
|
+
$[9] = t5;
|
|
58
|
+
} else t5 = $[9];
|
|
59
|
+
let t6;
|
|
60
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
61
|
+
t6 = [];
|
|
62
|
+
$[10] = t6;
|
|
63
|
+
} else t6 = $[10];
|
|
64
|
+
let t7;
|
|
65
|
+
if ($[11] !== t) {
|
|
66
|
+
t7 = t("down");
|
|
67
|
+
$[11] = t;
|
|
68
|
+
$[12] = t7;
|
|
69
|
+
} else t7 = $[12];
|
|
70
|
+
let t8;
|
|
71
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
72
|
+
t8 = /* @__PURE__ */ jsx(XIcon, {});
|
|
73
|
+
$[13] = t8;
|
|
74
|
+
} else t8 = $[13];
|
|
75
|
+
let t9;
|
|
76
|
+
if ($[14] !== t7) {
|
|
77
|
+
t9 = {
|
|
78
|
+
label: t7,
|
|
79
|
+
mark: t8,
|
|
80
|
+
tone: "error"
|
|
81
|
+
};
|
|
82
|
+
$[14] = t7;
|
|
83
|
+
$[15] = t9;
|
|
84
|
+
} else t9 = $[15];
|
|
85
|
+
let t10;
|
|
86
|
+
if ($[16] !== t) {
|
|
87
|
+
t10 = t("fine");
|
|
88
|
+
$[16] = t;
|
|
89
|
+
$[17] = t10;
|
|
90
|
+
} else t10 = $[17];
|
|
91
|
+
let t11;
|
|
92
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
|
+
t11 = /* @__PURE__ */ jsx(CheckIcon, {});
|
|
94
|
+
$[18] = t11;
|
|
95
|
+
} else t11 = $[18];
|
|
96
|
+
let t12;
|
|
97
|
+
if ($[19] !== t10) {
|
|
98
|
+
t12 = {
|
|
99
|
+
label: t10,
|
|
100
|
+
mark: t11,
|
|
101
|
+
tone: "success"
|
|
102
|
+
};
|
|
103
|
+
$[19] = t10;
|
|
104
|
+
$[20] = t12;
|
|
105
|
+
} else t12 = $[20];
|
|
106
|
+
let t13;
|
|
107
|
+
if ($[21] !== t12 || $[22] !== t9) {
|
|
108
|
+
t13 = {
|
|
109
|
+
down: t9,
|
|
110
|
+
fine: t12
|
|
111
|
+
};
|
|
112
|
+
$[21] = t12;
|
|
113
|
+
$[22] = t9;
|
|
114
|
+
$[23] = t13;
|
|
115
|
+
} else t13 = $[23];
|
|
116
|
+
let t14;
|
|
117
|
+
if ($[24] !== t) {
|
|
118
|
+
t14 = t("unmeasured");
|
|
119
|
+
$[24] = t;
|
|
120
|
+
$[25] = t14;
|
|
121
|
+
} else t14 = $[25];
|
|
122
|
+
let t15;
|
|
123
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
124
|
+
t15 = /* @__PURE__ */ jsx(CircleDashedIcon, {});
|
|
125
|
+
$[26] = t15;
|
|
126
|
+
} else t15 = $[26];
|
|
127
|
+
let t16;
|
|
128
|
+
if ($[27] !== t14) {
|
|
129
|
+
t16 = {
|
|
130
|
+
label: t14,
|
|
131
|
+
mark: t15,
|
|
132
|
+
tone: "neutral"
|
|
133
|
+
};
|
|
134
|
+
$[27] = t14;
|
|
135
|
+
$[28] = t16;
|
|
136
|
+
} else t16 = $[28];
|
|
137
|
+
let t17;
|
|
138
|
+
if ($[29] !== t0 || $[30] !== t13 || $[31] !== t16 || $[32] !== t3 || $[33] !== t4 || $[34] !== t5) {
|
|
139
|
+
t17 = /* @__PURE__ */ jsx(StatusMatrix, {
|
|
140
|
+
caption: t0,
|
|
141
|
+
cells: t1,
|
|
142
|
+
columns: t2,
|
|
143
|
+
corner: t3,
|
|
144
|
+
empty: t4,
|
|
145
|
+
rollup: t5,
|
|
146
|
+
rows: t6,
|
|
147
|
+
rules: "all",
|
|
148
|
+
states: t13,
|
|
149
|
+
unmeasured: t16,
|
|
150
|
+
variant: "surface"
|
|
151
|
+
});
|
|
152
|
+
$[29] = t0;
|
|
153
|
+
$[30] = t13;
|
|
154
|
+
$[31] = t16;
|
|
155
|
+
$[32] = t3;
|
|
156
|
+
$[33] = t4;
|
|
157
|
+
$[34] = t5;
|
|
158
|
+
$[35] = t17;
|
|
159
|
+
} else t17 = $[35];
|
|
160
|
+
return t17;
|
|
161
|
+
}
|
|
162
|
+
function _temp$4(site) {
|
|
163
|
+
return {
|
|
164
|
+
id: site,
|
|
165
|
+
label: site
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, CircleDashedIcon, XIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { StatusMatrix } from \"@stealthscale/component-collections\";\n\nconst SITES = [\"Dublin\", \"Reston\", \"Osaka\"] as const;\n\nexport function Empty(): ReactElement {\n const { t } = useWords(\"status-matrix\");\n\n return (\n <StatusMatrix\n caption={t(\"checks\")}\n cells={[]}\n columns={SITES.map((site) => ({ id: site, label: site }))}\n corner={t(\"corner\")}\n empty={t(\"nothing\")}\n rollup={t(\"worst\")}\n rows={[]}\n rules=\"all\"\n states={{\n down: { label: t(\"down\"), mark: <XIcon />, tone: \"error\" },\n fine: { label: t(\"fine\"), mark: <CheckIcon />, tone: \"success\" },\n }}\n unmeasured={{ label: t(\"unmeasured\"), mark: <CircleDashedIcon />, tone: \"neutral\" }}\n variant=\"surface\"\n />\n );\n}\n";
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/status-matrix/examples/gapped.example.tsx
|
|
171
|
+
var gapped_example_exports = /* @__PURE__ */ __exportAll({
|
|
172
|
+
Gapped: () => Gapped,
|
|
173
|
+
source: () => source$3
|
|
174
|
+
});
|
|
175
|
+
const SERVICES$2 = [
|
|
176
|
+
{
|
|
177
|
+
group: "platform",
|
|
178
|
+
id: "auth"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
group: "platform",
|
|
182
|
+
id: "billing"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
group: "streaming",
|
|
186
|
+
id: "media"
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
const REGIONS$1 = [
|
|
190
|
+
"EU",
|
|
191
|
+
"US",
|
|
192
|
+
"APAC"
|
|
193
|
+
];
|
|
194
|
+
const CELLS$3 = [
|
|
195
|
+
{
|
|
196
|
+
column: "EU",
|
|
197
|
+
row: "auth",
|
|
198
|
+
state: "fine"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
column: "US",
|
|
202
|
+
row: "auth",
|
|
203
|
+
state: "fine"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
column: "EU",
|
|
207
|
+
row: "billing",
|
|
208
|
+
state: "slow"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
column: "US",
|
|
212
|
+
row: "billing",
|
|
213
|
+
state: "down"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
column: "EU",
|
|
217
|
+
row: "media",
|
|
218
|
+
state: "rolling"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
column: "US",
|
|
222
|
+
row: "media",
|
|
223
|
+
state: "fine"
|
|
224
|
+
}
|
|
225
|
+
];
|
|
226
|
+
function Gapped() {
|
|
227
|
+
const $ = c(49);
|
|
228
|
+
const { t } = useWords("status-matrix");
|
|
229
|
+
let t0;
|
|
230
|
+
if ($[0] !== t) {
|
|
231
|
+
t0 = t("rollout");
|
|
232
|
+
$[0] = t;
|
|
233
|
+
$[1] = t0;
|
|
234
|
+
} else t0 = $[1];
|
|
235
|
+
let t1;
|
|
236
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
237
|
+
t1 = REGIONS$1.map(_temp$3);
|
|
238
|
+
$[2] = t1;
|
|
239
|
+
} else t1 = $[2];
|
|
240
|
+
let t2;
|
|
241
|
+
if ($[3] !== t) {
|
|
242
|
+
t2 = t("corner");
|
|
243
|
+
$[3] = t;
|
|
244
|
+
$[4] = t2;
|
|
245
|
+
} else t2 = $[4];
|
|
246
|
+
let t3;
|
|
247
|
+
if ($[5] !== t) {
|
|
248
|
+
t3 = t("legend");
|
|
249
|
+
$[5] = t;
|
|
250
|
+
$[6] = t3;
|
|
251
|
+
} else t3 = $[6];
|
|
252
|
+
let t4;
|
|
253
|
+
if ($[7] !== t) {
|
|
254
|
+
t4 = t("worst");
|
|
255
|
+
$[7] = t;
|
|
256
|
+
$[8] = t4;
|
|
257
|
+
} else t4 = $[8];
|
|
258
|
+
let t5;
|
|
259
|
+
if ($[9] !== t) {
|
|
260
|
+
t5 = SERVICES$2.map((t6) => {
|
|
261
|
+
const { group, id } = t6;
|
|
262
|
+
return {
|
|
263
|
+
group: t(group),
|
|
264
|
+
id,
|
|
265
|
+
label: id
|
|
266
|
+
};
|
|
267
|
+
});
|
|
268
|
+
$[9] = t;
|
|
269
|
+
$[10] = t5;
|
|
270
|
+
} else t5 = $[10];
|
|
271
|
+
let t6;
|
|
272
|
+
if ($[11] !== t) {
|
|
273
|
+
t6 = t("down");
|
|
274
|
+
$[11] = t;
|
|
275
|
+
$[12] = t6;
|
|
276
|
+
} else t6 = $[12];
|
|
277
|
+
let t7;
|
|
278
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
279
|
+
t7 = /* @__PURE__ */ jsx(XIcon, {});
|
|
280
|
+
$[13] = t7;
|
|
281
|
+
} else t7 = $[13];
|
|
282
|
+
let t8;
|
|
283
|
+
if ($[14] !== t6) {
|
|
284
|
+
t8 = {
|
|
285
|
+
label: t6,
|
|
286
|
+
mark: t7,
|
|
287
|
+
tone: "error"
|
|
288
|
+
};
|
|
289
|
+
$[14] = t6;
|
|
290
|
+
$[15] = t8;
|
|
291
|
+
} else t8 = $[15];
|
|
292
|
+
let t9;
|
|
293
|
+
if ($[16] !== t) {
|
|
294
|
+
t9 = t("fine");
|
|
295
|
+
$[16] = t;
|
|
296
|
+
$[17] = t9;
|
|
297
|
+
} else t9 = $[17];
|
|
298
|
+
let t10;
|
|
299
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
300
|
+
t10 = /* @__PURE__ */ jsx(CheckIcon, {});
|
|
301
|
+
$[18] = t10;
|
|
302
|
+
} else t10 = $[18];
|
|
303
|
+
let t11;
|
|
304
|
+
if ($[19] !== t9) {
|
|
305
|
+
t11 = {
|
|
306
|
+
label: t9,
|
|
307
|
+
mark: t10,
|
|
308
|
+
tone: "success"
|
|
309
|
+
};
|
|
310
|
+
$[19] = t9;
|
|
311
|
+
$[20] = t11;
|
|
312
|
+
} else t11 = $[20];
|
|
313
|
+
let t12;
|
|
314
|
+
if ($[21] !== t) {
|
|
315
|
+
t12 = t("rolling");
|
|
316
|
+
$[21] = t;
|
|
317
|
+
$[22] = t12;
|
|
318
|
+
} else t12 = $[22];
|
|
319
|
+
let t13;
|
|
320
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
321
|
+
t13 = /* @__PURE__ */ jsx(LoaderIcon, {});
|
|
322
|
+
$[23] = t13;
|
|
323
|
+
} else t13 = $[23];
|
|
324
|
+
let t14;
|
|
325
|
+
if ($[24] !== t12) {
|
|
326
|
+
t14 = {
|
|
327
|
+
label: t12,
|
|
328
|
+
mark: t13,
|
|
329
|
+
tone: "info"
|
|
330
|
+
};
|
|
331
|
+
$[24] = t12;
|
|
332
|
+
$[25] = t14;
|
|
333
|
+
} else t14 = $[25];
|
|
334
|
+
let t15;
|
|
335
|
+
if ($[26] !== t) {
|
|
336
|
+
t15 = t("slow");
|
|
337
|
+
$[26] = t;
|
|
338
|
+
$[27] = t15;
|
|
339
|
+
} else t15 = $[27];
|
|
340
|
+
let t16;
|
|
341
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
342
|
+
t16 = /* @__PURE__ */ jsx(TriangleAlertIcon, {});
|
|
343
|
+
$[28] = t16;
|
|
344
|
+
} else t16 = $[28];
|
|
345
|
+
let t17;
|
|
346
|
+
if ($[29] !== t15) {
|
|
347
|
+
t17 = {
|
|
348
|
+
label: t15,
|
|
349
|
+
mark: t16,
|
|
350
|
+
tone: "warning"
|
|
351
|
+
};
|
|
352
|
+
$[29] = t15;
|
|
353
|
+
$[30] = t17;
|
|
354
|
+
} else t17 = $[30];
|
|
355
|
+
let t18;
|
|
356
|
+
if ($[31] !== t11 || $[32] !== t14 || $[33] !== t17 || $[34] !== t8) {
|
|
357
|
+
t18 = {
|
|
358
|
+
down: t8,
|
|
359
|
+
fine: t11,
|
|
360
|
+
rolling: t14,
|
|
361
|
+
slow: t17
|
|
362
|
+
};
|
|
363
|
+
$[31] = t11;
|
|
364
|
+
$[32] = t14;
|
|
365
|
+
$[33] = t17;
|
|
366
|
+
$[34] = t8;
|
|
367
|
+
$[35] = t18;
|
|
368
|
+
} else t18 = $[35];
|
|
369
|
+
let t19;
|
|
370
|
+
if ($[36] !== t) {
|
|
371
|
+
t19 = t("unmeasured");
|
|
372
|
+
$[36] = t;
|
|
373
|
+
$[37] = t19;
|
|
374
|
+
} else t19 = $[37];
|
|
375
|
+
let t20;
|
|
376
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
377
|
+
t20 = /* @__PURE__ */ jsx(CircleDashedIcon, {});
|
|
378
|
+
$[38] = t20;
|
|
379
|
+
} else t20 = $[38];
|
|
380
|
+
let t21;
|
|
381
|
+
if ($[39] !== t19) {
|
|
382
|
+
t21 = {
|
|
383
|
+
label: t19,
|
|
384
|
+
mark: t20,
|
|
385
|
+
tone: "neutral"
|
|
386
|
+
};
|
|
387
|
+
$[39] = t19;
|
|
388
|
+
$[40] = t21;
|
|
389
|
+
} else t21 = $[40];
|
|
390
|
+
let t22;
|
|
391
|
+
if ($[41] !== t0 || $[42] !== t18 || $[43] !== t2 || $[44] !== t21 || $[45] !== t3 || $[46] !== t4 || $[47] !== t5) {
|
|
392
|
+
t22 = /* @__PURE__ */ jsx(StatusMatrix, {
|
|
393
|
+
caption: t0,
|
|
394
|
+
cells: CELLS$3,
|
|
395
|
+
columns: t1,
|
|
396
|
+
corner: t2,
|
|
397
|
+
legend: t3,
|
|
398
|
+
rollup: t4,
|
|
399
|
+
rows: t5,
|
|
400
|
+
rules: "all",
|
|
401
|
+
states: t18,
|
|
402
|
+
unmeasured: t21,
|
|
403
|
+
variant: "surface"
|
|
404
|
+
});
|
|
405
|
+
$[41] = t0;
|
|
406
|
+
$[42] = t18;
|
|
407
|
+
$[43] = t2;
|
|
408
|
+
$[44] = t21;
|
|
409
|
+
$[45] = t3;
|
|
410
|
+
$[46] = t4;
|
|
411
|
+
$[47] = t5;
|
|
412
|
+
$[48] = t22;
|
|
413
|
+
} else t22 = $[48];
|
|
414
|
+
return t22;
|
|
415
|
+
}
|
|
416
|
+
function _temp$3(region) {
|
|
417
|
+
return {
|
|
418
|
+
id: region,
|
|
419
|
+
label: region
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, CircleDashedIcon, LoaderIcon, TriangleAlertIcon, XIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { MatrixCell, StatusMatrix } from \"@stealthscale/component-collections\";\n\nconst SERVICES = [\n { group: \"platform\", id: \"auth\" },\n { group: \"platform\", id: \"billing\" },\n { group: \"streaming\", id: \"media\" },\n] as const;\n\nconst REGIONS = [\"EU\", \"US\", \"APAC\"] as const;\n\nconst CELLS: readonly MatrixCell[] = [\n { column: \"EU\", row: \"auth\", state: \"fine\" },\n { column: \"US\", row: \"auth\", state: \"fine\" },\n { column: \"EU\", row: \"billing\", state: \"slow\" },\n { column: \"US\", row: \"billing\", state: \"down\" },\n { column: \"EU\", row: \"media\", state: \"rolling\" },\n { column: \"US\", row: \"media\", state: \"fine\" },\n];\n\nexport function Gapped(): ReactElement {\n const { t } = useWords(\"status-matrix\");\n\n return (\n <StatusMatrix\n caption={t(\"rollout\")}\n cells={CELLS}\n columns={REGIONS.map((region) => ({ id: region, label: region }))}\n corner={t(\"corner\")}\n legend={t(\"legend\")}\n rollup={t(\"worst\")}\n rows={SERVICES.map(({ group, id }) => ({ group: t(group), id, label: id }))}\n rules=\"all\"\n states={{\n down: { label: t(\"down\"), mark: <XIcon />, tone: \"error\" },\n fine: { label: t(\"fine\"), mark: <CheckIcon />, tone: \"success\" },\n rolling: { label: t(\"rolling\"), mark: <LoaderIcon />, tone: \"info\" },\n slow: { label: t(\"slow\"), mark: <TriangleAlertIcon />, tone: \"warning\" },\n }}\n unmeasured={{ label: t(\"unmeasured\"), mark: <CircleDashedIcon />, tone: \"neutral\" }}\n variant=\"surface\"\n />\n );\n}\n";
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/status-matrix/examples/health.example.tsx
|
|
425
|
+
var health_example_exports = /* @__PURE__ */ __exportAll({
|
|
426
|
+
Health: () => Health,
|
|
427
|
+
source: () => source$2
|
|
428
|
+
});
|
|
429
|
+
const SERVICES$1 = [
|
|
430
|
+
{
|
|
431
|
+
group: "payments",
|
|
432
|
+
id: "checkout-api"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
group: "payments",
|
|
436
|
+
id: "ledger"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
group: "discovery",
|
|
440
|
+
id: "search-api"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
group: "discovery",
|
|
444
|
+
id: "ranking"
|
|
445
|
+
}
|
|
446
|
+
];
|
|
447
|
+
const REGIONS = [
|
|
448
|
+
"EU",
|
|
449
|
+
"US",
|
|
450
|
+
"APAC"
|
|
451
|
+
];
|
|
452
|
+
const CELLS$2 = [
|
|
453
|
+
{
|
|
454
|
+
column: "EU",
|
|
455
|
+
row: "checkout-api",
|
|
456
|
+
state: "fine"
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
column: "US",
|
|
460
|
+
row: "checkout-api",
|
|
461
|
+
state: "down"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
column: "APAC",
|
|
465
|
+
row: "checkout-api",
|
|
466
|
+
state: "slow"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
column: "EU",
|
|
470
|
+
row: "ledger",
|
|
471
|
+
state: "fine"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
column: "US",
|
|
475
|
+
row: "ledger",
|
|
476
|
+
state: "fine"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
column: "APAC",
|
|
480
|
+
row: "ledger",
|
|
481
|
+
state: "fine"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
column: "EU",
|
|
485
|
+
row: "search-api",
|
|
486
|
+
state: "fine"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
column: "US",
|
|
490
|
+
row: "search-api",
|
|
491
|
+
state: "rolling"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
column: "APAC",
|
|
495
|
+
row: "search-api",
|
|
496
|
+
state: "fine"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
column: "EU",
|
|
500
|
+
row: "ranking",
|
|
501
|
+
state: "slow"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
column: "US",
|
|
505
|
+
row: "ranking",
|
|
506
|
+
state: "fine"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
column: "APAC",
|
|
510
|
+
row: "ranking",
|
|
511
|
+
state: "skipped"
|
|
512
|
+
}
|
|
513
|
+
];
|
|
514
|
+
function Health(props) {
|
|
515
|
+
const $ = c(59);
|
|
516
|
+
const { t } = useWords("status-matrix");
|
|
517
|
+
let t0;
|
|
518
|
+
if ($[0] !== t) {
|
|
519
|
+
t0 = t("caption");
|
|
520
|
+
$[0] = t;
|
|
521
|
+
$[1] = t0;
|
|
522
|
+
} else t0 = $[1];
|
|
523
|
+
let t1;
|
|
524
|
+
if ($[2] !== t) {
|
|
525
|
+
t1 = (state, row, column) => t("crossing", {
|
|
526
|
+
column: column.id,
|
|
527
|
+
row: row.id,
|
|
528
|
+
state: state.label
|
|
529
|
+
});
|
|
530
|
+
$[2] = t;
|
|
531
|
+
$[3] = t1;
|
|
532
|
+
} else t1 = $[3];
|
|
533
|
+
let t2;
|
|
534
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
535
|
+
t2 = REGIONS.map(_temp$2);
|
|
536
|
+
$[4] = t2;
|
|
537
|
+
} else t2 = $[4];
|
|
538
|
+
let t3;
|
|
539
|
+
if ($[5] !== t) {
|
|
540
|
+
t3 = t("corner");
|
|
541
|
+
$[5] = t;
|
|
542
|
+
$[6] = t3;
|
|
543
|
+
} else t3 = $[6];
|
|
544
|
+
let t4;
|
|
545
|
+
if ($[7] !== t) {
|
|
546
|
+
t4 = t("legend");
|
|
547
|
+
$[7] = t;
|
|
548
|
+
$[8] = t4;
|
|
549
|
+
} else t4 = $[8];
|
|
550
|
+
let t5;
|
|
551
|
+
if ($[9] !== t) {
|
|
552
|
+
t5 = t("worst");
|
|
553
|
+
$[9] = t;
|
|
554
|
+
$[10] = t5;
|
|
555
|
+
} else t5 = $[10];
|
|
556
|
+
let t6;
|
|
557
|
+
if ($[11] !== t) {
|
|
558
|
+
t6 = SERVICES$1.map((t7) => {
|
|
559
|
+
const { group, id } = t7;
|
|
560
|
+
return {
|
|
561
|
+
group: t(group),
|
|
562
|
+
id,
|
|
563
|
+
label: id
|
|
564
|
+
};
|
|
565
|
+
});
|
|
566
|
+
$[11] = t;
|
|
567
|
+
$[12] = t6;
|
|
568
|
+
} else t6 = $[12];
|
|
569
|
+
let t7;
|
|
570
|
+
if ($[13] !== t) {
|
|
571
|
+
t7 = t("down");
|
|
572
|
+
$[13] = t;
|
|
573
|
+
$[14] = t7;
|
|
574
|
+
} else t7 = $[14];
|
|
575
|
+
let t8;
|
|
576
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
577
|
+
t8 = /* @__PURE__ */ jsx(XIcon, {});
|
|
578
|
+
$[15] = t8;
|
|
579
|
+
} else t8 = $[15];
|
|
580
|
+
let t9;
|
|
581
|
+
if ($[16] !== t7) {
|
|
582
|
+
t9 = {
|
|
583
|
+
label: t7,
|
|
584
|
+
mark: t8,
|
|
585
|
+
tone: "error"
|
|
586
|
+
};
|
|
587
|
+
$[16] = t7;
|
|
588
|
+
$[17] = t9;
|
|
589
|
+
} else t9 = $[17];
|
|
590
|
+
let t10;
|
|
591
|
+
if ($[18] !== t) {
|
|
592
|
+
t10 = t("fine");
|
|
593
|
+
$[18] = t;
|
|
594
|
+
$[19] = t10;
|
|
595
|
+
} else t10 = $[19];
|
|
596
|
+
let t11;
|
|
597
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
598
|
+
t11 = /* @__PURE__ */ jsx(CheckIcon, {});
|
|
599
|
+
$[20] = t11;
|
|
600
|
+
} else t11 = $[20];
|
|
601
|
+
let t12;
|
|
602
|
+
if ($[21] !== t10) {
|
|
603
|
+
t12 = {
|
|
604
|
+
label: t10,
|
|
605
|
+
mark: t11,
|
|
606
|
+
tone: "success"
|
|
607
|
+
};
|
|
608
|
+
$[21] = t10;
|
|
609
|
+
$[22] = t12;
|
|
610
|
+
} else t12 = $[22];
|
|
611
|
+
let t13;
|
|
612
|
+
if ($[23] !== t) {
|
|
613
|
+
t13 = t("rolling");
|
|
614
|
+
$[23] = t;
|
|
615
|
+
$[24] = t13;
|
|
616
|
+
} else t13 = $[24];
|
|
617
|
+
let t14;
|
|
618
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
619
|
+
t14 = /* @__PURE__ */ jsx(LoaderIcon, {});
|
|
620
|
+
$[25] = t14;
|
|
621
|
+
} else t14 = $[25];
|
|
622
|
+
let t15;
|
|
623
|
+
if ($[26] !== t13) {
|
|
624
|
+
t15 = {
|
|
625
|
+
label: t13,
|
|
626
|
+
mark: t14,
|
|
627
|
+
tone: "info"
|
|
628
|
+
};
|
|
629
|
+
$[26] = t13;
|
|
630
|
+
$[27] = t15;
|
|
631
|
+
} else t15 = $[27];
|
|
632
|
+
let t16;
|
|
633
|
+
if ($[28] !== t) {
|
|
634
|
+
t16 = t("skipped");
|
|
635
|
+
$[28] = t;
|
|
636
|
+
$[29] = t16;
|
|
637
|
+
} else t16 = $[29];
|
|
638
|
+
let t17;
|
|
639
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
640
|
+
t17 = /* @__PURE__ */ jsx(MinusIcon, {});
|
|
641
|
+
$[30] = t17;
|
|
642
|
+
} else t17 = $[30];
|
|
643
|
+
let t18;
|
|
644
|
+
if ($[31] !== t16) {
|
|
645
|
+
t18 = {
|
|
646
|
+
label: t16,
|
|
647
|
+
mark: t17,
|
|
648
|
+
tone: "neutral"
|
|
649
|
+
};
|
|
650
|
+
$[31] = t16;
|
|
651
|
+
$[32] = t18;
|
|
652
|
+
} else t18 = $[32];
|
|
653
|
+
let t19;
|
|
654
|
+
if ($[33] !== t) {
|
|
655
|
+
t19 = t("slow");
|
|
656
|
+
$[33] = t;
|
|
657
|
+
$[34] = t19;
|
|
658
|
+
} else t19 = $[34];
|
|
659
|
+
let t20;
|
|
660
|
+
if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
|
|
661
|
+
t20 = /* @__PURE__ */ jsx(TriangleAlertIcon, {});
|
|
662
|
+
$[35] = t20;
|
|
663
|
+
} else t20 = $[35];
|
|
664
|
+
let t21;
|
|
665
|
+
if ($[36] !== t19) {
|
|
666
|
+
t21 = {
|
|
667
|
+
label: t19,
|
|
668
|
+
mark: t20,
|
|
669
|
+
tone: "warning"
|
|
670
|
+
};
|
|
671
|
+
$[36] = t19;
|
|
672
|
+
$[37] = t21;
|
|
673
|
+
} else t21 = $[37];
|
|
674
|
+
let t22;
|
|
675
|
+
if ($[38] !== t12 || $[39] !== t15 || $[40] !== t18 || $[41] !== t21 || $[42] !== t9) {
|
|
676
|
+
t22 = {
|
|
677
|
+
down: t9,
|
|
678
|
+
fine: t12,
|
|
679
|
+
rolling: t15,
|
|
680
|
+
skipped: t18,
|
|
681
|
+
slow: t21
|
|
682
|
+
};
|
|
683
|
+
$[38] = t12;
|
|
684
|
+
$[39] = t15;
|
|
685
|
+
$[40] = t18;
|
|
686
|
+
$[41] = t21;
|
|
687
|
+
$[42] = t9;
|
|
688
|
+
$[43] = t22;
|
|
689
|
+
} else t22 = $[43];
|
|
690
|
+
let t23;
|
|
691
|
+
if ($[44] !== t) {
|
|
692
|
+
t23 = t("unmeasured");
|
|
693
|
+
$[44] = t;
|
|
694
|
+
$[45] = t23;
|
|
695
|
+
} else t23 = $[45];
|
|
696
|
+
let t24;
|
|
697
|
+
if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
|
|
698
|
+
t24 = /* @__PURE__ */ jsx(CircleDashedIcon, {});
|
|
699
|
+
$[46] = t24;
|
|
700
|
+
} else t24 = $[46];
|
|
701
|
+
let t25;
|
|
702
|
+
if ($[47] !== t23) {
|
|
703
|
+
t25 = {
|
|
704
|
+
label: t23,
|
|
705
|
+
mark: t24,
|
|
706
|
+
tone: "neutral"
|
|
707
|
+
};
|
|
708
|
+
$[47] = t23;
|
|
709
|
+
$[48] = t25;
|
|
710
|
+
} else t25 = $[48];
|
|
711
|
+
let t26;
|
|
712
|
+
if ($[49] !== props || $[50] !== t0 || $[51] !== t1 || $[52] !== t22 || $[53] !== t25 || $[54] !== t3 || $[55] !== t4 || $[56] !== t5 || $[57] !== t6) {
|
|
713
|
+
t26 = /* @__PURE__ */ jsx(StatusMatrix, {
|
|
714
|
+
caption: t0,
|
|
715
|
+
cellLabel: t1,
|
|
716
|
+
cells: CELLS$2,
|
|
717
|
+
columns: t2,
|
|
718
|
+
corner: t3,
|
|
719
|
+
legend: t4,
|
|
720
|
+
rollup: t5,
|
|
721
|
+
rows: t6,
|
|
722
|
+
rules: "all",
|
|
723
|
+
states: t22,
|
|
724
|
+
unmeasured: t25,
|
|
725
|
+
variant: "surface",
|
|
726
|
+
...props
|
|
727
|
+
});
|
|
728
|
+
$[49] = props;
|
|
729
|
+
$[50] = t0;
|
|
730
|
+
$[51] = t1;
|
|
731
|
+
$[52] = t22;
|
|
732
|
+
$[53] = t25;
|
|
733
|
+
$[54] = t3;
|
|
734
|
+
$[55] = t4;
|
|
735
|
+
$[56] = t5;
|
|
736
|
+
$[57] = t6;
|
|
737
|
+
$[58] = t26;
|
|
738
|
+
} else t26 = $[58];
|
|
739
|
+
return t26;
|
|
740
|
+
}
|
|
741
|
+
function _temp$2(region) {
|
|
742
|
+
return {
|
|
743
|
+
id: region,
|
|
744
|
+
label: region
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport {\n CheckIcon,\n CircleDashedIcon,\n LoaderIcon,\n MinusIcon,\n TriangleAlertIcon,\n XIcon,\n} from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { MatrixCell, StatusMatrix, StatusMatrixProps } from \"@stealthscale/component-collections\";\n\nconst SERVICES = [\n { group: \"payments\", id: \"checkout-api\" },\n { group: \"payments\", id: \"ledger\" },\n { group: \"discovery\", id: \"search-api\" },\n { group: \"discovery\", id: \"ranking\" },\n] as const;\n\nconst REGIONS = [\"EU\", \"US\", \"APAC\"] as const;\n\nconst CELLS: readonly MatrixCell[] = [\n { column: \"EU\", row: \"checkout-api\", state: \"fine\" },\n { column: \"US\", row: \"checkout-api\", state: \"down\" },\n { column: \"APAC\", row: \"checkout-api\", state: \"slow\" },\n { column: \"EU\", row: \"ledger\", state: \"fine\" },\n { column: \"US\", row: \"ledger\", state: \"fine\" },\n { column: \"APAC\", row: \"ledger\", state: \"fine\" },\n { column: \"EU\", row: \"search-api\", state: \"fine\" },\n { column: \"US\", row: \"search-api\", state: \"rolling\" },\n { column: \"APAC\", row: \"search-api\", state: \"fine\" },\n { column: \"EU\", row: \"ranking\", state: \"slow\" },\n { column: \"US\", row: \"ranking\", state: \"fine\" },\n { column: \"APAC\", row: \"ranking\", state: \"skipped\" },\n];\n\nexport function Health(\n props: Omit<StatusMatrixProps, \"cells\" | \"columns\" | \"rows\" | \"states\" | \"unmeasured\">,\n): ReactElement {\n const { t } = useWords(\"status-matrix\");\n\n return (\n <StatusMatrix\n caption={t(\"caption\")}\n cellLabel={(state, row, column) =>\n t(\"crossing\", { column: column.id, row: row.id, state: state.label })\n }\n cells={CELLS}\n columns={REGIONS.map((region) => ({ id: region, label: region }))}\n corner={t(\"corner\")}\n legend={t(\"legend\")}\n rollup={t(\"worst\")}\n rows={SERVICES.map(({ group, id }) => ({ group: t(group), id, label: id }))}\n rules=\"all\"\n states={{\n down: { label: t(\"down\"), mark: <XIcon />, tone: \"error\" },\n fine: { label: t(\"fine\"), mark: <CheckIcon />, tone: \"success\" },\n rolling: { label: t(\"rolling\"), mark: <LoaderIcon />, tone: \"info\" },\n skipped: { label: t(\"skipped\"), mark: <MinusIcon />, tone: \"neutral\" },\n slow: { label: t(\"slow\"), mark: <TriangleAlertIcon />, tone: \"warning\" },\n }}\n unmeasured={{ label: t(\"unmeasured\"), mark: <CircleDashedIcon />, tone: \"neutral\" }}\n variant=\"surface\"\n {...props}\n />\n );\n}\n";
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/status-matrix/examples/plumbing.example.tsx
|
|
750
|
+
var plumbing_example_exports = /* @__PURE__ */ __exportAll({
|
|
751
|
+
Plumbing: () => Plumbing,
|
|
752
|
+
source: () => source$1
|
|
753
|
+
});
|
|
754
|
+
const SERVICES = [
|
|
755
|
+
"cdn",
|
|
756
|
+
"dns",
|
|
757
|
+
"mail",
|
|
758
|
+
"object-store"
|
|
759
|
+
];
|
|
760
|
+
const SITES$1 = [
|
|
761
|
+
"Dublin",
|
|
762
|
+
"Reston",
|
|
763
|
+
"Osaka"
|
|
764
|
+
];
|
|
765
|
+
const CELLS$1 = [
|
|
766
|
+
{
|
|
767
|
+
column: "Dublin",
|
|
768
|
+
row: "cdn",
|
|
769
|
+
state: "fine"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
column: "Reston",
|
|
773
|
+
row: "cdn",
|
|
774
|
+
state: "fine"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
column: "Osaka",
|
|
778
|
+
row: "cdn",
|
|
779
|
+
state: "slow"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
column: "Dublin",
|
|
783
|
+
row: "dns",
|
|
784
|
+
state: "fine"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
column: "Reston",
|
|
788
|
+
row: "dns",
|
|
789
|
+
state: "fine"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
column: "Osaka",
|
|
793
|
+
row: "dns",
|
|
794
|
+
state: "fine"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
column: "Dublin",
|
|
798
|
+
row: "mail",
|
|
799
|
+
state: "skipped"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
column: "Reston",
|
|
803
|
+
row: "mail",
|
|
804
|
+
state: "rolling"
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
column: "Osaka",
|
|
808
|
+
row: "mail",
|
|
809
|
+
state: "skipped"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
column: "Dublin",
|
|
813
|
+
row: "object-store",
|
|
814
|
+
state: "down"
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
column: "Reston",
|
|
818
|
+
row: "object-store",
|
|
819
|
+
state: "fine"
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
column: "Osaka",
|
|
823
|
+
row: "object-store",
|
|
824
|
+
state: "fine"
|
|
825
|
+
}
|
|
826
|
+
];
|
|
827
|
+
function Plumbing() {
|
|
828
|
+
const $ = c(50);
|
|
829
|
+
const { t } = useWords("status-matrix");
|
|
830
|
+
let t0;
|
|
831
|
+
if ($[0] !== t) {
|
|
832
|
+
t0 = t("shared");
|
|
833
|
+
$[0] = t;
|
|
834
|
+
$[1] = t0;
|
|
835
|
+
} else t0 = $[1];
|
|
836
|
+
let t1;
|
|
837
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
838
|
+
t1 = SITES$1.map(_temp$1);
|
|
839
|
+
$[2] = t1;
|
|
840
|
+
} else t1 = $[2];
|
|
841
|
+
let t2;
|
|
842
|
+
if ($[3] !== t) {
|
|
843
|
+
t2 = t("corner");
|
|
844
|
+
$[3] = t;
|
|
845
|
+
$[4] = t2;
|
|
846
|
+
} else t2 = $[4];
|
|
847
|
+
let t3;
|
|
848
|
+
if ($[5] !== t) {
|
|
849
|
+
t3 = t("worst");
|
|
850
|
+
$[5] = t;
|
|
851
|
+
$[6] = t3;
|
|
852
|
+
} else t3 = $[6];
|
|
853
|
+
let t4;
|
|
854
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
855
|
+
t4 = SERVICES.map(_temp2$1);
|
|
856
|
+
$[7] = t4;
|
|
857
|
+
} else t4 = $[7];
|
|
858
|
+
let t5;
|
|
859
|
+
if ($[8] !== t) {
|
|
860
|
+
t5 = t("down");
|
|
861
|
+
$[8] = t;
|
|
862
|
+
$[9] = t5;
|
|
863
|
+
} else t5 = $[9];
|
|
864
|
+
let t6;
|
|
865
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
866
|
+
t6 = /* @__PURE__ */ jsx(XIcon, {});
|
|
867
|
+
$[10] = t6;
|
|
868
|
+
} else t6 = $[10];
|
|
869
|
+
let t7;
|
|
870
|
+
if ($[11] !== t5) {
|
|
871
|
+
t7 = {
|
|
872
|
+
label: t5,
|
|
873
|
+
mark: t6,
|
|
874
|
+
tone: "error"
|
|
875
|
+
};
|
|
876
|
+
$[11] = t5;
|
|
877
|
+
$[12] = t7;
|
|
878
|
+
} else t7 = $[12];
|
|
879
|
+
let t8;
|
|
880
|
+
if ($[13] !== t) {
|
|
881
|
+
t8 = t("fine");
|
|
882
|
+
$[13] = t;
|
|
883
|
+
$[14] = t8;
|
|
884
|
+
} else t8 = $[14];
|
|
885
|
+
let t9;
|
|
886
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
887
|
+
t9 = /* @__PURE__ */ jsx(CheckIcon, {});
|
|
888
|
+
$[15] = t9;
|
|
889
|
+
} else t9 = $[15];
|
|
890
|
+
let t10;
|
|
891
|
+
if ($[16] !== t8) {
|
|
892
|
+
t10 = {
|
|
893
|
+
label: t8,
|
|
894
|
+
mark: t9,
|
|
895
|
+
tone: "success"
|
|
896
|
+
};
|
|
897
|
+
$[16] = t8;
|
|
898
|
+
$[17] = t10;
|
|
899
|
+
} else t10 = $[17];
|
|
900
|
+
let t11;
|
|
901
|
+
if ($[18] !== t) {
|
|
902
|
+
t11 = t("rolling");
|
|
903
|
+
$[18] = t;
|
|
904
|
+
$[19] = t11;
|
|
905
|
+
} else t11 = $[19];
|
|
906
|
+
let t12;
|
|
907
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
908
|
+
t12 = /* @__PURE__ */ jsx(LoaderIcon, {});
|
|
909
|
+
$[20] = t12;
|
|
910
|
+
} else t12 = $[20];
|
|
911
|
+
let t13;
|
|
912
|
+
if ($[21] !== t11) {
|
|
913
|
+
t13 = {
|
|
914
|
+
label: t11,
|
|
915
|
+
mark: t12,
|
|
916
|
+
tone: "info"
|
|
917
|
+
};
|
|
918
|
+
$[21] = t11;
|
|
919
|
+
$[22] = t13;
|
|
920
|
+
} else t13 = $[22];
|
|
921
|
+
let t14;
|
|
922
|
+
if ($[23] !== t) {
|
|
923
|
+
t14 = t("skipped");
|
|
924
|
+
$[23] = t;
|
|
925
|
+
$[24] = t14;
|
|
926
|
+
} else t14 = $[24];
|
|
927
|
+
let t15;
|
|
928
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
929
|
+
t15 = /* @__PURE__ */ jsx(MinusIcon, {});
|
|
930
|
+
$[25] = t15;
|
|
931
|
+
} else t15 = $[25];
|
|
932
|
+
let t16;
|
|
933
|
+
if ($[26] !== t14) {
|
|
934
|
+
t16 = {
|
|
935
|
+
label: t14,
|
|
936
|
+
mark: t15,
|
|
937
|
+
tone: "neutral"
|
|
938
|
+
};
|
|
939
|
+
$[26] = t14;
|
|
940
|
+
$[27] = t16;
|
|
941
|
+
} else t16 = $[27];
|
|
942
|
+
let t17;
|
|
943
|
+
if ($[28] !== t) {
|
|
944
|
+
t17 = t("slow");
|
|
945
|
+
$[28] = t;
|
|
946
|
+
$[29] = t17;
|
|
947
|
+
} else t17 = $[29];
|
|
948
|
+
let t18;
|
|
949
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
950
|
+
t18 = /* @__PURE__ */ jsx(TriangleAlertIcon, {});
|
|
951
|
+
$[30] = t18;
|
|
952
|
+
} else t18 = $[30];
|
|
953
|
+
let t19;
|
|
954
|
+
if ($[31] !== t17) {
|
|
955
|
+
t19 = {
|
|
956
|
+
label: t17,
|
|
957
|
+
mark: t18,
|
|
958
|
+
tone: "warning"
|
|
959
|
+
};
|
|
960
|
+
$[31] = t17;
|
|
961
|
+
$[32] = t19;
|
|
962
|
+
} else t19 = $[32];
|
|
963
|
+
let t20;
|
|
964
|
+
if ($[33] !== t10 || $[34] !== t13 || $[35] !== t16 || $[36] !== t19 || $[37] !== t7) {
|
|
965
|
+
t20 = {
|
|
966
|
+
down: t7,
|
|
967
|
+
fine: t10,
|
|
968
|
+
rolling: t13,
|
|
969
|
+
skipped: t16,
|
|
970
|
+
slow: t19
|
|
971
|
+
};
|
|
972
|
+
$[33] = t10;
|
|
973
|
+
$[34] = t13;
|
|
974
|
+
$[35] = t16;
|
|
975
|
+
$[36] = t19;
|
|
976
|
+
$[37] = t7;
|
|
977
|
+
$[38] = t20;
|
|
978
|
+
} else t20 = $[38];
|
|
979
|
+
let t21;
|
|
980
|
+
if ($[39] !== t) {
|
|
981
|
+
t21 = t("unmeasured");
|
|
982
|
+
$[39] = t;
|
|
983
|
+
$[40] = t21;
|
|
984
|
+
} else t21 = $[40];
|
|
985
|
+
let t22;
|
|
986
|
+
if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
|
|
987
|
+
t22 = /* @__PURE__ */ jsx(CircleDashedIcon, {});
|
|
988
|
+
$[41] = t22;
|
|
989
|
+
} else t22 = $[41];
|
|
990
|
+
let t23;
|
|
991
|
+
if ($[42] !== t21) {
|
|
992
|
+
t23 = {
|
|
993
|
+
label: t21,
|
|
994
|
+
mark: t22,
|
|
995
|
+
tone: "neutral"
|
|
996
|
+
};
|
|
997
|
+
$[42] = t21;
|
|
998
|
+
$[43] = t23;
|
|
999
|
+
} else t23 = $[43];
|
|
1000
|
+
let t24;
|
|
1001
|
+
if ($[44] !== t0 || $[45] !== t2 || $[46] !== t20 || $[47] !== t23 || $[48] !== t3) {
|
|
1002
|
+
t24 = /* @__PURE__ */ jsx(StatusMatrix, {
|
|
1003
|
+
caption: t0,
|
|
1004
|
+
cells: CELLS$1,
|
|
1005
|
+
columns: t1,
|
|
1006
|
+
corner: t2,
|
|
1007
|
+
rollup: t3,
|
|
1008
|
+
rows: t4,
|
|
1009
|
+
rules: "all",
|
|
1010
|
+
states: t20,
|
|
1011
|
+
unmeasured: t23,
|
|
1012
|
+
variant: "surface"
|
|
1013
|
+
});
|
|
1014
|
+
$[44] = t0;
|
|
1015
|
+
$[45] = t2;
|
|
1016
|
+
$[46] = t20;
|
|
1017
|
+
$[47] = t23;
|
|
1018
|
+
$[48] = t3;
|
|
1019
|
+
$[49] = t24;
|
|
1020
|
+
} else t24 = $[49];
|
|
1021
|
+
return t24;
|
|
1022
|
+
}
|
|
1023
|
+
function _temp2$1(id) {
|
|
1024
|
+
return {
|
|
1025
|
+
id,
|
|
1026
|
+
label: id
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function _temp$1(site) {
|
|
1030
|
+
return {
|
|
1031
|
+
id: site,
|
|
1032
|
+
label: site
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport {\n CheckIcon,\n CircleDashedIcon,\n LoaderIcon,\n MinusIcon,\n TriangleAlertIcon,\n XIcon,\n} from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { MatrixCell, StatusMatrix } from \"@stealthscale/component-collections\";\n\nconst SERVICES = [\"cdn\", \"dns\", \"mail\", \"object-store\"] as const;\n\nconst SITES = [\"Dublin\", \"Reston\", \"Osaka\"] as const;\n\nconst CELLS: readonly MatrixCell[] = [\n { column: \"Dublin\", row: \"cdn\", state: \"fine\" },\n { column: \"Reston\", row: \"cdn\", state: \"fine\" },\n { column: \"Osaka\", row: \"cdn\", state: \"slow\" },\n { column: \"Dublin\", row: \"dns\", state: \"fine\" },\n { column: \"Reston\", row: \"dns\", state: \"fine\" },\n { column: \"Osaka\", row: \"dns\", state: \"fine\" },\n { column: \"Dublin\", row: \"mail\", state: \"skipped\" },\n { column: \"Reston\", row: \"mail\", state: \"rolling\" },\n { column: \"Osaka\", row: \"mail\", state: \"skipped\" },\n { column: \"Dublin\", row: \"object-store\", state: \"down\" },\n { column: \"Reston\", row: \"object-store\", state: \"fine\" },\n { column: \"Osaka\", row: \"object-store\", state: \"fine\" },\n];\n\nexport function Plumbing(): ReactElement {\n const { t } = useWords(\"status-matrix\");\n\n return (\n <StatusMatrix\n caption={t(\"shared\")}\n cells={CELLS}\n columns={SITES.map((site) => ({ id: site, label: site }))}\n corner={t(\"corner\")}\n rollup={t(\"worst\")}\n rows={SERVICES.map((id) => ({ id, label: id }))}\n rules=\"all\"\n states={{\n down: { label: t(\"down\"), mark: <XIcon />, tone: \"error\" },\n fine: { label: t(\"fine\"), mark: <CheckIcon />, tone: \"success\" },\n rolling: { label: t(\"rolling\"), mark: <LoaderIcon />, tone: \"info\" },\n skipped: { label: t(\"skipped\"), mark: <MinusIcon />, tone: \"neutral\" },\n slow: { label: t(\"slow\"), mark: <TriangleAlertIcon />, tone: \"warning\" },\n }}\n unmeasured={{ label: t(\"unmeasured\"), mark: <CircleDashedIcon />, tone: \"neutral\" }}\n variant=\"surface\"\n />\n );\n}\n";
|
|
1036
|
+
//#endregion
|
|
1037
|
+
//#region src/status-matrix/examples/queues.example.tsx
|
|
1038
|
+
var queues_example_exports = /* @__PURE__ */ __exportAll({
|
|
1039
|
+
Queues: () => Queues,
|
|
1040
|
+
source: () => source
|
|
1041
|
+
});
|
|
1042
|
+
const QUEUES = ["notifications", "webhooks"];
|
|
1043
|
+
const SITES = [
|
|
1044
|
+
"Dublin",
|
|
1045
|
+
"Reston",
|
|
1046
|
+
"Osaka"
|
|
1047
|
+
];
|
|
1048
|
+
const CELLS = [
|
|
1049
|
+
{
|
|
1050
|
+
column: "Dublin",
|
|
1051
|
+
row: "notifications",
|
|
1052
|
+
state: "fine"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
column: "Reston",
|
|
1056
|
+
row: "notifications",
|
|
1057
|
+
state: "slow"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
column: "Osaka",
|
|
1061
|
+
row: "notifications",
|
|
1062
|
+
state: "fine"
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
column: "Dublin",
|
|
1066
|
+
row: "webhooks",
|
|
1067
|
+
state: "down"
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
column: "Reston",
|
|
1071
|
+
row: "webhooks",
|
|
1072
|
+
state: "fine"
|
|
1073
|
+
}
|
|
1074
|
+
];
|
|
1075
|
+
function Queues() {
|
|
1076
|
+
const $ = c(51);
|
|
1077
|
+
const { t } = useWords("status-matrix");
|
|
1078
|
+
const [picked, setPicked] = useState();
|
|
1079
|
+
let t0;
|
|
1080
|
+
if ($[0] !== t) {
|
|
1081
|
+
t0 = t("down");
|
|
1082
|
+
$[0] = t;
|
|
1083
|
+
$[1] = t0;
|
|
1084
|
+
} else t0 = $[1];
|
|
1085
|
+
let t1;
|
|
1086
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1087
|
+
t1 = /* @__PURE__ */ jsx(XIcon, {});
|
|
1088
|
+
$[2] = t1;
|
|
1089
|
+
} else t1 = $[2];
|
|
1090
|
+
let t2;
|
|
1091
|
+
if ($[3] !== t0) {
|
|
1092
|
+
t2 = {
|
|
1093
|
+
label: t0,
|
|
1094
|
+
mark: t1,
|
|
1095
|
+
tone: "error"
|
|
1096
|
+
};
|
|
1097
|
+
$[3] = t0;
|
|
1098
|
+
$[4] = t2;
|
|
1099
|
+
} else t2 = $[4];
|
|
1100
|
+
let t3;
|
|
1101
|
+
if ($[5] !== t) {
|
|
1102
|
+
t3 = t("fine");
|
|
1103
|
+
$[5] = t;
|
|
1104
|
+
$[6] = t3;
|
|
1105
|
+
} else t3 = $[6];
|
|
1106
|
+
let t4;
|
|
1107
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1108
|
+
t4 = /* @__PURE__ */ jsx(CheckIcon, {});
|
|
1109
|
+
$[7] = t4;
|
|
1110
|
+
} else t4 = $[7];
|
|
1111
|
+
let t5;
|
|
1112
|
+
if ($[8] !== t3) {
|
|
1113
|
+
t5 = {
|
|
1114
|
+
label: t3,
|
|
1115
|
+
mark: t4,
|
|
1116
|
+
tone: "success"
|
|
1117
|
+
};
|
|
1118
|
+
$[8] = t3;
|
|
1119
|
+
$[9] = t5;
|
|
1120
|
+
} else t5 = $[9];
|
|
1121
|
+
let t6;
|
|
1122
|
+
if ($[10] !== t) {
|
|
1123
|
+
t6 = t("slow");
|
|
1124
|
+
$[10] = t;
|
|
1125
|
+
$[11] = t6;
|
|
1126
|
+
} else t6 = $[11];
|
|
1127
|
+
let t7;
|
|
1128
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1129
|
+
t7 = /* @__PURE__ */ jsx(TriangleAlertIcon, {});
|
|
1130
|
+
$[12] = t7;
|
|
1131
|
+
} else t7 = $[12];
|
|
1132
|
+
let t8;
|
|
1133
|
+
if ($[13] !== t6) {
|
|
1134
|
+
t8 = {
|
|
1135
|
+
label: t6,
|
|
1136
|
+
mark: t7,
|
|
1137
|
+
tone: "warning"
|
|
1138
|
+
};
|
|
1139
|
+
$[13] = t6;
|
|
1140
|
+
$[14] = t8;
|
|
1141
|
+
} else t8 = $[14];
|
|
1142
|
+
let t9;
|
|
1143
|
+
if ($[15] !== t2 || $[16] !== t5 || $[17] !== t8) {
|
|
1144
|
+
t9 = {
|
|
1145
|
+
down: t2,
|
|
1146
|
+
fine: t5,
|
|
1147
|
+
slow: t8
|
|
1148
|
+
};
|
|
1149
|
+
$[15] = t2;
|
|
1150
|
+
$[16] = t5;
|
|
1151
|
+
$[17] = t8;
|
|
1152
|
+
$[18] = t9;
|
|
1153
|
+
} else t9 = $[18];
|
|
1154
|
+
const states = t9;
|
|
1155
|
+
let t10;
|
|
1156
|
+
if ($[19] !== t) {
|
|
1157
|
+
t10 = t("unmeasured");
|
|
1158
|
+
$[19] = t;
|
|
1159
|
+
$[20] = t10;
|
|
1160
|
+
} else t10 = $[20];
|
|
1161
|
+
let t11;
|
|
1162
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1163
|
+
t11 = /* @__PURE__ */ jsx(CircleDashedIcon, {});
|
|
1164
|
+
$[21] = t11;
|
|
1165
|
+
} else t11 = $[21];
|
|
1166
|
+
let t12;
|
|
1167
|
+
if ($[22] !== t10) {
|
|
1168
|
+
t12 = {
|
|
1169
|
+
label: t10,
|
|
1170
|
+
mark: t11,
|
|
1171
|
+
tone: "neutral"
|
|
1172
|
+
};
|
|
1173
|
+
$[22] = t10;
|
|
1174
|
+
$[23] = t12;
|
|
1175
|
+
} else t12 = $[23];
|
|
1176
|
+
const unmeasured = t12;
|
|
1177
|
+
let t13;
|
|
1178
|
+
if ($[24] !== t) {
|
|
1179
|
+
t13 = t("queues");
|
|
1180
|
+
$[24] = t;
|
|
1181
|
+
$[25] = t13;
|
|
1182
|
+
} else t13 = $[25];
|
|
1183
|
+
let t14;
|
|
1184
|
+
if ($[26] !== t) {
|
|
1185
|
+
t14 = (state, row, column) => t("crossing", {
|
|
1186
|
+
column: column.id,
|
|
1187
|
+
row: row.id,
|
|
1188
|
+
state: state.label
|
|
1189
|
+
});
|
|
1190
|
+
$[26] = t;
|
|
1191
|
+
$[27] = t14;
|
|
1192
|
+
} else t14 = $[27];
|
|
1193
|
+
let t15;
|
|
1194
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1195
|
+
t15 = SITES.map(_temp);
|
|
1196
|
+
$[28] = t15;
|
|
1197
|
+
} else t15 = $[28];
|
|
1198
|
+
let t16;
|
|
1199
|
+
if ($[29] !== t) {
|
|
1200
|
+
t16 = t("queue");
|
|
1201
|
+
$[29] = t;
|
|
1202
|
+
$[30] = t16;
|
|
1203
|
+
} else t16 = $[30];
|
|
1204
|
+
let t17;
|
|
1205
|
+
if ($[31] !== states || $[32] !== t || $[33] !== unmeasured) {
|
|
1206
|
+
t17 = (row_0, column_0, cell) => {
|
|
1207
|
+
const state_0 = (cell === void 0 ? void 0 : states[cell.state]) ?? unmeasured;
|
|
1208
|
+
const said = t("picked", {
|
|
1209
|
+
column: column_0,
|
|
1210
|
+
row: row_0,
|
|
1211
|
+
state: state_0.label
|
|
1212
|
+
});
|
|
1213
|
+
setPicked((was) => was === said ? void 0 : said);
|
|
1214
|
+
};
|
|
1215
|
+
$[31] = states;
|
|
1216
|
+
$[32] = t;
|
|
1217
|
+
$[33] = unmeasured;
|
|
1218
|
+
$[34] = t17;
|
|
1219
|
+
} else t17 = $[34];
|
|
1220
|
+
let t18;
|
|
1221
|
+
if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1222
|
+
t18 = QUEUES.map(_temp2);
|
|
1223
|
+
$[35] = t18;
|
|
1224
|
+
} else t18 = $[35];
|
|
1225
|
+
let t19;
|
|
1226
|
+
if ($[36] !== states || $[37] !== t13 || $[38] !== t14 || $[39] !== t16 || $[40] !== t17 || $[41] !== unmeasured) {
|
|
1227
|
+
t19 = /* @__PURE__ */ jsx(StatusMatrix, {
|
|
1228
|
+
caption: t13,
|
|
1229
|
+
cellLabel: t14,
|
|
1230
|
+
cells: CELLS,
|
|
1231
|
+
columns: t15,
|
|
1232
|
+
corner: t16,
|
|
1233
|
+
onSelectCell: t17,
|
|
1234
|
+
rows: t18,
|
|
1235
|
+
rules: "all",
|
|
1236
|
+
states,
|
|
1237
|
+
unmeasured,
|
|
1238
|
+
variant: "surface"
|
|
1239
|
+
});
|
|
1240
|
+
$[36] = states;
|
|
1241
|
+
$[37] = t13;
|
|
1242
|
+
$[38] = t14;
|
|
1243
|
+
$[39] = t16;
|
|
1244
|
+
$[40] = t17;
|
|
1245
|
+
$[41] = unmeasured;
|
|
1246
|
+
$[42] = t19;
|
|
1247
|
+
} else t19 = $[42];
|
|
1248
|
+
let t20;
|
|
1249
|
+
if ($[43] !== picked || $[44] !== t) {
|
|
1250
|
+
t20 = picked ?? t("nothingYet");
|
|
1251
|
+
$[43] = picked;
|
|
1252
|
+
$[44] = t;
|
|
1253
|
+
$[45] = t20;
|
|
1254
|
+
} else t20 = $[45];
|
|
1255
|
+
let t21;
|
|
1256
|
+
if ($[46] !== t20) {
|
|
1257
|
+
t21 = /* @__PURE__ */ jsx(Text, {
|
|
1258
|
+
"aria-live": "polite",
|
|
1259
|
+
children: t20
|
|
1260
|
+
});
|
|
1261
|
+
$[46] = t20;
|
|
1262
|
+
$[47] = t21;
|
|
1263
|
+
} else t21 = $[47];
|
|
1264
|
+
let t22;
|
|
1265
|
+
if ($[48] !== t19 || $[49] !== t21) {
|
|
1266
|
+
t22 = /* @__PURE__ */ jsxs(Stack, {
|
|
1267
|
+
gap: "md",
|
|
1268
|
+
children: [t19, t21]
|
|
1269
|
+
});
|
|
1270
|
+
$[48] = t19;
|
|
1271
|
+
$[49] = t21;
|
|
1272
|
+
$[50] = t22;
|
|
1273
|
+
} else t22 = $[50];
|
|
1274
|
+
return t22;
|
|
1275
|
+
}
|
|
1276
|
+
function _temp2(id) {
|
|
1277
|
+
return {
|
|
1278
|
+
id,
|
|
1279
|
+
label: id
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
function _temp(site) {
|
|
1283
|
+
return {
|
|
1284
|
+
id: site,
|
|
1285
|
+
label: site
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
const source = "import { type ReactElement, useState } from \"react\";\n\nimport { CheckIcon, CircleDashedIcon, TriangleAlertIcon, XIcon } from \"lucide-react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { MatrixCell, MatrixState, StatusMatrix } from \"@stealthscale/component-collections\";\n\nconst QUEUES = [\"notifications\", \"webhooks\"] as const;\n\nconst SITES = [\"Dublin\", \"Reston\", \"Osaka\"] as const;\n\nconst CELLS: readonly MatrixCell[] = [\n { column: \"Dublin\", row: \"notifications\", state: \"fine\" },\n { column: \"Reston\", row: \"notifications\", state: \"slow\" },\n { column: \"Osaka\", row: \"notifications\", state: \"fine\" },\n { column: \"Dublin\", row: \"webhooks\", state: \"down\" },\n { column: \"Reston\", row: \"webhooks\", state: \"fine\" },\n];\n\nexport function Queues(): ReactElement {\n const { t } = useWords(\"status-matrix\");\n const [picked, setPicked] = useState<string | undefined>();\n const states: Readonly<Record<string, MatrixState>> = {\n down: { label: t(\"down\"), mark: <XIcon />, tone: \"error\" },\n fine: { label: t(\"fine\"), mark: <CheckIcon />, tone: \"success\" },\n slow: { label: t(\"slow\"), mark: <TriangleAlertIcon />, tone: \"warning\" },\n };\n const unmeasured: MatrixState = {\n label: t(\"unmeasured\"),\n mark: <CircleDashedIcon />,\n tone: \"neutral\",\n };\n\n return (\n <Stack gap=\"md\">\n <StatusMatrix\n caption={t(\"queues\")}\n cellLabel={(state, row, column) =>\n t(\"crossing\", { column: column.id, row: row.id, state: state.label })\n }\n cells={CELLS}\n columns={SITES.map((site) => ({ id: site, label: site }))}\n corner={t(\"queue\")}\n onSelectCell={(row, column, cell) => {\n const state = (cell === undefined ? undefined : states[cell.state]) ?? unmeasured;\n const said = t(\"picked\", { column, row, state: state.label });\n\n setPicked((was) => (was === said ? undefined : said));\n }}\n rows={QUEUES.map((id) => ({ id, label: id }))}\n rules=\"all\"\n states={states}\n unmeasured={unmeasured}\n variant=\"surface\"\n />\n <Text aria-live=\"polite\">{picked ?? t(\"nothingYet\")}</Text>\n </Stack>\n );\n}\n";
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/status-matrix/status-matrix.specimen.tsx
|
|
1291
|
+
/**
|
|
1292
|
+
* Catalogue page for the status matrix.
|
|
1293
|
+
*
|
|
1294
|
+
* @remarks
|
|
1295
|
+
* `scenesOf` generates the size scene from the health example. The gap, picking, flat and empty
|
|
1296
|
+
* scenes are hand-written, because each needs its own rows and cells. The picking scene moves a
|
|
1297
|
+
* pointer onto one crossing after it mounts, so the crosshair shows in a still image. Every scene
|
|
1298
|
+
* renders a component from `examples/` and shows that file as its source. The words are keys
|
|
1299
|
+
* under `status-matrix` in `locales/en/specimen/status-matrix.json`.
|
|
1300
|
+
*/
|
|
1301
|
+
/**
|
|
1302
|
+
* Renders a matrix and dispatches a pointer move onto one crossing after it mounts.
|
|
1303
|
+
*
|
|
1304
|
+
* @remarks
|
|
1305
|
+
* The event bubbles to the matrix's own handler, so the crosshair lights the crossing's row and
|
|
1306
|
+
* column the way a pointer would. The staging never appears in an example.
|
|
1307
|
+
*/
|
|
1308
|
+
function Lit(t0) {
|
|
1309
|
+
const $ = c(7);
|
|
1310
|
+
const { children, column, row } = t0;
|
|
1311
|
+
const [box, setBox] = useState(null);
|
|
1312
|
+
let t1;
|
|
1313
|
+
let t2;
|
|
1314
|
+
if ($[0] !== box || $[1] !== column || $[2] !== row) {
|
|
1315
|
+
t1 = () => {
|
|
1316
|
+
box?.querySelector(`td[data-row="${row}"][data-column="${column}"]`)?.dispatchEvent(new PointerEvent("pointermove", { bubbles: true }));
|
|
1317
|
+
};
|
|
1318
|
+
t2 = [
|
|
1319
|
+
box,
|
|
1320
|
+
column,
|
|
1321
|
+
row
|
|
1322
|
+
];
|
|
1323
|
+
$[0] = box;
|
|
1324
|
+
$[1] = column;
|
|
1325
|
+
$[2] = row;
|
|
1326
|
+
$[3] = t1;
|
|
1327
|
+
$[4] = t2;
|
|
1328
|
+
} else {
|
|
1329
|
+
t1 = $[3];
|
|
1330
|
+
t2 = $[4];
|
|
1331
|
+
}
|
|
1332
|
+
useEffect(t1, t2);
|
|
1333
|
+
let t3;
|
|
1334
|
+
if ($[5] !== children) {
|
|
1335
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
1336
|
+
ref: setBox,
|
|
1337
|
+
children
|
|
1338
|
+
});
|
|
1339
|
+
$[5] = children;
|
|
1340
|
+
$[6] = t3;
|
|
1341
|
+
} else t3 = $[6];
|
|
1342
|
+
return t3;
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Hand-written scene for a region nobody ran.
|
|
1346
|
+
*/
|
|
1347
|
+
const gapped = {
|
|
1348
|
+
about: "status-matrix.gap.about",
|
|
1349
|
+
draw: Gapped,
|
|
1350
|
+
example: gapped_example_exports,
|
|
1351
|
+
title: "status-matrix.gap.title"
|
|
1352
|
+
};
|
|
1353
|
+
/**
|
|
1354
|
+
* Hand-written scene for a matrix a reader picks crossings from, with the pointer on one.
|
|
1355
|
+
*/
|
|
1356
|
+
const picking = {
|
|
1357
|
+
about: "status-matrix.picking.about",
|
|
1358
|
+
draw: () => /* @__PURE__ */ jsx(Lit, {
|
|
1359
|
+
column: "Reston",
|
|
1360
|
+
row: "notifications",
|
|
1361
|
+
children: /* @__PURE__ */ jsx(Queues, {})
|
|
1362
|
+
}),
|
|
1363
|
+
example: queues_example_exports,
|
|
1364
|
+
title: "status-matrix.picking.title"
|
|
1365
|
+
};
|
|
1366
|
+
/**
|
|
1367
|
+
* Hand-written scene for rows without sections.
|
|
1368
|
+
*/
|
|
1369
|
+
const flat = {
|
|
1370
|
+
about: "status-matrix.flat.about",
|
|
1371
|
+
draw: Plumbing,
|
|
1372
|
+
example: plumbing_example_exports,
|
|
1373
|
+
title: "status-matrix.flat.title"
|
|
1374
|
+
};
|
|
1375
|
+
/**
|
|
1376
|
+
* Hand-written scene for a matrix with no rows.
|
|
1377
|
+
*/
|
|
1378
|
+
const empty = {
|
|
1379
|
+
about: "status-matrix.empty.about",
|
|
1380
|
+
draw: Empty,
|
|
1381
|
+
example: empty_example_exports,
|
|
1382
|
+
title: "status-matrix.empty.title"
|
|
1383
|
+
};
|
|
1384
|
+
var status_matrix_specimen_default = specimen({
|
|
1385
|
+
about: "status-matrix.about",
|
|
1386
|
+
id: "components/collections/status-matrix",
|
|
1387
|
+
imports: "import { StatusMatrix } from \"@stealthscale/component-collections\";",
|
|
1388
|
+
scenes: [
|
|
1389
|
+
...scenesOf(recipe, {
|
|
1390
|
+
axes: { size: { direction: "column" } },
|
|
1391
|
+
draw: (props) => /* @__PURE__ */ jsx(Health, { ...props }),
|
|
1392
|
+
example: health_example_exports,
|
|
1393
|
+
namespace: "status-matrix"
|
|
1394
|
+
}),
|
|
1395
|
+
gapped,
|
|
1396
|
+
picking,
|
|
1397
|
+
flat,
|
|
1398
|
+
empty
|
|
1399
|
+
],
|
|
1400
|
+
title: "status-matrix.title"
|
|
1401
|
+
});
|
|
1402
|
+
//#endregion
|
|
1403
|
+
export { status_matrix_specimen_default as default, empty, flat, gapped, picking };
|