@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,942 @@
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 { ControlElement, html, css, customElement, property, styleMap, query, FocusedPropertyKey } from '@refinitiv-ui/core';
8
+ import '../overlay';
9
+ import { Item } from '../item';
10
+ import '../item';
11
+ import '../icon';
12
+ import { CollectionComposer, TimeoutTaskRunner, AnimationTaskRunner } from '@refinitiv-ui/utils';
13
+ import { VERSION } from '../';
14
+ /**
15
+ * Key direction
16
+ */
17
+ var Direction;
18
+ (function (Direction) {
19
+ Direction[Direction["Up"] = -1] = "Up";
20
+ Direction[Direction["Down"] = 1] = "Down";
21
+ })(Direction || (Direction = {}));
22
+ // Observer config for items
23
+ const observerOptions = {
24
+ subtree: true,
25
+ childList: true,
26
+ attributes: true,
27
+ characterData: true,
28
+ attributeFilter: [
29
+ 'label',
30
+ 'value',
31
+ 'selected',
32
+ 'disabled',
33
+ 'readonly'
34
+ ]
35
+ };
36
+ const LABEL_SEPARATOR = ', '; // TODO: for multiselect
37
+ const POPUP_POSITION = ['bottom-start', 'top-start'];
38
+ const KEY_SEARCH_DEBOUNCER = 300;
39
+ /**
40
+ * Expands upon the native select element,
41
+ * providing a fully themeable dropdown element.
42
+ *
43
+ * @attr {boolean} disabled - Set disabled state
44
+ * @prop {boolean} [disabled=false] - Set disabled state
45
+ *
46
+ * @fires value-changed - Fired when the value property changes.
47
+ * @fires opened-changed - Fired when the opened property changes.
48
+ */
49
+ let Select = class Select extends ControlElement {
50
+ constructor() {
51
+ super(...arguments);
52
+ this.composer = new CollectionComposer([]);
53
+ this._data = null;
54
+ this.popupDynamicStyles = {}; /* set popup min-width based on select width or CSS vars */
55
+ this.lazyRendered = false; /* speed up rendering by not populating popup window on first load */
56
+ this.popupScrollTop = 0; /* remember scroll position on popup refit actions */
57
+ this.observingMutations = false;
58
+ this.keySearchTerm = ''; /* used for quick search */
59
+ this.keySearchThrottler = new TimeoutTaskRunner(KEY_SEARCH_DEBOUNCER);
60
+ this.resizeThrottler = new AnimationTaskRunner();
61
+ /**
62
+ * Placeholder to display when no value is set
63
+ */
64
+ this.placeholder = '';
65
+ /**
66
+ * Toggles the opened state of the list
67
+ */
68
+ this.opened = false;
69
+ /**
70
+ * Set state to error
71
+ */
72
+ this.error = false;
73
+ /**
74
+ * Set state to warning
75
+ */
76
+ this.warning = false;
77
+ /**
78
+ * This variable is here to ensure that the value and data are in sync when data is set after the value.
79
+ * This is developer error to use both, selected and value to control the selections.
80
+ * Therefore as soon as value has been set externally, selected state in data setter is ignored
81
+ */
82
+ this.cachedValue = '';
83
+ /**
84
+ * Handles all mutations and filters out
85
+ * any Shadow DOM changes in polyfilled browsers
86
+ * mutations collection of mutation records
87
+ * @param mutations Observer mutations
88
+ * @returns {void}
89
+ */
90
+ this.handleMutations = (mutations) => {
91
+ const hasLightDomMutations = mutations
92
+ .some(m => m.target.getRootNode() !== this.shadowRoot);
93
+ if (hasLightDomMutations) {
94
+ void this.requestUpdate();
95
+ }
96
+ };
97
+ this.shouldOpenOnFocus = false;
98
+ /**
99
+ * Used to store scroll position
100
+ * @returns {void}
101
+ */
102
+ this.onPopupScroll = ({ target }) => {
103
+ this.popupScrollTop = target.scrollTop;
104
+ };
105
+ }
106
+ /**
107
+ * Element version number
108
+ * @returns version number
109
+ */
110
+ static get version() {
111
+ return VERSION;
112
+ }
113
+ /**
114
+ * A `CSSResult` that will be used
115
+ * to style the host, slotted children
116
+ * and the internal template of the element.
117
+ * @return CSS template
118
+ */
119
+ static get styles() {
120
+ return css `
121
+ :host {
122
+ outline: none;
123
+ position: relative;
124
+ user-select: none;
125
+ -webkit-user-select: none;
126
+ display: inline-block;
127
+ }
128
+
129
+ [part=label],
130
+ [part=placeholder] {
131
+ white-space: nowrap;
132
+ overflow: hidden;
133
+ text-overflow: ellipsis;
134
+ }
135
+ [part=icon] {
136
+ flex: none;
137
+ }
138
+ :host [part=list] {
139
+ overflow-y: auto;
140
+ }
141
+ :host [part="list"] ::slotted(:not(ef-item)) {
142
+ display: none;
143
+ }
144
+ #box {
145
+ align-items: center;
146
+ display: inline-flex;
147
+ flex-flow: row nowrap;
148
+ overflow: hidden;
149
+ flex: 1 1 100%;
150
+ }
151
+ #text {
152
+ position: relative;
153
+ flex: 1 1 auto;
154
+ height: 100%;
155
+ display: flex;
156
+ align-items: center;
157
+ min-width: 0;
158
+ }
159
+ #trigger {
160
+ position: absolute;
161
+ top: 0;
162
+ right: 0;
163
+ bottom: 0;
164
+ left: 0;
165
+ }
166
+ #select {
167
+ position: absolute;
168
+ top: 0;
169
+ left: 0;
170
+ right: 0;
171
+ bottom: 0;
172
+ width: 100%;
173
+ height: 100%;
174
+ opacity: 0;
175
+ border: none;
176
+ padding: 0;
177
+ margin: 0;
178
+ }
179
+ `;
180
+ }
181
+ /**
182
+ * Current text content of the selected value
183
+ * @readonly
184
+ */
185
+ get label() {
186
+ return this.labels[0];
187
+ }
188
+ /**
189
+ * Current text content of the selected values
190
+ * @ignore
191
+ * @readonly
192
+ */
193
+ get labels() {
194
+ if (this.hasDataItems()) {
195
+ return this.selectedDataItems.map(item => this.composer.getItemPropertyValue(item, 'label'));
196
+ }
197
+ return this.selectedSlotItems.map(item => this.getItemLabel(item));
198
+ }
199
+ /**
200
+ * Switch to multiple select input
201
+ * @ignore
202
+ * @param multiple True if element needs to support multi selection
203
+ */
204
+ set multiple(multiple) {
205
+ // TODO: not implemented
206
+ }
207
+ /**
208
+ * @ignore
209
+ */
210
+ get multiple() {
211
+ return false;
212
+ }
213
+ /**
214
+ * Construct the menu from data object. Cannot be used with slotted content
215
+ * @type {SelectData | null}
216
+ */
217
+ get data() {
218
+ return this._data;
219
+ }
220
+ set data(value) {
221
+ const oldValue = this._data;
222
+ if (oldValue === value) {
223
+ return;
224
+ }
225
+ else if (Array.isArray(value)) {
226
+ this.composer = new CollectionComposer(value);
227
+ }
228
+ else {
229
+ this.composer = new CollectionComposer([]);
230
+ }
231
+ this._data = value;
232
+ // check if new set of data contains selected, which becomes the new value
233
+ // otherwise try to set current value
234
+ if (!this.selectedDataItems.length) {
235
+ this.value = this.cachedValue;
236
+ }
237
+ void this.requestUpdate('data', oldValue);
238
+ }
239
+ /**
240
+ * Value of the element
241
+ * @param value Element value
242
+ */
243
+ set value(value) {
244
+ value = this.castValue(value);
245
+ this.cachedValue = value;
246
+ const oldValue = this.value;
247
+ if (value !== oldValue) {
248
+ this.stopObserveMutations();
249
+ // setting the value always overrides the selected attribute
250
+ // either defined in data or by having selected as an attribute
251
+ this.clearSelection();
252
+ this.selectValue(value);
253
+ void this.requestUpdate('value', oldValue);
254
+ }
255
+ }
256
+ get value() {
257
+ return this.values[0] || '';
258
+ }
259
+ /**
260
+ * Array of selected items` values
261
+ * @ignore
262
+ * @readonly
263
+ */
264
+ get values() {
265
+ if (this.hasDataItems()) {
266
+ return this.selectedDataItems.map(item => this.composer.getItemPropertyValue(item, 'value'));
267
+ }
268
+ return this.selectedSlotItems.map(item => this.getItemValue(item));
269
+ }
270
+ /**
271
+ * Updates the element
272
+ * @param changedProperties Properties that has changed
273
+ * @returns {void}
274
+ */
275
+ update(changedProperties) {
276
+ this.cachedValue = ''; /* reset cached value as it is only valid when value and data are set the same time */
277
+ const focusedChanged = changedProperties.has(FocusedPropertyKey);
278
+ // the opened logic is bound to focus state
279
+ if (focusedChanged) {
280
+ // When focus changes the popup can open only on tapstart
281
+ if (this.focused && this.shouldOpenOnFocus) {
282
+ this.setOpened(true);
283
+ }
284
+ this.shouldOpenOnFocus = false;
285
+ }
286
+ if (changedProperties.has('opened')) {
287
+ if (this.opened) {
288
+ this.opening();
289
+ }
290
+ else {
291
+ this.closing();
292
+ }
293
+ }
294
+ super.update(changedProperties);
295
+ }
296
+ /**
297
+ * Called after the component is first rendered
298
+ * @param changedProperties Properties which have changed
299
+ * @returns {void}
300
+ */
301
+ firstUpdated(changedProperties) {
302
+ super.firstUpdated(changedProperties);
303
+ this.addEventListener('keydown', this.onKeyDown); /* keydown when select is closed */
304
+ }
305
+ /**
306
+ * Called when element finished updating
307
+ * @param changedProperties Properties which have changed
308
+ * @returns {void}
309
+ */
310
+ updated(changedProperties) {
311
+ super.updated(changedProperties);
312
+ // we must wait while all elements in the tree are updated before starting the mutation observer
313
+ void this.updateComplete.then(() => {
314
+ // Start watching for any child mutations
315
+ this.observeMutations();
316
+ });
317
+ }
318
+ /**
319
+ * Run when popup is opening
320
+ * Calculate CSS variables an computed width
321
+ * @returns {void}
322
+ */
323
+ opening() {
324
+ this.lazyRendered = true;
325
+ this.restrictPopupWidth(); /* styles ary dynamically applied in rendering */
326
+ }
327
+ /**
328
+ * Run when popup is closing
329
+ * @returns {void}
330
+ */
331
+ closing() {
332
+ // no content
333
+ }
334
+ /**
335
+ * Observe any changes to Light DOM
336
+ * This observer is self contained and should
337
+ * be garbage collected when there are no element references.
338
+ * @returns {void}
339
+ */
340
+ observeMutations() {
341
+ // Start watching for any new mutations if slotted content is used
342
+ if (!this.observingMutations && !this.hasDataItems()) {
343
+ if (!this.mutationObserver) {
344
+ this.mutationObserver = new MutationObserver(this.handleMutations);
345
+ }
346
+ this.mutationObserver.observe(this, observerOptions);
347
+ this.observingMutations = true;
348
+ }
349
+ }
350
+ /**
351
+ * Stop observe any changes to Light DOM
352
+ * There must not be any observation on any internal changes
353
+ * as it may cause excessive re-rendering
354
+ * @returns {void}
355
+ */
356
+ stopObserveMutations() {
357
+ if (this.observingMutations && this.mutationObserver) {
358
+ this.mutationObserver.disconnect();
359
+ this.observingMutations = false;
360
+ }
361
+ }
362
+ /**
363
+ * Popup has to use max width if --list-max-width specified
364
+ * otherwise, popup should have same width as control or wider
365
+ * @returns {void}
366
+ */
367
+ restrictPopupWidth() {
368
+ /* istanbul ignore next */
369
+ if (this.offsetWidth === 0) {
370
+ // this code might happen only when opened has been set during initialisation
371
+ // or when display is set to none
372
+ this.resizeThrottler.schedule(() => {
373
+ if (this.offsetWidth) { /* must be here to avoid infinitive loop */
374
+ this.restrictPopupWidth();
375
+ void this.requestUpdate();
376
+ }
377
+ });
378
+ return;
379
+ }
380
+ const maxWidth = this.getComputedVariable('--list-max-width', 'none');
381
+ let minWidth = this.offsetWidth;
382
+ if (maxWidth !== 'none') {
383
+ // reset min-width if max-width less than min-width, otherwise browser won't apply max-width
384
+ if (parseInt(maxWidth, 10) < minWidth) {
385
+ minWidth = 0;
386
+ }
387
+ }
388
+ this.popupDynamicStyles.minWidth = `${minWidth}px`;
389
+ }
390
+ /**
391
+ * Set opened state with event
392
+ * @param opened True if opened
393
+ * @returns {void}
394
+ */
395
+ setOpened(opened) {
396
+ if (this.opened !== opened) {
397
+ this.notifyPropertyChange('opened', opened);
398
+ this.opened = opened;
399
+ }
400
+ }
401
+ /**
402
+ * This flag is required to remove the frame gap
403
+ * between tap start and opening the popup
404
+ * @returns {void}
405
+ */
406
+ openOnFocus() {
407
+ if (this.opened) {
408
+ return;
409
+ }
410
+ if (this.focused) {
411
+ this.setOpened(true);
412
+ return;
413
+ }
414
+ this.shouldOpenOnFocus = true;
415
+ }
416
+ /**
417
+ * Toggles the opened state of the list
418
+ * @returns {void}
419
+ */
420
+ toggleOpened() {
421
+ if (this.opened) {
422
+ this.setOpened(false);
423
+ }
424
+ else {
425
+ this.openOnFocus();
426
+ }
427
+ }
428
+ /**
429
+ * Scroll to first selected item
430
+ * @returns {void}
431
+ */
432
+ scrollToSelected() {
433
+ const selected = this.getSelectedElements()[0];
434
+ if (selected) {
435
+ selected.scrollIntoView({
436
+ block: 'nearest'
437
+ });
438
+ }
439
+ }
440
+ /**
441
+ * Used to restore scroll position on each refit event
442
+ * @returns {void}
443
+ */
444
+ onPopupRefit({ target }) {
445
+ target.scrollTop = this.popupScrollTop;
446
+ }
447
+ /**
448
+ * Run when popup closes externally via opened-changed event
449
+ * Required to propagate the event
450
+ * @param event opened-changed event
451
+ * @returns {void}
452
+ */
453
+ onPopupOpenedChanged(event) {
454
+ event.preventDefault();
455
+ this.setOpened(event.detail.value);
456
+ }
457
+ /**
458
+ * Run when popup gets opened
459
+ * @returns {void}
460
+ */
461
+ onPopupOpened({ target }) {
462
+ this.scrollToSelected();
463
+ this.setItemHighlight(this.getSelectedElements()[0]);
464
+ const eventOptions = {
465
+ capture: true,
466
+ passive: true
467
+ };
468
+ target === null || target === void 0 ? void 0 : target.addEventListener('scroll', this.onPopupScroll, eventOptions);
469
+ }
470
+ /**
471
+ * Run when popup gets closed
472
+ * @returns {void}
473
+ */
474
+ onPopupClosed({ target }) {
475
+ const eventOptions = {
476
+ capture: true,
477
+ passive: true
478
+ };
479
+ target === null || target === void 0 ? void 0 : target.removeEventListener('scroll', this.onPopupScroll, eventOptions);
480
+ this.setItemHighlight();
481
+ this.popupScrollTop = 0;
482
+ }
483
+ /**
484
+ * Run when tap event happens on render root
485
+ * @param event tap event
486
+ * @returns {void}
487
+ */
488
+ onPopupTap(event) {
489
+ const item = this.findSelectableElement(event);
490
+ if (item) {
491
+ this.setValueAndNotify(this.getItemValue(item));
492
+ this.setOpened(false);
493
+ }
494
+ }
495
+ /**
496
+ * Run mouse move event over the popup
497
+ * @param event mouse move event
498
+ * @returns {void}
499
+ */
500
+ onPopupMouseMove(event) {
501
+ var _a;
502
+ (_a = this.menuEl) === null || _a === void 0 ? void 0 : _a.focus();
503
+ const item = this.findSelectableElement(event);
504
+ if (item) {
505
+ this.setItemHighlight(item);
506
+ }
507
+ }
508
+ /**
509
+ * Handles key input when popup is closed
510
+ * @param event Key down event object
511
+ * @returns {void}
512
+ */
513
+ onKeyDown(event) {
514
+ switch (event.key) {
515
+ case 'Up':
516
+ case 'ArrowUp':
517
+ case 'Down':
518
+ case 'ArrowDown':
519
+ case 'Enter':
520
+ case 'Spacebar':
521
+ case ' ':
522
+ this.setOpened(true);
523
+ break;
524
+ default:
525
+ return;
526
+ }
527
+ event.preventDefault();
528
+ }
529
+ /**
530
+ * Handles popup key input when popup is opened
531
+ * @param event Key down event object
532
+ * @returns {void}
533
+ */
534
+ onPopupKeyDown(event) {
535
+ var _a;
536
+ switch (event.key) {
537
+ case ' ':
538
+ case 'Spacebar':
539
+ case 'Enter':
540
+ (_a = this.highlightedItem) === null || _a === void 0 ? void 0 : _a.click();
541
+ break;
542
+ case 'Up':
543
+ case 'ArrowUp':
544
+ this.focusElement(Direction.Up);
545
+ break;
546
+ case 'Down':
547
+ case 'ArrowDown':
548
+ this.focusElement(Direction.Down);
549
+ break;
550
+ case 'Tab':
551
+ this.focusElement(event.shiftKey ? Direction.Up : Direction.Down);
552
+ break;
553
+ default:
554
+ if (this.isValidFilterKey(event)) {
555
+ this.onKeySearch(event.key);
556
+ break;
557
+ }
558
+ return;
559
+ // no default
560
+ }
561
+ event.preventDefault();
562
+ event.stopPropagation(); /* must be her to not reach self key listener */
563
+ }
564
+ /**
565
+ * Check if keyboard keydown can be used for data searching
566
+ * @param event Keyboard event
567
+ * @returns true if a valid key
568
+ */
569
+ isValidFilterKey(event) {
570
+ // all printable keys have length of 1. This is better than regexp as we cover all non latin characters
571
+ return event.key.length === 1
572
+ && !event.ctrlKey
573
+ && !event.altKey
574
+ && !event.metaKey;
575
+ }
576
+ /**
577
+ * Focus and highlight the next/previous element
578
+ * @param direction Focus next or previous element
579
+ * @returns {void}
580
+ */
581
+ focusElement(direction) {
582
+ const highlightedItem = this.highlightedItem || this.getSelectedElements()[0];
583
+ const children = this.getSelectableElements();
584
+ const idx = highlightedItem ? children.indexOf(highlightedItem) : -1;
585
+ let focusElement;
586
+ if (direction === 1) {
587
+ focusElement = idx === -1 ? children[0] : children[idx + 1];
588
+ }
589
+ else {
590
+ focusElement = idx === -1 ? children[children.length - 1] : children[idx - 1];
591
+ }
592
+ if (!focusElement) {
593
+ focusElement = direction === 1 ? children[0] : children[children.length - 1];
594
+ }
595
+ if (focusElement) {
596
+ focusElement.focus();
597
+ this.setItemHighlight(focusElement);
598
+ }
599
+ }
600
+ /**
601
+ * Highlight or remove highlight from an item
602
+ * @param [item] An item to highlight
603
+ * @returns {void}
604
+ */
605
+ setItemHighlight(item) {
606
+ if (this.highlightedItem === item) {
607
+ return;
608
+ }
609
+ if (this.highlightedItem) {
610
+ this.highlightedItem.highlighted = false;
611
+ }
612
+ this.highlightedItem = item;
613
+ if (item) {
614
+ item.highlighted = true;
615
+ }
616
+ }
617
+ /**
618
+ * A simple search that highlight elements on key press
619
+ * @param key A key pressed
620
+ * @returns {void}
621
+ */
622
+ onKeySearch(key) {
623
+ this.keySearchTerm += key.toLowerCase();
624
+ this.keySearchThrottler.schedule(() => {
625
+ this.keySearchTerm = '';
626
+ });
627
+ // start from highlighted and continue in circles
628
+ let selectableElements = this.getSelectableElements();
629
+ const highlightedIdx = this.highlightedItem ? selectableElements.indexOf(this.highlightedItem) : -1;
630
+ selectableElements = selectableElements.concat(selectableElements.splice(0, highlightedIdx));
631
+ const focusElement = selectableElements.find(item => {
632
+ const label = this.getItemLabel(item).toLowerCase();
633
+ return label.startsWith(this.keySearchTerm) && item !== this.highlightedItem;
634
+ });
635
+ if (focusElement) {
636
+ focusElement.focus();
637
+ this.setItemHighlight(focusElement);
638
+ }
639
+ }
640
+ /**
641
+ * Check if element can be selected
642
+ * @param element Element to check
643
+ * @returns true if element can be selected
644
+ */
645
+ isSelectableElement(element) {
646
+ // TODO: remove disabled && readonly check once ControlElement tabIndex issue is fixed
647
+ return element instanceof Item && element.tabIndex >= 0 && !element.disabled && !element.readonly;
648
+ }
649
+ /**
650
+ * Get a list of selectable HTML Elements
651
+ * *Can be used only when select is opened*
652
+ * @returns A list of selectable HTML elements
653
+ */
654
+ getSelectableElements() {
655
+ const root = this.hasDataItems() ? this.menuEl : this;
656
+ /* istanbul ignore next */
657
+ if (!root) {
658
+ return [];
659
+ }
660
+ const items = [];
661
+ const rootChildren = root.children;
662
+ for (let i = 0; i < rootChildren.length; i += 1) {
663
+ const item = rootChildren[i];
664
+ if (this.isSelectableElement(item)) {
665
+ items.push(item);
666
+ }
667
+ }
668
+ return items;
669
+ }
670
+ /**
671
+ * Find selectable element is the event composed path
672
+ * @param event Event to check
673
+ * @returns The first selectable element or undefined
674
+ */
675
+ findSelectableElement(event) {
676
+ const path = event.composedPath();
677
+ for (let i = 0; i < path.length; i += 1) {
678
+ const element = path[i];
679
+ if (element === this) {
680
+ return;
681
+ }
682
+ if (this.isSelectableElement(element)) {
683
+ return element;
684
+ }
685
+ }
686
+ }
687
+ /**
688
+ * Get a list of selected HTML elements
689
+ * *Can be used only when select is opened*
690
+ * @returns A list of selected elements
691
+ */
692
+ getSelectedElements() {
693
+ return this.getSelectableElements().filter(item => item.selected);
694
+ }
695
+ /**
696
+ * Clears the current selected items
697
+ * @returns {void}
698
+ */
699
+ clearSelection() {
700
+ if (this.hasDataItems()) {
701
+ this.selectedDataItems.forEach((item) => this.composer.setItemPropertyValue(item, 'selected', false));
702
+ }
703
+ else {
704
+ this.selectedSlotItems.forEach(item => {
705
+ item.selected = false;
706
+ });
707
+ }
708
+ void this.requestUpdate();
709
+ }
710
+ /**
711
+ * Mark item as selected
712
+ * @param value Value to select
713
+ * @returns true if corresponding item is found and item selected
714
+ */
715
+ selectValue(value) {
716
+ if (!this.values.includes(value)) {
717
+ if (this.hasDataItems()) {
718
+ return this.selectDataItem(value);
719
+ }
720
+ else {
721
+ return this.selectSlotItem(value);
722
+ }
723
+ }
724
+ return false;
725
+ }
726
+ /**
727
+ * Mark data item as selected
728
+ * @param value Item value
729
+ * @returns true if corresponding item is found and item selected
730
+ */
731
+ selectDataItem(value) {
732
+ const item = this.composer.queryItemsByPropertyValue('value', value)[0];
733
+ if (item) {
734
+ this.composer.setItemPropertyValue(item, 'selected', true);
735
+ return true;
736
+ }
737
+ return false;
738
+ }
739
+ /**
740
+ * Mark slotted item as selected
741
+ * @param value Item value, item label or item text content
742
+ * @returns true if corresponding item is found and item selected
743
+ */
744
+ selectSlotItem(value) {
745
+ const items = this.getSelectableElements();
746
+ for (let i = 0; i < items.length; i += 1) {
747
+ const item = items[i];
748
+ if (this.getItemValue(item) === value) {
749
+ item.selected = true;
750
+ return true;
751
+ }
752
+ }
753
+ return false;
754
+ }
755
+ /**
756
+ * Helper to return a value from an item
757
+ * @param item select item
758
+ * @returns value
759
+ */
760
+ getItemValue(item) {
761
+ return item.value || (item.hasAttribute('value') ? '' : this.getItemLabel(item));
762
+ }
763
+ /**
764
+ * Helper to return a label from an item
765
+ * @param item select item
766
+ * @returns value
767
+ */
768
+ getItemLabel(item) {
769
+ return item.label || item.textContent || '';
770
+ }
771
+ /**
772
+ * Check whether select is working with data or slotted content
773
+ * @returns True if working with data
774
+ */
775
+ hasDataItems() {
776
+ var _a;
777
+ return !!((_a = this.data) === null || _a === void 0 ? void 0 : _a.length);
778
+ }
779
+ /**
780
+ * Retrieve the selected data items
781
+ * @returns Selected data item
782
+ */
783
+ get selectedDataItems() {
784
+ return this.composer.queryItemsByPropertyValue('selected', true);
785
+ }
786
+ /**
787
+ * Retrieve the selected items
788
+ * @returns Selected data item
789
+ */
790
+ get selectedSlotItems() {
791
+ return this.getSelectedElements();
792
+ }
793
+ /**
794
+ * Calculating whether the placeholder should be hidden
795
+ * @returns result
796
+ */
797
+ placeholderHidden() {
798
+ return !!(this.labels.length > 0 || this.value);
799
+ }
800
+ /**
801
+ * Create template for menu item
802
+ * @param item JSON object to parse
803
+ * @returns template result
804
+ */
805
+ toItem(item) {
806
+ switch (item.type) {
807
+ case 'divider':
808
+ return html `<ef-item part="item" type="divider"></ef-item>`;
809
+ case 'header':
810
+ return html `<ef-item
811
+ part="item"
812
+ type="header"
813
+ .label=${item.label}></ef-item>`;
814
+ // no default
815
+ }
816
+ return html `<ef-item
817
+ part="item"
818
+ .value=${item.value}
819
+ .label=${item.label}
820
+ ?selected=${this.composer.getItemPropertyValue(item, 'selected')}
821
+ ?disabled=${item.disabled}
822
+ ></ef-item>`;
823
+ }
824
+ /**
825
+ * Template for placeholder
826
+ */
827
+ get placeholderTemplate() {
828
+ return html `<div part="placeholder">${this.placeholder}</div>`;
829
+ }
830
+ /**
831
+ * Template for label
832
+ */
833
+ get labelTemplate() {
834
+ return html `<div part="label">${this.multiple ? this.labels.join(LABEL_SEPARATOR) : this.label}</div>`;
835
+ }
836
+ /**
837
+ * Edit template when select is not readonly or disabled
838
+ */
839
+ get editTemplate() {
840
+ if (!this.readonly && !this.disabled) {
841
+ return html `
842
+ <div id="trigger" @tapstart="${this.toggleOpened}"></div>
843
+ ${this.popupTemplate}
844
+ `;
845
+ }
846
+ }
847
+ /**
848
+ * Get default slot template
849
+ */
850
+ get slottedContent() {
851
+ return html `<slot></slot>`;
852
+ }
853
+ /**
854
+ * Get data iterator template
855
+ */
856
+ get dataContent() {
857
+ return html `${this.composer.queryItems(() => true).map(item => this.toItem(item))}`;
858
+ }
859
+ /**
860
+ * Edit template when select is not readonly or disabled
861
+ */
862
+ get popupTemplate() {
863
+ if (this.lazyRendered) {
864
+ return html `<ef-overlay
865
+ tabindex="-1"
866
+ id="menu"
867
+ part="list"
868
+ style=${styleMap(this.popupDynamicStyles)}
869
+ with-shadow
870
+ lock-position-target
871
+ .positionTarget=${this}
872
+ .position=${POPUP_POSITION}
873
+ ?opened=${this.opened}
874
+ @tap=${this.onPopupTap}
875
+ @mousemove=${this.onPopupMouseMove}
876
+ @keydown=${this.onPopupKeyDown}
877
+ @opened-changed="${this.onPopupOpenedChanged}"
878
+ @opened="${this.onPopupOpened}"
879
+ @refit=${this.onPopupRefit}
880
+ @closed="${this.onPopupClosed}">${this.hasDataItems() ? this.dataContent : this.slottedContent}</ef-overlay>`;
881
+ }
882
+ else {
883
+ // This code is required because IE11 polyfill need items to be within a slot
884
+ // to make MutationObserver to observe items correctly
885
+ return html `<div style="display: none !important;"><slot></slot></div>`;
886
+ }
887
+ }
888
+ /**
889
+ * A `TemplateResult` that will be used
890
+ * to render the updated internal template.
891
+ * @return Render template
892
+ */
893
+ render() {
894
+ return html `
895
+ <div id="box">
896
+ <div id="text">
897
+ ${this.placeholderHidden() ? this.labelTemplate : this.placeholderTemplate}
898
+ </div>
899
+ <ef-icon icon="down" part="icon"></ef-icon>
900
+ </div>
901
+ ${this.editTemplate}`;
902
+ }
903
+ };
904
+ __decorate([
905
+ property({ type: String, attribute: false })
906
+ ], Select.prototype, "label", null);
907
+ __decorate([
908
+ property({ type: Array, attribute: false })
909
+ ], Select.prototype, "labels", null);
910
+ __decorate([
911
+ property({ type: String })
912
+ ], Select.prototype, "placeholder", void 0);
913
+ __decorate([
914
+ property({ type: Boolean, reflect: true })
915
+ ], Select.prototype, "opened", void 0);
916
+ __decorate([
917
+ property({ type: Boolean, reflect: true })
918
+ ], Select.prototype, "error", void 0);
919
+ __decorate([
920
+ property({ type: Boolean, reflect: true })
921
+ ], Select.prototype, "warning", void 0);
922
+ __decorate([
923
+ property({ type: Boolean })
924
+ ], Select.prototype, "multiple", null);
925
+ __decorate([
926
+ property({ attribute: false })
927
+ ], Select.prototype, "data", null);
928
+ __decorate([
929
+ property({ type: String, attribute: false })
930
+ ], Select.prototype, "value", null);
931
+ __decorate([
932
+ property({ attribute: false })
933
+ ], Select.prototype, "values", null);
934
+ __decorate([
935
+ query('#menu')
936
+ ], Select.prototype, "menuEl", void 0);
937
+ Select = __decorate([
938
+ customElement('ef-select', {
939
+ alias: 'coral-select'
940
+ })
941
+ ], Select);
942
+ export { Select };