@surfaces-ui/components 0.5.0 → 0.7.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.
- package/NOTICE +50 -0
- package/dist/appComponents.d.ts +9 -0
- package/dist/appComponents.js +105 -1
- package/dist/appComponents.js.map +1 -1
- package/dist/brand/MovingMark.d.ts +15 -0
- package/dist/brand/MovingMark.js +52 -0
- package/dist/brand/MovingMark.js.map +1 -0
- package/dist/brand/SurfacesMark.d.ts +9 -0
- package/dist/brand/SurfacesMark.js +12 -0
- package/dist/brand/SurfacesMark.js.map +1 -0
- package/dist/brand/index.d.ts +3 -0
- package/dist/brand/index.js +3 -0
- package/dist/brand/index.js.map +1 -0
- package/dist/brand/markMotion.d.ts +29 -0
- package/dist/brand/markMotion.js +89 -0
- package/dist/brand/markMotion.js.map +1 -0
- package/dist/chart/Chart.d.ts +8 -4
- package/dist/chart/Chart.js +28 -9
- package/dist/chart/Chart.js.map +1 -1
- package/dist/chart/advice.d.ts +4 -2
- package/dist/chart/advice.js +14 -1
- package/dist/chart/advice.js.map +1 -1
- package/dist/chart/labels.d.ts +23 -0
- package/dist/chart/labels.js +82 -0
- package/dist/chart/labels.js.map +1 -0
- package/dist/chart/option.d.ts +17 -2
- package/dist/chart/option.js +146 -3
- package/dist/chart/option.js.map +1 -1
- package/dist/controls/ItemControls.d.ts +6 -2
- package/dist/controls/ItemControls.js +8 -3
- package/dist/controls/ItemControls.js.map +1 -1
- package/dist/controls/OutlineIcon.d.ts +9 -0
- package/dist/controls/OutlineIcon.js +12 -0
- package/dist/controls/OutlineIcon.js.map +1 -0
- package/dist/feedback/ErrorPage.d.ts +27 -0
- package/dist/feedback/ErrorPage.js +12 -0
- package/dist/feedback/ErrorPage.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/loading/ChartArt.d.ts +8 -0
- package/dist/loading/ChartArt.js +29 -0
- package/dist/loading/ChartArt.js.map +1 -0
- package/dist/loading/DraftCard.d.ts +10 -0
- package/dist/loading/DraftCard.js +38 -0
- package/dist/loading/DraftCard.js.map +1 -0
- package/dist/loading/Loading.d.ts +49 -0
- package/dist/loading/Loading.js +38 -0
- package/dist/loading/Loading.js.map +1 -0
- package/dist/locale/locale.d.ts +1 -0
- package/dist/locale/locale.js +1 -0
- package/dist/locale/locale.js.map +1 -1
- package/dist/result/QueryResult.js +2 -1
- package/dist/result/QueryResult.js.map +1 -1
- package/dist/schema/SchemaExplorer.d.ts +4 -0
- package/dist/schema/SchemaExplorer.js +46 -28
- package/dist/schema/SchemaExplorer.js.map +1 -1
- package/dist/styles.css +812 -67
- package/dist/styles.layer.css +812 -67
- package/dist/text/Markdown.js +21 -8
- package/dist/text/Markdown.js.map +1 -1
- package/dist/workspace/icons.js +2 -1
- package/dist/workspace/icons.js.map +1 -1
- package/package.json +11 -6
package/dist/chart/option.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { DataType } from "apache-arrow";
|
|
2
2
|
import { numberFormat } from "../locale/locale.js";
|
|
3
|
+
/**
|
|
4
|
+
* The basic chart types, which answer most questions and come first: bars for amounts across categories, a line or
|
|
5
|
+
* an area for change over time, scatter for two measures, and a pie for a few parts of a whole.
|
|
6
|
+
*/
|
|
7
|
+
export const BASIC_CHART_TYPES = ["bar", "line", "area", "scatter", "pie"];
|
|
8
|
+
/**
|
|
9
|
+
* The other chart types, for a question a basic one cannot show: a heatmap for a measure across two dimensions, a
|
|
10
|
+
* funnel for how much is left at each stage, a treemap for many parts of a whole, a sankey for flows from one set of
|
|
11
|
+
* values to another. Each draws one measure, from the same query a basic chart sends.
|
|
12
|
+
*/
|
|
13
|
+
export const OTHER_CHART_TYPES = ["heatmap", "funnel", "treemap", "sankey"];
|
|
14
|
+
/** A chart drawn without x and y axes: its rows are parts, stages, cells or flows of one measure. */
|
|
15
|
+
export const isWholeChart = (type) => type !== "bar" && type !== "line" && type !== "area" && type !== "scatter";
|
|
3
16
|
/**
|
|
4
17
|
* An axis title sits a fixed gap beyond the tick labels, wherever they end. A gap measured from the axis line
|
|
5
18
|
* suits one width of label only: beside two-digit ticks the title ran off the chart's edge.
|
|
@@ -97,7 +110,7 @@ function endsApart(series, dataset, rows) {
|
|
|
97
110
|
* a count of the rows with no date would otherwise flatten the line of every week that has one.
|
|
98
111
|
*/
|
|
99
112
|
export function rowsWithoutX(input) {
|
|
100
|
-
if (input.type
|
|
113
|
+
if (isWholeChart(input.type))
|
|
101
114
|
return [];
|
|
102
115
|
const kinds = input.series.map((s) => s.type ?? input.type);
|
|
103
116
|
const xType = axisType(input.fields.find((f) => f.name === input.x), kinds.every((k) => k === "scatter"));
|
|
@@ -114,10 +127,12 @@ export function buildChartOption(given) {
|
|
|
114
127
|
const { type, x, splitBy } = input;
|
|
115
128
|
const xField = input.fields.find((f) => f.name === x);
|
|
116
129
|
// A date or number axis is drawn in its own order, whatever order the rows arrived in.
|
|
117
|
-
const byX = type
|
|
130
|
+
const byX = !isWholeChart(type) && isOrdered(xField) && input.sort === "value";
|
|
118
131
|
// A missing category is drawn under its own name rather than dropped from the axis.
|
|
119
|
-
const named = type
|
|
132
|
+
const named = !isWholeChart(type) && input.sort === "value" && !isOrdered(xField) ? input.rows.map((row) => (row[x] == null ? { ...row, [x]: "null" } : row)) : input.rows;
|
|
120
133
|
const rows = byX ? [...input.rows].sort((a, b) => (typeof a[x] === "number" && typeof b[x] === "number" ? a[x] - b[x] : String(a[x]).localeCompare(String(b[x])))) : named;
|
|
134
|
+
if (type === "heatmap" || type === "funnel" || type === "treemap" || type === "sankey")
|
|
135
|
+
return otherChartOption({ ...input, type, rows });
|
|
121
136
|
if (type === "pie") {
|
|
122
137
|
const measure = input.series[0];
|
|
123
138
|
return {
|
|
@@ -239,6 +254,134 @@ export function buildChartOption(given) {
|
|
|
239
254
|
series,
|
|
240
255
|
};
|
|
241
256
|
}
|
|
257
|
+
/** A value on a category axis, as a person reads it: a date for a time (the engine's buckets are UTC), else its text. */
|
|
258
|
+
function categoryName(value, field) {
|
|
259
|
+
if (value == null)
|
|
260
|
+
return "null";
|
|
261
|
+
if (typeof value === "number" && field && (DataType.isTimestamp(field.type) || DataType.isDate(field.type)))
|
|
262
|
+
return new Date(value).toISOString().slice(0, 10);
|
|
263
|
+
return String(value);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The distinct values of a column: in their own order when they have one (dates, numbers), largest first by the
|
|
267
|
+
* measure when `measure` is given, and otherwise in the order the rows give them (which the engine sorted).
|
|
268
|
+
*/
|
|
269
|
+
function valuesOf(rows, column, field, measure) {
|
|
270
|
+
const seen = [...new Map(rows.map((row) => [row[column] ?? null, row[column] ?? null])).values()];
|
|
271
|
+
if (isOrdered(field))
|
|
272
|
+
return seen.sort((a, b) => (typeof a === "number" && typeof b === "number" ? a - b : String(a).localeCompare(String(b))));
|
|
273
|
+
if (!measure)
|
|
274
|
+
return seen;
|
|
275
|
+
const order = categoriesBySize(rows, column, measure);
|
|
276
|
+
return seen.sort((a, b) => order.indexOf(String(a ?? "null")) - order.indexOf(String(b ?? "null")));
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* The option for a chart drawn without axes, from one measure (the first series): a heatmap (x across, `splitBy`
|
|
280
|
+
* down, the measure as colour on the theme's sequential ramp), a funnel (x as stages), a treemap (x as parts, grouped
|
|
281
|
+
* by `splitBy` when given) or a sankey (flows from x to `splitBy`, which it needs).
|
|
282
|
+
*/
|
|
283
|
+
function otherChartOption(input) {
|
|
284
|
+
const { type, x, splitBy, rows } = input;
|
|
285
|
+
const measure = input.series[0];
|
|
286
|
+
const format = tooltipFormatter(input.yFormat);
|
|
287
|
+
const xField = input.fields.find((f) => f.name === x);
|
|
288
|
+
const splitField = splitBy ? input.fields.find((f) => f.name === splitBy) : undefined;
|
|
289
|
+
const value = (row) => (measure ? row[measure.column] : null);
|
|
290
|
+
const name = measure?.label ?? "";
|
|
291
|
+
if (!measure)
|
|
292
|
+
return { series: [] };
|
|
293
|
+
if (type === "heatmap") {
|
|
294
|
+
// Weekdays, hours and the like keep the order the rows give them; by size only when asked for.
|
|
295
|
+
const bySize = input.sort === "value" ? measure.column : undefined;
|
|
296
|
+
const across = valuesOf(rows, x, xField, bySize);
|
|
297
|
+
const down = splitBy ? valuesOf(rows, splitBy, splitField, bySize) : [null];
|
|
298
|
+
const at = (list, v) => list.findIndex((item) => item === (v ?? null));
|
|
299
|
+
const data = rows.map((row) => [at(across, row[x] ?? null), splitBy ? at(down, row[splitBy] ?? null) : 0, value(row)]);
|
|
300
|
+
const numbers = rows.map((row) => Number(value(row))).filter((n) => Number.isFinite(n));
|
|
301
|
+
const cells = across.length * down.length;
|
|
302
|
+
return {
|
|
303
|
+
useUTC: true,
|
|
304
|
+
tooltip: { trigger: "item", valueFormatter: format },
|
|
305
|
+
grid: { left: 8, right: 16, top: 16, bottom: 56, outerBoundsMode: "same", outerBoundsContain: "all" },
|
|
306
|
+
xAxis: { type: "category", data: across.map((v) => categoryName(v, xField)), name: input.xTitle, nameLocation: "middle", ...TITLE_CLEAR, splitArea: { show: false }, axisLabel: { hideOverlap: true } },
|
|
307
|
+
yAxis: { type: "category", data: down.map((v) => (splitBy ? categoryName(v, splitField) : name)), inverse: true, name: input.yTitle, nameLocation: "middle", ...TITLE_CLEAR, axisLabel: { hideOverlap: true } },
|
|
308
|
+
visualMap: {
|
|
309
|
+
type: "continuous",
|
|
310
|
+
min: numbers.length ? Math.min(0, ...numbers) : 0,
|
|
311
|
+
max: numbers.length ? Math.max(...numbers) : 1,
|
|
312
|
+
orient: "horizontal",
|
|
313
|
+
left: "center",
|
|
314
|
+
bottom: 0,
|
|
315
|
+
itemHeight: 120,
|
|
316
|
+
calculable: false,
|
|
317
|
+
formatter: (v) => axisFormatter(input.yFormat)(v),
|
|
318
|
+
...(input.ramp?.length ? { inRange: { color: input.ramp } } : {}),
|
|
319
|
+
},
|
|
320
|
+
series: [{ type: "heatmap", name, data, label: { show: cells <= 48, formatter: (p) => axisFormatter(input.yFormat)(Number(p.value[2])) }, emphasis: { itemStyle: { borderWidth: 1 } } }],
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
if (type === "funnel") {
|
|
324
|
+
return {
|
|
325
|
+
tooltip: { trigger: "item", valueFormatter: format },
|
|
326
|
+
legend: { show: false },
|
|
327
|
+
series: [
|
|
328
|
+
{
|
|
329
|
+
type: "funnel",
|
|
330
|
+
name,
|
|
331
|
+
// One measure, so one colour: a colour per stage would only decorate.
|
|
332
|
+
colorBy: "series",
|
|
333
|
+
// Largest at the top, as stages narrow; "x" keeps the stages in the order the rows give them.
|
|
334
|
+
sort: input.sort === "x" ? "none" : "descending",
|
|
335
|
+
left: "10%",
|
|
336
|
+
width: "80%",
|
|
337
|
+
top: 8,
|
|
338
|
+
bottom: 8,
|
|
339
|
+
minSize: "2%",
|
|
340
|
+
gap: 2,
|
|
341
|
+
label: { show: true, position: "inside", formatter: "{b}" },
|
|
342
|
+
data: rows.map((row) => ({ name: categoryName(row[x] ?? null, xField), value: value(row) })),
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (type === "treemap") {
|
|
348
|
+
const leaf = (row) => ({ name: categoryName(row[x] ?? null, xField), value: value(row) });
|
|
349
|
+
const data = splitBy
|
|
350
|
+
? valuesOf(rows, splitBy, splitField, measure.column).map((group) => ({ name: categoryName(group, splitField), children: rows.filter((row) => (row[splitBy] ?? null) === group).map(leaf) }))
|
|
351
|
+
: rows.map(leaf);
|
|
352
|
+
return {
|
|
353
|
+
tooltip: { trigger: "item", valueFormatter: format },
|
|
354
|
+
series: [
|
|
355
|
+
{
|
|
356
|
+
type: "treemap",
|
|
357
|
+
name,
|
|
358
|
+
roam: false,
|
|
359
|
+
nodeClick: false,
|
|
360
|
+
breadcrumb: { show: false },
|
|
361
|
+
top: 0,
|
|
362
|
+
left: 0,
|
|
363
|
+
right: 0,
|
|
364
|
+
bottom: 0,
|
|
365
|
+
label: { show: true, formatter: "{b}" },
|
|
366
|
+
upperLabel: { show: !!splitBy, height: 20 },
|
|
367
|
+
data,
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
// A sankey: each row a flow from its x to its split value. Without a split there is nothing to flow to.
|
|
373
|
+
if (!splitBy)
|
|
374
|
+
return { series: [] };
|
|
375
|
+
const links = rows
|
|
376
|
+
.map((row) => ({ source: categoryName(row[x] ?? null, xField), target: categoryName(row[splitBy] ?? null, splitField), value: Number(value(row)) }))
|
|
377
|
+
// A flow from a value to itself, or of nothing, cannot be drawn.
|
|
378
|
+
.filter((link) => link.source !== link.target && Number.isFinite(link.value) && link.value > 0);
|
|
379
|
+
const nodes = [...new Set(links.flatMap((link) => [link.source, link.target]))].map((n) => ({ name: n }));
|
|
380
|
+
return {
|
|
381
|
+
tooltip: { trigger: "item", valueFormatter: format },
|
|
382
|
+
series: [{ type: "sankey", name, left: 8, right: 96, top: 8, bottom: 8, nodeGap: 10, emphasis: { focus: "adjacency" }, lineStyle: { color: "gradient", curveness: 0.5, opacity: 0.4 }, label: { show: true }, data: nodes, links }],
|
|
383
|
+
};
|
|
384
|
+
}
|
|
242
385
|
/** A round bin width that splits [min, max] into about `bins` bins. */
|
|
243
386
|
export function niceBinWidth(min, max, bins) {
|
|
244
387
|
const span = max - min;
|
package/dist/chart/option.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../src/chart/option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAyDnD;;;GAGG;AACH,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,eAAe,EAAE,IAAI,EAAW,CAAC;AAEnE,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,IAAe,EAAE,MAAwD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AAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1N,MAAM;KACP,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,IAAY;IACjE,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;IACvB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;IACtE,OAAO,IAAI,GAAG,KAAK,CAAC;AACtB,CAAC","sourcesContent":["import { DataType, type Field } from \"apache-arrow\";\nimport { numberFormat } from \"../locale/locale.js\";\n\nexport type ChartType = \"bar\" | \"line\" | \"area\" | \"scatter\" | \"pie\";\n/** How one series is drawn. A chart whose series differ is a compound chart. */\nexport type SeriesType = Exclude<ChartType, \"pie\">;\nexport type LegendPlacement = \"top\" | \"bottom\" | \"right\" | \"none\";\n\nexport interface ChartSpecSeries {\n /** Output column holding the values. */\n column: string;\n /** Name shown in the legend and tooltip. */\n label: string;\n /** Draw this series as something other than the chart's type, e.g. a line over bars. */\n type?: SeriesType;\n /** The y axis this series is measured on. Defaults to \"left\". */\n axis?: \"left\" | \"right\";\n /** Series with the same stack name are stacked on each other. */\n stack?: string;\n /** Draw this series in this colour instead of the next one in the theme's order. */\n color?: string;\n}\n\nexport interface ChartOptionInput {\n type: ChartType;\n /** Column for the x axis (or the slice names of a pie). */\n x: string;\n series: ChartSpecSeries[];\n /** Column whose distinct values split each measure into separate series. */\n splitBy?: string;\n fields: Field[];\n /** Rows as plain chart values, keyed by column. */\n rows: Record<string, string | number | null>[];\n /** Where the legend goes. Defaults to \"top\" when there is more than one series, otherwise \"none\". */\n legend?: LegendPlacement;\n /** Stack every series that has no stack name of its own. */\n stacked?: boolean;\n /** Colours for particular values of the split column, by value. */\n splitColors?: Record<string, string>;\n /** Axis titles. */\n xTitle?: string;\n yTitle?: string;\n yRightTitle?: string;\n /** How the left axis writes its numbers. Changes the labels only, never the values. */\n yFormat?: AxisFormat;\n /**\n * \"value\" puts categories in order of size, largest first, unless x is a\n * date or number, whose own order is kept. \"x\" keeps the rows as given.\n */\n sort?: \"value\" | \"x\";\n /**\n * Bars run across instead of up: the categories go down the left side,\n * largest at the top, and the values along the bottom. Applies only when\n * every series is a bar on one scale; otherwise it is ignored.\n */\n horizontal?: boolean;\n}\n\n/**\n * An axis title sits a fixed gap beyond the tick labels, wherever they end. A gap measured from the axis line\n * suits one width of label only: beside two-digit ticks the title ran off the chart's edge.\n */\nconst TITLE_CLEAR = { nameGap: 8, nameMoveOverlap: true } as const;\n\n/** True when a chart of this shape can be turned on its side: bars only, on one scale. */\nexport function canTurnSideways(type: ChartType, series: { type?: SeriesType; axis?: \"left\" | \"right\" }[]): boolean {\n return series.length > 0 && series.every((s) => (s.type ?? type) === \"bar\" && s.axis !== \"right\");\n}\n\n/** True when a column's values have an order of their own: dates, times and numbers. */\nexport function isOrdered(field: Field | undefined): boolean {\n if (!field) return false;\n return DataType.isTimestamp(field.type) || DataType.isDate(field.type) || DataType.isInt(field.type) || DataType.isFloat(field.type) || DataType.isDecimal(field.type);\n}\n\n/**\n * The order categories are drawn in when sorted by size: by the total of the\n * first measure across every series, largest first. Sorting by the total\n * keeps a stacked or grouped chart in one order for all its series.\n */\nexport function categoriesBySize(rows: Record<string, string | number | null>[], x: string, measure: string): string[] {\n const totals = new Map<string, number>();\n for (const row of rows) {\n const key = String(row[x] ?? \"null\");\n totals.set(key, (totals.get(key) ?? 0) + (Number(row[measure]) || 0));\n }\n return [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([key]) => key);\n}\n\ntype AxisType = \"category\" | \"time\" | \"value\";\n\nfunction axisType(field: Field | undefined, scatter: boolean): AxisType {\n if (!field) return \"category\";\n if (DataType.isTimestamp(field.type) || DataType.isDate(field.type)) return \"time\";\n const numeric = DataType.isInt(field.type) || DataType.isFloat(field.type) || DataType.isDecimal(field.type);\n return numeric && scatter ? \"value\" : \"category\";\n}\n\nconst compact = () => numberFormat({ notation: \"compact\", maximumFractionDigits: 1 });\nconst fraction = () => numberFormat({ maximumSignificantDigits: 2 });\n/** A number on an axis: 12K, 1.5M, and for a value under one enough digits to tell the ticks apart (0.02, not 0). */\nexport const axisNumber = (value: number) => (value !== 0 && Math.abs(value) < 1 ? fraction().format(value) : compact().format(value));\n\nexport type AxisFormat = \"number\" | \"compact\" | \"currency\" | \"percent\";\nconst percent = () => numberFormat({ style: \"percent\", maximumSignificantDigits: 2 });\nconst money = () => numberFormat({ style: \"currency\", currency: \"USD\", notation: \"compact\", maximumSignificantDigits: 3 });\n/** A number on an axis in a measure's own format: 6% rather than 0.06, $1.2M rather than 1.2M. */\nexport const axisFormatter = (format: AxisFormat | undefined): ((value: number) => string) =>\n format === \"percent\" ? (value) => percent().format(value) : format === \"currency\" ? (value) => money().format(value) : axisNumber;\n\nconst exactPercent = () => numberFormat({ style: \"percent\", maximumFractionDigits: 1 });\nconst exactMoney = () => numberFormat({ style: \"currency\", currency: \"USD\", maximumFractionDigits: 2 });\nconst exact = () => numberFormat({ maximumFractionDigits: 2 });\n/**\n * A value in a tooltip, where a person reads one number closely: in full rather than compact, rounded to what can be\n * told apart (6.1%, $1,234.50, 1,234.57, 0.0123), in the measure's own format. Changes the text only, never the value.\n */\nexport const tooltipFormatter =\n (format: AxisFormat | undefined) =>\n (value: unknown): string => {\n const n = typeof value === \"number\" ? value : Number(value);\n if (value == null || value === \"\" || !Number.isFinite(n)) return value == null ? \"–\" : String(value);\n if (format === \"percent\") return exactPercent().format(n);\n if (format === \"currency\") return exactMoney().format(n);\n return n !== 0 && Math.abs(n) < 1 ? fraction().format(n) : exact().format(n);\n };\n\nfunction legendOption(placement: LegendPlacement): Record<string, unknown> {\n if (placement === \"none\") return { show: false };\n if (placement === \"right\") return { type: \"scroll\", orient: \"vertical\", right: 0, top: \"middle\" };\n return { type: \"scroll\", [placement]: 0 };\n}\n\n/**\n * True when the last points of every series are far enough apart for a label\n * at each end to be read. Lines that finish close together keep the legend.\n */\nfunction endsApart(series: Record<string, unknown>[], dataset: unknown, rows: Record<string, string | number | null>[]): boolean {\n const sets = Array.isArray(dataset) ? (dataset as { source?: Record<string, string | number | null>[] }[]) : undefined;\n const ends: number[] = [];\n let low = Infinity;\n let high = -Infinity;\n for (const item of series) {\n const column = (item.encode as { y: string }).y;\n const source = sets ? (sets[item.datasetIndex as number]?.source ?? []) : rows;\n const values = source.map((row) => Number(row[column])).filter((v) => Number.isFinite(v));\n if (values.length === 0) return false;\n ends.push(values.at(-1)!);\n low = Math.min(low, ...values);\n high = Math.max(high, ...values);\n }\n const room = (high - Math.min(low, 0)) * 0.08;\n const sorted = [...ends].sort((a, b) => a - b);\n return sorted.every((value, i) => i === 0 || value - sorted[i - 1]! >= room);\n}\n\n/**\n * The rows a chart cannot place: those with no x, on a time or number axis. (A category axis draws them under\n * \"null\".) They are left out of the option whole, since a point that is not drawn must not size the y axis:\n * a count of the rows with no date would otherwise flatten the line of every week that has one.\n */\nexport function rowsWithoutX(input: Pick<ChartOptionInput, \"type\" | \"x\" | \"series\" | \"fields\" | \"rows\">): ChartOptionInput[\"rows\"] {\n if (input.type === \"pie\") return [];\n const kinds = input.series.map((s) => s.type ?? input.type);\n const xType = axisType(input.fields.find((f) => f.name === input.x), kinds.every((k) => k === \"scatter\"));\n return xType === \"category\" ? [] : input.rows.filter((row) => row[input.x] == null);\n}\n\n/**\n * Builds an ECharts option from query rows. Pure, so it can be tested and\n * reused on a server or by an agent. Colours and fonts come from the theme\n * passed to `echarts.init`, not from here.\n */\nexport function buildChartOption(given: ChartOptionInput): Record<string, unknown> {\n const unplaced = rowsWithoutX(given);\n const input = unplaced.length > 0 ? { ...given, rows: given.rows.filter((row) => row[given.x] != null) } : given;\n const { type, x, splitBy } = input;\n const xField = input.fields.find((f) => f.name === x);\n // A date or number axis is drawn in its own order, whatever order the rows arrived in.\n const byX = type !== \"pie\" && isOrdered(xField) && input.sort === \"value\";\n // A missing category is drawn under its own name rather than dropped from the axis.\n const named = type !== \"pie\" && input.sort === \"value\" && !isOrdered(xField) ? input.rows.map((row) => (row[x] == null ? { ...row, [x]: \"null\" } : row)) : input.rows;\n const rows = byX ? [...input.rows].sort((a, b) => (typeof a[x] === \"number\" && typeof b[x] === \"number\" ? a[x] - b[x] : String(a[x]).localeCompare(String(b[x])))) : named;\n\n if (type === \"pie\") {\n const measure = input.series[0];\n return {\n tooltip: { trigger: \"item\", valueFormatter: tooltipFormatter(input.yFormat) },\n legend: legendOption(input.legend ?? \"bottom\"),\n series: [\n {\n type: \"pie\",\n name: measure?.label ?? \"\",\n radius: [\"45%\", \"72%\"],\n center: [\"50%\", \"45%\"],\n label: { show: rows.length <= 8 },\n data: measure ? rows.map((row) => ({ name: String(row[x] ?? \"null\"), value: row[measure.column] })) : [],\n },\n ],\n };\n }\n\n const kinds = input.series.map((s) => s.type ?? type);\n const xType = axisType(xField, kinds.every((k) => k === \"scatter\"));\n const sideways = !!input.horizontal && canTurnSideways(type, input.series);\n // On its side, the category axis is the vertical one and the value axis the horizontal one.\n const at = (category: string, value: string) => (sideways ? { x: value, y: category } : { x: category, y: value });\n const large = rows.length > 2000 ? { large: true, sampling: \"lttb\", showSymbol: false } : {};\n const hasRight = input.series.some((s) => s.axis === \"right\");\n const shape = (measure: ChartSpecSeries): Record<string, unknown> => {\n const kind = measure.type ?? type;\n const stack = measure.stack ?? (input.stacked && kind !== \"scatter\" ? `stack-${measure.axis ?? \"left\"}-${kind}` : undefined);\n return {\n type: kind === \"area\" ? \"line\" : kind,\n ...(kind === \"area\" ? { areaStyle: { opacity: 0.18 }, showSymbol: false } : {}),\n ...(stack ? { stack } : {}),\n ...(hasRight ? { yAxisIndex: measure.axis === \"right\" ? 1 : 0 } : {}),\n tooltip: { valueFormatter: tooltipFormatter(measure.axis === \"right\" ? undefined : input.yFormat) },\n ...large,\n };\n };\n const painted = (color: string | undefined) => (color ? { itemStyle: { color }, lineStyle: { color } } : {});\n\n let series: Record<string, unknown>[];\n let dataset: Record<string, unknown> | Record<string, unknown>[];\n if (splitBy) {\n // One dataset per distinct value of the split column, one series per (value, measure).\n const groups = new Map<string, Record<string, string | number | null>[]>();\n for (const row of rows) {\n const key = String(row[splitBy] ?? \"null\");\n const group = groups.get(key);\n if (group) group.push(row);\n else groups.set(key, [row]);\n }\n const keys = [...groups.keys()];\n dataset = keys.map((key) => ({ source: groups.get(key) }));\n series = keys.flatMap((key, datasetIndex) =>\n input.series.map((measure) => ({\n ...shape(measure),\n ...painted(input.splitColors?.[key]),\n name: input.series.length > 1 ? `${key} · ${measure.label}` : key,\n datasetIndex,\n encode: at(x, measure.column),\n })),\n );\n } else {\n dataset = { source: rows };\n series = input.series.map((measure) => ({ ...shape(measure), ...painted(measure.color), name: measure.label, encode: at(x, measure.column) }));\n }\n\n // Up to four lines are named at their ends, where the eye already is, instead of in a legend.\n const direct =\n input.legend === undefined && series.length >= 2 && series.length <= 4 && kinds.every((k) => k === \"line\") && !input.stacked && !hasRight && endsApart(series, dataset, rows);\n if (direct) series = series.map((s) => ({ ...s, endLabel: { show: true, formatter: \"{a}\", distance: 6 }, labelLayout: { moveOverlap: \"shiftY\" } }));\n const legend = input.legend ?? (direct ? \"none\" : series.length > 1 ? \"top\" : \"none\");\n const categories = input.sort === \"value\" && !isOrdered(xField) && input.series[0] ? categoriesBySize(rows, x, input.series[0].column) : undefined;\n // A zoom bar earns its space only when there are too many points to read at once.\n const zoom = new Set(rows.map((row) => row[x])).size > 60;\n const valueAxis = (name: string | undefined, right: boolean) => ({\n type: \"value\",\n name,\n nameLocation: \"middle\",\n ...TITLE_CLEAR,\n position: right ? \"right\" : \"left\",\n // A second axis has its own scale, so its grid lines would not line up with the first.\n splitLine: { show: !right },\n axisLabel: { formatter: right ? axisNumber : axisFormatter(input.yFormat) },\n });\n return {\n // Times come from the engine in UTC (a month bucket is midnight UTC on the 1st). Drawn in the\n // viewer's own zone they would land on the last day of the month before.\n useUTC: true,\n dataset,\n // The margins are what is left around the plot, its tick labels and its axis titles together: the plot shrinks\n // until all three fit, however wide the tick labels turn out to be.\n grid: {\n left: 8,\n right: legend === \"right\" ? 140 : direct ? 96 : 16,\n top: legend === \"top\" ? 36 : 16,\n bottom: (zoom && !sideways ? 40 : 8) + (legend === \"bottom\" ? 28 : 0),\n outerBoundsMode: \"same\",\n outerBoundsContain: \"all\",\n },\n tooltip: { trigger: kinds.every((k) => k === \"scatter\") ? \"item\" : \"axis\" },\n legend: legendOption(legend),\n ...(sideways\n ? {\n // The largest bar at the top, where reading starts; the values along the bottom from zero.\n yAxis: { type: xType, ...(xType === \"category\" && categories ? { data: categories } : {}), inverse: true, name: input.xTitle, nameLocation: \"start\", nameGap: 8, axisLabel: { hideOverlap: true, ...(xType === \"category\" ? { interval: 0 } : {}) } },\n xAxis: { ...valueAxis(input.yTitle, false), position: \"bottom\" },\n }\n : {\n xAxis: {\n type: xType,\n ...(xType === \"category\" && categories ? { data: categories } : {}),\n name: input.xTitle ?? (xType === \"value\" ? x : undefined),\n nameLocation: \"middle\",\n ...TITLE_CLEAR,\n // A category axis tries every label (ECharts otherwise skips some on a guess) and hides only those that collide.\n axisLabel: { hideOverlap: true, ...(xType === \"category\" ? { interval: 0 } : {}) },\n },\n yAxis: hasRight ? [valueAxis(input.yTitle, false), valueAxis(input.yRightTitle, true)] : valueAxis(input.yTitle, false),\n }),\n dataZoom: !zoom ? [] : sideways ? [{ type: \"inside\", yAxisIndex: 0 }, { type: \"slider\", yAxisIndex: 0, width: 18, right: 8 }] : [{ type: \"inside\" }, { type: \"slider\", height: 18, bottom: legend === \"bottom\" ? 32 : 8 }],\n series,\n };\n}\n\n/** A round bin width that splits [min, max] into about `bins` bins. */\nexport function niceBinWidth(min: number, max: number, bins: number): number {\n const span = max - min;\n if (!(span > 0) || !(bins > 0)) return 1;\n const rough = span / bins;\n const power = 10 ** Math.floor(Math.log10(rough));\n const step = [1, 2, 2.5, 5, 10].find((m) => m * power >= rough) ?? 10;\n return step * power;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../src/chart/option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAU,CAAC;AACpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAIrF,qGAAqG;AACrG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAe,EAAW,EAAE,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,MAAM,IAAI,IAA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AE,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;KACpO,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,IAAY;IACjE,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;IACvB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;IACtE,OAAO,IAAI,GAAG,KAAK,CAAC;AACtB,CAAC","sourcesContent":["import { DataType, type Field } from \"apache-arrow\";\nimport { numberFormat } from \"../locale/locale.js\";\n\n/**\n * The basic chart types, which answer most questions and come first: bars for amounts across categories, a line or\n * an area for change over time, scatter for two measures, and a pie for a few parts of a whole.\n */\nexport const BASIC_CHART_TYPES = [\"bar\", \"line\", \"area\", \"scatter\", \"pie\"] as const;\n/**\n * The other chart types, for a question a basic one cannot show: a heatmap for a measure across two dimensions, a\n * funnel for how much is left at each stage, a treemap for many parts of a whole, a sankey for flows from one set of\n * values to another. Each draws one measure, from the same query a basic chart sends.\n */\nexport const OTHER_CHART_TYPES = [\"heatmap\", \"funnel\", \"treemap\", \"sankey\"] as const;\nexport type ChartType = (typeof BASIC_CHART_TYPES)[number] | (typeof OTHER_CHART_TYPES)[number];\n/** How one series is drawn. A chart whose series differ is a compound chart. */\nexport type SeriesType = \"bar\" | \"line\" | \"area\" | \"scatter\";\n/** A chart drawn without x and y axes: its rows are parts, stages, cells or flows of one measure. */\nexport const isWholeChart = (type: ChartType): boolean => type !== \"bar\" && type !== \"line\" && type !== \"area\" && type !== \"scatter\";\nexport type LegendPlacement = \"top\" | \"bottom\" | \"right\" | \"none\";\n\nexport interface ChartSpecSeries {\n /** Output column holding the values. */\n column: string;\n /** Name shown in the legend and tooltip. */\n label: string;\n /** Draw this series as something other than the chart's type, e.g. a line over bars. */\n type?: SeriesType;\n /** The y axis this series is measured on. Defaults to \"left\". */\n axis?: \"left\" | \"right\";\n /** Series with the same stack name are stacked on each other. */\n stack?: string;\n /** Draw this series in this colour instead of the next one in the theme's order. */\n color?: string;\n}\n\nexport interface ChartOptionInput {\n type: ChartType;\n /** Column for the x axis (or the slice names of a pie). */\n x: string;\n series: ChartSpecSeries[];\n /** Column whose distinct values split each measure into separate series. */\n splitBy?: string;\n fields: Field[];\n /** Rows as plain chart values, keyed by column. */\n rows: Record<string, string | number | null>[];\n /** Where the legend goes. Defaults to \"top\" when there is more than one series, otherwise \"none\". */\n legend?: LegendPlacement;\n /** Stack every series that has no stack name of its own. */\n stacked?: boolean;\n /** Colours for particular values of the split column, by value. */\n splitColors?: Record<string, string>;\n /** Axis titles. */\n xTitle?: string;\n yTitle?: string;\n yRightTitle?: string;\n /** How the left axis writes its numbers. Changes the labels only, never the values. */\n yFormat?: AxisFormat;\n /**\n * \"value\" puts categories in order of size, largest first, unless x is a\n * date or number, whose own order is kept. \"x\" keeps the rows as given.\n */\n sort?: \"value\" | \"x\";\n /**\n * Bars run across instead of up: the categories go down the left side,\n * largest at the top, and the values along the bottom. Applies only when\n * every series is a bar on one scale; otherwise it is ignored.\n */\n horizontal?: boolean;\n /** The theme's sequential colours, faint to strong, for a heatmap's cells. */\n ramp?: string[];\n}\n\n/**\n * An axis title sits a fixed gap beyond the tick labels, wherever they end. A gap measured from the axis line\n * suits one width of label only: beside two-digit ticks the title ran off the chart's edge.\n */\nconst TITLE_CLEAR = { nameGap: 8, nameMoveOverlap: true } as const;\n\n/** True when a chart of this shape can be turned on its side: bars only, on one scale. */\nexport function canTurnSideways(type: ChartType, series: { type?: SeriesType; axis?: \"left\" | \"right\" }[]): boolean {\n return series.length > 0 && series.every((s) => (s.type ?? type) === \"bar\" && s.axis !== \"right\");\n}\n\n/** True when a column's values have an order of their own: dates, times and numbers. */\nexport function isOrdered(field: Field | undefined): boolean {\n if (!field) return false;\n return DataType.isTimestamp(field.type) || DataType.isDate(field.type) || DataType.isInt(field.type) || DataType.isFloat(field.type) || DataType.isDecimal(field.type);\n}\n\n/**\n * The order categories are drawn in when sorted by size: by the total of the\n * first measure across every series, largest first. Sorting by the total\n * keeps a stacked or grouped chart in one order for all its series.\n */\nexport function categoriesBySize(rows: Record<string, string | number | null>[], x: string, measure: string): string[] {\n const totals = new Map<string, number>();\n for (const row of rows) {\n const key = String(row[x] ?? \"null\");\n totals.set(key, (totals.get(key) ?? 0) + (Number(row[measure]) || 0));\n }\n return [...totals.entries()].sort((a, b) => b[1] - a[1]).map(([key]) => key);\n}\n\ntype AxisType = \"category\" | \"time\" | \"value\";\n\nfunction axisType(field: Field | undefined, scatter: boolean): AxisType {\n if (!field) return \"category\";\n if (DataType.isTimestamp(field.type) || DataType.isDate(field.type)) return \"time\";\n const numeric = DataType.isInt(field.type) || DataType.isFloat(field.type) || DataType.isDecimal(field.type);\n return numeric && scatter ? \"value\" : \"category\";\n}\n\nconst compact = () => numberFormat({ notation: \"compact\", maximumFractionDigits: 1 });\nconst fraction = () => numberFormat({ maximumSignificantDigits: 2 });\n/** A number on an axis: 12K, 1.5M, and for a value under one enough digits to tell the ticks apart (0.02, not 0). */\nexport const axisNumber = (value: number) => (value !== 0 && Math.abs(value) < 1 ? fraction().format(value) : compact().format(value));\n\nexport type AxisFormat = \"number\" | \"compact\" | \"currency\" | \"percent\";\nconst percent = () => numberFormat({ style: \"percent\", maximumSignificantDigits: 2 });\nconst money = () => numberFormat({ style: \"currency\", currency: \"USD\", notation: \"compact\", maximumSignificantDigits: 3 });\n/** A number on an axis in a measure's own format: 6% rather than 0.06, $1.2M rather than 1.2M. */\nexport const axisFormatter = (format: AxisFormat | undefined): ((value: number) => string) =>\n format === \"percent\" ? (value) => percent().format(value) : format === \"currency\" ? (value) => money().format(value) : axisNumber;\n\nconst exactPercent = () => numberFormat({ style: \"percent\", maximumFractionDigits: 1 });\nconst exactMoney = () => numberFormat({ style: \"currency\", currency: \"USD\", maximumFractionDigits: 2 });\nconst exact = () => numberFormat({ maximumFractionDigits: 2 });\n/**\n * A value in a tooltip, where a person reads one number closely: in full rather than compact, rounded to what can be\n * told apart (6.1%, $1,234.50, 1,234.57, 0.0123), in the measure's own format. Changes the text only, never the value.\n */\nexport const tooltipFormatter =\n (format: AxisFormat | undefined) =>\n (value: unknown): string => {\n const n = typeof value === \"number\" ? value : Number(value);\n if (value == null || value === \"\" || !Number.isFinite(n)) return value == null ? \"–\" : String(value);\n if (format === \"percent\") return exactPercent().format(n);\n if (format === \"currency\") return exactMoney().format(n);\n return n !== 0 && Math.abs(n) < 1 ? fraction().format(n) : exact().format(n);\n };\n\nfunction legendOption(placement: LegendPlacement): Record<string, unknown> {\n if (placement === \"none\") return { show: false };\n if (placement === \"right\") return { type: \"scroll\", orient: \"vertical\", right: 0, top: \"middle\" };\n return { type: \"scroll\", [placement]: 0 };\n}\n\n/**\n * True when the last points of every series are far enough apart for a label\n * at each end to be read. Lines that finish close together keep the legend.\n */\nfunction endsApart(series: Record<string, unknown>[], dataset: unknown, rows: Record<string, string | number | null>[]): boolean {\n const sets = Array.isArray(dataset) ? (dataset as { source?: Record<string, string | number | null>[] }[]) : undefined;\n const ends: number[] = [];\n let low = Infinity;\n let high = -Infinity;\n for (const item of series) {\n const column = (item.encode as { y: string }).y;\n const source = sets ? (sets[item.datasetIndex as number]?.source ?? []) : rows;\n const values = source.map((row) => Number(row[column])).filter((v) => Number.isFinite(v));\n if (values.length === 0) return false;\n ends.push(values.at(-1)!);\n low = Math.min(low, ...values);\n high = Math.max(high, ...values);\n }\n const room = (high - Math.min(low, 0)) * 0.08;\n const sorted = [...ends].sort((a, b) => a - b);\n return sorted.every((value, i) => i === 0 || value - sorted[i - 1]! >= room);\n}\n\n/**\n * The rows a chart cannot place: those with no x, on a time or number axis. (A category axis draws them under\n * \"null\".) They are left out of the option whole, since a point that is not drawn must not size the y axis:\n * a count of the rows with no date would otherwise flatten the line of every week that has one.\n */\nexport function rowsWithoutX(input: Pick<ChartOptionInput, \"type\" | \"x\" | \"series\" | \"fields\" | \"rows\">): ChartOptionInput[\"rows\"] {\n if (isWholeChart(input.type)) return [];\n const kinds = input.series.map((s) => s.type ?? input.type);\n const xType = axisType(input.fields.find((f) => f.name === input.x), kinds.every((k) => k === \"scatter\"));\n return xType === \"category\" ? [] : input.rows.filter((row) => row[input.x] == null);\n}\n\n/**\n * Builds an ECharts option from query rows. Pure, so it can be tested and\n * reused on a server or by an agent. Colours and fonts come from the theme\n * passed to `echarts.init`, not from here.\n */\nexport function buildChartOption(given: ChartOptionInput): Record<string, unknown> {\n const unplaced = rowsWithoutX(given);\n const input = unplaced.length > 0 ? { ...given, rows: given.rows.filter((row) => row[given.x] != null) } : given;\n const { type, x, splitBy } = input;\n const xField = input.fields.find((f) => f.name === x);\n // A date or number axis is drawn in its own order, whatever order the rows arrived in.\n const byX = !isWholeChart(type) && isOrdered(xField) && input.sort === \"value\";\n // A missing category is drawn under its own name rather than dropped from the axis.\n const named = !isWholeChart(type) && input.sort === \"value\" && !isOrdered(xField) ? input.rows.map((row) => (row[x] == null ? { ...row, [x]: \"null\" } : row)) : input.rows;\n const rows = byX ? [...input.rows].sort((a, b) => (typeof a[x] === \"number\" && typeof b[x] === \"number\" ? a[x] - b[x] : String(a[x]).localeCompare(String(b[x])))) : named;\n\n if (type === \"heatmap\" || type === \"funnel\" || type === \"treemap\" || type === \"sankey\") return otherChartOption({ ...input, type, rows });\n\n if (type === \"pie\") {\n const measure = input.series[0];\n return {\n tooltip: { trigger: \"item\", valueFormatter: tooltipFormatter(input.yFormat) },\n legend: legendOption(input.legend ?? \"bottom\"),\n series: [\n {\n type: \"pie\",\n name: measure?.label ?? \"\",\n radius: [\"45%\", \"72%\"],\n center: [\"50%\", \"45%\"],\n label: { show: rows.length <= 8 },\n data: measure ? rows.map((row) => ({ name: String(row[x] ?? \"null\"), value: row[measure.column] })) : [],\n },\n ],\n };\n }\n\n const kinds = input.series.map((s) => s.type ?? type);\n const xType = axisType(xField, kinds.every((k) => k === \"scatter\"));\n const sideways = !!input.horizontal && canTurnSideways(type, input.series);\n // On its side, the category axis is the vertical one and the value axis the horizontal one.\n const at = (category: string, value: string) => (sideways ? { x: value, y: category } : { x: category, y: value });\n const large = rows.length > 2000 ? { large: true, sampling: \"lttb\", showSymbol: false } : {};\n const hasRight = input.series.some((s) => s.axis === \"right\");\n const shape = (measure: ChartSpecSeries): Record<string, unknown> => {\n const kind = measure.type ?? type;\n const stack = measure.stack ?? (input.stacked && kind !== \"scatter\" ? `stack-${measure.axis ?? \"left\"}-${kind}` : undefined);\n return {\n type: kind === \"area\" ? \"line\" : kind,\n ...(kind === \"area\" ? { areaStyle: { opacity: 0.18 }, showSymbol: false } : {}),\n ...(stack ? { stack } : {}),\n ...(hasRight ? { yAxisIndex: measure.axis === \"right\" ? 1 : 0 } : {}),\n tooltip: { valueFormatter: tooltipFormatter(measure.axis === \"right\" ? undefined : input.yFormat) },\n ...large,\n };\n };\n const painted = (color: string | undefined) => (color ? { itemStyle: { color }, lineStyle: { color } } : {});\n\n let series: Record<string, unknown>[];\n let dataset: Record<string, unknown> | Record<string, unknown>[];\n if (splitBy) {\n // One dataset per distinct value of the split column, one series per (value, measure).\n const groups = new Map<string, Record<string, string | number | null>[]>();\n for (const row of rows) {\n const key = String(row[splitBy] ?? \"null\");\n const group = groups.get(key);\n if (group) group.push(row);\n else groups.set(key, [row]);\n }\n const keys = [...groups.keys()];\n dataset = keys.map((key) => ({ source: groups.get(key) }));\n series = keys.flatMap((key, datasetIndex) =>\n input.series.map((measure) => ({\n ...shape(measure),\n ...painted(input.splitColors?.[key]),\n name: input.series.length > 1 ? `${key} · ${measure.label}` : key,\n datasetIndex,\n encode: at(x, measure.column),\n })),\n );\n } else {\n dataset = { source: rows };\n series = input.series.map((measure) => ({ ...shape(measure), ...painted(measure.color), name: measure.label, encode: at(x, measure.column) }));\n }\n\n // Up to four lines are named at their ends, where the eye already is, instead of in a legend.\n const direct =\n input.legend === undefined && series.length >= 2 && series.length <= 4 && kinds.every((k) => k === \"line\") && !input.stacked && !hasRight && endsApart(series, dataset, rows);\n if (direct) series = series.map((s) => ({ ...s, endLabel: { show: true, formatter: \"{a}\", distance: 6 }, labelLayout: { moveOverlap: \"shiftY\" } }));\n const legend = input.legend ?? (direct ? \"none\" : series.length > 1 ? \"top\" : \"none\");\n const categories = input.sort === \"value\" && !isOrdered(xField) && input.series[0] ? categoriesBySize(rows, x, input.series[0].column) : undefined;\n // A zoom bar earns its space only when there are too many points to read at once.\n const zoom = new Set(rows.map((row) => row[x])).size > 60;\n const valueAxis = (name: string | undefined, right: boolean) => ({\n type: \"value\",\n name,\n nameLocation: \"middle\",\n ...TITLE_CLEAR,\n position: right ? \"right\" : \"left\",\n // A second axis has its own scale, so its grid lines would not line up with the first.\n splitLine: { show: !right },\n axisLabel: { formatter: right ? axisNumber : axisFormatter(input.yFormat) },\n });\n return {\n // Times come from the engine in UTC (a month bucket is midnight UTC on the 1st). Drawn in the\n // viewer's own zone they would land on the last day of the month before.\n useUTC: true,\n dataset,\n // The margins are what is left around the plot, its tick labels and its axis titles together: the plot shrinks\n // until all three fit, however wide the tick labels turn out to be.\n grid: {\n left: 8,\n right: legend === \"right\" ? 140 : direct ? 96 : 16,\n top: legend === \"top\" ? 36 : 16,\n bottom: (zoom && !sideways ? 40 : 8) + (legend === \"bottom\" ? 28 : 0),\n outerBoundsMode: \"same\",\n outerBoundsContain: \"all\",\n },\n tooltip: { trigger: kinds.every((k) => k === \"scatter\") ? \"item\" : \"axis\" },\n legend: legendOption(legend),\n ...(sideways\n ? {\n // The largest bar at the top, where reading starts; the values along the bottom from zero.\n yAxis: { type: xType, ...(xType === \"category\" && categories ? { data: categories } : {}), inverse: true, name: input.xTitle, nameLocation: \"start\", nameGap: 8, axisLabel: { hideOverlap: true, ...(xType === \"category\" ? { interval: 0 } : {}) } },\n xAxis: { ...valueAxis(input.yTitle, false), position: \"bottom\" },\n }\n : {\n xAxis: {\n type: xType,\n ...(xType === \"category\" && categories ? { data: categories } : {}),\n name: input.xTitle ?? (xType === \"value\" ? x : undefined),\n nameLocation: \"middle\",\n ...TITLE_CLEAR,\n // A category axis tries every label (ECharts otherwise skips some on a guess) and hides only those that collide.\n axisLabel: { hideOverlap: true, ...(xType === \"category\" ? { interval: 0 } : {}) },\n },\n yAxis: hasRight ? [valueAxis(input.yTitle, false), valueAxis(input.yRightTitle, true)] : valueAxis(input.yTitle, false),\n }),\n dataZoom: !zoom ? [] : sideways ? [{ type: \"inside\", yAxisIndex: 0 }, { type: \"slider\", yAxisIndex: 0, width: 18, right: 8 }] : [{ type: \"inside\" }, { type: \"slider\", height: 18, bottom: legend === \"bottom\" ? 32 : 8 }],\n series,\n };\n}\n\n/** A value on a category axis, as a person reads it: a date for a time (the engine's buckets are UTC), else its text. */\nfunction categoryName(value: string | number | null, field: Field | undefined): string {\n if (value == null) return \"null\";\n if (typeof value === \"number\" && field && (DataType.isTimestamp(field.type) || DataType.isDate(field.type))) return new Date(value).toISOString().slice(0, 10);\n return String(value);\n}\n\n/**\n * The distinct values of a column: in their own order when they have one (dates, numbers), largest first by the\n * measure when `measure` is given, and otherwise in the order the rows give them (which the engine sorted).\n */\nfunction valuesOf(rows: ChartOptionInput[\"rows\"], column: string, field: Field | undefined, measure: string | undefined): (string | number | null)[] {\n const seen = [...new Map(rows.map((row) => [row[column] ?? null, row[column] ?? null])).values()];\n if (isOrdered(field)) return seen.sort((a, b) => (typeof a === \"number\" && typeof b === \"number\" ? a - b : String(a).localeCompare(String(b))));\n if (!measure) return seen;\n const order = categoriesBySize(rows, column, measure);\n return seen.sort((a, b) => order.indexOf(String(a ?? \"null\")) - order.indexOf(String(b ?? \"null\")));\n}\n\n/**\n * The option for a chart drawn without axes, from one measure (the first series): a heatmap (x across, `splitBy`\n * down, the measure as colour on the theme's sequential ramp), a funnel (x as stages), a treemap (x as parts, grouped\n * by `splitBy` when given) or a sankey (flows from x to `splitBy`, which it needs).\n */\nfunction otherChartOption(input: ChartOptionInput & { type: \"heatmap\" | \"funnel\" | \"treemap\" | \"sankey\" }): Record<string, unknown> {\n const { type, x, splitBy, rows } = input;\n const measure = input.series[0];\n const format = tooltipFormatter(input.yFormat);\n const xField = input.fields.find((f) => f.name === x);\n const splitField = splitBy ? input.fields.find((f) => f.name === splitBy) : undefined;\n const value = (row: Record<string, string | number | null>) => (measure ? row[measure.column] : null);\n const name = measure?.label ?? \"\";\n if (!measure) return { series: [] };\n\n if (type === \"heatmap\") {\n // Weekdays, hours and the like keep the order the rows give them; by size only when asked for.\n const bySize = input.sort === \"value\" ? measure.column : undefined;\n const across = valuesOf(rows, x, xField, bySize);\n const down = splitBy ? valuesOf(rows, splitBy, splitField, bySize) : [null];\n const at = (list: (string | number | null)[], v: string | number | null) => list.findIndex((item) => item === (v ?? null));\n const data = rows.map((row) => [at(across, row[x] ?? null), splitBy ? at(down, row[splitBy] ?? null) : 0, value(row)]);\n const numbers = rows.map((row) => Number(value(row))).filter((n) => Number.isFinite(n));\n const cells = across.length * down.length;\n return {\n useUTC: true,\n tooltip: { trigger: \"item\", valueFormatter: format },\n grid: { left: 8, right: 16, top: 16, bottom: 56, outerBoundsMode: \"same\", outerBoundsContain: \"all\" },\n xAxis: { type: \"category\", data: across.map((v) => categoryName(v, xField)), name: input.xTitle, nameLocation: \"middle\", ...TITLE_CLEAR, splitArea: { show: false }, axisLabel: { hideOverlap: true } },\n yAxis: { type: \"category\", data: down.map((v) => (splitBy ? categoryName(v, splitField) : name)), inverse: true, name: input.yTitle, nameLocation: \"middle\", ...TITLE_CLEAR, axisLabel: { hideOverlap: true } },\n visualMap: {\n type: \"continuous\",\n min: numbers.length ? Math.min(0, ...numbers) : 0,\n max: numbers.length ? Math.max(...numbers) : 1,\n orient: \"horizontal\",\n left: \"center\",\n bottom: 0,\n itemHeight: 120,\n calculable: false,\n formatter: (v: number) => axisFormatter(input.yFormat)(v),\n ...(input.ramp?.length ? { inRange: { color: input.ramp } } : {}),\n },\n series: [{ type: \"heatmap\", name, data, label: { show: cells <= 48, formatter: (p: { value: unknown[] }) => axisFormatter(input.yFormat)(Number(p.value[2])) }, emphasis: { itemStyle: { borderWidth: 1 } } }],\n };\n }\n\n if (type === \"funnel\") {\n return {\n tooltip: { trigger: \"item\", valueFormatter: format },\n legend: { show: false },\n series: [\n {\n type: \"funnel\",\n name,\n // One measure, so one colour: a colour per stage would only decorate.\n colorBy: \"series\",\n // Largest at the top, as stages narrow; \"x\" keeps the stages in the order the rows give them.\n sort: input.sort === \"x\" ? \"none\" : \"descending\",\n left: \"10%\",\n width: \"80%\",\n top: 8,\n bottom: 8,\n minSize: \"2%\",\n gap: 2,\n label: { show: true, position: \"inside\", formatter: \"{b}\" },\n data: rows.map((row) => ({ name: categoryName(row[x] ?? null, xField), value: value(row) })),\n },\n ],\n };\n }\n\n if (type === \"treemap\") {\n const leaf = (row: Record<string, string | number | null>) => ({ name: categoryName(row[x] ?? null, xField), value: value(row) });\n const data = splitBy\n ? valuesOf(rows, splitBy, splitField, measure.column).map((group) => ({ name: categoryName(group, splitField), children: rows.filter((row) => (row[splitBy] ?? null) === group).map(leaf) }))\n : rows.map(leaf);\n return {\n tooltip: { trigger: \"item\", valueFormatter: format },\n series: [\n {\n type: \"treemap\",\n name,\n roam: false,\n nodeClick: false,\n breadcrumb: { show: false },\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n label: { show: true, formatter: \"{b}\" },\n upperLabel: { show: !!splitBy, height: 20 },\n data,\n },\n ],\n };\n }\n\n // A sankey: each row a flow from its x to its split value. Without a split there is nothing to flow to.\n if (!splitBy) return { series: [] };\n const links = rows\n .map((row) => ({ source: categoryName(row[x] ?? null, xField), target: categoryName(row[splitBy] ?? null, splitField), value: Number(value(row)) }))\n // A flow from a value to itself, or of nothing, cannot be drawn.\n .filter((link) => link.source !== link.target && Number.isFinite(link.value) && link.value > 0);\n const nodes = [...new Set(links.flatMap((link) => [link.source, link.target]))].map((n) => ({ name: n }));\n return {\n tooltip: { trigger: \"item\", valueFormatter: format },\n series: [{ type: \"sankey\", name, left: 8, right: 96, top: 8, bottom: 8, nodeGap: 10, emphasis: { focus: \"adjacency\" }, lineStyle: { color: \"gradient\", curveness: 0.5, opacity: 0.4 }, label: { show: true }, data: nodes, links }],\n };\n}\n\n/** A round bin width that splits [min, max] into about `bins` bins. */\nexport function niceBinWidth(min: number, max: number, bins: number): number {\n const span = max - min;\n if (!(span > 0) || !(bins > 0)) return 1;\n const rough = span / bins;\n const power = 10 ** Math.floor(Math.log10(rough));\n const step = [1, 2, 2.5, 5, 10].find((m) => m * power >= rough) ?? 10;\n return step * power;\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type IconDrawing } from "@surfaces-ui/icons";
|
|
1
2
|
import { type ReactNode } from "react";
|
|
3
|
+
/** Drawn from the shared set where that set has the same drawing; the rest are this set's own. */
|
|
2
4
|
declare const PATHS: {
|
|
3
5
|
readonly edit: "M4 20h4L19 9l-4-4L4 16z M14 6l4 4";
|
|
4
6
|
readonly chart: "M4 4v16h16 M8 16v-5 M12 16V8 M16 16v-9";
|
|
@@ -11,8 +13,8 @@ declare const PATHS: {
|
|
|
11
13
|
readonly down: "M12 5v14 M6 13l6 6 6-6";
|
|
12
14
|
readonly duplicate: "M8 8h11v11H8z M5 16V5h11";
|
|
13
15
|
readonly remove: "M5 7h14 M10 7V4h4v3 M7 7l1 13h8l1-13 M10 11v6 M14 11v6";
|
|
14
|
-
readonly add:
|
|
15
|
-
readonly close:
|
|
16
|
+
readonly add: IconDrawing;
|
|
17
|
+
readonly close: IconDrawing;
|
|
16
18
|
readonly menu: "M4 7h16 M4 12h16 M4 17h16";
|
|
17
19
|
readonly fold: "M4 4v16 M20 12H9 M14 7l-5 5 5 5";
|
|
18
20
|
readonly unfold: "M20 4v16 M4 12h11 M10 7l5 5-5 5";
|
|
@@ -20,6 +22,8 @@ declare const PATHS: {
|
|
|
20
22
|
readonly power: "M12 3v8 M7 6.5a7 7 0 1 0 10 0";
|
|
21
23
|
readonly "sign-out": "M10 4H5v16h5 M15 8l4 4-4 4 M19 12H9";
|
|
22
24
|
readonly more: "M4.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M10.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M16.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0";
|
|
25
|
+
readonly undo: IconDrawing;
|
|
26
|
+
readonly redo: IconDrawing;
|
|
23
27
|
};
|
|
24
28
|
/** The drawings the shared controls use. One set, so the same action looks the same wherever it appears. */
|
|
25
29
|
export type ControlIconName = keyof typeof PATHS;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { addIcon, closeIcon, redoIcon, undoIcon } from "@surfaces-ui/icons";
|
|
2
3
|
import { useRef, useState } from "react";
|
|
4
|
+
import { OutlineIcon } from "./OutlineIcon.js";
|
|
5
|
+
/** Drawn from the shared set where that set has the same drawing; the rest are this set's own. */
|
|
3
6
|
const PATHS = {
|
|
4
7
|
edit: "M4 20h4L19 9l-4-4L4 16z M14 6l4 4",
|
|
5
8
|
chart: "M4 4v16h16 M8 16v-5 M12 16V8 M16 16v-9",
|
|
@@ -12,8 +15,8 @@ const PATHS = {
|
|
|
12
15
|
down: "M12 5v14 M6 13l6 6 6-6",
|
|
13
16
|
duplicate: "M8 8h11v11H8z M5 16V5h11",
|
|
14
17
|
remove: "M5 7h14 M10 7V4h4v3 M7 7l1 13h8l1-13 M10 11v6 M14 11v6",
|
|
15
|
-
add:
|
|
16
|
-
close:
|
|
18
|
+
add: addIcon,
|
|
19
|
+
close: closeIcon,
|
|
17
20
|
menu: "M4 7h16 M4 12h16 M4 17h16",
|
|
18
21
|
fold: "M4 4v16 M20 12H9 M14 7l-5 5 5 5",
|
|
19
22
|
unfold: "M20 4v16 M4 12h11 M10 7l5 5-5 5",
|
|
@@ -21,11 +24,13 @@ const PATHS = {
|
|
|
21
24
|
power: "M12 3v8 M7 6.5a7 7 0 1 0 10 0",
|
|
22
25
|
"sign-out": "M10 4H5v16h5 M15 8l4 4-4 4 M19 12H9",
|
|
23
26
|
more: "M4.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M10.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M16.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0",
|
|
27
|
+
undo: undoIcon,
|
|
28
|
+
redo: redoIcon,
|
|
24
29
|
};
|
|
25
30
|
export const CONTROL_ICONS = Object.keys(PATHS);
|
|
26
31
|
export function ControlIcon({ icon }) {
|
|
27
32
|
if (typeof icon === "string" && icon in PATHS) {
|
|
28
|
-
return
|
|
33
|
+
return _jsx(OutlineIcon, { className: "sf-item-control-icon", drawing: PATHS[icon] });
|
|
29
34
|
}
|
|
30
35
|
return _jsx("span", { className: "sf-item-control-icon", children: icon });
|
|
31
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemControls.js","sourceRoot":"","sources":["../../src/controls/ItemControls.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsC,MAAM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CAAC,SAAS,CAAC,CAAC;IACtE,GAAG,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { type KeyboardEvent, type ReactNode, useRef, useState } from \"react\";\n\nconst PATHS = {\n edit: \"M4 20h4L19 9l-4-4L4 16z M14 6l4 4\",\n chart: \"M4 4v16h16 M8 16v-5 M12 16V8 M16 16v-9\",\n table: \"M3 5h18v14H3z M3 10h18 M3 15h18 M9 5v14\",\n wider: \"M3 12h18 M7 8l-4 4 4 4 M17 8l4 4-4 4\",\n narrower: \"M3 12h6 M21 12h-6 M5 8l4 4-4 4 M19 8l-4 4 4 4\",\n earlier: \"M19 12H5 M11 6l-6 6 6 6\",\n later: \"M5 12h14 M13 6l6 6-6 6\",\n up: \"M12 19V5 M6 11l6-6 6 6\",\n down: \"M12 5v14 M6 13l6 6 6-6\",\n duplicate: \"M8 8h11v11H8z M5 16V5h11\",\n remove: \"M5 7h14 M10 7V4h4v3 M7 7l1 13h8l1-13 M10 11v6 M14 11v6\",\n add: \"M12 5v14 M5 12h14\",\n close: \"M6 6l12 12 M18 6L6 18\",\n menu: \"M4 7h16 M4 12h16 M4 17h16\",\n fold: \"M4 4v16 M20 12H9 M14 7l-5 5 5 5\",\n unfold: \"M20 4v16 M4 12h11 M10 7l5 5-5 5\",\n confirm: \"M5 12l5 5 9-10\",\n power: \"M12 3v8 M7 6.5a7 7 0 1 0 10 0\",\n \"sign-out\": \"M10 4H5v16h5 M15 8l4 4-4 4 M19 12H9\",\n more: \"M4.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M10.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M16.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0\",\n} as const;\n\n/** The drawings the shared controls use. One set, so the same action looks the same wherever it appears. */\nexport type ControlIconName = keyof typeof PATHS;\nexport const CONTROL_ICONS = Object.keys(PATHS) as ControlIconName[];\n\nexport function ControlIcon({ icon }: { icon: ControlIconName | ReactNode }) {\n if (typeof icon === \"string\" && icon in PATHS) {\n return (\n <svg className=\"sf-item-control-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">\n <path d={PATHS[icon as ControlIconName]} />\n </svg>\n );\n }\n return <span className=\"sf-item-control-icon\">{icon}</span>;\n}\n\n/** One control on an item: an icon, and its name for assistive technology and the tooltip. */\nexport interface ItemControl {\n /** What it does, as a word: \"edit\", \"remove\". Put on the button as `data-control`. */\n id: string;\n /** The button's full name, said by a screen reader and shown at once on hover and focus: \"Remove Refund rate by category\". */\n label: string;\n icon: ControlIconName | ReactNode;\n onSelect(): void;\n /** Shown but cannot be used: the first item cannot move earlier. It can still be focused, so its name can be read. */\n disabled?: boolean;\n /** For a control that removes or destroys. Marked by more than colour: it comes last, after a gap. */\n danger?: boolean;\n /** For a control that switches something on and off. */\n pressed?: boolean;\n /**\n * Stays visible when the rest are quiet: for the one action a person\n * must be able to find without pointing at the item first (a report's\n * \"Add to report\"). Use it sparingly, and not on a control that cannot\n * be used right now.\n */\n pinned?: boolean;\n}\n\nexport interface ItemControlsProps {\n /** Names the group: \"Refund rate by category controls\". */\n label: string;\n controls: ItemControl[];\n /**\n * \"hover\" (the default) shows the controls when the pointer is over the\n * item they belong to, or focus is inside it; give that item the class\n * `sf-controls-host`. On a touch screen, which has no hover, they are\n * always shown. \"always\" keeps them shown.\n */\n show?: \"hover\" | \"always\";\n /**\n * Whether an outer layer of controls can hide these (see `CONTROLS_QUIET`).\n * True by default; the outer layer's own controls pass false.\n */\n quietable?: boolean;\n className?: string;\n}\n\n/**\n * Put this class on a region to hide the item controls inside it, so that\n * two layers of controls are never on screen at once: an editor that frames\n * each component with its own controls (move, remove, resize) quiets the\n * controls of what it frames while it is arranging.\n */\nexport const CONTROLS_QUIET = \"sf-controls-quiet\";\n/** Put this class on the item a set of hover controls belongs to. */\nexport const CONTROLS_HOST = \"sf-controls-host\";\n\n/**\n * The controls of one item (a tile, a card, a framed component) as a row of\n * icons: quiet until the item is pointed at or focused, each named at once\n * in a tooltip, and one stop in the tab order with the arrow keys moving\n * between them. Every part of the library that lets a person change, move,\n * resize or remove an item uses this, with `standardControls` for the\n * actions they share, so the same action has the same icon, name and place\n * everywhere.\n */\nexport function ItemControls({ label, controls, show = \"hover\", quietable = true, className }: ItemControlsProps) {\n const bar = useRef<HTMLDivElement>(null);\n const [current, setCurrent] = useState(0);\n const [tip, setTip] = useState<number | undefined>();\n const at = Math.min(current, Math.max(0, controls.length - 1));\n\n const focus = (index: number) => {\n const next = (index + controls.length) % controls.length;\n setCurrent(next);\n bar.current?.querySelectorAll<HTMLButtonElement>(\"button\")[next]?.focus();\n };\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") focus(at + 1);\n else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") focus(at - 1);\n else if (event.key === \"Home\") focus(0);\n else if (event.key === \"End\") focus(controls.length - 1);\n else if (event.key === \"Escape\" && tip !== undefined) setTip(undefined);\n else return;\n event.preventDefault();\n event.stopPropagation();\n };\n\n if (controls.length === 0) return null;\n return (\n <div ref={bar} className={[\"sf-item-controls\", className].filter(Boolean).join(\" \")} role=\"toolbar\" aria-label={label} data-show={show} data-quietable={quietable || undefined} onKeyDown={onKeyDown}>\n {controls.map((control, index) => (\n <button\n key={control.id}\n type=\"button\"\n className=\"sf-item-control\"\n data-control={control.id}\n data-danger={control.danger || undefined}\n data-pinned={(control.pinned && !control.disabled) || undefined}\n aria-label={control.label}\n aria-pressed={control.pressed}\n // Not `disabled`, which would take it out of reach of the keyboard and leave its name unread.\n aria-disabled={control.disabled || undefined}\n tabIndex={index === at ? 0 : -1}\n onClick={() => !control.disabled && control.onSelect()}\n onFocus={() => {\n setCurrent(index);\n setTip(index);\n }}\n onBlur={() => setTip((now) => (now === index ? undefined : now))}\n onPointerEnter={() => setTip(index)}\n onPointerLeave={() => setTip((now) => (now === index ? undefined : now))}\n >\n <ControlIcon icon={control.icon} />\n {/* The button carries its name for assistive technology; this is the same words for the eye, shown at once. */}\n {tip === index && (\n <span className=\"sf-item-tip\" aria-hidden=\"true\">\n {control.label}\n {control.disabled ? \" (not available here)\" : \"\"}\n </span>\n )}\n </button>\n ))}\n </div>\n );\n}\n\n/** What an item can have done to it. A handler left out leaves the control out; `false` shows it greyed, for an action that makes no sense right now. */\nexport interface StandardActions {\n edit?: (() => void) | false;\n /** Switch between a chart and a table. `now` is what is showing. */\n view?: { now: \"chart\" | \"table\"; toggle(): void };\n wider?: (() => void) | false;\n narrower?: (() => void) | false;\n /** Earlier and later in reading order, for items laid out across. */\n earlier?: (() => void) | false;\n later?: (() => void) | false;\n /** Up and down, for items stacked. */\n up?: (() => void) | false;\n down?: (() => void) | false;\n duplicate?: (() => void) | false;\n remove?: (() => void) | false;\n}\n\n/**\n * The controls an item shares with every other kind of item, in one order\n * and with one wording: change, chart or table, wider, narrower, move,\n * duplicate, remove. `name` is what the item is called (\"Refund rate by\n * category\", \"Chart revenue\"), and goes into each control's name.\n */\nexport function standardControls(name: string, actions: StandardActions): ItemControl[] {\n const out: ItemControl[] = [];\n const add = (id: string, label: string, icon: ControlIconName, handler: (() => void) | false | undefined, extra: Partial<ItemControl> = {}) => {\n if (handler === undefined) return;\n out.push({ id, label, icon, onSelect: handler || (() => undefined), ...(handler === false ? { disabled: true } : {}), ...extra });\n };\n add(\"edit\", `Change ${name}`, \"edit\", actions.edit);\n if (actions.view) add(\"view\", actions.view.now === \"chart\" ? `Show ${name} as a table` : `Show ${name} as a chart`, actions.view.now === \"chart\" ? \"table\" : \"chart\", actions.view.toggle);\n add(\"wider\", `Make ${name} wider`, \"wider\", actions.wider);\n add(\"narrower\", `Make ${name} narrower`, \"narrower\", actions.narrower);\n add(\"earlier\", `Move ${name} earlier`, \"earlier\", actions.earlier);\n add(\"later\", `Move ${name} later`, \"later\", actions.later);\n add(\"up\", `Move ${name} up`, \"up\", actions.up);\n add(\"down\", `Move ${name} down`, \"down\", actions.down);\n add(\"duplicate\", `Duplicate ${name}`, \"duplicate\", actions.duplicate);\n add(\"remove\", `Remove ${name}`, \"remove\", actions.remove, { danger: true });\n return out;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ItemControls.js","sourceRoot":"","sources":["../../src/controls/ItemControls.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAoB,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAsC,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,kGAAkG;AAClG,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,mCAAmC;IACzC,KAAK,EAAE,wCAAwC;IAC/C,KAAK,EAAE,yCAAyC;IAChD,KAAK,EAAE,sCAAsC;IAC7C,QAAQ,EAAE,+CAA+C;IACzD,OAAO,EAAE,yBAAyB;IAClC,KAAK,EAAE,wBAAwB;IAC/B,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,wBAAwB;IAC9B,SAAS,EAAE,0BAA0B;IACrC,MAAM,EAAE,wDAAwD;IAChE,GAAG,EAAE,OAAO;IACZ,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,iCAAiC;IACvC,MAAM,EAAE,iCAAiC;IACzC,OAAO,EAAE,gBAAgB;IACzB,KAAK,EAAE,+BAA+B;IACtC,UAAU,EAAE,qCAAqC;IACjD,IAAI,EAAE,mJAAmJ;IACzJ,IAAI,EAAE,QAAQ;I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GAAG,CAAC,SAAS,EAAE,QAAQ,IAAI,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,GAAG,CAAC,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,GAAG,CAAC,IAAI,EAAE,QAAQ,IAAI,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/C,GAAG,CAAC,MAAM,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,GAAG,CAAC,WAAW,EAAE,aAAa,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACtE,GAAG,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { addIcon, closeIcon, type IconDrawing, redoIcon, undoIcon } from \"@surfaces-ui/icons\";\nimport { type KeyboardEvent, type ReactNode, useRef, useState } from \"react\";\nimport { OutlineIcon } from \"./OutlineIcon.js\";\n\n/** Drawn from the shared set where that set has the same drawing; the rest are this set's own. */\nconst PATHS = {\n edit: \"M4 20h4L19 9l-4-4L4 16z M14 6l4 4\",\n chart: \"M4 4v16h16 M8 16v-5 M12 16V8 M16 16v-9\",\n table: \"M3 5h18v14H3z M3 10h18 M3 15h18 M9 5v14\",\n wider: \"M3 12h18 M7 8l-4 4 4 4 M17 8l4 4-4 4\",\n narrower: \"M3 12h6 M21 12h-6 M5 8l4 4-4 4 M19 8l-4 4 4 4\",\n earlier: \"M19 12H5 M11 6l-6 6 6 6\",\n later: \"M5 12h14 M13 6l6 6-6 6\",\n up: \"M12 19V5 M6 11l6-6 6 6\",\n down: \"M12 5v14 M6 13l6 6 6-6\",\n duplicate: \"M8 8h11v11H8z M5 16V5h11\",\n remove: \"M5 7h14 M10 7V4h4v3 M7 7l1 13h8l1-13 M10 11v6 M14 11v6\",\n add: addIcon,\n close: closeIcon,\n menu: \"M4 7h16 M4 12h16 M4 17h16\",\n fold: \"M4 4v16 M20 12H9 M14 7l-5 5 5 5\",\n unfold: \"M20 4v16 M4 12h11 M10 7l5 5-5 5\",\n confirm: \"M5 12l5 5 9-10\",\n power: \"M12 3v8 M7 6.5a7 7 0 1 0 10 0\",\n \"sign-out\": \"M10 4H5v16h5 M15 8l4 4-4 4 M19 12H9\",\n more: \"M4.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M10.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0 M16.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0\",\n undo: undoIcon,\n redo: redoIcon,\n} as const satisfies Record<string, string | IconDrawing>;\n\n/** The drawings the shared controls use. One set, so the same action looks the same wherever it appears. */\nexport type ControlIconName = keyof typeof PATHS;\nexport const CONTROL_ICONS = Object.keys(PATHS) as ControlIconName[];\n\nexport function ControlIcon({ icon }: { icon: ControlIconName | ReactNode }) {\n if (typeof icon === \"string\" && icon in PATHS) {\n return <OutlineIcon className=\"sf-item-control-icon\" drawing={PATHS[icon as ControlIconName]} />;\n }\n return <span className=\"sf-item-control-icon\">{icon}</span>;\n}\n\n/** One control on an item: an icon, and its name for assistive technology and the tooltip. */\nexport interface ItemControl {\n /** What it does, as a word: \"edit\", \"remove\". Put on the button as `data-control`. */\n id: string;\n /** The button's full name, said by a screen reader and shown at once on hover and focus: \"Remove Refund rate by category\". */\n label: string;\n icon: ControlIconName | ReactNode;\n onSelect(): void;\n /** Shown but cannot be used: the first item cannot move earlier. It can still be focused, so its name can be read. */\n disabled?: boolean;\n /** For a control that removes or destroys. Marked by more than colour: it comes last, after a gap. */\n danger?: boolean;\n /** For a control that switches something on and off. */\n pressed?: boolean;\n /**\n * Stays visible when the rest are quiet: for the one action a person\n * must be able to find without pointing at the item first (a report's\n * \"Add to report\"). Use it sparingly, and not on a control that cannot\n * be used right now.\n */\n pinned?: boolean;\n}\n\nexport interface ItemControlsProps {\n /** Names the group: \"Refund rate by category controls\". */\n label: string;\n controls: ItemControl[];\n /**\n * \"hover\" (the default) shows the controls when the pointer is over the\n * item they belong to, or focus is inside it; give that item the class\n * `sf-controls-host`. On a touch screen, which has no hover, they are\n * always shown. \"always\" keeps them shown.\n */\n show?: \"hover\" | \"always\";\n /**\n * Whether an outer layer of controls can hide these (see `CONTROLS_QUIET`).\n * True by default; the outer layer's own controls pass false.\n */\n quietable?: boolean;\n className?: string;\n}\n\n/**\n * Put this class on a region to hide the item controls inside it, so that\n * two layers of controls are never on screen at once: an editor that frames\n * each component with its own controls (move, remove, resize) quiets the\n * controls of what it frames while it is arranging.\n */\nexport const CONTROLS_QUIET = \"sf-controls-quiet\";\n/** Put this class on the item a set of hover controls belongs to. */\nexport const CONTROLS_HOST = \"sf-controls-host\";\n\n/**\n * The controls of one item (a tile, a card, a framed component) as a row of\n * icons: quiet until the item is pointed at or focused, each named at once\n * in a tooltip, and one stop in the tab order with the arrow keys moving\n * between them. Every part of the library that lets a person change, move,\n * resize or remove an item uses this, with `standardControls` for the\n * actions they share, so the same action has the same icon, name and place\n * everywhere.\n */\nexport function ItemControls({ label, controls, show = \"hover\", quietable = true, className }: ItemControlsProps) {\n const bar = useRef<HTMLDivElement>(null);\n const [current, setCurrent] = useState(0);\n const [tip, setTip] = useState<number | undefined>();\n const at = Math.min(current, Math.max(0, controls.length - 1));\n\n const focus = (index: number) => {\n const next = (index + controls.length) % controls.length;\n setCurrent(next);\n bar.current?.querySelectorAll<HTMLButtonElement>(\"button\")[next]?.focus();\n };\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") focus(at + 1);\n else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") focus(at - 1);\n else if (event.key === \"Home\") focus(0);\n else if (event.key === \"End\") focus(controls.length - 1);\n else if (event.key === \"Escape\" && tip !== undefined) setTip(undefined);\n else return;\n event.preventDefault();\n event.stopPropagation();\n };\n\n if (controls.length === 0) return null;\n return (\n <div ref={bar} className={[\"sf-item-controls\", className].filter(Boolean).join(\" \")} role=\"toolbar\" aria-label={label} data-show={show} data-quietable={quietable || undefined} onKeyDown={onKeyDown}>\n {controls.map((control, index) => (\n <button\n key={control.id}\n type=\"button\"\n className=\"sf-item-control\"\n data-control={control.id}\n data-danger={control.danger || undefined}\n data-pinned={(control.pinned && !control.disabled) || undefined}\n aria-label={control.label}\n aria-pressed={control.pressed}\n // Not `disabled`, which would take it out of reach of the keyboard and leave its name unread.\n aria-disabled={control.disabled || undefined}\n tabIndex={index === at ? 0 : -1}\n onClick={() => !control.disabled && control.onSelect()}\n onFocus={() => {\n setCurrent(index);\n setTip(index);\n }}\n onBlur={() => setTip((now) => (now === index ? undefined : now))}\n onPointerEnter={() => setTip(index)}\n onPointerLeave={() => setTip((now) => (now === index ? undefined : now))}\n >\n <ControlIcon icon={control.icon} />\n {/* The button carries its name for assistive technology; this is the same words for the eye, shown at once. */}\n {tip === index && (\n <span className=\"sf-item-tip\" aria-hidden=\"true\">\n {control.label}\n {control.disabled ? \" (not available here)\" : \"\"}\n </span>\n )}\n </button>\n ))}\n </div>\n );\n}\n\n/** What an item can have done to it. A handler left out leaves the control out; `false` shows it greyed, for an action that makes no sense right now. */\nexport interface StandardActions {\n edit?: (() => void) | false;\n /** Switch between a chart and a table. `now` is what is showing. */\n view?: { now: \"chart\" | \"table\"; toggle(): void };\n wider?: (() => void) | false;\n narrower?: (() => void) | false;\n /** Earlier and later in reading order, for items laid out across. */\n earlier?: (() => void) | false;\n later?: (() => void) | false;\n /** Up and down, for items stacked. */\n up?: (() => void) | false;\n down?: (() => void) | false;\n duplicate?: (() => void) | false;\n remove?: (() => void) | false;\n}\n\n/**\n * The controls an item shares with every other kind of item, in one order\n * and with one wording: change, chart or table, wider, narrower, move,\n * duplicate, remove. `name` is what the item is called (\"Refund rate by\n * category\", \"Chart revenue\"), and goes into each control's name.\n */\nexport function standardControls(name: string, actions: StandardActions): ItemControl[] {\n const out: ItemControl[] = [];\n const add = (id: string, label: string, icon: ControlIconName, handler: (() => void) | false | undefined, extra: Partial<ItemControl> = {}) => {\n if (handler === undefined) return;\n out.push({ id, label, icon, onSelect: handler || (() => undefined), ...(handler === false ? { disabled: true } : {}), ...extra });\n };\n add(\"edit\", `Change ${name}`, \"edit\", actions.edit);\n if (actions.view) add(\"view\", actions.view.now === \"chart\" ? `Show ${name} as a table` : `Show ${name} as a chart`, actions.view.now === \"chart\" ? \"table\" : \"chart\", actions.view.toggle);\n add(\"wider\", `Make ${name} wider`, \"wider\", actions.wider);\n add(\"narrower\", `Make ${name} narrower`, \"narrower\", actions.narrower);\n add(\"earlier\", `Move ${name} earlier`, \"earlier\", actions.earlier);\n add(\"later\", `Move ${name} later`, \"later\", actions.later);\n add(\"up\", `Move ${name} up`, \"up\", actions.up);\n add(\"down\", `Move ${name} down`, \"down\", actions.down);\n add(\"duplicate\", `Duplicate ${name}`, \"duplicate\", actions.duplicate);\n add(\"remove\", `Remove ${name}`, \"remove\", actions.remove, { danger: true });\n return out;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IconDrawing } from "@surfaces-ui/icons";
|
|
2
|
+
/**
|
|
3
|
+
* One icon of a set that is sized by its class: a drawing from the shared set, or one path of the set's own. Either
|
|
4
|
+
* way the frame (grid, caps, colour, line weight) is the shared set's, so the two cannot differ in weight.
|
|
5
|
+
*/
|
|
6
|
+
export declare function OutlineIcon({ className, drawing }: {
|
|
7
|
+
className: string;
|
|
8
|
+
drawing: string | IconDrawing;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, iconFrame } from "@surfaces-ui/icons";
|
|
3
|
+
/**
|
|
4
|
+
* One icon of a set that is sized by its class: a drawing from the shared set, or one path of the set's own. Either
|
|
5
|
+
* way the frame (grid, caps, colour, line weight) is the shared set's, so the two cannot differ in weight.
|
|
6
|
+
*/
|
|
7
|
+
export function OutlineIcon({ className, drawing }) {
|
|
8
|
+
if (typeof drawing !== "string")
|
|
9
|
+
return _jsx(Icon, { icon: drawing, className: className, width: undefined, height: undefined });
|
|
10
|
+
return (_jsx("svg", { className: className, ...iconFrame, "aria-hidden": "true", children: _jsx("path", { d: drawing }) }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=OutlineIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutlineIcon.js","sourceRoot":"","sources":["../../src/controls/OutlineIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAoB,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAwD;IACtG,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAI,CAAC;IAC3H,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,KAAM,SAAS,iBAAc,MAAM,YAC1D,eAAM,CAAC,EAAE,OAAO,GAAI,GAChB,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { Icon, type IconDrawing, iconFrame } from \"@surfaces-ui/icons\";\n\n/**\n * One icon of a set that is sized by its class: a drawing from the shared set, or one path of the set's own. Either\n * way the frame (grid, caps, colour, line weight) is the shared set's, so the two cannot differ in weight.\n */\nexport function OutlineIcon({ className, drawing }: { className: string; drawing: string | IconDrawing }) {\n if (typeof drawing !== \"string\") return <Icon icon={drawing} className={className} width={undefined} height={undefined} />;\n return (\n <svg className={className} {...iconFrame} aria-hidden=\"true\">\n <path d={drawing} />\n </svg>\n );\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface ErrorPageProps {
|
|
3
|
+
/** What happened, short: "We can't find this report". */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Why, as far as it may be said, and what can be done. Never an engine's or a server's own text. */
|
|
6
|
+
message: string;
|
|
7
|
+
/** A short code above the title, such as "404". */
|
|
8
|
+
code?: string;
|
|
9
|
+
/** The ways on, the one to take first. */
|
|
10
|
+
actions?: {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[];
|
|
14
|
+
onAction?(id: string): void;
|
|
15
|
+
/** A picture above the words: the host's own mark or drawing. Decoration, hidden from assistive technology. */
|
|
16
|
+
picture?: ReactNode;
|
|
17
|
+
/** The title's heading level. Default 1. */
|
|
18
|
+
level?: 1 | 2 | 3;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What is shown in place of a page that could not be: not found, no longer shared, the server not answering, a failure
|
|
23
|
+
* to draw. It says what happened and the way on. The words are an alert, so they are read out when it appears. It is
|
|
24
|
+
* not a landmark: put it in the page's `main`. For "not found", say the same whether or not the thing exists for
|
|
25
|
+
* someone else, so the page does not tell.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ErrorPage({ title, message, code, actions, onAction, picture, level, className }: ErrorPageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* What is shown in place of a page that could not be: not found, no longer shared, the server not answering, a failure
|
|
4
|
+
* to draw. It says what happened and the way on. The words are an alert, so they are read out when it appears. It is
|
|
5
|
+
* not a landmark: put it in the page's `main`. For "not found", say the same whether or not the thing exists for
|
|
6
|
+
* someone else, so the page does not tell.
|
|
7
|
+
*/
|
|
8
|
+
export function ErrorPage({ title, message, code, actions = [], onAction, picture, level = 1, className }) {
|
|
9
|
+
const Title = `h${level}`;
|
|
10
|
+
return (_jsxs("div", { className: ["sf-error-page", className].filter(Boolean).join(" "), children: [picture && (_jsx("span", { className: "sf-error-page-picture", "aria-hidden": "true", children: picture })), _jsxs("div", { role: "alert", className: "sf-error-page-words", children: [code && _jsx("p", { className: "sf-error-page-code", children: code }), _jsx(Title, { children: title }), _jsx("p", { children: message })] }), actions.length > 0 && (_jsx("div", { className: "sf-error-page-actions", children: actions.map((action, i) => (_jsx("button", { type: "button", className: "sf-button", "data-variant": i === 0 ? "primary" : undefined, onClick: () => onAction?.(action.id), children: action.label }, action.id))) }))] }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ErrorPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","sourceRoot":"","sources":["../../src/feedback/ErrorPage.tsx"],"names":[],"mappings":";AAmBA;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,EAAkB;IACvH,MAAM,KAAK,GAAG,IAAI,KAAK,EAAwB,CAAC;IAChD,OAAO,CACL,eAAK,SAAS,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aACnE,OAAO,IAAI,CACV,eAAM,SAAS,EAAC,uBAAuB,iBAAa,MAAM,YACvD,OAAO,GACH,CACR,EACD,eAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,qBAAqB,aAC9C,IAAI,IAAI,YAAG,SAAS,EAAC,oBAAoB,YAAE,IAAI,GAAK,EACrD,KAAC,KAAK,cAAE,KAAK,GAAS,EACtB,sBAAI,OAAO,GAAK,IACZ,EACL,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,cAAK,SAAS,EAAC,uBAAuB,YACnC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAC1B,iBAAwB,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,WAAW,kBAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,YAC5I,MAAM,CAAC,KAAK,IADF,MAAM,CAAC,EAAE,CAEb,CACV,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\n\nexport interface ErrorPageProps {\n /** What happened, short: \"We can't find this report\". */\n title: string;\n /** Why, as far as it may be said, and what can be done. Never an engine's or a server's own text. */\n message: string;\n /** A short code above the title, such as \"404\". */\n code?: string;\n /** The ways on, the one to take first. */\n actions?: { id: string; label: string }[];\n onAction?(id: string): void;\n /** A picture above the words: the host's own mark or drawing. Decoration, hidden from assistive technology. */\n picture?: ReactNode;\n /** The title's heading level. Default 1. */\n level?: 1 | 2 | 3;\n className?: string;\n}\n\n/**\n * What is shown in place of a page that could not be: not found, no longer shared, the server not answering, a failure\n * to draw. It says what happened and the way on. The words are an alert, so they are read out when it appears. It is\n * not a landmark: put it in the page's `main`. For \"not found\", say the same whether or not the thing exists for\n * someone else, so the page does not tell.\n */\nexport function ErrorPage({ title, message, code, actions = [], onAction, picture, level = 1, className }: ErrorPageProps) {\n const Title = `h${level}` as \"h1\" | \"h2\" | \"h3\";\n return (\n <div className={[\"sf-error-page\", className].filter(Boolean).join(\" \")}>\n {picture && (\n <span className=\"sf-error-page-picture\" aria-hidden=\"true\">\n {picture}\n </span>\n )}\n <div role=\"alert\" className=\"sf-error-page-words\">\n {code && <p className=\"sf-error-page-code\">{code}</p>}\n <Title>{title}</Title>\n <p>{message}</p>\n </div>\n {actions.length > 0 && (\n <div className=\"sf-error-page-actions\">\n {actions.map((action, i) => (\n <button key={action.id} type=\"button\" className=\"sf-button\" data-variant={i === 0 ? \"primary\" : undefined} onClick={() => onAction?.(action.id)}>\n {action.label}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n"]}
|