@refinitiv-ui/elements 7.0.0-next.4 → 7.0.0-next.5

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 (38) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/lib/calendar/index.js +2 -6
  3. package/lib/chart/elements/chart.d.ts +1 -1
  4. package/lib/chart/elements/chart.js +1 -1
  5. package/lib/chart/plugins/doughnut-center-label.d.ts +4 -4
  6. package/lib/chart/plugins/doughnut-center-label.js +2 -2
  7. package/lib/collapse/index.js +0 -2
  8. package/lib/configuration/custom-elements.json +15 -0
  9. package/lib/configuration/custom-elements.md +7 -0
  10. package/lib/configuration/elements/configuration.d.ts +44 -0
  11. package/lib/configuration/elements/configuration.js +46 -0
  12. package/lib/configuration/helpers/context.d.ts +5 -0
  13. package/lib/configuration/helpers/context.js +3 -0
  14. package/lib/configuration/helpers/types.d.ts +9 -0
  15. package/lib/configuration/helpers/types.js +1 -0
  16. package/lib/configuration/index.d.ts +3 -0
  17. package/lib/configuration/index.js +2 -0
  18. package/lib/datetime-picker/index.js +0 -2
  19. package/lib/flag/index.d.ts +0 -14
  20. package/lib/flag/index.js +7 -31
  21. package/lib/icon/index.d.ts +26 -18
  22. package/lib/icon/index.js +64 -40
  23. package/lib/icon/themes/halo/dark/index.js +1 -1
  24. package/lib/icon/themes/halo/light/index.js +1 -1
  25. package/lib/icon/themes/solar/charcoal/index.js +1 -1
  26. package/lib/icon/themes/solar/pearl/index.js +1 -1
  27. package/lib/icon/utils/IconLoader.d.ts +0 -8
  28. package/lib/icon/utils/IconLoader.js +0 -10
  29. package/lib/icon/utils/SpriteLoader.d.ts +22 -0
  30. package/lib/icon/utils/SpriteLoader.js +38 -0
  31. package/lib/interactive-chart/index.d.ts +0 -11
  32. package/lib/interactive-chart/index.js +4 -15
  33. package/lib/number-field/index.d.ts +6 -0
  34. package/lib/number-field/index.js +25 -1
  35. package/lib/password-field/index.js +0 -6
  36. package/lib/tree/elements/tree-item.js +0 -2
  37. package/lib/version.js +1 -1
  38. package/package.json +18 -16
package/CHANGELOG.md CHANGED
@@ -3,6 +3,50 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.8.6](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.5...@refinitiv-ui/elements@6.8.6) (2023-06-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **calendar, datetime-picker:** prevent deselect date on calendar ([#735](https://github.com/Refinitiv/refinitiv-ui/issues/735)) ([4b0799a](https://github.com/Refinitiv/refinitiv-ui/commit/4b0799a19725cba456fa41be35de24b79df466c5))
12
+ * **number-field:** fix Floating point Division on validate method ([#757](https://github.com/Refinitiv/refinitiv-ui/issues/757)) ([a7095ae](https://github.com/Refinitiv/refinitiv-ui/commit/a7095ae861e0948f95cc73ac68d31eb5585a54a6))
13
+
14
+
15
+
16
+
17
+
18
+ ## [6.8.5](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.4...@refinitiv-ui/elements@6.8.5) (2023-06-08)
19
+
20
+ **Note:** Version bump only for package @refinitiv-ui/elements
21
+
22
+
23
+
24
+
25
+
26
+ ## [6.8.4](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.4-next.1...@refinitiv-ui/elements@6.8.4) (2023-06-07)
27
+
28
+ **Note:** Version bump only for package @refinitiv-ui/elements
29
+
30
+
31
+
32
+
33
+
34
+ ## [6.8.4-next.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.4-next.0...@refinitiv-ui/elements@6.8.4-next.1) (2023-06-06)
35
+
36
+ **Note:** Version bump only for package @refinitiv-ui/elements
37
+
38
+
39
+
40
+
41
+
42
+ ## [6.8.3](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.2...@refinitiv-ui/elements@6.8.3) (2023-06-06)
43
+
44
+ **Note:** Version bump only for package @refinitiv-ui/elements
45
+
46
+
47
+
48
+
49
+
6
50
  ## [6.8.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.8.1...@refinitiv-ui/elements@6.8.2) (2023-05-24)
7
51
 
8
52
 
@@ -789,16 +789,12 @@ let Calendar = class Calendar extends ControlElement {
789
789
  values = [value];
790
790
  }
791
791
  }
792
- else if (this.values.indexOf(value) === -1) {
793
- values = [value];
794
- }
795
792
  else {
796
- // remove range if start/end index match
797
- values = [];
793
+ values = [value];
798
794
  }
799
795
  }
800
796
  else {
801
- values = this.value === value ? [] : [value];
797
+ values = [value];
802
798
  }
803
799
  this.notifyValuesChange(values);
804
800
  }
@@ -7,7 +7,7 @@ import 'chartjs-adapter-date-fns';
7
7
  import { DatasetColors } from '../helpers/index.js';
8
8
  import '../../header/index.js';
9
9
  declare module 'chart.js' {
10
- interface PluginOptionsByType<TType extends ChartType> {
10
+ interface PluginOptionsByType<TType extends ChartType = ChartType> {
11
11
  'ef-chart': object;
12
12
  }
13
13
  }
@@ -381,7 +381,7 @@ let Chart = class Chart extends BasicElement {
381
381
  ChartJS.defaults.scale.grid.color = (line) => {
382
382
  return line.index === 0 ? this.getComputedVariable('--zero-line-color', 'transparent') : this.getComputedVariable('--grid-line-color', 'transparent');
383
383
  };
384
- if (this.config?.type === 'polarArea' || this.config?.type === 'radar') {
384
+ if (ChartJS.defaults.scales.radialLinear) {
385
385
  ChartJS.defaults.scales.radialLinear.ticks.showLabelBackdrop = false;
386
386
  }
387
387
  }
@@ -1,20 +1,20 @@
1
1
  import { Chart as ChartJS } from 'chart.js';
2
2
  import type { Plugin, ChartType, ActiveElement } from 'chart.js';
3
- interface CenterLabel {
3
+ export interface CenterLabel {
4
4
  label: string;
5
5
  bold?: boolean;
6
6
  }
7
- interface Selected {
7
+ export interface Selected {
8
8
  datasetIndex?: number;
9
9
  index: number;
10
10
  }
11
- interface CenterLabelConfig {
11
+ export interface CenterLabelConfig {
12
12
  defaultText: CenterLabel[];
13
13
  selected: Selected;
14
14
  onRenderLabel(chart: ChartJS, chartItems: ActiveElement[]): CenterLabel[];
15
15
  }
16
16
  declare module 'chart.js' {
17
- interface PluginOptionsByType<TType extends ChartType> {
17
+ interface PluginOptionsByType<TType extends ChartType = ChartType> {
18
18
  'centerLabel'?: CenterLabelConfig;
19
19
  }
20
20
  }
@@ -175,9 +175,9 @@ const plugins = {
175
175
  }
176
176
  const selectedIndex = Number(config.selected?.index);
177
177
  const datasetIndex = Number(config.selected.datasetIndex || 0);
178
- const visibleIndexes = chart.getVisibleDatasetCount() - 1;
178
+ const visibleIndex = chart.getVisibleDatasetCount() - 1;
179
179
  // Validate index and datasetIndex
180
- if (isNaN(selectedIndex) || (isNaN(datasetIndex) || datasetIndex < 0 || datasetIndex > visibleIndexes)) {
180
+ if (isNaN(selectedIndex) || (isNaN(datasetIndex) || datasetIndex < 0 || datasetIndex > visibleIndex)) {
181
181
  return;
182
182
  }
183
183
  // Set selected item to the chart
@@ -5,11 +5,9 @@ import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { state } from '@refinitiv-ui/core/decorators/state.js';
6
6
  import { ref, createRef } from '@refinitiv-ui/core/directives/ref.js';
7
7
  import { VERSION } from '../version.js';
8
- import { preload } from '../icon/index.js';
9
8
  import '../header/index.js';
10
9
  import '../panel/index.js';
11
10
  import '../icon/index.js';
12
- preload('right'); /* preload calendar icons for faster loading */
13
11
  /**
14
12
  * Allows users to hide non-critical information
15
13
  * or areas of the screen, maximizing the amount of real estate
@@ -0,0 +1,15 @@
1
+ {
2
+ "version": "experimental",
3
+ "tags": [
4
+ {
5
+ "name": "ef-configuration",
6
+ "properties": [
7
+ {
8
+ "name": "config",
9
+ "description": "Configuration data",
10
+ "default": "\"DEFAULT_CONFIG\""
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,7 @@
1
+ # ef-configuration
2
+
3
+ ## Properties
4
+
5
+ | Property | Default | Description |
6
+ |----------|------------------|--------------------|
7
+ | `config` | "DEFAULT_CONFIG" | Configuration data |
@@ -0,0 +1,44 @@
1
+ import { JSXInterface } from '../../jsx';
2
+ import { BasicElement, TemplateResult } from '@refinitiv-ui/core';
3
+ import { type Config } from '../helpers/types.js';
4
+ export declare class Configuration extends BasicElement {
5
+ /**
6
+ * Element version number
7
+ * @returns version number
8
+ */
9
+ static get version(): string;
10
+ /**
11
+ * Render slot as light DOM
12
+ * @returns Element
13
+ */
14
+ protected createRenderRoot(): this;
15
+ /**
16
+ * Configuration data
17
+ */
18
+ config: Config;
19
+ /**
20
+ * A `TemplateResult` that will be used
21
+ * to render the updated internal template.
22
+ * @return Render template
23
+ */
24
+ protected render(): TemplateResult;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ 'ef-configuration': Configuration;
29
+ }
30
+ }
31
+
32
+ declare global {
33
+ interface HTMLElementTagNameMap {
34
+ 'ef-configuration': Configuration;
35
+ }
36
+
37
+ namespace JSX {
38
+ interface IntrinsicElements {
39
+ 'ef-configuration': Partial<Configuration> | JSXInterface.HTMLAttributes<Configuration>;
40
+ }
41
+ }
42
+ }
43
+
44
+ export {};
@@ -0,0 +1,46 @@
1
+ import { __decorate } from "tslib";
2
+ import { BasicElement, html } from '@refinitiv-ui/core';
3
+ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
+ import { state } from '@refinitiv-ui/core/decorators/state.js';
5
+ import { VERSION } from '../../version.js';
6
+ import { efConfig, DEFAULT_CONFIG } from '../helpers/context.js';
7
+ import { provide } from '@lit-labs/context';
8
+ let Configuration = class Configuration extends BasicElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ /**
12
+ * Configuration data
13
+ */
14
+ this.config = DEFAULT_CONFIG;
15
+ }
16
+ /**
17
+ * Element version number
18
+ * @returns version number
19
+ */
20
+ static get version() {
21
+ return VERSION;
22
+ }
23
+ /**
24
+ * Render slot as light DOM
25
+ * @returns Element
26
+ */
27
+ createRenderRoot() {
28
+ return this;
29
+ }
30
+ /**
31
+ * A `TemplateResult` that will be used
32
+ * to render the updated internal template.
33
+ * @return Render template
34
+ */
35
+ render() {
36
+ return html `<slot></slot>`;
37
+ }
38
+ };
39
+ __decorate([
40
+ provide({ context: efConfig }),
41
+ state()
42
+ ], Configuration.prototype, "config", void 0);
43
+ Configuration = __decorate([
44
+ customElement('ef-configuration', { theme: false })
45
+ ], Configuration);
46
+ export { Configuration };
@@ -0,0 +1,5 @@
1
+ import type { Config } from './types.js';
2
+ export declare const DEFAULT_CONFIG: Config;
3
+ export declare const efConfig: {
4
+ __context__: Config;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from '@lit-labs/context';
2
+ export const DEFAULT_CONFIG = { icon: { map: {} } };
3
+ export const efConfig = createContext('ef-configuration');
@@ -0,0 +1,9 @@
1
+ export type IconMap = {
2
+ [key: string]: string;
3
+ };
4
+ export type ConfigIcon = {
5
+ map: IconMap;
6
+ };
7
+ export type Config = {
8
+ icon: ConfigIcon;
9
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './elements/configuration.js';
2
+ export { efConfig } from './helpers/context.js';
3
+ export type { Config } from './helpers/types.js';
@@ -0,0 +1,2 @@
1
+ export * from './elements/configuration.js';
2
+ export { efConfig } from './helpers/context.js';
@@ -16,8 +16,6 @@ import inputParse from 'date-fns/esm/parse/index.js';
16
16
  import isValid from 'date-fns/esm/isValid/index.js';
17
17
  import { addMonths, subMonths, isAfter, isBefore, isValidDate, isValidDateTime, DateFormat, DateTimeFormat, parse, format } from '@refinitiv-ui/utils/date.js';
18
18
  import { DateTimeSegment, formatToView, getCurrentTime } from './utils.js';
19
- import { preload } from '../icon/index.js';
20
- preload('calendar', 'down', 'left', 'right'); /* preload calendar icons for faster loading */
21
19
  const POPUP_POSITION = ['bottom-start', 'top-start', 'bottom-end', 'top-end', 'bottom-middle', 'top-middle'];
22
20
  const INPUT_FORMAT = {
23
21
  DATE: 'dd-MMM-yyyy',
@@ -22,20 +22,6 @@ export declare class Flag extends BasicElement {
22
22
  */
23
23
  get flag(): string | null;
24
24
  set flag(value: string | null);
25
- private _src;
26
- /**
27
- * Src location of an svg flag.
28
- * @ignore
29
- * @example https://cdn.io/flags/gb.svg
30
- * @deprecated Use `flag` instead
31
- * @default null
32
- */
33
- get src(): string | null;
34
- /**
35
- * @ignore
36
- * @param value Location of an svg
37
- */
38
- set src(value: string | null);
39
25
  private _template;
40
26
  /**
41
27
  * The flag template to render
package/lib/flag/index.js CHANGED
@@ -53,32 +53,6 @@ let Flag = class Flag extends BasicElement {
53
53
  void this.setFlagSrc();
54
54
  }
55
55
  }
56
- /**
57
- * Src location of an svg flag.
58
- * @ignore
59
- * @example https://cdn.io/flags/gb.svg
60
- * @deprecated Use `flag` instead
61
- * @default null
62
- */
63
- get src() {
64
- return this._src;
65
- }
66
- /**
67
- * @ignore
68
- * @param value Location of an svg
69
- */
70
- set src(value) {
71
- if (this.src !== value) {
72
- this.deferFlagReady();
73
- this._src = value;
74
- if (value) {
75
- void this.loadAndRenderFlag(value);
76
- }
77
- else {
78
- this.clearFlag();
79
- }
80
- }
81
- }
82
56
  /**
83
57
  * The flag template to render
84
58
  */
@@ -95,7 +69,6 @@ let Flag = class Flag extends BasicElement {
95
69
  constructor() {
96
70
  super();
97
71
  this._flag = null;
98
- this._src = null;
99
72
  this._template = EmptyTemplate;
100
73
  this.flagReady = new Deferred();
101
74
  // `flagReady` resolves at this stage so that `updateComplete` would be resolvable
@@ -132,7 +105,13 @@ let Flag = class Flag extends BasicElement {
132
105
  */
133
106
  async setFlagSrc() {
134
107
  // keep `src` in-sync with `flag` so that flag svg would be resolved after every `flag` update
135
- this.src = this.flag ? await FlagLoader.getSrc(this.flag) : this.flag;
108
+ const value = this.flag ? await FlagLoader.getSrc(this.flag) : this.flag;
109
+ if (value) {
110
+ await this.loadAndRenderFlag(value);
111
+ }
112
+ else {
113
+ this.clearFlag();
114
+ }
136
115
  }
137
116
  /**
138
117
  * Tries to load an flag from the url provided
@@ -176,9 +155,6 @@ let Flag = class Flag extends BasicElement {
176
155
  __decorate([
177
156
  property({ type: String })
178
157
  ], Flag.prototype, "flag", null);
179
- __decorate([
180
- property({ type: String })
181
- ], Flag.prototype, "src", null);
182
158
  Flag = __decorate([
183
159
  customElement('ef-flag')
184
160
  ], Flag);
@@ -1,12 +1,17 @@
1
1
  import { JSXInterface } from '../jsx';
2
2
  import { BasicElement, CSSResultGroup, TemplateResult, PropertyValues } from '@refinitiv-ui/core';
3
- export { preload } from './utils/IconLoader.js';
3
+ import { type Config } from '../configuration/index.js';
4
4
  export declare class Icon extends BasicElement {
5
5
  /**
6
6
  * Element version number
7
7
  * @returns version number
8
8
  */
9
9
  static get version(): string;
10
+ /**
11
+ * Icon map from ef-configuration
12
+ * @ignore
13
+ */
14
+ config?: Config;
10
15
  /**
11
16
  * A `CSSResultGroup` that will be used
12
17
  * to style the host, slotted children
@@ -17,25 +22,11 @@ export declare class Icon extends BasicElement {
17
22
  private _icon;
18
23
  /**
19
24
  * Name of a known icon to render or URL of SVG icon.
20
- * @example home | https://cdn.io/icons/home.svg
25
+ * @example heart | https://cdn.io/icons/heart.svg
21
26
  * @default null
22
27
  */
23
28
  get icon(): string | null;
24
29
  set icon(value: string | null);
25
- private _src;
26
- /**
27
- * Src location of an svg icon.
28
- * @ignore
29
- * @example https://cdn.io/icons/home.svg
30
- * @deprecated Use `icon` instead
31
- * @default null
32
- */
33
- get src(): string | null;
34
- /**
35
- * @ignore
36
- * @param value Location of an svg
37
- */
38
- set src(value: string | null);
39
30
  private _template;
40
31
  /**
41
32
  * The icon template to render
@@ -49,6 +40,11 @@ export declare class Icon extends BasicElement {
49
40
  */
50
41
  private iconReady;
51
42
  constructor();
43
+ /**
44
+ * Check if the icon map configuration has content
45
+ * @returns icon map if exists
46
+ */
47
+ private get iconMap();
52
48
  /**
53
49
  * Called after the component is first rendered
54
50
  * @param changedProperties Properties which have changed
@@ -62,10 +58,15 @@ export declare class Icon extends BasicElement {
62
58
  */
63
59
  private deferIconReady;
64
60
  /**
65
- * Helper method, used to set the icon src.
61
+ * Check if the icon is valid to render
62
+ * @returns false if icon value or icon map value is invalid
63
+ */
64
+ private isIconValid;
65
+ /**
66
+ * Update the icon renderer
66
67
  * @returns {void}
67
68
  */
68
- private setIconSrc;
69
+ private updateRenderer;
69
70
  /**
70
71
  * Tries to load an icon from the url provided
71
72
  * and the renders this into the icon template.
@@ -73,6 +74,13 @@ export declare class Icon extends BasicElement {
73
74
  * @returns {void}
74
75
  */
75
76
  private loadAndRenderIcon;
77
+ /**
78
+ * Tries to load get an icon from the sprite url provided
79
+ * and the renders this into the icon template.
80
+ * @param iconName Name of the svg icon.
81
+ * @returns {void}
82
+ */
83
+ private loadAndRenderSpriteIcon;
76
84
  /**
77
85
  * Get and cache CDN prefix
78
86
  * This is a private URL which is set in the theme
package/lib/icon/index.js CHANGED
@@ -3,10 +3,12 @@ import { BasicElement, svg, css } 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 { unsafeSVG } from '@refinitiv-ui/core/directives/unsafe-svg.js';
6
- import { Deferred } from '@refinitiv-ui/utils/loader.js';
6
+ import { Deferred, isUrl, isBase64svg } from '@refinitiv-ui/utils/loader.js';
7
7
  import { VERSION } from '../version.js';
8
8
  import { IconLoader } from './utils/IconLoader.js';
9
- export { preload } from './utils/IconLoader.js';
9
+ import { consume } from '@lit-labs/context';
10
+ import { efConfig } from '../configuration/index.js';
11
+ import { SpriteLoader } from './utils/SpriteLoader.js';
10
12
  const EmptyTemplate = svg ``;
11
13
  /**
12
14
  * Cache for reusing SVG template results across multiple icons.
@@ -44,7 +46,7 @@ let Icon = class Icon extends BasicElement {
44
46
  }
45
47
  /**
46
48
  * Name of a known icon to render or URL of SVG icon.
47
- * @example home | https://cdn.io/icons/home.svg
49
+ * @example heart | https://cdn.io/icons/heart.svg
48
50
  * @default null
49
51
  */
50
52
  get icon() {
@@ -55,36 +57,10 @@ let Icon = class Icon extends BasicElement {
55
57
  if (oldValue !== value) {
56
58
  this.deferIconReady();
57
59
  this._icon = value;
58
- void this.setIconSrc();
60
+ requestAnimationFrame(() => this.updateRenderer());
59
61
  this.requestUpdate('icon', oldValue);
60
62
  }
61
63
  }
62
- /**
63
- * Src location of an svg icon.
64
- * @ignore
65
- * @example https://cdn.io/icons/home.svg
66
- * @deprecated Use `icon` instead
67
- * @default null
68
- */
69
- get src() {
70
- return this._src;
71
- }
72
- /**
73
- * @ignore
74
- * @param value Location of an svg
75
- */
76
- set src(value) {
77
- if (this.src !== value) {
78
- this.deferIconReady();
79
- this._src = value;
80
- if (value) {
81
- void this.loadAndRenderIcon(value);
82
- }
83
- else {
84
- this.clearIcon();
85
- }
86
- }
87
- }
88
64
  /**
89
65
  * The icon template to render
90
66
  */
@@ -101,13 +77,19 @@ let Icon = class Icon extends BasicElement {
101
77
  constructor() {
102
78
  super();
103
79
  this._icon = null;
104
- this._src = null;
105
80
  this._template = EmptyTemplate;
106
81
  this.iconReady = new Deferred();
107
82
  // `iconReady` resolves at this stage so that `updateComplete` would be resolvable
108
83
  // even in the case that both `icon` and `src` attribute are missing.
109
84
  this.iconReady.resolve();
110
85
  }
86
+ /**
87
+ * Check if the icon map configuration has content
88
+ * @returns icon map if exists
89
+ */
90
+ get iconMap() {
91
+ return this.icon && this.config?.icon.map[this.icon] || null;
92
+ }
111
93
  /**
112
94
  * Called after the component is first rendered
113
95
  * @param changedProperties Properties which have changed
@@ -133,12 +115,36 @@ let Icon = class Icon extends BasicElement {
133
115
  this.iconReady = new Deferred();
134
116
  }
135
117
  /**
136
- * Helper method, used to set the icon src.
118
+ * Check if the icon is valid to render
119
+ * @returns false if icon value or icon map value is invalid
120
+ */
121
+ isIconValid() {
122
+ if (!this._icon) {
123
+ return false;
124
+ }
125
+ if (this.iconMap && (!isBase64svg(this.iconMap) && !isUrl(this.iconMap))) {
126
+ return false;
127
+ }
128
+ return true;
129
+ }
130
+ /**
131
+ * Update the icon renderer
137
132
  * @returns {void}
138
133
  */
139
- async setIconSrc() {
140
- // keep `src` in-sync with `icon` so that icon svg would be resolved after every `icon` update
141
- this.src = this.icon ? await IconLoader.getSrc(this.icon) : this.icon;
134
+ updateRenderer() {
135
+ if (!this.isIconValid()) {
136
+ return this.clearIcon();
137
+ }
138
+ const iconProperty = this._icon;
139
+ if (this.iconMap) {
140
+ void this.loadAndRenderIcon(this.iconMap);
141
+ }
142
+ else if (isUrl(iconProperty) || IconLoader.isPrefixSet) {
143
+ void this.loadAndRenderIcon(iconProperty);
144
+ }
145
+ else {
146
+ void this.loadAndRenderSpriteIcon(iconProperty);
147
+ }
142
148
  }
143
149
  /**
144
150
  * Tries to load an icon from the url provided
@@ -155,6 +161,21 @@ let Icon = class Icon extends BasicElement {
155
161
  }
156
162
  this.template = await iconTemplateCacheItem;
157
163
  }
164
+ /**
165
+ * Tries to load get an icon from the sprite url provided
166
+ * and the renders this into the icon template.
167
+ * @param iconName Name of the svg icon.
168
+ * @returns {void}
169
+ */
170
+ async loadAndRenderSpriteIcon(iconName) {
171
+ const iconTemplateCacheItem = iconTemplateCache.get(iconName);
172
+ if (!iconTemplateCacheItem) {
173
+ iconTemplateCache.set(iconName, SpriteLoader.loadSpriteSVG(iconName)
174
+ .then(body => svg `${unsafeSVG(body)}`));
175
+ return this.loadAndRenderIcon(iconName); // Load again and await cache result
176
+ }
177
+ this.template = await iconTemplateCacheItem;
178
+ }
158
179
  /**
159
180
  * Get and cache CDN prefix
160
181
  * This is a private URL which is set in the theme
@@ -163,10 +184,13 @@ let Icon = class Icon extends BasicElement {
163
184
  */
164
185
  setPrefix() {
165
186
  if (!IconLoader.isPrefixSet) {
166
- const CDNPrefix = this.getComputedVariable('--cdn-prefix')
167
- .replace(/^('|")|('|")$/g, '');
187
+ const CDNPrefix = this.getComputedVariable('--cdn-prefix');
168
188
  IconLoader.setCdnPrefix(CDNPrefix);
169
189
  }
190
+ if (!SpriteLoader.isPrefixSet) {
191
+ const CDNSpritePrefix = this.getComputedVariable('--cdn-sprite-prefix');
192
+ SpriteLoader.setCdnPrefix(CDNSpritePrefix);
193
+ }
170
194
  }
171
195
  /**
172
196
  * Clears SVG body from the icon template
@@ -184,12 +208,12 @@ let Icon = class Icon extends BasicElement {
184
208
  return this.template;
185
209
  }
186
210
  };
211
+ __decorate([
212
+ consume({ context: efConfig, subscribe: true })
213
+ ], Icon.prototype, "config", void 0);
187
214
  __decorate([
188
215
  property({ type: String, reflect: true })
189
216
  ], Icon.prototype, "icon", null);
190
- __decorate([
191
- property({ type: String })
192
- ], Icon.prototype, "src", null);
193
217
  Icon = __decorate([
194
218
  customElement('ef-icon')
195
219
  ], Icon);
@@ -1,2 +1,2 @@
1
1
 
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-halo/resources/icons/\';--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-halo/resources/icons/\';font-size:16px}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#334bff solid 1px}:host([icon]) circle,:host([icon]) ellipse,:host([icon]) g,:host([icon]) line,:host([icon]) path,:host([icon]) polygon,:host([icon]) polyline,:host([icon]) rect{vector-effect:non-scaling-stroke}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/sprites/icons.svg\';--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/sprites/icons.svg\';font-size:16px}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#334bff solid 1px}:host([icon]) circle,:host([icon]) ellipse,:host([icon]) g,:host([icon]) line,:host([icon]) path,:host([icon]) polygon,:host([icon]) polyline,:host([icon]) rect{vector-effect:non-scaling-stroke}' }}));
@@ -1,2 +1,2 @@
1
1
 
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-halo/resources/icons/\';--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-halo/resources/icons/\';font-size:16px}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#334bff solid 1px}:host([icon]) circle,:host([icon]) ellipse,:host([icon]) g,:host([icon]) line,:host([icon]) path,:host([icon]) polygon,:host([icon]) polyline,:host([icon]) rect{vector-effect:non-scaling-stroke}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/sprites/icons.svg\';--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/sprites/icons.svg\';font-size:16px}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#334bff solid 1px}:host([icon]) circle,:host([icon]) ellipse,:host([icon]) g,:host([icon]) line,:host([icon]) path,:host([icon]) polygon,:host([icon]) polyline,:host([icon]) rect{vector-effect:non-scaling-stroke}' }}));
@@ -1,2 +1,2 @@
1
1
 
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-halo/resources/icons/\';--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-solar/resources/icons/\'}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#f93 solid 1px}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/sprites/icons.svg\';--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-solar/resources/sprites/icons.svg\'}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#f93 solid 1px}' }}));
@@ -1,2 +1,2 @@
1
1
 
2
- dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-halo/resources/icons/\';--cdn-prefix:\'https://cdn.refinitiv.net/public/libs/elf/assets/elf-theme-solar/resources/icons/\'}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#ffb266 solid 1px}' }}));
2
+ dispatchEvent(new CustomEvent('ef.customStyles.define', { detail: { name: 'ef-icon', styles: ':host{--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/sprites/icons.svg\';--cdn-sprite-prefix:\'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-solar/resources/sprites/icons.svg\'}:host circle[fill]:not([fill=none]),:host ellipse[fill]:not([fill=none]),:host g[fill]:not([fill=none]),:host line[fill]:not([fill=none]),:host path[fill]:not([fill=none]),:host polygon[fill]:not([fill=none]),:host polyline[fill]:not([fill=none]),:host rect[fill]:not([fill=none]){fill:currentColor}:host circle[stroke]:not([stroke=none]),:host ellipse[stroke]:not([stroke=none]),:host g[stroke]:not([stroke=none]),:host line[stroke]:not([stroke=none]),:host path[stroke]:not([stroke=none]),:host polygon[stroke]:not([stroke=none]),:host polyline[stroke]:not([stroke=none]),:host rect[stroke]:not([stroke=none]){stroke:currentColor}:host([icon=powerpoint]){color:#ff3535}:host([icon=excel]){color:#00a626}:host([icon=pdf]){color:#ff3535}:host([icon=word]){color:#0094c4}:host([icon=twitter]){color:#1da1f2}:host([focused=visible]){outline:#ffb266 solid 1px}' }}));
@@ -7,11 +7,3 @@ declare class IconLoader extends SVGLoader {
7
7
  }
8
8
  declare const iconLoaderInstance: IconLoader;
9
9
  export { iconLoaderInstance as IconLoader };
10
- /**
11
- * Helper function to preload set of icons.
12
- * It could help to reduce icon loading delay when ef-icon has a known set of icons that it can use.
13
- * @param attrs - list of arguments, representing icons.
14
- * Could be icon names, complete icon URLs or mix of both.
15
- * @returns Array of promises, which will be resolved with SVG bodies.
16
- */
17
- export declare const preload: (...attrs: string[]) => Promise<string | undefined>[];
@@ -7,13 +7,3 @@ class IconLoader extends SVGLoader {
7
7
  }
8
8
  const iconLoaderInstance = new IconLoader();
9
9
  export { iconLoaderInstance as IconLoader };
10
- /**
11
- * Helper function to preload set of icons.
12
- * It could help to reduce icon loading delay when ef-icon has a known set of icons that it can use.
13
- * @param attrs - list of arguments, representing icons.
14
- * Could be icon names, complete icon URLs or mix of both.
15
- * @returns Array of promises, which will be resolved with SVG bodies.
16
- */
17
- export const preload = (...attrs) => {
18
- return attrs.map(icon => iconLoaderInstance.loadSVG(icon));
19
- };
@@ -0,0 +1,22 @@
1
+ import { SVGLoader } from '@refinitiv-ui/utils/loader.js';
2
+ /**
3
+ * Caches and provides sprite icon SVG
4
+ * Uses singleton pattern
5
+ */
6
+ declare class SpriteLoader extends SVGLoader {
7
+ getSrc(): Promise<string>;
8
+ /**
9
+ * Load and Create DOM sprite SVG
10
+ * @returns returns the DOM sprite SVG
11
+ */
12
+ private loadSprite;
13
+ /**
14
+ * Load and cache the DOM sprite svg
15
+ * Get an svg fragment of DOM sprite svg
16
+ * @param iconName Name of svg to load
17
+ * @returns returns the svg fragment body
18
+ */
19
+ loadSpriteSVG(iconName: string): Promise<string | undefined>;
20
+ }
21
+ declare const instance: SpriteLoader;
22
+ export { instance as SpriteLoader };
@@ -0,0 +1,38 @@
1
+ import { SVGLoader } from '@refinitiv-ui/utils/loader.js';
2
+ let spriteCache;
3
+ /**
4
+ * Caches and provides sprite icon SVG
5
+ * Uses singleton pattern
6
+ */
7
+ class SpriteLoader extends SVGLoader {
8
+ async getSrc() {
9
+ return await this.getCdnPrefix();
10
+ }
11
+ /**
12
+ * Load and Create DOM sprite SVG
13
+ * @returns returns the DOM sprite SVG
14
+ */
15
+ async loadSprite() {
16
+ const sprite = await this.loadSVG('sprite/icons');
17
+ if (!sprite) {
18
+ throw new Error("SpriteLoader: couldn't load SVG sprite source");
19
+ }
20
+ return new DOMParser().parseFromString(sprite, 'image/svg+xml');
21
+ }
22
+ /**
23
+ * Load and cache the DOM sprite svg
24
+ * Get an svg fragment of DOM sprite svg
25
+ * @param iconName Name of svg to load
26
+ * @returns returns the svg fragment body
27
+ */
28
+ async loadSpriteSVG(iconName) {
29
+ if (!spriteCache) {
30
+ spriteCache = this.loadSprite();
31
+ }
32
+ const sprite = await spriteCache;
33
+ const icon = sprite.getElementById(iconName);
34
+ return icon ? icon.outerHTML : undefined;
35
+ }
36
+ }
37
+ const instance = new SpriteLoader();
38
+ export { instance as SpriteLoader };
@@ -36,12 +36,6 @@ export declare class InteractiveChart extends ResponsiveElement {
36
36
  * Hide jump to latest data button
37
37
  */
38
38
  disabledJumpButton: boolean;
39
- /**
40
- * @deprecated `legendstyle` attribute is deprecated, use `legend-style` instead.
41
- * @ignore
42
- * Set legend style i.e. `horizontal`, `vertical`. Default is `vertical`.
43
- **/
44
- deprecatedLegendStyle: LegendStyle | undefined;
45
39
  /**
46
40
  * Set legend style i.e. `horizontal`, `vertical`.
47
41
  * @param {LegendStyle} value legend style value
@@ -50,11 +44,6 @@ export declare class InteractiveChart extends ResponsiveElement {
50
44
  **/
51
45
  set legendStyle(value: LegendStyle);
52
46
  get legendStyle(): LegendStyle;
53
- /**
54
- * Deprecation noticed, used to display a warning message
55
- * when deprecated features are used.
56
- */
57
- private deprecationNotice;
58
47
  /**
59
48
  * @ignore
60
49
  * Array of series instances in chart
@@ -1,6 +1,6 @@
1
1
  var InteractiveChart_1;
2
2
  import { __decorate } from "tslib";
3
- import { ResponsiveElement, html, css, DeprecationNotice } from '@refinitiv-ui/core';
3
+ import { ResponsiveElement, html, css } from '@refinitiv-ui/core';
4
4
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
5
5
  import { property } from '@refinitiv-ui/core/decorators/property.js';
6
6
  import { query } from '@refinitiv-ui/core/decorators/query.js';
@@ -34,11 +34,6 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
34
34
  * Hide jump to latest data button
35
35
  */
36
36
  this.disabledJumpButton = false;
37
- /**
38
- * Deprecation noticed, used to display a warning message
39
- * when deprecated features are used.
40
- */
41
- this.deprecationNotice = new DeprecationNotice('`legendstyle` attribute and property are deprecated. Use `legend-style` for attribute and `legendStyle` property instead.');
42
37
  /**
43
38
  * @ignore
44
39
  * Array of series instances in chart
@@ -139,7 +134,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
139
134
  }
140
135
  }
141
136
  get legendStyle() {
142
- return this._legendStyle || this.deprecatedLegendStyle || LegendStyle.vertical;
137
+ return this._legendStyle || LegendStyle.vertical;
143
138
  }
144
139
  /**
145
140
  * @returns return config of property component
@@ -166,11 +161,8 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
166
161
  if (changedProperties.has('disabledJumpButton')) {
167
162
  this.onJumpButtonChange();
168
163
  }
169
- if (changedProperties.has('deprecatedLegendStyle') || changedProperties.has('legend-style')) {
170
- if (changedProperties.has('deprecatedLegendStyle')) {
171
- this.deprecationNotice.show();
172
- }
173
- const oldLegendStyle = (changedProperties.get('legend-style') || changedProperties.get('deprecatedLegendStyle'));
164
+ if (changedProperties.has('legend-style')) {
165
+ const oldLegendStyle = changedProperties.get('legend-style');
174
166
  this.onLegendStyleChange(this.legendStyle, oldLegendStyle);
175
167
  }
176
168
  }
@@ -1065,9 +1057,6 @@ __decorate([
1065
1057
  __decorate([
1066
1058
  property({ type: Boolean, reflect: true, attribute: 'disabled-jump-button' })
1067
1059
  ], InteractiveChart.prototype, "disabledJumpButton", void 0);
1068
- __decorate([
1069
- property({ type: String, attribute: 'legendstyle' })
1070
- ], InteractiveChart.prototype, "deprecatedLegendStyle", void 0);
1071
1060
  __decorate([
1072
1061
  property({ type: String, attribute: 'legend-style' })
1073
1062
  ], InteractiveChart.prototype, "legendStyle", null);
@@ -216,6 +216,12 @@ export declare class NumberField extends FormFieldElement {
216
216
  * @returns step base
217
217
  */
218
218
  private get stepBase();
219
+ /**
220
+ * Count precision number
221
+ * @param number value to count
222
+ * @returns precision number
223
+ */
224
+ private getPrecision;
219
225
  /**
220
226
  * Check if value subtracted from the step base is not an integral multiple of the allowed value step
221
227
  * @param value value to check
@@ -447,6 +447,25 @@ let NumberField = class NumberField extends FormFieldElement {
447
447
  }
448
448
  return 0;
449
449
  }
450
+ /**
451
+ * Count precision number
452
+ * @param number value to count
453
+ * @returns precision number
454
+ */
455
+ getPrecision(number) {
456
+ const getDecimalPrecision = (number) => {
457
+ const [wholeNumber, decimalNumber] = number.split('.');
458
+ return (wholeNumber.length ?? 0) + (decimalNumber?.length ?? 0);
459
+ };
460
+ const numberString = number.toString();
461
+ // Check if the number is in exponential notation.
462
+ if (numberString.includes('e')) {
463
+ const [mantissa, exponent] = numberString.split('e');
464
+ const precision = getDecimalPrecision(mantissa) + Math.abs(Number(exponent));
465
+ return precision;
466
+ }
467
+ return getDecimalPrecision(numberString);
468
+ }
450
469
  /**
451
470
  * Check if value subtracted from the step base is not an integral multiple of the allowed value step
452
471
  * @param value value to check
@@ -457,7 +476,12 @@ let NumberField = class NumberField extends FormFieldElement {
457
476
  return true;
458
477
  }
459
478
  const decimals = Math.max(this.getDecimalPlace(value), this.stepDecimals);
460
- const division = (this.stepBase - value) / this.getAllowedValueStep();
479
+ const dividend = this.stepBase - value;
480
+ const divisor = this.getAllowedValueStep();
481
+ // calculate precision to prevent Floating point precision issue.
482
+ // e.g. 1111111/0.00001 would not result in 111111100000 as expected.
483
+ const precision = this.getPrecision(dividend) + this.getPrecision(divisor);
484
+ const division = parseFloat((dividend / divisor).toPrecision(precision));
461
485
  const number = decimals ? this.toFixedNumber(division, decimals) : division;
462
486
  // (2 - 1.01) % 0.33 needs to give 0. So we cannot use % directly as it is intended for integers
463
487
  return number % 1 === 0;
@@ -2,12 +2,10 @@ import { __decorate } from "tslib";
2
2
  import { html } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { state } from '@refinitiv-ui/core/decorators/state.js';
5
- import { preload } from '../icon/index.js';
6
5
  import { TextField } from '../text-field/index.js';
7
6
  import '../icon/index.js';
8
7
  import '@refinitiv-ui/phrasebook/locale/en/password-field.js';
9
8
  import { translate } from '@refinitiv-ui/translate';
10
- let isEyeOffPreloadRequested = false;
11
9
  /**
12
10
  * A form control element for password.
13
11
  *
@@ -58,10 +56,6 @@ let PasswordField = class PasswordField extends TextField {
58
56
  */
59
57
  firstUpdated(changedProperties) {
60
58
  super.firstUpdated(changedProperties);
61
- if (!isEyeOffPreloadRequested) {
62
- preload('eye-off');
63
- isEyeOffPreloadRequested = true;
64
- }
65
59
  }
66
60
  /**
67
61
  * Decorate `<input>` element with common properties extended from text-field:
@@ -4,10 +4,8 @@ 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';
6
6
  import '../../icon/index.js';
7
- import { preload } from '../../icon/index.js';
8
7
  import '../../checkbox/index.js';
9
8
  import { CheckedState } from '../managers/tree-manager.js';
10
- preload('right');
11
9
  const emptyTemplate = html ``;
12
10
  /**
13
11
  * Displays a tree list item.
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.0.0-next.4';
1
+ export const VERSION = '7.0.0-next.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "7.0.0-next.4",
3
+ "version": "7.0.0-next.5",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "LSEG",
6
6
  "license": "Apache-2.0",
@@ -107,6 +107,7 @@
107
107
  "./combo-box/themes/halo/light": "./lib/combo-box/themes/halo/light/index.js",
108
108
  "./combo-box/themes/solar/charcoal": "./lib/combo-box/themes/solar/charcoal/index.js",
109
109
  "./combo-box/themes/solar/pearl": "./lib/combo-box/themes/solar/pearl/index.js",
110
+ "./configuration": "./lib/configuration/index.js",
110
111
  "./counter": "./lib/counter/index.js",
111
112
  "./counter/themes/halo/dark": "./lib/counter/themes/halo/dark/index.js",
112
113
  "./counter/themes/halo/light": "./lib/counter/themes/halo/light/index.js",
@@ -338,9 +339,10 @@
338
339
  "version": "node ../../scripts/version/index.mjs"
339
340
  },
340
341
  "dependencies": {
342
+ "@lit-labs/context": "^0.3.1",
341
343
  "@refinitiv-ui/browser-sparkline": "1.1.8",
342
- "@refinitiv-ui/halo-theme": "^7.0.0-next.2",
343
- "@refinitiv-ui/solar-theme": "^7.0.0-next.2",
344
+ "@refinitiv-ui/halo-theme": "^7.0.0-next.3",
345
+ "@refinitiv-ui/solar-theme": "^7.0.0-next.3",
344
346
  "chart.js": "^4.3.0",
345
347
  "chartjs-adapter-date-fns": "^3.0.0",
346
348
  "d3-interpolate": "^3.0.1",
@@ -349,24 +351,24 @@
349
351
  "tslib": "^2.3.1"
350
352
  },
351
353
  "devDependencies": {
352
- "@refinitiv-ui/core": "^7.0.0-next.1",
353
- "@refinitiv-ui/demo-block": "^7.0.0-next.2",
354
- "@refinitiv-ui/i18n": "^7.0.0-next.1",
355
- "@refinitiv-ui/phrasebook": "^7.0.0-next.1",
356
- "@refinitiv-ui/test-helpers": "^7.0.0-next.1",
357
- "@refinitiv-ui/translate": "^7.0.0-next.2",
358
- "@refinitiv-ui/utils": "^7.0.0-next.1",
354
+ "@refinitiv-ui/core": "^7.0.0-next.2",
355
+ "@refinitiv-ui/demo-block": "^7.0.0-next.3",
356
+ "@refinitiv-ui/i18n": "^7.0.0-next.2",
357
+ "@refinitiv-ui/phrasebook": "^7.0.0-next.2",
358
+ "@refinitiv-ui/test-helpers": "^7.0.0-next.2",
359
+ "@refinitiv-ui/translate": "^7.0.0-next.3",
360
+ "@refinitiv-ui/utils": "^7.0.0-next.2",
359
361
  "@types/d3-interpolate": "^3.0.1"
360
362
  },
361
363
  "peerDependencies": {
362
- "@refinitiv-ui/core": "^7.0.0-next.1",
363
- "@refinitiv-ui/i18n": "^7.0.0-next.1",
364
- "@refinitiv-ui/phrasebook": "^7.0.0-next.1",
365
- "@refinitiv-ui/translate": "^7.0.0-next.2",
366
- "@refinitiv-ui/utils": "^7.0.0-next.1"
364
+ "@refinitiv-ui/core": "^7.0.0-next.2",
365
+ "@refinitiv-ui/i18n": "^7.0.0-next.2",
366
+ "@refinitiv-ui/phrasebook": "^7.0.0-next.2",
367
+ "@refinitiv-ui/translate": "^7.0.0-next.3",
368
+ "@refinitiv-ui/utils": "^7.0.0-next.2"
367
369
  },
368
370
  "publishConfig": {
369
371
  "access": "public"
370
372
  },
371
- "gitHead": "02dbb152a8c6e4801ef6f5a7f1892eb01a0564f5"
373
+ "gitHead": "06280dbb2701c7c126651b796a327a51a109d970"
372
374
  }