@cloudscape-design/components 3.0.246 → 3.0.248
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/annotation-context/annotation/styles.css.js +24 -24
- package/annotation-context/annotation/styles.scoped.css +30 -30
- package/annotation-context/annotation/styles.selectors.js +24 -24
- package/app-layout/drawer/index.d.ts +3 -21
- package/app-layout/drawer/index.d.ts.map +1 -1
- package/app-layout/drawer/index.js +25 -5
- package/app-layout/drawer/index.js.map +1 -1
- package/app-layout/drawer/interfaces.d.ts +84 -0
- package/app-layout/drawer/interfaces.d.ts.map +1 -0
- package/app-layout/drawer/interfaces.js +2 -0
- package/app-layout/drawer/interfaces.js.map +1 -0
- package/app-layout/drawer/resizable-drawer.d.ts +4 -0
- package/app-layout/drawer/resizable-drawer.d.ts.map +1 -0
- package/app-layout/drawer/resizable-drawer.js +51 -0
- package/app-layout/drawer/resizable-drawer.js.map +1 -0
- package/app-layout/drawer/styles.css.js +10 -5
- package/app-layout/drawer/styles.scoped.css +46 -10
- package/app-layout/drawer/styles.selectors.js +10 -5
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +142 -17
- package/app-layout/index.js.map +1 -1
- package/app-layout/mobile-toolbar/index.d.ts +10 -1
- package/app-layout/mobile-toolbar/index.d.ts.map +1 -1
- package/app-layout/mobile-toolbar/index.js +3 -2
- package/app-layout/mobile-toolbar/index.js.map +1 -1
- package/app-layout/mobile-toolbar/styles.css.js +5 -4
- package/app-layout/mobile-toolbar/styles.scoped.css +11 -7
- package/app-layout/mobile-toolbar/styles.selectors.js +5 -4
- package/app-layout/notifications/styles.css.js +3 -3
- package/app-layout/notifications/styles.scoped.css +7 -7
- package/app-layout/notifications/styles.selectors.js +3 -3
- package/app-layout/test-classes/styles.css.js +18 -13
- package/app-layout/test-classes/styles.scoped.css +33 -13
- package/app-layout/test-classes/styles.selectors.js +18 -13
- package/app-layout/toggles/index.d.ts.map +1 -1
- package/app-layout/toggles/index.js +2 -2
- package/app-layout/toggles/index.js.map +1 -1
- package/app-layout/toggles/interfaces.d.ts +3 -1
- package/app-layout/toggles/interfaces.d.ts.map +1 -1
- package/app-layout/toggles/interfaces.js.map +1 -1
- package/app-layout/utils/use-drawer-focus-control.d.ts +21 -0
- package/app-layout/utils/use-drawer-focus-control.d.ts.map +1 -0
- package/app-layout/utils/use-drawer-focus-control.js +65 -0
- package/app-layout/utils/use-drawer-focus-control.js.map +1 -0
- package/app-layout/visual-refresh/app-bar.d.ts.map +1 -1
- package/app-layout/visual-refresh/app-bar.js +8 -6
- package/app-layout/visual-refresh/app-bar.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +13 -6
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +107 -52
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/drawers.d.ts +47 -0
- package/app-layout/visual-refresh/drawers.d.ts.map +1 -0
- package/app-layout/visual-refresh/drawers.js +127 -0
- package/app-layout/visual-refresh/drawers.js.map +1 -0
- package/app-layout/visual-refresh/header.js +2 -2
- package/app-layout/visual-refresh/header.js.map +1 -1
- package/app-layout/visual-refresh/index.d.ts.map +1 -1
- package/app-layout/visual-refresh/index.js +3 -1
- package/app-layout/visual-refresh/index.js.map +1 -1
- package/app-layout/visual-refresh/layout.d.ts.map +1 -1
- package/app-layout/visual-refresh/layout.js +5 -42
- package/app-layout/visual-refresh/layout.js.map +1 -1
- package/app-layout/visual-refresh/main.d.ts.map +1 -1
- package/app-layout/visual-refresh/main.js +2 -3
- package/app-layout/visual-refresh/main.js.map +1 -1
- package/app-layout/visual-refresh/navigation.js +2 -2
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/notifications.d.ts.map +1 -1
- package/app-layout/visual-refresh/notifications.js +2 -2
- package/app-layout/visual-refresh/notifications.js.map +1 -1
- package/app-layout/visual-refresh/split-panel.js +2 -2
- package/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +71 -61
- package/app-layout/visual-refresh/styles.scoped.css +437 -229
- package/app-layout/visual-refresh/styles.selectors.js +71 -61
- package/app-layout/visual-refresh/tools.d.ts.map +1 -1
- package/app-layout/visual-refresh/tools.js +7 -3
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/app-layout/visual-refresh/trigger-button.d.ts +4 -3
- package/app-layout/visual-refresh/trigger-button.d.ts.map +1 -1
- package/app-layout/visual-refresh/trigger-button.js +5 -4
- package/app-layout/visual-refresh/trigger-button.js.map +1 -1
- package/area-chart/internal.js +1 -1
- package/area-chart/internal.js.map +1 -1
- package/flashbar/styles.css.js +45 -45
- package/flashbar/styles.scoped.css +169 -169
- package/flashbar/styles.selectors.js +45 -45
- package/internal/base-component/styles.scoped.css +24 -0
- package/internal/context/app-layout-context.d.ts +0 -1
- package/internal/context/app-layout-context.d.ts.map +1 -1
- package/internal/context/app-layout-context.js.map +1 -1
- package/internal/context/dynamic-overlap-context.d.ts +3 -0
- package/internal/context/dynamic-overlap-context.d.ts.map +1 -0
- package/internal/context/dynamic-overlap-context.js +5 -0
- package/internal/context/dynamic-overlap-context.js.map +1 -0
- package/internal/environment.js +1 -1
- package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
- package/internal/generated/custom-css-properties/index.js +31 -30
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/generated/styles/tokens.d.ts +2 -0
- package/internal/generated/styles/tokens.js +2 -0
- package/internal/generated/theming/index.cjs +140 -0
- package/internal/generated/theming/index.js +140 -0
- package/internal/hooks/use-dynamic-overlap/index.js +7 -7
- package/internal/hooks/use-dynamic-overlap/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/mixed-line-bar-chart/internal.js +1 -1
- package/mixed-line-bar-chart/internal.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/index.js +1 -1
- package/pie-chart/index.js.map +1 -1
- package/space-between/internal.js +1 -1
- package/space-between/internal.js.map +1 -1
- package/space-between/styles.css.js +20 -28
- package/space-between/styles.scoped.css +37 -101
- package/space-between/styles.selectors.js +20 -28
- package/test-utils/dom/button/index.js +1 -6
- package/test-utils/dom/button/index.js.map +1 -1
- package/test-utils/dom/flashbar/index.d.ts +5 -1
- package/test-utils/dom/flashbar/index.js +7 -0
- package/test-utils/dom/flashbar/index.js.map +1 -1
- package/test-utils/selectors/flashbar/index.d.ts +5 -1
- package/test-utils/selectors/flashbar/index.js +7 -0
- package/test-utils/selectors/flashbar/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/interfaces.d.ts +4 -0
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
- package/wizard/wizard-actions.d.ts +2 -1
- package/wizard/wizard-actions.d.ts.map +1 -1
- package/wizard/wizard-actions.js +2 -2
- package/wizard/wizard-actions.js.map +1 -1
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +1 -1
- package/wizard/wizard-form.js.map +1 -1
|
@@ -879,6 +879,10 @@ export var preset = {
|
|
|
879
879
|
"light": "{colorGrey200}",
|
|
880
880
|
"dark": "{colorGrey650}"
|
|
881
881
|
},
|
|
882
|
+
"colorBackgroundLayoutPanelTriggerActive": {
|
|
883
|
+
"light": "{colorBlue900}",
|
|
884
|
+
"dark": "{colorBlue400}"
|
|
885
|
+
},
|
|
882
886
|
"colorBackgroundLayoutToggleActive": {
|
|
883
887
|
"light": "{colorGrey650}",
|
|
884
888
|
"dark": "{colorGrey650}"
|
|
@@ -1195,6 +1199,10 @@ export var preset = {
|
|
|
1195
1199
|
"light": "{colorGreyTransparentHeavy}",
|
|
1196
1200
|
"dark": "{colorGreyTransparentHeavy}"
|
|
1197
1201
|
},
|
|
1202
|
+
"colorShadowLayoutPanelTrigger": {
|
|
1203
|
+
"light": "{colorGrey300}",
|
|
1204
|
+
"dark": "{colorGrey650}"
|
|
1205
|
+
},
|
|
1198
1206
|
"colorShadowMedium": {
|
|
1199
1207
|
"light": "{colorGreyTransparent}",
|
|
1200
1208
|
"dark": "{colorGreyTransparent}"
|
|
@@ -1527,6 +1535,14 @@ export var preset = {
|
|
|
1527
1535
|
"light": "{colorBlue600}",
|
|
1528
1536
|
"dark": "{colorBlue500}"
|
|
1529
1537
|
},
|
|
1538
|
+
"colorTextLayoutPanelTriggerHover": {
|
|
1539
|
+
"light": "{colorBlue600}",
|
|
1540
|
+
"dark": "{colorBlue500}"
|
|
1541
|
+
},
|
|
1542
|
+
"colorTextLayoutPanelTriggerActive": {
|
|
1543
|
+
"light": "{colorWhite}",
|
|
1544
|
+
"dark": "{colorGrey800}"
|
|
1545
|
+
},
|
|
1530
1546
|
"colorTextSmall": {
|
|
1531
1547
|
"light": "{colorGrey550}",
|
|
1532
1548
|
"dark": "{colorGrey450}"
|
|
@@ -1563,6 +1579,14 @@ export var preset = {
|
|
|
1563
1579
|
"light": "{colorBlue200}",
|
|
1564
1580
|
"dark": "{colorBlue600}"
|
|
1565
1581
|
},
|
|
1582
|
+
"colorDragPlaceholderActive": {
|
|
1583
|
+
"light": "{colorGrey200}",
|
|
1584
|
+
"dark": "{colorGrey550}"
|
|
1585
|
+
},
|
|
1586
|
+
"colorDragPlaceholderHover": {
|
|
1587
|
+
"light": "{colorBlue200}",
|
|
1588
|
+
"dark": "{colorBlue600}"
|
|
1589
|
+
},
|
|
1566
1590
|
"fontBodyMLineHeight": "22px",
|
|
1567
1591
|
"fontBodyMSize": "14px",
|
|
1568
1592
|
"fontBodySLetterSpacing": "0.005em",
|
|
@@ -2791,6 +2815,10 @@ export var preset = {
|
|
|
2791
2815
|
"light": "{colorGrey650}",
|
|
2792
2816
|
"dark": "{colorGrey650}"
|
|
2793
2817
|
},
|
|
2818
|
+
"colorBackgroundLayoutPanelTriggerActive": {
|
|
2819
|
+
"light": "{colorBlue400}",
|
|
2820
|
+
"dark": "{colorBlue400}"
|
|
2821
|
+
},
|
|
2794
2822
|
"colorBackgroundLayoutToggleActive": {
|
|
2795
2823
|
"light": "{colorGrey650}",
|
|
2796
2824
|
"dark": "{colorGrey650}"
|
|
@@ -3107,6 +3135,10 @@ export var preset = {
|
|
|
3107
3135
|
"light": "{colorGreyTransparentHeavy}",
|
|
3108
3136
|
"dark": "{colorGreyTransparentHeavy}"
|
|
3109
3137
|
},
|
|
3138
|
+
"colorShadowLayoutPanelTrigger": {
|
|
3139
|
+
"light": "{colorGrey650}",
|
|
3140
|
+
"dark": "{colorGrey650}"
|
|
3141
|
+
},
|
|
3110
3142
|
"colorShadowMedium": {
|
|
3111
3143
|
"light": "{colorGreyTransparent}",
|
|
3112
3144
|
"dark": "{colorGreyTransparent}"
|
|
@@ -3439,6 +3471,14 @@ export var preset = {
|
|
|
3439
3471
|
"light": "{colorBlue500}",
|
|
3440
3472
|
"dark": "{colorBlue500}"
|
|
3441
3473
|
},
|
|
3474
|
+
"colorTextLayoutPanelTriggerHover": {
|
|
3475
|
+
"light": "{colorBlue500}",
|
|
3476
|
+
"dark": "{colorBlue500}"
|
|
3477
|
+
},
|
|
3478
|
+
"colorTextLayoutPanelTriggerActive": {
|
|
3479
|
+
"light": "{colorGrey800}",
|
|
3480
|
+
"dark": "{colorGrey800}"
|
|
3481
|
+
},
|
|
3442
3482
|
"colorTextSmall": {
|
|
3443
3483
|
"light": "{colorGrey450}",
|
|
3444
3484
|
"dark": "{colorGrey450}"
|
|
@@ -3474,6 +3514,14 @@ export var preset = {
|
|
|
3474
3514
|
"colorBoardPlaceholderHover": {
|
|
3475
3515
|
"light": "{colorBlue600}",
|
|
3476
3516
|
"dark": "{colorBlue600}"
|
|
3517
|
+
},
|
|
3518
|
+
"colorDragPlaceholderActive": {
|
|
3519
|
+
"light": "{colorGrey550}",
|
|
3520
|
+
"dark": "{colorGrey550}"
|
|
3521
|
+
},
|
|
3522
|
+
"colorDragPlaceholderHover": {
|
|
3523
|
+
"light": "{colorBlue600}",
|
|
3524
|
+
"dark": "{colorBlue600}"
|
|
3477
3525
|
}
|
|
3478
3526
|
}
|
|
3479
3527
|
},
|
|
@@ -3721,6 +3769,10 @@ export var preset = {
|
|
|
3721
3769
|
"light": "{colorGrey650}",
|
|
3722
3770
|
"dark": "{colorGrey650}"
|
|
3723
3771
|
},
|
|
3772
|
+
"colorBackgroundLayoutPanelTriggerActive": {
|
|
3773
|
+
"light": "{colorBlue400}",
|
|
3774
|
+
"dark": "{colorBlue400}"
|
|
3775
|
+
},
|
|
3724
3776
|
"colorBackgroundLayoutToggleActive": {
|
|
3725
3777
|
"light": "{colorGrey650}",
|
|
3726
3778
|
"dark": "{colorGrey650}"
|
|
@@ -4037,6 +4089,10 @@ export var preset = {
|
|
|
4037
4089
|
"light": "{colorGreyTransparentHeavy}",
|
|
4038
4090
|
"dark": "{colorGreyTransparentHeavy}"
|
|
4039
4091
|
},
|
|
4092
|
+
"colorShadowLayoutPanelTrigger": {
|
|
4093
|
+
"light": "{colorGrey650}",
|
|
4094
|
+
"dark": "{colorGrey650}"
|
|
4095
|
+
},
|
|
4040
4096
|
"colorShadowMedium": {
|
|
4041
4097
|
"light": "{colorGreyTransparent}",
|
|
4042
4098
|
"dark": "{colorGreyTransparent}"
|
|
@@ -4369,6 +4425,14 @@ export var preset = {
|
|
|
4369
4425
|
"light": "{colorBlue500}",
|
|
4370
4426
|
"dark": "{colorBlue500}"
|
|
4371
4427
|
},
|
|
4428
|
+
"colorTextLayoutPanelTriggerHover": {
|
|
4429
|
+
"light": "{colorBlue500}",
|
|
4430
|
+
"dark": "{colorBlue500}"
|
|
4431
|
+
},
|
|
4432
|
+
"colorTextLayoutPanelTriggerActive": {
|
|
4433
|
+
"light": "{colorGrey800}",
|
|
4434
|
+
"dark": "{colorGrey800}"
|
|
4435
|
+
},
|
|
4372
4436
|
"colorTextSmall": {
|
|
4373
4437
|
"light": "{colorGrey450}",
|
|
4374
4438
|
"dark": "{colorGrey450}"
|
|
@@ -4404,6 +4468,14 @@ export var preset = {
|
|
|
4404
4468
|
"colorBoardPlaceholderHover": {
|
|
4405
4469
|
"light": "{colorBlue600}",
|
|
4406
4470
|
"dark": "{colorBlue600}"
|
|
4471
|
+
},
|
|
4472
|
+
"colorDragPlaceholderActive": {
|
|
4473
|
+
"light": "{colorGrey550}",
|
|
4474
|
+
"dark": "{colorGrey550}"
|
|
4475
|
+
},
|
|
4476
|
+
"colorDragPlaceholderHover": {
|
|
4477
|
+
"light": "{colorBlue600}",
|
|
4478
|
+
"dark": "{colorBlue600}"
|
|
4407
4479
|
}
|
|
4408
4480
|
}
|
|
4409
4481
|
},
|
|
@@ -4591,6 +4663,10 @@ export var preset = {
|
|
|
4591
4663
|
"light": "{colorGrey200}",
|
|
4592
4664
|
"dark": "{colorGrey650}"
|
|
4593
4665
|
},
|
|
4666
|
+
"colorBackgroundLayoutPanelTriggerActive": {
|
|
4667
|
+
"light": "{colorBlue900}",
|
|
4668
|
+
"dark": "{colorBlue400}"
|
|
4669
|
+
},
|
|
4594
4670
|
"colorBackgroundLayoutToggleActive": {
|
|
4595
4671
|
"light": "{colorGrey650}",
|
|
4596
4672
|
"dark": "{colorGrey650}"
|
|
@@ -4907,6 +4983,10 @@ export var preset = {
|
|
|
4907
4983
|
"light": "{colorGreyTransparentHeavy}",
|
|
4908
4984
|
"dark": "{colorGreyTransparentHeavy}"
|
|
4909
4985
|
},
|
|
4986
|
+
"colorShadowLayoutPanelTrigger": {
|
|
4987
|
+
"light": "{colorGrey300}",
|
|
4988
|
+
"dark": "{colorGrey650}"
|
|
4989
|
+
},
|
|
4910
4990
|
"colorShadowMedium": {
|
|
4911
4991
|
"light": "{colorGreyTransparent}",
|
|
4912
4992
|
"dark": "{colorGreyTransparent}"
|
|
@@ -5239,6 +5319,14 @@ export var preset = {
|
|
|
5239
5319
|
"light": "{colorBlue600}",
|
|
5240
5320
|
"dark": "{colorBlue500}"
|
|
5241
5321
|
},
|
|
5322
|
+
"colorTextLayoutPanelTriggerHover": {
|
|
5323
|
+
"light": "{colorBlue600}",
|
|
5324
|
+
"dark": "{colorBlue500}"
|
|
5325
|
+
},
|
|
5326
|
+
"colorTextLayoutPanelTriggerActive": {
|
|
5327
|
+
"light": "{colorWhite}",
|
|
5328
|
+
"dark": "{colorGrey800}"
|
|
5329
|
+
},
|
|
5242
5330
|
"colorTextSmall": {
|
|
5243
5331
|
"light": "{colorGrey550}",
|
|
5244
5332
|
"dark": "{colorGrey450}"
|
|
@@ -5274,6 +5362,14 @@ export var preset = {
|
|
|
5274
5362
|
"colorBoardPlaceholderHover": {
|
|
5275
5363
|
"light": "{colorBlue200}",
|
|
5276
5364
|
"dark": "{colorBlue600}"
|
|
5365
|
+
},
|
|
5366
|
+
"colorDragPlaceholderActive": {
|
|
5367
|
+
"light": "{colorGrey200}",
|
|
5368
|
+
"dark": "{colorGrey550}"
|
|
5369
|
+
},
|
|
5370
|
+
"colorDragPlaceholderHover": {
|
|
5371
|
+
"light": "{colorBlue200}",
|
|
5372
|
+
"dark": "{colorBlue600}"
|
|
5277
5373
|
}
|
|
5278
5374
|
}
|
|
5279
5375
|
},
|
|
@@ -5461,6 +5557,10 @@ export var preset = {
|
|
|
5461
5557
|
"light": "{colorGrey200}",
|
|
5462
5558
|
"dark": "{colorGrey650}"
|
|
5463
5559
|
},
|
|
5560
|
+
"colorBackgroundLayoutPanelTriggerActive": {
|
|
5561
|
+
"light": "{colorBlue900}",
|
|
5562
|
+
"dark": "{colorBlue400}"
|
|
5563
|
+
},
|
|
5464
5564
|
"colorBackgroundLayoutToggleActive": {
|
|
5465
5565
|
"light": "{colorGrey650}",
|
|
5466
5566
|
"dark": "{colorGrey650}"
|
|
@@ -5777,6 +5877,10 @@ export var preset = {
|
|
|
5777
5877
|
"light": "{colorGreyTransparentHeavy}",
|
|
5778
5878
|
"dark": "{colorGreyTransparentHeavy}"
|
|
5779
5879
|
},
|
|
5880
|
+
"colorShadowLayoutPanelTrigger": {
|
|
5881
|
+
"light": "{colorGrey300}",
|
|
5882
|
+
"dark": "{colorGrey650}"
|
|
5883
|
+
},
|
|
5780
5884
|
"colorShadowMedium": {
|
|
5781
5885
|
"light": "{colorGreyTransparent}",
|
|
5782
5886
|
"dark": "{colorGreyTransparent}"
|
|
@@ -6109,6 +6213,14 @@ export var preset = {
|
|
|
6109
6213
|
"light": "{colorBlue600}",
|
|
6110
6214
|
"dark": "{colorBlue500}"
|
|
6111
6215
|
},
|
|
6216
|
+
"colorTextLayoutPanelTriggerHover": {
|
|
6217
|
+
"light": "{colorBlue600}",
|
|
6218
|
+
"dark": "{colorBlue500}"
|
|
6219
|
+
},
|
|
6220
|
+
"colorTextLayoutPanelTriggerActive": {
|
|
6221
|
+
"light": "{colorWhite}",
|
|
6222
|
+
"dark": "{colorGrey800}"
|
|
6223
|
+
},
|
|
6112
6224
|
"colorTextSmall": {
|
|
6113
6225
|
"light": "{colorGrey550}",
|
|
6114
6226
|
"dark": "{colorGrey450}"
|
|
@@ -6144,6 +6256,14 @@ export var preset = {
|
|
|
6144
6256
|
"colorBoardPlaceholderHover": {
|
|
6145
6257
|
"light": "{colorBlue200}",
|
|
6146
6258
|
"dark": "{colorBlue600}"
|
|
6259
|
+
},
|
|
6260
|
+
"colorDragPlaceholderActive": {
|
|
6261
|
+
"light": "{colorGrey200}",
|
|
6262
|
+
"dark": "{colorGrey550}"
|
|
6263
|
+
},
|
|
6264
|
+
"colorDragPlaceholderHover": {
|
|
6265
|
+
"light": "{colorBlue200}",
|
|
6266
|
+
"dark": "{colorBlue600}"
|
|
6147
6267
|
}
|
|
6148
6268
|
}
|
|
6149
6269
|
}
|
|
@@ -6348,6 +6468,7 @@ export var preset = {
|
|
|
6348
6468
|
"colorBackgroundLayoutMobilePanel": "color",
|
|
6349
6469
|
"colorBackgroundLayoutPanelContent": "color",
|
|
6350
6470
|
"colorBackgroundLayoutPanelHover": "color",
|
|
6471
|
+
"colorBackgroundLayoutPanelTriggerActive": "color",
|
|
6351
6472
|
"colorBackgroundLayoutToggleActive": "color",
|
|
6352
6473
|
"colorBackgroundLayoutToggleDefault": "color",
|
|
6353
6474
|
"colorBackgroundLayoutToggleHover": "color",
|
|
@@ -6427,6 +6548,7 @@ export var preset = {
|
|
|
6427
6548
|
"colorForegroundControlDefault": "color",
|
|
6428
6549
|
"colorForegroundControlDisabled": "color",
|
|
6429
6550
|
"colorShadowDefault": "color",
|
|
6551
|
+
"colorShadowLayoutPanelTrigger": "color",
|
|
6430
6552
|
"colorShadowMedium": "color",
|
|
6431
6553
|
"colorShadowSide": "color",
|
|
6432
6554
|
"colorStrokeCodeEditorResizeHandler": "color",
|
|
@@ -6510,6 +6632,8 @@ export var preset = {
|
|
|
6510
6632
|
"colorTextSegmentActive": "color",
|
|
6511
6633
|
"colorTextSegmentDefault": "color",
|
|
6512
6634
|
"colorTextSegmentHover": "color",
|
|
6635
|
+
"colorTextLayoutPanelTriggerHover": "color",
|
|
6636
|
+
"colorTextLayoutPanelTriggerActive": "color",
|
|
6513
6637
|
"colorTextSmall": "color",
|
|
6514
6638
|
"colorTextStatusError": "color",
|
|
6515
6639
|
"colorTextStatusInactive": "color",
|
|
@@ -6519,6 +6643,8 @@ export var preset = {
|
|
|
6519
6643
|
"colorTextTopNavigationTitle": "color",
|
|
6520
6644
|
"colorBoardPlaceholderActive": "color",
|
|
6521
6645
|
"colorBoardPlaceholderHover": "color",
|
|
6646
|
+
"colorDragPlaceholderActive": "color",
|
|
6647
|
+
"colorDragPlaceholderHover": "color",
|
|
6522
6648
|
"motionDurationExtraFast": "motion",
|
|
6523
6649
|
"motionDurationExtraSlow": "motion",
|
|
6524
6650
|
"motionDurationFast": "motion",
|
|
@@ -7070,6 +7196,8 @@ export var preset = {
|
|
|
7070
7196
|
"colorTextStatusWarning",
|
|
7071
7197
|
"colorBoardPlaceholderActive",
|
|
7072
7198
|
"colorBoardPlaceholderHover",
|
|
7199
|
+
"colorDragPlaceholderActive",
|
|
7200
|
+
"colorDragPlaceholderHover",
|
|
7073
7201
|
"fontFamilyBase",
|
|
7074
7202
|
"fontFamilyMonospace",
|
|
7075
7203
|
"borderRadiusAlert",
|
|
@@ -7365,6 +7493,7 @@ export var preset = {
|
|
|
7365
7493
|
"colorBackgroundLayoutMobilePanel": "color-background-layout-mobile-panel",
|
|
7366
7494
|
"colorBackgroundLayoutPanelContent": "color-background-layout-panel-content",
|
|
7367
7495
|
"colorBackgroundLayoutPanelHover": "color-background-layout-panel-hover",
|
|
7496
|
+
"colorBackgroundLayoutPanelTriggerActive": "color-background-layout-panel-trigger-active",
|
|
7368
7497
|
"colorBackgroundLayoutToggleActive": "color-background-layout-toggle-active",
|
|
7369
7498
|
"colorBackgroundLayoutToggleDefault": "color-background-layout-toggle-default",
|
|
7370
7499
|
"colorBackgroundLayoutToggleHover": "color-background-layout-toggle-hover",
|
|
@@ -7444,6 +7573,7 @@ export var preset = {
|
|
|
7444
7573
|
"colorForegroundControlDefault": "color-foreground-control-default",
|
|
7445
7574
|
"colorForegroundControlDisabled": "color-foreground-control-disabled",
|
|
7446
7575
|
"colorShadowDefault": "color-shadow-default",
|
|
7576
|
+
"colorShadowLayoutPanelTrigger": "color-shadow-layout-panel-trigger",
|
|
7447
7577
|
"colorShadowMedium": "color-shadow-medium",
|
|
7448
7578
|
"colorShadowSide": "color-shadow-side",
|
|
7449
7579
|
"colorStrokeCodeEditorResizeHandler": "color-stroke-code-editor-resize-handler",
|
|
@@ -7527,6 +7657,8 @@ export var preset = {
|
|
|
7527
7657
|
"colorTextSegmentActive": "color-text-segment-active",
|
|
7528
7658
|
"colorTextSegmentDefault": "color-text-segment-default",
|
|
7529
7659
|
"colorTextSegmentHover": "color-text-segment-hover",
|
|
7660
|
+
"colorTextLayoutPanelTriggerHover": "color-text-layout-panel-trigger-hover",
|
|
7661
|
+
"colorTextLayoutPanelTriggerActive": "color-text-layout-panel-trigger-active",
|
|
7530
7662
|
"colorTextSmall": "color-text-small",
|
|
7531
7663
|
"colorTextStatusError": "color-text-status-error",
|
|
7532
7664
|
"colorTextStatusInactive": "color-text-status-inactive",
|
|
@@ -7536,6 +7668,8 @@ export var preset = {
|
|
|
7536
7668
|
"colorTextTopNavigationTitle": "color-text-top-navigation-title",
|
|
7537
7669
|
"colorBoardPlaceholderActive": "color-board-placeholder-active",
|
|
7538
7670
|
"colorBoardPlaceholderHover": "color-board-placeholder-hover",
|
|
7671
|
+
"colorDragPlaceholderActive": "color-drag-placeholder-active",
|
|
7672
|
+
"colorDragPlaceholderHover": "color-drag-placeholder-hover",
|
|
7539
7673
|
"fontBodyMLineHeight": "font-body-m-line-height",
|
|
7540
7674
|
"fontBodyMSize": "font-body-m-size",
|
|
7541
7675
|
"fontBodySLetterSpacing": "font-body-s-letter-spacing",
|
|
@@ -8019,6 +8153,7 @@ export var preset = {
|
|
|
8019
8153
|
"colorBackgroundLayoutMobilePanel": "--color-background-layout-mobile-panel-9vweqk",
|
|
8020
8154
|
"colorBackgroundLayoutPanelContent": "--color-background-layout-panel-content-808qum",
|
|
8021
8155
|
"colorBackgroundLayoutPanelHover": "--color-background-layout-panel-hover-0bg3gq",
|
|
8156
|
+
"colorBackgroundLayoutPanelTriggerActive": "--color-background-layout-panel-trigger-active-uf4o0r",
|
|
8022
8157
|
"colorBackgroundLayoutToggleActive": "--color-background-layout-toggle-active-d15dki",
|
|
8023
8158
|
"colorBackgroundLayoutToggleDefault": "--color-background-layout-toggle-default-f9hnkv",
|
|
8024
8159
|
"colorBackgroundLayoutToggleHover": "--color-background-layout-toggle-hover-gi0e0b",
|
|
@@ -8098,6 +8233,7 @@ export var preset = {
|
|
|
8098
8233
|
"colorForegroundControlDefault": "--color-foreground-control-default-7ajdem",
|
|
8099
8234
|
"colorForegroundControlDisabled": "--color-foreground-control-disabled-v6a97u",
|
|
8100
8235
|
"colorShadowDefault": "--color-shadow-default-3se70f",
|
|
8236
|
+
"colorShadowLayoutPanelTrigger": "--color-shadow-layout-panel-trigger-t4yazw",
|
|
8101
8237
|
"colorShadowMedium": "--color-shadow-medium-02bwpe",
|
|
8102
8238
|
"colorShadowSide": "--color-shadow-side-07co14",
|
|
8103
8239
|
"colorStrokeCodeEditorResizeHandler": "--color-stroke-code-editor-resize-handler-lop07p",
|
|
@@ -8181,6 +8317,8 @@ export var preset = {
|
|
|
8181
8317
|
"colorTextSegmentActive": "--color-text-segment-active-gc2jjl",
|
|
8182
8318
|
"colorTextSegmentDefault": "--color-text-segment-default-bf7rka",
|
|
8183
8319
|
"colorTextSegmentHover": "--color-text-segment-hover-5pccvg",
|
|
8320
|
+
"colorTextLayoutPanelTriggerHover": "--color-text-layout-panel-trigger-hover-yw2kb4",
|
|
8321
|
+
"colorTextLayoutPanelTriggerActive": "--color-text-layout-panel-trigger-active-mt4zu0",
|
|
8184
8322
|
"colorTextSmall": "--color-text-small-le1y42",
|
|
8185
8323
|
"colorTextStatusError": "--color-text-status-error-5sesl6",
|
|
8186
8324
|
"colorTextStatusInactive": "--color-text-status-inactive-5ei55p",
|
|
@@ -8190,6 +8328,8 @@ export var preset = {
|
|
|
8190
8328
|
"colorTextTopNavigationTitle": "--color-text-top-navigation-title-oypxe3",
|
|
8191
8329
|
"colorBoardPlaceholderActive": "--color-board-placeholder-active-vaxzdf",
|
|
8192
8330
|
"colorBoardPlaceholderHover": "--color-board-placeholder-hover-v1s7kq",
|
|
8331
|
+
"colorDragPlaceholderActive": "--color-drag-placeholder-active-fkpj7i",
|
|
8332
|
+
"colorDragPlaceholderHover": "--color-drag-placeholder-hover-3ohnz1",
|
|
8193
8333
|
"fontBodyMLineHeight": "--font-body-m-line-height-i7xxvv",
|
|
8194
8334
|
"fontBodyMSize": "--font-body-m-size-sregvd",
|
|
8195
8335
|
"fontBodySLetterSpacing": "--font-body-s-letter-spacing-cy0oxj",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { useLayoutEffect } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { useContext, useLayoutEffect } from 'react';
|
|
4
|
+
import { DynamicOverlapContext } from '../../context/dynamic-overlap-context';
|
|
5
5
|
import { useContainerQuery } from '../container-queries';
|
|
6
6
|
/**
|
|
7
7
|
* Observes the height of an element referenced by the returning ref and sets the value as overlapping
|
|
@@ -12,18 +12,18 @@ import { useContainerQuery } from '../container-queries';
|
|
|
12
12
|
export function useDynamicOverlap(props) {
|
|
13
13
|
var _a;
|
|
14
14
|
const disabled = (_a = props === null || props === void 0 ? void 0 : props.disabled) !== null && _a !== void 0 ? _a : false;
|
|
15
|
-
const
|
|
16
|
-
const [
|
|
15
|
+
const setDynamicOverlapHeight = useContext(DynamicOverlapContext);
|
|
16
|
+
const [overlapHeight, overlapElementRef] = useContainerQuery(rect => rect.height);
|
|
17
17
|
useLayoutEffect(function handleDynamicOverlapHeight() {
|
|
18
18
|
if (!disabled) {
|
|
19
|
-
setDynamicOverlapHeight
|
|
19
|
+
setDynamicOverlapHeight(overlapHeight !== null && overlapHeight !== void 0 ? overlapHeight : 0);
|
|
20
20
|
}
|
|
21
21
|
return () => {
|
|
22
22
|
if (!disabled) {
|
|
23
|
-
setDynamicOverlapHeight
|
|
23
|
+
setDynamicOverlapHeight(0);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
}, [disabled,
|
|
26
|
+
}, [disabled, overlapHeight, setDynamicOverlapHeight]);
|
|
27
27
|
return overlapElementRef;
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/hooks/use-dynamic-overlap/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/hooks/use-dynamic-overlap/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA8B;;IAC9D,MAAM,QAAQ,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,mCAAI,KAAK,CAAC;IAC1C,MAAM,uBAAuB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClE,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAElF,eAAe,CACb,SAAS,0BAA0B;QACjC,IAAI,CAAC,QAAQ,EAAE;YACb,uBAAuB,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,CAAC,CAAC,CAAC;SAC7C;QAED,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,QAAQ,EAAE;gBACb,uBAAuB,CAAC,CAAC,CAAC,CAAC;aAC5B;QACH,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,QAAQ,EAAE,aAAa,EAAE,uBAAuB,CAAC,CACnD,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useContext, useLayoutEffect } from 'react';\n\nimport { DynamicOverlapContext } from '../../context/dynamic-overlap-context';\nimport { useContainerQuery } from '../container-queries';\n\nexport interface UseDynamicOverlapProps {\n /**\n * Disables hook if not needed. By default, `false`.\n */\n disabled?: boolean;\n}\n\n/**\n * Observes the height of an element referenced by the returning ref and sets the value as overlapping\n * height for the surrounding AppLayout component.\n * @param props.disabled disables hook if not applicable\n * @returns ref to be measured as overlapping height\n */\nexport function useDynamicOverlap(props?: UseDynamicOverlapProps) {\n const disabled = props?.disabled ?? false;\n const setDynamicOverlapHeight = useContext(DynamicOverlapContext);\n const [overlapHeight, overlapElementRef] = useContainerQuery(rect => rect.height);\n\n useLayoutEffect(\n function handleDynamicOverlapHeight() {\n if (!disabled) {\n setDynamicOverlapHeight(overlapHeight ?? 0);\n }\n\n return () => {\n if (!disabled) {\n setDynamicOverlapHeight(0);\n }\n };\n },\n [disabled, overlapHeight, setDynamicOverlapHeight]\n );\n\n return overlapElementRef;\n}\n"]}
|
package/internal/manifest.json
CHANGED
|
@@ -102,7 +102,7 @@ export default function InternalMixedLineBarChart(_a) {
|
|
|
102
102
|
visibleData: visibleSeries || [],
|
|
103
103
|
statusType,
|
|
104
104
|
});
|
|
105
|
-
const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch);
|
|
105
|
+
const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch) && (additionalFilters || !hideFilter);
|
|
106
106
|
const showLegend = !hideLegend && !isEmpty && statusType === 'finished';
|
|
107
107
|
const reserveLegendSpace = !showChart && !hideLegend;
|
|
108
108
|
const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["mixed-line-bar-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EA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AAC,mBAAmB,IAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,qBAAqB,IAAI,EAAE,EAC1C,iBAAiB,EAAE,YAAY,EAC/B,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { warnOnce } from '../internal/logging';\n\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport InternalChartFilters from './chart-filters';\nimport InternalChartLegend from './chart-legend';\nimport ChartContainer from './chart-container';\nimport cartesianStyles from '../internal/components/cartesian-chart/styles.css.js';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { isDevelopment } from '../internal/is-development';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport { ScaledPoint } from './make-scaled-series';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { nodeContains } from '../internal/utils/dom';\nimport { SomeRequired } from '../internal/types';\nimport { isXThreshold, isYThreshold } from './utils';\n\ntype InternalMixedLineBarChartProps<T extends ChartDataTypes> = SomeRequired<\n MixedLineBarChartProps<T>,\n | 'series'\n | 'height'\n | 'xScaleType'\n | 'yScaleType'\n | 'stackedBars'\n | 'horizontalBars'\n | 'statusType'\n | 'detailPopoverSize'\n | 'emphasizeBaselineAxis'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalMixedLineBarChart<T extends number | string | Date>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n stackedBars,\n horizontalBars,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n emphasizeBaselineAxis,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalMixedLineBarChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const gotBarSeries = externalSeries.some(s => s.type === 'bar');\n const gotLineSeries = externalSeries.some(s => s.type === 'line');\n\n if (xScaleType !== 'categorical' && gotBarSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Bar series cannot be used with a ${xScaleType} scale. Use a categorical x axis instead.`\n );\n }\n\n if (horizontalBars && gotLineSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Property horizontalBars can only be used with charts that contain only bar or threshold series.`\n );\n }\n\n for (const s of externalSeries) {\n if (s.type === 'threshold' && s.x !== undefined && s.y !== undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n if (s.type === 'threshold' && s.x === undefined && s.y === undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n }\n }, [xScaleType, horizontalBars, externalSeries]);\n\n const series = useMemo(() => {\n // Generate series colors if not explicitly provided.\n // The thresholds use a dedicated colour scale.\n const colors = createCategoryColorScale(\n externalSeries,\n it => isYThreshold(it) || isXThreshold(it),\n it => it.color || null\n );\n\n return externalSeries.map((s, i) => ({ index: i, color: colors[i], series: s }));\n }, [externalSeries]);\n\n const [highlightedPoint, setHighlightedPoint] = useState<ScaledPoint<T> | null>(null);\n const [highlightedGroupIndex, setHighlightedGroupIndex] = useState<number | null>(null);\n const [highlightedSeries = null, setHighlightedSeries] = useControllable(\n controlledHighlightedSeries,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'highlightedSeries',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSeries, setLegendSeries] = useState<MixedLineBarChartProps.ChartSeries<T> | null>(highlightedSeries);\n useEffect(() => {\n setLegendSeries(controlledHighlightedSeries || null);\n }, [controlledHighlightedSeries]);\n\n const [externalVisibleSeries, setExternalVisibleSeries] = useControllable(\n controlledVisibleSeries,\n onFilterChange,\n externalSeries,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'visibleSeries',\n changeHandler: 'onFilterChange',\n }\n );\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousSeries = usePrevious(externalSeries);\n\n const hasPrevious = !!(previousSeries && previousSeries.length);\n const hasCurrent = !!externalSeries.length;\n\n if (hasPrevious && hasCurrent && externalSeries !== previousSeries && !controlledVisibleSeries && !hideFilter) {\n warnOnce(\n 'MixedLineBarChart',\n 'The `series` value passed into the component changed. ' +\n 'This may cause problems with filtering - we recommend that you make the `series` value constant, ' +\n 'or provide a `visibleSeries` value that derives from the current `series` value.'\n );\n }\n }\n\n const visibleSeries = useMemo(\n () => series.filter(s => externalVisibleSeries?.indexOf(s.series) !== -1),\n [series, externalVisibleSeries]\n );\n\n const filterChange = (selectedSeries: ReadonlyArray<MixedLineBarChartProps.ChartSeries<T>>) => {\n setExternalVisibleSeries(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSeries: selectedSeries,\n });\n };\n\n const onHighlightChange = (series: MixedLineBarChartProps.ChartSeries<T> | null) => {\n setHighlightedSeries(series);\n fireNonCancelableEvent(controlledOnHighlightChange, {\n highlightedSeries: series,\n });\n setLegendSeries(series);\n };\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSeries && onHighlightChange(highlightedSeries);\n setHighlightedPoint(null);\n setHighlightedGroupIndex(null);\n setLegendSeries(null);\n }\n };\n\n const { isEmpty, isNoMatch, showChart } = getChartStatus({\n externalData: externalSeries,\n visibleData: visibleSeries || [],\n statusType,\n });\n const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch);\n const showLegend = !hideLegend && !isEmpty && statusType === 'finished';\n const reserveLegendSpace = !showChart && !hideLegend;\n const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);\n const mergedRef = useMergeRefs(containerRef, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef} onBlur={onBlur}>\n {showFilters && (\n <InternalBox className={cartesianStyles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalChartFilters\n series={series}\n visibleSeries={externalVisibleSeries || []}\n onChange={filterChange}\n i18nStrings={i18nStrings}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n />\n </InternalBox>\n )}\n\n <div\n className={clsx(styles.content, {\n [styles['content--reserve-filter']]: reserveFilterSpace,\n [styles['content--reserve-legend']]: reserveLegendSpace,\n })}\n style={{ minHeight: height }}\n >\n <ChartStatusContainer\n isEmpty={isEmpty}\n isNoMatch={isNoMatch}\n showChart={showChart}\n statusType={statusType}\n empty={empty}\n noMatch={noMatch}\n loadingText={loadingText}\n errorText={errorText}\n recoveryText={recoveryText}\n onRecoveryClick={onRecoveryClick}\n />\n {showChart && (\n <ChartContainer\n height={height}\n xScaleType={xScaleType}\n yScaleType={yScaleType}\n xDomain={xDomain}\n yDomain={yDomain}\n xTickFormatter={i18nStrings?.xTickFormatter}\n yTickFormatter={i18nStrings?.yTickFormatter}\n emphasizeBaselineAxis={emphasizeBaselineAxis}\n stackedBars={stackedBars}\n horizontalBars={horizontalBars}\n series={series}\n visibleSeries={visibleSeries}\n highlightedSeries={highlightedSeries}\n onHighlightChange={onHighlightChange}\n highlightedPoint={highlightedPoint}\n setHighlightedPoint={setHighlightedPoint}\n highlightedGroupIndex={highlightedGroupIndex}\n setHighlightedGroupIndex={setHighlightedGroupIndex}\n detailPopoverSize={detailPopoverSize}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n plotContainerRef={containerRef}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <InternalChartLegend\n series={series}\n visibleSeries={externalVisibleSeries || []}\n highlightedSeries={legendSeries}\n onHighlightChange={onHighlightChange}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["mixed-line-bar-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,OAAO,oBAAoB,MAAM,iBAAiB,CAAC;AACnD,OAAO,mBAA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EAC/B,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport { warnOnce } from '../internal/logging';\n\nimport { ChartDataTypes, MixedLineBarChartProps } from './interfaces';\nimport InternalChartFilters from './chart-filters';\nimport InternalChartLegend from './chart-legend';\nimport ChartContainer from './chart-container';\nimport cartesianStyles from '../internal/components/cartesian-chart/styles.css.js';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { isDevelopment } from '../internal/is-development';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport { ScaledPoint } from './make-scaled-series';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { nodeContains } from '../internal/utils/dom';\nimport { SomeRequired } from '../internal/types';\nimport { isXThreshold, isYThreshold } from './utils';\n\ntype InternalMixedLineBarChartProps<T extends ChartDataTypes> = SomeRequired<\n MixedLineBarChartProps<T>,\n | 'series'\n | 'height'\n | 'xScaleType'\n | 'yScaleType'\n | 'stackedBars'\n | 'horizontalBars'\n | 'statusType'\n | 'detailPopoverSize'\n | 'emphasizeBaselineAxis'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalMixedLineBarChart<T extends number | string | Date>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n stackedBars,\n horizontalBars,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n emphasizeBaselineAxis,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalMixedLineBarChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const gotBarSeries = externalSeries.some(s => s.type === 'bar');\n const gotLineSeries = externalSeries.some(s => s.type === 'line');\n\n if (xScaleType !== 'categorical' && gotBarSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Bar series cannot be used with a ${xScaleType} scale. Use a categorical x axis instead.`\n );\n }\n\n if (horizontalBars && gotLineSeries) {\n warnOnce(\n 'MixedLineBarChart',\n `Property horizontalBars can only be used with charts that contain only bar or threshold series.`\n );\n }\n\n for (const s of externalSeries) {\n if (s.type === 'threshold' && s.x !== undefined && s.y !== undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n if (s.type === 'threshold' && s.x === undefined && s.y === undefined) {\n warnOnce('MixedLineBarChart', `Series of type \"threshold\" must contain either x or y property.`);\n }\n }\n }, [xScaleType, horizontalBars, externalSeries]);\n\n const series = useMemo(() => {\n // Generate series colors if not explicitly provided.\n // The thresholds use a dedicated colour scale.\n const colors = createCategoryColorScale(\n externalSeries,\n it => isYThreshold(it) || isXThreshold(it),\n it => it.color || null\n );\n\n return externalSeries.map((s, i) => ({ index: i, color: colors[i], series: s }));\n }, [externalSeries]);\n\n const [highlightedPoint, setHighlightedPoint] = useState<ScaledPoint<T> | null>(null);\n const [highlightedGroupIndex, setHighlightedGroupIndex] = useState<number | null>(null);\n const [highlightedSeries = null, setHighlightedSeries] = useControllable(\n controlledHighlightedSeries,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'highlightedSeries',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSeries, setLegendSeries] = useState<MixedLineBarChartProps.ChartSeries<T> | null>(highlightedSeries);\n useEffect(() => {\n setLegendSeries(controlledHighlightedSeries || null);\n }, [controlledHighlightedSeries]);\n\n const [externalVisibleSeries, setExternalVisibleSeries] = useControllable(\n controlledVisibleSeries,\n onFilterChange,\n externalSeries,\n {\n componentName: 'MixedLineBarChart',\n controlledProp: 'visibleSeries',\n changeHandler: 'onFilterChange',\n }\n );\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousSeries = usePrevious(externalSeries);\n\n const hasPrevious = !!(previousSeries && previousSeries.length);\n const hasCurrent = !!externalSeries.length;\n\n if (hasPrevious && hasCurrent && externalSeries !== previousSeries && !controlledVisibleSeries && !hideFilter) {\n warnOnce(\n 'MixedLineBarChart',\n 'The `series` value passed into the component changed. ' +\n 'This may cause problems with filtering - we recommend that you make the `series` value constant, ' +\n 'or provide a `visibleSeries` value that derives from the current `series` value.'\n );\n }\n }\n\n const visibleSeries = useMemo(\n () => series.filter(s => externalVisibleSeries?.indexOf(s.series) !== -1),\n [series, externalVisibleSeries]\n );\n\n const filterChange = (selectedSeries: ReadonlyArray<MixedLineBarChartProps.ChartSeries<T>>) => {\n setExternalVisibleSeries(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSeries: selectedSeries,\n });\n };\n\n const onHighlightChange = (series: MixedLineBarChartProps.ChartSeries<T> | null) => {\n setHighlightedSeries(series);\n fireNonCancelableEvent(controlledOnHighlightChange, {\n highlightedSeries: series,\n });\n setLegendSeries(series);\n };\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSeries && onHighlightChange(highlightedSeries);\n setHighlightedPoint(null);\n setHighlightedGroupIndex(null);\n setLegendSeries(null);\n }\n };\n\n const { isEmpty, isNoMatch, showChart } = getChartStatus({\n externalData: externalSeries,\n visibleData: visibleSeries || [],\n statusType,\n });\n const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch) && (additionalFilters || !hideFilter);\n const showLegend = !hideLegend && !isEmpty && statusType === 'finished';\n const reserveLegendSpace = !showChart && !hideLegend;\n const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);\n const mergedRef = useMergeRefs(containerRef, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef} onBlur={onBlur}>\n {showFilters && (\n <InternalBox className={cartesianStyles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalChartFilters\n series={series}\n visibleSeries={externalVisibleSeries || []}\n onChange={filterChange}\n i18nStrings={i18nStrings}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n />\n </InternalBox>\n )}\n\n <div\n className={clsx(styles.content, {\n [styles['content--reserve-filter']]: reserveFilterSpace,\n [styles['content--reserve-legend']]: reserveLegendSpace,\n })}\n style={{ minHeight: height }}\n >\n <ChartStatusContainer\n isEmpty={isEmpty}\n isNoMatch={isNoMatch}\n showChart={showChart}\n statusType={statusType}\n empty={empty}\n noMatch={noMatch}\n loadingText={loadingText}\n errorText={errorText}\n recoveryText={recoveryText}\n onRecoveryClick={onRecoveryClick}\n />\n {showChart && (\n <ChartContainer\n height={height}\n xScaleType={xScaleType}\n yScaleType={yScaleType}\n xDomain={xDomain}\n yDomain={yDomain}\n xTickFormatter={i18nStrings?.xTickFormatter}\n yTickFormatter={i18nStrings?.yTickFormatter}\n emphasizeBaselineAxis={emphasizeBaselineAxis}\n stackedBars={stackedBars}\n horizontalBars={horizontalBars}\n series={series}\n visibleSeries={visibleSeries}\n highlightedSeries={highlightedSeries}\n onHighlightChange={onHighlightChange}\n highlightedPoint={highlightedPoint}\n setHighlightedPoint={setHighlightedPoint}\n highlightedGroupIndex={highlightedGroupIndex}\n setHighlightedGroupIndex={setHighlightedGroupIndex}\n detailPopoverSize={detailPopoverSize}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n plotContainerRef={containerRef}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <InternalChartLegend\n series={series}\n visibleSeries={externalVisibleSeries || []}\n highlightedSeries={legendSeries}\n onHighlightChange={onHighlightChange}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
|
package/package.json
CHANGED
package/pie-chart/index.js
CHANGED
|
@@ -76,7 +76,7 @@ const PieChart = function PieChart(_a) {
|
|
|
76
76
|
};
|
|
77
77
|
const mergedRef = useMergeRefs(containerRef, measureRef, __internalRootRef);
|
|
78
78
|
return (React.createElement("div", Object.assign({}, containerAttr, { ref: mergedRef, onBlur: onBlur }),
|
|
79
|
-
statusType === 'finished' && !isEmpty && (React.createElement(InternalBox, { className: styles['filter-container'], margin: { bottom: 'l' } },
|
|
79
|
+
statusType === 'finished' && !isEmpty && (additionalFilters || !hideFilter) && (React.createElement(InternalBox, { className: styles['filter-container'], margin: { bottom: 'l' } },
|
|
80
80
|
React.createElement(InternalSpaceBetween, { size: "l", direction: "horizontal", className: clsx({
|
|
81
81
|
[styles['has-default-filter']]: !hideFilter,
|
|
82
82
|
}) },
|
package/pie-chart/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,M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WAAW,GACxB,CACH;gBACA,iBAAiB,CACG,CACX,CACf;QAED,oBAAC,gBAAgB,oBACX,KAAK,IACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,cAAc,EACrB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,IACpC;QAED,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,UAAU,KAAK,UAAU,IAAI,CACvD,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,MAAM,IACL,MAAM,EAAE,WAAW,EACnB,iBAAiB,EAAE,aAAa,EAChC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACvC,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Legend, { ChartLegendProps } from '../internal/components/chart-legend';\nimport Filter, { ChartFilterProps } from '../internal/components/chart-filter';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalBox from '../box/internal';\n\nimport InternalPieChart, { InternalChartDatum } from './pie-chart';\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { nodeContains } from '../internal/utils/dom';\n\nexport { PieChartProps };\n\nconst PieChart = function PieChart<T extends PieChartProps.Datum = PieChartProps.Datum>({\n variant = 'pie',\n size = 'medium',\n hideTitles = false,\n hideDescriptions = false,\n hideLegend = false,\n hideFilter = false,\n statusType = 'finished',\n data: externalData = [],\n i18nStrings = {},\n highlightedSegment: controlledHighlightedSegment,\n visibleSegments: controlledVisibleSegments,\n onHighlightChange: controlledOnHighlightChange,\n onFilterChange,\n additionalFilters,\n legendTitle,\n detailPopoverSize = 'medium',\n ...props\n}: PieChartProps<T>) {\n const { __internalRootRef = null } = useBaseComponent('PieChart');\n const baseProps = getBaseProps(props);\n const isEmpty = !externalData || externalData.length === 0;\n const containerAttr = {\n ...baseProps,\n className: clsx(baseProps.className, styles.root),\n };\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, measureRef] = useContainerWidth();\n\n const data: ReadonlyArray<InternalChartDatum<T>> = useMemo(() => {\n const colors = createCategoryColorScale(externalData, undefined, it => it.color || null);\n\n return externalData.map((datum, i) => ({\n index: i,\n color: colors[i],\n datum,\n }));\n }, [externalData]);\n\n const [highlightedSegment = null, setHighlightedSegment] = useControllable(\n controlledHighlightedSegment,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'PieChart',\n controlledProp: 'highlightedSegment',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSegment, setLegendSegment] = useState<null | T>(highlightedSegment);\n useEffect(() => {\n setLegendSegment(controlledHighlightedSegment || null);\n }, [controlledHighlightedSegment]);\n\n const [visibleSegments, setVisibleSegments] = useControllable(\n controlledVisibleSegments,\n onFilterChange,\n externalData,\n {\n componentName: 'PieChart',\n controlledProp: 'visibleSegments',\n changeHandler: 'onFilterChange',\n }\n );\n\n const [pinnedSegment, setPinnedSegment] = useState<T | null>(null);\n\n const visibleData = useMemo(\n () => data.filter(d => visibleSegments?.indexOf(d.datum) !== -1),\n [data, visibleSegments]\n );\n\n const filterItems: ChartFilterProps<T>['series'] = data?.map(data => ({\n label: data.datum.title,\n color: data.color,\n type: 'rectangle',\n datum: data.datum,\n }));\n\n const legendItems: ChartLegendProps<T>['series'] = filterItems.filter(d => visibleSegments?.indexOf(d.datum) !== -1);\n\n const filterChange = useCallback(\n (selectedSeries: ReadonlyArray<T>) => {\n setVisibleSegments(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSegments: selectedSeries,\n });\n },\n [setVisibleSegments, onFilterChange]\n );\n\n const onHighlightChange = useCallback(\n (segment: T | null) => {\n setLegendSegment(segment);\n setHighlightedSegment(segment);\n fireNonCancelableEvent(controlledOnHighlightChange, { highlightedSegment: segment });\n },\n [controlledOnHighlightChange, setHighlightedSegment]\n );\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSegment && onHighlightChange(null);\n setLegendSegment(null);\n }\n };\n\n const mergedRef = useMergeRefs(containerRef, measureRef, __internalRootRef);\n\n return (\n <div {...containerAttr} ref={mergedRef} onBlur={onBlur}>\n {statusType === 'finished' && !isEmpty && (\n <InternalBox className={styles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({\n [styles['has-default-filter']]: !hideFilter,\n })}\n >\n {!hideFilter && (\n <Filter\n series={filterItems}\n onChange={filterChange}\n selectedSeries={visibleSegments}\n i18nStrings={i18nStrings}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\n </InternalBox>\n )}\n\n <InternalPieChart\n {...props}\n variant={variant}\n size={size}\n data={externalData}\n visibleData={visibleData}\n width={containerWidth}\n statusType={statusType}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n hideLegend={hideLegend}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n i18nStrings={i18nStrings}\n onHighlightChange={onHighlightChange}\n highlightedSegment={highlightedSegment}\n legendSegment={legendSegment}\n pinnedSegment={pinnedSegment}\n setPinnedSegment={setPinnedSegment}\n detailPopoverSize={detailPopoverSize}\n />\n\n {!hideLegend && !isEmpty && statusType === 'finished' && (\n <InternalBox margin={{ top: 'm' }}>\n <Legend<T>\n series={legendItems}\n highlightedSeries={legendSegment}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n onHighlightChange={onHighlightChange}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n};\n\napplyDisplayName(PieChart, 'PieChart');\nexport default PieChart;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,MAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,MAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D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AAU,EACtB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,IACpC;QAED,CAAC,UAAU,IAAI,CAAC,OAAO,IAAI,UAAU,KAAK,UAAU,IAAI,CACvD,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,MAAM,IACL,MAAM,EAAE,WAAW,EACnB,iBAAiB,EAAE,aAAa,EAChC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EACvC,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,YAAY,GAC9B,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACvC,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Legend, { ChartLegendProps } from '../internal/components/chart-legend';\nimport Filter, { ChartFilterProps } from '../internal/components/chart-filter';\nimport InternalSpaceBetween from '../space-between/internal';\nimport InternalBox from '../box/internal';\n\nimport InternalPieChart, { InternalChartDatum } from './pie-chart';\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport createCategoryColorScale from '../internal/utils/create-category-color-scale';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { nodeContains } from '../internal/utils/dom';\n\nexport { PieChartProps };\n\nconst PieChart = function PieChart<T extends PieChartProps.Datum = PieChartProps.Datum>({\n variant = 'pie',\n size = 'medium',\n hideTitles = false,\n hideDescriptions = false,\n hideLegend = false,\n hideFilter = false,\n statusType = 'finished',\n data: externalData = [],\n i18nStrings = {},\n highlightedSegment: controlledHighlightedSegment,\n visibleSegments: controlledVisibleSegments,\n onHighlightChange: controlledOnHighlightChange,\n onFilterChange,\n additionalFilters,\n legendTitle,\n detailPopoverSize = 'medium',\n ...props\n}: PieChartProps<T>) {\n const { __internalRootRef = null } = useBaseComponent('PieChart');\n const baseProps = getBaseProps(props);\n const isEmpty = !externalData || externalData.length === 0;\n const containerAttr = {\n ...baseProps,\n className: clsx(baseProps.className, styles.root),\n };\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, measureRef] = useContainerWidth();\n\n const data: ReadonlyArray<InternalChartDatum<T>> = useMemo(() => {\n const colors = createCategoryColorScale(externalData, undefined, it => it.color || null);\n\n return externalData.map((datum, i) => ({\n index: i,\n color: colors[i],\n datum,\n }));\n }, [externalData]);\n\n const [highlightedSegment = null, setHighlightedSegment] = useControllable(\n controlledHighlightedSegment,\n controlledOnHighlightChange,\n null,\n {\n componentName: 'PieChart',\n controlledProp: 'highlightedSegment',\n changeHandler: 'onHighlightChange',\n }\n );\n const [legendSegment, setLegendSegment] = useState<null | T>(highlightedSegment);\n useEffect(() => {\n setLegendSegment(controlledHighlightedSegment || null);\n }, [controlledHighlightedSegment]);\n\n const [visibleSegments, setVisibleSegments] = useControllable(\n controlledVisibleSegments,\n onFilterChange,\n externalData,\n {\n componentName: 'PieChart',\n controlledProp: 'visibleSegments',\n changeHandler: 'onFilterChange',\n }\n );\n\n const [pinnedSegment, setPinnedSegment] = useState<T | null>(null);\n\n const visibleData = useMemo(\n () => data.filter(d => visibleSegments?.indexOf(d.datum) !== -1),\n [data, visibleSegments]\n );\n\n const filterItems: ChartFilterProps<T>['series'] = data?.map(data => ({\n label: data.datum.title,\n color: data.color,\n type: 'rectangle',\n datum: data.datum,\n }));\n\n const legendItems: ChartLegendProps<T>['series'] = filterItems.filter(d => visibleSegments?.indexOf(d.datum) !== -1);\n\n const filterChange = useCallback(\n (selectedSeries: ReadonlyArray<T>) => {\n setVisibleSegments(selectedSeries);\n fireNonCancelableEvent(onFilterChange, {\n visibleSegments: selectedSeries,\n });\n },\n [setVisibleSegments, onFilterChange]\n );\n\n const onHighlightChange = useCallback(\n (segment: T | null) => {\n setLegendSegment(segment);\n setHighlightedSegment(segment);\n fireNonCancelableEvent(controlledOnHighlightChange, { highlightedSegment: segment });\n },\n [controlledOnHighlightChange, setHighlightedSegment]\n );\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n highlightedSegment && onHighlightChange(null);\n setLegendSegment(null);\n }\n };\n\n const mergedRef = useMergeRefs(containerRef, measureRef, __internalRootRef);\n\n return (\n <div {...containerAttr} ref={mergedRef} onBlur={onBlur}>\n {statusType === 'finished' && !isEmpty && (additionalFilters || !hideFilter) && (\n <InternalBox className={styles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({\n [styles['has-default-filter']]: !hideFilter,\n })}\n >\n {!hideFilter && (\n <Filter\n series={filterItems}\n onChange={filterChange}\n selectedSeries={visibleSegments}\n i18nStrings={i18nStrings}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\n </InternalBox>\n )}\n\n <InternalPieChart\n {...props}\n variant={variant}\n size={size}\n data={externalData}\n visibleData={visibleData}\n width={containerWidth}\n statusType={statusType}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n hideLegend={hideLegend}\n hideFilter={hideFilter}\n additionalFilters={additionalFilters}\n i18nStrings={i18nStrings}\n onHighlightChange={onHighlightChange}\n highlightedSegment={highlightedSegment}\n legendSegment={legendSegment}\n pinnedSegment={pinnedSegment}\n setPinnedSegment={setPinnedSegment}\n detailPopoverSize={detailPopoverSize}\n />\n\n {!hideLegend && !isEmpty && statusType === 'finished' && (\n <InternalBox margin={{ top: 'm' }}>\n <Legend<T>\n series={legendItems}\n highlightedSeries={legendSegment}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings?.legendAriaLabel}\n onHighlightChange={onHighlightChange}\n plotContainerRef={containerRef}\n />\n </InternalBox>\n )}\n </div>\n );\n};\n\napplyDisplayName(PieChart, 'PieChart');\nexport default PieChart;\n"]}
|
|
@@ -15,7 +15,7 @@ export default function InternalSpaceBetween(_a) {
|
|
|
15
15
|
const flattenedChildren = flattenChildren(children);
|
|
16
16
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root, styles[direction], styles[`${direction}-${size}`]), ref: __internalRootRef }), flattenedChildren.map(child => {
|
|
17
17
|
const key = typeof child === 'object' ? child.key : undefined;
|
|
18
|
-
return (React.createElement("div", { key: key, className:
|
|
18
|
+
return (React.createElement("div", { key: key, className: styles.child }, child));
|
|
19
19
|
})));
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["space-between/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAM3D,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAMjB;QANiB,EAC3C,SAAS,GAAG,UAAU,EACtB,IAAI,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D,OAAO,CACL,6CACM,SAAS,IACb,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC,EACpG,GAAG,EAAE,iBAAiB,KAErB,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC7B,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9D,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,IACnC,KAAK,CACF,CACP,CAAC;IACJ,CAAC,CAAC,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport styles from './styles.css.js';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport { SpaceBetweenProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\ntype InternalSpaceBetweenProps = SpaceBetweenProps & InternalBaseComponentProps;\n\nexport default function InternalSpaceBetween({\n direction = 'vertical',\n size,\n children,\n __internalRootRef,\n ...props\n}: InternalSpaceBetweenProps) {\n const baseProps = getBaseProps(props);\n\n /*\n Flattening the children allows us to \"see through\" React Fragments and nested arrays.\n */\n const flattenedChildren = flattenChildren(children);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, styles[direction], styles[`${direction}-${size}`])}\n ref={__internalRootRef}\n >\n {flattenedChildren.map(child => {\n const key = typeof child === 'object' ? child.key : undefined;\n\n return (\n <div key={key} className={styles.child}>\n {child}\n </div>\n );\n })}\n </div>\n );\n}\n"]}
|