@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,1093 @@
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
+ var InteractiveChart_1;
8
+ import { ResponsiveElement, html, css, customElement, property, query, DeprecationNotice } from '@refinitiv-ui/core';
9
+ import { color as parseColor } from '@refinitiv-ui/utils';
10
+ import { createChart as chart } from 'lightweight-charts';
11
+ import { VERSION } from '../';
12
+ import '../tooltip';
13
+ import { LegendStyle } from './helpers/types';
14
+ import { merge } from './helpers/merge';
15
+ export { LegendStyle };
16
+ const NOT_AVAILABLE_DATA = 'N/A';
17
+ const NO_DATA_POINT = '--';
18
+ /**
19
+ * A charting component that allows you to create several use cases of financial chart.
20
+ * By lightweight-charts library.
21
+ * @slot legend - Slot to use for implementing custom legend.
22
+ * @fires initialized - Dispatched when chart is initialized
23
+ */
24
+ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends ResponsiveElement {
25
+ constructor() {
26
+ super(...arguments);
27
+ /**
28
+ * Chart configurations for init chart
29
+ * @type {InteractiveChartConfig}
30
+ */
31
+ this.config = null;
32
+ /**
33
+ * Hide legend
34
+ */
35
+ this.disabledLegend = false;
36
+ /**
37
+ * Hide jump to latest data button
38
+ */
39
+ this.disabledJumpButton = false;
40
+ /**
41
+ * Deprecation noticed, used to display a warning message
42
+ * when deprecated features are used.
43
+ */
44
+ this.deprecationNotice = new DeprecationNotice('`legendstyle` attribute and property are deprecated. Use `legend-style` for attribute and `legendStyle` property instead.');
45
+ /** Array of series instances in chart */
46
+ this.seriesList = [];
47
+ this.jumpButtonInitialized = false;
48
+ this.legendInitialized = false;
49
+ this.isCrosshairVisible = false;
50
+ this.chart = null;
51
+ this.rowLegend = null;
52
+ this.timeScale = null;
53
+ this.width = 0;
54
+ this.height = 0;
55
+ this.theme = null;
56
+ this.themeColors = [];
57
+ this.hasDataPoint = false;
58
+ /**
59
+ * Set opacity of color
60
+ * @param color color value
61
+ * @param opacity opacity value
62
+ * @returns color parse
63
+ */
64
+ this.setOpacity = (color, opacity) => {
65
+ const colorParse = parseColor(color);
66
+ if (colorParse && opacity !== null) {
67
+ colorParse.opacity = Number(opacity);
68
+ }
69
+ return colorParse;
70
+ };
71
+ /**
72
+ * Handle MouseEventHandler
73
+ * on event subscribeCrosshairMove
74
+ * for create row legend
75
+ * @param param MouseEventParams
76
+ * @returns {void} return undefined has out of boundary chart
77
+ */
78
+ /* istanbul ignore next */
79
+ this.handleCrosshairMoved = (param) => {
80
+ if (!param) {
81
+ return;
82
+ }
83
+ this.createRowLegend(this.rowLegend, param);
84
+ };
85
+ /**
86
+ * Handle TimeRangeChangeEventHandler
87
+ * on event subscribeVisibleTimeRangeChange
88
+ * for create jump last button
89
+ * @returns {void}
90
+ */
91
+ this.handleTimeRangeChange = () => {
92
+ let buttonVisible = false;
93
+ if (this.timeScale) {
94
+ buttonVisible = this.timeScale.scrollPosition() < 0;
95
+ }
96
+ this.jumpButtonContainer.style.display = buttonVisible ? 'block' : 'none';
97
+ // when update data in series then should always show last value
98
+ if (this.internalConfig.series.length === this.seriesList.length) {
99
+ // update legend only when chart already created
100
+ this.updateLegendWithLatestData();
101
+ }
102
+ };
103
+ /**
104
+ * Handle event clicked scroll to realtime
105
+ * @returns {void}
106
+ */
107
+ this.handleScrollToRealTime = () => {
108
+ if (this.timeScale !== null) {
109
+ this.timeScale.scrollToRealTime();
110
+ }
111
+ };
112
+ }
113
+ /**
114
+ * Element version number
115
+ * @returns version number
116
+ */
117
+ static get version() {
118
+ return VERSION;
119
+ }
120
+ /**
121
+ * Set legend style i.e. `horizontal`, `vertical`.
122
+ * Default is `vertical`.
123
+ * @param {LegendStyle} value legend style value
124
+ * @type {"vertical" | "horizontal"} type of legend style
125
+ **/
126
+ set legendStyle(value) {
127
+ const oldValue = this.legendStyle;
128
+ if (oldValue !== value) {
129
+ this._legendStyle = value;
130
+ void this.requestUpdate('legend-style', oldValue);
131
+ }
132
+ }
133
+ get legendStyle() {
134
+ return this._legendStyle || this.deprecatedLegendStyle || LegendStyle.vertical;
135
+ }
136
+ /**
137
+ * @returns return config of property component
138
+ */
139
+ get internalConfig() {
140
+ // Check config is available
141
+ return this.config === null ? { series: [] } : this.config;
142
+ }
143
+ /**
144
+ * On Updated Lifecycle
145
+ * @param changedProperties changed properties
146
+ * @returns {void}
147
+ */
148
+ updated(changedProperties) {
149
+ super.updated(changedProperties);
150
+ if (changedProperties.has('config')) {
151
+ if (this.width && this.height && this.config) {
152
+ this.createChart(this.width, this.height, this.config);
153
+ }
154
+ }
155
+ if (changedProperties.has('disabledLegend')) {
156
+ this.onLegendChange(this.disabledLegend);
157
+ }
158
+ if (changedProperties.has('disabledJumpButton')) {
159
+ this.onJumpButtonChange(this.disabledJumpButton);
160
+ }
161
+ if (changedProperties.has('deprecatedLegendStyle') || changedProperties.has('legend-style')) {
162
+ if (changedProperties.has('deprecatedLegendStyle')) {
163
+ this.deprecationNotice.show();
164
+ }
165
+ const oldLegendStyle = (changedProperties.get('legend-style') || changedProperties.get('deprecatedLegendStyle'));
166
+ this.onLegendStyleChange(this.legendStyle, oldLegendStyle);
167
+ }
168
+ }
169
+ /**
170
+ * Change chart size or re-create chart
171
+ * when window size changed
172
+ * @ignore
173
+ * @param size new size
174
+ * @returns {void}
175
+ */
176
+ resizedCallback(size) {
177
+ super.resizedCallback(size);
178
+ this.width = size.width;
179
+ this.height = size.height;
180
+ if (this.chart) {
181
+ this.applyChartOptionSize(this.width, this.height);
182
+ }
183
+ else {
184
+ this.createChart(this.width, this.height, this.config);
185
+ }
186
+ }
187
+ /**
188
+ * Legend value observer
189
+ * @param value Legend value
190
+ * @returns {void}
191
+ */
192
+ onLegendChange(value) {
193
+ if (!value) {
194
+ this.createLegend();
195
+ }
196
+ else {
197
+ this.removeLegend();
198
+ }
199
+ }
200
+ /**
201
+ * Legend style observer
202
+ * @param value Legend style value
203
+ * @param previousValue Previous legend style value
204
+ * @returns {void}
205
+ */
206
+ onLegendStyleChange(value, previousValue) {
207
+ if (value === 'horizontal') {
208
+ if (previousValue) {
209
+ this.legendContainer.classList.remove(previousValue);
210
+ }
211
+ this.legendContainer.classList.add(value);
212
+ }
213
+ else {
214
+ this.legendContainer.classList.remove(previousValue);
215
+ }
216
+ }
217
+ /**
218
+ * Jump last value observer
219
+ * @param value jump last value
220
+ * @returns {void}
221
+ */
222
+ onJumpButtonChange(value) {
223
+ if (!value) {
224
+ this.createJumpButton(this.width, this.height);
225
+ }
226
+ else {
227
+ this.removeJumpButton();
228
+ }
229
+ }
230
+ /**
231
+ * update width and height of chart
232
+ * @param width width of element
233
+ * @param height height of element
234
+ * @returns {void}
235
+ */
236
+ applyChartOptionSize(width, height) {
237
+ if (this.chart) {
238
+ // Resize chart after rendered.
239
+ this.chart.applyOptions({
240
+ width: width,
241
+ height: height
242
+ });
243
+ // Render jump last button
244
+ if (!this.disabledJumpButton) {
245
+ this.createJumpButton(width, height);
246
+ }
247
+ }
248
+ }
249
+ /**
250
+ * Create chart from user config
251
+ * @param width Width component size
252
+ * @param height Height component size
253
+ * @param config data config
254
+ * @returns {void}
255
+ */
256
+ createChart(width, height, config) {
257
+ this.destroyChart();
258
+ if (config && width && height) {
259
+ // init css variables
260
+ this.themeColors = this.colors();
261
+ this.theme = {
262
+ backgroundColor: this.getComputedVariable('--background-color'),
263
+ textColor: this.getComputedVariable('--text-color'),
264
+ scalePriceBorderColor: this.getComputedVariable('--scale-price-border-color'),
265
+ scaleTimesBorderColor: this.getComputedVariable('--scale-times-border-color'),
266
+ gridVertLineColor: this.getComputedVariable('--grid-vert-line-color'),
267
+ gridHorzLineColor: this.getComputedVariable('--grid-horz-line-color'),
268
+ crossHairColor: this.getComputedVariable('--cross-hair-color'),
269
+ chartUpColor: this.getComputedVariable('--chart-up-color'),
270
+ chartDownColor: this.getComputedVariable('--chart-down-color'),
271
+ fillOpacity: this.cssVarAsNumber('--fill-opacity', InteractiveChart_1.DEFAULT_FILL_OPACITY),
272
+ lineWidth: this.cssVarAsNumber('--line-width', InteractiveChart_1.DEFAULT_LINE_WIDTH)
273
+ };
274
+ this.chart = chart(this.chartContainer);
275
+ this.mergeConfig(config);
276
+ this.applyChartOptionSize(width, height);
277
+ if (!this.disabledLegend) {
278
+ this.createLegend();
279
+ }
280
+ if (this.legendStyle === 'horizontal') {
281
+ this.legendContainer.classList.add(this.legendStyle);
282
+ }
283
+ this.chart.timeScale().fitContent();
284
+ /*
285
+ * Fired when chart initialized
286
+ */
287
+ this.dispatchEvent(new CustomEvent('initialized'));
288
+ }
289
+ }
290
+ /**
291
+ * Destroy chart
292
+ * @returns {void}
293
+ */
294
+ destroyChart() {
295
+ if (this.chart) {
296
+ this.removeLegend();
297
+ this.removeJumpButton();
298
+ this.destroySeries();
299
+ this.chartContainer.textContent = '';
300
+ }
301
+ }
302
+ /**
303
+ * Remove jump button
304
+ * @returns {void}
305
+ */
306
+ removeJumpButton() {
307
+ if (this.chart) {
308
+ this.jumpButtonContainer.style.display = 'none';
309
+ this.chart.timeScale().unsubscribeVisibleTimeRangeChange(this.handleTimeRangeChange);
310
+ this.jumpButtonContainer.removeEventListener('tap', this.handleScrollToRealTime);
311
+ this.jumpButtonInitialized = false;
312
+ }
313
+ }
314
+ /**
315
+ * Remove legend element
316
+ * @returns {void}
317
+ */
318
+ removeLegend() {
319
+ if (this.chart) {
320
+ this.legendContainer.textContent = '';
321
+ this.chart.unsubscribeCrosshairMove(this.handleCrosshairMoved);
322
+ this.legendInitialized = false;
323
+ }
324
+ }
325
+ /**
326
+ * Customize config and create chart by theme
327
+ * @param config data configuration for create chart
328
+ * @returns {void}
329
+ */
330
+ mergeConfig(config) {
331
+ if (config && config.hasOwnProperty('series')) {
332
+ this.createSeriesOptions();
333
+ this.createSeries();
334
+ }
335
+ this.applyTheme(config);
336
+ this.applyLegendTextColor();
337
+ this.applyStylesBranding();
338
+ this.applyStyleLegend();
339
+ }
340
+ /**
341
+ * Create series
342
+ * @returns {void}
343
+ */
344
+ createSeries() {
345
+ // Loop for add multiple series
346
+ for (let index = 0; index < this.internalConfig.series.length; index++) {
347
+ const config = this.internalConfig.series[index];
348
+ const series = this.addSeriesConfig(config);
349
+ this.seriesList.push(series);
350
+ }
351
+ }
352
+ /**
353
+ * Destroy Series
354
+ * @returns {void}
355
+ */
356
+ destroySeries() {
357
+ if (this.chart && this.seriesList && this.seriesList.length > 0) {
358
+ for (let i = 0; i < this.seriesList.length; i++) {
359
+ this.chart.removeSeries(this.seriesList[i]);
360
+ }
361
+ this.seriesList = [];
362
+ }
363
+ }
364
+ /**
365
+ * Add series to chart from config
366
+ * @param config data configuration for add series
367
+ * @returns series data
368
+ */
369
+ addSeriesConfig(config) {
370
+ let series = null;
371
+ if (this.chart) {
372
+ const { type, data, seriesOptions } = config;
373
+ // Create instance series
374
+ if (type === 'line') {
375
+ series = this.chart.addLineSeries(seriesOptions);
376
+ }
377
+ else if (type === 'area') {
378
+ series = this.chart.addAreaSeries(seriesOptions);
379
+ }
380
+ else if (type === 'bar') {
381
+ series = this.chart.addBarSeries(seriesOptions);
382
+ }
383
+ else if (type === 'candlestick') {
384
+ series = this.chart.addCandlestickSeries(seriesOptions);
385
+ }
386
+ else if (type === 'volume') {
387
+ series = this.chart.addHistogramSeries(seriesOptions);
388
+ }
389
+ if (data && series) {
390
+ series.setData(data);
391
+ }
392
+ }
393
+ return series;
394
+ }
395
+ /**
396
+ * Convert color to string
397
+ * @param fn function for parse color
398
+ * @param param value color
399
+ * @returns color parse
400
+ */
401
+ convertColorToString(fn, param, ...args) {
402
+ let color = null;
403
+ if (param) {
404
+ color = fn(param, ...args);
405
+ if (color) {
406
+ color = color.toString();
407
+ }
408
+ }
409
+ else {
410
+ color = {};
411
+ }
412
+ return color || {};
413
+ }
414
+ /**
415
+ * Create data configuration from theme
416
+ * @returns {void}
417
+ */
418
+ createSeriesOptions() {
419
+ if (this.theme) {
420
+ let colorIndex = 0;
421
+ for (let index = 0; index < this.internalConfig.series.length; index++) {
422
+ // Get seriesOptions and type
423
+ const seriesOptions = this.internalConfig.series[index].seriesOptions || {};
424
+ const type = this.internalConfig.series[index].type;
425
+ let seriesThemeOptions = {};
426
+ const colorCycle = this.convertColorToString(parseColor, this.themeColors[colorIndex]);
427
+ if (type === 'line') {
428
+ seriesThemeOptions = {
429
+ lineWidth: this.theme.lineWidth,
430
+ color: colorCycle
431
+ };
432
+ // Update color index
433
+ if (!seriesOptions.color) {
434
+ colorIndex++;
435
+ }
436
+ }
437
+ else if (type === 'area') {
438
+ seriesThemeOptions = {
439
+ lineWidth: this.theme.lineWidth,
440
+ lineColor: this.convertColorToString(parseColor, this.themeColors[colorIndex]),
441
+ topColor: this.convertColorToString(this.setOpacity, this.themeColors[colorIndex], this.theme.fillOpacity),
442
+ bottomColor: this.convertColorToString(this.setOpacity, this.themeColors[colorIndex], '0')
443
+ };
444
+ // Update color index
445
+ if (!seriesOptions.lineColor || !seriesOptions.topColor || !seriesOptions.bottomColor) {
446
+ colorIndex++;
447
+ }
448
+ }
449
+ else if (type === 'bar') {
450
+ seriesThemeOptions = {
451
+ upColor: colorCycle,
452
+ downColor: colorCycle
453
+ };
454
+ // Update color index
455
+ if (!seriesOptions.upColor || !seriesOptions.downColor) {
456
+ colorIndex++;
457
+ }
458
+ }
459
+ else if (type === 'candlestick') {
460
+ seriesThemeOptions = {
461
+ upColor: this.theme.chartUpColor,
462
+ downColor: this.theme.chartDownColor,
463
+ borderUpColor: this.theme.chartUpColor,
464
+ borderDownColor: this.theme.chartDownColor,
465
+ wickUpColor: this.theme.chartUpColor,
466
+ wickDownColor: this.theme.chartDownColor
467
+ };
468
+ // Update color index
469
+ if (!seriesOptions.upColor
470
+ || !seriesOptions.downColor
471
+ || !seriesOptions.borderUpColor
472
+ || !seriesOptions.borderDownColor
473
+ || !seriesOptions.wickUpColor
474
+ || !seriesOptions.wickDownColor) {
475
+ colorIndex++;
476
+ }
477
+ }
478
+ else if (type === 'volume') {
479
+ seriesThemeOptions = {
480
+ color: colorCycle
481
+ };
482
+ // Update color index
483
+ if (!seriesOptions.color) {
484
+ colorIndex++;
485
+ }
486
+ }
487
+ // Update config seriesOptions not have seriesOptions
488
+ if (!this.internalConfig.series[index].seriesOptions) {
489
+ this.internalConfig.series[index].seriesOptions = seriesThemeOptions;
490
+ }
491
+ else {
492
+ merge(seriesOptions, seriesThemeOptions);
493
+ }
494
+ }
495
+ }
496
+ }
497
+ /**
498
+ * Apply Theme to chart
499
+ * @param config value config
500
+ * @returns {void}
501
+ */
502
+ applyTheme(config) {
503
+ if (this.chart && this.theme) {
504
+ const style = getComputedStyle(this);
505
+ const defaultFontFamily = style.getPropertyValue('font-family');
506
+ // Create object has a property object before comparing config the theme
507
+ const chartOptions = config.options || {};
508
+ // Create object same as the theme
509
+ const chartThemeOptions = {
510
+ layout: {
511
+ backgroundColor: this.theme.backgroundColor,
512
+ textColor: this.theme.textColor,
513
+ fontFamily: defaultFontFamily
514
+ },
515
+ priceScale: {
516
+ borderColor: this.theme.scalePriceBorderColor
517
+ },
518
+ timeScale: {
519
+ borderColor: this.theme.scaleTimesBorderColor,
520
+ rightOffset: 1
521
+ },
522
+ grid: {
523
+ vertLines: {
524
+ color: this.theme.gridVertLineColor,
525
+ style: InteractiveChart_1.LINE_STYLES.SOLID
526
+ },
527
+ horzLines: {
528
+ color: this.theme.gridHorzLineColor,
529
+ style: InteractiveChart_1.LINE_STYLES.SOLID
530
+ }
531
+ },
532
+ crosshair: {
533
+ vertLine: {
534
+ color: this.theme.crossHairColor
535
+ },
536
+ horzLine: {
537
+ color: this.theme.crossHairColor
538
+ }
539
+ }
540
+ };
541
+ merge(chartOptions, chartThemeOptions);
542
+ if (!config.options) {
543
+ this.chart.applyOptions(chartThemeOptions);
544
+ }
545
+ else {
546
+ // Apply config when has option for custom
547
+ this.applyLegendTextColor();
548
+ this.chart.applyOptions(config.options);
549
+ }
550
+ }
551
+ }
552
+ /**
553
+ * Apply text color legend from chart options
554
+ * @returns {void}
555
+ */
556
+ applyLegendTextColor() {
557
+ if (this.chart) {
558
+ const options = this.chart.options();
559
+ if (options && options.hasOwnProperty('layout') && options.layout.hasOwnProperty('textColor')) {
560
+ this.legendContainer.style.color = options.layout.textColor;
561
+ }
562
+ }
563
+ }
564
+ /**
565
+ * Get position config for set position legend
566
+ * @returns {void}
567
+ */
568
+ applyStyleLegend() {
569
+ if (this.chart) {
570
+ // Get position config for set position legend
571
+ const position = this.getPriceScalePosition();
572
+ if (position === 'left' || position === 'two-price') {
573
+ this.legendContainer.className = 'yaxis-left';
574
+ }
575
+ else {
576
+ this.legendContainer.className = 'yaxis-right';
577
+ }
578
+ }
579
+ }
580
+ /**
581
+ * Get position config for set position logo trading view on chart
582
+ * @returns {void}
583
+ */
584
+ applyStylesBranding() {
585
+ if (this.chart) {
586
+ const position = this.getPriceScalePosition();
587
+ this.brandingContainer.className = position === 'two-price' ? 'right' : position;
588
+ }
589
+ }
590
+ /**
591
+ * Get price scale position
592
+ * @return position
593
+ */
594
+ getPriceScalePosition() {
595
+ var _a;
596
+ const priceScale = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.options();
597
+ if (priceScale.leftPriceScale.visible && priceScale.rightPriceScale.visible) {
598
+ return 'two-price';
599
+ }
600
+ else if (priceScale.leftPriceScale.visible) {
601
+ return 'left';
602
+ }
603
+ else if (priceScale.rightPriceScale.visible) {
604
+ return 'right';
605
+ }
606
+ else {
607
+ return 'none';
608
+ }
609
+ }
610
+ /**
611
+ * Create legend element
612
+ * @returns {void}
613
+ */
614
+ createLegend() {
615
+ if (this.chart && !this.legendInitialized && this.internalConfig.hasOwnProperty('series')) {
616
+ this.createRowLegend();
617
+ if (this.shadowRoot) {
618
+ this.rowLegend = this.shadowRoot.querySelectorAll('.row');
619
+ }
620
+ this.chart.subscribeCrosshairMove(this.handleCrosshairMoved);
621
+ this.legendInitialized = true;
622
+ }
623
+ }
624
+ /**
625
+ * Create legend element or update value in legend element
626
+ * @param rowLegend Legend element
627
+ * @param eventMove Event mouse move on chart
628
+ * @return {void}
629
+ */
630
+ createRowLegend(rowLegend, eventMove) {
631
+ let rowLegendElem;
632
+ for (let idx = 0; idx < this.internalConfig.series.length; idx++) {
633
+ const chartType = this.internalConfig.series[idx].type;
634
+ const dataSet = this.internalConfig.series[idx].data || [];
635
+ const symbol = (this.internalConfig.series[idx].symbolName || this.internalConfig.series[idx].symbol) || '';
636
+ // Create row legend element
637
+ if (!rowLegend) {
638
+ rowLegendElem = document.createElement('div');
639
+ rowLegendElem.setAttribute('class', 'row');
640
+ this.createTextSymbol(rowLegendElem, symbol);
641
+ if (dataSet.length) {
642
+ this.hasDataPoint = true;
643
+ const lastData = dataSet[dataSet.length - 1];
644
+ const priceColor = this.getColorInSeries(lastData, chartType, idx);
645
+ const lastDataValue = chartType === 'bar' || chartType === 'candlestick' ? lastData : lastData.value;
646
+ this.renderTextLegend(chartType, rowLegendElem, lastDataValue, priceColor, idx);
647
+ }
648
+ else {
649
+ const span = document.createElement('span');
650
+ span.className = 'price';
651
+ span.textContent = NOT_AVAILABLE_DATA;
652
+ rowLegendElem.appendChild(span);
653
+ }
654
+ this.legendContainer.appendChild(rowLegendElem);
655
+ }
656
+ /* Update value legend element on subscribeCrosshairMove.
657
+ * Don't need to be updated if chart has no data.
658
+ */
659
+ /* istanbul ignore next */
660
+ else if (rowLegend && dataSet.length) {
661
+ let value;
662
+ let priceColor = '';
663
+ // When have price on event moved on the crosshair
664
+ if ((eventMove === null || eventMove === void 0 ? void 0 : eventMove.seriesPrices.get(this.seriesList[idx])) && eventMove.time) {
665
+ value = eventMove.seriesPrices.get(this.seriesList[idx]);
666
+ priceColor = this.getColorInSeries(eventMove, chartType, idx);
667
+ this.isCrosshairVisible = true;
668
+ this.hasDataPoint = true;
669
+ }
670
+ // when there's no data point in the series object.
671
+ else if (!(eventMove === null || eventMove === void 0 ? void 0 : eventMove.seriesPrices.get(this.seriesList[idx])) && (eventMove === null || eventMove === void 0 ? void 0 : eventMove.time)) {
672
+ value = NO_DATA_POINT;
673
+ this.isCrosshairVisible = true;
674
+ this.hasDataPoint = false;
675
+ }
676
+ // Get latest value when mouse move out of scope
677
+ else {
678
+ const latestData = dataSet[dataSet.length - 1];
679
+ if (latestData) {
680
+ priceColor = this.getColorInSeries(latestData, chartType, idx);
681
+ value = chartType === 'bar' || chartType === 'candlestick' ? latestData : latestData.value;
682
+ this.isCrosshairVisible = false;
683
+ this.hasDataPoint = true;
684
+ }
685
+ }
686
+ // Render legend by series type
687
+ this.renderTextLegend(chartType, rowLegend, value, priceColor, idx);
688
+ }
689
+ }
690
+ }
691
+ /**
692
+ * Render text legend in row legend
693
+ * @param chartType chart type of series
694
+ * @param rowLegendElem row legend div element
695
+ * @param value value of series
696
+ * @param priceColor price color of series
697
+ * @param index index of series
698
+ * @returns {void}
699
+ */
700
+ renderTextLegend(chartType, rowLegendElem, value, priceColor, index) {
701
+ if (chartType === 'bar' || chartType === 'candlestick') {
702
+ if (!this.hasDataPoint && this.isNodeListElement(rowLegendElem)) {
703
+ const spanElem = rowLegendElem[index].querySelectorAll('span.price,span.ohlc');
704
+ spanElem.forEach(span => rowLegendElem[index].removeChild(span));
705
+ const span = document.createElement('span');
706
+ span.className = 'price';
707
+ span.textContent = value;
708
+ rowLegendElem[index].appendChild(span);
709
+ }
710
+ else {
711
+ this.createTextOHLC(rowLegendElem, value, priceColor, index);
712
+ }
713
+ }
714
+ else {
715
+ this.createTextPrice(rowLegendElem, value, priceColor, index);
716
+ }
717
+ }
718
+ /**
719
+ * Check `node` inside row legend and case type to HTMLElement
720
+ * @param rowLegend Legend element
721
+ * @returns true if not have `node` inside row legend
722
+ */
723
+ isHTMLElement(rowLegend) {
724
+ return rowLegend.length === undefined;
725
+ }
726
+ /**
727
+ * Check `node` inside row legend and case type to NodeListOf<Element>
728
+ * @param rowLegend Legend element
729
+ * @returns true if have `node` inside row legend
730
+ */
731
+ isNodeListElement(rowLegend) {
732
+ return rowLegend !== undefined;
733
+ }
734
+ /**
735
+ * Create span OHLC in row legend used by several series types such as bars or candlesticks
736
+ * @param rowLegend Legend element
737
+ * @param rowData Value of series
738
+ * @param priceColor Color of series
739
+ * @returns {void}
740
+ */
741
+ createSpanOHLC(rowLegend, rowData, priceColor) {
742
+ if (this.isHTMLElement(rowLegend)) {
743
+ rowLegend.setAttribute('data-color', priceColor);
744
+ this.createSpan(rowLegend, 'O', rowData.open, 'H', rowData.high, 'L', rowData.low, 'C', rowData.close);
745
+ }
746
+ }
747
+ /**
748
+ * Create text used by several series types such as bars or candlesticks
749
+ * @param rowLegend Legend element
750
+ * @param rowData Value of series
751
+ * @param priceColor color of series
752
+ * @param index Series index
753
+ * @returns {void}
754
+ */
755
+ createTextOHLC(rowLegend, rowData, priceColor, index) {
756
+ // Uses price formatter if provided
757
+ const formatter = this.internalConfig.series[index].hasOwnProperty('legendPriceFormatter') ? this.internalConfig.series[index].legendPriceFormatter : null;
758
+ if (formatter) {
759
+ rowData = {
760
+ open: formatter(rowData.open),
761
+ high: formatter(rowData.high),
762
+ low: formatter(rowData.low),
763
+ close: formatter(rowData.close)
764
+ };
765
+ }
766
+ // Create text price after chart has rendered
767
+ if (this.isHTMLElement(rowLegend)) {
768
+ this.createSpanOHLC(rowLegend, rowData, priceColor);
769
+ }
770
+ // Handle update text price when mouse crosshairMove in chart
771
+ else if (this.isNodeListElement(rowLegend)) {
772
+ const rowSpanLength = rowLegend[index].children.length;
773
+ let countElmPrice = 0;
774
+ for (let spanIndex = 0; spanIndex < rowSpanLength; spanIndex++) {
775
+ const spanElem = rowLegend[index].children[spanIndex];
776
+ /**
777
+ * Create a new span OHLC after displaying (--) or (N/A)
778
+ */
779
+ if (spanElem.textContent === NOT_AVAILABLE_DATA || spanElem.textContent === NO_DATA_POINT) {
780
+ rowLegend[index].removeChild(spanElem);
781
+ this.createSpanOHLC(rowLegend[index], rowData, priceColor);
782
+ }
783
+ else if (spanElem.getAttribute('class') === 'price') {
784
+ // Set price color
785
+ spanElem.style.color = priceColor;
786
+ // Set value OHLC BY price
787
+ if (countElmPrice === 0) {
788
+ spanElem.textContent = `${rowData.open}`;
789
+ }
790
+ else if (countElmPrice === 1) {
791
+ spanElem.textContent = `${rowData.high}`;
792
+ }
793
+ else if (countElmPrice === 2) {
794
+ spanElem.textContent = `${rowData.low}`;
795
+ }
796
+ else if (countElmPrice === 3) {
797
+ spanElem.textContent = `${rowData.close}`;
798
+ }
799
+ // Update next span by price
800
+ countElmPrice++;
801
+ }
802
+ }
803
+ }
804
+ }
805
+ /**
806
+ * Create text price used by several series types
807
+ * @param rowLegend Legend element
808
+ * @param price Value of series
809
+ * @param priceColor color of series
810
+ * @param index Series index
811
+ * @returns {void}
812
+ */
813
+ createTextPrice(rowLegend, price, priceColor, index) {
814
+ var _a;
815
+ const formatter = this.internalConfig.series[index].legendPriceFormatter;
816
+ // Formats legend only when formatter and data point are provided
817
+ const formattedPrice = !!formatter && price !== NO_DATA_POINT ? formatter(price) : price;
818
+ // Create text price after chart has rendered
819
+ if (this.isHTMLElement(rowLegend)) {
820
+ rowLegend.setAttribute('data-color', priceColor);
821
+ this.createSpan(rowLegend, formattedPrice);
822
+ }
823
+ // Handle update text price when mouse crosshairMove in chart
824
+ else if (this.isNodeListElement(rowLegend)) {
825
+ const symbolElem = rowLegend[index].children[0];
826
+ const spanIndex = ((_a = symbolElem.getAttribute('class')) === null || _a === void 0 ? void 0 : _a.indexOf('symbol')) === 0 ? 1 : 0;
827
+ const rowLegendElem = rowLegend[index];
828
+ rowLegendElem.children[spanIndex].textContent = `${formattedPrice}`;
829
+ rowLegendElem.children[spanIndex].style.color = `${priceColor}`;
830
+ }
831
+ }
832
+ /**
833
+ * Create span in legend element by several series types
834
+ * @param rowLegend Legend element
835
+ * @param args text value
836
+ * @returns {void}
837
+ */
838
+ createSpan(rowLegend, ...args) {
839
+ const div = rowLegend; // rowLegend
840
+ const arg = args;
841
+ const len = args.length;
842
+ const color = div.getAttribute('data-color');
843
+ for (let idx = 0; idx < len; idx++) {
844
+ const span = document.createElement('span');
845
+ const textContent = `${arg[idx]}`;
846
+ span.textContent = textContent;
847
+ // Set class by Text O H L C
848
+ if (['O', 'H', 'L', 'C'].includes(textContent)) {
849
+ span.setAttribute('class', 'ohlc');
850
+ }
851
+ else {
852
+ span.setAttribute('class', 'price');
853
+ span.style.color = color;
854
+ }
855
+ div.appendChild(span);
856
+ }
857
+ }
858
+ /**
859
+ * Create span in legend element by several series types
860
+ * @param rowLegend Legend element
861
+ * @param symbol Value naming for show
862
+ * @returns {void}
863
+ */
864
+ createTextSymbol(rowLegend, symbol) {
865
+ if (rowLegend.children && symbol) {
866
+ const symbolElem = document.createElement('span');
867
+ symbolElem.setAttribute('class', 'symbol');
868
+ symbolElem.textContent = symbol + ' : ';
869
+ rowLegend.appendChild(symbolElem);
870
+ }
871
+ }
872
+ /**
873
+ * Get legend price color
874
+ * @param color color code
875
+ * @returns rgba or hex color
876
+ */
877
+ getLegendPriceColor(color) {
878
+ // check color is does not blend with the background
879
+ if (color === 'rgba(0,0,0,0)' || color === 'transparent') {
880
+ return this.getComputedVariable('--text-color');
881
+ }
882
+ return color;
883
+ }
884
+ /**
885
+ * Get Color in series
886
+ * @param seriesData series data or event mouse move on chart
887
+ * @param chartType type of chart
888
+ * @param index index of list series
889
+ * @returns color value
890
+ */
891
+ getColorInSeries(seriesData, chartType, index) {
892
+ var _a;
893
+ if (chartType === 'line') {
894
+ return this.getLegendPriceColor(this.seriesList[index].options().color);
895
+ }
896
+ else if (chartType === 'candlestick') {
897
+ const value = seriesData.hasOwnProperty('seriesPrices') ? (_a = seriesData) === null || _a === void 0 ? void 0 : _a.seriesPrices.get(this.seriesList[index]) : seriesData;
898
+ const barStyle = this.seriesList[index].options();
899
+ const colorBar = value.close > value.open ? barStyle.borderUpColor : barStyle.borderDownColor;
900
+ return colorBar;
901
+ }
902
+ else if (chartType === 'bar') {
903
+ return this.getLegendPriceColor(this.seriesList[index].options().upColor);
904
+ }
905
+ else if (chartType === 'area') {
906
+ return this.getLegendPriceColor(this.seriesList[index].options().lineColor);
907
+ }
908
+ else if (chartType === 'volume') {
909
+ const priceValue = seriesData.hasOwnProperty('seriesPrices') ? seriesData.seriesPrices.get(this.seriesList[index]) : seriesData.value;
910
+ let dataItem = {};
911
+ this.internalConfig.series[index].data.forEach((dataConfig) => {
912
+ const data = dataConfig;
913
+ const time = data.time;
914
+ const timeSeriesData = seriesData.time;
915
+ // if via time point data string format 'yyyy-mm-dd' or object '{ year: 2019, month: 6, day: 1 }'
916
+ if (time.hasOwnProperty('day') && time.hasOwnProperty('month') && time.hasOwnProperty('year')) {
917
+ if (time.day === timeSeriesData.day
918
+ && time.month === timeSeriesData.month
919
+ && time.year === timeSeriesData.year
920
+ && data.value === priceValue) {
921
+ dataItem = dataConfig;
922
+ }
923
+ }
924
+ // if via config time uses a UNIX Timestamp format for time point data.
925
+ else if (time === seriesData.time) {
926
+ dataItem = data;
927
+ }
928
+ });
929
+ // check when each color is added, the item comes from the configuration
930
+ if (dataItem.hasOwnProperty('color')) {
931
+ const data = dataItem;
932
+ return this.getLegendPriceColor(data.color);
933
+ }
934
+ else {
935
+ return this.getLegendPriceColor(this.seriesList[index].options().color);
936
+ }
937
+ }
938
+ return '';
939
+ }
940
+ /**
941
+ * Create button that will make window scroll to the last data
942
+ * in the chart when clicked
943
+ * @param width Width component size
944
+ * @param height Hight component size
945
+ * @returns {void}
946
+ */
947
+ createJumpButton(width, height) {
948
+ if (this.chart && this.jumpButtonContainer) {
949
+ this.timeScale = this.chart.timeScale();
950
+ // Get position config for set position jump last button
951
+ const position = this.getPriceScalePosition();
952
+ const pricePosition = position === 'left' ? 30 : 0;
953
+ const buttonTop = `${height - 70}px`;
954
+ const buttonLeft = `${(width + pricePosition) - 100}px`;
955
+ this.jumpButtonContainer.style.top = buttonTop;
956
+ this.jumpButtonContainer.style.left = buttonLeft;
957
+ // Create subscribeVisibleTimeRangeChange
958
+ if (!this.jumpButtonInitialized) {
959
+ this.chart.timeScale().subscribeVisibleTimeRangeChange(this.handleTimeRangeChange);
960
+ this.jumpButtonContainer.addEventListener('tap', this.handleScrollToRealTime);
961
+ this.jumpButtonInitialized = true;
962
+ }
963
+ }
964
+ }
965
+ /**
966
+ * Update Legend with latest data on update data in series
967
+ * @returns {void}
968
+ */
969
+ updateLegendWithLatestData() {
970
+ var _a;
971
+ if (this.rowLegend && !this.isCrosshairVisible && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('series'))) {
972
+ for (let idx = 0; idx < this.internalConfig.series.length; idx++) {
973
+ const chartType = this.internalConfig.series[idx].type;
974
+ const series = this.internalConfig.series[idx];
975
+ const dataSet = series.data || [];
976
+ const latestData = dataSet[dataSet.length - 1];
977
+ if (latestData) {
978
+ const value = chartType === 'bar' || chartType === 'candlestick' ? latestData : latestData.value; // latestData
979
+ const priceColor = this.getColorInSeries(latestData, chartType, idx);
980
+ // Render legend by series type
981
+ this.renderTextLegend(chartType, this.rowLegend, value, priceColor, idx);
982
+ }
983
+ }
984
+ }
985
+ }
986
+ /**
987
+ * Get as CSS variable and tries to convert it into a usable number
988
+ * @param args param css variable
989
+ * @returns The value as a number, or, undefined if NaN.
990
+ */
991
+ cssVarAsNumber(...args) {
992
+ args[args.length] = '';
993
+ const cssComputeVar = this.getComputedVariable(...args);
994
+ const result = parseFloat(cssComputeVar.replace(/\D+$/, ''));
995
+ return cssComputeVar && !isNaN(result) ? result : undefined;
996
+ }
997
+ /**
998
+ * List of available chart colors from the theme.
999
+ * @returns list of available chart colors from the theme.
1000
+ */
1001
+ colors() {
1002
+ let color;
1003
+ let index = 0;
1004
+ const colors = [];
1005
+ while ((color = this.getComputedVariable(`${InteractiveChart_1.CSS_COLOR_PREFIX}${(index += 1)}`))) {
1006
+ const parseColorCode = parseColor(color);
1007
+ if (parseColorCode !== null) {
1008
+ colors.push(parseColorCode.toString());
1009
+ }
1010
+ }
1011
+ return colors;
1012
+ }
1013
+ /**
1014
+ * A `CSSResult` that will be used
1015
+ * to style the host, slotted children
1016
+ * and the internal template of the element.
1017
+ * @return CSS template
1018
+ */
1019
+ static get styles() {
1020
+ return css `
1021
+ :host {
1022
+ display: block;
1023
+ position: relative;
1024
+ height: 300px;
1025
+ z-index: 0;
1026
+ }
1027
+ `;
1028
+ }
1029
+ /**
1030
+ * A `TemplateResult` that will be used
1031
+ * to render the updated internal template.
1032
+ * @return Render template
1033
+ */
1034
+ render() {
1035
+ return html `
1036
+ <slot name="legend">
1037
+ <div part="legend"></div>
1038
+ </slot>
1039
+ <div part="jump-button-container">
1040
+ <div part="jump-button"></div>
1041
+ </div>
1042
+ <div part="branding-container" title="" tooltip="Powered by Trading View">
1043
+ <svg width="33" height="19" viewBox="0 0 611 314" part="branding">
1044
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M341 124C375.242 124 403 96.2417 403 62C403 27.7583 375.242 0 341 0C306.758 0 279 27.7583 279 62C279 96.2417 306.758 124 341 124ZM481 314H337L467 4H611L481 314ZM124 4H248V128V314H124V128H0V4H124Z"/>
1045
+ </svg>
1046
+ </div>
1047
+ <div part="chart"></div>
1048
+ `;
1049
+ }
1050
+ };
1051
+ InteractiveChart.CSS_COLOR_PREFIX = '--chart-color-';
1052
+ InteractiveChart.DEFAULT_LINE_WIDTH = '2';
1053
+ InteractiveChart.DEFAULT_FILL_OPACITY = '0.4';
1054
+ InteractiveChart.LINE_STYLES = {
1055
+ SOLID: 0,
1056
+ DOTTED: 1,
1057
+ DASHED: 2,
1058
+ LARGE_DASHED: 3,
1059
+ SPARSE_DOTTED: 4
1060
+ };
1061
+ __decorate([
1062
+ property({ type: Object })
1063
+ ], InteractiveChart.prototype, "config", void 0);
1064
+ __decorate([
1065
+ property({ type: Boolean, reflect: true, attribute: 'disabled-legend' })
1066
+ ], InteractiveChart.prototype, "disabledLegend", void 0);
1067
+ __decorate([
1068
+ property({ type: Boolean, reflect: true, attribute: 'disabled-jump-button' })
1069
+ ], InteractiveChart.prototype, "disabledJumpButton", void 0);
1070
+ __decorate([
1071
+ property({ type: String, attribute: 'legendstyle' })
1072
+ ], InteractiveChart.prototype, "deprecatedLegendStyle", void 0);
1073
+ __decorate([
1074
+ property({ type: String, attribute: 'legend-style' })
1075
+ ], InteractiveChart.prototype, "legendStyle", null);
1076
+ __decorate([
1077
+ query('[part=chart]', true)
1078
+ ], InteractiveChart.prototype, "chartContainer", void 0);
1079
+ __decorate([
1080
+ query('[part=legend]', true)
1081
+ ], InteractiveChart.prototype, "legendContainer", void 0);
1082
+ __decorate([
1083
+ query('[part=jump-button-container]', true)
1084
+ ], InteractiveChart.prototype, "jumpButtonContainer", void 0);
1085
+ __decorate([
1086
+ query('[part=branding-container]', true)
1087
+ ], InteractiveChart.prototype, "brandingContainer", void 0);
1088
+ InteractiveChart = InteractiveChart_1 = __decorate([
1089
+ customElement('ef-interactive-chart', {
1090
+ alias: 'sapphire-interactive-chart'
1091
+ })
1092
+ ], InteractiveChart);
1093
+ export { InteractiveChart };