@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
@@ -0,0 +1,25 @@
1
+ import { DateTimeFormatPart, InputSelection } from './types';
2
+ import { Direction } from './constants.js';
3
+ /**
4
+ * Get a part index based on the selection
5
+ * @param selection Selection, containing selectionStart and selectionEnd
6
+ * @param parts The list of parts
7
+ * @returns index
8
+ */
9
+ export declare const getSelectedPartIndex: (selection: InputSelection, parts: DateTimeFormatPart[]) => number;
10
+ /**
11
+ * Get next available part index based on the selection, direction and input value
12
+ * @param selection Selection, containing selectionStart and selectionEnd
13
+ * @param parts The list of parts
14
+ * @param inputValue The date time string value
15
+ * @param direction Get the previous or the next part index
16
+ * @returns index
17
+ */
18
+ export declare const getNextSelectedPartIndex: (selection: InputSelection, parts: DateTimeFormatPart[], inputValue: string, direction?: Direction) => number;
19
+ /**
20
+ * Get part selectionStart and selectionEnd indexes
21
+ * @param index Part index
22
+ * @param parts The list of parts
23
+ * @returns selection
24
+ */
25
+ export declare const selectPart: (index: number | undefined, parts: DateTimeFormatPart[]) => InputSelection;
@@ -0,0 +1,79 @@
1
+ import { Direction } from './constants.js';
2
+ const IterablePartTypes = ['year', 'day', 'month', 'hour', 'minute', 'second', 'weekday', 'dayPeriod', 'fractionalSecond'];
3
+ const isAllowedPart = (part) => IterablePartTypes.includes(part.type);
4
+ /**
5
+ * Get a part index based on the selection
6
+ * @param selection Selection, containing selectionStart and selectionEnd
7
+ * @param parts The list of parts
8
+ * @returns index
9
+ */
10
+ export const getSelectedPartIndex = (selection, parts) => {
11
+ const selectionEnd = selection.selectionEnd || 0;
12
+ let accumulator = 0;
13
+ // Get the closest part to selectionEnd
14
+ for (let i = 0; i < parts.length; i += 1) {
15
+ const part = parts[i];
16
+ accumulator += part.value.length;
17
+ if (accumulator >= selectionEnd && isAllowedPart(part)) {
18
+ return i;
19
+ }
20
+ }
21
+ return 0;
22
+ };
23
+ /**
24
+ * Get next available part index based on the selection, direction and input value
25
+ * @param selection Selection, containing selectionStart and selectionEnd
26
+ * @param parts The list of parts
27
+ * @param inputValue The date time string value
28
+ * @param direction Get the previous or the next part index
29
+ * @returns index
30
+ */
31
+ export const getNextSelectedPartIndex = (selection, parts, inputValue, direction = Direction.Up) => {
32
+ let selectedIndex;
33
+ const { selectionEnd, selectionStart } = selection;
34
+ if (selectionStart === 0 && selectionEnd === inputValue.length) {
35
+ // Full text selected
36
+ selectedIndex = direction === Direction.Up ? -1 : parts.length;
37
+ }
38
+ else if (selectionEnd === 0) {
39
+ // Cursor at the start of the text
40
+ selectedIndex = -1;
41
+ direction = Direction.Up;
42
+ }
43
+ else if (selectionEnd === inputValue.length && selectionEnd === selectionStart) {
44
+ // cursor at the end of the text
45
+ selectedIndex = parts.length;
46
+ direction = Direction.Down;
47
+ }
48
+ else {
49
+ selectedIndex = getSelectedPartIndex(selection, parts);
50
+ }
51
+ for (let i = selectedIndex + direction; direction === Direction.Up ? i < parts.length : i >= 0; i += direction) {
52
+ if (isAllowedPart(parts[i])) {
53
+ return i;
54
+ }
55
+ }
56
+ return selectedIndex;
57
+ };
58
+ /**
59
+ * Get part selectionStart and selectionEnd indexes
60
+ * @param index Part index
61
+ * @param parts The list of parts
62
+ * @returns selection
63
+ */
64
+ export const selectPart = (index = 0, parts) => {
65
+ let selectionStart = 0;
66
+ let selectionEnd = 0;
67
+ for (let i = 0; i < parts.length; i += 1) {
68
+ const part = parts[i];
69
+ selectionEnd += part.value.length;
70
+ if (i === index) {
71
+ break;
72
+ }
73
+ selectionStart = selectionEnd;
74
+ }
75
+ return {
76
+ selectionStart,
77
+ selectionEnd
78
+ };
79
+ };
@@ -1,9 +1,9 @@
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 { query } from '@refinitiv-ui/core/lib/decorators/query.js';
6
- import { ifDefined } from '@refinitiv-ui/core/lib/directives/if-defined.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 { ifDefined } from '@refinitiv-ui/core/directives/if-defined.js';
7
7
  import { VERSION } from '../version.js';
8
8
  import '../calendar/index.js';
9
9
  import '../icon/index.js';
@@ -15,7 +15,7 @@ import { getDateFNSLocale } from './locales.js';
15
15
  import inputFormat from 'date-fns/esm/format/index.js';
16
16
  import inputParse from 'date-fns/esm/parse/index.js';
17
17
  import isValid from 'date-fns/esm/isValid/index.js';
18
- import { addMonths, subMonths, isAfter, isBefore, isValidDate, isValidDateTime, DateFormat, DateTimeFormat, parse, format } from '@refinitiv-ui/utils/lib/date.js';
18
+ import { addMonths, subMonths, isAfter, isBefore, isValidDate, isValidDateTime, DateFormat, DateTimeFormat, parse, format } from '@refinitiv-ui/utils/date.js';
19
19
  import { DateTimeSegment, formatToView, getCurrentTime } from './utils.js';
20
20
  import { preload } from '../icon/index.js';
21
21
  preload('calendar', 'down', 'left', 'right'); /* preload calendar icons for faster loading */
@@ -727,7 +727,6 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
727
727
  * @returns {void}
728
728
  */
729
729
  onCalendarValueChanged(event) {
730
- var _a, _b;
731
730
  const values = event.target.values;
732
731
  this.interimSegments = values.map((value, index) => {
733
732
  const segment = this.interimSegments[index] || new DateTimeSegment();
@@ -741,7 +740,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
741
740
  // in duplex mode, avoid jumping on views
742
741
  // Therefore if any of values have changed, save the current view
743
742
  if (this.isDuplex() && this.calendarEl && this.calendarToEl) {
744
- this.notifyViewsChange([(_a = this.calendarEl) === null || _a === void 0 ? void 0 : _a.view, (_b = this.calendarToEl) === null || _b === void 0 ? void 0 : _b.view]);
743
+ this.notifyViewsChange([this.calendarEl?.view, this.calendarToEl?.view]);
745
744
  }
746
745
  // Close popup if there is no time picker
747
746
  const newValues = this.values;
@@ -1,4 +1,4 @@
1
- import { format, DateFormat, parse, TimeFormat, toTimeSegment } from '@refinitiv-ui/utils/lib/date.js';
1
+ import { format, DateFormat, parse, TimeFormat, toTimeSegment } from '@refinitiv-ui/utils/date.js';
2
2
  /**
3
3
  * A helper class to split date time string into date and time segments
4
4
  */
@@ -86,9 +86,8 @@ class DraggableManager {
86
86
  * @returns {void}
87
87
  */
88
88
  deregister(draggableElement) {
89
- var _a;
90
89
  if (this.draggableElements.has(draggableElement)) {
91
- const handle = (_a = this.draggableElements.get(draggableElement)) === null || _a === void 0 ? void 0 : _a.handle;
90
+ const handle = this.draggableElements.get(draggableElement)?.handle;
92
91
  if (handle) {
93
92
  DraggableManager.removeHandleCursor(handle);
94
93
  }
@@ -6,7 +6,7 @@ import '../panel/index.js';
6
6
  import '../header/index.js';
7
7
  import '../button/index.js';
8
8
  import { Translate } from '@refinitiv-ui/translate';
9
- import '@refinitiv-ui/phrasebook/lib/locale/en/dialog.js';
9
+ import '@refinitiv-ui/phrasebook/locale/en/dialog.js';
10
10
  /**
11
11
  * Popup window, designed to contain and show any HTML content.
12
12
  * It provides modal and dragging functionality,
@@ -1,10 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html } 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';
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
6
  import { VERSION } from '../version.js';
7
- import { isIE } from '@refinitiv-ui/utils/lib/browser.js';
7
+ import { isIE } from '@refinitiv-ui/utils/browser.js';
8
8
  import { deregister as draggableDeregister, register as draggableRegister } from './draggable-element.js';
9
9
  import { Overlay } from '../overlay/index.js';
10
10
  import '../icon/index.js';
@@ -12,7 +12,7 @@ import '../panel/index.js';
12
12
  import '../header/index.js';
13
13
  import '../button/index.js';
14
14
  import { translate, TranslatePropertyKey } from '@refinitiv-ui/translate';
15
- import '@refinitiv-ui/phrasebook/lib/locale/en/dialog.js';
15
+ import '@refinitiv-ui/phrasebook/locale/en/dialog.js';
16
16
  /**
17
17
  * Popup window, designed to contain and show any HTML content.
18
18
  * It provides modal and dragging functionality,
@@ -2,7 +2,7 @@ import { JSXInterface } from '../jsx';
2
2
  import { PropertyValues } from '@refinitiv-ui/core';
3
3
  import '../icon/index.js';
4
4
  import { TextField } from '../text-field/index.js';
5
- import { TemplateMap } from '@refinitiv-ui/core/lib/directives/template-map.js';
5
+ import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
6
6
  /**
7
7
  * A form control element for email.
8
8
  *
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
- import { customElement } from '@refinitiv-ui/core/lib/decorators/custom-element.js';
3
- import { property } from '@refinitiv-ui/core/lib/decorators/property.js';
2
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
3
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
4
4
  import '../icon/index.js';
5
5
  import { TextField } from '../text-field/index.js';
6
6
  /**
@@ -60,7 +60,12 @@ let EmailField = class EmailField extends TextField {
60
60
  * @returns template map
61
61
  */
62
62
  get decorateInputMap() {
63
- return Object.assign(Object.assign({}, super.decorateInputMap), { 'type': 'email', 'inputmode': 'email', 'multiple': this.multiple });
63
+ return {
64
+ ...super.decorateInputMap,
65
+ 'type': 'email',
66
+ 'inputmode': 'email',
67
+ 'multiple': this.multiple
68
+ };
64
69
  }
65
70
  /**
66
71
  * Check if input should be re-validated
package/lib/flag/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { BasicElement, svg, 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 { unsafeHTML } from '@refinitiv-ui/core/lib/directives/unsafe-html.js';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
+ import { unsafeHTML } from '@refinitiv-ui/core/directives/unsafe-html.js';
6
6
  import { VERSION } from '../version.js';
7
7
  import { FlagLoader } from './utils/FlagLoader.js';
8
8
  export { preload } from './utils/FlagLoader.js';
@@ -1,4 +1,4 @@
1
- import { CdnLoader } from '@refinitiv-ui/utils/lib/loader.js';
1
+ import { CdnLoader } from '@refinitiv-ui/utils/loader.js';
2
2
  /**
3
3
  * Caches and provides flag SVGs, Loaded either by name from CDN or directly by URL.
4
4
  * Uses singleton pattern
@@ -1,4 +1,4 @@
1
- import { CdnLoader, Deferred } from '@refinitiv-ui/utils/lib/loader.js';
1
+ import { CdnLoader, Deferred } from '@refinitiv-ui/utils/loader.js';
2
2
  const isUrl = (str) => (/^https?:\/\//i).test(str);
3
3
  /**
4
4
  * Caches and provides flag SVGs, Loaded either by name from CDN or directly by URL.
@@ -1,7 +1,7 @@
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
6
  /**
7
7
  * Use to identify and separate different sections of a page.
@@ -1,4 +1,4 @@
1
- import { ColorCommonInstance } from '@refinitiv-ui/utils/lib/color.js';
1
+ import { ColorCommonInstance } from '@refinitiv-ui/utils/color.js';
2
2
  import { interpolate } from 'd3-interpolate';
3
3
  /**
4
4
  * Check if the color is a light color
@@ -1,5 +1,5 @@
1
1
  /* istanbul ignore file */
2
- import { color, rgb, hsl } from '@refinitiv-ui/utils/lib/color.js';
2
+ import { color, rgb, hsl } from '@refinitiv-ui/utils/color.js';
3
3
  import { interpolate } from 'd3-interpolate';
4
4
  /**
5
5
  * Check if the color is a light color
@@ -16,8 +16,7 @@ const isLight = (col) => {
16
16
  * @return a color brighter than original color
17
17
  */
18
18
  const brighten = (colorString) => {
19
- var _a;
20
- return ((_a = color(colorString)) === null || _a === void 0 ? void 0 : _a.brighter(0.8).toString()) || '';
19
+ return color(colorString)?.brighter(0.8).toString() || '';
21
20
  };
22
21
  /**
23
22
  * Darkens a color
@@ -38,7 +37,6 @@ const darken = (colorString) => {
38
37
  * @returns a new blended color
39
38
  */
40
39
  const blend = (color1, color2, backgroundColor, amount) => {
41
- var _a;
42
40
  let primaryColor;
43
41
  let secondaryColor;
44
42
  if (amount >= 0) {
@@ -63,6 +61,6 @@ const blend = (color1, color2, backgroundColor, amount) => {
63
61
  const red = mixRedComponent ? Math.round(interpolate(primaryColor.r, secondaryColor.r)(factor)) : primaryColor.r;
64
62
  const green = mixGreenComponent ? Math.round(interpolate(primaryColor.g, secondaryColor.g)(factor)) : primaryColor.g;
65
63
  const blue = mixBlueComponent ? Math.round(interpolate(primaryColor.b, secondaryColor.b)(factor)) : primaryColor.b;
66
- return ((_a = color(`rgb(${red}, ${green}, ${blue})`)) === null || _a === void 0 ? void 0 : _a.toString()) || '';
64
+ return color(`rgb(${red}, ${green}, ${blue})`)?.toString() || '';
67
65
  };
68
66
  export { blend, brighten, darken, isLight, interpolate };
@@ -1,11 +1,11 @@
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';
5
- import { query } from '@refinitiv-ui/core/lib/decorators/query.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
6
  import { VERSION } from '../version.js';
7
- import { MicroTaskRunner } from '@refinitiv-ui/utils/lib/async.js';
8
- import { color } from '@refinitiv-ui/utils/lib/color.js';
7
+ import { MicroTaskRunner } from '@refinitiv-ui/utils/async.js';
8
+ import { color } from '@refinitiv-ui/utils/color.js';
9
9
  import '../canvas/index.js';
10
10
  import '../tooltip/index.js';
11
11
  import { Track } from './helpers/track.js';
@@ -235,8 +235,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
235
235
  * @returns array of row data
236
236
  */
237
237
  get rows() {
238
- var _a;
239
- return this.config && Array.isArray((_a = this.config) === null || _a === void 0 ? void 0 : _a.data) ? this.config.data : [];
238
+ return this.config && Array.isArray(this.config?.data) ? this.config.data : [];
240
239
  }
241
240
  /**
242
241
  * Get row count
@@ -250,9 +249,8 @@ let Heatmap = class Heatmap extends ResponsiveElement {
250
249
  * @returns count of columns
251
250
  */
252
251
  get columnCount() {
253
- var _a;
254
252
  let result = 0;
255
- (_a = this.rows) === null || _a === void 0 ? void 0 : _a.forEach(columns => {
253
+ this.rows?.forEach(columns => {
256
254
  if (columns.length > result) {
257
255
  result = columns.length;
258
256
  }
@@ -393,11 +391,10 @@ let Heatmap = class Heatmap extends ResponsiveElement {
393
391
  */
394
392
  /* istanbul ignore next */
395
393
  updateTooltipOverlayPosition(cell) {
396
- var _a, _b, _c;
397
394
  // Compensate x-axis height for overlay when x-axis is at top position
398
395
  let marginOverlayTop = 0;
399
- if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.xAxis) && ((_b = this.xAxis) === null || _b === void 0 ? void 0 : _b.offsetHeight)) {
400
- marginOverlayTop = this.config.xAxis.position === 'bottom' ? 0 : (_c = this.xAxis) === null || _c === void 0 ? void 0 : _c.offsetHeight;
396
+ if (this.config?.xAxis && this.xAxis?.offsetHeight) {
397
+ marginOverlayTop = this.config.xAxis.position === 'bottom' ? 0 : this.xAxis?.offsetHeight;
401
398
  }
402
399
  // Update overlay position
403
400
  this.tooltipOverlay.style.left = `${cell.x}px`;
@@ -481,8 +478,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
481
478
  */
482
479
  /* istanbul ignore next */
483
480
  resetCell(cell) {
484
- var _a;
485
- (_a = this.canvasContext) === null || _a === void 0 ? void 0 : _a.clearRect(cell.x, cell.y, cell.width, cell.height);
481
+ this.canvasContext?.clearRect(cell.x, cell.y, cell.width, cell.height);
486
482
  }
487
483
  /**
488
484
  * Fades a cell's background from one color to another
@@ -525,14 +521,13 @@ let Heatmap = class Heatmap extends ResponsiveElement {
525
521
  * @returns {void}
526
522
  */
527
523
  calculateCellData() {
528
- var _a, _b, _c;
529
524
  // Reset cell
530
525
  this.cells = [];
531
526
  if (!this.axisHidden) {
532
- if (this.yAxis && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.yAxis)) {
527
+ if (this.yAxis && this.config?.yAxis) {
533
528
  this.rowTrack.init(this.yAxis.offsetHeight, this.rowCount);
534
529
  }
535
- if (this.xAxis && ((_b = this.config) === null || _b === void 0 ? void 0 : _b.xAxis)) {
530
+ if (this.xAxis && this.config?.xAxis) {
536
531
  this.colTrack.init(this.xAxis.offsetWidth, this.columnCount);
537
532
  }
538
533
  }
@@ -545,7 +540,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
545
540
  const cellHeader = cell && cell.header ? cell.header : '';
546
541
  const cellIndex = rowIndex * this.colTrack.laneCount + columnIndex;
547
542
  const foregroundColor = this.foregroundColor;
548
- const backgroundColor = ((_c = this.getBackgroundColor(cellValue)) === null || _c === void 0 ? void 0 : _c.toString()) || '';
543
+ const backgroundColor = this.getBackgroundColor(cellValue)?.toString() || '';
549
544
  if (cellHeader) {
550
545
  this.hasCellHeader = true;
551
546
  }
@@ -821,8 +816,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
821
816
  * @returns {void}
822
817
  */
823
818
  paintAllCellBackground() {
824
- var _a;
825
- (_a = this.canvasContext) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, this.canvas.width, this.canvas.height);
819
+ this.canvasContext?.clearRect(0, 0, this.canvas.width, this.canvas.height);
826
820
  for (let index = 0; index < this.cells.length; index++) {
827
821
  this.paintCellBackground(this.cells[index]);
828
822
  }
@@ -843,11 +837,10 @@ let Heatmap = class Heatmap extends ResponsiveElement {
843
837
  * @returns {void}
844
838
  */
845
839
  renderAxisX() {
846
- var _a;
847
840
  if (!this.isSizeCalculated) {
848
841
  return;
849
842
  }
850
- const axisConfig = (_a = this.config) === null || _a === void 0 ? void 0 : _a.xAxis;
843
+ const axisConfig = this.config?.xAxis;
851
844
  if (!this.xAxis || !this.yAxisBox || !axisConfig) {
852
845
  return;
853
846
  }
@@ -909,11 +902,10 @@ let Heatmap = class Heatmap extends ResponsiveElement {
909
902
  * @returns {void}
910
903
  */
911
904
  renderAxisY() {
912
- var _a, _b;
913
905
  if (!this.isSizeCalculated) {
914
906
  return;
915
907
  }
916
- const axisConfig = (_a = this.config) === null || _a === void 0 ? void 0 : _a.yAxis;
908
+ const axisConfig = this.config?.yAxis;
917
909
  if (!this.yAxis || !axisConfig) {
918
910
  return;
919
911
  }
@@ -979,7 +971,7 @@ let Heatmap = class Heatmap extends ResponsiveElement {
979
971
  }
980
972
  element.textContent = labels[i] || nbsp;
981
973
  }
982
- if (this.xAxis && ((_b = this.config) === null || _b === void 0 ? void 0 : _b.xAxis)) {
974
+ if (this.xAxis && this.config?.xAxis) {
983
975
  // TODO: Wrong crossBox margin calculation when margin = 0.5px
984
976
  this.crossBox.style.margin = `${this.cellMargin}px`;
985
977
  this.crossBox.style.height = `${this.xAxis.children[0].offsetHeight}px`;
@@ -1015,16 +1007,15 @@ let Heatmap = class Heatmap extends ResponsiveElement {
1015
1007
  * @return Render template
1016
1008
  */
1017
1009
  render() {
1018
- var _a, _b;
1019
1010
  return html `
1020
1011
  <div id="container" @mousemove=${this.onMouseMove} @mouseleave=${this.onMouseLeave}>
1021
- ${((_a = this.config) === null || _a === void 0 ? void 0 : _a.yAxis) && !this.axisHidden ? html `
1012
+ ${this.config?.yAxis && !this.axisHidden ? html `
1022
1013
  <div id="y-axis-container">
1023
1014
  <div part="cross-box"></div>
1024
1015
  <div part="y-axis"></div>
1025
1016
  </div>` : null}
1026
1017
  <div id="canvas-container">
1027
- ${((_b = this.config) === null || _b === void 0 ? void 0 : _b.xAxis) && !this.axisHidden ? html `<div part="x-axis"></div>` : null}
1018
+ ${this.config?.xAxis && !this.axisHidden ? html `<div part="x-axis"></div>` : null}
1028
1019
  <ef-canvas part="canvas" @resize=${this.onCanvasResize}></ef-canvas>
1029
1020
  ${this.tooltipCallback ? html `<div id="tooltip-overlay"></div>` : null}
1030
1021
  </div>
package/lib/icon/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { BasicElement, svg, 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 { unsafeSVG } from '@refinitiv-ui/core/lib/directives/unsafe-svg.js';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
+ import { unsafeSVG } from '@refinitiv-ui/core/directives/unsafe-svg.js';
6
6
  import { VERSION } from '../version.js';
7
7
  import { IconLoader } from './utils/IconLoader.js';
8
8
  export { preload } from './utils/IconLoader.js';
@@ -1,4 +1,4 @@
1
- import { CdnLoader } from '@refinitiv-ui/utils/lib/loader.js';
1
+ import { CdnLoader } from '@refinitiv-ui/utils/loader.js';
2
2
  /**
3
3
  * Caches and provides icon SVGs, Loaded either by name from CDN or directly by URL.
4
4
  * Uses singleton pattern
@@ -1,4 +1,4 @@
1
- import { CdnLoader, Deferred } from '@refinitiv-ui/utils/lib/loader.js';
1
+ import { CdnLoader, Deferred } from '@refinitiv-ui/utils/loader.js';
2
2
  const isUrl = (str) => (/^(https?:\/{2}|\.?\/)/i).test(str);
3
3
  /**
4
4
  * Caches and provides icon SVGs, Loaded either by name from CDN or directly by URL.
@@ -1,5 +1,5 @@
1
1
  import type { LineData, BarData, HistogramData, DeepPartial, ChartOptions, SeriesPartialOptions, LineSeriesPartialOptions, AreaSeriesPartialOptions, BarSeriesPartialOptions, CandlestickSeriesPartialOptions, HistogramSeriesPartialOptions, LineStyleOptions, AreaStyleOptions, BarStyleOptions, CandlestickStyleOptions, HistogramStyleOptions, ISeriesApi, SeriesType } from 'lightweight-charts';
2
- import type { RGBColor, HSLColor } from '@refinitiv-ui/utils/lib/color.js';
2
+ import type { RGBColor, HSLColor } from '@refinitiv-ui/utils/color.js';
3
3
  declare type SeriesOptions = AreaSeriesPartialOptions | BarSeriesPartialOptions | CandlestickSeriesPartialOptions | HistogramSeriesPartialOptions | LineSeriesPartialOptions;
4
4
  declare type SeriesStyleOptions = LineStyleOptions & AreaStyleOptions & BarStyleOptions & CandlestickStyleOptions & HistogramStyleOptions;
5
5
  declare type SeriesData = LineData[] | BarData[] | HistogramData[];
@@ -1,11 +1,11 @@
1
1
  var InteractiveChart_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { ResponsiveElement, html, css, DeprecationNotice } 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';
6
- import { query } from '@refinitiv-ui/core/lib/decorators/query.js';
4
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
5
+ import { property } from '@refinitiv-ui/core/decorators/property.js';
6
+ import { query } from '@refinitiv-ui/core/decorators/query.js';
7
7
  import { VERSION } from '../version.js';
8
- import { color as parseColor } from '@refinitiv-ui/utils/lib/color.js';
8
+ import { color as parseColor } from '@refinitiv-ui/utils/color.js';
9
9
  import { createChart as chart } from 'lightweight-charts';
10
10
  import '../tooltip/index.js';
11
11
  import { LegendStyle } from './helpers/types.js';
@@ -592,8 +592,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
592
592
  * @return position
593
593
  */
594
594
  getPriceScalePosition() {
595
- var _a;
596
- const priceScale = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.options();
595
+ const priceScale = this.chart?.options();
597
596
  if (priceScale.leftPriceScale.visible && priceScale.rightPriceScale.visible) {
598
597
  return 'two-price';
599
598
  }
@@ -661,14 +660,14 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
661
660
  let value;
662
661
  let priceColor = '';
663
662
  // When have price on event moved on the crosshair
664
- if ((eventMove === null || eventMove === void 0 ? void 0 : eventMove.seriesPrices.get(this.seriesList[idx])) && eventMove.time) {
663
+ if (eventMove?.seriesPrices.get(this.seriesList[idx]) && eventMove.time) {
665
664
  value = eventMove.seriesPrices.get(this.seriesList[idx]);
666
665
  priceColor = this.getColorInSeries(eventMove, chartType, idx);
667
666
  this.isCrosshairVisible = true;
668
667
  this.hasDataPoint = true;
669
668
  }
670
669
  // when there's no data point in the series object.
671
- else if (!(eventMove === null || eventMove === void 0 ? void 0 : eventMove.seriesPrices.get(this.seriesList[idx])) && (eventMove === null || eventMove === void 0 ? void 0 : eventMove.time)) {
670
+ else if (!eventMove?.seriesPrices.get(this.seriesList[idx]) && eventMove?.time) {
672
671
  value = NO_DATA_POINT;
673
672
  this.isCrosshairVisible = true;
674
673
  this.hasDataPoint = false;
@@ -811,7 +810,6 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
811
810
  * @returns {void}
812
811
  */
813
812
  createTextPrice(rowLegend, price, priceColor, index) {
814
- var _a;
815
813
  const formatter = this.internalConfig.series[index].legendPriceFormatter;
816
814
  // Formats legend only when formatter and data point are provided
817
815
  const formattedPrice = !!formatter && price !== NO_DATA_POINT ? formatter(price) : price;
@@ -823,7 +821,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
823
821
  // Handle update text price when mouse crosshairMove in chart
824
822
  else if (this.isNodeListElement(rowLegend)) {
825
823
  const symbolElem = rowLegend[index].children[0];
826
- const spanIndex = ((_a = symbolElem.getAttribute('class')) === null || _a === void 0 ? void 0 : _a.indexOf('symbol')) === 0 ? 1 : 0;
824
+ const spanIndex = symbolElem.getAttribute('class')?.indexOf('symbol') === 0 ? 1 : 0;
827
825
  const rowLegendElem = rowLegend[index];
828
826
  rowLegendElem.children[spanIndex].textContent = `${formattedPrice}`;
829
827
  rowLegendElem.children[spanIndex].style.color = `${priceColor}`;
@@ -889,12 +887,11 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
889
887
  * @returns color value
890
888
  */
891
889
  getColorInSeries(seriesData, chartType, index) {
892
- var _a;
893
890
  if (chartType === 'line') {
894
891
  return this.getLegendPriceColor(this.seriesList[index].options().color);
895
892
  }
896
893
  else if (chartType === 'candlestick') {
897
- const value = seriesData.hasOwnProperty('seriesPrices') ? (_a = seriesData) === null || _a === void 0 ? void 0 : _a.seriesPrices.get(this.seriesList[index]) : seriesData;
894
+ const value = seriesData.hasOwnProperty('seriesPrices') ? seriesData?.seriesPrices.get(this.seriesList[index]) : seriesData;
898
895
  const barStyle = this.seriesList[index].options();
899
896
  const colorBar = value.close > value.open ? barStyle.borderUpColor : barStyle.borderDownColor;
900
897
  return colorBar;
@@ -967,8 +964,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
967
964
  * @returns {void}
968
965
  */
969
966
  updateLegendWithLatestData() {
970
- var _a;
971
- if (this.rowLegend && !this.isCrosshairVisible && ((_a = this.config) === null || _a === void 0 ? void 0 : _a.hasOwnProperty('series'))) {
967
+ if (this.rowLegend && !this.isCrosshairVisible && this.config?.hasOwnProperty('series')) {
972
968
  for (let idx = 0; idx < this.internalConfig.series.length; idx++) {
973
969
  const chartType = this.internalConfig.series[idx].type;
974
970
  const series = this.internalConfig.series[idx];
@@ -1,4 +1,4 @@
1
- import type { DataItem } from '@refinitiv-ui/utils/lib/collection.js';
1
+ import type { DataItem } from '@refinitiv-ui/utils/collection.js';
2
2
  export declare type ItemType = 'text' | 'header' | 'divider';
3
3
  interface CommonItem extends DataItem {
4
4
  /**