@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,244 +1,388 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { BasicElement, html, css, customElement, property, query } from '@refinitiv-ui/core';
8
- import '@refinitiv-ui/phrasebook/lib/locale/en/pagination';
1
+ import { __decorate } from "tslib";
2
+ import { BasicElement, html, css, WarningNotice, DeprecationNotice } from '@refinitiv-ui/core';
3
+ import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
5
+ import { state } from '@refinitiv-ui/core/lib/decorators/state.js';
6
+ import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
7
+ import { VERSION } from '../version.js';
8
+ import '../button/index.js';
9
+ import '../button-bar/index.js';
10
+ import '../layout/index.js';
11
+ import '../text-field/index.js';
12
+ import '@refinitiv-ui/phrasebook/lib/locale/en/pagination.js';
9
13
  import { translate } from '@refinitiv-ui/translate';
10
- import '../button';
11
- import '../button-bar';
12
- import '../layout';
13
- import '../text-field';
14
+ const pageDeprecation = new DeprecationNotice('Property `page` is deprecated, use `value` instead.');
15
+ const pageSizeDeprecation = new DeprecationNotice('Property `pageSize ` is deprecated, use `max` instead.');
16
+ const totalItemsDeprecation = new DeprecationNotice('Property `totalItems ` is deprecated, use `max` instead.');
14
17
  /**
15
18
  * Used to control and navigate through multiple pages
16
- * @fires page-changed - Fired when the `page` property is changed
19
+ * @fires value-changed - Fired when the `value` property is changed
17
20
  */
18
21
  let Pagination = class Pagination extends BasicElement {
19
22
  constructor() {
20
23
  super(...arguments);
21
24
  /**
22
- * Set current page
25
+ * Current page internal current page value
26
+ */
27
+ this._value = '';
28
+ /**
29
+ * Max page
23
30
  */
24
- this.page = '1';
31
+ this._max = '';
25
32
  /**
26
- * Number of item per page
33
+ * Number of item per page internal value
34
+ * @deprecated
27
35
  */
28
- this.pageSize = '10';
36
+ this._pageSize = '';
29
37
  /**
30
- * Total items
38
+ * Total items internal value
39
+ * @deprecated
31
40
  */
32
- this.totalItems = '10';
41
+ this._totalItems = '';
33
42
  /**
34
43
  * Set state to disable
35
44
  */
36
45
  this.disabled = false;
46
+ /**
47
+ * State for check the input focus
48
+ */
49
+ this.inputFocused = false;
37
50
  }
38
51
  /**
39
- * A `CSSResult` that will be used
40
- * to style the host, slotted children
41
- * and the internal template of the element.
42
- * @return CSS template
52
+ * Element version number
53
+ * @returns version number
43
54
  */
44
- static get styles() {
45
- return css `
46
- :host {
47
- display: block;
48
- --responsive-width: 450;
49
- }
50
- `;
55
+ static get version() {
56
+ return VERSION;
51
57
  }
52
58
  /**
53
- * Invoked whenever the element is updated
54
- * @param changedProperties Map of changed properties with old values
55
- * @returns {void}
59
+ * Internal current page
60
+ * @returns current page
56
61
  */
57
- updated(changedProperties) {
58
- super.updated(changedProperties);
59
- if (changedProperties.has('disabled')) {
60
- this.disabledChanged();
62
+ get internalValue() {
63
+ let value = parseInt(this._value, 10) || 0;
64
+ if (value <= 0) {
65
+ value = 1;
61
66
  }
62
- if (changedProperties.has('page')) {
63
- const previousPage = changedProperties.get('page');
64
- this.page = this.validatePage(previousPage, this.page);
65
- this.updateButtons();
66
- }
67
- if (changedProperties.has('pageSize')) {
68
- this.pageSizeChanged();
67
+ return value;
68
+ }
69
+ /**
70
+ * Current page
71
+ */
72
+ get value() {
73
+ return this._value;
74
+ }
75
+ /**
76
+ * Set current page
77
+ * @param value current page
78
+ */
79
+ set value(value) {
80
+ let newValue = value;
81
+ if (!newValue || !this.validatePage(newValue, true, 'value')) {
82
+ newValue = '';
69
83
  }
70
- if (changedProperties.has('totalItems')) {
71
- this.totalItemsChanged();
84
+ const oldValue = this._value;
85
+ if (oldValue !== newValue) {
86
+ this._value = newValue.toString();
72
87
  }
88
+ this.requestUpdate('value', oldValue);
73
89
  }
74
90
  /**
75
- * Handle when page-size property changed
76
- * @returns {void}
91
+ * Internal max page
92
+ * @returns max page
77
93
  */
78
- pageSizeChanged() {
79
- const page = Number.parseInt(this.page, 10);
80
- const pageSize = Number.parseInt(this.pageSize, 10);
81
- // page must have at least 1 item
82
- if (pageSize < 1) {
83
- this.pageSize = '1';
94
+ get internalMax() {
95
+ const max = parseInt(this._max, 10) || 0;
96
+ const pageSize = this.internalPageSize;
97
+ const totalItems = this.internalTotalitems;
98
+ if (!max && !totalItems) {
99
+ return Infinity;
84
100
  }
85
- if (page > this.totalPage) {
86
- this.page = this.totalPage.toString();
101
+ else if (max >= 1) {
102
+ return max;
87
103
  }
88
- this.updateButtons();
104
+ if (pageSize > 0) {
105
+ const totalPage = Math.ceil(totalItems / pageSize);
106
+ return totalPage >= 1 ? totalPage : 1;
107
+ }
108
+ return 1;
89
109
  }
90
110
  /**
91
- * Handle when total-items property changed
92
- * @returns {void}
111
+ * Max page
112
+ * @returns max page
113
+ */
114
+ get max() {
115
+ return this._max;
116
+ }
117
+ /**
118
+ * Set max page
119
+ * @param value max page
93
120
  */
94
- totalItemsChanged() {
95
- const page = Number.parseInt(this.page, 10);
96
- const totalItems = Number.parseInt(this.totalItems, 10);
97
- // handle if someone doesn't know how to count
98
- if (totalItems < 1) {
99
- this.totalItems = '0';
100
- this.page = '1';
121
+ set max(value) {
122
+ let newValue = value;
123
+ if (!newValue || !this.validatePage(value, true, 'max')) {
124
+ newValue = '';
101
125
  }
102
- else if (page > this.totalPage) {
103
- this.page = this.totalPage.toString();
126
+ const oldValue = this._max;
127
+ if (oldValue !== newValue) {
128
+ this._max = newValue.toString();
104
129
  }
105
- this.updateButtons();
130
+ this.requestUpdate('max', oldValue);
106
131
  }
107
132
  /**
108
- * Handle when disabled property changed
109
- * @returns {void}
133
+ * Current page
134
+ * @returns current page
135
+ * @deprecated
136
+ * @ignore
137
+ */
138
+ get page() {
139
+ pageDeprecation.once();
140
+ return this._value;
141
+ }
142
+ /**
143
+ * Set current page
144
+ * @param value - Set current page
145
+ * @deprecated
146
+ * @ignore
110
147
  */
111
- disabledChanged() {
112
- if (this.disabled) {
113
- this.infoElement.setAttribute('disabled', '');
148
+ set page(value) {
149
+ pageDeprecation.show();
150
+ let newValue = value;
151
+ if (!newValue || !this.validatePage(value, true, 'page')) {
152
+ newValue = '';
114
153
  }
115
- else {
116
- this.infoElement.removeAttribute('disabled');
154
+ const oldValue = this._value;
155
+ if (oldValue !== newValue) {
156
+ this._value = newValue.toString();
117
157
  }
118
- this.input.disabled = this.disabled;
119
- // recalculate button state
120
- this.updateButtons();
158
+ this.requestUpdate('page', oldValue);
121
159
  }
122
160
  /**
123
- * Update disable/enable state of first, previous, next, and last
124
- * First and previous should be disabled if showing first page
125
- * Next and last should be disabled if showing last page
126
- * @returns {void}
161
+ * Number of item per page
162
+ * @returns number of items per page
163
+ * @deprecated
164
+ * @ignore
127
165
  */
128
- updateButtons() {
129
- const page = Number.parseInt(this.page, 10);
130
- const firstPage = this.disabled || page <= 1;
131
- const lastPage = this.disabled || page >= this.totalPage;
132
- this.previousPageButton.disabled = firstPage;
133
- this.firstPageButton.disabled = firstPage;
134
- this.nextPageButton.disabled = lastPage;
135
- this.lastPageButton.disabled = lastPage;
166
+ get pageSize() {
167
+ pageSizeDeprecation.once();
168
+ return this._pageSize;
136
169
  }
137
170
  /**
138
- * Calculate and return total pages
139
- * Total pages should never less than 1
140
- * @returns {number} Number of total page
171
+ * Set number of item per page
172
+ * @param value - number of item per page
173
+ * @deprecated
174
+ * @ignore
141
175
  */
142
- get totalPage() {
143
- const pageSize = Number.parseInt(this.pageSize, 10);
144
- const totalItems = Number.parseInt(this.totalItems, 10);
145
- if (pageSize > 0) {
146
- const totalPage = Math.ceil(totalItems / pageSize);
147
- return totalPage > 0 ? totalPage : 1;
176
+ set pageSize(value) {
177
+ pageSizeDeprecation.show();
178
+ let newValue = value;
179
+ if (!newValue || !this.validatePage(value, true, 'page-size')) {
180
+ newValue = '';
148
181
  }
149
- return 1;
182
+ // Validate to show warning only, need to keep developer value.
183
+ // Check page still is in supported range if page-size changed
184
+ const newTotalPage = Math.ceil(this.internalTotalitems / (parseInt(newValue, 10) || 1)) || 1;
185
+ if (this.internalValue > newTotalPage) {
186
+ new WarningNotice(`${this.localName} : The specified value "${newValue}" of page-size caused the value of page property is out of supported range.`).show();
187
+ }
188
+ const oldValue = this._pageSize;
189
+ if (oldValue !== newValue) {
190
+ this._pageSize = newValue;
191
+ }
192
+ this.requestUpdate('pageSize', oldValue);
150
193
  }
151
194
  /**
152
- * Check a new page value to be usable
153
- * if a new page value is allow then return newPage
154
- * Condition to be old value is null or NaN or undefined or string or less than 1
155
- * @param oldPage a old page value
156
- * @param newPage a new page value
157
- * @return return a new page value
195
+ * Internal page size
196
+ * @deprecated
197
+ * @returns page size
158
198
  */
159
- validatePage(oldPage, newPage) {
160
- let page = Number.parseInt(newPage, 10);
161
- if (!page || isNaN(Number(newPage)) || isNaN(page)) {
162
- page = Number.parseInt(oldPage, 10);
199
+ get internalPageSize() {
200
+ return parseInt(this._pageSize, 10);
201
+ }
202
+ /**
203
+ * Internal total items
204
+ * @returns total items
205
+ * @deprecated
206
+ */
207
+ get internalTotalitems() {
208
+ const totalItems = parseInt(this._totalItems, 10) || 0;
209
+ return totalItems >= 1 ? totalItems : 0;
210
+ }
211
+ /**
212
+ * Total items
213
+ * @returns total items
214
+ * @deprecated
215
+ * @ignore
216
+ */
217
+ get totalItems() {
218
+ totalItemsDeprecation.once();
219
+ return this._totalItems;
220
+ }
221
+ /**
222
+ * Set total items
223
+ * @param value total items
224
+ * @deprecated
225
+ * @ignore
226
+ */
227
+ set totalItems(value) {
228
+ totalItemsDeprecation.show();
229
+ let newValue = value;
230
+ if (!newValue || !this.validatePage(value, true, 'total-items')) {
231
+ newValue = '';
163
232
  }
164
- else if (page > this.totalPage) {
165
- page = this.totalPage;
233
+ // Validate to show warning only, need to keep developer value.
234
+ // Check page still is in supported range if total-item changed
235
+ const newTotalPage = Math.ceil((parseInt(newValue, 10) || 1) / this.internalPageSize) || 1;
236
+ if (this.internalValue > newTotalPage) {
237
+ new WarningNotice(`${this.localName} : The specified value "${newValue}" of total-items caused the value of page property is out of supported range.`).show();
166
238
  }
167
- else if (page < 1) {
168
- page = 1;
239
+ const oldValue = this._totalItems;
240
+ if (oldValue !== newValue) {
241
+ this._totalItems = newValue;
169
242
  }
170
- return page.toString();
243
+ this.requestUpdate('totalItems', oldValue);
171
244
  }
172
245
  /**
173
- * Get text to display in info part
174
- * @returns {PageInfo} Used for translations
246
+ * Get infinite pagination state
247
+ * @returns infinite pagination state
175
248
  */
176
- get pageInfo() {
177
- const page = Number.parseInt(this.page, 10);
178
- const pageSize = Number.parseInt(this.pageSize, 10);
179
- const totalCount = Number.parseInt(this.totalItems, 10);
180
- const from = ((page - 1) * pageSize) + 1;
181
- const to = page * pageSize > totalCount ? totalCount : page * pageSize;
182
- return {
183
- from,
184
- to,
185
- totalCount,
186
- pageSize
187
- };
249
+ get infinitePaginate() {
250
+ return this.internalMax === Infinity; // internalMax always returns 1-Infinity
188
251
  }
189
252
  /**
190
- * Hide info part when it's too small
191
- * @returns {void}
253
+ * Getter for display text in the input
254
+ * @returns input text
192
255
  */
193
- onResize() {
194
- const display = this.clientWidth < Number.parseInt(this.getComputedVariable('--responsive-width'), 10) ? 'none' : 'block';
195
- this.infoElement.style.display = display;
256
+ get inputText() {
257
+ if (this.inputFocused) {
258
+ return this.internalValue.toString();
259
+ }
260
+ else {
261
+ return (this.infinitePaginate ? this.t('PAGE', { page: this.internalValue }) : this.t('PAGE_OF', { page: this.internalValue, pageTotal: this.internalMax }));
262
+ }
196
263
  }
197
264
  /**
198
- * Handle when input is focus
199
- * @returns {void}
265
+ * State for checking the first page button is available
200
266
  */
201
- onInputFocus() {
202
- this.input.value = this.page;
203
- setTimeout(() => {
204
- this.input.select();
205
- });
267
+ get useFirstButton() {
268
+ return !this.disabled && this.internalValue >= 2;
206
269
  }
207
270
  /**
208
- * Handle when input lost focus
209
- * @param event Event object
210
- * @returns {void}
271
+ * State for checking the previous page button is available
211
272
  */
212
- onInputBlur(event) {
213
- const oldPageValue = this.page;
214
- this.page = this.validatePage(this.page, event.target.value);
215
- // need this to update input text
216
- void this.requestUpdate();
217
- if (this.page !== oldPageValue) {
218
- this.notifyPropertyChange('page', this.page);
273
+ get usePreviousButton() {
274
+ return this.useFirstButton;
275
+ }
276
+ /**
277
+ * State for checking the next page button is available
278
+ */
279
+ get useNextButton() {
280
+ return !this.disabled && this.internalValue < this.internalMax;
281
+ }
282
+ /**
283
+ * State for checking the last page button is available
284
+ */
285
+ get useLastButton() {
286
+ return this.useNextButton && !this.infinitePaginate;
287
+ }
288
+ /**
289
+ * @override
290
+ */
291
+ updated(changedProperties) {
292
+ super.updated(changedProperties);
293
+ if (this.inputFocused && changedProperties.has('inputFocused')) {
294
+ void this.selectInput();
295
+ }
296
+ }
297
+ /**
298
+ * Validate page value which returns true when value is valid
299
+ * @param value value
300
+ * @param warning show warning message when value is invalid
301
+ * @param propName property name to show in warning message
302
+ * @returns result of validation
303
+ */
304
+ validatePage(value, warning = false, propName = '') {
305
+ if ((/^[1-9]([0-9]+)?$/).test(value)) {
306
+ return true;
307
+ }
308
+ else {
309
+ if (value !== null && warning && propName) {
310
+ new WarningNotice(`${this.localName} : The specified value "${value}" of ${propName} property is not valid, The value must be integer and greater than 0.`).show();
311
+ }
312
+ return false;
219
313
  }
220
314
  }
221
315
  /**
222
- * Handles action when Enter key is press onto the input
316
+ * Handles action when Enter and Tab key is press onto the input
223
317
  * @param event Keyboard event
224
318
  * @returns {void}
225
319
  */
226
320
  onInputKeyDown(event) {
227
321
  var _a, _b;
228
- if (event.key === 'Enter' || event.keyCode === 13) {
229
- /*
230
- * Issue only in firefox
231
- * cannot blur() or focus() to this.input
232
- * so create a temp to this.input loses focus
233
- */
234
- const temp = document.createElement('input');
235
- (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(temp);
236
- temp.focus();
237
- this.input.blur();
238
- (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.removeChild(temp);
239
- event.preventDefault();
322
+ const isEnter = event.key === 'Enter' || event.keyCode === 13;
323
+ const isTab = event.key === 'Tab' || event.keyCode === 9;
324
+ if (isEnter || isTab) {
325
+ this.updatePageInput();
326
+ if (isEnter) {
327
+ this.input.blur();
328
+ event.preventDefault();
329
+ /**
330
+ * Issue only in firefox
331
+ * cannot blur() or focus() to this.input so create a temp to this.input loses focus
332
+ */
333
+ const temp = document.createElement('input');
334
+ (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(temp);
335
+ temp.focus();
336
+ this.input.blur();
337
+ (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.removeChild(temp);
338
+ }
240
339
  }
241
340
  }
341
+ /**
342
+ * Handles action when input focused change
343
+ * @param event focus change event
344
+ * @returns {void}
345
+ */
346
+ onInputFocusedChanged(event) {
347
+ this.inputFocused = event.detail.value;
348
+ if (!this.inputFocused) {
349
+ this.updatePageInput();
350
+ }
351
+ }
352
+ /**
353
+ * Update page by using value from the input
354
+ * @returns {void}
355
+ */
356
+ updatePageInput() {
357
+ // Prevent update page to the same value
358
+ if (this.value === this.input.value) {
359
+ return;
360
+ }
361
+ const oldValue = this.value;
362
+ let newValue = parseInt(this.input.value, 10);
363
+ // Reset input and boundary value into supported range.
364
+ if (this.validatePage(this.input.value)) {
365
+ if (newValue > this.internalMax) {
366
+ newValue = this.internalMax;
367
+ }
368
+ this.value = newValue.toString();
369
+ }
370
+ // When input value is invalid in case less than support range (value<1), then reset value = '1'.
371
+ else if (!isNaN(newValue) && newValue < 1) {
372
+ this.value = '1';
373
+ }
374
+ if (this.value !== oldValue) {
375
+ this.notifyValueChange();
376
+ }
377
+ }
378
+ /**
379
+ * Select text in input when update element complete
380
+ * @returns returns a promise void
381
+ */
382
+ async selectInput() {
383
+ await this.updateComplete;
384
+ this.input.select();
385
+ }
242
386
  /**
243
387
  * Updates page value depending on direction
244
388
  * @param direction page value direction
@@ -246,21 +390,35 @@ let Pagination = class Pagination extends BasicElement {
246
390
  * @returns {void}
247
391
  */
248
392
  updatePage(direction, event = false) {
249
- const page = parseInt(this.page, 10);
250
- const limit = direction === 'increment' ? page < this.totalPage : page > 1;
251
- if (limit) {
252
- this.page = direction === 'increment' ? (page + 1).toString() : (page - 1).toString();
393
+ /**
394
+ * Handle in case the value of max property is greater than value of value/page property,
395
+ * which it might happen by using developer API.
396
+ */
397
+ let page = this.internalValue;
398
+ if (page > this.internalMax) {
399
+ page = this.internalMax + 1;
400
+ }
401
+ const limit = direction === 'increment' ? page >= this.internalMax : page <= 1;
402
+ if (!limit) {
403
+ this.value = direction === 'increment' ? (page + 1).toString() : (page - 1).toString();
253
404
  if (event) {
254
- this.notifyPropertyChange('page', this.page);
405
+ this.notifyValueChange();
255
406
  }
256
407
  }
257
408
  }
409
+ /**
410
+ * Fires event when value change
411
+ * @returns {void}
412
+ */
413
+ notifyValueChange() {
414
+ this.notifyPropertyChange('value', this.value);
415
+ this.notifyPropertyChange('page', this.value); // deprecated. support backwards compatibility.
416
+ }
258
417
  /**
259
418
  * Go to the next page
260
419
  * @returns {void}
261
420
  */
262
421
  next() {
263
- this.input.blur();
264
422
  this.updatePage('increment');
265
423
  }
266
424
  /**
@@ -268,7 +426,6 @@ let Pagination = class Pagination extends BasicElement {
268
426
  * @returns {void}
269
427
  */
270
428
  onNextTap() {
271
- this.input.blur();
272
429
  this.updatePage('increment', true);
273
430
  }
274
431
  /**
@@ -276,15 +433,13 @@ let Pagination = class Pagination extends BasicElement {
276
433
  * @returns {void}
277
434
  */
278
435
  previous() {
279
- this.input.blur();
280
436
  this.updatePage('decrement');
281
437
  }
282
438
  /**
283
- * Go to the previous page and fires evetn
439
+ * Go to the previous page and fires event
284
440
  * @returns {void}
285
441
  */
286
442
  onPreviousTap() {
287
- this.input.blur();
288
443
  this.updatePage('decrement', true);
289
444
  }
290
445
  /**
@@ -292,8 +447,7 @@ let Pagination = class Pagination extends BasicElement {
292
447
  * @returns {void}
293
448
  */
294
449
  first() {
295
- this.input.blur();
296
- this.page = '1';
450
+ this.value = '1';
297
451
  }
298
452
  /**
299
453
  * Go to the first page and fires event
@@ -301,15 +455,18 @@ let Pagination = class Pagination extends BasicElement {
301
455
  */
302
456
  onFirstTap() {
303
457
  this.first();
304
- this.notifyPropertyChange('page', this.page);
458
+ this.notifyValueChange();
305
459
  }
306
460
  /**
307
461
  * Go to the last page
308
462
  * @returns {void}
309
463
  */
310
464
  last() {
311
- this.input.blur();
312
- this.page = this.totalPage.toString();
465
+ if (this.infinitePaginate) {
466
+ new WarningNotice(`${this.localName}: Cannot call "last()" when "max" attribute/property is unset.`).show();
467
+ return;
468
+ }
469
+ this.value = this.internalMax.toString();
313
470
  }
314
471
  /**
315
472
  * Go to the last page and fires event
@@ -317,35 +474,44 @@ let Pagination = class Pagination extends BasicElement {
317
474
  */
318
475
  onLastTap() {
319
476
  this.last();
320
- this.notifyPropertyChange('page', this.page);
477
+ this.notifyValueChange();
478
+ }
479
+ /**
480
+ * A `CSSResultGroup` that will be used
481
+ * to style the host, slotted children
482
+ * and the internal template of the element.
483
+ * @return CSS template
484
+ */
485
+ static get styles() {
486
+ return css `
487
+ :host {
488
+ display: inline-block;
489
+ }
490
+ `;
321
491
  }
322
492
  /**
323
493
  * A `TemplateResult` that will be used
324
494
  * to render the updated internal template.
325
- * @return {TemplateResult} Render template
495
+ * @return Render template
326
496
  */
327
497
  render() {
328
498
  return html `
329
- <ef-layout part="container" flex nowrap @resize="${this.onResize}">
330
- <div id="info" part="info">${this.t('ITEM_INFO', this.pageInfo)}</div>
499
+ <ef-layout part="container" flex nowrap>
331
500
  <ef-button-bar part="buttons">
332
- <ef-button id="first" icon="skip-to-start" @tap="${this.onFirstTap}"></ef-button>
333
- <ef-button id="previous" icon="left" @tap="${this.onPreviousTap}"></ef-button>
501
+ <ef-button id="first" icon="skip-to-start" @tap="${this.onFirstTap}" .disabled=${!this.useFirstButton}></ef-button>
502
+ <ef-button id="previous" icon="left" @tap="${this.onPreviousTap}" .disabled=${!this.usePreviousButton}></ef-button>
334
503
  </ef-button-bar>
335
504
  <ef-text-field
336
505
  id="input"
337
506
  part="input"
338
- @focus="${this.onInputFocus}"
339
- @blur="${this.onInputBlur}"
340
- @keydown="${this.onInputKeyDown}"
341
- .value="${this.t('PAGE_OF', {
342
- page: this.page,
343
- pageTotal: this.totalPage
344
- })}"
507
+ @focused-changed=${this.onInputFocusedChanged}
508
+ @keydown=${this.onInputKeyDown}
509
+ .value=${this.inputText}
510
+ .disabled=${this.disabled}
345
511
  no-spinner></ef-text-field>
346
512
  <ef-button-bar part="buttons">
347
- <ef-button id="next" icon="right" @tap="${this.onNextTap}"></ef-button>
348
- <ef-button id="last" icon="skip-to-end" @tap="${this.onLastTap}"></ef-button>
513
+ <ef-button id="next" icon="right" @tap="${this.onNextTap}" .disabled=${!this.useNextButton}></ef-button>
514
+ <ef-button id="last" icon="skip-to-end" @tap="${this.onLastTap}" .disabled=${!this.useLastButton}></ef-button>
349
515
  </ef-button-bar>
350
516
  </ef-layout>
351
517
  `;
@@ -353,41 +519,34 @@ let Pagination = class Pagination extends BasicElement {
353
519
  };
354
520
  __decorate([
355
521
  property({ type: String })
356
- ], Pagination.prototype, "page", void 0);
522
+ ], Pagination.prototype, "value", null);
523
+ __decorate([
524
+ property({ type: String })
525
+ ], Pagination.prototype, "max", null);
526
+ __decorate([
527
+ property({ type: String })
528
+ ], Pagination.prototype, "page", null);
357
529
  __decorate([
358
530
  property({ type: String, attribute: 'page-size' })
359
- ], Pagination.prototype, "pageSize", void 0);
531
+ ], Pagination.prototype, "pageSize", null);
360
532
  __decorate([
361
533
  property({ type: String, attribute: 'total-items' })
362
- ], Pagination.prototype, "totalItems", void 0);
534
+ ], Pagination.prototype, "totalItems", null);
363
535
  __decorate([
364
536
  property({ type: Boolean, reflect: true })
365
537
  ], Pagination.prototype, "disabled", void 0);
366
- __decorate([
367
- query('#info')
368
- ], Pagination.prototype, "infoElement", void 0);
369
538
  __decorate([
370
539
  query('#input')
371
540
  ], Pagination.prototype, "input", void 0);
372
- __decorate([
373
- query('#first')
374
- ], Pagination.prototype, "firstPageButton", void 0);
375
- __decorate([
376
- query('#previous')
377
- ], Pagination.prototype, "previousPageButton", void 0);
378
- __decorate([
379
- query('#next')
380
- ], Pagination.prototype, "nextPageButton", void 0);
381
- __decorate([
382
- query('#last')
383
- ], Pagination.prototype, "lastPageButton", void 0);
384
541
  __decorate([
385
542
  translate()
386
543
  ], Pagination.prototype, "t", void 0);
544
+ __decorate([
545
+ state()
546
+ ], Pagination.prototype, "inputFocused", void 0);
387
547
  Pagination = __decorate([
388
548
  customElement('ef-pagination', {
389
549
  alias: 'emerald-pagination'
390
550
  })
391
551
  ], Pagination);
392
552
  export { Pagination };
393
- //# sourceMappingURL=index.js.map