@refinitiv-ui/elements 5.3.3 → 5.7.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 (617) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/lib/accordion/custom-elements.json +49 -0
  3. package/lib/accordion/custom-elements.md +18 -0
  4. package/lib/accordion/index.d.ts +76 -0
  5. package/lib/accordion/index.js +136 -0
  6. package/lib/accordion/themes/halo/dark/index.js +3 -0
  7. package/lib/accordion/themes/halo/light/index.js +3 -0
  8. package/lib/accordion/themes/solar/charcoal/index.js +3 -0
  9. package/lib/accordion/themes/solar/pearl/index.js +3 -0
  10. package/lib/appstate-bar/custom-elements.json +49 -0
  11. package/lib/appstate-bar/custom-elements.md +22 -0
  12. package/lib/appstate-bar/index.d.ts +65 -0
  13. package/lib/appstate-bar/index.js +100 -0
  14. package/lib/appstate-bar/themes/halo/dark/index.js +3 -0
  15. package/lib/appstate-bar/themes/halo/light/index.js +3 -0
  16. package/lib/appstate-bar/themes/solar/charcoal/index.js +3 -0
  17. package/lib/appstate-bar/themes/solar/pearl/index.js +3 -0
  18. package/lib/autosuggest/custom-elements.json +233 -0
  19. package/lib/autosuggest/custom-elements.md +47 -0
  20. package/lib/autosuggest/helpers/types.d.ts +54 -0
  21. package/lib/autosuggest/helpers/types.js +1 -0
  22. package/lib/autosuggest/helpers/utils.d.ts +39 -0
  23. package/lib/autosuggest/helpers/utils.js +75 -0
  24. package/lib/autosuggest/index.d.ts +534 -0
  25. package/lib/autosuggest/index.js +1251 -0
  26. package/lib/autosuggest/themes/halo/dark/index.js +5 -0
  27. package/lib/autosuggest/themes/halo/light/index.js +5 -0
  28. package/lib/autosuggest/themes/solar/charcoal/index.js +5 -0
  29. package/lib/autosuggest/themes/solar/pearl/index.js +5 -0
  30. package/lib/button/custom-elements.json +119 -0
  31. package/lib/button/custom-elements.md +23 -0
  32. package/lib/button/index.d.ts +132 -0
  33. package/lib/button/index.js +223 -0
  34. package/lib/button/themes/halo/dark/index.js +3 -0
  35. package/lib/button/themes/halo/light/index.js +3 -0
  36. package/lib/button/themes/solar/charcoal/index.js +3 -0
  37. package/lib/button/themes/solar/pearl/index.js +3 -0
  38. package/lib/button-bar/custom-elements.json +26 -0
  39. package/lib/button-bar/custom-elements.md +9 -0
  40. package/lib/button-bar/index.d.ts +76 -0
  41. package/lib/button-bar/index.js +155 -0
  42. package/lib/button-bar/themes/halo/dark/index.js +3 -0
  43. package/lib/button-bar/themes/halo/light/index.js +3 -0
  44. package/lib/button-bar/themes/solar/charcoal/index.js +3 -0
  45. package/lib/button-bar/themes/solar/pearl/index.js +3 -0
  46. package/lib/calendar/constants.d.ts +22 -0
  47. package/lib/calendar/constants.js +23 -0
  48. package/lib/calendar/custom-elements.json +199 -0
  49. package/lib/calendar/custom-elements.md +35 -0
  50. package/lib/calendar/index.d.ts +321 -0
  51. package/lib/calendar/index.js +906 -0
  52. package/lib/calendar/locales.d.ts +1 -0
  53. package/lib/calendar/locales.js +40 -0
  54. package/lib/calendar/themes/halo/dark/index.js +3 -0
  55. package/lib/calendar/themes/halo/light/index.js +3 -0
  56. package/lib/calendar/themes/solar/charcoal/index.js +3 -0
  57. package/lib/calendar/themes/solar/pearl/index.js +3 -0
  58. package/lib/calendar/types.d.ts +29 -0
  59. package/lib/calendar/types.js +1 -0
  60. package/lib/calendar/utils.d.ts +42 -0
  61. package/lib/calendar/utils.js +119 -0
  62. package/lib/canvas/custom-elements.json +69 -0
  63. package/lib/canvas/custom-elements.md +27 -0
  64. package/lib/canvas/index.d.ts +100 -0
  65. package/lib/canvas/index.js +172 -0
  66. package/lib/canvas/themes/halo/dark/index.js +2 -0
  67. package/lib/canvas/themes/halo/light/index.js +2 -0
  68. package/lib/canvas/themes/solar/charcoal/index.js +2 -0
  69. package/lib/canvas/themes/solar/pearl/index.js +2 -0
  70. package/lib/card/custom-elements.json +59 -0
  71. package/lib/card/custom-elements.md +24 -0
  72. package/lib/card/helpers/types.d.ts +12 -0
  73. package/lib/card/helpers/types.js +1 -0
  74. package/lib/card/index.d.ts +140 -0
  75. package/lib/card/index.js +246 -0
  76. package/lib/card/themes/halo/dark/index.js +5 -0
  77. package/lib/card/themes/halo/light/index.js +5 -0
  78. package/lib/card/themes/solar/charcoal/index.js +5 -0
  79. package/lib/card/themes/solar/pearl/index.js +5 -0
  80. package/lib/chart/custom-elements.json +42 -0
  81. package/lib/chart/custom-elements.md +16 -0
  82. package/lib/chart/helpers/index.d.ts +2 -0
  83. package/lib/chart/helpers/index.js +2 -0
  84. package/lib/chart/helpers/legend.d.ts +5 -0
  85. package/lib/chart/helpers/legend.js +78 -0
  86. package/lib/chart/helpers/merge.d.ts +15 -0
  87. package/lib/chart/helpers/merge.js +28 -0
  88. package/lib/chart/helpers/types.d.ts +69 -0
  89. package/lib/chart/helpers/types.js +1 -0
  90. package/lib/chart/index.d.ts +187 -0
  91. package/lib/chart/index.js +491 -0
  92. package/lib/chart/plugins/doughnut-center-label.d.ts +3 -0
  93. package/lib/chart/plugins/doughnut-center-label.js +196 -0
  94. package/lib/chart/themes/halo/dark/index.js +4 -0
  95. package/lib/chart/themes/halo/light/index.js +4 -0
  96. package/lib/chart/themes/solar/charcoal/index.js +4 -0
  97. package/lib/chart/themes/solar/pearl/index.js +4 -0
  98. package/lib/checkbox/custom-elements.json +67 -0
  99. package/lib/checkbox/custom-elements.md +18 -0
  100. package/lib/checkbox/index.d.ts +95 -0
  101. package/lib/checkbox/index.js +193 -0
  102. package/lib/checkbox/themes/halo/dark/index.js +4 -0
  103. package/lib/checkbox/themes/halo/light/index.js +4 -0
  104. package/lib/checkbox/themes/solar/charcoal/index.js +4 -0
  105. package/lib/checkbox/themes/solar/pearl/index.js +4 -0
  106. package/lib/clock/custom-elements.json +121 -0
  107. package/lib/clock/custom-elements.md +28 -0
  108. package/lib/clock/index.d.ts +319 -0
  109. package/lib/clock/index.js +581 -0
  110. package/lib/clock/themes/halo/dark/index.js +2 -0
  111. package/lib/clock/themes/halo/light/index.js +2 -0
  112. package/lib/clock/themes/solar/charcoal/index.js +2 -0
  113. package/lib/clock/themes/solar/pearl/index.js +2 -0
  114. package/lib/clock/utils/TickManager.d.ts +14 -0
  115. package/lib/clock/utils/TickManager.js +66 -0
  116. package/lib/clock/utils/timestamps.d.ts +6 -0
  117. package/lib/clock/utils/timestamps.js +6 -0
  118. package/lib/collapse/custom-elements.json +79 -0
  119. package/lib/collapse/custom-elements.md +27 -0
  120. package/lib/collapse/index.d.ts +119 -0
  121. package/lib/collapse/index.js +197 -0
  122. package/lib/collapse/themes/halo/dark/index.js +5 -0
  123. package/lib/collapse/themes/halo/light/index.js +5 -0
  124. package/lib/collapse/themes/solar/charcoal/index.js +5 -0
  125. package/lib/collapse/themes/solar/pearl/index.js +5 -0
  126. package/lib/color-dialog/custom-elements.json +193 -0
  127. package/lib/color-dialog/custom-elements.md +39 -0
  128. package/lib/color-dialog/elements/color-palettes.d.ts +52 -0
  129. package/lib/color-dialog/elements/color-palettes.js +101 -0
  130. package/lib/color-dialog/elements/grayscale-palettes.d.ts +67 -0
  131. package/lib/color-dialog/elements/grayscale-palettes.js +161 -0
  132. package/lib/color-dialog/elements/palettes.d.ts +65 -0
  133. package/lib/color-dialog/elements/palettes.js +132 -0
  134. package/lib/color-dialog/helpers/color-helpers.d.ts +16 -0
  135. package/lib/color-dialog/helpers/color-helpers.js +161 -0
  136. package/lib/color-dialog/helpers/value-model.d.ts +75 -0
  137. package/lib/color-dialog/helpers/value-model.js +141 -0
  138. package/lib/color-dialog/index.d.ts +232 -0
  139. package/lib/color-dialog/index.js +459 -0
  140. package/lib/color-dialog/themes/halo/dark/index.js +7 -0
  141. package/lib/color-dialog/themes/halo/light/index.js +7 -0
  142. package/lib/color-dialog/themes/solar/charcoal/index.js +7 -0
  143. package/lib/color-dialog/themes/solar/pearl/index.js +7 -0
  144. package/lib/combo-box/custom-elements.json +210 -0
  145. package/lib/combo-box/custom-elements.md +35 -0
  146. package/lib/combo-box/helpers/filter.d.ts +10 -0
  147. package/lib/combo-box/helpers/filter.js +29 -0
  148. package/lib/combo-box/helpers/keyboard-event.d.ts +17 -0
  149. package/lib/combo-box/helpers/keyboard-event.js +19 -0
  150. package/lib/combo-box/helpers/types.d.ts +11 -0
  151. package/lib/combo-box/helpers/types.js +1 -0
  152. package/lib/combo-box/index.d.ts +523 -0
  153. package/lib/combo-box/index.js +1146 -0
  154. package/lib/combo-box/themes/halo/dark/index.js +8 -0
  155. package/lib/combo-box/themes/halo/light/index.js +8 -0
  156. package/lib/combo-box/themes/solar/charcoal/index.js +8 -0
  157. package/lib/combo-box/themes/solar/pearl/index.js +8 -0
  158. package/lib/counter/custom-elements.json +35 -0
  159. package/lib/counter/custom-elements.md +11 -0
  160. package/lib/counter/index.d.ts +89 -0
  161. package/lib/counter/index.js +152 -0
  162. package/lib/counter/themes/halo/dark/index.js +3 -0
  163. package/lib/counter/themes/halo/light/index.js +3 -0
  164. package/lib/counter/themes/solar/charcoal/index.js +3 -0
  165. package/lib/counter/themes/solar/pearl/index.js +3 -0
  166. package/lib/counter/utils.d.ts +13 -0
  167. package/lib/counter/utils.js +52 -0
  168. package/lib/datetime-picker/custom-elements.json +333 -0
  169. package/lib/datetime-picker/custom-elements.md +49 -0
  170. package/lib/datetime-picker/index.d.ts +498 -0
  171. package/lib/datetime-picker/index.js +1164 -0
  172. package/lib/datetime-picker/locales.d.ts +8 -0
  173. package/lib/datetime-picker/locales.js +57 -0
  174. package/lib/datetime-picker/themes/halo/dark/index.js +7 -0
  175. package/lib/datetime-picker/themes/halo/light/index.js +7 -0
  176. package/lib/datetime-picker/themes/solar/charcoal/index.js +7 -0
  177. package/lib/datetime-picker/themes/solar/pearl/index.js +7 -0
  178. package/lib/datetime-picker/types.d.ts +3 -0
  179. package/lib/datetime-picker/types.js +1 -0
  180. package/lib/datetime-picker/utils.d.ts +55 -0
  181. package/lib/datetime-picker/utils.js +92 -0
  182. package/lib/dialog/custom-elements.json +136 -0
  183. package/lib/dialog/custom-elements.md +47 -0
  184. package/lib/dialog/draggable-element.d.ts +14 -0
  185. package/lib/dialog/draggable-element.js +221 -0
  186. package/lib/dialog/index.d.ts +199 -0
  187. package/lib/dialog/index.js +331 -0
  188. package/lib/dialog/themes/halo/dark/index.js +7 -0
  189. package/lib/dialog/themes/halo/light/index.js +7 -0
  190. package/lib/dialog/themes/solar/charcoal/index.js +7 -0
  191. package/lib/dialog/themes/solar/pearl/index.js +7 -0
  192. package/lib/email-field/custom-elements.json +199 -0
  193. package/lib/email-field/custom-elements.md +35 -0
  194. package/lib/email-field/index.d.ts +152 -0
  195. package/lib/email-field/index.js +286 -0
  196. package/lib/email-field/themes/halo/dark/index.js +3 -0
  197. package/lib/email-field/themes/halo/light/index.js +3 -0
  198. package/lib/email-field/themes/solar/charcoal/index.js +3 -0
  199. package/lib/email-field/themes/solar/pearl/index.js +3 -0
  200. package/lib/events.d.ts +121 -0
  201. package/lib/events.js +1 -0
  202. package/lib/flag/custom-elements.json +35 -0
  203. package/lib/flag/custom-elements.md +10 -0
  204. package/lib/flag/index.d.ts +94 -0
  205. package/lib/flag/index.js +166 -0
  206. package/lib/flag/themes/halo/dark/index.js +2 -0
  207. package/lib/flag/themes/halo/light/index.js +2 -0
  208. package/lib/flag/themes/solar/charcoal/index.js +2 -0
  209. package/lib/flag/themes/solar/pearl/index.js +2 -0
  210. package/lib/flag/utils/FlagLoader.d.ts +47 -0
  211. package/lib/flag/utils/FlagLoader.js +86 -0
  212. package/lib/header/custom-elements.json +36 -0
  213. package/lib/header/custom-elements.md +18 -0
  214. package/lib/header/index.d.ts +46 -0
  215. package/lib/header/index.js +73 -0
  216. package/lib/header/themes/halo/dark/index.js +2 -0
  217. package/lib/header/themes/halo/light/index.js +2 -0
  218. package/lib/header/themes/solar/charcoal/index.js +2 -0
  219. package/lib/header/themes/solar/pearl/index.js +2 -0
  220. package/lib/heatmap/custom-elements.json +151 -0
  221. package/lib/heatmap/custom-elements.md +26 -0
  222. package/lib/heatmap/helpers/color.d.ts +30 -0
  223. package/lib/heatmap/helpers/color.js +68 -0
  224. package/lib/heatmap/helpers/text.d.ts +26 -0
  225. package/lib/heatmap/helpers/text.js +91 -0
  226. package/lib/heatmap/helpers/track.d.ts +102 -0
  227. package/lib/heatmap/helpers/track.js +160 -0
  228. package/lib/heatmap/helpers/types.d.ts +40 -0
  229. package/lib/heatmap/helpers/types.js +1 -0
  230. package/lib/heatmap/index.d.ts +453 -0
  231. package/lib/heatmap/index.js +1103 -0
  232. package/lib/heatmap/themes/halo/dark/index.js +4 -0
  233. package/lib/heatmap/themes/halo/light/index.js +4 -0
  234. package/lib/heatmap/themes/solar/charcoal/index.js +4 -0
  235. package/lib/heatmap/themes/solar/pearl/index.js +4 -0
  236. package/lib/icon/custom-elements.json +36 -0
  237. package/lib/icon/custom-elements.md +8 -0
  238. package/lib/icon/index.d.ts +88 -0
  239. package/lib/icon/index.js +169 -0
  240. package/lib/icon/themes/halo/dark/index.js +2 -0
  241. package/lib/icon/themes/halo/light/index.js +2 -0
  242. package/lib/icon/themes/solar/charcoal/index.js +2 -0
  243. package/lib/icon/themes/solar/pearl/index.js +2 -0
  244. package/lib/icon/utils/IconLoader.d.ts +52 -0
  245. package/lib/icon/utils/IconLoader.js +93 -0
  246. package/lib/index.d.ts +3 -0
  247. package/lib/index.js +3 -0
  248. package/lib/interactive-chart/custom-elements.json +86 -0
  249. package/lib/interactive-chart/custom-elements.md +32 -0
  250. package/lib/interactive-chart/helpers/merge.d.ts +15 -0
  251. package/lib/interactive-chart/helpers/merge.js +28 -0
  252. package/lib/interactive-chart/helpers/types.d.ts +45 -0
  253. package/lib/interactive-chart/helpers/types.js +6 -0
  254. package/lib/interactive-chart/index.d.ts +380 -0
  255. package/lib/interactive-chart/index.js +1090 -0
  256. package/lib/interactive-chart/themes/halo/dark/index.js +3 -0
  257. package/lib/interactive-chart/themes/halo/light/index.js +3 -0
  258. package/lib/interactive-chart/themes/solar/charcoal/index.js +3 -0
  259. package/lib/interactive-chart/themes/solar/pearl/index.js +3 -0
  260. package/lib/item/custom-elements.json +151 -0
  261. package/lib/item/custom-elements.md +29 -0
  262. package/lib/item/helpers/types.d.ts +57 -0
  263. package/lib/item/helpers/types.js +1 -0
  264. package/lib/item/index.d.ts +158 -0
  265. package/lib/item/index.js +271 -0
  266. package/lib/item/themes/halo/dark/index.js +4 -0
  267. package/lib/item/themes/halo/light/index.js +4 -0
  268. package/lib/item/themes/solar/charcoal/index.js +4 -0
  269. package/lib/item/themes/solar/pearl/index.js +4 -0
  270. package/lib/jsx.d.ts +223 -0
  271. package/lib/label/custom-elements.json +52 -0
  272. package/lib/label/custom-elements.md +11 -0
  273. package/lib/label/index.d.ts +102 -0
  274. package/lib/label/index.js +244 -0
  275. package/lib/label/themes/halo/dark/index.js +3 -0
  276. package/lib/label/themes/halo/light/index.js +3 -0
  277. package/lib/label/themes/solar/charcoal/index.js +3 -0
  278. package/lib/label/themes/solar/pearl/index.js +3 -0
  279. package/lib/layout/custom-elements.json +163 -0
  280. package/lib/layout/custom-elements.md +26 -0
  281. package/lib/layout/index.d.ts +107 -0
  282. package/lib/layout/index.js +212 -0
  283. package/lib/layout/themes/halo/dark/index.js +2 -0
  284. package/lib/layout/themes/halo/light/index.js +2 -0
  285. package/lib/layout/themes/solar/charcoal/index.js +2 -0
  286. package/lib/layout/themes/solar/pearl/index.js +2 -0
  287. package/lib/led-gauge/custom-elements.json +113 -0
  288. package/lib/led-gauge/custom-elements.md +17 -0
  289. package/lib/led-gauge/index.d.ts +143 -0
  290. package/lib/led-gauge/index.js +437 -0
  291. package/lib/led-gauge/themes/halo/dark/index.js +3 -0
  292. package/lib/led-gauge/themes/halo/light/index.js +3 -0
  293. package/lib/led-gauge/themes/solar/charcoal/index.js +3 -0
  294. package/lib/led-gauge/themes/solar/pearl/index.js +3 -0
  295. package/lib/list/custom-elements.json +111 -0
  296. package/lib/list/custom-elements.md +30 -0
  297. package/lib/list/extensible-function.d.ts +8 -0
  298. package/lib/list/extensible-function.js +13 -0
  299. package/lib/list/helpers/list-renderer.d.ts +9 -0
  300. package/lib/list/helpers/list-renderer.js +35 -0
  301. package/lib/list/helpers/types.d.ts +3 -0
  302. package/lib/list/helpers/types.js +1 -0
  303. package/lib/list/index.d.ts +292 -0
  304. package/lib/list/index.js +600 -0
  305. package/lib/list/renderer.d.ts +36 -0
  306. package/lib/list/renderer.js +9 -0
  307. package/lib/list/themes/halo/dark/index.js +3 -0
  308. package/lib/list/themes/halo/light/index.js +3 -0
  309. package/lib/list/themes/solar/charcoal/index.js +3 -0
  310. package/lib/list/themes/solar/pearl/index.js +3 -0
  311. package/lib/loader/custom-elements.json +9 -0
  312. package/lib/loader/custom-elements.md +5 -0
  313. package/lib/loader/index.d.ts +41 -0
  314. package/lib/loader/index.js +61 -0
  315. package/lib/loader/themes/halo/dark/index.js +2 -0
  316. package/lib/loader/themes/halo/light/index.js +2 -0
  317. package/lib/loader/themes/solar/charcoal/index.js +2 -0
  318. package/lib/loader/themes/solar/pearl/index.js +2 -0
  319. package/lib/multi-input/custom-elements.json +238 -0
  320. package/lib/multi-input/custom-elements.md +43 -0
  321. package/lib/multi-input/helpers/types.d.ts +11 -0
  322. package/lib/multi-input/helpers/types.js +1 -0
  323. package/lib/multi-input/index.d.ts +297 -0
  324. package/lib/multi-input/index.js +590 -0
  325. package/lib/multi-input/themes/halo/dark/index.js +4 -0
  326. package/lib/multi-input/themes/halo/light/index.js +4 -0
  327. package/lib/multi-input/themes/solar/charcoal/index.js +4 -0
  328. package/lib/multi-input/themes/solar/pearl/index.js +4 -0
  329. package/lib/notification/custom-elements.json +95 -0
  330. package/lib/notification/custom-elements.md +26 -0
  331. package/lib/notification/elements/notification-tray.d.ts +97 -0
  332. package/lib/notification/elements/notification-tray.js +167 -0
  333. package/lib/notification/elements/notification.d.ts +90 -0
  334. package/lib/notification/elements/notification.js +154 -0
  335. package/lib/notification/helpers/status.d.ts +30 -0
  336. package/lib/notification/helpers/status.js +130 -0
  337. package/lib/notification/helpers/types.d.ts +10 -0
  338. package/lib/notification/helpers/types.js +1 -0
  339. package/lib/notification/index.d.ts +2 -0
  340. package/lib/notification/index.js +2 -0
  341. package/lib/notification/themes/halo/dark/index.js +5 -0
  342. package/lib/notification/themes/halo/light/index.js +5 -0
  343. package/lib/notification/themes/solar/charcoal/index.js +5 -0
  344. package/lib/notification/themes/solar/pearl/index.js +5 -0
  345. package/lib/number-field/custom-elements.json +200 -0
  346. package/lib/number-field/custom-elements.md +37 -0
  347. package/lib/number-field/index.d.ts +294 -0
  348. package/lib/number-field/index.js +707 -0
  349. package/lib/number-field/themes/halo/dark/index.js +3 -0
  350. package/lib/number-field/themes/halo/light/index.js +3 -0
  351. package/lib/number-field/themes/solar/charcoal/index.js +3 -0
  352. package/lib/number-field/themes/solar/pearl/index.js +3 -0
  353. package/lib/overlay/custom-elements.json +345 -0
  354. package/lib/overlay/custom-elements.md +54 -0
  355. package/lib/overlay/elements/overlay-backdrop.d.ts +46 -0
  356. package/lib/overlay/elements/overlay-backdrop.js +64 -0
  357. package/lib/overlay/elements/overlay-viewport.d.ts +40 -0
  358. package/lib/overlay/elements/overlay-viewport.js +52 -0
  359. package/lib/overlay/elements/overlay.d.ts +403 -0
  360. package/lib/overlay/elements/overlay.js +1426 -0
  361. package/lib/overlay/helpers/functions.d.ts +13 -0
  362. package/lib/overlay/helpers/functions.js +16 -0
  363. package/lib/overlay/helpers/types.d.ts +97 -0
  364. package/lib/overlay/helpers/types.js +16 -0
  365. package/lib/overlay/index.d.ts +2 -0
  366. package/lib/overlay/index.js +1 -0
  367. package/lib/overlay/managers/backdrop-manager.d.ts +45 -0
  368. package/lib/overlay/managers/backdrop-manager.js +96 -0
  369. package/lib/overlay/managers/close-manager.d.ts +54 -0
  370. package/lib/overlay/managers/close-manager.js +138 -0
  371. package/lib/overlay/managers/focus-manager.d.ts +71 -0
  372. package/lib/overlay/managers/focus-manager.js +228 -0
  373. package/lib/overlay/managers/interaction-lock-manager.d.ts +138 -0
  374. package/lib/overlay/managers/interaction-lock-manager.js +375 -0
  375. package/lib/overlay/managers/viewport-manager.d.ts +93 -0
  376. package/lib/overlay/managers/viewport-manager.js +211 -0
  377. package/lib/overlay/managers/zindex-manager.d.ts +80 -0
  378. package/lib/overlay/managers/zindex-manager.js +195 -0
  379. package/lib/overlay/themes/halo/dark/index.js +4 -0
  380. package/lib/overlay/themes/halo/light/index.js +4 -0
  381. package/lib/overlay/themes/solar/charcoal/index.js +4 -0
  382. package/lib/overlay/themes/solar/pearl/index.js +4 -0
  383. package/lib/overlay-menu/custom-elements.json +194 -0
  384. package/lib/overlay-menu/custom-elements.md +44 -0
  385. package/lib/overlay-menu/helpers/types.d.ts +8 -0
  386. package/lib/overlay-menu/helpers/types.js +1 -0
  387. package/lib/overlay-menu/index.d.ts +385 -0
  388. package/lib/overlay-menu/index.js +933 -0
  389. package/lib/overlay-menu/managers/menu-manager.d.ts +98 -0
  390. package/lib/overlay-menu/managers/menu-manager.js +240 -0
  391. package/lib/overlay-menu/themes/halo/dark/index.js +5 -0
  392. package/lib/overlay-menu/themes/halo/light/index.js +5 -0
  393. package/lib/overlay-menu/themes/solar/charcoal/index.js +5 -0
  394. package/lib/overlay-menu/themes/solar/pearl/index.js +5 -0
  395. package/lib/pagination/custom-elements.json +93 -0
  396. package/lib/pagination/custom-elements.md +27 -0
  397. package/lib/pagination/helpers/types.d.ts +9 -0
  398. package/lib/pagination/helpers/types.js +1 -0
  399. package/lib/pagination/index.d.ts +207 -0
  400. package/lib/pagination/index.js +398 -0
  401. package/lib/pagination/themes/halo/dark/index.js +6 -0
  402. package/lib/pagination/themes/halo/light/index.js +6 -0
  403. package/lib/pagination/themes/solar/charcoal/index.js +6 -0
  404. package/lib/pagination/themes/solar/pearl/index.js +6 -0
  405. package/lib/panel/custom-elements.json +39 -0
  406. package/lib/panel/custom-elements.md +11 -0
  407. package/lib/panel/index.d.ts +48 -0
  408. package/lib/panel/index.js +74 -0
  409. package/lib/panel/themes/halo/dark/index.js +2 -0
  410. package/lib/panel/themes/halo/light/index.js +2 -0
  411. package/lib/panel/themes/solar/charcoal/index.js +2 -0
  412. package/lib/panel/themes/solar/pearl/index.js +2 -0
  413. package/lib/password-field/custom-elements.json +156 -0
  414. package/lib/password-field/custom-elements.md +31 -0
  415. package/lib/password-field/index.d.ts +141 -0
  416. package/lib/password-field/index.js +258 -0
  417. package/lib/password-field/themes/halo/dark/index.js +3 -0
  418. package/lib/password-field/themes/halo/light/index.js +3 -0
  419. package/lib/password-field/themes/solar/charcoal/index.js +3 -0
  420. package/lib/password-field/themes/solar/pearl/index.js +3 -0
  421. package/lib/pill/custom-elements.json +95 -0
  422. package/lib/pill/custom-elements.md +22 -0
  423. package/lib/pill/index.d.ts +97 -0
  424. package/lib/pill/index.js +160 -0
  425. package/lib/pill/themes/halo/dark/index.js +3 -0
  426. package/lib/pill/themes/halo/light/index.js +3 -0
  427. package/lib/pill/themes/solar/charcoal/index.js +3 -0
  428. package/lib/pill/themes/solar/pearl/index.js +3 -0
  429. package/lib/progress-bar/custom-elements.json +58 -0
  430. package/lib/progress-bar/custom-elements.md +18 -0
  431. package/lib/progress-bar/index.d.ts +82 -0
  432. package/lib/progress-bar/index.js +157 -0
  433. package/lib/progress-bar/themes/halo/dark/index.js +2 -0
  434. package/lib/progress-bar/themes/halo/light/index.js +2 -0
  435. package/lib/progress-bar/themes/solar/charcoal/index.js +2 -0
  436. package/lib/progress-bar/themes/solar/pearl/index.js +2 -0
  437. package/lib/radio-button/custom-elements.json +82 -0
  438. package/lib/radio-button/custom-elements.md +19 -0
  439. package/lib/radio-button/index.d.ts +122 -0
  440. package/lib/radio-button/index.js +257 -0
  441. package/lib/radio-button/radio-button-registry.d.ts +22 -0
  442. package/lib/radio-button/radio-button-registry.js +93 -0
  443. package/lib/radio-button/themes/halo/dark/index.js +3 -0
  444. package/lib/radio-button/themes/halo/light/index.js +3 -0
  445. package/lib/radio-button/themes/solar/charcoal/index.js +3 -0
  446. package/lib/radio-button/themes/solar/pearl/index.js +3 -0
  447. package/lib/rating/custom-elements.json +58 -0
  448. package/lib/rating/custom-elements.md +17 -0
  449. package/lib/rating/index.d.ts +91 -0
  450. package/lib/rating/index.js +157 -0
  451. package/lib/rating/themes/halo/dark/index.js +2 -0
  452. package/lib/rating/themes/halo/light/index.js +2 -0
  453. package/lib/rating/themes/solar/charcoal/index.js +2 -0
  454. package/lib/rating/themes/solar/pearl/index.js +2 -0
  455. package/lib/search-field/custom-elements.json +173 -0
  456. package/lib/search-field/custom-elements.md +33 -0
  457. package/lib/search-field/index.d.ts +134 -0
  458. package/lib/search-field/index.js +253 -0
  459. package/lib/search-field/themes/halo/dark/index.js +3 -0
  460. package/lib/search-field/themes/halo/light/index.js +3 -0
  461. package/lib/search-field/themes/solar/charcoal/index.js +3 -0
  462. package/lib/search-field/themes/solar/pearl/index.js +3 -0
  463. package/lib/select/custom-elements.json +103 -0
  464. package/lib/select/custom-elements.md +24 -0
  465. package/lib/select/helpers/types.d.ts +3 -0
  466. package/lib/select/helpers/types.js +1 -0
  467. package/lib/select/index.d.ts +388 -0
  468. package/lib/select/index.js +942 -0
  469. package/lib/select/themes/halo/dark/index.js +5 -0
  470. package/lib/select/themes/halo/light/index.js +5 -0
  471. package/lib/select/themes/solar/charcoal/index.js +5 -0
  472. package/lib/select/themes/solar/pearl/index.js +5 -0
  473. package/lib/sidebar-layout/custom-elements.json +72 -0
  474. package/lib/sidebar-layout/custom-elements.md +22 -0
  475. package/lib/sidebar-layout/index.d.ts +69 -0
  476. package/lib/sidebar-layout/index.js +134 -0
  477. package/lib/sidebar-layout/themes/halo/dark/index.js +3 -0
  478. package/lib/sidebar-layout/themes/halo/light/index.js +3 -0
  479. package/lib/sidebar-layout/themes/solar/charcoal/index.js +3 -0
  480. package/lib/sidebar-layout/themes/solar/pearl/index.js +3 -0
  481. package/lib/slider/custom-elements.json +181 -0
  482. package/lib/slider/custom-elements.md +28 -0
  483. package/lib/slider/index.d.ts +409 -0
  484. package/lib/slider/index.js +1187 -0
  485. package/lib/slider/themes/halo/dark/index.js +3 -0
  486. package/lib/slider/themes/halo/light/index.js +3 -0
  487. package/lib/slider/themes/solar/charcoal/index.js +3 -0
  488. package/lib/slider/themes/solar/pearl/index.js +3 -0
  489. package/lib/sparkline/custom-elements.json +59 -0
  490. package/lib/sparkline/custom-elements.md +16 -0
  491. package/lib/sparkline/index.d.ts +107 -0
  492. package/lib/sparkline/index.js +186 -0
  493. package/lib/sparkline/themes/halo/dark/index.js +2 -0
  494. package/lib/sparkline/themes/halo/light/index.js +2 -0
  495. package/lib/sparkline/themes/solar/charcoal/index.js +2 -0
  496. package/lib/sparkline/themes/solar/pearl/index.js +2 -0
  497. package/lib/swing-gauge/const.d.ts +22 -0
  498. package/lib/swing-gauge/const.js +26 -0
  499. package/lib/swing-gauge/custom-elements.json +109 -0
  500. package/lib/swing-gauge/custom-elements.md +17 -0
  501. package/lib/swing-gauge/helpers.d.ts +8 -0
  502. package/lib/swing-gauge/helpers.js +105 -0
  503. package/lib/swing-gauge/index.d.ts +294 -0
  504. package/lib/swing-gauge/index.js +762 -0
  505. package/lib/swing-gauge/themes/halo/dark/index.js +3 -0
  506. package/lib/swing-gauge/themes/halo/light/index.js +3 -0
  507. package/lib/swing-gauge/themes/solar/charcoal/index.js +3 -0
  508. package/lib/swing-gauge/themes/solar/pearl/index.js +3 -0
  509. package/lib/swing-gauge/types.d.ts +34 -0
  510. package/lib/swing-gauge/types.js +1 -0
  511. package/lib/tab/custom-elements.json +123 -0
  512. package/lib/tab/custom-elements.md +22 -0
  513. package/lib/tab/index.d.ts +118 -0
  514. package/lib/tab/index.js +208 -0
  515. package/lib/tab/themes/halo/dark/index.js +4 -0
  516. package/lib/tab/themes/halo/light/index.js +4 -0
  517. package/lib/tab/themes/solar/charcoal/index.js +4 -0
  518. package/lib/tab/themes/solar/pearl/index.js +4 -0
  519. package/lib/tab-bar/custom-elements.json +52 -0
  520. package/lib/tab-bar/custom-elements.md +11 -0
  521. package/lib/tab-bar/helpers/animate.d.ts +16 -0
  522. package/lib/tab-bar/helpers/animate.js +53 -0
  523. package/lib/tab-bar/index.d.ts +108 -0
  524. package/lib/tab-bar/index.js +218 -0
  525. package/lib/tab-bar/themes/halo/dark/index.js +4 -0
  526. package/lib/tab-bar/themes/halo/light/index.js +4 -0
  527. package/lib/tab-bar/themes/solar/charcoal/index.js +4 -0
  528. package/lib/tab-bar/themes/solar/pearl/index.js +4 -0
  529. package/lib/text-field/custom-elements.json +210 -0
  530. package/lib/text-field/custom-elements.md +37 -0
  531. package/lib/text-field/index.d.ts +193 -0
  532. package/lib/text-field/index.js +409 -0
  533. package/lib/text-field/themes/halo/dark/index.js +3 -0
  534. package/lib/text-field/themes/halo/light/index.js +3 -0
  535. package/lib/text-field/themes/solar/charcoal/index.js +3 -0
  536. package/lib/text-field/themes/solar/pearl/index.js +3 -0
  537. package/lib/time-picker/custom-elements.json +124 -0
  538. package/lib/time-picker/custom-elements.md +28 -0
  539. package/lib/time-picker/index.d.ts +379 -0
  540. package/lib/time-picker/index.js +775 -0
  541. package/lib/time-picker/themes/halo/dark/index.js +4 -0
  542. package/lib/time-picker/themes/halo/light/index.js +4 -0
  543. package/lib/time-picker/themes/solar/charcoal/index.js +4 -0
  544. package/lib/time-picker/themes/solar/pearl/index.js +4 -0
  545. package/lib/toggle/custom-elements.json +82 -0
  546. package/lib/toggle/custom-elements.md +19 -0
  547. package/lib/toggle/index.d.ts +86 -0
  548. package/lib/toggle/index.js +152 -0
  549. package/lib/toggle/themes/halo/dark/index.js +2 -0
  550. package/lib/toggle/themes/halo/light/index.js +2 -0
  551. package/lib/toggle/themes/solar/charcoal/index.js +2 -0
  552. package/lib/toggle/themes/solar/pearl/index.js +2 -0
  553. package/lib/tooltip/custom-elements.json +62 -0
  554. package/lib/tooltip/custom-elements.md +14 -0
  555. package/lib/tooltip/elements/title-tooltip.d.ts +1 -0
  556. package/lib/tooltip/elements/title-tooltip.js +18 -0
  557. package/lib/tooltip/elements/tooltip-element.d.ts +21 -0
  558. package/lib/tooltip/elements/tooltip-element.js +54 -0
  559. package/lib/tooltip/helpers/overflow-tooltip.d.ts +9 -0
  560. package/lib/tooltip/helpers/overflow-tooltip.js +19 -0
  561. package/lib/tooltip/helpers/renderer.d.ts +8 -0
  562. package/lib/tooltip/helpers/renderer.js +11 -0
  563. package/lib/tooltip/helpers/types.d.ts +23 -0
  564. package/lib/tooltip/helpers/types.js +1 -0
  565. package/lib/tooltip/index.d.ts +232 -0
  566. package/lib/tooltip/index.js +477 -0
  567. package/lib/tooltip/managers/tooltip-manager.d.ts +15 -0
  568. package/lib/tooltip/managers/tooltip-manager.js +140 -0
  569. package/lib/tooltip/themes/halo/dark/index.js +3 -0
  570. package/lib/tooltip/themes/halo/light/index.js +3 -0
  571. package/lib/tooltip/themes/solar/charcoal/index.js +3 -0
  572. package/lib/tooltip/themes/solar/pearl/index.js +3 -0
  573. package/lib/tornado-chart/custom-elements.json +45 -0
  574. package/lib/tornado-chart/custom-elements.md +18 -0
  575. package/lib/tornado-chart/elements/tornado-chart.d.ts +78 -0
  576. package/lib/tornado-chart/elements/tornado-chart.js +122 -0
  577. package/lib/tornado-chart/elements/tornado-item.d.ts +110 -0
  578. package/lib/tornado-chart/elements/tornado-item.js +207 -0
  579. package/lib/tornado-chart/index.d.ts +2 -0
  580. package/lib/tornado-chart/index.js +2 -0
  581. package/lib/tornado-chart/themes/halo/dark/index.js +6 -0
  582. package/lib/tornado-chart/themes/halo/light/index.js +6 -0
  583. package/lib/tornado-chart/themes/solar/charcoal/index.js +6 -0
  584. package/lib/tornado-chart/themes/solar/pearl/index.js +6 -0
  585. package/lib/tree/custom-elements.json +113 -0
  586. package/lib/tree/custom-elements.md +32 -0
  587. package/lib/tree/elements/tree-item.d.ts +96 -0
  588. package/lib/tree/elements/tree-item.js +179 -0
  589. package/lib/tree/elements/tree.d.ts +201 -0
  590. package/lib/tree/elements/tree.js +412 -0
  591. package/lib/tree/helpers/filter.d.ts +8 -0
  592. package/lib/tree/helpers/filter.js +33 -0
  593. package/lib/tree/helpers/renderer.d.ts +5 -0
  594. package/lib/tree/helpers/renderer.js +33 -0
  595. package/lib/tree/helpers/types.d.ts +25 -0
  596. package/lib/tree/helpers/types.js +1 -0
  597. package/lib/tree/index.d.ts +4 -0
  598. package/lib/tree/index.js +3 -0
  599. package/lib/tree/managers/tree-manager.d.ts +248 -0
  600. package/lib/tree/managers/tree-manager.js +395 -0
  601. package/lib/tree/themes/halo/dark/index.js +7 -0
  602. package/lib/tree/themes/halo/light/index.js +7 -0
  603. package/lib/tree/themes/solar/charcoal/index.js +7 -0
  604. package/lib/tree/themes/solar/pearl/index.js +7 -0
  605. package/lib/tree-select/custom-elements.json +107 -0
  606. package/lib/tree-select/custom-elements.md +26 -0
  607. package/lib/tree-select/helpers/types.d.ts +4 -0
  608. package/lib/tree-select/helpers/types.js +1 -0
  609. package/lib/tree-select/index.d.ts +402 -0
  610. package/lib/tree-select/index.js +890 -0
  611. package/lib/tree-select/themes/halo/dark/index.js +12 -0
  612. package/lib/tree-select/themes/halo/light/index.js +12 -0
  613. package/lib/tree-select/themes/solar/charcoal/index.js +12 -0
  614. package/lib/tree-select/themes/solar/pearl/index.js +12 -0
  615. package/lib/version.d.ts +1 -0
  616. package/lib/version.js +1 -0
  617. package/package.json +298 -15
@@ -0,0 +1,1103 @@
1
+ import { __decorate } from "tslib";
2
+ import { ResponsiveElement, html, css } from '@refinitiv-ui/core';
3
+ import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
5
+ import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
6
+ import { VERSION } from '../version.js';
7
+ import { MicroTaskRunner } from '@refinitiv-ui/utils/lib/async.js';
8
+ import { color } from '@refinitiv-ui/utils/lib/color.js';
9
+ import '../canvas/index.js';
10
+ import '../tooltip/index.js';
11
+ import { Track } from './helpers/track.js';
12
+ import { blend, brighten, darken, isLight, interpolate } from './helpers/color.js';
13
+ import { getResponsiveFontSize, getMaximumTextWidth, getMaximumLabelTextWidth, MIN_FONT_SIZE } from './helpers/text.js';
14
+ const MAX_CELL_WIDTH_RATIO = 0.85;
15
+ const DEFAULT_CANVAS_RATIO = 0.75; // ratio — 4:3
16
+ /**
17
+ * A graphical representation of data where the individual
18
+ * values contained in a matrix are represented as colors
19
+ */
20
+ let Heatmap = class Heatmap extends ResponsiveElement {
21
+ constructor() {
22
+ super();
23
+ /**
24
+ * Heatmap configuration options.
25
+ * @type {HeatmapConfig}
26
+ */
27
+ this.config = null;
28
+ /**
29
+ * Number of maximum label width that cell can paint in pixel.
30
+ * e.g. label-width: 30px; cell label hides when text length reaches 30px.
31
+ */
32
+ this.labelWidth = 0;
33
+ /**
34
+ * Hide all labels in the cells
35
+ */
36
+ this.labelHidden = false;
37
+ /**
38
+ * Hide all axes
39
+ */
40
+ this.axisHidden = false;
41
+ /**
42
+ * Minimum point of the cell coloring
43
+ */
44
+ this.minPoint = -1;
45
+ /**
46
+ * Middle point of the cell coloring
47
+ */
48
+ this.midPoint = 0;
49
+ /**
50
+ * Maximum point of the cell coloring
51
+ */
52
+ this.maxPoint = 1;
53
+ /**
54
+ * Enable cell color blending
55
+ */
56
+ this.blend = false;
57
+ /**
58
+ * Cell minimum color saturation, value can be from 0 - 1
59
+ */
60
+ this.saturation = 0.4;
61
+ /**
62
+ * Current active cell
63
+ */
64
+ this._hoverCell = null;
65
+ /**
66
+ * Internal cells data storage
67
+ */
68
+ this.cells = [];
69
+ /**
70
+ * Canvas's font color according to theme
71
+ */
72
+ this.foregroundColor = '';
73
+ /**
74
+ * Canvas's background color according to theme
75
+ */
76
+ this.backgroundColor = '';
77
+ /**
78
+ * Row cells track for easier calculations
79
+ */
80
+ this.rowTrack = new Track();
81
+ /**
82
+ * Column cells track for easier calculations
83
+ */
84
+ this.colTrack = new Track();
85
+ /**
86
+ * A flag to check if calculated responsive height it been set.
87
+ */
88
+ this.responsiveHeight = false;
89
+ /**
90
+ * A flag to check if the component has a size.
91
+ */
92
+ this.isSizeCalculated = false;
93
+ /**
94
+ * Use to prevent resizes observer in certain use cases
95
+ */
96
+ this.updateTimer = 0;
97
+ /**
98
+ * Use to throttle heatmap painting
99
+ */
100
+ this.renderTask = new MicroTaskRunner();
101
+ /**
102
+ * A flag to check if the cell has header enable.
103
+ */
104
+ this.hasCellHeader = false;
105
+ /**
106
+ * A flag to check if cell's content is within its boundary
107
+ */
108
+ this.contentWithinCellBoundary = true;
109
+ /**
110
+ * Margin around each cell
111
+ */
112
+ this.cellMargin = 1;
113
+ /**
114
+ * Above point color that is customisable using CSS variable
115
+ */
116
+ this.abovePointColor = '';
117
+ /**
118
+ * Middle point color that is customisable using CSS variable
119
+ */
120
+ this.midPointColor = '';
121
+ /**
122
+ * Below point color that is customisable using CSS variable
123
+ */
124
+ this.belowPointColor = '';
125
+ /** @ignore */
126
+ this.onResize = this.onResize.bind(this);
127
+ /** @ignore */
128
+ this.onMouseMove = this.onMouseMove.bind(this);
129
+ /** @ignore */
130
+ this.stopAnimation = this.stopAnimation.bind(this);
131
+ /** @ignore */
132
+ this.tooltipRenderer = this.tooltipRenderer.bind(this);
133
+ /** @ignore */
134
+ this.tooltipCondition = this.tooltipCondition.bind(this);
135
+ /** @ignore */
136
+ this.onMouseLeave = this.onMouseLeave.bind(this);
137
+ }
138
+ /**
139
+ * Element version number
140
+ * @returns version number
141
+ */
142
+ static get version() {
143
+ return VERSION;
144
+ }
145
+ /**
146
+ * A `CSSResultGroup` that will be used
147
+ * to style the host, slotted children
148
+ * and the internal template of the element.
149
+ * @returns CSS template
150
+ */
151
+ static get styles() {
152
+ return css `
153
+ :host {
154
+ display: block;
155
+ }
156
+ #container{
157
+ width: 100%;
158
+ height: 100%;
159
+ display: flex;
160
+ }
161
+ #canvas-container {
162
+ min-width:0;
163
+ display: flex;
164
+ width: 100%;
165
+ flex-direction: column;
166
+ position: relative;
167
+ }
168
+ #tooltip-overlay {
169
+ position: absolute;
170
+ }
171
+ [part=canvas] {
172
+ flex-grow: 1;
173
+ }
174
+ [part=x-axis] {
175
+ display: flex;
176
+ align-items: center;
177
+ }
178
+ [part=y-axis]{
179
+ display: flex;
180
+ flex-direction: column;
181
+ }
182
+ .x-axis-item {
183
+ text-align: center;
184
+ overflow: hidden;
185
+ }
186
+ .y-axis-item {
187
+ display: flex;
188
+ align-items: center;
189
+ justify-content: center;
190
+ overflow: hidden;
191
+ }
192
+ `;
193
+ }
194
+ /**
195
+ * Current active cell for internal use
196
+ * @private
197
+ */
198
+ get hoverCell() {
199
+ return this._hoverCell;
200
+ }
201
+ /* istanbul ignore next */
202
+ set hoverCell(hoverCell) {
203
+ const previousHoverCell = this._hoverCell;
204
+ this._hoverCell = hoverCell;
205
+ if (this._hoverCell !== previousHoverCell) {
206
+ this.requestUpdate('hoverCell', previousHoverCell);
207
+ this.hoverCellChanged(this._hoverCell, previousHoverCell);
208
+ }
209
+ }
210
+ /**
211
+ * Returns data of interactive cell
212
+ * @param event an event that occur while the user interacting with element
213
+ * @returns data of cell
214
+ */
215
+ /* istanbul ignore next */
216
+ getCellDataAtEvent(event) {
217
+ return this.hitTest(event);
218
+ }
219
+ /**
220
+ * Gets the computed style of the canvas element
221
+ * @returns computed canvas style
222
+ */
223
+ get canvasStyle() {
224
+ return getComputedStyle(this.canvas);
225
+ }
226
+ /**
227
+ * Gets the 2D context of the canvas element
228
+ * @returns 2D canvas context
229
+ */
230
+ get canvasContext() {
231
+ return this.canvas.context;
232
+ }
233
+ /**
234
+ * Safely gets the row data
235
+ * @returns array of row data
236
+ */
237
+ get rows() {
238
+ var _a;
239
+ return this.config && Array.isArray((_a = this.config) === null || _a === void 0 ? void 0 : _a.data) ? this.config.data : [];
240
+ }
241
+ /**
242
+ * Get row count
243
+ * @returns count of rows
244
+ */
245
+ get rowCount() {
246
+ return this.rows ? this.rows.length : 0;
247
+ }
248
+ /**
249
+ * Get column count
250
+ * @returns count of columns
251
+ */
252
+ get columnCount() {
253
+ var _a;
254
+ let result = 0;
255
+ (_a = this.rows) === null || _a === void 0 ? void 0 : _a.forEach(columns => {
256
+ if (columns.length > result) {
257
+ result = columns.length;
258
+ }
259
+ });
260
+ return result;
261
+ }
262
+ /**
263
+ * Called when the element’s DOM has been updated and rendered
264
+ * @param changedProperties changed properties
265
+ * @returns {void}
266
+ */
267
+ updated(changedProperties) {
268
+ if (changedProperties.has('labelHidden')) {
269
+ this.labelHiddenChanged();
270
+ }
271
+ // Re-paints whole canvas when at least one of the following properties changes
272
+ if (changedProperties.has('config')
273
+ || changedProperties.has('blend')
274
+ || changedProperties.has('minPoint')
275
+ || changedProperties.has('midPoint')
276
+ || changedProperties.has('maxPoint')
277
+ || changedProperties.has('saturation')
278
+ || changedProperties.has('axisHidden')
279
+ || changedProperties.has('labelWidth')) {
280
+ this.prepareAndPaint();
281
+ }
282
+ }
283
+ /**
284
+ * Handles resize events
285
+ * @returns {void}
286
+ */
287
+ onCanvasResize() {
288
+ this.prepareAndPaint();
289
+ }
290
+ /**
291
+ * Handles mouse moving on heatmap canvas
292
+ * @param event mousemove event
293
+ * @returns {void}
294
+ */
295
+ /* istanbul ignore next */
296
+ onMouseMove(event) {
297
+ if (event.composedPath().includes(this.canvas) || this.tooltipCallback && this.tooltipOverlay === event.target) {
298
+ this.hoverCell = this.hitTest(event);
299
+ }
300
+ else {
301
+ this.hoverCell = null;
302
+ }
303
+ }
304
+ /**
305
+ * Handles when mouse moving outside element
306
+ * @param event mouseleave event
307
+ * @returns {void}
308
+ */
309
+ /* istanbul ignore next */
310
+ onMouseLeave() {
311
+ this.hoverCell = null;
312
+ }
313
+ /**
314
+ * Handles heatmap resizes
315
+ * @returns {void}
316
+ */
317
+ onResize() {
318
+ this.updateTimer = 0;
319
+ if (!this.isSizeCalculated) {
320
+ if (this.offsetWidth || this.offsetHeight) {
321
+ this.isSizeCalculated = true;
322
+ }
323
+ }
324
+ if (this.isSizeCalculated) {
325
+ const spacing = parseFloat(this.getComputedVariable('--spacing', '0'));
326
+ this.cellMargin = spacing / 2;
327
+ }
328
+ // calculate responsive height
329
+ if (this.responsiveHeight || !this.offsetHeight) {
330
+ const width = this.offsetWidth;
331
+ if (width) {
332
+ const newHeight = `${Math.floor(DEFAULT_CANVAS_RATIO * width)}px`;
333
+ if (this.style.height !== newHeight) {
334
+ // set height to outermost container, so that heatmap's height can be override
335
+ this.container.style.height = newHeight;
336
+ this.responsiveHeight = true;
337
+ this.updateTimer = -1; // Prevent resizeObserver from executing this method in the next call
338
+ }
339
+ }
340
+ }
341
+ this.prepareAndPaint();
342
+ }
343
+ /**
344
+ * Initialize row track
345
+ * @returns {void}
346
+ */
347
+ initialiseRowTrack() {
348
+ this.rowTrack.init(this.offsetHeight, this.rowCount);
349
+ this.rowTrack.margin = this.cellMargin;
350
+ }
351
+ /**
352
+ * Initialize column track
353
+ * @returns {void}
354
+ */
355
+ initialiseColumnTrack() {
356
+ this.colTrack.init(this.offsetWidth, this.columnCount);
357
+ this.colTrack.margin = this.cellMargin;
358
+ }
359
+ /**
360
+ * Hit testing on heatmap
361
+ * @param event mouse event
362
+ * @returns cell
363
+ */
364
+ /* istanbul ignore next */
365
+ hitTest(event) {
366
+ const box = this.canvas.getBoundingClientRect();
367
+ const x = event.clientX - box.left;
368
+ const y = event.clientY - box.top;
369
+ const row = this.rowTrack.hitTest(y);
370
+ const column = this.colTrack.hitTest(x);
371
+ return this.getCellByLocation(row, column);
372
+ }
373
+ /**
374
+ * Get a cell, using row and column coordinates
375
+ * @param row row index
376
+ * @param column column index
377
+ * @returns cell
378
+ */
379
+ /* istanbul ignore next */
380
+ getCellByLocation(row, column) {
381
+ if (row < 0 || row >= this.rowCount) {
382
+ return null;
383
+ }
384
+ if (column < 0 || column >= this.columnCount) {
385
+ return null;
386
+ }
387
+ return this.cells[row * this.columnCount + column] || null;
388
+ }
389
+ /**
390
+ * Update overlay position
391
+ * @param cell cell information for correct overlay
392
+ * @returns {void}
393
+ */
394
+ /* istanbul ignore next */
395
+ updateTooltipOverlayPosition(cell) {
396
+ var _a, _b, _c;
397
+ // Compensate x-axis height for overlay when x-axis is at top position
398
+ let marginOverlayTop = 0;
399
+ if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.xAxis) && ((_b = this.xAxis) === null || _b === void 0 ? void 0 : _b.offsetHeight)) {
400
+ marginOverlayTop = this.config.xAxis.position === 'bottom' ? 0 : (_c = this.xAxis) === null || _c === void 0 ? void 0 : _c.offsetHeight;
401
+ }
402
+ // Update overlay position
403
+ this.tooltipOverlay.style.left = `${cell.x}px`;
404
+ this.tooltipOverlay.style.top = `${cell.y + marginOverlayTop}px`;
405
+ this.tooltipOverlay.style.width = `${cell.width}px`;
406
+ this.tooltipOverlay.style.height = `${cell.height}px`;
407
+ }
408
+ /**
409
+ * Called upon active cell changes i.e cell hovering
410
+ * @param cell current active cell
411
+ * @param previousCell previous active cell
412
+ * @returns {void}
413
+ */
414
+ /* istanbul ignore next */
415
+ hoverCellChanged(cell, previousCell) {
416
+ if (cell && cell.value !== null) {
417
+ if (this.tooltipCallback) {
418
+ this.updateTooltipOverlayPosition(cell);
419
+ }
420
+ // faded color depending on cell font color, light font darkens the cell background and vice versa
421
+ const fontColor = color(getComputedStyle(this.canvas).color);
422
+ const fadedColor = isLight(fontColor) ? darken(cell.backgroundColor) : brighten(cell.backgroundColor);
423
+ this.fade(cell, cell.backgroundColor, fadedColor, 100);
424
+ }
425
+ // returns color of previous cell to default cell color
426
+ if (previousCell && previousCell.value !== null) {
427
+ previousCell.foregroundColor = this.foregroundColor;
428
+ this.fade(previousCell, previousCell.backgroundColor, this.getBackgroundColor(previousCell.value), 300);
429
+ }
430
+ }
431
+ /**
432
+ * Called upon label-hidden attribute changes
433
+ * @returns {void}
434
+ */
435
+ labelHiddenChanged() {
436
+ this.paintAllCellBackground();
437
+ if (this.hasCellHeader) {
438
+ this.paintAllHeader();
439
+ }
440
+ if (!this.labelHidden) {
441
+ this.paintAllLabel();
442
+ }
443
+ }
444
+ /**
445
+ * Handles heatmap resizes
446
+ * @ignore
447
+ * @returns {void}
448
+ */
449
+ resizedCallback() {
450
+ if (this.updateTimer) {
451
+ this.updateTimer = 0;
452
+ }
453
+ else {
454
+ // split layout updating to another execution-loop
455
+ // to prevents resizeObserver triggers resize-loop-error
456
+ this.updateTimer = window.setTimeout(this.onResize);
457
+ }
458
+ }
459
+ /**
460
+ * Stop any current animations on a cell.
461
+ * @param {HeatmapCell} cell cell to stop the animation on
462
+ * @returns {void}
463
+ */
464
+ /* istanbul ignore next */
465
+ stopAnimation(cell) {
466
+ if (cell.animationFrame) {
467
+ cancelAnimationFrame(cell.animationFrame);
468
+ }
469
+ }
470
+ /**
471
+ * Stops all animations on a cell
472
+ * @returns {void}
473
+ */
474
+ stopAllAnimations() {
475
+ this.cells.forEach(this.stopAnimation);
476
+ }
477
+ /**
478
+ * Clear a cell on canvas
479
+ * @param cell cell object
480
+ * @returns {void}
481
+ */
482
+ /* istanbul ignore next */
483
+ resetCell(cell) {
484
+ var _a;
485
+ (_a = this.canvasContext) === null || _a === void 0 ? void 0 : _a.clearRect(cell.x, cell.y, cell.width, cell.height);
486
+ }
487
+ /**
488
+ * Fades a cell's background from one color to another
489
+ * @param cell to fade
490
+ * @param from initial cell color
491
+ * @param to color after faded
492
+ * @param duration fading animation duration
493
+ * @param delay fading animation delay
494
+ * @returns {void}
495
+ */
496
+ /* istanbul ignore next */
497
+ fade(cell, from, to, duration) {
498
+ const start = performance.now();
499
+ const end = start + duration;
500
+ const fadingAnimation = (time) => {
501
+ cell.x = this.colTrack.getContentStart(cell.colIndex);
502
+ cell.y = this.rowTrack.getContentStart(cell.rowIndex);
503
+ cell.width = this.colTrack.getContentSize(cell.colIndex);
504
+ cell.height = this.rowTrack.getContentSize(cell.rowIndex);
505
+ if (cell.animationFrame) {
506
+ cancelAnimationFrame(cell.animationFrame);
507
+ }
508
+ const colorFadingFactor = Math.max(Math.min((time - start) / (end - start), 1), 0);
509
+ // Reset cell and prepare for re-paint
510
+ this.resetCell(cell);
511
+ // Assign new cell background color after fading
512
+ cell.backgroundColor = interpolate(from, to)(colorFadingFactor);
513
+ this.paintCell(cell);
514
+ if (colorFadingFactor < 1) {
515
+ cell.animationFrame = requestAnimationFrame(fadingAnimation);
516
+ }
517
+ };
518
+ if (cell.animationFrame) {
519
+ cancelAnimationFrame(cell.animationFrame);
520
+ }
521
+ cell.animationFrame = requestAnimationFrame(fadingAnimation);
522
+ }
523
+ /**
524
+ * Converts the input data into usable cell data
525
+ * @returns {void}
526
+ */
527
+ calculateCellData() {
528
+ var _a, _b, _c;
529
+ // Reset cell
530
+ this.cells = [];
531
+ if (!this.axisHidden) {
532
+ if (this.yAxis && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.yAxis)) {
533
+ this.rowTrack.init(this.yAxis.offsetHeight, this.rowCount);
534
+ }
535
+ if (this.xAxis && ((_b = this.config) === null || _b === void 0 ? void 0 : _b.xAxis)) {
536
+ this.colTrack.init(this.xAxis.offsetWidth, this.columnCount);
537
+ }
538
+ }
539
+ // TODO: ensure that cell size must always be larger than cell margin
540
+ for (let rowIndex = 0; rowIndex < this.rowTrack.laneCount; rowIndex++) {
541
+ for (let columnIndex = 0; columnIndex < this.colTrack.laneCount; columnIndex++) {
542
+ const cell = this.rows[rowIndex][columnIndex];
543
+ const cellValue = cell ? cell.value : null;
544
+ const cellLabel = cellValue !== null && typeof cellValue === 'number' ? cellValue.toFixed(2) : '';
545
+ const cellHeader = cell && cell.header ? cell.header : '';
546
+ const cellIndex = rowIndex * this.colTrack.laneCount + columnIndex;
547
+ const foregroundColor = this.foregroundColor;
548
+ const backgroundColor = ((_c = this.getBackgroundColor(cellValue)) === null || _c === void 0 ? void 0 : _c.toString()) || '';
549
+ if (cellHeader) {
550
+ this.hasCellHeader = true;
551
+ }
552
+ this.cells[cellIndex] = {
553
+ rowIndex: rowIndex,
554
+ colIndex: columnIndex,
555
+ x: this.colTrack.getContentStart(columnIndex),
556
+ y: this.rowTrack.getContentStart(rowIndex),
557
+ width: this.colTrack.getContentSize(columnIndex),
558
+ height: this.rowTrack.getContentSize(rowIndex),
559
+ value: cellValue,
560
+ header: cellHeader,
561
+ label: cellLabel,
562
+ foregroundColor: foregroundColor,
563
+ defaultBackground: backgroundColor,
564
+ backgroundColor: backgroundColor
565
+ };
566
+ }
567
+ }
568
+ }
569
+ /**
570
+ * Performs check to see if everything is ready,
571
+ * converts data into usable cells and then
572
+ * paints to the canvas.
573
+ * @returns {void}
574
+ */
575
+ prepareAndPaint() {
576
+ if (!!this.canvas && this.config) {
577
+ this.renderTask.schedule(() => {
578
+ this.stopAllAnimations();
579
+ this.initialiseColumnTrack();
580
+ this.initialiseRowTrack();
581
+ if (!this.axisHidden) {
582
+ this.renderAxisX();
583
+ this.renderAxisY();
584
+ }
585
+ this.getCellBaseColors();
586
+ this.getCanvasColors();
587
+ this.calculateCellData();
588
+ this.paint();
589
+ });
590
+ }
591
+ }
592
+ /**
593
+ * Paints all cells to the canvas
594
+ * @returns {void}
595
+ */
596
+ paint() {
597
+ if (!this.isSizeCalculated) {
598
+ return;
599
+ }
600
+ if (this.renderCallback) {
601
+ this.retrieveAllCustomCellProperties();
602
+ }
603
+ this.paintAllCellBackground();
604
+ if (this.canPaintText()) {
605
+ if (!this.labelHidden) {
606
+ this.paintAllLabel();
607
+ }
608
+ if (this.hasCellHeader) {
609
+ this.paintAllHeader();
610
+ }
611
+ }
612
+ }
613
+ /**
614
+ * Paints label to all cells
615
+ * @returns {void}
616
+ */
617
+ paintAllLabel() {
618
+ for (let index = 0; index < this.cells.length; index++) {
619
+ this.paintLabel(this.cells[index]);
620
+ }
621
+ }
622
+ /**
623
+ * Calculates space between header and label using cell's height
624
+ * Maximum 10 pixels
625
+ * @param cellHeight in pixels
626
+ * @returns in pixels
627
+ */
628
+ calculateHeaderMargin(cellHeight) {
629
+ const margin = (cellHeight / 10) * 2;
630
+ return margin > 10 ? 10 : margin;
631
+ }
632
+ /**
633
+ * Paints label to a single cell
634
+ * @param cell cell to paint
635
+ * @returns {void}
636
+ */
637
+ paintLabel(cell) {
638
+ const margin = cell.header ? this.calculateHeaderMargin(cell.height) : 0;
639
+ const label = typeof cell.customLabel === 'string' ? cell.customLabel : cell.label;
640
+ if (this.canvasContext) {
641
+ this.canvasContext.fillStyle = cell.customForegroundColor || cell.foregroundColor;
642
+ this.canvasContext.fillText(label || '', cell.x + cell.width / 2, (cell.y + 1 + cell.height / 2) + margin);
643
+ }
644
+ }
645
+ /**
646
+ * Check if the text (label / header and label) can be paint on the cell
647
+ * @returns true if text is within cell's boundary
648
+ */
649
+ /* istanbul ignore next */
650
+ canPaintText() {
651
+ const canvas = this.canvasContext;
652
+ if (!canvas) {
653
+ return false;
654
+ }
655
+ const fontRatio = this.responsiveHeight ? 0.3 : 0.4;
656
+ const fontFamily = getComputedStyle(this).fontFamily;
657
+ const contentWidth = this.colTrack.getContentSize(0);
658
+ const contentHeight = this.rowTrack.getContentSize(0);
659
+ if (contentWidth <= 0 || contentHeight <= 0) {
660
+ this.contentWithinCellBoundary = false;
661
+ return this.contentWithinCellBoundary;
662
+ }
663
+ let fontSize = getResponsiveFontSize(fontRatio, contentHeight, contentWidth);
664
+ canvas.textAlign = 'center';
665
+ canvas.textBaseline = 'middle';
666
+ canvas.font = `${fontSize}px ${fontFamily}`;
667
+ let isWithinMinCellWidth = ((this.labelWidth || getMaximumTextWidth(canvas, this.cells, this.hasCellHeader)) / contentWidth) < MAX_CELL_WIDTH_RATIO;
668
+ // If label width is still more than 85% of the cell width, try to reduce to smallest possible font-size to display label.
669
+ if (!isWithinMinCellWidth && fontSize !== MIN_FONT_SIZE) {
670
+ while (!isWithinMinCellWidth) {
671
+ canvas.font = `${fontSize}px ${fontFamily}`; // Should assigned new font size to canvas before calculated again.
672
+ isWithinMinCellWidth = ((this.labelWidth || getMaximumTextWidth(canvas, this.cells, this.hasCellHeader)) / contentWidth) < MAX_CELL_WIDTH_RATIO;
673
+ // Stops when reaches minimum font-size
674
+ if (fontSize === MIN_FONT_SIZE) {
675
+ break;
676
+ }
677
+ if (!isWithinMinCellWidth && fontSize > MIN_FONT_SIZE) {
678
+ fontSize -= 1;
679
+ }
680
+ }
681
+ }
682
+ const isWithinMinCellHeight = this.hasCellHeader ? (fontSize * 2) < contentHeight : fontSize < contentHeight;
683
+ this.contentWithinCellBoundary = isWithinMinCellWidth && isWithinMinCellHeight;
684
+ return this.contentWithinCellBoundary;
685
+ }
686
+ /**
687
+ * Calculate cell background color based on the current cell data value
688
+ * @param value cell value
689
+ * @returns calculated color
690
+ */
691
+ /* istanbul ignore next */
692
+ getBackgroundColor(value) {
693
+ if (value === null) {
694
+ return this.backgroundColor;
695
+ }
696
+ let saturation = this.blend ? 0 : this.saturation;
697
+ // Can only have value from 0 to 1
698
+ if (saturation > 1) {
699
+ saturation = 1;
700
+ }
701
+ else if (saturation < 0) {
702
+ saturation = 0;
703
+ }
704
+ const factor = this.calculateColorFactor(value, saturation);
705
+ if (this.blend) {
706
+ return blend(this.belowPointColor, this.abovePointColor, this.backgroundColor, factor);
707
+ }
708
+ else if (factor >= 0) {
709
+ return interpolate(this.midPointColor, this.abovePointColor)(factor);
710
+ }
711
+ else {
712
+ return interpolate(this.midPointColor, this.belowPointColor)(-factor);
713
+ }
714
+ }
715
+ /**
716
+ * Calculate the color mixing factor from 0 - 1
717
+ * @param value cell value
718
+ * @param saturation color saturation level
719
+ * @returns factor
720
+ */
721
+ /* istanbul ignore next */
722
+ calculateColorFactor(value, saturation) {
723
+ if (value >= this.maxPoint) {
724
+ return 1;
725
+ }
726
+ if (value <= this.minPoint) {
727
+ return -1;
728
+ }
729
+ if (value === this.midPoint) {
730
+ return saturation;
731
+ }
732
+ const saturateRatio = 1 - saturation;
733
+ if (value > this.midPoint) {
734
+ return ((value - this.midPoint) / (this.maxPoint - this.midPoint) * saturateRatio) + saturation;
735
+ }
736
+ else {
737
+ return ((value - this.midPoint) / (this.midPoint - this.minPoint) * saturateRatio) - saturation;
738
+ }
739
+ }
740
+ /**
741
+ * Get and stores canvas color from computed canvas style
742
+ * @returns {void}
743
+ */
744
+ getCanvasColors() {
745
+ this.foregroundColor = this.canvasStyle.color;
746
+ this.backgroundColor = this.canvasStyle.backgroundColor;
747
+ }
748
+ /**
749
+ * Get and stores cell colors based on theme or custom css variables
750
+ * @returns {void}
751
+ */
752
+ getCellBaseColors() {
753
+ this.abovePointColor = this.getComputedVariable('--above-point-color');
754
+ this.midPointColor = this.getComputedVariable('--mid-point-color');
755
+ this.belowPointColor = this.getComputedVariable('--below-point-color');
756
+ }
757
+ /**
758
+ * Retrieve custom cell properties for a single cell
759
+ * @param {HeatmapCell} cell cell to assign colours
760
+ * @returns {void}
761
+ */
762
+ retrieveCustomCellProperties(cell) {
763
+ const customCellProperties = this.renderCallback ? this.renderCallback(Object.assign({}, cell)) : null;
764
+ if (customCellProperties) {
765
+ cell.customLabel = customCellProperties.label;
766
+ cell.customBackgroundColor = customCellProperties.backgroundColor;
767
+ cell.customForegroundColor = customCellProperties.foregroundColor;
768
+ }
769
+ }
770
+ /**
771
+ * Retrieves all custom call properties
772
+ * @returns {void}
773
+ */
774
+ retrieveAllCustomCellProperties() {
775
+ for (let index = 0; index < this.cells.length; index++) {
776
+ this.retrieveCustomCellProperties(this.cells[index]);
777
+ }
778
+ }
779
+ /**
780
+ * Paints cell header
781
+ * @param {HeatmapCell} cell cell to paint
782
+ * @returns {void}
783
+ */
784
+ paintHeader(cell) {
785
+ if (this.canvasContext) {
786
+ const labelFontStyle = this.canvasContext.font;
787
+ const margin = this.labelHidden ? 0 : this.calculateHeaderMargin(cell.height);
788
+ this.canvasContext.font = 'bold ' + labelFontStyle;
789
+ this.canvasContext.fillStyle = cell.customForegroundColor || cell.foregroundColor;
790
+ this.canvasContext.fillText(cell.header || '', cell.x + cell.width / 2, (cell.y + 1 + cell.height / 2) - margin);
791
+ // Reverts font style to paint label correctly
792
+ this.canvasContext.font = labelFontStyle;
793
+ }
794
+ }
795
+ /**
796
+ * Paints header to all cells
797
+ * @returns {void}
798
+ */
799
+ paintAllHeader() {
800
+ for (let index = 0; index < this.cells.length; index++) {
801
+ this.paintHeader(this.cells[index]);
802
+ }
803
+ }
804
+ /**
805
+ * Paints individual cell when fading
806
+ * @param cell object
807
+ * @returns {void}
808
+ */
809
+ /* istanbul ignore next */
810
+ paintCell(cell) {
811
+ this.paintCellBackground(cell);
812
+ if (!this.labelHidden && this.contentWithinCellBoundary) {
813
+ this.paintLabel(cell);
814
+ }
815
+ if (cell.header && this.contentWithinCellBoundary) {
816
+ this.paintHeader(cell);
817
+ }
818
+ }
819
+ /**
820
+ * Paints all cells background colour
821
+ * @returns {void}
822
+ */
823
+ paintAllCellBackground() {
824
+ var _a;
825
+ (_a = this.canvasContext) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, this.canvas.width, this.canvas.height);
826
+ for (let index = 0; index < this.cells.length; index++) {
827
+ this.paintCellBackground(this.cells[index]);
828
+ }
829
+ }
830
+ /**
831
+ * Paints a single cell background colour
832
+ * @param {HeatmapCell} cell cell to paint
833
+ * @returns {void}
834
+ */
835
+ paintCellBackground(cell) {
836
+ if (this.canvasContext) {
837
+ this.canvasContext.fillStyle = cell.customBackgroundColor || cell.backgroundColor;
838
+ this.canvasContext.fillRect(cell.x, cell.y, cell.width, cell.height);
839
+ }
840
+ }
841
+ /**
842
+ * Construct and renders x-axis
843
+ * @returns {void}
844
+ */
845
+ renderAxisX() {
846
+ var _a;
847
+ if (!this.isSizeCalculated) {
848
+ return;
849
+ }
850
+ const axisConfig = (_a = this.config) === null || _a === void 0 ? void 0 : _a.xAxis;
851
+ if (!this.xAxis || !this.yAxisBox || !axisConfig) {
852
+ return;
853
+ }
854
+ if (axisConfig.position === 'bottom') {
855
+ this.canvasContainer.style.flexDirection = 'column-reverse';
856
+ this.yAxisBox.style.display = 'flex';
857
+ this.yAxisBox.style.flexDirection = 'column-reverse';
858
+ }
859
+ else {
860
+ this.canvasContainer.style.flexDirection = 'column';
861
+ this.yAxisBox.style.display = 'block';
862
+ }
863
+ const laneCount = this.colTrack.laneCount;
864
+ const xAxisElement = this.xAxis;
865
+ const labels = axisConfig.labels || [];
866
+ const shortLabels = axisConfig.shortLabels || [];
867
+ const cellMargin = this.colTrack.margin;
868
+ let displayShortLabel = false;
869
+ const nbsp = String.fromCharCode(160);
870
+ while (xAxisElement.children.length > laneCount) {
871
+ if (xAxisElement.lastChild) {
872
+ xAxisElement.removeChild(xAxisElement.lastChild);
873
+ }
874
+ }
875
+ for (let i = 0; i < laneCount; i++) {
876
+ let element = xAxisElement.children[i];
877
+ if (!element) {
878
+ element = document.createElement('div');
879
+ element.className = 'x-axis-item';
880
+ element.appendChild(document.createElement('span'));
881
+ xAxisElement.appendChild(element);
882
+ }
883
+ if (cellMargin !== Number(element.getAttribute('cell-margin'))) {
884
+ element.style.margin = `${cellMargin}px`;
885
+ element.setAttribute('cell-margin', cellMargin.toString());
886
+ }
887
+ const cellWidth = this.colTrack.getContentSize(i);
888
+ if (cellWidth !== Number(element.getAttribute('cell-width'))) {
889
+ element.style.width = `${cellWidth}px`;
890
+ element.setAttribute('cell-width', cellWidth.toString());
891
+ }
892
+ const span = element.children[0];
893
+ span.textContent = labels[i] || nbsp;
894
+ // If x-axis text is more than container
895
+ if (span.offsetWidth > element.offsetWidth) {
896
+ displayShortLabel = true;
897
+ }
898
+ }
899
+ if (displayShortLabel) {
900
+ // Reassign all x-axis labels
901
+ for (let i = 0; i < laneCount; i++) {
902
+ const element = xAxisElement.children[i];
903
+ element.children[0].textContent = shortLabels[i] || nbsp;
904
+ }
905
+ }
906
+ }
907
+ /**
908
+ * Construct and renders y-axis
909
+ * @returns {void}
910
+ */
911
+ renderAxisY() {
912
+ var _a, _b;
913
+ if (!this.isSizeCalculated) {
914
+ return;
915
+ }
916
+ const axisConfig = (_a = this.config) === null || _a === void 0 ? void 0 : _a.yAxis;
917
+ if (!this.yAxis || !axisConfig) {
918
+ return;
919
+ }
920
+ if (axisConfig.position === 'right') {
921
+ this.container.style.flexDirection = 'row-reverse';
922
+ }
923
+ else {
924
+ this.container.style.flexDirection = 'row';
925
+ }
926
+ const yAxisElement = this.yAxis;
927
+ const labels = axisConfig.labels || [];
928
+ const cellMargin = this.rowTrack.margin;
929
+ const laneCount = this.rowTrack.laneCount;
930
+ const nbsp = String.fromCharCode(160);
931
+ // Make one box inside the y axis needed to create the width of the crossbox.
932
+ if (this.yAxis.children.length === 0) {
933
+ const element = document.createElement('div');
934
+ element.className = 'y-axis-item';
935
+ const span = document.createElement('span');
936
+ span.textContent = getMaximumLabelTextWidth(labels);
937
+ element.appendChild(span);
938
+ element.style.margin = `${cellMargin}px`;
939
+ const cellHeight = this.rowTrack.getContentSize(1);
940
+ element.style.height = `${cellHeight}px`;
941
+ yAxisElement.appendChild(element);
942
+ }
943
+ // Create crossbox
944
+ if (this.xAxis && this.yAxis) {
945
+ // In order to build a crossbox,
946
+ // it is necessary to have the height of xAxis and the width of yAxis
947
+ // in order to determine the correct size of the crossbox.
948
+ this.crossBox.style.margin = `${this.cellMargin}px`;
949
+ this.crossBox.style.height = `${this.xAxis.children[0].offsetHeight}px`;
950
+ this.crossBox.style.width = `${this.yAxis.children[0].offsetWidth}px`;
951
+ // clear one box inside the yAxis after create crossbox
952
+ if (yAxisElement.lastChild) {
953
+ yAxisElement.removeChild(yAxisElement.lastChild);
954
+ }
955
+ }
956
+ this.rowTrack.init(this.offsetHeight - (this.crossBox.offsetHeight + (this.cellMargin * 2)), this.rowCount);
957
+ // Clear yAxis element before re-create yAxis
958
+ while (yAxisElement.children.length > laneCount) {
959
+ if (yAxisElement.lastChild) {
960
+ yAxisElement.removeChild(yAxisElement.lastChild);
961
+ }
962
+ }
963
+ // Create content inside yAxis
964
+ for (let i = 0; i < laneCount; i++) {
965
+ let element = yAxisElement.children[i];
966
+ if (!element) {
967
+ element = document.createElement('div');
968
+ element.className = 'y-axis-item';
969
+ yAxisElement.appendChild(element);
970
+ }
971
+ if (cellMargin !== Number(element.getAttribute('cell-margin'))) {
972
+ element.style.margin = `${cellMargin}px`;
973
+ element.setAttribute('cell-margin', cellMargin.toString());
974
+ }
975
+ const cellHeight = this.rowTrack.getContentSize(i);
976
+ if (cellHeight !== Number(element.getAttribute('cell-height'))) {
977
+ element.style.height = `${cellHeight}px`;
978
+ element.setAttribute('cell-height', cellHeight.toString());
979
+ }
980
+ element.textContent = labels[i] || nbsp;
981
+ }
982
+ if (this.xAxis && ((_b = this.config) === null || _b === void 0 ? void 0 : _b.xAxis)) {
983
+ // TODO: Wrong crossBox margin calculation when margin = 0.5px
984
+ this.crossBox.style.margin = `${this.cellMargin}px`;
985
+ this.crossBox.style.height = `${this.xAxis.children[0].offsetHeight}px`;
986
+ this.crossBox.style.width = `${this.yAxis.children[0].offsetWidth}px`;
987
+ }
988
+ else {
989
+ this.crossBox.style.width = '0';
990
+ }
991
+ }
992
+ /**
993
+ * Tooltip renderer function
994
+ * @returns tooltip template to be render
995
+ */
996
+ /* istanbul ignore next */
997
+ tooltipRenderer() {
998
+ if (this.hoverCell && this.canvasContext && this.tooltipCallback) {
999
+ return this.tooltipCallback(this.hoverCell);
1000
+ }
1001
+ return undefined;
1002
+ }
1003
+ /**
1004
+ * Checks if the tooltip should display or not
1005
+ * @param target element target
1006
+ * @returns if the canvas target within canvas
1007
+ */
1008
+ /* istanbul ignore next */
1009
+ tooltipCondition(target) {
1010
+ return target === this.tooltipOverlay;
1011
+ }
1012
+ /**
1013
+ * A `TemplateResult` that will be used
1014
+ * to render the updated internal template.
1015
+ * @return Render template
1016
+ */
1017
+ render() {
1018
+ var _a, _b;
1019
+ return html `
1020
+ <div id="container" @mousemove=${this.onMouseMove} @mouseleave=${this.onMouseLeave}>
1021
+ ${((_a = this.config) === null || _a === void 0 ? void 0 : _a.yAxis) && !this.axisHidden ? html `
1022
+ <div id="y-axis-container">
1023
+ <div part="cross-box"></div>
1024
+ <div part="y-axis"></div>
1025
+ </div>` : null}
1026
+ <div id="canvas-container">
1027
+ ${((_b = this.config) === null || _b === void 0 ? void 0 : _b.xAxis) && !this.axisHidden ? html `<div part="x-axis"></div>` : null}
1028
+ <ef-canvas part="canvas" @resize=${this.onCanvasResize}></ef-canvas>
1029
+ ${this.tooltipCallback ? html `<div id="tooltip-overlay"></div>` : null}
1030
+ </div>
1031
+ </div>
1032
+ ${this.tooltipCallback ? html `
1033
+ <ef-tooltip .condition=${this.tooltipCondition} .renderer=${this.tooltipRenderer}></ef-tooltip>
1034
+ ` : null}
1035
+ `;
1036
+ }
1037
+ };
1038
+ __decorate([
1039
+ property({ type: Object })
1040
+ ], Heatmap.prototype, "config", void 0);
1041
+ __decorate([
1042
+ property({ type: Number, attribute: 'label-width' })
1043
+ ], Heatmap.prototype, "labelWidth", void 0);
1044
+ __decorate([
1045
+ property({ type: Boolean, attribute: 'label-hidden' })
1046
+ ], Heatmap.prototype, "labelHidden", void 0);
1047
+ __decorate([
1048
+ property({ type: Boolean, attribute: 'axis-hidden' })
1049
+ ], Heatmap.prototype, "axisHidden", void 0);
1050
+ __decorate([
1051
+ property({ type: Object, attribute: false })
1052
+ ], Heatmap.prototype, "hoverCell", null);
1053
+ __decorate([
1054
+ property({ type: Number, attribute: 'min-point' })
1055
+ ], Heatmap.prototype, "minPoint", void 0);
1056
+ __decorate([
1057
+ property({ type: Number, attribute: 'mid-point' })
1058
+ ], Heatmap.prototype, "midPoint", void 0);
1059
+ __decorate([
1060
+ property({ type: Number, attribute: 'max-point' })
1061
+ ], Heatmap.prototype, "maxPoint", void 0);
1062
+ __decorate([
1063
+ property({ type: Boolean })
1064
+ ], Heatmap.prototype, "blend", void 0);
1065
+ __decorate([
1066
+ property({ type: Number })
1067
+ ], Heatmap.prototype, "saturation", void 0);
1068
+ __decorate([
1069
+ property({ type: Function, attribute: false })
1070
+ ], Heatmap.prototype, "tooltipCallback", void 0);
1071
+ __decorate([
1072
+ property({ type: Function, attribute: false })
1073
+ ], Heatmap.prototype, "renderCallback", void 0);
1074
+ __decorate([
1075
+ query('[part=canvas]', true)
1076
+ ], Heatmap.prototype, "canvas", void 0);
1077
+ __decorate([
1078
+ query('#container', true)
1079
+ ], Heatmap.prototype, "container", void 0);
1080
+ __decorate([
1081
+ query('[part=cross-box]', true)
1082
+ ], Heatmap.prototype, "crossBox", void 0);
1083
+ __decorate([
1084
+ query('[part=y-axis]', true)
1085
+ ], Heatmap.prototype, "yAxis", void 0);
1086
+ __decorate([
1087
+ query('[part=x-axis]', true)
1088
+ ], Heatmap.prototype, "xAxis", void 0);
1089
+ __decorate([
1090
+ query('#canvas-container', true)
1091
+ ], Heatmap.prototype, "canvasContainer", void 0);
1092
+ __decorate([
1093
+ query('#y-axis-container', true)
1094
+ ], Heatmap.prototype, "yAxisBox", void 0);
1095
+ __decorate([
1096
+ query('#tooltip-overlay')
1097
+ ], Heatmap.prototype, "tooltipOverlay", void 0);
1098
+ Heatmap = __decorate([
1099
+ customElement('ef-heatmap', {
1100
+ alias: 'sapphire-heatmap'
1101
+ })
1102
+ ], Heatmap);
1103
+ export { Heatmap };