@refinitiv-ui/elements 6.8.7 → 6.8.9

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 (209) hide show
  1. package/CHANGELOG.md +180 -433
  2. package/LICENSE +1 -1
  3. package/README.md +13 -11
  4. package/lib/accordion/index.d.ts +1 -1
  5. package/lib/accordion/index.js +4 -7
  6. package/lib/appstate-bar/index.d.ts +2 -2
  7. package/lib/appstate-bar/index.js +10 -4
  8. package/lib/autosuggest/index.d.ts +7 -7
  9. package/lib/autosuggest/index.js +85 -80
  10. package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
  11. package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
  12. package/lib/button/index.js +7 -10
  13. package/lib/button-bar/index.d.ts +1 -1
  14. package/lib/button-bar/index.js +12 -12
  15. package/lib/calendar/index.d.ts +39 -39
  16. package/lib/calendar/index.js +160 -125
  17. package/lib/calendar/utils.js +2 -2
  18. package/lib/canvas/index.d.ts +1 -1
  19. package/lib/canvas/index.js +2 -4
  20. package/lib/card/helpers/types.d.ts +2 -2
  21. package/lib/card/index.d.ts +5 -5
  22. package/lib/card/index.js +34 -28
  23. package/lib/chart/helpers/legend.js +10 -8
  24. package/lib/chart/index.d.ts +3 -3
  25. package/lib/chart/index.js +17 -17
  26. package/lib/chart/plugins/doughnut-center-label.js +6 -5
  27. package/lib/checkbox/index.d.ts +1 -1
  28. package/lib/checkbox/index.js +12 -13
  29. package/lib/clock/index.d.ts +55 -55
  30. package/lib/clock/index.js +84 -95
  31. package/lib/clock/themes/halo/dark/index.js +1 -1
  32. package/lib/clock/themes/halo/light/index.js +1 -1
  33. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  34. package/lib/clock/themes/solar/pearl/index.js +1 -1
  35. package/lib/collapse/index.d.ts +1 -1
  36. package/lib/collapse/index.js +28 -19
  37. package/lib/collapse/themes/halo/dark/index.js +1 -1
  38. package/lib/collapse/themes/halo/light/index.js +1 -1
  39. package/lib/color-dialog/elements/color-palettes.d.ts +1 -1
  40. package/lib/color-dialog/elements/color-palettes.js +5 -6
  41. package/lib/color-dialog/elements/grayscale-palettes.d.ts +1 -1
  42. package/lib/color-dialog/elements/grayscale-palettes.js +9 -9
  43. package/lib/color-dialog/elements/palettes.js +5 -4
  44. package/lib/color-dialog/helpers/value-model.js +7 -9
  45. package/lib/color-dialog/index.d.ts +6 -6
  46. package/lib/color-dialog/index.js +53 -37
  47. package/lib/color-picker/index.d.ts +2 -2
  48. package/lib/color-picker/index.js +40 -34
  49. package/lib/combo-box/helpers/filter.d.ts +2 -2
  50. package/lib/combo-box/helpers/types.d.ts +1 -1
  51. package/lib/combo-box/index.d.ts +9 -9
  52. package/lib/combo-box/index.js +61 -55
  53. package/lib/configuration/elements/configuration.d.ts +1 -1
  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 +151 -132
  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 +6 -6
  66. package/lib/dialog/index.js +48 -38
  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 +6 -8
  86. package/lib/icon/utils/IconLoader.d.ts +1 -0
  87. package/lib/icon/utils/IconLoader.js +9 -1
  88. package/lib/interactive-chart/helpers/types.d.ts +3 -3
  89. package/lib/interactive-chart/index.d.ts +34 -34
  90. package/lib/interactive-chart/index.js +72 -57
  91. package/lib/item/helpers/types.d.ts +1 -1
  92. package/lib/item/index.d.ts +3 -3
  93. package/lib/item/index.js +24 -20
  94. package/lib/jsx.d.ts +6 -4
  95. package/lib/label/index.d.ts +1 -1
  96. package/lib/label/index.js +11 -8
  97. package/lib/layout/index.d.ts +7 -7
  98. package/lib/layout/index.js +7 -7
  99. package/lib/led-gauge/index.d.ts +1 -1
  100. package/lib/led-gauge/index.js +10 -10
  101. package/lib/list/elements/list.d.ts +3 -3
  102. package/lib/list/elements/list.js +10 -12
  103. package/lib/list/helpers/renderer.js +2 -2
  104. package/lib/list/helpers/types.d.ts +1 -1
  105. package/lib/list/index.d.ts +1 -1
  106. package/lib/list/renderer.d.ts +7 -7
  107. package/lib/loader/index.js +7 -8
  108. package/lib/multi-input/index.d.ts +6 -6
  109. package/lib/multi-input/index.js +39 -45
  110. package/lib/notification/elements/notification-tray.d.ts +2 -2
  111. package/lib/notification/elements/notification-tray.js +3 -3
  112. package/lib/notification/elements/notification.d.ts +2 -2
  113. package/lib/notification/elements/notification.js +22 -14
  114. package/lib/notification/helpers/status.js +1 -1
  115. package/lib/number-field/index.d.ts +5 -6
  116. package/lib/number-field/index.js +37 -47
  117. package/lib/overlay/elements/overlay-viewport.d.ts +1 -1
  118. package/lib/overlay/elements/overlay.d.ts +2 -2
  119. package/lib/overlay/elements/overlay.js +154 -98
  120. package/lib/overlay/helpers/types.d.ts +1 -1
  121. package/lib/overlay/managers/backdrop-manager.d.ts +1 -1
  122. package/lib/overlay/managers/backdrop-manager.js +2 -2
  123. package/lib/overlay/managers/close-manager.js +2 -1
  124. package/lib/overlay/managers/focus-manager.js +23 -13
  125. package/lib/overlay/managers/interaction-lock-manager.d.ts +4 -4
  126. package/lib/overlay/managers/interaction-lock-manager.js +33 -25
  127. package/lib/overlay/managers/viewport-manager.d.ts +2 -2
  128. package/lib/overlay/managers/viewport-manager.js +3 -2
  129. package/lib/overlay/managers/zindex-manager.js +4 -2
  130. package/lib/overlay-menu/helpers/types.d.ts +2 -2
  131. package/lib/overlay-menu/index.d.ts +1 -1
  132. package/lib/overlay-menu/index.js +44 -33
  133. package/lib/overlay-menu/managers/menu-manager.d.ts +10 -10
  134. package/lib/overlay-menu/managers/menu-manager.js +15 -13
  135. package/lib/pagination/index.d.ts +4 -4
  136. package/lib/pagination/index.js +39 -14
  137. package/lib/panel/index.js +1 -1
  138. package/lib/password-field/index.d.ts +2 -2
  139. package/lib/password-field/index.js +4 -4
  140. package/lib/pill/index.d.ts +1 -1
  141. package/lib/pill/index.js +22 -19
  142. package/lib/progress-bar/index.d.ts +1 -1
  143. package/lib/progress-bar/index.js +38 -37
  144. package/lib/radio-button/index.d.ts +2 -2
  145. package/lib/radio-button/index.js +17 -12
  146. package/lib/radio-button/radio-button-registry.js +8 -5
  147. package/lib/rating/index.d.ts +1 -1
  148. package/lib/rating/index.js +2 -5
  149. package/lib/rating/utils.d.ts +6 -6
  150. package/lib/rating/utils.js +6 -6
  151. package/lib/search-field/index.d.ts +2 -2
  152. package/lib/search-field/index.js +4 -4
  153. package/lib/select/index.d.ts +34 -34
  154. package/lib/select/index.js +70 -83
  155. package/lib/sidebar-layout/index.d.ts +2 -2
  156. package/lib/sidebar-layout/index.js +7 -9
  157. package/lib/slider/index.d.ts +2 -2
  158. package/lib/slider/index.js +57 -45
  159. package/lib/slider/utils.d.ts +10 -10
  160. package/lib/slider/utils.js +10 -10
  161. package/lib/sparkline/index.d.ts +1 -1
  162. package/lib/sparkline/index.js +7 -8
  163. package/lib/swing-gauge/helpers.js +2 -2
  164. package/lib/swing-gauge/index.d.ts +19 -19
  165. package/lib/swing-gauge/index.js +91 -81
  166. package/lib/tab/index.d.ts +1 -1
  167. package/lib/tab/index.js +16 -27
  168. package/lib/tab/themes/halo/dark/index.js +1 -1
  169. package/lib/tab/themes/halo/light/index.js +1 -1
  170. package/lib/tab/themes/solar/charcoal/index.js +1 -1
  171. package/lib/tab/themes/solar/pearl/index.js +1 -1
  172. package/lib/tab-bar/helpers/animate.js +1 -1
  173. package/lib/tab-bar/index.d.ts +1 -1
  174. package/lib/tab-bar/index.js +34 -18
  175. package/lib/tab-bar/themes/halo/dark/index.js +1 -1
  176. package/lib/tab-bar/themes/halo/light/index.js +1 -1
  177. package/lib/text-field/index.d.ts +1 -1
  178. package/lib/text-field/index.js +36 -33
  179. package/lib/time-picker/index.d.ts +6 -6
  180. package/lib/time-picker/index.js +104 -90
  181. package/lib/toggle/index.d.ts +1 -1
  182. package/lib/toggle/index.js +4 -3
  183. package/lib/tooltip/elements/title-tooltip.js +2 -2
  184. package/lib/tooltip/index.d.ts +27 -27
  185. package/lib/tooltip/index.js +42 -38
  186. package/lib/tooltip/managers/tooltip-manager.d.ts +1 -1
  187. package/lib/tornado-chart/elements/tornado-chart.d.ts +1 -1
  188. package/lib/tornado-chart/elements/tornado-chart.js +1 -1
  189. package/lib/tornado-chart/elements/tornado-item.d.ts +2 -2
  190. package/lib/tornado-chart/elements/tornado-item.js +12 -10
  191. package/lib/tree/elements/tree-item.d.ts +3 -3
  192. package/lib/tree/elements/tree-item.js +21 -19
  193. package/lib/tree/elements/tree.d.ts +1 -1
  194. package/lib/tree/elements/tree.js +12 -11
  195. package/lib/tree/helpers/renderer.js +4 -3
  196. package/lib/tree/index.d.ts +1 -1
  197. package/lib/tree/managers/tree-manager.d.ts +1 -1
  198. package/lib/tree/managers/tree-manager.js +17 -18
  199. package/lib/tree/themes/solar/charcoal/index.js +1 -1
  200. package/lib/tree/themes/solar/pearl/index.js +1 -1
  201. package/lib/tree-select/index.d.ts +9 -9
  202. package/lib/tree-select/index.js +91 -82
  203. package/lib/tree-select/themes/halo/dark/index.js +1 -1
  204. package/lib/tree-select/themes/halo/light/index.js +1 -1
  205. package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
  206. package/lib/tree-select/themes/solar/pearl/index.js +1 -1
  207. package/lib/version.js +1 -1
  208. package/package.json +16 -16
  209. package/tsconfig.tsbuildinfo +1 -1
@@ -1,22 +1,22 @@
1
1
  import { __decorate } from "tslib";
2
- import { ControlElement, html, css, WarningNotice, nothing } from '@refinitiv-ui/core';
2
+ import inputFormat from 'date-fns/esm/format/index.js';
3
+ import isValid from 'date-fns/esm/isValid/index.js';
4
+ import inputParse from 'date-fns/esm/parse/index.js';
5
+ import { ControlElement, WarningNotice, css, html, nothing } from '@refinitiv-ui/core';
3
6
  import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
7
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
8
  import { query } from '@refinitiv-ui/core/decorators/query.js';
6
- import { VERSION } from '../version.js';
9
+ import { TranslatePropertyKey, getLocale, translate } from '@refinitiv-ui/translate';
10
+ import { DateFormat, DateTimeFormat, addMonths, format, isAfter, isBefore, isValidDate, isValidDateTime, parse, subMonths } from '@refinitiv-ui/utils/date.js';
7
11
  import '../calendar/index.js';
8
12
  import '../icon/index.js';
13
+ import { preload } from '../icon/index.js';
9
14
  import '../overlay/index.js';
10
15
  import '../text-field/index.js';
11
16
  import '../time-picker/index.js';
12
- import { translate, getLocale, TranslatePropertyKey } from '@refinitiv-ui/translate';
17
+ import { VERSION } from '../version.js';
13
18
  import { getDateFNSLocale } from './locales.js';
14
- import inputFormat from 'date-fns/esm/format/index.js';
15
- import inputParse from 'date-fns/esm/parse/index.js';
16
- import isValid from 'date-fns/esm/isValid/index.js';
17
- import { addMonths, subMonths, isAfter, isBefore, isValidDate, isValidDateTime, DateFormat, DateTimeFormat, parse, format } from '@refinitiv-ui/utils/date.js';
18
19
  import { DateTimeSegment, formatToView, getCurrentTime } from './utils.js';
19
- import { preload } from '../icon/index.js';
20
20
  preload('calendar', 'down', 'left', 'right'); /* preload calendar icons for faster loading */
21
21
  const POPUP_POSITION = ['bottom-start', 'top-start', 'bottom-end', 'top-end', 'bottom-middle', 'top-middle'];
22
22
  const INPUT_FORMAT = {
@@ -58,21 +58,21 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
58
58
  this._max = '';
59
59
  this.maxDate = '';
60
60
  /**
61
- * Only enable weekdays
62
- */
61
+ * Only enable weekdays
62
+ */
63
63
  this.weekdaysOnly = false;
64
64
  /**
65
- * Only enable weekends
66
- */
65
+ * Only enable weekends
66
+ */
67
67
  this.weekendsOnly = false;
68
68
  /**
69
- * Custom filter, used for enabling/disabling certain dates
70
- * @type {DatetimePickerFilter | null}
71
- */
69
+ * Custom filter, used for enabling/disabling certain dates
70
+ * @type {DatetimePickerFilter | null}
71
+ */
72
72
  this.filter = null;
73
73
  /**
74
- * Set to switch to range select mode
75
- */
74
+ * Set to switch to range select mode
75
+ */
76
76
  this.range = false;
77
77
  this._values = []; /* list of values as passed by the user */
78
78
  this._segments = []; /* filtered and processed list of values */
@@ -87,8 +87,8 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
87
87
  this.showSeconds = false;
88
88
  this._placeholder = '';
89
89
  /**
90
- * Toggles the opened state of the list
91
- */
90
+ * Toggles the opened state of the list
91
+ */
92
92
  this.opened = false;
93
93
  /**
94
94
  * Set state to error
@@ -99,27 +99,27 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
99
99
  */
100
100
  this.warning = false;
101
101
  /**
102
- * Only open picker panel when calendar icon is clicked.
103
- * Clicking on the input will no longer open the picker.
104
- */
102
+ * Only open picker panel when calendar icon is clicked.
103
+ * Clicking on the input will no longer open the picker.
104
+ */
105
105
  this.inputTriggerDisabled = false;
106
106
  /**
107
- * Disable input part of the picker
108
- */
107
+ * Disable input part of the picker
108
+ */
109
109
  this.inputDisabled = false;
110
110
  /**
111
- * Disable the popup
112
- */
111
+ * Disable the popup
112
+ */
113
113
  this.popupDisabled = false;
114
114
  this._format = '';
115
115
  /**
116
- * Toggle to display the time picker
117
- */
116
+ * Toggle to display the time picker
117
+ */
118
118
  this.timepicker = false;
119
119
  /**
120
- * Display two calendar pickers.
121
- * @type {"" | "consecutive" | "split"}
122
- */
120
+ * Display two calendar pickers.
121
+ * @type {"" | "consecutive" | "split"}
122
+ */
123
123
  this.duplex = null;
124
124
  this._views = [];
125
125
  this._interimSegments = [];
@@ -145,44 +145,45 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
145
145
  outline: none;
146
146
  cursor: text;
147
147
  }
148
- [part=input-wrapper] {
148
+ [part='input-wrapper'] {
149
149
  display: flex;
150
150
  flex: 1;
151
151
  }
152
- [part=body] {
152
+ [part='body'] {
153
153
  display: flex;
154
154
  }
155
- [part=timepicker-wrapper] {
155
+ [part='timepicker-wrapper'] {
156
156
  display: flex;
157
157
  justify-content: space-between;
158
158
  }
159
- [part=timepicker-wrapper]:before,
160
- [part=timepicker-wrapper]:after {
159
+ [part='timepicker-wrapper']:before,
160
+ [part='timepicker-wrapper']:after {
161
161
  content: '';
162
162
  }
163
- [part=input] {
163
+ [part='input'] {
164
164
  flex: 1;
165
165
  width: auto;
166
166
  height: auto;
167
167
  padding: 0;
168
168
  margin: 0;
169
169
  }
170
- [part=calendar-wrapper] {
170
+ [part='calendar-wrapper'] {
171
171
  display: inline-flex;
172
172
  }
173
- [part=icon] {
173
+ [part='icon'] {
174
174
  cursor: pointer;
175
175
  }
176
- :host([popup-disabled]) [part=icon], :host([readonly]) [part=icon] {
176
+ :host([popup-disabled]) [part='icon'],
177
+ :host([readonly]) [part='icon'] {
177
178
  pointer-events: none;
178
179
  }
179
180
  `;
180
181
  }
181
182
  /**
182
- * Set minimum date
183
- * @param min date
184
- * @default -
185
- */
183
+ * Set minimum date
184
+ * @param min date
185
+ * @default -
186
+ */
186
187
  set min(min) {
187
188
  if (!this.isValidValue(min)) {
188
189
  this.warnInvalidValue(min);
@@ -199,10 +200,10 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
199
200
  return this._min;
200
201
  }
201
202
  /**
202
- * Set maximum date
203
- * @param max date
204
- * @default -
205
- */
203
+ * Set maximum date
204
+ * @param max date
205
+ * @default -
206
+ */
206
207
  set max(max) {
207
208
  if (!this.isValidValue(max)) {
208
209
  this.warnInvalidValue(max);
@@ -219,25 +220,25 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
219
220
  return this._max;
220
221
  }
221
222
  /**
222
- * Set to switch to multiple select mode
223
- * @ignore
224
- * @param multiple Multiple
225
- */
223
+ * Set to switch to multiple select mode
224
+ * @ignore
225
+ * @param multiple Multiple
226
+ */
226
227
  /* istanbul ignore next */
227
228
  set multiple(multiple) {
228
229
  new WarningNotice('multiple is not currently supported').show();
229
230
  }
230
231
  /**
231
- * @ignore
232
- */
232
+ * @ignore
233
+ */
233
234
  get multiple() {
234
235
  return false;
235
236
  }
236
237
  /**
237
- * Current date time value
238
- * @param value Calendar value
239
- * @default -
240
- */
238
+ * Current date time value
239
+ * @param value Calendar value
240
+ * @default -
241
+ */
241
242
  set value(value) {
242
243
  this.values = value ? [value] : [];
243
244
  }
@@ -245,11 +246,11 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
245
246
  return this.values[0] || '';
246
247
  }
247
248
  /**
248
- * Set multiple selected values
249
- * @param values Values to set
250
- * @type {string[]}
251
- * @default []
252
- */
249
+ * Set multiple selected values
250
+ * @param values Values to set
251
+ * @type {string[]}
252
+ * @default []
253
+ */
253
254
  set values(values) {
254
255
  const oldValues = this._values;
255
256
  if (String(oldValues) !== String(values)) {
@@ -259,13 +260,13 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
259
260
  }
260
261
  }
261
262
  get values() {
262
- return this._segments.map(segment => segment.value);
263
+ return this._segments.map((segment) => segment.value);
263
264
  }
264
265
  /**
265
- * Placeholder to display when no value is set
266
- * @param placeholder Placeholder
267
- * @default -
268
- */
266
+ * Placeholder to display when no value is set
267
+ * @param placeholder Placeholder
268
+ * @default -
269
+ */
269
270
  set placeholder(placeholder) {
270
271
  const oldPlaceholder = this._placeholder;
271
272
  if (oldPlaceholder !== placeholder) {
@@ -277,11 +278,11 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
277
278
  return this._placeholder || this.format;
278
279
  }
279
280
  /**
280
- * Set the datetime format
281
- * Based on dane-fns datetime formats
282
- * @param format Date format
283
- * @default -
284
- */
281
+ * Set the datetime format
282
+ * Based on dane-fns datetime formats
283
+ * @param format Date format
284
+ * @default -
285
+ */
285
286
  set format(format) {
286
287
  const oldFormat = this._format;
287
288
  if (oldFormat !== format) {
@@ -290,18 +291,23 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
290
291
  }
291
292
  }
292
293
  get format() {
293
- return this._format || (this.timepicker
294
- ? (this.showSeconds
295
- ? (this.amPm ? INPUT_FORMAT.DATETIME_SECONDS_AM_PM : INPUT_FORMAT.DATETIME_SECONDS)
296
- : (this.amPm ? INPUT_FORMAT.DATETIME_AM_PM : INPUT_FORMAT.DATETIME))
297
- : INPUT_FORMAT.DATE);
294
+ return (this._format ||
295
+ (this.timepicker
296
+ ? this.showSeconds
297
+ ? this.amPm
298
+ ? INPUT_FORMAT.DATETIME_SECONDS_AM_PM
299
+ : INPUT_FORMAT.DATETIME_SECONDS
300
+ : this.amPm
301
+ ? INPUT_FORMAT.DATETIME_AM_PM
302
+ : INPUT_FORMAT.DATETIME
303
+ : INPUT_FORMAT.DATE));
298
304
  }
299
305
  /**
300
- * Set the current calendar view.
301
- * Accepted format: 'yyyy-MM'
302
- * @param view view date
303
- * @default -
304
- */
306
+ * Set the current calendar view.
307
+ * Accepted format: 'yyyy-MM'
308
+ * @param view view date
309
+ * @default -
310
+ */
305
311
  set view(view) {
306
312
  this.views = view ? [view] : [];
307
313
  }
@@ -309,12 +315,12 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
309
315
  return this.views[0] || '';
310
316
  }
311
317
  /**
312
- * Set the current calendar views for duplex mode
313
- * Accepted format: 'yyyy-MM'
314
- * @param views view dates
315
- * @type {string[]}
316
- * @default []
317
- */
318
+ * Set the current calendar views for duplex mode
319
+ * Accepted format: 'yyyy-MM'
320
+ * @param views view dates
321
+ * @type {string[]}
322
+ * @default []
323
+ */
318
324
  set views(views) {
319
325
  const oldViews = this._views;
320
326
  views = this.filterAndWarnInvalidViews(views);
@@ -334,7 +340,11 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
334
340
  }
335
341
  const to = this.values[1];
336
342
  // default duplex mode
337
- if (this.isDuplexConsecutive() || !from || !to || formatToView(from) === formatToView(to) || isBefore(to, from)) {
343
+ if (this.isDuplexConsecutive() ||
344
+ !from ||
345
+ !to ||
346
+ formatToView(from) === formatToView(to) ||
347
+ isBefore(to, from)) {
338
348
  return this.composeViews(formatToView(from || to || now), !from && to ? 1 : 0, []);
339
349
  }
340
350
  // duplex split if as from and to
@@ -394,15 +404,15 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
394
404
  }
395
405
  // Need to check for the attribute to cover the case when
396
406
  // timepicker and value attributes are set
397
- return (this.timepicker || this.hasAttribute('timepicker'))
407
+ return this.timepicker || this.hasAttribute('timepicker')
398
408
  ? isValidDateTime(value)
399
409
  : isValidDate(value, DateFormat.yyyyMMdd);
400
410
  }
401
411
  /**
402
- * Used to show a warning when the value does not pass the validation
403
- * @param value that is invalid
404
- * @returns {void}
405
- */
412
+ * Used to show a warning when the value does not pass the validation
413
+ * @param value that is invalid
414
+ * @returns {void}
415
+ */
406
416
  warnInvalidValue(value) {
407
417
  new WarningNotice(`The specified value "${value}" does not conform to the required format. The format is ${this.timepicker ? '"yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS"' : '"yyyy-MM-dd"'}.`).show();
408
418
  }
@@ -420,7 +430,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
420
430
  * @returns {void}
421
431
  */
422
432
  valuesToSegments() {
423
- const newSegments = this.filterAndWarnInvalidValues(this._values).map(value => DateTimeSegment.fromString(value));
433
+ const newSegments = this.filterAndWarnInvalidValues(this._values).map((value) => DateTimeSegment.fromString(value));
424
434
  this._segments = newSegments;
425
435
  this.interimSegments = newSegments;
426
436
  }
@@ -431,10 +441,10 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
431
441
  */
432
442
  shouldValidateValue(changedProperties) {
433
443
  // do not validate default value
434
- if (changedProperties.has('_values') && changedProperties.get('_values') !== undefined
435
- || changedProperties.has('min') && changedProperties.get('min') !== undefined
436
- || changedProperties.has('max') && changedProperties.get('max') !== undefined
437
- || changedProperties.has('showSeconds') && changedProperties.get('showSeconds') !== undefined) {
444
+ if ((changedProperties.has('_values') && changedProperties.get('_values') !== undefined) ||
445
+ (changedProperties.has('min') && changedProperties.get('min') !== undefined) ||
446
+ (changedProperties.has('max') && changedProperties.get('max') !== undefined) ||
447
+ (changedProperties.has('showSeconds') && changedProperties.get('showSeconds') !== undefined)) {
438
448
  return true;
439
449
  }
440
450
  return false;
@@ -446,7 +456,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
446
456
  * @returns Filtered collection of values
447
457
  */
448
458
  filterAndWarnInvalidValues(values) {
449
- return values.map(value => {
459
+ return values.map((value) => {
450
460
  if (this.isValidValue(value)) {
451
461
  return value;
452
462
  }
@@ -515,7 +525,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
515
525
  }
516
526
  // input values cannot be populated off interim segments as require a valid date
517
527
  // date-fns formats to local if there is time info
518
- this.inputValues = this._segments.map(segment => this.formatSegment(segment));
528
+ this.inputValues = this._segments.map((segment) => this.formatSegment(segment));
519
529
  }
520
530
  /**
521
531
  * Format date segment according to format and locale
@@ -523,9 +533,11 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
523
533
  * @returns formatted string
524
534
  */
525
535
  formatSegment(segment) {
526
- return segment.value ? inputFormat(segment.getTime(), this.format, {
527
- locale: getDateFNSLocale(getLocale(this))
528
- }) : '';
536
+ return segment.value
537
+ ? inputFormat(segment.getTime(), this.format, {
538
+ locale: getDateFNSLocale(getLocale(this))
539
+ })
540
+ : '';
529
541
  }
530
542
  /**
531
543
  * Construct view collection
@@ -540,22 +552,26 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
540
552
  return [view];
541
553
  }
542
554
  if (this.isDuplexConsecutive()) {
543
- if (index === 0) { /* from */
555
+ if (index === 0) {
556
+ /* from */
544
557
  return [view, formatToView(addMonths(view, 1))];
545
558
  }
546
- else { /* to */
559
+ else {
560
+ /* to */
547
561
  return [formatToView(subMonths(view, 1)), view];
548
562
  }
549
563
  }
550
564
  // duplex split
551
- if (index === 0) { /* from. to must be after or the same */
565
+ if (index === 0) {
566
+ /* from. to must be after or the same */
552
567
  let after = views[1] || addMonths(view, 1);
553
568
  if (isBefore(after, view)) {
554
569
  after = view;
555
570
  }
556
571
  return [view, formatToView(after)];
557
572
  }
558
- if (index === 1) { /* to. from must be before or the same */
573
+ if (index === 1) {
574
+ /* to. from must be before or the same */
559
575
  let before = views[0] || subMonths(view, 1);
560
576
  if (isAfter(before, view)) {
561
577
  before = view;
@@ -570,11 +586,11 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
570
586
  * @param segments Segments
571
587
  */
572
588
  set interimSegments(segments) {
573
- const interimSegments = segments.map(segment => DateTimeSegment.fromDateTimeSegment(segment));
589
+ const interimSegments = segments.map((segment) => DateTimeSegment.fromDateTimeSegment(segment));
574
590
  this._interimSegments = interimSegments;
575
591
  // cannot populate calendar if from is after to, it looks broken
576
- this.calendarValues = this.isFromBeforeTo() ? interimSegments.map(segment => segment.dateSegment) : [];
577
- this.timepickerValues = interimSegments.map(segment => segment.timeSegment);
592
+ this.calendarValues = this.isFromBeforeTo() ? interimSegments.map((segment) => segment.dateSegment) : [];
593
+ this.timepickerValues = interimSegments.map((segment) => segment.timeSegment);
578
594
  }
579
595
  /**
580
596
  * Get interim segments. These are free to modify
@@ -595,9 +611,10 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
595
611
  if (oldSegments.toString() === newSegments.toString()) {
596
612
  return false;
597
613
  }
598
- const newValues = newSegments.map(segment => segment.value);
614
+ const newValues = newSegments.map((segment) => segment.value);
599
615
  // validate
600
- for (let i = 0; i < newValues.length; i += 1) { /* need this step in case timepicker is not populated */
616
+ for (let i = 0; i < newValues.length; i += 1) {
617
+ /* need this step in case timepicker is not populated */
601
618
  if (!this.isValidValue(newValues[i])) {
602
619
  return false;
603
620
  }
@@ -807,7 +824,11 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
807
824
  locale: getDateFNSLocale(getLocale(this))
808
825
  });
809
826
  if (isValid(date)) {
810
- dateString = inputFormat(date, this.timepicker ? this.showSeconds ? DateTimeFormat.yyyMMddTHHmmss : DateTimeFormat.yyyMMddTHHmm : DateFormat.yyyyMMdd);
827
+ dateString = inputFormat(date, this.timepicker
828
+ ? this.showSeconds
829
+ ? DateTimeFormat.yyyMMddTHHmmss
830
+ : DateTimeFormat.yyyMMddTHHmm
831
+ : DateFormat.yyyyMMdd);
811
832
  this.resetViews(); /* user input should be treated similar to manually switching the views */
812
833
  }
813
834
  }
@@ -898,7 +919,8 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
898
919
  * @returns {void}
899
920
  */
900
921
  setOpened(opened) {
901
- if (opened && !this.canOpenPopup) { /* never allow to open popup if cannot do so */
922
+ if (opened && !this.canOpenPopup) {
923
+ /* never allow to open popup if cannot do so */
902
924
  return;
903
925
  }
904
926
  if (this.opened !== opened && this.notifyPropertyChange('opened', opened, true)) {
@@ -925,7 +947,8 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
925
947
  .showSeconds=${this.showSeconds}
926
948
  .amPm=${this.amPm}
927
949
  .value=${value}
928
- @value-changed=${this.onTimePickerValueChanged}></ef-time-picker>`;
950
+ @value-changed=${this.onTimePickerValueChanged}
951
+ ></ef-time-picker>`;
929
952
  }
930
953
  /**
931
954
  * Get calendar template
@@ -951,7 +974,8 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
951
974
  .view=${view}
952
975
  @keydown=${this.onCalendarKeyDown}
953
976
  @view-changed=${this.onCalendarViewChanged}
954
- @value-changed=${this.onCalendarValueChanged}></ef-calendar>`;
977
+ @value-changed=${this.onCalendarValueChanged}
978
+ ></ef-calendar>`;
955
979
  }
956
980
  /**
957
981
  * Get calendar templates
@@ -993,18 +1017,15 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
993
1017
  @focus=${this.onInputFocus}
994
1018
  @blur=${this.onInputBlur}
995
1019
  @keydown=${this.onInputKeyDown}
996
- @value-changed=${this.onInputValueChanged}></ef-text-field>
1020
+ @value-changed=${this.onInputValueChanged}
1021
+ ></ef-text-field>
997
1022
  `;
998
1023
  }
999
1024
  /**
1000
1025
  * Template for rendering an icon
1001
1026
  */
1002
1027
  get iconTemplate() {
1003
- return html `
1004
- <ef-icon
1005
- part="icon"
1006
- icon="calendar"></ef-icon>
1007
- `;
1028
+ return html ` <ef-icon part="icon" icon="calendar"></ef-icon> `;
1008
1029
  }
1009
1030
  /**
1010
1031
  * Template for inputs
@@ -1021,8 +1042,8 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
1021
1042
  `;
1022
1043
  }
1023
1044
  /**
1024
- * Popup panel template
1025
- */
1045
+ * Popup panel template
1046
+ */
1026
1047
  get popupTemplate() {
1027
1048
  if (this.lazyRendered) {
1028
1049
  return html `<ef-overlay
@@ -1044,7 +1065,9 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
1044
1065
  <div part="calendar-wrapper">
1045
1066
  ${this.calendarsTemplate}
1046
1067
  </div>
1047
- ${this.timepicker ? html `<div part="timepicker-wrapper">${this.timepickersTemplate}</div>` : undefined}
1068
+ ${this.timepicker
1069
+ ? html `<div part="timepicker-wrapper">${this.timepickersTemplate}</div>`
1070
+ : undefined}
1048
1071
  </div>
1049
1072
  <div><slot name="right"></div>
1050
1073
  </div>
@@ -1058,11 +1081,7 @@ let DatetimePicker = class DatetimePicker extends ControlElement {
1058
1081
  * @return Render template
1059
1082
  */
1060
1083
  render() {
1061
- return html `
1062
- ${this.inputTemplates}
1063
- ${this.iconTemplate}
1064
- ${this.popupTemplate}
1065
- `;
1084
+ return html ` ${this.inputTemplates} ${this.iconTemplate} ${this.popupTemplate} `;
1066
1085
  }
1067
1086
  };
1068
1087
  __decorate([
@@ -1,8 +1,6 @@
1
- import { Phrasebook } from '@refinitiv-ui/phrasebook';
2
- import { resolveLocale, DEFAULT_LOCALE } from '@refinitiv-ui/i18n';
1
+ import de from 'date-fns/esm/locale/de/index.js';
3
2
  import enGB from 'date-fns/esm/locale/en-GB/index.js';
4
3
  import enUS from 'date-fns/esm/locale/en-US/index.js';
5
- import de from 'date-fns/esm/locale/de/index.js';
6
4
  import es from 'date-fns/esm/locale/es/index.js';
7
5
  import fr from 'date-fns/esm/locale/fr/index.js';
8
6
  import it from 'date-fns/esm/locale/it/index.js';
@@ -12,6 +10,8 @@ import pl from 'date-fns/esm/locale/pl/index.js';
12
10
  import ru from 'date-fns/esm/locale/ru/index.js';
13
11
  import th from 'date-fns/esm/locale/th/index.js';
14
12
  import zhCN from 'date-fns/esm/locale/zh-CN/index.js';
13
+ import { DEFAULT_LOCALE, resolveLocale } from '@refinitiv-ui/i18n';
14
+ import { Phrasebook } from '@refinitiv-ui/phrasebook';
15
15
  // This file is a transition between using date-fns and Intl object to format dates
16
16
  // As of now, use Phraseboook to just resolve languages and locales
17
17
  // and match against the date-fns locales.
@@ -32,7 +32,7 @@ Phrasebook.define('ru', scope, globals);
32
32
  Phrasebook.define('th', scope, globals);
33
33
  Phrasebook.define('zh', scope, globals);
34
34
  const locales = {
35
- 'en': enUS,
35
+ en: enUS,
36
36
  'en-GB': enGB,
37
37
  de,
38
38
  es,
@@ -43,7 +43,7 @@ const locales = {
43
43
  pl,
44
44
  ru,
45
45
  th,
46
- 'zh': zhCN
46
+ zh: zhCN
47
47
  };
48
48
  /**
49
49
  * Get date-fns locale or default locale
@@ -1,4 +1,4 @@
1
- import { format, DateFormat, parse, TimeFormat, toTimeSegment } from '@refinitiv-ui/utils/date.js';
1
+ import { DateFormat, TimeFormat, format, parse, 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
  */
@@ -53,18 +53,18 @@ DateTimeSegment.fromDateTimeSegment = (segment) => {
53
53
  return new DateTimeSegment(segment.dateSegment, segment.timeSegment);
54
54
  };
55
55
  /**
56
- * Check if passed Date object is valid
57
- * @param date Date to check
58
- * @returns is valid
59
- */
56
+ * Check if passed Date object is valid
57
+ * @param date Date to check
58
+ * @returns is valid
59
+ */
60
60
  const isValid = (date) => {
61
61
  return !isNaN(date.getTime());
62
62
  };
63
63
  /**
64
- * Convert date to Date object
65
- * @param date Date to convert
66
- * @returns Date object
67
- */
64
+ * Convert date to Date object
65
+ * @param date Date to convert
66
+ * @returns Date object
67
+ */
68
68
  const toDate = (date) => {
69
69
  if (typeof date === 'string') {
70
70
  return parse(date);
@@ -128,8 +128,7 @@ class DraggableManager {
128
128
  setHandleListeners(draggableElement) {
129
129
  const element = this.draggableElements.get(draggableElement);
130
130
  if (element) {
131
- element.handle
132
- .addEventListener('mousedown', element.mouseDownListener);
131
+ element.handle.addEventListener('mousedown', element.mouseDownListener);
133
132
  }
134
133
  }
135
134
  /**
@@ -1,12 +1,12 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { CSSResultGroup, TemplateResult, ElementSize, PropertyValues } from '@refinitiv-ui/core';
3
- import { Overlay } from '../overlay/index.js';
2
+ import { CSSResultGroup, ElementSize, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
+ import '@refinitiv-ui/phrasebook/locale/en/dialog.js';
4
+ import { Translate } from '@refinitiv-ui/translate';
5
+ import '../button/index.js';
6
+ import '../header/index.js';
4
7
  import '../icon/index.js';
8
+ import { Overlay } from '../overlay/index.js';
5
9
  import '../panel/index.js';
6
- import '../header/index.js';
7
- import '../button/index.js';
8
- import { Translate } from '@refinitiv-ui/translate';
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,