@refinitiv-ui/elements 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +195 -449
  2. package/LICENSE +2 -2
  3. package/README.md +12 -10
  4. package/cli.mjs +5 -3
  5. package/lib/accordion/index.d.ts +1 -1
  6. package/lib/accordion/index.js +4 -7
  7. package/lib/appstate-bar/index.d.ts +2 -2
  8. package/lib/appstate-bar/index.js +10 -4
  9. package/lib/autosuggest/index.d.ts +7 -7
  10. package/lib/autosuggest/index.js +80 -80
  11. package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
  12. package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
  13. package/lib/button/index.js +7 -10
  14. package/lib/button-bar/index.d.ts +1 -1
  15. package/lib/button-bar/index.js +12 -12
  16. package/lib/calendar/index.d.ts +39 -39
  17. package/lib/calendar/index.js +156 -123
  18. package/lib/calendar/utils.js +1 -1
  19. package/lib/canvas/index.d.ts +1 -1
  20. package/lib/canvas/index.js +2 -4
  21. package/lib/card/helpers/types.d.ts +2 -2
  22. package/lib/card/index.d.ts +5 -5
  23. package/lib/card/index.js +34 -28
  24. package/lib/chart/elements/chart.d.ts +4 -4
  25. package/lib/chart/elements/chart.js +39 -33
  26. package/lib/chart/plugins/doughnut-center-label.d.ts +3 -3
  27. package/lib/chart/plugins/doughnut-center-label.js +13 -9
  28. package/lib/checkbox/index.d.ts +1 -1
  29. package/lib/checkbox/index.js +12 -13
  30. package/lib/clock/index.d.ts +55 -55
  31. package/lib/clock/index.js +84 -95
  32. package/lib/clock/themes/halo/dark/index.js +1 -1
  33. package/lib/clock/themes/halo/light/index.js +1 -1
  34. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  35. package/lib/clock/themes/solar/pearl/index.js +1 -1
  36. package/lib/collapse/index.d.ts +1 -1
  37. package/lib/collapse/index.js +27 -18
  38. package/lib/collapse/themes/halo/dark/index.js +1 -1
  39. package/lib/collapse/themes/halo/light/index.js +1 -1
  40. package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
  41. package/lib/color-dialog/elements/color-palettes.js +5 -6
  42. package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
  43. package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
  44. package/lib/color-dialog/elements/palettes.js +5 -4
  45. package/lib/color-dialog/helpers/value-model.js +7 -9
  46. package/lib/color-dialog/index.d.ts +6 -6
  47. package/lib/color-dialog/index.js +53 -37
  48. package/lib/color-picker/index.d.ts +2 -2
  49. package/lib/color-picker/index.js +40 -34
  50. package/lib/combo-box/helpers/filter.d.ts +2 -2
  51. package/lib/combo-box/helpers/types.d.ts +1 -1
  52. package/lib/combo-box/index.d.ts +9 -9
  53. package/lib/combo-box/index.js +61 -55
  54. package/lib/configuration/elements/configuration.js +2 -2
  55. package/lib/counter/index.d.ts +4 -4
  56. package/lib/counter/index.js +9 -7
  57. package/lib/datetime-field/index.d.ts +4 -5
  58. package/lib/datetime-field/index.js +32 -23
  59. package/lib/datetime-field/utils.js +11 -1
  60. package/lib/datetime-picker/index.d.ts +75 -75
  61. package/lib/datetime-picker/index.js +150 -131
  62. package/lib/datetime-picker/locales.js +5 -5
  63. package/lib/datetime-picker/utils.js +9 -9
  64. package/lib/dialog/draggable-element.js +1 -2
  65. package/lib/dialog/index.d.ts +5 -5
  66. package/lib/dialog/index.js +51 -47
  67. package/lib/email-field/index.d.ts +1 -1
  68. package/lib/email-field/index.js +6 -6
  69. package/lib/events.d.ts +1 -1
  70. package/lib/flag/index.d.ts +1 -1
  71. package/lib/flag/index.js +6 -5
  72. package/lib/flag/utils/FlagLoader.js +1 -1
  73. package/lib/header/index.d.ts +1 -1
  74. package/lib/header/index.js +2 -2
  75. package/lib/header/themes/halo/dark/index.js +1 -1
  76. package/lib/header/themes/halo/light/index.js +1 -1
  77. package/lib/header/themes/solar/charcoal/index.js +1 -1
  78. package/lib/header/themes/solar/pearl/index.js +1 -1
  79. package/lib/heatmap/helpers/color.d.ts +1 -1
  80. package/lib/heatmap/helpers/color.js +11 -5
  81. package/lib/heatmap/helpers/track.js +3 -3
  82. package/lib/heatmap/index.d.ts +9 -9
  83. package/lib/heatmap/index.js +51 -42
  84. package/lib/icon/index.d.ts +2 -2
  85. package/lib/icon/index.js +8 -10
  86. package/lib/interactive-chart/helpers/types.d.ts +3 -3
  87. package/lib/interactive-chart/index.d.ts +29 -29
  88. package/lib/interactive-chart/index.js +69 -55
  89. package/lib/item/helpers/types.d.ts +1 -1
  90. package/lib/item/index.d.ts +3 -3
  91. package/lib/item/index.js +24 -20
  92. package/lib/jsx.d.ts +6 -4
  93. package/lib/label/index.d.ts +1 -1
  94. package/lib/label/index.js +10 -7
  95. package/lib/layout/index.d.ts +7 -7
  96. package/lib/layout/index.js +7 -7
  97. package/lib/led-gauge/index.d.ts +1 -1
  98. package/lib/led-gauge/index.js +10 -10
  99. package/lib/list/elements/list.d.ts +3 -3
  100. package/lib/list/elements/list.js +10 -12
  101. package/lib/list/helpers/renderer.js +2 -2
  102. package/lib/list/helpers/types.d.ts +1 -1
  103. package/lib/list/index.d.ts +1 -1
  104. package/lib/list/renderer.d.ts +7 -7
  105. package/lib/loader/index.js +7 -8
  106. package/lib/multi-input/index.d.ts +6 -6
  107. package/lib/multi-input/index.js +39 -45
  108. package/lib/notification/elements/notification-tray.d.ts +2 -2
  109. package/lib/notification/elements/notification-tray.js +3 -3
  110. package/lib/notification/elements/notification.d.ts +2 -2
  111. package/lib/notification/elements/notification.js +14 -13
  112. package/lib/notification/helpers/status.js +1 -1
  113. package/lib/notification/themes/halo/dark/index.js +1 -1
  114. package/lib/notification/themes/halo/light/index.js +1 -1
  115. package/lib/notification/themes/solar/charcoal/index.js +1 -1
  116. package/lib/notification/themes/solar/pearl/index.js +1 -1
  117. package/lib/number-field/index.d.ts +5 -6
  118. package/lib/number-field/index.js +37 -47
  119. package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
  120. package/lib/overlay/elements/overlay.d.ts +2 -2
  121. package/lib/overlay/elements/overlay.js +152 -96
  122. package/lib/overlay/helpers/types.d.ts +1 -1
  123. package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
  124. package/lib/overlay/managers/backdrop-manager.js +2 -2
  125. package/lib/overlay/managers/close-manager.js +2 -1
  126. package/lib/overlay/managers/focus-manager.js +23 -13
  127. package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
  128. package/lib/overlay/managers/interaction-lock-manager.js +33 -25
  129. package/lib/overlay/managers/viewport-manager.d.ts +2 -2
  130. package/lib/overlay/managers/viewport-manager.js +3 -2
  131. package/lib/overlay/managers/zindex-manager.js +4 -2
  132. package/lib/overlay-menu/helpers/types.d.ts +2 -2
  133. package/lib/overlay-menu/index.d.ts +1 -1
  134. package/lib/overlay-menu/index.js +44 -33
  135. package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
  136. package/lib/overlay-menu/managers/menu-manager.js +14 -13
  137. package/lib/pagination/index.d.ts +4 -4
  138. package/lib/pagination/index.js +39 -14
  139. package/lib/panel/index.js +1 -1
  140. package/lib/password-field/index.d.ts +2 -2
  141. package/lib/password-field/index.js +3 -3
  142. package/lib/pill/index.d.ts +1 -1
  143. package/lib/pill/index.js +22 -19
  144. package/lib/progress-bar/index.d.ts +1 -1
  145. package/lib/progress-bar/index.js +38 -37
  146. package/lib/radio-button/index.d.ts +2 -2
  147. package/lib/radio-button/index.js +17 -12
  148. package/lib/radio-button/radio-button-registry.js +8 -5
  149. package/lib/rating/index.d.ts +1 -1
  150. package/lib/rating/index.js +2 -5
  151. package/lib/rating/utils.d.ts +6 -6
  152. package/lib/rating/utils.js +6 -6
  153. package/lib/search-field/index.d.ts +2 -2
  154. package/lib/search-field/index.js +4 -4
  155. package/lib/select/index.d.ts +34 -34
  156. package/lib/select/index.js +68 -81
  157. package/lib/sidebar-layout/index.d.ts +2 -2
  158. package/lib/sidebar-layout/index.js +7 -9
  159. package/lib/slider/index.d.ts +2 -2
  160. package/lib/slider/index.js +57 -45
  161. package/lib/slider/utils.d.ts +10 -10
  162. package/lib/slider/utils.js +10 -10
  163. package/lib/sparkline/index.d.ts +1 -1
  164. package/lib/sparkline/index.js +7 -8
  165. package/lib/swing-gauge/helpers.js +2 -2
  166. package/lib/swing-gauge/index.d.ts +19 -19
  167. package/lib/swing-gauge/index.js +91 -81
  168. package/lib/tab/index.d.ts +1 -1
  169. package/lib/tab/index.js +16 -27
  170. package/lib/tab/themes/halo/dark/index.js +1 -1
  171. package/lib/tab/themes/halo/light/index.js +1 -1
  172. package/lib/tab/themes/solar/charcoal/index.js +1 -1
  173. package/lib/tab/themes/solar/pearl/index.js +1 -1
  174. package/lib/tab-bar/helpers/animate.js +1 -1
  175. package/lib/tab-bar/index.d.ts +1 -1
  176. package/lib/tab-bar/index.js +34 -18
  177. package/lib/tab-bar/themes/halo/dark/index.js +1 -1
  178. package/lib/tab-bar/themes/halo/light/index.js +1 -1
  179. package/lib/text-field/index.d.ts +1 -1
  180. package/lib/text-field/index.js +34 -31
  181. package/lib/time-picker/index.d.ts +6 -6
  182. package/lib/time-picker/index.js +103 -89
  183. package/lib/toggle/index.d.ts +1 -1
  184. package/lib/toggle/index.js +4 -3
  185. package/lib/toggle/themes/halo/dark/index.js +1 -1
  186. package/lib/toggle/themes/halo/light/index.js +1 -1
  187. package/lib/toggle/themes/solar/charcoal/index.js +1 -1
  188. package/lib/toggle/themes/solar/pearl/index.js +1 -1
  189. package/lib/tooltip/elements/title-tooltip.js +2 -2
  190. package/lib/tooltip/index.d.ts +27 -27
  191. package/lib/tooltip/index.js +42 -38
  192. package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
  193. package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
  194. package/lib/tornado-chart/elements/tornado-chart.js +2 -2
  195. package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
  196. package/lib/tornado-chart/elements/tornado-item.js +12 -10
  197. package/lib/tree/elements/tree-item.d.ts +3 -3
  198. package/lib/tree/elements/tree-item.js +21 -19
  199. package/lib/tree/elements/tree.d.ts +1 -1
  200. package/lib/tree/elements/tree.js +12 -11
  201. package/lib/tree/helpers/renderer.js +4 -3
  202. package/lib/tree/index.d.ts +1 -1
  203. package/lib/tree/managers/tree-manager.d.ts +1 -1
  204. package/lib/tree/managers/tree-manager.js +17 -18
  205. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  206. package/lib/tree/themes/solar/pearl/index.js +1 -1
  207. package/lib/tree-select/index.d.ts +9 -9
  208. package/lib/tree-select/index.js +91 -82
  209. package/lib/tree-select/themes/halo/dark/index.js +1 -1
  210. package/lib/tree-select/themes/halo/light/index.js +1 -1
  211. package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
  212. package/lib/tree-select/themes/solar/pearl/index.js +1 -1
  213. package/lib/version.js +1 -1
  214. package/package.json +17 -17
  215. package/tsconfig.tsbuildinfo +1 -1
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Set prevent default action and stop bubbles event
3
- * @param event event mouse or touch
4
- * @returns {void}
5
- */
2
+ * Set prevent default action and stop bubbles event
3
+ * @param event event mouse or touch
4
+ * @returns {void}
5
+ */
6
6
  declare const preventDefault: (event: Event) => Event;
7
7
  /**
8
- * Return value that never exceed the maximum boundary
9
- * @param value value for check clamp
10
- * @param min max value
11
- * @param max min value
12
- * @returns number between two numbers
13
- */
8
+ * Return value that never exceed the maximum boundary
9
+ * @param value value for check clamp
10
+ * @param min max value
11
+ * @param max min value
12
+ * @returns number between two numbers
13
+ */
14
14
  declare const clamp: (value: number, min: number, max: number) => string;
15
15
  /**
16
16
  * Check if number is a decimal number
@@ -1,20 +1,20 @@
1
1
  /**
2
- * Set prevent default action and stop bubbles event
3
- * @param event event mouse or touch
4
- * @returns {void}
5
- */
2
+ * Set prevent default action and stop bubbles event
3
+ * @param event event mouse or touch
4
+ * @returns {void}
5
+ */
6
6
  const preventDefault = (event) => {
7
7
  event.preventDefault();
8
8
  event.stopPropagation();
9
9
  return event;
10
10
  };
11
11
  /**
12
- * Return value that never exceed the maximum boundary
13
- * @param value value for check clamp
14
- * @param min max value
15
- * @param max min value
16
- * @returns number between two numbers
17
- */
12
+ * Return value that never exceed the maximum boundary
13
+ * @param value value for check clamp
14
+ * @param min max value
15
+ * @param max min value
16
+ * @returns number between two numbers
17
+ */
18
18
  const clamp = function (value, min, max) {
19
19
  return Math.max(min, Math.min(value, max)).toString();
20
20
  };
@@ -1,5 +1,5 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { CSSResultGroup, PropertyValues, ResponsiveElement, TemplateResult, ElementSize } from '@refinitiv-ui/core';
2
+ import { CSSResultGroup, ElementSize, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
3
3
  import '@refinitiv-ui/browser-sparkline';
4
4
  import type { BrowserSparklineChart } from '@refinitiv-ui/browser-sparkline';
5
5
  import type { ThemeConfig } from '@refinitiv-ui/browser-sparkline/lib/browserSparklineCanvas';
@@ -1,11 +1,11 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, ResponsiveElement, html } from '@refinitiv-ui/core';
2
+ import { ResponsiveElement, css, html } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { query } from '@refinitiv-ui/core/decorators/query.js';
6
- import { VERSION } from '../version.js';
7
- import { color } from '@refinitiv-ui/utils/color.js';
8
6
  import '@refinitiv-ui/browser-sparkline';
7
+ import { color } from '@refinitiv-ui/utils/color.js';
8
+ import { VERSION } from '../version.js';
9
9
  let Sparkline = class Sparkline extends ResponsiveElement {
10
10
  constructor() {
11
11
  super(...arguments);
@@ -145,13 +145,14 @@ let Sparkline = class Sparkline extends ResponsiveElement {
145
145
  display: block;
146
146
  }
147
147
 
148
- browser-sparkline-chart, browser-sparkline-canvas {
148
+ browser-sparkline-chart,
149
+ browser-sparkline-canvas {
149
150
  width: 100%;
150
151
  height: 100%;
151
152
  display: block;
152
153
  }
153
154
 
154
- [part=chart] {
155
+ [part='chart'] {
155
156
  height: 100%;
156
157
  }
157
158
  `;
@@ -162,9 +163,7 @@ let Sparkline = class Sparkline extends ResponsiveElement {
162
163
  * @return Render template
163
164
  */
164
165
  render() {
165
- return html `
166
- <browser-sparkline-chart part="chart" id="sparkline"></browser-sparkline-chart>
167
- `;
166
+ return html ` <browser-sparkline-chart part="chart" id="sparkline"></browser-sparkline-chart> `;
168
167
  }
169
168
  };
170
169
  __decorate([
@@ -75,7 +75,7 @@ const draw = (drawData, drawCtx, drawParams) => {
75
75
  ctx.setLineDash([5, 3]);
76
76
  }
77
77
  ctx.moveTo(data.width / 2, data.height - data.size * data.gaugeLowerBound);
78
- ctx.lineTo(data.width / 2, data.height - (data.size * data.gaugeUpperBound) + style.strokeWidth);
78
+ ctx.lineTo(data.width / 2, data.height - data.size * data.gaugeUpperBound + style.strokeWidth);
79
79
  ctx.strokeStyle = style.centerlineColor;
80
80
  ctx.stroke();
81
81
  ctx.restore();
@@ -89,7 +89,7 @@ const elasticOut = ((amplitude, period) => {
89
89
  return time;
90
90
  }
91
91
  const s = (period / pi2) * Math.asin(1 / amplitude);
92
- return (amplitude * Math.pow(2, -10 * time) * Math.sin(((time - s) * pi2) / period) + 1);
92
+ return amplitude * Math.pow(2, -10 * time) * Math.sin(((time - s) * pi2) / period) + 1;
93
93
  };
94
94
  })(1.2, 0.5);
95
95
  const textWidth = (drawCtx, text, fontSize, fontFamily) => {
@@ -1,5 +1,5 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { ResponsiveElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
2
+ import { CSSResultGroup, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
3
3
  import '../canvas/index.js';
4
4
  import '../label/index.js';
5
5
  import type { SwingGaugeCanvasSize, SwingGaugeValueFormatter } from './types';
@@ -47,12 +47,12 @@ export declare class SwingGauge extends ResponsiveElement {
47
47
  */
48
48
  duration: number;
49
49
  /**
50
- * Primary value legend
51
- */
50
+ * Primary value legend
51
+ */
52
52
  primaryLegend: string;
53
53
  /**
54
- * Secondary value legend
55
- */
54
+ * Secondary value legend
55
+ */
56
56
  secondaryLegend: string;
57
57
  /**
58
58
  * Custom value formatter
@@ -74,36 +74,36 @@ export declare class SwingGauge extends ResponsiveElement {
74
74
  private primaryLineRadian;
75
75
  private secondaryLineRadian;
76
76
  /**
77
- * Data requires to draw swing gauge
78
- */
77
+ * Data requires to draw swing gauge
78
+ */
79
79
  private data;
80
80
  /**
81
- * Internal sizes and scales
82
- */
81
+ * Internal sizes and scales
82
+ */
83
83
  private width;
84
84
  private height;
85
85
  private size;
86
86
  private lineLength;
87
87
  private scale;
88
88
  /**
89
- * Current fill percentage
90
- */
89
+ * Current fill percentage
90
+ */
91
91
  private fillPercentage;
92
92
  /**
93
- * Keeps previous percentage calculation to avoid re-rendering the same value
94
- */
93
+ * Keeps previous percentage calculation to avoid re-rendering the same value
94
+ */
95
95
  private previousFillPercentage;
96
96
  /**
97
- * This for keep line number of label for calculate new radius
98
- */
97
+ * This for keep line number of label for calculate new radius
98
+ */
99
99
  private labelLineNumber;
100
100
  /**
101
- * Get primary percentage
102
- */
101
+ * Get primary percentage
102
+ */
103
103
  private get primaryPercentage();
104
104
  /**
105
- * Get secondary percentage
106
- */
105
+ * Get secondary percentage
106
+ */
107
107
  private get secondaryPercentage();
108
108
  /**
109
109
  * Check width and height are valid
@@ -1,15 +1,15 @@
1
1
  import { __decorate } from "tslib";
2
- import { ResponsiveElement, css, html, WarningNotice } from '@refinitiv-ui/core';
2
+ import { ResponsiveElement, WarningNotice, css, html } from '@refinitiv-ui/core';
3
3
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { query } from '@refinitiv-ui/core/decorators/query.js';
6
6
  import { state } from '@refinitiv-ui/core/decorators/state.js';
7
7
  import { styleMap } from '@refinitiv-ui/core/directives/style-map.js';
8
- import { VERSION } from '../version.js';
9
8
  import '../canvas/index.js';
10
9
  import '../label/index.js';
11
- import { helpers as canvasHelper } from './helpers.js';
10
+ import { VERSION } from '../version.js';
12
11
  import { DefaultStyle, Segment, TextType } from './const.js';
12
+ import { helpers as canvasHelper } from './helpers.js';
13
13
  /**
14
14
  * Constants from swing-gauge default specs
15
15
  */
@@ -53,12 +53,12 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
53
53
  */
54
54
  this.duration = 1000;
55
55
  /**
56
- * Primary value legend
57
- */
56
+ * Primary value legend
57
+ */
58
58
  this.primaryLegend = '';
59
59
  /**
60
- * Secondary value legend
61
- */
60
+ * Secondary value legend
61
+ */
62
62
  this.secondaryLegend = '';
63
63
  /**
64
64
  * Custom value formatter
@@ -80,28 +80,28 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
80
80
  this.primaryLineRadian = PRIMARY_RADIAN;
81
81
  this.secondaryLineRadian = SECONDARY_RADIAN;
82
82
  /**
83
- * Data requires to draw swing gauge
84
- */
83
+ * Data requires to draw swing gauge
84
+ */
85
85
  this.data = null;
86
86
  /**
87
- * Internal sizes and scales
88
- */
87
+ * Internal sizes and scales
88
+ */
89
89
  this.width = 0;
90
90
  this.height = 0;
91
91
  this.size = 0;
92
92
  this.lineLength = 60;
93
93
  this.scale = 1;
94
94
  /**
95
- * Current fill percentage
96
- */
95
+ * Current fill percentage
96
+ */
97
97
  this.fillPercentage = 0;
98
98
  /**
99
- * Keeps previous percentage calculation to avoid re-rendering the same value
100
- */
99
+ * Keeps previous percentage calculation to avoid re-rendering the same value
100
+ */
101
101
  this.previousFillPercentage = 0;
102
102
  /**
103
- * This for keep line number of label for calculate new radius
104
- */
103
+ * This for keep line number of label for calculate new radius
104
+ */
105
105
  this.labelLineNumber = 1;
106
106
  /**
107
107
  * Style for primary container
@@ -139,46 +139,50 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
139
139
  display: block;
140
140
  height: 200px;
141
141
  }
142
- :host [part=container] {
142
+ :host [part='container'] {
143
143
  display: flex;
144
144
  flex-direction: column;
145
145
  height: 100%;
146
146
  }
147
- :host [part=canvas-container] {
147
+ :host [part='canvas-container'] {
148
148
  position: relative;
149
149
  flex: 1;
150
150
  }
151
- :host [part=canvas] {
151
+ :host [part='canvas'] {
152
152
  height: 100%;
153
153
  }
154
- :host [part=primary-legend], [part=secondary-legend] {
154
+ :host [part='primary-legend'],
155
+ [part='secondary-legend'] {
155
156
  text-align: left;
156
157
  display: flex;
157
158
  }
158
- :host [part=primary-label], [part=primary-value] {
159
+ :host [part='primary-label'],
160
+ [part='primary-value'] {
159
161
  text-align: left;
160
162
  }
161
- :host [part=secondary-label], [part=secondary-value] {
163
+ :host [part='secondary-label'],
164
+ [part='secondary-value'] {
162
165
  text-align: right;
163
166
  }
164
- :host [part=legend-container-outer] {
167
+ :host [part='legend-container-outer'] {
165
168
  width: 60%;
166
169
  margin: 0 auto;
167
170
  text-align: center;
168
171
  }
169
- :host [part=legend-container-inner] {
172
+ :host [part='legend-container-inner'] {
170
173
  max-width: 100%;
171
174
  display: inline-block;
172
175
  }
173
- :host [part=primary-legend-symbol], [part=secondary-legend-symbol] {
176
+ :host [part='primary-legend-symbol'],
177
+ [part='secondary-legend-symbol'] {
174
178
  display: inline-block;
175
179
  flex-shrink: 0;
176
180
  }
177
- :host [part=primary-container] {
181
+ :host [part='primary-container'] {
178
182
  position: absolute;
179
183
  text-align: left;
180
184
  }
181
- :host [part=secondary-container] {
185
+ :host [part='secondary-container'] {
182
186
  position: absolute;
183
187
  text-align: right;
184
188
  }
@@ -215,14 +219,14 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
215
219
  return this._secondaryValue;
216
220
  }
217
221
  /**
218
- * Get primary percentage
219
- */
222
+ * Get primary percentage
223
+ */
220
224
  get primaryPercentage() {
221
225
  return this.getPercentage(this.primaryValue);
222
226
  }
223
227
  /**
224
- * Get secondary percentage
225
- */
228
+ * Get secondary percentage
229
+ */
226
230
  get secondaryPercentage() {
227
231
  return this.getPercentage(this.secondaryValue);
228
232
  }
@@ -273,8 +277,9 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
273
277
  */
274
278
  update(changedProperties) {
275
279
  super.update(changedProperties);
276
- if (changedProperties.has('primaryValue') || changedProperties.has('secondaryValue')
277
- || (this.primaryValue === 0 && this.secondaryValue === 0)) {
280
+ if (changedProperties.has('primaryValue') ||
281
+ changedProperties.has('secondaryValue') ||
282
+ (this.primaryValue === 0 && this.secondaryValue === 0)) {
278
283
  this.canvas.autoloop = true;
279
284
  this.renderCanvas('frame');
280
285
  this.animateCanvas();
@@ -285,9 +290,11 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
285
290
  if (changedProperties.has('valueFormatter')) {
286
291
  this.calculateValueFontSize();
287
292
  }
288
- if (changedProperties.has('primaryValue') || changedProperties.has('secondaryValue')
289
- || changedProperties.has('primaryLabel') || changedProperties.has('secondaryLabel')
290
- || changedProperties.has('valueFormatter')) {
293
+ if (changedProperties.has('primaryValue') ||
294
+ changedProperties.has('secondaryValue') ||
295
+ changedProperties.has('primaryLabel') ||
296
+ changedProperties.has('secondaryLabel') ||
297
+ changedProperties.has('valueFormatter')) {
291
298
  this.updateGaugePositions();
292
299
  }
293
300
  }
@@ -328,7 +335,8 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
328
335
  */
329
336
  easeTo(to, from, time) {
330
337
  const diff = (this.duration - (time - performance.now())) / this.duration;
331
- this.fillPercentage = from + (to - from) * canvasHelper.elasticOut(diff > 1 ? 1 : diff < 0 ? 0 : diff) || 0;
338
+ this.fillPercentage =
339
+ from + (to - from) * canvasHelper.elasticOut(diff > 1 ? 1 : diff < 0 ? 0 : diff) || 0;
332
340
  if (this.fillPercentage !== to) {
333
341
  this.cancelFrame(this.requestedAnimationID);
334
342
  this.requestedAnimationID = this.onFrame(() => this.easeTo(to, from, time));
@@ -408,7 +416,7 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
408
416
  const reverseScale = 1 - this.scale;
409
417
  // increase the offset by 25%, this for buffer to make label have some space from bottom
410
418
  this.linePointerOffset = (containerHeight / gaugeHeight) * reverseScale * 1.25;
411
- this.primaryLineRadian = PRIMARY_RADIAN + DEFAULT_OFFSET + (OVERFLOW_OFFSET * reverseScale);
419
+ this.primaryLineRadian = PRIMARY_RADIAN + DEFAULT_OFFSET + OVERFLOW_OFFSET * reverseScale;
412
420
  this.secondaryLineRadian = 3 - this.primaryLineRadian;
413
421
  }
414
422
  const primaryPosLine = this.getPositionStyle(Segment.PRIMARY, this.primaryLineRadian, this.linePointerOffset, 0);
@@ -528,7 +536,7 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
528
536
  const offset = DEFAULT_OFFSET * reverseScale;
529
537
  this.primaryLineRadian = PRIMARY_RADIAN + offset;
530
538
  this.secondaryLineRadian = SECONDARY_RADIAN - offset;
531
- this.linePointerOffset = LINE_POINTER_OFFSET + (0.4 * (1 - this.scale));
539
+ this.linePointerOffset = LINE_POINTER_OFFSET + 0.4 * (1 - this.scale);
532
540
  }
533
541
  this.primaryLineRadian = this.primaryLineRadian > 1.3 ? 1.3 : this.primaryLineRadian;
534
542
  this.secondaryLineRadian = this.primaryLineRadian > 1.7 ? 1.7 : this.secondaryLineRadian;
@@ -558,7 +566,8 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
558
566
  minFontSize = MIN_LABEL_FONT_SIZE;
559
567
  // buffer for word wrap
560
568
  widthScale = 1.1;
561
- longerLabel = this.primaryLabel.length > this.secondaryLabel.length ? this.primaryLabel : this.secondaryLabel;
569
+ longerLabel =
570
+ this.primaryLabel.length > this.secondaryLabel.length ? this.primaryLabel : this.secondaryLabel;
562
571
  fontSize = Math.ceil(this.scale * this.canvas.height * GAUGE_LABEL_FONT_SCALE);
563
572
  }
564
573
  else {
@@ -596,7 +605,10 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
596
605
  if (!this.canvas.ctx) {
597
606
  return;
598
607
  }
599
- this.labelStyle = { maxWidth: `${this.lineLength}px`, fontSize: `${this.calculateFontSize(this.canvas.ctx, TextType.LABEL)}px` };
608
+ this.labelStyle = {
609
+ maxWidth: `${this.lineLength}px`,
610
+ fontSize: `${this.calculateFontSize(this.canvas.ctx, TextType.LABEL)}px`
611
+ };
600
612
  }
601
613
  /**
602
614
  * Update value font size
@@ -606,7 +618,10 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
606
618
  if (!this.canvas.ctx) {
607
619
  return;
608
620
  }
609
- this.valueStyle = { maxWidth: `${this.lineLength}px`, fontSize: `${this.calculateFontSize(this.canvas.ctx, TextType.VALUE)}px` };
621
+ this.valueStyle = {
622
+ maxWidth: `${this.lineLength}px`,
623
+ fontSize: `${this.calculateFontSize(this.canvas.ctx, TextType.VALUE)}px`
624
+ };
610
625
  }
611
626
  /**
612
627
  * Compute percentage of value
@@ -617,7 +632,7 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
617
632
  if (value === 0) {
618
633
  return 0;
619
634
  }
620
- return 100 * value / (this.primaryValue + this.secondaryValue);
635
+ return (100 * value) / (this.primaryValue + this.secondaryValue);
621
636
  }
622
637
  /**
623
638
  * Handles canvas resize
@@ -636,11 +651,10 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
636
651
  get legendTemplate() {
637
652
  return this.primaryLegend.length > 0 || this.secondaryLegend.length > 0
638
653
  ? html `<div part="legend-container-outer">
639
- <div part="legend-container-inner">
640
- ${this.primaryLegendTemplate}
641
- ${this.secondaryLegendTemplate}
642
- </div>
643
- </div>`
654
+ <div part="legend-container-inner">
655
+ ${this.primaryLegendTemplate} ${this.secondaryLegendTemplate}
656
+ </div>
657
+ </div>`
644
658
  : null;
645
659
  }
646
660
  /**
@@ -650,9 +664,11 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
650
664
  get primaryLegendTemplate() {
651
665
  return this.primaryLegend
652
666
  ? html `<div part="primary-legend">
653
- <span part="primary-legend-symbol"></span>
654
- <ef-label max-line="${MAX_LEGEND_LINE}" line-clamp="${MAX_LEGEND_LINE}">${this.primaryLegend}</ef-label>
655
- </div>`
667
+ <span part="primary-legend-symbol"></span>
668
+ <ef-label max-line="${MAX_LEGEND_LINE}" line-clamp="${MAX_LEGEND_LINE}"
669
+ >${this.primaryLegend}</ef-label
670
+ >
671
+ </div>`
656
672
  : null;
657
673
  }
658
674
  /**
@@ -662,9 +678,11 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
662
678
  get secondaryLegendTemplate() {
663
679
  return this.secondaryLegend
664
680
  ? html `<div part="secondary-legend">
665
- <span part="secondary-legend-symbol"></span>
666
- <ef-label max-line="${MAX_LEGEND_LINE}" line-clamp="${MAX_LEGEND_LINE}">${this.secondaryLegend}</ef-label>
667
- </div>`
681
+ <span part="secondary-legend-symbol"></span>
682
+ <ef-label max-line="${MAX_LEGEND_LINE}" line-clamp="${MAX_LEGEND_LINE}"
683
+ >${this.secondaryLegend}</ef-label
684
+ >
685
+ </div>`
668
686
  : null;
669
687
  }
670
688
  render() {
@@ -674,38 +692,30 @@ let SwingGauge = class SwingGauge extends ResponsiveElement {
674
692
  <div part="canvas-container">
675
693
  <ef-canvas part="canvas" @resize=${this.onCanvasResize}></ef-canvas>
676
694
  <div part="primary-container" style=${styleMap(this.primaryContainerStyle)}>
677
- ${this.primaryLabel ? html `
678
- <ef-label
679
- part="primary-label"
680
- max-line="${MAX_LABEL_LINE}"
681
- line-clamp="${MAX_LABEL_LINE}"
682
- style=${styleMap(this.labelStyle)}
683
- >${this.primaryLabel}
684
- </ef-label><br>`
695
+ ${this.primaryLabel
696
+ ? html ` <ef-label
697
+ part="primary-label"
698
+ max-line="${MAX_LABEL_LINE}"
699
+ line-clamp="${MAX_LABEL_LINE}"
700
+ style=${styleMap(this.labelStyle)}
701
+ >${this.primaryLabel} </ef-label
702
+ ><br />`
685
703
  : null}
686
- <ef-label
687
- part="primary-value"
688
- truncate=""
689
- line-clamp="1"
690
- style=${styleMap(this.valueStyle)}
704
+ <ef-label part="primary-value" truncate="" line-clamp="1" style=${styleMap(this.valueStyle)}
691
705
  >${this.valueFormatter(this.primaryPercentage, this.primaryValue)}</ef-label
692
706
  >
693
707
  </div>
694
708
  <div part="secondary-container" style=${styleMap(this.secondaryContainerStyle)}>
695
- ${this.secondaryLabel ? html `
696
- <ef-label
697
- part="secondary-label"
698
- max-line="${MAX_LABEL_LINE}"
699
- line-clamp="${MAX_LABEL_LINE}"
700
- style=${styleMap(this.labelStyle)}
701
- >${this.secondaryLabel}
702
- </ef-label><br>`
709
+ ${this.secondaryLabel
710
+ ? html ` <ef-label
711
+ part="secondary-label"
712
+ max-line="${MAX_LABEL_LINE}"
713
+ line-clamp="${MAX_LABEL_LINE}"
714
+ style=${styleMap(this.labelStyle)}
715
+ >${this.secondaryLabel} </ef-label
716
+ ><br />`
703
717
  : null}
704
- <ef-label
705
- part="secondary-value"
706
- truncate=""
707
- line-clamp="1"
708
- style=${styleMap(this.valueStyle)}
718
+ <ef-label part="secondary-value" truncate="" line-clamp="1" style=${styleMap(this.valueStyle)}
709
719
  >${this.valueFormatter(this.secondaryPercentage, this.secondaryValue)}</ef-label
710
720
  >
711
721
  </div>
@@ -1,5 +1,5 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { TemplateResult, CSSResultGroup, ControlElement, PropertyValues } from '@refinitiv-ui/core';
2
+ import { CSSResultGroup, ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
3
  import '../icon/index.js';
4
4
  import '../label/index.js';
5
5
  /**
package/lib/tab/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { __decorate } from "tslib";
2
- import { html, css, ControlElement } from '@refinitiv-ui/core';
2
+ import { ControlElement, css, html } from '@refinitiv-ui/core';
3
+ import { triggerResize } from '@refinitiv-ui/core';
3
4
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
5
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
6
  import { state } from '@refinitiv-ui/core/decorators/state.js';
6
7
  import { isSlotEmpty } from '@refinitiv-ui/utils/is-slot-empty.js';
7
- import { triggerResize } from '@refinitiv-ui/core';
8
- import { VERSION } from '../version.js';
9
8
  import '../icon/index.js';
10
9
  import '../label/index.js';
10
+ import { VERSION } from '../version.js';
11
11
  /**
12
12
  * A building block for individual tab
13
13
  * @attr {boolean} disabled - Set disabled state
@@ -153,11 +153,13 @@ let Tab = class Tab extends ControlElement {
153
153
  * @returns close button template
154
154
  */
155
155
  get CloseTemplate() {
156
- return this.clears || this.clearsOnHover ? html `
157
- <div part="close-container">
158
- <ef-icon part="close" icon="cross" @tap="${this.handleClickClear}"></ef-icon>
159
- </div>
160
- ` : null;
156
+ return this.clears || this.clearsOnHover
157
+ ? html `
158
+ <div part="close-container">
159
+ <ef-icon part="close" icon="cross" @tap="${this.handleClickClear}"></ef-icon>
160
+ </div>
161
+ `
162
+ : null;
161
163
  }
162
164
  /**
163
165
  * Create ef-label template when label is true
@@ -167,13 +169,7 @@ let Tab = class Tab extends ControlElement {
167
169
  if (!this.label || this.isSlotHasContent) {
168
170
  return null;
169
171
  }
170
- return html `
171
- <ef-label
172
- part="label"
173
- .lineClamp=${this.getLineClamp()}>
174
- ${this.label}
175
- </ef-label>
176
- `;
172
+ return html ` <ef-label part="label" .lineClamp=${this.getLineClamp()}> ${this.label} </ef-label> `;
177
173
  }
178
174
  /**
179
175
  * Create ef-label template when subLabel is true
@@ -183,13 +179,7 @@ let Tab = class Tab extends ControlElement {
183
179
  if (!this.subLabel || this.isSlotHasContent) {
184
180
  return null;
185
181
  }
186
- return html `
187
- <ef-label
188
- part="sub-label"
189
- .lineClamp=${this.getLineClamp()}>
190
- ${this.subLabel}
191
- </ef-label>
192
- `;
182
+ return html ` <ef-label part="sub-label" .lineClamp=${this.getLineClamp()}> ${this.subLabel} </ef-label> `;
193
183
  }
194
184
  /**
195
185
  * A `TemplateResult` that will be used
@@ -199,11 +189,10 @@ let Tab = class Tab extends ControlElement {
199
189
  render() {
200
190
  return html `
201
191
  ${this.icon ? html `<ef-icon icon=${this.icon} part="icon"></ef-icon>` : null}
202
- <div part="label-container">
203
- ${this.LabelTemplate}
204
- ${this.SubLabelTemplate}
205
- <slot @slotchange="${this.onSlotChange}"></slot>
206
- </div>
192
+ <div part="label-container">
193
+ ${this.LabelTemplate} ${this.SubLabelTemplate}
194
+ <slot @slotchange="${this.onSlotChange}"></slot>
195
+ </div>
207
196
  ${this.CloseTemplate}
208
197
  `;
209
198
  }