@riverty/web-components 5.8.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.
- package/CHANGELOG.md +86 -0
- package/custom-elements.json +124 -369
- package/dist/cjs/index-DJ4H_bFj.js +6 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/r-accordion-panel.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion-section.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion-trigger.cjs.entry.js +5 -35
- package/dist/cjs/r-accordion.cjs.entry.js +3 -7
- package/dist/cjs/r-alert.cjs.entry.js +26 -11
- package/dist/cjs/r-badge.cjs.entry.js +1 -1
- package/dist/cjs/r-button.cjs.entry.js +1 -1
- package/dist/cjs/r-checkbox-group.cjs.entry.js +1 -11
- package/dist/cjs/r-checkbox.cjs.entry.js +76 -75
- package/dist/cjs/r-dialog.cjs.entry.js +3 -11
- package/dist/cjs/r-hint_2.cjs.entry.js +50 -0
- package/dist/cjs/{r-hint_3.cjs.entry.js → r-icon-button_2.cjs.entry.js} +64 -51
- package/dist/cjs/r-input-code.cjs.entry.js +112 -17
- package/dist/cjs/r-input-date.cjs.entry.js +8 -14
- package/dist/cjs/r-input-password.cjs.entry.js +16 -8
- package/dist/cjs/r-input-phone-number.cjs.entry.js +7 -12
- package/dist/cjs/r-input.cjs.entry.js +87 -41
- package/dist/cjs/r-list-item.cjs.entry.js +5 -5
- package/dist/cjs/r-panel.cjs.entry.js +2 -2
- package/dist/cjs/r-popover-action.cjs.entry.js +1 -1
- package/dist/cjs/r-popover-content.cjs.entry.js +1 -1
- package/dist/cjs/r-popover-headline.cjs.entry.js +1 -1
- package/dist/cjs/r-popover-trigger.cjs.entry.js +1 -1
- package/dist/cjs/r-popover.cjs.entry.js +3 -3
- package/dist/cjs/r-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-description.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-leading.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-title.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-trailing.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button.cjs.entry.js +29 -12
- package/dist/cjs/r-radio-group.cjs.entry.js +18 -22
- package/dist/cjs/r-select-option.cjs.entry.js +1 -1
- package/dist/cjs/r-select.cjs.entry.js +6 -24
- package/dist/cjs/r-skip-link.cjs.entry.js +1 -1
- package/dist/cjs/r-stepper-item.cjs.entry.js +2 -2
- package/dist/cjs/r-stepper.cjs.entry.js +1 -1
- package/dist/cjs/r-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/r-tab.cjs.entry.js +1 -1
- package/dist/cjs/r-tabs-list.cjs.entry.js +1 -1
- package/dist/cjs/r-tabs.cjs.entry.js +1 -1
- package/dist/cjs/r-textarea.cjs.entry.js +6 -18
- package/dist/cjs/r-toast-group.cjs.entry.js +1 -1
- package/dist/cjs/r-toast.cjs.entry.js +9 -9
- package/dist/cjs/web-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/accordion/accordion.css +0 -2
- package/dist/collection/components/accordion/accordion.js +4 -8
- package/dist/collection/components/accordion/exports.js +1 -1
- package/dist/collection/components/accordion-panel/accordion-panel.js +1 -1
- package/dist/collection/components/accordion-section/accordion-section.js +1 -1
- package/dist/collection/components/accordion-trigger/accordion-trigger.css +0 -4
- package/dist/collection/components/accordion-trigger/accordion-trigger.js +4 -215
- package/dist/collection/components/alert/alert.css +6 -0
- package/dist/collection/components/alert/alert.js +48 -10
- package/dist/collection/components/badge/badge.js +1 -1
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +80 -98
- package/dist/collection/components/checkbox-group/checkbox-group.js +1 -50
- package/dist/collection/components/dialog/dialog.css +1 -3
- package/dist/collection/components/dialog/dialog.js +2 -10
- package/dist/collection/components/hint/hint.js +2 -2
- package/dist/collection/components/icon-button/icon-button.js +3 -3
- package/dist/collection/components/input/input.css +3 -0
- package/dist/collection/components/input/input.js +180 -370
- package/dist/collection/components/input-code/exports.js +2 -0
- package/dist/collection/components/input-code/input-code.js +294 -26
- package/dist/collection/components/input-date/input-date.js +8 -77
- package/dist/collection/components/input-password/exports.js +1 -0
- package/dist/collection/components/input-password/input-password.css +1 -0
- package/dist/collection/components/input-password/input-password.js +195 -70
- package/dist/collection/components/input-phone-number/input-phone-number.js +7 -75
- package/dist/collection/components/label/label.js +3 -113
- package/dist/collection/components/list-item/list-item/list-item.css +7 -7
- package/dist/collection/components/list-item/list-item/list-item.js +4 -26
- package/dist/collection/components/panel/panel.js +2 -2
- package/dist/collection/components/popover/exports.js +0 -1
- package/dist/collection/components/popover/popover.css +2 -10
- package/dist/collection/components/popover/popover.js +2 -55
- package/dist/collection/components/popover-action/popover-action.js +1 -1
- package/dist/collection/components/popover-content/popover-content.js +1 -1
- package/dist/collection/components/popover-headline/popover-headline.js +1 -1
- package/dist/collection/components/popover-trigger/popover-trigger.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/radio-button/radio-button.js +49 -12
- package/dist/collection/components/radio-button-description/radio-button-description.js +1 -1
- package/dist/collection/components/radio-button-leading/radio-button-leading.js +1 -1
- package/dist/collection/components/radio-button-title/radio-button-title.js +1 -1
- package/dist/collection/components/radio-button-trailing/radio-button-trailing.js +1 -1
- package/dist/collection/components/radio-group/radio-group.js +38 -124
- package/dist/collection/components/select/select.js +6 -330
- package/dist/collection/components/select-option/select-option.js +1 -1
- package/dist/collection/components/skip-link/skip-link.js +1 -1
- package/dist/collection/components/stepper/stepper.js +1 -1
- package/dist/collection/components/stepper-item/stepper-item.js +2 -2
- package/dist/collection/components/tab/tab.js +1 -1
- package/dist/collection/components/tab-panel/tab-panel.js +1 -1
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/tabs-list/tabs-list.js +1 -1
- package/dist/collection/components/textarea/textarea.js +6 -158
- package/dist/collection/components/toast/toast.js +9 -31
- package/dist/collection/components/toast-group/toast-group.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js +1 -1
- package/dist/esm/index-Da7qOBFr.js +6 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/r-accordion-panel.entry.js +1 -1
- package/dist/esm/r-accordion-section.entry.js +1 -1
- package/dist/esm/r-accordion-trigger.entry.js +5 -35
- package/dist/esm/r-accordion.entry.js +3 -7
- package/dist/esm/r-alert.entry.js +26 -11
- package/dist/esm/r-badge.entry.js +1 -1
- package/dist/esm/r-button.entry.js +1 -1
- package/dist/esm/r-checkbox-group.entry.js +1 -11
- package/dist/esm/r-checkbox.entry.js +76 -75
- package/dist/esm/r-dialog.entry.js +3 -11
- package/dist/esm/r-hint_2.entry.js +47 -0
- package/dist/esm/{r-hint_3.entry.js → r-icon-button_2.entry.js} +65 -51
- package/dist/esm/r-input-code.entry.js +112 -17
- package/dist/esm/r-input-date.entry.js +8 -14
- package/dist/esm/r-input-password.entry.js +16 -8
- package/dist/esm/r-input-phone-number.entry.js +7 -12
- package/dist/esm/r-input.entry.js +87 -41
- package/dist/esm/r-list-item.entry.js +5 -5
- package/dist/esm/r-panel.entry.js +2 -2
- package/dist/esm/r-popover-action.entry.js +1 -1
- package/dist/esm/r-popover-content.entry.js +1 -1
- package/dist/esm/r-popover-headline.entry.js +1 -1
- package/dist/esm/r-popover-trigger.entry.js +1 -1
- package/dist/esm/r-popover.entry.js +3 -3
- package/dist/esm/r-progress-bar.entry.js +1 -1
- package/dist/esm/r-radio-button-description.entry.js +1 -1
- package/dist/esm/r-radio-button-leading.entry.js +1 -1
- package/dist/esm/r-radio-button-title.entry.js +1 -1
- package/dist/esm/r-radio-button-trailing.entry.js +1 -1
- package/dist/esm/r-radio-button.entry.js +29 -12
- package/dist/esm/r-radio-group.entry.js +18 -22
- package/dist/esm/r-select-option.entry.js +1 -1
- package/dist/esm/r-select.entry.js +6 -24
- package/dist/esm/r-skip-link.entry.js +1 -1
- package/dist/esm/r-stepper-item.entry.js +2 -2
- package/dist/esm/r-stepper.entry.js +1 -1
- package/dist/esm/r-tab-panel.entry.js +1 -1
- package/dist/esm/r-tab.entry.js +1 -1
- package/dist/esm/r-tabs-list.entry.js +1 -1
- package/dist/esm/r-tabs.entry.js +1 -1
- package/dist/esm/r-textarea.entry.js +6 -18
- package/dist/esm/r-toast-group.entry.js +1 -1
- package/dist/esm/r-toast.entry.js +9 -9
- package/dist/esm/web-components.js +1 -1
- package/dist/types/components/accordion/accordion.d.ts +1 -5
- package/dist/types/components/accordion/exports.d.ts +1 -1
- package/dist/types/components/accordion-trigger/accordion-trigger.d.ts +0 -36
- package/dist/types/components/alert/alert.d.ts +6 -1
- package/dist/types/components/checkbox/checkbox.d.ts +24 -34
- package/dist/types/components/checkbox-group/checkbox-group.d.ts +0 -11
- package/dist/types/components/dialog/dialog.d.ts +0 -2
- package/dist/types/components/input/input.d.ts +30 -72
- package/dist/types/components/input-code/exports.d.ts +4 -0
- package/dist/types/components/input-code/input-code.d.ts +49 -7
- package/dist/types/components/input-date/input-date.d.ts +0 -16
- package/dist/types/components/input-password/exports.d.ts +1 -0
- package/dist/types/components/input-password/input-password.d.ts +48 -16
- package/dist/types/components/input-phone-number/input-phone-number.d.ts +0 -16
- package/dist/types/components/label/label.d.ts +0 -18
- package/dist/types/components/list-item/list-item/list-item.d.ts +0 -6
- package/dist/types/components/popover/exports.d.ts +0 -2
- package/dist/types/components/popover/popover.d.ts +1 -14
- package/dist/types/components/radio-button/radio-button.d.ts +5 -0
- package/dist/types/components/radio-group/radio-group.d.ts +5 -26
- package/dist/types/components/select/select.d.ts +0 -50
- package/dist/types/components/textarea/textarea.d.ts +0 -32
- package/dist/types/components/toast/toast.d.ts +0 -5
- package/dist/types/components.d.ts +201 -636
- package/dist/web-components/p-0347feff.entry.js +1 -0
- package/dist/web-components/p-05738503.entry.js +1 -0
- package/dist/web-components/p-0e4c8bf1.entry.js +1 -0
- package/dist/web-components/{p-5744d75c.entry.js → p-1da75540.entry.js} +1 -1
- package/dist/web-components/p-26ef77d6.entry.js +1 -0
- package/dist/web-components/p-3884c6e7.entry.js +1 -0
- package/dist/web-components/p-3a5a67e7.entry.js +1 -0
- package/dist/web-components/p-3f60c6c0.entry.js +1 -0
- package/dist/web-components/p-4254a383.entry.js +1 -0
- package/dist/web-components/{p-87f39749.entry.js → p-4595fa8e.entry.js} +1 -1
- package/dist/web-components/{p-4e3df002.entry.js → p-4cc58c6a.entry.js} +1 -1
- package/dist/web-components/p-5441b746.entry.js +1 -0
- package/dist/web-components/{p-72fa1fd1.entry.js → p-550e2237.entry.js} +1 -1
- package/dist/web-components/p-589baaf9.entry.js +1 -0
- package/dist/web-components/p-60341de2.entry.js +1 -0
- package/dist/web-components/{p-4bd3e077.entry.js → p-60ca994e.entry.js} +1 -1
- package/dist/web-components/{p-44ae9f33.entry.js → p-62b788bf.entry.js} +1 -1
- package/dist/web-components/{p-2b2f581a.entry.js → p-6303b9fe.entry.js} +1 -1
- package/dist/web-components/p-63fd817d.entry.js +1 -0
- package/dist/web-components/{p-e0e2f2b2.entry.js → p-673dbfd0.entry.js} +1 -1
- package/dist/web-components/p-67fa3f84.entry.js +1 -0
- package/dist/web-components/p-6cc2ea2c.entry.js +1 -0
- package/dist/web-components/p-70784685.entry.js +1 -0
- package/dist/web-components/{p-429213ea.entry.js → p-7fed6f4d.entry.js} +1 -1
- package/dist/web-components/p-8a66d20c.entry.js +1 -0
- package/dist/web-components/{p-0bb04d79.entry.js → p-8b4d2448.entry.js} +1 -1
- package/dist/web-components/{p-c7f8e59b.entry.js → p-8c31cbd5.entry.js} +1 -1
- package/dist/web-components/p-8dac326b.entry.js +1 -0
- package/dist/web-components/{p-1c2497de.entry.js → p-9ef1bbee.entry.js} +1 -1
- package/dist/web-components/p-a0dbde7c.entry.js +1 -0
- package/dist/web-components/{p-755cc697.entry.js → p-a71485d8.entry.js} +1 -1
- package/dist/web-components/p-a7d22c76.entry.js +1 -0
- package/dist/web-components/{p-85a9af42.entry.js → p-ae251d2f.entry.js} +1 -1
- package/dist/web-components/p-b9e3b3d6.entry.js +1 -0
- package/dist/web-components/p-c1e748f2.entry.js +1 -0
- package/dist/web-components/{p-5bbd6e3c.entry.js → p-c478712b.entry.js} +1 -1
- package/dist/web-components/{p-3078b2b8.entry.js → p-d054eb4d.entry.js} +1 -1
- package/dist/web-components/{p-8563a1ab.entry.js → p-d433a828.entry.js} +1 -1
- package/dist/web-components/p-d7726e46.entry.js +1 -0
- package/dist/web-components/p-d819c8e5.entry.js +1 -0
- package/dist/web-components/p-e2188953.entry.js +1 -0
- package/dist/web-components/{p-3b4e3faf.entry.js → p-e5945c01.entry.js} +1 -1
- package/dist/web-components/{p-d1379ac6.entry.js → p-f9d5004c.entry.js} +1 -1
- package/dist/web-components/web-components.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/r-accordion-item.cjs.entry.js +0 -78
- package/dist/cjs/r-icon-button.cjs.entry.js +0 -81
- package/dist/collection/components/accordion-item/accordion-item.css +0 -121
- package/dist/collection/components/accordion-item/accordion-item.js +0 -138
- package/dist/esm/r-accordion-item.entry.js +0 -76
- package/dist/esm/r-icon-button.entry.js +0 -79
- package/dist/types/components/accordion-item/accordion-item.d.ts +0 -26
- package/dist/web-components/p-00ca474f.entry.js +0 -1
- package/dist/web-components/p-15ac0fdd.entry.js +0 -1
- package/dist/web-components/p-1c956370.entry.js +0 -1
- package/dist/web-components/p-2a512983.entry.js +0 -1
- package/dist/web-components/p-2e18e762.entry.js +0 -1
- package/dist/web-components/p-3bc93d65.entry.js +0 -1
- package/dist/web-components/p-51a5804b.entry.js +0 -1
- package/dist/web-components/p-56da04d8.entry.js +0 -1
- package/dist/web-components/p-5e6aabd8.entry.js +0 -1
- package/dist/web-components/p-656229de.entry.js +0 -1
- package/dist/web-components/p-7775228c.entry.js +0 -1
- package/dist/web-components/p-7ad8e78b.entry.js +0 -1
- package/dist/web-components/p-9e50120b.entry.js +0 -1
- package/dist/web-components/p-a022f356.entry.js +0 -1
- package/dist/web-components/p-a7e7f8fa.entry.js +0 -1
- package/dist/web-components/p-ad9b2a48.entry.js +0 -1
- package/dist/web-components/p-b2f03016.entry.js +0 -1
- package/dist/web-components/p-b87ad83b.entry.js +0 -1
- package/dist/web-components/p-c937bd92.entry.js +0 -1
- package/dist/web-components/p-cbcd7699.entry.js +0 -1
- package/dist/web-components/p-dbe579e8.entry.js +0 -1
- package/dist/web-components/p-e4b66277.entry.js +0 -1
- package/dist/web-components/p-e6a31881.entry.js +0 -1
- package/dist/web-components/p-f2577a3c.entry.js +0 -1
- package/dist/web-components/p-f6a92287.entry.js +0 -1
|
@@ -11,18 +11,32 @@ const InputCode = class {
|
|
|
11
11
|
this.rChange = index.createEvent(this, "rChange");
|
|
12
12
|
this.rValidate = index.createEvent(this, "rValidate");
|
|
13
13
|
this.rReset = index.createEvent(this, "rReset");
|
|
14
|
-
/** Specifies a name for an input for
|
|
14
|
+
/** Specifies a name for an input for submission within formData object. */
|
|
15
15
|
this.name = 'input-code';
|
|
16
|
-
/** Number of digits (typically 4–6)
|
|
16
|
+
/** Number of digits (typically 4–6).
|
|
17
|
+
* @default: 4
|
|
18
|
+
*/
|
|
17
19
|
this.length = 4;
|
|
18
|
-
/** Label for accessibility
|
|
20
|
+
/** Label for accessibility.
|
|
21
|
+
* @default: 'Verification code'
|
|
22
|
+
*/
|
|
19
23
|
this.label = 'Verification code';
|
|
20
|
-
/** Set custom message for `tooShort` property of a ValidityState object (set by `minlength`) within Constrain Validation API */
|
|
21
|
-
this.tooShortMessage = `All ${this.length} characters must be filled.`;
|
|
22
24
|
/** Defines initial value */
|
|
23
25
|
this.value = '';
|
|
26
|
+
/** Specifies the input mode for the virtual keyboard on mobile devices. Default is 'numeric' for OTP codes.
|
|
27
|
+
* @default: 'numeric'
|
|
28
|
+
*/
|
|
29
|
+
this.inputmode = 'numeric';
|
|
30
|
+
/** Specifies the enter key hint for the virtual keyboard. Default is 'done' for OTP completion.
|
|
31
|
+
* @default: 'done'
|
|
32
|
+
*/
|
|
33
|
+
this.enterkeyhint = 'done';
|
|
34
|
+
/** Specifies the autocomplete behavior. Default is 'one-time-code' for SMS OTP autofill.
|
|
35
|
+
* @default: 'one-time-code'
|
|
36
|
+
*/
|
|
37
|
+
this.autocomplete = 'one-time-code';
|
|
24
38
|
/** Holds the current values of each input box */
|
|
25
|
-
this.values =
|
|
39
|
+
this.values = [];
|
|
26
40
|
/** Validity state passed from validateFormElement function after validation */
|
|
27
41
|
this.validityState = '';
|
|
28
42
|
/** Validity message passed from validateFormElement function after validation */
|
|
@@ -109,6 +123,10 @@ const InputCode = class {
|
|
|
109
123
|
this.getValidityStateData = (element) => {
|
|
110
124
|
let validityState = '';
|
|
111
125
|
let validityMessage = '';
|
|
126
|
+
if (!element) {
|
|
127
|
+
validityState = 'valid';
|
|
128
|
+
return { validityState, validityMessage };
|
|
129
|
+
}
|
|
112
130
|
if (this.required && element.value.length === 0) {
|
|
113
131
|
validityState = 'valueMissing';
|
|
114
132
|
validityMessage = this.valueMissingMessage;
|
|
@@ -116,7 +134,7 @@ const InputCode = class {
|
|
|
116
134
|
}
|
|
117
135
|
if (element.value.length > 0 && element.value.length < this.length) {
|
|
118
136
|
validityState = 'tooShort';
|
|
119
|
-
validityMessage = this.tooShortMessage
|
|
137
|
+
validityMessage = this.tooShortMessage || `All ${this.length} characters must be filled.`;
|
|
120
138
|
return { validityState, validityMessage };
|
|
121
139
|
}
|
|
122
140
|
validityState = 'valid';
|
|
@@ -141,7 +159,7 @@ const InputCode = class {
|
|
|
141
159
|
this.onResetForm = async () => {
|
|
142
160
|
if (this.readonly)
|
|
143
161
|
return;
|
|
144
|
-
this.reset();
|
|
162
|
+
await this.reset();
|
|
145
163
|
this.validityState = null;
|
|
146
164
|
this.validityMessage = null;
|
|
147
165
|
this.invalid = null;
|
|
@@ -164,6 +182,19 @@ const InputCode = class {
|
|
|
164
182
|
formData.appendControlToFormData(this.nativeElement || this.host, event.formData);
|
|
165
183
|
};
|
|
166
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Validates segment index and throws descriptive errors if invalid.
|
|
187
|
+
* @param index - The index to validate
|
|
188
|
+
* @throws Error if index is not an integer or out of bounds
|
|
189
|
+
*/
|
|
190
|
+
validateSegmentIndex(index) {
|
|
191
|
+
if (typeof index !== 'number' || !Number.isInteger(index)) {
|
|
192
|
+
throw new Error('Index must be an integer');
|
|
193
|
+
}
|
|
194
|
+
if (index < 0 || index >= this.length) {
|
|
195
|
+
throw new Error(`Index out of bounds: must be between 0 and ${this.length - 1}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
167
198
|
/**
|
|
168
199
|
* Gets the current complete code value by joining all individual digit values.
|
|
169
200
|
* @returns Promise that resolves to the complete code string
|
|
@@ -191,6 +222,10 @@ const InputCode = class {
|
|
|
191
222
|
return;
|
|
192
223
|
}
|
|
193
224
|
const valueArray = Array.from(value).slice(0, this.length).map(char => String(char));
|
|
225
|
+
// Pad with empty strings if value is shorter than length
|
|
226
|
+
while (valueArray.length < this.length) {
|
|
227
|
+
valueArray.push('');
|
|
228
|
+
}
|
|
194
229
|
this.values = valueArray;
|
|
195
230
|
this.rChange.emit({ value: this.values.join('') });
|
|
196
231
|
}
|
|
@@ -202,9 +237,68 @@ const InputCode = class {
|
|
|
202
237
|
const { validityState } = this.getValidityStateData(this.nativeElement);
|
|
203
238
|
return validityState === 'valid';
|
|
204
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Focuses a specific segment (input) by index.
|
|
242
|
+
* @param index - The zero-based index of the segment to focus (0 to length-1)
|
|
243
|
+
* @returns Promise that resolves when focus is set, or rejects if index is invalid
|
|
244
|
+
*/
|
|
245
|
+
async focusSegment(index) {
|
|
246
|
+
this.validateSegmentIndex(index);
|
|
247
|
+
const input = this.inputs[index];
|
|
248
|
+
if (input) {
|
|
249
|
+
input.focus();
|
|
250
|
+
// Select the content if it exists
|
|
251
|
+
if (this.values[index]) {
|
|
252
|
+
setTimeout(() => {
|
|
253
|
+
// Check if setSelectionRange exists (not available in some test environments)
|
|
254
|
+
if (typeof input.setSelectionRange === 'function') {
|
|
255
|
+
input.setSelectionRange(0, 1);
|
|
256
|
+
}
|
|
257
|
+
}, 0);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Gets the value of a specific segment by index.
|
|
263
|
+
* @param index - The zero-based index of the segment (0 to length-1)
|
|
264
|
+
* @returns Promise that resolves to the segment value (single character string or empty string)
|
|
265
|
+
*/
|
|
266
|
+
async getSegmentValue(index) {
|
|
267
|
+
this.validateSegmentIndex(index);
|
|
268
|
+
return this.values[index] || '';
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Sets the value of a specific segment by index.
|
|
272
|
+
* @param index - The zero-based index of the segment (0 to length-1)
|
|
273
|
+
* @param value - The value to set (will be truncated to first character if longer)
|
|
274
|
+
*/
|
|
275
|
+
async setSegmentValue(index, value) {
|
|
276
|
+
this.validateSegmentIndex(index);
|
|
277
|
+
// Take only the first character, or empty string if value is empty
|
|
278
|
+
const newValue = value ? value.charAt(0) : '';
|
|
279
|
+
this.values[index] = newValue;
|
|
280
|
+
this.values = [...this.values];
|
|
281
|
+
// Update the input element's value to reflect the change
|
|
282
|
+
const input = this.inputs[index];
|
|
283
|
+
if (input) {
|
|
284
|
+
input.value = newValue;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
205
287
|
handleValuesChange() {
|
|
206
288
|
this.value = this.values.join('');
|
|
207
289
|
}
|
|
290
|
+
handleLengthChange(newLength) {
|
|
291
|
+
// Adjust values array when length changes
|
|
292
|
+
if (this.values.length !== newLength) {
|
|
293
|
+
const newValues = new Array(newLength).fill('');
|
|
294
|
+
// Copy existing values up to the new length
|
|
295
|
+
for (let i = 0; i < Math.min(this.values.length, newLength); i++) {
|
|
296
|
+
newValues[i] = this.values[i];
|
|
297
|
+
}
|
|
298
|
+
this.values = newValues;
|
|
299
|
+
this.inputs = [];
|
|
300
|
+
}
|
|
301
|
+
}
|
|
208
302
|
get firstEmptyInput() {
|
|
209
303
|
return this.inputs.find(input => !input.value) || null;
|
|
210
304
|
}
|
|
@@ -217,7 +311,7 @@ const InputCode = class {
|
|
|
217
311
|
return null;
|
|
218
312
|
}
|
|
219
313
|
return (this.validityState && this.validityState !== 'valid' ?
|
|
220
|
-
(this.customErrorMessage || this.validityMessage)
|
|
314
|
+
(this.customErrorMessage || this.validityMessage || `All ${this.length} characters must be filled.`)
|
|
221
315
|
: null);
|
|
222
316
|
}
|
|
223
317
|
get ariaDescribedBy() {
|
|
@@ -295,19 +389,20 @@ const InputCode = class {
|
|
|
295
389
|
id: `${uniqueId}-label`,
|
|
296
390
|
fieldIndicator
|
|
297
391
|
} : {};
|
|
298
|
-
return (index.h(index.Host, { key: '
|
|
392
|
+
return (index.h(index.Host, { key: '4d744320f4bf03760e4b11dd38934c0f7ce05223', value: this.value, onClick: this.onHostClick }, index.h("div", { key: 'f047f6669b243f301a2a462188d24721ccb565a5', class: "r-input-code--label-container" }, index.h("label", { key: 'a5acdd7308cca3981a78619c480d79c499ebc58a', htmlFor: uniqueId }, label ?
|
|
299
393
|
index.h("r-label", Object.assign({}, labelAttr), label)
|
|
300
394
|
:
|
|
301
|
-
index.h("slot", { name: "label" })), index.h("slot", { key: '
|
|
302
|
-
index.h("r-hint", { key: '
|
|
303
|
-
index.h("r-icon", { key: '
|
|
304
|
-
index.h("slot", { key: '
|
|
305
|
-
index.h("r-icon", { key: '
|
|
306
|
-
index.h("r-hint", { key: '
|
|
395
|
+
index.h("slot", { name: "label" })), index.h("slot", { key: '696554954e2b29b49a8d639aa79d80abeaa6a729', name: "popover" })), hint &&
|
|
396
|
+
index.h("r-hint", { key: '58b3e011e49b4a3bd4dd31050ab554483fba0fc4', id: `${uniqueId}-hint`, role: "note" }, hint), index.h("div", { key: '6f4668b5bda975b59ff269759e2d3ae3306b09c4', class: "r-input-code--container", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.groupDescribedby }, index.h("slot", { key: '59206e0ed6e335735b610c44a925ea70b137ffe0', name: "leading" }), Array.from({ length: this.length }).map((_, i) => (index.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 }))), index.h("input", Object.assign({ key: '815da7a7566b0cefdbdfda32c990637385eba304', type: "hidden" }, inputAttrs, { value: this.values.join(''), ref: el => this.nativeElement = el })), index.h("div", { key: 'b03d7e03bd6c91d441f4377d53bb7d845edf498d', class: "r-input-code--trailing" }, this.readonly &&
|
|
397
|
+
index.h("r-icon", { key: '53796d1b572ff2eac8297a0fad8e22d3a95f1bee', class: "r-input-code--readonly-icon", name: "pen-disabled", size: "s" }), this.hasTrailingSlot &&
|
|
398
|
+
index.h("slot", { key: '9becd49e7d79f824fcd79e7afbc3040a1b0f33a3', name: "trailing" }, valid &&
|
|
399
|
+
index.h("r-icon", { key: 'a31379d7e8eb6ad66bbf1567d4cd4f9526962226', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" })))), index.h("slot", { key: 'a38ac5d9dda2017a443ec2b58cffbdd0db952239', name: "message" }, this.hasMessage &&
|
|
400
|
+
index.h("r-hint", { key: '39e47e0fdf23b1ebab5a0384447a965a8890d77f', "aria-live": "polite", id: `${uniqueId}-message`, variant: "error" }, this.message))));
|
|
307
401
|
}
|
|
308
402
|
get host() { return index.getElement(this); }
|
|
309
403
|
static get watchers() { return {
|
|
310
|
-
"values": ["handleValuesChange"]
|
|
404
|
+
"values": ["handleValuesChange"],
|
|
405
|
+
"length": ["handleLengthChange"]
|
|
311
406
|
}; }
|
|
312
407
|
};
|
|
313
408
|
InputCode.style = inputCodeCss;
|
|
@@ -481,7 +481,7 @@ const InputDate = class {
|
|
|
481
481
|
this.disconnectFormEventListeners();
|
|
482
482
|
}
|
|
483
483
|
render() {
|
|
484
|
-
const { form, name, required, disabled, label, fieldIndicator, hint,
|
|
484
|
+
const { form, name, required, disabled, label, fieldIndicator, hint, uniqueId, invalid, valid, readonly } = this;
|
|
485
485
|
const groupAttrs = {
|
|
486
486
|
'aria-invalid': `${invalid || false}`,
|
|
487
487
|
'aria-describedby': this.ariaDescribedBy
|
|
@@ -495,24 +495,18 @@ const InputDate = class {
|
|
|
495
495
|
readonly,
|
|
496
496
|
'aria-describedby': this.ariaDescribedBy
|
|
497
497
|
};
|
|
498
|
-
// DEPRECATED: will be removed in November 2025 release.
|
|
499
|
-
const tooltipAttrs = tooltip ? {
|
|
500
|
-
tooltip,
|
|
501
|
-
'tooltip-icon': tooltipIcon,
|
|
502
|
-
'tooltip-icon-color': tooltipIconColor,
|
|
503
|
-
} : {};
|
|
504
498
|
const labelAttr = label ? {
|
|
505
499
|
id: `${uniqueId}-label`,
|
|
506
500
|
fieldIndicator
|
|
507
501
|
} : {};
|
|
508
|
-
return (index.h(index.Host, { key: '
|
|
509
|
-
index.h("r-label", Object.assign({}, labelAttr
|
|
502
|
+
return (index.h(index.Host, { key: '1a8a9175148f43758ec6b9d905c4bd2f619ffd7f', onClick: this.onHostClick, "data-touched": `${this.touched}`, "data-dirty": `${this.dirty}` }, index.h("fieldset", Object.assign({ key: 'fb004332d8578b8da74df643bd93f93d062973bb', class: "r-input-date" }, groupAttrs), index.h("div", { key: '128e65638dc21d95c8b4b92669b0bd6733a653f6', class: "r-input-date--legend-container" }, index.h("legend", { key: '63e7e858c38930fecbe71d819f1a0b49bf711911', class: "r-input-date--legend" }, index.h("label", { key: 'ccd6a5434f5df91bf9b2c121bb182c152302d864', htmlFor: uniqueId }, label ?
|
|
503
|
+
index.h("r-label", Object.assign({}, labelAttr), label)
|
|
510
504
|
:
|
|
511
|
-
index.h("slot", { name: "label" }))), index.h("slot", { key: '
|
|
512
|
-
index.h("r-hint", { key: '
|
|
513
|
-
index.h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), index.h("input", Object.assign({ key: '
|
|
514
|
-
index.h("r-icon", { key: '
|
|
515
|
-
index.h("r-icon", { key: '
|
|
505
|
+
index.h("slot", { name: "label" }))), index.h("slot", { key: '4be5c643d1b0532d27f4b82692cb6ca937291d6b', name: "popover" })), hint &&
|
|
506
|
+
index.h("r-hint", { key: '07a912c146dff97ef991a6e375f4aeb8cd0ba45e', id: `${uniqueId}-hint`, role: "note" }, hint), index.h("div", { key: '386dfb87cface9333c93d5fe8165cbe52a9a83c4', class: "r-input-date--container" }, index.h("r-icon", { key: '9ff075723ac54f6d7c2325ba59f833422404bee6', name: "calendar", size: "s", class: "r-input-date--calendar-icon" }), index.h("div", { key: 'ebcb76a92ab1591c3128a60d6620bea5b0c517ec', class: "r-input-date--inputs" }, this.inputOrder.map((input, i) => (index.h(index.Fragment, null, index.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 &&
|
|
507
|
+
index.h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), index.h("input", Object.assign({ key: 'e5736ffa215662436c539332be1414cc409ce448', type: "hidden" }, dateInputAttrs, { value: this.value, ref: (el) => this.nativeElement = el }))), index.h("div", { key: '45ccffbb4111f2fd906d9b687f62f4adc83b62aa', class: "r-input-date--trailing" }, this.readonly &&
|
|
508
|
+
index.h("r-icon", { key: '3a5433e3d601a83154687bdd55feeeef0ef04215', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
|
|
509
|
+
index.h("r-icon", { key: '03de3e49b8b51690e4fb6c2edbb7a53ca1a71f76', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }), this.hasTrailingSlot && index.h("slot", { key: 'db4911a4421b296effdd37ca08c96d8a0096e5e6', name: "trailing" }))), index.h("div", { key: 'd21f19188462be93812487702eb8a07fd3a91cea', id: `${uniqueId}-message`, "aria-live": "polite", class: "r-input-date--message" }, this.hasMessage && index.h("r-hint", { key: '6937f2d48a634308c97d33e59daa0a7242bd39fd', variant: "error" }, this.message)))));
|
|
516
510
|
}
|
|
517
511
|
get host() { return index.getElement(this); }
|
|
518
512
|
static get watchers() { return {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var index = require('./index-DJ4H_bFj.js');
|
|
4
4
|
var formData = require('./formData-B2DZyLxP.js');
|
|
5
5
|
|
|
6
|
-
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}";
|
|
6
|
+
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}";
|
|
7
7
|
|
|
8
8
|
const InputPassword = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -12,6 +12,7 @@ const InputPassword = class {
|
|
|
12
12
|
this.rInput = index.createEvent(this, "rInput");
|
|
13
13
|
this.rChange = index.createEvent(this, "rChange");
|
|
14
14
|
this.rReset = index.createEvent(this, "rReset");
|
|
15
|
+
this.rVisibilityChange = index.createEvent(this, "rVisibilityChange");
|
|
15
16
|
/** The value of the password input */
|
|
16
17
|
this.value = '';
|
|
17
18
|
/**
|
|
@@ -152,6 +153,7 @@ const InputPassword = class {
|
|
|
152
153
|
async showPassword() {
|
|
153
154
|
this.showed = true;
|
|
154
155
|
this.alertOnPasswordVisibilityChange();
|
|
156
|
+
this.rVisibilityChange.emit({ element: this.host, visible: true });
|
|
155
157
|
}
|
|
156
158
|
/**
|
|
157
159
|
* Hide password text.
|
|
@@ -159,6 +161,7 @@ const InputPassword = class {
|
|
|
159
161
|
async hidePassword() {
|
|
160
162
|
this.showed = false;
|
|
161
163
|
this.alertOnPasswordVisibilityChange();
|
|
164
|
+
this.rVisibilityChange.emit({ element: this.host, visible: false });
|
|
162
165
|
}
|
|
163
166
|
/** Get the input value */
|
|
164
167
|
async getValue() {
|
|
@@ -227,11 +230,14 @@ const InputPassword = class {
|
|
|
227
230
|
this.disconnectFormEventListeners();
|
|
228
231
|
}
|
|
229
232
|
render() {
|
|
230
|
-
const { name, placeholder, required, fieldIndicator, value, disabled, form, invalid, valid, hint, label,
|
|
233
|
+
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;
|
|
231
234
|
const inputAttrs = {
|
|
232
235
|
name,
|
|
233
236
|
placeholder,
|
|
234
237
|
required,
|
|
238
|
+
minlength,
|
|
239
|
+
maxlength,
|
|
240
|
+
pattern,
|
|
235
241
|
fieldIndicator,
|
|
236
242
|
value,
|
|
237
243
|
disabled,
|
|
@@ -240,15 +246,17 @@ const InputPassword = class {
|
|
|
240
246
|
valid,
|
|
241
247
|
hint,
|
|
242
248
|
label,
|
|
243
|
-
tooltip,
|
|
244
|
-
tooltipIcon,
|
|
245
|
-
tooltipIconColor,
|
|
246
249
|
fullWidth,
|
|
247
250
|
novalidate: true,
|
|
248
|
-
readonly
|
|
251
|
+
readonly,
|
|
252
|
+
passwordrules,
|
|
253
|
+
autocomplete,
|
|
254
|
+
tooLongMessage,
|
|
255
|
+
tooShortMessage,
|
|
256
|
+
patternMismatchMessage
|
|
249
257
|
};
|
|
250
|
-
return (index.h(index.Host, { key: '
|
|
251
|
-
index.h("r-hint", { key: '
|
|
258
|
+
return (index.h(index.Host, { key: '15d9cac9269a816de47d1ae4d3818a99f6229979' }, index.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 }), index.h("r-icon", { key: 'd7a425d45f7897d7f6f11b7bf37595e25da3295b', name: "padlock-closed", size: "s", slot: "leading" }), index.h("slot", { key: '6ae8e4dc4633e692ae4280d9cd1420bf7e02d0c0', name: "popover", slot: "popover" }), index.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 &&
|
|
259
|
+
index.h("r-hint", { key: 'bcee0a5b7f75a4ddd2e2fa6a2dd44cd0392170dc', slot: "message", variant: "error" }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))), index.h("div", { key: '995e229dfab56b03e0a177c6952c2135777f7899', class: "visually-hidden", ref: el => this.passwordVisibilityChangeAlertContainer = el, "aria-live": "polite" })));
|
|
252
260
|
}
|
|
253
261
|
get host() { return index.getElement(this); }
|
|
254
262
|
};
|
|
@@ -2494,14 +2494,10 @@ const InputPhoneNumber = class {
|
|
|
2494
2494
|
this.disconnectEventListeners();
|
|
2495
2495
|
}
|
|
2496
2496
|
render() {
|
|
2497
|
-
const { label, fieldIndicator, hint, name, form, inputLabel,
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
'tooltip-icon': tooltipIcon,
|
|
2502
|
-
'tooltip-icon-color': tooltipIconColor,
|
|
2503
|
-
} : {};
|
|
2504
|
-
const labelAttr = Object.assign({ fieldIndicator }, tooltipAttrs);
|
|
2497
|
+
const { label, fieldIndicator, hint, name, form, inputLabel, disabled, uniqueId, required, valid, invalid, novalidate, phoneNumber, fullPhoneNumber, fullWidth } = this;
|
|
2498
|
+
const labelAttr = {
|
|
2499
|
+
fieldIndicator
|
|
2500
|
+
};
|
|
2505
2501
|
const inputAttrs = {
|
|
2506
2502
|
id: uniqueId,
|
|
2507
2503
|
form,
|
|
@@ -2511,10 +2507,9 @@ const InputPhoneNumber = class {
|
|
|
2511
2507
|
disabled,
|
|
2512
2508
|
'aria-describedby': this.ariaDescribedBy
|
|
2513
2509
|
};
|
|
2514
|
-
return (index.h(index.Host, { key: '
|
|
2515
|
-
index.h("r-label", Object.assign({ key: '
|
|
2516
|
-
index.h("r-hint", { key: '
|
|
2517
|
-
index.h("r-icon", { key: '09c721cb014d6d7ece724bcf7de9ec5928624dac', slot: "trailing", name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }))), index.h("input", Object.assign({ key: 'e2eef2512f9125f0dd3d1b09120cbb77955350bd', type: "hidden" }, inputAttrs, { readonly: this.readonly, value: fullPhoneNumber, ref: el => this.nativeElement = el })), index.h("r-hint", { key: 'a12e9640bcf2df7b754de4e54b111e4ead2d023e', "aria-live": "polite", "aria-atomic": "true", id: `${uniqueId}-message`, class: !this.hasMessage && 'visually-hidden', variant: "error" }, this.hasMessage ? (this.hasError ? this.error : this.validityMessage) : '')));
|
|
2510
|
+
return (index.h(index.Host, { key: '97edc0f9bbc4a3823e628bb08be3b3abbbcfe6ec' }, index.h("div", { key: '8a5236c58655d47368bfaa9bcea6bde3c39c6a22', class: "r-input-phone-number--label-container" }, index.h("label", { key: 'ae6e6e72381864d67d98f4429856cf5b1943943c', id: `${uniqueId}-label` }, label &&
|
|
2511
|
+
index.h("r-label", Object.assign({ key: 'd760960dbf5806084b0a10d14fef218ca5e4cd79' }, labelAttr), label)), index.h("slot", { key: '4f9bcaba34f2f49592a3167958bd091eeac9f6be', name: "popover" })), hint &&
|
|
2512
|
+
index.h("r-hint", { key: '0c3f402b7f9369dcea2c84478e12ed0ea241fd0a', id: `${uniqueId}-hint`, role: "note" }, hint), index.h("div", { key: '43e5dbd9ca897cfc2ca05e6ab020c321871f3961', class: "r-input-phone-number", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.ariaDescribedBy }, index.h("slot", { key: '4e3f891eb21f15927d6a33e7ba6728c09d20e981' }), index.h("r-input", { key: '6bd6e929e396bf515511fdd978d00df9de54cc37', label: inputLabel, value: phoneNumber, internal: true, valid: valid, invalid: invalid, required: required, readonly: this.readonly, novalidate: true, fullWidth: fullWidth, type: "tel", error: this.errorMessage || '', onRInput: this.handleOnInput, onRChange: this.handleInputOnChange, disabled: disabled })), index.h("input", Object.assign({ key: 'f113123ef2fa2096b686d132ce11ca11970ab1be', type: "hidden" }, inputAttrs, { readonly: this.readonly, value: fullPhoneNumber, ref: el => this.nativeElement = el })), index.h("r-hint", { key: 'd00477c3a27f999c4a3079710c34266ed47e0e57', "aria-live": "polite", "aria-atomic": "true", id: `${uniqueId}-message`, class: !this.hasMessage && 'visually-hidden', variant: "error" }, this.hasMessage ? (this.hasError ? this.error : this.validityMessage) : '')));
|
|
2518
2513
|
}
|
|
2519
2514
|
get host() { return index.getElement(this); }
|
|
2520
2515
|
static get watchers() { return {
|