@cloudscape-design/chart-components 1.0.17 → 1.0.19

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.
Files changed (31) hide show
  1. package/core/chart-api/index.d.ts +1 -0
  2. package/core/chart-api/index.js +7 -0
  3. package/core/chart-api/index.js.map +1 -1
  4. package/core/components/core-legend.d.ts +2 -1
  5. package/core/components/core-legend.js +2 -2
  6. package/core/components/core-legend.js.map +1 -1
  7. package/core/components/core-tooltip.js +25 -6
  8. package/core/components/core-tooltip.js.map +1 -1
  9. package/core/interfaces.d.ts +9 -0
  10. package/core/interfaces.js.map +1 -1
  11. package/internal/components/chart-legend/index.d.ts +3 -1
  12. package/internal/components/chart-legend/index.js +6 -2
  13. package/internal/components/chart-legend/index.js.map +1 -1
  14. package/internal/components/chart-legend/styles.css.js +23 -17
  15. package/internal/components/chart-legend/styles.scoped.css +44 -26
  16. package/internal/components/chart-legend/styles.selectors.js +23 -17
  17. package/internal/environment.js +1 -1
  18. package/internal/environment.json +1 -1
  19. package/internal/generated/styles/tokens.d.ts +2 -0
  20. package/internal/generated/styles/tokens.js +2 -0
  21. package/internal/generated/theming/index.cjs +45 -0
  22. package/internal/generated/theming/index.cjs.d.ts +9 -0
  23. package/internal/generated/theming/index.d.ts +9 -0
  24. package/internal/generated/theming/index.js +45 -0
  25. package/internal/manifest.json +1 -1
  26. package/internal-do-not-use/core-legend/index.d.ts +1 -1
  27. package/internal-do-not-use/core-legend/index.js +2 -2
  28. package/internal-do-not-use/core-legend/index.js.map +1 -1
  29. package/package.json +1 -1
  30. package/pie-chart/chart-pie-internal.js +1 -1
  31. package/pie-chart/chart-pie-internal.js.map +1 -1
@@ -2077,6 +2077,10 @@ module.exports.preset = {
2077
2077
  "light": "{colorNeutral250}",
2078
2078
  "dark": "{colorNeutral950}"
2079
2079
  },
2080
+ "colorTreeViewConnectorLine": {
2081
+ "light": "{colorNeutral500}",
2082
+ "dark": "{colorNeutral300}"
2083
+ },
2080
2084
  "fontBoxValueLargeWeight": "700",
2081
2085
  "fontButtonLetterSpacing": "0.005em",
2082
2086
  "fontChartDetailSize": "{fontSizeBodyS}",
@@ -2605,6 +2609,10 @@ module.exports.preset = {
2605
2609
  "comfortable": "{spaceContainerHorizontal}",
2606
2610
  "compact": "{spaceContainerHorizontal}"
2607
2611
  },
2612
+ "spaceTreeViewIndentation": {
2613
+ "comfortable": "{spaceL}",
2614
+ "compact": "{spaceL}"
2615
+ },
2608
2616
  "spaceTileGutter": {
2609
2617
  "comfortable": "{spaceXl}",
2610
2618
  "compact": "{spaceM}"
@@ -3071,6 +3079,10 @@ module.exports.preset = {
3071
3079
  "comfortable": "{spaceContainerHorizontal}",
3072
3080
  "compact": "{spaceContainerHorizontal}"
3073
3081
  },
3082
+ "spaceTreeViewIndentation": {
3083
+ "comfortable": "{spaceL}",
3084
+ "compact": "{spaceL}"
3085
+ },
3074
3086
  "spaceTileGutter": {
3075
3087
  "comfortable": "{spaceXl}",
3076
3088
  "compact": "{spaceM}"
@@ -4344,6 +4356,10 @@ module.exports.preset = {
4344
4356
  "colorGapGlobalDrawer": {
4345
4357
  "light": "{colorNeutral950}",
4346
4358
  "dark": "{colorNeutral950}"
4359
+ },
4360
+ "colorTreeViewConnectorLine": {
4361
+ "light": "{colorNeutral300}",
4362
+ "dark": "{colorNeutral300}"
4347
4363
  }
4348
4364
  }
4349
4365
  },
@@ -5518,6 +5534,10 @@ module.exports.preset = {
5518
5534
  "colorGapGlobalDrawer": {
5519
5535
  "light": "{colorNeutral950}",
5520
5536
  "dark": "{colorNeutral950}"
5537
+ },
5538
+ "colorTreeViewConnectorLine": {
5539
+ "light": "{colorNeutral300}",
5540
+ "dark": "{colorNeutral300}"
5521
5541
  }
5522
5542
  }
5523
5543
  },
@@ -6628,6 +6648,10 @@ module.exports.preset = {
6628
6648
  "colorGapGlobalDrawer": {
6629
6649
  "light": "{colorNeutral250}",
6630
6650
  "dark": "{colorNeutral950}"
6651
+ },
6652
+ "colorTreeViewConnectorLine": {
6653
+ "light": "{colorNeutral500}",
6654
+ "dark": "{colorNeutral300}"
6631
6655
  }
6632
6656
  }
6633
6657
  },
@@ -7738,6 +7762,10 @@ module.exports.preset = {
7738
7762
  "colorGapGlobalDrawer": {
7739
7763
  "light": "{colorNeutral250}",
7740
7764
  "dark": "{colorNeutral950}"
7765
+ },
7766
+ "colorTreeViewConnectorLine": {
7767
+ "light": "{colorNeutral500}",
7768
+ "dark": "{colorNeutral300}"
7741
7769
  }
7742
7770
  }
7743
7771
  },
@@ -8849,6 +8877,10 @@ module.exports.preset = {
8849
8877
  "light": "{colorNeutral250}",
8850
8878
  "dark": "{colorNeutral950}"
8851
8879
  },
8880
+ "colorTreeViewConnectorLine": {
8881
+ "light": "{colorNeutral500}",
8882
+ "dark": "{colorNeutral300}"
8883
+ },
8852
8884
  "fontExpandableHeadingSize": "14px",
8853
8885
  "borderDividerSectionWidth": "1px"
8854
8886
  }
@@ -9960,6 +9992,10 @@ module.exports.preset = {
9960
9992
  "colorGapGlobalDrawer": {
9961
9993
  "light": "{colorNeutral950}",
9962
9994
  "dark": "{colorNeutral950}"
9995
+ },
9996
+ "colorTreeViewConnectorLine": {
9997
+ "light": "{colorNeutral300}",
9998
+ "dark": "{colorNeutral300}"
9963
9999
  }
9964
10000
  }
9965
10001
  },
@@ -10472,6 +10508,7 @@ module.exports.preset = {
10472
10508
  "colorDropzoneBorderDefault": "color",
10473
10509
  "colorDropzoneBorderHover": "color",
10474
10510
  "colorGapGlobalDrawer": "color",
10511
+ "colorTreeViewConnectorLine": "color",
10475
10512
  "motionDurationExtraFast": "motion",
10476
10513
  "motionDurationExtraSlow": "motion",
10477
10514
  "motionDurationFast": "motion",
@@ -10581,6 +10618,7 @@ module.exports.preset = {
10581
10618
  "spaceTableHeaderToolsBottom": "density",
10582
10619
  "spaceTableHeaderToolsFullPageBottom": "density",
10583
10620
  "spaceTableHorizontal": "density",
10621
+ "spaceTreeViewIndentation": "density",
10584
10622
  "spaceTileGutter": "density",
10585
10623
  "spaceScaled2xNone": "density",
10586
10624
  "spaceScaled2xXxxs": "density",
@@ -10925,6 +10963,7 @@ module.exports.preset = {
10925
10963
  "colorDropzoneTextHover",
10926
10964
  "colorDropzoneBorderDefault",
10927
10965
  "colorDropzoneBorderHover",
10966
+ "colorTreeViewConnectorLine",
10928
10967
  "fontFamilyBase",
10929
10968
  "fontFamilyMonospace",
10930
10969
  "fontSizeBodyM",
@@ -11290,6 +11329,7 @@ module.exports.preset = {
11290
11329
  "colorDropzoneTextHover",
11291
11330
  "colorDropzoneBorderDefault",
11292
11331
  "colorDropzoneBorderHover",
11332
+ "colorTreeViewConnectorLine",
11293
11333
  "fontFamilyBase",
11294
11334
  "fontFamilyMonospace",
11295
11335
  "fontSizeBodyM",
@@ -11353,6 +11393,7 @@ module.exports.preset = {
11353
11393
  "motionKeyframesScalePopup",
11354
11394
  "spaceContainerHorizontal",
11355
11395
  "spaceFieldHorizontal",
11396
+ "spaceTreeViewIndentation",
11356
11397
  "spaceScaledXxxs",
11357
11398
  "spaceScaledXxs",
11358
11399
  "spaceScaledXs",
@@ -11921,6 +11962,7 @@ module.exports.preset = {
11921
11962
  "colorDropzoneBorderDefault": "color-dropzone-border-default",
11922
11963
  "colorDropzoneBorderHover": "color-dropzone-border-hover",
11923
11964
  "colorGapGlobalDrawer": "color-gap-global-drawer",
11965
+ "colorTreeViewConnectorLine": "color-tree-view-connector-line",
11924
11966
  "fontBoxValueLargeWeight": "font-box-value-large-weight",
11925
11967
  "fontButtonLetterSpacing": "font-button-letter-spacing",
11926
11968
  "fontChartDetailSize": "font-chart-detail-size",
@@ -12122,6 +12164,7 @@ module.exports.preset = {
12122
12164
  "spaceTableHeaderToolsBottom": "space-table-header-tools-bottom",
12123
12165
  "spaceTableHeaderToolsFullPageBottom": "space-table-header-tools-full-page-bottom",
12124
12166
  "spaceTableHorizontal": "space-table-horizontal",
12167
+ "spaceTreeViewIndentation": "space-tree-view-indentation",
12125
12168
  "spaceTileGutter": "space-tile-gutter",
12126
12169
  "spaceScaled2xNone": "space-scaled-2x-none",
12127
12170
  "spaceScaled2xXxxs": "space-scaled-2x-xxxs",
@@ -12727,6 +12770,7 @@ module.exports.preset = {
12727
12770
  "colorDropzoneBorderDefault": "--color-dropzone-border-default-k648ha",
12728
12771
  "colorDropzoneBorderHover": "--color-dropzone-border-hover-otpag5",
12729
12772
  "colorGapGlobalDrawer": "--color-gap-global-drawer-nh699a",
12773
+ "colorTreeViewConnectorLine": "--color-tree-view-connector-line-1usxvn",
12730
12774
  "fontBoxValueLargeWeight": "--font-box-value-large-weight-wr00sw",
12731
12775
  "fontButtonLetterSpacing": "--font-button-letter-spacing-ufowe3",
12732
12776
  "fontChartDetailSize": "--font-chart-detail-size-9qr25q",
@@ -12928,6 +12972,7 @@ module.exports.preset = {
12928
12972
  "spaceTableHeaderToolsBottom": "--space-table-header-tools-bottom-d9u5kf",
12929
12973
  "spaceTableHeaderToolsFullPageBottom": "--space-table-header-tools-full-page-bottom-9m47g6",
12930
12974
  "spaceTableHorizontal": "--space-table-horizontal-suurzj",
12975
+ "spaceTreeViewIndentation": "--space-tree-view-indentation-gmy1k3",
12931
12976
  "spaceTileGutter": "--space-tile-gutter-bi2bdv",
12932
12977
  "spaceScaled2xNone": "--space-scaled-2x-none-987dp7",
12933
12978
  "spaceScaled2xXxxs": "--space-scaled-2x-xxxs-reumxj",
@@ -220,6 +220,7 @@ export declare interface TypedOverride {
220
220
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
221
221
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
222
222
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
223
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
223
224
  fontFamilyBase?: GlobalValue;
224
225
  fontFamilyMonospace?: GlobalValue;
225
226
  fontSizeBodyM?: GlobalValue;
@@ -489,6 +490,7 @@ export declare interface TypedOverride {
489
490
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
490
491
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
491
492
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
493
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
492
494
  fontFamilyBase?: GlobalValue;
493
495
  fontFamilyMonospace?: GlobalValue;
494
496
  fontSizeBodyM?: GlobalValue;
@@ -758,6 +760,7 @@ export declare interface TypedOverride {
758
760
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
759
761
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
760
762
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
763
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
761
764
  fontFamilyBase?: GlobalValue;
762
765
  fontFamilyMonospace?: GlobalValue;
763
766
  fontSizeBodyM?: GlobalValue;
@@ -1027,6 +1030,7 @@ export declare interface TypedOverride {
1027
1030
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1028
1031
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1029
1032
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1033
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1030
1034
  fontFamilyBase?: GlobalValue;
1031
1035
  fontFamilyMonospace?: GlobalValue;
1032
1036
  fontSizeBodyM?: GlobalValue;
@@ -1296,6 +1300,7 @@ export declare interface TypedOverride {
1296
1300
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1297
1301
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1298
1302
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1303
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1299
1304
  fontFamilyBase?: GlobalValue;
1300
1305
  fontFamilyMonospace?: GlobalValue;
1301
1306
  fontSizeBodyM?: GlobalValue;
@@ -1565,6 +1570,7 @@ export declare interface TypedOverride {
1565
1570
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1566
1571
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1567
1572
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1573
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1568
1574
  fontFamilyBase?: GlobalValue;
1569
1575
  fontFamilyMonospace?: GlobalValue;
1570
1576
  fontSizeBodyM?: GlobalValue;
@@ -1834,6 +1840,7 @@ export declare interface TypedOverride {
1834
1840
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1835
1841
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1836
1842
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1843
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1837
1844
  fontFamilyBase?: GlobalValue;
1838
1845
  fontFamilyMonospace?: GlobalValue;
1839
1846
  fontSizeBodyM?: GlobalValue;
@@ -2103,6 +2110,7 @@ export declare interface TypedOverride {
2103
2110
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2104
2111
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2105
2112
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2113
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2106
2114
  fontFamilyBase?: GlobalValue;
2107
2115
  fontFamilyMonospace?: GlobalValue;
2108
2116
  fontSizeBodyM?: GlobalValue;
@@ -2372,6 +2380,7 @@ export declare interface TypedOverride {
2372
2380
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2373
2381
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2374
2382
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2383
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2375
2384
  fontFamilyBase?: GlobalValue;
2376
2385
  fontFamilyMonospace?: GlobalValue;
2377
2386
  fontSizeBodyM?: GlobalValue;
@@ -220,6 +220,7 @@ export declare interface TypedOverride {
220
220
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
221
221
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
222
222
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
223
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
223
224
  fontFamilyBase?: GlobalValue;
224
225
  fontFamilyMonospace?: GlobalValue;
225
226
  fontSizeBodyM?: GlobalValue;
@@ -489,6 +490,7 @@ export declare interface TypedOverride {
489
490
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
490
491
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
491
492
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
493
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
492
494
  fontFamilyBase?: GlobalValue;
493
495
  fontFamilyMonospace?: GlobalValue;
494
496
  fontSizeBodyM?: GlobalValue;
@@ -758,6 +760,7 @@ export declare interface TypedOverride {
758
760
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
759
761
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
760
762
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
763
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
761
764
  fontFamilyBase?: GlobalValue;
762
765
  fontFamilyMonospace?: GlobalValue;
763
766
  fontSizeBodyM?: GlobalValue;
@@ -1027,6 +1030,7 @@ export declare interface TypedOverride {
1027
1030
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1028
1031
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1029
1032
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1033
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1030
1034
  fontFamilyBase?: GlobalValue;
1031
1035
  fontFamilyMonospace?: GlobalValue;
1032
1036
  fontSizeBodyM?: GlobalValue;
@@ -1296,6 +1300,7 @@ export declare interface TypedOverride {
1296
1300
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1297
1301
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1298
1302
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1303
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1299
1304
  fontFamilyBase?: GlobalValue;
1300
1305
  fontFamilyMonospace?: GlobalValue;
1301
1306
  fontSizeBodyM?: GlobalValue;
@@ -1565,6 +1570,7 @@ export declare interface TypedOverride {
1565
1570
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1566
1571
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1567
1572
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1573
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1568
1574
  fontFamilyBase?: GlobalValue;
1569
1575
  fontFamilyMonospace?: GlobalValue;
1570
1576
  fontSizeBodyM?: GlobalValue;
@@ -1834,6 +1840,7 @@ export declare interface TypedOverride {
1834
1840
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1835
1841
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1836
1842
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1843
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1837
1844
  fontFamilyBase?: GlobalValue;
1838
1845
  fontFamilyMonospace?: GlobalValue;
1839
1846
  fontSizeBodyM?: GlobalValue;
@@ -2103,6 +2110,7 @@ export declare interface TypedOverride {
2103
2110
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2104
2111
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2105
2112
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2113
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2106
2114
  fontFamilyBase?: GlobalValue;
2107
2115
  fontFamilyMonospace?: GlobalValue;
2108
2116
  fontSizeBodyM?: GlobalValue;
@@ -2372,6 +2380,7 @@ export declare interface TypedOverride {
2372
2380
  colorDropzoneTextHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2373
2381
  colorDropzoneBorderDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2374
2382
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2383
+ colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2375
2384
  fontFamilyBase?: GlobalValue;
2376
2385
  fontFamilyMonospace?: GlobalValue;
2377
2386
  fontSizeBodyM?: GlobalValue;
@@ -2077,6 +2077,10 @@ export var preset = {
2077
2077
  "light": "{colorNeutral250}",
2078
2078
  "dark": "{colorNeutral950}"
2079
2079
  },
2080
+ "colorTreeViewConnectorLine": {
2081
+ "light": "{colorNeutral500}",
2082
+ "dark": "{colorNeutral300}"
2083
+ },
2080
2084
  "fontBoxValueLargeWeight": "700",
2081
2085
  "fontButtonLetterSpacing": "0.005em",
2082
2086
  "fontChartDetailSize": "{fontSizeBodyS}",
@@ -2605,6 +2609,10 @@ export var preset = {
2605
2609
  "comfortable": "{spaceContainerHorizontal}",
2606
2610
  "compact": "{spaceContainerHorizontal}"
2607
2611
  },
2612
+ "spaceTreeViewIndentation": {
2613
+ "comfortable": "{spaceL}",
2614
+ "compact": "{spaceL}"
2615
+ },
2608
2616
  "spaceTileGutter": {
2609
2617
  "comfortable": "{spaceXl}",
2610
2618
  "compact": "{spaceM}"
@@ -3071,6 +3079,10 @@ export var preset = {
3071
3079
  "comfortable": "{spaceContainerHorizontal}",
3072
3080
  "compact": "{spaceContainerHorizontal}"
3073
3081
  },
3082
+ "spaceTreeViewIndentation": {
3083
+ "comfortable": "{spaceL}",
3084
+ "compact": "{spaceL}"
3085
+ },
3074
3086
  "spaceTileGutter": {
3075
3087
  "comfortable": "{spaceXl}",
3076
3088
  "compact": "{spaceM}"
@@ -4344,6 +4356,10 @@ export var preset = {
4344
4356
  "colorGapGlobalDrawer": {
4345
4357
  "light": "{colorNeutral950}",
4346
4358
  "dark": "{colorNeutral950}"
4359
+ },
4360
+ "colorTreeViewConnectorLine": {
4361
+ "light": "{colorNeutral300}",
4362
+ "dark": "{colorNeutral300}"
4347
4363
  }
4348
4364
  }
4349
4365
  },
@@ -5518,6 +5534,10 @@ export var preset = {
5518
5534
  "colorGapGlobalDrawer": {
5519
5535
  "light": "{colorNeutral950}",
5520
5536
  "dark": "{colorNeutral950}"
5537
+ },
5538
+ "colorTreeViewConnectorLine": {
5539
+ "light": "{colorNeutral300}",
5540
+ "dark": "{colorNeutral300}"
5521
5541
  }
5522
5542
  }
5523
5543
  },
@@ -6628,6 +6648,10 @@ export var preset = {
6628
6648
  "colorGapGlobalDrawer": {
6629
6649
  "light": "{colorNeutral250}",
6630
6650
  "dark": "{colorNeutral950}"
6651
+ },
6652
+ "colorTreeViewConnectorLine": {
6653
+ "light": "{colorNeutral500}",
6654
+ "dark": "{colorNeutral300}"
6631
6655
  }
6632
6656
  }
6633
6657
  },
@@ -7738,6 +7762,10 @@ export var preset = {
7738
7762
  "colorGapGlobalDrawer": {
7739
7763
  "light": "{colorNeutral250}",
7740
7764
  "dark": "{colorNeutral950}"
7765
+ },
7766
+ "colorTreeViewConnectorLine": {
7767
+ "light": "{colorNeutral500}",
7768
+ "dark": "{colorNeutral300}"
7741
7769
  }
7742
7770
  }
7743
7771
  },
@@ -8849,6 +8877,10 @@ export var preset = {
8849
8877
  "light": "{colorNeutral250}",
8850
8878
  "dark": "{colorNeutral950}"
8851
8879
  },
8880
+ "colorTreeViewConnectorLine": {
8881
+ "light": "{colorNeutral500}",
8882
+ "dark": "{colorNeutral300}"
8883
+ },
8852
8884
  "fontExpandableHeadingSize": "14px",
8853
8885
  "borderDividerSectionWidth": "1px"
8854
8886
  }
@@ -9960,6 +9992,10 @@ export var preset = {
9960
9992
  "colorGapGlobalDrawer": {
9961
9993
  "light": "{colorNeutral950}",
9962
9994
  "dark": "{colorNeutral950}"
9995
+ },
9996
+ "colorTreeViewConnectorLine": {
9997
+ "light": "{colorNeutral300}",
9998
+ "dark": "{colorNeutral300}"
9963
9999
  }
9964
10000
  }
9965
10001
  },
@@ -10472,6 +10508,7 @@ export var preset = {
10472
10508
  "colorDropzoneBorderDefault": "color",
10473
10509
  "colorDropzoneBorderHover": "color",
10474
10510
  "colorGapGlobalDrawer": "color",
10511
+ "colorTreeViewConnectorLine": "color",
10475
10512
  "motionDurationExtraFast": "motion",
10476
10513
  "motionDurationExtraSlow": "motion",
10477
10514
  "motionDurationFast": "motion",
@@ -10581,6 +10618,7 @@ export var preset = {
10581
10618
  "spaceTableHeaderToolsBottom": "density",
10582
10619
  "spaceTableHeaderToolsFullPageBottom": "density",
10583
10620
  "spaceTableHorizontal": "density",
10621
+ "spaceTreeViewIndentation": "density",
10584
10622
  "spaceTileGutter": "density",
10585
10623
  "spaceScaled2xNone": "density",
10586
10624
  "spaceScaled2xXxxs": "density",
@@ -10925,6 +10963,7 @@ export var preset = {
10925
10963
  "colorDropzoneTextHover",
10926
10964
  "colorDropzoneBorderDefault",
10927
10965
  "colorDropzoneBorderHover",
10966
+ "colorTreeViewConnectorLine",
10928
10967
  "fontFamilyBase",
10929
10968
  "fontFamilyMonospace",
10930
10969
  "fontSizeBodyM",
@@ -11290,6 +11329,7 @@ export var preset = {
11290
11329
  "colorDropzoneTextHover",
11291
11330
  "colorDropzoneBorderDefault",
11292
11331
  "colorDropzoneBorderHover",
11332
+ "colorTreeViewConnectorLine",
11293
11333
  "fontFamilyBase",
11294
11334
  "fontFamilyMonospace",
11295
11335
  "fontSizeBodyM",
@@ -11353,6 +11393,7 @@ export var preset = {
11353
11393
  "motionKeyframesScalePopup",
11354
11394
  "spaceContainerHorizontal",
11355
11395
  "spaceFieldHorizontal",
11396
+ "spaceTreeViewIndentation",
11356
11397
  "spaceScaledXxxs",
11357
11398
  "spaceScaledXxs",
11358
11399
  "spaceScaledXs",
@@ -11921,6 +11962,7 @@ export var preset = {
11921
11962
  "colorDropzoneBorderDefault": "color-dropzone-border-default",
11922
11963
  "colorDropzoneBorderHover": "color-dropzone-border-hover",
11923
11964
  "colorGapGlobalDrawer": "color-gap-global-drawer",
11965
+ "colorTreeViewConnectorLine": "color-tree-view-connector-line",
11924
11966
  "fontBoxValueLargeWeight": "font-box-value-large-weight",
11925
11967
  "fontButtonLetterSpacing": "font-button-letter-spacing",
11926
11968
  "fontChartDetailSize": "font-chart-detail-size",
@@ -12122,6 +12164,7 @@ export var preset = {
12122
12164
  "spaceTableHeaderToolsBottom": "space-table-header-tools-bottom",
12123
12165
  "spaceTableHeaderToolsFullPageBottom": "space-table-header-tools-full-page-bottom",
12124
12166
  "spaceTableHorizontal": "space-table-horizontal",
12167
+ "spaceTreeViewIndentation": "space-tree-view-indentation",
12125
12168
  "spaceTileGutter": "space-tile-gutter",
12126
12169
  "spaceScaled2xNone": "space-scaled-2x-none",
12127
12170
  "spaceScaled2xXxxs": "space-scaled-2x-xxxs",
@@ -12727,6 +12770,7 @@ export var preset = {
12727
12770
  "colorDropzoneBorderDefault": "--color-dropzone-border-default-k648ha",
12728
12771
  "colorDropzoneBorderHover": "--color-dropzone-border-hover-otpag5",
12729
12772
  "colorGapGlobalDrawer": "--color-gap-global-drawer-nh699a",
12773
+ "colorTreeViewConnectorLine": "--color-tree-view-connector-line-1usxvn",
12730
12774
  "fontBoxValueLargeWeight": "--font-box-value-large-weight-wr00sw",
12731
12775
  "fontButtonLetterSpacing": "--font-button-letter-spacing-ufowe3",
12732
12776
  "fontChartDetailSize": "--font-chart-detail-size-9qr25q",
@@ -12928,6 +12972,7 @@ export var preset = {
12928
12972
  "spaceTableHeaderToolsBottom": "--space-table-header-tools-bottom-d9u5kf",
12929
12973
  "spaceTableHeaderToolsFullPageBottom": "--space-table-header-tools-full-page-bottom-9m47g6",
12930
12974
  "spaceTableHorizontal": "--space-table-horizontal-suurzj",
12975
+ "spaceTreeViewIndentation": "--space-tree-view-indentation-gmy1k3",
12931
12976
  "spaceTileGutter": "--space-tile-gutter-bi2bdv",
12932
12977
  "spaceScaled2xNone": "--space-scaled-2x-none-987dp7",
12933
12978
  "spaceScaled2xXxxs": "--space-scaled-2x-xxxs-reumxj",
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "116234a9664d7074743c085519df60a1cba3b7e8"
2
+ "commit": "0e235d07ade8f0af459e48dfa583feb044a32e65"
3
3
  }
@@ -1,2 +1,2 @@
1
1
  import { CoreLegendProps } from "../../core/interfaces";
2
- export declare const CoreLegend: ({ items, title, actions, ariaLabel, alignment, onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, }: CoreLegendProps) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const CoreLegend: ({ items, title, actions, ariaLabel, alignment, onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, horizontalAlignment, }: CoreLegendProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ChartLegend as ChartLegendComponent } from "../../internal/components/chart-legend";
3
3
  import { fireNonCancelableEvent } from "../../internal/events";
4
- export const CoreLegend = ({ items, title, actions, ariaLabel, alignment = "horizontal", onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, }) => {
4
+ export const CoreLegend = ({ items, title, actions, ariaLabel, alignment = "horizontal", onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, horizontalAlignment = "start", }) => {
5
5
  const position = alignment === "horizontal" ? "bottom" : "side";
6
6
  if (items.length === 0) {
7
7
  return null;
8
8
  }
9
- return (_jsx(ChartLegendComponent, { items: items, actions: actions, legendTitle: title, position: position, ariaLabel: ariaLabel, getTooltipContent: (props) => { var _a; return (_a = getLegendTooltipContent === null || getLegendTooltipContent === void 0 ? void 0 : getLegendTooltipContent(props)) !== null && _a !== void 0 ? _a : null; }, onItemHighlightExit: () => fireNonCancelableEvent(onClearHighlight), onItemHighlightEnter: (item) => fireNonCancelableEvent(onItemHighlight, { item }), onItemVisibilityChange: (items) => fireNonCancelableEvent(onVisibleItemsChange, { items }) }));
9
+ return (_jsx(ChartLegendComponent, { items: items, actions: actions, legendTitle: title, position: position, horizontalAlignment: horizontalAlignment, ariaLabel: ariaLabel, getTooltipContent: (props) => { var _a; return (_a = getLegendTooltipContent === null || getLegendTooltipContent === void 0 ? void 0 : getLegendTooltipContent(props)) !== null && _a !== void 0 ? _a : null; }, onItemHighlightExit: () => fireNonCancelableEvent(onClearHighlight), onItemHighlightEnter: (item) => fireNonCancelableEvent(onItemHighlight, { item }), onItemVisibilityChange: (items) => fireNonCancelableEvent(onVisibleItemsChange, { items }) }));
10
10
  };
11
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-legend/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,GAAG,YAAY,EACxB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,GACP,EAAE,EAAE;IACpB,MAAM,QAAQ,GAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,KAAK,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,KAAK,CAAC,mCAAI,IAAI,CAAA,EAAA,EACtE,mBAAmB,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EACnE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,EACjF,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,CAAC,GAC1F,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { CoreLegendProps } from \"../../core/interfaces\";\nimport { ChartLegend as ChartLegendComponent } from \"../../internal/components/chart-legend\";\nimport { fireNonCancelableEvent } from \"../../internal/events\";\n\nexport const CoreLegend = ({\n items,\n title,\n actions,\n ariaLabel,\n alignment = \"horizontal\",\n onItemHighlight,\n onClearHighlight,\n onVisibleItemsChange,\n getLegendTooltipContent,\n}: CoreLegendProps) => {\n const position = alignment === \"horizontal\" ? \"bottom\" : \"side\";\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <ChartLegendComponent\n items={items}\n actions={actions}\n legendTitle={title}\n position={position}\n ariaLabel={ariaLabel}\n getTooltipContent={(props) => getLegendTooltipContent?.(props) ?? null}\n onItemHighlightExit={() => fireNonCancelableEvent(onClearHighlight)}\n onItemHighlightEnter={(item) => fireNonCancelableEvent(onItemHighlight, { item })}\n onItemVisibilityChange={(items) => fireNonCancelableEvent(onVisibleItemsChange, { items })}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-legend/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,GAAG,YAAY,EACxB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,GAAG,OAAO,GACb,EAAE,EAAE;IACpB,MAAM,QAAQ,GAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,KAAK,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,KAAK,CAAC,mCAAI,IAAI,CAAA,EAAA,EACtE,mBAAmB,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EACnE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,EACjF,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,CAAC,GAC1F,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { CoreLegendProps } from \"../../core/interfaces\";\nimport { ChartLegend as ChartLegendComponent } from \"../../internal/components/chart-legend\";\nimport { fireNonCancelableEvent } from \"../../internal/events\";\n\nexport const CoreLegend = ({\n items,\n title,\n actions,\n ariaLabel,\n alignment = \"horizontal\",\n onItemHighlight,\n onClearHighlight,\n onVisibleItemsChange,\n getLegendTooltipContent,\n horizontalAlignment = \"start\",\n}: CoreLegendProps) => {\n const position = alignment === \"horizontal\" ? \"bottom\" : \"side\";\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <ChartLegendComponent\n items={items}\n actions={actions}\n legendTitle={title}\n position={position}\n horizontalAlignment={horizontalAlignment}\n ariaLabel={ariaLabel}\n getTooltipContent={(props) => getLegendTooltipContent?.(props) ?? null}\n onItemHighlightExit={() => fireNonCancelableEvent(onClearHighlight)}\n onItemHighlightEnter={(item) => fireNonCancelableEvent(onItemHighlight, { item })}\n onItemVisibilityChange={(items) => fireNonCancelableEvent(onVisibleItemsChange, { items })}\n />\n );\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chart-components",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chart-components.git"
@@ -51,7 +51,7 @@ export const InternalPieChart = forwardRef(({ series: originalSeries, tooltip, .
51
51
  };
52
52
  const transformSlotProps = (props) => {
53
53
  const point = props.items[0].point;
54
- return transformDetailsProps({ point });
54
+ return transformDetailsProps({ point, hideTooltip: props.hideTooltip });
55
55
  };
56
56
  return {
57
57
  header: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.header) ? (props) => tooltip.header(transformSlotProps(props)) : undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"chart-pie-internal.js","sourceRoot":"","sources":["../../../src/pie-chart/chart-pie-internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,sBAAsB,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3B,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef, useImperativeHandle, useRef } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport type Highcharts from \"highcharts\";\n\nimport { useControllableState } from \"@cloudscape-design/component-toolkit\";\n\nimport { InternalCoreChart } from \"../core/chart-core\";\nimport { CoreChartProps } from \"../core/interfaces\";\nimport { getOptionsId } from \"../core/utils\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { fireNonCancelableEvent } from \"../internal/events\";\nimport { SomeRequired, Writeable } from \"../internal/utils/utils\";\nimport { useInnerArea } from \"./chart-inner-area\";\nimport { PieChartProps } from \"./interfaces\";\n\nimport testClasses from \"./test-classes/styles.css.js\";\n\ninterface InternalPieChartProps extends InternalBaseComponentProps, Omit<PieChartProps, \"series\"> {\n series: readonly PieChartProps.SeriesOptions[];\n tooltip: SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\">;\n legend: SomeRequired<PieChartProps.LegendOptions, \"enabled\">;\n}\n\nexport const InternalPieChart = forwardRef(\n ({ series: originalSeries, tooltip, ...props }: InternalPieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n const apiRef = useRef<null | CoreChartProps.ChartAPI>(null);\n\n // When visibleSegments and onVisibleSegmentsChange are provided - the segments visibility can be controlled from the outside.\n // Otherwise - the component handles segments visibility using its internal state.\n useControllableState(props.visibleSegments, props.onVisibleSegmentsChange, undefined, {\n componentName: \"PieChart\",\n propertyName: \"visibleSegments\",\n changeHandlerName: \"onVisibleSegmentsChange\",\n });\n const allSegmentIds = originalSeries.flatMap((s) => s.data.map((d) => getOptionsId(d)));\n const onVisibleSegmentsChange: CoreChartProps[\"onVisibleItemsChange\"] = ({ detail: { items } }) => {\n const visibleSegments = items.filter((i) => i.visible).map((i) => i.id);\n fireNonCancelableEvent(props.onVisibleSegmentsChange, { visibleSegments });\n };\n\n // Converting donut series to Highcharts pie series.\n const series: Highcharts.SeriesOptionsType[] = originalSeries.map((s) => {\n const data = s.data as Writeable<PieChartProps.PieSegmentOptions[]>;\n const style = s.type === \"pie\" ? Styles.pieSeries : Styles.donutSeries;\n return { ...s, type: \"pie\", data, ...style };\n });\n\n // Pie chart imperative API.\n useImperativeHandle(ref, () => ({\n setVisibleSegments: (visibleSegmentsIds) => apiRef.current?.setItemsVisible(visibleSegmentsIds),\n showAllSegments: () => apiRef.current?.setItemsVisible(allSegmentIds),\n }));\n\n // Get inner area title and description for donut chart.\n const innerArea = useInnerArea(originalSeries, props);\n\n // We convert pie tooltip options to the core chart's getTooltipContent callback,\n // ensuring no internal types are exposed to the consumer-defined render functions.\n const getTooltipContent: CoreChartProps[\"getTooltipContent\"] = () => {\n const transformDetailsProps = ({\n point,\n }: CoreChartProps.TooltipDetailsProps): PieChartProps.TooltipDetailsRenderProps => {\n return {\n totalValue: point.total ?? 0,\n segmentValue: point.y ?? 0,\n segmentId: getOptionsId(point.options),\n segmentName: point.name ?? \"\",\n };\n };\n const transformSlotProps = (props: CoreChartProps.TooltipSlotProps): PieChartProps.TooltipDetailsRenderProps => {\n const point = props.items[0].point;\n return transformDetailsProps({ point });\n };\n return {\n header: tooltip?.header ? (props) => tooltip.header!(transformSlotProps(props)) : undefined,\n details: tooltip?.details ? (props) => tooltip.details!(transformDetailsProps(props)) : undefined,\n body: tooltip?.body ? (props) => tooltip.body!(transformSlotProps(props)) : undefined,\n footer: tooltip?.footer ? (props) => tooltip.footer!(transformSlotProps(props)) : undefined,\n };\n };\n\n // Convert pie segment props to Highcharts segment data labels.\n const segmentDataLabels:\n | Highcharts.SeriesPieDataLabelsOptionsObject\n | Highcharts.SeriesPieDataLabelsOptionsObject[] = {\n position: \"left\",\n formatter() {\n const { segmentTitle, segmentDescription } = props;\n const segmentProps = {\n // For pie series, we expect y, total, and name to be always present, and y to be non-null for any visible segment.\n // However, these are optional in Highcharts types, so we need to do a fallback.\n totalValue: this.total ?? 0,\n segmentValue: this.y ?? 0,\n segmentId: this.options.id,\n segmentName: this.options.name ?? \"\",\n };\n const title = segmentTitle ? segmentTitle(segmentProps) : this.name;\n const description = segmentDescription?.(segmentProps);\n if (title || description) {\n return renderToStaticMarkup(\n <text>\n {title ? <tspan>{title}</tspan> : null}\n <br />\n {description ? <tspan style={Styles.segmentDescriptionCss}>{description}</tspan> : null}\n </text>,\n );\n }\n return null;\n },\n useHTML: false,\n };\n\n const highchartsOptions: Highcharts.Options = {\n chart: {\n events: {\n render(event) {\n innerArea.onChartRender.call(this, event);\n },\n },\n },\n plotOptions: {\n pie: {\n dataLabels: segmentDataLabels,\n },\n },\n series,\n };\n\n return (\n <InternalCoreChart\n {...props}\n callback={(api) => (apiRef.current = api)}\n options={highchartsOptions}\n tooltip={tooltip}\n getTooltipContent={getTooltipContent}\n visibleItems={props.visibleSegments}\n onVisibleItemsChange={onVisibleSegmentsChange}\n className={testClasses.root}\n />\n );\n },\n);\n"]}
1
+ {"version":3,"file":"chart-pie-internal.js","sourceRoot":"","sources":["../../../src/pie-chart/chart-pie-internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,W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on.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef, useImperativeHandle, useRef } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport type Highcharts from \"highcharts\";\n\nimport { useControllableState } from \"@cloudscape-design/component-toolkit\";\n\nimport { InternalCoreChart } from \"../core/chart-core\";\nimport { CoreChartProps } from \"../core/interfaces\";\nimport { getOptionsId } from \"../core/utils\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { fireNonCancelableEvent } from \"../internal/events\";\nimport { SomeRequired, Writeable } from \"../internal/utils/utils\";\nimport { useInnerArea } from \"./chart-inner-area\";\nimport { PieChartProps } from \"./interfaces\";\n\nimport testClasses from \"./test-classes/styles.css.js\";\n\ninterface InternalPieChartProps extends InternalBaseComponentProps, Omit<PieChartProps, \"series\"> {\n series: readonly PieChartProps.SeriesOptions[];\n tooltip: SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\">;\n legend: SomeRequired<PieChartProps.LegendOptions, \"enabled\">;\n}\n\nexport const InternalPieChart = forwardRef(\n ({ series: originalSeries, tooltip, ...props }: InternalPieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n const apiRef = useRef<null | CoreChartProps.ChartAPI>(null);\n\n // When visibleSegments and onVisibleSegmentsChange are provided - the segments visibility can be controlled from the outside.\n // Otherwise - the component handles segments visibility using its internal state.\n useControllableState(props.visibleSegments, props.onVisibleSegmentsChange, undefined, {\n componentName: \"PieChart\",\n propertyName: \"visibleSegments\",\n changeHandlerName: \"onVisibleSegmentsChange\",\n });\n const allSegmentIds = originalSeries.flatMap((s) => s.data.map((d) => getOptionsId(d)));\n const onVisibleSegmentsChange: CoreChartProps[\"onVisibleItemsChange\"] = ({ detail: { items } }) => {\n const visibleSegments = items.filter((i) => i.visible).map((i) => i.id);\n fireNonCancelableEvent(props.onVisibleSegmentsChange, { visibleSegments });\n };\n\n // Converting donut series to Highcharts pie series.\n const series: Highcharts.SeriesOptionsType[] = originalSeries.map((s) => {\n const data = s.data as Writeable<PieChartProps.PieSegmentOptions[]>;\n const style = s.type === \"pie\" ? Styles.pieSeries : Styles.donutSeries;\n return { ...s, type: \"pie\", data, ...style };\n });\n\n // Pie chart imperative API.\n useImperativeHandle(ref, () => ({\n setVisibleSegments: (visibleSegmentsIds) => apiRef.current?.setItemsVisible(visibleSegmentsIds),\n showAllSegments: () => apiRef.current?.setItemsVisible(allSegmentIds),\n }));\n\n // Get inner area title and description for donut chart.\n const innerArea = useInnerArea(originalSeries, props);\n\n // We convert pie tooltip options to the core chart's getTooltipContent callback,\n // ensuring no internal types are exposed to the consumer-defined render functions.\n const getTooltipContent: CoreChartProps[\"getTooltipContent\"] = () => {\n const transformDetailsProps = ({\n point,\n }: CoreChartProps.TooltipDetailsProps): PieChartProps.TooltipDetailsRenderProps => {\n return {\n totalValue: point.total ?? 0,\n segmentValue: point.y ?? 0,\n segmentId: getOptionsId(point.options),\n segmentName: point.name ?? \"\",\n };\n };\n const transformSlotProps = (props: CoreChartProps.TooltipSlotProps): PieChartProps.TooltipDetailsRenderProps => {\n const point = props.items[0].point;\n return transformDetailsProps({ point, hideTooltip: props.hideTooltip });\n };\n return {\n header: tooltip?.header ? (props) => tooltip.header!(transformSlotProps(props)) : undefined,\n details: tooltip?.details ? (props) => tooltip.details!(transformDetailsProps(props)) : undefined,\n body: tooltip?.body ? (props) => tooltip.body!(transformSlotProps(props)) : undefined,\n footer: tooltip?.footer ? (props) => tooltip.footer!(transformSlotProps(props)) : undefined,\n };\n };\n\n // Convert pie segment props to Highcharts segment data labels.\n const segmentDataLabels:\n | Highcharts.SeriesPieDataLabelsOptionsObject\n | Highcharts.SeriesPieDataLabelsOptionsObject[] = {\n position: \"left\",\n formatter() {\n const { segmentTitle, segmentDescription } = props;\n const segmentProps = {\n // For pie series, we expect y, total, and name to be always present, and y to be non-null for any visible segment.\n // However, these are optional in Highcharts types, so we need to do a fallback.\n totalValue: this.total ?? 0,\n segmentValue: this.y ?? 0,\n segmentId: this.options.id,\n segmentName: this.options.name ?? \"\",\n };\n const title = segmentTitle ? segmentTitle(segmentProps) : this.name;\n const description = segmentDescription?.(segmentProps);\n if (title || description) {\n return renderToStaticMarkup(\n <text>\n {title ? <tspan>{title}</tspan> : null}\n <br />\n {description ? <tspan style={Styles.segmentDescriptionCss}>{description}</tspan> : null}\n </text>,\n );\n }\n return null;\n },\n useHTML: false,\n };\n\n const highchartsOptions: Highcharts.Options = {\n chart: {\n events: {\n render(event) {\n innerArea.onChartRender.call(this, event);\n },\n },\n },\n plotOptions: {\n pie: {\n dataLabels: segmentDataLabels,\n },\n },\n series,\n };\n\n return (\n <InternalCoreChart\n {...props}\n callback={(api) => (apiRef.current = api)}\n options={highchartsOptions}\n tooltip={tooltip}\n getTooltipContent={getTooltipContent}\n visibleItems={props.visibleSegments}\n onVisibleItemsChange={onVisibleSegmentsChange}\n className={testClasses.root}\n />\n );\n },\n);\n"]}