@refinitiv-ui/elements 5.3.4 → 5.8.0

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 (352) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/lib/accordion/custom-elements.md +18 -0
  3. package/lib/accordion/index.d.ts +5 -5
  4. package/lib/accordion/index.js +8 -11
  5. package/lib/appstate-bar/custom-elements.md +22 -0
  6. package/lib/appstate-bar/index.d.ts +5 -5
  7. package/lib/appstate-bar/index.js +8 -11
  8. package/lib/autosuggest/custom-elements.json +24 -4
  9. package/lib/autosuggest/custom-elements.md +54 -0
  10. package/lib/autosuggest/helpers/types.d.ts +1 -1
  11. package/lib/autosuggest/helpers/utils.d.ts +2 -2
  12. package/lib/autosuggest/helpers/utils.js +1 -2
  13. package/lib/autosuggest/index.d.ts +13 -8
  14. package/lib/autosuggest/index.js +38 -31
  15. package/lib/button/custom-elements.json +2 -2
  16. package/lib/button/custom-elements.md +23 -0
  17. package/lib/button/index.d.ts +13 -13
  18. package/lib/button/index.js +41 -31
  19. package/lib/button-bar/custom-elements.md +9 -0
  20. package/lib/button-bar/index.d.ts +3 -3
  21. package/lib/button-bar/index.js +8 -10
  22. package/lib/calendar/constants.d.ts +22 -0
  23. package/lib/calendar/constants.js +23 -0
  24. package/lib/calendar/custom-elements.json +8 -6
  25. package/lib/calendar/custom-elements.md +35 -0
  26. package/lib/calendar/index.d.ts +9 -7
  27. package/lib/calendar/index.js +20 -38
  28. package/lib/calendar/locales.d.ts +1 -31
  29. package/lib/calendar/locales.js +0 -104
  30. package/lib/calendar/types.d.ts +1 -5
  31. package/lib/calendar/types.js +1 -6
  32. package/lib/calendar/utils.d.ts +31 -1
  33. package/lib/calendar/utils.js +104 -2
  34. package/lib/canvas/custom-elements.json +7 -5
  35. package/lib/canvas/custom-elements.md +27 -0
  36. package/lib/canvas/index.d.ts +4 -3
  37. package/lib/canvas/index.js +8 -10
  38. package/lib/card/custom-elements.json +3 -1
  39. package/lib/card/custom-elements.md +24 -0
  40. package/lib/card/helpers/types.d.ts +1 -1
  41. package/lib/card/index.d.ts +10 -8
  42. package/lib/card/index.js +14 -13
  43. package/lib/chart/custom-elements.json +1 -1
  44. package/lib/chart/custom-elements.md +16 -0
  45. package/lib/chart/helpers/index.d.ts +2 -2
  46. package/lib/chart/helpers/index.js +2 -2
  47. package/lib/chart/index.d.ts +6 -6
  48. package/lib/chart/index.js +12 -14
  49. package/lib/checkbox/custom-elements.json +4 -4
  50. package/lib/checkbox/custom-elements.md +18 -0
  51. package/lib/checkbox/index.d.ts +21 -13
  52. package/lib/checkbox/index.js +56 -31
  53. package/lib/clock/custom-elements.json +21 -4
  54. package/lib/clock/custom-elements.md +28 -0
  55. package/lib/clock/index.d.ts +17 -5
  56. package/lib/clock/index.js +37 -18
  57. package/lib/clock/themes/halo/dark/index.js +1 -1
  58. package/lib/clock/themes/halo/light/index.js +1 -1
  59. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  60. package/lib/clock/themes/solar/pearl/index.js +1 -1
  61. package/lib/clock/utils/TickManager.js +2 -2
  62. package/lib/collapse/custom-elements.md +27 -0
  63. package/lib/collapse/index.d.ts +7 -7
  64. package/lib/collapse/index.js +11 -13
  65. package/lib/color-dialog/custom-elements.json +29 -16
  66. package/lib/color-dialog/custom-elements.md +39 -0
  67. package/lib/color-dialog/elements/color-palettes.d.ts +5 -5
  68. package/lib/color-dialog/elements/color-palettes.js +9 -13
  69. package/lib/color-dialog/elements/grayscale-palettes.d.ts +5 -5
  70. package/lib/color-dialog/elements/grayscale-palettes.js +10 -13
  71. package/lib/color-dialog/elements/palettes.d.ts +10 -3
  72. package/lib/color-dialog/elements/palettes.js +58 -45
  73. package/lib/color-dialog/helpers/color-helpers.d.ts +7 -53
  74. package/lib/color-dialog/helpers/color-helpers.js +12 -109
  75. package/lib/color-dialog/helpers/value-model.d.ts +1 -1
  76. package/lib/color-dialog/helpers/value-model.js +18 -16
  77. package/lib/color-dialog/index.d.ts +19 -19
  78. package/lib/color-dialog/index.js +47 -45
  79. package/lib/combo-box/custom-elements.json +28 -16
  80. package/lib/combo-box/custom-elements.md +35 -0
  81. package/lib/combo-box/helpers/filter.d.ts +4 -4
  82. package/lib/combo-box/helpers/types.d.ts +2 -2
  83. package/lib/combo-box/index.d.ts +26 -18
  84. package/lib/combo-box/index.js +36 -27
  85. package/lib/combo-box/themes/halo/dark/index.js +1 -1
  86. package/lib/combo-box/themes/halo/light/index.js +1 -1
  87. package/lib/combo-box/themes/solar/charcoal/index.js +1 -1
  88. package/lib/combo-box/themes/solar/pearl/index.js +1 -1
  89. package/lib/counter/custom-elements.json +8 -4
  90. package/lib/counter/custom-elements.md +11 -0
  91. package/lib/counter/index.d.ts +5 -3
  92. package/lib/counter/index.js +11 -12
  93. package/lib/datetime-picker/custom-elements.json +52 -23
  94. package/lib/datetime-picker/custom-elements.md +57 -0
  95. package/lib/datetime-picker/index.d.ts +25 -14
  96. package/lib/datetime-picker/index.js +46 -35
  97. package/lib/datetime-picker/locales.d.ts +1 -1
  98. package/lib/datetime-picker/locales.js +12 -1
  99. package/lib/datetime-picker/themes/solar/charcoal/index.js +1 -1
  100. package/lib/datetime-picker/themes/solar/pearl/index.js +1 -1
  101. package/lib/datetime-picker/types.d.ts +1 -1
  102. package/lib/datetime-picker/utils.js +1 -1
  103. package/lib/dialog/custom-elements.json +34 -12
  104. package/lib/dialog/custom-elements.md +47 -0
  105. package/lib/dialog/index.d.ts +17 -20
  106. package/lib/dialog/index.js +28 -31
  107. package/lib/email-field/custom-elements.json +81 -94
  108. package/lib/email-field/custom-elements.md +37 -0
  109. package/lib/email-field/index.d.ts +44 -116
  110. package/lib/email-field/index.js +48 -249
  111. package/lib/email-field/themes/solar/charcoal/index.js +1 -1
  112. package/lib/email-field/themes/solar/pearl/index.js +1 -1
  113. package/lib/events.d.ts +2 -2
  114. package/lib/events.js +1 -2
  115. package/lib/flag/custom-elements.md +10 -0
  116. package/lib/flag/index.d.ts +6 -4
  117. package/lib/flag/index.js +12 -12
  118. package/lib/flag/utils/FlagLoader.d.ts +1 -1
  119. package/lib/flag/utils/FlagLoader.js +1 -1
  120. package/lib/header/custom-elements.md +18 -0
  121. package/lib/header/index.d.ts +2 -2
  122. package/lib/header/index.js +5 -8
  123. package/lib/heatmap/custom-elements.md +26 -0
  124. package/lib/heatmap/helpers/color.d.ts +1 -1
  125. package/lib/heatmap/helpers/color.js +1 -1
  126. package/lib/heatmap/helpers/text.d.ts +1 -1
  127. package/lib/heatmap/index.d.ts +7 -7
  128. package/lib/heatmap/index.js +15 -16
  129. package/lib/icon/custom-elements.json +6 -4
  130. package/lib/icon/custom-elements.md +8 -0
  131. package/lib/icon/index.d.ts +9 -6
  132. package/lib/icon/index.js +28 -18
  133. package/lib/icon/utils/IconLoader.d.ts +6 -1
  134. package/lib/icon/utils/IconLoader.js +24 -17
  135. package/lib/index.d.ts +2 -1
  136. package/lib/index.js +2 -1
  137. package/lib/interactive-chart/custom-elements.json +6 -10
  138. package/lib/interactive-chart/custom-elements.md +31 -0
  139. package/lib/interactive-chart/helpers/types.d.ts +2 -2
  140. package/lib/interactive-chart/index.d.ts +11 -8
  141. package/lib/interactive-chart/index.js +17 -17
  142. package/lib/item/custom-elements.json +4 -4
  143. package/lib/item/custom-elements.md +29 -0
  144. package/lib/item/helpers/types.d.ts +1 -1
  145. package/lib/item/index.d.ts +18 -8
  146. package/lib/item/index.js +36 -16
  147. package/lib/label/custom-elements.md +11 -0
  148. package/lib/label/index.d.ts +3 -3
  149. package/lib/label/index.js +12 -20
  150. package/lib/layout/custom-elements.md +26 -0
  151. package/lib/layout/index.d.ts +3 -3
  152. package/lib/layout/index.js +6 -9
  153. package/lib/led-gauge/custom-elements.json +4 -4
  154. package/lib/led-gauge/custom-elements.md +17 -0
  155. package/lib/led-gauge/index.d.ts +5 -4
  156. package/lib/led-gauge/index.js +9 -11
  157. package/lib/list/custom-elements.json +18 -5
  158. package/lib/list/custom-elements.md +32 -0
  159. package/lib/list/helpers/list-renderer.d.ts +2 -2
  160. package/lib/list/helpers/list-renderer.js +4 -2
  161. package/lib/list/helpers/types.d.ts +2 -2
  162. package/lib/list/index.d.ts +27 -10
  163. package/lib/list/index.js +54 -25
  164. package/lib/list/renderer.d.ts +2 -2
  165. package/lib/list/renderer.js +1 -1
  166. package/lib/loader/custom-elements.md +5 -0
  167. package/lib/loader/index.js +4 -8
  168. package/lib/multi-input/custom-elements.json +7 -6
  169. package/lib/multi-input/custom-elements.md +43 -0
  170. package/lib/multi-input/helpers/types.d.ts +1 -1
  171. package/lib/multi-input/index.d.ts +11 -7
  172. package/lib/multi-input/index.js +20 -17
  173. package/lib/multi-input/themes/solar/charcoal/index.js +1 -1
  174. package/lib/multi-input/themes/solar/pearl/index.js +1 -1
  175. package/lib/notification/custom-elements.md +26 -0
  176. package/lib/notification/elements/notification-tray.d.ts +2 -2
  177. package/lib/notification/elements/notification-tray.js +6 -9
  178. package/lib/notification/elements/notification.d.ts +5 -5
  179. package/lib/notification/elements/notification.js +8 -11
  180. package/lib/notification/helpers/status.d.ts +1 -1
  181. package/lib/notification/helpers/status.js +1 -1
  182. package/lib/notification/helpers/types.d.ts +1 -1
  183. package/lib/notification/index.d.ts +2 -2
  184. package/lib/notification/index.js +2 -2
  185. package/lib/number-field/custom-elements.json +99 -54
  186. package/lib/number-field/custom-elements.md +42 -0
  187. package/lib/number-field/index.d.ts +96 -51
  188. package/lib/number-field/index.js +121 -89
  189. package/lib/number-field/themes/solar/charcoal/index.js +1 -1
  190. package/lib/number-field/themes/solar/pearl/index.js +1 -1
  191. package/lib/overlay/custom-elements.json +26 -13
  192. package/lib/overlay/custom-elements.md +54 -0
  193. package/lib/overlay/elements/overlay-backdrop.d.ts +4 -4
  194. package/lib/overlay/elements/overlay-backdrop.js +6 -9
  195. package/lib/overlay/elements/overlay-viewport.d.ts +3 -3
  196. package/lib/overlay/elements/overlay-viewport.js +5 -9
  197. package/lib/overlay/elements/overlay.d.ts +10 -5
  198. package/lib/overlay/elements/overlay.js +27 -28
  199. package/lib/overlay/index.d.ts +2 -2
  200. package/lib/overlay/index.js +1 -1
  201. package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
  202. package/lib/overlay/managers/backdrop-manager.js +2 -2
  203. package/lib/overlay/managers/close-manager.js +1 -1
  204. package/lib/overlay/managers/focus-manager.js +2 -2
  205. package/lib/overlay/managers/interaction-lock-manager.js +2 -2
  206. package/lib/overlay/managers/viewport-manager.d.ts +2 -2
  207. package/lib/overlay/managers/viewport-manager.js +6 -2
  208. package/lib/overlay/managers/zindex-manager.js +1 -1
  209. package/lib/overlay-menu/custom-elements.json +70 -20
  210. package/lib/overlay-menu/custom-elements.md +44 -0
  211. package/lib/overlay-menu/helpers/types.d.ts +3 -3
  212. package/lib/overlay-menu/index.d.ts +26 -19
  213. package/lib/overlay-menu/index.js +47 -33
  214. package/lib/overlay-menu/managers/menu-manager.d.ts +2 -2
  215. package/lib/overlay-menu/managers/menu-manager.js +3 -3
  216. package/lib/pagination/custom-elements.md +27 -0
  217. package/lib/pagination/index.d.ts +8 -8
  218. package/lib/pagination/index.js +13 -15
  219. package/lib/panel/custom-elements.md +11 -0
  220. package/lib/panel/index.d.ts +3 -3
  221. package/lib/panel/index.js +6 -9
  222. package/lib/password-field/custom-elements.json +62 -67
  223. package/lib/password-field/custom-elements.md +39 -0
  224. package/lib/password-field/index.d.ts +43 -94
  225. package/lib/password-field/index.js +52 -198
  226. package/lib/password-field/themes/solar/charcoal/index.js +1 -1
  227. package/lib/password-field/themes/solar/pearl/index.js +1 -1
  228. package/lib/pill/custom-elements.json +8 -6
  229. package/lib/pill/custom-elements.md +22 -0
  230. package/lib/pill/index.d.ts +5 -5
  231. package/lib/pill/index.js +9 -11
  232. package/lib/progress-bar/custom-elements.md +18 -0
  233. package/lib/progress-bar/index.d.ts +3 -3
  234. package/lib/progress-bar/index.js +7 -9
  235. package/lib/radio-button/custom-elements.json +4 -4
  236. package/lib/radio-button/custom-elements.md +19 -0
  237. package/lib/radio-button/index.d.ts +25 -8
  238. package/lib/radio-button/index.js +84 -21
  239. package/lib/radio-button/radio-button-registry.d.ts +3 -2
  240. package/lib/radio-button/radio-button-registry.js +57 -4
  241. package/lib/rating/custom-elements.md +17 -0
  242. package/lib/rating/index.d.ts +3 -3
  243. package/lib/rating/index.js +9 -10
  244. package/lib/search-field/custom-elements.json +70 -74
  245. package/lib/search-field/custom-elements.md +41 -0
  246. package/lib/search-field/index.d.ts +44 -101
  247. package/lib/search-field/index.js +50 -220
  248. package/lib/search-field/themes/solar/charcoal/index.js +1 -1
  249. package/lib/search-field/themes/solar/pearl/index.js +1 -1
  250. package/lib/select/custom-elements.json +5 -4
  251. package/lib/select/custom-elements.md +24 -0
  252. package/lib/select/helpers/types.d.ts +1 -1
  253. package/lib/select/index.d.ts +18 -10
  254. package/lib/select/index.js +84 -45
  255. package/lib/sidebar-layout/custom-elements.json +2 -6
  256. package/lib/sidebar-layout/custom-elements.md +21 -0
  257. package/lib/sidebar-layout/index.d.ts +7 -6
  258. package/lib/sidebar-layout/index.js +9 -10
  259. package/lib/slider/custom-elements.json +4 -4
  260. package/lib/slider/custom-elements.md +28 -0
  261. package/lib/slider/index.d.ts +4 -4
  262. package/lib/slider/index.js +9 -10
  263. package/lib/sparkline/custom-elements.json +4 -4
  264. package/lib/sparkline/custom-elements.md +16 -0
  265. package/lib/sparkline/index.d.ts +6 -4
  266. package/lib/sparkline/index.js +10 -10
  267. package/lib/swing-gauge/custom-elements.json +5 -3
  268. package/lib/swing-gauge/custom-elements.md +17 -0
  269. package/lib/swing-gauge/helpers.d.ts +1 -1
  270. package/lib/swing-gauge/helpers.js +1 -1
  271. package/lib/swing-gauge/index.d.ts +9 -7
  272. package/lib/swing-gauge/index.js +17 -15
  273. package/lib/tab/custom-elements.json +2 -2
  274. package/lib/tab/custom-elements.md +22 -0
  275. package/lib/tab/index.d.ts +5 -5
  276. package/lib/tab/index.js +9 -12
  277. package/lib/tab/themes/solar/charcoal/index.js +1 -1
  278. package/lib/tab/themes/solar/pearl/index.js +1 -1
  279. package/lib/tab-bar/custom-elements.md +11 -0
  280. package/lib/tab-bar/index.d.ts +4 -4
  281. package/lib/tab-bar/index.js +9 -11
  282. package/lib/tab-bar/themes/solar/charcoal/index.js +1 -1
  283. package/lib/tab-bar/themes/solar/pearl/index.js +1 -1
  284. package/lib/text-field/custom-elements.json +78 -89
  285. package/lib/text-field/custom-elements.md +35 -0
  286. package/lib/text-field/index.d.ts +59 -79
  287. package/lib/text-field/index.js +99 -158
  288. package/lib/text-field/themes/solar/charcoal/index.js +1 -1
  289. package/lib/text-field/themes/solar/pearl/index.js +1 -1
  290. package/lib/time-picker/custom-elements.json +4 -4
  291. package/lib/time-picker/custom-elements.md +28 -0
  292. package/lib/time-picker/index.d.ts +7 -4
  293. package/lib/time-picker/index.js +15 -14
  294. package/lib/time-picker/themes/solar/charcoal/index.js +1 -1
  295. package/lib/time-picker/themes/solar/pearl/index.js +1 -1
  296. package/lib/toggle/custom-elements.json +4 -4
  297. package/lib/toggle/custom-elements.md +19 -0
  298. package/lib/toggle/index.d.ts +14 -4
  299. package/lib/toggle/index.js +31 -12
  300. package/lib/tooltip/custom-elements.md +14 -0
  301. package/lib/tooltip/elements/title-tooltip.js +2 -2
  302. package/lib/tooltip/elements/tooltip-element.d.ts +1 -1
  303. package/lib/tooltip/helpers/overflow-tooltip.d.ts +1 -1
  304. package/lib/tooltip/helpers/overflow-tooltip.js +1 -1
  305. package/lib/tooltip/helpers/renderer.d.ts +1 -1
  306. package/lib/tooltip/helpers/types.d.ts +1 -1
  307. package/lib/tooltip/index.d.ts +9 -9
  308. package/lib/tooltip/index.js +18 -20
  309. package/lib/tooltip/managers/tooltip-manager.d.ts +2 -2
  310. package/lib/tooltip/managers/tooltip-manager.js +3 -7
  311. package/lib/tornado-chart/custom-elements.md +18 -0
  312. package/lib/tornado-chart/elements/tornado-chart.d.ts +4 -4
  313. package/lib/tornado-chart/elements/tornado-chart.js +8 -11
  314. package/lib/tornado-chart/elements/tornado-item.d.ts +5 -5
  315. package/lib/tornado-chart/elements/tornado-item.js +10 -12
  316. package/lib/tornado-chart/index.d.ts +2 -2
  317. package/lib/tornado-chart/index.js +2 -2
  318. package/lib/tree/custom-elements.json +17 -3
  319. package/lib/tree/custom-elements.md +32 -0
  320. package/lib/tree/elements/tree-item.d.ts +4 -4
  321. package/lib/tree/elements/tree-item.js +10 -13
  322. package/lib/tree/elements/tree.d.ts +51 -5
  323. package/lib/tree/elements/tree.js +138 -11
  324. package/lib/tree/helpers/filter.d.ts +8 -0
  325. package/lib/tree/helpers/filter.js +33 -0
  326. package/lib/tree/helpers/renderer.d.ts +2 -2
  327. package/lib/tree/helpers/renderer.js +3 -3
  328. package/lib/tree/helpers/types.d.ts +9 -1
  329. package/lib/tree/index.d.ts +4 -4
  330. package/lib/tree/index.js +3 -3
  331. package/lib/tree/managers/tree-manager.d.ts +22 -10
  332. package/lib/tree/managers/tree-manager.js +56 -40
  333. package/lib/tree/themes/halo/dark/index.js +1 -1
  334. package/lib/tree/themes/halo/light/index.js +1 -1
  335. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  336. package/lib/tree/themes/solar/pearl/index.js +1 -1
  337. package/lib/tree-select/custom-elements.json +10 -6
  338. package/lib/tree-select/custom-elements.md +26 -0
  339. package/lib/tree-select/helpers/types.d.ts +2 -2
  340. package/lib/tree-select/index.d.ts +32 -28
  341. package/lib/tree-select/index.js +54 -44
  342. package/lib/tree-select/themes/halo/dark/index.js +1 -1
  343. package/lib/tree-select/themes/halo/light/index.js +1 -1
  344. package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
  345. package/lib/tree-select/themes/solar/pearl/index.js +1 -1
  346. package/lib/version.d.ts +1 -0
  347. package/lib/version.js +1 -0
  348. package/package.json +298 -15
  349. package/lib/autosuggest/helpers/const.d.ts +0 -2
  350. package/lib/autosuggest/helpers/const.js +0 -3
  351. package/lib/overlay-menu/helpers/uuid.d.ts +0 -7
  352. package/lib/overlay-menu/helpers/uuid.js +0 -13
@@ -1,6 +1,4 @@
1
1
  import { Phrasebook } from '@refinitiv-ui/phrasebook';
2
- import { DEFAULT_LOCALE, resolveLocale } from '@refinitiv-ui/i18n';
3
- import { utcParse } from '@refinitiv-ui/utils';
4
2
  // While Intl can support literally all world languages
5
3
  // for safety still limit the number of locales, for the following reasons
6
4
  // 1) different browsers and OS support different locales, and the result might be different.
@@ -40,105 +38,3 @@ Phrasebook.define('ru', scope, ru);
40
38
  Phrasebook.define('th', scope, th);
41
39
  Phrasebook.define('zh', scope, zh);
42
40
  Phrasebook.define('ar', scope, ar);
43
- const calendar = {
44
- // calendar property is not part of TypeScript Intl.DateTimeFormatOptions,
45
- // but is supported by all modern browsers and is required by Intl.DateTimeFormat polyfill
46
- calendar: 'gregory',
47
- timeZone: 'UTC'
48
- };
49
- /**
50
- * Custom formats for date formatting
51
- */
52
- const DateMessageFormats = {
53
- date: {
54
- calendarMonthEra: Object.assign(Object.assign({}, calendar), { month: 'long', year: 'numeric', era: 'short' }),
55
- calendarMonth: Object.assign(Object.assign({}, calendar), { month: 'long', year: 'numeric' }),
56
- calendarYearEra: Object.assign(Object.assign({}, calendar), { year: 'numeric', era: 'short' }),
57
- calendarYear: Object.assign(Object.assign({}, calendar), { year: 'numeric' })
58
- }
59
- };
60
- /**
61
- * Used to format views
62
- */
63
- const ViewFormatTranslateParams = {
64
- unicodeExtensions: {
65
- // while latest Chrome, FF and Intl.DateTimeFormat polyfill support
66
- // calendar option to format date,
67
- // older browsers as Safari and IE11 need this to be provided as
68
- // unicode extension, e.g. lang="th-u-ca-gregory"
69
- ca: 'gregory'
70
- },
71
- formats: DateMessageFormats
72
- };
73
- /**
74
- * Get locale based on provided locale and Phrasebook available locales
75
- * @param locale locale tag
76
- * @returns resolved locale
77
- */
78
- const getLocale = (locale) => {
79
- return resolveLocale(scope, locale) || DEFAULT_LOCALE;
80
- };
81
- /**
82
- * Get a list of weekday abbreviations based on locale
83
- * @param locale Locale
84
- * @param [width='short'] Day width
85
- * @returns The list of weekdays starting from Sunday
86
- */
87
- const weekdaysNames = (locale, width = 'narrow') => {
88
- locale = getLocale(locale);
89
- // we know that Jan 04 1970 is Sunday
90
- let day = 4;
91
- const date = utcParse({
92
- year: 1970,
93
- month: 0,
94
- day: day
95
- });
96
- const weekdays = [];
97
- while (day < 11) {
98
- weekdays.push(date.toLocaleDateString(locale, { weekday: width, timeZone: 'UTC' }));
99
- day += 1;
100
- date.setUTCDate(day);
101
- }
102
- return weekdays;
103
- };
104
- /**
105
- * Get a list of months based on locale
106
- * @param locale Locale
107
- * @param [width='short'] Month width
108
- * @returns The list of months starting from January
109
- */
110
- const monthsNames = (locale, width = 'short') => {
111
- locale = getLocale(locale);
112
- let month = 0;
113
- const date = utcParse({
114
- year: 1970,
115
- month,
116
- day: 1
117
- });
118
- const months = [];
119
- while (month < 12) {
120
- months.push(date.toLocaleDateString(locale, { month: width, timeZone: 'UTC' }));
121
- month += 1;
122
- date.setUTCMonth(month);
123
- }
124
- return months;
125
- };
126
- /**
127
- * @deprecated
128
- * Some old browsers (as IE11) do not support formatting of old dates before BC
129
- * Instead simply convert the date manually to match Translate function
130
- * @param date Date
131
- * @param locale locale
132
- * @param [includeMonth=false] true to include month
133
- * @param [includeEra=false] tru to include era descriptor
134
- * @returns formatted dates
135
- */
136
- const formatLocaleDate = (date, locale, includeMonth = false, includeEra = false) => {
137
- const monthNames = monthsNames(locale, 'long');
138
- locale = getLocale(locale);
139
- const year = date.getUTCFullYear();
140
- const month = date.getUTCMonth();
141
- // BC flags are not supported. Always use English
142
- return `${includeMonth ? `${monthNames[month]} ` : ''} ${year > 0 ? year : year === 0 ? '1' : Math.abs(year - 1)}${includeEra ? year <= 0 ? ' BC' : ' AD' : ''}`;
143
- };
144
- export { weekdaysNames, monthsNames, formatLocaleDate, ViewFormatTranslateParams };
@@ -1,8 +1,4 @@
1
- export declare enum RenderView {
2
- DAY = "day",
3
- MONTH = "month",
4
- YEAR = "year"
5
- }
1
+ import { RenderView } from './constants.js';
6
2
  export interface CellSelectionModel {
7
3
  selected?: boolean;
8
4
  range?: boolean;
@@ -1,6 +1 @@
1
- export var RenderView;
2
- (function (RenderView) {
3
- RenderView["DAY"] = "day";
4
- RenderView["MONTH"] = "month";
5
- RenderView["YEAR"] = "year";
6
- })(RenderView || (RenderView = {}));
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import { TranslateParams } from '@refinitiv-ui/i18n';
1
2
  export declare type MonthInfo = {
2
3
  days: number;
3
4
  month: number;
@@ -9,4 +10,33 @@ export declare type MonthInfo = {
9
10
  * @returns Month information object
10
11
  */
11
12
  declare const monthInfo: (value: string) => MonthInfo;
12
- export { monthInfo };
13
+ /**
14
+ * Get a list of weekday abbreviations based on locale
15
+ * @param locale Locale
16
+ * @param [width='short'] Day width
17
+ * @returns The list of weekdays starting from Sunday
18
+ */
19
+ declare const weekdaysNames: (locale: string, width?: Intl.DateTimeFormatOptions['weekday']) => string[];
20
+ /**
21
+ * Get a list of months based on locale
22
+ * @param locale Locale
23
+ * @param [width='short'] Month width
24
+ * @returns The list of months starting from January
25
+ */
26
+ declare const monthsNames: (locale: string, width?: Intl.DateTimeFormatOptions['month']) => string[];
27
+ /**
28
+ * @deprecated
29
+ * Some old browsers (as IE11) do not support formatting of old dates before BC
30
+ * Instead simply convert the date manually to match Translate function
31
+ * @param date Date
32
+ * @param locale locale
33
+ * @param [includeMonth=false] true to include month
34
+ * @param [includeEra=false] tru to include era descriptor
35
+ * @returns formatted dates
36
+ */
37
+ declare const formatLocaleDate: (date: Date, locale: string, includeMonth?: boolean, includeEra?: boolean) => string;
38
+ /**
39
+ * Used to format views
40
+ */
41
+ declare const ViewFormatTranslateParams: TranslateParams;
42
+ export { monthInfo, weekdaysNames, monthsNames, formatLocaleDate, ViewFormatTranslateParams };
@@ -1,4 +1,5 @@
1
- import { toDateSegment, getDaysInMonth } from '@refinitiv-ui/utils';
1
+ import { toDateSegment, getDaysInMonth, utcParse } from '@refinitiv-ui/utils/lib/date.js';
2
+ import { DEFAULT_LOCALE, resolveLocale } from '@refinitiv-ui/i18n';
2
3
  /**
3
4
  * Get information about number of days, month number and year from date object
4
5
  * @param value Date string
@@ -14,4 +15,105 @@ const monthInfo = (value) => {
14
15
  year
15
16
  };
16
17
  };
17
- export { monthInfo };
18
+ const calendar = {
19
+ // calendar property is not part of TypeScript Intl.DateTimeFormatOptions,
20
+ // but is supported by all modern browsers and is required by Intl.DateTimeFormat polyfill
21
+ calendar: 'gregory',
22
+ timeZone: 'UTC'
23
+ };
24
+ /**
25
+ * Custom formats for date formatting
26
+ */
27
+ const DateMessageFormats = {
28
+ date: {
29
+ calendarMonthEra: Object.assign(Object.assign({}, calendar), { month: 'long', year: 'numeric', era: 'short' }),
30
+ calendarMonth: Object.assign(Object.assign({}, calendar), { month: 'long', year: 'numeric' }),
31
+ calendarYearEra: Object.assign(Object.assign({}, calendar), { year: 'numeric', era: 'short' }),
32
+ calendarYear: Object.assign(Object.assign({}, calendar), { year: 'numeric' })
33
+ }
34
+ };
35
+ /**
36
+ * Get locale based on provided locale and Phrasebook available locales
37
+ * @param locale locale tag
38
+ * @returns resolved locale
39
+ */
40
+ const getLocale = (locale) => {
41
+ return resolveLocale('ef-calendar', locale) || DEFAULT_LOCALE;
42
+ };
43
+ /**
44
+ * Get a list of weekday abbreviations based on locale
45
+ * @param locale Locale
46
+ * @param [width='short'] Day width
47
+ * @returns The list of weekdays starting from Sunday
48
+ */
49
+ const weekdaysNames = (locale, width = 'narrow') => {
50
+ locale = getLocale(locale);
51
+ // we know that Jan 04 1970 is Sunday
52
+ let day = 4;
53
+ const date = utcParse({
54
+ year: 1970,
55
+ month: 0,
56
+ day: day
57
+ });
58
+ const weekdays = [];
59
+ while (day < 11) {
60
+ weekdays.push(date.toLocaleDateString(locale, { weekday: width, timeZone: 'UTC' }));
61
+ day += 1;
62
+ date.setUTCDate(day);
63
+ }
64
+ return weekdays;
65
+ };
66
+ /**
67
+ * Get a list of months based on locale
68
+ * @param locale Locale
69
+ * @param [width='short'] Month width
70
+ * @returns The list of months starting from January
71
+ */
72
+ const monthsNames = (locale, width = 'short') => {
73
+ locale = getLocale(locale);
74
+ let month = 0;
75
+ const date = utcParse({
76
+ year: 1970,
77
+ month,
78
+ day: 1
79
+ });
80
+ const months = [];
81
+ while (month < 12) {
82
+ months.push(date.toLocaleDateString(locale, { month: width, timeZone: 'UTC' }));
83
+ month += 1;
84
+ date.setUTCMonth(month);
85
+ }
86
+ return months;
87
+ };
88
+ /**
89
+ * @deprecated
90
+ * Some old browsers (as IE11) do not support formatting of old dates before BC
91
+ * Instead simply convert the date manually to match Translate function
92
+ * @param date Date
93
+ * @param locale locale
94
+ * @param [includeMonth=false] true to include month
95
+ * @param [includeEra=false] tru to include era descriptor
96
+ * @returns formatted dates
97
+ */
98
+ const formatLocaleDate = (date, locale, includeMonth = false, includeEra = false) => {
99
+ locale = getLocale(locale);
100
+ const monthNames = monthsNames(locale, 'long');
101
+ const year = date.getUTCFullYear();
102
+ const month = date.getUTCMonth();
103
+ // BC flags are not supported. Always use English
104
+ return `${includeMonth ? `${monthNames[month]} ` : ''} ${year > 0 ? year : year === 0 ? '1' : Math.abs(year - 1)}${includeEra ? year <= 0 ? ' BC' : ' AD' : ''}`;
105
+ };
106
+ /**
107
+ * Used to format views
108
+ */
109
+ const ViewFormatTranslateParams = {
110
+ unicodeExtensions: {
111
+ // while latest Chrome, FF and Intl.DateTimeFormat polyfill support
112
+ // calendar option to format date,
113
+ // older browsers as Safari and IE11 need this to be provided as
114
+ // unicode extension, e.g. lang="th-u-ca-gregory"
115
+ ca: 'gregory'
116
+ },
117
+ formats: DateMessageFormats
118
+ };
119
+ export { monthInfo, weekdaysNames, monthsNames, formatLocaleDate, ViewFormatTranslateParams };
@@ -8,7 +8,8 @@
8
8
  {
9
9
  "name": "autoloop",
10
10
  "description": "Starts an automatic animation loop.\nEnabling the frame event.",
11
- "type": "boolean"
11
+ "type": "boolean",
12
+ "default": "false"
12
13
  }
13
14
  ],
14
15
  "properties": [
@@ -16,20 +17,21 @@
16
17
  "name": "autoloop",
17
18
  "attribute": "autoloop",
18
19
  "description": "Starts an automatic animation loop.\nEnabling the frame event.",
19
- "type": "boolean"
20
+ "type": "boolean",
21
+ "default": "false"
20
22
  },
21
23
  {
22
- "name": "canvas",
24
+ "name": "canvas (readonly)",
23
25
  "description": "Html canvas element",
24
26
  "type": "HTMLCanvasElement"
25
27
  },
26
28
  {
27
- "name": "ctx",
29
+ "name": "ctx (readonly)",
28
30
  "description": "Alias of context",
29
31
  "type": "CanvasRenderingContext2D | null"
30
32
  },
31
33
  {
32
- "name": "context",
34
+ "name": "context (readonly)",
33
35
  "description": "The 2 dimensional context of the canvas, used for drawing",
34
36
  "type": "CanvasRenderingContext2D | null"
35
37
  },
@@ -0,0 +1,27 @@
1
+ # ef-canvas
2
+
3
+ A Component uses to draw graphics on a web page,
4
+ it works similarly to the normal HTML5 Canvas element.
5
+
6
+ ## Properties
7
+
8
+ | Property | Attribute | Type | Default | Description |
9
+ |----------------------|------------|------------------------------------|---------|--------------------------------------------------|
10
+ | `autoloop` | `autoloop` | `boolean` | false | Starts an automatic animation loop.<br />Enabling the frame event. |
11
+ | `canvas (readonly)` | | `HTMLCanvasElement` | | Html canvas element |
12
+ | `context (readonly)` | | `CanvasRenderingContext2D \| null` | | The 2 dimensional context of the canvas, used for drawing |
13
+ | `ctx (readonly)` | | `CanvasRenderingContext2D \| null` | | Alias of context |
14
+ | `height` | | `number` | 0 | Height of canvas |
15
+ | `width` | | `number` | 0 | Width of canvas |
16
+
17
+ ## Methods
18
+
19
+ | Method | Type | Description |
20
+ |--------------|--------------------------|--------------------------------------------------|
21
+ | `getContext` | `(mode: string): string` | Return context of canvas,<br />support only 2D mode<br /><br />**mode**: mode of canvas's context |
22
+
23
+ ## Events
24
+
25
+ | Event | Description |
26
+ |---------|--------------------------------------------------|
27
+ | `frame` | dispatched when next Frame event occurs when autoloop is set to true |
@@ -1,5 +1,5 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { ResponsiveElement, TemplateResult, CSSResult, ElementSize } from '@refinitiv-ui/core';
2
+ import { ResponsiveElement, TemplateResult, CSSResultGroup, ElementSize } from '@refinitiv-ui/core';
3
3
  /**
4
4
  * A Component uses to draw graphics on a web page,
5
5
  * it works similarly to the normal HTML5 Canvas element.
@@ -12,12 +12,12 @@ export declare class Canvas extends ResponsiveElement {
12
12
  */
13
13
  static get version(): string;
14
14
  /**
15
- * A `CSSResult` that will be used
15
+ * A `CSSResultGroup` that will be used
16
16
  * to style the host, slotted children
17
17
  * and the internal template of the element.
18
18
  * @return CSS template
19
19
  */
20
- static get styles(): CSSResult;
20
+ static get styles(): CSSResultGroup;
21
21
  width: number;
22
22
  height: number;
23
23
  private frameId;
@@ -26,6 +26,7 @@ export declare class Canvas extends ResponsiveElement {
26
26
  /**
27
27
  * Starts an automatic animation loop.
28
28
  * Enabling the frame event.
29
+ * @default false
29
30
  */
30
31
  get autoloop(): boolean;
31
32
  set autoloop(val: boolean);
@@ -1,11 +1,8 @@
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 { ResponsiveElement, html, css, customElement, property } from '@refinitiv-ui/core';
8
- import { VERSION } from '../';
1
+ import { __decorate } from "tslib";
2
+ import { ResponsiveElement, html, css } 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 { VERSION } from '../version.js';
9
6
  /**
10
7
  * A Component uses to draw graphics on a web page,
11
8
  * it works similarly to the normal HTML5 Canvas element.
@@ -27,7 +24,7 @@ let Canvas = class Canvas extends ResponsiveElement {
27
24
  return VERSION;
28
25
  }
29
26
  /**
30
- * A `CSSResult` that will be used
27
+ * A `CSSResultGroup` that will be used
31
28
  * to style the host, slotted children
32
29
  * and the internal template of the element.
33
30
  * @return CSS template
@@ -51,6 +48,7 @@ let Canvas = class Canvas extends ResponsiveElement {
51
48
  /**
52
49
  * Starts an automatic animation loop.
53
50
  * Enabling the frame event.
51
+ * @default false
54
52
  */
55
53
  get autoloop() {
56
54
  return this._autoloop;
@@ -58,7 +56,7 @@ let Canvas = class Canvas extends ResponsiveElement {
58
56
  set autoloop(val) {
59
57
  const oldValue = this._autoloop;
60
58
  this._autoloop = val;
61
- void this.requestUpdate('autoloop', oldValue);
59
+ this.requestUpdate('autoloop', oldValue);
62
60
  this.loop();
63
61
  }
64
62
  /**
@@ -35,7 +35,9 @@
35
35
  },
36
36
  {
37
37
  "name": "config",
38
- "description": "Set card configurations"
38
+ "description": "Set card configurations",
39
+ "type": "CardConfig",
40
+ "default": "{}"
39
41
  }
40
42
  ],
41
43
  "events": [
@@ -0,0 +1,24 @@
1
+ # ef-card
2
+
3
+ A card frame component.
4
+
5
+ ## Properties
6
+
7
+ | Property | Attribute | Type | Default | Description |
8
+ |----------|-----------|--------------|---------|-------------------------|
9
+ | `config` | | `CardConfig` | {} | Set card configurations |
10
+ | `footer` | `footer` | `string` | "" | Set text on the footer |
11
+ | `header` | `header` | `string` | "" | Set text on the header |
12
+
13
+ ## Events
14
+
15
+ | Event | Description |
16
+ |----------------|-----------------------------------|
17
+ | `item-trigger` | Fired when card menu is selected. |
18
+
19
+ ## Slots
20
+
21
+ | Name | Description |
22
+ |----------|--------------------------------------------------|
23
+ | `footer` | Adds slotted content into the footer of the card. |
24
+ | `header` | Adds slotted content into the header of the card. |
@@ -1,4 +1,4 @@
1
- import { OverlayMenuData } from '../../overlay-menu';
1
+ import type { OverlayMenuData } from '../../overlay-menu';
2
2
  export declare type CardConfig = {
3
3
  /**
4
4
  * Configuration for side menu
@@ -1,10 +1,10 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { BasicElement, TemplateResult, CSSResult, PropertyValues } from '@refinitiv-ui/core';
3
- import '../label';
4
- import '../button';
5
- import '../overlay-menu';
6
- import { CardConfig } from './helpers/types';
7
- export { CardConfig };
2
+ import { BasicElement, TemplateResult, CSSResultGroup, PropertyValues } from '@refinitiv-ui/core';
3
+ import type { CardConfig } from './helpers/types';
4
+ import '../label/index.js';
5
+ import '../button/index.js';
6
+ import '../overlay-menu/index.js';
7
+ export type { CardConfig };
8
8
  /**
9
9
  * A card frame component.
10
10
  *
@@ -20,12 +20,12 @@ export declare class Card extends BasicElement {
20
20
  */
21
21
  static get version(): string;
22
22
  /**
23
- * A `CSSResult` that will be used
23
+ * A `CSSResultGroup` that will be used
24
24
  * to style the host, slotted children
25
25
  * and the internal template of the element.
26
26
  * @returns CSS template
27
27
  */
28
- static get styles(): CSSResult | CSSResult[];
28
+ static get styles(): CSSResultGroup;
29
29
  private _config;
30
30
  /**
31
31
  * Set text on the header
@@ -37,6 +37,8 @@ export declare class Card extends BasicElement {
37
37
  footer: string;
38
38
  /**
39
39
  * Set card configurations
40
+ * @type {CardConfig}
41
+ * @default {}
40
42
  */
41
43
  get config(): CardConfig;
42
44
  set config(config: CardConfig);
package/lib/card/index.js CHANGED
@@ -1,15 +1,14 @@
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, state } from '@refinitiv-ui/core';
8
- import { isSlotEmpty } from '@refinitiv-ui/utils';
9
- import '../label';
10
- import '../button';
11
- import '../overlay-menu';
12
- import { VERSION } from '../';
1
+ import { __decorate } from "tslib";
2
+ import { BasicElement, html, css } 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 { query } from '@refinitiv-ui/core/lib/decorators/query.js';
6
+ import { state } from '@refinitiv-ui/core/lib/decorators/state.js';
7
+ import { VERSION } from '../version.js';
8
+ import { isSlotEmpty } from '@refinitiv-ui/utils/lib/is-slot-empty.js';
9
+ import '../label/index.js';
10
+ import '../button/index.js';
11
+ import '../overlay-menu/index.js';
13
12
  /**
14
13
  * A card frame component.
15
14
  *
@@ -47,7 +46,7 @@ let Card = class Card extends BasicElement {
47
46
  return VERSION;
48
47
  }
49
48
  /**
50
- * A `CSSResult` that will be used
49
+ * A `CSSResultGroup` that will be used
51
50
  * to style the host, slotted children
52
51
  * and the internal template of the element.
53
52
  * @returns CSS template
@@ -72,6 +71,8 @@ let Card = class Card extends BasicElement {
72
71
  }
73
72
  /**
74
73
  * Set card configurations
74
+ * @type {CardConfig}
75
+ * @default {}
75
76
  */
76
77
  get config() {
77
78
  return this._config;
@@ -19,7 +19,7 @@
19
19
  "type": "ChartConfig"
20
20
  },
21
21
  {
22
- "name": "colors",
22
+ "name": "colors (readonly)",
23
23
  "description": "List of available chart colors",
24
24
  "type": "string[]"
25
25
  }
@@ -0,0 +1,16 @@
1
+ # ef-chart
2
+
3
+ Charting component that use ChartJS library
4
+
5
+ ## Properties
6
+
7
+ | Property | Attribute | Type | Default | Description |
8
+ |---------------------|-----------|---------------|---------|--------------------------------------------------|
9
+ | `colors (readonly)` | | `string[]` | | List of available chart colors |
10
+ | `config` | `config` | `ChartConfig` | null | Chart configurations. Same configuration as ChartJS |
11
+
12
+ ## Methods
13
+
14
+ | Method | Type | Description |
15
+ |---------------|--------------------------------------|--------------------------------------------------|
16
+ | `updateChart` | `(config?: ChartUpdateProps=): void` | Update all data, title, scales, legends and re-render the chart based on its config<br /><br />**config**: Additional configuration for control an animation in the update process. |
@@ -1,2 +1,2 @@
1
- export * from './legend';
2
- export * from './merge';
1
+ export * from './legend.js';
2
+ export * from './merge.js';
@@ -1,2 +1,2 @@
1
- export * from './legend';
2
- export * from './merge';
1
+ export * from './legend.js';
2
+ export * from './merge.js';
@@ -1,11 +1,11 @@
1
1
  import { JSXInterface } from '../jsx';
2
2
  /// <reference types="chart.js" />
3
- import { BasicElement, PropertyValues, TemplateResult, CSSResult } from '@refinitiv-ui/core';
3
+ import { BasicElement, PropertyValues, TemplateResult, CSSResultGroup } from '@refinitiv-ui/core';
4
4
  import 'chart.js/dist/Chart.bundle.min.js';
5
- import { Header } from '../header';
6
- import '../header';
7
- import '../layout';
8
5
  import type { ChartJS, ChartConfig, ChartUpdateProps, DatasetColors } from './helpers/types';
6
+ import type { Header } from '../header';
7
+ import '../header/index.js';
8
+ import '../layout/index.js';
9
9
  declare global {
10
10
  interface Window {
11
11
  Chart: ChartJS;
@@ -153,12 +153,12 @@ export declare class Chart extends BasicElement {
153
153
  */
154
154
  updateChart(config?: ChartUpdateProps): void;
155
155
  /**
156
- * A `CSSResult` that will be used
156
+ * A `CSSResultGroup` that will be used
157
157
  * to style the host, slotted children
158
158
  * and the internal template of the element.
159
159
  * @return CSS template
160
160
  */
161
- static get styles(): CSSResult | CSSResult[];
161
+ static get styles(): CSSResultGroup;
162
162
  /**
163
163
  * Handles resize event of the chart region
164
164
  * @returns {void}