@riverty/web-components 5.7.0 → 6.0.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 (273) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/custom-elements.json +152 -372
  3. package/dist/cjs/index-DJ4H_bFj.js +6 -10
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/r-accordion-panel.cjs.entry.js +1 -1
  6. package/dist/cjs/r-accordion-section.cjs.entry.js +1 -1
  7. package/dist/cjs/r-accordion-trigger.cjs.entry.js +5 -35
  8. package/dist/cjs/r-accordion.cjs.entry.js +3 -7
  9. package/dist/cjs/r-alert.cjs.entry.js +45 -14
  10. package/dist/cjs/r-badge.cjs.entry.js +1 -1
  11. package/dist/cjs/r-button.cjs.entry.js +2 -2
  12. package/dist/cjs/r-checkbox-group.cjs.entry.js +28 -24
  13. package/dist/cjs/r-checkbox.cjs.entry.js +97 -81
  14. package/dist/cjs/r-dialog.cjs.entry.js +3 -11
  15. package/dist/cjs/r-hint_2.cjs.entry.js +50 -0
  16. package/dist/cjs/{r-hint_3.cjs.entry.js → r-icon-button_2.cjs.entry.js} +64 -51
  17. package/dist/cjs/r-icon.cjs.entry.js +1 -1
  18. package/dist/cjs/r-input-code.cjs.entry.js +133 -25
  19. package/dist/cjs/r-input-date.cjs.entry.js +87 -23
  20. package/dist/cjs/r-input-password.cjs.entry.js +34 -13
  21. package/dist/cjs/r-input-phone-number.cjs.entry.js +30 -22
  22. package/dist/cjs/r-input.cjs.entry.js +108 -49
  23. package/dist/cjs/r-list-item.cjs.entry.js +5 -5
  24. package/dist/cjs/r-pagination.cjs.entry.js +1 -1
  25. package/dist/cjs/r-panel.cjs.entry.js +2 -2
  26. package/dist/cjs/r-popover-action.cjs.entry.js +2 -2
  27. package/dist/cjs/r-popover-content.cjs.entry.js +1 -1
  28. package/dist/cjs/r-popover-headline.cjs.entry.js +1 -1
  29. package/dist/cjs/r-popover-trigger.cjs.entry.js +1 -1
  30. package/dist/cjs/r-popover.cjs.entry.js +3 -3
  31. package/dist/cjs/r-progress-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/r-radio-button-description.cjs.entry.js +1 -1
  33. package/dist/cjs/r-radio-button-leading.cjs.entry.js +1 -1
  34. package/dist/cjs/r-radio-button-title.cjs.entry.js +1 -1
  35. package/dist/cjs/r-radio-button-trailing.cjs.entry.js +1 -1
  36. package/dist/cjs/r-radio-button.cjs.entry.js +29 -12
  37. package/dist/cjs/r-radio-group.cjs.entry.js +32 -32
  38. package/dist/cjs/r-select-option.cjs.entry.js +1 -1
  39. package/dist/cjs/r-select.cjs.entry.js +116 -40
  40. package/dist/cjs/r-skip-link.cjs.entry.js +1 -1
  41. package/dist/cjs/r-stepper-item.cjs.entry.js +2 -2
  42. package/dist/cjs/r-stepper.cjs.entry.js +1 -1
  43. package/dist/cjs/r-tab-panel.cjs.entry.js +1 -1
  44. package/dist/cjs/r-tab.cjs.entry.js +1 -1
  45. package/dist/cjs/r-tabs-list.cjs.entry.js +1 -1
  46. package/dist/cjs/r-tabs.cjs.entry.js +1 -1
  47. package/dist/cjs/r-textarea.cjs.entry.js +24 -23
  48. package/dist/cjs/r-toast-group.cjs.entry.js +1 -1
  49. package/dist/cjs/r-toast.cjs.entry.js +51 -20
  50. package/dist/cjs/web-components.cjs.js +1 -1
  51. package/dist/collection/collection-manifest.json +0 -1
  52. package/dist/collection/components/accordion/accordion.css +0 -2
  53. package/dist/collection/components/accordion/accordion.js +4 -8
  54. package/dist/collection/components/accordion/exports.js +1 -1
  55. package/dist/collection/components/accordion-panel/accordion-panel.js +1 -1
  56. package/dist/collection/components/accordion-section/accordion-section.js +1 -1
  57. package/dist/collection/components/accordion-trigger/accordion-trigger.css +0 -4
  58. package/dist/collection/components/accordion-trigger/accordion-trigger.js +4 -215
  59. package/dist/collection/components/alert/alert.css +58 -12
  60. package/dist/collection/components/alert/alert.js +92 -17
  61. package/dist/collection/components/alert/exports.js +1 -1
  62. package/dist/collection/components/badge/badge.js +1 -1
  63. package/dist/collection/components/button/button.css +6 -7
  64. package/dist/collection/components/button/button.js +1 -1
  65. package/dist/collection/components/checkbox/checkbox.js +121 -104
  66. package/dist/collection/components/checkbox-group/checkbox-group.js +48 -63
  67. package/dist/collection/components/dialog/dialog.css +1 -3
  68. package/dist/collection/components/dialog/dialog.js +2 -10
  69. package/dist/collection/components/hint/hint.js +2 -2
  70. package/dist/collection/components/icon/bundled-icons/riverty-kit.json +1 -1
  71. package/dist/collection/components/icon/riverty-kit.js +1 -1
  72. package/dist/collection/components/icon-button/icon-button.css +0 -7
  73. package/dist/collection/components/icon-button/icon-button.js +3 -3
  74. package/dist/collection/components/input/input.css +3 -0
  75. package/dist/collection/components/input/input.js +221 -378
  76. package/dist/collection/components/input-code/exports.js +2 -0
  77. package/dist/collection/components/input-code/input-code.js +335 -34
  78. package/dist/collection/components/input-date/input-date.js +237 -87
  79. package/dist/collection/components/input-password/exports.js +1 -0
  80. package/dist/collection/components/input-password/input-password.css +1 -0
  81. package/dist/collection/components/input-password/input-password.js +233 -75
  82. package/dist/collection/components/input-phone-number/input-phone-number.js +50 -85
  83. package/dist/collection/components/label/label.js +3 -113
  84. package/dist/collection/components/list-item/list-item/list-item.css +7 -7
  85. package/dist/collection/components/list-item/list-item/list-item.js +4 -26
  86. package/dist/collection/components/pagination/pagination.css +23 -23
  87. package/dist/collection/components/panel/panel.js +2 -2
  88. package/dist/collection/components/popover/exports.js +0 -1
  89. package/dist/collection/components/popover/popover.css +13 -13
  90. package/dist/collection/components/popover/popover.js +2 -55
  91. package/dist/collection/components/popover-action/popover-action.css +3 -5
  92. package/dist/collection/components/popover-action/popover-action.js +1 -1
  93. package/dist/collection/components/popover-content/popover-content.js +1 -1
  94. package/dist/collection/components/popover-headline/popover-headline.js +1 -1
  95. package/dist/collection/components/popover-trigger/popover-trigger.js +1 -1
  96. package/dist/collection/components/progress-bar/progress-bar.js +1 -1
  97. package/dist/collection/components/radio-button/radio-button.js +49 -12
  98. package/dist/collection/components/radio-button-description/radio-button-description.js +1 -1
  99. package/dist/collection/components/radio-button-leading/radio-button-leading.js +1 -1
  100. package/dist/collection/components/radio-button-title/radio-button-title.js +1 -1
  101. package/dist/collection/components/radio-button-trailing/radio-button-trailing.js +1 -1
  102. package/dist/collection/components/radio-group/radio-group.js +53 -135
  103. package/dist/collection/components/select/select.js +197 -349
  104. package/dist/collection/components/select-option/select-option.js +1 -1
  105. package/dist/collection/components/skip-link/skip-link.js +1 -1
  106. package/dist/collection/components/stepper/stepper.js +1 -1
  107. package/dist/collection/components/stepper-item/stepper-item.js +2 -2
  108. package/dist/collection/components/tab/tab.js +1 -1
  109. package/dist/collection/components/tab-panel/tab-panel.js +1 -1
  110. package/dist/collection/components/tabs/tabs.js +1 -1
  111. package/dist/collection/components/tabs-list/tabs-list.js +1 -1
  112. package/dist/collection/components/textarea/textarea.js +44 -163
  113. package/dist/collection/components/toast/toast.css +22 -14
  114. package/dist/collection/components/toast/toast.js +95 -43
  115. package/dist/collection/components/toast-group/toast-group.js +1 -1
  116. package/dist/collection/components/tooltip/tooltip.js +1 -1
  117. package/dist/esm/index-Da7qOBFr.js +6 -10
  118. package/dist/esm/loader.js +1 -1
  119. package/dist/esm/r-accordion-panel.entry.js +1 -1
  120. package/dist/esm/r-accordion-section.entry.js +1 -1
  121. package/dist/esm/r-accordion-trigger.entry.js +5 -35
  122. package/dist/esm/r-accordion.entry.js +3 -7
  123. package/dist/esm/r-alert.entry.js +45 -14
  124. package/dist/esm/r-badge.entry.js +1 -1
  125. package/dist/esm/r-button.entry.js +2 -2
  126. package/dist/esm/r-checkbox-group.entry.js +28 -24
  127. package/dist/esm/r-checkbox.entry.js +97 -81
  128. package/dist/esm/r-dialog.entry.js +3 -11
  129. package/dist/esm/r-hint_2.entry.js +47 -0
  130. package/dist/esm/{r-hint_3.entry.js → r-icon-button_2.entry.js} +65 -51
  131. package/dist/esm/r-icon.entry.js +1 -1
  132. package/dist/esm/r-input-code.entry.js +133 -25
  133. package/dist/esm/r-input-date.entry.js +87 -23
  134. package/dist/esm/r-input-password.entry.js +34 -13
  135. package/dist/esm/r-input-phone-number.entry.js +30 -22
  136. package/dist/esm/r-input.entry.js +108 -49
  137. package/dist/esm/r-list-item.entry.js +5 -5
  138. package/dist/esm/r-pagination.entry.js +1 -1
  139. package/dist/esm/r-panel.entry.js +2 -2
  140. package/dist/esm/r-popover-action.entry.js +2 -2
  141. package/dist/esm/r-popover-content.entry.js +1 -1
  142. package/dist/esm/r-popover-headline.entry.js +1 -1
  143. package/dist/esm/r-popover-trigger.entry.js +1 -1
  144. package/dist/esm/r-popover.entry.js +3 -3
  145. package/dist/esm/r-progress-bar.entry.js +1 -1
  146. package/dist/esm/r-radio-button-description.entry.js +1 -1
  147. package/dist/esm/r-radio-button-leading.entry.js +1 -1
  148. package/dist/esm/r-radio-button-title.entry.js +1 -1
  149. package/dist/esm/r-radio-button-trailing.entry.js +1 -1
  150. package/dist/esm/r-radio-button.entry.js +29 -12
  151. package/dist/esm/r-radio-group.entry.js +32 -32
  152. package/dist/esm/r-select-option.entry.js +1 -1
  153. package/dist/esm/r-select.entry.js +116 -40
  154. package/dist/esm/r-skip-link.entry.js +1 -1
  155. package/dist/esm/r-stepper-item.entry.js +2 -2
  156. package/dist/esm/r-stepper.entry.js +1 -1
  157. package/dist/esm/r-tab-panel.entry.js +1 -1
  158. package/dist/esm/r-tab.entry.js +1 -1
  159. package/dist/esm/r-tabs-list.entry.js +1 -1
  160. package/dist/esm/r-tabs.entry.js +1 -1
  161. package/dist/esm/r-textarea.entry.js +24 -23
  162. package/dist/esm/r-toast-group.entry.js +1 -1
  163. package/dist/esm/r-toast.entry.js +51 -20
  164. package/dist/esm/web-components.js +1 -1
  165. package/dist/types/components/accordion/accordion.d.ts +1 -5
  166. package/dist/types/components/accordion/exports.d.ts +1 -1
  167. package/dist/types/components/accordion-trigger/accordion-trigger.d.ts +0 -36
  168. package/dist/types/components/alert/alert.d.ts +9 -1
  169. package/dist/types/components/alert/exports.d.ts +1 -1
  170. package/dist/types/components/checkbox/checkbox.d.ts +29 -34
  171. package/dist/types/components/checkbox-group/checkbox-group.d.ts +6 -11
  172. package/dist/types/components/dialog/dialog.d.ts +0 -2
  173. package/dist/types/components/input/input.d.ts +35 -72
  174. package/dist/types/components/input-code/exports.d.ts +4 -0
  175. package/dist/types/components/input-code/input-code.d.ts +54 -7
  176. package/dist/types/components/input-date/input-date.d.ts +30 -16
  177. package/dist/types/components/input-password/exports.d.ts +1 -0
  178. package/dist/types/components/input-password/input-password.d.ts +53 -16
  179. package/dist/types/components/input-phone-number/input-phone-number.d.ts +5 -16
  180. package/dist/types/components/label/label.d.ts +0 -18
  181. package/dist/types/components/list-item/list-item/list-item.d.ts +0 -6
  182. package/dist/types/components/popover/exports.d.ts +0 -2
  183. package/dist/types/components/popover/popover.d.ts +1 -14
  184. package/dist/types/components/radio-button/radio-button.d.ts +5 -0
  185. package/dist/types/components/radio-group/radio-group.d.ts +6 -28
  186. package/dist/types/components/select/select.d.ts +34 -52
  187. package/dist/types/components/textarea/textarea.d.ts +5 -32
  188. package/dist/types/components/toast/toast.d.ts +10 -7
  189. package/dist/types/components.d.ts +347 -647
  190. package/dist/web-components/bundled-icons/riverty-kit.json +1 -1
  191. package/dist/web-components/p-0347feff.entry.js +1 -0
  192. package/dist/web-components/p-05738503.entry.js +1 -0
  193. package/dist/web-components/p-0e4c8bf1.entry.js +1 -0
  194. package/dist/web-components/p-1da75540.entry.js +1 -0
  195. package/dist/web-components/p-26ef77d6.entry.js +1 -0
  196. package/dist/web-components/p-3884c6e7.entry.js +1 -0
  197. package/dist/web-components/p-3a5a67e7.entry.js +1 -0
  198. package/dist/web-components/p-3f60c6c0.entry.js +1 -0
  199. package/dist/web-components/p-4254a383.entry.js +1 -0
  200. package/dist/web-components/{p-87f39749.entry.js → p-4595fa8e.entry.js} +1 -1
  201. package/dist/web-components/{p-4e3df002.entry.js → p-4cc58c6a.entry.js} +1 -1
  202. package/dist/web-components/p-5441b746.entry.js +1 -0
  203. package/dist/web-components/{p-72fa1fd1.entry.js → p-550e2237.entry.js} +1 -1
  204. package/dist/web-components/p-589baaf9.entry.js +1 -0
  205. package/dist/web-components/p-60341de2.entry.js +1 -0
  206. package/dist/web-components/{p-4bd3e077.entry.js → p-60ca994e.entry.js} +1 -1
  207. package/dist/web-components/{p-44ae9f33.entry.js → p-62b788bf.entry.js} +1 -1
  208. package/dist/web-components/{p-2b2f581a.entry.js → p-6303b9fe.entry.js} +1 -1
  209. package/dist/web-components/p-63fd817d.entry.js +1 -0
  210. package/dist/web-components/{p-e0e2f2b2.entry.js → p-673dbfd0.entry.js} +1 -1
  211. package/dist/web-components/p-67fa3f84.entry.js +1 -0
  212. package/dist/web-components/p-6a4f3836.entry.js +1 -0
  213. package/dist/web-components/p-6cc2ea2c.entry.js +1 -0
  214. package/dist/web-components/p-70784685.entry.js +1 -0
  215. package/dist/web-components/{p-429213ea.entry.js → p-7fed6f4d.entry.js} +1 -1
  216. package/dist/web-components/p-8a66d20c.entry.js +1 -0
  217. package/dist/web-components/{p-0bb04d79.entry.js → p-8b4d2448.entry.js} +1 -1
  218. package/dist/web-components/{p-c7f8e59b.entry.js → p-8c31cbd5.entry.js} +1 -1
  219. package/dist/web-components/p-8dac326b.entry.js +1 -0
  220. package/dist/web-components/{p-1c2497de.entry.js → p-9ef1bbee.entry.js} +1 -1
  221. package/dist/web-components/p-a0dbde7c.entry.js +1 -0
  222. package/dist/web-components/{p-755cc697.entry.js → p-a71485d8.entry.js} +1 -1
  223. package/dist/web-components/p-a7d22c76.entry.js +1 -0
  224. package/dist/web-components/{p-85a9af42.entry.js → p-ae251d2f.entry.js} +1 -1
  225. package/dist/web-components/{p-77155630.entry.js → p-b98ab649.entry.js} +1 -1
  226. package/dist/web-components/p-b9e3b3d6.entry.js +1 -0
  227. package/dist/web-components/p-c1e748f2.entry.js +1 -0
  228. package/dist/web-components/p-c478712b.entry.js +1 -0
  229. package/dist/web-components/{p-72c0c0d8.entry.js → p-d054eb4d.entry.js} +1 -1
  230. package/dist/web-components/p-d433a828.entry.js +1 -0
  231. package/dist/web-components/p-d7726e46.entry.js +1 -0
  232. package/dist/web-components/p-d819c8e5.entry.js +1 -0
  233. package/dist/web-components/p-e2188953.entry.js +1 -0
  234. package/dist/web-components/{p-3b4e3faf.entry.js → p-e5945c01.entry.js} +1 -1
  235. package/dist/web-components/{p-d1379ac6.entry.js → p-f9d5004c.entry.js} +1 -1
  236. package/dist/web-components/web-components.esm.js +1 -1
  237. package/package.json +1 -1
  238. package/dist/cjs/r-accordion-item.cjs.entry.js +0 -78
  239. package/dist/cjs/r-icon-button.cjs.entry.js +0 -81
  240. package/dist/collection/components/accordion-item/accordion-item.css +0 -121
  241. package/dist/collection/components/accordion-item/accordion-item.js +0 -138
  242. package/dist/esm/r-accordion-item.entry.js +0 -76
  243. package/dist/esm/r-icon-button.entry.js +0 -79
  244. package/dist/types/components/accordion-item/accordion-item.d.ts +0 -26
  245. package/dist/web-components/p-00ca474f.entry.js +0 -1
  246. package/dist/web-components/p-289eb4b0.entry.js +0 -1
  247. package/dist/web-components/p-2b8e12ae.entry.js +0 -1
  248. package/dist/web-components/p-2e2c8a5b.entry.js +0 -1
  249. package/dist/web-components/p-3a39932b.entry.js +0 -1
  250. package/dist/web-components/p-3bc93d65.entry.js +0 -1
  251. package/dist/web-components/p-44be9992.entry.js +0 -1
  252. package/dist/web-components/p-4652635a.entry.js +0 -1
  253. package/dist/web-components/p-51a5804b.entry.js +0 -1
  254. package/dist/web-components/p-63474b32.entry.js +0 -1
  255. package/dist/web-components/p-74d2a563.entry.js +0 -1
  256. package/dist/web-components/p-7ad8e78b.entry.js +0 -1
  257. package/dist/web-components/p-8028c2a9.entry.js +0 -1
  258. package/dist/web-components/p-96ddeb7f.entry.js +0 -1
  259. package/dist/web-components/p-9d898089.entry.js +0 -1
  260. package/dist/web-components/p-9e50120b.entry.js +0 -1
  261. package/dist/web-components/p-9eb1f262.entry.js +0 -1
  262. package/dist/web-components/p-a022f356.entry.js +0 -1
  263. package/dist/web-components/p-a7e7f8fa.entry.js +0 -1
  264. package/dist/web-components/p-b2f03016.entry.js +0 -1
  265. package/dist/web-components/p-c300c22f.entry.js +0 -1
  266. package/dist/web-components/p-c937bd92.entry.js +0 -1
  267. package/dist/web-components/p-cbcd7699.entry.js +0 -1
  268. package/dist/web-components/p-d93c240d.entry.js +0 -1
  269. package/dist/web-components/p-e4b66277.entry.js +0 -1
  270. package/dist/web-components/p-e6a31881.entry.js +0 -1
  271. package/dist/web-components/p-f6a92287.entry.js +0 -1
  272. package/dist/web-components/p-f770e22b.entry.js +0 -1
  273. package/dist/web-components/p-f952161b.entry.js +0 -1
@@ -9,18 +9,32 @@ const InputCode = class {
9
9
  this.rChange = createEvent(this, "rChange");
10
10
  this.rValidate = createEvent(this, "rValidate");
11
11
  this.rReset = createEvent(this, "rReset");
12
- /** Specifies a name for an input for submittion within formData object. */
12
+ /** Specifies a name for an input for submission within formData object. */
13
13
  this.name = 'input-code';
14
- /** Number of digits (typically 4–6) */
14
+ /** Number of digits (typically 4–6).
15
+ * @default: 4
16
+ */
15
17
  this.length = 4;
16
- /** Label for accessibility */
18
+ /** Label for accessibility.
19
+ * @default: 'Verification code'
20
+ */
17
21
  this.label = 'Verification code';
18
- /** Set custom message for `tooShort` property of a ValidityState object (set by `minlength`) within Constrain Validation API */
19
- this.tooShortMessage = `All ${this.length} characters must be filled.`;
20
22
  /** Defines initial value */
21
23
  this.value = '';
24
+ /** Specifies the input mode for the virtual keyboard on mobile devices. Default is 'numeric' for OTP codes.
25
+ * @default: 'numeric'
26
+ */
27
+ this.inputmode = 'numeric';
28
+ /** Specifies the enter key hint for the virtual keyboard. Default is 'done' for OTP completion.
29
+ * @default: 'done'
30
+ */
31
+ this.enterkeyhint = 'done';
32
+ /** Specifies the autocomplete behavior. Default is 'one-time-code' for SMS OTP autofill.
33
+ * @default: 'one-time-code'
34
+ */
35
+ this.autocomplete = 'one-time-code';
22
36
  /** Holds the current values of each input box */
23
- this.values = new Array(this.length).fill('');
37
+ this.values = [];
24
38
  /** Validity state passed from validateFormElement function after validation */
25
39
  this.validityState = '';
26
40
  /** Validity message passed from validateFormElement function after validation */
@@ -105,24 +119,33 @@ const InputCode = class {
105
119
  this.uniqueId = `r-input-code-${Date.now().toString(32)}${Math.random().toString(32)}`.replace(/\./g, '');
106
120
  this.nativeElement = null;
107
121
  this.getValidityStateData = (element) => {
108
- if (element.value.length === 0) {
109
- this.validityState = 'valueMissing';
110
- this.validityMessage = this.valueMissingMessage;
111
- return;
122
+ let validityState = '';
123
+ let validityMessage = '';
124
+ if (!element) {
125
+ validityState = 'valid';
126
+ return { validityState, validityMessage };
127
+ }
128
+ if (this.required && element.value.length === 0) {
129
+ validityState = 'valueMissing';
130
+ validityMessage = this.valueMissingMessage;
131
+ return { validityState, validityMessage };
112
132
  }
113
133
  if (element.value.length > 0 && element.value.length < this.length) {
114
- this.validityState = 'tooShort';
115
- this.validityMessage = this.tooShortMessage;
116
- return;
134
+ validityState = 'tooShort';
135
+ validityMessage = this.tooShortMessage || `All ${this.length} characters must be filled.`;
136
+ return { validityState, validityMessage };
117
137
  }
118
- this.validityState = 'valid';
138
+ validityState = 'valid';
139
+ return { validityState, validityMessage };
119
140
  };
120
141
  this.validateFormElement = (element) => {
121
142
  if (element === null)
122
143
  return;
123
144
  if (this.isNoValidate)
124
145
  return;
125
- this.getValidityStateData(element);
146
+ const { validityState, validityMessage } = this.getValidityStateData(element);
147
+ this.validityState = validityState;
148
+ this.validityMessage = validityMessage;
126
149
  const isValid = this.validityState === 'valid';
127
150
  this.valid = isValid;
128
151
  this.invalid = !isValid;
@@ -134,7 +157,7 @@ const InputCode = class {
134
157
  this.onResetForm = async () => {
135
158
  if (this.readonly)
136
159
  return;
137
- this.reset();
160
+ await this.reset();
138
161
  this.validityState = null;
139
162
  this.validityMessage = null;
140
163
  this.invalid = null;
@@ -157,6 +180,19 @@ const InputCode = class {
157
180
  appendControlToFormData(this.nativeElement || this.host, event.formData);
158
181
  };
159
182
  }
183
+ /**
184
+ * Validates segment index and throws descriptive errors if invalid.
185
+ * @param index - The index to validate
186
+ * @throws Error if index is not an integer or out of bounds
187
+ */
188
+ validateSegmentIndex(index) {
189
+ if (typeof index !== 'number' || !Number.isInteger(index)) {
190
+ throw new Error('Index must be an integer');
191
+ }
192
+ if (index < 0 || index >= this.length) {
193
+ throw new Error(`Index out of bounds: must be between 0 and ${this.length - 1}`);
194
+ }
195
+ }
160
196
  /**
161
197
  * Gets the current complete code value by joining all individual digit values.
162
198
  * @returns Promise that resolves to the complete code string
@@ -184,12 +220,83 @@ const InputCode = class {
184
220
  return;
185
221
  }
186
222
  const valueArray = Array.from(value).slice(0, this.length).map(char => String(char));
223
+ // Pad with empty strings if value is shorter than length
224
+ while (valueArray.length < this.length) {
225
+ valueArray.push('');
226
+ }
187
227
  this.values = valueArray;
188
228
  this.rChange.emit({ value: this.values.join('') });
189
229
  }
230
+ /**
231
+ * Validates the input code without triggering UI and returns a boolean indicating its validity.
232
+ * @returns A boolean indicating whether the input code is valid.
233
+ */
234
+ async checkValidity() {
235
+ const { validityState } = this.getValidityStateData(this.nativeElement);
236
+ return validityState === 'valid';
237
+ }
238
+ /**
239
+ * Focuses a specific segment (input) by index.
240
+ * @param index - The zero-based index of the segment to focus (0 to length-1)
241
+ * @returns Promise that resolves when focus is set, or rejects if index is invalid
242
+ */
243
+ async focusSegment(index) {
244
+ this.validateSegmentIndex(index);
245
+ const input = this.inputs[index];
246
+ if (input) {
247
+ input.focus();
248
+ // Select the content if it exists
249
+ if (this.values[index]) {
250
+ setTimeout(() => {
251
+ // Check if setSelectionRange exists (not available in some test environments)
252
+ if (typeof input.setSelectionRange === 'function') {
253
+ input.setSelectionRange(0, 1);
254
+ }
255
+ }, 0);
256
+ }
257
+ }
258
+ }
259
+ /**
260
+ * Gets the value of a specific segment by index.
261
+ * @param index - The zero-based index of the segment (0 to length-1)
262
+ * @returns Promise that resolves to the segment value (single character string or empty string)
263
+ */
264
+ async getSegmentValue(index) {
265
+ this.validateSegmentIndex(index);
266
+ return this.values[index] || '';
267
+ }
268
+ /**
269
+ * Sets the value of a specific segment by index.
270
+ * @param index - The zero-based index of the segment (0 to length-1)
271
+ * @param value - The value to set (will be truncated to first character if longer)
272
+ */
273
+ async setSegmentValue(index, value) {
274
+ this.validateSegmentIndex(index);
275
+ // Take only the first character, or empty string if value is empty
276
+ const newValue = value ? value.charAt(0) : '';
277
+ this.values[index] = newValue;
278
+ this.values = [...this.values];
279
+ // Update the input element's value to reflect the change
280
+ const input = this.inputs[index];
281
+ if (input) {
282
+ input.value = newValue;
283
+ }
284
+ }
190
285
  handleValuesChange() {
191
286
  this.value = this.values.join('');
192
287
  }
288
+ handleLengthChange(newLength) {
289
+ // Adjust values array when length changes
290
+ if (this.values.length !== newLength) {
291
+ const newValues = new Array(newLength).fill('');
292
+ // Copy existing values up to the new length
293
+ for (let i = 0; i < Math.min(this.values.length, newLength); i++) {
294
+ newValues[i] = this.values[i];
295
+ }
296
+ this.values = newValues;
297
+ this.inputs = [];
298
+ }
299
+ }
193
300
  get firstEmptyInput() {
194
301
  return this.inputs.find(input => !input.value) || null;
195
302
  }
@@ -202,7 +309,7 @@ const InputCode = class {
202
309
  return null;
203
310
  }
204
311
  return (this.validityState && this.validityState !== 'valid' ?
205
- (this.customErrorMessage || this.validityMessage)
312
+ (this.customErrorMessage || this.validityMessage || `All ${this.length} characters must be filled.`)
206
313
  : null);
207
314
  }
208
315
  get ariaDescribedBy() {
@@ -280,19 +387,20 @@ const InputCode = class {
280
387
  id: `${uniqueId}-label`,
281
388
  fieldIndicator
282
389
  } : {};
283
- 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 ?
390
+ return (h(Host, { key: '4d744320f4bf03760e4b11dd38934c0f7ce05223', value: this.value, onClick: this.onHostClick }, h("div", { key: 'f047f6669b243f301a2a462188d24721ccb565a5', class: "r-input-code--label-container" }, h("label", { key: 'a5acdd7308cca3981a78619c480d79c499ebc58a', htmlFor: uniqueId }, label ?
284
391
  h("r-label", Object.assign({}, labelAttr), label)
285
392
  :
286
- h("slot", { name: "label" })), h("slot", { key: 'f68f02578abd8be8fceea4bdaf1af657f07f5327', name: "popover" })), hint &&
287
- 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 &&
288
- h("r-icon", { key: '28df1a0823e8b6c94a26fe8dac6838d663da26b7', class: "r-input-code--readonly-icon", name: "pen-disabled", size: "s" }), this.hasTrailingSlot &&
289
- h("slot", { key: '13dee654a15b7104fbe66408ba6c0a8d4b839a2c', name: "trailing" }, valid &&
290
- h("r-icon", { key: '85f0413d86b7366229fe07af87a7bdd5368f8a22', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" })))), h("slot", { key: 'cf9e23001dec5216a2c35144b9282dee25d5fe50', name: "message" }, this.hasMessage &&
291
- h("r-hint", { key: '0c642fbeef09ec9c5ce1e2a6272bb27160be05c0', "aria-live": "polite", id: `${uniqueId}-message`, variant: "error" }, this.message))));
393
+ h("slot", { name: "label" })), h("slot", { key: '696554954e2b29b49a8d639aa79d80abeaa6a729', name: "popover" })), hint &&
394
+ h("r-hint", { key: '58b3e011e49b4a3bd4dd31050ab554483fba0fc4', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '6f4668b5bda975b59ff269759e2d3ae3306b09c4', class: "r-input-code--container", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.groupDescribedby }, h("slot", { key: '59206e0ed6e335735b610c44a925ea70b137ffe0', 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, inputmode: this.inputmode, enterkeyhint: this.enterkeyhint, autocomplete: this.autocomplete, onInput: this.createInputHandler(i), onKeyDown: this.createKeyDownHandler(i), onPaste: this.handlePaste }))), h("input", Object.assign({ key: '815da7a7566b0cefdbdfda32c990637385eba304', type: "hidden" }, inputAttrs, { value: this.values.join(''), ref: el => this.nativeElement = el })), h("div", { key: 'b03d7e03bd6c91d441f4377d53bb7d845edf498d', class: "r-input-code--trailing" }, this.readonly &&
395
+ h("r-icon", { key: '53796d1b572ff2eac8297a0fad8e22d3a95f1bee', class: "r-input-code--readonly-icon", name: "pen-disabled", size: "s" }), this.hasTrailingSlot &&
396
+ h("slot", { key: '9becd49e7d79f824fcd79e7afbc3040a1b0f33a3', name: "trailing" }, valid &&
397
+ h("r-icon", { key: 'a31379d7e8eb6ad66bbf1567d4cd4f9526962226', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" })))), h("slot", { key: 'a38ac5d9dda2017a443ec2b58cffbdd0db952239', name: "message" }, this.hasMessage &&
398
+ h("r-hint", { key: '39e47e0fdf23b1ebab5a0384447a965a8890d77f', "aria-live": "polite", id: `${uniqueId}-message`, variant: "error" }, this.message))));
292
399
  }
293
400
  get host() { return getElement(this); }
294
401
  static get watchers() { return {
295
- "values": ["handleValuesChange"]
402
+ "values": ["handleValuesChange"],
403
+ "length": ["handleLengthChange"]
296
404
  }; }
297
405
  };
298
406
  InputCode.style = inputCodeCss;
@@ -68,6 +68,10 @@ const InputDate = class {
68
68
  this.validityState = '';
69
69
  /** Validity message passed from validateFormElement function after validation */
70
70
  this.validityMessage = '';
71
+ /** Defines if the component has been touched by user */
72
+ this.touched = false;
73
+ /** Defines if the value has been changed by user interaction */
74
+ this.dirty = false;
71
75
  /**
72
76
  * Initial attributes state
73
77
  * */
@@ -158,6 +162,7 @@ const InputDate = class {
158
162
  if (this.readonly)
159
163
  return;
160
164
  if (event.code === 'Enter') {
165
+ this.touched = true;
161
166
  this.validateFormElement(this.nativeElement);
162
167
  if (this.invalid && !this.isNoValidate)
163
168
  return;
@@ -208,6 +213,8 @@ const InputDate = class {
208
213
  if (this.readonly)
209
214
  return;
210
215
  this.value = event.clipboardData.getData('text');
216
+ this.touched = true;
217
+ this.dirty = true;
211
218
  event.preventDefault();
212
219
  };
213
220
  this.createInputHandler = (input, index) => {
@@ -225,7 +232,10 @@ const InputDate = class {
225
232
  index < this.inputOrder.length - 1) {
226
233
  (_c = this.inputs[index + 1]) === null || _c === void 0 ? void 0 : _c.focus();
227
234
  }
235
+ this.touched = true;
236
+ this.dirty = true;
228
237
  this.rInput.emit({ element: this.host, value: this.value });
238
+ this.validateFormElement(this.nativeElement);
229
239
  };
230
240
  this.createChangeHandler = (input) => {
231
241
  return (e) => this.handleChange(input, e);
@@ -238,29 +248,64 @@ const InputDate = class {
238
248
  event.target.value = value;
239
249
  this.setDateComponent(input, value);
240
250
  this.value = this.inputOrder.map((el) => this.getDateComponent(el)).join(this.delimiter);
251
+ this.touched = true;
252
+ this.dirty = true;
241
253
  this.rChange.emit({ element: this.host, value: this.value });
242
254
  this.validateFormElement(this.nativeElement);
243
255
  };
256
+ this.handleBlur = () => {
257
+ this.touched = true;
258
+ this.validateFormElement(this.nativeElement);
259
+ };
244
260
  this.getValidityStateData = (element) => {
261
+ let validityState = '';
262
+ let validityMessage = '';
245
263
  if (this.required && element.value.length === 0) {
246
- this.validityState = 'valueMissing';
247
- this.validityMessage = this.valueMissingMessage;
248
- return;
264
+ validityState = 'valueMissing';
265
+ validityMessage = this.valueMissingMessage;
266
+ return { validityState, validityMessage };
249
267
  }
250
- const valid = dayjs(this.value, this.format, true).isValid();
268
+ const valid = this.value ? dayjs(this.value, this.format, true).isValid() : true;
251
269
  if (!valid) {
252
- this.validityState = 'invalid';
253
- this.validityMessage = this.invalidDateMessage;
254
- return;
270
+ validityState = 'invalid';
271
+ validityMessage = this.invalidDateMessage;
272
+ return { validityState, validityMessage };
273
+ }
274
+ // Check min/max constraints only if date is valid and has a value
275
+ // Note: min and max are expected to be in the same format as this.format
276
+ // If format changes, the developer should update min/max accordingly
277
+ if (this.value && valid) {
278
+ const currentDate = dayjs(this.value, this.format, true);
279
+ // Check minimum date constraint
280
+ if (this.min) {
281
+ const minDate = dayjs(this.min, this.format, true);
282
+ if (minDate.isValid() && currentDate.isBefore(minDate, 'day')) {
283
+ validityState = 'rangeUnderflow';
284
+ validityMessage = this.rangeUnderflowMessage;
285
+ return { validityState, validityMessage };
286
+ }
287
+ }
288
+ // Check maximum date constraint
289
+ if (this.max) {
290
+ const maxDate = dayjs(this.max, this.format, true);
291
+ if (maxDate.isValid() && currentDate.isAfter(maxDate, 'day')) {
292
+ validityState = 'rangeOverflow';
293
+ validityMessage = this.rangeOverflowMessage;
294
+ return { validityState, validityMessage };
295
+ }
296
+ }
255
297
  }
256
- this.validityState = 'valid';
298
+ validityState = 'valid';
299
+ return { validityState, validityMessage };
257
300
  };
258
301
  this.validateFormElement = (element) => {
259
302
  if (element === null)
260
303
  return;
261
304
  if (this.isNoValidate)
262
305
  return;
263
- this.getValidityStateData(element);
306
+ const { validityState, validityMessage } = this.getValidityStateData(element);
307
+ this.validityState = validityState;
308
+ this.validityMessage = validityMessage;
264
309
  const isValid = this.validityState === 'valid';
265
310
  this.valid = isValid;
266
311
  this.invalid = !isValid;
@@ -309,6 +354,8 @@ const InputDate = class {
309
354
  }
310
355
  handleValueChange() {
311
356
  this.setCurrentValues();
357
+ if (this.touched)
358
+ this.validateFormElement(this.nativeElement);
312
359
  }
313
360
  /** Get the date value */
314
361
  async getValue() {
@@ -316,6 +363,7 @@ const InputDate = class {
316
363
  }
317
364
  /** Sets the date value */
318
365
  async setValue(value) {
366
+ this.nativeElement.value = value;
319
367
  this.value = value;
320
368
  }
321
369
  /** Gets the current date format */
@@ -326,6 +374,19 @@ const InputDate = class {
326
374
  async setFormat(format) {
327
375
  this.format = format;
328
376
  }
377
+ /** Gets the touched state (whether user has interacted with the input) */
378
+ async isTouched() {
379
+ return this.touched;
380
+ }
381
+ /** Gets the dirty state (whether value has been changed by user) */
382
+ async isDirty() {
383
+ return this.dirty;
384
+ }
385
+ /** Resets touched and dirty states to pristine (untouched/clean) */
386
+ async markAsPristine() {
387
+ this.touched = false;
388
+ this.dirty = false;
389
+ }
329
390
  /**
330
391
  * Resets the component by clearing all input values and focusing the first input.
331
392
  * @returns Promise that resolves when reset is complete
@@ -333,6 +394,7 @@ const InputDate = class {
333
394
  async reset() {
334
395
  if (this.readonly)
335
396
  return;
397
+ this.markAsPristine();
336
398
  this.validityState = null;
337
399
  this.validityMessage = null;
338
400
  this.value = this.initial['value'];
@@ -340,6 +402,14 @@ const InputDate = class {
340
402
  this.format = this.initial['format'];
341
403
  this.valid = !this.invalid;
342
404
  }
405
+ /**
406
+ * Validates the input date without triggering UI and returns a boolean indicating its validity.
407
+ * @returns A boolean indicating whether the input date is valid.
408
+ */
409
+ async checkValidity() {
410
+ const { validityState } = this.getValidityStateData(this.nativeElement);
411
+ return validityState === 'valid';
412
+ }
343
413
  get inputs() {
344
414
  return Array.from(this.host.shadowRoot.querySelectorAll('input[data-date-type]'));
345
415
  }
@@ -409,7 +479,7 @@ const InputDate = class {
409
479
  this.disconnectFormEventListeners();
410
480
  }
411
481
  render() {
412
- const { form, name, required, disabled, label, fieldIndicator, hint, tooltip, tooltipIcon, tooltipIconColor, uniqueId, invalid, valid, readonly } = this;
482
+ const { form, name, required, disabled, label, fieldIndicator, hint, uniqueId, invalid, valid, readonly } = this;
413
483
  const groupAttrs = {
414
484
  'aria-invalid': `${invalid || false}`,
415
485
  'aria-describedby': this.ariaDescribedBy
@@ -423,24 +493,18 @@ const InputDate = class {
423
493
  readonly,
424
494
  'aria-describedby': this.ariaDescribedBy
425
495
  };
426
- // DEPRECATED: will be removed in November 2025 release.
427
- const tooltipAttrs = tooltip ? {
428
- tooltip,
429
- 'tooltip-icon': tooltipIcon,
430
- 'tooltip-icon-color': tooltipIconColor,
431
- } : {};
432
496
  const labelAttr = label ? {
433
497
  id: `${uniqueId}-label`,
434
498
  fieldIndicator
435
499
  } : {};
436
- 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 ?
437
- h("r-label", Object.assign({}, labelAttr, tooltipAttrs), label)
500
+ return (h(Host, { key: '1a8a9175148f43758ec6b9d905c4bd2f619ffd7f', onClick: this.onHostClick, "data-touched": `${this.touched}`, "data-dirty": `${this.dirty}` }, h("fieldset", Object.assign({ key: 'fb004332d8578b8da74df643bd93f93d062973bb', class: "r-input-date" }, groupAttrs), h("div", { key: '128e65638dc21d95c8b4b92669b0bd6733a653f6', class: "r-input-date--legend-container" }, h("legend", { key: '63e7e858c38930fecbe71d819f1a0b49bf711911', class: "r-input-date--legend" }, h("label", { key: 'ccd6a5434f5df91bf9b2c121bb182c152302d864', htmlFor: uniqueId }, label ?
501
+ h("r-label", Object.assign({}, labelAttr), label)
438
502
  :
439
- h("slot", { name: "label" }))), h("slot", { key: '825c6e93994dd54738f3168e782066787c48af5c', name: "popover" })), hint &&
440
- 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 &&
441
- 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 &&
442
- h("r-icon", { key: '750df4d848ef7d0e7a6b9a7b7853a3389da44232', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
443
- 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)))));
503
+ h("slot", { name: "label" }))), h("slot", { key: '4be5c643d1b0532d27f4b82692cb6ca937291d6b', name: "popover" })), hint &&
504
+ h("r-hint", { key: '07a912c146dff97ef991a6e375f4aeb8cd0ba45e', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '386dfb87cface9333c93d5fe8165cbe52a9a83c4', class: "r-input-date--container" }, h("r-icon", { key: '9ff075723ac54f6d7c2325ba59f833422404bee6', name: "calendar", size: "s", class: "r-input-date--calendar-icon" }), h("div", { key: 'ebcb76a92ab1591c3128a60d6620bea5b0c517ec', 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 &&
505
+ h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: 'e5736ffa215662436c539332be1414cc409ce448', type: "hidden" }, dateInputAttrs, { value: this.value, ref: (el) => this.nativeElement = el }))), h("div", { key: '45ccffbb4111f2fd906d9b687f62f4adc83b62aa', class: "r-input-date--trailing" }, this.readonly &&
506
+ h("r-icon", { key: '3a5433e3d601a83154687bdd55feeeef0ef04215', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
507
+ h("r-icon", { key: '03de3e49b8b51690e4fb6c2edbb7a53ca1a71f76', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }), this.hasTrailingSlot && h("slot", { key: 'db4911a4421b296effdd37ca08c96d8a0096e5e6', name: "trailing" }))), h("div", { key: 'd21f19188462be93812487702eb8a07fd3a91cea', id: `${uniqueId}-message`, "aria-live": "polite", class: "r-input-date--message" }, this.hasMessage && h("r-hint", { key: '6937f2d48a634308c97d33e59daa0a7242bd39fd', variant: "error" }, this.message)))));
444
508
  }
445
509
  get host() { return getElement(this); }
446
510
  static get watchers() { return {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-Da7qOBFr.js';
2
2
  import { a as appendControlToFormData } from './formData-DvLT8-y3.js';
3
3
 
4
- const inputPasswordCss = ":host{display:inline-flex;flex-direction:column;vertical-align:top}:host([full-width]:not([full-width=false])){display:block}:host([disabled]:not([disabled=false])) r-icon-button{opacity:1}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}";
4
+ const inputPasswordCss = ":host{display:inline-flex;flex-direction:column;vertical-align:top;--r-input--validation-icon--display:none}:host([full-width]:not([full-width=false])){display:block}:host([disabled]:not([disabled=false])) r-icon-button{opacity:1}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}";
5
5
 
6
6
  const InputPassword = class {
7
7
  constructor(hostRef) {
@@ -10,6 +10,7 @@ const InputPassword = class {
10
10
  this.rInput = createEvent(this, "rInput");
11
11
  this.rChange = createEvent(this, "rChange");
12
12
  this.rReset = createEvent(this, "rReset");
13
+ this.rVisibilityChange = createEvent(this, "rVisibilityChange");
13
14
  /** The value of the password input */
14
15
  this.value = '';
15
16
  /**
@@ -59,16 +60,19 @@ const InputPassword = class {
59
60
  this.rChange.emit({ element: host, value });
60
61
  };
61
62
  this.getValidityStateData = (element) => {
63
+ let validityState = '';
64
+ let validityMessage = '';
62
65
  for (const state in element.validity) {
63
66
  if (element.validity[state]) {
64
- this.validityState = state;
67
+ validityState = state;
65
68
  if (this[state + 'Message']) {
66
- this.validityMessage = this[state + 'Message'];
67
- return;
69
+ validityMessage = this[state + 'Message'];
70
+ return { validityState, validityMessage };
68
71
  }
69
- this.validityMessage = element.validationMessage;
72
+ validityMessage = element.validationMessage;
70
73
  }
71
74
  }
75
+ return { validityState, validityMessage };
72
76
  };
73
77
  this.validateFormElement = (element) => {
74
78
  if (element === null)
@@ -77,7 +81,9 @@ const InputPassword = class {
77
81
  return;
78
82
  if (this.error)
79
83
  return;
80
- this.getValidityStateData(element.shadowRoot.querySelector('input'));
84
+ const { validityState, validityMessage } = this.getValidityStateData(element.shadowRoot.querySelector('input'));
85
+ this.validityState = validityState;
86
+ this.validityMessage = validityMessage;
81
87
  const isValid = this.validityState === 'valid';
82
88
  this.valid = isValid;
83
89
  this.invalid = !isValid;
@@ -145,6 +151,7 @@ const InputPassword = class {
145
151
  async showPassword() {
146
152
  this.showed = true;
147
153
  this.alertOnPasswordVisibilityChange();
154
+ this.rVisibilityChange.emit({ element: this.host, visible: true });
148
155
  }
149
156
  /**
150
157
  * Hide password text.
@@ -152,6 +159,7 @@ const InputPassword = class {
152
159
  async hidePassword() {
153
160
  this.showed = false;
154
161
  this.alertOnPasswordVisibilityChange();
162
+ this.rVisibilityChange.emit({ element: this.host, visible: false });
155
163
  }
156
164
  /** Get the input value */
157
165
  async getValue() {
@@ -164,6 +172,14 @@ const InputPassword = class {
164
172
  this.value = value;
165
173
  this.validateFormElement(this.nativeElement);
166
174
  }
175
+ /**
176
+ * Validates the input password without triggering UI and returns a boolean indicating its validity.
177
+ * @returns A boolean indicating whether the input password is valid.
178
+ */
179
+ async checkValidity() {
180
+ const { validityState } = this.getValidityStateData(this.nativeElement.shadowRoot.querySelector('input'));
181
+ return validityState === 'valid';
182
+ }
167
183
  /** Identify wrapping form element */
168
184
  get parentFormEl() {
169
185
  return this.host.closest('form') || document.querySelector(`#${this.form}`) || null;
@@ -212,11 +228,14 @@ const InputPassword = class {
212
228
  this.disconnectFormEventListeners();
213
229
  }
214
230
  render() {
215
- const { name, placeholder, required, fieldIndicator, value, disabled, form, invalid, valid, hint, label, tooltip, tooltipIcon, tooltipIconColor, fullWidth, showPasswordAriaLabel, hidePasswordAriaLabel, showed, readonly } = this;
231
+ const { name, placeholder, required, minlength, maxlength, pattern, fieldIndicator, value, disabled, form, invalid, valid, hint, label, fullWidth, showPasswordAriaLabel, hidePasswordAriaLabel, showed, readonly, passwordrules, autocomplete, tooLongMessage, tooShortMessage, patternMismatchMessage } = this;
216
232
  const inputAttrs = {
217
233
  name,
218
234
  placeholder,
219
235
  required,
236
+ minlength,
237
+ maxlength,
238
+ pattern,
220
239
  fieldIndicator,
221
240
  value,
222
241
  disabled,
@@ -225,15 +244,17 @@ const InputPassword = class {
225
244
  valid,
226
245
  hint,
227
246
  label,
228
- tooltip,
229
- tooltipIcon,
230
- tooltipIconColor,
231
247
  fullWidth,
232
248
  novalidate: true,
233
- readonly
249
+ readonly,
250
+ passwordrules,
251
+ autocomplete,
252
+ tooLongMessage,
253
+ tooShortMessage,
254
+ patternMismatchMessage
234
255
  };
235
- return (h(Host, { key: '27a9dec1e7b44ca89bf6fa3a2519e449250503e0' }, h("r-input", Object.assign({ key: '5ca5a59b7dcbcc5f5bbeefd8741b679bc1d11004' }, 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: '62a04c271572db925e1992bd1ac540a5a09234dc', name: "padlock-closed", size: "s", slot: "leading" }), h("slot", { key: 'cbee36e927550e21e76dcf61de99980f92564177', name: "popover", slot: "popover" }), h("r-icon-button", { key: 'd4939f4be247d76df7e96eee97ea9ed1079a8f5d', slot: "trailing", name: showed ? 'eye-crossed-out' : 'eye', size: "s", disabled: disabled, label: showed ? hidePasswordAriaLabel : showPasswordAriaLabel, onClick: this.onShowClick }), this.hasMessage &&
236
- h("r-hint", { key: '5c5ba0c83013b4e6a283a86beb5abe1676b97093', slot: "message", variant: "error" }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))), h("div", { key: '0763d06fbaf887574e44b0fedbb9d08b1725b99f', class: "visually-hidden", ref: el => this.passwordVisibilityChangeAlertContainer = el, "aria-live": "polite" })));
256
+ return (h(Host, { key: '15d9cac9269a816de47d1ae4d3818a99f6229979' }, h("r-input", Object.assign({ key: 'eea64612b319eae93c0fc6591c22020bf2e3d4fb' }, 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: 'd7a425d45f7897d7f6f11b7bf37595e25da3295b', name: "padlock-closed", size: "s", slot: "leading" }), h("slot", { key: '6ae8e4dc4633e692ae4280d9cd1420bf7e02d0c0', name: "popover", slot: "popover" }), h("r-icon-button", { key: 'e51d43f5966477dc1c35bf6a8114d5b206a58187', slot: "trailing", name: showed ? 'eye-crossed-out' : 'eye', size: "s", disabled: disabled, label: showed ? hidePasswordAriaLabel : showPasswordAriaLabel, onClick: this.onShowClick }), this.hasMessage &&
257
+ h("r-hint", { key: 'bcee0a5b7f75a4ddd2e2fa6a2dd44cd0392170dc', slot: "message", variant: "error" }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))), h("div", { key: '995e229dfab56b03e0a177c6952c2135777f7899', class: "visually-hidden", ref: el => this.passwordVisibilityChangeAlertContainer = el, "aria-live": "polite" })));
237
258
  }
238
259
  get host() { return getElement(this); }
239
260
  };