@riverty/web-components 6.2.1 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +78 -0
- package/custom-elements.json +4 -0
- package/dist/cjs/index-BnETQtSf.js +16 -16
- package/dist/cjs/index.cjs.js +35 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/r-alert.cjs.entry.js +1 -1
- package/dist/cjs/r-badge.cjs.entry.js +3 -2
- package/dist/cjs/r-button.cjs.entry.js +1 -1
- package/dist/cjs/r-checkbox-group.cjs.entry.js +5 -0
- package/dist/cjs/r-checkbox.cjs.entry.js +9 -4
- package/dist/cjs/r-dialog.cjs.entry.js +2 -2
- package/dist/cjs/r-hint_2.cjs.entry.js +4 -4
- package/dist/cjs/r-icon-button_2.cjs.entry.js +43 -18
- package/dist/cjs/r-input-code.cjs.entry.js +11 -6
- package/dist/cjs/r-input-date.cjs.entry.js +11 -6
- package/dist/cjs/r-input-password.cjs.entry.js +8 -3
- package/dist/cjs/r-input-phone-number.cjs.entry.js +6 -6
- package/dist/cjs/r-input.cjs.entry.js +249 -33
- package/dist/cjs/r-pagination.cjs.entry.js +9 -3
- 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 +2 -2
- 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 +5 -5
- package/dist/cjs/r-radio-group.cjs.entry.js +8 -5
- package/dist/cjs/r-select-option.cjs.entry.js +1 -1
- package/dist/cjs/r-select.cjs.entry.js +10 -4
- 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 +2 -2
- package/dist/cjs/r-tabs-list.cjs.entry.js +3 -3
- package/dist/cjs/r-tabs.cjs.entry.js +1 -1
- package/dist/cjs/r-toast-group.cjs.entry.js +1 -1
- package/dist/cjs/r-toast.cjs.entry.js +17 -9
- package/dist/cjs/web-components.cjs.js +1 -1
- package/dist/collection/components/alert/alert.css +1 -0
- package/dist/collection/components/badge/badge.css +10 -0
- package/dist/collection/components/badge/badge.js +5 -1
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +30 -4
- package/dist/collection/components/checkbox-group/checkbox-group.js +26 -0
- package/dist/collection/components/dialog/dialog.js +2 -2
- 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/exports.js +46 -0
- package/dist/collection/components/input/input.css +6 -0
- package/dist/collection/components/input/input.js +321 -32
- package/dist/collection/components/input-code/input-code.js +32 -6
- package/dist/collection/components/input-date/input-date.js +32 -6
- package/dist/collection/components/input-password/input-password.js +29 -3
- package/dist/collection/components/input-phone-number/input-phone-number.js +25 -6
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/pagination/pagination.js +18 -3
- package/dist/collection/components/panel/panel.js +2 -2
- package/dist/collection/components/popover/popover.js +2 -2
- 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 +5 -5
- 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 +8 -5
- package/dist/collection/components/select/select.js +31 -4
- 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 +2 -2
- 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 +3 -3
- package/dist/collection/components/toast/toast.js +17 -9
- package/dist/collection/components/toast-group/toast-group.js +1 -1
- package/dist/collection/components/tooltip/tooltip.css +34 -63
- package/dist/collection/components/tooltip/tooltip.js +39 -14
- package/dist/collection/index.js +2 -1
- package/dist/collection/utils/version-checker.js +33 -0
- package/dist/esm/index-CTxpqopm.js +16 -16
- package/dist/esm/index.js +34 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/r-alert.entry.js +1 -1
- package/dist/esm/r-badge.entry.js +3 -2
- package/dist/esm/r-button.entry.js +1 -1
- package/dist/esm/r-checkbox-group.entry.js +5 -0
- package/dist/esm/r-checkbox.entry.js +9 -4
- package/dist/esm/r-dialog.entry.js +2 -2
- package/dist/esm/r-hint_2.entry.js +4 -4
- package/dist/esm/r-icon-button_2.entry.js +43 -18
- package/dist/esm/r-input-code.entry.js +11 -6
- package/dist/esm/r-input-date.entry.js +11 -6
- package/dist/esm/r-input-password.entry.js +8 -3
- package/dist/esm/r-input-phone-number.entry.js +6 -6
- package/dist/esm/r-input.entry.js +249 -33
- package/dist/esm/r-pagination.entry.js +9 -3
- 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 +2 -2
- 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 +5 -5
- package/dist/esm/r-radio-group.entry.js +8 -5
- package/dist/esm/r-select-option.entry.js +1 -1
- package/dist/esm/r-select.entry.js +10 -4
- 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 +2 -2
- package/dist/esm/r-tabs-list.entry.js +3 -3
- package/dist/esm/r-tabs.entry.js +1 -1
- package/dist/esm/r-toast-group.entry.js +1 -1
- package/dist/esm/r-toast.entry.js +17 -9
- package/dist/esm/web-components.js +1 -1
- package/dist/types/components/badge/badge.d.ts +3 -0
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/checkbox-group/checkbox-group.d.ts +2 -0
- package/dist/types/components/input/exports.d.ts +45 -0
- package/dist/types/components/input/input.d.ts +66 -1
- package/dist/types/components/input-code/input-code.d.ts +2 -0
- package/dist/types/components/input-date/input-date.d.ts +2 -0
- package/dist/types/components/input-password/input-password.d.ts +2 -0
- package/dist/types/components/input-phone-number/input-phone-number.d.ts +2 -0
- package/dist/types/components/pagination/pagination.d.ts +1 -1
- package/dist/types/components/radio-group/radio-group.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +2 -0
- package/dist/types/components/tooltip/tooltip.d.ts +1 -0
- package/dist/types/components.d.ts +63 -2
- package/dist/types/utils/version-checker.d.ts +1 -0
- package/dist/web-components/index.esm.js +1 -0
- package/dist/web-components/{p-253068b9.entry.js → p-01aefcf0.entry.js} +1 -1
- package/dist/web-components/p-05cb55db.entry.js +1 -0
- package/dist/web-components/{p-477614c5.entry.js → p-11b22309.entry.js} +1 -1
- package/dist/web-components/{p-562051aa.entry.js → p-2d878934.entry.js} +1 -1
- package/dist/web-components/p-325dbedf.entry.js +1 -0
- package/dist/web-components/{p-10cc9983.entry.js → p-34b9457b.entry.js} +1 -1
- package/dist/web-components/{p-e5b943a2.entry.js → p-36abd05a.entry.js} +1 -1
- package/dist/web-components/{p-d2447e30.entry.js → p-386d1ef9.entry.js} +1 -1
- package/dist/web-components/{p-4de76291.entry.js → p-3d67b77b.entry.js} +1 -1
- package/dist/web-components/{p-93435fcd.entry.js → p-4b12fbc0.entry.js} +1 -1
- package/dist/web-components/p-52f7b505.entry.js +1 -0
- package/dist/web-components/{p-bfc7e6c0.entry.js → p-57ebc474.entry.js} +1 -1
- package/dist/web-components/{p-a1086abe.entry.js → p-57edf7f4.entry.js} +1 -1
- package/dist/web-components/{p-cc363c3d.entry.js → p-69a24fe2.entry.js} +1 -1
- package/dist/web-components/{p-e67b13df.entry.js → p-6d92648c.entry.js} +1 -1
- package/dist/web-components/p-75052597.entry.js +1 -0
- package/dist/web-components/{p-9de3a1a5.entry.js → p-7b2c5b63.entry.js} +1 -1
- package/dist/web-components/p-7bf463ff.entry.js +1 -0
- package/dist/web-components/{p-8e125826.entry.js → p-838e43d4.entry.js} +1 -1
- package/dist/web-components/p-8c16d038.entry.js +1 -0
- package/dist/web-components/{p-075a8dc8.entry.js → p-8f8313de.entry.js} +1 -1
- package/dist/web-components/{p-3beacdab.entry.js → p-9026d5a2.entry.js} +1 -1
- package/dist/web-components/p-9c31c7c4.entry.js +1 -0
- package/dist/web-components/p-9c415b9c.entry.js +1 -0
- package/dist/web-components/p-b303b2cc.entry.js +1 -0
- package/dist/web-components/p-b8df041d.entry.js +1 -0
- package/dist/web-components/p-bc30844f.entry.js +1 -0
- package/dist/web-components/{p-bde44ec4.entry.js → p-c4a77a65.entry.js} +1 -1
- package/dist/web-components/{p-d0310ed4.entry.js → p-c549addf.entry.js} +1 -1
- package/dist/web-components/p-c65df19f.entry.js +1 -0
- package/dist/web-components/p-cf3f044d.entry.js +1 -0
- package/dist/web-components/p-d9778cfa.entry.js +1 -0
- package/dist/web-components/{p-44f87e16.entry.js → p-dbe4ccb8.entry.js} +1 -1
- package/dist/web-components/p-ded50850.entry.js +1 -0
- package/dist/web-components/{p-02b22f8e.entry.js → p-e5be895b.entry.js} +1 -1
- package/dist/web-components/{p-495ba3d2.entry.js → p-e6b34c1e.entry.js} +1 -1
- package/dist/web-components/p-ec3c4800.entry.js +1 -0
- package/dist/web-components/p-f670fd87.entry.js +1 -0
- package/dist/web-components/web-components.esm.js +1 -1
- package/package.json +3 -2
- package/dist/web-components/p-3b8c8951.entry.js +0 -1
- package/dist/web-components/p-4214867d.entry.js +0 -1
- package/dist/web-components/p-42c857e9.entry.js +0 -1
- package/dist/web-components/p-5b850e0f.entry.js +0 -1
- package/dist/web-components/p-6013dfc8.entry.js +0 -1
- package/dist/web-components/p-62e7ae04.entry.js +0 -1
- package/dist/web-components/p-71519d37.entry.js +0 -1
- package/dist/web-components/p-88f7b47f.entry.js +0 -1
- package/dist/web-components/p-8975a6a3.entry.js +0 -1
- package/dist/web-components/p-91cc0bde.entry.js +0 -1
- package/dist/web-components/p-947969d7.entry.js +0 -1
- package/dist/web-components/p-bbba6d79.entry.js +0 -1
- package/dist/web-components/p-c1030394.entry.js +0 -1
- package/dist/web-components/p-caf8f067.entry.js +0 -1
- package/dist/web-components/p-cf4ff357.entry.js +0 -1
- package/dist/web-components/p-dc9cca06.entry.js +0 -1
- package/dist/web-components/p-efec231a.entry.js +0 -1
|
@@ -22,8 +22,8 @@ export class Hint {
|
|
|
22
22
|
return this.hasIconSlot || this.iconName !== null;
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
return (h(Host, { key: '
|
|
26
|
-
h("div", { key: '
|
|
25
|
+
return (h(Host, { key: 'b413c5c8e37c0918ad6d3c8b029d3f9d4df9381c' }, h("div", { key: '4de7efeccab67a041140550b01fd971c61c9aabf', class: "r-hint" }, this.hasIcon &&
|
|
26
|
+
h("div", { key: '3e4157da31557769f1aa0ef4576a40b080349f26', class: "r-hint--icon" }, h("slot", { key: '160ed96c348de4372afa0937f7c15582f7068437', name: "icon" }, this.iconName && h("r-icon", { key: '232afba86ec9215fedd795768c918e58878defb6', name: this.iconName, size: "s" }))), h("div", { key: 'f828794b26cbd73587394fd6d8b271952470a5e6', class: "r-hint--text" }, h("slot", { key: '948cdaca6c2b93b45e26333126193cb34874b303' })))));
|
|
27
27
|
}
|
|
28
28
|
static get is() { return "r-hint"; }
|
|
29
29
|
static get encapsulation() { return "shadow"; }
|
|
@@ -62,11 +62,11 @@ export class IconButton {
|
|
|
62
62
|
name,
|
|
63
63
|
size
|
|
64
64
|
};
|
|
65
|
-
const buttonTemplate = () => (h("button", Object.assign({ key: '
|
|
65
|
+
const buttonTemplate = () => (h("button", Object.assign({ key: 'df699957ba93858e755bfdf29de83a3ab9718fe3', type: "button", tabindex: !this.disabled && this.rTabindex || null, class: "r-icon-button", "aria-label": this.host.getAttribute('aria-label') || null }, buttonAttrs, { onClick: this._handleClick, onFocus: this.onFocus, onBlur: this.onBlur, ref: (el) => (this.nativeElement = el) }), name ?
|
|
66
66
|
h("r-icon", Object.assign({}, iconAttrs))
|
|
67
67
|
:
|
|
68
|
-
h("r-icon", { size: size, class: "r-icon-button--icon" }, h("slot", null)), h("span", { key: '
|
|
69
|
-
return (h(Host, { key: '
|
|
68
|
+
h("r-icon", { size: size, class: "r-icon-button--icon" }, h("slot", null)), h("span", { key: '86e9640751a2e75f24ba6eb1d75850251f629579', class: "r-icon-button--label visually-hidden" }, this.label), h("span", { key: '509e3f6870a4da1e788082a8af5a50c93e8360b5', class: "r-icon-button--target-area" })));
|
|
69
|
+
return (h(Host, { key: 'e829d0c5038ebe4893b998b832bbff3c62335327' }, !disabled && tooltipText ?
|
|
70
70
|
h("r-tooltip", { text: tooltipText, position: tooltipPosition }, buttonTemplate())
|
|
71
71
|
:
|
|
72
72
|
buttonTemplate()));
|
|
@@ -14,3 +14,49 @@ export const inputAutocompleteArray = [
|
|
|
14
14
|
];
|
|
15
15
|
export const enterKeyHintArray = ['enter', 'done', 'go', 'next', 'previous', 'search', 'send'];
|
|
16
16
|
export const autocapitalizeArray = ['off', 'none', 'on', 'sentences', 'words', 'characters'];
|
|
17
|
+
/**
|
|
18
|
+
* Native HTML input attributes that can be passed through.
|
|
19
|
+
* Using Set for O(1) lookup performance instead of O(n) array includes.
|
|
20
|
+
*/
|
|
21
|
+
export const nativeInputAttributesSet = new Set([
|
|
22
|
+
'accept', 'autocorrect', 'capture', 'dirname',
|
|
23
|
+
'height', 'incremental', 'list', 'multiple', 'size', 'src', 'width'
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Special case mappings for attributes that need custom camelCase conversion
|
|
27
|
+
* beyond simple hyphen-based transformation. Maps HTML attribute name (lowercase)
|
|
28
|
+
* to JSX property name (camelCase).
|
|
29
|
+
*/
|
|
30
|
+
export const attributeCamelCaseMap = {
|
|
31
|
+
'autocorrect': 'autoCorrect',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Component-specific props that should NOT be passed to the native input.
|
|
35
|
+
* Using Set for O(1) lookup performance.
|
|
36
|
+
*/
|
|
37
|
+
export const excludedAttributesSet = new Set([
|
|
38
|
+
'internal', 'full-width', 'fullwidth', 'validity-marker', 'validitymarker',
|
|
39
|
+
'error', 'valid', 'invalid', 'hint', 'field-indicator', 'fieldindicator',
|
|
40
|
+
'value-missing-message', 'valuemissingmessage', 'type-mismatch-message', 'typemismatchmessage',
|
|
41
|
+
'pattern-mismatch-message', 'patternmismatchmessage', 'too-long-message', 'toolongmessage',
|
|
42
|
+
'too-short-message', 'tooshortmessage', 'range-overflow-message', 'rangeoverflowmessage',
|
|
43
|
+
'range-underflow-message', 'rangeunderflowmessage', 'step-mismatch-message', 'stepmismatchmessage',
|
|
44
|
+
'bad-input-message', 'badinputmessage', 'custom-error-message', 'customerrormessage'
|
|
45
|
+
]);
|
|
46
|
+
/**
|
|
47
|
+
* Framework/DOM-specific attributes that should never be passed through.
|
|
48
|
+
*/
|
|
49
|
+
export const frameworkAttributesSet = new Set([
|
|
50
|
+
'class', 'style', 'id', 'slot', 'ref', 'key'
|
|
51
|
+
]);
|
|
52
|
+
/**
|
|
53
|
+
* ARIA attributes that are already handled explicitly by the component
|
|
54
|
+
* and should not be passed through to avoid conflicts.
|
|
55
|
+
*/
|
|
56
|
+
export const managedAriaAttributesSet = new Set([
|
|
57
|
+
'aria-invalid',
|
|
58
|
+
'aria-required',
|
|
59
|
+
'aria-placeholder',
|
|
60
|
+
'aria-describedby',
|
|
61
|
+
'data-value'
|
|
62
|
+
]);
|
|
@@ -46,6 +46,12 @@
|
|
|
46
46
|
--r-input--container--background-color: var(--r-status-error-soft, #fef6f6);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
:host([size]) {
|
|
50
|
+
--r-input--width: auto;
|
|
51
|
+
--r-input--input--width: auto;
|
|
52
|
+
--r-input--container--display: inline-flex;
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
.r-input {
|
|
50
56
|
display: var(--r-input--display, flex);
|
|
51
57
|
flex: var(--r-input--flex, 1);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { nativeInputAttributesSet, excludedAttributesSet, frameworkAttributesSet, managedAriaAttributesSet, attributeCamelCaseMap } from "./exports";
|
|
2
3
|
import { appendControlToFormData } from "../../utils/formData";
|
|
3
4
|
export class RInput {
|
|
4
5
|
constructor() {
|
|
@@ -11,6 +12,8 @@ export class RInput {
|
|
|
11
12
|
* Current value. Mutable: can be changed programmatically or through user input.
|
|
12
13
|
*/
|
|
13
14
|
this.value = '';
|
|
15
|
+
/** Internal state for options extracted from slotted datalist */
|
|
16
|
+
this.slottedOptions = [];
|
|
14
17
|
/**
|
|
15
18
|
* When `true` field renders valid/invalid marker within.
|
|
16
19
|
*/
|
|
@@ -26,11 +29,37 @@ export class RInput {
|
|
|
26
29
|
/** Private flag to prevent validation during reset */
|
|
27
30
|
this.isResetting = false;
|
|
28
31
|
this.nativeElement = null;
|
|
32
|
+
/**
|
|
33
|
+
* Helper to set the native input element ref and apply boolean properties
|
|
34
|
+
* that don't get properly set through JSX attribute spreading.
|
|
35
|
+
*/
|
|
36
|
+
this.setNativeInputRef = (el) => {
|
|
37
|
+
this.nativeElement = el;
|
|
38
|
+
if (el) {
|
|
39
|
+
el.addEventListener('beforeinput', this.onBeforeInput);
|
|
40
|
+
// Manually apply boolean native attributes as properties
|
|
41
|
+
// This is necessary because Stencil's JSX doesn't always properly
|
|
42
|
+
// set boolean DOM properties when spreading attributes
|
|
43
|
+
const passthroughAttrs = this.collectNativeAttributes();
|
|
44
|
+
// List of boolean native input properties that need manual application
|
|
45
|
+
const booleanProps = ['multiple'];
|
|
46
|
+
for (const prop of booleanProps) {
|
|
47
|
+
if (prop in passthroughAttrs && passthroughAttrs[prop] === true) {
|
|
48
|
+
el[prop] = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
29
53
|
this.uniqueId = `r-input-${Date.now().toString(32)}${Math.random().toString(32)}`.replace(/\./g, '');
|
|
30
54
|
/**
|
|
31
55
|
* Initial attributes state
|
|
32
56
|
* */
|
|
33
57
|
this.initial = {};
|
|
58
|
+
/**
|
|
59
|
+
* Cache for passthrough attributes to avoid recomputing on every render.
|
|
60
|
+
* Cleared when attributes might have changed.
|
|
61
|
+
*/
|
|
62
|
+
this.passthroughAttrsCache = null;
|
|
34
63
|
this.getValidityStateData = (element) => {
|
|
35
64
|
let validityState = '';
|
|
36
65
|
let validityMessage = '';
|
|
@@ -106,9 +135,25 @@ export class RInput {
|
|
|
106
135
|
this.host.classList.add('focused');
|
|
107
136
|
this.rFocus.emit();
|
|
108
137
|
};
|
|
138
|
+
this.onBeforeInput = (event) => {
|
|
139
|
+
this.rBeforeInput.emit(event);
|
|
140
|
+
};
|
|
141
|
+
this.onInvalid = (event) => {
|
|
142
|
+
this.rInvalid.emit(event);
|
|
143
|
+
};
|
|
144
|
+
this.onKeyDown = (event) => {
|
|
145
|
+
this.rKeyDown.emit(event);
|
|
146
|
+
};
|
|
147
|
+
this.onKeyUp = (event) => {
|
|
148
|
+
this.rKeyUp.emit(event);
|
|
149
|
+
};
|
|
150
|
+
this.onSelect = (event) => {
|
|
151
|
+
this.rSelect.emit(event);
|
|
152
|
+
};
|
|
109
153
|
this.contributeToFormData = (event) => {
|
|
110
154
|
appendControlToFormData(this.nativeElement || this.host, event.formData);
|
|
111
155
|
};
|
|
156
|
+
this.datalistObserver = null;
|
|
112
157
|
this.onResetForm = () => {
|
|
113
158
|
if (this.readonly)
|
|
114
159
|
return;
|
|
@@ -220,6 +265,11 @@ export class RInput {
|
|
|
220
265
|
this.value = value;
|
|
221
266
|
this.validateFormElement(this.nativeElement);
|
|
222
267
|
}
|
|
268
|
+
/** Validates an element, displays provided message in case value is invalid. */
|
|
269
|
+
async setCustomValidity(message) {
|
|
270
|
+
this.customErrorMessage = message;
|
|
271
|
+
this.validateFormElement(this.nativeElement);
|
|
272
|
+
}
|
|
223
273
|
/**
|
|
224
274
|
* Validates the input without triggering UI and returns a boolean indicating its validity.
|
|
225
275
|
* @returns A boolean indicating whether the input is valid.
|
|
@@ -247,6 +297,56 @@ export class RInput {
|
|
|
247
297
|
this.touched = false;
|
|
248
298
|
this.dirty = false;
|
|
249
299
|
}
|
|
300
|
+
get datalistId() {
|
|
301
|
+
return `${this.uniqueId}-list`;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Checks if an attribute should be excluded from passthrough.
|
|
305
|
+
*/
|
|
306
|
+
shouldExcludeAttribute(attrName) {
|
|
307
|
+
return (frameworkAttributesSet.has(attrName) ||
|
|
308
|
+
excludedAttributesSet.has(attrName) ||
|
|
309
|
+
managedAriaAttributesSet.has(attrName));
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Collects native HTML input attributes from the host element that aren't
|
|
313
|
+
* already handled by explicit props. This allows passing through attributes
|
|
314
|
+
* like 'list', 'multiple', 'size', etc. without creating explicit props.
|
|
315
|
+
* Optimized with Set lookups (O(1)) and caching.
|
|
316
|
+
*/
|
|
317
|
+
collectNativeAttributes() {
|
|
318
|
+
// Return cached result if available
|
|
319
|
+
if (this.passthroughAttrsCache !== null) {
|
|
320
|
+
return this.passthroughAttrsCache;
|
|
321
|
+
}
|
|
322
|
+
const collected = {};
|
|
323
|
+
const hostAttrs = this.host.attributes;
|
|
324
|
+
// Early return if no attributes to process
|
|
325
|
+
if (!hostAttrs || hostAttrs.length === 0) {
|
|
326
|
+
this.passthroughAttrsCache = collected;
|
|
327
|
+
return collected;
|
|
328
|
+
}
|
|
329
|
+
for (const attr of Array.from(hostAttrs)) {
|
|
330
|
+
const attrName = attr.name.toLowerCase();
|
|
331
|
+
// Skip framework/component-specific attributes using helper method
|
|
332
|
+
if (this.shouldExcludeAttribute(attrName)) {
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
// Include data-* or native input attributes (exclude aria- - component manages ARIA via inputAttrs)
|
|
336
|
+
if (attrName.startsWith('data-') || nativeInputAttributesSet.has(attrName)) {
|
|
337
|
+
// Use special camelCase mapping for certain attributes that need it for JSX properties
|
|
338
|
+
// Otherwise keep the attribute name as-is for native HTML attributes
|
|
339
|
+
const jsxAttrName = attributeCamelCaseMap[attrName] || attrName;
|
|
340
|
+
// Handle boolean attributes: if value is empty or matches attribute name, set to true
|
|
341
|
+
// This ensures proper JSX rendering for attributes like 'multiple'
|
|
342
|
+
const attrValue = attr.value;
|
|
343
|
+
collected[jsxAttrName] = (attrValue === '' || attrValue === attrName) ? true : attrValue;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// Cache the result
|
|
347
|
+
this.passthroughAttrsCache = collected;
|
|
348
|
+
return collected;
|
|
349
|
+
}
|
|
250
350
|
/** Identify wrapping form element */
|
|
251
351
|
get parentFormEl() {
|
|
252
352
|
return this.host.closest('form') || document.querySelector(`#${this.form}`) || null;
|
|
@@ -260,7 +360,7 @@ export class RInput {
|
|
|
260
360
|
return this.invalid && !!((_a = this.error) === null || _a === void 0 ? void 0 : _a.length);
|
|
261
361
|
}
|
|
262
362
|
get hasValidationError() {
|
|
263
|
-
return (this.validityState !== 'valid' || this.invalid) && !!(this.validityMessage || this.customErrorMessage);
|
|
363
|
+
return (this.validityState && this.validityState !== 'valid' || this.invalid) && !!(this.validityMessage || this.customErrorMessage);
|
|
264
364
|
}
|
|
265
365
|
get hasMessage() {
|
|
266
366
|
return this.hasError || this.hasValidationError;
|
|
@@ -279,12 +379,52 @@ export class RInput {
|
|
|
279
379
|
return !!this.host.querySelector('[slot="trailing"]');
|
|
280
380
|
}
|
|
281
381
|
get validEmailPattern() {
|
|
382
|
+
if (!this.value)
|
|
383
|
+
return false;
|
|
282
384
|
const regex = new RegExp(this.pattern, 'u');
|
|
283
385
|
return regex.test(this.value);
|
|
284
386
|
}
|
|
285
387
|
componentWillLoad() {
|
|
286
388
|
this.initial['value'] = this.value;
|
|
287
389
|
this.initial['invalid'] = this.invalid;
|
|
390
|
+
// Clear passthrough attributes cache to ensure fresh collection on load
|
|
391
|
+
this.passthroughAttrsCache = null;
|
|
392
|
+
// Extract options from slotted datalist
|
|
393
|
+
this.extractSlottedDatalistOptions();
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Extracts options from a slotted <datalist> element.
|
|
397
|
+
* Supports both default slot and slot="datalist" usage.
|
|
398
|
+
*/
|
|
399
|
+
extractSlottedDatalistOptions() {
|
|
400
|
+
// First check for slot="datalist"
|
|
401
|
+
const slottedDatalist = this.host.querySelector('datalist[slot="datalist"]');
|
|
402
|
+
if (!slottedDatalist) {
|
|
403
|
+
// Check for datalist in default slot
|
|
404
|
+
const defaultSlotDatalist = Array.from(this.host.querySelectorAll('datalist'))
|
|
405
|
+
.find(el => !el.hasAttribute('slot'));
|
|
406
|
+
if (!defaultSlotDatalist) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
this.slottedOptions = this.parseDatalistOptions(defaultSlotDatalist);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
this.slottedOptions = this.parseDatalistOptions(slottedDatalist);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Parses options from a HTMLDataListElement into InputOption array.
|
|
417
|
+
*/
|
|
418
|
+
parseDatalistOptions(datalist) {
|
|
419
|
+
const options = [];
|
|
420
|
+
const optionElements = datalist.querySelectorAll('option');
|
|
421
|
+
optionElements.forEach(opt => {
|
|
422
|
+
options.push({
|
|
423
|
+
value: opt.value,
|
|
424
|
+
label: opt.label || opt.textContent || opt.value
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
return options;
|
|
288
428
|
}
|
|
289
429
|
connectFormEventListeners() {
|
|
290
430
|
var _a, _b, _c;
|
|
@@ -292,18 +432,49 @@ export class RInput {
|
|
|
292
432
|
(_b = this.parentFormEl) === null || _b === void 0 ? void 0 : _b.addEventListener('submit', this.onSubmitForm, { capture: true });
|
|
293
433
|
(_c = this.parentFormEl) === null || _c === void 0 ? void 0 : _c.addEventListener('reset', this.onResetForm);
|
|
294
434
|
}
|
|
295
|
-
disconnectFormEventListeners() {
|
|
296
|
-
var _a, _b, _c;
|
|
297
|
-
(_a = this.parentFormEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.contributeToFormData);
|
|
298
|
-
(_b = this.parentFormEl) === null || _b === void 0 ? void 0 : _b.removeEventListener('submit', this.onSubmitForm);
|
|
299
|
-
(_c = this.parentFormEl) === null || _c === void 0 ? void 0 : _c.removeEventListener('reset', this.onResetForm);
|
|
300
|
-
}
|
|
301
435
|
connectedCallback() {
|
|
302
436
|
this.connectFormEventListeners();
|
|
303
|
-
|
|
437
|
+
this.setupDatalistObserver();
|
|
438
|
+
if (this.autofocus && !RInput.autofocusHandled) {
|
|
439
|
+
RInput.autofocusHandled = true;
|
|
440
|
+
queueMicrotask(() => { var _a; return (_a = this.host.querySelector('input[autofocus]')) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); });
|
|
441
|
+
}
|
|
304
442
|
}
|
|
305
443
|
disconnectedCallback() {
|
|
444
|
+
var _a;
|
|
306
445
|
this.disconnectFormEventListeners();
|
|
446
|
+
this.disconnectDatalistObserver();
|
|
447
|
+
(_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('beforeinput', this.onBeforeInput);
|
|
448
|
+
}
|
|
449
|
+
setupDatalistObserver() {
|
|
450
|
+
this.extractSlottedDatalistOptions();
|
|
451
|
+
if (typeof MutationObserver === 'undefined') {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
this.datalistObserver = new MutationObserver((mutations) => {
|
|
455
|
+
for (const mutation of mutations) {
|
|
456
|
+
if (mutation.type === 'childList') {
|
|
457
|
+
this.extractSlottedDatalistOptions();
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
this.datalistObserver.observe(this.host, {
|
|
463
|
+
childList: true,
|
|
464
|
+
subtree: false
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
disconnectDatalistObserver() {
|
|
468
|
+
if (this.datalistObserver) {
|
|
469
|
+
this.datalistObserver.disconnect();
|
|
470
|
+
this.datalistObserver = null;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
disconnectFormEventListeners() {
|
|
474
|
+
var _a, _b, _c;
|
|
475
|
+
(_a = this.parentFormEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.contributeToFormData);
|
|
476
|
+
(_b = this.parentFormEl) === null || _b === void 0 ? void 0 : _b.removeEventListener('submit', this.onSubmitForm);
|
|
477
|
+
(_c = this.parentFormEl) === null || _c === void 0 ? void 0 : _c.removeEventListener('reset', this.onResetForm);
|
|
307
478
|
}
|
|
308
479
|
handleValueChange() {
|
|
309
480
|
if (!this.isResetting) {
|
|
@@ -311,12 +482,18 @@ export class RInput {
|
|
|
311
482
|
}
|
|
312
483
|
}
|
|
313
484
|
handleTypeChange() {
|
|
314
|
-
|
|
485
|
+
if (this.nativeElement) {
|
|
486
|
+
this.setValue(this.nativeElement.value);
|
|
487
|
+
}
|
|
315
488
|
}
|
|
316
489
|
render() {
|
|
317
490
|
const { name, placeholder, required, fieldIndicator, maxlength, minlength, min, max, value, disabled, form, pattern, invalid, valid, hint, label, internal, uniqueId, autocomplete, readonly, autofocus, passwordrules, enterkeyhint, spellcheck, autocapitalize, validityMarker } = this;
|
|
318
|
-
|
|
319
|
-
|
|
491
|
+
// Collect any native input attributes that were set on the host element
|
|
492
|
+
const passthroughAttrs = this.collectNativeAttributes();
|
|
493
|
+
// Combine options from prop and slotted datalist (prop takes precedence)
|
|
494
|
+
const options = [...(this.slottedOptions || [])];
|
|
495
|
+
const hasDatalist = options.length > 0;
|
|
496
|
+
const inputAttrs = Object.assign(Object.assign({ disabled,
|
|
320
497
|
readonly,
|
|
321
498
|
required,
|
|
322
499
|
label,
|
|
@@ -328,20 +505,15 @@ export class RInput {
|
|
|
328
505
|
max,
|
|
329
506
|
form,
|
|
330
507
|
pattern,
|
|
331
|
-
autocomplete,
|
|
332
|
-
autofocus: autofocus || null,
|
|
333
|
-
passwordrules,
|
|
508
|
+
autocomplete, autofocus: autofocus || null, passwordrules,
|
|
334
509
|
enterkeyhint,
|
|
335
510
|
autocapitalize,
|
|
336
|
-
spellcheck,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
'aria-required': `${required || false}`,
|
|
343
|
-
'aria-describedby': this.ariaDescribedBy
|
|
344
|
-
};
|
|
511
|
+
spellcheck, inputmode: this.inputmode || null, id: uniqueId }, passthroughAttrs), {
|
|
512
|
+
// Component-controlled values always win
|
|
513
|
+
'data-value': value, 'aria-invalid': `${invalid || false}`, 'aria-required': `${required || false}`, 'aria-describedby': this.ariaDescribedBy,
|
|
514
|
+
// list attribute: use internal datalist when options provided, otherwise use passthrough value (explicit takes precedence)
|
|
515
|
+
list: hasDatalist ? this.datalistId : (passthroughAttrs.list || null)
|
|
516
|
+
});
|
|
345
517
|
const labelAttr = label ? {
|
|
346
518
|
id: `${uniqueId}-label`,
|
|
347
519
|
fieldIndicator
|
|
@@ -363,19 +535,11 @@ export class RInput {
|
|
|
363
535
|
const iconColor = shouldShowInvalidMarker ? colors.invalid : colors.valid;
|
|
364
536
|
return h("r-icon", { class: "r-input--validation-icon", "aria-hidden": "true", size: "s", name: iconName, color: iconColor });
|
|
365
537
|
};
|
|
366
|
-
// Filter out event listener properties based on naming convention.
|
|
367
|
-
// Pass them to native element.
|
|
368
|
-
const eventListeners = Object.entries(this).reduce((acc, [key, value]) => {
|
|
369
|
-
if (typeof value === 'function' && key.startsWith('on')) {
|
|
370
|
-
acc[key] = value;
|
|
371
|
-
}
|
|
372
|
-
return acc;
|
|
373
|
-
}, {});
|
|
374
538
|
return (h(Host, { onClick: this.handleClick, onKeyup: this.handleKeyup, "data-touched": `${this.touched}`, "data-dirty": `${this.dirty}` }, h("div", { class: internal ? 'visually-hidden' : 'r-input--label-container' }, h("label", { htmlFor: uniqueId }, label ?
|
|
375
539
|
h("r-label", Object.assign({ class: "r-input--label" }, labelAttr), label)
|
|
376
540
|
:
|
|
377
541
|
h("slot", { name: "label" })), h("slot", { name: "popover" })), hint &&
|
|
378
|
-
h("r-hint", { id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { class: "r-input--container" }, h("slot", { name: "leading" }), h("input", Object.assign({ class: "r-input--input", type: this.type }, inputAttrs,
|
|
542
|
+
h("r-hint", { id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { class: "r-input--container" }, h("slot", { name: "leading" }), h("input", Object.assign({ class: "r-input--input", type: this.type }, inputAttrs, { ref: this.setNativeInputRef, value: this.value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onInvalid: this.onInvalid, onKeyDown: this.onKeyDown, onKeyUp: this.onKeyUp, onSelect: this.onSelect })), hasDatalist && (h("datalist", { ref: (el) => el && (el.id = this.datalistId) }, options.map((option) => (h("option", { value: option.value }, option.label || option.value))))), h("div", { class: "r-input--trailing" }, this.readonly &&
|
|
379
543
|
h("r-icon", { class: "r-input--readonly-icon", name: "pen-disabled", size: "s" }), renderValidationMarker(), this.hasTrailingSlot &&
|
|
380
544
|
h("slot", { name: "trailing" }))), h("div", { id: `${uniqueId}-message`, "aria-live": !internal ? 'polite' : null, class: !internal ? 'r-input--message' : 'visually-hidden' }, h("slot", { name: "message" }, this.hasMessage && h("r-hint", { variant: valid ? 'success' : 'error' }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))))));
|
|
381
545
|
}
|
|
@@ -1209,6 +1373,7 @@ export class RInput {
|
|
|
1209
1373
|
}
|
|
1210
1374
|
static get states() {
|
|
1211
1375
|
return {
|
|
1376
|
+
"slottedOptions": {},
|
|
1212
1377
|
"validityState": {},
|
|
1213
1378
|
"validityMessage": {},
|
|
1214
1379
|
"touched": {},
|
|
@@ -1321,6 +1486,108 @@ export class RInput {
|
|
|
1321
1486
|
}
|
|
1322
1487
|
}
|
|
1323
1488
|
}
|
|
1489
|
+
}, {
|
|
1490
|
+
"method": "rBeforeInput",
|
|
1491
|
+
"name": "rBeforeInput",
|
|
1492
|
+
"bubbles": true,
|
|
1493
|
+
"cancelable": true,
|
|
1494
|
+
"composed": true,
|
|
1495
|
+
"docs": {
|
|
1496
|
+
"tags": [],
|
|
1497
|
+
"text": "Emitted when the input is about to be modified (mirrors native `beforeinput` semantics).\nUse for intercepting and preventing input before it occurs."
|
|
1498
|
+
},
|
|
1499
|
+
"complexType": {
|
|
1500
|
+
"original": "InputEvent",
|
|
1501
|
+
"resolved": "InputEvent",
|
|
1502
|
+
"references": {
|
|
1503
|
+
"InputEvent": {
|
|
1504
|
+
"location": "global",
|
|
1505
|
+
"id": "global::InputEvent"
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
}, {
|
|
1510
|
+
"method": "rInvalid",
|
|
1511
|
+
"name": "rInvalid",
|
|
1512
|
+
"bubbles": true,
|
|
1513
|
+
"cancelable": true,
|
|
1514
|
+
"composed": true,
|
|
1515
|
+
"docs": {
|
|
1516
|
+
"tags": [],
|
|
1517
|
+
"text": "Emitted when the input fails validation (mirrors native `invalid` semantics)."
|
|
1518
|
+
},
|
|
1519
|
+
"complexType": {
|
|
1520
|
+
"original": "Event",
|
|
1521
|
+
"resolved": "Event",
|
|
1522
|
+
"references": {
|
|
1523
|
+
"Event": {
|
|
1524
|
+
"location": "import",
|
|
1525
|
+
"path": "@stencil/core",
|
|
1526
|
+
"id": "../../node_modules/@stencil/core/internal/stencil-core/index.d.ts::Event"
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
}, {
|
|
1531
|
+
"method": "rKeyDown",
|
|
1532
|
+
"name": "rKeyDown",
|
|
1533
|
+
"bubbles": true,
|
|
1534
|
+
"cancelable": true,
|
|
1535
|
+
"composed": true,
|
|
1536
|
+
"docs": {
|
|
1537
|
+
"tags": [],
|
|
1538
|
+
"text": "Emitted when a key is pressed down (mirrors native `keydown` semantics)."
|
|
1539
|
+
},
|
|
1540
|
+
"complexType": {
|
|
1541
|
+
"original": "KeyboardEvent",
|
|
1542
|
+
"resolved": "KeyboardEvent",
|
|
1543
|
+
"references": {
|
|
1544
|
+
"KeyboardEvent": {
|
|
1545
|
+
"location": "global",
|
|
1546
|
+
"id": "global::KeyboardEvent"
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}, {
|
|
1551
|
+
"method": "rKeyUp",
|
|
1552
|
+
"name": "rKeyUp",
|
|
1553
|
+
"bubbles": true,
|
|
1554
|
+
"cancelable": true,
|
|
1555
|
+
"composed": true,
|
|
1556
|
+
"docs": {
|
|
1557
|
+
"tags": [],
|
|
1558
|
+
"text": "Emitted when a key is released (mirrors native `keyup` semantics)."
|
|
1559
|
+
},
|
|
1560
|
+
"complexType": {
|
|
1561
|
+
"original": "KeyboardEvent",
|
|
1562
|
+
"resolved": "KeyboardEvent",
|
|
1563
|
+
"references": {
|
|
1564
|
+
"KeyboardEvent": {
|
|
1565
|
+
"location": "global",
|
|
1566
|
+
"id": "global::KeyboardEvent"
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}, {
|
|
1571
|
+
"method": "rSelect",
|
|
1572
|
+
"name": "rSelect",
|
|
1573
|
+
"bubbles": true,
|
|
1574
|
+
"cancelable": true,
|
|
1575
|
+
"composed": true,
|
|
1576
|
+
"docs": {
|
|
1577
|
+
"tags": [],
|
|
1578
|
+
"text": "Emitted when text is selected (mirrors native `select` semantics)."
|
|
1579
|
+
},
|
|
1580
|
+
"complexType": {
|
|
1581
|
+
"original": "Event",
|
|
1582
|
+
"resolved": "Event",
|
|
1583
|
+
"references": {
|
|
1584
|
+
"Event": {
|
|
1585
|
+
"location": "import",
|
|
1586
|
+
"path": "@stencil/core",
|
|
1587
|
+
"id": "../../node_modules/@stencil/core/internal/stencil-core/index.d.ts::Event"
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1324
1591
|
}];
|
|
1325
1592
|
}
|
|
1326
1593
|
static get methods() {
|
|
@@ -1486,6 +1753,27 @@ export class RInput {
|
|
|
1486
1753
|
"tags": []
|
|
1487
1754
|
}
|
|
1488
1755
|
},
|
|
1756
|
+
"setCustomValidity": {
|
|
1757
|
+
"complexType": {
|
|
1758
|
+
"signature": "(message: string) => Promise<void>",
|
|
1759
|
+
"parameters": [{
|
|
1760
|
+
"name": "message",
|
|
1761
|
+
"type": "string",
|
|
1762
|
+
"docs": ""
|
|
1763
|
+
}],
|
|
1764
|
+
"references": {
|
|
1765
|
+
"Promise": {
|
|
1766
|
+
"location": "global",
|
|
1767
|
+
"id": "global::Promise"
|
|
1768
|
+
}
|
|
1769
|
+
},
|
|
1770
|
+
"return": "Promise<void>"
|
|
1771
|
+
},
|
|
1772
|
+
"docs": {
|
|
1773
|
+
"text": "Validates an element, displays provided message in case value is invalid.",
|
|
1774
|
+
"tags": []
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1489
1777
|
"checkValidity": {
|
|
1490
1778
|
"complexType": {
|
|
1491
1779
|
"signature": "() => Promise<boolean>",
|
|
@@ -1570,3 +1858,4 @@ export class RInput {
|
|
|
1570
1858
|
}];
|
|
1571
1859
|
}
|
|
1572
1860
|
}
|
|
1861
|
+
RInput.autofocusHandled = false;
|
|
@@ -244,6 +244,11 @@ export class InputCode {
|
|
|
244
244
|
this.values = valueArray;
|
|
245
245
|
this.rChange.emit({ value: this.values.join('') });
|
|
246
246
|
}
|
|
247
|
+
/** Validates an element, displays provided message in case value is invalid. */
|
|
248
|
+
async setCustomValidity(message) {
|
|
249
|
+
this.customErrorMessage = message;
|
|
250
|
+
this.validateFormElement(this.nativeElement);
|
|
251
|
+
}
|
|
247
252
|
/**
|
|
248
253
|
* Validates the input code without triggering UI and returns a boolean indicating its validity.
|
|
249
254
|
* @returns A boolean indicating whether the input code is valid.
|
|
@@ -402,14 +407,14 @@ export class InputCode {
|
|
|
402
407
|
id: `${uniqueId}-label`,
|
|
403
408
|
fieldIndicator
|
|
404
409
|
} : {};
|
|
405
|
-
return (h(Host, { key: '
|
|
410
|
+
return (h(Host, { key: '800791debf1f1c64b666d8933dddfc9d308ef70e', value: this.value, onClick: this.onHostClick }, h("div", { key: 'b081be06e5e46fbce4764d59ee3de65091c39464', class: "r-input-code--label-container" }, h("label", { key: '4b98d9f9ea5e318943da440c1851887a9c540d50', htmlFor: uniqueId }, label ?
|
|
406
411
|
h("r-label", Object.assign({}, labelAttr), label)
|
|
407
412
|
:
|
|
408
|
-
h("slot", { name: "label" })), h("slot", { key: '
|
|
409
|
-
h("r-hint", { key: '
|
|
410
|
-
h("r-icon", { key: '
|
|
411
|
-
h("r-icon", { key: '
|
|
412
|
-
h("r-hint", { key: '
|
|
413
|
+
h("slot", { name: "label" })), h("slot", { key: 'd7949be3b99b6774529948b22a4dc9544da2057d', name: "popover" })), hint &&
|
|
414
|
+
h("r-hint", { key: 'cd46c69b0f7ca4468219bc5d5698f95a8639864b', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '3249a7836c7354a8ec8b9457d6dc0e81140710c9', class: "r-form-field" }, h("slot", { key: '9e1e2574802b9b650ba99bb971a5c0a165b0b197', name: "prefix" }), h("div", { key: '6ccba704319cc140d68a37b9bea922f62e4513b6', class: "r-input-code--container", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.groupDescribedby }, h("slot", { key: '06d57c63d11f5818f4cf2ccacca60aa64bd16a49', 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: '56e629b9f9c4a7cbf83e0ba10d3338cccb27579f', type: "hidden" }, inputAttrs, { value: this.values.join(''), ref: el => this.nativeElement = el })), h("div", { key: '1388dab339130521becb1a0c2d0005ba8e1b8fde', class: "r-input-code--trailing" }, this.readonly &&
|
|
415
|
+
h("r-icon", { key: 'ea1cbf74635a3480ec03ea16f41d8133a156219d', class: "r-input-code--readonly-icon", name: "pen-disabled", size: "s" }), h("slot", { key: '90801524b96b72fdb21b49f6c15d00d4809faba6', name: "trailing" }, valid &&
|
|
416
|
+
h("r-icon", { key: '709294d96d12dfff3c902bbac8656d59d0e6064b', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" })))), h("slot", { key: '67195193bd3d6a8c3e7aaa3ae0b5f35274971add', name: "suffix" })), h("slot", { key: '735676c16afee87dc1b121ec4eed689645e40f84', name: "message" }, this.hasMessage &&
|
|
417
|
+
h("r-hint", { key: 'f7733e7bdaa5037fa6244fb351551c9a6d7faf95', "aria-live": "polite", id: `${uniqueId}-message`, variant: "error" }, this.message))));
|
|
413
418
|
}
|
|
414
419
|
static get is() { return "r-input-code"; }
|
|
415
420
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1019,6 +1024,27 @@ export class InputCode {
|
|
|
1019
1024
|
"tags": []
|
|
1020
1025
|
}
|
|
1021
1026
|
},
|
|
1027
|
+
"setCustomValidity": {
|
|
1028
|
+
"complexType": {
|
|
1029
|
+
"signature": "(message: string) => Promise<void>",
|
|
1030
|
+
"parameters": [{
|
|
1031
|
+
"name": "message",
|
|
1032
|
+
"type": "string",
|
|
1033
|
+
"docs": ""
|
|
1034
|
+
}],
|
|
1035
|
+
"references": {
|
|
1036
|
+
"Promise": {
|
|
1037
|
+
"location": "global",
|
|
1038
|
+
"id": "global::Promise"
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
"return": "Promise<void>"
|
|
1042
|
+
},
|
|
1043
|
+
"docs": {
|
|
1044
|
+
"text": "Validates an element, displays provided message in case value is invalid.",
|
|
1045
|
+
"tags": []
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1022
1048
|
"checkValidity": {
|
|
1023
1049
|
"complexType": {
|
|
1024
1050
|
"signature": "() => Promise<boolean>",
|