@nxgt/material 3.39.0 → 3.42.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/CHANGELOG.md +18 -0
- package/README.md +4 -4
- package/dist/{async-slice-BtUexP2l.js → async-slice-Dj0tAKRI.js} +2 -2
- package/dist/{button-CCAYSsgh.js → button-CTsT_LqL.js} +1 -1
- package/dist/charts.js +1733 -1364
- package/dist/{chip-Corr637n.js → chip-DP7EyhtT.js} +1 -1
- package/dist/{code-editor-B8_ny_jT.js → code-editor-BWn0AXBf.js} +4 -4
- package/dist/code-editor.js +4 -4
- package/dist/{code-language-items-1E5Qmfzb.js → code-language-items-CCRuLYpA.js} +2 -2
- package/dist/components/components.css +1 -0
- package/dist/components/ui/widgets/native-charts/native-charts-reference.css +102 -0
- package/dist/{components-CTKlqX8g.js → components-g8mWYJE8.js} +10896 -10827
- package/dist/components.js +17 -17
- package/dist/{dialog-DGlnqBbX.js → dialog-uQld1gKm.js} +1 -1
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-B-buMTGc.js → dropdown-menu-BA70o7HC.js} +1 -1
- package/dist/editor.js +529 -529
- package/dist/{empty-state-DKgPt475.js → empty-state-BzwyRX5J.js} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{i18n-provider-Bc7bdIRW.js → i18n-provider-DkeMr5bw.js} +1 -1
- package/dist/i18n.js +5 -5
- package/dist/{icon-badge-BzLsPW3c.js → icon-badge-D_z5BGbc.js} +1 -1
- package/dist/lib/charts/index.d.ts +3 -1
- package/dist/lib/components/ui/collections/server-table/bulk-action-targets.d.ts +18 -0
- package/dist/lib/components/ui/collections/server-table/bulk-action.d.ts +50 -3
- package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-buttons.d.ts +5 -3
- package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-focus.d.ts +31 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-more.d.ts +24 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-notice.d.ts +16 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-bulk-texts.d.ts +9 -0
- package/dist/lib/components/ui/collections/server-table/server-table.d.ts +1 -1
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/selection/autocomplete/autocomplete-form-field.d.ts +5 -2
- package/dist/lib/components/ui/selection/autocomplete/autocomplete-text-rules.d.ts +20 -0
- package/dist/lib/components/ui/selection/autocomplete/autocomplete.d.ts +1 -1
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-chip-input.d.ts +13 -0
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-chips.d.ts +7 -1
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-text-input.d.ts +15 -0
- package/dist/lib/components/ui/selection/autocomplete/types.d.ts +15 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-handlers.d.ts +10 -3
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete.d.ts +6 -1
- package/dist/lib/components/ui/selection/combobox/combobox-input.d.ts +3 -1
- package/dist/lib/components/ui/widgets/native-charts/core/point-tones.d.ts +17 -0
- package/dist/lib/components/ui/widgets/native-charts/core/reference-text.d.ts +30 -0
- package/dist/lib/components/ui/widgets/native-charts/core/reference.d.ts +45 -0
- package/dist/lib/components/ui/widgets/native-charts/core/summary.d.ts +3 -0
- package/dist/lib/components/ui/widgets/native-charts/core/table.d.ts +7 -0
- package/dist/lib/components/ui/widgets/native-charts/core/types.d.ts +25 -0
- package/dist/lib/components/ui/widgets/native-charts/hooks/chart-model-types.d.ts +18 -1
- package/dist/lib/components/ui/widgets/native-charts/hooks/model-parts.d.ts +3 -0
- package/dist/lib/components/ui/widgets/native-charts/hooks/model-series.d.ts +3 -0
- package/dist/lib/components/ui/widgets/native-charts/hooks/model-tones.d.ts +19 -0
- package/dist/lib/components/ui/widgets/native-charts/hooks/use-chart-model.d.ts +3 -3
- package/dist/lib/components/ui/widgets/native-charts/index.d.ts +1 -1
- package/dist/lib/components/ui/widgets/native-charts/line-chart/line-chart-types.d.ts +26 -1
- package/dist/lib/components/ui/widgets/native-charts/line-chart/line-geometry.d.ts +4 -0
- package/dist/lib/components/ui/widgets/native-charts/line-chart/partials/reference-marks.d.ts +17 -0
- package/dist/lib/components/ui/widgets/native-charts/line-chart/partials/tone-points.d.ts +11 -0
- package/dist/lib/components/ui/widgets/native-charts/partials/chart-tooltip.d.ts +3 -0
- package/dist/lib/i18n/resources/en/en.d.ts +22 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +22 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +22 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +22 -0
- package/dist/lib/i18n/resources/resources.d.ts +44 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +1 -1
- package/dist/main.js +23 -23
- package/dist/map.js +4 -4
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/print.js +2 -2
- package/dist/{public-CNlIuQOj.js → public-ib0sK0Hr.js} +6 -6
- package/dist/{rich-code-block-Jo0OLy0J.js → rich-code-block-D_PTTZWQ.js} +4 -4
- package/dist/{sortable-provider-DgIo378H.js → sortable-provider-CrS51nKB.js} +1 -1
- package/dist/{spinner-BTR8rVN9.js → spinner-DLd_IHev.js} +1 -1
- package/dist/{stored-language-Bbwcy-Pv.js → stored-language-B5SMR-W2.js} +44 -0
- package/dist/theme-picker.js +2 -2
- package/dist/{theme-toggle-DMZ_3HiG.js → theme-toggle-wJYmnwgu.js} +1 -1
- package/dist/{toolbar-items-D3SPTgXE.js → toolbar-items-BLjrk8uU.js} +2 -2
- package/dist/{translate-material-CRF13PON.js → translate-material-BYRDtSEk.js} +2 -2
- package/dist/{translator-D7AVZCfQ.js → translator-C-_M57ZA.js} +1 -1
- package/dist/{use-chat-composer-D3kvp8Fw.js → use-chat-composer-D_hfO99B.js} +2647 -2474
- package/dist/{use-heading-spy-uyhOQV2O.js → use-heading-spy-wElRpO2G.js} +1 -1
- package/dist/{use-material-translation-kISeB-fY.js → use-material-translation-CFF73jk5.js} +2 -2
- package/docs/README.md +1 -1
- package/docs/components/data-table-filter-and-lists.md +59 -4
- package/docs/components/rich-widgets.md +6 -0
- package/docs/components/selection-and-choice.md +47 -1
- package/docs/guides/charts.md +78 -2
- package/docs/guides/i18n.md +1 -1
- package/docs/roadmap.md +7 -0
- package/lib/components/components.css +1 -0
- package/lib/components/ui/widgets/native-charts/native-charts-reference.css +102 -0
- package/package.json +1 -1
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
1
|
+
import { Dispatch, FocusEvent, SetStateAction } from 'react';
|
|
2
2
|
import { ChangeEventDetails } from '../combobox/combobox.js';
|
|
3
3
|
import { AutocompleteOption, AutocompleteProps } from './types.js';
|
|
4
4
|
type State<T> = {
|
|
5
5
|
setQuery: Dispatch<SetStateAction<string>>;
|
|
6
6
|
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
7
|
+
/** `display="text"`: the input shows what is typed, not the label. */
|
|
8
|
+
text: boolean;
|
|
9
|
+
editing: boolean;
|
|
10
|
+
setEditing: Dispatch<SetStateAction<boolean>>;
|
|
11
|
+
query: string;
|
|
7
12
|
getOptionValue: (option: T) => string;
|
|
8
13
|
/** Keeps the picked options, for their chips once the list moves on. */
|
|
9
14
|
remember: (options: T[]) => void;
|
|
10
15
|
};
|
|
11
16
|
/** What the Combobox and the chips call back: a pick, a removal, typing. */
|
|
12
|
-
export declare function useAutocompleteHandlers<T extends AutocompleteOption>(props: AutocompleteProps<T>, { setQuery, setOpen, getOptionValue: readValue, remember }: State<T>): {
|
|
17
|
+
export declare function useAutocompleteHandlers<T extends AutocompleteOption>(props: AutocompleteProps<T>, { setQuery, setOpen, text, editing, setEditing, query, getOptionValue: readValue, remember, }: State<T>): {
|
|
13
18
|
handleRemove: (value: string) => void;
|
|
14
|
-
handleValueChange: (value: any) => void;
|
|
19
|
+
handleValueChange: (value: any, details?: ChangeEventDetails) => void;
|
|
15
20
|
handleInputValueChange: (value: string, eventDetails: ChangeEventDetails) => void;
|
|
21
|
+
handleOpenChange: (open: boolean, details: ChangeEventDetails) => void;
|
|
22
|
+
handleFieldBlur: (event: FocusEvent<HTMLElement>) => void;
|
|
16
23
|
};
|
|
17
24
|
export {};
|
|
@@ -6,8 +6,10 @@ type Readers<T> = {
|
|
|
6
6
|
/** Autocomplete's state and callbacks; the component only lays them out. */
|
|
7
7
|
export declare function useAutocomplete<T extends AutocompleteOption>(props: AutocompleteProps<T>, readers: Readers<T>): {
|
|
8
8
|
handleRemove: (value: string) => void;
|
|
9
|
-
handleValueChange: (value: any) => void;
|
|
9
|
+
handleValueChange: (value: any, details?: import('../index.js').ChangeEventDetails) => void;
|
|
10
10
|
handleInputValueChange: (value: string, eventDetails: import('../index.js').ChangeEventDetails) => void;
|
|
11
|
+
handleOpenChange: (open: boolean, details: import('../index.js').ChangeEventDetails) => void;
|
|
12
|
+
handleFieldBlur: (event: import('react').FocusEvent<HTMLElement>) => void;
|
|
11
13
|
fullOptions: T[];
|
|
12
14
|
selectable: T[];
|
|
13
15
|
showAddButton: boolean;
|
|
@@ -25,5 +27,8 @@ export declare function useAutocomplete<T extends AutocompleteOption>(props: Aut
|
|
|
25
27
|
emptyText: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null;
|
|
26
28
|
announcement: string | number | bigint | true | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null;
|
|
27
29
|
};
|
|
30
|
+
text: boolean;
|
|
31
|
+
selected: T | null;
|
|
32
|
+
inputValue: string;
|
|
28
33
|
};
|
|
29
34
|
export {};
|
|
@@ -13,7 +13,9 @@ export type ComboboxInputSize = FieldSize;
|
|
|
13
13
|
* `leading`: a flag, an avatar or an icon before the input.
|
|
14
14
|
* `suffix`: muted text after it ("GMT+2"), before the clear button.
|
|
15
15
|
*/
|
|
16
|
-
export declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, size, leading, suffix, labelId, ...props }: Omit<ComboboxPrimitive.Input.Props, 'size'> & {
|
|
16
|
+
export declare function ComboboxInput({ className, children, disabled, showTrigger, showClear, size, leading, suffix, labelId, anchorRef, ...props }: Omit<ComboboxPrimitive.Input.Props, 'size'> & {
|
|
17
|
+
/** Also measured by a list that hangs under the box (Autocomplete's Drawer room). */
|
|
18
|
+
anchorRef?: React.Ref<HTMLDivElement>;
|
|
17
19
|
/** The id of the field's label: describes the clear and chevron buttons. */
|
|
18
20
|
labelId?: string;
|
|
19
21
|
showTrigger?: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Tone } from '../../../tones.js';
|
|
2
|
+
import { ChartTranslate } from './translate.js';
|
|
3
|
+
/** A point's tone and the word that names it: the tooltip, the live status, the summary and the table read the word. */
|
|
4
|
+
export type ToneMark = {
|
|
5
|
+
tone: Tone;
|
|
6
|
+
word: string;
|
|
7
|
+
};
|
|
8
|
+
/** Per-tone words an application gives (its own language, its own domain), by tone. */
|
|
9
|
+
export type ToneWords = Partial<Record<string, string>>;
|
|
10
|
+
/**
|
|
11
|
+
* The word for a tone: the caller's, else the library's neutral one in the
|
|
12
|
+
* provider's language (`material.charts.tone.*`), else the tone's own name
|
|
13
|
+
* (an app's tone).
|
|
14
|
+
*/
|
|
15
|
+
export declare function toneWord(t: ChartTranslate, tone: Tone, words?: ToneWords): string;
|
|
16
|
+
/** The marks of a series counted by word, in order of first appearance: `[['High', 2], ['Critical', 1]]`. */
|
|
17
|
+
export declare function countWords(marks: readonly (ToneMark | null | undefined)[]): [string, number][];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ToneMark } from './point-tones.js';
|
|
2
|
+
import { ChartTranslate } from './translate.js';
|
|
3
|
+
import { ChartBand, ChartThreshold } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The words of a chart's reference bands, thresholds and toned points, for
|
|
6
|
+
* the summary and the "View data" notes. Pure: the translator comes in as an
|
|
7
|
+
* argument.
|
|
8
|
+
*/
|
|
9
|
+
export type ReferenceSeries = {
|
|
10
|
+
label: string;
|
|
11
|
+
values: readonly (number | null | undefined)[];
|
|
12
|
+
/** The tone mark of each row, null where there is none. */
|
|
13
|
+
tones?: readonly (ToneMark | null)[];
|
|
14
|
+
};
|
|
15
|
+
/** One line per band ("Normal range: 40 to 60") then one per threshold ("High: 70"): the notes under the data table. */
|
|
16
|
+
export declare function referenceNotes(t: ChartTranslate, input: {
|
|
17
|
+
bands: readonly ChartBand[];
|
|
18
|
+
thresholds: readonly ChartThreshold[];
|
|
19
|
+
format: (value: number) => string;
|
|
20
|
+
}): string[];
|
|
21
|
+
/**
|
|
22
|
+
* The summary sentences: the ranges and the lines, then for each series how
|
|
23
|
+
* many values lie outside each band, then how many points carry each tone.
|
|
24
|
+
*/
|
|
25
|
+
export declare function referenceSummary(t: ChartTranslate, input: {
|
|
26
|
+
bands: readonly ChartBand[];
|
|
27
|
+
thresholds: readonly ChartThreshold[];
|
|
28
|
+
series: readonly ReferenceSeries[];
|
|
29
|
+
format: (value: number) => string;
|
|
30
|
+
}): string[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ChartBand, ChartThreshold } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The maths of a line chart's reference bands and threshold lines: they are
|
|
4
|
+
* cleaned once (a range given backwards, a value that is not a number), fed
|
|
5
|
+
* to the value domain so the chart shows them, clipped to the domain when an
|
|
6
|
+
* axis pins it, and counted against the data for the summary.
|
|
7
|
+
*/
|
|
8
|
+
/** A value-axis span, low then high. */
|
|
9
|
+
export type Domain = readonly [number, number];
|
|
10
|
+
/** The bands with a finite range, each as `from <= to`; the rest are dropped. */
|
|
11
|
+
export declare function normalizeBands(bands: readonly ChartBand[] | undefined): ChartBand[];
|
|
12
|
+
/** The thresholds with a finite value. */
|
|
13
|
+
export declare function normalizeThresholds(thresholds: readonly ChartThreshold[] | undefined): ChartThreshold[];
|
|
14
|
+
/** Every value a band or a threshold marks: the value domain grows to hold them. */
|
|
15
|
+
export declare function referenceValues(bands: readonly ChartBand[], thresholds: readonly ChartThreshold[]): number[];
|
|
16
|
+
/** The part of `band` inside `domain`; null when none of it is, or it has no height. */
|
|
17
|
+
export declare function clipBand(band: Pick<ChartBand, 'from' | 'to'>, domain: Domain): {
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
} | null;
|
|
21
|
+
/** A band's box on the plot, `y` mapping a value to a pixel: its top and height, clipped to the domain; null when it is out of view. */
|
|
22
|
+
export declare function bandBox(band: Pick<ChartBand, 'from' | 'to'>, domain: Domain, y: (value: number) => number): {
|
|
23
|
+
top: number;
|
|
24
|
+
height: number;
|
|
25
|
+
} | null;
|
|
26
|
+
/** Where a threshold's line falls; null when its value is outside the domain. */
|
|
27
|
+
export declare function thresholdAt(value: number, domain: Domain, y: (value: number) => number): number | null;
|
|
28
|
+
/** The baseline of a band's label: inside the band under its top edge, or above a band too thin to hold it. */
|
|
29
|
+
export declare function bandLabelBaseline(top: number, height: number): number;
|
|
30
|
+
/** The baseline of a threshold's label: above its line, or under it at the top of the plot. */
|
|
31
|
+
export declare function thresholdLabelBaseline(lineY: number): number;
|
|
32
|
+
/** How many of `values` lie outside `band` (a missing value is not counted), and how many there are. */
|
|
33
|
+
export declare function outsideBand(values: readonly (number | null | undefined)[], band: Pick<ChartBand, 'from' | 'to'>): {
|
|
34
|
+
outside: number;
|
|
35
|
+
total: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* How a label sits at a plot's physical `edge` (the plot is drawn left to
|
|
39
|
+
* right whatever the page): a label in a right-to-left script is set `rtl`,
|
|
40
|
+
* and the anchor that grows it inward from that edge flips with it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function labelFlow(label: string, edge: 'left' | 'right'): {
|
|
43
|
+
direction: 'ltr' | 'rtl';
|
|
44
|
+
textAnchor: 'start' | 'end';
|
|
45
|
+
};
|
|
@@ -20,6 +20,8 @@ export type SummaryInput = {
|
|
|
20
20
|
series: readonly SummarySeries[];
|
|
21
21
|
/** The hidden series' labels. */
|
|
22
22
|
hidden?: readonly string[];
|
|
23
|
+
/** Sentences a chart adds after its series' (a line chart's bands, thresholds and toned points). */
|
|
24
|
+
extra?: readonly string[];
|
|
23
25
|
};
|
|
24
26
|
/** The chart kind's name ("line chart"), also the plot's `aria-roledescription`. */
|
|
25
27
|
export declare function kindName(t: ChartTranslate, kind: ChartKind): string;
|
|
@@ -30,6 +32,7 @@ export declare function summarize(t: ChartTranslate, input: SummaryInput): strin
|
|
|
30
32
|
export declare function pointStatus(t: ChartTranslate, label: string, values: readonly {
|
|
31
33
|
series: string;
|
|
32
34
|
value: string;
|
|
35
|
+
tone?: string;
|
|
33
36
|
}[]): string;
|
|
34
37
|
/** The summary a chart shows: its `summary` prop (a text, or a function of the generated one), else the generated one. */
|
|
35
38
|
export declare function applySummary(summary: string | ((auto: string) => string) | undefined, auto: string): string;
|
|
@@ -15,12 +15,19 @@ export type ChartTableModel = {
|
|
|
15
15
|
corner: string;
|
|
16
16
|
columns: TableColumn[];
|
|
17
17
|
rows: TableRowModel[];
|
|
18
|
+
/** Lines read under the table (a line chart's reference bands and thresholds). */
|
|
19
|
+
notes?: string[];
|
|
18
20
|
};
|
|
19
21
|
export type TableSeries = {
|
|
20
22
|
key: string;
|
|
21
23
|
label: string;
|
|
22
24
|
values: readonly (number | null | undefined)[];
|
|
23
25
|
format: (value: number) => string;
|
|
26
|
+
/** Adds a column after the series' own: its header, and the word of each row (null for none). */
|
|
27
|
+
tone?: {
|
|
28
|
+
label: string;
|
|
29
|
+
words: readonly (string | null)[];
|
|
30
|
+
};
|
|
24
31
|
};
|
|
25
32
|
/**
|
|
26
33
|
* Rows of `labels` × `series`. Hidden series stay out: the table shows what
|
|
@@ -95,6 +95,31 @@ export interface ChartPoint {
|
|
|
95
95
|
* the colour's ink (lines, points and swatches in the ink).
|
|
96
96
|
*/
|
|
97
97
|
export type ChartPalette = 'default' | 'soft';
|
|
98
|
+
/**
|
|
99
|
+
* A shaded range of the value axis, drawn behind the lines: a normal range,
|
|
100
|
+
* a target zone. Its `label` is drawn in the band and listed in the summary
|
|
101
|
+
* and in "View data"; the shade is decorative, the label carries the meaning.
|
|
102
|
+
*/
|
|
103
|
+
export interface ChartBand {
|
|
104
|
+
/** One end of the range, in the value axis' units (either order). */
|
|
105
|
+
from: number;
|
|
106
|
+
/** The other end. */
|
|
107
|
+
to: number;
|
|
108
|
+
/** Names the range: drawn in it, read by the summary and the table. */
|
|
109
|
+
label: string;
|
|
110
|
+
/** Tints the band and its label in the tone; default a neutral wash. */
|
|
111
|
+
tone?: Tone;
|
|
112
|
+
}
|
|
113
|
+
/** A horizontal line at a value, with a direct label at its end. */
|
|
114
|
+
export interface ChartThreshold {
|
|
115
|
+
value: number;
|
|
116
|
+
/** Names the line: drawn at its end, read by the summary and the table. */
|
|
117
|
+
label: string;
|
|
118
|
+
/** Draws the line and its label in the tone's colour; default the axis colour. */
|
|
119
|
+
tone?: Tone;
|
|
120
|
+
/** Dashed (default) or, with `false`, solid. */
|
|
121
|
+
dash?: boolean;
|
|
122
|
+
}
|
|
98
123
|
/** What every chart accepts. */
|
|
99
124
|
export interface ChartBaseProps {
|
|
100
125
|
/** The card's title, and the chart's accessible name. */
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Tone } from '../../../tones.js';
|
|
1
2
|
import { ResolvedSeries } from '../core/colors.js';
|
|
2
3
|
import { SeriesAxis } from '../core/combo-axes.js';
|
|
4
|
+
import { ToneMark, ToneWords } from '../core/point-tones.js';
|
|
3
5
|
import { ChartTableModel } from '../core/table.js';
|
|
4
|
-
import { ChartAxis, ChartBaseProps, ChartPoint, ChartRow, ChartSeries, ChartXAxis, RowKey } from '../core/types.js';
|
|
6
|
+
import { ChartAxis, ChartBand, ChartBaseProps, ChartPoint, ChartRow, ChartSeries, ChartThreshold, ChartXAxis, RowKey } from '../core/types.js';
|
|
5
7
|
import { LegendItem } from '../partials/chart-legend.js';
|
|
6
8
|
import { ModelSeries } from './model-series.js';
|
|
7
9
|
import { useChartSize } from './use-chart-size.js';
|
|
@@ -26,7 +28,20 @@ export type ChartModelProps<T extends object = ChartRow> = ChartBaseProps & {
|
|
|
26
28
|
/** The header of the View data table's category column (the x values; the heat map's row labels). Defaults, on the line, area and bar charts, to the x axis label when set, else a translated "Category"; the radar and heat map charts have no x axis label, so they always read "Category" unless this is set. */
|
|
27
29
|
categoryLabel?: string;
|
|
28
30
|
};
|
|
31
|
+
/** What a chart reads against its data: ranges and lines on the value axis, and a tone per point. */
|
|
32
|
+
export type ChartReferenceProps = {
|
|
33
|
+
bands?: ChartBand[];
|
|
34
|
+
thresholds?: ChartThreshold[];
|
|
35
|
+
pointTone?: (point: ChartPoint, series: ChartSeries) => Tone | undefined;
|
|
36
|
+
toneLabels?: ToneWords;
|
|
37
|
+
};
|
|
38
|
+
export type { ToneMark };
|
|
29
39
|
export type ChartModel = {
|
|
40
|
+
/** The bands and thresholds, cleaned (`from <= to`, finite). */
|
|
41
|
+
refs: {
|
|
42
|
+
bands: ChartBand[];
|
|
43
|
+
thresholds: ChartThreshold[];
|
|
44
|
+
};
|
|
30
45
|
size: ReturnType<typeof useChartSize<HTMLDivElement>>;
|
|
31
46
|
/** Every series, resolved (colour, shape, dash, position). */
|
|
32
47
|
series: ResolvedSeries[];
|
|
@@ -63,4 +78,6 @@ export type ChartModelOptions = {
|
|
|
63
78
|
};
|
|
64
79
|
/** Names the axis each series reads and formats it by that axis (two-axis charts). Keep it stable (memoized). */
|
|
65
80
|
axes?: (series: ChartSeries) => SeriesAxis;
|
|
81
|
+
/** A line chart's bands, thresholds and point tones. Keep the arrays and the function stable (memoized): they key the summary and the table. */
|
|
82
|
+
reference?: ChartReferenceProps;
|
|
66
83
|
};
|
|
@@ -14,6 +14,7 @@ export declare function summaryText(t: ChartTranslate, input: {
|
|
|
14
14
|
series: readonly ResolvedSeries[];
|
|
15
15
|
hidden: readonly string[];
|
|
16
16
|
summary: Parameters<typeof applySummary>[0];
|
|
17
|
+
extra?: readonly string[];
|
|
17
18
|
}): string;
|
|
18
19
|
/** What the live status reads for row `index`; null when none is active. */
|
|
19
20
|
export declare function statusText(t: ChartTranslate, labels: readonly string[], shown: readonly ModelSeries[], index: number | null): string | null;
|
|
@@ -26,6 +27,8 @@ export declare function viewTable(t: ChartTranslate, input: {
|
|
|
26
27
|
shown: readonly ModelSeries[];
|
|
27
28
|
categoryLabel?: string;
|
|
28
29
|
axisLabel?: string;
|
|
30
|
+
/** Lines read under the table: the reference bands and thresholds. */
|
|
31
|
+
notes?: string[];
|
|
29
32
|
}): ChartTableModel;
|
|
30
33
|
/** The point at row `index` of the rows shown on the series at `position`; `offset` (a zoomed window's first row) makes its `index` the row of the full data. */
|
|
31
34
|
export declare function pointAt(input: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PaintAttributes, ResolvedSeries } from '../core/colors.js';
|
|
2
2
|
import { SeriesAxis } from '../core/combo-axes.js';
|
|
3
|
+
import { ToneMark } from '../core/point-tones.js';
|
|
3
4
|
import { ChartAxis, ChartRow, ChartSeries } from '../core/types.js';
|
|
4
5
|
/** A visible series, ready to draw: its paint, values and formatter. */
|
|
5
6
|
export type ModelSeries = ResolvedSeries & {
|
|
@@ -10,6 +11,8 @@ export type ModelSeries = ResolvedSeries & {
|
|
|
10
11
|
tag?: string;
|
|
11
12
|
/** The label of the axis the series reads. */
|
|
12
13
|
axisLabel?: string;
|
|
14
|
+
/** The tone of each row's point, null for none (`pointTone`); unset when no point of the series has one. */
|
|
15
|
+
tones?: (ToneMark | null)[];
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
18
|
* The visible series with their values and formatters. `axes` names the axis
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ToneWords } from '../core/point-tones.js';
|
|
2
|
+
import { ChartTranslate } from '../core/translate.js';
|
|
3
|
+
import { ChartRow } from '../core/types.js';
|
|
4
|
+
import { ChartReferenceProps } from './chart-model-types.js';
|
|
5
|
+
import { ModelSeries } from './model-series.js';
|
|
6
|
+
/**
|
|
7
|
+
* Asks `pointTone` for the tone of every value of every visible series, and
|
|
8
|
+
* gives each series that has any the marks, with their words (`toneLabels`,
|
|
9
|
+
* else the library's neutral ones). The point it is given is the one
|
|
10
|
+
* `onPointClick` gets: `index` is the row of the full data, even in a zoomed window.
|
|
11
|
+
*/
|
|
12
|
+
export declare function withPointTones(t: ChartTranslate, input: {
|
|
13
|
+
shown: ModelSeries[];
|
|
14
|
+
labels: readonly string[];
|
|
15
|
+
data: readonly ChartRow[];
|
|
16
|
+
offset?: number;
|
|
17
|
+
pointTone: NonNullable<ChartReferenceProps['pointTone']>;
|
|
18
|
+
words?: ToneWords;
|
|
19
|
+
}): ModelSeries[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartKind } from '../core/summary.js';
|
|
2
|
-
import { ChartModel, ChartModelOptions, ChartModelProps } from './chart-model-types.js';
|
|
2
|
+
import { ChartModel, ChartModelOptions, ChartModelProps, ChartReferenceProps } from './chart-model-types.js';
|
|
3
3
|
import { ModelSeries } from './model-series.js';
|
|
4
|
-
export type { ChartModel, ChartModelOptions, ChartModelProps, ModelSeries };
|
|
4
|
+
export type { ChartModel, ChartModelOptions, ChartModelProps, ChartReferenceProps, ModelSeries, };
|
|
5
5
|
/**
|
|
6
6
|
* Everything a chart computes besides its SVG: series, visibility, labels,
|
|
7
7
|
* the keyboard point, summary, status, legend and table. A chart calls it,
|
|
@@ -10,4 +10,4 @@ export type { ChartModel, ChartModelOptions, ChartModelProps, ModelSeries };
|
|
|
10
10
|
* parts are memoized on the data, the series, the hidden ones and the
|
|
11
11
|
* language, so a hover only recomputes the status.
|
|
12
12
|
*/
|
|
13
|
-
export declare function useChartModel(props: ChartModelProps, kind: ChartKind, { keyMap, axes, span }?: ChartModelOptions): ChartModel;
|
|
13
|
+
export declare function useChartModel(props: ChartModelProps, kind: ChartKind, { keyMap, axes, span, reference }?: ChartModelOptions): ChartModel;
|
|
@@ -4,7 +4,7 @@ export type { BarChartProps, BarLayout, BarOrientation, } from './bar-chart/bar-
|
|
|
4
4
|
export { ComboChart } from './combo-chart/combo-chart.js';
|
|
5
5
|
export type { ComboChartProps } from './combo-chart/combo-chart-types.js';
|
|
6
6
|
export type { ChartRange, ChartRangeProps, ChartScrollOptions, ChartZoomOptions, } from './core/range-types.js';
|
|
7
|
-
export type { ChartAxis, ChartBaseProps, ChartColor, ChartPalette, ChartPoint, ChartRow, ChartSeries, ChartShape, ChartSlice, ChartValue, ChartXAxis, ComboSeries, RowKey, ScatterPoint, ScatterSeries, } from './core/types.js';
|
|
7
|
+
export type { ChartAxis, ChartBand, ChartBaseProps, ChartColor, ChartPalette, ChartPoint, ChartRow, ChartSeries, ChartShape, ChartSlice, ChartThreshold, ChartValue, ChartXAxis, ComboSeries, RowKey, ScatterPoint, ScatterSeries, } from './core/types.js';
|
|
8
8
|
export { FunnelChart } from './funnel-chart/funnel-chart.js';
|
|
9
9
|
export type { FunnelChartProps } from './funnel-chart/funnel-chart-types.js';
|
|
10
10
|
export { Gauge } from './gauge/gauge.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Tone } from '../../../tones.js';
|
|
1
2
|
import { ChartCurve } from '../core/lines.js';
|
|
3
|
+
import { ToneWords } from '../core/point-tones.js';
|
|
2
4
|
import { ChartRangeProps } from '../core/range-types.js';
|
|
3
|
-
import { ChartRow } from '../core/types.js';
|
|
5
|
+
import { ChartBand, ChartPoint, ChartRow, ChartSeries, ChartThreshold } from '../core/types.js';
|
|
4
6
|
import { ChartModelProps } from '../hooks/use-chart-model.js';
|
|
5
7
|
export type { ChartCurve };
|
|
6
8
|
/**
|
|
@@ -13,6 +15,29 @@ export type LineChartProps<T extends object = ChartRow> = ChartModelProps<T> & C
|
|
|
13
15
|
curve?: ChartCurve;
|
|
14
16
|
/** Draws a dot on every value; patterns mode draws each series' shape instead. */
|
|
15
17
|
points?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Shaded ranges of the value axis behind the lines (a normal range, a
|
|
20
|
+
* target zone), each with its label. The value axis grows to show them
|
|
21
|
+
* unless `yAxis.min` / `max` pin it (a band is then clipped); the
|
|
22
|
+
* summary says how many values fall outside each, and "View data"
|
|
23
|
+
* lists them. Keep the array stable (memoize it).
|
|
24
|
+
*/
|
|
25
|
+
bands?: ChartBand[];
|
|
26
|
+
/** Horizontal lines at a value with a label at their end, also in the summary and in "View data". Keep the array stable. */
|
|
27
|
+
thresholds?: ChartThreshold[];
|
|
28
|
+
/**
|
|
29
|
+
* The tone of a point, or undefined for none. A toned point is drawn
|
|
30
|
+
* as a ringed marker (never colour alone) and its word ("High") joins the
|
|
31
|
+
* tooltip, the live status, the summary and a tone column of "View data".
|
|
32
|
+
* It is given the point `onPointClick` gets (`index` is the row of the full
|
|
33
|
+
* data) and its series. Keep the function stable (`useCallback`).
|
|
34
|
+
*/
|
|
35
|
+
pointTone?: (point: ChartPoint, series: ChartSeries) => Tone | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The word of each tone, in your language and domain ({ error: 'High' });
|
|
38
|
+
* unset, the library's neutral word ("Error", translated).
|
|
39
|
+
*/
|
|
40
|
+
toneLabels?: ToneWords;
|
|
16
41
|
};
|
|
17
42
|
export type AreaChartProps<T extends object = ChartRow> = LineChartProps<T> & {
|
|
18
43
|
/** Stacks the series on one another; the areas are all filled. Expects values of 0 or more: a negative value is subtracted from the band below. */
|
|
@@ -23,6 +23,8 @@ export type LineGeometry = {
|
|
|
23
23
|
x: ScaleLinear<number, number>;
|
|
24
24
|
y: ScaleLinear<number, number>;
|
|
25
25
|
ticks: number[];
|
|
26
|
+
/** The value axis' span, low then high. */
|
|
27
|
+
domain: [number, number];
|
|
26
28
|
/** The x labels, cut to the room each drawn one gets, and every how many is drawn. */
|
|
27
29
|
labels: string[];
|
|
28
30
|
step: number;
|
|
@@ -37,6 +39,8 @@ export type LineGeometryInput = {
|
|
|
37
39
|
yAxis?: ChartAxis;
|
|
38
40
|
curve?: ChartCurve;
|
|
39
41
|
stacked?: boolean;
|
|
42
|
+
/** Values the domain must also hold: the bands' ends and the thresholds. */
|
|
43
|
+
extra?: readonly number[];
|
|
40
44
|
/** The y axis' formatted tick labels decide the left margin. */
|
|
41
45
|
margin: (ticks: number[]) => number;
|
|
42
46
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChartModel } from '../../hooks/use-chart-model.js';
|
|
2
|
+
import { LineGeometry } from '../line-geometry.js';
|
|
3
|
+
/**
|
|
4
|
+
* The reference bands and threshold lines, behind the series: a band is a
|
|
5
|
+
* tint across the plot (decorative: its label carries the meaning), a
|
|
6
|
+
* threshold a dashed line. Both are clipped to the value axis, so a
|
|
7
|
+
* pinned `yAxis` or a zoomed window never draws outside the plot.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ReferenceLayer({ refs, geo, }: {
|
|
10
|
+
refs: ChartModel['refs'];
|
|
11
|
+
geo: LineGeometry;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/** The labels of the bands (inside, at the plot's left) and of the thresholds (above the line, at its right end), over the series. */
|
|
14
|
+
export declare function ReferenceLabels({ refs, geo, }: {
|
|
15
|
+
refs: ChartModel['refs'];
|
|
16
|
+
geo: LineGeometry;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LineGeometry } from '../line-geometry.js';
|
|
2
|
+
/**
|
|
3
|
+
* The points a `pointTone` marks: a ring in the tone's colour round the
|
|
4
|
+
* value, never a colour change alone, with the series' shape inside in
|
|
5
|
+
* patterns mode, else a dot. Drawn over the series' own dots. The ring stays
|
|
6
|
+
* on the plot's layer: the word itself is in the tooltip, the summary and the table.
|
|
7
|
+
*/
|
|
8
|
+
export declare function TonePoints({ geo, patterns, }: {
|
|
9
|
+
geo: LineGeometry;
|
|
10
|
+
patterns?: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { PaintAttributes } from '../core/colors.js';
|
|
3
|
+
import { ToneMark } from '../core/point-tones.js';
|
|
3
4
|
/** The tooltip's drawn size, in px. */
|
|
4
5
|
export type TipSize = {
|
|
5
6
|
width: number;
|
|
@@ -12,6 +13,8 @@ export type TooltipRow = {
|
|
|
12
13
|
paint: PaintAttributes;
|
|
13
14
|
/** The axis the value belongs to, when the chart has two. */
|
|
14
15
|
note?: string;
|
|
16
|
+
/** The point's tone and its word ("High"), when it has one. */
|
|
17
|
+
tone?: ToneMark;
|
|
15
18
|
};
|
|
16
19
|
/**
|
|
17
20
|
* The tooltip's content, direction B: the x label, the first (active)
|
|
@@ -2076,6 +2076,7 @@ export declare const en: {
|
|
|
2076
2076
|
"error-hint": string;
|
|
2077
2077
|
"bulk-action": string;
|
|
2078
2078
|
"bulk-action-name": string;
|
|
2079
|
+
"bulk-max-notice": string;
|
|
2079
2080
|
"bulk-more": string;
|
|
2080
2081
|
};
|
|
2081
2082
|
"list-empty": {
|
|
@@ -2725,6 +2726,8 @@ export declare const en: {
|
|
|
2725
2726
|
"no-data": string;
|
|
2726
2727
|
loading: string;
|
|
2727
2728
|
"status-value": string;
|
|
2729
|
+
"status-value-tone": string;
|
|
2730
|
+
"table-tone": string;
|
|
2728
2731
|
"status-point": string;
|
|
2729
2732
|
"table-caption": string;
|
|
2730
2733
|
"status-slice": string;
|
|
@@ -2768,6 +2771,20 @@ export declare const en: {
|
|
|
2768
2771
|
"zoom-reset": string;
|
|
2769
2772
|
"zoom-showing": string;
|
|
2770
2773
|
"zoom-range": string;
|
|
2774
|
+
tone: {
|
|
2775
|
+
primary: string;
|
|
2776
|
+
secondary: string;
|
|
2777
|
+
tertiary: string;
|
|
2778
|
+
success: string;
|
|
2779
|
+
info: string;
|
|
2780
|
+
warning: string;
|
|
2781
|
+
error: string;
|
|
2782
|
+
neutral: string;
|
|
2783
|
+
};
|
|
2784
|
+
reference: {
|
|
2785
|
+
band: string;
|
|
2786
|
+
threshold: string;
|
|
2787
|
+
};
|
|
2771
2788
|
kind: {
|
|
2772
2789
|
line: string;
|
|
2773
2790
|
area: string;
|
|
@@ -2787,6 +2804,11 @@ export declare const en: {
|
|
|
2787
2804
|
range: string;
|
|
2788
2805
|
series: string;
|
|
2789
2806
|
hidden: string;
|
|
2807
|
+
bands: string;
|
|
2808
|
+
thresholds: string;
|
|
2809
|
+
outside: string;
|
|
2810
|
+
tones: string;
|
|
2811
|
+
"tone-count": string;
|
|
2790
2812
|
slices: string;
|
|
2791
2813
|
largest: string;
|
|
2792
2814
|
slice: string;
|
|
@@ -2066,6 +2066,7 @@ declare const _default: {
|
|
|
2066
2066
|
"error-hint": "Check your connection, then try again.",
|
|
2067
2067
|
"bulk-action": "{label} ({count})",
|
|
2068
2068
|
"bulk-action-name": "{label} {count, plural, one {# row} other {# rows}}",
|
|
2069
|
+
"bulk-max-notice": "Select {max, plural, one {# row} other {# rows}} or fewer to {label}",
|
|
2069
2070
|
"bulk-more": "More"
|
|
2070
2071
|
},
|
|
2071
2072
|
"list-empty": {
|
|
@@ -2715,6 +2716,8 @@ declare const _default: {
|
|
|
2715
2716
|
"no-data": "No data to show",
|
|
2716
2717
|
"loading": "Loading chart",
|
|
2717
2718
|
"status-value": "{series} {value}",
|
|
2719
|
+
"status-value-tone": "{series} {value} ({tone})",
|
|
2720
|
+
"table-tone": "{series} tone",
|
|
2718
2721
|
"status-point": "{label}: {values}",
|
|
2719
2722
|
"table-caption": "{title}: the data",
|
|
2720
2723
|
"status-slice": "{label}: {value}, {share}",
|
|
@@ -2758,6 +2761,20 @@ declare const _default: {
|
|
|
2758
2761
|
"zoom-reset": "Reset zoom",
|
|
2759
2762
|
"zoom-showing": "Showing {from} to {to}",
|
|
2760
2763
|
"zoom-range": "{from} to {to}",
|
|
2764
|
+
"tone": {
|
|
2765
|
+
"primary": "Primary",
|
|
2766
|
+
"secondary": "Secondary",
|
|
2767
|
+
"tertiary": "Tertiary",
|
|
2768
|
+
"success": "Success",
|
|
2769
|
+
"info": "Info",
|
|
2770
|
+
"warning": "Warning",
|
|
2771
|
+
"error": "Error",
|
|
2772
|
+
"neutral": "Neutral"
|
|
2773
|
+
},
|
|
2774
|
+
"reference": {
|
|
2775
|
+
"band": "{label}: {from} to {to}",
|
|
2776
|
+
"threshold": "{label}: {value}"
|
|
2777
|
+
},
|
|
2761
2778
|
"kind": {
|
|
2762
2779
|
"line": "line chart",
|
|
2763
2780
|
"area": "area chart",
|
|
@@ -2777,6 +2794,11 @@ declare const _default: {
|
|
|
2777
2794
|
"range": "{count, plural, one {# point} other {# points}}, from {first} to {last}.",
|
|
2778
2795
|
"series": "{series}: from {start} to {end}, highest {max} ({maxAt}), lowest {min} ({minAt}).",
|
|
2779
2796
|
"hidden": "Hidden: {series}.",
|
|
2797
|
+
"bands": "Reference ranges: {list}.",
|
|
2798
|
+
"thresholds": "Thresholds: {list}.",
|
|
2799
|
+
"outside": "{series}: {count} of {total, plural, one {# point} other {# points}} outside {band}.",
|
|
2800
|
+
"tones": "{series}: {list}, of {total, plural, one {# point} other {# points}}.",
|
|
2801
|
+
"tone-count": "{count} {tone}",
|
|
2780
2802
|
"slices": "{count, plural, one {# slice} other {# slices}}, {total} in all.",
|
|
2781
2803
|
"largest": "Largest: {list}.",
|
|
2782
2804
|
"slice": "{label} {value} ({share})",
|
|
@@ -2076,6 +2076,7 @@ export declare const fr: {
|
|
|
2076
2076
|
"error-hint": string;
|
|
2077
2077
|
"bulk-action": string;
|
|
2078
2078
|
"bulk-action-name": string;
|
|
2079
|
+
"bulk-max-notice": string;
|
|
2079
2080
|
"bulk-more": string;
|
|
2080
2081
|
};
|
|
2081
2082
|
"list-empty": {
|
|
@@ -2725,6 +2726,8 @@ export declare const fr: {
|
|
|
2725
2726
|
"no-data": string;
|
|
2726
2727
|
loading: string;
|
|
2727
2728
|
"status-value": string;
|
|
2729
|
+
"status-value-tone": string;
|
|
2730
|
+
"table-tone": string;
|
|
2728
2731
|
"status-point": string;
|
|
2729
2732
|
"table-caption": string;
|
|
2730
2733
|
"status-slice": string;
|
|
@@ -2768,6 +2771,20 @@ export declare const fr: {
|
|
|
2768
2771
|
"zoom-reset": string;
|
|
2769
2772
|
"zoom-showing": string;
|
|
2770
2773
|
"zoom-range": string;
|
|
2774
|
+
tone: {
|
|
2775
|
+
primary: string;
|
|
2776
|
+
secondary: string;
|
|
2777
|
+
tertiary: string;
|
|
2778
|
+
success: string;
|
|
2779
|
+
info: string;
|
|
2780
|
+
warning: string;
|
|
2781
|
+
error: string;
|
|
2782
|
+
neutral: string;
|
|
2783
|
+
};
|
|
2784
|
+
reference: {
|
|
2785
|
+
band: string;
|
|
2786
|
+
threshold: string;
|
|
2787
|
+
};
|
|
2771
2788
|
kind: {
|
|
2772
2789
|
line: string;
|
|
2773
2790
|
area: string;
|
|
@@ -2787,6 +2804,11 @@ export declare const fr: {
|
|
|
2787
2804
|
range: string;
|
|
2788
2805
|
series: string;
|
|
2789
2806
|
hidden: string;
|
|
2807
|
+
bands: string;
|
|
2808
|
+
thresholds: string;
|
|
2809
|
+
outside: string;
|
|
2810
|
+
tones: string;
|
|
2811
|
+
"tone-count": string;
|
|
2790
2812
|
slices: string;
|
|
2791
2813
|
largest: string;
|
|
2792
2814
|
slice: string;
|