@cloudscape-design/components 3.0.128 → 3.0.129

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 (198) hide show
  1. package/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
  2. package/annotation-context/annotation/annotation-popover.js +8 -2
  3. package/annotation-context/annotation/annotation-popover.js.map +1 -1
  4. package/annotation-context/annotation/annotation-trigger.d.ts +2 -0
  5. package/annotation-context/annotation/annotation-trigger.d.ts.map +1 -1
  6. package/annotation-context/annotation/annotation-trigger.js +2 -2
  7. package/annotation-context/annotation/annotation-trigger.js.map +1 -1
  8. package/annotation-context/annotation/closed-annotation.d.ts +3 -1
  9. package/annotation-context/annotation/closed-annotation.d.ts.map +1 -1
  10. package/annotation-context/annotation/closed-annotation.js +2 -2
  11. package/annotation-context/annotation/closed-annotation.js.map +1 -1
  12. package/annotation-context/annotation/open-annotation.d.ts.map +1 -1
  13. package/annotation-context/annotation/open-annotation.js +1 -1
  14. package/annotation-context/annotation/open-annotation.js.map +1 -1
  15. package/annotation-context/annotation/styles.css.js +24 -24
  16. package/annotation-context/annotation/styles.scoped.css +30 -30
  17. package/annotation-context/annotation/styles.selectors.js +24 -24
  18. package/annotation-context/index.d.ts.map +1 -1
  19. package/annotation-context/index.js +3 -1
  20. package/annotation-context/index.js.map +1 -1
  21. package/annotation-context/interfaces.d.ts +1 -1
  22. package/annotation-context/interfaces.d.ts.map +1 -1
  23. package/annotation-context/interfaces.js.map +1 -1
  24. package/app-layout/visual-refresh/main.d.ts.map +1 -1
  25. package/app-layout/visual-refresh/main.js +8 -3
  26. package/app-layout/visual-refresh/main.js.map +1 -1
  27. package/app-layout/visual-refresh/styles.css.js +60 -60
  28. package/app-layout/visual-refresh/styles.scoped.css +255 -237
  29. package/app-layout/visual-refresh/styles.selectors.js +60 -60
  30. package/area-chart/internal.d.ts.map +1 -1
  31. package/area-chart/internal.js +5 -0
  32. package/area-chart/internal.js.map +1 -1
  33. package/area-chart/model/index.d.ts +1 -0
  34. package/area-chart/model/index.d.ts.map +1 -1
  35. package/area-chart/model/index.js.map +1 -1
  36. package/area-chart/model/use-chart-model.d.ts.map +1 -1
  37. package/area-chart/model/use-chart-model.js +8 -1
  38. package/area-chart/model/use-chart-model.js.map +1 -1
  39. package/attribute-editor/row.d.ts.map +1 -1
  40. package/attribute-editor/row.js +4 -3
  41. package/attribute-editor/row.js.map +1 -1
  42. package/attribute-editor/styles.css.js +13 -12
  43. package/attribute-editor/styles.scoped.css +27 -23
  44. package/attribute-editor/styles.selectors.js +13 -12
  45. package/breadcrumb-group/interfaces.d.ts +1 -0
  46. package/breadcrumb-group/interfaces.d.ts.map +1 -1
  47. package/breadcrumb-group/interfaces.js.map +1 -1
  48. package/breadcrumb-group/internal.d.ts.map +1 -1
  49. package/breadcrumb-group/internal.js +1 -1
  50. package/breadcrumb-group/internal.js.map +1 -1
  51. package/breadcrumb-group/item/item.d.ts +1 -1
  52. package/breadcrumb-group/item/item.d.ts.map +1 -1
  53. package/breadcrumb-group/item/item.js +68 -8
  54. package/breadcrumb-group/item/item.js.map +1 -1
  55. package/breadcrumb-group/item/styles.css.js +9 -7
  56. package/breadcrumb-group/item/styles.scoped.css +26 -16
  57. package/breadcrumb-group/item/styles.selectors.js +9 -7
  58. package/code-editor/index.d.ts.map +1 -1
  59. package/code-editor/index.js +11 -16
  60. package/code-editor/index.js.map +1 -1
  61. package/code-editor/interfaces.d.ts +12 -1
  62. package/code-editor/interfaces.d.ts.map +1 -1
  63. package/code-editor/interfaces.js.map +1 -1
  64. package/code-editor/status-bar.d.ts.map +1 -1
  65. package/code-editor/status-bar.js +7 -1
  66. package/code-editor/status-bar.js.map +1 -1
  67. package/code-editor/util.js +1 -1
  68. package/code-editor/util.js.map +1 -1
  69. package/container/internal.d.ts.map +1 -1
  70. package/container/internal.js +7 -4
  71. package/container/internal.js.map +1 -1
  72. package/date-range-picker/calendar/grids/index.d.ts +0 -1
  73. package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
  74. package/date-range-picker/calendar/grids/index.js +2 -14
  75. package/date-range-picker/calendar/grids/index.js.map +1 -1
  76. package/date-range-picker/calendar/index.d.ts +6 -4
  77. package/date-range-picker/calendar/index.d.ts.map +1 -1
  78. package/date-range-picker/calendar/index.js +111 -123
  79. package/date-range-picker/calendar/index.js.map +1 -1
  80. package/date-range-picker/calendar/utils.d.ts +4 -0
  81. package/date-range-picker/calendar/utils.d.ts.map +1 -0
  82. package/date-range-picker/calendar/utils.js +31 -0
  83. package/date-range-picker/calendar/utils.js.map +1 -0
  84. package/date-range-picker/dropdown.d.ts +2 -1
  85. package/date-range-picker/dropdown.d.ts.map +1 -1
  86. package/date-range-picker/dropdown.js +8 -6
  87. package/date-range-picker/dropdown.js.map +1 -1
  88. package/date-range-picker/index.d.ts.map +1 -1
  89. package/date-range-picker/index.js +2 -2
  90. package/date-range-picker/index.js.map +1 -1
  91. package/date-range-picker/interfaces.d.ts +14 -4
  92. package/date-range-picker/interfaces.d.ts.map +1 -1
  93. package/date-range-picker/interfaces.js.map +1 -1
  94. package/date-range-picker/styles.css.js +38 -38
  95. package/date-range-picker/styles.scoped.css +45 -50
  96. package/date-range-picker/styles.selectors.js +38 -38
  97. package/date-range-picker/utils.d.ts +2 -8
  98. package/date-range-picker/utils.d.ts.map +1 -1
  99. package/date-range-picker/utils.js +17 -12
  100. package/date-range-picker/utils.js.map +1 -1
  101. package/flashbar/styles.css.js +33 -33
  102. package/flashbar/styles.scoped.css +121 -121
  103. package/flashbar/styles.selectors.js +33 -33
  104. package/internal/components/dropdown/index.d.ts.map +1 -1
  105. package/internal/components/dropdown/index.js +2 -9
  106. package/internal/components/dropdown/index.js.map +1 -1
  107. package/internal/components/dropdown-status/index.d.ts +1 -4
  108. package/internal/components/dropdown-status/index.d.ts.map +1 -1
  109. package/internal/components/dropdown-status/index.js +3 -5
  110. package/internal/components/dropdown-status/index.js.map +1 -1
  111. package/internal/components/filtering-token/index.d.ts +2 -1
  112. package/internal/components/filtering-token/index.d.ts.map +1 -1
  113. package/internal/components/filtering-token/index.js +2 -2
  114. package/internal/components/filtering-token/index.js.map +1 -1
  115. package/internal/components/option/index.js +4 -4
  116. package/internal/components/option/index.js.map +1 -1
  117. package/internal/environment.js +1 -1
  118. package/internal/generated/custom-css-properties/index.d.ts.map +1 -1
  119. package/internal/generated/custom-css-properties/index.js +27 -26
  120. package/internal/generated/custom-css-properties/index.js.map +1 -1
  121. package/internal/hooks/use-analytics/index.d.ts +2 -0
  122. package/internal/hooks/use-analytics/index.d.ts.map +1 -0
  123. package/internal/hooks/use-analytics/index.js +16 -0
  124. package/internal/hooks/use-analytics/index.js.map +1 -0
  125. package/internal/manifest.json +1 -1
  126. package/internal/utils/date-time/format-date-time.d.ts +2 -0
  127. package/internal/utils/date-time/format-date-time.d.ts.map +1 -0
  128. package/internal/utils/date-time/format-date-time.js +8 -0
  129. package/internal/utils/date-time/format-date-time.js.map +1 -0
  130. package/internal/utils/date-time/index.d.ts +2 -1
  131. package/internal/utils/date-time/index.d.ts.map +1 -1
  132. package/internal/utils/date-time/index.js +2 -1
  133. package/internal/utils/date-time/index.js.map +1 -1
  134. package/internal/utils/date-time/join-date-time.d.ts +4 -0
  135. package/internal/utils/date-time/join-date-time.d.ts.map +1 -1
  136. package/internal/utils/date-time/join-date-time.js +4 -0
  137. package/internal/utils/date-time/join-date-time.js.map +1 -1
  138. package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
  139. package/mixed-line-bar-chart/chart-container.js +14 -5
  140. package/mixed-line-bar-chart/chart-container.js.map +1 -1
  141. package/package.json +1 -1
  142. package/pie-chart/pie-chart.d.ts.map +1 -1
  143. package/pie-chart/pie-chart.js +10 -1
  144. package/pie-chart/pie-chart.js.map +1 -1
  145. package/popover/body.d.ts +2 -1
  146. package/popover/body.d.ts.map +1 -1
  147. package/popover/body.js +2 -2
  148. package/popover/body.js.map +1 -1
  149. package/property-filter/interfaces.d.ts +1 -0
  150. package/property-filter/interfaces.d.ts.map +1 -1
  151. package/property-filter/interfaces.js.map +1 -1
  152. package/property-filter/token.d.ts.map +1 -1
  153. package/property-filter/token.js +1 -1
  154. package/property-filter/token.js.map +1 -1
  155. package/select/parts/filter.d.ts +1 -1
  156. package/select/utils/use-select.d.ts +1 -7
  157. package/select/utils/use-select.d.ts.map +1 -1
  158. package/select/utils/use-select.js +1 -1
  159. package/select/utils/use-select.js.map +1 -1
  160. package/table/styles.css.js +34 -34
  161. package/table/styles.scoped.css +42 -40
  162. package/table/styles.selectors.js +34 -34
  163. package/tabs/index.d.ts.map +1 -1
  164. package/tabs/index.js +9 -11
  165. package/tabs/index.js.map +1 -1
  166. package/tabs/styles.css.js +21 -21
  167. package/tabs/styles.scoped.css +48 -41
  168. package/tabs/styles.selectors.js +21 -21
  169. package/tabs/tab-header-bar.d.ts +4 -0
  170. package/tabs/tab-header-bar.d.ts.map +1 -1
  171. package/tabs/tab-header-bar.js +5 -1
  172. package/tabs/tab-header-bar.js.map +1 -1
  173. package/tag-editor/internal.d.ts.map +1 -1
  174. package/tag-editor/internal.js +6 -7
  175. package/tag-editor/internal.js.map +1 -1
  176. package/test-utils/tsconfig.tsbuildinfo +1 -1
  177. package/tutorial-panel/components/tutorial-detail-view/index.d.ts.map +1 -1
  178. package/tutorial-panel/components/tutorial-detail-view/index.js +3 -1
  179. package/tutorial-panel/components/tutorial-detail-view/index.js.map +1 -1
  180. package/tutorial-panel/components/tutorial-detail-view/task.d.ts.map +1 -1
  181. package/tutorial-panel/components/tutorial-detail-view/task.js +2 -1
  182. package/tutorial-panel/components/tutorial-detail-view/task.js.map +1 -1
  183. package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
  184. package/tutorial-panel/components/tutorial-list/index.js +2 -2
  185. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
  186. package/tutorial-panel/interfaces.d.ts +2 -0
  187. package/tutorial-panel/interfaces.d.ts.map +1 -1
  188. package/tutorial-panel/interfaces.js.map +1 -1
  189. package/wizard/index.d.ts.map +1 -1
  190. package/wizard/index.js +9 -5
  191. package/wizard/index.js.map +1 -1
  192. package/wizard/wizard-form.d.ts.map +1 -1
  193. package/wizard/wizard-form.js +7 -2
  194. package/wizard/wizard-form.js.map +1 -1
  195. package/date-range-picker/calendar/use-date-time.d.ts +0 -9
  196. package/date-range-picker/calendar/use-date-time.d.ts.map +0 -1
  197. package/date-range-picker/calendar/use-date-time.js +0 -16
  198. package/date-range-picker/calendar/use-date-time.js.map +0 -1
@@ -2,65 +2,65 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "appbar": "awsui_appbar_hyvsj_8eynx_93",
6
- "appbar-nav": "awsui_appbar-nav_hyvsj_8eynx_117",
7
- "breadcrumbs": "awsui_breadcrumbs_hyvsj_8eynx_121",
8
- "appbar-tools": "awsui_appbar-tools_hyvsj_8eynx_125",
9
- "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_8eynx_166",
10
- "has-notifications-content": "awsui_has-notifications-content_hyvsj_8eynx_173",
11
- "has-header": "awsui_has-header_hyvsj_8eynx_179",
12
- "has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_8eynx_179",
13
- "content-type-wizard": "awsui_content-type-wizard_hyvsj_8eynx_180",
14
- "content-type-cards": "awsui_content-type-cards_hyvsj_8eynx_183",
15
- "content-type-table": "awsui_content-type-table_hyvsj_8eynx_184",
16
- "has-sticky-background": "awsui_has-sticky-background_hyvsj_8eynx_187",
17
- "background": "awsui_background_hyvsj_8eynx_221",
18
- "notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_8eynx_224",
19
- "sticky-notifications": "awsui_sticky-notifications_hyvsj_8eynx_236",
20
- "overlap": "awsui_overlap_hyvsj_8eynx_242",
21
- "content": "awsui_content_hyvsj_8eynx_180",
22
- "layout": "awsui_layout_hyvsj_8eynx_329",
23
- "has-max-content-width": "awsui_has-max-content-width_hyvsj_8eynx_411",
24
- "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_8eynx_438",
25
- "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_8eynx_441",
26
- "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_8eynx_445",
27
- "has-split-panel": "awsui_has-split-panel_hyvsj_8eynx_459",
28
- "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_8eynx_459",
29
- "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_8eynx_471",
30
- "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_8eynx_474",
31
- "block-body-scroll": "awsui_block-body-scroll_hyvsj_8eynx_489",
32
- "container": "awsui_container_hyvsj_8eynx_497",
33
- "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_8eynx_514",
34
- "is-navigation-open": "awsui_is-navigation-open_hyvsj_8eynx_519",
35
- "is-tools-open": "awsui_is-tools-open_hyvsj_8eynx_522",
36
- "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_8eynx_522",
37
- "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_8eynx_522",
38
- "content-type-default": "awsui_content-type-default_hyvsj_8eynx_542",
39
- "content-type-form": "awsui_content-type-form_hyvsj_8eynx_542",
40
- "unfocusable": "awsui_unfocusable_hyvsj_8eynx_583",
41
- "navigation-container": "awsui_navigation-container_hyvsj_8eynx_591",
42
- "show-navigation": "awsui_show-navigation_hyvsj_8eynx_626",
43
- "animating": "awsui_animating_hyvsj_8eynx_648",
44
- "showButtons": "awsui_showButtons_hyvsj_8eynx_1",
45
- "navigation": "awsui_navigation_hyvsj_8eynx_591",
46
- "openNavigation": "awsui_openNavigation_hyvsj_8eynx_1",
47
- "animated-content": "awsui_animated-content_hyvsj_8eynx_709",
48
- "hide-navigation": "awsui_hide-navigation_hyvsj_8eynx_718",
49
- "notifications": "awsui_notifications_hyvsj_8eynx_224",
50
- "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_8eynx_785",
51
- "position-bottom": "awsui_position-bottom_hyvsj_8eynx_820",
52
- "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_8eynx_1",
53
- "split-panel-side": "awsui_split-panel-side_hyvsj_8eynx_849",
54
- "position-side": "awsui_position-side_hyvsj_8eynx_877",
55
- "openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_8eynx_1",
56
- "tools-container": "awsui_tools-container_hyvsj_8eynx_914",
57
- "tools": "awsui_tools_hyvsj_8eynx_914",
58
- "openTools": "awsui_openTools_hyvsj_8eynx_1",
59
- "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_8eynx_999",
60
- "hide-tools": "awsui_hide-tools_hyvsj_8eynx_1009",
61
- "show-tools": "awsui_show-tools_hyvsj_8eynx_1021",
62
- "has-tools-form": "awsui_has-tools-form_hyvsj_8eynx_999",
63
- "trigger": "awsui_trigger_hyvsj_8eynx_1078",
64
- "selected": "awsui_selected_hyvsj_8eynx_1117"
5
+ "appbar": "awsui_appbar_hyvsj_1sfal_93",
6
+ "appbar-nav": "awsui_appbar-nav_hyvsj_1sfal_117",
7
+ "breadcrumbs": "awsui_breadcrumbs_hyvsj_1sfal_121",
8
+ "appbar-tools": "awsui_appbar-tools_hyvsj_1sfal_125",
9
+ "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_1sfal_166",
10
+ "has-notifications-content": "awsui_has-notifications-content_hyvsj_1sfal_173",
11
+ "has-header": "awsui_has-header_hyvsj_1sfal_179",
12
+ "has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_1sfal_179",
13
+ "content-type-wizard": "awsui_content-type-wizard_hyvsj_1sfal_180",
14
+ "content-type-cards": "awsui_content-type-cards_hyvsj_1sfal_183",
15
+ "content-type-table": "awsui_content-type-table_hyvsj_1sfal_184",
16
+ "has-sticky-background": "awsui_has-sticky-background_hyvsj_1sfal_187",
17
+ "background": "awsui_background_hyvsj_1sfal_221",
18
+ "notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_1sfal_224",
19
+ "sticky-notifications": "awsui_sticky-notifications_hyvsj_1sfal_236",
20
+ "overlap": "awsui_overlap_hyvsj_1sfal_242",
21
+ "content": "awsui_content_hyvsj_1sfal_180",
22
+ "layout": "awsui_layout_hyvsj_1sfal_329",
23
+ "has-max-content-width": "awsui_has-max-content-width_hyvsj_1sfal_411",
24
+ "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_1sfal_438",
25
+ "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_1sfal_441",
26
+ "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_1sfal_445",
27
+ "has-split-panel": "awsui_has-split-panel_hyvsj_1sfal_459",
28
+ "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_1sfal_459",
29
+ "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_1sfal_471",
30
+ "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_1sfal_474",
31
+ "block-body-scroll": "awsui_block-body-scroll_hyvsj_1sfal_489",
32
+ "container": "awsui_container_hyvsj_1sfal_497",
33
+ "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_1sfal_523",
34
+ "is-navigation-open": "awsui_is-navigation-open_hyvsj_1sfal_528",
35
+ "is-tools-open": "awsui_is-tools-open_hyvsj_1sfal_531",
36
+ "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_1sfal_531",
37
+ "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_1sfal_531",
38
+ "content-type-default": "awsui_content-type-default_hyvsj_1sfal_551",
39
+ "content-type-form": "awsui_content-type-form_hyvsj_1sfal_551",
40
+ "unfocusable": "awsui_unfocusable_hyvsj_1sfal_592",
41
+ "navigation-container": "awsui_navigation-container_hyvsj_1sfal_600",
42
+ "show-navigation": "awsui_show-navigation_hyvsj_1sfal_635",
43
+ "animating": "awsui_animating_hyvsj_1sfal_657",
44
+ "showButtons": "awsui_showButtons_hyvsj_1sfal_1",
45
+ "navigation": "awsui_navigation_hyvsj_1sfal_600",
46
+ "openNavigation": "awsui_openNavigation_hyvsj_1sfal_1",
47
+ "animated-content": "awsui_animated-content_hyvsj_1sfal_718",
48
+ "hide-navigation": "awsui_hide-navigation_hyvsj_1sfal_727",
49
+ "notifications": "awsui_notifications_hyvsj_1sfal_224",
50
+ "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_1sfal_792",
51
+ "position-bottom": "awsui_position-bottom_hyvsj_1sfal_838",
52
+ "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_1sfal_1",
53
+ "split-panel-side": "awsui_split-panel-side_hyvsj_1sfal_867",
54
+ "position-side": "awsui_position-side_hyvsj_1sfal_895",
55
+ "openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_1sfal_1",
56
+ "tools-container": "awsui_tools-container_hyvsj_1sfal_932",
57
+ "tools": "awsui_tools_hyvsj_1sfal_932",
58
+ "openTools": "awsui_openTools_hyvsj_1sfal_1",
59
+ "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_1sfal_1017",
60
+ "hide-tools": "awsui_hide-tools_hyvsj_1sfal_1027",
61
+ "show-tools": "awsui_show-tools_hyvsj_1sfal_1039",
62
+ "has-tools-form": "awsui_has-tools-form_hyvsj_1sfal_1017",
63
+ "trigger": "awsui_trigger_hyvsj_1sfal_1096",
64
+ "selected": "awsui_selected_hyvsj_1sfal_1135"
65
65
  };
66
66
 
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/area-chart/internal.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAQlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,aAAK,sBAAsB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,IAAI,YAAY,CAC5E,cAAc,CAAC,CAAC,CAAC,EACjB,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,m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EACtC,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,yBAAyB,EACzC,iBAAiB,EAAE,2BAA2B,EAC9C,WAAW,EACX,SAAS,EACT,cAAc,EACd,eAAe,EACf,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,KAAK,EACL,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,iBAAwB,EACxB,GAAG,KAAK,EACT,EAAE,sBAAsB,CAAC,CAAC,CAAC,eAsI3B"}
@@ -59,6 +59,11 @@ export default function InternalAreaChart(_a) {
59
59
  var showLegend = !hideLegend && !isEmpty && statusType === 'finished';
60
60
  var reserveLegendSpace = !showChart && !hideLegend;
61
61
  var reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);
62
+ useEffect(function () {
63
+ var onKeyDown = model.handlers.onDocumentKeyDown;
64
+ document.addEventListener('keydown', onKeyDown);
65
+ return function () { return document.removeEventListener('keydown', onKeyDown); };
66
+ }, [model.handlers.onDocumentKeyDown]);
62
67
  var onBlur = function (event) {
63
68
  if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {
64
69
  model.handlers.onContainerBlur();
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/area-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAErG,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yB,CAAC,IAAG,kBAAkB;gBACvD,GAAC,MAAM,CAAC,yBAAyB,CAAC,IAAG,kBAAkB;oBACvD,EACF,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;YAE5B,oBAAC,oBAAoB,IACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC;YACD,SAAS,IAAI,CACZ,oBAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,GACxB,CACH,CACG;QAEL,UAAU,IAAI,CACb,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,eAAe,IACd,gBAAgB,EAAE,YAAY,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,CAAC,eAAe,GACtC,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, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isDevelopment } from '../internal/is-development';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\n\nimport AreaChartFilter from './elements/area-chart-filter';\nimport AreaChartLegend from './elements/area-chart-legend';\nimport { AreaChartProps } from './interfaces';\nimport InternalSpaceBetween from '../space-between/internal';\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 useChartModel from './model/use-chart-model';\nimport useFilterProps from './model/use-filter-props';\nimport useHighlightProps from './model/use-highlight-props';\nimport { isSeriesValid } from './model/utils';\nimport { warnOnce } from '../internal/logging';\nimport { nodeContains } from '../internal/utils/dom';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\n\ntype InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<\n AreaChartProps<T>,\n 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalAreaChart<T extends AreaChartProps.DataTypes>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange: controlledOnVisibleChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalAreaChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (!isSeriesValid(externalSeries)) {\n warnOnce(\n 'AreaChart',\n \"The `series` property violates the component's constraints: all `area` \" +\n 'series must have `data` arrays of the same length and with the same x-values.'\n );\n }\n }, [externalSeries]);\n }\n\n const [width, setWidth] = useState(0);\n const [visibleSeries, setVisibleSeries] = useFilterProps(\n externalSeries,\n controlledVisibleSeries,\n controlledOnVisibleChange\n );\n const [highlightedSeries, setHighlightedSeries] = useHighlightProps(\n externalSeries,\n controlledHighlightedSeries,\n controlledOnHighlightChange\n );\n const model = useChartModel({\n externalSeries,\n visibleSeries,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\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\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n model.handlers.onContainerBlur();\n }\n };\n\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 <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({ [styles['has-default-filter']]: !hideFilter })}\n >\n {!hideFilter && (\n <AreaChartFilter\n model={model}\n filterLabel={i18nStrings.filterLabel}\n filterPlaceholder={i18nStrings.filterPlaceholder}\n filterSelectedAriaLabel={i18nStrings.filterSelectedAriaLabel}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\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 model={model}\n autoWidth={setWidth}\n detailPopoverSize={detailPopoverSize}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <AreaChartLegend\n plotContainerRef={containerRef}\n model={model}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings.legendAriaLabel}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/area-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,eAAe,MAAM,sDAAsD,CAAC;AACnF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,iBAAiB,MAAM,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AAkB;gBACvD,GAAC,MAAM,CAAC,yBAAyB,CAAC,IAAG,kBAAkB;oBACvD,EACF,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;YAE5B,oBAAC,oBAAoB,IACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC;YACD,SAAS,IAAI,CACZ,oBAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,GACxB,CACH,CACG;QAEL,UAAU,IAAI,CACb,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,eAAe,IACd,gBAAgB,EAAE,YAAY,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,CAAC,eAAe,GACtC,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, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isDevelopment } from '../internal/is-development';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\n\nimport AreaChartFilter from './elements/area-chart-filter';\nimport AreaChartLegend from './elements/area-chart-legend';\nimport { AreaChartProps } from './interfaces';\nimport InternalSpaceBetween from '../space-between/internal';\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 useChartModel from './model/use-chart-model';\nimport useFilterProps from './model/use-filter-props';\nimport useHighlightProps from './model/use-highlight-props';\nimport { isSeriesValid } from './model/utils';\nimport { warnOnce } from '../internal/logging';\nimport { nodeContains } from '../internal/utils/dom';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\n\ntype InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<\n AreaChartProps<T>,\n 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalAreaChart<T extends AreaChartProps.DataTypes>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange: controlledOnVisibleChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalAreaChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (!isSeriesValid(externalSeries)) {\n warnOnce(\n 'AreaChart',\n \"The `series` property violates the component's constraints: all `area` \" +\n 'series must have `data` arrays of the same length and with the same x-values.'\n );\n }\n }, [externalSeries]);\n }\n\n const [width, setWidth] = useState(0);\n const [visibleSeries, setVisibleSeries] = useFilterProps(\n externalSeries,\n controlledVisibleSeries,\n controlledOnVisibleChange\n );\n const [highlightedSeries, setHighlightedSeries] = useHighlightProps(\n externalSeries,\n controlledHighlightedSeries,\n controlledOnHighlightChange\n );\n const model = useChartModel({\n externalSeries,\n visibleSeries,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\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\n useEffect(() => {\n const onKeyDown = model.handlers.onDocumentKeyDown;\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [model.handlers.onDocumentKeyDown]);\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeContains(containerRef.current, event.relatedTarget)) {\n model.handlers.onContainerBlur();\n }\n };\n\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 <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({ [styles['has-default-filter']]: !hideFilter })}\n >\n {!hideFilter && (\n <AreaChartFilter\n model={model}\n filterLabel={i18nStrings.filterLabel}\n filterPlaceholder={i18nStrings.filterPlaceholder}\n filterSelectedAriaLabel={i18nStrings.filterSelectedAriaLabel}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\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 model={model}\n autoWidth={setWidth}\n detailPopoverSize={detailPopoverSize}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <AreaChartLegend\n plotContainerRef={containerRef}\n model={model}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings.legendAriaLabel}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
@@ -23,6 +23,7 @@ export interface ChartModel<T extends AreaChartProps.DataTypes> {
23
23
  onLegendHighlight: (series: null | AreaChartProps.Series<T>) => void;
24
24
  onPopoverDismiss: (outsideClick?: boolean) => void;
25
25
  onContainerBlur: () => void;
26
+ onDocumentKeyDown: (event: KeyboardEvent) => void;
26
27
  };
27
28
  interactions: ReadonlyAsyncStore<ChartModel.InteractionsState<T>>;
28
29
  refs: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,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,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACtC,iBAAiB,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnD,YAAY,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9C,eAAe,EAAE,OAAO,CAAC;KAC1B;IAED,UAAiB,cAAc,CAAC,CAAC;QAC/B,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,qBAAqB,CAAC;QAClC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;KACnD;IAED,UAAiB,SAAS,CAAC,CAAC;QAC1B,CAAC,EAAE,CAAC,CAAC;QACL,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QAC9C,KAAK,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3C,KAAK,EAAE,MAAM,CAAC;KACf;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/area-chart/model/index.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { ChartSeriesMarkerType } from '../../internal/components/chart-series-marker';\nimport { ChartScale, NumericChartScale } from '../../internal/components/cartesian-chart/scales';\nimport { XDomain, YDomain } from '../../internal/components/cartesian-chart/interfaces';\nimport { ReadonlyAsyncStore } from './async-store';\nimport { AreaChartProps } from '../interfaces';\nimport { ChartPlotRef } from '../../internal/components/chart-plot';\n\nexport interface ChartModel<T extends AreaChartProps.DataTypes> {\n height: number;\n width: number;\n series: readonly AreaChartProps.Series<T>[];\n allSeries: readonly AreaChartProps.Series<T>[];\n getInternalSeries(series: AreaChartProps.Series<T>): ChartModel.InternalSeries<T>;\n computed: ChartModel.ComputedProps<T>;\n handlers: {\n onSVGMouseMove: (event: React.MouseEvent<SVGElement, MouseEvent>) => void;\n onSVGMouseOut: (event: React.MouseEvent<SVGElement, MouseEvent>) => void;\n onSVGMouseDown: (event: React.MouseEvent<SVGSVGElement>) => void;\n onSVGKeyDown: (event: React.KeyboardEvent) => void;\n onSVGFocus: (event: React.FocusEvent<Element>, trigger: 'mouse' | 'keyboard') => void;\n onSVGBlur: (event: React.FocusEvent<Element>) => void;\n onFilterSeries: (series: readonly AreaChartProps.Series<T>[]) => void;\n onLegendHighlight: (series: null | AreaChartProps.Series<T>) => void;\n onPopoverDismiss: (outsideClick?: boolean) => void;\n onContainerBlur: () => void;\n };\n interactions: ReadonlyAsyncStore<ChartModel.InteractionsState<T>>;\n refs: {\n plot: React.RefObject<ChartPlotRef>;\n container: React.RefObject<HTMLDivElement>;\n verticalMarker: React.RefObject<SVGLineElement>;\n };\n}\n\nexport namespace ChartModel {\n export interface ComputedProps<T extends AreaChartProps.DataTypes> {\n xDomain: XDomain<T>;\n yDomain: YDomain;\n xScale: ChartScale;\n yScale: NumericChartScale;\n xTicks: AreaChartProps.DataTypes[];\n yTicks: number[];\n plot: {\n xy: readonly PlotPoint<T>[][];\n xs: readonly PlotPoint<T>[][];\n sx: readonly PlotPoint<T>[][];\n };\n }\n\n export interface InteractionsState<T> {\n highlightedX: null | readonly PlotPoint<T>[];\n highlightedPoint: null | PlotPoint<T>;\n highlightedSeries: null | AreaChartProps.Series<T>;\n legendSeries: null | AreaChartProps.Series<T>;\n isPopoverPinned: boolean;\n }\n\n export interface InternalSeries<T> {\n series: AreaChartProps.Series<T>;\n title: string;\n color: string;\n markerType: ChartSeriesMarkerType;\n formatValue: (y: number, x: T) => string | number;\n }\n\n export interface PlotPoint<T> {\n x: T;\n y0: number;\n y1: number;\n scaled: { x: number; y0: number; y1: number };\n index: { x: number; y: number; s: number };\n value: number;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/area-chart/model/index.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { ChartSeriesMarkerType } from '../../internal/components/chart-series-marker';\nimport { ChartScale, NumericChartScale } from '../../internal/components/cartesian-chart/scales';\nimport { XDomain, YDomain } from '../../internal/components/cartesian-chart/interfaces';\nimport { ReadonlyAsyncStore } from './async-store';\nimport { AreaChartProps } from '../interfaces';\nimport { ChartPlotRef } from '../../internal/components/chart-plot';\n\nexport interface ChartModel<T extends AreaChartProps.DataTypes> {\n height: number;\n width: number;\n series: readonly AreaChartProps.Series<T>[];\n allSeries: readonly AreaChartProps.Series<T>[];\n getInternalSeries(series: AreaChartProps.Series<T>): ChartModel.InternalSeries<T>;\n computed: ChartModel.ComputedProps<T>;\n handlers: {\n onSVGMouseMove: (event: React.MouseEvent<SVGElement, MouseEvent>) => void;\n onSVGMouseOut: (event: React.MouseEvent<SVGElement, MouseEvent>) => void;\n onSVGMouseDown: (event: React.MouseEvent<SVGSVGElement>) => void;\n onSVGKeyDown: (event: React.KeyboardEvent) => void;\n onSVGFocus: (event: React.FocusEvent<Element>, trigger: 'mouse' | 'keyboard') => void;\n onSVGBlur: (event: React.FocusEvent<Element>) => void;\n onFilterSeries: (series: readonly AreaChartProps.Series<T>[]) => void;\n onLegendHighlight: (series: null | AreaChartProps.Series<T>) => void;\n onPopoverDismiss: (outsideClick?: boolean) => void;\n onContainerBlur: () => void;\n onDocumentKeyDown: (event: KeyboardEvent) => void;\n };\n interactions: ReadonlyAsyncStore<ChartModel.InteractionsState<T>>;\n refs: {\n plot: React.RefObject<ChartPlotRef>;\n container: React.RefObject<HTMLDivElement>;\n verticalMarker: React.RefObject<SVGLineElement>;\n };\n}\n\nexport namespace ChartModel {\n export interface ComputedProps<T extends AreaChartProps.DataTypes> {\n xDomain: XDomain<T>;\n yDomain: YDomain;\n xScale: ChartScale;\n yScale: NumericChartScale;\n xTicks: AreaChartProps.DataTypes[];\n yTicks: number[];\n plot: {\n xy: readonly PlotPoint<T>[][];\n xs: readonly PlotPoint<T>[][];\n sx: readonly PlotPoint<T>[][];\n };\n }\n\n export interface InteractionsState<T> {\n highlightedX: null | readonly PlotPoint<T>[];\n highlightedPoint: null | PlotPoint<T>;\n highlightedSeries: null | AreaChartProps.Series<T>;\n legendSeries: null | AreaChartProps.Series<T>;\n isPopoverPinned: boolean;\n }\n\n export interface InternalSeries<T> {\n series: AreaChartProps.Series<T>;\n title: string;\n color: string;\n markerType: ChartSeriesMarkerType;\n formatValue: (y: number, x: T) => string | number;\n }\n\n export interface PlotPoint<T> {\n x: T;\n y0: number;\n y1: number;\n scaled: { x: number; y0: number; y1: number };\n index: { x: number; y: number; s: number };\n value: number;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-chart-model.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/use-chart-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAM/C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;AAMhH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOrC,UAAU,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS;IAC7D,cAAc,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,aAAa,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CA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;IACpD,aAAa,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,gBAAgB,EAAE,CAAC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;IACxE,iBAAiB,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnD,oBAAoB,EAAE,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EACxE,cAAc,EAAE,SAAS,EACzB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,MAAM,EACN,KAAK,GACN,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAkPvC"}
@@ -178,6 +178,12 @@ export default function useChartModel(_a) {
178
178
  var onContainerBlur = function () {
179
179
  interactions.clearState();
180
180
  };
181
+ var onDocumentKeyDown = function (event) {
182
+ if (event.key === 'Escape') {
183
+ interactions.clearHighlight();
184
+ interactions.clearHighlightedLegend();
185
+ }
186
+ };
181
187
  return {
182
188
  width: width,
183
189
  height: height,
@@ -196,7 +202,8 @@ export default function useChartModel(_a) {
196
202
  onFilterSeries: onFilterSeries,
197
203
  onLegendHighlight: onLegendHighlight,
198
204
  onPopoverDismiss: onPopoverDismiss,
199
- onContainerBlur: onContainerBlur
205
+ onContainerBlur: onContainerBlur,
206
+ onDocumentKeyDown: onDocumentKeyDown
200
207
  },
201
208
  refs: {
202
209
  plot: plotRef,
@@ -1 +1 @@
1
- {"version":3,"file":"use-chart-model.js","sourceRoot":"","sources":["../../../../src/area-chart/model/use-chart-model.ts"],"names":[],"mappings":"AAGA,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,qBAAqB,MAAM,2BAA2B,CAAC;AAC9D,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAGtF,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,IAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAgB9B,6FAA6F;AAC7F,MAAM,CAAC,OAAO,UAAU,aAAa,CAAqC,EAYlD;QAXN,SAAS,oBAAA,EACV,MAAM,mBAAA,EACrB,gBAAgB,sBAAA,EAChB,iBAAiB,uBAAA,EACjB,oBAAoB,0BAAA,EACpB,OAAO,aAAA,EACP,OAAO,aAAA,EACP,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,KAAK,WAAA;IAEL,wCAAwC;IACxC,IAAM,OAAO,GAAG,MAAM,CAAe,IAAI,CAAC,CAAC;IAC3C,IAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAClD,IAAM,iBAAiB,G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YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,SAAS,EAAE,YAAY;gBACvB,cAAc,EAAE,iBAAiB;aAClC;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAEzG,8CAA8C;IAC9C,WAAW,CAAC,KAAK,CAAC,YAAY,EAAE,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,iBAAiB,EAAvB,CAAuB,EAAE,oBAAoB,CAAC,CAAC;IAExF,uEAAuE;IACvE,SAAS,CAAC;QACR,IAAI,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE;YACpE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;SACvD;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AreaChartProps } from '../interfaces';\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { findClosest, circleIndex } from './utils';\n\nimport { nodeContains } from '../../internal/utils/dom';\nimport { KeyCode } from '../../internal/keycode';\nimport { XDomain, XScaleType, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';\nimport { useReaction } from './async-store';\nimport computeChartProps from './compute-chart-props';\nimport createSeriesDecorator from './create-series-decorator';\nimport InteractionsStore from './interactions-store';\nimport { useStableEventHandler } from '../../internal/hooks/use-stable-event-handler';\nimport { ChartModel } from './index';\nimport { ChartPlotRef } from '../../internal/components/chart-plot';\nimport { throttle } from '../../internal/utils/throttle';\n\nconst MAX_HOVER_MARGIN = 6;\nconst SVG_HOVER_THROTTLE = 25;\n\ninterface UseChartModelProps<T extends AreaChartProps.DataTypes> {\n externalSeries: readonly AreaChartProps.Series<T>[];\n visibleSeries: readonly AreaChartProps.Series<T>[];\n setVisibleSeries: (series: readonly AreaChartProps.Series<T>[]) => void;\n highlightedSeries: null | AreaChartProps.Series<T>;\n setHighlightedSeries: (series: null | AreaChartProps.Series<T>) => void;\n xDomain?: XDomain<T>;\n yDomain?: YDomain;\n xScaleType: XScaleType;\n yScaleType: YScaleType;\n height: number;\n width: number;\n}\n\n// Represents the core the chart logic, including the model of all allowed user interactions.\nexport default function useChartModel<T extends AreaChartProps.DataTypes>({\n externalSeries: allSeries,\n visibleSeries: series,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n}: UseChartModelProps<T>): ChartModel<T> {\n // Chart elements refs used in handlers.\n const plotRef = useRef<ChartPlotRef>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const verticalMarkerRef = useRef<SVGLineElement>(null);\n\n const stableSetVisibleSeries = useStableEventHandler(setVisibleSeries);\n\n const model = useMemo(() => {\n // Compute scales, ticks and two-dimensional plots.\n const computed = computeChartProps({\n series,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n });\n\n // A store for chart interactions that don't require plot recomputation.\n const interactions = new InteractionsStore(series, computed.plot);\n\n // A series decorator to provide extra props such as color and marker type.\n const getInternalSeries = createSeriesDecorator(allSeries);\n\n // A Callback for svg mouseover to hover the plot points.\n // Throttling is necessary for a substantially smoother customer experience.\n const onSVGMouseMoveThrottled = throttle((clientX: number, clientY: number) => {\n // No hover logic when the popover is pinned or no data available.\n if (interactions.get().isPopoverPinned || !plotRef.current || interactions.plot.xy.length === 0) {\n return;\n }\n\n const svgRect = plotRef.current.svg.getBoundingClientRect();\n const offsetX = clientX - svgRect.left;\n const offsetY = clientY - svgRect.top;\n\n const closestX = findClosest(interactions.plot.xy, offsetX, xPoints => xPoints[0].scaled.x);\n const closestPoint = findClosest(closestX, offsetY, point => point.scaled.y1);\n\n // If close enough to the point - highlight the point and its column.\n // If not - only highlight the closest column.\n if (\n Math.abs(offsetX - closestPoint.scaled.x) < MAX_HOVER_MARGIN &&\n Math.abs(offsetY - closestPoint.scaled.y1) < MAX_HOVER_MARGIN\n ) {\n interactions.highlightPoint(closestPoint);\n } else {\n interactions.highlightX(closestX);\n }\n }, SVG_HOVER_THROTTLE);\n\n const onSVGMouseMove = ({ clientX, clientY }: React.MouseEvent<SVGElement, MouseEvent>) =>\n onSVGMouseMoveThrottled(clientX, clientY);\n\n // A callback for svg mouseout to clear all highlights.\n const onSVGMouseOut = (event: React.MouseEvent<SVGElement, MouseEvent>) => {\n // Because the mouseover is throttled, in can occur slightly after the mouseout,\n // neglecting its effect; cancelling the throttled function prevents that.\n onSVGMouseMoveThrottled.cancel();\n\n // No hover logic when the popover is pinned.\n if (interactions.get().isPopoverPinned) {\n return;\n }\n\n // Check if the target is contained within svg to allow hovering on the popover body.\n if (!nodeContains(plotRef.current!.svg, event.relatedTarget as Element)) {\n interactions.clearHighlightedLegend();\n interactions.clearHighlight();\n }\n };\n\n // A callback for svg click to pin/unpin the popover.\n const onSVGMouseDown = (event: React.MouseEvent<SVGSVGElement>) => {\n interactions.togglePopoverPin();\n event.preventDefault();\n };\n\n // A helper function to highlight the next or previous point within selected series.\n const moveWithinSeries = (direction: -1 | 1) => {\n // Can only use motion when a particular point is highlighted.\n const point = interactions.get().highlightedPoint;\n if (!point) {\n return;\n }\n\n // Take the index of the currently highlighted series.\n const sIndex = point.index.s;\n // Take the incremented(circularly) x-index of the currently highlighted point.\n const xIndex = circleIndex(point.index.x + direction, [0, interactions.plot.xs.length - 1]);\n // Highlight the next point using x:s grouped data.\n interactions.highlightPoint(interactions.plot.xs[xIndex][sIndex]);\n };\n\n // A helper function to highlight the next or previous point withing selected column.\n const moveBetweenSeries = (direction: -1 | 1) => {\n // Can only use motion when a particular point is highlighted.\n const point = interactions.get().highlightedPoint;\n if (!point) {\n return;\n }\n\n // Take the index of the currently highlighted column.\n const xIndex = point.index.x;\n // Take the incremented(circularly) y-index of the currently highlighted point.\n const yIndex = circleIndex(point.index.y + direction, [0, interactions.plot.xy[xIndex].length - 1]);\n // Highlight the next point using x:y grouped data.\n interactions.highlightPoint(interactions.plot.xy[xIndex][yIndex]);\n };\n\n // A callback for svg keydown to enable motions and popover pin with the keyboard.\n const onSVGKeyDown = (event: React.KeyboardEvent) => {\n const keyCode = event.keyCode;\n if (\n keyCode !== KeyCode.up &&\n keyCode !== KeyCode.right &&\n keyCode !== KeyCode.down &&\n keyCode !== KeyCode.left &&\n keyCode !== KeyCode.space &&\n keyCode !== KeyCode.enter\n ) {\n return;\n }\n\n // Preventing default fixes an issue in Safari+VO when VO additionally interprets arrow keys as its commands.\n event.preventDefault();\n\n // No keydown logic when the popover is pinned.\n if (interactions.get().isPopoverPinned) {\n return;\n }\n\n // Move up/down.\n if (keyCode === KeyCode.down || keyCode === KeyCode.up) {\n moveBetweenSeries(keyCode === KeyCode.down ? -1 : 1);\n }\n // Move left/right.\n else if (keyCode === KeyCode.left || keyCode === KeyCode.right) {\n moveWithinSeries(keyCode === KeyCode.right ? 1 : -1);\n }\n // Pin popover.\n else if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n interactions.pinPopover();\n }\n };\n\n // A callback for svg focus to highlight series.\n const onSVGFocus = (_event: React.FocusEvent, trigger: 'mouse' | 'keyboard') => {\n // When focus is caused by a click event nothing is expected as clicks are handled separately.\n // Otherwise, select the first series point.\n if (trigger === 'keyboard') {\n interactions.highlightFirstPoint();\n }\n };\n\n // A callback for svg blur to clear all highlights unless the popover is pinned.\n const onSVGBlur = () => {\n // Pinned popover stays pinned even if the focus is lost.\n // If blur is not caused by the popover, forget the previously highlighted point.\n if (!interactions.get().isPopoverPinned) {\n interactions.clearHighlight();\n }\n };\n\n const onFilterSeries = (series: readonly AreaChartProps.Series<T>[]) => {\n stableSetVisibleSeries(series);\n };\n\n const onLegendHighlight = (series: null | AreaChartProps.Series<T>) => {\n interactions.highlightSeries(series);\n };\n\n const onPopoverDismiss = (outsideClick?: boolean) => {\n interactions.unpinPopover();\n\n // Return focus back to the application or plot (when no point is highlighted).\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n if (interactions.get().highlightedPoint) {\n plotRef.current!.focusApplication();\n } else {\n interactions.clearHighlight();\n plotRef.current!.focusPlot();\n }\n }, 0);\n }\n };\n\n const onContainerBlur = () => {\n interactions.clearState();\n };\n\n return {\n width,\n height,\n series,\n allSeries,\n getInternalSeries,\n computed,\n interactions,\n handlers: {\n onSVGMouseMove,\n onSVGMouseOut,\n onSVGMouseDown,\n onSVGKeyDown,\n onSVGFocus,\n onSVGBlur,\n onFilterSeries,\n onLegendHighlight,\n onPopoverDismiss,\n onContainerBlur,\n },\n refs: {\n plot: plotRef,\n container: containerRef,\n verticalMarker: verticalMarkerRef,\n },\n };\n }, [allSeries, series, xDomain, yDomain, xScaleType, yScaleType, height, width, stableSetVisibleSeries]);\n\n // Notify client when series highlight change.\n useReaction(model.interactions, state => state.highlightedSeries, setHighlightedSeries);\n\n // Update interactions store when series highlight in a controlled way.\n useEffect(() => {\n if (highlightedSeries !== model.interactions.get().highlightedSeries) {\n model.interactions.highlightSeries(highlightedSeries);\n }\n }, [model, highlightedSeries]);\n\n return model;\n}\n"]}
1
+ {"version":3,"file":"use-chart-model.js","sourceRoot":"","sources":["../../../../src/area-chart/model/use-chart-model.ts"],"names":[],"mappings":"AAGA,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,eA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C9C,WAAW,CAAC,KAAK,CAAC,YAAY,EAAE,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,iBAAiB,EAAvB,CAAuB,EAAE,oBAAoB,CAAC,CAAC;IAExF,uEAAuE;IACvE,SAAS,CAAC;QACR,IAAI,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE;YACpE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;SACvD;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AreaChartProps } from '../interfaces';\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { findClosest, circleIndex } from './utils';\n\nimport { nodeContains } from '../../internal/utils/dom';\nimport { KeyCode } from '../../internal/keycode';\nimport { XDomain, XScaleType, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';\nimport { useReaction } from './async-store';\nimport computeChartProps from './compute-chart-props';\nimport createSeriesDecorator from './create-series-decorator';\nimport InteractionsStore from './interactions-store';\nimport { useStableEventHandler } from '../../internal/hooks/use-stable-event-handler';\nimport { ChartModel } from './index';\nimport { ChartPlotRef } from '../../internal/components/chart-plot';\nimport { throttle } from '../../internal/utils/throttle';\n\nconst MAX_HOVER_MARGIN = 6;\nconst SVG_HOVER_THROTTLE = 25;\n\ninterface UseChartModelProps<T extends AreaChartProps.DataTypes> {\n externalSeries: readonly AreaChartProps.Series<T>[];\n visibleSeries: readonly AreaChartProps.Series<T>[];\n setVisibleSeries: (series: readonly AreaChartProps.Series<T>[]) => void;\n highlightedSeries: null | AreaChartProps.Series<T>;\n setHighlightedSeries: (series: null | AreaChartProps.Series<T>) => void;\n xDomain?: XDomain<T>;\n yDomain?: YDomain;\n xScaleType: XScaleType;\n yScaleType: YScaleType;\n height: number;\n width: number;\n}\n\n// Represents the core the chart logic, including the model of all allowed user interactions.\nexport default function useChartModel<T extends AreaChartProps.DataTypes>({\n externalSeries: allSeries,\n visibleSeries: series,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n}: UseChartModelProps<T>): ChartModel<T> {\n // Chart elements refs used in handlers.\n const plotRef = useRef<ChartPlotRef>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const verticalMarkerRef = useRef<SVGLineElement>(null);\n\n const stableSetVisibleSeries = useStableEventHandler(setVisibleSeries);\n\n const model = useMemo(() => {\n // Compute scales, ticks and two-dimensional plots.\n const computed = computeChartProps({\n series,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n });\n\n // A store for chart interactions that don't require plot recomputation.\n const interactions = new InteractionsStore(series, computed.plot);\n\n // A series decorator to provide extra props such as color and marker type.\n const getInternalSeries = createSeriesDecorator(allSeries);\n\n // A Callback for svg mouseover to hover the plot points.\n // Throttling is necessary for a substantially smoother customer experience.\n const onSVGMouseMoveThrottled = throttle((clientX: number, clientY: number) => {\n // No hover logic when the popover is pinned or no data available.\n if (interactions.get().isPopoverPinned || !plotRef.current || interactions.plot.xy.length === 0) {\n return;\n }\n\n const svgRect = plotRef.current.svg.getBoundingClientRect();\n const offsetX = clientX - svgRect.left;\n const offsetY = clientY - svgRect.top;\n\n const closestX = findClosest(interactions.plot.xy, offsetX, xPoints => xPoints[0].scaled.x);\n const closestPoint = findClosest(closestX, offsetY, point => point.scaled.y1);\n\n // If close enough to the point - highlight the point and its column.\n // If not - only highlight the closest column.\n if (\n Math.abs(offsetX - closestPoint.scaled.x) < MAX_HOVER_MARGIN &&\n Math.abs(offsetY - closestPoint.scaled.y1) < MAX_HOVER_MARGIN\n ) {\n interactions.highlightPoint(closestPoint);\n } else {\n interactions.highlightX(closestX);\n }\n }, SVG_HOVER_THROTTLE);\n\n const onSVGMouseMove = ({ clientX, clientY }: React.MouseEvent<SVGElement, MouseEvent>) =>\n onSVGMouseMoveThrottled(clientX, clientY);\n\n // A callback for svg mouseout to clear all highlights.\n const onSVGMouseOut = (event: React.MouseEvent<SVGElement, MouseEvent>) => {\n // Because the mouseover is throttled, in can occur slightly after the mouseout,\n // neglecting its effect; cancelling the throttled function prevents that.\n onSVGMouseMoveThrottled.cancel();\n\n // No hover logic when the popover is pinned.\n if (interactions.get().isPopoverPinned) {\n return;\n }\n\n // Check if the target is contained within svg to allow hovering on the popover body.\n if (!nodeContains(plotRef.current!.svg, event.relatedTarget as Element)) {\n interactions.clearHighlightedLegend();\n interactions.clearHighlight();\n }\n };\n\n // A callback for svg click to pin/unpin the popover.\n const onSVGMouseDown = (event: React.MouseEvent<SVGSVGElement>) => {\n interactions.togglePopoverPin();\n event.preventDefault();\n };\n\n // A helper function to highlight the next or previous point within selected series.\n const moveWithinSeries = (direction: -1 | 1) => {\n // Can only use motion when a particular point is highlighted.\n const point = interactions.get().highlightedPoint;\n if (!point) {\n return;\n }\n\n // Take the index of the currently highlighted series.\n const sIndex = point.index.s;\n // Take the incremented(circularly) x-index of the currently highlighted point.\n const xIndex = circleIndex(point.index.x + direction, [0, interactions.plot.xs.length - 1]);\n // Highlight the next point using x:s grouped data.\n interactions.highlightPoint(interactions.plot.xs[xIndex][sIndex]);\n };\n\n // A helper function to highlight the next or previous point withing selected column.\n const moveBetweenSeries = (direction: -1 | 1) => {\n // Can only use motion when a particular point is highlighted.\n const point = interactions.get().highlightedPoint;\n if (!point) {\n return;\n }\n\n // Take the index of the currently highlighted column.\n const xIndex = point.index.x;\n // Take the incremented(circularly) y-index of the currently highlighted point.\n const yIndex = circleIndex(point.index.y + direction, [0, interactions.plot.xy[xIndex].length - 1]);\n // Highlight the next point using x:y grouped data.\n interactions.highlightPoint(interactions.plot.xy[xIndex][yIndex]);\n };\n\n // A callback for svg keydown to enable motions and popover pin with the keyboard.\n const onSVGKeyDown = (event: React.KeyboardEvent) => {\n const keyCode = event.keyCode;\n if (\n keyCode !== KeyCode.up &&\n keyCode !== KeyCode.right &&\n keyCode !== KeyCode.down &&\n keyCode !== KeyCode.left &&\n keyCode !== KeyCode.space &&\n keyCode !== KeyCode.enter\n ) {\n return;\n }\n\n // Preventing default fixes an issue in Safari+VO when VO additionally interprets arrow keys as its commands.\n event.preventDefault();\n\n // No keydown logic when the popover is pinned.\n if (interactions.get().isPopoverPinned) {\n return;\n }\n\n // Move up/down.\n if (keyCode === KeyCode.down || keyCode === KeyCode.up) {\n moveBetweenSeries(keyCode === KeyCode.down ? -1 : 1);\n }\n // Move left/right.\n else if (keyCode === KeyCode.left || keyCode === KeyCode.right) {\n moveWithinSeries(keyCode === KeyCode.right ? 1 : -1);\n }\n // Pin popover.\n else if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n interactions.pinPopover();\n }\n };\n\n // A callback for svg focus to highlight series.\n const onSVGFocus = (_event: React.FocusEvent, trigger: 'mouse' | 'keyboard') => {\n // When focus is caused by a click event nothing is expected as clicks are handled separately.\n // Otherwise, select the first series point.\n if (trigger === 'keyboard') {\n interactions.highlightFirstPoint();\n }\n };\n\n // A callback for svg blur to clear all highlights unless the popover is pinned.\n const onSVGBlur = () => {\n // Pinned popover stays pinned even if the focus is lost.\n // If blur is not caused by the popover, forget the previously highlighted point.\n if (!interactions.get().isPopoverPinned) {\n interactions.clearHighlight();\n }\n };\n\n const onFilterSeries = (series: readonly AreaChartProps.Series<T>[]) => {\n stableSetVisibleSeries(series);\n };\n\n const onLegendHighlight = (series: null | AreaChartProps.Series<T>) => {\n interactions.highlightSeries(series);\n };\n\n const onPopoverDismiss = (outsideClick?: boolean) => {\n interactions.unpinPopover();\n\n // Return focus back to the application or plot (when no point is highlighted).\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n if (interactions.get().highlightedPoint) {\n plotRef.current!.focusApplication();\n } else {\n interactions.clearHighlight();\n plotRef.current!.focusPlot();\n }\n }, 0);\n }\n };\n\n const onContainerBlur = () => {\n interactions.clearState();\n };\n\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n interactions.clearHighlight();\n interactions.clearHighlightedLegend();\n }\n };\n\n return {\n width,\n height,\n series,\n allSeries,\n getInternalSeries,\n computed,\n interactions,\n handlers: {\n onSVGMouseMove,\n onSVGMouseOut,\n onSVGMouseDown,\n onSVGKeyDown,\n onSVGFocus,\n onSVGBlur,\n onFilterSeries,\n onLegendHighlight,\n onPopoverDismiss,\n onContainerBlur,\n onDocumentKeyDown,\n },\n refs: {\n plot: plotRef,\n container: containerRef,\n verticalMarker: verticalMarkerRef,\n },\n };\n }, [allSeries, series, xDomain, yDomain, xScaleType, yScaleType, height, width, stableSetVisibleSeries]);\n\n // Notify client when series highlight change.\n useReaction(model.interactions, state => state.highlightedSeries, setHighlightedSeries);\n\n // Update interactions store when series highlight in a controlled way.\n useEffect(() => {\n if (highlightedSeries !== model.interactions.get().highlightedSeries) {\n model.interactions.highlightSeries(highlightedSeries);\n }\n }, [model, highlightedSeries]);\n\n return model;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../../src/attribute-editor/row.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAE3C,OAA6B,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAQvF,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC,CAA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 +31,7 @@ export var Row = React.memo(function (_a) {
31
31
  var info = _a.info, label = _a.label, constraintText = _a.constraintText, errorText = _a.errorText, control = _a.control;
32
32
  return (React.createElement(InternalFormField, { key: defIndex, className: styles.field, label: label, info: info, constraintText: render(item, index, constraintText), errorText: render(item, index, errorText), stretch: true, i18nStrings: { errorIconAriaLabel: i18nStrings.errorIconAriaLabel }, __hideLabel: isWideViewport && index > 0, controlId: defIndex === 0 ? firstControlId : undefined }, render(item, index, control)));
33
33
  })),
34
- removable && (React.createElement(ButtonContainer, { index: index, isNarrowViewport: isNarrowViewport },
34
+ removable && (React.createElement(ButtonContainer, { index: index, isNarrowViewport: isNarrowViewport, hasLabel: definition.some(function (row) { return row.label; }) },
35
35
  React.createElement(InternalButton, { className: styles['remove-button'], formAction: "none", ref: function (ref) {
36
36
  removeButtonRefs[index] = ref !== null && ref !== void 0 ? ref : undefined;
37
37
  }, onClick: handleRemoveClick }, removeButtonText))))),
@@ -39,9 +39,10 @@ export var Row = React.memo(function (_a) {
39
39
  });
40
40
  var ButtonContainer = function (_a) {
41
41
  var _b;
42
- var index = _a.index, children = _a.children, isNarrowViewport = _a.isNarrowViewport;
42
+ var index = _a.index, children = _a.children, isNarrowViewport = _a.isNarrowViewport, hasLabel = _a.hasLabel;
43
43
  return (React.createElement("div", { className: clsx((_b = {},
44
- _b[styles['button-container']] = !isNarrowViewport && index === 0,
44
+ _b[styles['button-container-haslabel']] = !isNarrowViewport && index === 0 && hasLabel,
45
+ _b[styles['button-container-nolabel']] = !isNarrowViewport && index === 0 && !hasLabel,
45
46
  _b[styles['right-align']] = isNarrowViewport,
46
47
  _b)) }, children));
47
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"row.js","sourceRoot":"","sources":["../../../src/attribute-editor/row.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,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2.0\nimport InternalBox from '../box/internal';\nimport styles from './styles.css.js';\nimport React, { useCallback } from 'react';\nimport InternalFormField from '../form-field/internal';\nimport InternalColumnLayout, { ColumnLayoutBreakpoint } from '../column-layout/internal';\nimport { AttributeEditorProps } from './interfaces';\nimport { ButtonProps } from '../button/interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport InternalGrid from '../grid/internal';\nimport { InternalButton } from '../button/internal';\nimport clsx from 'clsx';\nimport { generateUniqueId } from '../internal/hooks/use-unique-id';\n\nconst Divider = () => <InternalBox className={styles.divider} padding={{ top: 'l' }} />;\n\nexport interface RowProps<T> {\n breakpoint: ColumnLayoutBreakpoint | null;\n item: T;\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n i18nStrings: AttributeEditorProps.I18nStrings | undefined;\n index: number;\n removable: boolean;\n removeButtonText: string;\n removeButtonRefs: Array<ButtonProps.Ref | undefined>;\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n}\n\nfunction render<T>(\n item: T,\n itemIndex: number,\n slot: AttributeEditorProps.FieldRenderable<T> | React.ReactNode | undefined\n) {\n return typeof slot === 'function' ? slot(item, itemIndex) : slot;\n}\n\nconst GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }];\nconst REMOVABLE_GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }, { colspan: { default: 12, xs: 3 } }];\nexport const Row = React.memo(\n <T,>({\n breakpoint,\n item,\n definition,\n i18nStrings = {},\n index,\n removable,\n removeButtonText,\n removeButtonRefs,\n onRemoveButtonClick,\n }: RowProps<T>) => {\n const isNarrowViewport = breakpoint === 'default' || breakpoint === 'xxs';\n const isWideViewport = !isNarrowViewport;\n\n const handleRemoveClick = useCallback(() => {\n fireNonCancelableEvent(onRemoveButtonClick, { itemIndex: index });\n }, [onRemoveButtonClick, index]);\n\n const firstControlId = generateUniqueId('first-control-id-');\n\n return (\n <InternalBox className={styles.row} margin={{ bottom: 's' }}>\n <div role=\"group\" aria-labelledby={`${firstControlId}-label ${firstControlId}`}>\n <InternalGrid\n __breakpoint={breakpoint}\n gridDefinition={removable ? REMOVABLE_GRID_DEFINITION : GRID_DEFINITION}\n >\n <InternalColumnLayout\n className={styles['row-control']}\n columns={definition.length}\n __breakpoint={breakpoint}\n >\n {definition.map(({ info, label, constraintText, errorText, control }, defIndex) => (\n <InternalFormField\n key={defIndex}\n className={styles.field}\n label={label}\n info={info}\n constraintText={render(item, index, constraintText)}\n errorText={render(item, index, errorText)}\n stretch={true}\n i18nStrings={{ errorIconAriaLabel: i18nStrings.errorIconAriaLabel }}\n __hideLabel={isWideViewport && index > 0}\n controlId={defIndex === 0 ? firstControlId : undefined}\n >\n {render(item, index, control)}\n </InternalFormField>\n ))}\n </InternalColumnLayout>\n {removable && (\n <ButtonContainer index={index} isNarrowViewport={isNarrowViewport}>\n <InternalButton\n className={styles['remove-button']}\n formAction=\"none\"\n ref={ref => {\n removeButtonRefs[index] = ref ?? undefined;\n }}\n onClick={handleRemoveClick}\n >\n {removeButtonText}\n </InternalButton>\n </ButtonContainer>\n )}\n </InternalGrid>\n </div>\n {isNarrowViewport && <Divider />}\n </InternalBox>\n );\n }\n);\n\ninterface ButtonContainer {\n index: number;\n children: React.ReactNode;\n isNarrowViewport: boolean;\n}\n\nconst ButtonContainer = ({ index, children, isNarrowViewport }: ButtonContainer) => (\n <div\n className={clsx({\n [styles['button-container']]: !isNarrowViewport && index === 0,\n [styles['right-align']]: isNarrowViewport,\n })}\n >\n {children}\n </div>\n);\n"]}
1
+ {"version":3,"file":"row.js","sourceRoot":"","sources":["../../../src/attribute-editor/row.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAA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C,QAAQ;YACnF,GAAC,MAAM,CAAC,aAAa,CAAC,IAAG,gBAAgB;gBACzC,IAED,QAAQ,CACL,CACP;AAV6F,CAU7F,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport InternalBox from '../box/internal';\nimport styles from './styles.css.js';\nimport React, { useCallback } from 'react';\nimport InternalFormField from '../form-field/internal';\nimport InternalColumnLayout, { ColumnLayoutBreakpoint } from '../column-layout/internal';\nimport { AttributeEditorProps } from './interfaces';\nimport { ButtonProps } from '../button/interfaces';\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from '../internal/events';\nimport InternalGrid from '../grid/internal';\nimport { InternalButton } from '../button/internal';\nimport clsx from 'clsx';\nimport { generateUniqueId } from '../internal/hooks/use-unique-id';\n\nconst Divider = () => <InternalBox className={styles.divider} padding={{ top: 'l' }} />;\n\nexport interface RowProps<T> {\n breakpoint: ColumnLayoutBreakpoint | null;\n item: T;\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n i18nStrings: AttributeEditorProps.I18nStrings | undefined;\n index: number;\n removable: boolean;\n removeButtonText: string;\n removeButtonRefs: Array<ButtonProps.Ref | undefined>;\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n}\n\nfunction render<T>(\n item: T,\n itemIndex: number,\n slot: AttributeEditorProps.FieldRenderable<T> | React.ReactNode | undefined\n) {\n return typeof slot === 'function' ? slot(item, itemIndex) : slot;\n}\n\nconst GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }];\nconst REMOVABLE_GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }, { colspan: { default: 12, xs: 3 } }];\nexport const Row = React.memo(\n <T,>({\n breakpoint,\n item,\n definition,\n i18nStrings = {},\n index,\n removable,\n removeButtonText,\n removeButtonRefs,\n onRemoveButtonClick,\n }: RowProps<T>) => {\n const isNarrowViewport = breakpoint === 'default' || breakpoint === 'xxs';\n const isWideViewport = !isNarrowViewport;\n\n const handleRemoveClick = useCallback(() => {\n fireNonCancelableEvent(onRemoveButtonClick, { itemIndex: index });\n }, [onRemoveButtonClick, index]);\n\n const firstControlId = generateUniqueId('first-control-id-');\n\n return (\n <InternalBox className={styles.row} margin={{ bottom: 's' }}>\n <div role=\"group\" aria-labelledby={`${firstControlId}-label ${firstControlId}`}>\n <InternalGrid\n __breakpoint={breakpoint}\n gridDefinition={removable ? REMOVABLE_GRID_DEFINITION : GRID_DEFINITION}\n >\n <InternalColumnLayout\n className={styles['row-control']}\n columns={definition.length}\n __breakpoint={breakpoint}\n >\n {definition.map(({ info, label, constraintText, errorText, control }, defIndex) => (\n <InternalFormField\n key={defIndex}\n className={styles.field}\n label={label}\n info={info}\n constraintText={render(item, index, constraintText)}\n errorText={render(item, index, errorText)}\n stretch={true}\n i18nStrings={{ errorIconAriaLabel: i18nStrings.errorIconAriaLabel }}\n __hideLabel={isWideViewport && index > 0}\n controlId={defIndex === 0 ? firstControlId : undefined}\n >\n {render(item, index, control)}\n </InternalFormField>\n ))}\n </InternalColumnLayout>\n {removable && (\n <ButtonContainer\n index={index}\n isNarrowViewport={isNarrowViewport}\n hasLabel={definition.some(row => row.label)}\n >\n <InternalButton\n className={styles['remove-button']}\n formAction=\"none\"\n ref={ref => {\n removeButtonRefs[index] = ref ?? undefined;\n }}\n onClick={handleRemoveClick}\n >\n {removeButtonText}\n </InternalButton>\n </ButtonContainer>\n )}\n </InternalGrid>\n </div>\n {isNarrowViewport && <Divider />}\n </InternalBox>\n );\n }\n);\n\ninterface ButtonContainer {\n index: number;\n children: React.ReactNode;\n isNarrowViewport: boolean;\n hasLabel: boolean;\n}\n\nconst ButtonContainer = ({ index, children, isNarrowViewport, hasLabel }: ButtonContainer) => (\n <div\n className={clsx({\n [styles['button-container-haslabel']]: !isNarrowViewport && index === 0 && hasLabel,\n [styles['button-container-nolabel']]: !isNarrowViewport && index === 0 && !hasLabel,\n [styles['right-align']]: isNarrowViewport,\n })}\n >\n {children}\n </div>\n);\n"]}
@@ -1,17 +1,18 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "empty": "awsui_empty_n4qlp_h3o62_93",
5
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_n4qlp_h3o62_1",
6
- "root": "awsui_root_n4qlp_h3o62_119",
7
- "row": "awsui_row_n4qlp_h3o62_137",
8
- "row-control": "awsui_row-control_n4qlp_h3o62_141",
9
- "field": "awsui_field_n4qlp_h3o62_145",
10
- "add-button": "awsui_add-button_n4qlp_h3o62_149",
11
- "remove-button": "awsui_remove-button_n4qlp_h3o62_153",
12
- "button-container": "awsui_button-container_n4qlp_h3o62_157",
13
- "divider": "awsui_divider_n4qlp_h3o62_161",
14
- "additional-info": "awsui_additional-info_n4qlp_h3o62_165",
15
- "right-align": "awsui_right-align_n4qlp_h3o62_211"
4
+ "empty": "awsui_empty_n4qlp_19053_93",
5
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_n4qlp_19053_1",
6
+ "root": "awsui_root_n4qlp_19053_119",
7
+ "row": "awsui_row_n4qlp_19053_137",
8
+ "row-control": "awsui_row-control_n4qlp_19053_141",
9
+ "field": "awsui_field_n4qlp_19053_145",
10
+ "add-button": "awsui_add-button_n4qlp_19053_149",
11
+ "remove-button": "awsui_remove-button_n4qlp_19053_153",
12
+ "button-container-haslabel": "awsui_button-container-haslabel_n4qlp_19053_157",
13
+ "button-container-nolabel": "awsui_button-container-nolabel_n4qlp_19053_161",
14
+ "divider": "awsui_divider_n4qlp_19053_165",
15
+ "additional-info": "awsui_additional-info_n4qlp_19053_169",
16
+ "right-align": "awsui_right-align_n4qlp_19053_215"
16
17
  };
17
18