@ds-mo/ui 2.10.4 → 2.11.2
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/.build-stamp +1 -1
- package/dist/components/ds-app-shell.js +1 -1
- package/dist/components/ds-banner.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-button-filled.js +1 -1
- package/dist/components/ds-button-unfilled-icon.js +1 -1
- package/dist/components/ds-card-data-viz.d.ts +11 -0
- package/dist/components/ds-card-data-viz.js +2 -0
- package/dist/components/ds-card-data-viz.js.map +1 -0
- package/dist/components/ds-card-setting.js +1 -1
- package/dist/components/{ds-card.d.ts → ds-chart-bar.d.ts} +4 -4
- package/dist/components/ds-chart-bar.js +2 -0
- package/dist/components/ds-chart-bar.js.map +1 -0
- package/dist/components/ds-chart-donut.d.ts +11 -0
- package/dist/components/ds-chart-donut.js +2 -0
- package/dist/components/ds-chart-donut.js.map +1 -0
- package/dist/components/ds-chart-legend.d.ts +11 -0
- package/dist/components/ds-chart-legend.js +2 -0
- package/dist/components/ds-chart-legend.js.map +1 -0
- package/dist/components/ds-chart-line.d.ts +11 -0
- package/dist/components/ds-chart-line.js +2 -0
- package/dist/components/ds-chart-line.js.map +1 -0
- package/dist/components/ds-checkbox.js +1 -1
- package/dist/components/ds-chip.js +1 -1
- package/dist/components/ds-divider.js +1 -1
- package/dist/components/ds-empty-state.js +1 -1
- package/dist/components/ds-empty-state.js.map +1 -1
- package/dist/components/ds-fade.js +1 -1
- package/dist/components/ds-field.js +1 -1
- package/dist/components/ds-header.js +1 -1
- package/dist/components/ds-header.js.map +1 -1
- package/dist/components/ds-icon.js +1 -1
- package/dist/components/ds-input.js +1 -1
- package/dist/components/ds-loader.js +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-modal.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-panel-tools.js +1 -1
- package/dist/components/ds-radio-group.js +1 -1
- package/dist/components/ds-scrollbar.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-shell-gradient-picker.js +1 -1
- package/dist/components/ds-shell-gradient-swatch.js +1 -1
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/ds-surface.js +1 -1
- package/dist/components/ds-tab-group-nav.js +1 -1
- package/dist/components/ds-tab-group.js +1 -1
- package/dist/components/ds-table.js +1 -1
- package/dist/components/ds-table.js.map +1 -1
- package/dist/components/ds-tag.js +1 -1
- package/dist/components/ds-text.js +1 -1
- package/dist/components/ds-toast-provider.js +1 -1
- package/dist/components/ds-toggle.js +1 -1
- package/dist/components/ds-tooltip-data-viz.d.ts +11 -0
- package/dist/components/ds-tooltip-data-viz.js +2 -0
- package/dist/components/ds-tooltip-data-viz.js.map +1 -0
- package/dist/components/ds-tooltip.js +1 -1
- package/dist/components/{p-BdP53fjF.js → p-8Nt92j1-.js} +2 -2
- package/dist/components/{p-DFAxTEe4.js → p-BMQbEIrQ.js} +2 -2
- package/dist/components/{p-Ba1QXRnN.js → p-BSFgy5r6.js} +2 -2
- package/dist/components/p-CMv_7vFs.js +2 -0
- package/dist/components/p-CMv_7vFs.js.map +1 -0
- package/dist/components/{p-CRh-MLwj.js → p-ChVwCVHy.js} +2 -2
- package/dist/components/{p-TuuGOzXH.js → p-CpNIQXz6.js} +2 -2
- package/dist/components/p-CrCGIx8s.js +2 -0
- package/dist/components/p-CrCGIx8s.js.map +1 -0
- package/dist/components/{p-BXI096cJ.js → p-CvgHQfvT.js} +2 -2
- package/dist/components/p-CzBnvtcz.js +2 -0
- package/dist/components/p-CzBnvtcz.js.map +1 -0
- package/dist/components/p-DEpLlQZK.js +2 -0
- package/dist/components/p-DEpLlQZK.js.map +1 -0
- package/dist/components/{p-BGZjpSXm.js → p-DOU4cbpc.js} +2 -2
- package/dist/components/p-DdFUTZ3y.js +2 -0
- package/dist/components/{p-eOWUz57C.js.map → p-DdFUTZ3y.js.map} +1 -1
- package/dist/components/p-bDf6yBQd.js +2 -0
- package/dist/components/p-bDf6yBQd.js.map +1 -0
- package/dist/lib/nav/index.js +7 -0
- package/dist/lib/nav/index.js.map +2 -2
- package/dist/lib/utils/format-compact-number.d.ts +2 -0
- package/dist/lib/utils/index.d.ts +2 -0
- package/dist/lib/utils/index.js +59 -1
- package/dist/lib/utils/index.js.map +3 -3
- package/dist/lib/utils/token-defaults.d.ts +7 -0
- package/dist/lib/utils/truncate-svg-text.d.ts +9 -0
- package/dist/types/components/CardDataViz/CardDataViz.d.ts +22 -0
- package/dist/types/components/CardDataViz/index.d.ts +2 -0
- package/dist/types/components/ChartBar/ChartBar.d.ts +9 -0
- package/dist/types/components/ChartBar/index.d.ts +2 -0
- package/dist/types/components/ChartDonut/ChartDonut.d.ts +35 -0
- package/dist/types/components/ChartDonut/index.d.ts +2 -0
- package/dist/types/components/ChartLegend/ChartLegend.d.ts +38 -0
- package/dist/types/components/ChartLegend/index.d.ts +3 -0
- package/dist/types/components/ChartLine/ChartLine.d.ts +12 -0
- package/dist/types/components/ChartLine/index.d.ts +2 -0
- package/dist/types/components/TooltipDataViz/TooltipDataViz.d.ts +28 -0
- package/dist/types/components/TooltipDataViz/index.d.ts +2 -0
- package/dist/types/components.d.ts +470 -23
- package/dist/types/utils/chart-colors.d.ts +2 -0
- package/dist/types/utils/chart-types.d.ts +23 -0
- package/dist/types/utils/format-compact-number.d.ts +3 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/token-defaults.d.ts +7 -0
- package/dist/types/utils/truncate-svg-text.d.ts +10 -0
- package/package.json +12 -4
- package/src/angular/index.ts +7 -2
- package/src/angular/proxies.ts +144 -6
- package/src/react/components.ts +6 -1
- package/src/react/ds-card-data-viz.ts +26 -0
- package/src/react/{ds-card.ts → ds-chart-bar.ts} +7 -7
- package/src/react/ds-chart-donut.ts +27 -0
- package/src/react/ds-chart-legend.ts +33 -0
- package/src/react/ds-chart-line.ts +26 -0
- package/src/react/ds-tooltip-data-viz.ts +26 -0
- package/src/wc/components/CardDataViz/CardDataViz.tsx +102 -0
- package/src/wc/components/CardDataViz/index.ts +1 -0
- package/src/wc/components/ChartBar/ChartBar.tsx +88 -0
- package/src/wc/components/ChartBar/index.ts +1 -0
- package/src/wc/components/ChartDonut/ChartDonut.tsx +184 -0
- package/src/wc/components/ChartDonut/index.ts +1 -0
- package/src/wc/components/ChartLegend/ChartLegend.tsx +114 -0
- package/src/wc/components/ChartLegend/index.ts +2 -0
- package/src/wc/components/ChartLine/ChartLine.tsx +102 -0
- package/src/wc/components/ChartLine/index.ts +1 -0
- package/src/wc/components/TooltipDataViz/TooltipDataViz.tsx +82 -0
- package/src/wc/components/TooltipDataViz/index.ts +1 -0
- package/src/wc/components.d.ts +470 -23
- package/src/wc/utils/chart-colors.ts +7 -0
- package/src/wc/utils/chart-types.ts +25 -0
- package/src/wc/utils/format-compact-number.ts +27 -0
- package/src/wc/utils/index.ts +2 -0
- package/src/wc/utils/token-defaults.ts +14 -0
- package/src/wc/utils/truncate-svg-text.ts +25 -0
- package/dist/components/ds-card.js +0 -2
- package/dist/components/ds-card.js.map +0 -1
- package/dist/components/p-eOWUz57C.js +0 -2
- package/dist/components/p-jjfqrXnP.js +0 -2
- package/dist/components/p-jjfqrXnP.js.map +0 -1
- package/dist/types/components/Card/Card.d.ts +0 -8
- package/src/wc/components/Card/Card.tsx +0 -26
- /package/dist/components/{p-BdP53fjF.js.map → p-8Nt92j1-.js.map} +0 -0
- /package/dist/components/{p-DFAxTEe4.js.map → p-BMQbEIrQ.js.map} +0 -0
- /package/dist/components/{p-Ba1QXRnN.js.map → p-BSFgy5r6.js.map} +0 -0
- /package/dist/components/{p-CRh-MLwj.js.map → p-ChVwCVHy.js.map} +0 -0
- /package/dist/components/{p-TuuGOzXH.js.map → p-CpNIQXz6.js.map} +0 -0
- /package/dist/components/{p-BXI096cJ.js.map → p-CvgHQfvT.js.map} +0 -0
- /package/dist/components/{p-BGZjpSXm.js.map → p-DOU4cbpc.js.map} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Shared data shapes for `ds-chart-*` components — kept minimal for the initial scaffold, expect these to grow per component once design is finalized. */
|
|
2
|
+
export interface ChartDatum {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
/** CSS color override; defaults to the next `--color-data-category-*` token. */
|
|
6
|
+
color?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ChartSeries {
|
|
9
|
+
name: string;
|
|
10
|
+
data: number[];
|
|
11
|
+
/** CSS color override; defaults to the next `--color-data-category-*` token. */
|
|
12
|
+
color?: string;
|
|
13
|
+
}
|
|
14
|
+
/** `ds-chart-legend` entry — value is optional so a series name (no single value) can be legended too. */
|
|
15
|
+
export interface ChartLegendItem {
|
|
16
|
+
label: string;
|
|
17
|
+
value?: number;
|
|
18
|
+
/** CSS color override; defaults to the next `--color-data-category-*` token. */
|
|
19
|
+
color?: string;
|
|
20
|
+
/** When set, the row renders as a link (e.g. to a filtered list page for this segment). */
|
|
21
|
+
href?: string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=chart-types.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { registerIcons } from '../components/Icon/icon-cache';
|
|
2
2
|
export { clearCssLengthPxCache, resolveCssLengthPx } from './resolve-css-length-px';
|
|
3
|
+
export { formatCompactNumber } from './format-compact-number';
|
|
4
|
+
export { truncateSvgTextToWidth } from './truncate-svg-text';
|
|
3
5
|
export { parseCssTimeMs, resolveCssTimeMs } from './resolve-css-time-ms';
|
|
4
6
|
export { SCROLL_EDGE_FADE_DEFAULT_SIZE, SCROLL_EDGE_FADE_SIZE_VAR, isScrollAtEdge, resolveScrollEdgeFadeSize, scrollEdgeFadeClassMap, scrollEdgeFadeMaskImage, scrollEdgeFadeMaskStyle, scrollEdgeFadeSizeStyle, } from './scroll-edge-fade';
|
|
5
7
|
export type { ScrollEdgeFadeEdge, ScrollEdgeFadeOptions, ScrollEdgeFadeSize, ScrollEdgeFadeSizeToken, } from './scroll-edge-fade';
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export declare const TOKEN_DEFAULTS: {
|
|
3
3
|
readonly space050: "--dimension-space-050";
|
|
4
4
|
readonly space200: "--dimension-space-200";
|
|
5
|
+
readonly radius025: "--dimension-radius-025";
|
|
6
|
+
readonly size200: "--dimension-size-200";
|
|
5
7
|
readonly size300: "--dimension-size-300";
|
|
6
8
|
readonly size600: "--dimension-size-600";
|
|
7
9
|
readonly size800: "--dimension-size-800";
|
|
@@ -12,6 +14,11 @@ export declare const TOKEN_DEFAULTS: {
|
|
|
12
14
|
readonly panelWidthMd: "--dimension-panel-width-md";
|
|
13
15
|
readonly panelWidthLg: "--dimension-panel-width-lg";
|
|
14
16
|
readonly menuWidthXs: "--dimension-menu-width-xs";
|
|
17
|
+
readonly lineheightLg: "--typography-lineheight-lg";
|
|
18
|
+
readonly lineheightMd: "--typography-lineheight-md";
|
|
19
|
+
readonly lineheightSm: "--typography-lineheight-sm";
|
|
20
|
+
readonly lineheightXl: "--typography-lineheight-xl";
|
|
21
|
+
readonly lineheightXs: "--typography-lineheight-xs";
|
|
15
22
|
readonly motionShort2: "--effect-motion-short-2";
|
|
16
23
|
readonly motionShort3: "--effect-motion-short-3";
|
|
17
24
|
readonly animationDurationShort3: "--effect-animation-duration-short-3";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary-searches the longest prefix of `text` (plus an ellipsis) that fits within `maxWidth`
|
|
3
|
+
* px when rendered by `el`, using the SVG `getComputedTextLength()` API for exact measurement —
|
|
4
|
+
* `text-overflow: ellipsis` doesn't apply to raw SVG `<text>` nodes.
|
|
5
|
+
*
|
|
6
|
+
* Mutates `el.textContent` during measurement; the caller's next render (driven by the
|
|
7
|
+
* returned string going into state) overwrites it with the final value.
|
|
8
|
+
*/
|
|
9
|
+
export declare function truncateSvgTextToWidth(el: SVGTextElement, text: string, maxWidth: number): string;
|
|
10
|
+
//# sourceMappingURL=truncate-svg-text.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ds-mo/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "CompoMo — composable web components styled with TokoMo design tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -116,9 +116,13 @@
|
|
|
116
116
|
"@storybook/addon-docs": "^10.4.2",
|
|
117
117
|
"@storybook/web-components": "^10.4.2",
|
|
118
118
|
"@storybook/web-components-vite": "^10.4.2",
|
|
119
|
+
"@types/d3-array": "^3.2.2",
|
|
120
|
+
"@types/d3-scale": "^4.0.9",
|
|
121
|
+
"@types/d3-shape": "^3.1.8",
|
|
119
122
|
"@types/react": "^19.2.17",
|
|
120
123
|
"@types/react-dom": "^19.2.3",
|
|
121
124
|
"concurrently": "^10.0.3",
|
|
125
|
+
"esbuild": "^0.28.0",
|
|
122
126
|
"eslint": "^10.4.1",
|
|
123
127
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
124
128
|
"globals": "^17.6.0",
|
|
@@ -130,8 +134,7 @@
|
|
|
130
134
|
"typescript": "~6.0.3",
|
|
131
135
|
"typescript-eslint": "^8.59.1",
|
|
132
136
|
"vite": "^8.0.16",
|
|
133
|
-
"zod": "^4.4.3"
|
|
134
|
-
"esbuild": "^0.28.0"
|
|
137
|
+
"zod": "^4.4.3"
|
|
135
138
|
},
|
|
136
139
|
"engines": {
|
|
137
140
|
"node": "^20.19.0 || >=22.12.0"
|
|
@@ -139,5 +142,10 @@
|
|
|
139
142
|
"sideEffects": [
|
|
140
143
|
"**/*.css",
|
|
141
144
|
"dist/components/**/*.js"
|
|
142
|
-
]
|
|
145
|
+
],
|
|
146
|
+
"dependencies": {
|
|
147
|
+
"d3-array": "^3.2.4",
|
|
148
|
+
"d3-scale": "^4.0.2",
|
|
149
|
+
"d3-shape": "^3.2.0"
|
|
150
|
+
}
|
|
143
151
|
}
|
package/src/angular/index.ts
CHANGED
|
@@ -10,8 +10,12 @@ export const DIRECTIVES = [
|
|
|
10
10
|
d.DsBreadcrumb,
|
|
11
11
|
d.DsButtonFilled,
|
|
12
12
|
d.DsButtonUnfilledIcon,
|
|
13
|
-
d.
|
|
13
|
+
d.DsCardDataViz,
|
|
14
14
|
d.DsCardSetting,
|
|
15
|
+
d.DsChartBar,
|
|
16
|
+
d.DsChartDonut,
|
|
17
|
+
d.DsChartLegend,
|
|
18
|
+
d.DsChartLine,
|
|
15
19
|
d.DsCheckbox,
|
|
16
20
|
d.DsChip,
|
|
17
21
|
d.DsDivider,
|
|
@@ -42,5 +46,6 @@ export const DIRECTIVES = [
|
|
|
42
46
|
d.DsText,
|
|
43
47
|
d.DsToastProvider,
|
|
44
48
|
d.DsToggle,
|
|
45
|
-
d.DsTooltip
|
|
49
|
+
d.DsTooltip,
|
|
50
|
+
d.DsTooltipDataViz
|
|
46
51
|
];
|
package/src/angular/proxies.ts
CHANGED
|
@@ -231,18 +231,18 @@ export declare interface DsButtonUnfilledIcon extends Components.DsButtonUnfille
|
|
|
231
231
|
|
|
232
232
|
|
|
233
233
|
@ProxyCmp({
|
|
234
|
-
inputs: ['
|
|
234
|
+
inputs: ['cardWidth', 'heading']
|
|
235
235
|
})
|
|
236
236
|
@Component({
|
|
237
|
-
selector: 'ds-card',
|
|
237
|
+
selector: 'ds-card-data-viz',
|
|
238
238
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
239
239
|
template: '<ng-content></ng-content>',
|
|
240
240
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
241
|
-
inputs: ['
|
|
241
|
+
inputs: ['cardWidth', { name: 'heading', required: true }],
|
|
242
242
|
standalone: false
|
|
243
243
|
})
|
|
244
|
-
export class
|
|
245
|
-
protected el:
|
|
244
|
+
export class DsCardDataViz {
|
|
245
|
+
protected el: HTMLDsCardDataVizElement;
|
|
246
246
|
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
247
247
|
c.detach();
|
|
248
248
|
this.el = r.nativeElement;
|
|
@@ -250,7 +250,7 @@ export class DsCard {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
|
|
253
|
-
export declare interface
|
|
253
|
+
export declare interface DsCardDataViz extends Components.DsCardDataViz {}
|
|
254
254
|
|
|
255
255
|
|
|
256
256
|
@ProxyCmp({
|
|
@@ -283,6 +283,121 @@ export declare interface DsCardSetting extends Components.DsCardSetting {
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
|
|
286
|
+
@ProxyCmp({
|
|
287
|
+
inputs: ['data', 'height', 'width']
|
|
288
|
+
})
|
|
289
|
+
@Component({
|
|
290
|
+
selector: 'ds-chart-bar',
|
|
291
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
292
|
+
template: '<ng-content></ng-content>',
|
|
293
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
294
|
+
inputs: ['data', 'height', 'width'],
|
|
295
|
+
standalone: false
|
|
296
|
+
})
|
|
297
|
+
export class DsChartBar {
|
|
298
|
+
protected el: HTMLDsChartBarElement;
|
|
299
|
+
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
300
|
+
c.detach();
|
|
301
|
+
this.el = r.nativeElement;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
export declare interface DsChartBar extends Components.DsChartBar {}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
@ProxyCmp({
|
|
310
|
+
inputs: ['activeLabel', 'centerCaption', 'centerValue', 'cornerRadius', 'data', 'gap', 'size', 'thickness']
|
|
311
|
+
})
|
|
312
|
+
@Component({
|
|
313
|
+
selector: 'ds-chart-donut',
|
|
314
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
315
|
+
template: '<ng-content></ng-content>',
|
|
316
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
317
|
+
inputs: ['activeLabel', 'centerCaption', 'centerValue', 'cornerRadius', 'data', 'gap', 'size', 'thickness'],
|
|
318
|
+
outputs: ['dsSliceHover'],
|
|
319
|
+
standalone: false
|
|
320
|
+
})
|
|
321
|
+
export class DsChartDonut {
|
|
322
|
+
protected el: HTMLDsChartDonutElement;
|
|
323
|
+
@Output() dsSliceHover = new EventEmitter<CustomEvent<IDsChartDonutChartDatum | null>>();
|
|
324
|
+
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
325
|
+
c.detach();
|
|
326
|
+
this.el = r.nativeElement;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
import type { ChartDatum as IDsChartDonutChartDatum } from '@ds-mo/ui';
|
|
332
|
+
|
|
333
|
+
export declare interface DsChartDonut extends Components.DsChartDonut {
|
|
334
|
+
/**
|
|
335
|
+
* Fires with the hovered/focused slice's datum, or `null` on leave/blur.
|
|
336
|
+
*/
|
|
337
|
+
dsSliceHover: EventEmitter<CustomEvent<IDsChartDonutChartDatum | null>>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
@ProxyCmp({
|
|
342
|
+
inputs: ['activeLabel', 'direction', 'items', 'showPercentage']
|
|
343
|
+
})
|
|
344
|
+
@Component({
|
|
345
|
+
selector: 'ds-chart-legend',
|
|
346
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
347
|
+
template: '<ng-content></ng-content>',
|
|
348
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
349
|
+
inputs: ['activeLabel', 'direction', 'items', 'showPercentage'],
|
|
350
|
+
outputs: ['dsItemHover', 'dsItemClick'],
|
|
351
|
+
standalone: false
|
|
352
|
+
})
|
|
353
|
+
export class DsChartLegend {
|
|
354
|
+
protected el: HTMLDsChartLegendElement;
|
|
355
|
+
@Output() dsItemHover = new EventEmitter<CustomEvent<IDsChartLegendChartLegendItem | null>>();
|
|
356
|
+
@Output() dsItemClick = new EventEmitter<CustomEvent<{ item: IDsChartLegendChartLegendItem; originalEvent: MouseEvent }>>();
|
|
357
|
+
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
358
|
+
c.detach();
|
|
359
|
+
this.el = r.nativeElement;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
import type { ChartLegendItem as IDsChartLegendChartLegendItem } from '@ds-mo/ui';
|
|
365
|
+
|
|
366
|
+
export declare interface DsChartLegend extends Components.DsChartLegend {
|
|
367
|
+
/**
|
|
368
|
+
* Fires on row hover/focus with the item, or `null` on leave/blur.
|
|
369
|
+
*/
|
|
370
|
+
dsItemHover: EventEmitter<CustomEvent<IDsChartLegendChartLegendItem | null>>;
|
|
371
|
+
/**
|
|
372
|
+
* Fires when a deep-linkable row (`item.href` set) is activated.
|
|
373
|
+
*/
|
|
374
|
+
dsItemClick: EventEmitter<CustomEvent<{ item: IDsChartLegendChartLegendItem; originalEvent: MouseEvent }>>;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
@ProxyCmp({
|
|
379
|
+
inputs: ['categories', 'height', 'series', 'showPoints', 'width']
|
|
380
|
+
})
|
|
381
|
+
@Component({
|
|
382
|
+
selector: 'ds-chart-line',
|
|
383
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
384
|
+
template: '<ng-content></ng-content>',
|
|
385
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
386
|
+
inputs: ['categories', 'height', 'series', 'showPoints', 'width'],
|
|
387
|
+
standalone: false
|
|
388
|
+
})
|
|
389
|
+
export class DsChartLine {
|
|
390
|
+
protected el: HTMLDsChartLineElement;
|
|
391
|
+
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
392
|
+
c.detach();
|
|
393
|
+
this.el = r.nativeElement;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
export declare interface DsChartLine extends Components.DsChartLine {}
|
|
399
|
+
|
|
400
|
+
|
|
286
401
|
@ProxyCmp({
|
|
287
402
|
inputs: ['checked', 'inactive', 'indeterminate', 'label']
|
|
288
403
|
})
|
|
@@ -1169,3 +1284,26 @@ export class DsTooltip {
|
|
|
1169
1284
|
export declare interface DsTooltip extends Components.DsTooltip {}
|
|
1170
1285
|
|
|
1171
1286
|
|
|
1287
|
+
@ProxyCmp({
|
|
1288
|
+
inputs: ['label', 'value', 'x', 'y']
|
|
1289
|
+
})
|
|
1290
|
+
@Component({
|
|
1291
|
+
selector: 'ds-tooltip-data-viz',
|
|
1292
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1293
|
+
template: '<ng-content></ng-content>',
|
|
1294
|
+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
1295
|
+
inputs: ['label', 'value', 'x', 'y'],
|
|
1296
|
+
standalone: false
|
|
1297
|
+
})
|
|
1298
|
+
export class DsTooltipDataViz {
|
|
1299
|
+
protected el: HTMLDsTooltipDataVizElement;
|
|
1300
|
+
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
|
|
1301
|
+
c.detach();
|
|
1302
|
+
this.el = r.nativeElement;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
export declare interface DsTooltipDataViz extends Components.DsTooltipDataViz {}
|
|
1308
|
+
|
|
1309
|
+
|
package/src/react/components.ts
CHANGED
|
@@ -12,8 +12,12 @@ export { DsBarNav } from "./ds-bar-nav.js";
|
|
|
12
12
|
export { DsBreadcrumb } from "./ds-breadcrumb.js";
|
|
13
13
|
export { DsButtonFilled } from "./ds-button-filled.js";
|
|
14
14
|
export { DsButtonUnfilledIcon } from "./ds-button-unfilled-icon.js";
|
|
15
|
+
export { DsCardDataViz } from "./ds-card-data-viz.js";
|
|
15
16
|
export { DsCardSetting } from "./ds-card-setting.js";
|
|
16
|
-
export {
|
|
17
|
+
export { DsChartBar } from "./ds-chart-bar.js";
|
|
18
|
+
export { DsChartDonut } from "./ds-chart-donut.js";
|
|
19
|
+
export { DsChartLegend } from "./ds-chart-legend.js";
|
|
20
|
+
export { DsChartLine } from "./ds-chart-line.js";
|
|
17
21
|
export { DsCheckbox } from "./ds-checkbox.js";
|
|
18
22
|
export { DsChip } from "./ds-chip.js";
|
|
19
23
|
export { DsDivider } from "./ds-divider.js";
|
|
@@ -44,4 +48,5 @@ export { DsTag } from "./ds-tag.js";
|
|
|
44
48
|
export { DsText } from "./ds-text.js";
|
|
45
49
|
export { DsToastProvider } from "./ds-toast-provider.js";
|
|
46
50
|
export { DsToggle } from "./ds-toggle.js";
|
|
51
|
+
export { DsTooltipDataViz } from "./ds-tooltip-data-viz.js";
|
|
47
52
|
export { DsTooltip } from "./ds-tooltip.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
5
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
|
|
10
|
+
import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
11
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import type { Components } from "@ds-mo/ui/dist/components";
|
|
15
|
+
import { DsCardDataViz as DsCardDataVizElement, defineCustomElement as defineDsCardDataViz } from "@ds-mo/ui/dist/components/ds-card-data-viz.js";
|
|
16
|
+
|
|
17
|
+
export type DsCardDataVizEvents = NonNullable<unknown>;
|
|
18
|
+
|
|
19
|
+
export const DsCardDataViz: StencilReactComponent<DsCardDataVizElement, DsCardDataVizEvents, Components.DsCardDataViz> = /*@__PURE__*/ createComponent<DsCardDataVizElement, DsCardDataVizEvents, Components.DsCardDataViz>({
|
|
20
|
+
tagName: 'ds-card-data-viz',
|
|
21
|
+
elementClass: DsCardDataVizElement,
|
|
22
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
23
|
+
react: React,
|
|
24
|
+
events: {} as DsCardDataVizEvents,
|
|
25
|
+
defineCustomElement: defineDsCardDataViz
|
|
26
|
+
});
|
|
@@ -12,15 +12,15 @@ import { createComponent } from '@stencil/react-output-target/runtime';
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
|
|
14
14
|
import type { Components } from "@ds-mo/ui/dist/components";
|
|
15
|
-
import {
|
|
15
|
+
import { DsChartBar as DsChartBarElement, defineCustomElement as defineDsChartBar } from "@ds-mo/ui/dist/components/ds-chart-bar.js";
|
|
16
16
|
|
|
17
|
-
export type
|
|
17
|
+
export type DsChartBarEvents = NonNullable<unknown>;
|
|
18
18
|
|
|
19
|
-
export const
|
|
20
|
-
tagName: 'ds-
|
|
21
|
-
elementClass:
|
|
19
|
+
export const DsChartBar: StencilReactComponent<DsChartBarElement, DsChartBarEvents, Components.DsChartBar> = /*@__PURE__*/ createComponent<DsChartBarElement, DsChartBarEvents, Components.DsChartBar>({
|
|
20
|
+
tagName: 'ds-chart-bar',
|
|
21
|
+
elementClass: DsChartBarElement,
|
|
22
22
|
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
23
23
|
react: React,
|
|
24
|
-
events: {} as
|
|
25
|
-
defineCustomElement:
|
|
24
|
+
events: {} as DsChartBarEvents,
|
|
25
|
+
defineCustomElement: defineDsChartBar
|
|
26
26
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
5
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
|
|
10
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
11
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import { type ChartDatum, type DsChartDonutCustomEvent } from "@ds-mo/ui";
|
|
15
|
+
import type { Components } from "@ds-mo/ui/dist/components";
|
|
16
|
+
import { DsChartDonut as DsChartDonutElement, defineCustomElement as defineDsChartDonut } from "@ds-mo/ui/dist/components/ds-chart-donut.js";
|
|
17
|
+
|
|
18
|
+
export type DsChartDonutEvents = { onDsSliceHover: EventName<DsChartDonutCustomEvent<ChartDatum | null>> };
|
|
19
|
+
|
|
20
|
+
export const DsChartDonut: StencilReactComponent<DsChartDonutElement, DsChartDonutEvents, Components.DsChartDonut> = /*@__PURE__*/ createComponent<DsChartDonutElement, DsChartDonutEvents, Components.DsChartDonut>({
|
|
21
|
+
tagName: 'ds-chart-donut',
|
|
22
|
+
elementClass: DsChartDonutElement,
|
|
23
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
24
|
+
react: React,
|
|
25
|
+
events: { onDsSliceHover: 'dsSliceHover' } as DsChartDonutEvents,
|
|
26
|
+
defineCustomElement: defineDsChartDonut
|
|
27
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
5
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
|
|
10
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
11
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import { type ChartLegendItem, type DsChartLegendCustomEvent } from "@ds-mo/ui";
|
|
15
|
+
import type { Components } from "@ds-mo/ui/dist/components";
|
|
16
|
+
import { DsChartLegend as DsChartLegendElement, defineCustomElement as defineDsChartLegend } from "@ds-mo/ui/dist/components/ds-chart-legend.js";
|
|
17
|
+
|
|
18
|
+
export type DsChartLegendEvents = {
|
|
19
|
+
onDsItemHover: EventName<DsChartLegendCustomEvent<ChartLegendItem | null>>,
|
|
20
|
+
onDsItemClick: EventName<DsChartLegendCustomEvent<{ item: ChartLegendItem; originalEvent: MouseEvent }>>
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const DsChartLegend: StencilReactComponent<DsChartLegendElement, DsChartLegendEvents, Components.DsChartLegend> = /*@__PURE__*/ createComponent<DsChartLegendElement, DsChartLegendEvents, Components.DsChartLegend>({
|
|
24
|
+
tagName: 'ds-chart-legend',
|
|
25
|
+
elementClass: DsChartLegendElement,
|
|
26
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
27
|
+
react: React,
|
|
28
|
+
events: {
|
|
29
|
+
onDsItemHover: 'dsItemHover',
|
|
30
|
+
onDsItemClick: 'dsItemClick'
|
|
31
|
+
} as DsChartLegendEvents,
|
|
32
|
+
defineCustomElement: defineDsChartLegend
|
|
33
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
5
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
|
|
10
|
+
import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
11
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import type { Components } from "@ds-mo/ui/dist/components";
|
|
15
|
+
import { DsChartLine as DsChartLineElement, defineCustomElement as defineDsChartLine } from "@ds-mo/ui/dist/components/ds-chart-line.js";
|
|
16
|
+
|
|
17
|
+
export type DsChartLineEvents = NonNullable<unknown>;
|
|
18
|
+
|
|
19
|
+
export const DsChartLine: StencilReactComponent<DsChartLineElement, DsChartLineEvents, Components.DsChartLine> = /*@__PURE__*/ createComponent<DsChartLineElement, DsChartLineEvents, Components.DsChartLine>({
|
|
20
|
+
tagName: 'ds-chart-line',
|
|
21
|
+
elementClass: DsChartLineElement,
|
|
22
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
23
|
+
react: React,
|
|
24
|
+
events: {} as DsChartLineEvents,
|
|
25
|
+
defineCustomElement: defineDsChartLine
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
5
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
|
|
10
|
+
import type { StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
11
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import type { Components } from "@ds-mo/ui/dist/components";
|
|
15
|
+
import { DsTooltipDataViz as DsTooltipDataVizElement, defineCustomElement as defineDsTooltipDataViz } from "@ds-mo/ui/dist/components/ds-tooltip-data-viz.js";
|
|
16
|
+
|
|
17
|
+
export type DsTooltipDataVizEvents = NonNullable<unknown>;
|
|
18
|
+
|
|
19
|
+
export const DsTooltipDataViz: StencilReactComponent<DsTooltipDataVizElement, DsTooltipDataVizEvents, Components.DsTooltipDataViz> = /*@__PURE__*/ createComponent<DsTooltipDataVizElement, DsTooltipDataVizEvents, Components.DsTooltipDataViz>({
|
|
20
|
+
tagName: 'ds-tooltip-data-viz',
|
|
21
|
+
elementClass: DsTooltipDataVizElement,
|
|
22
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
23
|
+
react: React,
|
|
24
|
+
events: {} as DsTooltipDataVizEvents,
|
|
25
|
+
defineCustomElement: defineDsTooltipDataViz
|
|
26
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Component, Element, State, h, Host, Prop } from '@stencil/core';
|
|
2
|
+
|
|
3
|
+
export type CardDataVizWidth = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
|
+
|
|
5
|
+
/** Matches the `dsSliceHover`/`dsItemHover` detail shape emitted by `ds-chart-*` and `ds-chart-legend`. */
|
|
6
|
+
type HoveredDatum = { label: string } | null;
|
|
7
|
+
|
|
8
|
+
/** A slotted chart/legend that opts into hover sync by exposing an `activeLabel` prop. */
|
|
9
|
+
type SyncableSlot = HTMLElement & { activeLabel?: string | null };
|
|
10
|
+
|
|
11
|
+
const CARD_WIDTH_VARS: Record<CardDataVizWidth, string> = {
|
|
12
|
+
xs: 'var(--dimension-card-width-xs)',
|
|
13
|
+
sm: 'var(--dimension-card-width-sm)',
|
|
14
|
+
md: 'var(--dimension-card-width-md)',
|
|
15
|
+
lg: 'var(--dimension-card-width-lg)',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Copied from CardSetting as a starting scaffold — header edit affordance removed for now
|
|
20
|
+
* (data-viz widgets don't have an obvious "edit" action the way settings fields do); revisit
|
|
21
|
+
* once the data-viz card's real header actions (menu, caption, footer stat) are designed.
|
|
22
|
+
*/
|
|
23
|
+
@Component({
|
|
24
|
+
tag: 'ds-card-data-viz',
|
|
25
|
+
styleUrl: 'CardDataViz.css',
|
|
26
|
+
scoped: true,
|
|
27
|
+
})
|
|
28
|
+
export class CardDataViz {
|
|
29
|
+
@Element() el!: HTMLElement;
|
|
30
|
+
|
|
31
|
+
/** Widget heading shown in the card header. */
|
|
32
|
+
@Prop() heading!: string;
|
|
33
|
+
|
|
34
|
+
/** Card width token. */
|
|
35
|
+
@Prop() cardWidth: CardDataVizWidth = 'md';
|
|
36
|
+
|
|
37
|
+
// Scoped (light-DOM) components have no native slot projection to detect emptiness from CSS —
|
|
38
|
+
// check the actual children so an unused region (e.g. no legend) doesn't render a dangling
|
|
39
|
+
// padded box plus a body gap next to nothing.
|
|
40
|
+
@State() private hasChartSlot = false;
|
|
41
|
+
@State() private hasLegendSlot = false;
|
|
42
|
+
|
|
43
|
+
componentWillRender() {
|
|
44
|
+
this.hasChartSlot = !!this.el.querySelector(':scope > [slot="chart"]');
|
|
45
|
+
this.hasLegendSlot = !!this.el.querySelector(':scope > [slot="legend"]');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
componentDidLoad() {
|
|
49
|
+
// Sync the chart's and legend's `activeLabel` from each other's hover events, so any
|
|
50
|
+
// ds-chart-* + ds-chart-legend pair cross-highlights without every consumer having to
|
|
51
|
+
// wire it up by hand. Delegated on the host (rather than bound to the specific slotted
|
|
52
|
+
// elements) since Stencil events bubble and the slot content can be swapped at runtime.
|
|
53
|
+
this.el.addEventListener('dsSliceHover', this.handleChartHover);
|
|
54
|
+
this.el.addEventListener('dsItemHover', this.handleLegendHover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
this.el.removeEventListener('dsSliceHover', this.handleChartHover);
|
|
59
|
+
this.el.removeEventListener('dsItemHover', this.handleLegendHover);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private handleChartHover = (e: Event) => {
|
|
63
|
+
// Not `:scope >` — Stencil's slot polyfill for scoped (non-shadow) components relocates
|
|
64
|
+
// slotted children into an inner `.chart-region`/`.legend-region` wrapper on render, so
|
|
65
|
+
// they're no longer direct children of the host by the time this fires.
|
|
66
|
+
const legend = this.el.querySelector('[slot="legend"]') as SyncableSlot | null;
|
|
67
|
+
if (!legend || !('activeLabel' in legend)) return;
|
|
68
|
+
legend.activeLabel = (e as CustomEvent<HoveredDatum>).detail?.label ?? null;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
private handleLegendHover = (e: Event) => {
|
|
72
|
+
const chart = this.el.querySelector('[slot="chart"]') as SyncableSlot | null;
|
|
73
|
+
if (!chart || !('activeLabel' in chart)) return;
|
|
74
|
+
chart.activeLabel = (e as CustomEvent<HoveredDatum>).detail?.label ?? null;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
render() {
|
|
78
|
+
return (
|
|
79
|
+
<Host class="card-data-viz" style={{ '--_card-data-viz-width': CARD_WIDTH_VARS[this.cardWidth] }}>
|
|
80
|
+
<header class="card-data-viz__header">
|
|
81
|
+
<div class="card-data-viz__title-wrap">
|
|
82
|
+
<ds-text class="card-data-viz__title" variant="text-title-small" color="primary" as="h2">
|
|
83
|
+
{this.heading}
|
|
84
|
+
</ds-text>
|
|
85
|
+
</div>
|
|
86
|
+
</header>
|
|
87
|
+
<div class="card-data-viz__body">
|
|
88
|
+
{this.hasChartSlot && (
|
|
89
|
+
<div class="card-data-viz__chart-region">
|
|
90
|
+
<slot name="chart" />
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
{this.hasLegendSlot && (
|
|
94
|
+
<div class="card-data-viz__legend-region">
|
|
95
|
+
<slot name="legend" />
|
|
96
|
+
</div>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
</Host>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CardDataVizWidth } from './CardDataViz';
|