@limetech/lime-elements 40.23.0 → 40.25.0

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 (404) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/{checkbox.template-CNJ29zDR.js → checkbox.template-DgiUCPna.js} +1 -1
  3. package/dist/cjs/dom-BWMDM6En.js +32 -0
  4. package/dist/cjs/{image.template-DlF-f23b.js → image.template-B_HZH9t-.js} +1 -1
  5. package/dist/cjs/{index-BlsqxTB1.js → index-CQn9p_mp.js} +12 -0
  6. package/dist/cjs/lime-elements.cjs.js +2 -2
  7. package/dist/cjs/limel-3d-hover-effect-glow.cjs.entry.js +2 -2
  8. package/dist/cjs/limel-action-bar_3.cjs.entry.js +5 -6
  9. package/dist/cjs/limel-ai-avatar.cjs.entry.js +3 -4
  10. package/dist/cjs/limel-badge_7.cjs.entry.js +13 -13
  11. package/dist/cjs/limel-banner.cjs.entry.js +2 -2
  12. package/dist/cjs/limel-button-group.cjs.entry.js +2 -2
  13. package/dist/cjs/limel-button.cjs.entry.js +3 -3
  14. package/dist/cjs/limel-callout.cjs.entry.js +3 -4
  15. package/dist/cjs/limel-card.cjs.entry.js +3 -3
  16. package/dist/cjs/limel-chart.cjs.entry.js +782 -180
  17. package/dist/cjs/limel-checkbox.cjs.entry.js +3 -3
  18. package/dist/cjs/limel-chip-set.cjs.entry.js +3 -4
  19. package/dist/cjs/limel-chip_2.cjs.entry.js +4 -5
  20. package/dist/cjs/limel-circular-progress.cjs.entry.js +2 -2
  21. package/dist/cjs/limel-code-diff.cjs.entry.js +3 -4
  22. package/dist/cjs/limel-code-editor.cjs.entry.js +3 -4
  23. package/dist/cjs/limel-collapsible-section.cjs.entry.js +3 -4
  24. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +3 -3
  25. package/dist/cjs/limel-color-picker.cjs.entry.js +2 -2
  26. package/dist/cjs/limel-config.cjs.entry.js +1 -1
  27. package/dist/cjs/limel-date-picker.cjs.entry.js +439 -28
  28. package/dist/cjs/limel-dialog.cjs.entry.js +3 -3
  29. package/dist/cjs/limel-dock-button.cjs.entry.js +1 -1
  30. package/dist/cjs/limel-dock.cjs.entry.js +4 -5
  31. package/dist/cjs/limel-drag-handle_2.cjs.entry.js +5 -6
  32. package/dist/cjs/limel-dynamic-label.cjs.entry.js +1 -1
  33. package/dist/cjs/limel-email-viewer.cjs.entry.js +3 -4
  34. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +3 -3
  35. package/dist/cjs/limel-file-viewer.cjs.entry.js +3 -4
  36. package/dist/cjs/limel-file.cjs.entry.js +3 -4
  37. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +124 -16
  38. package/dist/cjs/limel-flex-container.cjs.entry.js +2 -2
  39. package/dist/cjs/limel-form-header.cjs.entry.js +2 -2
  40. package/dist/cjs/limel-form.cjs.entry.js +66 -6
  41. package/dist/cjs/limel-grid.cjs.entry.js +2 -2
  42. package/dist/cjs/limel-header.cjs.entry.js +2 -2
  43. package/dist/cjs/limel-help_2.cjs.entry.js +4 -4
  44. package/dist/cjs/limel-helper-line_3.cjs.entry.js +5 -5
  45. package/dist/cjs/limel-hotkey_4.cjs.entry.js +6 -6
  46. package/dist/cjs/limel-icon-button.cjs.entry.js +2 -2
  47. package/dist/cjs/limel-icon.cjs.entry.js +2 -2
  48. package/dist/cjs/limel-info-tile.cjs.entry.js +3 -3
  49. package/dist/cjs/limel-list-item.cjs.entry.js +7 -8
  50. package/dist/cjs/limel-markdown.cjs.entry.js +2 -2
  51. package/dist/cjs/limel-masonry-layout.cjs.entry.js +2 -2
  52. package/dist/cjs/limel-menu-item-meta.cjs.entry.js +2 -2
  53. package/dist/cjs/limel-pagination-jump.cjs.entry.js +2 -3
  54. package/dist/cjs/limel-pagination.cjs.entry.js +7 -8
  55. package/dist/cjs/limel-picker.cjs.entry.js +7 -7
  56. package/dist/cjs/limel-popover_2.cjs.entry.js +3 -3
  57. package/dist/cjs/limel-profile-picture.cjs.entry.js +3 -4
  58. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
  59. package/dist/cjs/limel-progress-flow.cjs.entry.js +1 -1
  60. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +3 -4
  61. package/dist/cjs/limel-radio-button-group.cjs.entry.js +2 -2
  62. package/dist/cjs/limel-radio-button.cjs.entry.js +3 -3
  63. package/dist/cjs/limel-resize-handle.cjs.entry.js +3 -4
  64. package/dist/cjs/limel-select.cjs.entry.js +3 -3
  65. package/dist/cjs/limel-shortcut.cjs.entry.js +2 -2
  66. package/dist/cjs/limel-side-panel.cjs.entry.js +3 -4
  67. package/dist/cjs/limel-slider.cjs.entry.js +5 -6
  68. package/dist/cjs/limel-snackbar.cjs.entry.js +4 -5
  69. package/dist/cjs/limel-split-button.cjs.entry.js +3 -3
  70. package/dist/cjs/limel-switch.cjs.entry.js +2 -2
  71. package/dist/cjs/limel-tab-bar.cjs.entry.js +2 -2
  72. package/dist/cjs/limel-tab-panel.cjs.entry.js +2 -2
  73. package/dist/cjs/limel-table.cjs.entry.js +4 -5
  74. package/dist/cjs/limel-text-editor-link-menu.cjs.entry.js +5 -6
  75. package/dist/cjs/limel-text-editor.cjs.entry.js +2 -2
  76. package/dist/cjs/{live-message-BNl3Ihcz.js → live-message-CwxlKd60.js} +0 -30
  77. package/dist/cjs/loader.cjs.js +2 -2
  78. package/dist/cjs/{render-list-component-BtAliHQp.js → render-list-component-BOYFHMFE.js} +1 -1
  79. package/dist/cjs/{translations-JLP5icQ9.js → translations-BPsptVkN.js} +73 -3
  80. package/dist/collection/components/3d-hover-effect-glow/3d-hover-effect-glow.js +1 -1
  81. package/dist/collection/components/action-bar/action-bar-item/action-bar-overflow-menu.js +1 -1
  82. package/dist/collection/components/action-bar/action-bar.js +2 -2
  83. package/dist/collection/components/ai-avatar/ai-avatar.js +1 -1
  84. package/dist/collection/components/badge/badge.js +2 -2
  85. package/dist/collection/components/banner/banner.js +1 -1
  86. package/dist/collection/components/breadcrumbs/breadcrumbs.js +1 -1
  87. package/dist/collection/components/button/button.js +2 -2
  88. package/dist/collection/components/button-group/button-group.js +1 -1
  89. package/dist/collection/components/callout/callout.js +1 -1
  90. package/dist/collection/components/card/card.js +1 -1
  91. package/dist/collection/components/chart/chart.css +29 -0
  92. package/dist/collection/components/chart/chart.js +352 -67
  93. package/dist/collection/components/chart/options.js +342 -109
  94. package/dist/collection/components/chart/scale.js +25 -2
  95. package/dist/collection/components/chart/series.js +110 -0
  96. package/dist/collection/components/checkbox/checkbox.js +1 -1
  97. package/dist/collection/components/chip/chip.js +1 -1
  98. package/dist/collection/components/chip-set/chip-set.js +1 -1
  99. package/dist/collection/components/circular-progress/circular-progress.js +1 -1
  100. package/dist/collection/components/code-diff/code-diff.js +1 -1
  101. package/dist/collection/components/code-editor/code-editor.js +1 -1
  102. package/dist/collection/components/collapsible-section/collapsible-section.js +1 -1
  103. package/dist/collection/components/color-picker/color-picker-palette.js +2 -2
  104. package/dist/collection/components/color-picker/color-picker.js +1 -1
  105. package/dist/collection/components/date-picker/date-formatter.js +147 -1
  106. package/dist/collection/components/date-picker/date-picker.css +112 -0
  107. package/dist/collection/components/date-picker/date-picker.js +307 -26
  108. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +77 -30
  109. package/dist/collection/components/date-picker/pickers/month-picker.js +3 -0
  110. package/dist/collection/components/date-picker/pickers/picker.js +37 -1
  111. package/dist/collection/components/date-picker/pickers/quarter-picker.js +3 -0
  112. package/dist/collection/components/date-picker/pickers/week-picker.js +21 -0
  113. package/dist/collection/components/date-picker/pickers/year-picker.js +24 -0
  114. package/dist/collection/components/dialog/dialog.js +2 -2
  115. package/dist/collection/components/dock/dock.js +2 -2
  116. package/dist/collection/components/drag-handle/drag-handle.js +1 -1
  117. package/dist/collection/components/email-viewer/email-viewer.js +1 -1
  118. package/dist/collection/components/file/file.js +1 -1
  119. package/dist/collection/components/file-dropzone/file-dropzone.js +1 -1
  120. package/dist/collection/components/file-input/file-input.js +1 -1
  121. package/dist/collection/components/flex-container/flex-container.js +1 -1
  122. package/dist/collection/components/form/fields/schema-field.js +19 -1
  123. package/dist/collection/components/form/form.js +30 -3
  124. package/dist/collection/components/form/form.test-schemas.js +11 -0
  125. package/dist/collection/components/form/invalid-input.js +14 -0
  126. package/dist/collection/components/form/widgets/date-picker.js +3 -1
  127. package/dist/collection/components/form-header/form-header.js +1 -1
  128. package/dist/collection/components/grid/grid.js +1 -1
  129. package/dist/collection/components/header/header.js +1 -1
  130. package/dist/collection/components/help/help-content.js +1 -1
  131. package/dist/collection/components/help/help.js +2 -2
  132. package/dist/collection/components/helper-line/helper-line.js +2 -2
  133. package/dist/collection/components/hotkey/hotkey.js +1 -1
  134. package/dist/collection/components/icon/icon.js +1 -1
  135. package/dist/collection/components/icon-button/icon-button.js +1 -1
  136. package/dist/collection/components/info-tile/info-tile.js +2 -2
  137. package/dist/collection/components/input-field/input-field.js +1 -1
  138. package/dist/collection/components/list/list.js +1 -1
  139. package/dist/collection/components/list-item/list-item.js +2 -2
  140. package/dist/collection/components/list-item/menu-item-meta/menu-item-meta.js +1 -1
  141. package/dist/collection/components/markdown/markdown.js +1 -1
  142. package/dist/collection/components/masonry-layout/masonry-layout.js +1 -1
  143. package/dist/collection/components/menu/menu.js +1 -1
  144. package/dist/collection/components/menu-list/menu-list.js +1 -1
  145. package/dist/collection/components/menu-surface/menu-surface.js +1 -1
  146. package/dist/collection/components/notched-outline/notched-outline.js +1 -1
  147. package/dist/collection/components/pagination/pagination.js +1 -1
  148. package/dist/collection/components/picker/picker.js +1 -1
  149. package/dist/collection/components/popover/popover.js +1 -1
  150. package/dist/collection/components/popover-surface/popover-surface.js +1 -1
  151. package/dist/collection/components/portal/portal.js +1 -1
  152. package/dist/collection/components/radio-button-group/radio-button-group.js +1 -1
  153. package/dist/collection/components/radio-button-group/radio-button.js +2 -2
  154. package/dist/collection/components/resize-handle/resize-handle.js +1 -1
  155. package/dist/collection/components/scroller/scroller.js +2 -2
  156. package/dist/collection/components/select/select.js +1 -1
  157. package/dist/collection/components/shortcut/shortcut.js +1 -1
  158. package/dist/collection/components/side-panel/side-panel.js +1 -1
  159. package/dist/collection/components/slider/slider.js +3 -3
  160. package/dist/collection/components/snackbar/snackbar.js +2 -2
  161. package/dist/collection/components/spinner/spinner.js +1 -1
  162. package/dist/collection/components/split-button/split-button.js +2 -2
  163. package/dist/collection/components/switch/switch.js +1 -1
  164. package/dist/collection/components/tab-bar/tab-bar.js +1 -1
  165. package/dist/collection/components/tab-panel/tab-panel.js +1 -1
  166. package/dist/collection/components/table/table.js +2 -2
  167. package/dist/collection/components/text-editor/link-menu/editor-link-menu.js +3 -3
  168. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +1 -1
  169. package/dist/collection/components/text-editor/text-editor.js +1 -1
  170. package/dist/collection/components/tooltip/tooltip-content.js +1 -1
  171. package/dist/collection/components/tooltip/tooltip.js +2 -2
  172. package/dist/collection/translations/da.js +2 -0
  173. package/dist/collection/translations/de.js +2 -0
  174. package/dist/collection/translations/en.js +2 -0
  175. package/dist/collection/translations/fi.js +2 -0
  176. package/dist/collection/translations/fr.js +2 -0
  177. package/dist/collection/translations/nl.js +2 -0
  178. package/dist/collection/translations/no.js +2 -0
  179. package/dist/collection/translations/sv.js +2 -0
  180. package/dist/esm/{checkbox.template-CAja2LKZ.js → checkbox.template-BJJmiDJP.js} +1 -1
  181. package/dist/esm/dom-B9Ofc5RB.js +30 -0
  182. package/dist/esm/{image.template-BGjw97m_.js → image.template-Cw2q5IS7.js} +1 -1
  183. package/dist/esm/{index-BU9IJqli.js → index-D3SUrFhp.js} +12 -1
  184. package/dist/esm/{keyboard-navigation-BF7IKmnG.js → keyboard-navigation-DeMxdkNf.js} +1 -1
  185. package/dist/esm/lime-elements.js +3 -3
  186. package/dist/esm/limel-3d-hover-effect-glow.entry.js +2 -2
  187. package/dist/esm/limel-action-bar_3.entry.js +5 -6
  188. package/dist/esm/limel-ai-avatar.entry.js +3 -4
  189. package/dist/esm/limel-badge_7.entry.js +12 -12
  190. package/dist/esm/limel-banner.entry.js +2 -2
  191. package/dist/esm/limel-button-group.entry.js +2 -2
  192. package/dist/esm/limel-button.entry.js +3 -3
  193. package/dist/esm/limel-callout.entry.js +3 -4
  194. package/dist/esm/limel-card.entry.js +3 -3
  195. package/dist/esm/limel-chart.entry.js +779 -177
  196. package/dist/esm/limel-checkbox.entry.js +3 -3
  197. package/dist/esm/limel-chip-set.entry.js +3 -4
  198. package/dist/esm/limel-chip_2.entry.js +4 -5
  199. package/dist/esm/limel-circular-progress.entry.js +2 -2
  200. package/dist/esm/limel-code-diff.entry.js +3 -4
  201. package/dist/esm/limel-code-editor.entry.js +3 -4
  202. package/dist/esm/limel-collapsible-section.entry.js +3 -4
  203. package/dist/esm/limel-color-picker-palette.entry.js +3 -3
  204. package/dist/esm/limel-color-picker.entry.js +2 -2
  205. package/dist/esm/limel-config.entry.js +1 -1
  206. package/dist/esm/limel-date-picker.entry.js +436 -25
  207. package/dist/esm/limel-dialog.entry.js +3 -3
  208. package/dist/esm/limel-dock-button.entry.js +1 -1
  209. package/dist/esm/limel-dock.entry.js +4 -5
  210. package/dist/esm/limel-drag-handle_2.entry.js +5 -6
  211. package/dist/esm/limel-dynamic-label.entry.js +1 -1
  212. package/dist/esm/limel-email-viewer.entry.js +3 -4
  213. package/dist/esm/limel-file-dropzone_2.entry.js +3 -3
  214. package/dist/esm/limel-file-viewer.entry.js +3 -4
  215. package/dist/esm/limel-file.entry.js +3 -4
  216. package/dist/esm/limel-flatpickr-adapter.entry.js +118 -10
  217. package/dist/esm/limel-flex-container.entry.js +2 -2
  218. package/dist/esm/limel-form-header.entry.js +2 -2
  219. package/dist/esm/limel-form.entry.js +66 -6
  220. package/dist/esm/limel-grid.entry.js +2 -2
  221. package/dist/esm/limel-header.entry.js +2 -2
  222. package/dist/esm/limel-help_2.entry.js +4 -4
  223. package/dist/esm/limel-helper-line_3.entry.js +5 -5
  224. package/dist/esm/limel-hotkey_4.entry.js +6 -6
  225. package/dist/esm/limel-icon-button.entry.js +2 -2
  226. package/dist/esm/limel-icon.entry.js +2 -2
  227. package/dist/esm/limel-info-tile.entry.js +3 -3
  228. package/dist/esm/limel-list-item.entry.js +7 -8
  229. package/dist/esm/limel-markdown.entry.js +2 -2
  230. package/dist/esm/limel-masonry-layout.entry.js +2 -2
  231. package/dist/esm/limel-menu-item-meta.entry.js +2 -2
  232. package/dist/esm/limel-pagination-jump.entry.js +2 -3
  233. package/dist/esm/limel-pagination.entry.js +3 -4
  234. package/dist/esm/limel-picker.entry.js +5 -5
  235. package/dist/esm/limel-popover_2.entry.js +3 -3
  236. package/dist/esm/limel-profile-picture.entry.js +3 -4
  237. package/dist/esm/limel-progress-flow-item.entry.js +1 -1
  238. package/dist/esm/limel-progress-flow.entry.js +1 -1
  239. package/dist/esm/limel-prosemirror-adapter.entry.js +3 -4
  240. package/dist/esm/limel-radio-button-group.entry.js +2 -2
  241. package/dist/esm/limel-radio-button.entry.js +3 -3
  242. package/dist/esm/limel-resize-handle.entry.js +3 -4
  243. package/dist/esm/limel-select.entry.js +3 -3
  244. package/dist/esm/limel-shortcut.entry.js +2 -2
  245. package/dist/esm/limel-side-panel.entry.js +3 -4
  246. package/dist/esm/limel-slider.entry.js +5 -6
  247. package/dist/esm/limel-snackbar.entry.js +4 -5
  248. package/dist/esm/limel-split-button.entry.js +3 -3
  249. package/dist/esm/limel-switch.entry.js +2 -2
  250. package/dist/esm/limel-tab-bar.entry.js +3 -3
  251. package/dist/esm/limel-tab-panel.entry.js +2 -2
  252. package/dist/esm/limel-table.entry.js +4 -5
  253. package/dist/esm/limel-text-editor-link-menu.entry.js +5 -6
  254. package/dist/esm/limel-text-editor.entry.js +2 -2
  255. package/dist/esm/{live-message-BQAYeNiX.js → live-message-BKB4vu28.js} +1 -30
  256. package/dist/esm/loader.js +3 -3
  257. package/dist/esm/{render-list-component-J1IzNpbv.js → render-list-component-CnMNjOaj.js} +1 -1
  258. package/dist/esm/{translations-D9ZGrMhe.js → translations--i932i_D.js} +70 -2
  259. package/dist/lime-elements/lime-elements.esm.js +1 -1
  260. package/dist/lime-elements/p--i932i_D.js +1 -0
  261. package/dist/lime-elements/p-07961d4f.entry.js +1 -0
  262. package/dist/lime-elements/p-099e9e1a.entry.js +1 -0
  263. package/dist/lime-elements/p-0dd5cb25.entry.js +1 -0
  264. package/dist/lime-elements/{p-40940a6c.entry.js → p-1d57370e.entry.js} +1 -1
  265. package/dist/lime-elements/p-1ef92aa3.entry.js +1 -0
  266. package/dist/lime-elements/p-1eff9347.entry.js +56 -0
  267. package/dist/lime-elements/{p-6053608a.entry.js → p-22458db2.entry.js} +2 -2
  268. package/dist/lime-elements/{p-db9cb7ef.entry.js → p-2520a91b.entry.js} +1 -1
  269. package/dist/lime-elements/{p-85318636.entry.js → p-25473848.entry.js} +1 -1
  270. package/dist/lime-elements/p-27000dfb.entry.js +1 -0
  271. package/dist/lime-elements/p-29800b71.entry.js +1 -0
  272. package/dist/lime-elements/{p-438fe49b.entry.js → p-2e1fd8c4.entry.js} +1 -1
  273. package/dist/lime-elements/p-2f6ee1b0.entry.js +1 -0
  274. package/dist/lime-elements/{p-c61e9b83.entry.js → p-427a3da3.entry.js} +1 -1
  275. package/dist/lime-elements/p-447a2633.entry.js +1 -0
  276. package/dist/lime-elements/{p-909466b8.entry.js → p-4c54780d.entry.js} +1 -1
  277. package/dist/lime-elements/p-4f81f0b4.entry.js +1 -0
  278. package/dist/lime-elements/{p-7d0ffc60.entry.js → p-5062b51a.entry.js} +1 -1
  279. package/dist/lime-elements/p-5295b4c7.entry.js +1 -0
  280. package/dist/lime-elements/p-5a1b7f4d.entry.js +1 -0
  281. package/dist/lime-elements/{p-a6387dc7.entry.js → p-5b9c1f8f.entry.js} +1 -1
  282. package/dist/lime-elements/p-5be1e9e8.entry.js +159 -0
  283. package/dist/lime-elements/p-5c6589aa.entry.js +1 -0
  284. package/dist/lime-elements/{p-3f7fa772.entry.js → p-5e7ca1fd.entry.js} +1 -1
  285. package/dist/lime-elements/{p-95a486c8.entry.js → p-5f66e497.entry.js} +1 -1
  286. package/dist/lime-elements/p-667759da.entry.js +1 -0
  287. package/dist/lime-elements/{p-48a412ed.entry.js → p-6a340609.entry.js} +1 -1
  288. package/dist/lime-elements/{p-a891f3e8.entry.js → p-6d3cde2e.entry.js} +1 -1
  289. package/dist/lime-elements/{p-f59447bf.entry.js → p-6e529563.entry.js} +1 -1
  290. package/dist/lime-elements/{p-c2056ebc.entry.js → p-743f014f.entry.js} +1 -1
  291. package/dist/lime-elements/{p-c6b3448c.entry.js → p-7aa034e2.entry.js} +1 -1
  292. package/dist/lime-elements/p-7b2ec934.entry.js +1 -0
  293. package/dist/lime-elements/p-7b99624f.entry.js +1 -0
  294. package/dist/lime-elements/p-7ea96b80.entry.js +1 -0
  295. package/dist/lime-elements/{p-e5abe390.entry.js → p-7fe1d9ad.entry.js} +1 -1
  296. package/dist/lime-elements/p-842694af.entry.js +1 -0
  297. package/dist/lime-elements/{p-d3f13124.entry.js → p-848aeaa6.entry.js} +1 -1
  298. package/dist/lime-elements/{p-1e0ced6a.entry.js → p-868a8b12.entry.js} +1 -1
  299. package/dist/lime-elements/p-891f6a07.entry.js +1 -0
  300. package/dist/lime-elements/{p-28957b5c.entry.js → p-8dcb9ef1.entry.js} +1 -1
  301. package/dist/lime-elements/p-92f79a62.entry.js +1 -0
  302. package/dist/lime-elements/p-93907698.entry.js +16 -0
  303. package/dist/lime-elements/{p-c0ebf7cc.entry.js → p-9b3c7341.entry.js} +1 -1
  304. package/dist/lime-elements/p-B9Ofc5RB.js +1 -0
  305. package/dist/lime-elements/{p-_1yBt1pG.js → p-BJrZuSu3.js} +1 -1
  306. package/dist/lime-elements/{p-Cadm4-WZ.js → p-BzHrLZdr.js} +1 -1
  307. package/dist/lime-elements/p-CMedqTpE.js +1 -0
  308. package/dist/lime-elements/{p-BU9IJqli.js → p-D3SUrFhp.js} +2 -2
  309. package/dist/lime-elements/p-DpXrxCh5.js +1 -0
  310. package/dist/lime-elements/p-DwxRLqY6.js +1 -0
  311. package/dist/lime-elements/{p-c8a34cef.entry.js → p-a0501e84.entry.js} +1 -1
  312. package/dist/lime-elements/p-a5419b44.entry.js +1 -0
  313. package/dist/lime-elements/{p-ce71c5b9.entry.js → p-abd612b3.entry.js} +1 -1
  314. package/dist/lime-elements/{p-f3b93ce8.entry.js → p-aeac9588.entry.js} +2 -2
  315. package/dist/lime-elements/p-b01e8af9.entry.js +1 -0
  316. package/dist/lime-elements/{p-f97ec7a5.entry.js → p-b08c9b52.entry.js} +1 -1
  317. package/dist/lime-elements/{p-54537c85.entry.js → p-b1f6412e.entry.js} +1 -1
  318. package/dist/lime-elements/{p-6ae093c8.entry.js → p-b3967ab3.entry.js} +1 -1
  319. package/dist/lime-elements/{p-5dce791c.entry.js → p-b8bfec0e.entry.js} +1 -1
  320. package/dist/lime-elements/p-ba4b44ad.entry.js +1 -0
  321. package/dist/lime-elements/{p-783fd221.entry.js → p-bf726f16.entry.js} +1 -1
  322. package/dist/lime-elements/p-c2f27d2a.entry.js +1 -0
  323. package/dist/lime-elements/{p-271662d4.entry.js → p-c3bd19ea.entry.js} +1 -1
  324. package/dist/lime-elements/p-cc560bbd.entry.js +1 -0
  325. package/dist/lime-elements/{p-0319f07f.entry.js → p-d2953c11.entry.js} +1 -1
  326. package/dist/lime-elements/{p-764d2f86.entry.js → p-d3d01dd4.entry.js} +1 -1
  327. package/dist/lime-elements/{p-4b75e653.entry.js → p-d9e6175b.entry.js} +1 -1
  328. package/dist/lime-elements/p-dab5421d.entry.js +1 -0
  329. package/dist/lime-elements/p-dcaeefc9.entry.js +1 -0
  330. package/dist/lime-elements/{p-f71fbc9e.entry.js → p-df8aa135.entry.js} +4 -4
  331. package/dist/lime-elements/p-e2fb2af4.entry.js +1 -0
  332. package/dist/lime-elements/p-e929fc64.entry.js +1 -0
  333. package/dist/lime-elements/p-ea02dade.entry.js +1 -0
  334. package/dist/lime-elements/p-ecd633cb.entry.js +1 -0
  335. package/dist/lime-elements/{p-39d1e157.entry.js → p-f5cd53e8.entry.js} +1 -1
  336. package/dist/lime-elements/{p-8fe28845.entry.js → p-f7cae25a.entry.js} +1 -1
  337. package/dist/types/components/chart/chart.d.ts +59 -8
  338. package/dist/types/components/chart/chart.types.d.ts +23 -0
  339. package/dist/types/components/chart/options.d.ts +83 -8
  340. package/dist/types/components/chart/scale.d.ts +10 -0
  341. package/dist/types/components/chart/series.d.ts +71 -0
  342. package/dist/types/components/date-picker/date-formatter.d.ts +12 -0
  343. package/dist/types/components/date-picker/date-picker.d.ts +59 -3
  344. package/dist/types/components/date-picker/flatpickr-adapter/flatpickr-adapter.d.ts +13 -2
  345. package/dist/types/components/date-picker/pickers/month-picker.d.ts +1 -0
  346. package/dist/types/components/date-picker/pickers/picker.d.ts +8 -1
  347. package/dist/types/components/date-picker/pickers/quarter-picker.d.ts +1 -0
  348. package/dist/types/components/date-picker/pickers/week-picker.d.ts +4 -0
  349. package/dist/types/components/date-picker/pickers/year-picker.d.ts +7 -0
  350. package/dist/types/components/form/fields/schema-field.d.ts +2 -0
  351. package/dist/types/components/form/form.d.ts +2 -0
  352. package/dist/types/components/form/form.test-schemas.d.ts +1 -0
  353. package/dist/types/components/form/invalid-input.d.ts +14 -0
  354. package/dist/types/components/form/widgets/date-picker.d.ts +1 -0
  355. package/dist/types/components.d.ts +73 -26
  356. package/dist/types/translations/da.d.ts +2 -0
  357. package/dist/types/translations/de.d.ts +2 -0
  358. package/dist/types/translations/en.d.ts +2 -0
  359. package/dist/types/translations/fi.d.ts +2 -0
  360. package/dist/types/translations/fr.d.ts +2 -0
  361. package/dist/types/translations/nl.d.ts +2 -0
  362. package/dist/types/translations/no.d.ts +2 -0
  363. package/dist/types/translations/sv.d.ts +2 -0
  364. package/package.json +3 -3
  365. package/dist/cjs/language-s0bKUCvO.js +0 -58
  366. package/dist/esm/language-VamkUr90.js +0 -55
  367. package/dist/lime-elements/p-0a7cbdc3.entry.js +0 -1
  368. package/dist/lime-elements/p-0f96e94d.entry.js +0 -1
  369. package/dist/lime-elements/p-1a0c5e45.entry.js +0 -1
  370. package/dist/lime-elements/p-401d5c92.entry.js +0 -1
  371. package/dist/lime-elements/p-430db3b9.entry.js +0 -1
  372. package/dist/lime-elements/p-43b62587.entry.js +0 -1
  373. package/dist/lime-elements/p-48dccb83.entry.js +0 -1
  374. package/dist/lime-elements/p-5c918155.entry.js +0 -1
  375. package/dist/lime-elements/p-66101ed6.entry.js +0 -1
  376. package/dist/lime-elements/p-7ab72b52.entry.js +0 -1
  377. package/dist/lime-elements/p-8d602078.entry.js +0 -1
  378. package/dist/lime-elements/p-8d9a2a22.entry.js +0 -1
  379. package/dist/lime-elements/p-8de4f0f3.entry.js +0 -1
  380. package/dist/lime-elements/p-8e80a884.entry.js +0 -56
  381. package/dist/lime-elements/p-99984c66.entry.js +0 -1
  382. package/dist/lime-elements/p-9d46f720.entry.js +0 -1
  383. package/dist/lime-elements/p-9e2b426c.entry.js +0 -1
  384. package/dist/lime-elements/p-C9dBa_Im.js +0 -1
  385. package/dist/lime-elements/p-Cw7VQSGU.js +0 -1
  386. package/dist/lime-elements/p-N9vxZMhe.js +0 -1
  387. package/dist/lime-elements/p-VamkUr90.js +0 -1
  388. package/dist/lime-elements/p-b1c7033b.entry.js +0 -16
  389. package/dist/lime-elements/p-b5451350.entry.js +0 -1
  390. package/dist/lime-elements/p-c75f3b0d.entry.js +0 -1
  391. package/dist/lime-elements/p-ca4247c4.entry.js +0 -1
  392. package/dist/lime-elements/p-cf2d43c7.entry.js +0 -1
  393. package/dist/lime-elements/p-d53421af.entry.js +0 -1
  394. package/dist/lime-elements/p-d8901e39.entry.js +0 -1
  395. package/dist/lime-elements/p-d89553b3.entry.js +0 -1
  396. package/dist/lime-elements/p-d93b8ce0.entry.js +0 -1
  397. package/dist/lime-elements/p-e97340c4.entry.js +0 -1
  398. package/dist/lime-elements/p-eF09GxA_.js +0 -1
  399. package/dist/lime-elements/p-ec0c113d.entry.js +0 -1
  400. package/dist/lime-elements/p-f036ad27.entry.js +0 -1
  401. package/dist/lime-elements/p-f197000b.entry.js +0 -159
  402. package/dist/lime-elements/p-f5bb17eb.entry.js +0 -1
  403. package/dist/lime-elements/p-f6bc6658.entry.js +0 -1
  404. package/dist/lime-elements/p-fa1aa440.entry.js +0 -1
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BlsqxTB1.js');
4
- var translations = require('./translations-JLP5icQ9.js');
3
+ var index = require('./index-CQn9p_mp.js');
4
+ var translations = require('./translations-BPsptVkN.js');
5
5
  var keyboardNavigation = require('./keyboard-navigation-VyqkMDKy.js');
6
- var language = require('./language-s0bKUCvO.js');
7
6
  require('./keycodes-BQ_AERli.js');
8
7
 
9
8
  /*! *****************************************************************************
@@ -25331,7 +25330,7 @@ var tmpNotUsedArr = [];
25331
25330
  * specific language governing permissions and limitations
25332
25331
  * under the License.
25333
25332
  */
25334
- var AXIS_TYPES = {
25333
+ var AXIS_TYPES$1 = {
25335
25334
  value: 1,
25336
25335
  category: 1,
25337
25336
  time: 1,
@@ -25347,7 +25346,7 @@ function determineAxisType(model) {
25347
25346
  // PENDING: Theoretically, a customized `Scale` is probably impossible, since
25348
25347
  // the interface of `Scale` does not guarantee stability. But we still literally
25349
25348
  // support it for backward compat, though type incorrect.
25350
- || !hasOwn(AXIS_TYPES, type) && !Scale.getClass(type)) {
25349
+ || !hasOwn(AXIS_TYPES$1, type) && !Scale.getClass(type)) {
25351
25350
  type = 'value';
25352
25351
  }
25353
25352
  return type;
@@ -42062,7 +42061,7 @@ var axisDefault = {
42062
42061
  * @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...
42063
42062
  */
42064
42063
  function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {
42065
- each$3(AXIS_TYPES, function (v, axisType) {
42064
+ each$3(AXIS_TYPES$1, function (v, axisType) {
42066
42065
  var defaultOption = merge(merge({}, axisDefault[axisType], true), extraDefaultOption, true);
42067
42066
  var AxisModel = /** @class */function (_super) {
42068
42067
  __extends$1(AxisModel, _super);
@@ -50191,12 +50190,21 @@ const WHOLE_TYPES = new Set([
50191
50190
  'doughnut',
50192
50191
  'ring',
50193
50192
  ]);
50194
- const AXIS_INCREMENT_TYPES = new Set([
50193
+ /**
50194
+ * Types that draw their values along an axis, against the texts of the items
50195
+ * along another one.
50196
+ */
50197
+ const AXIS_TYPES = new Set([
50195
50198
  'bar',
50196
50199
  'dot',
50197
50200
  'area',
50198
50201
  'line',
50199
50202
  ]);
50203
+ const STACK_TYPES = new Set([
50204
+ 'bar',
50205
+ 'area',
50206
+ 'line',
50207
+ ]);
50200
50208
  /**
50201
50209
  * Whether the items of a chart of this type are parts of one whole.
50202
50210
  * @param type - the chart type
@@ -50210,7 +50218,21 @@ function isPartOfWhole(type) {
50210
50218
  * @param type - the chart type
50211
50219
  */
50212
50220
  function usesAxisIncrement(type) {
50213
- return AXIS_INCREMENT_TYPES.has(type);
50221
+ return AXIS_TYPES.has(type);
50222
+ }
50223
+ /**
50224
+ * Whether a chart of this type can draw `series`.
50225
+ * @param type - the chart type
50226
+ */
50227
+ function canDrawSeries(type) {
50228
+ return AXIS_TYPES.has(type);
50229
+ }
50230
+ /**
50231
+ * Whether a chart of this type can stack its `series` on each other.
50232
+ * @param type - the chart type
50233
+ */
50234
+ function canStack(type) {
50235
+ return STACK_TYPES.has(type);
50214
50236
  }
50215
50237
  /**
50216
50238
  * Whether the item has a `[start, end]` range, or an `[x, y]` point in a
@@ -50775,11 +50797,121 @@ function getLocale(language) {
50775
50797
  var _a;
50776
50798
  return (_a = findLocale(language)) !== null && _a !== void 0 ? _a : FALLBACK_LOCALE;
50777
50799
  }
50778
- function findLocale(language$1) {
50779
- if (!locales.has(language$1)) {
50780
- locales.set(language$1, language.getSupportedLocale(language$1));
50800
+ function findLocale(language) {
50801
+ if (!locales.has(language)) {
50802
+ locales.set(language, translations.getSupportedLocale(language));
50803
+ }
50804
+ return locales.get(language);
50805
+ }
50806
+
50807
+ /**
50808
+ * Lines up the items of the series by their text, since items of different
50809
+ * series that have the same text belong to the same category. When a series
50810
+ * has several items with the same text, its second item with that text lines
50811
+ * up with the second one of the other series, and so on.
50812
+ * @param series - the series
50813
+ */
50814
+ function alignSeries(series) {
50815
+ const categories = [];
50816
+ const placesOfTexts = new Map();
50817
+ const placedSeries = series.map((current) => {
50818
+ var _a;
50819
+ const timesSeen = new Map();
50820
+ return ((_a = current.items) !== null && _a !== void 0 ? _a : []).map((item) => {
50821
+ var _a, _b;
50822
+ const occurrence = (_a = timesSeen.get(item.text)) !== null && _a !== void 0 ? _a : 0;
50823
+ timesSeen.set(item.text, occurrence + 1);
50824
+ const places = (_b = placesOfTexts.get(item.text)) !== null && _b !== void 0 ? _b : [];
50825
+ placesOfTexts.set(item.text, places);
50826
+ if (occurrence === places.length) {
50827
+ places.push(categories.length);
50828
+ categories.push(item.text);
50829
+ }
50830
+ return { item: item, index: places[occurrence] };
50831
+ });
50832
+ });
50833
+ return {
50834
+ categories: categories,
50835
+ series: series.map((current, index) => {
50836
+ const itemsByCategory = new Map(placedSeries[index].map((placed) => [placed.index, placed.item]));
50837
+ return {
50838
+ text: current.text,
50839
+ color: current.color,
50840
+ items: categories.map((_, category) => itemsByCategory.get(category)),
50841
+ };
50842
+ }),
50843
+ };
50844
+ }
50845
+ /**
50846
+ * The item at a position, if there is one.
50847
+ * @param grid - the series
50848
+ * @param position - where the item is
50849
+ */
50850
+ function getItemAt(grid, position) {
50851
+ var _a;
50852
+ return (_a = grid.series[position.series]) === null || _a === void 0 ? void 0 : _a.items[position.index];
50853
+ }
50854
+ /**
50855
+ * The series that has an item at a place on the axis and is nearest to a
50856
+ * series: the series itself when it has an item there, otherwise the closest
50857
+ * one, and the earlier of two that are as close.
50858
+ * @param grid - the series
50859
+ * @param position - the place on the axis, and the series to start from
50860
+ */
50861
+ function getNearestSeries(grid, position) {
50862
+ const distance = (series) => Math.abs(series - position.series);
50863
+ const [nearest] = [...grid.series.keys()]
50864
+ .filter((series) => getItemAt(grid, Object.assign(Object.assign({}, position), { series: series })))
50865
+ .sort((a, b) => distance(a) - distance(b));
50866
+ return nearest;
50867
+ }
50868
+ /**
50869
+ * The items of every series, in no particular order.
50870
+ * @param grid - the series
50871
+ */
50872
+ function getAllItems(grid) {
50873
+ return grid.series.flatMap((series) => series.items.filter((item) => item !== undefined));
50874
+ }
50875
+ /**
50876
+ * The items that the value axis has to reach: every item, or, when the
50877
+ * series are stacked, the two ends of the stack at each place on the axis.
50878
+ * Positive and negative values are stacked on their own side of zero, and a
50879
+ * range adds its extent to the stack.
50880
+ * @param grid - the series
50881
+ * @param stacked - whether the series are stacked on each other
50882
+ */
50883
+ function getAxisItems(grid, stacked) {
50884
+ if (!stacked) {
50885
+ return getAllItems(grid);
50781
50886
  }
50782
- return locales.get(language$1);
50887
+ return grid.categories.flatMap((text, index) => {
50888
+ const values = grid.series
50889
+ .map((series) => series.items[index])
50890
+ .filter((item) => item !== undefined)
50891
+ .map((item) => getValueSpan(item));
50892
+ const sum = (side) => values.filter((value) => side(value)).reduce((a, b) => a + b, 0);
50893
+ return [
50894
+ { text: text, value: sum((value) => value > 0) },
50895
+ { text: text, value: sum((value) => value < 0) },
50896
+ ];
50897
+ });
50898
+ }
50899
+ /**
50900
+ * Whether the item at a position ends its stack, since no later series has
50901
+ * an item on the same side of zero at that place on the axis.
50902
+ * @param grid - the stacked series
50903
+ * @param position - where the item is
50904
+ */
50905
+ function endsStack(grid, position) {
50906
+ const side = Math.sign(getStackedValue(grid, position));
50907
+ return grid.series.slice(position.series + 1).every((_, offset) => Math.sign(getStackedValue(grid, {
50908
+ series: position.series + 1 + offset,
50909
+ index: position.index,
50910
+ })) !== side);
50911
+ }
50912
+ function getStackedValue(grid, position) {
50913
+ const item = getItemAt(grid, position);
50914
+ return item ? getValueSpan(item) : 0;
50783
50915
  }
50784
50916
 
50785
50917
  const DOT_SIZE = 8;
@@ -50787,6 +50919,8 @@ const LINE_DOT_SIZE = 6;
50787
50919
  const CONNECTOR_WIDTH = 2;
50788
50920
  const DIMMED_OPACITY = 0.4;
50789
50921
  const AREA_OPACITY = 0.4;
50922
+ const SERIES_AREA_OPACITY = 0.15;
50923
+ const SERIES_STACK = { stack: 'series', stackStrategy: 'samesign' };
50790
50924
  const PADDING = 8;
50791
50925
  const NPS_MIN = -100;
50792
50926
  const NPS_MAX = 100;
@@ -50797,6 +50931,15 @@ const NPS_ARC_WIDTH = 16;
50797
50931
  const ITEM_TEXT_MIN_WIDTH = 40;
50798
50932
  const ITEM_TEXT_GAP = 4;
50799
50933
  const ITEM_TEXT_LINE_HEIGHT = 14;
50934
+ const SWATCH = {
50935
+ width: '0.625rem',
50936
+ height: '0.625rem',
50937
+ 'border-radius': '0.125rem',
50938
+ };
50939
+ const SWATCH_SHAPES = {
50940
+ line: { height: '0.125rem' },
50941
+ dot: { 'border-radius': '50%' },
50942
+ };
50800
50943
  const emphasis = { focus: 'self' };
50801
50944
  const blur = { itemStyle: { opacity: DIMMED_OPACITY } };
50802
50945
  const hidden = { show: false };
@@ -50808,34 +50951,116 @@ const hidden = { show: false };
50808
50951
  * when it is known from an earlier drawing
50809
50952
  */
50810
50953
  function drawChart(settings, theme, itemSpace) {
50811
- const drawing = drawSeries(settings, theme, itemSpace);
50812
- return Object.assign(Object.assign({}, drawing), { option: Object.assign({ animation: theme.animate, textStyle: { fontFamily: theme.fontFamily, color: theme.textColor }, tooltip: {
50813
- trigger: 'item',
50814
- appendTo: 'body',
50815
- backgroundColor: theme.surfaceColor,
50816
- borderColor: theme.axisLineColor,
50817
- textStyle: { color: theme.textColor },
50818
- formatter: (params) => getTooltip(settings, getItemIndex(drawing, params)),
50819
- } }, drawing.option) });
50820
- }
50821
- /**
50822
- * The index of the item drawn at a position, if an item is drawn there.
50954
+ const drawn = getDrawnSettings(settings);
50955
+ const grid = getSeriesGrid(drawn);
50956
+ const drawing = drawSeries(drawn, grid, theme, itemSpace);
50957
+ return Object.assign(Object.assign({}, drawing), { option: Object.assign({ animation: theme.animate, textStyle: { fontFamily: theme.fontFamily, color: theme.textColor }, tooltip: Object.assign({ appendTo: 'body', backgroundColor: theme.surfaceColor, borderColor: theme.axisLineColor, textStyle: { color: theme.textColor } }, (drawn.series
50958
+ ? getCategoryTooltipOption(drawn, grid, theme)
50959
+ : {
50960
+ trigger: 'item',
50961
+ formatter: (params) => getTooltip(drawn, findItem(drawing, params).index),
50962
+ })) }, drawing.option) });
50963
+ }
50964
+ /**
50965
+ * The item drawn at a position, if an item is drawn there. A position in a
50966
+ * series of ECharts that draws no items of its own, such as the invisible
50967
+ * column of an item, belongs to the first series.
50823
50968
  * @param drawing - the drawing of the chart
50824
50969
  * @param location - a position within the drawn series
50825
50970
  */
50826
- function getItemIndex(drawing, location) {
50827
- return drawing.itemsAreSeries ? location.seriesIndex : location.dataIndex;
50971
+ function findItem(drawing, location) {
50972
+ var _a, _b;
50973
+ if (drawing.itemsAreSeries) {
50974
+ return { series: 0, index: location.seriesIndex };
50975
+ }
50976
+ return {
50977
+ series: (_b = (_a = drawing.partsOfSeries) === null || _a === void 0 ? void 0 : _a[location.seriesIndex]) !== null && _b !== void 0 ? _b : 0,
50978
+ index: location.dataIndex,
50979
+ };
50828
50980
  }
50829
50981
  /**
50830
50982
  * Where an item is drawn, for highlighting it and showing its tooltip.
50831
50983
  * @param drawing - the drawing of the chart
50832
- * @param index - the index of the item
50984
+ * @param position - where the item is among the series
50833
50985
  */
50834
- function locateItem(drawing, index) {
50986
+ function locateItem(drawing, position) {
50835
50987
  if (drawing.itemsAreSeries) {
50836
- return { seriesIndex: index, dataIndex: 0 };
50988
+ return { seriesIndex: position.index, dataIndex: 0 };
50989
+ }
50990
+ return {
50991
+ seriesIndex: drawing.seriesIndexes[position.series],
50992
+ dataIndex: position.index,
50993
+ };
50994
+ }
50995
+ /**
50996
+ * The series that the chart draws: its series, when its type can draw them.
50997
+ * @param settings - what the chart is given
50998
+ */
50999
+ function getDrawnSeries(settings) {
51000
+ var _a;
51001
+ if (!((_a = settings.series) === null || _a === void 0 ? void 0 : _a.length) || !canDrawSeries(settings.type)) {
51002
+ return;
51003
+ }
51004
+ return settings.series;
51005
+ }
51006
+ /**
51007
+ * The series whose items the chart draws as its items: its first series,
51008
+ * when its type cannot draw series and it has no items.
51009
+ * @param settings - what the chart is given
51010
+ */
51011
+ function getSeriesOfDrawnItems(settings) {
51012
+ var _a, _b;
51013
+ if (getDrawnSeries(settings) || ((_a = settings.items) === null || _a === void 0 ? void 0 : _a.length)) {
51014
+ return;
51015
+ }
51016
+ return (_b = settings.series) === null || _b === void 0 ? void 0 : _b[0];
51017
+ }
51018
+ /**
51019
+ * The items that the chart draws when it draws no series: its items, or the
51020
+ * items of its first series when it has no items.
51021
+ * @param settings - what the chart is given
51022
+ */
51023
+ function getDrawnItems(settings) {
51024
+ var _a, _b, _c;
51025
+ if (getDrawnSeries(settings)) {
51026
+ return [];
50837
51027
  }
50838
- return { seriesIndex: drawing.seriesIndex, dataIndex: index };
51028
+ return (_c = (_b = (_a = getSeriesOfDrawnItems(settings)) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : settings.items) !== null && _c !== void 0 ? _c : [];
51029
+ }
51030
+ /**
51031
+ * Whether the chart stacks its series on each other. Only the types that
51032
+ * can stack series do, and never with dates, since a sum of dates means
51033
+ * nothing.
51034
+ * @param settings - what the chart is given
51035
+ */
51036
+ function isStacked(settings) {
51037
+ return Boolean(settings.stacked &&
51038
+ getDrawnSeries(settings) &&
51039
+ canStack(settings.type) &&
51040
+ settings.valueFormat !== 'date');
51041
+ }
51042
+ function getDrawnSettings(settings) {
51043
+ return Object.assign(Object.assign({}, settings), { items: getDrawnItems(settings), series: getDrawnSeries(settings), stacked: isStacked(settings) });
51044
+ }
51045
+ /**
51046
+ * The series that the chart draws lined up by category, or the items it
51047
+ * draws as the only series when it draws no series.
51048
+ * @param settings - what the chart is given
51049
+ */
51050
+ function getSeriesGrid(settings) {
51051
+ var _a;
51052
+ return alignSeries((_a = getDrawnSeries(settings)) !== null && _a !== void 0 ? _a : [
51053
+ { text: '', items: getDrawnItems(settings) },
51054
+ ]);
51055
+ }
51056
+ /**
51057
+ * The style of the marker of a series, in the legend and in the tooltip: a
51058
+ * square for bars and areas, a line for lines, and a dot for dots.
51059
+ * @param type - the chart type
51060
+ * @param color - the color of the series
51061
+ */
51062
+ function getSwatchStyle(type, color = '') {
51063
+ return Object.assign(Object.assign(Object.assign({}, SWATCH), SWATCH_SHAPES[type]), { 'background-color': color });
50839
51064
  }
50840
51065
  /**
50841
51066
  * Shows the text of every item on the axis, cut short to the space of the
@@ -50894,7 +51119,51 @@ function getTooltip(settings, index) {
50894
51119
  .map((text) => encodeHTML(text))
50895
51120
  .join('<br/>');
50896
51121
  }
50897
- function drawSeries(settings, theme, itemSpace) {
51122
+ /**
51123
+ * The tooltip of a category of a chart with series, as HTML: its text, and
51124
+ * the name and value of each series that has an item there.
51125
+ * @param grid - the series of the chart, lined up by category
51126
+ * @param style - how the chart writes values
51127
+ * @param index - the index of the category
51128
+ */
51129
+ function getCategoryTooltip(grid, style, index) {
51130
+ const category = grid.categories[index];
51131
+ if (category === undefined) {
51132
+ return '';
51133
+ }
51134
+ const lines = grid.series
51135
+ .filter((series) => series.items[index] !== undefined)
51136
+ .map((series) => {
51137
+ var _a;
51138
+ const item = series.items[index];
51139
+ return getTooltipLine(getSwatch(style.type, (_a = item.color) !== null && _a !== void 0 ? _a : series.color), series.text, formatValue(item, style));
51140
+ });
51141
+ return [`<div>${encodeHTML(category)}</div>`, ...lines].join('');
51142
+ }
51143
+ function getTooltipLine(swatch, name, value) {
51144
+ return `<div style="display:flex;justify-content:space-between;gap:1rem"><span>${swatch}${encodeHTML(name)}</span><span>${encodeHTML(value)}</span></div>`;
51145
+ }
51146
+ function getSwatch(type, color = '') {
51147
+ const style = Object.assign({ display: 'inline-block', 'vertical-align': 'middle', 'margin-right': '0.375rem' }, getSwatchStyle(type, encodeHTML(color)));
51148
+ const declarations = Object.entries(style).map(([property, value]) => `${property}:${value}`);
51149
+ return `<span style="${declarations.join(';')}"></span>`;
51150
+ }
51151
+ function getCategoryTooltipOption(settings, grid, theme) {
51152
+ return {
51153
+ trigger: 'axis',
51154
+ axisPointer: settings.type === 'bar'
51155
+ ? {
51156
+ type: 'shadow',
51157
+ shadowStyle: { color: theme.axisLineColor, opacity: 0.2 },
51158
+ }
51159
+ : { type: 'line', lineStyle: { color: theme.axisLineColor } },
51160
+ formatter: (params) => {
51161
+ const [first] = [params].flat();
51162
+ return getCategoryTooltip(grid, settings, first === null || first === void 0 ? void 0 : first.dataIndex);
51163
+ },
51164
+ };
51165
+ }
51166
+ function drawSeries(settings, grid, theme, itemSpace) {
50898
51167
  switch (settings.type) {
50899
51168
  case 'pie':
50900
51169
  case 'doughnut': {
@@ -50913,46 +51182,54 @@ function drawSeries(settings, theme, itemSpace) {
50913
51182
  return drawNps(settings, theme);
50914
51183
  }
50915
51184
  default: {
50916
- return drawOnAxes(settings, theme, itemSpace);
51185
+ return drawOnAxes(settings, grid, theme, itemSpace);
50917
51186
  }
50918
51187
  }
50919
51188
  }
50920
- function drawOnAxes(settings, theme, itemSpace) {
50921
- const { items, orientation } = settings;
50922
- const range = settings.valueFormat === 'date'
50923
- ? getDateRange(items.flatMap((item) => [
50924
- getMinimumValue(item),
50925
- getMaximumValue(item),
50926
- ]), settings.maxValue)
50927
- : getAxisRange(items, settings.maxValue, settings.axisIncrement);
50928
- const itemTextAxis = getItemTextAxis(settings);
50929
- const categoryAxis = Object.assign(Object.assign(Object.assign({}, getCategoryAxis(settings)), { axisLabel: Object.assign({ show: settings.displayItemText, color: theme.textColor }, (itemTextAxis &&
51189
+ function drawOnAxes(settings, grid, theme, itemSpace) {
51190
+ const { orientation } = settings;
51191
+ const range = getValueRange(settings, grid);
51192
+ const itemTextAxis = getItemTextAxis(settings, grid);
51193
+ const categoryAxis = Object.assign(Object.assign(Object.assign({}, getCategoryAxis(settings, grid)), { axisLabel: Object.assign({ show: settings.displayItemText, color: theme.textColor }, (itemTextAxis &&
50930
51194
  itemSpace &&
50931
51195
  getItemTextLayout(itemTextAxis, itemSpace))), axisTick: hidden, axisLine: { lineStyle: { color: theme.axisLineColor } } }), getAxisName(settings, settings.itemsLabel, theme));
50932
51196
  const valueAxis = getValueAxis(range, getAxisName(settings, settings.valuesLabel, theme), settings, theme);
50933
- const { series, seriesIndex } = getAxisSeries(settings, theme);
51197
+ const { series, seriesIndexes, partsOfSeries } = getAxisSeries(settings, grid, theme);
50934
51198
  const option = {
50935
51199
  grid: getGrid(theme),
50936
51200
  xAxis: orientation === 'landscape' ? categoryAxis : valueAxis,
50937
51201
  yAxis: orientation === 'landscape' ? valueAxis : categoryAxis,
50938
51202
  series: series,
50939
51203
  };
51204
+ const hasColumns = settings.type !== 'bar' && !settings.series;
50940
51205
  return {
50941
- seriesIndex: seriesIndex,
51206
+ seriesIndexes: seriesIndexes,
51207
+ partsOfSeries: partsOfSeries,
50942
51208
  itemsAreSeries: false,
50943
51209
  itemTextAxis: itemTextAxis,
50944
- option: settings.type === 'bar' ? option : withColumns(option, settings),
51210
+ valueRange: range,
51211
+ option: hasColumns ? withColumns(option, settings, grid) : option,
50945
51212
  };
50946
51213
  }
50947
- function getCategoryAxis(settings) {
51214
+ function getValueRange(settings, grid) {
51215
+ const items = getAxisItems(grid, Boolean(settings.stacked));
51216
+ if (settings.valueFormat === 'date') {
51217
+ return getDateRange(items.flatMap((item) => [
51218
+ getMinimumValue(item),
51219
+ getMaximumValue(item),
51220
+ ]), settings.maxValue);
51221
+ }
51222
+ return getAxisRange(items, settings.maxValue, settings.axisIncrement);
51223
+ }
51224
+ function getCategoryAxis(settings, grid) {
50948
51225
  return {
50949
51226
  type: 'category',
50950
- data: settings.items.map((item) => item.text),
51227
+ data: grid.categories,
50951
51228
  inverse: settings.orientation === 'portrait',
50952
51229
  };
50953
51230
  }
50954
- function getItemTextAxis(settings) {
50955
- if (!settings.displayItemText || settings.items.length < 2) {
51231
+ function getItemTextAxis(settings, grid) {
51232
+ if (!settings.displayItemText || grid.categories.length < 2) {
50956
51233
  return;
50957
51234
  }
50958
51235
  return settings.orientation === 'landscape' ? 'xAxis' : 'yAxis';
@@ -50961,9 +51238,9 @@ function getItemTextAxis(settings) {
50961
51238
  // column across the whole plot that shows its tooltip and takes its clicks.
50962
51239
  // The columns have axes of their own, so they are not laid out next to the
50963
51240
  // bars that draw ranges.
50964
- function withColumns(option, settings) {
51241
+ function withColumns(option, settings, grid) {
50965
51242
  const { items, orientation } = settings;
50966
- const categoryAxis = Object.assign(Object.assign({}, getCategoryAxis(settings)), { show: false });
51243
+ const categoryAxis = Object.assign(Object.assign({}, getCategoryAxis(settings, grid)), { show: false });
50967
51244
  const valueAxis = { type: 'value', min: 0, max: 1, show: false };
50968
51245
  const columns = {
50969
51246
  type: 'bar',
@@ -50978,78 +51255,140 @@ function withColumns(option, settings) {
50978
51255
  const landscape = orientation === 'landscape';
50979
51256
  return Object.assign(Object.assign({}, option), { xAxis: [option.xAxis, landscape ? categoryAxis : valueAxis], yAxis: [option.yAxis, landscape ? valueAxis : categoryAxis], series: [...option.series, columns] });
50980
51257
  }
50981
- function getAxisSeries(settings, theme) {
51258
+ function getAxisSeries(settings, grid, theme) {
51259
+ const series = [];
51260
+ const seriesIndexes = [];
51261
+ const partsOfSeries = [];
51262
+ for (const index of grid.series.keys()) {
51263
+ const drawn = drawItemSeries(settings, grid, index, theme);
51264
+ seriesIndexes.push(series.length + drawn.seriesIndex);
51265
+ series.push(...drawn.series);
51266
+ partsOfSeries.push(...drawn.series.map(() => index));
51267
+ }
51268
+ return {
51269
+ series: series,
51270
+ seriesIndexes: seriesIndexes,
51271
+ partsOfSeries: partsOfSeries,
51272
+ };
51273
+ }
51274
+ function drawItemSeries(settings, grid, index, theme) {
51275
+ const series = grid.series[index];
50982
51276
  if (settings.type === 'line' || settings.type === 'area') {
50983
- return getLineSeries(settings, theme);
51277
+ return getLineSeries(settings, series, index, theme);
50984
51278
  }
50985
51279
  if (settings.type === 'dot') {
50986
- return getDotSeries(settings, theme);
51280
+ return getDotSeries(settings, series, index, theme);
50987
51281
  }
50988
- return getBarSeries(settings, theme);
51282
+ if (settings.stacked) {
51283
+ return {
51284
+ series: [getStackedBars(settings, grid, index, theme)],
51285
+ seriesIndex: 0,
51286
+ };
51287
+ }
51288
+ return getBarSeries(settings, series, index, theme);
50989
51289
  }
50990
- function getBarSeries(settings, theme) {
50991
- const { items } = settings;
51290
+ function getStackedBars(settings, grid, index, theme) {
51291
+ const series = grid.series[index];
51292
+ return Object.assign(Object.assign({ type: 'bar' }, SERIES_STACK), { data: series.items.map((item, category) => item
51293
+ ? {
51294
+ value: getValueSpan(item),
51295
+ itemStyle: {
51296
+ color: item.color,
51297
+ borderRadius: endsStack(grid, {
51298
+ series: index,
51299
+ index: category,
51300
+ })
51301
+ ? getOuterCorners(settings, item, theme)
51302
+ : 0,
51303
+ borderColor: theme.dividerColor,
51304
+ borderWidth: 1,
51305
+ },
51306
+ }
51307
+ : null), label: Object.assign(Object.assign({}, getValueLabel(settings, series, theme)), { position: 'inside', color: undefined }), cursor: getSeriesCursor(series.items), emphasis: emphasis, blur: blur });
51308
+ }
51309
+ function getOuterCorners(settings, item, theme) {
51310
+ const [topLeft, topRight, bottomRight, bottomLeft] = theme.itemBorderRadius;
51311
+ const positive = getValueSpan(item) >= 0;
51312
+ if (settings.orientation === 'portrait') {
51313
+ return positive
51314
+ ? [0, topRight, bottomRight, 0]
51315
+ : [topLeft, 0, 0, bottomLeft];
51316
+ }
51317
+ return positive
51318
+ ? [topLeft, topRight, 0, 0]
51319
+ : [0, 0, bottomRight, bottomLeft];
51320
+ }
51321
+ function getBarSeries(settings, series, index, theme) {
51322
+ const { items } = series;
50992
51323
  const bars = {
50993
51324
  type: 'bar',
50994
- data: items.map((item) => ({
50995
- value: getValueSpan(item),
50996
- itemStyle: {
50997
- color: item.color,
50998
- borderRadius: theme.itemBorderRadius,
50999
- },
51000
- })),
51001
- label: getValueLabel(settings, theme),
51325
+ data: items.map((item) => item
51326
+ ? {
51327
+ value: getValueSpan(item),
51328
+ itemStyle: {
51329
+ color: item.color,
51330
+ borderRadius: theme.itemBorderRadius,
51331
+ },
51332
+ }
51333
+ : null),
51334
+ label: getValueLabel(settings, series, theme),
51002
51335
  cursor: getSeriesCursor(items),
51003
51336
  emphasis: emphasis,
51004
51337
  blur: blur,
51005
51338
  };
51006
- if (items.every((item) => !isRangeItem(item))) {
51339
+ if (!hasRanges(items)) {
51007
51340
  return { series: [bars], seriesIndex: 0 };
51008
51341
  }
51009
51342
  return {
51010
51343
  series: [
51011
- Object.assign(Object.assign({ type: 'bar' }, rangeBase), { data: getRangeStarts(items) }),
51012
- Object.assign(Object.assign({}, bars), stacked),
51344
+ Object.assign(Object.assign({ type: 'bar' }, getRangeBase(index)), { data: getRangeStarts(items) }),
51345
+ Object.assign(Object.assign({}, bars), getRangeStack(index)),
51013
51346
  ],
51014
51347
  seriesIndex: 1,
51015
51348
  };
51016
51349
  }
51017
- function getDotSeries(settings, theme) {
51018
- const { items, orientation } = settings;
51019
- const point = (index, value) => orientation === 'landscape' ? [index, value] : [value, index];
51350
+ function getDotSeries(settings, series, index, theme) {
51351
+ const { items } = series;
51352
+ const { orientation } = settings;
51353
+ const point = (category, value) => orientation === 'landscape' ? [category, value] : [value, category];
51020
51354
  const ends = {
51021
51355
  type: 'scatter',
51022
51356
  symbolSize: DOT_SIZE,
51023
- data: items.map((item, index) => ({
51024
- value: point(index, getMaximumValue(item)),
51025
- itemStyle: { color: item.color },
51026
- })),
51027
- label: getValueLabel(settings, theme),
51357
+ data: items.map((item, category) => item
51358
+ ? {
51359
+ value: point(category, getMaximumValue(item)),
51360
+ itemStyle: { color: item.color },
51361
+ }
51362
+ : null),
51363
+ label: getValueLabel(settings, series, theme),
51028
51364
  cursor: getSeriesCursor(items),
51029
51365
  emphasis: emphasis,
51030
51366
  blur: blur,
51031
51367
  };
51032
- if (items.every((item) => !isRangeItem(item))) {
51368
+ if (!hasRanges(items)) {
51033
51369
  return { series: [ends], seriesIndex: 0 };
51034
51370
  }
51035
- const connectors = Object.assign(Object.assign({ type: 'bar' }, stacked), { silent: true, barWidth: CONNECTOR_WIDTH, data: items.map((item) => ({
51036
- value: isRangeItem(item) ? getValueSpan(item) : null,
51037
- itemStyle: { color: item.color },
51038
- })) });
51371
+ const connectors = Object.assign(Object.assign({ type: 'bar' }, getRangeStack(index)), { cursor: getSeriesCursor(items), emphasis: { disabled: true }, barWidth: CONNECTOR_WIDTH, barGap: '-100%', data: items.map((item) => item && isRangeItem(item)
51372
+ ? {
51373
+ value: getValueSpan(item),
51374
+ itemStyle: { color: item.color },
51375
+ }
51376
+ : null) });
51039
51377
  const starts = {
51040
51378
  type: 'scatter',
51041
- silent: true,
51379
+ cursor: getSeriesCursor(items),
51380
+ emphasis: { disabled: true },
51042
51381
  symbolSize: DOT_SIZE,
51043
- data: items.map((item, index) => ({
51044
- value: isRangeItem(item)
51045
- ? point(index, getMinimumValue(item))
51046
- : [null, null],
51047
- itemStyle: { color: item.color },
51048
- })),
51382
+ data: items.map((item, category) => item && isRangeItem(item)
51383
+ ? {
51384
+ value: point(category, getMinimumValue(item)),
51385
+ itemStyle: { color: item.color },
51386
+ }
51387
+ : null),
51049
51388
  };
51050
51389
  return {
51051
51390
  series: [
51052
- Object.assign(Object.assign({ type: 'bar' }, rangeBase), { data: getRangeStarts(items) }),
51391
+ Object.assign(Object.assign({ type: 'bar' }, getRangeBase(index)), { barGap: '-100%', data: getRangeStarts(items) }),
51053
51392
  connectors,
51054
51393
  starts,
51055
51394
  ends,
@@ -51057,38 +51396,63 @@ function getDotSeries(settings, theme) {
51057
51396
  seriesIndex: 3,
51058
51397
  };
51059
51398
  }
51060
- function getLineSeries(settings, theme) {
51061
- const { items } = settings;
51062
- const color = theme.lineColor;
51399
+ function getLineSeries(settings, series, index, theme) {
51400
+ var _a;
51401
+ const { items } = series;
51402
+ const color = (_a = series.color) !== null && _a !== void 0 ? _a : theme.lineColor;
51063
51403
  const area = settings.type === 'area';
51064
- const line = {
51065
- type: 'line',
51066
- color: color,
51067
- symbol: 'circle',
51068
- symbolSize: LINE_DOT_SIZE,
51069
- data: items.map((item) => ({
51070
- value: getValueSpan(item),
51071
- itemStyle: { color: item.color },
51072
- })),
51073
- areaStyle: area ? { color: color, opacity: AREA_OPACITY } : undefined,
51074
- label: getValueLabel(settings, theme),
51075
- cursor: getSeriesCursor(items),
51076
- emphasis: emphasis,
51077
- blur: blur,
51078
- };
51079
- if (items.every((item) => !isRangeItem(item))) {
51404
+ const line = Object.assign(Object.assign({ type: 'line', color: color, symbol: 'circle', symbolSize: LINE_DOT_SIZE }, (settings.series &&
51405
+ hasClickableItems(items) && {
51406
+ showAllSymbol: true,
51407
+ labelLayout: { hideOverlap: true },
51408
+ })), { data: items.map((item) => item
51409
+ ? {
51410
+ value: getValueSpan(item),
51411
+ itemStyle: { color: item.color },
51412
+ }
51413
+ : null), areaStyle: area
51414
+ ? { color: color, opacity: getAreaOpacity(settings) }
51415
+ : undefined, label: getValueLabel(settings, series, theme), cursor: getSeriesCursor(items), emphasis: emphasis, blur: blur });
51416
+ if (settings.stacked) {
51417
+ return { series: [Object.assign(Object.assign({}, line), SERIES_STACK)], seriesIndex: 0 };
51418
+ }
51419
+ if (!hasRanges(items)) {
51080
51420
  return { series: [line], seriesIndex: 0 };
51081
51421
  }
51082
- const base = Object.assign(Object.assign({ type: 'line' }, rangeBase), { symbol: 'none', color: color, lineStyle: { opacity: area ? 0 : 1 }, data: getRangeStarts(items) });
51083
- return { series: [base, Object.assign(Object.assign({}, line), stacked)], seriesIndex: 1 };
51422
+ const base = Object.assign(Object.assign({ type: 'line' }, getRangeBase(index)), { symbol: 'none', color: color, lineStyle: { opacity: area ? 0 : 1 }, data: getRangeStarts(items) });
51423
+ return {
51424
+ series: [base, Object.assign(Object.assign({}, line), getRangeStack(index))],
51425
+ seriesIndex: 1,
51426
+ };
51427
+ }
51428
+ function getAreaOpacity(settings) {
51429
+ var _a;
51430
+ return ((_a = settings.series) === null || _a === void 0 ? void 0 : _a.length) > 1 && !settings.stacked
51431
+ ? SERIES_AREA_OPACITY
51432
+ : AREA_OPACITY;
51433
+ }
51434
+ function hasClickableItems(items) {
51435
+ return items.some((item) => item === null || item === void 0 ? void 0 : item.clickable);
51436
+ }
51437
+ function hasRanges(items) {
51438
+ return items.some((item) => item && isRangeItem(item));
51084
51439
  }
51085
- const stacked = { stack: 'range', stackStrategy: 'all' };
51086
51440
  // A range is drawn as a stack of an invisible part from zero to its start,
51087
51441
  // and a visible part from its start to its end. Items that are not ranges
51088
- // start at zero.
51089
- const rangeBase = Object.assign(Object.assign({}, stacked), { silent: true, tooltip: hidden, emphasis: { disabled: true }, itemStyle: { color: 'transparent' } });
51442
+ // start at zero. Each series has a stack of its own.
51443
+ function getRangeStack(index) {
51444
+ return { stack: `range${index}`, stackStrategy: 'all' };
51445
+ }
51446
+ function getRangeBase(index) {
51447
+ return Object.assign(Object.assign({}, getRangeStack(index)), { silent: true, tooltip: hidden, emphasis: { disabled: true }, itemStyle: { color: 'transparent' } });
51448
+ }
51090
51449
  function getRangeStarts(items) {
51091
- return items.map((item) => (isRangeItem(item) ? getMinimumValue(item) : 0));
51450
+ return items.map((item) => {
51451
+ if (!item) {
51452
+ return null;
51453
+ }
51454
+ return isRangeItem(item) ? getMinimumValue(item) : 0;
51455
+ });
51092
51456
  }
51093
51457
  function drawScatter(settings, theme) {
51094
51458
  const { items } = settings;
@@ -51118,7 +51482,7 @@ function drawScatter(settings, theme) {
51118
51482
  blur: blur,
51119
51483
  };
51120
51484
  return {
51121
- seriesIndex: 0,
51485
+ seriesIndexes: [0],
51122
51486
  itemsAreSeries: false,
51123
51487
  option: {
51124
51488
  grid: getGrid(theme),
@@ -51147,7 +51511,7 @@ function drawPie(settings, theme) {
51147
51511
  }
51148
51512
  const innerRadius = settings.type === 'doughnut' ? '50%' : 0;
51149
51513
  return {
51150
- seriesIndex: 0,
51514
+ seriesIndexes: [0],
51151
51515
  itemsAreSeries: false,
51152
51516
  option: {
51153
51517
  series: [
@@ -51182,7 +51546,7 @@ function drawProportionBar(settings, theme) {
51182
51546
  const categoryAxis = { type: 'category', data: [''], show: false };
51183
51547
  const landscape = settings.orientation === 'landscape';
51184
51548
  return {
51185
- seriesIndex: 0,
51549
+ seriesIndexes: [0],
51186
51550
  itemsAreSeries: true,
51187
51551
  option: {
51188
51552
  backgroundColor: theme.backgroundColor,
@@ -51211,7 +51575,7 @@ function drawRing(settings, theme) {
51211
51575
  const { items } = settings;
51212
51576
  const whole = getWholeRange(items, settings.maxValue).totalRange;
51213
51577
  return {
51214
- seriesIndex: 0,
51578
+ seriesIndexes: [0],
51215
51579
  itemsAreSeries: false,
51216
51580
  option: {
51217
51581
  polar: { radius: ['20%', '90%'] },
@@ -51248,7 +51612,7 @@ function drawRing(settings, theme) {
51248
51612
  function drawNps(settings, theme) {
51249
51613
  const { items } = settings;
51250
51614
  return {
51251
- seriesIndex: 0,
51615
+ seriesIndexes: [0],
51252
51616
  itemsAreSeries: false,
51253
51617
  option: {
51254
51618
  series: [
@@ -51337,8 +51701,8 @@ function getAxisName(settings, name, theme) {
51337
51701
  nameTextStyle: { color: theme.textColor },
51338
51702
  };
51339
51703
  }
51340
- function getValueLabel(settings, theme) {
51341
- return Object.assign(Object.assign({ show: settings.displayItemValue, position: settings.orientation === 'landscape' ? 'top' : 'right' }, getLabelStyle(theme)), { formatter: ({ dataIndex }) => formatValue(settings.items[dataIndex], settings) });
51704
+ function getValueLabel(settings, series, theme) {
51705
+ return Object.assign(Object.assign({ show: settings.displayItemValue, position: settings.orientation === 'landscape' ? 'top' : 'right' }, getLabelStyle(theme)), { formatter: ({ dataIndex }) => formatValue(series.items[dataIndex], settings) });
51342
51706
  }
51343
51707
  function getLabelStyle(theme) {
51344
51708
  return { color: theme.textColor, textBorderWidth: 0 };
@@ -51354,7 +51718,7 @@ function getPointLabel(settings, item) {
51354
51718
  return parts.join(' ');
51355
51719
  }
51356
51720
  function getSeriesCursor(items) {
51357
- return getCursor(items.some((item) => item.clickable));
51721
+ return getCursor(hasClickableItems(items));
51358
51722
  }
51359
51723
  function getCursor(clickable) {
51360
51724
  return clickable ? 'pointer' : 'default';
@@ -51506,9 +51870,18 @@ function paintToRgba(context, color) {
51506
51870
  return `rgba(${red}, ${green}, ${blue}, ${alpha / MAX_CHANNEL})`;
51507
51871
  }
51508
51872
 
51509
- const chartCss = () => `@charset "UTF-8";:host(limel-chart){--limel-chart-item-color:var( --chart-item-color, rgb(var(--contrast-1100), 0.8) );--limel-chart-axis-line-color:var( --chart-axis-line-color, rgb(var(--contrast-900), 0.4) );--limel-chart-background-color:var(--chart-background-color, transparent);--limel-chart-item-divider-color:var( --chart-item-divider-color, rgb(var(--contrast-100), 0.6) );--limel-chart-item-border-radius:var(--chart-item-border-radius, 0);--limel-chart-scatter-item-size:var(--chart-scatter-item-size, 0.5rem);--limel-chart-text-color:rgb(var(--contrast-1000));--limel-chart-line-color:rgb(var(--contrast-900));--limel-chart-surface-color:rgb(var(--contrast-100));--limel-chart-nps-detractors-color:rgb(var(--color-coral-default));--limel-chart-nps-passives-color:rgb(var(--color-amber-light));--limel-chart-nps-good-color:rgb(var(--color-lime-light));--limel-chart-nps-excellent-color:rgb(var(--color-lime-default));box-sizing:border-box;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}:host(limel-chart[type=bar]){--limel-chart-item-border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=proportion-bar]),:host(limel-chart[type=stacked-bar]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-800), 0.2) )}:host(limel-chart[type=proportion-bar][orientation=landscape]),:host(limel-chart[type=proportion-bar][orientation=landscape]) .plot,:host(limel-chart[type=stacked-bar][orientation=landscape]),:host(limel-chart[type=stacked-bar][orientation=landscape]) .plot{min-height:0.5rem}:host(limel-chart[type=proportion-bar][orientation=portrait]),:host(limel-chart[type=proportion-bar][orientation=portrait]) .plot,:host(limel-chart[type=stacked-bar][orientation=portrait]),:host(limel-chart[type=stacked-bar][orientation=portrait]) .plot{min-width:0.5rem}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-200)) )}:host(limel-chart[type=nps]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-100)) )}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]),:host(limel-chart[type=nps]){aspect-ratio:1}:host(limel-chart[type=bar][data-fallback-height]),:host(limel-chart[type=dot][data-fallback-height]),:host(limel-chart[type=line][data-fallback-height]),:host(limel-chart[type=area][data-fallback-height]),:host(limel-chart[type=scatter][data-fallback-height]){aspect-ratio:2}.plot{flex-grow:1;contain:size}:host(limel-chart[type=proportion-bar]) .plot,:host(limel-chart[type=stacked-bar]) .plot{border-radius:0.25rem;overflow:hidden}table{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}limel-spinner{margin:auto}`;
51873
+ const chartCss = () => `@charset "UTF-8";:host(limel-chart){--limel-chart-item-color:var( --chart-item-color, rgb(var(--contrast-1100), 0.8) );--limel-chart-axis-line-color:var( --chart-axis-line-color, rgb(var(--contrast-900), 0.4) );--limel-chart-background-color:var(--chart-background-color, transparent);--limel-chart-item-divider-color:var( --chart-item-divider-color, rgb(var(--contrast-100), 0.6) );--limel-chart-item-border-radius:var(--chart-item-border-radius, 0);--limel-chart-scatter-item-size:var(--chart-scatter-item-size, 0.5rem);--limel-chart-text-color:rgb(var(--contrast-1000));--limel-chart-line-color:rgb(var(--contrast-900));--limel-chart-surface-color:rgb(var(--contrast-100));--limel-chart-nps-detractors-color:rgb(var(--color-coral-default));--limel-chart-nps-passives-color:rgb(var(--color-amber-light));--limel-chart-nps-good-color:rgb(var(--color-lime-light));--limel-chart-nps-excellent-color:rgb(var(--color-lime-default));--limel-chart-series-color-1:rgb(var(--color-blue-default));--limel-chart-series-color-2:rgb(var(--color-coral-default));--limel-chart-series-color-3:rgb(var(--color-teal-default));--limel-chart-series-color-4:rgb(var(--color-amber-default));--limel-chart-series-color-5:rgb(var(--color-magenta-default));--limel-chart-series-color-6:rgb(var(--color-green-default));--limel-chart-series-color-7:rgb(var(--color-violet-default));--limel-chart-series-color-8:rgb(var(--color-red-default));box-sizing:border-box;position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0}:host(limel-chart[type=bar]){--limel-chart-item-border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=proportion-bar]),:host(limel-chart[type=stacked-bar]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-800), 0.2) )}:host(limel-chart[type=proportion-bar][orientation=landscape]),:host(limel-chart[type=proportion-bar][orientation=landscape]) .plot,:host(limel-chart[type=stacked-bar][orientation=landscape]),:host(limel-chart[type=stacked-bar][orientation=landscape]) .plot{min-height:0.5rem}:host(limel-chart[type=proportion-bar][orientation=portrait]),:host(limel-chart[type=proportion-bar][orientation=portrait]) .plot,:host(limel-chart[type=stacked-bar][orientation=portrait]),:host(limel-chart[type=stacked-bar][orientation=portrait]) .plot{min-width:0.5rem}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-200)) )}:host(limel-chart[type=nps]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-100)) )}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]),:host(limel-chart[type=nps]){aspect-ratio:1}:host(limel-chart[type=bar][data-fallback-height]),:host(limel-chart[type=dot][data-fallback-height]),:host(limel-chart[type=line][data-fallback-height]),:host(limel-chart[type=area][data-fallback-height]),:host(limel-chart[type=scatter][data-fallback-height]){aspect-ratio:2}.plot{flex-grow:1;contain:size}ul{display:flex;flex-wrap:wrap;gap:0.25rem 0.875rem;margin:0 0 0.5rem 0;padding:0;list-style:none;font-size:0.75rem;color:rgb(var(--contrast-1100))}li{display:inline-flex;align-items:center;gap:0.375rem}li>span{flex-shrink:0}:host(limel-chart[type=proportion-bar]) .plot,:host(limel-chart[type=stacked-bar]) .plot{border-radius:0.25rem;overflow:hidden}table{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}limel-spinner{margin:auto}`;
51510
51874
 
51511
51875
  const orientations = ['horizontal', 'vertical'];
51876
+ const SERIES_COLOR_COUNT = 8;
51877
+ const getDefaultSeriesColor = (index) => `var(--limel-chart-series-color-${(index % SERIES_COLOR_COUNT) + 1})`;
51878
+ const copyItem = (item) => ({
51879
+ text: item.text,
51880
+ value: item.value,
51881
+ formattedValue: item.formattedValue,
51882
+ color: item.color,
51883
+ clickable: item.clickable,
51884
+ });
51512
51885
  const extensions = [
51513
51886
  install$9,
51514
51887
  install$5,
@@ -51555,6 +51928,15 @@ const Chart = class {
51555
51928
  * Applies to `proportion-bar`, `pie`, `doughnut`, and `ring` charts.
51556
51929
  */
51557
51930
  this.displayItemPercentage = true;
51931
+ /**
51932
+ * Stacks the `series` on each other, so that each place on the axis
51933
+ * shows their total, such as the revenue of each product, which adds up
51934
+ * to the revenue of the month. Positive and negative values are stacked
51935
+ * on their own side of zero, and a range adds its extent to the stack.
51936
+ * Applies to `bar`, `line`, and `area` charts, but not when
51937
+ * `valueFormat` is `date`.
51938
+ */
51939
+ this.stacked = false;
51558
51940
  /**
51559
51941
  * Defines how items are visualized in the chart.
51560
51942
  * `stacked-bar` is the old name of `proportion-bar`. It still works, but
@@ -51583,7 +51965,9 @@ const Chart = class {
51583
51965
  /**
51584
51966
  * The item that last had focus, which is the one that Tab returns to.
51585
51967
  */
51586
- this.focusedIndex = 0;
51968
+ this.focusedPosition = { series: 0, index: 0 };
51969
+ this.grid = { categories: [], series: [] };
51970
+ this.seriesColors = [];
51587
51971
  this.themeMayHaveChanged = false;
51588
51972
  this.warnings = new Map();
51589
51973
  this.invalidColors = new Set();
@@ -51602,7 +51986,7 @@ const Chart = class {
51602
51986
  if (!this.drawing) {
51603
51987
  return;
51604
51988
  }
51605
- const item = this.getClickableItem(getItemIndex(this.drawing, event));
51989
+ const item = this.getClickableItem(this.getClickedPosition(event));
51606
51990
  if (!item) {
51607
51991
  return;
51608
51992
  }
@@ -51616,7 +52000,7 @@ const Chart = class {
51616
52000
  this.highlightItemAt(event, false);
51617
52001
  };
51618
52002
  this.handleClick = (event) => {
51619
- const item = this.getClickableItem(this.getRowIndex(event));
52003
+ const item = this.getClickableItem(this.getEventPosition(event));
51620
52004
  if (!item) {
51621
52005
  return;
51622
52006
  }
@@ -51627,13 +52011,13 @@ const Chart = class {
51627
52011
  const orientation = orientations.find((option) => keyboardNavigation.isNavigationKey(event, { orientation: option }));
51628
52012
  if (orientation) {
51629
52013
  event.preventDefault();
51630
- this.focusItem(keyboardNavigation.findNavigationTarget(this.items, event.key, this.getRowIndex(event), { orientation: orientation }));
52014
+ this.focusItem(this.findTarget(event.key, this.getEventPosition(event), orientation));
51631
52015
  return;
51632
52016
  }
51633
52017
  if (event.key !== 'Enter' && event.key !== ' ') {
51634
52018
  return;
51635
52019
  }
51636
- const item = this.getClickableItem(this.getRowIndex(event));
52020
+ const item = this.getClickableItem(this.getEventPosition(event));
51637
52021
  if (!item) {
51638
52022
  return;
51639
52023
  }
@@ -51641,9 +52025,9 @@ const Chart = class {
51641
52025
  this.interact.emit(item);
51642
52026
  };
51643
52027
  this.handleFocus = (event) => {
51644
- const row = event.currentTarget;
51645
- this.focusedIndex = Number(row.dataset.index);
51646
- this.showItem(row, true);
52028
+ const element = event.currentTarget;
52029
+ this.focusedPosition = this.getPosition(element);
52030
+ this.showItem(element, true);
51647
52031
  };
51648
52032
  this.handleBlur = (event) => {
51649
52033
  this.showItem(event.currentTarget, false);
@@ -51653,10 +52037,17 @@ const Chart = class {
51653
52037
  this.warnAboutOldTypeName();
51654
52038
  }
51655
52039
  componentWillRender() {
52040
+ this.grid = getSeriesGrid({
52041
+ type: this.chartType,
52042
+ items: this.items,
52043
+ series: this.series,
52044
+ });
51656
52045
  this.warnOnChange('axisIncrement', this.getAxisIncrementWarning());
51657
52046
  this.warnOnChange('language', this.getLanguageWarning());
51658
52047
  this.warnOnChange('currency', this.getCurrencyWarning());
51659
52048
  this.warnOnChange('items', this.getDateWarning());
52049
+ this.warnOnChange('series', this.getSeriesWarning());
52050
+ this.warnOnChange('stacked', this.getStackedWarning());
51660
52051
  }
51661
52052
  connectedCallback() {
51662
52053
  this.draw();
@@ -51698,11 +52089,10 @@ const Chart = class {
51698
52089
  return `limel-chart: \`currency\` must be a three-letter code such as \`SEK\` when \`valueFormat\` is \`currency\`, but was ${JSON.stringify(this.currency)}. Writing the values as numbers instead.`;
51699
52090
  }
51700
52091
  getDateWarning() {
51701
- var _a;
51702
52092
  if (this.valueFormat !== 'date') {
51703
52093
  return;
51704
52094
  }
51705
- const wrong = ((_a = this.items) !== null && _a !== void 0 ? _a : [])
52095
+ const wrong = getAllItems(this.grid)
51706
52096
  .flatMap((item) => [item.value].flat())
51707
52097
  .find((value) => !isDate(value));
51708
52098
  if (wrong === undefined) {
@@ -51711,6 +52101,56 @@ const Chart = class {
51711
52101
  const shown = typeof wrong === 'number' ? wrong : JSON.stringify(wrong);
51712
52102
  return `limel-chart: with \`valueFormat\` \`date\`, each value must be a date in milliseconds since 1970, as \`Date.getTime()\` gives, but was ${shown}. Showing it as it is.`;
51713
52103
  }
52104
+ getSeriesWarning() {
52105
+ var _a, _b, _c;
52106
+ if (!((_a = this.series) === null || _a === void 0 ? void 0 : _a.length)) {
52107
+ return;
52108
+ }
52109
+ if (!canDrawSeries(this.chartType)) {
52110
+ const drawn = ((_b = this.items) === null || _b === void 0 ? void 0 : _b.length)
52111
+ ? '`items`'
52112
+ : 'the items of the first series';
52113
+ return `limel-chart: \`series\` can only be drawn by \`bar\`, \`dot\`, \`line\`, and \`area\` charts, but \`type\` is \`${this.type}\`. Drawing ${drawn} instead.`;
52114
+ }
52115
+ if ((_c = this.items) === null || _c === void 0 ? void 0 : _c.length) {
52116
+ return 'limel-chart: both `items` and `series` are set. Drawing `series`, and leaving out `items`.';
52117
+ }
52118
+ }
52119
+ getStackedWarning() {
52120
+ if (!this.stacked) {
52121
+ return;
52122
+ }
52123
+ if (!canStack(this.chartType)) {
52124
+ return `limel-chart: \`stacked\` can only stack the series of \`bar\`, \`line\`, and \`area\` charts, but \`type\` is \`${this.type}\`. Ignoring \`stacked\`.`;
52125
+ }
52126
+ if (this.valueFormat === 'date') {
52127
+ return 'limel-chart: `stacked` cannot stack dates. Ignoring `stacked`.';
52128
+ }
52129
+ if (!this.drawsSeries) {
52130
+ return 'limel-chart: `stacked` stacks the `series` of a chart, but this chart has none. Ignoring `stacked`.';
52131
+ }
52132
+ }
52133
+ get stacksSeries() {
52134
+ return isStacked({
52135
+ type: this.chartType,
52136
+ series: this.series,
52137
+ stacked: this.stacked,
52138
+ valueFormat: this.valueFormat,
52139
+ });
52140
+ }
52141
+ get drawsSeries() {
52142
+ return Boolean(this.drawnSeries);
52143
+ }
52144
+ get drawnSeries() {
52145
+ return getDrawnSeries({ type: this.chartType, series: this.series });
52146
+ }
52147
+ get drawnItems() {
52148
+ return getDrawnItems({
52149
+ type: this.chartType,
52150
+ items: this.items,
52151
+ series: this.series,
52152
+ });
52153
+ }
51714
52154
  get valueStyle() {
51715
52155
  return {
51716
52156
  type: this.chartType,
@@ -51723,7 +52163,6 @@ const Chart = class {
51723
52163
  return this.type === 'stacked-bar' ? 'proportion-bar' : this.type;
51724
52164
  }
51725
52165
  getAxisIncrementWarning() {
51726
- var _a;
51727
52166
  const increment = this.axisIncrement;
51728
52167
  if (increment === undefined ||
51729
52168
  increment === null ||
@@ -51736,7 +52175,7 @@ const Chart = class {
51736
52175
  if (!usesAxisIncrement(this.chartType)) {
51737
52176
  return;
51738
52177
  }
51739
- const range = getAxisRange((_a = this.items) !== null && _a !== void 0 ? _a : [], this.maxValue, increment);
52178
+ const range = getAxisRange(getAxisItems(this.grid, this.stacksSeries), this.maxValue, increment);
51740
52179
  if (range.increment !== increment) {
51741
52180
  return `limel-chart: \`axisIncrement\` ${increment} would divide the axis into more than ${MAX_AXIS_STEPS} steps. Working out a step from the values instead.`;
51742
52181
  }
@@ -51745,7 +52184,19 @@ const Chart = class {
51745
52184
  if (this.loading) {
51746
52185
  return index.h("limel-spinner", { limeBranded: false });
51747
52186
  }
51748
- return (index.h(index.Host, null, index.h("div", { class: "plot", "aria-hidden": "true", ref: this.setPlot }), index.h("table", { "aria-live": "polite" }, this.renderCaption(), this.renderTableHeader(), index.h("tbody", null, this.renderItems()))));
52187
+ return (index.h(index.Host, null, this.renderLegend(), index.h("div", { class: "plot", "aria-hidden": "true", ref: this.setPlot }), index.h("table", { "aria-live": "polite" }, this.renderCaption(), this.renderTableHeader(), index.h("tbody", null, this.drawsSeries
52188
+ ? this.renderCategories()
52189
+ : this.renderItems()))));
52190
+ }
52191
+ get hasLegend() {
52192
+ var _a, _b;
52193
+ return ((_b = (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1;
52194
+ }
52195
+ renderLegend() {
52196
+ if (!this.hasLegend) {
52197
+ return;
52198
+ }
52199
+ return (index.h("ul", { "aria-hidden": "true" }, this.drawnSeries.map((series, index$1) => (index.h("li", null, index.h("span", { style: getSwatchStyle(this.chartType, this.seriesColors[index$1]) }), series.text)))));
51749
52200
  }
51750
52201
  renderCaption() {
51751
52202
  if (!this.accessibleLabel) {
@@ -51754,7 +52205,18 @@ const Chart = class {
51754
52205
  return index.h("caption", null, this.accessibleLabel);
51755
52206
  }
51756
52207
  renderTableHeader() {
51757
- return (index.h("thead", null, index.h("tr", null, index.h("th", { scope: "col" }, this.itemsLabel), index.h("th", { scope: "col" }, this.valuesLabel))));
52208
+ var _a, _b;
52209
+ const columns = (_b = (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.map((series) => series.text)) !== null && _b !== void 0 ? _b : [
52210
+ this.valuesLabel,
52211
+ ];
52212
+ return (index.h("thead", null, this.renderSeriesGroupHeader(), index.h("tr", null, index.h("th", { scope: "col" }, this.itemsLabel), columns.map((column) => (index.h("th", { scope: "col" }, column))))));
52213
+ }
52214
+ renderSeriesGroupHeader() {
52215
+ const allSeries = this.drawnSeries;
52216
+ if (!allSeries || !this.accessibleValuesLabel) {
52217
+ return;
52218
+ }
52219
+ return (index.h("tr", null, index.h("td", null), index.h("th", { scope: "col", colSpan: allSeries.length }, this.accessibleValuesLabel)));
51758
52220
  }
51759
52221
  get itemsLabel() {
51760
52222
  var _a;
@@ -51765,13 +52227,46 @@ const Chart = class {
51765
52227
  return ((_a = this.accessibleValuesLabel) !== null && _a !== void 0 ? _a : translations.translations.get('value', this.language));
51766
52228
  }
51767
52229
  renderItems() {
51768
- var _a, _b;
51769
- const tabStop = keyboardNavigation.findTabStop((_a = this.items) !== null && _a !== void 0 ? _a : [], this.focusedIndex);
51770
- return (_b = this.items) === null || _b === void 0 ? void 0 : _b.map((item, index$1) => (index.h("tr", { "data-index": index$1, "aria-description": this.getRowDescription(index$1), tabIndex: index$1 === tabStop ? 0 : -1, role: item.clickable ? 'button' : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, index.h("td", null, item.text), index.h("td", null, formatValue(item, this.valueStyle)))));
52230
+ const items = this.drawnItems;
52231
+ const tabStop = keyboardNavigation.findTabStop(items, this.focusedPosition.index);
52232
+ return items.map((item, index$1) => (index.h("tr", { "data-index": index$1, "aria-description": this.getRowDescription(index$1), tabIndex: index$1 === tabStop ? 0 : -1, role: item.clickable ? 'button' : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, index.h("td", null, item.text), index.h("td", null, formatValue(item, this.valueStyle)))));
51771
52233
  }
51772
52234
  getRowDescription(index) {
51773
- const label = getItemLabel(Object.assign(Object.assign({}, this.valueStyle), { items: this.items, maxValue: this.maxValue, displayItemPercentage: this.displayItemPercentage }), index);
51774
- return label === this.items[index].text ? undefined : label;
52235
+ const items = this.drawnItems;
52236
+ const label = getItemLabel(Object.assign(Object.assign({}, this.valueStyle), { items: items, maxValue: this.maxValue, displayItemPercentage: this.displayItemPercentage }), index);
52237
+ return label === items[index].text ? undefined : label;
52238
+ }
52239
+ renderCategories() {
52240
+ const grid = this.grid;
52241
+ const tabStop = this.findTabStopInGrid(grid);
52242
+ return grid.categories.map((category, index$1) => (index.h("tr", null, index.h("th", { scope: "row" }, category), grid.series.map((series, seriesIndex) => this.renderCell(series.items[index$1], { series: seriesIndex, index: index$1 }, tabStop)))));
52243
+ }
52244
+ renderCell(item, position, tabStop) {
52245
+ if (!item) {
52246
+ return index.h("td", null);
52247
+ }
52248
+ const isTabStop = position.series === (tabStop === null || tabStop === void 0 ? void 0 : tabStop.series) &&
52249
+ position.index === (tabStop === null || tabStop === void 0 ? void 0 : tabStop.index);
52250
+ return (index.h("td", { "data-series": position.series, "data-index": position.index, tabIndex: isTabStop ? 0 : -1, role: item.clickable ? 'button' : undefined, "aria-label": item.clickable ? this.getButtonLabel(item, position) : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, formatValue(item, this.valueStyle)));
52251
+ }
52252
+ getButtonLabel(item, position) {
52253
+ return [
52254
+ this.grid.categories[position.index],
52255
+ this.grid.series[position.series].text,
52256
+ formatValue(item, this.valueStyle),
52257
+ ].join(', ');
52258
+ }
52259
+ findTabStopInGrid(grid) {
52260
+ const focused = this.focusedPosition;
52261
+ if (getItemAt(grid, focused)) {
52262
+ return focused;
52263
+ }
52264
+ const first = { series: 0, index: 0 };
52265
+ const series = getNearestSeries(grid, first);
52266
+ if (series === undefined) {
52267
+ return;
52268
+ }
52269
+ return Object.assign(Object.assign({}, first), { series: series });
51775
52270
  }
51776
52271
  draw() {
51777
52272
  var _a;
@@ -51848,20 +52343,23 @@ const Chart = class {
51848
52343
  this.chart.on('mouseout', this.handleChartOut);
51849
52344
  }
51850
52345
  updateChart() {
51851
- var _a, _b;
52346
+ var _a, _b, _c, _d;
51852
52347
  const settings = this.getSettings();
51853
52348
  const drawnSettings = JSON.stringify(settings);
51854
52349
  if (drawnSettings === this.drawnSettings && !this.themeMayHaveChanged) {
51855
52350
  return;
51856
52351
  }
51857
52352
  this.themeMayHaveChanged = false;
51858
- (_a = this.themeReader) !== null && _a !== void 0 ? _a : (this.themeReader = createThemeReader(this.host.shadowRoot));
51859
- (_b = this.stopWatchingTheme) !== null && _b !== void 0 ? _b : (this.stopWatchingTheme = watchTheme(this.host, this.handleThemeChange));
51860
- const theme = this.themeReader.theme();
52353
+ (_a = this.stopWatchingTheme) !== null && _a !== void 0 ? _a : (this.stopWatchingTheme = watchTheme(this.host, this.handleThemeChange));
52354
+ const theme = this.getThemeReader().theme();
51861
52355
  const coloredSettings = this.withItemColors(settings, theme);
51862
52356
  const drawnTheme = JSON.stringify({
51863
52357
  theme: theme,
51864
52358
  itemColors: coloredSettings.items.map((item) => item.color),
52359
+ seriesColors: (_b = coloredSettings.series) === null || _b === void 0 ? void 0 : _b.map((series) => [
52360
+ series.color,
52361
+ ...series.items.map((item) => item.color),
52362
+ ]),
51865
52363
  });
51866
52364
  if (drawnSettings === this.drawnSettings &&
51867
52365
  drawnTheme === this.drawnTheme) {
@@ -51871,9 +52369,10 @@ const Chart = class {
51871
52369
  this.drawnTheme = drawnTheme;
51872
52370
  this.drawing = drawChart(coloredSettings, theme, this.itemSpace);
51873
52371
  this.chart.setOption(this.drawing.option, { notMerge: true });
51874
- const focusedRow = this.host.shadowRoot.activeElement;
51875
- if (focusedRow instanceof HTMLElement && focusedRow.dataset.index) {
51876
- this.showItem(focusedRow, true);
52372
+ this.showSeriesColors((_d = (_c = coloredSettings.series) === null || _c === void 0 ? void 0 : _c.map((series) => series.color)) !== null && _d !== void 0 ? _d : []);
52373
+ const focused = this.host.shadowRoot.activeElement;
52374
+ if (focused instanceof HTMLElement && focused.dataset.index) {
52375
+ this.showItem(focused, true);
51877
52376
  }
51878
52377
  }
51879
52378
  fitItemTextsToSize() {
@@ -51893,33 +52392,74 @@ const Chart = class {
51893
52392
  }
51894
52393
  getSettings() {
51895
52394
  var _a;
51896
- return Object.assign(Object.assign({ items: ((_a = this.items) !== null && _a !== void 0 ? _a : []).map((item) => ({
51897
- text: item.text,
51898
- value: item.value,
51899
- formattedValue: item.formattedValue,
51900
- color: item.color,
51901
- clickable: item.clickable,
51902
- })) }, this.valueStyle), { orientation: this.orientation, maxValue: this.maxValue, axisIncrement: this.axisIncrement, displayAxisLabels: this.displayAxisLabels, itemsLabel: this.itemsLabel, valuesLabel: this.valuesLabel, displayItemText: this.displayItemText, displayItemValue: this.displayItemValue, displayItemPercentage: this.displayItemPercentage });
52395
+ return Object.assign(Object.assign({ items: this.drawnItems.map((item) => copyItem(item)), series: (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.map((series) => {
52396
+ var _a;
52397
+ return ({
52398
+ text: series.text,
52399
+ color: series.color,
52400
+ items: ((_a = series.items) !== null && _a !== void 0 ? _a : []).map((item) => copyItem(item)),
52401
+ });
52402
+ }), stacked: this.stacksSeries }, this.valueStyle), { orientation: this.orientation, maxValue: this.maxValue, axisIncrement: this.axisIncrement, displayAxisLabels: this.displayAxisLabels, itemsLabel: this.itemsLabel, valuesLabel: this.valuesLabel, displayItemText: this.displayItemText, displayItemValue: this.displayItemValue, displayItemPercentage: this.displayItemPercentage });
51903
52403
  }
51904
52404
  withItemColors(settings, theme) {
51905
- return Object.assign(Object.assign({}, settings), { items: settings.items.map((item) => (Object.assign(Object.assign({}, item), { color: this.getItemColor(item, theme) }))) });
52405
+ var _a;
52406
+ const seriesOfItems = getSeriesOfDrawnItems({
52407
+ type: this.chartType,
52408
+ items: this.items,
52409
+ series: this.series,
52410
+ });
52411
+ const itemColor = seriesOfItems
52412
+ ? this.getSeriesColor(seriesOfItems, 0, theme)
52413
+ : theme.itemColor;
52414
+ const itemFallback = seriesOfItems
52415
+ ? 'the color of its series'
52416
+ : 'the default item color';
52417
+ return Object.assign(Object.assign({}, settings), { items: settings.items.map((item) => {
52418
+ var _a;
52419
+ return (Object.assign(Object.assign({}, item), { color: (_a = this.readColor(item.color, 'item', itemFallback)) !== null && _a !== void 0 ? _a : itemColor }));
52420
+ }), series: (_a = settings.series) === null || _a === void 0 ? void 0 : _a.map((series, index) => {
52421
+ const color = this.getSeriesColor(series, index, theme);
52422
+ return Object.assign(Object.assign({}, series), { color: color, items: series.items.map((item) => {
52423
+ var _a;
52424
+ return (Object.assign(Object.assign({}, item), { color: (_a = this.readColor(item.color, 'item', 'the color of its series')) !== null && _a !== void 0 ? _a : color }));
52425
+ }) });
52426
+ }) });
52427
+ }
52428
+ getSeriesColor(series, index, theme) {
52429
+ var _a, _b;
52430
+ return ((_b = (_a = this.readColor(series.color, 'series', 'the default series color')) !== null && _a !== void 0 ? _a : this.getThemeReader().color(getDefaultSeriesColor(index))) !== null && _b !== void 0 ? _b : theme.itemColor);
51906
52431
  }
51907
- getItemColor(item, theme) {
51908
- if (!item.color) {
51909
- return theme.itemColor;
52432
+ showSeriesColors(colors) {
52433
+ const shown = this.seriesColors;
52434
+ const same = colors.length === shown.length &&
52435
+ colors.every((color, index) => color === shown[index]);
52436
+ if (same) {
52437
+ return;
51910
52438
  }
51911
- const color = this.themeReader.color(item.color);
51912
- if (color) {
51913
- return color;
52439
+ this.seriesColors = colors;
52440
+ if (this.hasLegend) {
52441
+ index.forceUpdate(this);
52442
+ }
52443
+ }
52444
+ readColor(color, owner, fallback) {
52445
+ if (!color) {
52446
+ return;
51914
52447
  }
51915
- if (!this.invalidColors.has(item.color)) {
51916
- this.invalidColors.add(item.color);
51917
- const hint = item.color.includes('var(')
52448
+ const resolved = this.getThemeReader().color(color);
52449
+ if (!resolved && !this.invalidColors.has(color)) {
52450
+ this.invalidColors.add(color);
52451
+ const hint = color.includes('var(')
51918
52452
  ? ' Check that its variables are set, and that they make a color.'
51919
52453
  : '';
51920
- console.warn(`limel-chart: the color of an item must be a CSS color, but was \`${item.color}\`.${hint} Using the default item color instead.`);
52454
+ const article = owner === 'item' ? 'an' : 'a';
52455
+ console.warn(`limel-chart: the color of ${article} ${owner} must be a CSS color, but was \`${color}\`.${hint} Using ${fallback} instead.`);
51921
52456
  }
51922
- return theme.itemColor;
52457
+ return resolved;
52458
+ }
52459
+ getThemeReader() {
52460
+ var _a;
52461
+ (_a = this.themeReader) !== null && _a !== void 0 ? _a : (this.themeReader = createThemeReader(this.host.shadowRoot));
52462
+ return this.themeReader;
51923
52463
  }
51924
52464
  observeSize() {
51925
52465
  if (this.resizeObserver || typeof ResizeObserver === 'undefined') {
@@ -51937,40 +52477,102 @@ const Chart = class {
51937
52477
  this.drawnTheme = undefined;
51938
52478
  this.itemSpace = undefined;
51939
52479
  }
52480
+ getClickedPosition(event) {
52481
+ const position = findItem(this.drawing, event);
52482
+ if (event.seriesType !== 'line' || !event.event) {
52483
+ return position;
52484
+ }
52485
+ return Object.assign(Object.assign({}, position), { index: this.getNearestPlace(event.event) });
52486
+ }
52487
+ getNearestPlace(pixel) {
52488
+ const landscape = this.orientation === 'landscape';
52489
+ const place = this.chart.convertFromPixel(landscape ? { xAxisIndex: 0 } : { yAxisIndex: 0 }, landscape ? pixel.offsetX : pixel.offsetY);
52490
+ return Math.round(place);
52491
+ }
51940
52492
  highlightItemAt(event, highlight) {
51941
52493
  if (!this.drawing) {
51942
52494
  return;
51943
52495
  }
51944
- const location = locateItem(this.drawing, getItemIndex(this.drawing, event));
52496
+ const location = locateItem(this.drawing, findItem(this.drawing, event));
51945
52497
  if (location.seriesIndex === event.seriesIndex) {
51946
52498
  return;
51947
52499
  }
51948
52500
  this.chart.dispatchAction(Object.assign({ type: highlight ? 'highlight' : 'downplay' }, location));
51949
52501
  }
51950
- getClickableItem(index) {
51951
- const item = this.items[index];
52502
+ getClickableItem(position) {
52503
+ const item = getItemAt(this.grid, position);
51952
52504
  if (!(item === null || item === void 0 ? void 0 : item.clickable)) {
51953
52505
  return;
51954
52506
  }
51955
52507
  return item;
51956
52508
  }
51957
- getRowIndex(event) {
51958
- return Number(event.currentTarget.dataset.index);
52509
+ getPosition(element) {
52510
+ var _a;
52511
+ return {
52512
+ series: Number((_a = element.dataset.series) !== null && _a !== void 0 ? _a : 0),
52513
+ index: Number(element.dataset.index),
52514
+ };
52515
+ }
52516
+ getEventPosition(event) {
52517
+ return this.getPosition(event.currentTarget);
51959
52518
  }
51960
- focusItem(index) {
51961
- if (index === keyboardNavigation.NO_NAVIGATION_TARGET) {
52519
+ findTarget(key, position, orientation) {
52520
+ if (!this.drawsSeries) {
52521
+ const items = this.drawnItems;
52522
+ const index = keyboardNavigation.findNavigationTarget(items, key, position.index, {
52523
+ orientation: orientation,
52524
+ });
52525
+ return { series: 0, index: index };
52526
+ }
52527
+ const grid = this.grid;
52528
+ if (orientation === 'horizontal') {
52529
+ const items = grid.series.map((series) => series.items[position.index]);
52530
+ const series = keyboardNavigation.findNavigationTarget(items, key, position.series, {
52531
+ orientation: orientation,
52532
+ isDisabled: (item) => !item,
52533
+ });
52534
+ return { series: series, index: position.index };
52535
+ }
52536
+ const index = keyboardNavigation.findNavigationTarget(grid.categories, key, position.index, { orientation: orientation });
52537
+ const series = getNearestSeries(grid, {
52538
+ series: position.series,
52539
+ index: index,
52540
+ });
52541
+ return { series: series !== null && series !== void 0 ? series : keyboardNavigation.NO_NAVIGATION_TARGET, index: index };
52542
+ }
52543
+ focusItem(position) {
52544
+ if (position.series === keyboardNavigation.NO_NAVIGATION_TARGET ||
52545
+ position.index === keyboardNavigation.NO_NAVIGATION_TARGET) {
51962
52546
  return;
51963
52547
  }
51964
- const rows = this.host.shadowRoot.querySelectorAll('tbody tr');
51965
- rows[index].focus();
52548
+ const series = this.drawsSeries
52549
+ ? `[data-series="${position.series}"]`
52550
+ : '';
52551
+ const element = this.host.shadowRoot.querySelector(`tbody [data-index="${position.index}"]${series}`);
52552
+ element === null || element === void 0 ? void 0 : element.focus();
51966
52553
  }
51967
- showItem(row, show) {
52554
+ showItem(element, show) {
51968
52555
  if (!this.chart || !this.drawing) {
51969
52556
  return;
51970
52557
  }
51971
- const location = locateItem(this.drawing, Number(row.dataset.index));
52558
+ const position = this.getPosition(element);
52559
+ const location = locateItem(this.drawing, position);
51972
52560
  this.chart.dispatchAction(Object.assign({ type: show ? 'highlight' : 'downplay' }, location));
51973
- this.chart.dispatchAction(Object.assign({ type: show ? 'showTip' : 'hideTip' }, location));
52561
+ if (!show) {
52562
+ this.chart.dispatchAction(this.drawsSeries
52563
+ ? { type: 'updateAxisPointer', currTrigger: 'leave' }
52564
+ : { type: 'hideTip' });
52565
+ return;
52566
+ }
52567
+ this.chart.dispatchAction(Object.assign({ type: 'showTip' }, (this.drawsSeries
52568
+ ? this.getMiddleOfPlace(position.index)
52569
+ : location)));
52570
+ }
52571
+ getMiddleOfPlace(index) {
52572
+ const { minValue, maxValue } = this.drawing.valueRange;
52573
+ const middle = (minValue + maxValue) / 2;
52574
+ const [x, y] = this.chart.convertToPixel({ gridIndex: 0 }, this.orientation === 'landscape' ? [index, middle] : [middle, index]);
52575
+ return { x: x, y: y };
51974
52576
  }
51975
52577
  get host() { return index.getElement(this); }
51976
52578
  static get watchers() { return {