@refinitiv-ui/elements 7.4.0 → 7.6.0

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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +1 -1
  3. package/README.md +5 -5
  4. package/lib/calendar/constants.d.ts +1 -1
  5. package/lib/calendar/constants.js +7 -6
  6. package/lib/calendar/custom-elements.json +4 -0
  7. package/lib/calendar/custom-elements.md +5 -4
  8. package/lib/calendar/index.d.ts +13 -3
  9. package/lib/calendar/index.js +52 -29
  10. package/lib/calendar/types.d.ts +21 -2
  11. package/lib/calendar/utils.d.ts +9 -1
  12. package/lib/calendar/utils.js +24 -1
  13. package/lib/combo-box/index.js +2 -0
  14. package/lib/datetime-field/custom-elements.json +0 -5
  15. package/lib/datetime-field/custom-elements.md +4 -5
  16. package/lib/datetime-field/index.d.ts +0 -22
  17. package/lib/datetime-field/index.js +2 -38
  18. package/lib/email-field/custom-elements.json +12 -0
  19. package/lib/email-field/custom-elements.md +7 -0
  20. package/lib/email-field/index.d.ts +10 -7
  21. package/lib/email-field/index.js +14 -13
  22. package/lib/interactive-chart/index.js +1 -0
  23. package/lib/number-field/custom-elements.json +4 -7
  24. package/lib/number-field/custom-elements.md +2 -3
  25. package/lib/number-field/index.d.ts +6 -11
  26. package/lib/number-field/index.js +19 -33
  27. package/lib/password-field/custom-elements.json +12 -0
  28. package/lib/password-field/custom-elements.md +7 -0
  29. package/lib/password-field/index.d.ts +10 -0
  30. package/lib/password-field/index.js +14 -0
  31. package/lib/search-field/custom-elements.json +12 -0
  32. package/lib/search-field/custom-elements.md +7 -0
  33. package/lib/search-field/index.d.ts +10 -0
  34. package/lib/search-field/index.js +14 -0
  35. package/lib/slider/custom-elements.json +1 -1
  36. package/lib/slider/custom-elements.md +1 -1
  37. package/lib/slider/index.d.ts +6 -1
  38. package/lib/slider/index.js +14 -2
  39. package/lib/text-field/custom-elements.json +12 -0
  40. package/lib/text-field/custom-elements.md +7 -0
  41. package/lib/text-field/index.d.ts +17 -12
  42. package/lib/text-field/index.js +29 -31
  43. package/lib/tree/elements/tree.js +4 -4
  44. package/lib/tree/managers/tree-manager.d.ts +8 -0
  45. package/lib/tree/managers/tree-manager.js +19 -1
  46. package/lib/tree-select/index.d.ts +12 -3
  47. package/lib/tree-select/index.js +55 -20
  48. package/lib/version.js +1 -1
  49. package/package.json +17 -17
@@ -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 |
@@ -1,5 +1,4 @@
1
1
  import { JSXInterface } from '../jsx';
2
- import { PropertyValues } from '@refinitiv-ui/core';
3
2
  import { TemplateMap } from '@refinitiv-ui/core/directives/template-map.js';
4
3
  import '../icon/index.js';
5
4
  import { TextField } from '../text-field/index.js';
@@ -50,6 +49,16 @@ export declare class EmailField extends TextField {
50
49
  * Set to multiple mode, allows multiple emails in a single input
51
50
  */
52
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;
53
62
  /**
54
63
  * Decorate `<input>` element with common properties extended from text-field:
55
64
  * type="email" - always `email`
@@ -57,12 +66,6 @@ export declare class EmailField extends TextField {
57
66
  * @returns template map
58
67
  */
59
68
  protected get decorateInputMap(): TemplateMap;
60
- /**
61
- * Check if input should be re-validated
62
- * @param changedProperties Properties that has changed
63
- * @returns True if input should be re-validated
64
- */
65
- protected shouldValidateInput(changedProperties: PropertyValues): boolean;
66
69
  }
67
70
  declare global {
68
71
  interface HTMLElementTagNameMap {
@@ -52,7 +52,20 @@ let EmailField = class EmailField extends TextField {
52
52
  * Set to multiple mode, allows multiple emails in a single input
53
53
  */
54
54
  this.multiple = false;
55
- /* c8 ignore stop */
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();
56
69
  }
57
70
  /**
58
71
  * Decorate `<input>` element with common properties extended from text-field:
@@ -68,18 +81,6 @@ let EmailField = class EmailField extends TextField {
68
81
  multiple: this.multiple
69
82
  };
70
83
  }
71
- /**
72
- * Check if input should be re-validated
73
- * @param changedProperties Properties that has changed
74
- * @returns True if input should be re-validated
75
- */
76
- /* c8 ignore start */
77
- shouldValidateInput(changedProperties) {
78
- // TODO: This validation should be refactored
79
- return (changedProperties.has('value') ||
80
- changedProperties.has('multiple') ||
81
- super.shouldValidateInput(changedProperties));
82
- }
83
84
  };
84
85
  __decorate([
85
86
  property({ type: Boolean, reflect: true })
@@ -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);
@@ -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": [
@@ -193,13 +190,13 @@
193
190
  ]
194
191
  },
195
192
  {
196
- "name": "checkValidity",
197
- "description": "Returns true if an input element contains valid data.",
193
+ "name": "reportValidity",
194
+ "description": "Validate the element input and mark it as error if its input is invalid.",
198
195
  "params": []
199
196
  },
200
197
  {
201
- "name": "reportValidity",
202
- "description": "Validate input. Mark as error if input is invalid",
198
+ "name": "checkValidity",
199
+ "description": "Returns `true` if the element input is valid; otherwise, returns `false`.",
203
200
  "params": []
204
201
  }
205
202
  ]
@@ -23,8 +23,8 @@ Form control element for numbers.
23
23
 
24
24
  | Method | Type | Description |
25
25
  |------------------|-----------------------------------------------|--------------------------------------------------|
26
- | `checkValidity` | `(): boolean` | Returns true if an input element contains valid data. |
27
- | `reportValidity` | `(): boolean` | Validate input. Mark as error if input is invalid |
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
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
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. |
30
30
 
@@ -33,7 +33,6 @@ Form control element for numbers.
33
33
  | Event | Description |
34
34
  |-----------------|--------------------------------------------------|
35
35
  | `error-changed` | Fired when user inputs invalid value. The event is not triggered if `error` property is changed programmatically. |
36
- | `input` | |
37
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. |
38
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. |
39
38
  | `value-changed` | Fired when user commits a value change. The event is not triggered if `value` property is changed programmatically. |
@@ -209,11 +209,6 @@ export declare class NumberField extends FormFieldElement {
209
209
  * @returns {void}
210
210
  */
211
211
  private setSilentlyValueAndNotify;
212
- /**
213
- * Reset error state on input
214
- * @returns {void}
215
- */
216
- private resetError;
217
212
  /**
218
213
  * Get the allowed step value
219
214
  * @returns allowed step
@@ -267,15 +262,15 @@ export declare class NumberField extends FormFieldElement {
267
262
  */
268
263
  stepDown(stepIncrement?: number): void;
269
264
  /**
270
- * Returns true if an input element contains valid data.
271
- * @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`.
272
267
  */
273
- checkValidity(): boolean;
268
+ reportValidity(): boolean;
274
269
  /**
275
- * Validate input. Mark as error if input is invalid
276
- * @returns false if there is an error
270
+ * Returns `true` if the element input is valid; otherwise, returns `false`.
271
+ * @returns element input validity
277
272
  */
278
- reportValidity(): boolean;
273
+ checkValidity(): boolean;
279
274
  /**
280
275
  * @ignore
281
276
  * @inheritDoc
@@ -138,8 +138,6 @@ let NumberField = class NumberField extends FormFieldElement {
138
138
  * @returns {void}
139
139
  */
140
140
  update(changedProperties) {
141
- // This code probably should not be here, as validation must be instantiated by the app developer
142
- // Keep the element inline with others for now
143
141
  if (changedProperties.has(FocusedPropertyKey) && !this.focused) {
144
142
  this.reportValidity();
145
143
  }
@@ -291,6 +289,10 @@ let NumberField = class NumberField extends FormFieldElement {
291
289
  if (event) {
292
290
  try {
293
291
  this.applyStepDirection(direction);
292
+ /**
293
+ * @ignore
294
+ * exclude native event from the documentation
295
+ */
294
296
  this.dispatchEvent(new InputEvent('input'));
295
297
  this.setSilentlyValueAndNotify();
296
298
  }
@@ -362,16 +364,14 @@ let NumberField = class NumberField extends FormFieldElement {
362
364
  onNativeInputChange(event) {
363
365
  const currentInput = this.inputValue;
364
366
  const inputValue = this.stripeInvalidCharacters(currentInput, this.value, event.data || '');
365
- if (inputValue !== currentInput) {
366
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
367
- const inputEl = this.inputElement;
367
+ if (inputValue !== currentInput && this.inputElement) {
368
368
  // we can only stripe the characters, so try to make the best guess where the cursor should be
369
- const selectionStart = inputEl.selectionStart || 0;
370
- const selectionEnd = inputEl.selectionEnd || 0;
369
+ const selectionStart = this.inputElement.selectionStart || 0;
370
+ const selectionEnd = this.inputElement.selectionEnd || 0;
371
371
  this.inputValue = inputValue;
372
372
  const diff = currentInput.length - inputValue.length;
373
- inputEl.selectionStart = Math.max(selectionStart - diff, 0);
374
- 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);
375
375
  }
376
376
  this.setSilentlyValueAndNotify();
377
377
  }
@@ -418,7 +418,7 @@ let NumberField = class NumberField extends FormFieldElement {
418
418
  */
419
419
  setSilentlyValueAndNotify() {
420
420
  // Nobody likes to see a red border
421
- this.resetError();
421
+ this.reportValidity();
422
422
  const value = this.valueAsNumberString(this.inputValue);
423
423
  if (super.value !== value) {
424
424
  // here we must set the value silently to avoid re-rendering of input
@@ -426,15 +426,6 @@ let NumberField = class NumberField extends FormFieldElement {
426
426
  this.notifyPropertyChange('value', value);
427
427
  }
428
428
  }
429
- /**
430
- * Reset error state on input
431
- * @returns {void}
432
- */
433
- resetError() {
434
- if (this.error && this.checkValidity()) {
435
- this.reportValidity();
436
- }
437
- }
438
429
  /**
439
430
  * Get the allowed step value
440
431
  * @returns allowed step
@@ -619,8 +610,15 @@ let NumberField = class NumberField extends FormFieldElement {
619
610
  this.applyStepDirection(Direction.Down, stepIncrement);
620
611
  }
621
612
  /**
622
- * Returns true if an input element contains valid data.
623
- * @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
624
622
  */
625
623
  checkValidity() {
626
624
  const value = this.internalValue;
@@ -645,18 +643,6 @@ let NumberField = class NumberField extends FormFieldElement {
645
643
  }
646
644
  return true;
647
645
  }
648
- /**
649
- * Validate input. Mark as error if input is invalid
650
- * @returns false if there is an error
651
- */
652
- reportValidity() {
653
- const hasError = !this.checkValidity();
654
- if (this.error !== hasError) {
655
- this.error = hasError;
656
- this.notifyPropertyChange('error', this.error);
657
- }
658
- return !hasError;
659
- }
660
646
  /**
661
647
  * @ignore
662
648
  * @inheritDoc
@@ -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}
@@ -177,7 +177,7 @@
177
177
  },
178
178
  {
179
179
  "name": "input",
180
- "description": "Fired when the user inputs a value by interacting with the slider or updating its input field."
180
+ "description": "Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field."
181
181
  },
182
182
  {
183
183
  "name": "from-input",
@@ -25,7 +25,7 @@ Allows users to make selections from a range of values
25
25
  |-----------------|--------------------------------------------------|
26
26
  | `from-changed` | Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically. |
27
27
  | `from-input` | Fired when the user inputs from's value by interacting with the slider or updating its input field. |
28
- | `input` | Fired when the user inputs a value by interacting with the slider or updating its input field. |
28
+ | `input` | Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field. |
29
29
  | `to-changed` | Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically. |
30
30
  | `to-input` | Fired when the user inputs to's value by interacting with the slider or updating its input field. |
31
31
  | `value-changed` | Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically. |
@@ -18,7 +18,7 @@ import '../number-field/index.js';
18
18
  * @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
19
19
  * @fires from-changed - Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically.
20
20
  * @fires to-changed - Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically.
21
- * @fires input - Fired when the user inputs a value by interacting with the slider or updating its input field.
21
+ * @fires input - Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field.
22
22
  * @fires from-input - Fired when the user inputs from's value by interacting with the slider or updating its input field.
23
23
  * @fires to-input - Fired when the user inputs to's value by interacting with the slider or updating its input field.
24
24
  */
@@ -341,6 +341,11 @@ export declare class Slider extends ControlElement {
341
341
  * @returns validated to value.
342
342
  */
343
343
  private validateTo;
344
+ /**
345
+ * Validate number field from changed thumb
346
+ * @returns {void}
347
+ */
348
+ private validateNumberField;
344
349
  /**
345
350
  * Calculate the nearest possible step value depending on step interval
346
351
  * @param thumbPosition current thumb position in fraction
@@ -27,7 +27,7 @@ import { clamp, countDecimalPlace, isDecimalNumber, preventDefault } from './uti
27
27
  * @fires value-changed - Fired when the user commits a value change. The event is not triggered if `value` property is changed programmatically.
28
28
  * @fires from-changed - Fired when the user changes from's value. The event is not triggered if `from` property is changed programmatically.
29
29
  * @fires to-changed - Fired when the user changes to's value. The event is not triggered if `to` property is changed programmatically.
30
- * @fires input - Fired when the user inputs a value by interacting with the slider or updating its input field.
30
+ * @fires input - Fired with the value of the input in `e.detail.value` like another custom events when the user inputs a value by interacting with the slider or updating its input field.
31
31
  * @fires from-input - Fired when the user inputs from's value by interacting with the slider or updating its input field.
32
32
  * @fires to-input - Fired when the user inputs to's value by interacting with the slider or updating its input field.
33
33
  */
@@ -762,6 +762,7 @@ let Slider = class Slider extends ControlElement {
762
762
  this.valuePreviousInput = this.value;
763
763
  }
764
764
  this.onDrag(event);
765
+ this.validateNumberField();
765
766
  if (event.changedTouches) {
766
767
  this.addEventListener('touchmove', this.onDrag);
767
768
  this.addEventListener('touchend', this.onDragEnd);
@@ -855,6 +856,17 @@ let Slider = class Slider extends ControlElement {
855
856
  }
856
857
  return this.fromNumber + this.minRangeNumber;
857
858
  }
859
+ /**
860
+ * Validate number field from changed thumb
861
+ * @returns {void}
862
+ */
863
+ validateNumberField() {
864
+ if (this.isShowInputField) {
865
+ const name = this.changedThumb?.getAttribute('name');
866
+ const numberField = this[`${name}Input`];
867
+ requestAnimationFrame(() => numberField.reportValidity());
868
+ }
869
+ }
858
870
  /**
859
871
  * Calculate the nearest possible step value depending on step interval
860
872
  * @param thumbPosition current thumb position in fraction
@@ -996,7 +1008,7 @@ let Slider = class Slider extends ControlElement {
996
1008
  if (valueFor === SliderDataName.to && value < this.fromNumber + this.minRangeNumber) {
997
1009
  return false;
998
1010
  }
999
- else if (value > this.toNumber - this.minRangeNumber) {
1011
+ else if (valueFor === SliderDataName.from && value > this.toNumber - this.minRangeNumber) {
1000
1012
  return false;
1001
1013
  }
1002
1014
  }
@@ -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 |
@@ -68,12 +68,28 @@ export declare class TextField extends FormFieldElement {
68
68
  * @returns {void}
69
69
  */
70
70
  protected firstUpdated(changedProperties: PropertyValues): void;
71
+ /**
72
+ * Updates the element
73
+ * @param changedProperties Properties that has changed
74
+ * @returns {void}
75
+ */
76
+ protected update(changedProperties: PropertyValues): void;
71
77
  /**
72
78
  * Called when the element’s DOM has been updated and rendered
73
79
  * @param changedProperties Properties that has changed
74
80
  * @returns shouldUpdate
75
81
  */
76
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;
77
93
  /**
78
94
  * Check if input value should be synchronised with component value
79
95
  * @param changedProperties Properties that has changed
@@ -86,13 +102,7 @@ export declare class TextField extends FormFieldElement {
86
102
  * @param changedProperties Properties that has changed
87
103
  * @returns {void}
88
104
  */
89
- protected syncInputValue(changedProperties: PropertyValues): void;
90
- /**
91
- * Check if input should be re-validated
92
- * @param changedProperties Properties that has changed
93
- * @returns True if input should be re-validated
94
- */
95
- protected shouldValidateInput(changedProperties: PropertyValues): boolean;
105
+ protected syncInputValue(): void;
96
106
  /**
97
107
  * Runs on input element `input` event
98
108
  * @param event `input` event
@@ -110,11 +120,6 @@ export declare class TextField extends FormFieldElement {
110
120
  * @returns {void}
111
121
  */
112
122
  protected onPossibleValueChange(event: InputEvent): void;
113
- /**
114
- * Uses native `checkValidity()` function to validate input
115
- * @returns {void}
116
- */
117
- protected validateInput(): void;
118
123
  /**
119
124
  * Fires event on `icon` click
120
125
  * @returns {void}