@redvars/peacock 3.15.0 → 3.17.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/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/assets/theme.js +19 -19
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/tokens.css.map +1 -1
- package/dist/card-content.js +8 -7
- package/dist/card-content.js.map +1 -1
- package/dist/card.js +142 -98
- package/dist/card.js.map +1 -1
- package/dist/{chart-bar-D5dGFJfK.js → cartesian-chart-DgE4USyC.js} +529 -312
- package/dist/cartesian-chart-DgE4USyC.js.map +1 -0
- package/dist/chart-area.js +78 -0
- package/dist/chart-area.js.map +1 -0
- package/dist/chart-bar.js +283 -213
- package/dist/chart-bar.js.map +1 -1
- package/dist/{transform-DSwFSqzD.js → chart-base-C2qRMF48.js} +771 -102
- package/dist/chart-base-C2qRMF48.js.map +1 -0
- package/dist/chart-doughnut.js +55 -287
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-line.js +626 -0
- package/dist/chart-line.js.map +1 -0
- package/dist/chart-pie.js +637 -195
- package/dist/chart-pie.js.map +1 -1
- package/dist/code-editor.js +704 -131
- package/dist/code-editor.js.map +1 -1
- package/dist/code-group.js +188 -0
- package/dist/code-group.js.map +1 -0
- package/dist/code-highlighter.js +895 -257
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +2278 -677
- package/dist/custom-elements.json +13962 -3690
- package/dist/image.js +5 -1
- package/dist/image.js.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/loader-full.js +1 -1
- package/dist/loader.js +9 -3
- package/dist/loader.js.map +1 -1
- package/dist/{is-dark-mode-DOcaw4Yq.js → observe-theme-change-DCifz1uv.js} +2 -6
- package/dist/observe-theme-change-DCifz1uv.js.map +1 -0
- package/dist/pagination.js +408 -110
- package/dist/pagination.js.map +1 -1
- package/dist/path-CJ0Arqcy.js +166 -0
- package/dist/path-CJ0Arqcy.js.map +1 -0
- package/dist/snackbar.js +89 -34
- package/dist/snackbar.js.map +1 -1
- package/dist/src/__internal/chart/cartesian-chart.d.ts +80 -0
- package/dist/src/__internal/chart/chart-base.d.ts +113 -0
- package/dist/src/__internal/chart/paths.d.ts +5 -0
- package/dist/src/__internal/chart/types.d.ts +42 -0
- package/dist/src/card/card-content.d.ts +2 -3
- package/dist/src/card/card.d.ts +31 -17
- package/dist/src/chart-area/chart-area.d.ts +54 -0
- package/dist/src/chart-area/index.d.ts +1 -0
- package/dist/src/chart-bar/chart-bar.d.ts +44 -33
- package/dist/src/chart-bar/index.d.ts +0 -1
- package/dist/src/chart-doughnut/chart-doughnut.d.ts +33 -39
- package/dist/src/chart-line/chart-line.d.ts +69 -0
- package/dist/src/chart-line/index.d.ts +1 -0
- package/dist/src/chart-pie/chart-pie.d.ts +63 -28
- package/dist/src/code-editor/code-editor.d.ts +52 -13
- package/dist/src/code-editor/editor-theme.d.ts +60 -0
- package/dist/src/code-highlighter/code-group.d.ts +52 -0
- package/dist/src/code-highlighter/code-highlighter.d.ts +122 -15
- package/dist/src/code-highlighter/index.d.ts +1 -0
- package/dist/src/code-highlighter/line-ranges.d.ts +24 -0
- package/dist/src/code-highlighter/local.d.ts +4 -1
- package/dist/src/code-highlighter/token-colors.d.ts +8 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/pagination/page-items.d.ts +14 -0
- package/dist/src/pagination/pagination.d.ts +46 -7
- package/dist/src/snackbar/snackbar.d.ts +13 -1
- package/dist/src/table/table.d.ts +125 -27
- package/dist/src/toolbar/toolbar.d.ts +56 -51
- package/dist/table.js +1007 -338
- package/dist/table.js.map +1 -1
- package/dist/test/chart.test.d.ts +1 -0
- package/dist/test/code-highlighter.test.d.ts +1 -0
- package/dist/test/pagination.test.d.ts +1 -0
- package/dist/test/table.test.d.ts +1 -0
- package/dist/token-colors-0TFHWbcq.js +81 -0
- package/dist/token-colors-0TFHWbcq.js.map +1 -0
- package/dist/toolbar.js +195 -184
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/readme.md +7 -6
- package/scss/_code-block.scss +139 -0
- package/scss/tokens.css +24 -0
- package/src/__internal/chart/cartesian-chart.ts +404 -0
- package/src/__internal/chart/chart-base.scss +252 -0
- package/src/__internal/chart/chart-base.ts +474 -0
- package/src/__internal/chart/paths.ts +28 -0
- package/src/__internal/chart/types.ts +49 -0
- package/src/card/card-content.ts +12 -9
- package/src/card/card.scss +66 -54
- package/src/card/card.ts +109 -73
- package/src/chart-area/chart-area.ts +82 -0
- package/src/chart-area/index.ts +1 -0
- package/src/chart-bar/chart-bar.ts +336 -250
- package/src/chart-bar/index.ts +0 -1
- package/src/chart-doughnut/chart-doughnut.ts +62 -262
- package/src/chart-doughnut/demo/index.html +14 -22
- package/src/chart-line/chart-line.scss +25 -0
- package/src/chart-line/chart-line.ts +346 -0
- package/src/chart-line/index.ts +1 -0
- package/src/chart-pie/chart-pie.scss +35 -16
- package/src/chart-pie/chart-pie.ts +282 -188
- package/src/chart-pie/demo/index.html +13 -21
- package/src/code-editor/code-editor.scss +132 -36
- package/src/code-editor/code-editor.ts +308 -88
- package/src/code-editor/demo/index.html +39 -12
- package/src/code-editor/editor-theme.ts +213 -0
- package/src/code-highlighter/code-group.scss +34 -0
- package/src/code-highlighter/code-group.ts +173 -0
- package/src/code-highlighter/code-highlighter.scss +226 -111
- package/src/code-highlighter/code-highlighter.ts +554 -199
- package/src/code-highlighter/demo/index.html +68 -4
- package/src/code-highlighter/index.ts +1 -0
- package/src/code-highlighter/line-ranges.ts +81 -0
- package/src/code-highlighter/local.ts +9 -3
- package/src/code-highlighter/token-colors.ts +42 -0
- package/src/index.ts +4 -2
- package/src/loader.ts +8 -2
- package/src/pagination/page-items.ts +50 -0
- package/src/pagination/pagination.scss +159 -44
- package/src/pagination/pagination.ts +275 -74
- package/src/snackbar/demo/index.html +39 -4
- package/src/snackbar/snackbar.scss +27 -10
- package/src/snackbar/snackbar.ts +80 -37
- package/src/table/table.scss +337 -109
- package/src/table/table.ts +812 -272
- package/src/toolbar/toolbar-colors.scss +6 -7
- package/src/toolbar/toolbar.scss +35 -106
- package/src/toolbar/toolbar.ts +180 -80
- package/dist/array-D5vjT2Xm.js +0 -14
- package/dist/array-D5vjT2Xm.js.map +0 -1
- package/dist/chart-bar-D5dGFJfK.js.map +0 -1
- package/dist/chart-stacked-bar.js +0 -403
- package/dist/chart-stacked-bar.js.map +0 -1
- package/dist/copy-to-clipboard-upGx-Ueo.js +0 -39
- package/dist/copy-to-clipboard-upGx-Ueo.js.map +0 -1
- package/dist/is-dark-mode-DOcaw4Yq.js.map +0 -1
- package/dist/pie-Dz0IDiPt.js +0 -537
- package/dist/pie-Dz0IDiPt.js.map +0 -1
- package/dist/pierre-dark-DFWl0m-C.js +0 -4
- package/dist/pierre-dark-DFWl0m-C.js.map +0 -1
- package/dist/pierre-light-BEkAPImt.js +0 -4
- package/dist/pierre-light-BEkAPImt.js.map +0 -1
- package/dist/src/chart-bar/chart-stacked-bar.d.ts +0 -78
- package/dist/src/code-highlighter/constants.d.ts +0 -1
- package/dist/transform-DSwFSqzD.js.map +0 -1
- package/src/chart-bar/chart-bar.scss +0 -58
- package/src/chart-bar/chart-stacked-bar.ts +0 -398
- package/src/chart-doughnut/chart-donut.scss +0 -37
- package/src/code-highlighter/constants.ts +0 -117
- /package/dist/test/{chart-bar.test.d.ts → card.test.d.ts} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { LitElement, nothing, PropertyValues, SVGTemplateResult, TemplateResult } from 'lit';
|
|
2
|
+
import { BaseType, Selection } from 'd3';
|
|
3
|
+
import type { ChartSelectDetail, ChartSeries, ChartTooltipModel, ChartValueFormatter } from './types.js';
|
|
4
|
+
/** Number of `--color-chart-n` tokens series cycle through. */
|
|
5
|
+
export declare const CHART_PALETTE_SIZE = 8;
|
|
6
|
+
/** The palette color for the series or slice at `index`. */
|
|
7
|
+
export declare function chartColor(index: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Shared behaviour for every Peacock chart: container sizing, palette, value formatting,
|
|
10
|
+
* tooltip, legend, keyboard navigation, the accessible data table, and loading and empty states.
|
|
11
|
+
* Subclasses draw the marks with d3 into the SVG returned by `renderSvgContent()`.
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class ChartBase extends LitElement {
|
|
14
|
+
/** Height of the plot in pixels. The width follows the container. */
|
|
15
|
+
height: number;
|
|
16
|
+
/** Accessible name of the chart, read by screen readers. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Shows a skeleton while data loads. */
|
|
19
|
+
loading: boolean;
|
|
20
|
+
/** Shows the legend even for a single series. */
|
|
21
|
+
showLegend: boolean;
|
|
22
|
+
/** Hides the legend. */
|
|
23
|
+
hideLegend: boolean;
|
|
24
|
+
/** Hides the tooltip. */
|
|
25
|
+
hideTooltip: boolean;
|
|
26
|
+
/** Turns off enter and update animations. They are also off when the user prefers reduced motion. */
|
|
27
|
+
disableAnimation: boolean;
|
|
28
|
+
/** Formats values in tooltips, value labels and axis ticks. Defaults to the locale number format, compact on axes. */
|
|
29
|
+
valueFormatter?: ChartValueFormatter;
|
|
30
|
+
/** Keys of series or slices switched off in the legend. */
|
|
31
|
+
protected hiddenKeys: Set<string>;
|
|
32
|
+
/** Index of the hovered or focused category or slice, -1 for none. */
|
|
33
|
+
protected activeIndex: number;
|
|
34
|
+
/** Key of the series highlighted from the legend. */
|
|
35
|
+
protected activeSeries?: string;
|
|
36
|
+
/** Pointer position the tooltip follows; undefined places it at the item's anchor. */
|
|
37
|
+
protected pointer?: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
};
|
|
41
|
+
/** Width of the plot, measured from the container. */
|
|
42
|
+
protected plotWidth: number;
|
|
43
|
+
/** Text for the polite live region, set during keyboard navigation. */
|
|
44
|
+
private announcement;
|
|
45
|
+
protected svgElement?: SVGSVGElement;
|
|
46
|
+
protected plotElement?: HTMLElement;
|
|
47
|
+
/** Watches the host width. */
|
|
48
|
+
private resizeObserver?;
|
|
49
|
+
/** Whether the marks have been drawn once. */
|
|
50
|
+
private hasDrawn;
|
|
51
|
+
connectedCallback(): void;
|
|
52
|
+
disconnectedCallback(): void;
|
|
53
|
+
updated(changed: PropertyValues): void;
|
|
54
|
+
/** True when there is something to plot. */
|
|
55
|
+
protected abstract hasData(): boolean;
|
|
56
|
+
/** Every series or slice, including hidden ones, in legend order. */
|
|
57
|
+
protected abstract getSeries(): ChartSeries[];
|
|
58
|
+
/** Number of categories or slices keyboard navigation moves through. */
|
|
59
|
+
protected abstract getItemCount(): number;
|
|
60
|
+
/** Draws the marks; `animate` is false for resizes and when motion is off. */
|
|
61
|
+
protected abstract draw(animate: boolean): void;
|
|
62
|
+
/** Applies hover and focus state (dimming, cursor, active dots) without redrawing. */
|
|
63
|
+
protected abstract drawHighlight(): void;
|
|
64
|
+
/** The item under a point in plot coordinates. */
|
|
65
|
+
protected abstract itemAtPoint(x: number, y: number): number;
|
|
66
|
+
/** Tooltip content and default anchor for an item. */
|
|
67
|
+
protected abstract getTooltip(index: number): ChartTooltipModel | undefined;
|
|
68
|
+
/** Detail of `chart-select` for an item. */
|
|
69
|
+
protected abstract getSelectDetail(index: number): ChartSelectDetail;
|
|
70
|
+
/** The static SVG layers d3 draws into. */
|
|
71
|
+
protected abstract renderSvgContent(): SVGTemplateResult;
|
|
72
|
+
/** Rows of the visually hidden data table. */
|
|
73
|
+
protected abstract renderTable(): TemplateResult;
|
|
74
|
+
/** Property names that trigger a redraw when they change. */
|
|
75
|
+
protected drawProperties(): string[];
|
|
76
|
+
/** Whether the legend shows. */
|
|
77
|
+
protected legendVisible(): boolean;
|
|
78
|
+
/** Width and height of the SVG. */
|
|
79
|
+
protected svgSize(): {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
};
|
|
83
|
+
/** Motion duration in ms, 0 when animation is off. */
|
|
84
|
+
protected motionEnabled(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Returns a transition of `selection` when `animate` is true, else the selection itself, so
|
|
87
|
+
* callers set end values once. Transitions share the attr/style API used here.
|
|
88
|
+
*/
|
|
89
|
+
protected motion<E extends BaseType, D>(selection: Selection<E, D, BaseType, unknown>, animate: boolean): Selection<E, D, BaseType, unknown>;
|
|
90
|
+
/** Formats a value for tooltips and value labels. */
|
|
91
|
+
protected formatValue(value: number): string;
|
|
92
|
+
/** Formats an axis tick. */
|
|
93
|
+
protected formatTick(value: number): string;
|
|
94
|
+
/** Whether a series or slice is switched off in the legend. */
|
|
95
|
+
protected isHidden(key: string): boolean;
|
|
96
|
+
/** Extra content layered over the plot, such as the doughnut centre. */
|
|
97
|
+
protected renderOverlay(): TemplateResult | typeof nothing;
|
|
98
|
+
/** Skeleton shown while `loading`. */
|
|
99
|
+
protected renderSkeleton(): TemplateResult;
|
|
100
|
+
private pointFromEvent;
|
|
101
|
+
private handlePointerMove;
|
|
102
|
+
private handlePointerLeave;
|
|
103
|
+
private handleClick;
|
|
104
|
+
private handleKeyDown;
|
|
105
|
+
private handleBlur;
|
|
106
|
+
private announce;
|
|
107
|
+
private select;
|
|
108
|
+
private toggleSeries;
|
|
109
|
+
private renderTooltip;
|
|
110
|
+
private renderLegend;
|
|
111
|
+
private renderPlot;
|
|
112
|
+
render(): TemplateResult<1>;
|
|
113
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG path for a rectangle with its own radius per corner, in the order top-left, top-right,
|
|
3
|
+
* bottom-right, bottom-left. Every path has the same commands, so d3 can tween between any two.
|
|
4
|
+
*/
|
|
5
|
+
export declare function roundedRectPath(x: number, y: number, width: number, height: number, radii: [number, number, number, number]): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** One series in a bar, line or area chart, keyed by the data field that holds its values. */
|
|
2
|
+
export type ChartSeriesConfig = {
|
|
3
|
+
/** Display name in the legend and tooltip. Defaults to the key. */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Any CSS color. Defaults to the next `--color-chart-n` token. */
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Maps a data field to how its series is shown, for example `{ desktop: { label: 'Desktop' } }`. */
|
|
9
|
+
export type ChartConfig = Record<string, ChartSeriesConfig>;
|
|
10
|
+
/** One row of cartesian chart data: the category field (`index`) plus a number per series. */
|
|
11
|
+
export type ChartDatum = Record<string, unknown>;
|
|
12
|
+
/** Formats a value for tooltips, value labels and axis ticks. */
|
|
13
|
+
export type ChartValueFormatter = (value: number) => string;
|
|
14
|
+
/** A series resolved from config: key, label and color. */
|
|
15
|
+
export type ChartSeries = {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
/** A row in the tooltip. */
|
|
21
|
+
export type ChartTooltipRow = {
|
|
22
|
+
key: string;
|
|
23
|
+
label: string;
|
|
24
|
+
color: string;
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
/** What the tooltip shows and where. Coordinates are relative to the plot element. */
|
|
28
|
+
export type ChartTooltipModel = {
|
|
29
|
+
title: string;
|
|
30
|
+
rows: ChartTooltipRow[];
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
};
|
|
34
|
+
/** Detail of the `chart-select` event. */
|
|
35
|
+
export type ChartSelectDetail = {
|
|
36
|
+
/** Index of the selected category or slice in `data`. */
|
|
37
|
+
index: number;
|
|
38
|
+
/** Series key, when a single series was selected. */
|
|
39
|
+
series?: string;
|
|
40
|
+
/** The selected data row. */
|
|
41
|
+
datum: unknown;
|
|
42
|
+
};
|
|
@@ -3,10 +3,9 @@ import { LitElement } from 'lit';
|
|
|
3
3
|
* @label Card Content
|
|
4
4
|
* @tag wc-card-content
|
|
5
5
|
* @rawTag card-content
|
|
6
|
+
* @summary A padded block inside a card. A card can hold several, next to edge-to-edge media.
|
|
6
7
|
*
|
|
7
|
-
* @cssprop --card-content-padding -
|
|
8
|
-
*
|
|
9
|
-
* ```
|
|
8
|
+
* @cssprop --card-content-padding - Padding on all sides. Defaults to 1rem.
|
|
10
9
|
*/
|
|
11
10
|
export declare class CardContent extends LitElement {
|
|
12
11
|
static styles: import("lit").CSSResult;
|
package/dist/src/card/card.d.ts
CHANGED
|
@@ -5,48 +5,62 @@ declare const Card_base: typeof LitElement & import("../__internal/mixins/MixinC
|
|
|
5
5
|
* @label Card
|
|
6
6
|
* @tag wc-card
|
|
7
7
|
* @rawTag card
|
|
8
|
-
* @summary A card
|
|
9
|
-
* @cssprop --card-
|
|
10
|
-
* @cssprop --card-
|
|
11
|
-
* @cssprop --card-gap - Gap between
|
|
8
|
+
* @summary A surface that groups content and actions about one subject. Set `actionable` to make the whole card a button, or `href` to make it a link.
|
|
9
|
+
* @cssprop --card-container-shape - Corner radius of the card. Defaults to `--shape-corner-large`.
|
|
10
|
+
* @cssprop --card-padding - Padding inside the card, around its children. Defaults to 0; `wc-card-content` adds its own padding.
|
|
11
|
+
* @cssprop --card-gap - Gap between the card's children. Defaults to 0.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```html
|
|
15
|
-
* <wc-card variant="outlined"
|
|
15
|
+
* <wc-card variant="outlined">
|
|
16
16
|
* <wc-card-content>
|
|
17
|
-
* <h3 class="text-
|
|
18
|
-
* <p class="text-body">
|
|
17
|
+
* <h3 class="text-title-large">Title</h3>
|
|
18
|
+
* <p class="text-body-medium">Supporting text</p>
|
|
19
19
|
* </wc-card-content>
|
|
20
20
|
* </wc-card>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare class Card extends Card_base {
|
|
24
|
-
#private;
|
|
25
24
|
static styles: import("lit").CSSResultGroup[];
|
|
25
|
+
/**
|
|
26
|
+
* Visual style of the card: `elevated` (a raised surface with a shadow), `filled` (a tonal surface)
|
|
27
|
+
* or `outlined` (a bordered surface). Defaults to `elevated`.
|
|
28
|
+
*/
|
|
26
29
|
variant: CardVariant;
|
|
30
|
+
/**
|
|
31
|
+
* Dims the card and makes its content inert. An actionable or link card also stops responding
|
|
32
|
+
* to clicks and leaves the tab order, unless `disabled-reason` is set.
|
|
33
|
+
*/
|
|
27
34
|
disabled: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Makes the whole card a single button that fires `click`. Its content becomes inert, so don't
|
|
37
|
+
* put buttons or links inside an actionable card.
|
|
38
|
+
*/
|
|
28
39
|
actionable: boolean;
|
|
29
40
|
/**
|
|
30
|
-
*
|
|
41
|
+
* Why an actionable or link card is disabled. The card stays focusable and screen readers read
|
|
42
|
+
* the reason with it.
|
|
31
43
|
*/
|
|
32
44
|
disabledReason: string;
|
|
33
45
|
/**
|
|
34
|
-
*
|
|
46
|
+
* Delay in milliseconds for throttling activation of an actionable or link card. When unset
|
|
47
|
+
* (default), no throttle is applied.
|
|
35
48
|
*/
|
|
36
49
|
throttleDelay?: number;
|
|
37
|
-
/**
|
|
38
|
-
* States
|
|
39
|
-
*/
|
|
50
|
+
/** Whether the default slot holds meaningful content. */
|
|
40
51
|
private slotHasContent;
|
|
41
52
|
readonly cardElement: HTMLElement | null;
|
|
42
53
|
constructor();
|
|
43
54
|
firstUpdated(): void;
|
|
55
|
+
__handleClick(event: MouseEvent | KeyboardEvent): void;
|
|
44
56
|
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void;
|
|
45
57
|
__dispatchClick: (event: MouseEvent | KeyboardEvent) => void;
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
/** True when a disabled interactive card should stay focusable to expose its reason. */
|
|
59
|
+
__isSoftDisabled(): boolean;
|
|
60
|
+
__getDisabledReasonID(): "disabled-reason" | undefined;
|
|
61
|
+
renderDisabledReason(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
62
|
+
renderCardElement(isLinkElement: boolean): import("lit-html").TemplateResult<1>;
|
|
63
|
+
renderCardContent(inertContent: boolean): import("lit-html").TemplateResult<1>;
|
|
48
64
|
render(): import("lit-html").TemplateResult<1>;
|
|
49
|
-
renderCardElement(isLinkElement: boolean, disableSlotTabbing: boolean): import("lit-html").TemplateResult<1>;
|
|
50
|
-
renderCardContent(disableSlotTabbing: boolean): import("lit-html").TemplateResult<1>;
|
|
51
65
|
}
|
|
52
66
|
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ChartLine } from '../chart-line/chart-line.js';
|
|
2
|
+
export type { ChartConfig, ChartDatum, ChartSelectDetail, ChartSeriesConfig, ChartValueFormatter, } from '../__internal/chart/types.js';
|
|
3
|
+
export type { ChartCurve } from '../chart-line/chart-line.js';
|
|
4
|
+
/**
|
|
5
|
+
* @label Area Chart
|
|
6
|
+
* @tag wc-chart-area
|
|
7
|
+
* @rawTag chart-area
|
|
8
|
+
* @summary A line chart with the area under each line filled, optionally stacked to show parts of a total over time.
|
|
9
|
+
* @tags charts
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <wc-chart-area index="month" stacked label="Visitors by month"></wc-chart-area>
|
|
14
|
+
* <script>
|
|
15
|
+
* const chart = document.querySelector('wc-chart-area');
|
|
16
|
+
* chart.config = {
|
|
17
|
+
* desktop: { label: 'Desktop' },
|
|
18
|
+
* mobile: { label: 'Mobile' },
|
|
19
|
+
* };
|
|
20
|
+
* chart.data = [
|
|
21
|
+
* { month: 'January', desktop: 186, mobile: 80 },
|
|
22
|
+
* { month: 'February', desktop: 305, mobile: 200 },
|
|
23
|
+
* { month: 'March', desktop: 237, mobile: 120 },
|
|
24
|
+
* ];
|
|
25
|
+
* </script>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @slot empty - Shown when there is no data. Defaults to "No data".
|
|
29
|
+
*
|
|
30
|
+
* @fires chart-select - A category was clicked or chosen with Enter. `detail` holds `index` and `datum`.
|
|
31
|
+
*
|
|
32
|
+
* @csspart container - The outer wrapper.
|
|
33
|
+
* @csspart plot - The focusable plot area holding the SVG.
|
|
34
|
+
* @csspart tooltip - The tooltip.
|
|
35
|
+
* @csspart legend - The legend.
|
|
36
|
+
*
|
|
37
|
+
* @cssprop --color-chart-1 - Color of the first series; series cycle through `--color-chart-1` to `--color-chart-8`.
|
|
38
|
+
* @cssprop --chart-line-width - Stroke width of the lines. Defaults to `2px`.
|
|
39
|
+
* @cssprop --chart-grid-color - Gridline and baseline color. Defaults to `--color-outline-variant`.
|
|
40
|
+
* @cssprop --chart-axis-color - Axis label color. Defaults to `--color-on-surface-variant`.
|
|
41
|
+
* @cssprop --chart-dim-opacity - Opacity of series that are not highlighted. Defaults to `0.4`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class ChartArea extends ChartLine {
|
|
44
|
+
/** Stacks the series on each other so the top line shows the total. */
|
|
45
|
+
stacked: boolean;
|
|
46
|
+
constructor();
|
|
47
|
+
protected drawProperties(): string[];
|
|
48
|
+
protected isStacked(): boolean;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
'wc-chart-area': ChartArea;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChartArea } from './chart-area.js';
|
|
@@ -1,50 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
3
|
-
name: string;
|
|
4
|
-
value: number;
|
|
5
|
-
label?: string;
|
|
6
|
-
color?: string;
|
|
7
|
-
};
|
|
1
|
+
import { CartesianChart, ChartOrientation } from '../__internal/chart/cartesian-chart.js';
|
|
2
|
+
export type { ChartConfig, ChartDatum, ChartSelectDetail, ChartSeriesConfig, ChartValueFormatter, } from '../__internal/chart/types.js';
|
|
8
3
|
/**
|
|
9
|
-
* @label Chart
|
|
4
|
+
* @label Bar Chart
|
|
10
5
|
* @tag wc-chart-bar
|
|
11
6
|
* @rawTag chart-bar
|
|
12
|
-
* @summary
|
|
7
|
+
* @summary Compares values across categories with vertical or horizontal bars, grouped or stacked by series.
|
|
13
8
|
* @tags charts
|
|
14
9
|
*
|
|
15
10
|
* @example
|
|
16
11
|
* ```html
|
|
17
|
-
* <wc-chart-bar
|
|
12
|
+
* <wc-chart-bar index="month" label="Visitors by month"></wc-chart-bar>
|
|
18
13
|
* <script>
|
|
19
|
-
* document.querySelector('wc-chart-bar')
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
14
|
+
* const chart = document.querySelector('wc-chart-bar');
|
|
15
|
+
* chart.config = {
|
|
16
|
+
* desktop: { label: 'Desktop' },
|
|
17
|
+
* mobile: { label: 'Mobile' },
|
|
18
|
+
* };
|
|
19
|
+
* chart.data = [
|
|
20
|
+
* { month: 'January', desktop: 186, mobile: 80 },
|
|
21
|
+
* { month: 'February', desktop: 305, mobile: 200 },
|
|
22
|
+
* { month: 'March', desktop: 237, mobile: 120 },
|
|
23
23
|
* ];
|
|
24
24
|
* </script>
|
|
25
25
|
* ```
|
|
26
|
+
*
|
|
27
|
+
* @slot empty - Shown when there is no data. Defaults to "No data".
|
|
28
|
+
*
|
|
29
|
+
* @fires chart-select - A bar group was clicked or chosen with Enter. `detail` holds `index` and `datum`.
|
|
30
|
+
*
|
|
31
|
+
* @csspart container - The outer wrapper.
|
|
32
|
+
* @csspart plot - The focusable plot area holding the SVG.
|
|
33
|
+
* @csspart tooltip - The tooltip.
|
|
34
|
+
* @csspart legend - The legend.
|
|
35
|
+
*
|
|
36
|
+
* @cssprop --color-chart-1 - Color of the first series; series cycle through `--color-chart-1` to `--color-chart-8`.
|
|
37
|
+
* @cssprop --chart-grid-color - Gridline and baseline color. Defaults to `--color-outline-variant`.
|
|
38
|
+
* @cssprop --chart-axis-color - Axis label color. Defaults to `--color-on-surface-variant`.
|
|
39
|
+
* @cssprop --chart-dim-opacity - Opacity of marks that are not hovered. Defaults to `0.4`.
|
|
26
40
|
*/
|
|
27
|
-
export declare class ChartBar extends
|
|
41
|
+
export declare class ChartBar extends CartesianChart {
|
|
28
42
|
static styles: import("lit").CSSResultGroup[];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/** Margin around the chart drawing area. */
|
|
35
|
-
margin: number;
|
|
36
|
-
/** Chart data array. Each item should have name, value, and optional label and color. */
|
|
37
|
-
data: ChartBarItem[];
|
|
38
|
-
/** Whether to render value labels above bars. */
|
|
43
|
+
/** Stacks the series in each category instead of placing them side by side. */
|
|
44
|
+
stacked: boolean;
|
|
45
|
+
/** `vertical` draws columns; `horizontal` draws bars from the left. */
|
|
46
|
+
orientation: ChartOrientation;
|
|
47
|
+
/** Prints each bar's value (each stack's total when stacked) at its end. */
|
|
39
48
|
showValues: boolean;
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
|
|
46
|
-
private
|
|
47
|
-
|
|
49
|
+
/** Bars from the last draw, for highlighting. */
|
|
50
|
+
private bars;
|
|
51
|
+
protected drawProperties(): string[];
|
|
52
|
+
/** Corner radius of the rounded end, from `--shape-corner-extra-small`. */
|
|
53
|
+
private cornerRadius;
|
|
54
|
+
/** Bars and value labels in data space; positions are filled once scales exist. */
|
|
55
|
+
private buildModels;
|
|
56
|
+
protected draw(animate: boolean): void;
|
|
57
|
+
protected drawHighlight(): void;
|
|
58
|
+
protected getSelectDetail(index: number): import("../__internal/chart/types.js").ChartSelectDetail;
|
|
48
59
|
}
|
|
49
60
|
declare global {
|
|
50
61
|
interface HTMLElementTagNameMap {
|
|
@@ -1,53 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
3
|
-
color: string;
|
|
4
|
-
};
|
|
5
|
-
export type ChartDoughnutItem = {
|
|
6
|
-
name: string;
|
|
7
|
-
value: number;
|
|
8
|
-
label?: string;
|
|
9
|
-
color?: string;
|
|
10
|
-
};
|
|
1
|
+
import { ChartPie } from '../chart-pie/chart-pie.js';
|
|
2
|
+
export type { ChartPieItem, ChartSelectDetail, ChartValueFormatter, } from '../chart-pie/chart-pie.js';
|
|
11
3
|
/**
|
|
12
|
-
* @label Chart
|
|
4
|
+
* @label Doughnut Chart
|
|
13
5
|
* @tag wc-chart-doughnut
|
|
14
6
|
* @rawTag chart-doughnut
|
|
15
|
-
* @summary A
|
|
7
|
+
* @summary A pie chart with a hole that shows the total, or the hovered slice, in its centre.
|
|
16
8
|
* @tags charts
|
|
17
9
|
*
|
|
18
10
|
* @example
|
|
19
11
|
* ```html
|
|
20
|
-
* <wc-chart-doughnut
|
|
12
|
+
* <wc-chart-doughnut label="Visitors by browser" center-label="Visitors"></wc-chart-doughnut>
|
|
21
13
|
* <script>
|
|
22
14
|
* document.querySelector('wc-chart-doughnut').data = [
|
|
23
|
-
* { name: '
|
|
24
|
-
* { name: '
|
|
25
|
-
* { name: '
|
|
15
|
+
* { name: 'chrome', label: 'Chrome', value: 275 },
|
|
16
|
+
* { name: 'safari', label: 'Safari', value: 200 },
|
|
17
|
+
* { name: 'firefox', label: 'Firefox', value: 187 },
|
|
26
18
|
* ];
|
|
27
19
|
* </script>
|
|
28
20
|
* ```
|
|
21
|
+
*
|
|
22
|
+
* @slot center - Replaces the total and caption in the centre.
|
|
23
|
+
* @slot empty - Shown when there is no data. Defaults to "No data".
|
|
24
|
+
*
|
|
25
|
+
* @fires chart-select - A slice was clicked or chosen with Enter. `detail` holds `index`, `series` (the slice name) and `datum`.
|
|
26
|
+
*
|
|
27
|
+
* @csspart container - The outer wrapper.
|
|
28
|
+
* @csspart plot - The focusable plot area holding the SVG.
|
|
29
|
+
* @csspart center - The centre content.
|
|
30
|
+
* @csspart tooltip - The tooltip.
|
|
31
|
+
* @csspart legend - The legend.
|
|
32
|
+
*
|
|
33
|
+
* @cssprop --color-chart-1 - Color of the first slice; slices cycle through `--color-chart-1` to `--color-chart-8`.
|
|
34
|
+
* @cssprop --chart-dim-opacity - Opacity of slices that are not hovered. Defaults to `0.4`.
|
|
29
35
|
*/
|
|
30
|
-
export declare class ChartDoughnut extends
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/** Label displayed in the center of the doughnut. */
|
|
42
|
-
label?: string;
|
|
43
|
-
private _initialized;
|
|
44
|
-
private _debouncedRenderChart;
|
|
45
|
-
firstUpdated(): void;
|
|
46
|
-
updated(changedProperties: PropertyValues): void;
|
|
47
|
-
private _getRadius;
|
|
48
|
-
private _getTotal;
|
|
49
|
-
private _getPieData;
|
|
50
|
-
private _getColorScale;
|
|
51
|
-
private _renderChart;
|
|
52
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
36
|
+
export declare class ChartDoughnut extends ChartPie {
|
|
37
|
+
/** Size of the hole as a fraction of the radius. */
|
|
38
|
+
innerRadius: number;
|
|
39
|
+
/** Caption under the total in the centre. */
|
|
40
|
+
centerLabel: string;
|
|
41
|
+
protected renderOverlay(): import("lit-html").TemplateResult<1>;
|
|
42
|
+
}
|
|
43
|
+
declare global {
|
|
44
|
+
interface HTMLElementTagNameMap {
|
|
45
|
+
'wc-chart-doughnut': ChartDoughnut;
|
|
46
|
+
}
|
|
53
47
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CartesianChart } from '../__internal/chart/cartesian-chart.js';
|
|
2
|
+
export type { ChartConfig, ChartDatum, ChartSelectDetail, ChartSeriesConfig, ChartValueFormatter, } from '../__internal/chart/types.js';
|
|
3
|
+
export type ChartCurve = 'monotone' | 'linear' | 'step';
|
|
4
|
+
/**
|
|
5
|
+
* @label Line Chart
|
|
6
|
+
* @tag wc-chart-line
|
|
7
|
+
* @rawTag chart-line
|
|
8
|
+
* @summary Shows how values change across ordered categories such as time, with one line per series.
|
|
9
|
+
* @tags charts
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <wc-chart-line index="month" label="Visitors by month"></wc-chart-line>
|
|
14
|
+
* <script>
|
|
15
|
+
* const chart = document.querySelector('wc-chart-line');
|
|
16
|
+
* chart.config = {
|
|
17
|
+
* desktop: { label: 'Desktop' },
|
|
18
|
+
* mobile: { label: 'Mobile' },
|
|
19
|
+
* };
|
|
20
|
+
* chart.data = [
|
|
21
|
+
* { month: 'January', desktop: 186, mobile: 80 },
|
|
22
|
+
* { month: 'February', desktop: 305, mobile: 200 },
|
|
23
|
+
* { month: 'March', desktop: 237, mobile: 120 },
|
|
24
|
+
* ];
|
|
25
|
+
* </script>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @slot empty - Shown when there is no data. Defaults to "No data".
|
|
29
|
+
*
|
|
30
|
+
* @fires chart-select - A category was clicked or chosen with Enter. `detail` holds `index` and `datum`.
|
|
31
|
+
*
|
|
32
|
+
* @csspart container - The outer wrapper.
|
|
33
|
+
* @csspart plot - The focusable plot area holding the SVG.
|
|
34
|
+
* @csspart tooltip - The tooltip.
|
|
35
|
+
* @csspart legend - The legend.
|
|
36
|
+
*
|
|
37
|
+
* @cssprop --color-chart-1 - Color of the first series; series cycle through `--color-chart-1` to `--color-chart-8`.
|
|
38
|
+
* @cssprop --chart-line-width - Stroke width of the lines. Defaults to `2px`.
|
|
39
|
+
* @cssprop --chart-grid-color - Gridline and baseline color. Defaults to `--color-outline-variant`.
|
|
40
|
+
* @cssprop --chart-axis-color - Axis label color. Defaults to `--color-on-surface-variant`.
|
|
41
|
+
* @cssprop --chart-dim-opacity - Opacity of series that are not highlighted. Defaults to `0.4`.
|
|
42
|
+
*/
|
|
43
|
+
export declare class ChartLine extends CartesianChart {
|
|
44
|
+
static styles: import("lit").CSSResultGroup[];
|
|
45
|
+
/** How points are joined: `monotone` (smooth), `linear` or `step`. */
|
|
46
|
+
curve: ChartCurve;
|
|
47
|
+
/** Draws a dot at every point. Dots always show for the hovered category. */
|
|
48
|
+
showDots: boolean;
|
|
49
|
+
/** Whether the area under each line is filled. */
|
|
50
|
+
protected filled: boolean;
|
|
51
|
+
/** Value scale from the last draw, used to place active dots. */
|
|
52
|
+
private y;
|
|
53
|
+
/** Category positions from the last draw. */
|
|
54
|
+
private x;
|
|
55
|
+
/** Series from the last draw. */
|
|
56
|
+
private models;
|
|
57
|
+
constructor();
|
|
58
|
+
protected drawProperties(): string[];
|
|
59
|
+
/** Whether series stack on each other. Only areas stack. */
|
|
60
|
+
protected isStacked(): boolean;
|
|
61
|
+
private buildModels;
|
|
62
|
+
protected draw(animate: boolean): void;
|
|
63
|
+
protected drawHighlight(): void;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'wc-chart-line': ChartLine;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChartLine } from './chart-line.js';
|