@cloudscape-design/components 3.0.135 → 3.0.137

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 (310) hide show
  1. package/alert/internal.d.ts +1 -1
  2. package/alert/internal.d.ts.map +1 -1
  3. package/app-layout/visual-refresh/styles.css.js +60 -60
  4. package/app-layout/visual-refresh/styles.scoped.css +148 -148
  5. package/app-layout/visual-refresh/styles.selectors.js +60 -60
  6. package/area-chart/chart-container.d.ts.map +1 -1
  7. package/area-chart/chart-container.js +2 -1
  8. package/area-chart/chart-container.js.map +1 -1
  9. package/area-chart/internal.d.ts +1 -1
  10. package/area-chart/internal.d.ts.map +1 -1
  11. package/area-chart/model/async-store.d.ts +2 -2
  12. package/area-chart/model/async-store.d.ts.map +1 -1
  13. package/area-chart/model/interactions-store.d.ts.map +1 -1
  14. package/area-chart/model/interactions-store.js +1 -1
  15. package/area-chart/model/interactions-store.js.map +1 -1
  16. package/area-chart/model/use-chart-model.d.ts +1 -2
  17. package/area-chart/model/use-chart-model.d.ts.map +1 -1
  18. package/area-chart/model/use-chart-model.js +46 -10
  19. package/area-chart/model/use-chart-model.js.map +1 -1
  20. package/area-chart/model/use-filter-props.d.ts +1 -1
  21. package/area-chart/model/use-filter-props.d.ts.map +1 -1
  22. package/area-chart/model/use-highlight-props.d.ts +1 -1
  23. package/area-chart/model/use-highlight-props.d.ts.map +1 -1
  24. package/attribute-editor/internal.js.map +1 -1
  25. package/autosuggest/interfaces.d.ts +1 -1
  26. package/autosuggest/interfaces.d.ts.map +1 -1
  27. package/autosuggest/options-controller.d.ts +1 -1
  28. package/autosuggest/options-controller.d.ts.map +1 -1
  29. package/autosuggest/plain-list.d.ts +1 -1
  30. package/autosuggest/plain-list.d.ts.map +1 -1
  31. package/bar-chart/interfaces.d.ts +1 -1
  32. package/bar-chart/interfaces.d.ts.map +1 -1
  33. package/box/internal.d.ts +1 -1
  34. package/box/internal.d.ts.map +1 -1
  35. package/breadcrumb-group/internal.d.ts +1 -1
  36. package/breadcrumb-group/internal.d.ts.map +1 -1
  37. package/button-dropdown/interfaces.d.ts +2 -2
  38. package/button-dropdown/interfaces.d.ts.map +1 -1
  39. package/button-dropdown/utils/create-items-tree.d.ts +1 -1
  40. package/button-dropdown/utils/create-items-tree.d.ts.map +1 -1
  41. package/calendar/internal.d.ts +1 -1
  42. package/calendar/internal.d.ts.map +1 -1
  43. package/code-editor/interfaces.d.ts +2 -2
  44. package/code-editor/interfaces.d.ts.map +1 -1
  45. package/code-editor/util.d.ts +1 -1
  46. package/code-editor/util.d.ts.map +1 -1
  47. package/collection-preferences/index.d.ts +1 -1
  48. package/collection-preferences/index.d.ts.map +1 -1
  49. package/collection-preferences/index.js +10 -5
  50. package/collection-preferences/index.js.map +1 -1
  51. package/collection-preferences/interfaces.d.ts +17 -0
  52. package/collection-preferences/interfaces.d.ts.map +1 -1
  53. package/collection-preferences/interfaces.js.map +1 -1
  54. package/collection-preferences/styles.css.js +20 -19
  55. package/collection-preferences/styles.scoped.css +21 -20
  56. package/collection-preferences/styles.selectors.js +20 -19
  57. package/collection-preferences/utils.d.ts +6 -1
  58. package/collection-preferences/utils.d.ts.map +1 -1
  59. package/collection-preferences/utils.js +10 -1
  60. package/collection-preferences/utils.js.map +1 -1
  61. package/column-layout/internal.d.ts +2 -2
  62. package/column-layout/internal.d.ts.map +1 -1
  63. package/container/use-sticky-header.d.ts +1 -1
  64. package/container/use-sticky-header.d.ts.map +1 -1
  65. package/date-range-picker/calendar/range-inputs.d.ts +1 -1
  66. package/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
  67. package/date-range-picker/interfaces.d.ts +2 -2
  68. package/date-range-picker/interfaces.d.ts.map +1 -1
  69. package/expandable-section/internal.d.ts +1 -1
  70. package/expandable-section/internal.d.ts.map +1 -1
  71. package/form/internal.d.ts +1 -1
  72. package/form/internal.d.ts.map +1 -1
  73. package/icon/internal.d.ts +1 -1
  74. package/icon/internal.d.ts.map +1 -1
  75. package/input/index.js.map +1 -1
  76. package/internal/base-component/styles.scoped.css +4 -0
  77. package/internal/breakpoints.d.ts +1 -1
  78. package/internal/breakpoints.d.ts.map +1 -1
  79. package/internal/components/autosuggest-input/index.js.map +1 -1
  80. package/internal/components/cartesian-chart/bottom-labels.d.ts.map +1 -1
  81. package/internal/components/cartesian-chart/bottom-labels.js +1 -1
  82. package/internal/components/cartesian-chart/bottom-labels.js.map +1 -1
  83. package/internal/components/cartesian-chart/interfaces.d.ts +8 -8
  84. package/internal/components/cartesian-chart/interfaces.d.ts.map +1 -1
  85. package/internal/components/cartesian-chart/scales.d.ts +2 -2
  86. package/internal/components/cartesian-chart/scales.d.ts.map +1 -1
  87. package/internal/components/chart-plot/application-controller.js +1 -1
  88. package/internal/components/chart-plot/application-controller.js.map +1 -1
  89. package/internal/components/chart-plot/focus-outline.d.ts +2 -1
  90. package/internal/components/chart-plot/focus-outline.d.ts.map +1 -1
  91. package/internal/components/chart-plot/focus-outline.js +6 -4
  92. package/internal/components/chart-plot/focus-outline.js.map +1 -1
  93. package/internal/components/chart-plot/index.d.ts +3 -2
  94. package/internal/components/chart-plot/index.d.ts.map +1 -1
  95. package/internal/components/chart-plot/index.js.map +1 -1
  96. package/internal/components/chart-plot/interfaces.d.ts +5 -0
  97. package/internal/components/chart-plot/interfaces.d.ts.map +1 -0
  98. package/internal/components/chart-plot/interfaces.js +2 -0
  99. package/internal/components/chart-plot/interfaces.js.map +1 -0
  100. package/internal/components/chart-series-marker/index.d.ts +1 -1
  101. package/internal/components/chart-series-marker/index.d.ts.map +1 -1
  102. package/internal/components/dropdown/context.d.ts +1 -1
  103. package/internal/components/dropdown/context.d.ts.map +1 -1
  104. package/internal/components/dropdown/dropdown-fit-handler.d.ts +5 -5
  105. package/internal/components/dropdown/dropdown-fit-handler.d.ts.map +1 -1
  106. package/internal/components/dropdown/interfaces.d.ts +1 -1
  107. package/internal/components/dropdown/interfaces.d.ts.map +1 -1
  108. package/internal/components/dropdown-status/index.d.ts +1 -1
  109. package/internal/components/dropdown-status/index.d.ts.map +1 -1
  110. package/internal/components/interfaces.d.ts +5 -0
  111. package/internal/components/interfaces.d.ts.map +1 -0
  112. package/internal/components/interfaces.js +2 -0
  113. package/internal/components/interfaces.js.map +1 -0
  114. package/internal/components/live-region/index.d.ts +1 -1
  115. package/internal/components/live-region/index.d.ts.map +1 -1
  116. package/internal/components/option/utils/filter-options.d.ts +3 -3
  117. package/internal/components/option/utils/filter-options.d.ts.map +1 -1
  118. package/internal/components/options-list/utils/use-highlight-option.d.ts +1 -1
  119. package/internal/components/options-list/utils/use-highlight-option.d.ts.map +1 -1
  120. package/internal/components/selectable-item/index.d.ts +1 -1
  121. package/internal/components/selectable-item/index.d.ts.map +1 -1
  122. package/internal/components/transition/index.d.ts +1 -1
  123. package/internal/components/transition/index.d.ts.map +1 -1
  124. package/internal/context/split-panel-context.d.ts +1 -1
  125. package/internal/context/split-panel-context.d.ts.map +1 -1
  126. package/internal/environment.js +1 -1
  127. package/internal/events/index.d.ts +3 -3
  128. package/internal/events/index.d.ts.map +1 -1
  129. package/internal/generated/theming/index.cjs +26 -0
  130. package/internal/generated/theming/index.js +26 -0
  131. package/internal/hooks/container-queries/use-resize-observer.d.ts +1 -1
  132. package/internal/hooks/container-queries/use-resize-observer.d.ts.map +1 -1
  133. package/internal/hooks/forward-focus/index.js.map +1 -1
  134. package/internal/hooks/use-singleton-handler/index.d.ts +3 -3
  135. package/internal/hooks/use-singleton-handler/index.d.ts.map +1 -1
  136. package/internal/manifest.json +1 -1
  137. package/internal/metrics.d.ts +2 -2
  138. package/internal/metrics.d.ts.map +1 -1
  139. package/internal/metrics.js.map +1 -1
  140. package/internal/types.d.ts +1 -1
  141. package/internal/types.d.ts.map +1 -1
  142. package/internal/utils/locale/normalize-start-of-week.d.ts +1 -1
  143. package/internal/utils/locale/normalize-start-of-week.d.ts.map +1 -1
  144. package/internal/utils/scrollable-containers.d.ts +1 -1
  145. package/internal/utils/scrollable-containers.d.ts.map +1 -1
  146. package/internal/vendor/d3-scale.js +185 -186
  147. package/line-chart/interfaces.d.ts +1 -1
  148. package/line-chart/interfaces.d.ts.map +1 -1
  149. package/mixed-line-bar-chart/chart-container.d.ts +1 -2
  150. package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
  151. package/mixed-line-bar-chart/chart-container.js +55 -41
  152. package/mixed-line-bar-chart/chart-container.js.map +1 -1
  153. package/mixed-line-bar-chart/domain.js +4 -4
  154. package/mixed-line-bar-chart/domain.js.map +1 -1
  155. package/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts +3 -4
  156. package/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts.map +1 -1
  157. package/mixed-line-bar-chart/hooks/use-mouse-hover.js +22 -18
  158. package/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
  159. package/mixed-line-bar-chart/hooks/use-navigation.d.ts +7 -4
  160. package/mixed-line-bar-chart/hooks/use-navigation.d.ts.map +1 -1
  161. package/mixed-line-bar-chart/hooks/use-navigation.js +61 -31
  162. package/mixed-line-bar-chart/hooks/use-navigation.js.map +1 -1
  163. package/mixed-line-bar-chart/interfaces.d.ts +8 -4
  164. package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
  165. package/mixed-line-bar-chart/interfaces.js.map +1 -1
  166. package/mixed-line-bar-chart/internal.d.ts +1 -1
  167. package/mixed-line-bar-chart/internal.d.ts.map +1 -1
  168. package/mixed-line-bar-chart/internal.js +1 -1
  169. package/mixed-line-bar-chart/internal.js.map +1 -1
  170. package/mixed-line-bar-chart/utils.d.ts +1 -1
  171. package/mixed-line-bar-chart/utils.d.ts.map +1 -1
  172. package/modal/internal.d.ts +1 -1
  173. package/modal/internal.d.ts.map +1 -1
  174. package/package.json +1 -1
  175. package/pagination/internal.d.ts +1 -1
  176. package/pagination/internal.d.ts.map +1 -1
  177. package/popover/interfaces.d.ts +2 -2
  178. package/popover/interfaces.d.ts.map +1 -1
  179. package/property-filter/interfaces.d.ts +16 -16
  180. package/property-filter/interfaces.d.ts.map +1 -1
  181. package/property-filter/use-load-items.d.ts +2 -1
  182. package/property-filter/use-load-items.d.ts.map +1 -1
  183. package/s3-resource-selector/interfaces.d.ts +1 -1
  184. package/s3-resource-selector/interfaces.d.ts.map +1 -1
  185. package/segmented-control/internal.d.ts +1 -1
  186. package/segmented-control/internal.d.ts.map +1 -1
  187. package/select/utils/use-select.d.ts +3 -3
  188. package/select/utils/use-select.d.ts.map +1 -1
  189. package/select/utils/use-select.js +4 -3
  190. package/select/utils/use-select.js.map +1 -1
  191. package/side-navigation/util.d.ts +1 -1
  192. package/side-navigation/util.d.ts.map +1 -1
  193. package/space-between/internal.d.ts +1 -1
  194. package/space-between/internal.d.ts.map +1 -1
  195. package/table/body-cell/index.d.ts +3 -1
  196. package/table/body-cell/index.d.ts.map +1 -1
  197. package/table/body-cell/index.js +2 -2
  198. package/table/body-cell/index.js.map +1 -1
  199. package/table/body-cell/styles.css.js +8 -7
  200. package/table/body-cell/styles.scoped.css +21 -18
  201. package/table/body-cell/styles.selectors.js +8 -7
  202. package/table/header-cell/utils.d.ts +1 -1
  203. package/table/header-cell/utils.d.ts.map +1 -1
  204. package/table/interfaces.d.ts +4 -0
  205. package/table/interfaces.d.ts.map +1 -1
  206. package/table/interfaces.js.map +1 -1
  207. package/table/internal.d.ts.map +1 -1
  208. package/table/internal.js +4 -3
  209. package/table/internal.js.map +1 -1
  210. package/table/use-sticky-header.d.ts.map +1 -1
  211. package/table/use-sticky-header.js +4 -1
  212. package/table/use-sticky-header.js.map +1 -1
  213. package/tag-editor/validation.d.ts +1 -1
  214. package/tag-editor/validation.d.ts.map +1 -1
  215. package/test-utils/dom/collection-preferences/index.d.ts +1 -0
  216. package/test-utils/dom/collection-preferences/index.js +3 -0
  217. package/test-utils/dom/collection-preferences/index.js.map +1 -1
  218. package/test-utils/selectors/alert/index.js.map +1 -1
  219. package/test-utils/selectors/annotation/index.js.map +1 -1
  220. package/test-utils/selectors/app-layout/index.js.map +1 -1
  221. package/test-utils/selectors/area-chart/index.js.map +1 -1
  222. package/test-utils/selectors/attribute-editor/index.js.map +1 -1
  223. package/test-utils/selectors/autosuggest/index.js.map +1 -1
  224. package/test-utils/selectors/breadcrumb-group/index.js.map +1 -1
  225. package/test-utils/selectors/button/index.js.map +1 -1
  226. package/test-utils/selectors/button-dropdown/index.js.map +1 -1
  227. package/test-utils/selectors/calendar/index.js.map +1 -1
  228. package/test-utils/selectors/cards/index.js.map +1 -1
  229. package/test-utils/selectors/checkbox/index.js.map +1 -1
  230. package/test-utils/selectors/code-editor/index.js.map +1 -1
  231. package/test-utils/selectors/collection-preferences/index.d.ts +1 -0
  232. package/test-utils/selectors/collection-preferences/index.js +3 -0
  233. package/test-utils/selectors/collection-preferences/index.js.map +1 -1
  234. package/test-utils/selectors/collection-preferences/page-size-preference.js.map +1 -1
  235. package/test-utils/selectors/collection-preferences/visible-content-preference.js.map +1 -1
  236. package/test-utils/selectors/container/index.js.map +1 -1
  237. package/test-utils/selectors/content-layout/index.js.map +1 -1
  238. package/test-utils/selectors/date-picker/index.js +2 -2
  239. package/test-utils/selectors/date-picker/index.js.map +1 -1
  240. package/test-utils/selectors/date-range-picker/index.js +6 -3
  241. package/test-utils/selectors/date-range-picker/index.js.map +1 -1
  242. package/test-utils/selectors/expandable-section/index.js.map +1 -1
  243. package/test-utils/selectors/flashbar/flash.js.map +1 -1
  244. package/test-utils/selectors/flashbar/index.js.map +1 -1
  245. package/test-utils/selectors/form/index.js.map +1 -1
  246. package/test-utils/selectors/form-field/index.js.map +1 -1
  247. package/test-utils/selectors/grid/index.js.map +1 -1
  248. package/test-utils/selectors/header/index.js.map +1 -1
  249. package/test-utils/selectors/help-panel/index.js.map +1 -1
  250. package/test-utils/selectors/hotspot/index.js.map +1 -1
  251. package/test-utils/selectors/input/base-input.js.map +1 -1
  252. package/test-utils/selectors/input/index.js.map +1 -1
  253. package/test-utils/selectors/internal/abstract-switch.js.map +1 -1
  254. package/test-utils/selectors/internal/autosuggest-input.js.map +1 -1
  255. package/test-utils/selectors/internal/chart-filter.js.map +1 -1
  256. package/test-utils/selectors/internal/chart-legend.js.map +1 -1
  257. package/test-utils/selectors/internal/chart-popover.js.map +1 -1
  258. package/test-utils/selectors/internal/charts.js.map +1 -1
  259. package/test-utils/selectors/internal/dropdown-host.js.map +1 -1
  260. package/test-utils/selectors/internal/dropdown.js.map +1 -1
  261. package/test-utils/selectors/internal/filtering-token.js.map +1 -1
  262. package/test-utils/selectors/internal/option.js.map +1 -1
  263. package/test-utils/selectors/mixed-line-bar-chart/index.js.map +1 -1
  264. package/test-utils/selectors/modal/index.js.map +1 -1
  265. package/test-utils/selectors/multiselect/index.js.map +1 -1
  266. package/test-utils/selectors/pagination/index.js.map +1 -1
  267. package/test-utils/selectors/pie-chart/index.js.map +1 -1
  268. package/test-utils/selectors/popover/index.js.map +1 -1
  269. package/test-utils/selectors/progress-bar/index.js.map +1 -1
  270. package/test-utils/selectors/property-filter/index.js.map +1 -1
  271. package/test-utils/selectors/radio-group/index.js.map +1 -1
  272. package/test-utils/selectors/radio-group/radio-button.js.map +1 -1
  273. package/test-utils/selectors/s3-resource-selector/index.js.map +1 -1
  274. package/test-utils/selectors/segmented-control/index.js.map +1 -1
  275. package/test-utils/selectors/select/index.js.map +1 -1
  276. package/test-utils/selectors/side-navigation/index.js.map +1 -1
  277. package/test-utils/selectors/split-panel/index.js.map +1 -1
  278. package/test-utils/selectors/table/index.js +2 -1
  279. package/test-utils/selectors/table/index.js.map +1 -1
  280. package/test-utils/selectors/tabs/index.js.map +1 -1
  281. package/test-utils/selectors/tag-editor/index.js.map +1 -1
  282. package/test-utils/selectors/text-filter/index.js.map +1 -1
  283. package/test-utils/selectors/textarea/index.js.map +1 -1
  284. package/test-utils/selectors/tiles/index.js.map +1 -1
  285. package/test-utils/selectors/tiles/tile.js.map +1 -1
  286. package/test-utils/selectors/toggle/index.js.map +1 -1
  287. package/test-utils/selectors/token-group/index.js.map +1 -1
  288. package/test-utils/selectors/token-group/token.js.map +1 -1
  289. package/test-utils/selectors/top-navigation/1.0-beta/index.js.map +1 -1
  290. package/test-utils/selectors/top-navigation/index.js.map +1 -1
  291. package/test-utils/selectors/tutorial-panel/index.js.map +1 -1
  292. package/test-utils/selectors/tutorial-panel/tutorial.js.map +1 -1
  293. package/test-utils/selectors/wizard/index.js.map +1 -1
  294. package/test-utils/tsconfig.tsbuildinfo +1 -1
  295. package/theming/index.d.ts +1 -1
  296. package/theming/index.d.ts.map +1 -1
  297. package/token-group/internal.d.ts +1 -1
  298. package/token-group/internal.d.ts.map +1 -1
  299. package/top-navigation/1.0-beta/internal.d.ts +1 -1
  300. package/top-navigation/1.0-beta/internal.d.ts.map +1 -1
  301. package/top-navigation/internal.d.ts +1 -1
  302. package/top-navigation/internal.d.ts.map +1 -1
  303. package/top-navigation/parts/overflow-menu/menu-item.d.ts +2 -2
  304. package/top-navigation/parts/overflow-menu/menu-item.d.ts.map +1 -1
  305. package/top-navigation/parts/overflow-menu/menu-item.js.map +1 -1
  306. package/top-navigation/parts/overflow-menu/router.d.ts +1 -1
  307. package/top-navigation/parts/overflow-menu/router.d.ts.map +1 -1
  308. package/wizard/styles.css.js +32 -32
  309. package/wizard/styles.scoped.css +61 -60
  310. package/wizard/styles.selectors.js +32 -32
@@ -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_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"
5
+ "appbar": "awsui_appbar_hyvsj_1sg6g_93",
6
+ "appbar-nav": "awsui_appbar-nav_hyvsj_1sg6g_117",
7
+ "breadcrumbs": "awsui_breadcrumbs_hyvsj_1sg6g_121",
8
+ "appbar-tools": "awsui_appbar-tools_hyvsj_1sg6g_125",
9
+ "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_1sg6g_166",
10
+ "has-notifications-content": "awsui_has-notifications-content_hyvsj_1sg6g_173",
11
+ "has-header": "awsui_has-header_hyvsj_1sg6g_179",
12
+ "has-dynamic-overlap-height": "awsui_has-dynamic-overlap-height_hyvsj_1sg6g_179",
13
+ "content-type-wizard": "awsui_content-type-wizard_hyvsj_1sg6g_180",
14
+ "content-type-cards": "awsui_content-type-cards_hyvsj_1sg6g_183",
15
+ "content-type-table": "awsui_content-type-table_hyvsj_1sg6g_184",
16
+ "has-sticky-background": "awsui_has-sticky-background_hyvsj_1sg6g_187",
17
+ "background": "awsui_background_hyvsj_1sg6g_221",
18
+ "notifications-appbar-header": "awsui_notifications-appbar-header_hyvsj_1sg6g_224",
19
+ "sticky-notifications": "awsui_sticky-notifications_hyvsj_1sg6g_236",
20
+ "overlap": "awsui_overlap_hyvsj_1sg6g_242",
21
+ "content": "awsui_content_hyvsj_1sg6g_180",
22
+ "layout": "awsui_layout_hyvsj_1sg6g_329",
23
+ "has-max-content-width": "awsui_has-max-content-width_hyvsj_1sg6g_411",
24
+ "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_1sg6g_438",
25
+ "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_1sg6g_441",
26
+ "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_1sg6g_445",
27
+ "has-split-panel": "awsui_has-split-panel_hyvsj_1sg6g_459",
28
+ "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_1sg6g_459",
29
+ "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_1sg6g_471",
30
+ "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_1sg6g_474",
31
+ "block-body-scroll": "awsui_block-body-scroll_hyvsj_1sg6g_489",
32
+ "container": "awsui_container_hyvsj_1sg6g_497",
33
+ "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_1sg6g_523",
34
+ "is-navigation-open": "awsui_is-navigation-open_hyvsj_1sg6g_528",
35
+ "is-tools-open": "awsui_is-tools-open_hyvsj_1sg6g_531",
36
+ "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_1sg6g_531",
37
+ "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_1sg6g_531",
38
+ "content-type-default": "awsui_content-type-default_hyvsj_1sg6g_551",
39
+ "content-type-form": "awsui_content-type-form_hyvsj_1sg6g_551",
40
+ "unfocusable": "awsui_unfocusable_hyvsj_1sg6g_592",
41
+ "navigation-container": "awsui_navigation-container_hyvsj_1sg6g_600",
42
+ "show-navigation": "awsui_show-navigation_hyvsj_1sg6g_635",
43
+ "animating": "awsui_animating_hyvsj_1sg6g_657",
44
+ "showButtons": "awsui_showButtons_hyvsj_1sg6g_1",
45
+ "navigation": "awsui_navigation_hyvsj_1sg6g_600",
46
+ "openNavigation": "awsui_openNavigation_hyvsj_1sg6g_1",
47
+ "animated-content": "awsui_animated-content_hyvsj_1sg6g_718",
48
+ "hide-navigation": "awsui_hide-navigation_hyvsj_1sg6g_727",
49
+ "notifications": "awsui_notifications_hyvsj_1sg6g_224",
50
+ "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_1sg6g_792",
51
+ "position-bottom": "awsui_position-bottom_hyvsj_1sg6g_838",
52
+ "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_1sg6g_1",
53
+ "split-panel-side": "awsui_split-panel-side_hyvsj_1sg6g_867",
54
+ "position-side": "awsui_position-side_hyvsj_1sg6g_895",
55
+ "openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_1sg6g_1",
56
+ "tools-container": "awsui_tools-container_hyvsj_1sg6g_932",
57
+ "tools": "awsui_tools_hyvsj_1sg6g_932",
58
+ "openTools": "awsui_openTools_hyvsj_1sg6g_1",
59
+ "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_1sg6g_1017",
60
+ "hide-tools": "awsui_hide-tools_hyvsj_1sg6g_1027",
61
+ "show-tools": "awsui_show-tools_hyvsj_1sg6g_1039",
62
+ "has-tools-form": "awsui_has-tools-form_hyvsj_1sg6g_1017",
63
+ "trigger": "awsui_trigger_hyvsj_1sg6g_1096",
64
+ "selected": "awsui_selected_hyvsj_1sg6g_1135"
65
65
  };
66
66
 
@@ -1 +1 @@
1
- {"version":3,"file":"chart-container.d.ts","sourceRoot":"","sources":["../../../src/area-chart/chart-container.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAgBrC,UAAU,mBAAmB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,CAC9D,SAAQ,IAAI,CACV,cAAc,CAAC,CAAC,CAAC,EACjB,QAAQ,GAAG,QAAQ,GAAG,mBAAmB,GAAG,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAC/G;IACD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACrB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;;AAED,wBAA6D;AAE7D,iBAAS,cAAc,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC1D,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EAAE,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GACzB,GACP,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAmGxB"}
1
+ {"version":3,"file":"chart-container.d.ts","sourceRoot":"","sources":["../../../src/area-chart/chart-container.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAgBrC,UAAU,mBAAmB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,CAC9D,SAAQ,IAAI,CACV,cAAc,CAAC,CAAC,CAAC,EACjB,QAAQ,GAAG,QAAQ,GAAG,mBAAmB,GAAG,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAC/G;IACD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACrB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;;AAED,wBAA6D;AAE7D,iBAAS,cAAc,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC1D,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EAAE,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GACzB,GACP,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAsGxB"}
@@ -38,12 +38,13 @@ function ChartContainer(_a) {
38
38
  });
39
39
  var highlightedPointRef = useRef(null);
40
40
  var mergedRef = useMergeRefs(containerWidthRef, model.refs.container);
41
+ var isPointHighlighted = model.interactions.get().highlightedPoint !== null;
41
42
  return (React.createElement("div", { className: styles['chart-container'], ref: mergedRef },
42
43
  React.createElement(AxisLabel, { axis: "y", position: "left", title: yTitle }),
43
44
  React.createElement("div", { className: styles['chart-container__horizontal'] },
44
45
  React.createElement(LabelsMeasure, { scale: model.computed.yScale, ticks: model.computed.yTicks, tickFormatter: yTickFormatter, autoWidth: setLeftLabelsWidth }),
45
46
  React.createElement("div", { className: styles['chart-container__vertical'] },
46
- React.createElement(ChartPlot, { ref: model.refs.plot, width: model.width, height: model.height, offsetBottom: bottomLabelsHeight, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescription: ariaDescription, ariaRoleDescription: chartAriaRoleDescription, activeElementKey: !(highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.isPopoverPinned) && (highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.activeLabel), activeElementRef: highlightedPointRef, isClickable: !(highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.isPopoverPinned), onMouseMove: model.handlers.onSVGMouseMove, onMouseOut: model.handlers.onSVGMouseOut, onMouseDown: model.handlers.onSVGMouseDown, onKeyDown: model.handlers.onSVGKeyDown, onFocus: model.handlers.onSVGFocus, onBlur: model.handlers.onSVGBlur },
47
+ React.createElement(ChartPlot, { ref: model.refs.plot, width: model.width, height: model.height, offsetBottom: bottomLabelsHeight, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescription: ariaDescription, ariaRoleDescription: chartAriaRoleDescription, activeElementKey: !(highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.isPopoverPinned) && (highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.activeLabel), activeElementRef: isPointHighlighted ? highlightedPointRef : model.refs.verticalMarker, activeElementFocusOffset: isPointHighlighted ? 3 : { x: 8, y: 0 }, isClickable: !(highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.isPopoverPinned), onMouseMove: model.handlers.onSVGMouseMove, onMouseOut: model.handlers.onSVGMouseOut, onMouseDown: model.handlers.onSVGMouseDown, onKeyDown: model.handlers.onSVGKeyDown, onFocus: model.handlers.onSVGFocus, onBlur: model.handlers.onSVGBlur },
47
48
  React.createElement(LeftLabels, { width: model.width, height: model.height, scale: model.computed.yScale, ticks: model.computed.yTicks, tickFormatter: yTickFormatter, title: yTitle, ariaRoleDescription: yAxisAriaRoleDescription }),
48
49
  React.createElement(AreaDataSeries, { model: model }),
49
50
  React.createElement(BottomLabels, { width: model.width, height: model.height, scale: model.computed.xScale, ticks: model.computed.xTicks, tickFormatter: xTickFormatter, title: xTitle, ariaRoleDescription: xAxisAriaRoleDescription, autoHeight: setBottomLabelsHeight, offsetLeft: leftLabelsWidth + BOTTOM_LABELS_OFFSET, offsetRight: BOTTOM_LABELS_OFFSET }),
@@ -1 +1 @@
1
- {"version":3,"file":"chart-container.js","sourceRoot":"","sources":["../../../src/area-chart/chart-container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,SAAS,MAAM,mDAAmD,CAAC;AAC1E,OAAO,aAAa,MAAM,uDAAuD,CAAC;AAClF,OAAO,UAAU,MAAM,oDAAoD,CAAC;AAC5E,OAAO,YAAY,MAAM,sDAAsD,CAAC;AAChF,OAAO,kBAAkB,MAAM,4DAA4D,CAAC;AAG5F,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,mBAAmB,MAAM,kCAAkC,CAAC;AACnE,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AAEtE,IAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,IAAM,oBAAoB,GAAG,EAAE,CAAC;AAahC,eAAe,IAAI,CAAC,cAAc,CAA0B,CAAC;AAE7D,SAAS,cAAc,CAAqC,EAmBnC;QAlBvB,KAAK,WAAA,EACL,SAAS,eAAA,EACT,MAAM,YAAA,EACN,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,mBASM,EATN,qBASI,EAAE,KAAA,EARJ,cAAc,oB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.0\nimport React, { useState, useEffect, memo, useRef } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport ChartPlot from '../internal/components/chart-plot';\nimport AxisLabel from '../internal/components/cartesian-chart/axis-label';\nimport LabelsMeasure from '../internal/components/cartesian-chart/labels-measure';\nimport LeftLabels from '../internal/components/cartesian-chart/left-labels';\nimport BottomLabels from '../internal/components/cartesian-chart/bottom-labels';\nimport EmphasizedBaseline from '../internal/components/cartesian-chart/emphasized-baseline';\nimport { AreaChartProps } from './interfaces';\nimport { ChartModel } from './model';\nimport AreaDataSeries from './elements/data-series';\nimport AreaChartPopover from './elements/chart-popover';\nimport AreaHighlightedPoint from './elements/highlighted-point';\nimport AreaVerticalMarker from './elements/vertical-marker';\n\nimport styles from './styles.css.js';\nimport useHighlightDetails from './elements/use-highlight-details';\nimport useContainerWidth from '../internal/utils/use-container-width';\n\nconst DEFAULT_CHART_WIDTH = 500;\nconst LEFT_LABELS_MARGIN = 16;\nconst BOTTOM_LABELS_OFFSET = 12;\n\ntype TickFormatter = undefined | ((value: AreaChartProps.DataTypes) => string);\n\ninterface ChartContainerProps<T extends AreaChartProps.DataTypes>\n extends Pick<\n AreaChartProps<T>,\n 'xTitle' | 'yTitle' | 'detailPopoverSize' | 'ariaLabel' | 'ariaLabelledby' | 'ariaDescription' | 'i18nStrings'\n > {\n model: ChartModel<T>;\n autoWidth: (value: number) => void;\n}\n\nexport default memo(ChartContainer) as typeof ChartContainer;\n\nfunction ChartContainer<T extends AreaChartProps.DataTypes>({\n model,\n autoWidth,\n xTitle,\n yTitle,\n detailPopoverSize,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n i18nStrings: {\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n chartAriaRoleDescription,\n xAxisAriaRoleDescription,\n yAxisAriaRoleDescription,\n detailPopoverDismissAriaLabel,\n } = {},\n}: ChartContainerProps<T>) {\n const [leftLabelsWidth, setLeftLabelsWidth] = useState(0);\n const [bottomLabelsHeight, setBottomLabelsHeight] = useState(0);\n const [containerWidth, containerWidthRef] = useContainerWidth(DEFAULT_CHART_WIDTH);\n\n // Calculate the width of the plot area and tell it to the parent.\n const plotWidth = Math.max(0, containerWidth - leftLabelsWidth - LEFT_LABELS_MARGIN);\n useEffect(() => {\n autoWidth(plotWidth);\n }, [autoWidth, plotWidth]);\n\n const highlightDetails = useHighlightDetails({\n model,\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n });\n\n const highlightedPointRef = useRef<SVGGElement>(null);\n\n const mergedRef = useMergeRefs(containerWidthRef, model.refs.container);\n\n return (\n <div className={styles['chart-container']} ref={mergedRef}>\n <AxisLabel axis=\"y\" position=\"left\" title={yTitle} />\n\n <div className={styles['chart-container__horizontal']}>\n <LabelsMeasure\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter as TickFormatter}\n autoWidth={setLeftLabelsWidth}\n />\n\n <div className={styles['chart-container__vertical']}>\n <ChartPlot\n ref={model.refs.plot}\n width={model.width}\n height={model.height}\n offsetBottom={bottomLabelsHeight}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaRoleDescription={chartAriaRoleDescription}\n activeElementKey={!highlightDetails?.isPopoverPinned && highlightDetails?.activeLabel}\n activeElementRef={highlightedPointRef}\n isClickable={!highlightDetails?.isPopoverPinned}\n onMouseMove={model.handlers.onSVGMouseMove}\n onMouseOut={model.handlers.onSVGMouseOut}\n onMouseDown={model.handlers.onSVGMouseDown}\n onKeyDown={model.handlers.onSVGKeyDown}\n onFocus={model.handlers.onSVGFocus}\n onBlur={model.handlers.onSVGBlur}\n >\n <LeftLabels\n width={model.width}\n height={model.height}\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter}\n title={yTitle}\n ariaRoleDescription={yAxisAriaRoleDescription}\n />\n\n <AreaDataSeries model={model} />\n\n <BottomLabels\n width={model.width}\n height={model.height}\n scale={model.computed.xScale}\n ticks={model.computed.xTicks}\n tickFormatter={xTickFormatter as TickFormatter}\n title={xTitle}\n ariaRoleDescription={xAxisAriaRoleDescription}\n autoHeight={setBottomLabelsHeight}\n offsetLeft={leftLabelsWidth + BOTTOM_LABELS_OFFSET}\n offsetRight={BOTTOM_LABELS_OFFSET}\n />\n\n <EmphasizedBaseline width={model.width} height={model.height} scale={model.computed.yScale} />\n\n <AreaVerticalMarker model={model} />\n\n <AreaHighlightedPoint ref={highlightedPointRef} model={model} ariaLabel={highlightDetails?.activeLabel} />\n </ChartPlot>\n\n <AxisLabel axis=\"x\" position=\"bottom\" title={xTitle} />\n </div>\n\n <AreaChartPopover\n model={model}\n highlightDetails={highlightDetails}\n dismissAriaLabel={detailPopoverDismissAriaLabel}\n size={detailPopoverSize}\n />\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"chart-container.js","sourceRoot":"","sources":["../../../src/area-chart/chart-container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,SAAS,MAAM,mDAAmD,CAAC;AAC1E,OAAO,aAAa,MAAM,uDAAuD,CAAC;AAClF,OAAO,UAAU,MAAM,oDAAoD,CAAC;AAC5E,OAAO,YAAY,MAAM,sDAAsD,CAAC;AAChF,OAAO,kBAAkB,MAAM,4DAA4D,CAAC;AAG5F,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,MAAM,MAAM,i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ACjC,UAAU,EAAE,eAAe,GAAG,oBAAoB,EAClD,WAAW,EAAE,oBAAoB,GACjC;oBAEF,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAI;oBAE9F,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,GAAI;oBAEpC,oBAAC,oBAAoB,IAAC,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,WAAW,GAAI,CAChG;gBAEZ,oBAAC,SAAS,IAAC,IAAI,EAAC,GAAG,EAAC,QAAQ,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,GAAI,CACnD;YAEN,oBAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,6BAA6B,EAC/C,IAAI,EAAE,iBAAiB,GACvB,CACE,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, memo, useRef } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport ChartPlot from '../internal/components/chart-plot';\nimport AxisLabel from '../internal/components/cartesian-chart/axis-label';\nimport LabelsMeasure from '../internal/components/cartesian-chart/labels-measure';\nimport LeftLabels from '../internal/components/cartesian-chart/left-labels';\nimport BottomLabels from '../internal/components/cartesian-chart/bottom-labels';\nimport EmphasizedBaseline from '../internal/components/cartesian-chart/emphasized-baseline';\nimport { AreaChartProps } from './interfaces';\nimport { ChartModel } from './model';\nimport AreaDataSeries from './elements/data-series';\nimport AreaChartPopover from './elements/chart-popover';\nimport AreaHighlightedPoint from './elements/highlighted-point';\nimport AreaVerticalMarker from './elements/vertical-marker';\n\nimport styles from './styles.css.js';\nimport useHighlightDetails from './elements/use-highlight-details';\nimport useContainerWidth from '../internal/utils/use-container-width';\n\nconst DEFAULT_CHART_WIDTH = 500;\nconst LEFT_LABELS_MARGIN = 16;\nconst BOTTOM_LABELS_OFFSET = 12;\n\ntype TickFormatter = undefined | ((value: AreaChartProps.DataTypes) => string);\n\ninterface ChartContainerProps<T extends AreaChartProps.DataTypes>\n extends Pick<\n AreaChartProps<T>,\n 'xTitle' | 'yTitle' | 'detailPopoverSize' | 'ariaLabel' | 'ariaLabelledby' | 'ariaDescription' | 'i18nStrings'\n > {\n model: ChartModel<T>;\n autoWidth: (value: number) => void;\n}\n\nexport default memo(ChartContainer) as typeof ChartContainer;\n\nfunction ChartContainer<T extends AreaChartProps.DataTypes>({\n model,\n autoWidth,\n xTitle,\n yTitle,\n detailPopoverSize,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n i18nStrings: {\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n chartAriaRoleDescription,\n xAxisAriaRoleDescription,\n yAxisAriaRoleDescription,\n detailPopoverDismissAriaLabel,\n } = {},\n}: ChartContainerProps<T>) {\n const [leftLabelsWidth, setLeftLabelsWidth] = useState(0);\n const [bottomLabelsHeight, setBottomLabelsHeight] = useState(0);\n const [containerWidth, containerWidthRef] = useContainerWidth(DEFAULT_CHART_WIDTH);\n\n // Calculate the width of the plot area and tell it to the parent.\n const plotWidth = Math.max(0, containerWidth - leftLabelsWidth - LEFT_LABELS_MARGIN);\n useEffect(() => {\n autoWidth(plotWidth);\n }, [autoWidth, plotWidth]);\n\n const highlightDetails = useHighlightDetails({\n model,\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n });\n\n const highlightedPointRef = useRef<SVGGElement>(null);\n\n const mergedRef = useMergeRefs(containerWidthRef, model.refs.container);\n\n const isPointHighlighted = model.interactions.get().highlightedPoint !== null;\n\n return (\n <div className={styles['chart-container']} ref={mergedRef}>\n <AxisLabel axis=\"y\" position=\"left\" title={yTitle} />\n\n <div className={styles['chart-container__horizontal']}>\n <LabelsMeasure\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter as TickFormatter}\n autoWidth={setLeftLabelsWidth}\n />\n\n <div className={styles['chart-container__vertical']}>\n <ChartPlot\n ref={model.refs.plot}\n width={model.width}\n height={model.height}\n offsetBottom={bottomLabelsHeight}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaRoleDescription={chartAriaRoleDescription}\n activeElementKey={!highlightDetails?.isPopoverPinned && highlightDetails?.activeLabel}\n activeElementRef={isPointHighlighted ? highlightedPointRef : model.refs.verticalMarker}\n activeElementFocusOffset={isPointHighlighted ? 3 : { x: 8, y: 0 }}\n isClickable={!highlightDetails?.isPopoverPinned}\n onMouseMove={model.handlers.onSVGMouseMove}\n onMouseOut={model.handlers.onSVGMouseOut}\n onMouseDown={model.handlers.onSVGMouseDown}\n onKeyDown={model.handlers.onSVGKeyDown}\n onFocus={model.handlers.onSVGFocus}\n onBlur={model.handlers.onSVGBlur}\n >\n <LeftLabels\n width={model.width}\n height={model.height}\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter}\n title={yTitle}\n ariaRoleDescription={yAxisAriaRoleDescription}\n />\n\n <AreaDataSeries model={model} />\n\n <BottomLabels\n width={model.width}\n height={model.height}\n scale={model.computed.xScale}\n ticks={model.computed.xTicks}\n tickFormatter={xTickFormatter as TickFormatter}\n title={xTitle}\n ariaRoleDescription={xAxisAriaRoleDescription}\n autoHeight={setBottomLabelsHeight}\n offsetLeft={leftLabelsWidth + BOTTOM_LABELS_OFFSET}\n offsetRight={BOTTOM_LABELS_OFFSET}\n />\n\n <EmphasizedBaseline width={model.width} height={model.height} scale={model.computed.yScale} />\n\n <AreaVerticalMarker model={model} />\n\n <AreaHighlightedPoint ref={highlightedPointRef} model={model} ariaLabel={highlightDetails?.activeLabel} />\n </ChartPlot>\n\n <AxisLabel axis=\"x\" position=\"bottom\" title={xTitle} />\n </div>\n\n <AreaChartPopover\n model={model}\n highlightDetails={highlightDetails}\n dismissAriaLabel={detailPopoverDismissAriaLabel}\n size={detailPopoverSize}\n />\n </div>\n </div>\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { AreaChartProps } from './interfaces';
2
2
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
3
  import { SomeRequired } from '../internal/types';
4
- declare type InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<AreaChartProps<T>, 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'> & InternalBaseComponentProps;
4
+ type InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<AreaChartProps<T>, 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'> & InternalBaseComponentProps;
5
5
  export default function InternalAreaChart<T extends AreaChartProps.DataTypes>({ height, xScaleType, yScaleType, xDomain, yDomain, highlightedSeries: controlledHighlightedSeries, visibleSeries: controlledVisibleSeries, series: externalSeries, onFilterChange: controlledOnVisibleChange, onHighlightChange: controlledOnHighlightChange, i18nStrings, ariaLabel, ariaLabelledby, ariaDescription, xTitle, yTitle, hideFilter, additionalFilters, hideLegend, legendTitle, statusType, detailPopoverSize, empty, noMatch, errorText, loadingText, recoveryText, onRecoveryClick, __internalRootRef, ...props }: InternalAreaChartProps<T>): JSX.Element;
6
6
  export {};
7
7
  //# sourceMappingURL=internal.d.ts.map
@@ -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,M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C,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC5E,MAAM,EACN,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EAAE,2BAA2B,EAC9C,aAAa,EAAE,uBAAuB,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"}
@@ -1,5 +1,5 @@
1
- declare type Selector<S, R> = (state: S) => R;
2
- declare type Listener<S> = (state: S, prevState: S) => any;
1
+ type Selector<S, R> = (state: S) => R;
2
+ type Listener<S> = (state: S, prevState: S) => any;
3
3
  export interface ReadonlyAsyncStore<S> {
4
4
  get(): S;
5
5
  subscribe<R>(selector: Selector<S, R>, listener: Listener<S>): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"async-store.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/async-store.ts"],"names":[],"mappings":"AAMA,aAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;AACtC,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,GAAG,CAAC;AAEnD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,GAAG,IAAI,CAAC,CAAC;IACT,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE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AAC,SAAS,CAAC,CAAC,CAAC;CAKlF"}
1
+ {"version":3,"file":"interactions-store.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/interactions-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,UAAU,MAAM,eAAe,CAAC;AAUvC,MAAM,CAAC,OAAO,OAAO,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,CAAE,SAAQ,UAAU,CAC3F,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAChC;IACC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;gBAE9B,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAOlG,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IAU7C,UAAU,CAAC,MAAM,EAAE,SAAS,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;IAUrD,mBAAmB;IAenB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAQlD,cAAc;IAQd,sBAAsB;IAOtB,UAAU;IAIV,UAAU;IAIV,YAAY;IAIZ,gBAAgB;IAIhB,oBAAoB,CAAC,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;CAKlF"}
@@ -20,7 +20,7 @@ var InteractionsStore = /** @class */ (function (_super) {
20
20
  this.set(function (state) { return (__assign(__assign({}, state), { highlightedX: _this.plot.xy[point.index.x], highlightedPoint: point, highlightedSeries: _this.series[point.index.s], legendSeries: _this.series[point.index.s] })); });
21
21
  };
22
22
  InteractionsStore.prototype.highlightX = function (points) {
23
- this.set(function (state) { return (__assign(__assign({}, state), { highlightedX: points, highlightedPoint: null, highlightedSeries: null })); });
23
+ this.set(function (state) { return (__assign(__assign({}, state), { highlightedX: points, highlightedPoint: null, highlightedSeries: null, legendSeries: null })); });
24
24
  };
25
25
  InteractionsStore.prototype.highlightFirstPoint = function () {
26
26
  var _this = this;
@@ -1 +1 @@
1
- {"version":3,"file":"interactions-store.js","sourceRoot":"","sources":["../../../../src/area-chart/model/interactions-store.ts"],"names":[],"mappings":";AAKA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;CACvB,CAAC,CAAC;AAEH;IAAmF,qCAElF;IAIC,2BAAY,MAA2C,EAAE,IAAyC;QAAlG,YACE,kBAAM,YAAY,CAAC,SAIpB;QAFC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IAED,0CAAc,GAAd,UAAe,KAA8B;QAA7C,iBAQC;QAPC,IAAI,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,uBACb,KAAK,KACR,YAAY,EAAE,KAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EACzC,gBAAgB,EAAE,KAAK,EACvB,iBAAiB,EAAE,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAC7C,YAAY,EAAE,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CA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its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartModel } from './index';\nimport { AreaChartProps } from '../interfaces';\n\nimport AsyncStore from './async-store';\n\nconst initialState = Object.freeze({\n highlightedX: null,\n highlightedPoint: null,\n highlightedSeries: null,\n legendSeries: null,\n isPopoverPinned: false,\n});\n\nexport default class InteractionsStore<T extends AreaChartProps.DataTypes> extends AsyncStore<\n ChartModel.InteractionsState<T>\n> {\n series: readonly AreaChartProps.Series<T>[];\n plot: ChartModel.ComputedProps<T>['plot'];\n\n constructor(series: readonly AreaChartProps.Series<T>[], plot: ChartModel.ComputedProps<T>['plot']) {\n super(initialState);\n\n this.series = series;\n this.plot = plot;\n }\n\n highlightPoint(point: ChartModel.PlotPoint<T>) {\n this.set(state => ({\n ...state,\n highlightedX: this.plot.xy[point.index.x],\n highlightedPoint: point,\n highlightedSeries: this.series[point.index.s],\n legendSeries: this.series[point.index.s],\n }));\n }\n\n highlightX(points: readonly ChartModel.PlotPoint<T>[]) {\n this.set(state => ({\n ...state,\n highlightedX: points,\n highlightedPoint: null,\n highlightedSeries: null,\n }));\n }\n\n highlightFirstPoint() {\n this.set(state => {\n const series = state.legendSeries || state.highlightedSeries;\n const firstSeriesPoint = series && this._getFirstSeriesPoint(series);\n const point = state.highlightedPoint || firstSeriesPoint || this.plot.sx[0][0];\n return {\n ...state,\n highlightedX: this.plot.xy[point.index.x],\n highlightedPoint: point,\n highlightedSeries: this.series[point.index.s],\n legendSeries: this.series[point.index.s],\n };\n });\n }\n\n highlightSeries(s: null | AreaChartProps.Series<T>) {\n this.set(state => ({\n ...state,\n highlightedSeries: s,\n legendSeries: s,\n }));\n }\n\n clearHighlight() {\n this.set(state => ({\n ...state,\n highlightedX: null,\n highlightedPoint: null,\n highlightedSeries: null,\n }));\n }\n clearHighlightedLegend() {\n this.set(state => ({\n ...state,\n legendSeries: null,\n }));\n }\n\n clearState() {\n this.set(() => initialState);\n }\n\n pinPopover() {\n this.set(state => ({ ...state, isPopoverPinned: true }));\n }\n\n unpinPopover() {\n this.set(state => ({ ...state, isPopoverPinned: false }));\n }\n\n togglePopoverPin() {\n this.set(state => ({ ...state, isPopoverPinned: !state.isPopoverPinned }));\n }\n\n _getFirstSeriesPoint(s: AreaChartProps.Series<T>): null | ChartModel.PlotPoint<T> {\n const seriesIndex = this.series.indexOf(s);\n const [firstSeriesPoint] = this.plot.sx[seriesIndex] || [];\n return firstSeriesPoint || null;\n }\n}\n"]}
1
+ {"version":3,"file":"interactions-store.js","sourceRoot":"","sources":["../../../../src/area-chart/model/interactions-store.ts"],"names":[],"mappings":";AAKA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;CACvB,CAAC,CAAC;AAEH;IAAmF,qCAElF;IAIC,2BAAY,MAA2C,EAAE,IAAyC;QAAlG,YACE,kBAAM,YAAY,CAAC,SAIpB;QAFC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IAED,0CAAc,GAAd,UAAe,KAA8B;QAA7C,iBAQC;QAPC,IAAI,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,uBACb,KAAK,KACR,YAAY,EAAE,KAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EACzC,gBAAgB,EAAE,KAAK,EACvB,iBAAiB,EAAE,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAC7C,YAAY,EAAE,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IACxC,EANgB,CAMhB,CAAC,CAAC;IACN,CAAC;IAED,sCAA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apache-2.0\nimport { ChartModel } from './index';\nimport { AreaChartProps } from '../interfaces';\n\nimport AsyncStore from './async-store';\n\nconst initialState = Object.freeze({\n highlightedX: null,\n highlightedPoint: null,\n highlightedSeries: null,\n legendSeries: null,\n isPopoverPinned: false,\n});\n\nexport default class InteractionsStore<T extends AreaChartProps.DataTypes> extends AsyncStore<\n ChartModel.InteractionsState<T>\n> {\n series: readonly AreaChartProps.Series<T>[];\n plot: ChartModel.ComputedProps<T>['plot'];\n\n constructor(series: readonly AreaChartProps.Series<T>[], plot: ChartModel.ComputedProps<T>['plot']) {\n super(initialState);\n\n this.series = series;\n this.plot = plot;\n }\n\n highlightPoint(point: ChartModel.PlotPoint<T>) {\n this.set(state => ({\n ...state,\n highlightedX: this.plot.xy[point.index.x],\n highlightedPoint: point,\n highlightedSeries: this.series[point.index.s],\n legendSeries: this.series[point.index.s],\n }));\n }\n\n highlightX(points: readonly ChartModel.PlotPoint<T>[]) {\n this.set(state => ({\n ...state,\n highlightedX: points,\n highlightedPoint: null,\n highlightedSeries: null,\n legendSeries: null,\n }));\n }\n\n highlightFirstPoint() {\n this.set(state => {\n const series = state.legendSeries || state.highlightedSeries;\n const firstSeriesPoint = series && this._getFirstSeriesPoint(series);\n const point = state.highlightedPoint || firstSeriesPoint || this.plot.sx[0][0];\n return {\n ...state,\n highlightedX: this.plot.xy[point.index.x],\n highlightedPoint: point,\n highlightedSeries: this.series[point.index.s],\n legendSeries: this.series[point.index.s],\n };\n });\n }\n\n highlightSeries(s: null | AreaChartProps.Series<T>) {\n this.set(state => ({\n ...state,\n highlightedSeries: s,\n legendSeries: s,\n }));\n }\n\n clearHighlight() {\n this.set(state => ({\n ...state,\n highlightedX: null,\n highlightedPoint: null,\n highlightedSeries: null,\n }));\n }\n clearHighlightedLegend() {\n this.set(state => ({\n ...state,\n legendSeries: null,\n }));\n }\n\n clearState() {\n this.set(() => initialState);\n }\n\n pinPopover() {\n this.set(state => ({ ...state, isPopoverPinned: true }));\n }\n\n unpinPopover() {\n this.set(state => ({ ...state, isPopoverPinned: false }));\n }\n\n togglePopoverPin() {\n this.set(state => ({ ...state, isPopoverPinned: !state.isPopoverPinned }));\n }\n\n _getFirstSeriesPoint(s: AreaChartProps.Series<T>): null | ChartModel.PlotPoint<T> {\n const seriesIndex = this.series.indexOf(s);\n const [firstSeriesPoint] = this.plot.sx[seriesIndex] || [];\n return firstSeriesPoint || null;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { AreaChartProps } from '../interfaces';
2
2
  import { XDomain, XScaleType, YDomain, YScaleType } from '../../internal/components/cartesian-chart/interfaces';
3
3
  import { ChartModel } from './index';
4
- interface UseChartModelProps<T extends AreaChartProps.DataTypes> {
4
+ export interface UseChartModelProps<T extends AreaChartProps.DataTypes> {
5
5
  externalSeries: readonly AreaChartProps.Series<T>[];
6
6
  visibleSeries: readonly AreaChartProps.Series<T>[];
7
7
  setVisibleSeries: (series: readonly AreaChartProps.Series<T>[]) => void;
@@ -15,5 +15,4 @@ interface UseChartModelProps<T extends AreaChartProps.DataTypes> {
15
15
  width: number;
16
16
  }
17
17
  export default function useChartModel<T extends AreaChartProps.DataTypes>({ externalSeries: allSeries, visibleSeries: series, setVisibleSeries, highlightedSeries, setHighlightedSeries, xDomain, yDomain, xScaleType, yScaleType, height, width, }: UseChartModelProps<T>): ChartModel<T>;
18
- export {};
19
18
  //# sourceMappingURL=use-chart-model.d.ts.map
@@ -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,c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AAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS;IACpE,cAAc,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;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,CAyRvC"}
@@ -31,6 +31,7 @@ export default function useChartModel(_a) {
31
31
  });
32
32
  // A store for chart interactions that don't require plot recomputation.
33
33
  var interactions = new InteractionsStore(series, computed.plot);
34
+ var containsMultipleSeries = interactions.series.length > 1;
34
35
  // A series decorator to provide extra props such as color and marker type.
35
36
  var getInternalSeries = createSeriesDecorator(allSeries);
36
37
  // A Callback for svg mouseover to hover the plot points.
@@ -79,6 +80,19 @@ export default function useChartModel(_a) {
79
80
  interactions.togglePopoverPin();
80
81
  event.preventDefault();
81
82
  };
83
+ var moveWithinXAxis = function (direction) {
84
+ if (interactions.get().highlightedPoint) {
85
+ return moveWithinSeries(direction);
86
+ }
87
+ else if (containsMultipleSeries) {
88
+ var highlightedX = interactions.get().highlightedX;
89
+ if (highlightedX) {
90
+ var currentXIndex = highlightedX[0].index.x;
91
+ var nextXIndex = circleIndex(currentXIndex + direction, [0, interactions.plot.xy.length - 1]);
92
+ interactions.highlightX(interactions.plot.xy[nextXIndex]);
93
+ }
94
+ }
95
+ };
82
96
  // A helper function to highlight the next or previous point within selected series.
83
97
  var moveWithinSeries = function (direction) {
84
98
  // Can only use motion when a particular point is highlighted.
@@ -93,19 +107,33 @@ export default function useChartModel(_a) {
93
107
  // Highlight the next point using x:s grouped data.
94
108
  interactions.highlightPoint(interactions.plot.xs[xIndex][sIndex]);
95
109
  };
96
- // A helper function to highlight the next or previous point withing selected column.
110
+ // A helper function to highlight the next or previous point within the selected column.
97
111
  var moveBetweenSeries = function (direction) {
98
- // Can only use motion when a particular point is highlighted.
99
112
  var point = interactions.get().highlightedPoint;
100
113
  if (!point) {
114
+ var highlightedX = interactions.get().highlightedX;
115
+ if (highlightedX) {
116
+ var xIndex_1 = highlightedX[0].index.x;
117
+ var points = interactions.plot.xy[xIndex_1];
118
+ var yIndex = direction === 1 ? 0 : points.length - 1;
119
+ interactions.highlightPoint(points[yIndex]);
120
+ }
101
121
  return;
102
122
  }
103
123
  // Take the index of the currently highlighted column.
104
124
  var xIndex = point.index.x;
105
- // Take the incremented(circularly) y-index of the currently highlighted point.
106
- var yIndex = circleIndex(point.index.y + direction, [0, interactions.plot.xy[xIndex].length - 1]);
107
- // Highlight the next point using x:y grouped data.
108
- interactions.highlightPoint(interactions.plot.xy[xIndex][yIndex]);
125
+ var currentYIndex = point.index.y;
126
+ if (containsMultipleSeries &&
127
+ ((currentYIndex === 0 && direction === -1) ||
128
+ (currentYIndex === interactions.plot.xy[xIndex].length - 1 && direction === 1))) {
129
+ interactions.highlightX(interactions.plot.xy[xIndex]);
130
+ }
131
+ else {
132
+ // Take the incremented(circularly) y-index of the currently highlighted point.
133
+ var nextYIndex = circleIndex(currentYIndex + direction, [0, interactions.plot.xy[xIndex].length - 1]);
134
+ // Highlight the next point using x:y grouped data.
135
+ interactions.highlightPoint(interactions.plot.xy[xIndex][nextYIndex]);
136
+ }
109
137
  };
110
138
  // A callback for svg keydown to enable motions and popover pin with the keyboard.
111
139
  var onSVGKeyDown = function (event) {
@@ -130,19 +158,27 @@ export default function useChartModel(_a) {
130
158
  }
131
159
  // Move left/right.
132
160
  else if (keyCode === KeyCode.left || keyCode === KeyCode.right) {
133
- moveWithinSeries(keyCode === KeyCode.right ? 1 : -1);
161
+ moveWithinXAxis(keyCode === KeyCode.right ? 1 : -1);
134
162
  }
135
163
  // Pin popover.
136
164
  else if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {
137
165
  interactions.pinPopover();
138
166
  }
139
167
  };
168
+ var highlightFirstX = function () {
169
+ interactions.highlightX(interactions.plot.xy[0]);
170
+ };
140
171
  // A callback for svg focus to highlight series.
141
172
  var onSVGFocus = function (_event, trigger) {
142
173
  // When focus is caused by a click event nothing is expected as clicks are handled separately.
143
- // Otherwise, select the first series point.
144
174
  if (trigger === 'keyboard') {
145
- interactions.highlightFirstPoint();
175
+ var _a = interactions.get(), highlightedX = _a.highlightedX, highlightedPoint = _a.highlightedPoint, highlightedSeries_1 = _a.highlightedSeries, legendSeries = _a.legendSeries;
176
+ if (containsMultipleSeries && !highlightedX && !highlightedPoint && !highlightedSeries_1 && !legendSeries) {
177
+ highlightFirstX();
178
+ }
179
+ else if (!highlightedX) {
180
+ interactions.highlightFirstPoint();
181
+ }
146
182
  }
147
183
  };
148
184
  // A callback for svg blur to clear all highlights unless the popover is pinned.
@@ -165,7 +201,7 @@ export default function useChartModel(_a) {
165
201
  if (!outsideClick) {
166
202
  // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.
167
203
  setTimeout(function () {
168
- if (interactions.get().highlightedPoint) {
204
+ if (interactions.get().highlightedPoint || interactions.get().highlightedX) {
169
205
  plotRef.current.focusApplication();
170
206
  }
171
207
  else {
@@ -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,YAA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B,QAAQ,UAAA;YACR,YAAY,cAAA;YACZ,QAAQ,EAAE;gBACR,cAAc,gBAAA;gBACd,aAAa,eAAA;gBACb,cAAc,gBAAA;gBACd,YAAY,cAAA;gBACZ,UAAU,YAAA;gBACV,SAAS,WAAA;gBACT,cAAc,gBAAA;gBACd,iBAAiB,mBAAA;gBACjB,gBAAgB,kBAAA;gBAChB,eAAe,iBAAA;gBACf,iBAAiB,mBAAA;aAClB;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 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
+ {"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,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEvD,IAAM,sBAAsB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IA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E,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\nexport interface 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 const containsMultipleSeries = interactions.series.length > 1;\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 const moveWithinXAxis = (direction: -1 | 1) => {\n if (interactions.get().highlightedPoint) {\n return moveWithinSeries(direction);\n } else if (containsMultipleSeries) {\n const { highlightedX } = interactions.get();\n if (highlightedX) {\n const currentXIndex = highlightedX[0].index.x;\n const nextXIndex = circleIndex(currentXIndex + direction, [0, interactions.plot.xy.length - 1]);\n interactions.highlightX(interactions.plot.xy[nextXIndex]);\n }\n }\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 within the selected column.\n const moveBetweenSeries = (direction: -1 | 1) => {\n const point = interactions.get().highlightedPoint;\n if (!point) {\n const { highlightedX } = interactions.get();\n if (highlightedX) {\n const xIndex = highlightedX[0].index.x;\n const points = interactions.plot.xy[xIndex];\n const yIndex = direction === 1 ? 0 : points.length - 1;\n interactions.highlightPoint(points[yIndex]);\n }\n return;\n }\n\n // Take the index of the currently highlighted column.\n const xIndex = point.index.x;\n const currentYIndex = point.index.y;\n\n if (\n containsMultipleSeries &&\n ((currentYIndex === 0 && direction === -1) ||\n (currentYIndex === interactions.plot.xy[xIndex].length - 1 && direction === 1))\n ) {\n interactions.highlightX(interactions.plot.xy[xIndex]);\n } else {\n // Take the incremented(circularly) y-index of the currently highlighted point.\n const nextYIndex = circleIndex(currentYIndex + 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][nextYIndex]);\n }\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 moveWithinXAxis(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 const highlightFirstX = () => {\n interactions.highlightX(interactions.plot.xy[0]);\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 if (trigger === 'keyboard') {\n const { highlightedX, highlightedPoint, highlightedSeries, legendSeries } = interactions.get();\n if (containsMultipleSeries && !highlightedX && !highlightedPoint && !highlightedSeries && !legendSeries) {\n highlightFirstX();\n } else if (!highlightedX) {\n interactions.highlightFirstPoint();\n }\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 || interactions.get().highlightedX) {\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,6 +1,6 @@
1
1
  import { NonCancelableEventHandler } from '../../internal/events';
2
2
  import { AreaChartProps } from '../interfaces';
3
- declare type FilterProps<T> = [readonly AreaChartProps.Series<T>[], (series: readonly AreaChartProps.Series<T>[]) => void];
3
+ type FilterProps<T> = [readonly AreaChartProps.Series<T>[], (series: readonly AreaChartProps.Series<T>[]) => void];
4
4
  export default function useFilterProps<T>(series: readonly AreaChartProps.Series<T>[], controlledVisibleSeries?: readonly AreaChartProps.Series<T>[], controlledOnVisibleChange?: NonCancelableEventHandler<AreaChartProps.FilterChangeDetail<T>>): FilterProps<T>;
5
5
  export {};
6
6
  //# sourceMappingURL=use-filter-props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-filter-props.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/use-filter-props.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,aAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;AAGnH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EACtC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC3C,uBAAuB,CAAC,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC7D,yBAAyB,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAC1F,WAAW,CAAC,CAAC,CAAC,CA8BhB"}
1
+ {"version":3,"file":"use-filter-props.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/use-filter-props.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;AAGnH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EACtC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC3C,uBAAuB,CAAC,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC7D,yBAAyB,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAC1F,WAAW,CAAC,CAAC,CAAC,CA8BhB"}
@@ -1,6 +1,6 @@
1
1
  import { NonCancelableEventHandler } from '../../internal/events';
2
2
  import { AreaChartProps } from '../interfaces';
3
- declare type HighlightProps<T> = [null | AreaChartProps.Series<T>, (s: null | AreaChartProps.Series<T>) => void];
3
+ type HighlightProps<T> = [null | AreaChartProps.Series<T>, (s: null | AreaChartProps.Series<T>) => void];
4
4
  export default function useHighlightProps<T>(series: readonly AreaChartProps.Series<T>[], controlledHighlightedSeries?: null | AreaChartProps.Series<T>, controlledOnHighlightChange?: NonCancelableEventHandler<AreaChartProps.HighlightChangeDetail<T>>): HighlightProps<T>;
5
5
  export {};
6
6
  //# sourceMappingURL=use-highlight-props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-highlight-props.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/use-highlight-props.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,aAAK,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAGzG,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EACzC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC3C,2BAA2B,CAAC,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAC7D,2BAA2B,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAC/F,cAAc,CAAC,CAAC,CAAC,CAgCnB"}
1
+ {"version":3,"file":"use-highlight-props.d.ts","sourceRoot":"","sources":["../../../../src/area-chart/model/use-highlight-props.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAGzG,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EACzC,MAAM,EAAE,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAC3C,2BAA2B,CAAC,EAAE,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAC7D,2BAA2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