@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,493 @@
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 { BasicElement, html, css, query, customElement, property } from '@refinitiv-ui/core';
8
+ import { color as parseColor } from '@refinitiv-ui/utils';
9
+ import 'chart.js/dist/Chart.bundle.min.js';
10
+ import '../header';
11
+ import '../layout';
12
+ import { legendHelper, merge } from './helpers';
13
+ // Register plugins
14
+ import doughnutCenterPlugin from './plugins/doughnut-center-label';
15
+ import { VERSION } from '../';
16
+ window.Chart.pluginService.register(doughnutCenterPlugin);
17
+ const CSS_COLOR_PREFIX = '--chart-color-';
18
+ const CHART_TYPE_OPAQUE = ['line', 'bubble', 'radar', 'polarArea'];
19
+ const DEFAULT_CHART_CONFIG = window.Chart.defaults;
20
+ const ELF_CHART_CONFIG = {
21
+ polarArea: {
22
+ scale: {
23
+ ticks: {
24
+ showLabelBackdrop: false
25
+ }
26
+ }
27
+ },
28
+ radar: {
29
+ scale: {
30
+ ticks: {
31
+ showLabelBackdrop: false
32
+ }
33
+ }
34
+ }
35
+ };
36
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
37
+ window.Chart.helpers.merge(DEFAULT_CHART_CONFIG, ELF_CHART_CONFIG);
38
+ /**
39
+ * Charting component that use ChartJS library
40
+ */
41
+ let Chart = class Chart extends BasicElement {
42
+ constructor() {
43
+ super(...arguments);
44
+ /**
45
+ * Chart.js object
46
+ */
47
+ this.chart = null;
48
+ /**
49
+ * Chart configurations. Same configuration as ChartJS
50
+ * @type {ChartConfig}
51
+ */
52
+ this.config = null;
53
+ /**
54
+ * Generates the legend labels on a given chart
55
+ * @param {ChartJS} chart Chart.js instance
56
+ * @returns {Chart.ChartLegendLabelItem[]} Array of label configurations
57
+ */
58
+ this.generateLegendLabels = (chart) => {
59
+ var _a, _b, _c, _d;
60
+ if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.type)) {
61
+ return [];
62
+ }
63
+ const chartOption = DEFAULT_CHART_CONFIG[this.config.type];
64
+ if (this.datasets.length
65
+ && chartOption.legend
66
+ && Array.isArray(this.datasets[0].backgroundColor)) {
67
+ let legends = [];
68
+ if ((_b = chartOption.legend.labels) === null || _b === void 0 ? void 0 : _b.generateLabels) {
69
+ legends = (_c = chartOption.legend.labels) === null || _c === void 0 ? void 0 : _c.generateLabels(chart);
70
+ }
71
+ // Customize for doughnut chart change border color to background color
72
+ if (['pie', 'doughnut'].includes((_d = this.config) === null || _d === void 0 ? void 0 : _d.type) && this.datasets.length > 1) {
73
+ legends.forEach((label) => {
74
+ label.strokeStyle = label.fillStyle;
75
+ });
76
+ }
77
+ return legends;
78
+ }
79
+ return this.datasets.map((dataset, i) => {
80
+ var _a, _b, _c;
81
+ const solidFill = !CHART_TYPE_OPAQUE.includes(dataset.type || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.type));
82
+ const usePointStyle = ((_c = (_b = chart.options.legend) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.usePointStyle) || false;
83
+ return {
84
+ text: dataset.label,
85
+ fillStyle: legendHelper.getLegendFillStyle(dataset, usePointStyle, solidFill),
86
+ hidden: !chart.isDatasetVisible(i),
87
+ lineCap: dataset.borderCapStyle,
88
+ lineDash: dataset.borderDash,
89
+ lineDashOffset: dataset.borderDashOffset,
90
+ lineJoin: dataset.borderJoinStyle,
91
+ lineWidth: Number(dataset.borderWidth) || 0,
92
+ strokeStyle: legendHelper.getLegendStrokeStyle(dataset, usePointStyle),
93
+ pointStyle: typeof dataset.pointStyle === 'string' ? dataset.pointStyle : undefined,
94
+ // Below is extra data used for toggling the datasets
95
+ datasetIndex: i
96
+ };
97
+ });
98
+ };
99
+ }
100
+ /**
101
+ * Element version number
102
+ * @returns version number
103
+ */
104
+ static get version() {
105
+ return VERSION;
106
+ }
107
+ /**
108
+ * Required properties, needed for chart to work correctly.
109
+ * @returns config
110
+ */
111
+ get requiredConfig() {
112
+ return {
113
+ options: {
114
+ responsive: false,
115
+ maintainAspectRatio: false,
116
+ title: {
117
+ display: false
118
+ }
119
+ }
120
+ };
121
+ }
122
+ /**
123
+ * Safely returns the chart title
124
+ * @returns chart title
125
+ */
126
+ get chartTitle() {
127
+ var _a, _b, _c;
128
+ const title = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.title) === null || _c === void 0 ? void 0 : _c.text;
129
+ if (title) {
130
+ return typeof title === 'string' ? title : title.join();
131
+ }
132
+ return '';
133
+ }
134
+ /**
135
+ * Safely returns a dataset array
136
+ * @returns dataset array
137
+ */
138
+ get datasets() {
139
+ var _a, _b;
140
+ return ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.datasets) || [];
141
+ }
142
+ /**
143
+ * List of available chart colors
144
+ * @type {string[]}
145
+ * @returns {string[]} List of available chart colors
146
+ */
147
+ get colors() {
148
+ let color;
149
+ let index = 0;
150
+ const colors = [];
151
+ while ((color = this.getComputedVariable(`${CSS_COLOR_PREFIX}${++index}`))) {
152
+ colors.push(color);
153
+ }
154
+ return colors;
155
+ }
156
+ /**
157
+ * Invoked whenever the element is updated
158
+ * @param {PropertyValues} changedProperties Map of changed properties with old values
159
+ * @returns {void}
160
+ */
161
+ updated(changedProperties) {
162
+ super.updated(changedProperties);
163
+ if (changedProperties.has('config')) {
164
+ this.onConfigChange();
165
+ }
166
+ }
167
+ /**
168
+ * Element connected
169
+ * @returns {void}
170
+ */
171
+ connectedCallback() {
172
+ super.connectedCallback();
173
+ if (this.canvas) {
174
+ this.createChart();
175
+ }
176
+ }
177
+ /**
178
+ * Element disconnected
179
+ * @returns {void}
180
+ */
181
+ disconnectedCallback() {
182
+ super.disconnectedCallback();
183
+ this.destroyChart();
184
+ }
185
+ /**
186
+ * Themable parts of the config.
187
+ * This will be merged into the configuration object.
188
+ * @returns {ChartConfig} chart config with theme
189
+ */
190
+ get themableConfig() {
191
+ var _a;
192
+ const style = getComputedStyle(this);
193
+ // TODO: Try and remove the need for global object modification.
194
+ // It's easier to cover all areas by modifying the global object,
195
+ // however, if possible, we should look to try and just modify local configs.
196
+ // Set font globals
197
+ window.Chart.defaults.global.defaultFontColor = style.getPropertyValue('color');
198
+ window.Chart.defaults.global.defaultFontFamily = style.getPropertyValue('font-family');
199
+ window.Chart.defaults.global.defaultFontSize = Number(style.getPropertyValue('font-size').replace('px', ''));
200
+ window.Chart.defaults.global.defaultFontStyle = style.getPropertyValue('font-style');
201
+ // Set grid line globals
202
+ window.Chart.defaults.scale.gridLines.color = this.getComputedVariable('--grid-line-color', 'transparent');
203
+ window.Chart.defaults.scale.gridLines.zeroLineColor = this.getComputedVariable('--zero-line-color', 'transparent');
204
+ return {
205
+ options: {
206
+ animation: {
207
+ duration: this.cssVarAsNumber('--animation-duration', '0')
208
+ },
209
+ elements: {
210
+ line: {
211
+ borderWidth: this.cssVarAsNumber('--line-width', '1'),
212
+ tension: this.cssVarAsNumber('--line-tension', '0.5')
213
+ }
214
+ },
215
+ tooltips: {
216
+ backgroundColor: this.getComputedVariable('--tooltip-background-color', 'transparent'),
217
+ titleFontColor: this.getComputedVariable('--tooltip-title-color', 'transparent'),
218
+ bodyFontColor: this.getComputedVariable('--tooltip-body-color', 'transparent'),
219
+ cornerRadius: this.cssVarAsNumber('--tooltip-border-radius', '0'),
220
+ caretSize: this.cssVarAsNumber('--tooltip-caret-size', '0'),
221
+ xPadding: this.cssVarAsNumber('--tooltip-padding-x', '--tooltip-padding', '0'),
222
+ yPadding: this.cssVarAsNumber('--tooltip-padding-y', '--tooltip-padding', '0'),
223
+ titleSpacing: this.cssVarAsNumber('--tooltip-title-spacing', '0'),
224
+ displayColors: false
225
+ },
226
+ legend: {
227
+ position: ['pie', 'doughnut'].includes(((_a = this.config) === null || _a === void 0 ? void 0 : _a.type) || '') ? 'right' : 'top',
228
+ labels: {
229
+ boxWidth: this.cssVarAsNumber('--legend-key-box-width', '10'),
230
+ generateLabels: this.generateLegendLabels
231
+ }
232
+ }
233
+ }
234
+ };
235
+ }
236
+ /**
237
+ * Handles a change of configuration object.
238
+ * This does not fire when a property of the config object changes,
239
+ * for this use this.updateChart() to apply changes.
240
+ * @returns {void}
241
+ */
242
+ onConfigChange() {
243
+ if (this.config) {
244
+ this.createChart();
245
+ }
246
+ }
247
+ /**
248
+ * Get as CSS variable and tries to convert it into a usable number
249
+ * @returns {(number|undefined)} The value as a number, or, undefined if NaN.
250
+ */
251
+ cssVarAsNumber(...args) {
252
+ const result = Number(this.getComputedVariable(...args).replace(/\D+$/, ''));
253
+ return isNaN(result) ? undefined : result;
254
+ }
255
+ /**
256
+ * Merges all the different layers of the config.
257
+ * @returns {void}
258
+ */
259
+ mergeConfigs() {
260
+ if (!this.config) {
261
+ return;
262
+ }
263
+ merge(this.config, this.themableConfig);
264
+ merge(this.config, this.requiredConfig, true);
265
+ }
266
+ /**
267
+ * Themes the passed-in configuration object
268
+ * @returns {void}
269
+ */
270
+ decorateConfig() {
271
+ this.mergeConfigs();
272
+ const extendColorsIfRequired = (currentColors, infoColors) => {
273
+ if (Array.isArray(currentColors) && Array.isArray(infoColors) && currentColors.length < infoColors.length) {
274
+ merge(currentColors, infoColors);
275
+ }
276
+ };
277
+ this.datasets.forEach((dataset) => {
278
+ const info = this.datasetInfo(dataset);
279
+ // make sure that colours are defined for every dataset e.g. when new dataset is added
280
+ extendColorsIfRequired(dataset.borderColor, info.borderColor);
281
+ extendColorsIfRequired(dataset.backgroundColor, info.backgroundColor);
282
+ extendColorsIfRequired(dataset.pointBorderColor, info.pointBorderColor);
283
+ extendColorsIfRequired(dataset.pointBackgroundColor, info.pointBackgroundColor);
284
+ dataset.borderColor = dataset.borderColor || info.borderColor;
285
+ dataset.backgroundColor = dataset.backgroundColor || info.backgroundColor;
286
+ dataset.pointBackgroundColor = dataset.pointBackgroundColor || info.pointBackgroundColor;
287
+ dataset.pointBorderColor = dataset.pointBorderColor || info.pointBorderColor;
288
+ });
289
+ }
290
+ /**
291
+ * Returns usable information about a dataset
292
+ * @param {Chart.ChartDataSets} dataset Chart dataset
293
+ * @returns {Chart.ChartDataSets} Information about the dataset
294
+ */
295
+ datasetInfo(dataset) {
296
+ var _a;
297
+ const type = dataset.type || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.type);
298
+ let index = this.datasets.indexOf(dataset);
299
+ const isColorArray = (!!type && ['pie', 'doughnut', 'polarArea'].includes(type)) || type === 'bar' && this.datasets.length === 1;
300
+ const isSolidFill = !!type && !CHART_TYPE_OPAQUE.includes(type);
301
+ // Doughnut chart using same color sequence for each data in datasets
302
+ let borderColor = null;
303
+ if (['pie', 'doughnut'].includes(type) && this.datasets.length > 1) {
304
+ index = 0;
305
+ borderColor = this.getComputedVariable('--multi-dataset-border-color', '#fff');
306
+ }
307
+ const colors = this.generateColors(isColorArray, isColorArray && dataset.data ? dataset.data.length : 1, index);
308
+ return {
309
+ type,
310
+ borderColor: borderColor || colors.solid,
311
+ backgroundColor: isSolidFill ? colors.solid : colors.opaque,
312
+ pointBorderColor: colors.solid,
313
+ pointBackgroundColor: colors.solid
314
+ };
315
+ }
316
+ /**
317
+ * Generates internal solid and opaque color set for a dataset
318
+ * @param {boolean} isArray Flag to return result in array or not e.g. doughnut, pie, etc
319
+ * @param {number} amount Amount of colors required
320
+ * @param {number} shift Positional shift of the color start point
321
+ * @returns {DatasetColors} Solid and opaque color values
322
+ */
323
+ generateColors(isArray, amount, shift) {
324
+ let color;
325
+ const solid = [];
326
+ const opaque = [];
327
+ const alpha = Number(this.getComputedVariable('--fill-opacity', '0.2'));
328
+ amount = isArray ? amount : 1;
329
+ for (let i = shift; i < amount + shift; i++) {
330
+ color = this.colors[i % this.colors.length];
331
+ solid.push(color);
332
+ const opaqueColor = parseColor(color);
333
+ if (opaqueColor) {
334
+ opaqueColor.opacity = alpha;
335
+ opaque.push(opaqueColor.toString());
336
+ }
337
+ }
338
+ return {
339
+ solid: isArray ? solid : solid[0],
340
+ opaque: isArray ? opaque : opaque[0]
341
+ };
342
+ }
343
+ /**
344
+ * Manages the custom title element
345
+ * @returns {void}
346
+ */
347
+ manageTitle() {
348
+ this.titleElement.textContent = this.chartTitle;
349
+ if (this.chartTitle) {
350
+ this.titleElement.style.removeProperty('display');
351
+ }
352
+ else {
353
+ this.titleElement.style.display = 'none';
354
+ }
355
+ }
356
+ /**
357
+ * Creates a chart after config has changed,
358
+ * or, the element has been connected to the DOM
359
+ * @returns {void}
360
+ */
361
+ createChart() {
362
+ const ctx = this.canvas.getContext('2d');
363
+ if (ctx && this.config) {
364
+ // Are we reusing an old chart canvas?
365
+ const isReusingCanvas = this.destroyChart();
366
+ // Preparing the resources before create chart
367
+ this.decorateConfig();
368
+ this.manageTitle();
369
+ // Create chart
370
+ this.chart = new window.Chart(ctx, this.config);
371
+ if (isReusingCanvas) {
372
+ // If we're reusing an old chart canvas, we need to resize it.
373
+ // Destroying a chart has some strange side-effects on the canvas.
374
+ this.chart.resize();
375
+ }
376
+ }
377
+ }
378
+ /**
379
+ * Destroys the chart.js object
380
+ * @returns True if a chart object has been destroyed
381
+ */
382
+ destroyChart() {
383
+ if (this.chart) {
384
+ // Destroy the chart
385
+ this.chart.destroy();
386
+ this.chart = null;
387
+ return true;
388
+ }
389
+ return false;
390
+ }
391
+ /**
392
+ * Re-renders the chart based on its config
393
+ * @param {ChartUpdateProps} config Additional configuration object for the update process.
394
+ * @returns {void}
395
+ */
396
+ renderChart(config = { duration: this.cssVarAsNumber('--animation-duration', '0') }) {
397
+ if (!this.chart || !this.config) {
398
+ return;
399
+ }
400
+ // Stop any chart.js animations
401
+ this.chart.stop();
402
+ // Decorate the config object
403
+ this.decorateConfig();
404
+ // Update internal layout
405
+ this.manageTitle();
406
+ // Update the chart
407
+ this.chart.update(config);
408
+ }
409
+ /**
410
+ * Update all data, title, scales, legends and re-render the chart based on its config
411
+ * @param {ChartUpdateProps=} config Additional configuration for control an animation in the update process.
412
+ * @returns {void}
413
+ */
414
+ updateChart(config) {
415
+ this.renderChart(config);
416
+ }
417
+ /**
418
+ * A `CSSResult` that will be used
419
+ * to style the host, slotted children
420
+ * and the internal template of the element.
421
+ * @return CSS template
422
+ */
423
+ static get styles() {
424
+ return css `
425
+ :host {
426
+ display: block;
427
+ overflow: hidden;
428
+ position: relative;
429
+ }
430
+ :host::before {
431
+ content: '';
432
+ display: block;
433
+ padding-top: 60%;
434
+ min-height: 300px;
435
+ box-sizing: border-box;
436
+ }
437
+ [container] {
438
+ position: absolute;
439
+ top: 0;
440
+ right: 0;
441
+ bottom: 0;
442
+ left: 0;
443
+ }
444
+ ef-header {
445
+ margin-bottom: 12px;
446
+ }
447
+ canvas {
448
+ position: absolute;
449
+ top: 0;
450
+ right: 0;
451
+ bottom: 0;
452
+ left: 0;
453
+ }
454
+ `;
455
+ }
456
+ /**
457
+ * Handles resize event of the chart region
458
+ * @returns {void}
459
+ */
460
+ onResize() {
461
+ var _a;
462
+ (_a = this.chart) === null || _a === void 0 ? void 0 : _a.resize();
463
+ }
464
+ /**
465
+ * A `TemplateResult` that will be used
466
+ * to render the updated internal template.
467
+ * @return Render template
468
+ */
469
+ render() {
470
+ return html `
471
+ <ef-layout flex container>
472
+ <ef-header></ef-header>
473
+ <ef-layout part="chart" @resize="${this.onResize}">
474
+ <canvas id="canvas"></canvas>
475
+ </ef-layout>
476
+ </ef-layout>`;
477
+ }
478
+ };
479
+ __decorate([
480
+ property({ type: Object })
481
+ ], Chart.prototype, "config", void 0);
482
+ __decorate([
483
+ query('canvas')
484
+ ], Chart.prototype, "canvas", void 0);
485
+ __decorate([
486
+ query('ef-header')
487
+ ], Chart.prototype, "titleElement", void 0);
488
+ Chart = __decorate([
489
+ customElement('ef-chart', {
490
+ alias: 'sapphire-chart'
491
+ })
492
+ ], Chart);
493
+ export { Chart };
@@ -0,0 +1,3 @@
1
+ /// <reference types="chart.js" />
2
+ declare const plugins: Chart.PluginServiceRegistrationOptions;
3
+ export default plugins;
@@ -0,0 +1,196 @@
1
+ const CHART = window.Chart;
2
+ const getPluginConfig = (chart) => {
3
+ var _a, _b;
4
+ return (_b = (_a = chart.config.options) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.centerLabel;
5
+ };
6
+ /**
7
+ * Draw line
8
+ * @param {DoughnutChart} chart doughnut chart
9
+ * @param {MetaData[]} active active data
10
+ * @returns {void}
11
+ */
12
+ const drawItemBorder = function (chart, active) {
13
+ var _a, _b, _c;
14
+ if (!chart.data.datasets) {
15
+ return;
16
+ }
17
+ if (active === null || active === void 0 ? void 0 : active.length) {
18
+ const ctx = chart.ctx;
19
+ const chartItem = active[0];
20
+ const vm = chartItem._view;
21
+ const datasets = chart.data.datasets[chartItem._datasetIndex];
22
+ vm.backgroundColor = datasets.backgroundColor[chartItem._index];
23
+ vm.backgroundColor = CHART.helpers.getHoverColor(vm.backgroundColor); // we need to make color bolder
24
+ vm.borderWidth = (datasets.borderWidth || ((_c = (_b = (_a = chart.config.options) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.arc) === null || _c === void 0 ? void 0 : _c.borderWidth));
25
+ vm.borderColor = (getComputedStyle(chart.canvas).getPropertyValue('--doughnut-border-color') || CHART.defaults.global.defaultFontColor);
26
+ const sA = vm.startAngle;
27
+ const eA = vm.endAngle;
28
+ if (ctx) {
29
+ ctx.beginPath();
30
+ ctx.arc(vm.x, vm.y, vm.outerRadius, sA, eA);
31
+ ctx.arc(vm.x, vm.y, vm.innerRadius, eA, sA, true);
32
+ ctx.closePath();
33
+ ctx.strokeStyle = vm.borderColor;
34
+ ctx.lineWidth = vm.borderWidth;
35
+ ctx.fillStyle = vm.backgroundColor;
36
+ ctx.fill();
37
+ ctx.lineJoin = 'bevel';
38
+ if (vm.borderWidth) {
39
+ ctx.stroke();
40
+ }
41
+ }
42
+ }
43
+ };
44
+ const plugins = {
45
+ beforeEvent: function (chart, event) {
46
+ if (!getPluginConfig(chart)) {
47
+ return;
48
+ }
49
+ switch (event.type) {
50
+ case 'click':
51
+ // chart._select stores a segment that is clicked
52
+ if (!chart._select) {
53
+ chart._select = [];
54
+ }
55
+ if (chart.active.length) {
56
+ if (chart._select.length && chart._select[0]._datasetIndex === chart.active[0]._datasetIndex
57
+ && chart._select[0]._index === chart.active[0]._index) {
58
+ // reset value if user clicked on selected segment
59
+ chart._select = [];
60
+ }
61
+ else {
62
+ // set segment that user clicked
63
+ chart._select = chart.active.slice(0);
64
+ }
65
+ }
66
+ else {
67
+ chart._select = [];
68
+ }
69
+ chart.draw();
70
+ break;
71
+ default:
72
+ break;
73
+ }
74
+ },
75
+ beforeDraw: function (chart) {
76
+ var _a;
77
+ const config = getPluginConfig(chart);
78
+ if (!config) {
79
+ return;
80
+ }
81
+ // Set render hook function
82
+ let active = [];
83
+ if (chart._select) {
84
+ active = chart._select;
85
+ }
86
+ if ((_a = chart.active) === null || _a === void 0 ? void 0 : _a.length) {
87
+ active = chart.active;
88
+ }
89
+ const renderText = config.onRenderLabel(chart, active);
90
+ // Get Texts
91
+ const centerConfig = config;
92
+ const texts = renderText || centerConfig.defaultText;
93
+ if (!texts) {
94
+ return;
95
+ }
96
+ // Get ctx from param
97
+ const ctx = chart.ctx;
98
+ // Get options from config
99
+ const canvas = chart.canvas;
100
+ const style = window.getComputedStyle(canvas);
101
+ const globalConfig = CHART.defaults.global;
102
+ const defaultFontStyle = globalConfig.defaultFontFamily;
103
+ const defaultColor = style.getPropertyValue('--doughnut-center-text-color') || globalConfig.defaultFontColor;
104
+ const backgroundColor = style.getPropertyValue('--doughnut-center-background-color');
105
+ const customFontSizePercent = parseInt(style.getPropertyValue('--doughnut-center-font-size'), 10) / 100; // font size in percentage
106
+ const centerX = (chart.chartArea.left + chart.chartArea.right) / 2;
107
+ const centerY = (chart.chartArea.top + chart.chartArea.bottom) / 2;
108
+ // Render center background color
109
+ if (backgroundColor) {
110
+ ctx.arc(centerX, centerY, chart.innerRadius, 0, 2 * Math.PI);
111
+ ctx.fillStyle = backgroundColor;
112
+ ctx.fill();
113
+ }
114
+ const textAreaWidth = chart.innerRadius;
115
+ // Base font size is 30% and minus 4% per text lines ( if text has multiple lines ) of text area
116
+ const baseFontSize = textAreaWidth * (0.3 - (0.04 * (texts.length - 1)));
117
+ // Keep minimum font size equal 5% of text area
118
+ const computedFontSize = Math.max(textAreaWidth * 0.05, baseFontSize);
119
+ // Use font size ratio from user if --doughnut-center-font-size CSS variable is provided
120
+ const fontRatio = customFontSizePercent || computedFontSize / textAreaWidth;
121
+ const fontSizeToUse = textAreaWidth * fontRatio;
122
+ // Set font settings to draw it correctly.
123
+ ctx.textAlign = 'center';
124
+ ctx.textBaseline = 'middle';
125
+ ctx.fillStyle = defaultColor;
126
+ // Render texts
127
+ const fontLineHeight = fontSizeToUse * 1.5;
128
+ const fontSizeHeaderRatio = 1.15;
129
+ // Move Y position of text up according to text length
130
+ const offsetY = centerY - (texts.length - 1) * 0.5 * fontLineHeight;
131
+ const containerWidth = chart.innerRadius * 2;
132
+ const circlePadding = containerWidth * (texts.length <= 1 ? 0.4 : 0.5);
133
+ for (let i = 0; i < texts.length; i++) {
134
+ let targetFont;
135
+ if (texts[i].bold) {
136
+ targetFont = `bold ${fontSizeToUse * fontSizeHeaderRatio}px ${defaultFontStyle || ''}`;
137
+ }
138
+ else {
139
+ targetFont = `${fontSizeToUse}px ${defaultFontStyle || ''}`;
140
+ }
141
+ ctx.font = targetFont;
142
+ let targetText = texts[i].label;
143
+ if (ctx.measureText(targetText).width > containerWidth - circlePadding) {
144
+ const numText = targetText.length;
145
+ const numRatio = targetText.length / ctx.measureText(targetText).width;
146
+ const difSize = ctx.measureText(targetText).width - containerWidth + circlePadding;
147
+ let numCharacter = numText - Math.ceil(difSize * numRatio);
148
+ numCharacter = Math.max(1, numCharacter);
149
+ if (numCharacter) {
150
+ targetText = targetText.slice(0, numCharacter);
151
+ targetText += '...';
152
+ }
153
+ }
154
+ ctx.fillText(targetText, centerX, offsetY + (i * fontLineHeight));
155
+ }
156
+ },
157
+ afterDatasetUpdate: function (chart) {
158
+ var _a;
159
+ // Check chart already init selected.
160
+ if (chart.selected !== undefined) {
161
+ return;
162
+ }
163
+ // Check configs are ready to init selected
164
+ const config = getPluginConfig(chart);
165
+ if (!config || !config.selected || !chart.data.datasets) {
166
+ return;
167
+ }
168
+ const selectedIndex = Number((_a = config.selected) === null || _a === void 0 ? void 0 : _a.index);
169
+ const datasetIndex = Number(config.selected.datasetIndex || 0);
170
+ const visibleIndexes = chart.getVisibleDatasetCount() - 1;
171
+ // Validate index and datasetIndex
172
+ if (isNaN(selectedIndex) || (isNaN(datasetIndex) || datasetIndex < 0 || datasetIndex > visibleIndexes)) {
173
+ return;
174
+ }
175
+ // Set selected item to the chart
176
+ const items = chart.getDatasetMeta(datasetIndex).data[selectedIndex];
177
+ chart.selected = items ? [items] : [];
178
+ },
179
+ afterDraw: function (chart) {
180
+ var _a;
181
+ if (getPluginConfig(chart)) {
182
+ // Draw active element
183
+ // Note: use logic from chart.js - chart.js/src/elements/element.arc.js :draw()
184
+ // hover
185
+ drawItemBorder(chart, chart.active);
186
+ // selected
187
+ if ((_a = chart.selected) === null || _a === void 0 ? void 0 : _a.length) {
188
+ chart._select = chart.selected;
189
+ chart.selected = [];
190
+ }
191
+ // active
192
+ drawItemBorder(chart, chart._select);
193
+ }
194
+ }
195
+ };
196
+ export default plugins;