@refinitiv-ui/elements 5.3.3 → 5.3.4

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