@watermarkinsights/ripple 3.26.0 → 3.26.1-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 (278) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-b7452189.js → chartFunctions-d746b939.js} +596 -596
  3. package/dist/cjs/{functions-a047a8ea.js → functions-68f637b4.js} +503 -503
  4. package/dist/cjs/{global-21ae6c78.js → global-ae47f0c9.js} +72 -72
  5. package/dist/cjs/{http-service-494d81de.js → http-service-9e8c4dd5.js} +49 -49
  6. package/dist/cjs/{interfaces-a3338581.js → interfaces-30a74c1f.js} +29 -29
  7. package/dist/cjs/{intl-47d63c8f.js → intl-d9ffc76c.js} +131 -131
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/priv-chart-popover.cjs.entry.js +91 -91
  10. package/dist/cjs/priv-datepicker.cjs.entry.js +657 -657
  11. package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
  12. package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
  13. package/dist/cjs/ripple.cjs.js +1 -1
  14. package/dist/cjs/wm-action-menu_2.cjs.entry.js +334 -334
  15. package/dist/cjs/wm-button.cjs.entry.js +260 -260
  16. package/dist/cjs/wm-chart-slice.cjs.entry.js +18 -18
  17. package/dist/cjs/wm-chart.cjs.entry.js +183 -183
  18. package/dist/cjs/wm-datepicker.cjs.entry.js +263 -263
  19. package/dist/cjs/wm-file-list.cjs.entry.js +35 -35
  20. package/dist/cjs/wm-file.cjs.entry.js +181 -181
  21. package/dist/cjs/wm-input.cjs.entry.js +136 -136
  22. package/dist/cjs/wm-modal-footer.cjs.entry.js +33 -33
  23. package/dist/cjs/wm-modal-header.cjs.entry.js +32 -32
  24. package/dist/cjs/wm-modal.cjs.entry.js +152 -152
  25. package/dist/cjs/wm-navigation_3.cjs.entry.js +225 -225
  26. package/dist/cjs/wm-navigator.cjs.entry.js +264 -264
  27. package/dist/cjs/wm-network-uploader.cjs.entry.js +465 -465
  28. package/dist/cjs/wm-option_2.cjs.entry.js +768 -768
  29. package/dist/cjs/wm-pagination.cjs.entry.js +179 -179
  30. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +155 -155
  31. package/dist/cjs/wm-search.cjs.entry.js +184 -184
  32. package/dist/cjs/wm-snackbar.cjs.entry.js +155 -155
  33. package/dist/cjs/wm-tab-item_3.cjs.entry.js +265 -265
  34. package/dist/cjs/wm-tag-input-row.cjs.entry.js +14 -14
  35. package/dist/cjs/wm-tag-input.cjs.entry.js +939 -939
  36. package/dist/cjs/wm-timepicker.cjs.entry.js +385 -385
  37. package/dist/cjs/wm-toggletip.cjs.entry.js +130 -130
  38. package/dist/cjs/wm-uploader.cjs.entry.js +441 -441
  39. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  40. package/dist/collection/components/charts/chartFunctions.js +562 -562
  41. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +267 -267
  42. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +125 -125
  43. package/dist/collection/components/charts/wm-chart/wm-chart.js +450 -450
  44. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +207 -207
  45. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +143 -143
  46. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +121 -121
  47. package/dist/collection/components/wm-action-menu/wm-action-menu.js +472 -472
  48. package/dist/collection/components/wm-button/wm-button.js +575 -575
  49. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +983 -983
  50. package/dist/collection/components/wm-datepicker/wm-datepicker.js +491 -491
  51. package/dist/collection/components/wm-file/wm-file.js +313 -313
  52. package/dist/collection/components/wm-file-list/wm-file-list.js +152 -152
  53. package/dist/collection/components/wm-input/wm-input.js +509 -509
  54. package/dist/collection/components/wm-menuitem/wm-menuitem.js +454 -454
  55. package/dist/collection/components/wm-modal/wm-modal-footer.js +138 -138
  56. package/dist/collection/components/wm-modal/wm-modal-header.js +82 -82
  57. package/dist/collection/components/wm-modal/wm-modal.js +462 -462
  58. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +176 -176
  59. package/dist/collection/components/wm-navigation/wm-navigation-item.js +130 -130
  60. package/dist/collection/components/wm-navigation/wm-navigation.js +217 -217
  61. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +106 -106
  62. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +123 -123
  63. package/dist/collection/components/wm-navigator/wm-navigator.js +467 -467
  64. package/dist/collection/components/wm-option/wm-option.js +435 -435
  65. package/dist/collection/components/wm-pagination/wm-pagination.js +370 -370
  66. package/dist/collection/components/wm-search/wm-search.js +439 -439
  67. package/dist/collection/components/wm-select/wm-select.js +1054 -1054
  68. package/dist/collection/components/wm-snackbar/wm-snackbar.js +282 -282
  69. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +211 -211
  70. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +0 -1
  71. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +327 -327
  72. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +108 -108
  73. package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +122 -122
  74. package/dist/collection/components/wm-tag-input/wm-tag-input.js +1294 -1294
  75. package/dist/collection/components/wm-timepicker/wm-timepicker.js +605 -605
  76. package/dist/collection/components/wm-toggletip/wm-toggletip.js +253 -253
  77. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +772 -772
  78. package/dist/collection/components/wm-uploader/wm-uploader.js +964 -964
  79. package/dist/collection/components/wm-wrapper/wm-wrapper.js +28 -28
  80. package/dist/collection/dev/scripts.js +20 -20
  81. package/dist/collection/global/__mocks__/functions.js +6 -6
  82. package/dist/collection/global/functions.js +546 -546
  83. package/dist/collection/global/global.js +79 -79
  84. package/dist/collection/global/interfaces.js +49 -49
  85. package/dist/collection/global/intl.js +132 -132
  86. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  87. package/dist/collection/global/services/http-service.js +50 -50
  88. package/dist/collection/lang/lang.js +5 -5
  89. package/dist/collection/lang/missing.js +43 -43
  90. package/dist/collection/lang/piglatin.js +93 -93
  91. package/dist/esm/{chartFunctions-9d629e09.js → chartFunctions-5c1ad085.js} +596 -596
  92. package/dist/esm/{functions-3b813e0c.js → functions-b2582352.js} +503 -503
  93. package/dist/esm/{global-c7bb5530.js → global-770519f0.js} +72 -72
  94. package/dist/esm/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +49 -49
  95. package/dist/esm/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +29 -29
  96. package/dist/esm/{intl-d544f922.js → intl-6732dd5b.js} +131 -131
  97. package/dist/esm/loader.js +1 -1
  98. package/dist/esm/polyfills/core-js.js +0 -0
  99. package/dist/esm/polyfills/dom.js +0 -0
  100. package/dist/esm/polyfills/es5-html-element.js +0 -0
  101. package/dist/esm/polyfills/index.js +0 -0
  102. package/dist/esm/polyfills/system.js +0 -0
  103. package/dist/esm/priv-chart-popover.entry.js +91 -91
  104. package/dist/esm/priv-datepicker.entry.js +657 -657
  105. package/dist/esm/priv-navigator-button.entry.js +19 -19
  106. package/dist/esm/priv-navigator-item.entry.js +23 -23
  107. package/dist/esm/ripple.js +1 -1
  108. package/dist/esm/wm-action-menu_2.entry.js +334 -334
  109. package/dist/esm/wm-button.entry.js +260 -260
  110. package/dist/esm/wm-chart-slice.entry.js +18 -18
  111. package/dist/esm/wm-chart.entry.js +183 -183
  112. package/dist/esm/wm-datepicker.entry.js +263 -263
  113. package/dist/esm/wm-file-list.entry.js +35 -35
  114. package/dist/esm/wm-file.entry.js +181 -181
  115. package/dist/esm/wm-input.entry.js +136 -136
  116. package/dist/esm/wm-modal-footer.entry.js +33 -33
  117. package/dist/esm/wm-modal-header.entry.js +32 -32
  118. package/dist/esm/wm-modal.entry.js +152 -152
  119. package/dist/esm/wm-navigation_3.entry.js +225 -225
  120. package/dist/esm/wm-navigator.entry.js +264 -264
  121. package/dist/esm/wm-network-uploader.entry.js +465 -465
  122. package/dist/esm/wm-option_2.entry.js +768 -768
  123. package/dist/esm/wm-pagination.entry.js +179 -179
  124. package/dist/esm/wm-progress-indicator_3.entry.js +155 -155
  125. package/dist/esm/wm-search.entry.js +184 -184
  126. package/dist/esm/wm-snackbar.entry.js +155 -155
  127. package/dist/esm/wm-tab-item_3.entry.js +265 -265
  128. package/dist/esm/wm-tag-input-row.entry.js +14 -14
  129. package/dist/esm/wm-tag-input.entry.js +939 -939
  130. package/dist/esm/wm-timepicker.entry.js +385 -385
  131. package/dist/esm/wm-toggletip.entry.js +130 -130
  132. package/dist/esm/wm-uploader.entry.js +441 -441
  133. package/dist/esm/wm-wrapper.entry.js +12 -12
  134. package/dist/esm-es5/{chartFunctions-9d629e09.js → chartFunctions-5c1ad085.js} +1 -1
  135. package/dist/esm-es5/global-770519f0.js +1 -0
  136. package/dist/esm-es5/{intl-d544f922.js → intl-6732dd5b.js} +1 -1
  137. package/dist/esm-es5/loader.js +1 -1
  138. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  139. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  140. package/dist/esm-es5/ripple.js +1 -1
  141. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  142. package/dist/esm-es5/wm-button.entry.js +1 -1
  143. package/dist/esm-es5/wm-chart.entry.js +1 -1
  144. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  145. package/dist/esm-es5/wm-file.entry.js +1 -1
  146. package/dist/esm-es5/wm-input.entry.js +1 -1
  147. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  148. package/dist/esm-es5/wm-modal.entry.js +1 -1
  149. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  150. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  151. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  152. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  153. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  154. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  155. package/dist/esm-es5/wm-search.entry.js +1 -1
  156. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  157. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  158. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  159. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  160. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  161. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  162. package/dist/ripple/{p-56ba575c.system.entry.js → p-00edfbc8.system.entry.js} +1 -1
  163. package/dist/ripple/{p-0cfc0d13.entry.js → p-0414179c.entry.js} +1 -1
  164. package/dist/ripple/{p-f6c9c95f.entry.js → p-043b4874.entry.js} +1 -1
  165. package/dist/ripple/{p-ea99fb58.system.entry.js → p-0503e614.system.entry.js} +1 -1
  166. package/dist/ripple/{p-09a04f55.system.entry.js → p-061914bf.system.entry.js} +1 -1
  167. package/dist/ripple/{p-4f5a48dd.system.entry.js → p-0648aa61.system.entry.js} +1 -1
  168. package/dist/ripple/{p-2d46dbea.entry.js → p-076a8729.entry.js} +1 -1
  169. package/dist/ripple/{p-d973fe13.system.entry.js → p-08e1c91b.system.entry.js} +1 -1
  170. package/dist/ripple/{p-ae1e1db8.entry.js → p-094388f1.entry.js} +1 -1
  171. package/dist/ripple/{p-8c853762.entry.js → p-17490d32.entry.js} +1 -1
  172. package/dist/ripple/{p-51b38033.entry.js → p-22b74491.entry.js} +1 -1
  173. package/dist/ripple/{p-4fb81a33.system.entry.js → p-2948bf33.system.entry.js} +1 -1
  174. package/dist/ripple/{p-2cde4ade.system.entry.js → p-2cef256c.system.entry.js} +1 -1
  175. package/dist/ripple/{p-2dd5f5c3.system.entry.js → p-3313df40.system.entry.js} +1 -1
  176. package/dist/ripple/{p-7f15df83.entry.js → p-3aaf86e4.entry.js} +1 -1
  177. package/dist/ripple/{p-b3d97de8.entry.js → p-3b582301.entry.js} +1 -1
  178. package/dist/ripple/{p-42f8f3ff.entry.js → p-42739dba.entry.js} +1 -1
  179. package/dist/ripple/{p-236dab05.system.entry.js → p-462e7cf8.system.entry.js} +1 -1
  180. package/dist/ripple/{p-fe76e568.entry.js → p-49f7f1da.entry.js} +1 -1
  181. package/dist/ripple/{p-38819b27.system.entry.js → p-4e7489a3.system.entry.js} +1 -1
  182. package/dist/ripple/{p-832910a0.entry.js → p-5ddb1660.entry.js} +1 -1
  183. package/dist/ripple/{p-fea37751.system.entry.js → p-60f58a39.system.entry.js} +1 -1
  184. package/dist/ripple/{p-35790e4e.system.entry.js → p-64b64f40.system.entry.js} +1 -1
  185. package/dist/ripple/{p-84ce9b67.system.entry.js → p-66bb46e5.system.entry.js} +1 -1
  186. package/dist/ripple/{p-8b23f32b.entry.js → p-6f96c28d.entry.js} +1 -1
  187. package/dist/ripple/p-719816e6.system.entry.js +1 -0
  188. package/dist/ripple/{p-f6f80b8d.system.entry.js → p-731beaab.system.entry.js} +1 -1
  189. package/dist/ripple/{p-630bd6f5.system.entry.js → p-7dafc84b.system.entry.js} +1 -1
  190. package/dist/ripple/{p-18c2f4fe.js → p-7ee31208.js} +1 -1
  191. package/dist/ripple/{p-8ff578ad.system.entry.js → p-81b26d3a.system.entry.js} +1 -1
  192. package/dist/ripple/{p-ffb83b6f.entry.js → p-918dc303.entry.js} +1 -1
  193. package/dist/ripple/{p-3aa8e5f5.entry.js → p-926aab51.entry.js} +1 -1
  194. package/dist/ripple/{p-54a2b7d6.system.js → p-9706537b.system.js} +1 -1
  195. package/dist/ripple/p-9ad652d9.system.js +1 -0
  196. package/dist/ripple/{p-95f4e5a1.entry.js → p-9b28a31f.entry.js} +1 -1
  197. package/dist/ripple/{p-5708349e.entry.js → p-9b293f13.entry.js} +1 -1
  198. package/dist/ripple/{p-95aa793b.system.entry.js → p-9b9e60aa.system.entry.js} +1 -1
  199. package/dist/ripple/{p-2cd5477a.entry.js → p-9baf62ae.entry.js} +1 -1
  200. package/dist/ripple/p-9c2b8fb4.js +1 -0
  201. package/dist/ripple/{p-a48e4f1a.system.js → p-a1f5f82f.system.js} +1 -1
  202. package/dist/ripple/{p-09bc0aa7.entry.js → p-a2f10a77.entry.js} +1 -1
  203. package/dist/ripple/{p-f2bb38d0.system.entry.js → p-a5662a2c.system.entry.js} +1 -1
  204. package/dist/ripple/{p-0ef638b7.entry.js → p-a9080b82.entry.js} +1 -1
  205. package/dist/ripple/{p-72b9b986.entry.js → p-a966a18c.entry.js} +1 -1
  206. package/dist/ripple/{p-a006968b.system.entry.js → p-accdf91c.system.entry.js} +1 -1
  207. package/dist/ripple/{p-6eb2c2d5.system.js → p-b7982fab.system.js} +1 -1
  208. package/dist/ripple/{p-c3665c9f.system.entry.js → p-b805612a.system.entry.js} +1 -1
  209. package/dist/ripple/{p-eeeec290.entry.js → p-bd94e7c3.entry.js} +1 -1
  210. package/dist/ripple/{p-05563588.entry.js → p-d5a420fa.entry.js} +1 -1
  211. package/dist/ripple/{p-d96b86c9.js → p-d7f77b2c.js} +1 -1
  212. package/dist/ripple/{p-8775e10b.system.entry.js → p-e6fde200.system.entry.js} +1 -1
  213. package/dist/ripple/{p-12c70659.system.entry.js → p-f740c48c.system.entry.js} +1 -1
  214. package/dist/ripple/{p-bdecbb63.entry.js → p-f8418ac9.entry.js} +1 -1
  215. package/dist/ripple/ripple.esm.js +1 -1
  216. package/dist/ripple/ripple.js +1 -1
  217. package/dist/types/components/charts/chartFunctions.d.ts +37 -37
  218. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  219. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  220. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +47 -47
  221. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +29 -29
  222. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +20 -20
  223. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  224. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +49 -49
  225. package/dist/types/components/wm-button/wm-button.d.ts +49 -49
  226. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  227. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +42 -42
  228. package/dist/types/components/wm-file/wm-file.d.ts +40 -40
  229. package/dist/types/components/wm-file-list/wm-file-list.d.ts +16 -16
  230. package/dist/types/components/wm-input/wm-input.d.ts +57 -57
  231. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  232. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  233. package/dist/types/components/wm-modal/wm-modal-header.d.ts +10 -10
  234. package/dist/types/components/wm-modal/wm-modal.d.ts +40 -40
  235. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -21
  236. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  237. package/dist/types/components/wm-navigation/wm-navigation.d.ts +26 -26
  238. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  239. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  240. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  241. package/dist/types/components/wm-option/wm-option.d.ts +34 -34
  242. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  243. package/dist/types/components/wm-search/wm-search.d.ts +77 -77
  244. package/dist/types/components/wm-select/wm-select.d.ts +101 -101
  245. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +31 -31
  246. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +37 -37
  247. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +52 -52
  248. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  249. package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -11
  250. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +136 -136
  251. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +62 -62
  252. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +28 -28
  253. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  254. package/dist/types/components/wm-uploader/wm-uploader.d.ts +99 -99
  255. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  256. package/dist/types/components.d.ts +27 -27
  257. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  258. package/dist/types/global/functions.d.ts +49 -49
  259. package/dist/types/global/global.d.ts +1 -1
  260. package/dist/types/global/interfaces.d.ts +74 -74
  261. package/dist/types/global/intl.d.ts +29 -29
  262. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  263. package/dist/types/global/services/http-service.d.ts +4 -4
  264. package/dist/types/lang/lang.d.ts +5 -5
  265. package/package.json +46 -46
  266. package/dist/esm-es5/global-c7bb5530.js +0 -1
  267. package/dist/ripple/p-169606b9.system.js +0 -1
  268. package/dist/ripple/p-4444add0.system.entry.js +0 -1
  269. package/dist/ripple/p-76015762.js +0 -1
  270. /package/dist/esm-es5/{functions-3b813e0c.js → functions-b2582352.js} +0 -0
  271. /package/dist/esm-es5/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +0 -0
  272. /package/dist/esm-es5/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +0 -0
  273. /package/dist/ripple/{p-f5df5903.system.js → p-08b7ec08.system.js} +0 -0
  274. /package/dist/ripple/{p-9d02957d.system.js → p-313b6073.system.js} +0 -0
  275. /package/dist/ripple/{p-4a0e1d2d.js → p-5384856b.js} +0 -0
  276. /package/dist/ripple/{p-43f1298b.js → p-888bec42.js} +0 -0
  277. /package/dist/ripple/{p-190afa40.system.js → p-9e94ae94.system.js} +0 -0
  278. /package/dist/ripple/{p-fd8070fb.js → p-a6d6eae7.js} +0 -0
@@ -1,603 +1,603 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index-9f0e6656.js');
4
- const functions = require('./functions-a047a8ea.js');
4
+ const functions = require('./functions-68f637b4.js');
5
5
 
6
- const colors = {
7
- salmon: "#ff5f4e",
8
- cyan: "#19a1a9",
9
- forest: "#088000",
10
- sleet: "#7f97ad",
11
- midnight: "#2e1b46",
12
- lavender: "#8b86ca",
13
- periwinkle: "#575195",
14
- gray: "#6b6b6b",
15
- };
16
- const allChartsDetails = {
17
- // for progress monitor
18
- doughnut: {
19
- size: 155,
20
- colors: [colors.forest, colors.gray],
21
- thickness: 0.73,
22
- padding: 25,
23
- category: "doughnut",
24
- },
25
- // deprecated hybrid chart type, should use Progress Indicator's "doughnut" instead
26
- doughnut0: {
27
- size: 155,
28
- colors: [colors.forest, colors.gray],
29
- thickness: 0.73,
30
- padding: 25,
31
- category: "doughnut",
32
- },
33
- doughnut1: {
34
- size: 130,
35
- colors: [colors.lavender, colors.midnight, colors.gray],
36
- thickness: 0.5,
37
- padding: 90,
38
- category: "doughnut",
39
- },
40
- doughnut2: {
41
- size: 130,
42
- colors: [colors.cyan, colors.salmon, colors.gray],
43
- thickness: 0.5,
44
- padding: 90,
45
- category: "doughnut",
46
- },
47
- // an internal type only for use when doughnut 2 is populated with 4 slices
48
- // in this case, the first slice is colored purple
49
- doughnut2b: {
50
- size: 130,
51
- colors: [colors.periwinkle, colors.cyan, colors.salmon, colors.gray],
52
- thickness: 0.5,
53
- padding: 90,
54
- category: "doughnut",
55
- },
56
- doughnut3: {
57
- size: 130,
58
- colors: [colors.lavender, colors.midnight, "#0089e4", colors.forest, "#ea8500", "#d54f41", "#146ca9"],
59
- thickness: 0.5,
60
- padding: 90,
61
- category: "doughnut",
62
- },
63
- // for progress monitor
64
- bar: {
65
- size: 350,
66
- colors: [colors.forest, colors.gray],
67
- padding: 0,
68
- category: "stackedBar",
69
- },
70
- // deprecated hybrid chart type, should use Progress Indicator's "bar" instead
71
- bar1: {
72
- size: 350,
73
- colors: [colors.forest, colors.gray],
74
- padding: 0,
75
- category: "stackedBar",
76
- },
77
- bar2: {
78
- size: 400,
79
- colors: [colors.gray, colors.periwinkle, colors.cyan, colors.salmon],
80
- padding: 0,
81
- category: "stackedBar",
82
- },
83
- bar2b: {
84
- size: 400,
85
- colors: [colors.gray, colors.periwinkle, colors.midnight, colors.cyan, colors.salmon],
86
- padding: 0,
87
- category: "stackedBar",
88
- },
89
- bar3: {
90
- size: 300,
91
- colors: ["#0d696e", colors.cyan, "#8e4129", colors.salmon],
92
- padding: 0,
93
- category: "stackedBar",
94
- },
95
- bar4: {
96
- size: 400,
97
- colors: [colors.salmon, colors.cyan, colors.periwinkle],
98
- padding: 0,
99
- category: "stackedBar",
100
- },
101
- bar5: {
102
- size: 400,
103
- colors: [
104
- colors.gray,
105
- colors.lavender,
106
- colors.midnight,
107
- "#0089e4",
108
- colors.forest,
109
- "#ea8500",
110
- "#d54f41",
111
- "#146ca9",
112
- ],
113
- padding: 0,
114
- category: "stackedBar",
115
- },
116
- bar6: {
117
- size: 400,
118
- colors: [colors.lavender],
119
- padding: 0,
120
- category: "simpleBar",
121
- },
122
- bar7: {
123
- size: 400,
124
- colors: [colors.periwinkle, colors.cyan, colors.salmon, colors.gray],
125
- padding: 0,
126
- category: "simpleBar",
127
- },
128
- };
129
- function showValue(valueFormat) {
130
- return valueFormat === "percentage" || valueFormat === "amount" ? "show-values" : "";
131
- }
132
- const textHiddenMessage = functions.intl.formatMessage({
133
- id: "chart.hiddenValues",
134
- defaultMessage: "Values are not shown when too close to each other.",
135
- description: "Text displayed when a chart has some values hidden",
136
- });
137
- const seeDetailsMessage = functions.intl.formatMessage({
138
- id: "chart.clickToSeeDetails",
139
- defaultMessage: "Click or use arrow keys to see details.",
140
- description: "Text displayed, guiding user to interact to see more details.",
141
- });
142
- function abbrNumber(num) {
143
- return num > 999 ? Math.round(num / 100) / 10 + "K" : num;
144
- }
145
- function amountToPercent(val, total, asInt) {
146
- return asInt ? Math.round((val * 100) / total) : Math.round((val * 10000) / total) / 100; // with 2 decimals
147
- }
148
- function amountToDegree(val, total) {
149
- // In a circle of {total}, determine degrees of slice {val}
150
- return (val * 360) / total;
151
- }
152
- function toFixed(number) {
153
- return parseFloat((Math.floor(number * 100) / 100).toFixed(2));
154
- }
155
- function polarToCartesian(half, radius, startAngle, endAngle) {
156
- var x = toFixed(half + half * radius * Math.cos((Math.PI * startAngle) / 180));
157
- var y = toFixed(half + half * radius * Math.sin((Math.PI * startAngle) / 180));
158
- if (endAngle !== undefined) {
159
- // if a 2nd angle value was passed, return 2 pairs of coords
160
- var x2 = toFixed(half + half * radius * Math.cos((Math.PI * endAngle) / 180));
161
- var y2 = toFixed(half + half * radius * Math.sin((Math.PI * endAngle) / 180));
162
- return { x1: x, y1: y, x2, y2 };
163
- }
164
- return { x, y };
165
- }
166
- function getArc(radius, largeArcFlag, x, y, chartSize) {
167
- var z = toFixed((chartSize / 2) * radius);
168
- return `A ${z}, ${z} 0 ${largeArcFlag} ${toFixed(x)}, ${toFixed(y)}`;
169
- }
170
- function scale(val, inMin, inMax, outMin, outMax) {
171
- let scaled = ((val - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
172
- // clip the values so that whatever is passed in the output is never smaller than outMin or greater than outMax
173
- return scaled < outMin ? outMin : scaled > outMax ? outMax : scaled;
174
- }
175
- function minSpacing(width) {
176
- // minimum spacing between 2 ticks, in px
177
- return scale(width, 300, 900, 70, 150);
178
- }
179
- function getMaxTicks(width) {
180
- return Math.round(width / minSpacing(width));
181
- }
182
- function getInterval(largest, maxticks) {
183
- const minimum = largest / maxticks;
184
- const magnitude = 10 ** Math.floor(Math.log10(minimum));
185
- const residual = minimum / magnitude;
186
- let interval;
187
- if (residual > 5) {
188
- interval = 10 * magnitude;
189
- }
190
- else if (residual > 3) {
191
- interval = 5 * magnitude;
192
- }
193
- else if (residual > 2) {
194
- interval = 3 * magnitude;
195
- }
196
- else if (residual > 1.5) {
197
- interval = 2 * magnitude;
198
- }
199
- else if (residual > 1) {
200
- interval = 1.5 * magnitude;
201
- }
202
- else {
203
- interval = magnitude;
204
- }
205
- return interval;
206
- }
207
- function handleSliceKeyDown(ev) {
208
- if (this.popoverEl && this.popoverEl.open && ev.key === "Enter") {
209
- const popoverBtn = this.popoverEl.querySelector("button");
210
- popoverBtn && popoverBtn.click();
211
- }
212
- }
213
- function handleSliceClick(ev, s) {
214
- if (this.popoverEl && !this.isTabbing) {
215
- s.coords = { x: ev.clientX, y: ev.clientY };
216
- openPopover.call(this, s);
217
- }
218
- }
219
- function handleSliceFocus(ev, s) {
220
- if (this.popoverEl && this.isTabbing) {
221
- s.coords = functions.getPosition(ev.target);
222
- openPopover.call(this, s);
223
- }
224
- }
225
- function handleChartKeydown(ev) {
226
- switch (ev.key) {
227
- // arrow up / left
228
- case "ArrowUp":
229
- case "ArrowLeft":
230
- ev.preventDefault();
231
- this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
232
- focusPrevious.call(this);
233
- break;
234
- // arrow right / down
235
- case "ArrowRight":
236
- case "ArrowDown":
237
- ev.preventDefault();
238
- this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
239
- focusNext.call(this);
240
- break;
241
- // tab
242
- case "Tab":
243
- exitChart.call(this);
244
- break;
245
- case "Escape":
246
- this.popoverEl.open = false;
247
- this.userIsNavigating = false;
248
- break;
249
- }
250
- }
251
- function openPopover(s) {
252
- if (!!this.popoverEl && !!s.title && !!s.text) {
253
- this.popoverEl.popoverTitle = s.title;
254
- this.popoverEl.popoverText = s.text;
255
- this.popoverEl.buttonText = s.buttonText;
256
- this.popoverEl.coords = s.coords;
257
- this.popoverEl.sliceRef = s.sliceRef;
258
- window.setTimeout(() => {
259
- if (this.popoverEl) {
260
- this.popoverEl.open = true;
261
- }
262
- }, 30);
263
- const debouncedClosePopover = functions.debounce(async () => {
264
- this.popoverEl.open = false;
265
- }, 10);
266
- // set up event listeners for scrolling
267
- // to close popover on page scroll
268
- document.addEventListener("scroll", () => {
269
- debouncedClosePopover();
270
- });
271
- // ... and on parent scroll
272
- const scrollableParent = functions.findParentWithScrollbar(this.el);
273
- if (!!scrollableParent) {
274
- scrollableParent.addEventListener("scroll", () => {
275
- debouncedClosePopover();
276
- });
277
- }
278
- }
279
- }
280
- function focusNext() {
281
- const activeEl = functions.checkForActiveElInShadow(document.activeElement);
282
- const index =
283
- // if the active el is not in the array the first element gets focused
284
- (this.sliceEls.indexOf(activeEl) + 1) % this.sliceEls.length;
285
- focusSlice.call(this, index);
286
- }
287
- function focusPrevious() {
288
- if (this.sliceEls) {
289
- const activeEl = functions.checkForActiveElInShadow(document.activeElement);
290
- let index = this.sliceEls.indexOf(activeEl);
291
- if (index === -1) {
292
- // not in the array : focus the first slice
293
- index = 0;
294
- }
295
- else if (index === 0) {
296
- // first slice : focus the last slice
297
- index = this.sliceEls.length - 1;
298
- }
299
- else {
300
- // anything else: focus previous
301
- index -= 1;
302
- }
303
- focusSlice.call(this, index);
304
- }
305
- }
306
- function focusSlice(index) {
307
- if (this.sliceEls && this.el) {
308
- this.userIsNavigating = true;
309
- if (this.popoverEl) {
310
- this.popoverEl.open = false;
311
- }
312
- // set tabindex of the wrapper to -1 while slices are being focused, to allow for shft-tabbing out of the component directly
313
- this.componentWrapperEl.tabIndex = -1;
314
- // @ts-ignore
315
- this.el.focusable = false; // for Edge
316
- this.sliceEls.map((p) => {
317
- p.tabIndex = -1;
318
- // @ts-ignore
319
- p.focusable = false; // for Edge
320
- });
321
- this.sliceEls[index].tabIndex = 0;
322
- // @ts-ignore
323
- this.sliceEls[index].focusable = true; // for Edge
324
- this.sliceEls[index].focus();
325
- window.setTimeout(() => {
326
- if (this.popoverEl) {
327
- this.popoverEl.open = true;
328
- }
329
- }, 10);
330
- }
331
- }
332
- function exitChart() {
333
- this.sliceEls &&
334
- this.sliceEls.map((p) => {
335
- p.tabIndex = -1;
336
- // @ts-ignore
337
- p.focusable = false; // for Edge
338
- });
339
- this.userIsNavigating = false;
340
- // delay so that we can tab out of component before chart becomes focusable again
341
- // and in case user was still pressing an arrow key when they pressed tab
342
- window.setTimeout(() => {
343
- this.componentWrapperEl.tabIndex = 0;
344
- // @ts-ignore
345
- this.el.focusable = true; // for Edge
346
- if (this.popoverEl) {
347
- this.popoverEl.open = false;
348
- }
349
- }, 100);
350
- }
351
- async function getDetails(chartType) {
352
- this.slicesDetails = [];
353
- let acc = 0;
354
- const children = Array.from(this.el.children);
355
- this.total = children.reduce((total, slice) => (total += parseInt(slice.getAttribute("amount") || "0")), 0);
356
- children.forEach((c, i) => {
357
- const amount = parseInt(c.getAttribute("amount") || "0");
358
- const perc = amountToPercent(amount, this.total, true);
359
- let colorIndex = i;
360
- // for bar5, first color should be skipped unless notStartedColor is set to true
361
- if (chartType === "bar5") {
362
- colorIndex = this.notStartedColor ? i : i + 1;
363
- }
364
- // bars in bar6 are all the same color
365
- if (chartType === "bar6") {
366
- colorIndex = 0;
367
- }
368
- const color = allChartsDetails[chartType].colors[colorIndex];
369
- const sliceDetails = {
370
- amount: amount,
371
- perc: perc,
372
- legend: c.getAttribute("legend"),
373
- color: color || colors.gray,
374
- offset: acc,
375
- id: `${this.uid}-${i + 1}`,
376
- title: c.getAttribute("popover-title"),
377
- text: c.getAttribute("popover-text"),
378
- buttonText: c.getAttribute("popover-button-text"),
379
- sliceRef: c,
380
- inSmallCluster: false,
381
- };
382
- acc += amount;
383
- this.slicesDetails.push(sliceDetails);
384
- });
385
- }
386
- function sortSlicesDetails(slicesDetails, total) {
387
- // sort slices by decreasing amount
388
- let sortedSlicesDetails = [...slicesDetails].sort((a, b) => a.amount === b.amount ? 0 : a.amount > b.amount ? -1 : 1);
389
- let acc = 0;
390
- sortedSlicesDetails.forEach((s, idx) => {
391
- const prev = sortedSlicesDetails[idx === 0 ? sortedSlicesDetails.length - 1 : idx - 1];
392
- const next = sortedSlicesDetails[idx === sortedSlicesDetails.length - 1 ? 0 : idx + 1];
393
- const prevPerc = amountToPercent(prev.amount, total, true);
394
- const nextPerc = amountToPercent(next.amount, total, true);
395
- s.offset = acc;
396
- acc += s.amount;
397
- s.inSmallCluster = isInSmallCluster(prevPerc, s.perc, s.amount, nextPerc);
398
- });
399
- return sortedSlicesDetails;
400
- }
401
- function isInSmallCluster(prevPerc, perc, amount, nextPerc) {
402
- // determine whether the slice is in a cluster of small values
403
- // to avoid percentage text overlap for small values
404
- const isSmall = perc < 4;
405
- const prevIsSmall = prevPerc < 5;
406
- const nextIsSmall = nextPerc < 5;
407
- let inSmallCluster = isSmall && (prevIsSmall || nextIsSmall);
408
- // because <1% slice percentage text has an additional character
409
- // the inSmallCluster threshold needs to be widened for that slice only
410
- const lessThanOnePerc = perc === 0 && amount > 0;
411
- if (lessThanOnePerc && (nextPerc < 8 || prevPerc < 8)) {
412
- inSmallCluster = true;
413
- }
414
- return inSmallCluster;
415
- }
416
- function getPathData(amount, offset, chartType) {
417
- const startAngle = amountToDegree(offset, this.total) - 90; // start at noon, not at 3 o'clock
418
- const activeAngle = (amount / this.total) * 360;
419
- let endAngle = startAngle + activeAngle;
420
- const largeArcFlagOuter = activeAngle > 180 ? "1 1" : "0 1";
421
- const largeArcFlagInner = activeAngle > 180 ? "1 0" : "0 0";
422
- const half = this.chartDetails.size / 2;
423
- const innerRadius = this.chartDetails.thickness;
424
- const outerRadius = 1;
425
- const isHybridDoughnut = chartType === "doughnut0" || chartType === "doughnut";
426
- const outerSeparatorOffset = 1.5;
427
- const innerSeparatorOffset = isHybridDoughnut ? 2.25 : 3;
428
- if (activeAngle === 360) {
429
- // fix to avoid bad svg shape when the path goes all around (100%)
430
- endAngle -= 0.01;
431
- }
432
- const outerCoords = polarToCartesian(half, outerRadius, startAngle + outerSeparatorOffset, // Addition for slice separator
433
- endAngle);
434
- const innerCoords = polarToCartesian(half, innerRadius, startAngle + innerSeparatorOffset, // Addition for slice separator
435
- endAngle);
436
- const moveTo = `M ${outerCoords.x1}, ${outerCoords.y1} `;
437
- const arc1 = getArc(outerRadius, largeArcFlagOuter, outerCoords.x2, outerCoords.y2, this.chartDetails.size);
438
- const line = ` L ${innerCoords.x2}, ${innerCoords.y2} `;
439
- const arc2 = getArc(innerRadius, largeArcFlagInner, innerCoords.x1, innerCoords.y1, this.chartDetails.size);
440
- return moveTo + arc1 + line + arc2 + " z";
441
- }
442
- function renderInstructionsText() {
443
- const chartInstructions = functions.intl.formatMessage({
444
- id: "chart.instructions",
445
- defaultMessage: "Use arrow keys to browse elements, press Tab to exit.",
446
- description: "For screen readers only, instructions on how to interact with the chart component",
447
- });
448
- return index.h("div", { id: "chart-instructions" }, chartInstructions);
449
- }
450
- function renderFilter() {
451
- return (index.h("defs", null,
452
- index.h("filter", { id: "wmHoverDropShadow" },
453
- index.h("feGaussianBlur", { stdDeviation: "3" }),
454
- index.h("feOffset", { result: "offsetblur" }),
455
- index.h("feFlood", { "flood-color": "#333" }),
456
- index.h("feComposite", { operator: "in", in2: "offsetblur" }),
457
- index.h("feMerge", null,
458
- index.h("feMergeNode", null),
459
- index.h("feMergeNode", { in: "SourceGraphic" })))));
460
- }
461
- function renderDoughnut(chartType) {
462
- const outerSize = this.chartDetails.size + this.chartDetails.padding;
463
- const isHybridDoughnut = chartType === "doughnut0" || chartType === "doughnut";
464
- // no sorting in progress indicators
465
- let slicesDetails = isHybridDoughnut ? this.slicesDetails : sortSlicesDetails(this.slicesDetails, this.total);
466
- return (index.h("div", { class: "chart-wrapper doughnut-wrapper" },
467
- index.h("svg", { width: outerSize + "px", height: outerSize + "px", id: `graphic-${this.uid}`, class: "doughnut-svg" },
468
- renderFilter(),
469
- slicesDetails.map((s) => renderPath.call(this, s, chartType)),
470
- isHybridDoughnut ? (index.h("text", { class: "value", x: "50%", y: "50%", "font-size": "1.5rem", "font-weight": "500", "text-anchor": "middle", "dominant-baseline": "middle" }, amountToPercent(slicesDetails[0].amount, this.total, true) + "%")) : (index.h("g", { transform: `translate(${this.chartDetails.padding / 2}, ${this.chartDetails.padding / 2})`, "text-anchor": "middle", "dominant-baseline": "middle" }, slicesDetails.map((s) => s.amount > 0 && !s.inSmallCluster ? renderDoughnutText.call(this, s) : ""))))));
471
- }
472
- function renderPath(s, chartType) {
473
- return (index.h("g", { transform: `translate(${this.chartDetails.padding / 2}, ${this.chartDetails.padding / 2})` },
474
- index.h("path", { id: s.id, class: "segment doughnut-segment", fill: s.amount ? s.color : "transparent", d: getPathData.call(this, s.amount, s.offset, chartType), onClick: (ev) => handleSliceClick.call(this, ev, s), onFocus: (ev) => handleSliceFocus.call(this, ev, s), onKeyDown: (ev) => handleSliceKeyDown.call(this, ev), role: "img", "aria-label": s.legend })));
475
- }
476
- function renderDoughnutText(s) {
477
- const arcMiddle = amountToDegree(s.offset + s.amount / 2, this.total);
478
- let { x, y } = polarToCartesian(this.chartDetails.size / 2, 1.4, arcMiddle - 90);
479
- return (index.h("text", { class: "value", x: x + "px", y: y + "px" }, `${s.perc > 0 ? s.perc : "<1"}%`));
480
- }
481
- function renderStackedBar(chartType) {
482
- const isHybridBar = chartType === "bar1" || chartType === "bar";
483
- return (index.h("div", { class: "chart-wrapper bar-wrapper" },
484
- isHybridBar ? (index.h("div", { class: "single-perc" }, amountToPercent(this.slicesDetails[0].amount, this.total, true) + "%")) : (""),
485
- this.chartType === "bar3" && this.drawAxis(),
486
- index.h("div", { class: `inner-stacked-bar-wrapper ${showValue(this.tempValueFormat)}` },
487
- !isHybridBar ? (index.h("div", { class: "values" }, this.slicesDetails.map((s, idx) => this.renderBarText(s, idx)))) : (""),
488
- index.h("div", { class: "stacked-bar-segments-wrapper" }, this.slicesDetails.map((s, idx) => renderStackedBarSegment.call(this, s, idx))),
489
- isHybridBar ? renderCompletionMessage.call(this) : "")));
490
- }
491
- function renderStackedBarSegment(s, idx) {
492
- const isLastSlice = idx !== this.slicesDetails.length - 1;
493
- const width = `calc(${amountToPercent(s.amount, this.total, false)}%${isLastSlice ? " - 2px" : ""})`;
494
- return (index.h("div", { class: `segment stacked-bar-segment ${amountToPercent(s.amount, this.total, false) === 0 ? "zero" : ""}`, style: {
495
- backgroundColor: s.color,
496
- width: width,
497
- }, onClick: (ev) => handleSliceClick.call(this, ev, s), onFocus: (ev) => handleSliceFocus.call(this, ev, s), onKeyDown: (ev) => handleSliceKeyDown.call(this, ev) },
498
- index.h("span", { class: "sr-only" }, s.legend)));
499
- }
500
- function renderSimpleBar(chartType) {
501
- // find largest number and get interval, numTicks, chartMaxVal for all.
502
- const largest = this.slicesDetails
503
- .map((s) => s.amount)
504
- .reduce((a, b) => {
505
- return a > b ? a : b;
506
- });
507
- const labelWidth = parseInt(getComputedStyle(this.el).getPropertyValue("--labelWidth"), 10);
508
- const chartPadding = 48;
509
- const componentWidth = this.el.getBoundingClientRect().width;
510
- const chartWidth = componentWidth - labelWidth - chartPadding;
511
- let numTicks = getMaxTicks(chartWidth);
512
- let interval = getInterval(largest, numTicks);
513
- // after the algorithm finds an interval, remove extra ticks so that the greater number is always between the last tick and the one before that
514
- const lastTickVal = numTicks * interval;
515
- const extraTicks = Math.floor((lastTickVal - largest) / interval);
516
- numTicks -= extraTicks;
517
- this.el.style.setProperty("--backgroundSize", 100 / numTicks + "%");
518
- this.el.style.setProperty("--labelWidth", this.labelWidth);
519
- if (chartType === "bar7" && !this.showBarLegend) {
520
- this.el.style.setProperty("--labelWidth", "0px");
521
- }
522
- // we have to prep the data here rather than iterate directly in the return statement
523
- // because CSS grid needs a flat structure, and return functions must
524
- // have a single parent element
525
- const rows = [];
526
- this.slicesDetails.forEach((s) => {
527
- s.legend && rows.push(renderSimpleBarLegend(s.legend, this.showBarLegend, chartType));
528
- rows.push(renderSimpleBarItem.call(this, s, interval, numTicks, largest));
529
- });
530
- const ticks = [];
531
- for (let i = 1; i <= numTicks; i++) {
532
- const tickVal = abbrNumber(i * interval);
533
- ticks.push(index.h("div", { class: "tick" },
534
- index.h("span", null, tickVal)));
535
- }
536
- const showGrid = chartType === "bar6" && this.showGrid && this.el.getBoundingClientRect().width > 300;
537
- return (index.h("div", { class: "chart-wrapper simple-bar-wrapper" },
538
- index.h("div", { class: `chart ${showValue(this.tempValueFormat)}` },
539
- showGrid && index.h("div", { class: "gridlines" }),
540
- index.h("div", { class: "rows" }, rows)),
541
- showGrid && (index.h("div", { class: "x-axis", "aria-hidden": "true" },
542
- index.h("div", { class: "zero" },
543
- index.h("span", null, "0")),
544
- ticks))));
545
- }
546
- function renderSimpleBarLegend(legend, show, chartType) {
547
- // not sure how to collapse the left column to 0 width with CSS grid. text should still be available to SR.
548
- const hidden = chartType === "bar7" && !show ? " hidden" : "";
549
- return index.h("label", { class: `label${hidden}` }, legend);
550
- }
551
- function renderSimpleBarItem(s, interval, ticks, largest) {
552
- const chartMaxVal = this.currentChartType === "bar6" ? interval * ticks : largest;
553
- const width = amountToPercent(s.amount, chartMaxVal, false);
554
- const cssWidth = width ? width + "%" : "1px";
555
- const amt = abbrNumber(s.amount);
556
- let displayValue = this.tempValueFormat === "amount" ? amt : "";
557
- if (this.currentChartType === "bar6" && this.tempValueFormat === "percentage") {
558
- displayValue = s.amount + "%";
559
- }
560
- else if (this.currentChartType === "bar7" && this.tempValueFormat === "percentage") {
561
- displayValue = amountToPercent(s.amount, this.total, true) + "%";
562
- }
563
- return (index.h("div", { class: "bar segment", style: {
564
- backgroundColor: s.color,
565
- width: cssWidth,
566
- }, onClick: (ev) => handleSliceClick.call(this, ev, s), onFocus: (ev) => handleSliceFocus.call(this, ev, s), onKeyDown: (ev) => handleSliceKeyDown.call(this, ev) },
567
- index.h("div", { class: "value" }, displayValue)));
568
- }
569
- function renderLegend(chartType) {
570
- // legend is hidden for bar1 and bar6 types regardless of showLegend value
571
- if (this.showLegend) {
572
- const hasCluster = !this.chartDetails.isBar &&
573
- this.slicesDetails.reduce((hasCluster, cur) => (hasCluster = cur.inSmallCluster ? true : hasCluster), false);
574
- return (index.h("div", { class: "legend-wrapper" },
575
- index.h("div", { class: `legend ${chartType} ${this.mode === "bar" ? "--top" : "--bottom"}`, "aria-hidden": "true" }, this.total > 0
576
- ? this.slicesDetails.map((s) => {
577
- // when both legend and amount are omitted, the legend is not shown for that particular option (it's been deactivated by the user)
578
- if (!!s.amount || !!s.legend) {
579
- return renderLegendItem({ key: s.legend, color: s.color });
580
- }
581
- })
582
- : ""),
583
- hasCluster && renderHiddenValuesMessage()));
584
- }
585
- }
586
- function renderLegendItem(legendItem) {
587
- return (index.h("div", { class: "legend-item" },
588
- index.h("div", { class: "legend-color", style: { backgroundColor: legendItem.color } }),
589
- index.h("div", { class: "legend-text" }, legendItem.key)));
590
- }
591
- function renderCompletionMessage() {
592
- if (this.completionMessage) {
593
- return index.h("div", { class: "completion-message" }, this.completionMessage);
594
- }
595
- }
596
- function renderHiddenValuesMessage() {
597
- return (index.h("div", { class: "hidden-values-warning" },
598
- textHiddenMessage,
599
- index.h("br", null),
600
- seeDetailsMessage));
6
+ const colors = {
7
+ salmon: "#ff5f4e",
8
+ cyan: "#19a1a9",
9
+ forest: "#088000",
10
+ sleet: "#7f97ad",
11
+ midnight: "#2e1b46",
12
+ lavender: "#8b86ca",
13
+ periwinkle: "#575195",
14
+ gray: "#6b6b6b",
15
+ };
16
+ const allChartsDetails = {
17
+ // for progress monitor
18
+ doughnut: {
19
+ size: 155,
20
+ colors: [colors.forest, colors.gray],
21
+ thickness: 0.73,
22
+ padding: 25,
23
+ category: "doughnut",
24
+ },
25
+ // deprecated hybrid chart type, should use Progress Indicator's "doughnut" instead
26
+ doughnut0: {
27
+ size: 155,
28
+ colors: [colors.forest, colors.gray],
29
+ thickness: 0.73,
30
+ padding: 25,
31
+ category: "doughnut",
32
+ },
33
+ doughnut1: {
34
+ size: 130,
35
+ colors: [colors.lavender, colors.midnight, colors.gray],
36
+ thickness: 0.5,
37
+ padding: 90,
38
+ category: "doughnut",
39
+ },
40
+ doughnut2: {
41
+ size: 130,
42
+ colors: [colors.cyan, colors.salmon, colors.gray],
43
+ thickness: 0.5,
44
+ padding: 90,
45
+ category: "doughnut",
46
+ },
47
+ // an internal type only for use when doughnut 2 is populated with 4 slices
48
+ // in this case, the first slice is colored purple
49
+ doughnut2b: {
50
+ size: 130,
51
+ colors: [colors.periwinkle, colors.cyan, colors.salmon, colors.gray],
52
+ thickness: 0.5,
53
+ padding: 90,
54
+ category: "doughnut",
55
+ },
56
+ doughnut3: {
57
+ size: 130,
58
+ colors: [colors.lavender, colors.midnight, "#0089e4", colors.forest, "#ea8500", "#d54f41", "#146ca9"],
59
+ thickness: 0.5,
60
+ padding: 90,
61
+ category: "doughnut",
62
+ },
63
+ // for progress monitor
64
+ bar: {
65
+ size: 350,
66
+ colors: [colors.forest, colors.gray],
67
+ padding: 0,
68
+ category: "stackedBar",
69
+ },
70
+ // deprecated hybrid chart type, should use Progress Indicator's "bar" instead
71
+ bar1: {
72
+ size: 350,
73
+ colors: [colors.forest, colors.gray],
74
+ padding: 0,
75
+ category: "stackedBar",
76
+ },
77
+ bar2: {
78
+ size: 400,
79
+ colors: [colors.gray, colors.periwinkle, colors.cyan, colors.salmon],
80
+ padding: 0,
81
+ category: "stackedBar",
82
+ },
83
+ bar2b: {
84
+ size: 400,
85
+ colors: [colors.gray, colors.periwinkle, colors.midnight, colors.cyan, colors.salmon],
86
+ padding: 0,
87
+ category: "stackedBar",
88
+ },
89
+ bar3: {
90
+ size: 300,
91
+ colors: ["#0d696e", colors.cyan, "#8e4129", colors.salmon],
92
+ padding: 0,
93
+ category: "stackedBar",
94
+ },
95
+ bar4: {
96
+ size: 400,
97
+ colors: [colors.salmon, colors.cyan, colors.periwinkle],
98
+ padding: 0,
99
+ category: "stackedBar",
100
+ },
101
+ bar5: {
102
+ size: 400,
103
+ colors: [
104
+ colors.gray,
105
+ colors.lavender,
106
+ colors.midnight,
107
+ "#0089e4",
108
+ colors.forest,
109
+ "#ea8500",
110
+ "#d54f41",
111
+ "#146ca9",
112
+ ],
113
+ padding: 0,
114
+ category: "stackedBar",
115
+ },
116
+ bar6: {
117
+ size: 400,
118
+ colors: [colors.lavender],
119
+ padding: 0,
120
+ category: "simpleBar",
121
+ },
122
+ bar7: {
123
+ size: 400,
124
+ colors: [colors.periwinkle, colors.cyan, colors.salmon, colors.gray],
125
+ padding: 0,
126
+ category: "simpleBar",
127
+ },
128
+ };
129
+ function showValue(valueFormat) {
130
+ return valueFormat === "percentage" || valueFormat === "amount" ? "show-values" : "";
131
+ }
132
+ const textHiddenMessage = functions.intl.formatMessage({
133
+ id: "chart.hiddenValues",
134
+ defaultMessage: "Values are not shown when too close to each other.",
135
+ description: "Text displayed when a chart has some values hidden",
136
+ });
137
+ const seeDetailsMessage = functions.intl.formatMessage({
138
+ id: "chart.clickToSeeDetails",
139
+ defaultMessage: "Click or use arrow keys to see details.",
140
+ description: "Text displayed, guiding user to interact to see more details.",
141
+ });
142
+ function abbrNumber(num) {
143
+ return num > 999 ? Math.round(num / 100) / 10 + "K" : num;
144
+ }
145
+ function amountToPercent(val, total, asInt) {
146
+ return asInt ? Math.round((val * 100) / total) : Math.round((val * 10000) / total) / 100; // with 2 decimals
147
+ }
148
+ function amountToDegree(val, total) {
149
+ // In a circle of {total}, determine degrees of slice {val}
150
+ return (val * 360) / total;
151
+ }
152
+ function toFixed(number) {
153
+ return parseFloat((Math.floor(number * 100) / 100).toFixed(2));
154
+ }
155
+ function polarToCartesian(half, radius, startAngle, endAngle) {
156
+ var x = toFixed(half + half * radius * Math.cos((Math.PI * startAngle) / 180));
157
+ var y = toFixed(half + half * radius * Math.sin((Math.PI * startAngle) / 180));
158
+ if (endAngle !== undefined) {
159
+ // if a 2nd angle value was passed, return 2 pairs of coords
160
+ var x2 = toFixed(half + half * radius * Math.cos((Math.PI * endAngle) / 180));
161
+ var y2 = toFixed(half + half * radius * Math.sin((Math.PI * endAngle) / 180));
162
+ return { x1: x, y1: y, x2, y2 };
163
+ }
164
+ return { x, y };
165
+ }
166
+ function getArc(radius, largeArcFlag, x, y, chartSize) {
167
+ var z = toFixed((chartSize / 2) * radius);
168
+ return `A ${z}, ${z} 0 ${largeArcFlag} ${toFixed(x)}, ${toFixed(y)}`;
169
+ }
170
+ function scale(val, inMin, inMax, outMin, outMax) {
171
+ let scaled = ((val - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
172
+ // clip the values so that whatever is passed in the output is never smaller than outMin or greater than outMax
173
+ return scaled < outMin ? outMin : scaled > outMax ? outMax : scaled;
174
+ }
175
+ function minSpacing(width) {
176
+ // minimum spacing between 2 ticks, in px
177
+ return scale(width, 300, 900, 70, 150);
178
+ }
179
+ function getMaxTicks(width) {
180
+ return Math.round(width / minSpacing(width));
181
+ }
182
+ function getInterval(largest, maxticks) {
183
+ const minimum = largest / maxticks;
184
+ const magnitude = 10 ** Math.floor(Math.log10(minimum));
185
+ const residual = minimum / magnitude;
186
+ let interval;
187
+ if (residual > 5) {
188
+ interval = 10 * magnitude;
189
+ }
190
+ else if (residual > 3) {
191
+ interval = 5 * magnitude;
192
+ }
193
+ else if (residual > 2) {
194
+ interval = 3 * magnitude;
195
+ }
196
+ else if (residual > 1.5) {
197
+ interval = 2 * magnitude;
198
+ }
199
+ else if (residual > 1) {
200
+ interval = 1.5 * magnitude;
201
+ }
202
+ else {
203
+ interval = magnitude;
204
+ }
205
+ return interval;
206
+ }
207
+ function handleSliceKeyDown(ev) {
208
+ if (this.popoverEl && this.popoverEl.open && ev.key === "Enter") {
209
+ const popoverBtn = this.popoverEl.querySelector("button");
210
+ popoverBtn && popoverBtn.click();
211
+ }
212
+ }
213
+ function handleSliceClick(ev, s) {
214
+ if (this.popoverEl && !this.isTabbing) {
215
+ s.coords = { x: ev.clientX, y: ev.clientY };
216
+ openPopover.call(this, s);
217
+ }
218
+ }
219
+ function handleSliceFocus(ev, s) {
220
+ if (this.popoverEl && this.isTabbing) {
221
+ s.coords = functions.getPosition(ev.target);
222
+ openPopover.call(this, s);
223
+ }
224
+ }
225
+ function handleChartKeydown(ev) {
226
+ switch (ev.key) {
227
+ // arrow up / left
228
+ case "ArrowUp":
229
+ case "ArrowLeft":
230
+ ev.preventDefault();
231
+ this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
232
+ focusPrevious.call(this);
233
+ break;
234
+ // arrow right / down
235
+ case "ArrowRight":
236
+ case "ArrowDown":
237
+ ev.preventDefault();
238
+ this.isTabbing = true; // shd already be true. just in case user clicked on chart then pressed an arrow key
239
+ focusNext.call(this);
240
+ break;
241
+ // tab
242
+ case "Tab":
243
+ exitChart.call(this);
244
+ break;
245
+ case "Escape":
246
+ this.popoverEl.open = false;
247
+ this.userIsNavigating = false;
248
+ break;
249
+ }
250
+ }
251
+ function openPopover(s) {
252
+ if (!!this.popoverEl && !!s.title && !!s.text) {
253
+ this.popoverEl.popoverTitle = s.title;
254
+ this.popoverEl.popoverText = s.text;
255
+ this.popoverEl.buttonText = s.buttonText;
256
+ this.popoverEl.coords = s.coords;
257
+ this.popoverEl.sliceRef = s.sliceRef;
258
+ window.setTimeout(() => {
259
+ if (this.popoverEl) {
260
+ this.popoverEl.open = true;
261
+ }
262
+ }, 30);
263
+ const debouncedClosePopover = functions.debounce(async () => {
264
+ this.popoverEl.open = false;
265
+ }, 10);
266
+ // set up event listeners for scrolling
267
+ // to close popover on page scroll
268
+ document.addEventListener("scroll", () => {
269
+ debouncedClosePopover();
270
+ });
271
+ // ... and on parent scroll
272
+ const scrollableParent = functions.findParentWithScrollbar(this.el);
273
+ if (!!scrollableParent) {
274
+ scrollableParent.addEventListener("scroll", () => {
275
+ debouncedClosePopover();
276
+ });
277
+ }
278
+ }
279
+ }
280
+ function focusNext() {
281
+ const activeEl = functions.checkForActiveElInShadow(document.activeElement);
282
+ const index =
283
+ // if the active el is not in the array the first element gets focused
284
+ (this.sliceEls.indexOf(activeEl) + 1) % this.sliceEls.length;
285
+ focusSlice.call(this, index);
286
+ }
287
+ function focusPrevious() {
288
+ if (this.sliceEls) {
289
+ const activeEl = functions.checkForActiveElInShadow(document.activeElement);
290
+ let index = this.sliceEls.indexOf(activeEl);
291
+ if (index === -1) {
292
+ // not in the array : focus the first slice
293
+ index = 0;
294
+ }
295
+ else if (index === 0) {
296
+ // first slice : focus the last slice
297
+ index = this.sliceEls.length - 1;
298
+ }
299
+ else {
300
+ // anything else: focus previous
301
+ index -= 1;
302
+ }
303
+ focusSlice.call(this, index);
304
+ }
305
+ }
306
+ function focusSlice(index) {
307
+ if (this.sliceEls && this.el) {
308
+ this.userIsNavigating = true;
309
+ if (this.popoverEl) {
310
+ this.popoverEl.open = false;
311
+ }
312
+ // set tabindex of the wrapper to -1 while slices are being focused, to allow for shft-tabbing out of the component directly
313
+ this.componentWrapperEl.tabIndex = -1;
314
+ // @ts-ignore
315
+ this.el.focusable = false; // for Edge
316
+ this.sliceEls.map((p) => {
317
+ p.tabIndex = -1;
318
+ // @ts-ignore
319
+ p.focusable = false; // for Edge
320
+ });
321
+ this.sliceEls[index].tabIndex = 0;
322
+ // @ts-ignore
323
+ this.sliceEls[index].focusable = true; // for Edge
324
+ this.sliceEls[index].focus();
325
+ window.setTimeout(() => {
326
+ if (this.popoverEl) {
327
+ this.popoverEl.open = true;
328
+ }
329
+ }, 10);
330
+ }
331
+ }
332
+ function exitChart() {
333
+ this.sliceEls &&
334
+ this.sliceEls.map((p) => {
335
+ p.tabIndex = -1;
336
+ // @ts-ignore
337
+ p.focusable = false; // for Edge
338
+ });
339
+ this.userIsNavigating = false;
340
+ // delay so that we can tab out of component before chart becomes focusable again
341
+ // and in case user was still pressing an arrow key when they pressed tab
342
+ window.setTimeout(() => {
343
+ this.componentWrapperEl.tabIndex = 0;
344
+ // @ts-ignore
345
+ this.el.focusable = true; // for Edge
346
+ if (this.popoverEl) {
347
+ this.popoverEl.open = false;
348
+ }
349
+ }, 100);
350
+ }
351
+ async function getDetails(chartType) {
352
+ this.slicesDetails = [];
353
+ let acc = 0;
354
+ const children = Array.from(this.el.children);
355
+ this.total = children.reduce((total, slice) => (total += parseInt(slice.getAttribute("amount") || "0")), 0);
356
+ children.forEach((c, i) => {
357
+ const amount = parseInt(c.getAttribute("amount") || "0");
358
+ const perc = amountToPercent(amount, this.total, true);
359
+ let colorIndex = i;
360
+ // for bar5, first color should be skipped unless notStartedColor is set to true
361
+ if (chartType === "bar5") {
362
+ colorIndex = this.notStartedColor ? i : i + 1;
363
+ }
364
+ // bars in bar6 are all the same color
365
+ if (chartType === "bar6") {
366
+ colorIndex = 0;
367
+ }
368
+ const color = allChartsDetails[chartType].colors[colorIndex];
369
+ const sliceDetails = {
370
+ amount: amount,
371
+ perc: perc,
372
+ legend: c.getAttribute("legend"),
373
+ color: color || colors.gray,
374
+ offset: acc,
375
+ id: `${this.uid}-${i + 1}`,
376
+ title: c.getAttribute("popover-title"),
377
+ text: c.getAttribute("popover-text"),
378
+ buttonText: c.getAttribute("popover-button-text"),
379
+ sliceRef: c,
380
+ inSmallCluster: false,
381
+ };
382
+ acc += amount;
383
+ this.slicesDetails.push(sliceDetails);
384
+ });
385
+ }
386
+ function sortSlicesDetails(slicesDetails, total) {
387
+ // sort slices by decreasing amount
388
+ let sortedSlicesDetails = [...slicesDetails].sort((a, b) => a.amount === b.amount ? 0 : a.amount > b.amount ? -1 : 1);
389
+ let acc = 0;
390
+ sortedSlicesDetails.forEach((s, idx) => {
391
+ const prev = sortedSlicesDetails[idx === 0 ? sortedSlicesDetails.length - 1 : idx - 1];
392
+ const next = sortedSlicesDetails[idx === sortedSlicesDetails.length - 1 ? 0 : idx + 1];
393
+ const prevPerc = amountToPercent(prev.amount, total, true);
394
+ const nextPerc = amountToPercent(next.amount, total, true);
395
+ s.offset = acc;
396
+ acc += s.amount;
397
+ s.inSmallCluster = isInSmallCluster(prevPerc, s.perc, s.amount, nextPerc);
398
+ });
399
+ return sortedSlicesDetails;
400
+ }
401
+ function isInSmallCluster(prevPerc, perc, amount, nextPerc) {
402
+ // determine whether the slice is in a cluster of small values
403
+ // to avoid percentage text overlap for small values
404
+ const isSmall = perc < 4;
405
+ const prevIsSmall = prevPerc < 5;
406
+ const nextIsSmall = nextPerc < 5;
407
+ let inSmallCluster = isSmall && (prevIsSmall || nextIsSmall);
408
+ // because <1% slice percentage text has an additional character
409
+ // the inSmallCluster threshold needs to be widened for that slice only
410
+ const lessThanOnePerc = perc === 0 && amount > 0;
411
+ if (lessThanOnePerc && (nextPerc < 8 || prevPerc < 8)) {
412
+ inSmallCluster = true;
413
+ }
414
+ return inSmallCluster;
415
+ }
416
+ function getPathData(amount, offset, chartType) {
417
+ const startAngle = amountToDegree(offset, this.total) - 90; // start at noon, not at 3 o'clock
418
+ const activeAngle = (amount / this.total) * 360;
419
+ let endAngle = startAngle + activeAngle;
420
+ const largeArcFlagOuter = activeAngle > 180 ? "1 1" : "0 1";
421
+ const largeArcFlagInner = activeAngle > 180 ? "1 0" : "0 0";
422
+ const half = this.chartDetails.size / 2;
423
+ const innerRadius = this.chartDetails.thickness;
424
+ const outerRadius = 1;
425
+ const isHybridDoughnut = chartType === "doughnut0" || chartType === "doughnut";
426
+ const outerSeparatorOffset = 1.5;
427
+ const innerSeparatorOffset = isHybridDoughnut ? 2.25 : 3;
428
+ if (activeAngle === 360) {
429
+ // fix to avoid bad svg shape when the path goes all around (100%)
430
+ endAngle -= 0.01;
431
+ }
432
+ const outerCoords = polarToCartesian(half, outerRadius, startAngle + outerSeparatorOffset, // Addition for slice separator
433
+ endAngle);
434
+ const innerCoords = polarToCartesian(half, innerRadius, startAngle + innerSeparatorOffset, // Addition for slice separator
435
+ endAngle);
436
+ const moveTo = `M ${outerCoords.x1}, ${outerCoords.y1} `;
437
+ const arc1 = getArc(outerRadius, largeArcFlagOuter, outerCoords.x2, outerCoords.y2, this.chartDetails.size);
438
+ const line = ` L ${innerCoords.x2}, ${innerCoords.y2} `;
439
+ const arc2 = getArc(innerRadius, largeArcFlagInner, innerCoords.x1, innerCoords.y1, this.chartDetails.size);
440
+ return moveTo + arc1 + line + arc2 + " z";
441
+ }
442
+ function renderInstructionsText() {
443
+ const chartInstructions = functions.intl.formatMessage({
444
+ id: "chart.instructions",
445
+ defaultMessage: "Use arrow keys to browse elements, press Tab to exit.",
446
+ description: "For screen readers only, instructions on how to interact with the chart component",
447
+ });
448
+ return index.h("div", { id: "chart-instructions" }, chartInstructions);
449
+ }
450
+ function renderFilter() {
451
+ return (index.h("defs", null,
452
+ index.h("filter", { id: "wmHoverDropShadow" },
453
+ index.h("feGaussianBlur", { stdDeviation: "3" }),
454
+ index.h("feOffset", { result: "offsetblur" }),
455
+ index.h("feFlood", { "flood-color": "#333" }),
456
+ index.h("feComposite", { operator: "in", in2: "offsetblur" }),
457
+ index.h("feMerge", null,
458
+ index.h("feMergeNode", null),
459
+ index.h("feMergeNode", { in: "SourceGraphic" })))));
460
+ }
461
+ function renderDoughnut(chartType) {
462
+ const outerSize = this.chartDetails.size + this.chartDetails.padding;
463
+ const isHybridDoughnut = chartType === "doughnut0" || chartType === "doughnut";
464
+ // no sorting in progress indicators
465
+ let slicesDetails = isHybridDoughnut ? this.slicesDetails : sortSlicesDetails(this.slicesDetails, this.total);
466
+ return (index.h("div", { class: "chart-wrapper doughnut-wrapper" },
467
+ index.h("svg", { width: outerSize + "px", height: outerSize + "px", id: `graphic-${this.uid}`, class: "doughnut-svg" },
468
+ renderFilter(),
469
+ slicesDetails.map((s) => renderPath.call(this, s, chartType)),
470
+ isHybridDoughnut ? (index.h("text", { class: "value", x: "50%", y: "50%", "font-size": "1.5rem", "font-weight": "500", "text-anchor": "middle", "dominant-baseline": "middle" }, amountToPercent(slicesDetails[0].amount, this.total, true) + "%")) : (index.h("g", { transform: `translate(${this.chartDetails.padding / 2}, ${this.chartDetails.padding / 2})`, "text-anchor": "middle", "dominant-baseline": "middle" }, slicesDetails.map((s) => s.amount > 0 && !s.inSmallCluster ? renderDoughnutText.call(this, s) : ""))))));
471
+ }
472
+ function renderPath(s, chartType) {
473
+ return (index.h("g", { transform: `translate(${this.chartDetails.padding / 2}, ${this.chartDetails.padding / 2})` },
474
+ index.h("path", { id: s.id, class: "segment doughnut-segment", fill: s.amount ? s.color : "transparent", d: getPathData.call(this, s.amount, s.offset, chartType), onClick: (ev) => handleSliceClick.call(this, ev, s), onFocus: (ev) => handleSliceFocus.call(this, ev, s), onKeyDown: (ev) => handleSliceKeyDown.call(this, ev), role: "img", "aria-label": s.legend })));
475
+ }
476
+ function renderDoughnutText(s) {
477
+ const arcMiddle = amountToDegree(s.offset + s.amount / 2, this.total);
478
+ let { x, y } = polarToCartesian(this.chartDetails.size / 2, 1.4, arcMiddle - 90);
479
+ return (index.h("text", { class: "value", x: x + "px", y: y + "px" }, `${s.perc > 0 ? s.perc : "<1"}%`));
480
+ }
481
+ function renderStackedBar(chartType) {
482
+ const isHybridBar = chartType === "bar1" || chartType === "bar";
483
+ return (index.h("div", { class: "chart-wrapper bar-wrapper" },
484
+ isHybridBar ? (index.h("div", { class: "single-perc" }, amountToPercent(this.slicesDetails[0].amount, this.total, true) + "%")) : (""),
485
+ this.chartType === "bar3" && this.drawAxis(),
486
+ index.h("div", { class: `inner-stacked-bar-wrapper ${showValue(this.tempValueFormat)}` },
487
+ !isHybridBar ? (index.h("div", { class: "values" }, this.slicesDetails.map((s, idx) => this.renderBarText(s, idx)))) : (""),
488
+ index.h("div", { class: "stacked-bar-segments-wrapper" }, this.slicesDetails.map((s, idx) => renderStackedBarSegment.call(this, s, idx))),
489
+ isHybridBar ? renderCompletionMessage.call(this) : "")));
490
+ }
491
+ function renderStackedBarSegment(s, idx) {
492
+ const isLastSlice = idx !== this.slicesDetails.length - 1;
493
+ const width = `calc(${amountToPercent(s.amount, this.total, false)}%${isLastSlice ? " - 2px" : ""})`;
494
+ return (index.h("div", { class: `segment stacked-bar-segment ${amountToPercent(s.amount, this.total, false) === 0 ? "zero" : ""}`, style: {
495
+ backgroundColor: s.color,
496
+ width: width,
497
+ }, onClick: (ev) => handleSliceClick.call(this, ev, s), onFocus: (ev) => handleSliceFocus.call(this, ev, s), onKeyDown: (ev) => handleSliceKeyDown.call(this, ev) },
498
+ index.h("span", { class: "sr-only" }, s.legend)));
499
+ }
500
+ function renderSimpleBar(chartType) {
501
+ // find largest number and get interval, numTicks, chartMaxVal for all.
502
+ const largest = this.slicesDetails
503
+ .map((s) => s.amount)
504
+ .reduce((a, b) => {
505
+ return a > b ? a : b;
506
+ });
507
+ const labelWidth = parseInt(getComputedStyle(this.el).getPropertyValue("--labelWidth"), 10);
508
+ const chartPadding = 48;
509
+ const componentWidth = this.el.getBoundingClientRect().width;
510
+ const chartWidth = componentWidth - labelWidth - chartPadding;
511
+ let numTicks = getMaxTicks(chartWidth);
512
+ let interval = getInterval(largest, numTicks);
513
+ // after the algorithm finds an interval, remove extra ticks so that the greater number is always between the last tick and the one before that
514
+ const lastTickVal = numTicks * interval;
515
+ const extraTicks = Math.floor((lastTickVal - largest) / interval);
516
+ numTicks -= extraTicks;
517
+ this.el.style.setProperty("--backgroundSize", 100 / numTicks + "%");
518
+ this.el.style.setProperty("--labelWidth", this.labelWidth);
519
+ if (chartType === "bar7" && !this.showBarLegend) {
520
+ this.el.style.setProperty("--labelWidth", "0px");
521
+ }
522
+ // we have to prep the data here rather than iterate directly in the return statement
523
+ // because CSS grid needs a flat structure, and return functions must
524
+ // have a single parent element
525
+ const rows = [];
526
+ this.slicesDetails.forEach((s) => {
527
+ s.legend && rows.push(renderSimpleBarLegend(s.legend, this.showBarLegend, chartType));
528
+ rows.push(renderSimpleBarItem.call(this, s, interval, numTicks, largest));
529
+ });
530
+ const ticks = [];
531
+ for (let i = 1; i <= numTicks; i++) {
532
+ const tickVal = abbrNumber(i * interval);
533
+ ticks.push(index.h("div", { class: "tick" },
534
+ index.h("span", null, tickVal)));
535
+ }
536
+ const showGrid = chartType === "bar6" && this.showGrid && this.el.getBoundingClientRect().width > 300;
537
+ return (index.h("div", { class: "chart-wrapper simple-bar-wrapper" },
538
+ index.h("div", { class: `chart ${showValue(this.tempValueFormat)}` },
539
+ showGrid && index.h("div", { class: "gridlines" }),
540
+ index.h("div", { class: "rows" }, rows)),
541
+ showGrid && (index.h("div", { class: "x-axis", "aria-hidden": "true" },
542
+ index.h("div", { class: "zero" },
543
+ index.h("span", null, "0")),
544
+ ticks))));
545
+ }
546
+ function renderSimpleBarLegend(legend, show, chartType) {
547
+ // not sure how to collapse the left column to 0 width with CSS grid. text should still be available to SR.
548
+ const hidden = chartType === "bar7" && !show ? " hidden" : "";
549
+ return index.h("label", { class: `label${hidden}` }, legend);
550
+ }
551
+ function renderSimpleBarItem(s, interval, ticks, largest) {
552
+ const chartMaxVal = this.currentChartType === "bar6" ? interval * ticks : largest;
553
+ const width = amountToPercent(s.amount, chartMaxVal, false);
554
+ const cssWidth = width ? width + "%" : "1px";
555
+ const amt = abbrNumber(s.amount);
556
+ let displayValue = this.tempValueFormat === "amount" ? amt : "";
557
+ if (this.currentChartType === "bar6" && this.tempValueFormat === "percentage") {
558
+ displayValue = s.amount + "%";
559
+ }
560
+ else if (this.currentChartType === "bar7" && this.tempValueFormat === "percentage") {
561
+ displayValue = amountToPercent(s.amount, this.total, true) + "%";
562
+ }
563
+ return (index.h("div", { class: "bar segment", style: {
564
+ backgroundColor: s.color,
565
+ width: cssWidth,
566
+ }, onClick: (ev) => handleSliceClick.call(this, ev, s), onFocus: (ev) => handleSliceFocus.call(this, ev, s), onKeyDown: (ev) => handleSliceKeyDown.call(this, ev) },
567
+ index.h("div", { class: "value" }, displayValue)));
568
+ }
569
+ function renderLegend(chartType) {
570
+ // legend is hidden for bar1 and bar6 types regardless of showLegend value
571
+ if (this.showLegend) {
572
+ const hasCluster = !this.chartDetails.isBar &&
573
+ this.slicesDetails.reduce((hasCluster, cur) => (hasCluster = cur.inSmallCluster ? true : hasCluster), false);
574
+ return (index.h("div", { class: "legend-wrapper" },
575
+ index.h("div", { class: `legend ${chartType} ${this.mode === "bar" ? "--top" : "--bottom"}`, "aria-hidden": "true" }, this.total > 0
576
+ ? this.slicesDetails.map((s) => {
577
+ // when both legend and amount are omitted, the legend is not shown for that particular option (it's been deactivated by the user)
578
+ if (!!s.amount || !!s.legend) {
579
+ return renderLegendItem({ key: s.legend, color: s.color });
580
+ }
581
+ })
582
+ : ""),
583
+ hasCluster && renderHiddenValuesMessage()));
584
+ }
585
+ }
586
+ function renderLegendItem(legendItem) {
587
+ return (index.h("div", { class: "legend-item" },
588
+ index.h("div", { class: "legend-color", style: { backgroundColor: legendItem.color } }),
589
+ index.h("div", { class: "legend-text" }, legendItem.key)));
590
+ }
591
+ function renderCompletionMessage() {
592
+ if (this.completionMessage) {
593
+ return index.h("div", { class: "completion-message" }, this.completionMessage);
594
+ }
595
+ }
596
+ function renderHiddenValuesMessage() {
597
+ return (index.h("div", { class: "hidden-values-warning" },
598
+ textHiddenMessage,
599
+ index.h("br", null),
600
+ seeDetailsMessage));
601
601
  }
602
602
 
603
603
  exports.allChartsDetails = allChartsDetails;