@refinitiv-ui/elements 5.12.2 → 6.0.0-next.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 (160) hide show
  1. package/README.md +4 -4
  2. package/lib/accordion/index.js +2 -2
  3. package/lib/appstate-bar/index.d.ts +6 -0
  4. package/lib/appstate-bar/index.js +8 -3
  5. package/lib/autosuggest/index.js +10 -11
  6. package/lib/button/index.d.ts +2 -13
  7. package/lib/button/index.js +7 -42
  8. package/lib/button-bar/index.js +4 -5
  9. package/lib/calendar/constants.js +1 -1
  10. package/lib/calendar/index.d.ts +1 -1
  11. package/lib/calendar/index.js +39 -15
  12. package/lib/calendar/locales.js +5 -5
  13. package/lib/calendar/types.d.ts +1 -1
  14. package/lib/calendar/utils.js +5 -5
  15. package/lib/canvas/index.js +3 -4
  16. package/lib/card/index.js +6 -7
  17. package/lib/chart/index.js +18 -22
  18. package/lib/chart/plugins/doughnut-center-label.js +6 -11
  19. package/lib/checkbox/index.js +3 -3
  20. package/lib/clock/index.js +6 -6
  21. package/lib/clock/utils/TickManager.js +2 -2
  22. package/lib/collapse/index.js +7 -9
  23. package/lib/color-dialog/elements/color-palettes.js +1 -1
  24. package/lib/color-dialog/elements/grayscale-palettes.js +2 -2
  25. package/lib/color-dialog/elements/palettes.js +4 -5
  26. package/lib/color-dialog/helpers/value-model.js +1 -1
  27. package/lib/color-dialog/index.d.ts +1 -1
  28. package/lib/color-dialog/index.js +6 -6
  29. package/lib/combo-box/helpers/filter.d.ts +1 -1
  30. package/lib/combo-box/helpers/types.d.ts +1 -1
  31. package/lib/combo-box/index.d.ts +4 -4
  32. package/lib/combo-box/index.js +31 -14
  33. package/lib/counter/index.d.ts +6 -6
  34. package/lib/counter/index.js +8 -8
  35. package/lib/datetime-field/constants.d.ts +4 -0
  36. package/lib/datetime-field/constants.js +5 -0
  37. package/lib/datetime-field/custom-elements.json +345 -0
  38. package/lib/datetime-field/custom-elements.md +61 -0
  39. package/lib/datetime-field/index.d.ts +317 -0
  40. package/lib/datetime-field/index.js +660 -0
  41. package/lib/datetime-field/themes/halo/dark/index.js +3 -0
  42. package/lib/datetime-field/themes/halo/light/index.js +3 -0
  43. package/lib/datetime-field/themes/solar/charcoal/index.js +3 -0
  44. package/lib/datetime-field/themes/solar/pearl/index.js +3 -0
  45. package/lib/datetime-field/types.d.ts +10 -0
  46. package/lib/datetime-field/types.js +1 -0
  47. package/lib/datetime-field/utils.d.ts +25 -0
  48. package/lib/datetime-field/utils.js +79 -0
  49. package/lib/datetime-picker/index.js +6 -7
  50. package/lib/datetime-picker/utils.js +1 -1
  51. package/lib/dialog/draggable-element.js +1 -2
  52. package/lib/dialog/index.d.ts +1 -1
  53. package/lib/dialog/index.js +5 -5
  54. package/lib/email-field/index.d.ts +1 -1
  55. package/lib/email-field/index.js +8 -3
  56. package/lib/flag/index.js +3 -3
  57. package/lib/flag/utils/FlagLoader.d.ts +1 -1
  58. package/lib/flag/utils/FlagLoader.js +1 -1
  59. package/lib/header/index.js +2 -2
  60. package/lib/heatmap/helpers/color.d.ts +1 -1
  61. package/lib/heatmap/helpers/color.js +3 -5
  62. package/lib/heatmap/index.js +19 -28
  63. package/lib/icon/index.js +3 -3
  64. package/lib/icon/utils/IconLoader.d.ts +1 -1
  65. package/lib/icon/utils/IconLoader.js +1 -1
  66. package/lib/interactive-chart/helpers/types.d.ts +1 -1
  67. package/lib/interactive-chart/index.js +10 -14
  68. package/lib/item/helpers/types.d.ts +1 -1
  69. package/lib/item/index.d.ts +19 -17
  70. package/lib/item/index.js +45 -48
  71. package/lib/label/index.d.ts +1 -1
  72. package/lib/label/index.js +6 -6
  73. package/lib/layout/index.js +2 -2
  74. package/lib/led-gauge/index.js +2 -2
  75. package/lib/list/custom-elements.json +0 -13
  76. package/lib/list/custom-elements.md +9 -10
  77. package/lib/list/helpers/item-id.d.ts +8 -0
  78. package/lib/list/helpers/item-id.js +13 -0
  79. package/lib/list/helpers/{list-renderer.d.ts → renderer.d.ts} +4 -0
  80. package/lib/list/helpers/{list-renderer.js → renderer.js} +8 -0
  81. package/lib/list/helpers/types.d.ts +1 -1
  82. package/lib/list/index.d.ts +13 -12
  83. package/lib/list/index.js +30 -29
  84. package/lib/list/renderer.d.ts +1 -1
  85. package/lib/list/themes/halo/dark/index.js +1 -1
  86. package/lib/list/themes/halo/light/index.js +1 -1
  87. package/lib/list/themes/solar/charcoal/index.js +1 -1
  88. package/lib/list/themes/solar/pearl/index.js +1 -1
  89. package/lib/loader/index.js +1 -1
  90. package/lib/multi-input/helpers/types.d.ts +1 -1
  91. package/lib/multi-input/index.js +6 -7
  92. package/lib/notification/elements/notification-tray.js +4 -4
  93. package/lib/notification/elements/notification.d.ts +10 -0
  94. package/lib/notification/elements/notification.js +12 -3
  95. package/lib/number-field/index.d.ts +3 -3
  96. package/lib/number-field/index.js +14 -4
  97. package/lib/overlay/elements/overlay-backdrop.js +2 -2
  98. package/lib/overlay/elements/overlay-viewport.js +1 -1
  99. package/lib/overlay/elements/overlay.js +7 -5
  100. package/lib/overlay/managers/focus-manager.js +2 -3
  101. package/lib/overlay/managers/interaction-lock-manager.js +1 -1
  102. package/lib/overlay/managers/viewport-manager.js +4 -5
  103. package/lib/overlay/managers/zindex-manager.js +1 -1
  104. package/lib/overlay-menu/helpers/types.d.ts +1 -1
  105. package/lib/overlay-menu/index.js +12 -15
  106. package/lib/overlay-menu/managers/menu-manager.js +1 -1
  107. package/lib/pagination/index.d.ts +74 -91
  108. package/lib/pagination/index.js +205 -239
  109. package/lib/pagination/themes/halo/dark/index.js +1 -2
  110. package/lib/pagination/themes/halo/light/index.js +1 -2
  111. package/lib/pagination/themes/solar/charcoal/index.js +1 -2
  112. package/lib/pagination/themes/solar/pearl/index.js +1 -2
  113. package/lib/panel/index.js +2 -2
  114. package/lib/password-field/index.d.ts +2 -2
  115. package/lib/password-field/index.js +7 -4
  116. package/lib/pill/index.d.ts +16 -0
  117. package/lib/pill/index.js +36 -5
  118. package/lib/pill/themes/halo/dark/index.js +1 -1
  119. package/lib/pill/themes/halo/light/index.js +1 -1
  120. package/lib/pill/themes/solar/charcoal/index.js +1 -1
  121. package/lib/pill/themes/solar/pearl/index.js +1 -1
  122. package/lib/progress-bar/index.js +3 -3
  123. package/lib/radio-button/index.js +3 -3
  124. package/lib/radio-button/radio-button-registry.d.ts +1 -1
  125. package/lib/radio-button/radio-button-registry.js +4 -2
  126. package/lib/rating/index.js +4 -4
  127. package/lib/search-field/index.d.ts +2 -2
  128. package/lib/search-field/index.js +8 -4
  129. package/lib/select/index.js +11 -14
  130. package/lib/sidebar-layout/index.js +4 -4
  131. package/lib/slider/index.js +6 -8
  132. package/lib/sparkline/index.js +9 -10
  133. package/lib/swing-gauge/index.js +14 -8
  134. package/lib/tab/index.js +4 -4
  135. package/lib/tab-bar/index.js +6 -6
  136. package/lib/text-field/index.d.ts +14 -1
  137. package/lib/text-field/index.js +35 -11
  138. package/lib/time-picker/index.d.ts +1 -1
  139. package/lib/time-picker/index.js +11 -11
  140. package/lib/toggle/index.js +2 -2
  141. package/lib/tooltip/index.js +6 -8
  142. package/lib/tooltip/managers/tooltip-manager.js +2 -2
  143. package/lib/tornado-chart/elements/tornado-chart.js +2 -2
  144. package/lib/tornado-chart/elements/tornado-item.js +3 -3
  145. package/lib/tree/elements/tree-item.d.ts +3 -3
  146. package/lib/tree/elements/tree-item.js +5 -6
  147. package/lib/tree/elements/tree.d.ts +2 -3
  148. package/lib/tree/elements/tree.js +6 -7
  149. package/lib/tree/helpers/renderer.d.ts +4 -0
  150. package/lib/tree/helpers/renderer.js +8 -0
  151. package/lib/tree/helpers/types.d.ts +1 -1
  152. package/lib/tree/managers/tree-manager.d.ts +1 -1
  153. package/lib/tree/themes/halo/dark/index.js +1 -1
  154. package/lib/tree/themes/halo/light/index.js +1 -1
  155. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  156. package/lib/tree/themes/solar/pearl/index.js +1 -1
  157. package/lib/tree-select/index.d.ts +3 -7
  158. package/lib/tree-select/index.js +39 -38
  159. package/lib/version.js +1 -1
  160. package/package.json +35 -295
package/README.md CHANGED
@@ -29,10 +29,10 @@ Finally, import both elements that you want to use and its themes into your appl
29
29
  import '@refinitiv-ui/halo-theme/dark/imports/native-elements';
30
30
 
31
31
  // import element and its Halo dark theme
32
- import '@refinitiv-ui/elements/lib/button';
33
- import '@refinitiv-ui/elements/lib/panel';
34
- import '@refinitiv-ui/elements/lib/button/themes/halo/dark';
35
- import '@refinitiv-ui/elements/lib/panel/themes/halo/dark';
32
+ import '@refinitiv-ui/elements/button';
33
+ import '@refinitiv-ui/elements/panel';
34
+ import '@refinitiv-ui/elements/button/themes/halo/dark';
35
+ import '@refinitiv-ui/elements/panel/themes/halo/dark';
36
36
  ```
37
37
 
38
38
  Now, you can use the elements in your app.
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { 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';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { VERSION } from '../version.js';
6
6
  import { Collapse } from '../collapse/index.js';
7
7
  /**
@@ -1,5 +1,7 @@
1
1
  import { JSXInterface } from '../jsx';
2
2
  import { BasicElement, TemplateResult, CSSResultGroup, PropertyValues } from '@refinitiv-ui/core';
3
+ import { Translate } from '@refinitiv-ui/translate';
4
+ import '@refinitiv-ui/phrasebook/locale/en/appstate-bar.js';
3
5
  import '../icon/index.js';
4
6
  /**
5
7
  * Used to display at the top of application to provide a status or information.
@@ -29,6 +31,10 @@ export declare class AppstateBar extends BasicElement {
29
31
  * (optional) Type of state bar. Supported value are `info`, `highlight`.
30
32
  */
31
33
  state: 'info' | 'highlight' | null;
34
+ /**
35
+ * Used for translations
36
+ */
37
+ protected t: Translate;
32
38
  /**
33
39
  * Invoked whenever the element is updated
34
40
  * @param {PropertyValues} changedProperties Map of changed properties with old values
@@ -1,8 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
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';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { VERSION } from '../version.js';
6
+ import { translate } from '@refinitiv-ui/translate';
7
+ import '@refinitiv-ui/phrasebook/locale/en/appstate-bar.js';
6
8
  import '../icon/index.js';
7
9
  /**
8
10
  * Used to display at the top of application to provide a status or information.
@@ -82,7 +84,7 @@ let AppstateBar = class AppstateBar extends BasicElement {
82
84
  <div part="heading">${this.heading}</div>
83
85
  <div part="message"><slot></slot></div>
84
86
  <div part="right"><slot name="right"></slot></div>
85
- <ef-icon part="close" @tap="${this.clear}" icon="cross"></ef-icon>
87
+ <ef-icon role="button" part="close" @tap="${this.clear}" icon="cross" aria-label="${this.t('CLOSE')}"></ef-icon>
86
88
  `;
87
89
  }
88
90
  };
@@ -92,6 +94,9 @@ __decorate([
92
94
  __decorate([
93
95
  property({ type: String, reflect: true })
94
96
  ], AppstateBar.prototype, "state", void 0);
97
+ __decorate([
98
+ translate()
99
+ ], AppstateBar.prototype, "t", void 0);
95
100
  AppstateBar = __decorate([
96
101
  customElement('ef-appstate-bar', {
97
102
  alias: 'amber-appstate-bar'
@@ -1,14 +1,14 @@
1
1
  var Autosuggest_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { css, html } from '@refinitiv-ui/core';
4
- import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
5
- import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
6
- import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
7
- import { unsafeHTML } from '@refinitiv-ui/core/lib/directives/unsafe-html.js';
4
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
5
+ import { query } from '@refinitiv-ui/core/decorators/query.js';
6
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
7
+ import { unsafeHTML } from '@refinitiv-ui/core/directives/unsafe-html.js';
8
8
  import { VERSION } from '../version.js';
9
- import { AnimationTaskRunner, TimeoutTaskRunner } from '@refinitiv-ui/utils/lib/async.js';
9
+ import { AnimationTaskRunner, TimeoutTaskRunner } from '@refinitiv-ui/utils/async.js';
10
10
  import { escapeRegExp, itemHighlightable, itemRenderer, queryWordSelect } from './helpers/utils.js';
11
- import { isIE, isMobile } from '@refinitiv-ui/utils/lib/browser.js';
11
+ import { isIE, isMobile } from '@refinitiv-ui/utils/browser.js';
12
12
  import { Overlay } from '../overlay/index.js';
13
13
  import '../loader/index.js';
14
14
  import '../item/index.js';
@@ -532,7 +532,7 @@ let Autosuggest = Autosuggest_1 = class Autosuggest extends Overlay {
532
532
  const { detail: { query, suggestion } } = event;
533
533
  /* istanbul ignore next */
534
534
  if (this.attachTarget) {
535
- this.attachTarget.value = suggestion && (suggestion === null || suggestion === void 0 ? void 0 : suggestion.label) || query;
535
+ this.attachTarget.value = suggestion && suggestion?.label || query;
536
536
  }
537
537
  }
538
538
  /**
@@ -1181,13 +1181,12 @@ let Autosuggest = Autosuggest_1 = class Autosuggest extends Overlay {
1181
1181
  */
1182
1182
  /* istanbul ignore next */
1183
1183
  calculateContentMaxHeight(size) {
1184
- var _a, _b, _c;
1185
1184
  if (!isIE) {
1186
1185
  return;
1187
1186
  }
1188
- const headerRect = (_a = this.headerElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1189
- const footerRect = (_b = this.footerElement) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
1190
- const contentRect = (_c = this.contentElement) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
1187
+ const headerRect = this.headerElement?.getBoundingClientRect();
1188
+ const footerRect = this.footerElement?.getBoundingClientRect();
1189
+ const contentRect = this.contentElement?.getBoundingClientRect();
1191
1190
  const dialogHeight = size.height;
1192
1191
  const headerHeight = headerRect ? headerRect.height : 0;
1193
1192
  const footerHeight = footerRect ? footerRect.height : 0;
@@ -53,22 +53,11 @@ export declare class Button extends ControlElement {
53
53
  */
54
54
  private labelElement;
55
55
  /**
56
- * Aria indicating state of toggle button
57
- * @ignore
58
- */
59
- ariaPressed: string;
60
- /**
61
- * Aria indicating state of toggle button.
62
- * Used when role is radio.
63
- * @ignore
64
- */
65
- ariaChecked: string;
66
- /**
67
- * Updates the element
56
+ * Called before update() to compute values needed during the update.
68
57
  * @param changedProperties Properties that has changed
69
58
  * @returns {void}
70
59
  */
71
- protected update(changedProperties: PropertyValues): void;
60
+ protected willUpdate(changedProperties: PropertyValues): void;
72
61
  /**
73
62
  * the lifecycle method called when properties changed first time
74
63
  * @param changedProperties properties it's the Map object which has the updated properties
@@ -1,21 +1,11 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { ControlElement, html } from '@refinitiv-ui/core';
3
- import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
4
- import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
5
- import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { query } from '@refinitiv-ui/core/decorators/query.js';
5
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
6
6
  import { VERSION } from '../version.js';
7
7
  import { registerOverflowTooltip } from '../tooltip/index.js';
8
8
  import '../icon/index.js';
9
- /**
10
- * Return the attribute that converted from the property
11
- * Prevent empty string that reflected to attribute
12
- * @private
13
- * @param value value from the property
14
- * @returns string converted to attribute
15
- */
16
- const emptyStringToNull = function (value) {
17
- return value || null;
18
- };
19
9
  /**
20
10
  * Use button for actions in forms, dialogs,
21
11
  * and more with support for different states and styles.
@@ -60,17 +50,6 @@ let Button = class Button extends ControlElement {
60
50
  * Use by theme to detect when no content inside button
61
51
  */
62
52
  this.empty = false;
63
- /**
64
- * Aria indicating state of toggle button
65
- * @ignore
66
- */
67
- this.ariaPressed = '';
68
- /**
69
- * Aria indicating state of toggle button.
70
- * Used when role is radio.
71
- * @ignore
72
- */
73
- this.ariaChecked = '';
74
53
  }
75
54
  /**
76
55
  * Element version number
@@ -80,17 +59,17 @@ let Button = class Button extends ControlElement {
80
59
  return VERSION;
81
60
  }
82
61
  /**
83
- * Updates the element
62
+ * Called before update() to compute values needed during the update.
84
63
  * @param changedProperties Properties that has changed
85
64
  * @returns {void}
86
65
  */
87
- update(changedProperties) {
66
+ willUpdate(changedProperties) {
88
67
  if (changedProperties.has('active') && this.toggles || changedProperties.has('toggles') && this.toggles) {
89
68
  if (this.getAttribute('role') === 'radio') {
90
- this.ariaChecked = String(this.active);
69
+ this.setAttribute('aria-checked', String(this.active));
91
70
  }
92
71
  else {
93
- this.ariaPressed = String(this.active);
72
+ this.setAttribute('aria-pressed', String(this.active));
94
73
  }
95
74
  }
96
75
  super.update(changedProperties);
@@ -219,20 +198,6 @@ __decorate([
219
198
  __decorate([
220
199
  query('[part="label"]')
221
200
  ], Button.prototype, "labelElement", void 0);
222
- __decorate([
223
- property({ type: String,
224
- reflect: true,
225
- attribute: 'aria-pressed',
226
- converter: { toAttribute: emptyStringToNull } // TODO: Remove after typescript update to allow nullable for ARIAMixin
227
- })
228
- ], Button.prototype, "ariaPressed", void 0);
229
- __decorate([
230
- property({ type: String,
231
- reflect: true,
232
- attribute: 'aria-checked',
233
- converter: { toAttribute: emptyStringToNull } // TODO: Remove after typescript update to allow nullable for ARIAMixin
234
- })
235
- ], Button.prototype, "ariaChecked", void 0);
236
201
  Button = __decorate([
237
202
  customElement('ef-button', {
238
203
  alias: 'coral-button'
@@ -1,11 +1,11 @@
1
1
  var ButtonBar_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { BasicElement, html, css } from '@refinitiv-ui/core';
4
- import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
5
- import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
4
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
5
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
6
+ import { ref, createRef } from '@refinitiv-ui/core/directives/ref.js';
6
7
  import { VERSION } from '../version.js';
7
8
  import { Button } from '../button/index.js';
8
- import { ref, createRef } from '@refinitiv-ui/core/lib/directives/ref.js';
9
9
  /**
10
10
  * Used to display multiple buttons to create a list of commands bar.
11
11
  */
@@ -256,8 +256,7 @@ let ButtonBar = ButtonBar_1 = class ButtonBar extends BasicElement {
256
256
  * @returns the array of Element of the default slot
257
257
  */
258
258
  getElementsOfSlot() {
259
- var _a;
260
- return (_a = this.defaultSlot.value) === null || _a === void 0 ? void 0 : _a.assignedNodes().filter(node => node instanceof Element);
259
+ return this.defaultSlot.value?.assignedNodes().filter(node => node instanceof Element);
261
260
  }
262
261
  /**
263
262
  * Return the array of Buttons which focusable
@@ -1,4 +1,4 @@
1
- import { uuid } from '@refinitiv-ui/utils/lib/uuid.js';
1
+ import { uuid } from '@refinitiv-ui/utils/uuid.js';
2
2
  export var RenderView;
3
3
  (function (RenderView) {
4
4
  RenderView["DAY"] = "day";
@@ -4,7 +4,7 @@ import { TranslateDirective, TranslatePromise } from '@refinitiv-ui/translate';
4
4
  import { CalendarFilter } from './types';
5
5
  import './locales.js';
6
6
  import '../button/index.js';
7
- import '@refinitiv-ui/phrasebook/lib/locale/en/calendar.js';
7
+ import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
8
8
  export { CalendarFilter };
9
9
  /**
10
10
  * Standard calendar element
@@ -1,22 +1,22 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { ControlElement, html, css, WarningNotice } 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 { ifDefined } from '@refinitiv-ui/core/lib/directives/if-defined.js';
7
- import { cache } from '@refinitiv-ui/core/lib/directives/cache.js';
8
- import { guard } from '@refinitiv-ui/core/lib/directives/guard.js';
9
- import { ref, createRef } from '@refinitiv-ui/core/lib/directives/ref.js';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
+ import { state } from '@refinitiv-ui/core/decorators/state.js';
6
+ import { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
7
+ import { cache } from '@refinitiv-ui/core/directives/cache.js';
8
+ import { guard } from '@refinitiv-ui/core/directives/guard.js';
9
+ import { ref, createRef } from '@refinitiv-ui/core/directives/ref.js';
10
10
  import { VERSION } from '../version.js';
11
- import { isIE } from '@refinitiv-ui/utils/lib/browser.js';
12
- import { DateFormat, format, utcFormat, utcParse, isValidDate, isWeekend, isAfter, isBefore, addMonths, subMonths, isToday, isThisMonth, isThisYear, isSameDay, isSameMonth, isSameYear, toDateSegment, parse } from '@refinitiv-ui/utils/lib/date.js';
13
- import { left, right, up, down, first, last } from '@refinitiv-ui/utils/lib/navigation.js';
11
+ import { isIE } from '@refinitiv-ui/utils/browser.js';
12
+ 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';
13
+ import { left, right, up, down, first, last } from '@refinitiv-ui/utils/navigation.js';
14
14
  import { monthInfo, weekdaysNames, monthsNames, formatLocaleDate, ViewFormatTranslateParams } from './utils.js';
15
15
  import { translate, getLocale, TranslatePropertyKey } from '@refinitiv-ui/translate';
16
16
  import { RenderView, CalendarLocaleScope, FIRST_DAY_OF_WEEK, YEARS_PER_YEAR_VIEW, DAY_VIEW, YEAR_VIEW, MONTH_VIEW } from './constants.js';
17
17
  import './locales.js';
18
18
  import '../button/index.js';
19
- import '@refinitiv-ui/phrasebook/lib/locale/en/calendar.js';
19
+ import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
20
20
  /**
21
21
  * Standard calendar element
22
22
  *
@@ -925,7 +925,14 @@ let Calendar = class Calendar extends ControlElement {
925
925
  }
926
926
  const year = startIdx + i;
927
927
  const value = utcFormat({ year, month: 0, day: 1 }, DateFormat.yyyyMMdd);
928
- cell = Object.assign({ view, text: year > 0 ? `${year}` : year === 0 ? '1' : `${Math.abs(year - 1)}`, value: `${year}`, now: isThisYear(value), index: [cells.length, rows.length - 1] }, this.getCellSelection(value, isSameYear));
928
+ cell = {
929
+ view,
930
+ text: year > 0 ? `${year}` : year === 0 ? '1' : `${Math.abs(year - 1)}`,
931
+ value: `${year}`,
932
+ now: isThisYear(value),
933
+ index: [cells.length, rows.length - 1],
934
+ ...this.getCellSelection(value, isSameYear)
935
+ };
929
936
  cells.push(cell);
930
937
  years.push(cell);
931
938
  }
@@ -962,7 +969,15 @@ let Calendar = class Calendar extends ControlElement {
962
969
  const segment = { year, month, day: 1 };
963
970
  const value = utcFormat(segment, DateFormat.yyyyMMdd);
964
971
  const idle = i < before || i >= after;
965
- cell = Object.assign({ view, text: monthsNames[month], value: utcFormat(segment, DateFormat.yyyyMM), idle, now: isThisMonth(value), index: [cells.length, rows.length - 1] }, this.getCellSelection(value, isSameMonth));
972
+ cell = {
973
+ view,
974
+ text: monthsNames[month],
975
+ value: utcFormat(segment, DateFormat.yyyyMM),
976
+ idle,
977
+ now: isThisMonth(value),
978
+ index: [cells.length, rows.length - 1],
979
+ ...this.getCellSelection(value, isSameMonth)
980
+ };
966
981
  cells.push(cell);
967
982
  months.push(cell);
968
983
  }
@@ -1026,8 +1041,16 @@ let Calendar = class Calendar extends ControlElement {
1026
1041
  }
1027
1042
  const value = utcFormat({ year, month, day }, DateFormat.yyyyMMdd);
1028
1043
  const disabled = this.isDateAvailable ? !this.isDateAvailable(value) : false;
1029
- const dayCell = Object.assign({ view, text: day.toString(), value,
1030
- disabled, idle: month !== viewMonth.month || year !== viewMonth.year, now: isToday(value), index: [cells.length, rows.length - 1] }, this.getCellSelection(value, isSameDay));
1044
+ const dayCell = {
1045
+ view,
1046
+ text: day.toString(),
1047
+ value,
1048
+ disabled,
1049
+ idle: month !== viewMonth.month || year !== viewMonth.year,
1050
+ now: isToday(value),
1051
+ index: [cells.length, rows.length - 1],
1052
+ ...this.getCellSelection(value, isSameDay)
1053
+ };
1031
1054
  cells.push(dayCell);
1032
1055
  days.push(dayCell);
1033
1056
  }
@@ -1182,6 +1205,7 @@ let Calendar = class Calendar extends ControlElement {
1182
1205
  }
1183
1206
  return html `<div
1184
1207
  part="aria-selection"
1208
+ role="status"
1185
1209
  aria-live="polite"
1186
1210
  aria-label="${this.value
1187
1211
  ? this.range
@@ -9,20 +9,20 @@ const globals = {
9
9
  FIRST_DAY_OF_WEEK: '1'
10
10
  };
11
11
  const en = globals;
12
- const enUS = Object.assign(Object.assign({}, en), { FIRST_DAY_OF_WEEK: '0' });
12
+ const enUS = { ...en, FIRST_DAY_OF_WEEK: '0' };
13
13
  const enCA = enUS;
14
14
  const de = globals;
15
15
  const es = globals;
16
16
  const fr = globals;
17
- const frCA = Object.assign(Object.assign({}, fr), { FIRST_DAY_OF_WEEK: '0' });
17
+ const frCA = { ...fr, FIRST_DAY_OF_WEEK: '0' };
18
18
  const it = globals;
19
19
  const ja = globals;
20
- const ko = Object.assign(Object.assign({}, globals), { FIRST_DAY_OF_WEEK: '0' });
20
+ const ko = { ...globals, FIRST_DAY_OF_WEEK: '0' };
21
21
  const pl = globals;
22
22
  const ru = globals;
23
- const th = Object.assign(Object.assign({}, globals), { FIRST_DAY_OF_WEEK: '0' });
23
+ const th = { ...globals, FIRST_DAY_OF_WEEK: '0' };
24
24
  const zh = globals;
25
- const ar = Object.assign(Object.assign({}, globals), { FIRST_DAY_OF_WEEK: '6' });
25
+ const ar = { ...globals, FIRST_DAY_OF_WEEK: '6' };
26
26
  const scope = CalendarLocaleScope;
27
27
  Phrasebook.define('en', scope, en);
28
28
  Phrasebook.define('en-CA', scope, enCA);
@@ -1,4 +1,4 @@
1
- import { CellIndex } from '@refinitiv-ui/utils/lib/navigation.js';
1
+ import { CellIndex } from '@refinitiv-ui/utils/navigation.js';
2
2
  import { RenderView } from './constants.js';
3
3
  export interface CellSelectionModel {
4
4
  selected?: boolean;
@@ -1,4 +1,4 @@
1
- import { toDateSegment, getDaysInMonth, utcParse } from '@refinitiv-ui/utils/lib/date.js';
1
+ import { toDateSegment, getDaysInMonth, utcParse } from '@refinitiv-ui/utils/date.js';
2
2
  import { DEFAULT_LOCALE, resolveLocale } from '@refinitiv-ui/i18n';
3
3
  import { CalendarLocaleScope } from './constants.js';
4
4
  /**
@@ -27,10 +27,10 @@ const calendar = {
27
27
  */
28
28
  const DateMessageFormats = {
29
29
  date: {
30
- calendarMonthEra: Object.assign(Object.assign({}, calendar), { month: 'long', year: 'numeric', era: 'short' }),
31
- calendarMonth: Object.assign(Object.assign({}, calendar), { month: 'long', year: 'numeric' }),
32
- calendarYearEra: Object.assign(Object.assign({}, calendar), { year: 'numeric', era: 'short' }),
33
- calendarYear: Object.assign(Object.assign({}, calendar), { year: 'numeric' })
30
+ calendarMonthEra: { ...calendar, month: 'long', year: 'numeric', era: 'short' },
31
+ calendarMonth: { ...calendar, month: 'long', year: 'numeric' },
32
+ calendarYearEra: { ...calendar, year: 'numeric', era: 'short' },
33
+ calendarYear: { ...calendar, year: 'numeric' }
34
34
  }
35
35
  };
36
36
  /**
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
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';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { VERSION } from '../version.js';
6
6
  /**
7
7
  * A Component uses to draw graphics on a web page,
@@ -64,8 +64,7 @@ let Canvas = class Canvas extends ResponsiveElement {
64
64
  * @type {HTMLCanvasElement}
65
65
  */
66
66
  get canvas() {
67
- var _a;
68
- return (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('canvas');
67
+ return this.shadowRoot?.getElementById('canvas');
69
68
  }
70
69
  /**
71
70
  * Alias of context
package/lib/card/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { __decorate } from "tslib";
2
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';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
+ import { query } from '@refinitiv-ui/core/decorators/query.js';
6
+ import { state } from '@refinitiv-ui/core/decorators/state.js';
7
7
  import { VERSION } from '../version.js';
8
- import { isSlotEmpty } from '@refinitiv-ui/utils/lib/is-slot-empty.js';
8
+ import { isSlotEmpty } from '@refinitiv-ui/utils/is-slot-empty.js';
9
9
  import '../label/index.js';
10
10
  import '../button/index.js';
11
11
  import '../overlay-menu/index.js';
@@ -78,8 +78,7 @@ let Card = class Card extends BasicElement {
78
78
  return this._config;
79
79
  }
80
80
  set config(config) {
81
- var _a;
82
- const data = (_a = config === null || config === void 0 ? void 0 : config.menu) === null || _a === void 0 ? void 0 : _a.data;
81
+ const data = config?.menu?.data;
83
82
  if (data !== this.menuData) {
84
83
  this.menuData = data;
85
84
  }
@@ -1,10 +1,12 @@
1
+ /* eslint @typescript-eslint/no-unsafe-call: 0 */
2
+ /* eslint @typescript-eslint/no-unsafe-member-access: 0 */
1
3
  import { __decorate } from "tslib";
2
4
  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';
5
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
6
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
7
+ import { query } from '@refinitiv-ui/core/decorators/query.js';
6
8
  import { VERSION } from '../version.js';
7
- import { color as parseColor } from '@refinitiv-ui/utils/lib/color.js';
9
+ import { color as parseColor } from '@refinitiv-ui/utils/color.js';
8
10
  import 'chart.js/dist/Chart.bundle.min.js';
9
11
  import { legendHelper, merge } from './helpers/index.js';
10
12
  import '../header/index.js';
@@ -14,6 +16,7 @@ import doughnutCenterPlugin from './plugins/doughnut-center-label.js';
14
16
  window.Chart.pluginService.register(doughnutCenterPlugin);
15
17
  const CSS_COLOR_PREFIX = '--chart-color-';
16
18
  const CHART_TYPE_OPAQUE = ['line', 'bubble', 'radar', 'polarArea'];
19
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
17
20
  const DEFAULT_CHART_CONFIG = window.Chart.defaults;
18
21
  const ELF_CHART_CONFIG = {
19
22
  polarArea: {
@@ -54,8 +57,7 @@ let Chart = class Chart extends BasicElement {
54
57
  * @returns {Chart.ChartLegendLabelItem[]} Array of label configurations
55
58
  */
56
59
  this.generateLegendLabels = (chart) => {
57
- var _a, _b, _c, _d;
58
- if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.type)) {
60
+ if (!this.config?.type) {
59
61
  return [];
60
62
  }
61
63
  const chartOption = DEFAULT_CHART_CONFIG[this.config.type];
@@ -63,11 +65,11 @@ let Chart = class Chart extends BasicElement {
63
65
  && chartOption.legend
64
66
  && Array.isArray(this.datasets[0].backgroundColor)) {
65
67
  let legends = [];
66
- if ((_b = chartOption.legend.labels) === null || _b === void 0 ? void 0 : _b.generateLabels) {
67
- legends = (_c = chartOption.legend.labels) === null || _c === void 0 ? void 0 : _c.generateLabels(chart);
68
+ if (chartOption.legend.labels?.generateLabels) {
69
+ legends = chartOption.legend.labels?.generateLabels(chart);
68
70
  }
69
71
  // Customize for doughnut chart change border color to background color
70
- if (['pie', 'doughnut'].includes((_d = this.config) === null || _d === void 0 ? void 0 : _d.type) && this.datasets.length > 1) {
72
+ if (['pie', 'doughnut'].includes(this.config?.type) && this.datasets.length > 1) {
71
73
  legends.forEach((label) => {
72
74
  label.strokeStyle = label.fillStyle;
73
75
  });
@@ -75,9 +77,8 @@ let Chart = class Chart extends BasicElement {
75
77
  return legends;
76
78
  }
77
79
  return this.datasets.map((dataset, i) => {
78
- var _a, _b, _c;
79
- const solidFill = !CHART_TYPE_OPAQUE.includes(dataset.type || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.type));
80
- const usePointStyle = ((_c = (_b = chart.options.legend) === null || _b === void 0 ? void 0 : _b.labels) === null || _c === void 0 ? void 0 : _c.usePointStyle) || false;
80
+ const solidFill = !CHART_TYPE_OPAQUE.includes(dataset.type || this.config?.type);
81
+ const usePointStyle = chart.options.legend?.labels?.usePointStyle || false;
81
82
  return {
82
83
  text: dataset.label,
83
84
  fillStyle: legendHelper.getLegendFillStyle(dataset, usePointStyle, solidFill),
@@ -122,8 +123,7 @@ let Chart = class Chart extends BasicElement {
122
123
  * @returns chart title
123
124
  */
124
125
  get chartTitle() {
125
- var _a, _b, _c;
126
- const title = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.title) === null || _c === void 0 ? void 0 : _c.text;
126
+ const title = this.config?.options?.title?.text;
127
127
  if (title) {
128
128
  return typeof title === 'string' ? title : title.join();
129
129
  }
@@ -134,8 +134,7 @@ let Chart = class Chart extends BasicElement {
134
134
  * @returns dataset array
135
135
  */
136
136
  get datasets() {
137
- var _a, _b;
138
- return ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.datasets) || [];
137
+ return this.config?.data?.datasets || [];
139
138
  }
140
139
  /**
141
140
  * List of available chart colors
@@ -186,7 +185,6 @@ let Chart = class Chart extends BasicElement {
186
185
  * @returns {ChartConfig} chart config with theme
187
186
  */
188
187
  get themableConfig() {
189
- var _a;
190
188
  const style = getComputedStyle(this);
191
189
  // TODO: Try and remove the need for global object modification.
192
190
  // It's easier to cover all areas by modifying the global object,
@@ -222,7 +220,7 @@ let Chart = class Chart extends BasicElement {
222
220
  displayColors: false
223
221
  },
224
222
  legend: {
225
- position: ['pie', 'doughnut'].includes(((_a = this.config) === null || _a === void 0 ? void 0 : _a.type) || '') ? 'right' : 'top',
223
+ position: ['pie', 'doughnut'].includes(this.config?.type || '') ? 'right' : 'top',
226
224
  labels: {
227
225
  boxWidth: this.cssVarAsNumber('--legend-key-box-width', '10'),
228
226
  generateLabels: this.generateLegendLabels
@@ -291,8 +289,7 @@ let Chart = class Chart extends BasicElement {
291
289
  * @returns {Chart.ChartDataSets} Information about the dataset
292
290
  */
293
291
  datasetInfo(dataset) {
294
- var _a;
295
- const type = dataset.type || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.type);
292
+ const type = dataset.type || this.config?.type;
296
293
  let index = this.datasets.indexOf(dataset);
297
294
  const isColorArray = (!!type && ['pie', 'doughnut', 'polarArea'].includes(type)) || type === 'bar' && this.datasets.length === 1;
298
295
  const isSolidFill = !!type && !CHART_TYPE_OPAQUE.includes(type);
@@ -456,8 +453,7 @@ let Chart = class Chart extends BasicElement {
456
453
  * @returns {void}
457
454
  */
458
455
  onResize() {
459
- var _a;
460
- (_a = this.chart) === null || _a === void 0 ? void 0 : _a.resize();
456
+ this.chart?.resize();
461
457
  }
462
458
  /**
463
459
  * A `TemplateResult` that will be used