@refinitiv-ui/elements 0.0.0-dev.2589386127.1 → 0.0.0-dev.3949727059.1

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 (59) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/lib/calendar/index.js +6 -5
  3. package/lib/calendar/themes/halo/dark/index.js +1 -1
  4. package/lib/calendar/themes/halo/light/index.js +1 -1
  5. package/lib/combo-box/index.d.ts +1 -0
  6. package/lib/combo-box/index.js +4 -3
  7. package/lib/datetime-field/custom-elements.json +4 -0
  8. package/lib/datetime-field/custom-elements.md +1 -0
  9. package/lib/datetime-field/index.d.ts +13 -45
  10. package/lib/datetime-field/index.js +44 -132
  11. package/lib/datetime-field/resolvedLocale.d.ts +19 -0
  12. package/lib/datetime-field/resolvedLocale.js +137 -0
  13. package/lib/datetime-picker/custom-elements.json +72 -85
  14. package/lib/datetime-picker/custom-elements.md +31 -30
  15. package/lib/datetime-picker/index.d.ts +173 -251
  16. package/lib/datetime-picker/index.js +380 -663
  17. package/lib/datetime-picker/themes/halo/dark/index.js +2 -2
  18. package/lib/datetime-picker/themes/halo/light/index.js +2 -2
  19. package/lib/datetime-picker/themes/solar/charcoal/index.js +2 -2
  20. package/lib/datetime-picker/themes/solar/pearl/index.js +2 -2
  21. package/lib/datetime-picker/types.d.ts +1 -2
  22. package/lib/datetime-picker/utils.d.ts +22 -48
  23. package/lib/datetime-picker/utils.js +27 -83
  24. package/lib/interactive-chart/helpers/types.d.ts +1 -0
  25. package/lib/interactive-chart/index.js +4 -2
  26. package/lib/list/elements/list-item.d.ts +30 -0
  27. package/lib/list/elements/list-item.js +19 -0
  28. package/lib/list/elements/list.d.ts +307 -0
  29. package/lib/list/elements/list.js +632 -0
  30. package/lib/list/helpers/renderer.d.ts +0 -1
  31. package/lib/list/helpers/renderer.js +1 -3
  32. package/lib/list/index.d.ts +3 -317
  33. package/lib/list/index.js +3 -641
  34. package/lib/list/themes/halo/dark/index.js +4 -1
  35. package/lib/list/themes/halo/light/index.js +4 -1
  36. package/lib/list/themes/solar/charcoal/index.js +4 -1
  37. package/lib/list/themes/solar/pearl/index.js +4 -1
  38. package/lib/overlay/managers/focus-manager.js +2 -2
  39. package/lib/radio-button/index.js +2 -2
  40. package/lib/tab-bar/index.d.ts +13 -8
  41. package/lib/tab-bar/index.js +26 -15
  42. package/lib/tab-bar/themes/halo/dark/index.js +1 -0
  43. package/lib/tab-bar/themes/halo/light/index.js +1 -0
  44. package/lib/tab-bar/themes/solar/charcoal/index.js +1 -0
  45. package/lib/tab-bar/themes/solar/pearl/index.js +1 -0
  46. package/lib/tree/elements/tree-item.d.ts +4 -0
  47. package/lib/tree/elements/tree-item.js +4 -0
  48. package/lib/tree/elements/tree.d.ts +1 -0
  49. package/lib/tree/elements/tree.js +1 -0
  50. package/lib/tree/helpers/renderer.d.ts +0 -1
  51. package/lib/tree/helpers/renderer.js +0 -2
  52. package/lib/tree/themes/halo/dark/index.js +1 -2
  53. package/lib/tree/themes/halo/light/index.js +1 -2
  54. package/lib/tree/themes/solar/charcoal/index.js +1 -2
  55. package/lib/tree/themes/solar/pearl/index.js +1 -2
  56. package/lib/version.js +1 -1
  57. package/package.json +16 -17
  58. package/lib/datetime-picker/locales.d.ts +0 -8
  59. package/lib/datetime-picker/locales.js +0 -57
package/CHANGELOG.md CHANGED
@@ -3,6 +3,59 @@
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.1.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.4...@refinitiv-ui/elements@6.1.0) (2022-08-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **datetime-picker:** parse invalid value to date object ([#422](https://github.com/Refinitiv/refinitiv-ui/issues/422)) ([dd86b73](https://github.com/Refinitiv/refinitiv-ui/commit/dd86b73fecd03518d2dae78174b91b0ef50fc913))
12
+ * **overlay:** Tab does not work with slotted elements ([16f4b60](https://github.com/Refinitiv/refinitiv-ui/commit/16f4b60e9b840d3b7d225f3d61f15e017dc17855))
13
+ * **radio-button:** check-changed is not fired on arrow keys ([77d7407](https://github.com/Refinitiv/refinitiv-ui/commit/77d7407883ba77e7b07bdaa8483fc49d35c76c14))
14
+
15
+
16
+ ### Features
17
+
18
+ * **interactive-chart:** add disabledLegend option to hide data legend ([#421](https://github.com/Refinitiv/refinitiv-ui/issues/421)) ([32a6d7b](https://github.com/Refinitiv/refinitiv-ui/commit/32a6d7b1889597a7ae804edbb08fc95fc5c5a04e))
19
+
20
+
21
+
22
+
23
+
24
+ ## [6.0.4](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.3...@refinitiv-ui/elements@6.0.4) (2022-08-02)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **calendar:** day cell selected style not work with disabled state ([#410](https://github.com/Refinitiv/refinitiv-ui/issues/410)) ([1d9c931](https://github.com/Refinitiv/refinitiv-ui/commit/1d9c931b4d625b93c6fd60b780060ff2f03d9fc9))
30
+ * **interactive-chart:** show dash text when legend hided ([#402](https://github.com/Refinitiv/refinitiv-ui/issues/402)) ([93631ca](https://github.com/Refinitiv/refinitiv-ui/commit/93631cac4db0623f05c333b53f67728ace953039))
31
+ * **tab-bar:** notify value change event on pressing an arrow key ([#398](https://github.com/Refinitiv/refinitiv-ui/issues/398)) ([e55d152](https://github.com/Refinitiv/refinitiv-ui/commit/e55d152491b97c8763dc628ef7d1c013e4c3f01a))
32
+
33
+
34
+
35
+
36
+
37
+ ## [6.0.3](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.2...@refinitiv-ui/elements@6.0.3) (2022-07-20)
38
+
39
+ **Note:** Version bump only for package @refinitiv-ui/elements
40
+
41
+
42
+
43
+
44
+
45
+ ## [6.0.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.1...@refinitiv-ui/elements@6.0.2) (2022-07-19)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * **accordion:** The element should interact only with its direct children ([#378](https://github.com/Refinitiv/refinitiv-ui/issues/378)) ([f8e11d3](https://github.com/Refinitiv/refinitiv-ui/commit/f8e11d391839cb1e53aad3ec2682a089766851ff))
51
+ * **list:** item should not receive focus when click ([#272](https://github.com/Refinitiv/refinitiv-ui/issues/272)) ([e2293e3](https://github.com/Refinitiv/refinitiv-ui/commit/e2293e37126a446d5c1d16be1e5eb503425534f3))
52
+ * **tab-bar:** resize callback is not fired when a new tab has been added ([#389](https://github.com/Refinitiv/refinitiv-ui/issues/389)) ([13408e1](https://github.com/Refinitiv/refinitiv-ui/commit/13408e15302a19cd614fdd5f1b4af9be5f1881bd))
53
+ * use `setAttribute` instead of `AriaMixins` for aria attributes ([#327](https://github.com/Refinitiv/refinitiv-ui/issues/327)) ([09f91fa](https://github.com/Refinitiv/refinitiv-ui/commit/09f91fafdef57fa26722ccf0e19f586833405cbb))
54
+
55
+
56
+
57
+
58
+
6
59
  ## [6.0.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.0...@refinitiv-ui/elements@6.0.1) (2022-06-20)
7
60
 
8
61
 
@@ -156,7 +156,7 @@ let Calendar = class Calendar extends ControlElement {
156
156
  [part~=cell-content]:not([tabindex]) {
157
157
  pointer-events: none;
158
158
  }
159
- [part~=selection] {
159
+ [part~=selectable] {
160
160
  cursor: pointer;
161
161
  }
162
162
  `;
@@ -307,7 +307,7 @@ let Calendar = class Calendar extends ControlElement {
307
307
  * @returns button HTML date button element or null
308
308
  */
309
309
  getDateButtonByIndex(index) {
310
- const elements = Array.from(this.renderRoot.querySelectorAll('[part~=cell] > [part~=selection]'));
310
+ const elements = Array.from(this.renderRoot.querySelectorAll('[part~=cell] > [part~=selectable]'));
311
311
  return elements.find((element) => this.isDateButton(element) && String(element.index) === String(index));
312
312
  }
313
313
  /**
@@ -315,7 +315,7 @@ let Calendar = class Calendar extends ControlElement {
315
315
  * @returns button HTML date button element or null
316
316
  */
317
317
  get activeDateButton() {
318
- return this.renderRoot.querySelector('[part~=cell][active] > [part~=selection]');
318
+ return this.renderRoot.querySelector('[part~=cell][active] > [part~=selectable]');
319
319
  }
320
320
  /**
321
321
  * Return true if passed target is HTML
@@ -1118,7 +1118,8 @@ let Calendar = class Calendar extends ControlElement {
1118
1118
  * @returns template result
1119
1119
  */
1120
1120
  renderCell(cell) {
1121
- const isSelectable = cell.value !== undefined && !cell.disabled;
1121
+ const isSelection = cell.value !== undefined;
1122
+ const isSelectable = isSelection && !cell.disabled;
1122
1123
  return html `<div
1123
1124
  role="gridcell"
1124
1125
  part="cell ${cell.view}"
@@ -1140,7 +1141,7 @@ let Calendar = class Calendar extends ControlElement {
1140
1141
  value: parse(cell.value),
1141
1142
  view: this.renderView
1142
1143
  }) : undefined)}"
1143
- part="cell-content${isSelectable ? ' selection' : ''}"
1144
+ part="cell-content${isSelection ? ' selection' : ''}${isSelectable ? ' selectable' : ''}"
1144
1145
  .value=${cell.value}
1145
1146
  .index=${cell.index}>${cell.text}</div>
1146
1147
  </div>`;
@@ -1,3 +1,3 @@
1
1
  import '@refinitiv-ui/elements/button/themes/halo/dark';
2
2
 
3
- elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#ccc;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#262626;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#262626}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#333}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#404040}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:active [part~=selection],:host [part~=cell][selected]:active [part~=selection],:host [part~=cell][today]:active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#999;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#1a1a1a}:host [part~=cell-content]{background:#0d0d0d;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #0d0d0d}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
3
+ elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#ccc;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#262626;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#262626}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#333}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#fff}:host [part~=cell][today] [part~=selection]{background:#404040}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#999;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#1a1a1a}:host [part~=cell-content]{background:#0d0d0d;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #0d0d0d}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
@@ -1,3 +1,3 @@
1
1
  import '@refinitiv-ui/elements/button/themes/halo/light';
2
2
 
3
- elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#0d0d0d;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#f2f2f2;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-next]:not(:hover):not(:focus):not(:active),:host [part=btn-prev]:not(:hover):not(:focus):not(:active){color:#595959}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#e6e6e6}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#e6e6e6}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#0d0d0d}:host [part~=cell][today] [part~=selection]{background:#d9d9d9}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:active [part~=selection],:host [part~=cell][selected]:active [part~=selection],:host [part~=cell][today]:active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#737373;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#fafafa}:host [part~=cell-content]{background:#fff;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #fff}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
3
+ elf.customStyles.define('ef-calendar', ':host{font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-indent:0;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;outline:0;font-size:12rem;color:#0d0d0d;min-width:196px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#f2f2f2;padding:4px 3px}:host [part=navigation]{padding-bottom:3px}:host [part=btn-next],:host [part=btn-prev],:host [part=btn-view]{margin:0}:host [part=btn-next]:not(:hover):not(:focus):not(:active),:host [part=btn-prev]:not(:hover):not(:focus):not(:active){color:#595959}:host [part=btn-view]{background:0 0;margin-left:16px;border:none;color:inherit;padding:0}:host [part=btn-view]:hover,:host [part=btn-view][focused=visible]{opacity:.8}:host [part=table]{width:100%;background:#e6e6e6}:host [part~=row]:not(:first-of-type) [part~=cell] [part~=cell-content]{top:1px}:host [part~=day-name-row]{background-color:#e6e6e6}:host [part~=cell][disabled]{opacity:.4}:host [part~=cell][today]{color:#0d0d0d}:host [part~=cell][today] [part~=selection]{background:#d9d9d9}:host [part~=cell]:not([selected]):not([range]):not([disabled])[idle] [part~=selection]{opacity:.6}:host [part~=cell]:not([today]):not([range]) [part~=selection]:hover{color:#fff}:host [part~=cell]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([today]):not([range]):not(:active) [part~=selection]:hover,:host [part~=cell][today][selected] [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]) [part~=selection]:hover{background:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell]:not([selected]):not([range]):not([today]):not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range]:not(:active) [part~=selection]:hover,:host [part~=cell][selected]:not(:active) [part~=selection]:hover,:host [part~=cell][today]:not(:active) [part~=selection]:hover{border-color:#1429bd}:host [part~=cell][range]:not([disabled]):active [part~=selection],:host [part~=cell][selected]:not([disabled]):active [part~=selection],:host [part~=cell][today]:not([disabled]):active [part~=selection]{color:#fff;background-color:#0f1e8a}:host [part~=cell][range] [part~=selection]{background:rgba(51,75,255,.2)}:host [part~=cell][range][today]{color:#fff}:host [part~=cell][selected]{color:#fff}:host [part~=cell][selected] [part~=selection]{background:#334bff}:host [part~=cell]:not(:first-of-type) [part~=cell-content]{left:1px}:host [part~=day-name]{color:#737373;font-weight:600}:host [part~=day-name] [part~=cell-content]{background-color:#fafafa}:host [part~=cell-content]{background:#fff;top:0;bottom:0;right:0;left:0}:host [part~=selection]{outline:0;border:1px solid #fff}:host([focused=visible]) [part~=cell] [part~=selection]:focus{outline:#1429bd solid 1px}:host([disabled]){opacity:.4}');
@@ -505,6 +505,7 @@ export declare class ComboBox<T extends DataItem = ItemData> extends FormFieldEl
505
505
  protected get selectionBadgeTemplate(): TemplateResult | undefined;
506
506
  /**
507
507
  * Returns a list template
508
+ * TODO: Remove empty `tabindex`. We need better flexibility on removing tabindex value from ControlElement
508
509
  */
509
510
  protected get listTemplate(): TemplateResult;
510
511
  /**
@@ -1044,12 +1044,13 @@ let ComboBox = class ComboBox extends FormFieldElement {
1044
1044
  }
1045
1045
  /**
1046
1046
  * Returns a list template
1047
+ * TODO: Remove empty `tabindex`. We need better flexibility on removing tabindex value from ControlElement
1047
1048
  */
1048
1049
  get listTemplate() {
1049
1050
  return html `
1050
1051
  <ef-list
1051
1052
  id="internal-list"
1052
- tabindex="-1"
1053
+ tabindex
1053
1054
  @value-changed="${this.onListValueChanged}"
1054
1055
  .data="${this.composer}"
1055
1056
  .multiple="${this.multiple}"
@@ -1063,7 +1064,7 @@ let ComboBox = class ComboBox extends FormFieldElement {
1063
1064
  */
1064
1065
  get noItemsTemplate() {
1065
1066
  if (!this.freeText) {
1066
- return html `<ef-item disabled>${this.t('NO_OPTIONS')}</ef-item>`;
1067
+ return html `<ef-list-item disabled>${this.t('NO_OPTIONS')}</ef-list-item>`;
1067
1068
  }
1068
1069
  }
1069
1070
  /**
@@ -1187,7 +1188,7 @@ __decorate([
1187
1188
  query('#clears-button')
1188
1189
  ], ComboBox.prototype, "clearsButtonEl", void 0);
1189
1190
  __decorate([
1190
- property({ type: String, reflect: true })
1191
+ property({ type: Boolean, reflect: true })
1191
1192
  ], ComboBox.prototype, "loading", void 0);
1192
1193
  __decorate([
1193
1194
  translate({ scope: 'ef-combo-box' })
@@ -140,6 +140,10 @@
140
140
  "name": "formatOptions",
141
141
  "description": "Set the datetime format options based on\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat\n`formatOptions` overrides `timepicker` and `showSeconds` properties.\nNote: time-zone is not supported"
142
142
  },
143
+ {
144
+ "name": "locale",
145
+ "description": "Set the Locale object.\n`Locale` overrides `formatOptions`, `timepicker` and `showSeconds` properties."
146
+ },
143
147
  {
144
148
  "name": "value",
145
149
  "attribute": "value",
@@ -20,6 +20,7 @@ A form control element for datetime input.
20
20
  | `formatOptions` | | | null | Set the datetime format options based on<br />https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat<br />`formatOptions` overrides `timepicker` and `showSeconds` properties.<br />Note: time-zone is not supported |
21
21
  | `icon` | `icon` | `string \| null` | null | Specify icon to display in input. Value can be icon name |
22
22
  | `iconHasAction` | `icon-has-action` | `boolean` | false | Specify when icon need to be clickable |
23
+ | `locale` | | | null | Set the Locale object.<br />`Locale` overrides `formatOptions`, `timepicker` and `showSeconds` properties. |
23
24
  | `max` | `max` | `string \| null` | null | Set maximum date.<br />This value must follow the `format` and be greater<br />than or equal to the value of the `min` attribute |
24
25
  | `maxLength` | | `number \| null` | null | Set character max limit |
25
26
  | `min` | `min` | `string \| null` | null | Set minimum date.<br />This value must follow the `format` and be less<br />than or equal to the value of the `max` attribute |
@@ -68,50 +68,34 @@ export declare class DatetimeField extends TextField {
68
68
  * than or equal to the value of the `min` attribute
69
69
  */
70
70
  max: string | null;
71
- private _timepicker;
72
71
  /**
73
72
  * Toggle to display the time picker
74
- * @param timepicker true to set timepicker mode
75
- * @default false
76
73
  */
77
- set timepicker(timepicker: boolean);
78
- get timepicker(): boolean;
79
- private _showSeconds;
74
+ timepicker: boolean;
80
75
  /**
81
76
  * Toggle to display the seconds
82
- * @param showSeconds true to show seconds
83
- * @default false
84
77
  */
85
- set showSeconds(showSeconds: boolean);
86
- get showSeconds(): boolean;
87
- private _amPm;
78
+ showSeconds: boolean;
88
79
  /**
89
80
  * Overrides 12hr time display format
90
- * @param amPm true to show 12hr time format
91
- * @default false
92
81
  */
93
- set amPm(amPm: boolean);
94
- get amPm(): boolean;
95
- private _formatOptions;
82
+ amPm: boolean;
96
83
  /**
97
84
  * Set the datetime format options based on
98
85
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
99
86
  * `formatOptions` overrides `timepicker` and `showSeconds` properties.
100
87
  * Note: time-zone is not supported
101
- * @param formatOptions Format options
102
- * @default - null
103
88
  */
104
- set formatOptions(formatOptions: Intl.DateTimeFormatOptions | null);
105
- get formatOptions(): Intl.DateTimeFormatOptions | null;
89
+ formatOptions: Intl.DateTimeFormatOptions | null;
106
90
  /**
107
- * Used for translations
91
+ * Set the Locale object.
92
+ * `Locale` overrides `formatOptions`, `timepicker` and `showSeconds` properties.
108
93
  */
109
- protected t: TranslateDirective;
94
+ locale: Locale | null;
110
95
  /**
111
- * Format, which is based on locale
96
+ * Used for translations
112
97
  */
113
- private _locale;
114
- protected get locale(): Locale;
98
+ protected t: TranslateDirective;
115
99
  private interimValueState;
116
100
  /**
117
101
  * Current date time value
@@ -142,27 +126,16 @@ export declare class DatetimeField extends TextField {
142
126
  * Currently selected part
143
127
  */
144
128
  protected partLabel: string;
129
+ /**
130
+ * Get resolved locale for current element
131
+ */
132
+ protected get resolvedLocale(): Locale;
145
133
  /**
146
134
  * Transform Date object to date string
147
135
  * @param value Date
148
136
  * @returns dateSting
149
137
  */
150
138
  protected dateToString(value: Date): string;
151
- /**
152
- * Returns true if the datetime field has timepicker
153
- * @returns hasTimePicker
154
- */
155
- protected get hasTimePicker(): boolean;
156
- /**
157
- * Returns true if the datetime field has seconds
158
- * @returns hasSeconds
159
- */
160
- protected get hasSeconds(): boolean;
161
- /**
162
- * Returns true if the datetime field has am-pm
163
- * @returns hasAmPm
164
- */
165
- protected get hasAmPm(): boolean;
166
139
  /**
167
140
  * Get today's date noon as the start date when the value is not set
168
141
  */
@@ -211,11 +184,6 @@ export declare class DatetimeField extends TextField {
211
184
  * @returns {void}
212
185
  */
213
186
  protected warnInvalidValue(value: string): void;
214
- /**
215
- * Resolve locale based on element parameters
216
- * @returns locale Resolved locale
217
- */
218
- protected resolveLocale(): Locale;
219
187
  /**
220
188
  * Get Intl.DateTimeFormat object from locale
221
189
  */
@@ -4,9 +4,10 @@ import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
4
4
  import { property } from '@refinitiv-ui/core/decorators/property.js';
5
5
  import { state } from '@refinitiv-ui/core/decorators/state.js';
6
6
  import { AnimationTaskRunner } from '@refinitiv-ui/utils/async.js';
7
- import { utcParse, utcFormat, getFormat, isBefore, isAfter, iterateUnit, Locale } from '@refinitiv-ui/utils/date.js';
8
- import { translate, getLocale, TranslatePropertyKey } from '@refinitiv-ui/translate';
7
+ import { utcParse, utcFormat, getFormat, isBefore, isAfter, iterateUnit } from '@refinitiv-ui/utils/date.js';
8
+ import { translate, TranslatePropertyKey } from '@refinitiv-ui/translate';
9
9
  import { Direction } from './constants.js';
10
+ import { resolvedLocale } from './resolvedLocale.js';
10
11
  import { TextField } from '../text-field/index.js';
11
12
  import { getSelectedPartIndex, getNextSelectedPartIndex, selectPart } from './utils.js';
12
13
  import { VERSION } from '../version.js';
@@ -70,14 +71,30 @@ let DatetimeField = class DatetimeField extends TextField {
70
71
  * than or equal to the value of the `min` attribute
71
72
  */
72
73
  this.max = null;
73
- this._timepicker = false;
74
- this._showSeconds = false;
75
- this._amPm = false;
76
- this._formatOptions = null;
77
74
  /**
78
- * Format, which is based on locale
75
+ * Toggle to display the time picker
79
76
  */
80
- this._locale = null;
77
+ this.timepicker = false;
78
+ /**
79
+ * Toggle to display the seconds
80
+ */
81
+ this.showSeconds = false;
82
+ /**
83
+ * Overrides 12hr time display format
84
+ */
85
+ this.amPm = false;
86
+ /**
87
+ * Set the datetime format options based on
88
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
89
+ * `formatOptions` overrides `timepicker` and `showSeconds` properties.
90
+ * Note: time-zone is not supported
91
+ */
92
+ this.formatOptions = null;
93
+ /**
94
+ * Set the Locale object.
95
+ * `Locale` overrides `formatOptions`, `timepicker` and `showSeconds` properties.
96
+ */
97
+ this.locale = null;
81
98
  this.interimValueState = false; // make sure that internal input field value is updated only on external value change
82
99
  /**
83
100
  * Currently selected part
@@ -91,79 +108,6 @@ let DatetimeField = class DatetimeField extends TextField {
91
108
  static get version() {
92
109
  return VERSION;
93
110
  }
94
- /**
95
- * Toggle to display the time picker
96
- * @param timepicker true to set timepicker mode
97
- * @default false
98
- */
99
- set timepicker(timepicker) {
100
- const oldTimepicker = this._timepicker;
101
- if (timepicker !== oldTimepicker) {
102
- this._timepicker = timepicker;
103
- this._locale = null;
104
- this.requestUpdate('timepicker', oldTimepicker);
105
- }
106
- }
107
- get timepicker() {
108
- return this._timepicker;
109
- }
110
- /**
111
- * Toggle to display the seconds
112
- * @param showSeconds true to show seconds
113
- * @default false
114
- */
115
- set showSeconds(showSeconds) {
116
- const oldShowSeconds = this._showSeconds;
117
- if (oldShowSeconds !== showSeconds) {
118
- this._showSeconds = showSeconds;
119
- this._locale = null;
120
- this.requestUpdate('showSeconds', oldShowSeconds);
121
- }
122
- }
123
- get showSeconds() {
124
- return this._showSeconds;
125
- }
126
- /**
127
- * Overrides 12hr time display format
128
- * @param amPm true to show 12hr time format
129
- * @default false
130
- */
131
- set amPm(amPm) {
132
- const oldAmPm = this._amPm;
133
- if (oldAmPm !== amPm) {
134
- this._amPm = amPm;
135
- this._locale = null;
136
- this.requestUpdate('amPm', oldAmPm);
137
- }
138
- }
139
- get amPm() {
140
- return this._amPm;
141
- }
142
- /**
143
- * Set the datetime format options based on
144
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
145
- * `formatOptions` overrides `timepicker` and `showSeconds` properties.
146
- * Note: time-zone is not supported
147
- * @param formatOptions Format options
148
- * @default - null
149
- */
150
- set formatOptions(formatOptions) {
151
- const oldFormatOptions = this._formatOptions;
152
- if (oldFormatOptions !== formatOptions) {
153
- this._formatOptions = formatOptions;
154
- this._locale = null;
155
- this.requestUpdate('formatOptions', oldFormatOptions);
156
- }
157
- }
158
- get formatOptions() {
159
- return this._formatOptions;
160
- }
161
- get locale() {
162
- if (!this._locale) {
163
- this._locale = this.resolveLocale();
164
- }
165
- return this._locale;
166
- }
167
111
  /**
168
112
  * Current date time value
169
113
  * @param value Calendar value
@@ -207,35 +151,19 @@ let DatetimeField = class DatetimeField extends TextField {
207
151
  set valueAsDate(value) {
208
152
  this.value = value ? this.dateToString(value) : '';
209
153
  }
154
+ /**
155
+ * Get resolved locale for current element
156
+ */
157
+ get resolvedLocale() {
158
+ return resolvedLocale(this);
159
+ }
210
160
  /**
211
161
  * Transform Date object to date string
212
162
  * @param value Date
213
163
  * @returns dateSting
214
164
  */
215
165
  dateToString(value) {
216
- return isNaN(value.getTime()) ? '' : utcFormat(value, this.locale.isoFormat);
217
- }
218
- /**
219
- * Returns true if the datetime field has timepicker
220
- * @returns hasTimePicker
221
- */
222
- get hasTimePicker() {
223
- // need to check for attribute to resolve the value correctly until the first lifecycle is run
224
- return this.timepicker || this.hasAttribute('timepicker') || this.hasAmPm || this.hasSeconds;
225
- }
226
- /**
227
- * Returns true if the datetime field has seconds
228
- * @returns hasSeconds
229
- */
230
- get hasSeconds() {
231
- return this.showSeconds || this.hasAttribute('show-seconds');
232
- }
233
- /**
234
- * Returns true if the datetime field has am-pm
235
- * @returns hasAmPm
236
- */
237
- get hasAmPm() {
238
- return this.amPm || this.hasAttribute('am-pm');
166
+ return isNaN(value.getTime()) ? '' : utcFormat(value, this.resolvedLocale.isoFormat);
239
167
  }
240
168
  /**
241
169
  * Get today's date noon as the start date when the value is not set
@@ -257,9 +185,6 @@ let DatetimeField = class DatetimeField extends TextField {
257
185
  */
258
186
  willUpdate(changedProperties) {
259
187
  super.willUpdate(changedProperties);
260
- if (changedProperties.has(TranslatePropertyKey)) {
261
- this._locale = null; // Locale is updated on next call via getter
262
- }
263
188
  if (changedProperties.has(FocusedPropertyKey) && !this.focused) {
264
189
  this.partLabel = '';
265
190
  }
@@ -278,6 +203,7 @@ let DatetimeField = class DatetimeField extends TextField {
278
203
  || changedProperties.has('timepicker')
279
204
  || changedProperties.has('showSeconds')
280
205
  || changedProperties.has('amPm')
206
+ || changedProperties.has('locale')
281
207
  || (changedProperties.has(FocusedPropertyKey) && this.value !== '' && !this.focused);
282
208
  }
283
209
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -315,7 +241,7 @@ let DatetimeField = class DatetimeField extends TextField {
315
241
  return true;
316
242
  }
317
243
  // value format depends on locale.
318
- return getFormat(value) === this.locale.isoFormat;
244
+ return getFormat(value) === this.resolvedLocale.isoFormat;
319
245
  }
320
246
  /**
321
247
  * Used to show a warning when the value does not pass the validation
@@ -323,30 +249,13 @@ let DatetimeField = class DatetimeField extends TextField {
323
249
  * @returns {void}
324
250
  */
325
251
  warnInvalidValue(value) {
326
- new WarningNotice(`${this.localName}: the specified value "${value}" does not conform to the required format. The format is '${this.locale.isoFormat}'.`).show();
327
- }
328
- /**
329
- * Resolve locale based on element parameters
330
- * @returns locale Resolved locale
331
- */
332
- resolveLocale() {
333
- const hasTimePicker = this.hasTimePicker;
334
- // TODO: Do not use dateStyle and timeStyle as these are supported only in modern browsers
335
- return Locale.fromOptions(this.formatOptions || {
336
- year: 'numeric',
337
- month: 'short',
338
- day: 'numeric',
339
- hour: hasTimePicker ? 'numeric' : undefined,
340
- minute: hasTimePicker ? 'numeric' : undefined,
341
- second: this.hasSeconds ? 'numeric' : undefined,
342
- hour12: this.hasAmPm ? true : undefined // force am-pm if provided, otherwise rely on locale
343
- }, `${getLocale(this)}`);
252
+ new WarningNotice(`${this.localName}: the specified value "${value}" does not conform to the required format. The format is '${this.resolvedLocale.isoFormat}'.`).show();
344
253
  }
345
254
  /**
346
255
  * Get Intl.DateTimeFormat object from locale
347
256
  */
348
257
  get formatter() {
349
- return this.locale.formatter;
258
+ return this.resolvedLocale.formatter;
350
259
  }
351
260
  /**
352
261
  * Try to format ISO date/time/datetime string into datetime format parts
@@ -374,7 +283,7 @@ let DatetimeField = class DatetimeField extends TextField {
374
283
  toValue(inputValue) {
375
284
  let value = '';
376
285
  try {
377
- value = inputValue ? this.locale.parse(inputValue, this.value || this.startDate) : '';
286
+ value = inputValue ? this.resolvedLocale.parse(inputValue, this.value || this.startDate) : '';
378
287
  }
379
288
  catch (error) {
380
289
  // do nothing
@@ -635,16 +544,19 @@ __decorate([
635
544
  ], DatetimeField.prototype, "max", void 0);
636
545
  __decorate([
637
546
  property({ type: Boolean, reflect: true })
638
- ], DatetimeField.prototype, "timepicker", null);
547
+ ], DatetimeField.prototype, "timepicker", void 0);
639
548
  __decorate([
640
549
  property({ type: Boolean, attribute: 'show-seconds', reflect: true })
641
- ], DatetimeField.prototype, "showSeconds", null);
550
+ ], DatetimeField.prototype, "showSeconds", void 0);
642
551
  __decorate([
643
552
  property({ type: Boolean, attribute: 'am-pm', reflect: true })
644
- ], DatetimeField.prototype, "amPm", null);
553
+ ], DatetimeField.prototype, "amPm", void 0);
554
+ __decorate([
555
+ property({ attribute: false })
556
+ ], DatetimeField.prototype, "formatOptions", void 0);
645
557
  __decorate([
646
558
  property({ attribute: false })
647
- ], DatetimeField.prototype, "formatOptions", null);
559
+ ], DatetimeField.prototype, "locale", void 0);
648
560
  __decorate([
649
561
  translate({ mode: 'directive', scope: 'ef-datetime-field' })
650
562
  ], DatetimeField.prototype, "t", void 0);
@@ -0,0 +1,19 @@
1
+ import { Locale } from '@refinitiv-ui/utils/date.js';
2
+ /**
3
+ * Used for date elements to construct Locale object
4
+ */
5
+ declare type LocaleDateElement = HTMLElement & {
6
+ formatOptions?: Intl.DateTimeFormatOptions | null;
7
+ amPm?: boolean;
8
+ showSeconds?: boolean;
9
+ timepicker?: boolean;
10
+ locale?: Locale | null;
11
+ };
12
+ /**
13
+ * Resolve locale based on element parameters
14
+ * @param element Locale Date element
15
+ * @param [options] Override options if resolved from element
16
+ * @returns locale Resolved Locale object
17
+ */
18
+ declare const resolvedLocale: (element: LocaleDateElement, options?: Intl.DateTimeFormatOptions) => Locale;
19
+ export { LocaleDateElement, resolvedLocale };