@riverty/web-components 5.6.0 → 5.8.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 (134) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/custom-elements.json +28 -3
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/r-alert.cjs.entry.js +24 -8
  5. package/dist/cjs/r-badge.cjs.entry.js +1 -1
  6. package/dist/cjs/r-button.cjs.entry.js +1 -1
  7. package/dist/cjs/r-checkbox-group.cjs.entry.js +28 -14
  8. package/dist/cjs/r-checkbox.cjs.entry.js +25 -10
  9. package/dist/cjs/r-hint_3.cjs.entry.js +1 -1
  10. package/dist/cjs/r-icon-button.cjs.entry.js +1 -1
  11. package/dist/cjs/r-icon.cjs.entry.js +1 -1
  12. package/dist/cjs/r-input-code.cjs.entry.js +30 -17
  13. package/dist/cjs/r-input-date.cjs.entry.js +86 -16
  14. package/dist/cjs/r-input-password.cjs.entry.js +25 -9
  15. package/dist/cjs/r-input-phone-number.cjs.entry.js +27 -14
  16. package/dist/cjs/r-input.cjs.entry.js +27 -14
  17. package/dist/cjs/r-pagination.cjs.entry.js +1 -1
  18. package/dist/cjs/r-popover-action.cjs.entry.js +1 -1
  19. package/dist/cjs/r-popover.cjs.entry.js +1 -1
  20. package/dist/cjs/r-radio-button.cjs.entry.js +1 -1
  21. package/dist/cjs/r-radio-group.cjs.entry.js +21 -17
  22. package/dist/cjs/r-select.cjs.entry.js +113 -19
  23. package/dist/cjs/r-textarea.cjs.entry.js +19 -6
  24. package/dist/cjs/r-toast.cjs.entry.js +50 -19
  25. package/dist/cjs/web-components.cjs.js +1 -1
  26. package/dist/collection/components/alert/alert.css +56 -16
  27. package/dist/collection/components/alert/alert.js +48 -11
  28. package/dist/collection/components/alert/exports.js +1 -1
  29. package/dist/collection/components/badge/badge.css +8 -8
  30. package/dist/collection/components/button/button.css +6 -7
  31. package/dist/collection/components/checkbox/checkbox.js +45 -10
  32. package/dist/collection/components/checkbox-group/checkbox-group.css +2 -2
  33. package/dist/collection/components/checkbox-group/checkbox-group.js +47 -13
  34. package/dist/collection/components/hint/hint.css +1 -1
  35. package/dist/collection/components/icon/bundled-icons/riverty-kit.json +1 -1
  36. package/dist/collection/components/icon/riverty-kit.js +1 -1
  37. package/dist/collection/components/icon-button/icon-button.css +0 -7
  38. package/dist/collection/components/input/input.css +1 -1
  39. package/dist/collection/components/input/input.js +46 -13
  40. package/dist/collection/components/input-code/input-code.css +1 -1
  41. package/dist/collection/components/input-code/input-code.js +49 -16
  42. package/dist/collection/components/input-date/input-date.css +1 -1
  43. package/dist/collection/components/input-date/input-date.js +235 -16
  44. package/dist/collection/components/input-password/input-password.js +45 -9
  45. package/dist/collection/components/input-phone-number/input-phone-number.js +47 -14
  46. package/dist/collection/components/pagination/pagination.css +23 -23
  47. package/dist/collection/components/popover/popover.css +11 -3
  48. package/dist/collection/components/popover-action/popover-action.css +3 -5
  49. package/dist/collection/components/radio-button/radio-button.css +1 -1
  50. package/dist/collection/components/radio-group/radio-group.css +2 -2
  51. package/dist/collection/components/radio-group/radio-group.js +21 -17
  52. package/dist/collection/components/select/select.css +2 -2
  53. package/dist/collection/components/select/select.js +193 -21
  54. package/dist/collection/components/textarea/textarea.css +1 -1
  55. package/dist/collection/components/textarea/textarea.js +38 -5
  56. package/dist/collection/components/toast/toast.css +29 -21
  57. package/dist/collection/components/toast/toast.js +94 -20
  58. package/dist/esm/loader.js +1 -1
  59. package/dist/esm/r-alert.entry.js +24 -8
  60. package/dist/esm/r-badge.entry.js +1 -1
  61. package/dist/esm/r-button.entry.js +1 -1
  62. package/dist/esm/r-checkbox-group.entry.js +28 -14
  63. package/dist/esm/r-checkbox.entry.js +25 -10
  64. package/dist/esm/r-hint_3.entry.js +1 -1
  65. package/dist/esm/r-icon-button.entry.js +1 -1
  66. package/dist/esm/r-icon.entry.js +1 -1
  67. package/dist/esm/r-input-code.entry.js +30 -17
  68. package/dist/esm/r-input-date.entry.js +86 -16
  69. package/dist/esm/r-input-password.entry.js +25 -9
  70. package/dist/esm/r-input-phone-number.entry.js +27 -14
  71. package/dist/esm/r-input.entry.js +27 -14
  72. package/dist/esm/r-pagination.entry.js +1 -1
  73. package/dist/esm/r-popover-action.entry.js +1 -1
  74. package/dist/esm/r-popover.entry.js +1 -1
  75. package/dist/esm/r-radio-button.entry.js +1 -1
  76. package/dist/esm/r-radio-group.entry.js +21 -17
  77. package/dist/esm/r-select.entry.js +113 -19
  78. package/dist/esm/r-textarea.entry.js +19 -6
  79. package/dist/esm/r-toast.entry.js +50 -19
  80. package/dist/esm/web-components.js +1 -1
  81. package/dist/types/components/alert/alert.d.ts +3 -0
  82. package/dist/types/components/alert/exports.d.ts +1 -1
  83. package/dist/types/components/checkbox/checkbox.d.ts +5 -0
  84. package/dist/types/components/checkbox-group/checkbox-group.d.ts +6 -0
  85. package/dist/types/components/input/input.d.ts +5 -0
  86. package/dist/types/components/input-code/input-code.d.ts +5 -0
  87. package/dist/types/components/input-date/input-date.d.ts +30 -0
  88. package/dist/types/components/input-password/input-password.d.ts +5 -0
  89. package/dist/types/components/input-phone-number/input-phone-number.d.ts +5 -0
  90. package/dist/types/components/radio-group/radio-group.d.ts +1 -2
  91. package/dist/types/components/select/select.d.ts +34 -2
  92. package/dist/types/components/textarea/textarea.d.ts +5 -0
  93. package/dist/types/components/toast/toast.d.ts +10 -2
  94. package/dist/types/components.d.ts +143 -8
  95. package/dist/web-components/bundled-icons/riverty-kit.json +1 -1
  96. package/dist/web-components/p-15ac0fdd.entry.js +1 -0
  97. package/dist/web-components/p-1c956370.entry.js +1 -0
  98. package/dist/web-components/p-2a512983.entry.js +1 -0
  99. package/dist/web-components/p-2e18e762.entry.js +1 -0
  100. package/dist/web-components/{p-72c0c0d8.entry.js → p-3078b2b8.entry.js} +1 -1
  101. package/dist/web-components/p-56da04d8.entry.js +1 -0
  102. package/dist/web-components/p-5744d75c.entry.js +1 -0
  103. package/dist/web-components/p-5bbd6e3c.entry.js +1 -0
  104. package/dist/web-components/p-5e6aabd8.entry.js +1 -0
  105. package/dist/web-components/p-656229de.entry.js +1 -0
  106. package/dist/web-components/p-6a4f3836.entry.js +1 -0
  107. package/dist/web-components/p-7775228c.entry.js +1 -0
  108. package/dist/web-components/{p-29a1e75f.entry.js → p-7ad8e78b.entry.js} +1 -1
  109. package/dist/web-components/p-8563a1ab.entry.js +1 -0
  110. package/dist/web-components/p-ad9b2a48.entry.js +1 -0
  111. package/dist/web-components/{p-e49b1ec3.entry.js → p-b2f03016.entry.js} +1 -1
  112. package/dist/web-components/p-b87ad83b.entry.js +1 -0
  113. package/dist/web-components/{p-77155630.entry.js → p-b98ab649.entry.js} +1 -1
  114. package/dist/web-components/{p-f1e22caa.entry.js → p-d1379ac6.entry.js} +1 -1
  115. package/dist/web-components/p-dbe579e8.entry.js +1 -0
  116. package/dist/web-components/p-f2577a3c.entry.js +1 -0
  117. package/dist/web-components/web-components.esm.js +1 -1
  118. package/package.json +6 -6
  119. package/dist/web-components/p-1ae69897.entry.js +0 -1
  120. package/dist/web-components/p-230e44ae.entry.js +0 -1
  121. package/dist/web-components/p-44be9992.entry.js +0 -1
  122. package/dist/web-components/p-4652635a.entry.js +0 -1
  123. package/dist/web-components/p-8028c2a9.entry.js +0 -1
  124. package/dist/web-components/p-828cb164.entry.js +0 -1
  125. package/dist/web-components/p-89136369.entry.js +0 -1
  126. package/dist/web-components/p-8c577cda.entry.js +0 -1
  127. package/dist/web-components/p-96ddeb7f.entry.js +0 -1
  128. package/dist/web-components/p-9b08e9ee.entry.js +0 -1
  129. package/dist/web-components/p-9eb1f262.entry.js +0 -1
  130. package/dist/web-components/p-a58124c4.entry.js +0 -1
  131. package/dist/web-components/p-a5be3395.entry.js +0 -1
  132. package/dist/web-components/p-b2cec978.entry.js +0 -1
  133. package/dist/web-components/p-d3ff65b0.entry.js +0 -1
  134. package/dist/web-components/p-f770e22b.entry.js +0 -1
@@ -98,24 +98,29 @@ export class InputCode {
98
98
  this.uniqueId = `r-input-code-${Date.now().toString(32)}${Math.random().toString(32)}`.replace(/\./g, '');
99
99
  this.nativeElement = null;
100
100
  this.getValidityStateData = (element) => {
101
- if (element.value.length === 0) {
102
- this.validityState = 'valueMissing';
103
- this.validityMessage = this.valueMissingMessage;
104
- return;
101
+ let validityState = '';
102
+ let validityMessage = '';
103
+ if (this.required && element.value.length === 0) {
104
+ validityState = 'valueMissing';
105
+ validityMessage = this.valueMissingMessage;
106
+ return { validityState, validityMessage };
105
107
  }
106
108
  if (element.value.length > 0 && element.value.length < this.length) {
107
- this.validityState = 'tooShort';
108
- this.validityMessage = this.tooShortMessage;
109
- return;
109
+ validityState = 'tooShort';
110
+ validityMessage = this.tooShortMessage;
111
+ return { validityState, validityMessage };
110
112
  }
111
- this.validityState = 'valid';
113
+ validityState = 'valid';
114
+ return { validityState, validityMessage };
112
115
  };
113
116
  this.validateFormElement = (element) => {
114
117
  if (element === null)
115
118
  return;
116
119
  if (this.isNoValidate)
117
120
  return;
118
- this.getValidityStateData(element);
121
+ const { validityState, validityMessage } = this.getValidityStateData(element);
122
+ this.validityState = validityState;
123
+ this.validityMessage = validityMessage;
119
124
  const isValid = this.validityState === 'valid';
120
125
  this.valid = isValid;
121
126
  this.invalid = !isValid;
@@ -180,6 +185,14 @@ export class InputCode {
180
185
  this.values = valueArray;
181
186
  this.rChange.emit({ value: this.values.join('') });
182
187
  }
188
+ /**
189
+ * Validates the input code without triggering UI and returns a boolean indicating its validity.
190
+ * @returns A boolean indicating whether the input code is valid.
191
+ */
192
+ async checkValidity() {
193
+ const { validityState } = this.getValidityStateData(this.nativeElement);
194
+ return validityState === 'valid';
195
+ }
183
196
  handleValuesChange() {
184
197
  this.value = this.values.join('');
185
198
  }
@@ -273,15 +286,15 @@ export class InputCode {
273
286
  id: `${uniqueId}-label`,
274
287
  fieldIndicator
275
288
  } : {};
276
- return (h(Host, { key: '7c77442f0a5b39e6baca0e0a19b07e5c28388267', value: this.value, onClick: this.onHostClick }, h("div", { key: 'e9d80a3cbb3f8afcbfce17da69bbe881112307c5', class: "r-input-code--label-container" }, h("label", { key: 'dfdc795d969466e71d82492dd142773fbad93f6b', htmlFor: uniqueId }, label ?
289
+ return (h(Host, { key: '2babfeef172a7d6b76c734f3170ede3a7a8d3392', value: this.value, onClick: this.onHostClick }, h("div", { key: '712d241caa9d80f982f831633009a8452c472a3c', class: "r-input-code--label-container" }, h("label", { key: '5a6be87bb1ab122cea9e2c7cefaf2781c39a9465', htmlFor: uniqueId }, label ?
277
290
  h("r-label", Object.assign({}, labelAttr), label)
278
291
  :
279
- h("slot", { name: "label" })), h("slot", { key: 'f68f02578abd8be8fceea4bdaf1af657f07f5327', name: "popover" })), hint &&
280
- h("r-hint", { key: '784b4a072ee504c99873d8e7744c1c055cbdd52a', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: 'b9b458b9b18859132145848135118aacf6c43ab2', class: "r-input-code--container", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.groupDescribedby }, h("slot", { key: '34d0391987a526d9672ff457fbfd34c153099dbc', name: "leading" }), Array.from({ length: this.length }).map((_, i) => (h("input", { class: "r-input-code--input", key: i, id: `${uniqueId}-input-section-${i}`, "aria-label": `${this.ariaCharacterLabel || 'Character'}: ${i + 1}`, "aria-invalid": `${this.invalid || false}`, value: this.values[i], ref: el => this.inputs[i] = el, maxlength: 1, disabled: this.disabled, required: this.required, readonly: readonly, onInput: this.createInputHandler(i), onKeyDown: this.createKeyDownHandler(i), onPaste: this.handlePaste }))), h("input", Object.assign({ key: '029bcca9a6907090058ea65de36cc3aea106ad25', type: "hidden" }, inputAttrs, { value: this.values.join(''), ref: el => this.nativeElement = el })), h("div", { key: 'a91256c17340a75fe1e5a7942c9ede1089bd477c', class: "r-input-code--trailing" }, this.readonly &&
281
- h("r-icon", { key: '28df1a0823e8b6c94a26fe8dac6838d663da26b7', class: "r-input-code--readonly-icon", name: "pen-disabled", size: "s" }), this.hasTrailingSlot &&
282
- h("slot", { key: '13dee654a15b7104fbe66408ba6c0a8d4b839a2c', name: "trailing" }, valid &&
283
- h("r-icon", { key: '85f0413d86b7366229fe07af87a7bdd5368f8a22', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" })))), h("slot", { key: 'cf9e23001dec5216a2c35144b9282dee25d5fe50', name: "message" }, this.hasMessage &&
284
- h("r-hint", { key: '0c642fbeef09ec9c5ce1e2a6272bb27160be05c0', "aria-live": "polite", id: `${uniqueId}-message`, variant: "error" }, this.message))));
292
+ h("slot", { name: "label" })), h("slot", { key: 'd7afacaedc1741fdf703f5263eda57dc3591b36d', name: "popover" })), hint &&
293
+ h("r-hint", { key: 'd49faa30ca4ebbefe7e88217392ef7f6a9487e7f', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '89deb68a39134cdacc1009e83113c589aafc311e', class: "r-input-code--container", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.groupDescribedby }, h("slot", { key: '170f25027ccf4d3603474a77a92c5ff24579e46e', name: "leading" }), Array.from({ length: this.length }).map((_, i) => (h("input", { class: "r-input-code--input", key: i, id: `${uniqueId}-input-section-${i}`, "aria-label": `${this.ariaCharacterLabel || 'Character'}: ${i + 1}`, "aria-invalid": `${this.invalid || false}`, value: this.values[i], ref: el => this.inputs[i] = el, maxlength: 1, disabled: this.disabled, required: this.required, readonly: readonly, onInput: this.createInputHandler(i), onKeyDown: this.createKeyDownHandler(i), onPaste: this.handlePaste }))), h("input", Object.assign({ key: '482c544b68d48b089f7177846cee7f5fc279bbd9', type: "hidden" }, inputAttrs, { value: this.values.join(''), ref: el => this.nativeElement = el })), h("div", { key: '73f393a98b3ca5e830e7b35c360cd9e242564d8e', class: "r-input-code--trailing" }, this.readonly &&
294
+ h("r-icon", { key: '751fb71619d0d0ea808332de4cc9e1b1f2dff59d', class: "r-input-code--readonly-icon", name: "pen-disabled", size: "s" }), this.hasTrailingSlot &&
295
+ h("slot", { key: '072e2f141e1ef3fbf931e9c0abf24d6c42f64ec5', name: "trailing" }, valid &&
296
+ h("r-icon", { key: '45b17f30472b9a5cc2e2101261f7884bd96d1d72', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" })))), h("slot", { key: 'b8be9bc6d2c14fa04312313709a7911d8339c735', name: "message" }, this.hasMessage &&
297
+ h("r-hint", { key: 'f76a1e5aa6d542790bdc01c7e931eda9a986a14b', "aria-live": "polite", id: `${uniqueId}-message`, variant: "error" }, this.message))));
285
298
  }
286
299
  static get is() { return "r-input-code"; }
287
300
  static get encapsulation() { return "shadow"; }
@@ -787,6 +800,26 @@ export class InputCode {
787
800
  "text": "Sets provided value.",
788
801
  "tags": []
789
802
  }
803
+ },
804
+ "checkValidity": {
805
+ "complexType": {
806
+ "signature": "() => Promise<boolean>",
807
+ "parameters": [],
808
+ "references": {
809
+ "Promise": {
810
+ "location": "global",
811
+ "id": "global::Promise"
812
+ }
813
+ },
814
+ "return": "Promise<boolean>"
815
+ },
816
+ "docs": {
817
+ "text": "Validates the input code without triggering UI and returns a boolean indicating its validity.",
818
+ "tags": [{
819
+ "name": "returns",
820
+ "text": "A boolean indicating whether the input code is valid."
821
+ }]
822
+ }
790
823
  }
791
824
  };
792
825
  }
@@ -35,7 +35,7 @@
35
35
  }
36
36
 
37
37
  :host([invalid]:not([invalid=false])) {
38
- --r-input-date--container--border-color: var(--r-status-error-regular, #da1e28);
38
+ --r-input-date--container--border-color: var(--r-status-error-regular, #b00c15);
39
39
  --r-input-date--container--background-color: var(--r-status-error-soft, #fef6f6);
40
40
  }
41
41
 
@@ -22,6 +22,10 @@ export class InputDate {
22
22
  this.validityState = '';
23
23
  /** Validity message passed from validateFormElement function after validation */
24
24
  this.validityMessage = '';
25
+ /** Defines if the component has been touched by user */
26
+ this.touched = false;
27
+ /** Defines if the value has been changed by user interaction */
28
+ this.dirty = false;
25
29
  /**
26
30
  * Initial attributes state
27
31
  * */
@@ -112,6 +116,7 @@ export class InputDate {
112
116
  if (this.readonly)
113
117
  return;
114
118
  if (event.code === 'Enter') {
119
+ this.touched = true;
115
120
  this.validateFormElement(this.nativeElement);
116
121
  if (this.invalid && !this.isNoValidate)
117
122
  return;
@@ -162,6 +167,8 @@ export class InputDate {
162
167
  if (this.readonly)
163
168
  return;
164
169
  this.value = event.clipboardData.getData('text');
170
+ this.touched = true;
171
+ this.dirty = true;
165
172
  event.preventDefault();
166
173
  };
167
174
  this.createInputHandler = (input, index) => {
@@ -179,7 +186,10 @@ export class InputDate {
179
186
  index < this.inputOrder.length - 1) {
180
187
  (_c = this.inputs[index + 1]) === null || _c === void 0 ? void 0 : _c.focus();
181
188
  }
189
+ this.touched = true;
190
+ this.dirty = true;
182
191
  this.rInput.emit({ element: this.host, value: this.value });
192
+ this.validateFormElement(this.nativeElement);
183
193
  };
184
194
  this.createChangeHandler = (input) => {
185
195
  return (e) => this.handleChange(input, e);
@@ -192,29 +202,64 @@ export class InputDate {
192
202
  event.target.value = value;
193
203
  this.setDateComponent(input, value);
194
204
  this.value = this.inputOrder.map((el) => this.getDateComponent(el)).join(this.delimiter);
205
+ this.touched = true;
206
+ this.dirty = true;
195
207
  this.rChange.emit({ element: this.host, value: this.value });
196
208
  this.validateFormElement(this.nativeElement);
197
209
  };
210
+ this.handleBlur = () => {
211
+ this.touched = true;
212
+ this.validateFormElement(this.nativeElement);
213
+ };
198
214
  this.getValidityStateData = (element) => {
215
+ let validityState = '';
216
+ let validityMessage = '';
199
217
  if (this.required && element.value.length === 0) {
200
- this.validityState = 'valueMissing';
201
- this.validityMessage = this.valueMissingMessage;
202
- return;
218
+ validityState = 'valueMissing';
219
+ validityMessage = this.valueMissingMessage;
220
+ return { validityState, validityMessage };
203
221
  }
204
- const valid = dayjs(this.value, this.format, true).isValid();
222
+ const valid = this.value ? dayjs(this.value, this.format, true).isValid() : true;
205
223
  if (!valid) {
206
- this.validityState = 'invalid';
207
- this.validityMessage = this.invalidDateMessage;
208
- return;
224
+ validityState = 'invalid';
225
+ validityMessage = this.invalidDateMessage;
226
+ return { validityState, validityMessage };
227
+ }
228
+ // Check min/max constraints only if date is valid and has a value
229
+ // Note: min and max are expected to be in the same format as this.format
230
+ // If format changes, the developer should update min/max accordingly
231
+ if (this.value && valid) {
232
+ const currentDate = dayjs(this.value, this.format, true);
233
+ // Check minimum date constraint
234
+ if (this.min) {
235
+ const minDate = dayjs(this.min, this.format, true);
236
+ if (minDate.isValid() && currentDate.isBefore(minDate, 'day')) {
237
+ validityState = 'rangeUnderflow';
238
+ validityMessage = this.rangeUnderflowMessage;
239
+ return { validityState, validityMessage };
240
+ }
241
+ }
242
+ // Check maximum date constraint
243
+ if (this.max) {
244
+ const maxDate = dayjs(this.max, this.format, true);
245
+ if (maxDate.isValid() && currentDate.isAfter(maxDate, 'day')) {
246
+ validityState = 'rangeOverflow';
247
+ validityMessage = this.rangeOverflowMessage;
248
+ return { validityState, validityMessage };
249
+ }
250
+ }
209
251
  }
210
- this.validityState = 'valid';
252
+ validityState = 'valid';
253
+ return { validityState, validityMessage };
211
254
  };
212
255
  this.validateFormElement = (element) => {
213
256
  if (element === null)
214
257
  return;
215
258
  if (this.isNoValidate)
216
259
  return;
217
- this.getValidityStateData(element);
260
+ const { validityState, validityMessage } = this.getValidityStateData(element);
261
+ this.validityState = validityState;
262
+ this.validityMessage = validityMessage;
218
263
  const isValid = this.validityState === 'valid';
219
264
  this.valid = isValid;
220
265
  this.invalid = !isValid;
@@ -263,6 +308,8 @@ export class InputDate {
263
308
  }
264
309
  handleValueChange() {
265
310
  this.setCurrentValues();
311
+ if (this.touched)
312
+ this.validateFormElement(this.nativeElement);
266
313
  }
267
314
  /** Get the date value */
268
315
  async getValue() {
@@ -270,6 +317,7 @@ export class InputDate {
270
317
  }
271
318
  /** Sets the date value */
272
319
  async setValue(value) {
320
+ this.nativeElement.value = value;
273
321
  this.value = value;
274
322
  }
275
323
  /** Gets the current date format */
@@ -280,6 +328,19 @@ export class InputDate {
280
328
  async setFormat(format) {
281
329
  this.format = format;
282
330
  }
331
+ /** Gets the touched state (whether user has interacted with the input) */
332
+ async isTouched() {
333
+ return this.touched;
334
+ }
335
+ /** Gets the dirty state (whether value has been changed by user) */
336
+ async isDirty() {
337
+ return this.dirty;
338
+ }
339
+ /** Resets touched and dirty states to pristine (untouched/clean) */
340
+ async markAsPristine() {
341
+ this.touched = false;
342
+ this.dirty = false;
343
+ }
283
344
  /**
284
345
  * Resets the component by clearing all input values and focusing the first input.
285
346
  * @returns Promise that resolves when reset is complete
@@ -287,6 +348,7 @@ export class InputDate {
287
348
  async reset() {
288
349
  if (this.readonly)
289
350
  return;
351
+ this.markAsPristine();
290
352
  this.validityState = null;
291
353
  this.validityMessage = null;
292
354
  this.value = this.initial['value'];
@@ -294,6 +356,14 @@ export class InputDate {
294
356
  this.format = this.initial['format'];
295
357
  this.valid = !this.invalid;
296
358
  }
359
+ /**
360
+ * Validates the input date without triggering UI and returns a boolean indicating its validity.
361
+ * @returns A boolean indicating whether the input date is valid.
362
+ */
363
+ async checkValidity() {
364
+ const { validityState } = this.getValidityStateData(this.nativeElement);
365
+ return validityState === 'valid';
366
+ }
297
367
  get inputs() {
298
368
  return Array.from(this.host.shadowRoot.querySelectorAll('input[data-date-type]'));
299
369
  }
@@ -387,14 +457,14 @@ export class InputDate {
387
457
  id: `${uniqueId}-label`,
388
458
  fieldIndicator
389
459
  } : {};
390
- return (h(Host, { key: '8a1395ebe9606836eeca8c63958dd2c904901cc5', onClick: this.onHostClick }, h("fieldset", Object.assign({ key: '67eda3917e37c76e22dba41a3f168f25542b3e74', class: "r-input-date" }, groupAttrs), h("div", { key: '2e1c2fc3ff538cbaeb79cea6728a0fc01a3cfafe', class: "r-input-date--legend-container" }, h("legend", { key: '0f41209fd3934af15d17a60c366ae95cb7b0ffab', class: "r-input-date--legend" }, h("label", { key: '406ee340682dc64d75aacfe33456ed3d819b1a7d', htmlFor: uniqueId }, label ?
460
+ return (h(Host, { key: '00e6bbea2dcaf1e88b4587fa9df6165a2c28c134', onClick: this.onHostClick, "data-touched": `${this.touched}`, "data-dirty": `${this.dirty}` }, h("fieldset", Object.assign({ key: '94d107ad0f00608263df3f47b0c2240d93a01c4e', class: "r-input-date" }, groupAttrs), h("div", { key: '3ac5991c7b8754f2fa94c8053f60af17a99301e0', class: "r-input-date--legend-container" }, h("legend", { key: '62fc7c2b6af2f7911c11f135432323621dd278b8', class: "r-input-date--legend" }, h("label", { key: 'd161f2b149ca1295c6e96746520c6ef1cf2e23ba', htmlFor: uniqueId }, label ?
391
461
  h("r-label", Object.assign({}, labelAttr, tooltipAttrs), label)
392
462
  :
393
- h("slot", { name: "label" }))), h("slot", { key: '825c6e93994dd54738f3168e782066787c48af5c', name: "popover" })), hint &&
394
- h("r-hint", { key: '9cee9fa8904d8fc1a1968c4a2a12caed9a708cfb', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '60db93b0f58918d1ab087455fc495b093175dca4', class: "r-input-date--container" }, h("r-icon", { key: '74a495cb61d248a3d10422c6e28bde310684a7e9', name: "calendar", size: "s", class: "r-input-date--calendar-icon" }), h("div", { key: '59d28137260f613ef9f404821e6dc2b6624fb455', class: "r-input-date--inputs" }, this.inputOrder.map((input, i) => (h(Fragment, null, h("input", Object.assign({ class: "r-input-date--input" }, this.getInputAttrs(input), { key: input, value: this.getDateComponent(input), onInput: this.createInputHandler(input, i), onChange: this.createChangeHandler(input), onClick: this.onInputClick, onKeyDown: this.createKeyDownHandler(i), onPaste: this.handlePaste })), i < this.inputOrder.length - 1 &&
395
- h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: '9723d0a2417bf427a5a1ff4690f8745cc40899a0', type: "hidden" }, dateInputAttrs, { value: this.value, ref: (el) => this.nativeElement = el }))), h("div", { key: '65997938c00455e81becba759dc3fdadeeecc1e4', class: "r-input-date--trailing" }, this.readonly &&
396
- h("r-icon", { key: '750df4d848ef7d0e7a6b9a7b7853a3389da44232', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
397
- h("r-icon", { key: 'b24b8ea8a53b423c0060ac6a34d75ea7ad192b94', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }), this.hasTrailingSlot && h("slot", { key: '147d79539620af0051addf49d7e237c2a3428ff4', name: "trailing" }))), h("div", { key: 'e6b2bccd8d97560940805a08f420f5fc9b165649', id: `${uniqueId}-message`, "aria-live": "polite", class: "r-input-date--message" }, this.hasMessage && h("r-hint", { key: 'd4807c998838bf7a6c748a4555901e66f2ef92d0', variant: "error" }, this.message)))));
463
+ h("slot", { name: "label" }))), h("slot", { key: '81c9e7753273c5e7d6db5d6a1f0fad8398a57c0a', name: "popover" })), hint &&
464
+ h("r-hint", { key: '0814c3ef100ed6a8512b2f15d5b59e01664bd811', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '65247f18a297ef6a5751ab86e1123271ed8759f7', class: "r-input-date--container" }, h("r-icon", { key: 'fce4150b7c1b801752e1a67339b1a599728b0631', name: "calendar", size: "s", class: "r-input-date--calendar-icon" }), h("div", { key: '3b5e4776102b06acd9626477c702d2dc52ef681c', class: "r-input-date--inputs" }, this.inputOrder.map((input, i) => (h(Fragment, null, h("input", Object.assign({ class: "r-input-date--input" }, this.getInputAttrs(input), { key: input, value: this.getDateComponent(input), onInput: this.createInputHandler(input, i), onChange: this.createChangeHandler(input), onClick: this.onInputClick, onBlur: this.handleBlur, onKeyDown: this.createKeyDownHandler(i), onPaste: this.handlePaste })), i < this.inputOrder.length - 1 &&
465
+ h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: '2c181871c97962a35988eb406c09a05c8f27181d', type: "hidden" }, dateInputAttrs, { value: this.value, ref: (el) => this.nativeElement = el }))), h("div", { key: '8c694c11cc7ea4ecc23484d3f014cc865e0c56ad', class: "r-input-date--trailing" }, this.readonly &&
466
+ h("r-icon", { key: '8ed65eaef19f280381b7c0fae206163f3adeb5f4', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
467
+ h("r-icon", { key: 'aef55123b4b001576b482e0be4eff0df6dc97930', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }), this.hasTrailingSlot && h("slot", { key: 'd92dcda80b7434af1f8ed781329ce8f2e6734225', name: "trailing" }))), h("div", { key: '139792ccc090b29f041e3a731f65e5916379b911', id: `${uniqueId}-message`, "aria-live": "polite", class: "r-input-date--message" }, this.hasMessage && h("r-hint", { key: '74d444c9748c032e844c0772b8758873bdaef391', variant: "error" }, this.message)))));
398
468
  }
399
469
  static get is() { return "r-input-date"; }
400
470
  static get encapsulation() { return "shadow"; }
@@ -858,6 +928,82 @@ export class InputDate {
858
928
  "setter": false,
859
929
  "reflect": false
860
930
  },
931
+ "min": {
932
+ "type": "string",
933
+ "attribute": "min",
934
+ "mutable": false,
935
+ "complexType": {
936
+ "original": "string",
937
+ "resolved": "string",
938
+ "references": {}
939
+ },
940
+ "required": false,
941
+ "optional": true,
942
+ "docs": {
943
+ "tags": [],
944
+ "text": "Minimum date value (in the same format as the date input).\nNote: When changing the `format` prop, ensure `min` is also updated to match the new format."
945
+ },
946
+ "getter": false,
947
+ "setter": false,
948
+ "reflect": true
949
+ },
950
+ "max": {
951
+ "type": "string",
952
+ "attribute": "max",
953
+ "mutable": false,
954
+ "complexType": {
955
+ "original": "string",
956
+ "resolved": "string",
957
+ "references": {}
958
+ },
959
+ "required": false,
960
+ "optional": true,
961
+ "docs": {
962
+ "tags": [],
963
+ "text": "Maximum date value (in the same format as the date input).\nNote: When changing the `format` prop, ensure `max` is also updated to match the new format."
964
+ },
965
+ "getter": false,
966
+ "setter": false,
967
+ "reflect": true
968
+ },
969
+ "rangeUnderflowMessage": {
970
+ "type": "string",
971
+ "attribute": "range-underflow-message",
972
+ "mutable": false,
973
+ "complexType": {
974
+ "original": "string",
975
+ "resolved": "string",
976
+ "references": {}
977
+ },
978
+ "required": false,
979
+ "optional": true,
980
+ "docs": {
981
+ "tags": [],
982
+ "text": "Custom error message displayed when date is before the minimum date."
983
+ },
984
+ "getter": false,
985
+ "setter": false,
986
+ "reflect": false
987
+ },
988
+ "rangeOverflowMessage": {
989
+ "type": "string",
990
+ "attribute": "range-overflow-message",
991
+ "mutable": false,
992
+ "complexType": {
993
+ "original": "string",
994
+ "resolved": "string",
995
+ "references": {}
996
+ },
997
+ "required": false,
998
+ "optional": true,
999
+ "docs": {
1000
+ "tags": [],
1001
+ "text": "Custom error message displayed when date is after the maximum date."
1002
+ },
1003
+ "getter": false,
1004
+ "setter": false,
1005
+ "reflect": false
1006
+ },
861
1007
  "customErrorMessage": {
862
1008
  "type": "string",
863
1009
  "attribute": "custom-error-message",
@@ -884,7 +1030,9 @@ export class InputDate {
884
1030
  "currentValues": {},
885
1031
  "delimiter": {},
886
1032
  "validityState": {},
887
- "validityMessage": {}
1033
+ "validityMessage": {},
1034
+ "touched": {},
1035
+ "dirty": {}
888
1036
  };
889
1037
  }
890
1038
  static get events() {
@@ -1043,6 +1191,57 @@ export class InputDate {
1043
1191
  "tags": []
1044
1192
  }
1045
1193
  },
1194
+ "isTouched": {
1195
+ "complexType": {
1196
+ "signature": "() => Promise<boolean>",
1197
+ "parameters": [],
1198
+ "references": {
1199
+ "Promise": {
1200
+ "location": "global",
1201
+ "id": "global::Promise"
1202
+ }
1203
+ },
1204
+ "return": "Promise<boolean>"
1205
+ },
1206
+ "docs": {
1207
+ "text": "Gets the touched state (whether user has interacted with the input)",
1208
+ "tags": []
1209
+ }
1210
+ },
1211
+ "isDirty": {
1212
+ "complexType": {
1213
+ "signature": "() => Promise<boolean>",
1214
+ "parameters": [],
1215
+ "references": {
1216
+ "Promise": {
1217
+ "location": "global",
1218
+ "id": "global::Promise"
1219
+ }
1220
+ },
1221
+ "return": "Promise<boolean>"
1222
+ },
1223
+ "docs": {
1224
+ "text": "Gets the dirty state (whether value has been changed by user)",
1225
+ "tags": []
1226
+ }
1227
+ },
1228
+ "markAsPristine": {
1229
+ "complexType": {
1230
+ "signature": "() => Promise<void>",
1231
+ "parameters": [],
1232
+ "references": {
1233
+ "Promise": {
1234
+ "location": "global",
1235
+ "id": "global::Promise"
1236
+ }
1237
+ },
1238
+ "return": "Promise<void>"
1239
+ },
1240
+ "docs": {
1241
+ "text": "Resets touched and dirty states to pristine (untouched/clean)",
1242
+ "tags": []
1243
+ }
1244
+ },
1046
1245
  "reset": {
1047
1246
  "complexType": {
1048
1247
  "signature": "() => Promise<void>",
@@ -1062,6 +1261,26 @@ export class InputDate {
1062
1261
  "text": "Promise that resolves when reset is complete"
1063
1262
  }]
1064
1263
  }
1264
+ },
1265
+ "checkValidity": {
1266
+ "complexType": {
1267
+ "signature": "() => Promise<boolean>",
1268
+ "parameters": [],
1269
+ "references": {
1270
+ "Promise": {
1271
+ "location": "global",
1272
+ "id": "global::Promise"
1273
+ }
1274
+ },
1275
+ "return": "Promise<boolean>"
1276
+ },
1277
+ "docs": {
1278
+ "text": "Validates the input date without triggering UI and returns a boolean indicating its validity.",
1279
+ "tags": [{
1280
+ "name": "returns",
1281
+ "text": "A boolean indicating whether the input date is valid."
1282
+ }]
1283
+ }
1065
1284
  }
1066
1285
  };
1067
1286
  }
@@ -51,16 +51,19 @@ export class InputPassword {
51
51
  this.rChange.emit({ element: host, value });
52
52
  };
53
53
  this.getValidityStateData = (element) => {
54
+ let validityState = '';
55
+ let validityMessage = '';
54
56
  for (const state in element.validity) {
55
57
  if (element.validity[state]) {
56
- this.validityState = state;
58
+ validityState = state;
57
59
  if (this[state + 'Message']) {
58
- this.validityMessage = this[state + 'Message'];
59
- return;
60
+ validityMessage = this[state + 'Message'];
61
+ return { validityState, validityMessage };
60
62
  }
61
- this.validityMessage = element.validationMessage;
63
+ validityMessage = element.validationMessage;
62
64
  }
63
65
  }
66
+ return { validityState, validityMessage };
64
67
  };
65
68
  this.validateFormElement = (element) => {
66
69
  if (element === null)
@@ -69,7 +72,9 @@ export class InputPassword {
69
72
  return;
70
73
  if (this.error)
71
74
  return;
72
- this.getValidityStateData(element.shadowRoot.querySelector('input'));
75
+ const { validityState, validityMessage } = this.getValidityStateData(element.shadowRoot.querySelector('input'));
76
+ this.validityState = validityState;
77
+ this.validityMessage = validityMessage;
73
78
  const isValid = this.validityState === 'valid';
74
79
  this.valid = isValid;
75
80
  this.invalid = !isValid;
@@ -147,11 +152,22 @@ export class InputPassword {
147
152
  }
148
153
  /** Get the input value */
149
154
  async getValue() {
150
- return this.nativeElement.getValue();
155
+ return this.value || '';
151
156
  }
152
157
  /** Set the input value */
153
158
  async setValue(value) {
154
- this.nativeElement.value = value;
159
+ if (this.readonly)
160
+ return;
161
+ this.value = value;
162
+ this.validateFormElement(this.nativeElement);
163
+ }
164
+ /**
165
+ * Validates the input password without triggering UI and returns a boolean indicating its validity.
166
+ * @returns A boolean indicating whether the input password is valid.
167
+ */
168
+ async checkValidity() {
169
+ const { validityState } = this.getValidityStateData(this.nativeElement.shadowRoot.querySelector('input'));
170
+ return validityState === 'valid';
155
171
  }
156
172
  /** Identify wrapping form element */
157
173
  get parentFormEl() {
@@ -221,8 +237,8 @@ export class InputPassword {
221
237
  novalidate: true,
222
238
  readonly
223
239
  };
224
- return (h(Host, { key: '7ab5b4c4eb280f906cbabcc0d1ffa823d7b67bd1' }, h("r-input", Object.assign({ key: '0b71f3034611c2ed0d82b91dd8b9d98649ebd63f' }, inputAttrs, { ref: (el) => this.nativeElement = el, type: showed ? 'text' : 'password', onRInput: this.onInput, onRChange: this.onChange, onKeyUp: this.handleKeyup, onRBlur: this.handleBlur }), h("r-icon", { key: '5cf30f89fead0941ebf8f388f4380e7be82222b9', name: "padlock-closed", size: "s", slot: "leading" }), h("slot", { key: '921d8abefcef0bb71b2a518db1cba0c263b8924a', name: "popover", slot: "popover" }), h("r-icon-button", { key: '3b005036b4110685e4abf54add5bbe2571f2cf1b', slot: "trailing", name: showed ? 'eye-crossed-out' : 'eye', size: "s", disabled: disabled, label: showed ? hidePasswordAriaLabel : showPasswordAriaLabel, onClick: this.onShowClick }), this.hasMessage &&
225
- h("r-hint", { key: 'b5c7af864da0a47d81b40c1aa53f6bed20bc8349', slot: "message", variant: "error" }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))), h("div", { key: 'f3d2f7ad5811e716eb2184aad5ff25f5a282078d', class: "visually-hidden", ref: el => this.passwordVisibilityChangeAlertContainer = el, "aria-live": "polite" })));
240
+ return (h(Host, { key: '810ae74cdcdcd8a4289255e2b99b6cfc213330ac' }, h("r-input", Object.assign({ key: '55027ca5cd8b8ba4eade60067ac182e38eaf1bfa' }, inputAttrs, { ref: (el) => this.nativeElement = el, type: showed ? 'text' : 'password', onRInput: this.onInput, onRChange: this.onChange, onKeyUp: this.handleKeyup, onRBlur: this.handleBlur }), h("r-icon", { key: '935aa481c0eff444462e6be6d8e6975db8a24708', name: "padlock-closed", size: "s", slot: "leading" }), h("slot", { key: 'df29bd4fa96db1c1f5f70be9c44fab1b9c5f02be', name: "popover", slot: "popover" }), h("r-icon-button", { key: '95d5f3c5e64eb7b43364db7aff943d35fbdc4d2d', slot: "trailing", name: showed ? 'eye-crossed-out' : 'eye', size: "s", disabled: disabled, label: showed ? hidePasswordAriaLabel : showPasswordAriaLabel, onClick: this.onShowClick }), this.hasMessage &&
241
+ h("r-hint", { key: '7390d667a69c4ae5c2c6ae480eaf5f879ad6ed78', slot: "message", variant: "error" }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))), h("div", { key: 'c70c38f1249c80973bb2fe2a25ddf7d88835c686', class: "visually-hidden", ref: el => this.passwordVisibilityChangeAlertContainer = el, "aria-live": "polite" })));
226
242
  }
227
243
  static get is() { return "r-input-password"; }
228
244
  static get encapsulation() { return "shadow"; }
@@ -883,6 +899,26 @@ export class InputPassword {
883
899
  "text": "Set the input value",
884
900
  "tags": []
885
901
  }
902
+ },
903
+ "checkValidity": {
904
+ "complexType": {
905
+ "signature": "() => Promise<boolean>",
906
+ "parameters": [],
907
+ "references": {
908
+ "Promise": {
909
+ "location": "global",
910
+ "id": "global::Promise"
911
+ }
912
+ },
913
+ "return": "Promise<boolean>"
914
+ },
915
+ "docs": {
916
+ "text": "Validates the input password without triggering UI and returns a boolean indicating its validity.",
917
+ "tags": [{
918
+ "name": "returns",
919
+ "text": "A boolean indicating whether the input password is valid."
920
+ }]
921
+ }
886
922
  }
887
923
  };
888
924
  }