@refinitiv-ui/elements 7.0.0 → 7.0.2

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 (215) hide show
  1. package/CHANGELOG.md +195 -449
  2. package/LICENSE +2 -2
  3. package/README.md +12 -10
  4. package/cli.mjs +5 -3
  5. package/lib/accordion/index.d.ts +1 -1
  6. package/lib/accordion/index.js +4 -7
  7. package/lib/appstate-bar/index.d.ts +2 -2
  8. package/lib/appstate-bar/index.js +10 -4
  9. package/lib/autosuggest/index.d.ts +7 -7
  10. package/lib/autosuggest/index.js +80 -80
  11. package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
  12. package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
  13. package/lib/button/index.js +7 -10
  14. package/lib/button-bar/index.d.ts +1 -1
  15. package/lib/button-bar/index.js +12 -12
  16. package/lib/calendar/index.d.ts +39 -39
  17. package/lib/calendar/index.js +156 -123
  18. package/lib/calendar/utils.js +1 -1
  19. package/lib/canvas/index.d.ts +1 -1
  20. package/lib/canvas/index.js +2 -4
  21. package/lib/card/helpers/types.d.ts +2 -2
  22. package/lib/card/index.d.ts +5 -5
  23. package/lib/card/index.js +34 -28
  24. package/lib/chart/elements/chart.d.ts +4 -4
  25. package/lib/chart/elements/chart.js +39 -33
  26. package/lib/chart/plugins/doughnut-center-label.d.ts +3 -3
  27. package/lib/chart/plugins/doughnut-center-label.js +13 -9
  28. package/lib/checkbox/index.d.ts +1 -1
  29. package/lib/checkbox/index.js +12 -13
  30. package/lib/clock/index.d.ts +55 -55
  31. package/lib/clock/index.js +84 -95
  32. package/lib/clock/themes/halo/dark/index.js +1 -1
  33. package/lib/clock/themes/halo/light/index.js +1 -1
  34. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  35. package/lib/clock/themes/solar/pearl/index.js +1 -1
  36. package/lib/collapse/index.d.ts +1 -1
  37. package/lib/collapse/index.js +27 -18
  38. package/lib/collapse/themes/halo/dark/index.js +1 -1
  39. package/lib/collapse/themes/halo/light/index.js +1 -1
  40. package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
  41. package/lib/color-dialog/elements/color-palettes.js +5 -6
  42. package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
  43. package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
  44. package/lib/color-dialog/elements/palettes.js +5 -4
  45. package/lib/color-dialog/helpers/value-model.js +7 -9
  46. package/lib/color-dialog/index.d.ts +6 -6
  47. package/lib/color-dialog/index.js +53 -37
  48. package/lib/color-picker/index.d.ts +2 -2
  49. package/lib/color-picker/index.js +40 -34
  50. package/lib/combo-box/helpers/filter.d.ts +2 -2
  51. package/lib/combo-box/helpers/types.d.ts +1 -1
  52. package/lib/combo-box/index.d.ts +9 -9
  53. package/lib/combo-box/index.js +61 -55
  54. package/lib/configuration/elements/configuration.js +2 -2
  55. package/lib/counter/index.d.ts +4 -4
  56. package/lib/counter/index.js +9 -7
  57. package/lib/datetime-field/index.d.ts +4 -5
  58. package/lib/datetime-field/index.js +32 -23
  59. package/lib/datetime-field/utils.js +11 -1
  60. package/lib/datetime-picker/index.d.ts +75 -75
  61. package/lib/datetime-picker/index.js +150 -131
  62. package/lib/datetime-picker/locales.js +5 -5
  63. package/lib/datetime-picker/utils.js +9 -9
  64. package/lib/dialog/draggable-element.js +1 -2
  65. package/lib/dialog/index.d.ts +5 -5
  66. package/lib/dialog/index.js +51 -47
  67. package/lib/email-field/index.d.ts +1 -1
  68. package/lib/email-field/index.js +6 -6
  69. package/lib/events.d.ts +1 -1
  70. package/lib/flag/index.d.ts +1 -1
  71. package/lib/flag/index.js +6 -5
  72. package/lib/flag/utils/FlagLoader.js +1 -1
  73. package/lib/header/index.d.ts +1 -1
  74. package/lib/header/index.js +2 -2
  75. package/lib/header/themes/halo/dark/index.js +1 -1
  76. package/lib/header/themes/halo/light/index.js +1 -1
  77. package/lib/header/themes/solar/charcoal/index.js +1 -1
  78. package/lib/header/themes/solar/pearl/index.js +1 -1
  79. package/lib/heatmap/helpers/color.d.ts +1 -1
  80. package/lib/heatmap/helpers/color.js +11 -5
  81. package/lib/heatmap/helpers/track.js +3 -3
  82. package/lib/heatmap/index.d.ts +9 -9
  83. package/lib/heatmap/index.js +51 -42
  84. package/lib/icon/index.d.ts +2 -2
  85. package/lib/icon/index.js +8 -10
  86. package/lib/interactive-chart/helpers/types.d.ts +3 -3
  87. package/lib/interactive-chart/index.d.ts +29 -29
  88. package/lib/interactive-chart/index.js +69 -55
  89. package/lib/item/helpers/types.d.ts +1 -1
  90. package/lib/item/index.d.ts +3 -3
  91. package/lib/item/index.js +24 -20
  92. package/lib/jsx.d.ts +6 -4
  93. package/lib/label/index.d.ts +1 -1
  94. package/lib/label/index.js +10 -7
  95. package/lib/layout/index.d.ts +7 -7
  96. package/lib/layout/index.js +7 -7
  97. package/lib/led-gauge/index.d.ts +1 -1
  98. package/lib/led-gauge/index.js +10 -10
  99. package/lib/list/elements/list.d.ts +3 -3
  100. package/lib/list/elements/list.js +10 -12
  101. package/lib/list/helpers/renderer.js +2 -2
  102. package/lib/list/helpers/types.d.ts +1 -1
  103. package/lib/list/index.d.ts +1 -1
  104. package/lib/list/renderer.d.ts +7 -7
  105. package/lib/loader/index.js +7 -8
  106. package/lib/multi-input/index.d.ts +6 -6
  107. package/lib/multi-input/index.js +39 -45
  108. package/lib/notification/elements/notification-tray.d.ts +2 -2
  109. package/lib/notification/elements/notification-tray.js +3 -3
  110. package/lib/notification/elements/notification.d.ts +2 -2
  111. package/lib/notification/elements/notification.js +14 -13
  112. package/lib/notification/helpers/status.js +1 -1
  113. package/lib/notification/themes/halo/dark/index.js +1 -1
  114. package/lib/notification/themes/halo/light/index.js +1 -1
  115. package/lib/notification/themes/solar/charcoal/index.js +1 -1
  116. package/lib/notification/themes/solar/pearl/index.js +1 -1
  117. package/lib/number-field/index.d.ts +5 -6
  118. package/lib/number-field/index.js +37 -47
  119. package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
  120. package/lib/overlay/elements/overlay.d.ts +2 -2
  121. package/lib/overlay/elements/overlay.js +152 -96
  122. package/lib/overlay/helpers/types.d.ts +1 -1
  123. package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
  124. package/lib/overlay/managers/backdrop-manager.js +2 -2
  125. package/lib/overlay/managers/close-manager.js +2 -1
  126. package/lib/overlay/managers/focus-manager.js +23 -13
  127. package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
  128. package/lib/overlay/managers/interaction-lock-manager.js +33 -25
  129. package/lib/overlay/managers/viewport-manager.d.ts +2 -2
  130. package/lib/overlay/managers/viewport-manager.js +3 -2
  131. package/lib/overlay/managers/zindex-manager.js +4 -2
  132. package/lib/overlay-menu/helpers/types.d.ts +2 -2
  133. package/lib/overlay-menu/index.d.ts +1 -1
  134. package/lib/overlay-menu/index.js +44 -33
  135. package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
  136. package/lib/overlay-menu/managers/menu-manager.js +14 -13
  137. package/lib/pagination/index.d.ts +4 -4
  138. package/lib/pagination/index.js +39 -14
  139. package/lib/panel/index.js +1 -1
  140. package/lib/password-field/index.d.ts +2 -2
  141. package/lib/password-field/index.js +3 -3
  142. package/lib/pill/index.d.ts +1 -1
  143. package/lib/pill/index.js +22 -19
  144. package/lib/progress-bar/index.d.ts +1 -1
  145. package/lib/progress-bar/index.js +38 -37
  146. package/lib/radio-button/index.d.ts +2 -2
  147. package/lib/radio-button/index.js +17 -12
  148. package/lib/radio-button/radio-button-registry.js +8 -5
  149. package/lib/rating/index.d.ts +1 -1
  150. package/lib/rating/index.js +2 -5
  151. package/lib/rating/utils.d.ts +6 -6
  152. package/lib/rating/utils.js +6 -6
  153. package/lib/search-field/index.d.ts +2 -2
  154. package/lib/search-field/index.js +4 -4
  155. package/lib/select/index.d.ts +34 -34
  156. package/lib/select/index.js +68 -81
  157. package/lib/sidebar-layout/index.d.ts +2 -2
  158. package/lib/sidebar-layout/index.js +7 -9
  159. package/lib/slider/index.d.ts +2 -2
  160. package/lib/slider/index.js +57 -45
  161. package/lib/slider/utils.d.ts +10 -10
  162. package/lib/slider/utils.js +10 -10
  163. package/lib/sparkline/index.d.ts +1 -1
  164. package/lib/sparkline/index.js +7 -8
  165. package/lib/swing-gauge/helpers.js +2 -2
  166. package/lib/swing-gauge/index.d.ts +19 -19
  167. package/lib/swing-gauge/index.js +91 -81
  168. package/lib/tab/index.d.ts +1 -1
  169. package/lib/tab/index.js +16 -27
  170. package/lib/tab/themes/halo/dark/index.js +1 -1
  171. package/lib/tab/themes/halo/light/index.js +1 -1
  172. package/lib/tab/themes/solar/charcoal/index.js +1 -1
  173. package/lib/tab/themes/solar/pearl/index.js +1 -1
  174. package/lib/tab-bar/helpers/animate.js +1 -1
  175. package/lib/tab-bar/index.d.ts +1 -1
  176. package/lib/tab-bar/index.js +34 -18
  177. package/lib/tab-bar/themes/halo/dark/index.js +1 -1
  178. package/lib/tab-bar/themes/halo/light/index.js +1 -1
  179. package/lib/text-field/index.d.ts +1 -1
  180. package/lib/text-field/index.js +34 -31
  181. package/lib/time-picker/index.d.ts +6 -6
  182. package/lib/time-picker/index.js +103 -89
  183. package/lib/toggle/index.d.ts +1 -1
  184. package/lib/toggle/index.js +4 -3
  185. package/lib/toggle/themes/halo/dark/index.js +1 -1
  186. package/lib/toggle/themes/halo/light/index.js +1 -1
  187. package/lib/toggle/themes/solar/charcoal/index.js +1 -1
  188. package/lib/toggle/themes/solar/pearl/index.js +1 -1
  189. package/lib/tooltip/elements/title-tooltip.js +2 -2
  190. package/lib/tooltip/index.d.ts +27 -27
  191. package/lib/tooltip/index.js +42 -38
  192. package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
  193. package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
  194. package/lib/tornado-chart/elements/tornado-chart.js +2 -2
  195. package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
  196. package/lib/tornado-chart/elements/tornado-item.js +12 -10
  197. package/lib/tree/elements/tree-item.d.ts +3 -3
  198. package/lib/tree/elements/tree-item.js +21 -19
  199. package/lib/tree/elements/tree.d.ts +1 -1
  200. package/lib/tree/elements/tree.js +12 -11
  201. package/lib/tree/helpers/renderer.js +4 -3
  202. package/lib/tree/index.d.ts +1 -1
  203. package/lib/tree/managers/tree-manager.d.ts +1 -1
  204. package/lib/tree/managers/tree-manager.js +17 -18
  205. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  206. package/lib/tree/themes/solar/pearl/index.js +1 -1
  207. package/lib/tree-select/index.d.ts +9 -9
  208. package/lib/tree-select/index.js +91 -82
  209. package/lib/tree-select/themes/halo/dark/index.js +1 -1
  210. package/lib/tree-select/themes/halo/light/index.js +1 -1
  211. package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
  212. package/lib/tree-select/themes/solar/pearl/index.js +1 -1
  213. package/lib/version.js +1 -1
  214. package/package.json +17 -17
  215. package/tsconfig.tsbuildinfo +1 -1
@@ -1,20 +1,20 @@
1
1
  import { __decorate } from "tslib";
2
- import { ControlElement, html, css, nothing, WarningNotice } from '@refinitiv-ui/core';
2
+ import { ControlElement, WarningNotice, css, html, nothing } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { state } from '@refinitiv-ui/core/decorators/state.js';
6
6
  import { cache } from '@refinitiv-ui/core/directives/cache.js';
7
7
  import { guard } from '@refinitiv-ui/core/directives/guard.js';
8
- import { ref, createRef } from '@refinitiv-ui/core/directives/ref.js';
8
+ import { createRef, ref } from '@refinitiv-ui/core/directives/ref.js';
9
+ import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
10
+ import { TranslatePropertyKey, getLocale, translate } from '@refinitiv-ui/translate';
11
+ import { DateFormat, addMonths, format, isAfter, isBefore, isSameDay, isSameMonth, isSameYear, isThisMonth, isThisYear, isToday, isValidDate, isWeekend, parse, subMonths, toDateSegment, utcFormat, utcParse } from '@refinitiv-ui/utils/date.js';
12
+ import { down, first, last, left, right, up } from '@refinitiv-ui/utils/navigation.js';
13
+ import '../button/index.js';
9
14
  import { VERSION } from '../version.js';
10
- import { DateFormat, format, utcFormat, utcParse, isValidDate, isWeekend, isAfter, isBefore, addMonths, subMonths, isToday, isThisMonth, isThisYear, isSameDay, isSameMonth, isSameYear, toDateSegment, parse } from '@refinitiv-ui/utils/date.js';
11
- import { left, right, up, down, first, last } from '@refinitiv-ui/utils/navigation.js';
12
- import { monthInfo, weekdaysNames, monthsNames, ViewFormatTranslateParams } from './utils.js';
13
- import { translate, getLocale, TranslatePropertyKey } from '@refinitiv-ui/translate';
14
- import { RenderView, CalendarLocaleScope, FIRST_DAY_OF_WEEK, YEARS_PER_YEAR_VIEW, DAY_VIEW, YEAR_VIEW, MONTH_VIEW } from './constants.js';
15
+ import { CalendarLocaleScope, DAY_VIEW, FIRST_DAY_OF_WEEK, MONTH_VIEW, RenderView, YEARS_PER_YEAR_VIEW, YEAR_VIEW } from './constants.js';
15
16
  import './locales.js';
16
- import '../button/index.js';
17
- import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
17
+ import { ViewFormatTranslateParams, monthInfo, monthsNames, weekdaysNames } from './utils.js';
18
18
  /**
19
19
  * Standard calendar element
20
20
  *
@@ -40,28 +40,28 @@ let Calendar = class Calendar extends ControlElement {
40
40
  this._min = '';
41
41
  this._max = '';
42
42
  /**
43
- * Only enable weekdays
44
- */
43
+ * Only enable weekdays
44
+ */
45
45
  this.weekdaysOnly = false;
46
46
  /**
47
- * Only enable weekends
48
- */
47
+ * Only enable weekends
48
+ */
49
49
  this.weekendsOnly = false;
50
50
  /**
51
- * Custom filter, used for enabling/disabling certain dates
52
- * @type {CalendarFilter | null}
53
- */
51
+ * Custom filter, used for enabling/disabling certain dates
52
+ * @type {CalendarFilter | null}
53
+ */
54
54
  this.filter = null;
55
55
  this._view = '';
56
56
  this.localFirstDayOfWeek = FIRST_DAY_OF_WEEK; // used from locales. 0 stands for Sunday
57
57
  this._firstDayOfWeek = null; // used from setter
58
58
  /**
59
- * Set to switch to range select mode
60
- */
59
+ * Set to switch to range select mode
60
+ */
61
61
  this.range = false;
62
62
  /**
63
- * Set to switch to multiple select mode
64
- */
63
+ * Set to switch to multiple select mode
64
+ */
65
65
  this.multiple = false;
66
66
  this._values = [];
67
67
  /**
@@ -104,19 +104,20 @@ let Calendar = class Calendar extends ControlElement {
104
104
  :host {
105
105
  display: inline-block;
106
106
  }
107
- [part~=navigation], [part~=navigation] section {
107
+ [part~='navigation'],
108
+ [part~='navigation'] section {
108
109
  display: flex;
109
110
  flex-flow: row nowrap;
110
111
  }
111
- [part~=navigation] {
112
+ [part~='navigation'] {
112
113
  justify-content: space-between;
113
114
  }
114
- [part~=navigation] > div {
115
+ [part~='navigation'] > div {
115
116
  display: flex;
116
117
  flex: 1;
117
118
  justify-content: center;
118
119
  }
119
- [part~=cell-content] {
120
+ [part~='cell-content'] {
120
121
  position: absolute;
121
122
  top: 0;
122
123
  bottom: 0;
@@ -126,44 +127,45 @@ let Calendar = class Calendar extends ControlElement {
126
127
  align-items: center;
127
128
  justify-content: center;
128
129
  }
129
- [part=navigation] [part] {
130
+ [part='navigation'] [part] {
130
131
  flex: none;
131
132
  }
132
- [part=table] {
133
+ [part='table'] {
133
134
  width: 100%;
134
135
  }
135
- [part~=row] {
136
+ [part~='row'] {
136
137
  display: flex;
137
138
  width: 100%;
138
139
  }
139
- [part~=cell] {
140
+ [part~='cell'] {
140
141
  position: relative;
141
142
  }
142
- [part~=cell][part~=year] {
143
+ [part~='cell'][part~='year'] {
143
144
  width: calc(100% / ${YEAR_VIEW.columnCount});
144
145
  padding-top: calc(100% / ${YEAR_VIEW.columnCount});
145
146
  }
146
- [part~=cell][part~=month] {
147
+ [part~='cell'][part~='month'] {
147
148
  width: calc(100% / ${MONTH_VIEW.columnCount});
148
149
  padding-top: calc(100% / ${MONTH_VIEW.columnCount});
149
150
  }
150
- [part~=cell][part~=day], [part~=cell][part~=day-name] {
151
+ [part~='cell'][part~='day'],
152
+ [part~='cell'][part~='day-name'] {
151
153
  width: calc(100% / ${DAY_VIEW.columnCount});
152
154
  padding-top: calc(100% / ${DAY_VIEW.columnCount});
153
155
  }
154
- [part~=cell-content]:not([tabindex]) {
156
+ [part~='cell-content']:not([tabindex]) {
155
157
  pointer-events: none;
156
158
  }
157
- [part~=selectable] {
159
+ [part~='selectable'] {
158
160
  cursor: pointer;
159
161
  }
160
162
  `;
161
163
  }
162
164
  /**
163
- * Set minimum date
164
- * @param min min date
165
- * @default -
166
- */
165
+ * Set minimum date
166
+ * @param min min date
167
+ * @default -
168
+ */
167
169
  set min(min) {
168
170
  const oldMin = this._min;
169
171
  if (!this.isValidValue(min)) {
@@ -179,10 +181,10 @@ let Calendar = class Calendar extends ControlElement {
179
181
  return this._min;
180
182
  }
181
183
  /**
182
- * Set maximum date
183
- * @param max max date
184
- * @default -
185
- */
184
+ * Set maximum date
185
+ * @param max max date
186
+ * @default -
187
+ */
186
188
  set max(max) {
187
189
  const oldMax = this._max;
188
190
  if (!this.isValidValue(max)) {
@@ -198,10 +200,10 @@ let Calendar = class Calendar extends ControlElement {
198
200
  return this._max;
199
201
  }
200
202
  /**
201
- * Current calendar view date
202
- * @param view view date
203
- * @default -
204
- */
203
+ * Current calendar view date
204
+ * @param view view date
205
+ * @default -
206
+ */
205
207
  set view(view) {
206
208
  if (view && !isValidDate(view, DateFormat.yyyyMM)) {
207
209
  this.warnInvalidView(view);
@@ -216,7 +218,10 @@ let Calendar = class Calendar extends ControlElement {
216
218
  }
217
219
  get view() {
218
220
  /* as soon as user interaction has happened, always rely on view */
219
- return this._view || (this.value ? utcFormat(toDateSegment(this.value), DateFormat.yyyyMM) : format(new Date(), DateFormat.yyyyMM));
221
+ return (this._view ||
222
+ (this.value
223
+ ? utcFormat(toDateSegment(this.value), DateFormat.yyyyMM)
224
+ : format(new Date(), DateFormat.yyyyMM)));
220
225
  }
221
226
  /**
222
227
  * Set the first day of the week.
@@ -237,10 +242,10 @@ let Calendar = class Calendar extends ControlElement {
237
242
  return this._firstDayOfWeek === null ? this.localFirstDayOfWeek : this._firstDayOfWeek;
238
243
  }
239
244
  /**
240
- * Current date time value
241
- * @param value Calendar value
242
- * @default -
243
- */
245
+ * Current date time value
246
+ * @param value Calendar value
247
+ * @default -
248
+ */
244
249
  set value(value) {
245
250
  this.values = [value];
246
251
  }
@@ -340,7 +345,7 @@ let Calendar = class Calendar extends ControlElement {
340
345
  */
341
346
  async performUpdate() {
342
347
  const localFirstDayOfWeek = Number(await this.dateTPromise('FIRST_DAY_OF_WEEK'));
343
- this.localFirstDayOfWeek = isNaN(localFirstDayOfWeek) ? FIRST_DAY_OF_WEEK : (localFirstDayOfWeek % 7);
348
+ this.localFirstDayOfWeek = isNaN(localFirstDayOfWeek) ? FIRST_DAY_OF_WEEK : localFirstDayOfWeek % 7;
344
349
  void super.performUpdate();
345
350
  }
346
351
  /**
@@ -353,15 +358,18 @@ let Calendar = class Calendar extends ControlElement {
353
358
  super.willUpdate(changedProperties);
354
359
  // This code is here to ensure that focus is not lost
355
360
  // while navigating through the render views using keyboard
356
- if (this.focused && changedProperties.has('renderView') && this.viewBtnRef.value && this.activeElement !== this.viewBtnRef.value) {
361
+ if (this.focused &&
362
+ changedProperties.has('renderView') &&
363
+ this.viewBtnRef.value &&
364
+ this.activeElement !== this.viewBtnRef.value) {
357
365
  this.viewBtnRef.value.focus();
358
366
  }
359
367
  }
360
368
  /**
361
- * Updates the element
362
- * @param changedProperties Properties that has changed
363
- * @returns {void}
364
- */
369
+ * Updates the element
370
+ * @param changedProperties Properties that has changed
371
+ * @returns {void}
372
+ */
365
373
  update(changedProperties) {
366
374
  if (!this.localMonthsNames || changedProperties.has(TranslatePropertyKey)) {
367
375
  const locale = getLocale(this);
@@ -399,7 +407,7 @@ let Calendar = class Calendar extends ControlElement {
399
407
  */
400
408
  firstUpdated(changedProperties) {
401
409
  super.firstUpdated(changedProperties);
402
- this.renderRoot.addEventListener('keydown', event => this.onKeyDown(event));
410
+ this.renderRoot.addEventListener('keydown', (event) => this.onKeyDown(event));
403
411
  }
404
412
  /**
405
413
  * Show invalid view message
@@ -418,10 +426,10 @@ let Calendar = class Calendar extends ControlElement {
418
426
  new WarningNotice(`The specified value "${value}" does not conform to the required format. The format is "yyyy-MM-dd".`).once();
419
427
  }
420
428
  /**
421
- * Validate that the value confirms the control type
422
- * @param value Value to check
423
- * @returns false if value is invalid
424
- */
429
+ * Validate that the value confirms the control type
430
+ * @param value Value to check
431
+ * @returns false if value is invalid
432
+ */
425
433
  isValidValue(value) {
426
434
  return value === '' || isValidDate(value);
427
435
  }
@@ -433,7 +441,7 @@ let Calendar = class Calendar extends ControlElement {
433
441
  */
434
442
  filterAndWarnInvalidValues(values) {
435
443
  const filtered = [];
436
- values.forEach(value => {
444
+ values.forEach((value) => {
437
445
  if (this.isValidValue(value)) {
438
446
  value && filtered.push(value);
439
447
  }
@@ -449,11 +457,11 @@ let Calendar = class Calendar extends ControlElement {
449
457
  * @returns true if filter needs to be constructed
450
458
  */
451
459
  shouldConstructFilters(changedProperties) {
452
- return changedProperties.has('min')
453
- || changedProperties.has('max')
454
- || changedProperties.has('weekdaysOnly')
455
- || changedProperties.has('weekendsOnly')
456
- || changedProperties.has('filter');
460
+ return (changedProperties.has('min') ||
461
+ changedProperties.has('max') ||
462
+ changedProperties.has('weekdaysOnly') ||
463
+ changedProperties.has('weekendsOnly') ||
464
+ changedProperties.has('filter'));
457
465
  }
458
466
  /**
459
467
  * Construct and store a collection of filters
@@ -462,13 +470,13 @@ let Calendar = class Calendar extends ControlElement {
462
470
  */
463
471
  constructFilters() {
464
472
  const filters = [];
465
- this.min && filters.push(date => isSameDay(date, this.min) || isAfter(date, this.min));
466
- this.max && filters.push(date => isSameDay(date, this.max) || isBefore(date, this.max));
473
+ this.min && filters.push((date) => isSameDay(date, this.min) || isAfter(date, this.min));
474
+ this.max && filters.push((date) => isSameDay(date, this.max) || isBefore(date, this.max));
467
475
  if (this.weekdaysOnly) {
468
- filters.push(date => !isWeekend(date));
476
+ filters.push((date) => !isWeekend(date));
469
477
  }
470
478
  if (this.weekendsOnly) {
471
- filters.push(date => isWeekend(date));
479
+ filters.push((date) => isWeekend(date));
472
480
  }
473
481
  if (this.filter) {
474
482
  filters.push(this.filter);
@@ -537,7 +545,7 @@ let Calendar = class Calendar extends ControlElement {
537
545
  * @returns {void}
538
546
  */
539
547
  setNavigationMap(rows) {
540
- this.navigationGrid = rows.map(row => row.map(cell => cell.value && !cell.disabled ? 1 : 0));
548
+ this.navigationGrid = rows.map((row) => row.map((cell) => (cell.value && !cell.disabled ? 1 : 0)));
541
549
  }
542
550
  /**
543
551
  * Run when next button is tapped.
@@ -626,14 +634,16 @@ let Calendar = class Calendar extends ControlElement {
626
634
  this.activeCellIndex = cell.index;
627
635
  const cellSegment = toDateSegment(cell.value);
628
636
  const viewSegment = toDateSegment(this.view);
629
- if (this.renderView === RenderView.YEAR) { /* YEAR -> MONTH */
637
+ if (this.renderView === RenderView.YEAR) {
638
+ /* YEAR -> MONTH */
630
639
  viewSegment.year = cellSegment.year;
631
640
  if (this.notifyViewChange(viewSegment)) {
632
641
  this.renderView = RenderView.MONTH;
633
642
  }
634
643
  return;
635
644
  }
636
- if (this.renderView === RenderView.MONTH) { /* MONTH -> DAY */
645
+ if (this.renderView === RenderView.MONTH) {
646
+ /* MONTH -> DAY */
637
647
  viewSegment.year = cellSegment.year;
638
648
  viewSegment.month = cellSegment.month;
639
649
  if (this.notifyViewChange(viewSegment)) {
@@ -779,7 +789,8 @@ let Calendar = class Calendar extends ControlElement {
779
789
  if (!this.values.length) {
780
790
  values = [value];
781
791
  }
782
- else if (this.values.length === 1) { /* from is populated */
792
+ else if (this.values.length === 1) {
793
+ /* from is populated */
783
794
  const from = this.values[0];
784
795
  const to = value;
785
796
  if (isAfter(to, from) || isSameDay(to, from)) {
@@ -848,7 +859,9 @@ let Calendar = class Calendar extends ControlElement {
848
859
  const day = segment.day;
849
860
  const fromYear = Math.floor(segment.year / YEARS_PER_YEAR_VIEW) * YEARS_PER_YEAR_VIEW;
850
861
  const toYear = fromYear + YEARS_PER_YEAR_VIEW - 1;
851
- return html `${this.viewFormattedDate({ year: fromYear, month, day })} - ${this.viewFormattedDate({ year: toYear, month, day })}`;
862
+ const fromView = this.viewFormattedDate({ year: fromYear, month, day });
863
+ const toView = this.viewFormattedDate({ year: toYear, month, day });
864
+ return html `${fromView} - ${toView}`;
852
865
  case RenderView.DAY:
853
866
  default:
854
867
  return this.viewFormattedDate(segment, true);
@@ -945,7 +958,7 @@ let Calendar = class Calendar extends ControlElement {
945
958
  const totalCount = MONTH_VIEW.totalCount;
946
959
  const monthsNames = this.localMonthsNames;
947
960
  const before = (totalCount - monthCount) / 2;
948
- const startIdx = monthCount - before % monthCount;
961
+ const startIdx = monthCount - (before % monthCount);
949
962
  const after = before + monthCount;
950
963
  const months = [];
951
964
  const rows = [];
@@ -1051,8 +1064,7 @@ let Calendar = class Calendar extends ControlElement {
1051
1064
  this.setActiveCell(rows);
1052
1065
  this.setNavigationMap(rows);
1053
1066
  return html `
1054
- ${guard([this.firstDayOfWeek, this.lang], () => this.renderWeekdayNames)}
1055
- ${this.renderRows(rows)}
1067
+ ${guard([this.firstDayOfWeek, this.lang], () => this.renderWeekdayNames)} ${this.renderRows(rows)}
1056
1068
  `;
1057
1069
  }
1058
1070
  /**
@@ -1060,14 +1072,16 @@ let Calendar = class Calendar extends ControlElement {
1060
1072
  */
1061
1073
  get renderWeekdayNames() {
1062
1074
  const firstDayOfWeek = this.firstDayOfWeek;
1063
- const weekdaysNames = this.localWeekdaysNames.slice(firstDayOfWeek).concat(this.localWeekdaysNames.slice(0, firstDayOfWeek));
1064
- return html `
1065
- <div role="row"
1066
- part="row day-name-row">${weekdaysNames.map(day => html `
1067
- <div scope="col" role="columnheader" part="cell day-name" abbr="${day.long}">
1068
- <div part="cell-content">${day.narrow}</div>
1069
- </div>
1070
- `)}</div>`;
1075
+ const weekdaysNames = this.localWeekdaysNames
1076
+ .slice(firstDayOfWeek)
1077
+ .concat(this.localWeekdaysNames.slice(0, firstDayOfWeek));
1078
+ return html ` <div role="row" part="row day-name-row">
1079
+ ${weekdaysNames.map((day) => html `
1080
+ <div scope="col" role="columnheader" part="cell day-name" abbr="${day.long}">
1081
+ <div part="cell-content">${day.narrow}</div>
1082
+ </div>
1083
+ `)}
1084
+ </div>`;
1071
1085
  }
1072
1086
  /**
1073
1087
  * Render a view based on the current render view
@@ -1127,17 +1141,24 @@ let Calendar = class Calendar extends ControlElement {
1127
1141
  ?selected=${cell.selected}
1128
1142
  ?range=${cell.range}
1129
1143
  ?range-from=${cell.rangeFrom}
1130
- ?range-to=${cell.rangeTo}>
1131
- <div role="${cell.value ? 'button' : nothing}"
1132
- tabindex="${isSelectable ? String(isActive) : nothing}"
1133
- aria-label="${isSelectable ? this.t(this.getCellLabelKey(cell), {
1134
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1135
- value: parse(cell.value),
1136
- view: this.renderView
1137
- }) : nothing}"
1138
- part="cell-content${isSelection ? ' selection' : ''}${isSelectable ? ' selectable' : ''}"
1139
- .value=${cell.value}
1140
- .index=${cell.index}>${cell.text}</div>
1144
+ ?range-to=${cell.rangeTo}
1145
+ >
1146
+ <div
1147
+ role="${cell.value ? 'button' : nothing}"
1148
+ tabindex="${isSelectable ? String(isActive) : nothing}"
1149
+ aria-label="${isSelectable
1150
+ ? this.t(this.getCellLabelKey(cell), {
1151
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1152
+ value: parse(cell.value),
1153
+ view: this.renderView
1154
+ })
1155
+ : nothing}"
1156
+ part="cell-content${isSelection ? ' selection' : ''}${isSelectable ? ' selectable' : ''}"
1157
+ .value=${cell.value}
1158
+ .index=${cell.index}
1159
+ >
1160
+ ${cell.text}
1161
+ </div>
1141
1162
  </div>`;
1142
1163
  }
1143
1164
  /**
@@ -1146,7 +1167,7 @@ let Calendar = class Calendar extends ControlElement {
1146
1167
  * @returns template result
1147
1168
  */
1148
1169
  renderRows(rows) {
1149
- return rows.map(row => html `<div role="row" part="row">${row.map(cell => this.renderCell(cell))}</div>`);
1170
+ return rows.map((row) => html `<div role="row" part="row">${row.map((cell) => this.renderCell(cell))}</div>`);
1150
1171
  }
1151
1172
  /**
1152
1173
  * Render button navigation template
@@ -1171,24 +1192,28 @@ let Calendar = class Calendar extends ControlElement {
1171
1192
  // no default
1172
1193
  }
1173
1194
  return html `<div part="navigation">
1174
- <ef-button
1175
- part="btn-prev"
1176
- aria-label="${prevBtnAriaLabel}"
1177
- icon="left"
1178
- @tap=${this.onPreviousTap}></ef-button>
1179
- <ef-button
1180
- ${ref(this.viewBtnRef)}
1181
- aria-description="${viewBtnAriaLabel}"
1182
- part="btn-view"
1183
- textpos="before"
1184
- .icon="${this.renderView === RenderView.DAY ? 'down' : 'up'}"
1185
- @tap="${this.onRenderViewTap}">${this.formattedViewRender}</ef-button>
1186
- <ef-button
1187
- part="btn-next"
1188
- aria-label="${nextBtnAriaLabel}"
1189
- icon="right"
1190
- @tap=${this.onNextTap}></ef-button>
1191
- </div>`;
1195
+ <ef-button
1196
+ part="btn-prev"
1197
+ aria-label="${prevBtnAriaLabel}"
1198
+ icon="left"
1199
+ @tap=${this.onPreviousTap}
1200
+ ></ef-button>
1201
+ <ef-button
1202
+ ${ref(this.viewBtnRef)}
1203
+ aria-description="${viewBtnAriaLabel}"
1204
+ part="btn-view"
1205
+ textpos="before"
1206
+ .icon="${this.renderView === RenderView.DAY ? 'down' : 'up'}"
1207
+ @tap="${this.onRenderViewTap}"
1208
+ >${this.formattedViewRender}</ef-button
1209
+ >
1210
+ <ef-button
1211
+ part="btn-next"
1212
+ aria-label="${nextBtnAriaLabel}"
1213
+ icon="right"
1214
+ @tap=${this.onNextTap}
1215
+ ></ef-button>
1216
+ </div>`;
1192
1217
  }
1193
1218
  /**
1194
1219
  * A template used to notify currently selected value for screen readers
@@ -1204,9 +1229,13 @@ let Calendar = class Calendar extends ControlElement {
1204
1229
  aria-live="polite"
1205
1230
  aria-label="${this.value
1206
1231
  ? this.range
1207
- ? this.t('SELECTED_RANGE', { from: parse(this.values[0]), to: this.values[1] ? parse(this.values[1]) : null })
1232
+ ? this.t('SELECTED_RANGE', {
1233
+ from: parse(this.values[0]),
1234
+ to: this.values[1] ? parse(this.values[1]) : null
1235
+ })
1208
1236
  : this.t('SELECTED_DATE', { value: parse(this.value), count: this.values.length })
1209
- : this.t('SELECTED_NONE', { multiple: this.multiple, range: this.range })}"></div>`;
1237
+ : this.t('SELECTED_NONE', { multiple: this.multiple, range: this.range })}"
1238
+ ></div>`;
1210
1239
  }
1211
1240
  /**
1212
1241
  * A `TemplateResult` that will be used
@@ -1217,10 +1246,14 @@ let Calendar = class Calendar extends ControlElement {
1217
1246
  return html `
1218
1247
  ${guard([this.values, this.lang, this.range, this.multiple, this.announceValues], () => this.selectionTemplate)}
1219
1248
  ${guard([this.view, this.renderView, this.lang], () => this.buttonNavigationTemplate)}
1220
- <div role="grid"
1221
- aria-multiselectable="${this.range || this.multiple}"
1222
- part="table"
1223
- @tap=${this.onTableTap}>${this.viewRender}</div>
1249
+ <div
1250
+ role="grid"
1251
+ aria-multiselectable="${this.range || this.multiple}"
1252
+ part="table"
1253
+ @tap=${this.onTableTap}
1254
+ >
1255
+ ${this.viewRender}
1256
+ </div>
1224
1257
  <div part="footer"><slot name="footer"></slot></div>
1225
1258
  `;
1226
1259
  }
@@ -1,5 +1,5 @@
1
- import { toDateSegment, getDaysInMonth, utcParse } from '@refinitiv-ui/utils/date.js';
2
1
  import { DEFAULT_LOCALE, resolveLocale } from '@refinitiv-ui/i18n';
2
+ import { getDaysInMonth, toDateSegment, utcParse } from '@refinitiv-ui/utils/date.js';
3
3
  import { CalendarLocaleScope } from './constants.js';
4
4
  /**
5
5
  * Get information about number of days, month number and year from date object
@@ -1,5 +1,5 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { ResponsiveElement, TemplateResult, CSSResultGroup, ElementSize } from '@refinitiv-ui/core';
2
+ import { CSSResultGroup, ElementSize, ResponsiveElement, TemplateResult } 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.
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { ResponsiveElement, html, css } from '@refinitiv-ui/core';
2
+ import { ResponsiveElement, css, html } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { VERSION } from '../version.js';
@@ -157,9 +157,7 @@ let Canvas = class Canvas extends ResponsiveElement {
157
157
  * @return Render template
158
158
  */
159
159
  render() {
160
- return html `
161
- <canvas id="canvas"></canvas>
162
- `;
160
+ return html ` <canvas id="canvas"></canvas> `;
163
161
  }
164
162
  };
165
163
  __decorate([
@@ -1,8 +1,8 @@
1
1
  import type { OverlayMenuData } from '../../overlay-menu';
2
2
  export type CardConfig = {
3
3
  /**
4
- * Configuration for side menu
5
- */
4
+ * Configuration for side menu
5
+ */
6
6
  menu?: {
7
7
  /**
8
8
  * Menu data object as defined in `overlay-menu`
@@ -1,11 +1,11 @@
1
1
  import { JSXInterface } from '../jsx';
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';
2
+ import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
7
3
  import '@refinitiv-ui/phrasebook/locale/en/card.js';
8
4
  import { Translate } from '@refinitiv-ui/translate';
5
+ import '../button/index.js';
6
+ import '../label/index.js';
7
+ import '../overlay-menu/index.js';
8
+ import type { CardConfig } from './helpers/types';
9
9
  export type { CardConfig };
10
10
  /**
11
11
  * A card frame component.