@refinitiv-ui/elements 5.0.0-beta.3 → 5.0.0-dev.204

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 (596) hide show
  1. package/CHANGELOG.md +325 -73
  2. package/README.md +13 -2
  3. package/lib/accordion/custom-elements.json +0 -13
  4. package/lib/accordion/custom-elements.md +18 -0
  5. package/lib/accordion/index.d.ts +13 -10
  6. package/lib/accordion/index.js +15 -18
  7. package/lib/appstate-bar/custom-elements.json +1 -1
  8. package/lib/appstate-bar/custom-elements.md +22 -0
  9. package/lib/appstate-bar/index.d.ts +15 -6
  10. package/lib/appstate-bar/index.js +17 -11
  11. package/lib/autosuggest/custom-elements.json +24 -4
  12. package/lib/autosuggest/custom-elements.md +54 -0
  13. package/lib/autosuggest/helpers/types.d.ts +22 -1
  14. package/lib/autosuggest/helpers/types.js +0 -1
  15. package/lib/autosuggest/helpers/utils.d.ts +2 -2
  16. package/lib/autosuggest/helpers/utils.js +1 -3
  17. package/lib/autosuggest/index.d.ts +21 -9
  18. package/lib/autosuggest/index.js +45 -31
  19. package/lib/button/custom-elements.json +3 -3
  20. package/lib/button/custom-elements.md +23 -0
  21. package/lib/button/index.d.ts +27 -20
  22. package/lib/button/index.js +92 -74
  23. package/lib/button/themes/halo/dark/index.js +1 -1
  24. package/lib/button/themes/halo/light/index.js +1 -1
  25. package/lib/button/themes/solar/charcoal/index.js +1 -1
  26. package/lib/button/themes/solar/pearl/index.js +1 -1
  27. package/lib/button-bar/custom-elements.md +9 -0
  28. package/lib/button-bar/index.d.ts +60 -4
  29. package/lib/button-bar/index.js +164 -19
  30. package/lib/calendar/constants.d.ts +26 -0
  31. package/lib/calendar/constants.js +28 -0
  32. package/lib/calendar/custom-elements.json +8 -6
  33. package/lib/calendar/custom-elements.md +35 -0
  34. package/lib/calendar/index.d.ts +119 -21
  35. package/lib/calendar/index.js +512 -157
  36. package/lib/calendar/locales.d.ts +1 -31
  37. package/lib/calendar/locales.js +3 -107
  38. package/lib/calendar/themes/halo/dark/index.js +1 -1
  39. package/lib/calendar/themes/halo/light/index.js +1 -1
  40. package/lib/calendar/themes/solar/charcoal/index.js +1 -1
  41. package/lib/calendar/themes/solar/pearl/index.js +1 -1
  42. package/lib/calendar/types.d.ts +12 -13
  43. package/lib/calendar/types.js +1 -7
  44. package/lib/calendar/utils.d.ts +31 -1
  45. package/lib/calendar/utils.js +105 -3
  46. package/lib/canvas/custom-elements.json +9 -7
  47. package/lib/canvas/custom-elements.md +27 -0
  48. package/lib/canvas/index.d.ts +14 -6
  49. package/lib/canvas/index.js +17 -12
  50. package/lib/card/custom-elements.json +21 -9
  51. package/lib/card/custom-elements.md +24 -0
  52. package/lib/card/helpers/types.d.ts +1 -1
  53. package/lib/card/helpers/types.js +0 -1
  54. package/lib/card/index.d.ts +67 -20
  55. package/lib/card/index.js +132 -35
  56. package/lib/card/themes/halo/dark/index.js +1 -1
  57. package/lib/card/themes/halo/light/index.js +1 -1
  58. package/lib/card/themes/solar/charcoal/index.js +1 -1
  59. package/lib/card/themes/solar/pearl/index.js +1 -1
  60. package/lib/chart/custom-elements.json +3 -3
  61. package/lib/chart/custom-elements.md +16 -0
  62. package/lib/chart/helpers/index.d.ts +2 -0
  63. package/lib/chart/helpers/index.js +2 -0
  64. package/lib/chart/helpers/legend.d.ts +2 -2
  65. package/lib/chart/helpers/legend.js +2 -3
  66. package/lib/chart/helpers/merge.d.ts +15 -0
  67. package/lib/chart/helpers/merge.js +28 -0
  68. package/lib/chart/helpers/types.d.ts +40 -12
  69. package/lib/chart/helpers/types.js +0 -1
  70. package/lib/chart/index.d.ts +34 -26
  71. package/lib/chart/index.js +58 -55
  72. package/lib/chart/plugins/doughnut-center-label.js +4 -5
  73. package/lib/checkbox/custom-elements.json +4 -4
  74. package/lib/checkbox/custom-elements.md +18 -0
  75. package/lib/checkbox/index.d.ts +29 -14
  76. package/lib/checkbox/index.js +65 -34
  77. package/lib/checkbox/themes/halo/dark/index.js +1 -1
  78. package/lib/checkbox/themes/halo/light/index.js +1 -1
  79. package/lib/clock/custom-elements.json +21 -4
  80. package/lib/clock/custom-elements.md +28 -0
  81. package/lib/clock/index.d.ts +25 -6
  82. package/lib/clock/index.js +44 -18
  83. package/lib/clock/themes/halo/dark/index.js +1 -1
  84. package/lib/clock/themes/halo/light/index.js +1 -1
  85. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  86. package/lib/clock/themes/solar/pearl/index.js +1 -1
  87. package/lib/clock/utils/TickManager.js +2 -3
  88. package/lib/clock/utils/timestamps.js +0 -1
  89. package/lib/collapse/custom-elements.md +27 -0
  90. package/lib/collapse/index.d.ts +15 -8
  91. package/lib/collapse/index.js +18 -13
  92. package/lib/color-dialog/custom-elements.json +29 -16
  93. package/lib/color-dialog/custom-elements.md +39 -0
  94. package/lib/color-dialog/elements/color-palettes.d.ts +13 -6
  95. package/lib/color-dialog/elements/color-palettes.js +16 -13
  96. package/lib/color-dialog/elements/grayscale-palettes.d.ts +13 -6
  97. package/lib/color-dialog/elements/grayscale-palettes.js +17 -13
  98. package/lib/color-dialog/elements/palettes.d.ts +15 -3
  99. package/lib/color-dialog/elements/palettes.js +65 -45
  100. package/lib/color-dialog/helpers/color-helpers.d.ts +7 -53
  101. package/lib/color-dialog/helpers/color-helpers.js +12 -110
  102. package/lib/color-dialog/helpers/value-model.d.ts +1 -1
  103. package/lib/color-dialog/helpers/value-model.js +18 -17
  104. package/lib/color-dialog/index.d.ts +27 -20
  105. package/lib/color-dialog/index.js +54 -45
  106. package/lib/combo-box/custom-elements.json +51 -17
  107. package/lib/combo-box/custom-elements.md +42 -0
  108. package/lib/combo-box/helpers/filter.d.ts +4 -4
  109. package/lib/combo-box/helpers/filter.js +0 -1
  110. package/lib/combo-box/helpers/keyboard-event.js +0 -1
  111. package/lib/combo-box/helpers/renderer.d.ts +8 -0
  112. package/lib/combo-box/helpers/renderer.js +24 -0
  113. package/lib/combo-box/helpers/types.d.ts +2 -2
  114. package/lib/combo-box/helpers/types.js +0 -1
  115. package/lib/combo-box/index.d.ts +63 -32
  116. package/lib/combo-box/index.js +102 -60
  117. package/lib/combo-box/themes/halo/dark/index.js +2 -3
  118. package/lib/combo-box/themes/halo/light/index.js +2 -3
  119. package/lib/combo-box/themes/solar/charcoal/index.js +2 -3
  120. package/lib/combo-box/themes/solar/pearl/index.js +2 -3
  121. package/lib/counter/custom-elements.json +39 -0
  122. package/lib/counter/custom-elements.md +11 -0
  123. package/lib/counter/index.d.ts +91 -0
  124. package/lib/counter/index.js +154 -0
  125. package/lib/counter/themes/halo/dark/index.js +3 -0
  126. package/lib/counter/themes/halo/light/index.js +3 -0
  127. package/lib/counter/themes/solar/charcoal/index.js +3 -0
  128. package/lib/counter/themes/solar/pearl/index.js +3 -0
  129. package/lib/counter/utils.d.ts +13 -0
  130. package/lib/counter/utils.js +52 -0
  131. package/lib/datetime-picker/custom-elements.json +53 -24
  132. package/lib/datetime-picker/custom-elements.md +57 -0
  133. package/lib/datetime-picker/index.d.ts +34 -16
  134. package/lib/datetime-picker/index.js +56 -38
  135. package/lib/datetime-picker/locales.d.ts +1 -1
  136. package/lib/datetime-picker/locales.js +12 -2
  137. package/lib/datetime-picker/themes/solar/charcoal/index.js +1 -1
  138. package/lib/datetime-picker/themes/solar/pearl/index.js +1 -1
  139. package/lib/datetime-picker/types.d.ts +1 -1
  140. package/lib/datetime-picker/types.js +0 -1
  141. package/lib/datetime-picker/utils.js +1 -2
  142. package/lib/dialog/custom-elements.json +34 -12
  143. package/lib/dialog/custom-elements.md +47 -0
  144. package/lib/dialog/draggable-element.js +25 -16
  145. package/lib/dialog/index.d.ts +25 -21
  146. package/lib/dialog/index.js +36 -32
  147. package/lib/email-field/custom-elements.json +81 -94
  148. package/lib/email-field/custom-elements.md +37 -0
  149. package/lib/email-field/index.d.ts +47 -112
  150. package/lib/email-field/index.js +48 -241
  151. package/lib/email-field/themes/halo/dark/index.js +1 -1
  152. package/lib/email-field/themes/halo/light/index.js +1 -1
  153. package/lib/email-field/themes/solar/charcoal/index.js +1 -1
  154. package/lib/email-field/themes/solar/pearl/index.js +1 -1
  155. package/lib/events.d.ts +121 -0
  156. package/lib/events.js +1 -0
  157. package/lib/flag/custom-elements.md +10 -0
  158. package/lib/flag/index.d.ts +14 -5
  159. package/lib/flag/index.js +19 -12
  160. package/lib/flag/utils/FlagLoader.d.ts +1 -1
  161. package/lib/flag/utils/FlagLoader.js +1 -2
  162. package/lib/header/custom-elements.md +18 -0
  163. package/lib/header/index.d.ts +10 -3
  164. package/lib/header/index.js +12 -8
  165. package/lib/heatmap/custom-elements.json +13 -0
  166. package/lib/heatmap/custom-elements.md +26 -0
  167. package/lib/heatmap/helpers/color.d.ts +1 -1
  168. package/lib/heatmap/helpers/color.js +1 -2
  169. package/lib/heatmap/helpers/text.d.ts +1 -1
  170. package/lib/heatmap/helpers/text.js +0 -1
  171. package/lib/heatmap/helpers/track.js +2 -3
  172. package/lib/heatmap/helpers/types.js +0 -1
  173. package/lib/heatmap/index.d.ts +32 -13
  174. package/lib/heatmap/index.js +61 -35
  175. package/lib/icon/custom-elements.json +6 -4
  176. package/lib/icon/custom-elements.md +8 -0
  177. package/lib/icon/index.d.ts +17 -7
  178. package/lib/icon/index.js +36 -18
  179. package/lib/icon/utils/IconLoader.d.ts +6 -1
  180. package/lib/icon/utils/IconLoader.js +24 -18
  181. package/lib/index.d.ts +2 -0
  182. package/lib/index.js +2 -1
  183. package/lib/interactive-chart/custom-elements.json +5 -11
  184. package/lib/interactive-chart/custom-elements.md +31 -0
  185. package/lib/interactive-chart/helpers/merge.d.ts +15 -0
  186. package/lib/interactive-chart/helpers/merge.js +28 -0
  187. package/lib/interactive-chart/helpers/types.d.ts +10 -9
  188. package/lib/interactive-chart/helpers/types.js +6 -2
  189. package/lib/interactive-chart/index.d.ts +37 -18
  190. package/lib/interactive-chart/index.js +61 -51
  191. package/lib/item/custom-elements.json +4 -4
  192. package/lib/item/custom-elements.md +29 -0
  193. package/lib/item/helpers/types.d.ts +1 -1
  194. package/lib/item/helpers/types.js +0 -1
  195. package/lib/item/index.d.ts +26 -9
  196. package/lib/item/index.js +43 -16
  197. package/lib/label/custom-elements.json +7 -16
  198. package/lib/label/custom-elements.md +11 -0
  199. package/lib/label/index.d.ts +41 -73
  200. package/lib/label/index.js +150 -187
  201. package/lib/layout/custom-elements.md +26 -0
  202. package/lib/layout/index.d.ts +11 -4
  203. package/lib/layout/index.js +13 -9
  204. package/lib/led-gauge/custom-elements.json +4 -4
  205. package/lib/led-gauge/custom-elements.md +17 -0
  206. package/lib/led-gauge/index.d.ts +13 -5
  207. package/lib/led-gauge/index.js +16 -11
  208. package/lib/list/custom-elements.json +37 -5
  209. package/lib/list/custom-elements.md +33 -0
  210. package/lib/list/extensible-function.js +2 -1
  211. package/lib/list/helpers/list-renderer.d.ts +2 -2
  212. package/lib/list/helpers/list-renderer.js +4 -3
  213. package/lib/list/helpers/types.d.ts +2 -2
  214. package/lib/list/helpers/types.js +0 -1
  215. package/lib/list/index.d.ts +47 -12
  216. package/lib/list/index.js +100 -39
  217. package/lib/list/renderer.d.ts +2 -2
  218. package/lib/list/renderer.js +1 -2
  219. package/lib/loader/custom-elements.md +5 -0
  220. package/lib/loader/index.d.ts +8 -1
  221. package/lib/loader/index.js +11 -8
  222. package/lib/multi-input/custom-elements.json +7 -6
  223. package/lib/multi-input/custom-elements.md +43 -0
  224. package/lib/multi-input/helpers/types.d.ts +1 -1
  225. package/lib/multi-input/helpers/types.js +0 -1
  226. package/lib/multi-input/index.d.ts +19 -8
  227. package/lib/multi-input/index.js +28 -18
  228. package/lib/multi-input/themes/solar/charcoal/index.js +1 -1
  229. package/lib/multi-input/themes/solar/pearl/index.js +1 -1
  230. package/lib/notification/custom-elements.md +26 -0
  231. package/lib/notification/elements/notification-tray.d.ts +10 -4
  232. package/lib/notification/elements/notification-tray.js +15 -11
  233. package/lib/notification/elements/notification.d.ts +19 -7
  234. package/lib/notification/elements/notification.js +25 -13
  235. package/lib/notification/helpers/status.d.ts +1 -1
  236. package/lib/notification/helpers/status.js +1 -2
  237. package/lib/notification/helpers/types.d.ts +1 -1
  238. package/lib/notification/helpers/types.js +0 -1
  239. package/lib/notification/index.d.ts +2 -2
  240. package/lib/notification/index.js +2 -3
  241. package/lib/number-field/custom-elements.json +99 -54
  242. package/lib/number-field/custom-elements.md +42 -0
  243. package/lib/number-field/index.d.ts +104 -52
  244. package/lib/number-field/index.js +129 -88
  245. package/lib/number-field/themes/halo/dark/index.js +1 -1
  246. package/lib/number-field/themes/halo/light/index.js +1 -1
  247. package/lib/number-field/themes/solar/charcoal/index.js +1 -1
  248. package/lib/number-field/themes/solar/pearl/index.js +1 -1
  249. package/lib/overlay/custom-elements.json +26 -13
  250. package/lib/overlay/custom-elements.md +54 -0
  251. package/lib/overlay/elements/overlay-backdrop.d.ts +12 -5
  252. package/lib/overlay/elements/overlay-backdrop.js +13 -9
  253. package/lib/overlay/elements/overlay-viewport.d.ts +11 -4
  254. package/lib/overlay/elements/overlay-viewport.js +12 -9
  255. package/lib/overlay/elements/overlay.d.ts +18 -6
  256. package/lib/overlay/elements/overlay.js +35 -28
  257. package/lib/overlay/helpers/functions.js +0 -1
  258. package/lib/overlay/helpers/types.js +0 -1
  259. package/lib/overlay/index.d.ts +2 -2
  260. package/lib/overlay/index.js +1 -2
  261. package/lib/overlay/managers/backdrop-manager.d.ts +2 -2
  262. package/lib/overlay/managers/backdrop-manager.js +2 -3
  263. package/lib/overlay/managers/close-manager.d.ts +1 -1
  264. package/lib/overlay/managers/close-manager.js +1 -2
  265. package/lib/overlay/managers/focus-manager.d.ts +1 -1
  266. package/lib/overlay/managers/focus-manager.js +3 -5
  267. package/lib/overlay/managers/interaction-lock-manager.js +2 -3
  268. package/lib/overlay/managers/viewport-manager.d.ts +3 -3
  269. package/lib/overlay/managers/viewport-manager.js +6 -3
  270. package/lib/overlay/managers/zindex-manager.d.ts +1 -1
  271. package/lib/overlay/managers/zindex-manager.js +1 -4
  272. package/lib/overlay-menu/custom-elements.json +126 -12
  273. package/lib/overlay-menu/custom-elements.md +44 -0
  274. package/lib/overlay-menu/helpers/types.d.ts +3 -3
  275. package/lib/overlay-menu/helpers/types.js +0 -1
  276. package/lib/overlay-menu/index.d.ts +44 -12
  277. package/lib/overlay-menu/index.js +66 -35
  278. package/lib/overlay-menu/managers/menu-manager.d.ts +2 -2
  279. package/lib/overlay-menu/managers/menu-manager.js +8 -8
  280. package/lib/pagination/custom-elements.json +16 -33
  281. package/lib/pagination/custom-elements.md +26 -0
  282. package/lib/pagination/index.d.ts +156 -81
  283. package/lib/pagination/index.js +373 -214
  284. package/lib/pagination/themes/halo/dark/index.js +1 -1
  285. package/lib/pagination/themes/halo/light/index.js +1 -1
  286. package/lib/pagination/themes/solar/charcoal/index.js +1 -1
  287. package/lib/pagination/themes/solar/pearl/index.js +1 -1
  288. package/lib/panel/custom-elements.md +11 -0
  289. package/lib/panel/index.d.ts +11 -4
  290. package/lib/panel/index.js +13 -9
  291. package/lib/password-field/custom-elements.json +62 -67
  292. package/lib/password-field/custom-elements.md +39 -0
  293. package/lib/password-field/index.d.ts +46 -90
  294. package/lib/password-field/index.js +52 -190
  295. package/lib/password-field/themes/halo/dark/index.js +1 -1
  296. package/lib/password-field/themes/halo/light/index.js +1 -1
  297. package/lib/password-field/themes/solar/charcoal/index.js +1 -1
  298. package/lib/password-field/themes/solar/pearl/index.js +1 -1
  299. package/lib/pill/custom-elements.json +9 -7
  300. package/lib/pill/custom-elements.md +22 -0
  301. package/lib/pill/index.d.ts +15 -7
  302. package/lib/pill/index.js +21 -27
  303. package/lib/pill/themes/halo/dark/index.js +1 -1
  304. package/lib/pill/themes/halo/light/index.js +1 -1
  305. package/lib/progress-bar/custom-elements.md +18 -0
  306. package/lib/progress-bar/index.d.ts +11 -15
  307. package/lib/progress-bar/index.js +14 -25
  308. package/lib/radio-button/custom-elements.json +4 -4
  309. package/lib/radio-button/custom-elements.md +19 -0
  310. package/lib/radio-button/index.d.ts +33 -9
  311. package/lib/radio-button/index.js +97 -24
  312. package/lib/radio-button/radio-button-registry.d.ts +3 -2
  313. package/lib/radio-button/radio-button-registry.js +57 -5
  314. package/lib/radio-button/themes/halo/dark/index.js +1 -1
  315. package/lib/radio-button/themes/halo/light/index.js +1 -1
  316. package/lib/rating/custom-elements.md +17 -0
  317. package/lib/rating/index.d.ts +11 -4
  318. package/lib/rating/index.js +16 -10
  319. package/lib/search-field/custom-elements.json +70 -74
  320. package/lib/search-field/custom-elements.md +41 -0
  321. package/lib/search-field/index.d.ts +47 -97
  322. package/lib/search-field/index.js +50 -212
  323. package/lib/search-field/themes/halo/dark/index.js +1 -1
  324. package/lib/search-field/themes/halo/light/index.js +1 -1
  325. package/lib/search-field/themes/solar/charcoal/index.js +1 -1
  326. package/lib/search-field/themes/solar/pearl/index.js +1 -1
  327. package/lib/select/custom-elements.json +5 -4
  328. package/lib/select/custom-elements.md +24 -0
  329. package/lib/select/helpers/types.d.ts +1 -1
  330. package/lib/select/helpers/types.js +0 -1
  331. package/lib/select/index.d.ts +26 -11
  332. package/lib/select/index.js +93 -52
  333. package/lib/select/themes/halo/dark/index.js +1 -1
  334. package/lib/select/themes/halo/light/index.js +1 -1
  335. package/lib/sidebar-layout/custom-elements.json +2 -6
  336. package/lib/sidebar-layout/custom-elements.md +21 -0
  337. package/lib/sidebar-layout/index.d.ts +15 -7
  338. package/lib/sidebar-layout/index.js +16 -10
  339. package/lib/slider/custom-elements.json +4 -4
  340. package/lib/slider/custom-elements.md +28 -0
  341. package/lib/slider/index.d.ts +18 -5
  342. package/lib/slider/index.js +69 -16
  343. package/lib/sparkline/custom-elements.json +4 -4
  344. package/lib/sparkline/custom-elements.md +16 -0
  345. package/lib/sparkline/index.d.ts +14 -5
  346. package/lib/sparkline/index.js +17 -10
  347. package/lib/swing-gauge/const.d.ts +22 -0
  348. package/lib/swing-gauge/const.js +26 -0
  349. package/lib/swing-gauge/custom-elements.json +51 -22
  350. package/lib/swing-gauge/custom-elements.md +17 -0
  351. package/lib/swing-gauge/helpers.d.ts +8 -0
  352. package/lib/swing-gauge/helpers.js +105 -0
  353. package/lib/swing-gauge/index.d.ts +220 -72
  354. package/lib/swing-gauge/index.js +648 -168
  355. package/lib/swing-gauge/themes/halo/dark/index.js +1 -1
  356. package/lib/swing-gauge/themes/halo/light/index.js +1 -1
  357. package/lib/swing-gauge/themes/solar/charcoal/index.js +1 -1
  358. package/lib/swing-gauge/themes/solar/pearl/index.js +1 -1
  359. package/lib/swing-gauge/types.d.ts +34 -0
  360. package/lib/swing-gauge/types.js +1 -0
  361. package/lib/tab/custom-elements.json +10 -21
  362. package/lib/tab/custom-elements.md +22 -0
  363. package/lib/tab/index.d.ts +19 -14
  364. package/lib/tab/index.js +31 -40
  365. package/lib/tab/themes/halo/dark/index.js +1 -1
  366. package/lib/tab/themes/halo/light/index.js +1 -1
  367. package/lib/tab/themes/solar/charcoal/index.js +1 -1
  368. package/lib/tab/themes/solar/pearl/index.js +1 -1
  369. package/lib/tab-bar/custom-elements.json +0 -6
  370. package/lib/tab-bar/custom-elements.md +11 -0
  371. package/lib/tab-bar/helpers/animate.d.ts +1 -1
  372. package/lib/tab-bar/helpers/animate.js +5 -2
  373. package/lib/tab-bar/index.d.ts +12 -5
  374. package/lib/tab-bar/index.js +18 -21
  375. package/lib/tab-bar/themes/solar/charcoal/index.js +1 -1
  376. package/lib/tab-bar/themes/solar/pearl/index.js +1 -1
  377. package/lib/text-field/custom-elements.json +78 -89
  378. package/lib/text-field/custom-elements.md +35 -0
  379. package/lib/text-field/index.d.ts +67 -80
  380. package/lib/text-field/index.js +106 -157
  381. package/lib/text-field/themes/halo/dark/index.js +1 -1
  382. package/lib/text-field/themes/halo/light/index.js +1 -1
  383. package/lib/text-field/themes/solar/charcoal/index.js +1 -1
  384. package/lib/text-field/themes/solar/pearl/index.js +1 -1
  385. package/lib/time-picker/custom-elements.json +6 -8
  386. package/lib/time-picker/custom-elements.md +28 -0
  387. package/lib/time-picker/index.d.ts +105 -65
  388. package/lib/time-picker/index.js +297 -169
  389. package/lib/time-picker/themes/solar/charcoal/index.js +1 -1
  390. package/lib/time-picker/themes/solar/pearl/index.js +1 -1
  391. package/lib/toggle/custom-elements.json +4 -4
  392. package/lib/toggle/custom-elements.md +19 -0
  393. package/lib/toggle/index.d.ts +22 -5
  394. package/lib/toggle/index.js +58 -13
  395. package/lib/toggle/themes/halo/dark/index.js +1 -1
  396. package/lib/toggle/themes/halo/light/index.js +1 -1
  397. package/lib/toggle/themes/solar/charcoal/index.js +1 -1
  398. package/lib/toggle/themes/solar/pearl/index.js +1 -1
  399. package/lib/tooltip/custom-elements.md +14 -0
  400. package/lib/tooltip/elements/title-tooltip.js +2 -3
  401. package/lib/tooltip/elements/tooltip-element.d.ts +2 -3
  402. package/lib/tooltip/elements/tooltip-element.js +0 -2
  403. package/lib/tooltip/helpers/overflow-tooltip.d.ts +1 -1
  404. package/lib/tooltip/helpers/overflow-tooltip.js +1 -2
  405. package/lib/tooltip/helpers/renderer.d.ts +1 -1
  406. package/lib/tooltip/helpers/renderer.js +0 -1
  407. package/lib/tooltip/helpers/types.d.ts +1 -1
  408. package/lib/tooltip/helpers/types.js +0 -1
  409. package/lib/tooltip/index.d.ts +18 -11
  410. package/lib/tooltip/index.js +27 -23
  411. package/lib/tooltip/managers/tooltip-manager.d.ts +2 -2
  412. package/lib/tooltip/managers/tooltip-manager.js +17 -11
  413. package/lib/tornado-chart/custom-elements.md +18 -0
  414. package/lib/tornado-chart/elements/tornado-chart.d.ts +12 -5
  415. package/lib/tornado-chart/elements/tornado-chart.js +15 -11
  416. package/lib/tornado-chart/elements/tornado-item.d.ts +13 -6
  417. package/lib/tornado-chart/elements/tornado-item.js +17 -12
  418. package/lib/tornado-chart/index.d.ts +2 -2
  419. package/lib/tornado-chart/index.js +2 -3
  420. package/lib/tree/custom-elements.json +30 -2
  421. package/lib/tree/custom-elements.md +32 -0
  422. package/lib/tree/elements/tree-item.d.ts +53 -5
  423. package/lib/tree/elements/tree-item.js +114 -34
  424. package/lib/tree/elements/tree.d.ts +65 -20
  425. package/lib/tree/elements/tree.js +151 -34
  426. package/lib/tree/helpers/filter.d.ts +8 -0
  427. package/lib/tree/helpers/filter.js +33 -0
  428. package/lib/tree/helpers/renderer.d.ts +2 -2
  429. package/lib/tree/helpers/renderer.js +4 -4
  430. package/lib/tree/helpers/types.d.ts +13 -1
  431. package/lib/tree/helpers/types.js +0 -1
  432. package/lib/tree/index.d.ts +4 -4
  433. package/lib/tree/index.js +3 -4
  434. package/lib/tree/managers/tree-manager.d.ts +22 -10
  435. package/lib/tree/managers/tree-manager.js +56 -41
  436. package/lib/tree/themes/halo/dark/index.js +1 -1
  437. package/lib/tree/themes/halo/light/index.js +1 -1
  438. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  439. package/lib/tree/themes/solar/pearl/index.js +1 -1
  440. package/lib/tree-select/custom-elements.json +14 -5
  441. package/lib/tree-select/custom-elements.md +26 -0
  442. package/lib/tree-select/helpers/types.d.ts +2 -2
  443. package/lib/tree-select/helpers/types.js +0 -1
  444. package/lib/tree-select/index.d.ts +55 -27
  445. package/lib/tree-select/index.js +107 -45
  446. package/lib/tree-select/themes/halo/dark/index.js +3 -2
  447. package/lib/tree-select/themes/halo/light/index.js +3 -2
  448. package/lib/tree-select/themes/solar/charcoal/index.js +3 -2
  449. package/lib/tree-select/themes/solar/pearl/index.js +3 -2
  450. package/lib/version.d.ts +1 -0
  451. package/lib/version.js +1 -0
  452. package/package.json +601 -25
  453. package/lib/accordion/index.js.map +0 -1
  454. package/lib/appstate-bar/index.js.map +0 -1
  455. package/lib/autosuggest/helpers/const.d.ts +0 -2
  456. package/lib/autosuggest/helpers/const.js +0 -4
  457. package/lib/autosuggest/helpers/const.js.map +0 -1
  458. package/lib/autosuggest/helpers/types.js.map +0 -1
  459. package/lib/autosuggest/helpers/utils.js.map +0 -1
  460. package/lib/autosuggest/index.js.map +0 -1
  461. package/lib/button/index.js.map +0 -1
  462. package/lib/button-bar/index.js.map +0 -1
  463. package/lib/calendar/index.js.map +0 -1
  464. package/lib/calendar/locales.js.map +0 -1
  465. package/lib/calendar/types.js.map +0 -1
  466. package/lib/calendar/utils.js.map +0 -1
  467. package/lib/canvas/index.js.map +0 -1
  468. package/lib/card/helpers/types.js.map +0 -1
  469. package/lib/card/index.js.map +0 -1
  470. package/lib/chart/helpers/legend.js.map +0 -1
  471. package/lib/chart/helpers/types.js.map +0 -1
  472. package/lib/chart/index.js.map +0 -1
  473. package/lib/chart/plugins/doughnut-center-label.js.map +0 -1
  474. package/lib/checkbox/index.js.map +0 -1
  475. package/lib/clock/index.js.map +0 -1
  476. package/lib/clock/utils/TickManager.js.map +0 -1
  477. package/lib/clock/utils/timestamps.js.map +0 -1
  478. package/lib/collapse/index.js.map +0 -1
  479. package/lib/color-dialog/elements/color-palettes.js.map +0 -1
  480. package/lib/color-dialog/elements/grayscale-palettes.js.map +0 -1
  481. package/lib/color-dialog/elements/palettes.js.map +0 -1
  482. package/lib/color-dialog/helpers/color-helpers.js.map +0 -1
  483. package/lib/color-dialog/helpers/value-model.js.map +0 -1
  484. package/lib/color-dialog/index.js.map +0 -1
  485. package/lib/combo-box/helpers/filter.js.map +0 -1
  486. package/lib/combo-box/helpers/keyboard-event.js.map +0 -1
  487. package/lib/combo-box/helpers/types.js.map +0 -1
  488. package/lib/combo-box/index.js.map +0 -1
  489. package/lib/datetime-picker/index.js.map +0 -1
  490. package/lib/datetime-picker/locales.js.map +0 -1
  491. package/lib/datetime-picker/types.js.map +0 -1
  492. package/lib/datetime-picker/utils.js.map +0 -1
  493. package/lib/dialog/draggable-element.js.map +0 -1
  494. package/lib/dialog/index.js.map +0 -1
  495. package/lib/email-field/index.js.map +0 -1
  496. package/lib/flag/index.js.map +0 -1
  497. package/lib/flag/utils/FlagLoader.js.map +0 -1
  498. package/lib/header/index.js.map +0 -1
  499. package/lib/heatmap/helpers/color.js.map +0 -1
  500. package/lib/heatmap/helpers/text.js.map +0 -1
  501. package/lib/heatmap/helpers/track.js.map +0 -1
  502. package/lib/heatmap/helpers/types.js.map +0 -1
  503. package/lib/heatmap/index.js.map +0 -1
  504. package/lib/icon/index.js.map +0 -1
  505. package/lib/icon/utils/IconLoader.js.map +0 -1
  506. package/lib/index.js.map +0 -1
  507. package/lib/interactive-chart/helpers/types.js.map +0 -1
  508. package/lib/interactive-chart/index.js.map +0 -1
  509. package/lib/item/helpers/types.js.map +0 -1
  510. package/lib/item/index.js.map +0 -1
  511. package/lib/label/helpers/text.d.ts +0 -35
  512. package/lib/label/helpers/text.js +0 -57
  513. package/lib/label/helpers/text.js.map +0 -1
  514. package/lib/label/index.js.map +0 -1
  515. package/lib/layout/index.js.map +0 -1
  516. package/lib/led-gauge/index.js.map +0 -1
  517. package/lib/list/extensible-function.js.map +0 -1
  518. package/lib/list/helpers/list-renderer.js.map +0 -1
  519. package/lib/list/helpers/types.js.map +0 -1
  520. package/lib/list/index.js.map +0 -1
  521. package/lib/list/renderer.js.map +0 -1
  522. package/lib/loader/index.js.map +0 -1
  523. package/lib/multi-input/helpers/types.js.map +0 -1
  524. package/lib/multi-input/index.js.map +0 -1
  525. package/lib/notification/elements/notification-tray.js.map +0 -1
  526. package/lib/notification/elements/notification.js.map +0 -1
  527. package/lib/notification/helpers/status.js.map +0 -1
  528. package/lib/notification/helpers/types.js.map +0 -1
  529. package/lib/notification/index.js.map +0 -1
  530. package/lib/number-field/index.js.map +0 -1
  531. package/lib/overlay/elements/overlay-backdrop.js.map +0 -1
  532. package/lib/overlay/elements/overlay-viewport.js.map +0 -1
  533. package/lib/overlay/elements/overlay.js.map +0 -1
  534. package/lib/overlay/helpers/functions.js.map +0 -1
  535. package/lib/overlay/helpers/types.js.map +0 -1
  536. package/lib/overlay/index.js.map +0 -1
  537. package/lib/overlay/managers/backdrop-manager.js.map +0 -1
  538. package/lib/overlay/managers/close-manager.js.map +0 -1
  539. package/lib/overlay/managers/focus-manager.js.map +0 -1
  540. package/lib/overlay/managers/interaction-lock-manager.js.map +0 -1
  541. package/lib/overlay/managers/viewport-manager.js.map +0 -1
  542. package/lib/overlay/managers/zindex-manager.js.map +0 -1
  543. package/lib/overlay-menu/helpers/types.js.map +0 -1
  544. package/lib/overlay-menu/helpers/uuid.d.ts +0 -7
  545. package/lib/overlay-menu/helpers/uuid.js +0 -14
  546. package/lib/overlay-menu/helpers/uuid.js.map +0 -1
  547. package/lib/overlay-menu/index.js.map +0 -1
  548. package/lib/overlay-menu/managers/menu-manager.js.map +0 -1
  549. package/lib/pagination/helpers/types.d.ts +0 -9
  550. package/lib/pagination/helpers/types.js +0 -2
  551. package/lib/pagination/helpers/types.js.map +0 -1
  552. package/lib/pagination/index.js.map +0 -1
  553. package/lib/panel/index.js.map +0 -1
  554. package/lib/password-field/index.js.map +0 -1
  555. package/lib/pill/index.js.map +0 -1
  556. package/lib/progress-bar/index.js.map +0 -1
  557. package/lib/radio-button/index.js.map +0 -1
  558. package/lib/radio-button/radio-button-registry.js.map +0 -1
  559. package/lib/rating/index.js.map +0 -1
  560. package/lib/search-field/index.js.map +0 -1
  561. package/lib/select/helpers/types.js.map +0 -1
  562. package/lib/select/index.js.map +0 -1
  563. package/lib/sidebar-layout/index.js.map +0 -1
  564. package/lib/slider/index.js.map +0 -1
  565. package/lib/sparkline/index.js.map +0 -1
  566. package/lib/swing-gauge/helpers/canvas.d.ts +0 -8
  567. package/lib/swing-gauge/helpers/canvas.js +0 -115
  568. package/lib/swing-gauge/helpers/canvas.js.map +0 -1
  569. package/lib/swing-gauge/helpers/types.d.ts +0 -33
  570. package/lib/swing-gauge/helpers/types.js +0 -2
  571. package/lib/swing-gauge/helpers/types.js.map +0 -1
  572. package/lib/swing-gauge/index.js.map +0 -1
  573. package/lib/tab/index.js.map +0 -1
  574. package/lib/tab-bar/helpers/animate.js.map +0 -1
  575. package/lib/tab-bar/index.js.map +0 -1
  576. package/lib/text-field/index.js.map +0 -1
  577. package/lib/time-picker/index.js.map +0 -1
  578. package/lib/toggle/index.js.map +0 -1
  579. package/lib/tooltip/elements/title-tooltip.js.map +0 -1
  580. package/lib/tooltip/elements/tooltip-element.js.map +0 -1
  581. package/lib/tooltip/helpers/overflow-tooltip.js.map +0 -1
  582. package/lib/tooltip/helpers/renderer.js.map +0 -1
  583. package/lib/tooltip/helpers/types.js.map +0 -1
  584. package/lib/tooltip/index.js.map +0 -1
  585. package/lib/tooltip/managers/tooltip-manager.js.map +0 -1
  586. package/lib/tornado-chart/elements/tornado-chart.js.map +0 -1
  587. package/lib/tornado-chart/elements/tornado-item.js.map +0 -1
  588. package/lib/tornado-chart/index.js.map +0 -1
  589. package/lib/tree/elements/tree-item.js.map +0 -1
  590. package/lib/tree/elements/tree.js.map +0 -1
  591. package/lib/tree/helpers/renderer.js.map +0 -1
  592. package/lib/tree/helpers/types.js.map +0 -1
  593. package/lib/tree/index.js.map +0 -1
  594. package/lib/tree/managers/tree-manager.js.map +0 -1
  595. package/lib/tree-select/helpers/types.js.map +0 -1
  596. package/lib/tree-select/index.js.map +0 -1
@@ -1,12 +1,18 @@
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, query, customElement, property } from '@refinitiv-ui/core';
8
- import '../number-field';
9
- import { isValidTime, toTimeSegment, TimeFormat, getFormat, format, isAM, isPM, MILLISECONDS_IN_SECOND, MILLISECONDS_IN_MINUTE, MILLISECONDS_IN_HOUR, addOffset, padNumber } from '@refinitiv-ui/utils';
1
+ var TimePicker_1;
2
+ import { __decorate } from "tslib";
3
+ import { ControlElement, html, css } from '@refinitiv-ui/core';
4
+ import { ifDefined } from '@refinitiv-ui/core/lib/directives/if-defined.js';
5
+ import { guard } from '@refinitiv-ui/core/lib/directives/guard.js';
6
+ import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
7
+ import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
8
+ import { state } from '@refinitiv-ui/core/lib/decorators/state.js';
9
+ import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
10
+ import { VERSION } from '../version.js';
11
+ import { isValidTime, toTimeSegment, TimeFormat, getFormat, format, isAM, isPM, MILLISECONDS_IN_SECOND, MILLISECONDS_IN_MINUTE, MILLISECONDS_IN_HOUR, addOffset, padNumber, parse } from '@refinitiv-ui/utils/lib/date.js';
12
+ import { isIE } from '@refinitiv-ui/utils/lib/browser.js';
13
+ import '../number-field/index.js';
14
+ import { translate } from '@refinitiv-ui/translate';
15
+ import '@refinitiv-ui/phrasebook/lib/locale/en/time-picker.js';
10
16
  var Segment;
11
17
  (function (Segment) {
12
18
  Segment["HOURS"] = "hours";
@@ -34,9 +40,13 @@ const Placeholder = {
34
40
  * @attr {boolean} disabled - Set disabled state
35
41
  * @prop {boolean} [disabled=false] - Set disabled state
36
42
  */
37
- let TimePicker = class TimePicker extends ControlElement {
43
+ let TimePicker = TimePicker_1 = class TimePicker extends ControlElement {
38
44
  constructor() {
39
45
  super(...arguments);
46
+ this.defaultRole = 'group';
47
+ /**
48
+ * If time-picker is in mobile mode
49
+ */
40
50
  this.isMobile = false;
41
51
  /**
42
52
  * Internal hours value, used only in value getters and setters
@@ -64,53 +74,14 @@ let TimePicker = class TimePicker extends ControlElement {
64
74
  * Seconds are automatically shown when `hh:mm:ss` time format is provided as a value.
65
75
  */
66
76
  this.showSeconds = false;
77
+ this._selectedSegment = null;
67
78
  /**
68
- * Handles the blur event of any inputs
69
- *
70
- * @param event Event Object
71
- * @returns {void}
79
+ * Connected to role. If false, the values are not announced in the screen reader
72
80
  */
73
- this.onBlur = (event) => {
74
- if (this.readonly) {
75
- return;
76
- }
77
- const target = event.target;
78
- const value = target.value;
79
- let segment;
80
- if (target === this.hoursInput) {
81
- segment = Segment.HOURS;
82
- }
83
- else if (target === this.minutesInput) {
84
- segment = Segment.MINUTES;
85
- }
86
- else if (target === this.secondsInput) {
87
- segment = Segment.SECONDS;
88
- }
89
- /* istanbul ignore next */
90
- if (!segment) {
91
- return;
92
- }
93
- if (value) {
94
- this.updateTimeSegmentTo(segment, Number(value));
95
- }
96
- this.updateSegmentValue(segment);
97
- };
98
- /**
99
- * Handles the focus event of any inputs
100
- *
101
- * @param event Event Object
102
- * @returns {void}
103
- */
104
- this.onFocus = (event) => {
105
- if (this.readonly) {
106
- return;
107
- }
108
- event.target.value = '';
109
- };
81
+ this.announceValues = true;
110
82
  /**
111
83
  * Handles any keydown events
112
84
  * Used for control keys
113
- *
114
85
  * @param event Event Object
115
86
  * @returns {void}
116
87
  */
@@ -118,9 +89,17 @@ let TimePicker = class TimePicker extends ControlElement {
118
89
  this.manageControlKeys(event);
119
90
  };
120
91
  }
92
+ /**
93
+ * Element version number
94
+ * @returns version number
95
+ */
96
+ static get version() {
97
+ return VERSION;
98
+ }
121
99
  /**
122
100
  * Hours time segment in 24hr format
123
101
  * @param hours hours value
102
+ * @default null
124
103
  * @returns {void}
125
104
  */
126
105
  set hours(hours) {
@@ -128,9 +107,9 @@ let TimePicker = class TimePicker extends ControlElement {
128
107
  if ((hours !== null && isNaN(hours)) || oldHours === hours) {
129
108
  return;
130
109
  }
131
- this._hours = this.validUnit(hours, MIN_UNIT, MAX_HOURS, oldHours);
110
+ this._hours = TimePicker_1.validUnit(hours, MIN_UNIT, MAX_HOURS, oldHours);
132
111
  if (this._hours !== oldHours) {
133
- void this.requestUpdate('hours', oldHours);
112
+ this.requestUpdate('hours', oldHours);
134
113
  }
135
114
  }
136
115
  /**
@@ -150,14 +129,14 @@ let TimePicker = class TimePicker extends ControlElement {
150
129
  if ((minutes !== null && isNaN(minutes)) || oldMinutes === minutes) {
151
130
  return;
152
131
  }
153
- this._minutes = this.validUnit(minutes, MIN_UNIT, MAX_MINUTES, oldMinutes);
132
+ this._minutes = TimePicker_1.validUnit(minutes, MIN_UNIT, MAX_MINUTES, oldMinutes);
154
133
  if (this._minutes !== oldMinutes) {
155
- void this.requestUpdate('minutes', oldMinutes);
134
+ this.requestUpdate('minutes', oldMinutes);
156
135
  }
157
136
  }
158
137
  /**
159
138
  * Get minutes value
160
- * @returns hours
139
+ * @returns minutes
161
140
  */
162
141
  get minutes() {
163
142
  return this._minutes;
@@ -172,9 +151,9 @@ let TimePicker = class TimePicker extends ControlElement {
172
151
  if ((seconds !== null && isNaN(seconds)) || oldSeconds === seconds) {
173
152
  return;
174
153
  }
175
- this._seconds = this.validUnit(seconds, MIN_UNIT, MAX_SECONDS, oldSeconds);
154
+ this._seconds = TimePicker_1.validUnit(seconds, MIN_UNIT, MAX_SECONDS, oldSeconds);
176
155
  if (this._seconds !== oldSeconds) {
177
- void this.requestUpdate('seconds', oldSeconds);
156
+ this.requestUpdate('seconds', oldSeconds);
178
157
  }
179
158
  }
180
159
  /**
@@ -186,7 +165,6 @@ let TimePicker = class TimePicker extends ControlElement {
186
165
  }
187
166
  /**
188
167
  * Value of the element
189
- * @default -
190
168
  * @param value Element value
191
169
  */
192
170
  set value(value) {
@@ -219,6 +197,19 @@ let TimePicker = class TimePicker extends ControlElement {
219
197
  }
220
198
  return this.currentTimeString;
221
199
  }
200
+ /**
201
+ * State to select text in the segment
202
+ * Used to asynchronously select text after render cycle is complete
203
+ * @param segment Selected segment or null
204
+ */
205
+ set selectedSegment(segment) {
206
+ const oldSelectedSegment = this._selectedSegment;
207
+ this._selectedSegment = segment;
208
+ this.requestUpdate('selectedSegment', oldSelectedSegment);
209
+ }
210
+ get selectedSegment() {
211
+ return this._selectedSegment;
212
+ }
222
213
  /**
223
214
  * Return the current time string, based on the current hours, minutes and seconds.
224
215
  * Used internally to set the value string after updates.
@@ -238,61 +229,105 @@ let TimePicker = class TimePicker extends ControlElement {
238
229
  return this.showSeconds || this.valueWithSeconds;
239
230
  }
240
231
  /**
241
- * Formats the hours value
232
+ * Get hours taking into account AM/PM placeholder
242
233
  */
243
- get formattedHours() {
234
+ get periodHours() {
244
235
  const _hours = this.hours;
245
236
  let hours = _hours;
246
237
  if (_hours !== null) {
247
238
  hours = this.amPm && _hours > HOURS_OF_NOON
248
239
  ? _hours - HOURS_OF_NOON : this.amPm && !_hours ? HOURS_OF_NOON : _hours;
249
240
  }
250
- return this.formattedUnit(hours);
241
+ return hours;
242
+ }
243
+ /**
244
+ * Formats the hours value
245
+ */
246
+ get formattedHours() {
247
+ return TimePicker_1.formattedUnit(this.periodHours);
251
248
  }
252
249
  /**
253
250
  * Formats the minutes value
254
251
  */
255
252
  get formattedMinutes() {
256
- return this.formattedUnit(this.minutes);
253
+ return TimePicker_1.formattedUnit(this.minutes);
257
254
  }
258
255
  /**
259
256
  * Formats the seconds value
260
- * @returns Formatted number
261
257
  */
262
258
  get formattedSeconds() {
263
- return this.formattedUnit(this.seconds);
259
+ return TimePicker_1.formattedUnit(this.seconds);
260
+ }
261
+ /**
262
+ * Observes attribute change for `attributeChangedCallback`
263
+ */
264
+ static get observedAttributes() {
265
+ const observed = super.observedAttributes;
266
+ return ['role'].concat(observed);
267
+ }
268
+ /**
269
+ * Synchronizes attribute value
270
+ * @param name attribute name
271
+ * @param oldValue old attribute value
272
+ * @param newValue new attribute value
273
+ * @returns {void}
274
+ */
275
+ attributeChangedCallback(name, oldValue, newValue) {
276
+ super.attributeChangedCallback(name, oldValue, newValue);
277
+ if (name === 'role') {
278
+ this.announceValues = !(!newValue || newValue === 'none' || newValue === 'presentation');
279
+ }
264
280
  }
265
281
  /**
266
282
  * On first updated life-cycle
267
- *
268
283
  * @param changedProperties changed properties
269
284
  * @returns {void}
270
285
  */
271
286
  firstUpdated(changedProperties) {
272
287
  super.firstUpdated(changedProperties);
273
- // add events
274
- this.renderRoot.addEventListener('blur', this.onBlur, true);
275
- this.renderRoot.addEventListener('focus', this.onFocus, true);
276
288
  this.renderRoot.addEventListener('keydown', this.onKeydown, true);
277
289
  }
278
290
  /**
279
291
  * On updated life-cycle
280
- *
281
292
  * @param changedProperties changed properties
282
293
  * @returns {void}
283
294
  */
284
295
  updated(changedProperties) {
285
296
  super.updated(changedProperties);
286
297
  /* istanbul ignore next */
287
- if (this.hasTimeChanged(changedProperties) && this.isMobile) {
298
+ if (TimePicker_1.hasTimeChanged(changedProperties) && this.isMobile) {
288
299
  this.updateMobileTimePickerValue();
289
300
  }
301
+ if (this.selectedSegment && changedProperties.has('selectedSegment')) {
302
+ void this.selectSegment();
303
+ }
304
+ }
305
+ /**
306
+ * Select text in input when update element is complete
307
+ * @returns returns a promise void
308
+ */
309
+ async selectSegment() {
310
+ var _a;
311
+ await this.updateComplete;
312
+ switch (this.selectedSegment) {
313
+ case Segment.HOURS:
314
+ this.hoursInput.select();
315
+ break;
316
+ case Segment.MINUTES:
317
+ this.minutesInput.select();
318
+ break;
319
+ case Segment.SECONDS:
320
+ (_a = this.secondsInput) === null || _a === void 0 ? void 0 : _a.select();
321
+ break;
322
+ // no default
323
+ }
324
+ // Silently clear selected segment to ensure it can be reselected
325
+ this._selectedSegment = null;
290
326
  }
291
327
  /**
292
328
  * Overwrite validation method for value
293
- *
294
329
  * @param value value
295
- * @returns {boolean} result
330
+ * @returns True if value is valid
296
331
  */
297
332
  isValidValue(value) {
298
333
  return value === '' || isValidTime(value);
@@ -337,21 +372,20 @@ let TimePicker = class TimePicker extends ControlElement {
337
372
  * @param changedProperties changed properties
338
373
  * @returns True if changed
339
374
  */
340
- hasTimeChanged(changedProperties) {
375
+ static hasTimeChanged(changedProperties) {
341
376
  return changedProperties.has('hours')
342
377
  || changedProperties.has('minutes')
343
378
  || changedProperties.has('seconds');
344
379
  }
345
380
  /**
346
381
  * Validates a given unit against a min and max value, returning a fallback if invalid.
347
- *
348
382
  * @param unit Unit to validate
349
383
  * @param min Minimum allowed
350
384
  * @param max Maximum allowed
351
385
  * @param fallback Fallback value to use, if unit is invalid
352
386
  * @returns unit or fallback or 0 value
353
387
  */
354
- validUnit(unit, min, max, fallback) {
388
+ static validUnit(unit, min, max, fallback) {
355
389
  if (unit === null) {
356
390
  return null;
357
391
  }
@@ -362,7 +396,6 @@ let TimePicker = class TimePicker extends ControlElement {
362
396
  }
363
397
  /**
364
398
  * Handles value change from native time picker on mobile devices
365
- *
366
399
  * @param event Event Object
367
400
  * @returns {void}
368
401
  */
@@ -372,7 +405,6 @@ let TimePicker = class TimePicker extends ControlElement {
372
405
  }
373
406
  /**
374
407
  * Helper, used to update the mobile time picker value
375
- *
376
408
  * @returns {void}
377
409
  */
378
410
  /* istanbul ignore next */
@@ -381,9 +413,57 @@ let TimePicker = class TimePicker extends ControlElement {
381
413
  this.mtpInput.value = this.value;
382
414
  }
383
415
  }
416
+ /**
417
+ * Handles action when input focused change
418
+ * @param event Focus change event
419
+ * @returns {void}
420
+ */
421
+ onInputFocusedChanged(event) {
422
+ const target = event.target;
423
+ const focused = event.detail.value;
424
+ let segment;
425
+ if (target === this.hoursInput) {
426
+ segment = Segment.HOURS;
427
+ }
428
+ else if (target === this.minutesInput) {
429
+ segment = Segment.MINUTES;
430
+ }
431
+ else if (target === this.secondsInput) {
432
+ segment = Segment.SECONDS;
433
+ }
434
+ this.selectedSegment = focused && segment ? segment : null;
435
+ /* istanbul ignore next */
436
+ if (!segment || this.readonly) {
437
+ return;
438
+ }
439
+ const value = target.value;
440
+ if (value) {
441
+ this.updateTimeSegmentTo(segment, Number(value));
442
+ }
443
+ this.updateSegmentValue(segment);
444
+ }
445
+ /**
446
+ * Handles action when input value changes
447
+ * @param event Value change event
448
+ * @returns {void}
449
+ */
450
+ onInputValueChanged(event) {
451
+ // Make sure that the value can be reset to null
452
+ if (!event.detail.value) {
453
+ const target = event.target;
454
+ if (target === this.hoursInput) {
455
+ this.setSegmentAndNotify(Segment.HOURS, null);
456
+ }
457
+ else if (target === this.minutesInput) {
458
+ this.setSegmentAndNotify(Segment.MINUTES, null);
459
+ }
460
+ else if (target === this.secondsInput) {
461
+ this.setSegmentAndNotify(Segment.SECONDS, null);
462
+ }
463
+ }
464
+ }
384
465
  /**
385
466
  * Updates a time segment to the provided value
386
- *
387
467
  * @param segment Segment id
388
468
  * @param value Unit to change to
389
469
  * @returns {void}
@@ -396,7 +476,6 @@ let TimePicker = class TimePicker extends ControlElement {
396
476
  }
397
477
  /**
398
478
  * Updates the value of a time segment (element)
399
- *
400
479
  * @param segment Segment's name
401
480
  * @returns {void}
402
481
  */
@@ -417,12 +496,11 @@ let TimePicker = class TimePicker extends ControlElement {
417
496
  /**
418
497
  * Handle valid control keys and execute their corresponding commands
419
498
  * Will stop when readonly is set
420
- *
421
- * @param event Event Object
499
+ * @param event Keyboard event
422
500
  * @returns {void}
423
501
  */
424
502
  manageControlKeys(event) {
425
- if (this.readonly || this.disabled) {
503
+ if (this.readonly || this.disabled || event.defaultPrevented) {
426
504
  return;
427
505
  }
428
506
  switch (event.key) {
@@ -439,9 +517,6 @@ let TimePicker = class TimePicker extends ControlElement {
439
517
  case ' ':
440
518
  this.handleEnterKey(event);
441
519
  break;
442
- case 'Backspace':
443
- this.handleBackspaceKey(event);
444
- return;
445
520
  default:
446
521
  return;
447
522
  }
@@ -449,17 +524,18 @@ let TimePicker = class TimePicker extends ControlElement {
449
524
  }
450
525
  /**
451
526
  * Handles ENTER key press
452
- *
453
- * @param event Event Object
527
+ * @param event Keyboard event
454
528
  * @returns {void}
455
529
  */
456
530
  handleEnterKey(event) {
457
- event.target.blur();
531
+ if (event.target === this.toggleEl) {
532
+ this.toggle();
533
+ event.preventDefault();
534
+ }
458
535
  }
459
536
  /**
460
537
  * Handles UP key press
461
- *
462
- * @param event Event Object
538
+ * @param event Keyboard event
463
539
  * @returns {void}
464
540
  */
465
541
  handleUpKey(event) {
@@ -467,35 +543,15 @@ let TimePicker = class TimePicker extends ControlElement {
467
543
  }
468
544
  /**
469
545
  * Handle DOWN key press
470
- *
471
- * @param event Event Object
546
+ * @param event Keyboard event
472
547
  * @returns {void}
473
548
  */
474
549
  handleDownKey(event) {
475
550
  this.toggleOrModify(-1, event.target);
476
551
  }
477
- /**
478
- * Handle Backspace key press
479
- *
480
- * @param event Event Object
481
- * @returns {void}
482
- */
483
- handleBackspaceKey(event) {
484
- const target = event.target;
485
- if (target === this.hoursInput) {
486
- this.setSegmentAndNotify(Segment.HOURS, null);
487
- }
488
- else if (target === this.minutesInput) {
489
- this.setSegmentAndNotify(Segment.MINUTES, null);
490
- }
491
- else if (target === this.secondsInput) {
492
- this.setSegmentAndNotify(Segment.SECONDS, null);
493
- }
494
- }
495
552
  /**
496
553
  * Toggles the amPm flag or updates the time segment value.
497
554
  * Essentially a handler for user inputs on the control.
498
- *
499
555
  * @param amount to change value by
500
556
  * @param target Segment id
501
557
  * @returns {void}
@@ -517,7 +573,6 @@ let TimePicker = class TimePicker extends ControlElement {
517
573
  /**
518
574
  * Changes a time segment value by a specified amount.
519
575
  * Also updates parent values when rolling through cycles.
520
- *
521
576
  * @param amount Amount to change by
522
577
  * @param segment Segment id
523
578
  * @returns {void}
@@ -538,6 +593,7 @@ let TimePicker = class TimePicker extends ControlElement {
538
593
  }
539
594
  const value = addOffset(this.currentTimeString, offset);
540
595
  this.setValueAndNotify(value);
596
+ this.selectedSegment = segment;
541
597
  }
542
598
  /**
543
599
  * Gets the hours segment of the provided value
@@ -559,7 +615,6 @@ let TimePicker = class TimePicker extends ControlElement {
559
615
  }
560
616
  /**
561
617
  * Updates the value of the hours element
562
- *
563
618
  * @returns {void}
564
619
  */
565
620
  updateHoursSegmentValue() {
@@ -569,7 +624,6 @@ let TimePicker = class TimePicker extends ControlElement {
569
624
  }
570
625
  /**
571
626
  * Updated the value of the minutes element
572
- *
573
627
  * @returns {void}
574
628
  */
575
629
  updateMinutesSegmentValue() {
@@ -579,7 +633,6 @@ let TimePicker = class TimePicker extends ControlElement {
579
633
  }
580
634
  /**
581
635
  * Updates the value of the seconds element
582
- *
583
636
  * @returns {void}
584
637
  */
585
638
  updateSecondsSegmentValue() {
@@ -589,32 +642,28 @@ let TimePicker = class TimePicker extends ControlElement {
589
642
  }
590
643
  /**
591
644
  * Formats a given number and prefixes a 0 on numbers lower than 10
592
- *
593
645
  * @param n Number to format
594
646
  * @returns Formatted number
595
647
  */
596
- formattedUnit(n) {
648
+ static formattedUnit(n) {
597
649
  return n === null ? '' : padNumber(n, 2);
598
650
  }
599
651
  /**
600
652
  * Returns `true` or `false` depending on whether the hours are before, or, after noon
601
- *
602
- * @returns Result
653
+ * @returns True if time is AM
603
654
  */
604
655
  isAM() {
605
656
  return isAM(this.currentTimeString);
606
657
  }
607
658
  /**
608
659
  * Returns opposite of isAM
609
- *
610
- * @returns Result
660
+ * @returns True if time is PM
611
661
  */
612
662
  isPM() {
613
663
  return isPM(this.currentTimeString);
614
664
  }
615
665
  /**
616
666
  * Toggles the AM/PM state
617
- *
618
667
  * @returns {void}
619
668
  */
620
669
  toggle() {
@@ -624,7 +673,7 @@ let TimePicker = class TimePicker extends ControlElement {
624
673
  }
625
674
  }
626
675
  /**
627
- * A `CSSResult` that will be used
676
+ * A `CSSResultGroup` that will be used
628
677
  * to style the host, slotted children
629
678
  * and the internal template of the element.
630
679
  * @returns CSS template
@@ -649,49 +698,137 @@ let TimePicker = class TimePicker extends ControlElement {
649
698
  }
650
699
  `;
651
700
  }
701
+ /**
702
+ * Template for Hours Segment
703
+ * @returns template hours segment
704
+ */
705
+ get hoursTemplate() {
706
+ const hours = this.formattedHours;
707
+ return html `<ef-number-field
708
+ id="hours"
709
+ part="input"
710
+ aria-label="${ifDefined(!isIE ? this.t('SELECT_HOURS', { value: this.periodHours }) : undefined)}"
711
+ no-spinner
712
+ transparent
713
+ min="${this.amPm ? 1 : MIN_UNIT}"
714
+ max="${this.amPm ? HOURS_OF_NOON : MAX_HOURS}"
715
+ .value="${hours}"
716
+ placeholder="${ifDefined(hours ? undefined : Placeholder.HOURS)}"
717
+ ?disabled="${this.disabled}"
718
+ ?readonly="${this.readonly}"
719
+ @value-changed="${this.onInputValueChanged}"
720
+ @focused-changed=${this.onInputFocusedChanged}></ef-number-field>`;
721
+ }
722
+ /**
723
+ * Template for Minutes Segment
724
+ * @returns template minutes segment
725
+ */
726
+ get minutesTemplate() {
727
+ const minutes = this.formattedMinutes;
728
+ return html `<ef-number-field
729
+ id="minutes"
730
+ aria-label="${ifDefined(!isIE ? this.t('SELECT_MINUTES', { value: this.minutes }) : undefined)}"
731
+ part="input"
732
+ no-spinner
733
+ min="${MIN_UNIT}"
734
+ max="${MAX_MINUTES}"
735
+ .value="${minutes}"
736
+ placeholder="${ifDefined(minutes ? undefined : Placeholder.MINUTES)}"
737
+ ?readonly="${this.readonly}"
738
+ ?disabled="${this.disabled}"
739
+ transparent
740
+ @value-changed="${this.onInputValueChanged}"
741
+ @focused-changed=${this.onInputFocusedChanged}></ef-number-field>`;
742
+ }
652
743
  /**
653
744
  * Template for Seconds Segment
654
- *
655
- * @returns Seconds segment
745
+ * @returns template seconds segment
656
746
  */
657
- getSecondsHtml() {
658
- return this.isShowSeconds ? html `
659
- <span part="divider"></span>
747
+ get secondsTemplate() {
748
+ const seconds = this.formattedSeconds;
749
+ return html `
660
750
  <ef-number-field
661
751
  id="seconds"
662
752
  part="input"
753
+ aria-label="${ifDefined(!isIE ? this.t('SELECT_SECONDS', { value: this.seconds }) : undefined)}"
663
754
  no-spinner
664
755
  min="${MIN_UNIT}"
665
756
  max="${MAX_SECONDS}"
666
- .value="${this.formattedSeconds}"
667
- placeholder="${this.formattedSeconds || Placeholder.SECONDS}"
757
+ .value="${seconds}"
758
+ placeholder="${ifDefined(seconds ? undefined : Placeholder.SECONDS)}"
668
759
  ?readonly="${this.readonly}"
669
760
  ?disabled="${this.disabled}"
670
- transparent></ef-number-field>
671
- ` : null;
761
+ transparent
762
+ @value-changed="${this.onInputValueChanged}"
763
+ @focused-changed=${this.onInputFocusedChanged}></ef-number-field>`;
672
764
  }
673
765
  /**
674
766
  * Template for AmPm Segment
675
- *
676
767
  * @returns Am/Pm segment
677
768
  */
678
- getAmPmHtml() {
769
+ get getAmPmHtml() {
679
770
  const hasHours = this.hours !== null;
680
771
  return this.amPm ? html `
681
- <div id="toggle" part="toggle" @tap=${this.toggle} tabindex="0">
682
- <div part="toggle-item" ?active=${hasHours && this.isAM()}>AM</div>
683
- <div part="toggle-item" ?active=${hasHours && this.isPM()}>PM</div>
772
+ <div role="listbox"
773
+ aria-label="${this.t('TOGGLE_TIME_PERIOD')}"
774
+ aria-activedescendant="${ifDefined(hasHours ? this.isAM() ? 'toggle-am' : 'toggle-pm' : undefined)}"
775
+ id="toggle"
776
+ part="toggle"
777
+ @tap=${this.toggle}
778
+ tabindex="0">
779
+ <div
780
+ aria-label="${this.t('BEFORE_MIDDAY')}"
781
+ role="option"
782
+ id="toggle-am"
783
+ part="toggle-item"
784
+ ?active=${hasHours && this.isAM()}>AM</div>
785
+ <div
786
+ aria-label="${this.t('AFTER_MIDDAY')}"
787
+ role="option"
788
+ id="toggle-pm"
789
+ part="toggle-item"
790
+ ?active=${hasHours && this.isPM()}>PM</div>
684
791
  </div>
685
792
  ` : null;
686
793
  }
687
794
  /**
688
795
  * Native input's template for mobile
689
- *
690
796
  * @returns input
691
797
  */
692
- getNativeInputForMobile() {
798
+ get nativeInputForMobile() {
693
799
  return this.isMobile ? html `<input id="mtp" type="time" @change=${this.onMobileTimeChange}>` : null;
694
800
  }
801
+ /**
802
+ * A template used to notify currently selected value for screen readers
803
+ * @returns template result
804
+ */
805
+ get selectionTemplate() {
806
+ if (isIE || !this.announceValues) {
807
+ return;
808
+ }
809
+ const value = this.value;
810
+ const showSeconds = this.isShowSeconds;
811
+ const amPm = this.amPm;
812
+ return html `<div
813
+ part="aria-selection"
814
+ aria-live="polite"
815
+ aria-label="${this.t('SELECTED', {
816
+ value: value ? parse(value) : null,
817
+ showSeconds,
818
+ amPm
819
+ })}"></div>`;
820
+ }
821
+ /**
822
+ * Get time input template
823
+ * @returns template result
824
+ */
825
+ get inputTemplate() {
826
+ return html `
827
+ ${this.hoursTemplate}
828
+ ${TimePicker_1.dividerTemplate}
829
+ ${this.minutesTemplate}
830
+ ${this.isShowSeconds ? html `${TimePicker_1.dividerTemplate}${this.secondsTemplate}` : undefined}`;
831
+ }
695
832
  /**
696
833
  * A `TemplateResult` that will be used
697
834
  * to render the updated internal template.
@@ -699,35 +836,18 @@ let TimePicker = class TimePicker extends ControlElement {
699
836
  */
700
837
  render() {
701
838
  return html `
702
- <ef-number-field
703
- id="hours"
704
- part="input"
705
- no-spinner
706
- transparent
707
- min="${this.amPm ? 1 : MIN_UNIT}"
708
- max="${this.amPm ? HOURS_OF_NOON : MAX_HOURS}"
709
- .value="${this.formattedHours}"
710
- placeholder="${this.formattedHours || Placeholder.HOURS}"
711
- ?disabled="${this.disabled}"
712
- ?readonly="${this.readonly}"></ef-number-field>
713
- <span part="divider"></span>
714
- <ef-number-field
715
- id="minutes"
716
- part="input"
717
- no-spinner
718
- min="${MIN_UNIT}"
719
- max="${MAX_MINUTES}"
720
- .value="${this.formattedMinutes}"
721
- placeholder="${this.formattedMinutes || Placeholder.MINUTES}"
722
- ?readonly="${this.readonly}"
723
- ?disabled="${this.disabled}"
724
- transparent></ef-number-field>
725
- ${this.getSecondsHtml()}
726
- ${this.getAmPmHtml()}
727
- ${this.getNativeInputForMobile()}
839
+ ${this.inputTemplate}
840
+ ${guard([this.value, this.lang, this.amPm], () => this.getAmPmHtml)}
841
+ ${guard([this.isMobile], () => this.nativeInputForMobile)}
842
+ ${guard([this.value, this.lang, this.showSeconds, this.amPm, this.announceValues], () => this.selectionTemplate)}
728
843
  `;
729
844
  }
730
845
  };
846
+ /**
847
+ * Template for divider segment
848
+ * @returns Divider segment
849
+ */
850
+ TimePicker.dividerTemplate = html `<span part="divider"></span>`;
731
851
  __decorate([
732
852
  property({ type: Number })
733
853
  ], TimePicker.prototype, "hours", null);
@@ -761,10 +881,18 @@ __decorate([
761
881
  __decorate([
762
882
  query('#toggle')
763
883
  ], TimePicker.prototype, "toggleEl", void 0);
764
- TimePicker = __decorate([
884
+ __decorate([
885
+ translate({ mode: 'directive', scope: 'ef-time-picker' })
886
+ ], TimePicker.prototype, "t", void 0);
887
+ __decorate([
888
+ state()
889
+ ], TimePicker.prototype, "selectedSegment", null);
890
+ __decorate([
891
+ state()
892
+ ], TimePicker.prototype, "announceValues", void 0);
893
+ TimePicker = TimePicker_1 = __decorate([
765
894
  customElement('ef-time-picker', {
766
895
  alias: 'coral-time-picker'
767
896
  })
768
897
  ], TimePicker);
769
898
  export { TimePicker };
770
- //# sourceMappingURL=index.js.map