@refinitiv-ui/elements 7.5.0 → 7.6.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 (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/calendar/constants.d.ts +1 -1
  3. package/lib/calendar/constants.js +7 -6
  4. package/lib/calendar/custom-elements.json +4 -0
  5. package/lib/calendar/custom-elements.md +5 -4
  6. package/lib/calendar/index.d.ts +13 -3
  7. package/lib/calendar/index.js +52 -29
  8. package/lib/calendar/types.d.ts +21 -2
  9. package/lib/calendar/utils.d.ts +9 -1
  10. package/lib/calendar/utils.js +24 -1
  11. package/lib/email-field/custom-elements.json +12 -0
  12. package/lib/email-field/custom-elements.md +7 -0
  13. package/lib/email-field/index.d.ts +10 -0
  14. package/lib/email-field/index.js +14 -0
  15. package/lib/interactive-chart/index.js +1 -0
  16. package/lib/list/elements/list.js +8 -0
  17. package/lib/number-field/custom-elements.json +6 -4
  18. package/lib/number-field/custom-elements.md +6 -6
  19. package/lib/number-field/index.d.ts +7 -2
  20. package/lib/number-field/index.js +18 -9
  21. package/lib/password-field/custom-elements.json +12 -0
  22. package/lib/password-field/custom-elements.md +7 -0
  23. package/lib/password-field/index.d.ts +10 -0
  24. package/lib/password-field/index.js +14 -0
  25. package/lib/search-field/custom-elements.json +12 -0
  26. package/lib/search-field/custom-elements.md +7 -0
  27. package/lib/search-field/index.d.ts +10 -0
  28. package/lib/search-field/index.js +14 -0
  29. package/lib/text-field/custom-elements.json +12 -0
  30. package/lib/text-field/custom-elements.md +7 -0
  31. package/lib/text-field/index.d.ts +10 -0
  32. package/lib/text-field/index.js +14 -0
  33. package/lib/tree/elements/tree.js +4 -0
  34. package/lib/tree-select/index.js +1 -2
  35. package/lib/version.js +1 -1
  36. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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
+ ## [7.6.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.6.0...@refinitiv-ui/elements@7.6.1) (2023-10-02)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **list, tree:** stateless list and tree should have `aria-readonly`="true" ([#971](https://github.com/Refinitiv/refinitiv-ui/issues/971)) ([6856c0f](https://github.com/Refinitiv/refinitiv-ui/commit/6856c0fdff5e7165f8c07e99865ebfdc7f190558))
11
+ - **tree:** parent label can't expand/collapse in stateless mode ([#967](https://github.com/Refinitiv/refinitiv-ui/issues/967)) ([74f9877](https://github.com/Refinitiv/refinitiv-ui/commit/74f9877b8643e49059f4e35a141b4a892f17cd86))
12
+
13
+ # [7.6.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.5.0...@refinitiv-ui/elements@7.6.0) (2023-09-25)
14
+
15
+ ### Bug Fixes
16
+
17
+ - **interactive-chart:** invalid legend render when add new seriesList ([#954](https://github.com/Refinitiv/refinitiv-ui/issues/954)) ([f8706b6](https://github.com/Refinitiv/refinitiv-ui/commit/f8706b6da7ad5c49b6abbadce853c339bd5a77b8))
18
+ - **tree-select:** show invalid values when click on cancel button on selected view ([#964](https://github.com/Refinitiv/refinitiv-ui/issues/964)) ([49302bc](https://github.com/Refinitiv/refinitiv-ui/commit/49302bc1af0edec984e77083cdcdb31ba068c0c8))
19
+
20
+ ### Features
21
+
22
+ - **calendar:** introduce before-cell-render event ([#926](https://github.com/Refinitiv/refinitiv-ui/issues/926)) ([ff2164f](https://github.com/Refinitiv/refinitiv-ui/commit/ff2164f5794d874064f167c363a476fe7a3836e1))
23
+
6
24
  # [7.5.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.4.0...@refinitiv-ui/elements@7.5.0) (2023-09-18)
7
25
 
8
26
  ### Bug Fixes
@@ -1,4 +1,4 @@
1
- export declare enum RenderView {
1
+ export declare enum CalendarRenderView {
2
2
  DAY = "day",
3
3
  MONTH = "month",
4
4
  YEAR = "year"
@@ -1,10 +1,11 @@
1
1
  import { uuid } from '@refinitiv-ui/utils/uuid.js';
2
- export var RenderView;
3
- (function (RenderView) {
4
- RenderView["DAY"] = "day";
5
- RenderView["MONTH"] = "month";
6
- RenderView["YEAR"] = "year";
7
- })(RenderView || (RenderView = {}));
2
+ // public API
3
+ export var CalendarRenderView;
4
+ (function (CalendarRenderView) {
5
+ CalendarRenderView["DAY"] = "day";
6
+ CalendarRenderView["MONTH"] = "month";
7
+ CalendarRenderView["YEAR"] = "year";
8
+ })(CalendarRenderView || (CalendarRenderView = {}));
8
9
  export const FIRST_DAY_OF_WEEK = 0; // 0 for Sunday
9
10
  export const YEARS_PER_YEAR_VIEW = 16; /* must be a square number */
10
11
  export const DAY_VIEW = {
@@ -181,6 +181,10 @@
181
181
  }
182
182
  ],
183
183
  "events": [
184
+ {
185
+ "name": "before-cell-render",
186
+ "description": "Fired before calendar renders each cell along with `cell` model."
187
+ },
184
188
  {
185
189
  "name": "value-changed",
186
190
  "description": "Fired when the user commits a date change. The event is not triggered if `value` is changed programmatically."
@@ -23,10 +23,11 @@ Standard calendar element
23
23
 
24
24
  ## Events
25
25
 
26
- | Event | Description |
27
- |-----------------|--------------------------------------------------|
28
- | `value-changed` | Fired when the user commits a date change. The event is not triggered if `value` is changed programmatically. |
29
- | `view-changed` | Fired when the user changes a view of calendar e.g. changed to next month page. The event is not triggered if `view` property is changed programmatically. |
26
+ | Event | Description |
27
+ |----------------------|--------------------------------------------------|
28
+ | `before-cell-render` | Fired before calendar renders each cell along with `cell` model. |
29
+ | `value-changed` | Fired when the user commits a date change. The event is not triggered if `value` is changed programmatically. |
30
+ | `view-changed` | Fired when the user changes a view of calendar e.g. changed to next month page. The event is not triggered if `view` property is changed programmatically. |
30
31
 
31
32
  ## Slots
32
33
 
@@ -3,12 +3,16 @@ import { CSSResultGroup, ControlElement, MultiValue, PropertyValues, TemplateRes
3
3
  import '@refinitiv-ui/phrasebook/locale/en/calendar.js';
4
4
  import { TranslateDirective, TranslatePromise } from '@refinitiv-ui/translate';
5
5
  import '../button/index.js';
6
+ import { CalendarRenderView } from './constants.js';
6
7
  import './locales.js';
7
- import type { CalendarFilter } from './types';
8
- export { CalendarFilter };
8
+ import type { BeforeCellRenderEvent, CalendarFilter } from './types';
9
+ export { CalendarRenderView };
10
+ export type { CalendarCell } from './types';
11
+ export type { CalendarFilter, BeforeCellRenderEvent };
9
12
  /**
10
13
  * Standard calendar element
11
14
  *
15
+ * @fires before-cell-render - Fired before calendar renders each cell along with `cell` model.
12
16
  * @fires value-changed - Fired when the user commits a date change. The event is not triggered if `value` is changed programmatically.
13
17
  * @fires view-changed - Fired when the user changes a view of calendar e.g. changed to next month page. The event is not triggered if `view` property is changed programmatically.
14
18
  *
@@ -381,9 +385,15 @@ export declare class Calendar extends ControlElement implements MultiValue {
381
385
  * @returns key Translate label key
382
386
  */
383
387
  private getCellLabelKey;
388
+ /**
389
+ * fire 'before-cell-render' event
390
+ * @param cell Cell
391
+ * @returns {void}
392
+ */
393
+ private dispatchBeforeCellRender;
384
394
  /**
385
395
  * Render cell template. Cell can be a day, month or year
386
- * @param cell Cell object
396
+ * @param cell Cell
387
397
  * @returns template result
388
398
  */
389
399
  private renderCell;
@@ -12,12 +12,14 @@ import { DateFormat, addMonths, format, isAfter, isBefore, isSameDay, isSameMont
12
12
  import { down, first, last, left, right, up } from '@refinitiv-ui/utils/navigation.js';
13
13
  import '../button/index.js';
14
14
  import { VERSION } from '../version.js';
15
- import { CalendarLocaleScope, DAY_VIEW, FIRST_DAY_OF_WEEK, MONTH_VIEW, RenderView, YEARS_PER_YEAR_VIEW, YEAR_VIEW } from './constants.js';
15
+ import { CalendarLocaleScope, CalendarRenderView, DAY_VIEW, FIRST_DAY_OF_WEEK, MONTH_VIEW, YEARS_PER_YEAR_VIEW, YEAR_VIEW } from './constants.js';
16
16
  import './locales.js';
17
- import { ViewFormatTranslateParams, monthInfo, monthsNames, weekdaysNames } from './utils.js';
17
+ import { ViewFormatTranslateParams, monthInfo, monthsNames, toCalendarCell, weekdaysNames } from './utils.js';
18
+ export { CalendarRenderView };
18
19
  /**
19
20
  * Standard calendar element
20
21
  *
22
+ * @fires before-cell-render - Fired before calendar renders each cell along with `cell` model.
21
23
  * @fires value-changed - Fired when the user commits a date change. The event is not triggered if `value` is changed programmatically.
22
24
  * @fires view-changed - Fired when the user changes a view of calendar e.g. changed to next month page. The event is not triggered if `view` property is changed programmatically.
23
25
  *
@@ -72,7 +74,7 @@ let Calendar = class Calendar extends ControlElement {
72
74
  /**
73
75
  * Used for internal navigation between render views
74
76
  */
75
- this._renderView = RenderView.DAY;
77
+ this._renderView = CalendarRenderView.DAY;
76
78
  /**
77
79
  * Used for keyboard navigation when trying
78
80
  * to restore focus on re-render and control navigation
@@ -578,7 +580,8 @@ let Calendar = class Calendar extends ControlElement {
578
580
  */
579
581
  onRenderViewTap(event) {
580
582
  if (!event.defaultPrevented) {
581
- this.renderView = this.renderView === RenderView.DAY ? RenderView.YEAR : RenderView.DAY;
583
+ this.renderView =
584
+ this.renderView === CalendarRenderView.DAY ? CalendarRenderView.YEAR : CalendarRenderView.DAY;
582
585
  }
583
586
  }
584
587
  /**
@@ -592,8 +595,8 @@ let Calendar = class Calendar extends ControlElement {
592
595
  }
593
596
  switch (event.key) {
594
597
  case 'Escape':
595
- if (this.renderView === RenderView.YEAR || this.renderView === RenderView.MONTH) {
596
- this.renderView = RenderView.DAY;
598
+ if (this.renderView === CalendarRenderView.YEAR || this.renderView === CalendarRenderView.MONTH) {
599
+ this.renderView = CalendarRenderView.DAY;
597
600
  break;
598
601
  }
599
602
  return;
@@ -656,20 +659,20 @@ let Calendar = class Calendar extends ControlElement {
656
659
  this.activeCellIndex = cell.index;
657
660
  const cellSegment = toDateSegment(cell.value);
658
661
  const viewSegment = toDateSegment(this.view);
659
- if (this.renderView === RenderView.YEAR) {
662
+ if (this.renderView === CalendarRenderView.YEAR) {
660
663
  /* YEAR -> MONTH */
661
664
  viewSegment.year = cellSegment.year;
662
665
  if (this.notifyViewChange(viewSegment)) {
663
- this.renderView = RenderView.MONTH;
666
+ this.renderView = CalendarRenderView.MONTH;
664
667
  }
665
668
  return;
666
669
  }
667
- if (this.renderView === RenderView.MONTH) {
670
+ if (this.renderView === CalendarRenderView.MONTH) {
668
671
  /* MONTH -> DAY */
669
672
  viewSegment.year = cellSegment.year;
670
673
  viewSegment.month = cellSegment.month;
671
674
  if (this.notifyViewChange(viewSegment)) {
672
- this.renderView = RenderView.DAY;
675
+ this.renderView = CalendarRenderView.DAY;
673
676
  }
674
677
  return;
675
678
  }
@@ -753,13 +756,13 @@ let Calendar = class Calendar extends ControlElement {
753
756
  toNextView() {
754
757
  let viewSegment = toDateSegment(this.view);
755
758
  switch (this.renderView) {
756
- case RenderView.DAY:
759
+ case CalendarRenderView.DAY:
757
760
  viewSegment = toDateSegment(addMonths(this.view, 1));
758
761
  break;
759
- case RenderView.MONTH:
762
+ case CalendarRenderView.MONTH:
760
763
  viewSegment.year += 1;
761
764
  break;
762
- case RenderView.YEAR:
765
+ case CalendarRenderView.YEAR:
763
766
  viewSegment.year += YEARS_PER_YEAR_VIEW;
764
767
  break;
765
768
  // no default
@@ -773,13 +776,13 @@ let Calendar = class Calendar extends ControlElement {
773
776
  toPreviousView() {
774
777
  let viewSegment = toDateSegment(this.view);
775
778
  switch (this.renderView) {
776
- case RenderView.DAY:
779
+ case CalendarRenderView.DAY:
777
780
  viewSegment = toDateSegment(subMonths(this.view, 1));
778
781
  break;
779
- case RenderView.MONTH:
782
+ case CalendarRenderView.MONTH:
780
783
  viewSegment.year -= 1;
781
784
  break;
782
- case RenderView.YEAR:
785
+ case CalendarRenderView.YEAR:
783
786
  viewSegment.year -= YEARS_PER_YEAR_VIEW;
784
787
  break;
785
788
  // no default
@@ -874,9 +877,9 @@ let Calendar = class Calendar extends ControlElement {
874
877
  get formattedViewRender() {
875
878
  const segment = toDateSegment(this.view);
876
879
  switch (this.renderView) {
877
- case RenderView.MONTH:
880
+ case CalendarRenderView.MONTH:
878
881
  return this.viewFormattedDate(segment);
879
- case RenderView.YEAR:
882
+ case CalendarRenderView.YEAR:
880
883
  const month = segment.month;
881
884
  const day = segment.day;
882
885
  const fromYear = Math.floor(segment.year / YEARS_PER_YEAR_VIEW) * YEARS_PER_YEAR_VIEW;
@@ -884,7 +887,7 @@ let Calendar = class Calendar extends ControlElement {
884
887
  const fromView = this.viewFormattedDate({ year: fromYear, month, day });
885
888
  const toView = this.viewFormattedDate({ year: toYear, month, day });
886
889
  return html `${fromView} - ${toView}`;
887
- case RenderView.DAY:
890
+ case CalendarRenderView.DAY:
888
891
  default:
889
892
  return this.viewFormattedDate(segment, true);
890
893
  }
@@ -938,7 +941,7 @@ let Calendar = class Calendar extends ControlElement {
938
941
  * Get year view template
939
942
  */
940
943
  get yearView() {
941
- const view = RenderView.YEAR;
944
+ const view = CalendarRenderView.YEAR;
942
945
  const currentYear = toDateSegment(this.view).year;
943
946
  const startIdx = Math.floor(currentYear / YEARS_PER_YEAR_VIEW) * YEARS_PER_YEAR_VIEW;
944
947
  const years = [];
@@ -973,7 +976,7 @@ let Calendar = class Calendar extends ControlElement {
973
976
  * Get month view template
974
977
  */
975
978
  get monthView() {
976
- const view = RenderView.MONTH;
979
+ const view = CalendarRenderView.MONTH;
977
980
  const currentYear = toDateSegment(this.view).year;
978
981
  const columnCount = MONTH_VIEW.columnCount;
979
982
  const monthCount = 12;
@@ -1018,7 +1021,7 @@ let Calendar = class Calendar extends ControlElement {
1018
1021
  * Get day view template
1019
1022
  */
1020
1023
  get dayView() {
1021
- const view = RenderView.DAY;
1024
+ const view = CalendarRenderView.DAY;
1022
1025
  const firstDayOfWeek = this.firstDayOfWeek;
1023
1026
  const padding = (7 + utcParse(this.view).getUTCDay() - firstDayOfWeek) % 7;
1024
1027
  const viewMonth = monthInfo(this.view);
@@ -1111,13 +1114,13 @@ let Calendar = class Calendar extends ControlElement {
1111
1114
  get viewRender() {
1112
1115
  let renderView;
1113
1116
  switch (this.renderView) {
1114
- case RenderView.MONTH:
1117
+ case CalendarRenderView.MONTH:
1115
1118
  renderView = this.monthView;
1116
1119
  break;
1117
- case RenderView.YEAR:
1120
+ case CalendarRenderView.YEAR:
1118
1121
  renderView = this.yearView;
1119
1122
  break;
1120
- case RenderView.DAY:
1123
+ case CalendarRenderView.DAY:
1121
1124
  default:
1122
1125
  renderView = this.dayView;
1123
1126
  }
@@ -1140,12 +1143,32 @@ let Calendar = class Calendar extends ControlElement {
1140
1143
  }
1141
1144
  return 'CELL_LABEL';
1142
1145
  }
1146
+ /**
1147
+ * fire 'before-cell-render' event
1148
+ * @param cell Cell
1149
+ * @returns {void}
1150
+ */
1151
+ dispatchBeforeCellRender(cell) {
1152
+ const calendarCell = toCalendarCell(cell);
1153
+ const event = new CustomEvent('before-cell-render', {
1154
+ cancelable: false,
1155
+ composed: true,
1156
+ detail: {
1157
+ cell: calendarCell
1158
+ }
1159
+ });
1160
+ this.dispatchEvent(event);
1161
+ }
1143
1162
  /**
1144
1163
  * Render cell template. Cell can be a day, month or year
1145
- * @param cell Cell object
1164
+ * @param cell Cell
1146
1165
  * @returns template result
1147
1166
  */
1148
1167
  renderCell(cell) {
1168
+ // there is no slot for cells with falsy value
1169
+ if (cell.value) {
1170
+ this.dispatchBeforeCellRender(cell);
1171
+ }
1149
1172
  const isSelection = cell.value !== undefined;
1150
1173
  const isSelectable = isSelection && !cell.disabled;
1151
1174
  const isSelected = cell.selected ? 'true' : 'false';
@@ -1201,12 +1224,12 @@ let Calendar = class Calendar extends ControlElement {
1201
1224
  let nextBtnAriaLabel = this.t('NEXT_MONTH');
1202
1225
  let viewBtnAriaLabel = this.t('YEAR_SELECTOR');
1203
1226
  switch (this.renderView) {
1204
- case RenderView.YEAR:
1227
+ case CalendarRenderView.YEAR:
1205
1228
  prevBtnAriaLabel = this.t('PREVIOUS_DECADE');
1206
1229
  nextBtnAriaLabel = this.t('NEXT_DECADE');
1207
1230
  viewBtnAriaLabel = this.t('DATE_SELECTOR');
1208
1231
  break;
1209
- case RenderView.MONTH:
1232
+ case CalendarRenderView.MONTH:
1210
1233
  prevBtnAriaLabel = this.t('PREVIOUS_YEAR');
1211
1234
  nextBtnAriaLabel = this.t('NEXT_YEAR');
1212
1235
  viewBtnAriaLabel = this.t('DATE_SELECTOR');
@@ -1226,7 +1249,7 @@ let Calendar = class Calendar extends ControlElement {
1226
1249
  aria-description="${viewBtnAriaLabel}"
1227
1250
  part="btn-view"
1228
1251
  textpos="before"
1229
- .icon="${this.renderView === RenderView.DAY ? 'down' : 'up'}"
1252
+ .icon="${this.renderView === CalendarRenderView.DAY ? 'down' : 'up'}"
1230
1253
  @tap="${this.onRenderViewTap}"
1231
1254
  >${this.formattedViewRender}</ef-button
1232
1255
  >
@@ -1,5 +1,5 @@
1
1
  import { CellIndex } from '@refinitiv-ui/utils/navigation.js';
2
- import { RenderView } from './constants.js';
2
+ import { CalendarRenderView } from './constants.js';
3
3
  export interface CellSelectionModel {
4
4
  selected?: boolean;
5
5
  range?: boolean;
@@ -9,7 +9,7 @@ export interface CellSelectionModel {
9
9
  lastDate?: boolean;
10
10
  }
11
11
  export interface Cell extends CellSelectionModel {
12
- view: RenderView;
12
+ view: CalendarRenderView;
13
13
  text?: string;
14
14
  active?: boolean;
15
15
  value?: string;
@@ -30,3 +30,22 @@ export type WeekdayName = {
30
30
  narrow: string;
31
31
  long: string;
32
32
  };
33
+ export type CalendarCell = {
34
+ active: boolean;
35
+ disabled: boolean;
36
+ firstDate: boolean;
37
+ idle: boolean;
38
+ index: CellIndex;
39
+ lastDate: boolean;
40
+ now: boolean;
41
+ range: boolean;
42
+ rangeFrom: boolean;
43
+ rangeTo: boolean;
44
+ selected: boolean;
45
+ text: string;
46
+ value: string;
47
+ view: CalendarRenderView;
48
+ };
49
+ export type BeforeCellRenderEvent = CustomEvent<{
50
+ cell: CalendarCell;
51
+ }>;
@@ -1,4 +1,5 @@
1
1
  import { TranslateParams } from '@refinitiv-ui/i18n';
2
+ import { CalendarCell, Cell } from './types.js';
2
3
  export type MonthInfo = {
3
4
  days: number;
4
5
  month: number;
@@ -28,4 +29,11 @@ declare const monthsNames: (locale: string, width?: Intl.DateTimeFormatOptions['
28
29
  * Used to format views
29
30
  */
30
31
  declare const ViewFormatTranslateParams: TranslateParams;
31
- export { monthInfo, weekdaysNames, monthsNames, ViewFormatTranslateParams };
32
+ /**
33
+ * convert internal Cell to CalendarCell
34
+ * avoid introducing breaking changes to the API
35
+ * @param cell Cell
36
+ * @returns CalendarCell
37
+ */
38
+ declare const toCalendarCell: (cell: Cell) => CalendarCell;
39
+ export { monthInfo, weekdaysNames, monthsNames, toCalendarCell, ViewFormatTranslateParams };
@@ -99,4 +99,27 @@ const ViewFormatTranslateParams = {
99
99
  },
100
100
  formats: DateMessageFormats
101
101
  };
102
- export { monthInfo, weekdaysNames, monthsNames, ViewFormatTranslateParams };
102
+ /**
103
+ * convert internal Cell to CalendarCell
104
+ * avoid introducing breaking changes to the API
105
+ * @param cell Cell
106
+ * @returns CalendarCell
107
+ */
108
+ const toCalendarCell = (cell) => {
109
+ return {
110
+ ...cell,
111
+ active: cell.active || false,
112
+ disabled: cell.disabled || false,
113
+ firstDate: cell.firstDate || false,
114
+ idle: cell.idle || false,
115
+ lastDate: cell.lastDate || false,
116
+ now: cell.now || false,
117
+ range: cell.range || false,
118
+ rangeFrom: cell.rangeFrom || false,
119
+ rangeTo: cell.rangeTo || false,
120
+ selected: cell.selected || false,
121
+ text: cell.text ?? '',
122
+ value: cell.value ?? ''
123
+ };
124
+ };
125
+ export { monthInfo, weekdaysNames, monthsNames, toCalendarCell, ViewFormatTranslateParams };
@@ -180,6 +180,18 @@
180
180
  "name": "icon-click",
181
181
  "description": "Fired when the user taps on icon added into control's slot."
182
182
  }
183
+ ],
184
+ "methods": [
185
+ {
186
+ "name": "checkValidity",
187
+ "description": "Returns `true` if the element input is valid; otherwise, returns `false`.",
188
+ "params": []
189
+ },
190
+ {
191
+ "name": "reportValidity",
192
+ "description": "Validate the element input and mark it as error if its input is invalid.",
193
+ "params": []
194
+ }
183
195
  ]
184
196
  }
185
197
  ]
@@ -28,6 +28,13 @@ A form control element for email.
28
28
  | `value` | `value` | `string` | "" | Input's value |
29
29
  | `warning` | `warning` | `boolean` | false | Set warning state |
30
30
 
31
+ ## Methods
32
+
33
+ | Method | Type | Description |
34
+ |------------------|---------------|--------------------------------------------------|
35
+ | `checkValidity` | `(): boolean` | Returns `true` if the element input is valid; otherwise, returns `false`. |
36
+ | `reportValidity` | `(): boolean` | Validate the element input and mark it as error if its input is invalid. |
37
+
31
38
  ## Events
32
39
 
33
40
  | Event | Description |
@@ -49,6 +49,16 @@ export declare class EmailField extends TextField {
49
49
  * Set to multiple mode, allows multiple emails in a single input
50
50
  */
51
51
  multiple: boolean;
52
+ /**
53
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
54
+ * @returns element input validity
55
+ */
56
+ checkValidity(): boolean;
57
+ /**
58
+ * Validate the element input and mark it as error if its input is invalid.
59
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
60
+ */
61
+ reportValidity(): boolean;
52
62
  /**
53
63
  * Decorate `<input>` element with common properties extended from text-field:
54
64
  * type="email" - always `email`
@@ -53,6 +53,20 @@ let EmailField = class EmailField extends TextField {
53
53
  */
54
54
  this.multiple = false;
55
55
  }
56
+ /**
57
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
58
+ * @returns element input validity
59
+ */
60
+ checkValidity() {
61
+ return super.checkValidity();
62
+ }
63
+ /**
64
+ * Validate the element input and mark it as error if its input is invalid.
65
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
66
+ */
67
+ reportValidity() {
68
+ return super.reportValidity();
69
+ }
56
70
  /**
57
71
  * Decorate `<input>` element with common properties extended from text-field:
58
72
  * type="email" - always `email`
@@ -957,6 +957,7 @@ let InteractiveChart = InteractiveChart_1 = class InteractiveChart extends Respo
957
957
  const dataSet = series.data || [];
958
958
  const latestData = dataSet[dataSet.length - 1];
959
959
  if (latestData) {
960
+ this.hasDataPoint = dataSet.length > 0;
960
961
  const priceColor = this.getColorInSeries(latestData, chartType, idx);
961
962
  // Render legend by series type
962
963
  this.renderTextLegend(chartType, this.rowLegend, latestData, priceColor, idx);
@@ -572,6 +572,14 @@ let List = class List extends ControlElement {
572
572
  this.renderTimestamp.clear(); // force render of all items
573
573
  this.setAttribute('aria-multiselectable', this.multiple ? 'true' : 'false');
574
574
  }
575
+ if (changeProperties.has('stateless')) {
576
+ if (this.stateless) {
577
+ this.setAttribute('aria-readonly', 'true');
578
+ }
579
+ else {
580
+ this.removeAttribute('aria-readonly');
581
+ }
582
+ }
575
583
  }
576
584
  /**
577
585
  * A `CSSResultGroup` that will be used
@@ -166,9 +166,6 @@
166
166
  {
167
167
  "name": "step-down",
168
168
  "description": "Fired when user acts value down on both pressing arrow down or tapping the spinner down. The event is not triggered if stepDown method is called programmatically."
169
- },
170
- {
171
- "name": "input"
172
169
  }
173
170
  ],
174
171
  "methods": [
@@ -192,9 +189,14 @@
192
189
  }
193
190
  ]
194
191
  },
192
+ {
193
+ "name": "reportValidity",
194
+ "description": "Validate the element input and mark it as error if its input is invalid.",
195
+ "params": []
196
+ },
195
197
  {
196
198
  "name": "checkValidity",
197
- "description": "Returns true if an input element contains valid data.",
199
+ "description": "Returns `true` if the element input is valid; otherwise, returns `false`.",
198
200
  "params": []
199
201
  }
200
202
  ]
@@ -21,18 +21,18 @@ Form control element for numbers.
21
21
 
22
22
  ## Methods
23
23
 
24
- | Method | Type | Description |
25
- |-----------------|-----------------------------------------------|--------------------------------------------------|
26
- | `checkValidity` | `(): boolean` | Returns true if an input element contains valid data. |
27
- | `stepDown` | `(stepIncrement?: number \| undefined): void` | Decreases the input value by amount of step<br /><br />**stepIncrement**: The stepIncrement parameter is a numeric value. If no parameter is passed, stepIncrement defaults to 1. |
28
- | `stepUp` | `(stepIncrement?: number \| undefined): void` | Increases the input value by amount of step<br /><br />**stepIncrement**: The stepIncrement parameter is a numeric value. If no parameter is passed, stepIncrement defaults to 1. |
24
+ | Method | Type | Description |
25
+ |------------------|-----------------------------------------------|--------------------------------------------------|
26
+ | `checkValidity` | `(): boolean` | Returns `true` if the element input is valid; otherwise, returns `false`. |
27
+ | `reportValidity` | `(): boolean` | Validate the element input and mark it as error if its input is invalid. |
28
+ | `stepDown` | `(stepIncrement?: number \| undefined): void` | Decreases the input value by amount of step<br /><br />**stepIncrement**: The stepIncrement parameter is a numeric value. If no parameter is passed, stepIncrement defaults to 1. |
29
+ | `stepUp` | `(stepIncrement?: number \| undefined): void` | Increases the input value by amount of step<br /><br />**stepIncrement**: The stepIncrement parameter is a numeric value. If no parameter is passed, stepIncrement defaults to 1. |
29
30
 
30
31
  ## Events
31
32
 
32
33
  | Event | Description |
33
34
  |-----------------|--------------------------------------------------|
34
35
  | `error-changed` | Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically. |
35
- | `input` | |
36
36
  | `step-down` | Fired when user acts value down on both pressing arrow down or tapping the spinner down. The event is not triggered if stepDown method is called programmatically. |
37
37
  | `step-up` | Fired when user acts value up on both pressing arrow up or tapping the spinner up. The event is not triggered if stepUp method is called programmatically. |
38
38
  | `value-changed` | Fired when user commits a value change. The event is not triggered if `value` property is changed programmatically. |
@@ -262,8 +262,13 @@ export declare class NumberField extends FormFieldElement {
262
262
  */
263
263
  stepDown(stepIncrement?: number): void;
264
264
  /**
265
- * Returns true if an input element contains valid data.
266
- * @returns true if input is valid
265
+ * Validate the element input and mark it as error if its input is invalid.
266
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
267
+ */
268
+ reportValidity(): boolean;
269
+ /**
270
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
271
+ * @returns element input validity
267
272
  */
268
273
  checkValidity(): boolean;
269
274
  /**
@@ -289,6 +289,10 @@ let NumberField = class NumberField extends FormFieldElement {
289
289
  if (event) {
290
290
  try {
291
291
  this.applyStepDirection(direction);
292
+ /**
293
+ * @ignore
294
+ * exclude native event from the documentation
295
+ */
292
296
  this.dispatchEvent(new InputEvent('input'));
293
297
  this.setSilentlyValueAndNotify();
294
298
  }
@@ -360,16 +364,14 @@ let NumberField = class NumberField extends FormFieldElement {
360
364
  onNativeInputChange(event) {
361
365
  const currentInput = this.inputValue;
362
366
  const inputValue = this.stripeInvalidCharacters(currentInput, this.value, event.data || '');
363
- if (inputValue !== currentInput) {
364
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
365
- const inputEl = this.inputElement;
367
+ if (inputValue !== currentInput && this.inputElement) {
366
368
  // we can only stripe the characters, so try to make the best guess where the cursor should be
367
- const selectionStart = inputEl.selectionStart || 0;
368
- const selectionEnd = inputEl.selectionEnd || 0;
369
+ const selectionStart = this.inputElement.selectionStart || 0;
370
+ const selectionEnd = this.inputElement.selectionEnd || 0;
369
371
  this.inputValue = inputValue;
370
372
  const diff = currentInput.length - inputValue.length;
371
- inputEl.selectionStart = Math.max(selectionStart - diff, 0);
372
- inputEl.selectionEnd = Math.max(selectionEnd - diff, 0);
373
+ this.inputElement.selectionStart = Math.max(selectionStart - diff, 0);
374
+ this.inputElement.selectionEnd = Math.max(selectionEnd - diff, 0);
373
375
  }
374
376
  this.setSilentlyValueAndNotify();
375
377
  }
@@ -608,8 +610,15 @@ let NumberField = class NumberField extends FormFieldElement {
608
610
  this.applyStepDirection(Direction.Down, stepIncrement);
609
611
  }
610
612
  /**
611
- * Returns true if an input element contains valid data.
612
- * @returns true if input is valid
613
+ * Validate the element input and mark it as error if its input is invalid.
614
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
615
+ */
616
+ reportValidity() {
617
+ return super.reportValidity();
618
+ }
619
+ /**
620
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
621
+ * @returns element input validity
613
622
  */
614
623
  checkValidity() {
615
624
  const value = this.internalValue;
@@ -134,6 +134,18 @@
134
134
  "name": "error-changed",
135
135
  "description": "Fired when user inputs an invalid value. The event is not triggered if `error` property is changed programmatically."
136
136
  }
137
+ ],
138
+ "methods": [
139
+ {
140
+ "name": "checkValidity",
141
+ "description": "Returns `true` if the element input is valid; otherwise, returns `false`.",
142
+ "params": []
143
+ },
144
+ {
145
+ "name": "reportValidity",
146
+ "description": "Validate the element input and mark it as error if its input is invalid.",
147
+ "params": []
148
+ }
137
149
  ]
138
150
  }
139
151
  ]
@@ -24,6 +24,13 @@ A form control element for password.
24
24
  | `value` | `value` | `string` | "" | Input's value |
25
25
  | `warning` | `warning` | `boolean` | false | Set warning state |
26
26
 
27
+ ## Methods
28
+
29
+ | Method | Type | Description |
30
+ |------------------|---------------|--------------------------------------------------|
31
+ | `checkValidity` | `(): boolean` | Returns `true` if the element input is valid; otherwise, returns `false`. |
32
+ | `reportValidity` | `(): boolean` | Validate the element input and mark it as error if its input is invalid. |
33
+
27
34
  ## Events
28
35
 
29
36
  | Event | Description |
@@ -55,6 +55,16 @@ export declare class PasswordField extends TextField {
55
55
  * @return shouldUpdate
56
56
  */
57
57
  protected firstUpdated(changedProperties: PropertyValues): void;
58
+ /**
59
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
60
+ * @returns element input validity
61
+ */
62
+ checkValidity(): boolean;
63
+ /**
64
+ * Validate the element input and mark it as error if its input is invalid.
65
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
66
+ */
67
+ reportValidity(): boolean;
58
68
  /**
59
69
  * Decorate `<input>` element with common properties extended from text-field:
60
70
  * type="text|password" - text if password is visible
@@ -60,6 +60,20 @@ let PasswordField = class PasswordField extends TextField {
60
60
  // password shouldn't display value on tooltip when value is overflow
61
61
  deregisterOverflowTooltip(this);
62
62
  }
63
+ /**
64
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
65
+ * @returns element input validity
66
+ */
67
+ checkValidity() {
68
+ return super.checkValidity();
69
+ }
70
+ /**
71
+ * Validate the element input and mark it as error if its input is invalid.
72
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
73
+ */
74
+ reportValidity() {
75
+ return super.reportValidity();
76
+ }
63
77
  /**
64
78
  * Decorate `<input>` element with common properties extended from text-field:
65
79
  * type="text|password" - text if password is visible
@@ -156,6 +156,18 @@
156
156
  "name": "icon-click",
157
157
  "description": "Fired when the user taps on icon added into control's slot."
158
158
  }
159
+ ],
160
+ "methods": [
161
+ {
162
+ "name": "checkValidity",
163
+ "description": "Returns `true` if the element input is valid; otherwise, returns `false`.",
164
+ "params": []
165
+ },
166
+ {
167
+ "name": "reportValidity",
168
+ "description": "Validate the element input and mark it as error if its input is invalid.",
169
+ "params": []
170
+ }
159
171
  ]
160
172
  }
161
173
  ]
@@ -26,6 +26,13 @@ Form control to get a search input from users.
26
26
  | `value` | `value` | `string` | "" | Input's value |
27
27
  | `warning` | `warning` | `boolean` | false | Set warning state |
28
28
 
29
+ ## Methods
30
+
31
+ | Method | Type | Description |
32
+ |------------------|---------------|--------------------------------------------------|
33
+ | `checkValidity` | `(): boolean` | Returns `true` if the element input is valid; otherwise, returns `false`. |
34
+ | `reportValidity` | `(): boolean` | Validate the element input and mark it as error if its input is invalid. |
35
+
29
36
  ## Events
30
37
 
31
38
  | Event | Description |
@@ -55,6 +55,16 @@ export declare class SearchField extends TextField {
55
55
  * @returns template map
56
56
  */
57
57
  protected get decorateInputMap(): TemplateMap;
58
+ /**
59
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
60
+ * @returns element input validity
61
+ */
62
+ checkValidity(): boolean;
63
+ /**
64
+ * Validate the element input and mark it as error if its input is invalid.
65
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
66
+ */
67
+ reportValidity(): boolean;
58
68
  /**
59
69
  * Renders icon element
60
70
  * @returns {void}
@@ -57,6 +57,20 @@ let SearchField = class SearchField extends TextField {
57
57
  inputmode: 'search'
58
58
  };
59
59
  }
60
+ /**
61
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
62
+ * @returns element input validity
63
+ */
64
+ checkValidity() {
65
+ return super.checkValidity();
66
+ }
67
+ /**
68
+ * Validate the element input and mark it as error if its input is invalid.
69
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
70
+ */
71
+ reportValidity() {
72
+ return super.reportValidity();
73
+ }
60
74
  /**
61
75
  * Renders icon element
62
76
  * @returns {void}
@@ -171,6 +171,18 @@
171
171
  "name": "icon-click",
172
172
  "description": "Fired when the user taps on icon added into control's slot."
173
173
  }
174
+ ],
175
+ "methods": [
176
+ {
177
+ "name": "checkValidity",
178
+ "description": "Returns `true` if the element input is valid; otherwise, returns `false`.",
179
+ "params": []
180
+ },
181
+ {
182
+ "name": "reportValidity",
183
+ "description": "Validate the element input and mark it as error if its input is invalid.",
184
+ "params": []
185
+ }
174
186
  ]
175
187
  }
176
188
  ]
@@ -19,6 +19,13 @@ Form control element for text.
19
19
  | `value` | `value` | `string` | "" | Input's value |
20
20
  | `warning` | `warning` | `boolean` | false | Set warning state |
21
21
 
22
+ ## Methods
23
+
24
+ | Method | Type | Description |
25
+ |------------------|---------------|--------------------------------------------------|
26
+ | `checkValidity` | `(): boolean` | Returns `true` if the element input is valid; otherwise, returns `false`. |
27
+ | `reportValidity` | `(): boolean` | Validate the element input and mark it as error if its input is invalid. |
28
+
22
29
  ## Events
23
30
 
24
31
  | Event | Description |
@@ -80,6 +80,16 @@ export declare class TextField extends FormFieldElement {
80
80
  * @returns shouldUpdate
81
81
  */
82
82
  protected updated(changedProperties: PropertyValues): void;
83
+ /**
84
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
85
+ * @returns element input validity
86
+ */
87
+ checkValidity(): boolean;
88
+ /**
89
+ * Validate the element input and mark it as error if its input is invalid.
90
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
91
+ */
92
+ reportValidity(): boolean;
83
93
  /**
84
94
  * Check if input value should be synchronised with component value
85
95
  * @param changedProperties Properties that has changed
@@ -130,6 +130,20 @@ let TextField = class TextField extends FormFieldElement {
130
130
  this.syncInputValue();
131
131
  }
132
132
  }
133
+ /**
134
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
135
+ * @returns element input validity
136
+ */
137
+ checkValidity() {
138
+ return super.checkValidity();
139
+ }
140
+ /**
141
+ * Validate the element input and mark it as error if its input is invalid.
142
+ * @returns `true` if the element input is valid; otherwise, returns `false`.
143
+ */
144
+ reportValidity() {
145
+ return super.reportValidity();
146
+ }
133
147
  /**
134
148
  * Check if input value should be synchronised with component value
135
149
  * @param changedProperties Properties that has changed
@@ -96,6 +96,10 @@ let Tree = class Tree extends List {
96
96
  selectItem(item) {
97
97
  // Stateless tree
98
98
  if (this.stateless) {
99
+ // Single selection - expand/collapse group (parent)
100
+ if (!this.multiple && this.manager.isItemParent(item)) {
101
+ this.toggleExpandedState(item);
102
+ }
99
103
  return false;
100
104
  }
101
105
  // Multiple selection
@@ -539,9 +539,8 @@ let TreeSelect = class TreeSelect extends ComboBox {
539
539
  */
540
540
  onPopupClosed() {
541
541
  super.onPopupClosed();
542
- this.updateMemo();
542
+ this.exitEditSelection(); // selection filter should be removed before reverting modified selection
543
543
  this.revertModifiedSelection();
544
- this.exitEditSelection();
545
544
  }
546
545
  /**
547
546
  * Filter the internal items by query. Changes items' hidden state.
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.5.0';
1
+ export const VERSION = '7.6.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "7.5.0",
3
+ "version": "7.6.1",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "LSEG",
6
6
  "license": "Apache-2.0",
@@ -352,7 +352,7 @@
352
352
  },
353
353
  "devDependencies": {
354
354
  "@refinitiv-ui/core": "^7.2.0",
355
- "@refinitiv-ui/demo-block": "^7.0.6",
355
+ "@refinitiv-ui/demo-block": "^7.0.7",
356
356
  "@refinitiv-ui/i18n": "^7.0.4",
357
357
  "@refinitiv-ui/phrasebook": "^7.0.4",
358
358
  "@refinitiv-ui/test-helpers": "^7.0.4",
@@ -371,5 +371,5 @@
371
371
  "publishConfig": {
372
372
  "access": "public"
373
373
  },
374
- "gitHead": "e162ec78601e5f97201d53d740925ee2075fd95e"
374
+ "gitHead": "788e08bbba04ae54501cee9cf19251e1a44b18fb"
375
375
  }