@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
|
@@ -2298,7 +2298,7 @@ const InputPhoneNumber = class {
|
|
|
2298
2298
|
const isPhoneNumberValid = this.countryCode ? this.getPhoneValidationResult(this.phoneNumber, this.countryCode).isValid : false;
|
|
2299
2299
|
if (!isPhoneNumberValid) {
|
|
2300
2300
|
validityState = 'invalid';
|
|
2301
|
-
validityMessage = this.
|
|
2301
|
+
validityMessage = this.invalidPhoneNumberMessage;
|
|
2302
2302
|
return { validityState, validityMessage };
|
|
2303
2303
|
}
|
|
2304
2304
|
validityState = 'valid';
|
|
@@ -2404,8 +2404,8 @@ const InputPhoneNumber = class {
|
|
|
2404
2404
|
return this.invalid && !!((_a = this.error) === null || _a === void 0 ? void 0 : _a.length);
|
|
2405
2405
|
}
|
|
2406
2406
|
get hasValidationError() {
|
|
2407
|
-
var _a;
|
|
2408
|
-
return this.validityState !== 'valid' && !!((_a = this.
|
|
2407
|
+
var _a, _b;
|
|
2408
|
+
return this.validityState && this.validityState !== 'valid' && (!!((_a = this.customErrorMessage) === null || _a === void 0 ? void 0 : _a.length) || !!((_b = this.validityMessage) === null || _b === void 0 ? void 0 : _b.length));
|
|
2409
2409
|
}
|
|
2410
2410
|
get hasMessage() {
|
|
2411
2411
|
return this.hasError || this.hasValidationError;
|
|
@@ -2505,9 +2505,9 @@ const InputPhoneNumber = class {
|
|
|
2505
2505
|
disabled,
|
|
2506
2506
|
'aria-describedby': this.ariaDescribedBy
|
|
2507
2507
|
};
|
|
2508
|
-
return (h(Host, { key: '
|
|
2509
|
-
h("r-label", Object.assign({ key: '
|
|
2510
|
-
h("r-hint", { key: '
|
|
2508
|
+
return (h(Host, { key: 'e5170613c08f3927d2a65cb7649cd29d27954b99' }, h("div", { key: '42e8954e2140be50ea42290779af01522e0e39e7', class: "r-input-phone-number--label-container" }, h("label", { key: '0dbd4ad0d762f97d4a2242f1dc95ba8cd9039ce0', id: `${uniqueId}-label` }, label &&
|
|
2509
|
+
h("r-label", Object.assign({ key: 'ec76421b8dad5b1ed58cb0302d7c8d32fed66735' }, labelAttr), label)), h("slot", { key: 'c9e8a6fb83822826f5a1f62cedb06169715dac52', name: "popover" })), hint &&
|
|
2510
|
+
h("r-hint", { key: 'c0755d106d3d01f6f6c0ab1d939337d98e014652', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: 'e32fe35fed92c7a729231164705ef6437060775e', class: "r-input-phone-number", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.ariaDescribedBy }, h("slot", { key: 'cc2d797e9f9c5b5a21d6e8a7a7d6c7edb2d2b88a' }), h("r-input", { key: 'c3402afa0f6f30afb61b81c947272368dfabbbcf', 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 })), h("input", Object.assign({ key: 'cd814c1b35708f56a911b4d93e907f9a2fac0f1c', type: "hidden" }, inputAttrs, { readonly: this.readonly, value: fullPhoneNumber, ref: el => this.nativeElement = el })), h("r-hint", { key: '211661682d51d22ffe93a6e993e03a3c89cc76e2', "aria-live": "polite", "aria-atomic": "true", id: `${uniqueId}-message`, class: !this.hasMessage && 'visually-hidden', variant: "error" }, this.hasMessage ? (this.hasError ? this.error : (this.customErrorMessage || this.validityMessage)) : '')));
|
|
2511
2511
|
}
|
|
2512
2512
|
get host() { return getElement(this); }
|
|
2513
2513
|
static get watchers() { return {
|
|
@@ -1,7 +1,54 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-CTxpqopm.js';
|
|
2
2
|
import { a as appendControlToFormData } from './formData-DvLT8-y3.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Native HTML input attributes that can be passed through.
|
|
6
|
+
* Using Set for O(1) lookup performance instead of O(n) array includes.
|
|
7
|
+
*/
|
|
8
|
+
const nativeInputAttributesSet = new Set([
|
|
9
|
+
'accept', 'autocorrect', 'capture', 'dirname',
|
|
10
|
+
'height', 'incremental', 'list', 'multiple', 'size', 'src', 'width'
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
* Special case mappings for attributes that need custom camelCase conversion
|
|
14
|
+
* beyond simple hyphen-based transformation. Maps HTML attribute name (lowercase)
|
|
15
|
+
* to JSX property name (camelCase).
|
|
16
|
+
*/
|
|
17
|
+
const attributeCamelCaseMap = {
|
|
18
|
+
'autocorrect': 'autoCorrect',
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Component-specific props that should NOT be passed to the native input.
|
|
22
|
+
* Using Set for O(1) lookup performance.
|
|
23
|
+
*/
|
|
24
|
+
const excludedAttributesSet = new Set([
|
|
25
|
+
'internal', 'full-width', 'fullwidth', 'validity-marker', 'validitymarker',
|
|
26
|
+
'error', 'valid', 'invalid', 'hint', 'field-indicator', 'fieldindicator',
|
|
27
|
+
'value-missing-message', 'valuemissingmessage', 'type-mismatch-message', 'typemismatchmessage',
|
|
28
|
+
'pattern-mismatch-message', 'patternmismatchmessage', 'too-long-message', 'toolongmessage',
|
|
29
|
+
'too-short-message', 'tooshortmessage', 'range-overflow-message', 'rangeoverflowmessage',
|
|
30
|
+
'range-underflow-message', 'rangeunderflowmessage', 'step-mismatch-message', 'stepmismatchmessage',
|
|
31
|
+
'bad-input-message', 'badinputmessage', 'custom-error-message', 'customerrormessage'
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* Framework/DOM-specific attributes that should never be passed through.
|
|
35
|
+
*/
|
|
36
|
+
const frameworkAttributesSet = new Set([
|
|
37
|
+
'class', 'style', 'id', 'slot', 'ref', 'key'
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* ARIA attributes that are already handled explicitly by the component
|
|
41
|
+
* and should not be passed through to avoid conflicts.
|
|
42
|
+
*/
|
|
43
|
+
const managedAriaAttributesSet = new Set([
|
|
44
|
+
'aria-invalid',
|
|
45
|
+
'aria-required',
|
|
46
|
+
'aria-placeholder',
|
|
47
|
+
'aria-describedby',
|
|
48
|
+
'data-value'
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
const inputCss = ":host{display:inline-flex;flex-direction:column;vertical-align:top;--r-label--margin-bottom:0}:host slot{display:contents}:host([readonly]:not([readonly=false])){--r-input--container--background-color:var(--r-background-soft, #f3f1f0);--r-input--container--border-color:transparent transparent var(--r-border-soft, #686868) transparent;--r-input--container--cursor:text}:host(:hover:not([disabled]:not([disabled=false])):not([readonly]:not([readonly=false]))){--r-input--container--background-color:var(--r-background-interactive-hovered, rgba(40, 40, 40, 0.04))}:host(.focused){--r-input--container--box-shadow:0 0 0 6px var(--r-border-focused-outlined);--r-input--container--outline:2px solid var(--r-border-focused);--r-input--container--outline-offset:2px}:host(:active:not([disabled]:not([disabled=false])):not([readonly]:not([readonly=false]))){--r-input--container--background-color:var(--r-background-interactive-pressed, rgba(40, 40, 40, 0.12))}:host([expanded]:not([expanded=false])),:host([full-width]:not([full-width=false])){display:block}:host([disabled]:not([disabled=false])){--r-input--container--opacity:0.4;--r-input--container--cursor:not-allowed;--r-input--container--pointer-events:none;--r-input--container--background-color:transparent}:host([invalid]:not([invalid=false])){--r-input--container--border-color:var(--r-status-error-regular, #b00c15);--r-input--container--background-color:var(--r-status-error-soft, #fef6f6)}:host([size]){--r-input--width:auto;--r-input--input--width:auto;--r-input--container--display:inline-flex}.r-input{display:var(--r-input--display, flex);flex:var(--r-input--flex, 1);flex-direction:var(--r-input--flex-direction, column);width:var(--r-input--width, auto);font-family:var(--r-input--font-family, system-ui);position:var(--r-input--position, relative);border-radius:var(--r-input--border-radius, 0);cursor:var(--r-input--cursor, inherit)}.r-input--label-container{display:var(--r-input--label-container--display, flex);gap:var(--r-input--label-container--gap, var(--r-spacing-100, 1rem));align-items:var(--r-input--label-container--align-items, center);justify-content:var(--r-input--label-container--align-items, space-between)}.r-input--label-container ::slotted([slot=popover]){display:var(--r-input--popover--display, inline-flex);height:var(--r-input--popover--height, var(--r-spacing-150, 1.5));align-items:var(--r-input--popover--align-items, center);justify-content:var(--r-input--popover--justify-content, center);margin-right:var(--r-input--popover--margin-right, -0.25rem);--r-popover--trigger--min-width:var(--r-input--popover-trigger--min-width, var(--r-spacing-150, 1.5));--r-popover--trigger--min-height:var(--r-input--popover--trigger--min-height, var(--r-spacing-150, 1.5))}.r-input--label{cursor:var(--r-input--label--cursor, inherit)}.r-input--input{font-family:var(--r-input--input--font-family, system-ui);font-size:var(--r-input--input--font-size, 1em);width:var(--r-input--input--width, 100%);max-width:var(--r-input--input--max-width, 100%);height:var(--r-input--input--height, var(--r-spacing-275, 2.75rem));border-radius:var(--r-input--input--border-radius, 0);border:var(--r-input--input--border, none);color:var(--r-input--input--color, var(--r-text-regular, #282828));background-color:var(--r-input--input--background-color, none);appearance:var(--r-input--input--appearance, none);box-sizing:var(--r-input--input--box-sizing, border-box);outline:var(--r-input--input--outline, none);cursor:var(--r-input--input--cursor, inherit);pointer-events:var(--r-input--input--pointer-events, auto)}.r-input--input:autofill,.r-input--input:-webkit-autofill{-webkit-background-clip:text !important}.r-input--input::-ms-reveal{display:var(--r-input--input--ms-reveal--display, none)}.r-input--input::placeholder{color:var(--r-input--input--placeholder--color, var(--r-text-soft, #686868))}.r-input--input[type=search]::-webkit-search-cancel-button{cursor:var(--r-input--input-clear--cursor, pointer);display:var(--r-input--input-clear--display, block);height:var(--r-input--input-clear--height, 0.875rem);width:var(--r-input--input-clear--width, 0.875rem);appearance:var(--r-input--input-clear--appearance, none);background-repeat:var(--r-input--input-clear--background-repeat, no-repeat);background-image:var(--r-input--input-clear--background-image, url(\"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20stroke-width%3D%221.5%22%20viewBox%3D%220.75%200.75%2022.5%2022.5%22%3E%3Cpath%20id%3D%22Vector%202269%22%20stroke%3D%22currentColor%22%20d%3D%22M1.5%201.5L22.5%2022.5%22%2F%3E%3Cpath%20id%3D%22Vector%202270%22%20stroke%3D%22currentColor%22%20d%3D%22M22.5%201.5L1.5%2022.5%22%2F%3E%3C%2Fsvg%3E\"));background-size:var(--r-input--input-clear--background-size, contain);margin-inline:var(--r-input--input-clear--margin-inline, 0);color:currentColor}.r-input--button{position:var(--r-input--icon-button--position, absolute);width:var(--r-input--icon-button--width, calc(1.125em + var(--r-input--icon--width)));height:var(--r-input--icon-button--height, 100%);top:var(--r-input--icon-button--top, 0);right:var(--r-input--icon-button--right, auto);bottom:var(--r-input--icon-button--bottom, auto);left:var(--r-input--icon-button--left, 0);cursor:var(--r-input--icon-button--cursor, inherit)}.r-input--container{position:var(--r-input--container--position, relative);display:var(--r-input--container--display, flex);align-items:var(--r-input--container--align-items, center);gap:var(--r-input--container--gap, 0.625rem);height:var(--r-input--container--height, var(--r-spacing-275, 2.75rem));background-color:var(--r-input--container--background-color, var(--r-background-softest, #fff));border-width:var(--r-input--container--border-width, 1px);border-style:var(--r-input--container--border-style, solid);border-color:var(--r-input--container--border-color, var(--r-border-soft, #686868));box-sizing:var(--r-input--container--box-sizing, border-box);box-shadow:var(--r-input--container--box-shadow, none);outline:var(--r-input--container--outline, none);outline-offset:var(--r-input--container--outline-offset, 0);padding-top:var(--r-input--container--padding-top, 0.6875rem);padding-right:var(--r-input--container--padding-right, var(--r-spacing-075, 0.75rem));padding-bottom:var(--r-input--container--padding-bottom, 0.6875rem);padding-left:var(--r-input--container--padding-left, var(--r-spacing-0275, 0.75rem));opacity:var(--r-input--container--opacity, 1);pointer-events:var(--r-input--container--pointer-events, auto);line-height:var(--r-input--container--line-height, 1);cursor:var(--r-input--container--cursor, inherit);margin-top:var(--r-input--container--margin-top, var(--r-spacing-025, 0.25rem))}.r-input--container slot[name=leading]{color:var(--r-input--container-leading--color, var(--r-icon-soft, #686868))}.r-input--message:has(r-hint),.r-input--message ::slotted([slot=message]){margin-top:var(--r-input--message--margin-top, var(--r-spacing-025, 0.25rem))}.r-input--trailing{display:var(--r-input--trailing--display, flex);margin-left:var(--r-input--trailing--margin-left, auto);align-items:var(--r-input--trailing--align-items, center);gap:var(--r-input--trailing--gap, 0.625rem)}.r-input--trailing:empty{--r-input--trailing--display:none}.r-input--validation-icon{display:var(--r-input--validation-icon--display, inline-block)}.r-input--readonly-icon{color:var(--r-input--readonly-icon--color, var(--r-icon-soft, #686868))}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}";
|
|
5
52
|
|
|
6
53
|
const RInput = class {
|
|
7
54
|
constructor(hostRef) {
|
|
@@ -12,6 +59,11 @@ const RInput = class {
|
|
|
12
59
|
this.rFocus = createEvent(this, "rFocus");
|
|
13
60
|
this.rChange = createEvent(this, "rChange");
|
|
14
61
|
this.rReset = createEvent(this, "rReset");
|
|
62
|
+
this.rBeforeInput = createEvent(this, "rBeforeInput");
|
|
63
|
+
this.rInvalid = createEvent(this, "rInvalid");
|
|
64
|
+
this.rKeyDown = createEvent(this, "rKeyDown");
|
|
65
|
+
this.rKeyUp = createEvent(this, "rKeyUp");
|
|
66
|
+
this.rSelect = createEvent(this, "rSelect");
|
|
15
67
|
/**
|
|
16
68
|
* Input type (e.g. `text`, `email`, `number`, `password`).
|
|
17
69
|
* See HTMLInputElement `type` for supported values.
|
|
@@ -21,6 +73,8 @@ const RInput = class {
|
|
|
21
73
|
* Current value. Mutable: can be changed programmatically or through user input.
|
|
22
74
|
*/
|
|
23
75
|
this.value = '';
|
|
76
|
+
/** Internal state for options extracted from slotted datalist */
|
|
77
|
+
this.slottedOptions = [];
|
|
24
78
|
/**
|
|
25
79
|
* When `true` field renders valid/invalid marker within.
|
|
26
80
|
*/
|
|
@@ -36,11 +90,37 @@ const RInput = class {
|
|
|
36
90
|
/** Private flag to prevent validation during reset */
|
|
37
91
|
this.isResetting = false;
|
|
38
92
|
this.nativeElement = null;
|
|
93
|
+
/**
|
|
94
|
+
* Helper to set the native input element ref and apply boolean properties
|
|
95
|
+
* that don't get properly set through JSX attribute spreading.
|
|
96
|
+
*/
|
|
97
|
+
this.setNativeInputRef = (el) => {
|
|
98
|
+
this.nativeElement = el;
|
|
99
|
+
if (el) {
|
|
100
|
+
el.addEventListener('beforeinput', this.onBeforeInput);
|
|
101
|
+
// Manually apply boolean native attributes as properties
|
|
102
|
+
// This is necessary because Stencil's JSX doesn't always properly
|
|
103
|
+
// set boolean DOM properties when spreading attributes
|
|
104
|
+
const passthroughAttrs = this.collectNativeAttributes();
|
|
105
|
+
// List of boolean native input properties that need manual application
|
|
106
|
+
const booleanProps = ['multiple'];
|
|
107
|
+
for (const prop of booleanProps) {
|
|
108
|
+
if (prop in passthroughAttrs && passthroughAttrs[prop] === true) {
|
|
109
|
+
el[prop] = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
39
114
|
this.uniqueId = `r-input-${Date.now().toString(32)}${Math.random().toString(32)}`.replace(/\./g, '');
|
|
40
115
|
/**
|
|
41
116
|
* Initial attributes state
|
|
42
117
|
* */
|
|
43
118
|
this.initial = {};
|
|
119
|
+
/**
|
|
120
|
+
* Cache for passthrough attributes to avoid recomputing on every render.
|
|
121
|
+
* Cleared when attributes might have changed.
|
|
122
|
+
*/
|
|
123
|
+
this.passthroughAttrsCache = null;
|
|
44
124
|
this.getValidityStateData = (element) => {
|
|
45
125
|
let validityState = '';
|
|
46
126
|
let validityMessage = '';
|
|
@@ -116,9 +196,25 @@ const RInput = class {
|
|
|
116
196
|
this.host.classList.add('focused');
|
|
117
197
|
this.rFocus.emit();
|
|
118
198
|
};
|
|
199
|
+
this.onBeforeInput = (event) => {
|
|
200
|
+
this.rBeforeInput.emit(event);
|
|
201
|
+
};
|
|
202
|
+
this.onInvalid = (event) => {
|
|
203
|
+
this.rInvalid.emit(event);
|
|
204
|
+
};
|
|
205
|
+
this.onKeyDown = (event) => {
|
|
206
|
+
this.rKeyDown.emit(event);
|
|
207
|
+
};
|
|
208
|
+
this.onKeyUp = (event) => {
|
|
209
|
+
this.rKeyUp.emit(event);
|
|
210
|
+
};
|
|
211
|
+
this.onSelect = (event) => {
|
|
212
|
+
this.rSelect.emit(event);
|
|
213
|
+
};
|
|
119
214
|
this.contributeToFormData = (event) => {
|
|
120
215
|
appendControlToFormData(this.nativeElement || this.host, event.formData);
|
|
121
216
|
};
|
|
217
|
+
this.datalistObserver = null;
|
|
122
218
|
this.onResetForm = () => {
|
|
123
219
|
if (this.readonly)
|
|
124
220
|
return;
|
|
@@ -230,6 +326,11 @@ const RInput = class {
|
|
|
230
326
|
this.value = value;
|
|
231
327
|
this.validateFormElement(this.nativeElement);
|
|
232
328
|
}
|
|
329
|
+
/** Validates an element, displays provided message in case value is invalid. */
|
|
330
|
+
async setCustomValidity(message) {
|
|
331
|
+
this.customErrorMessage = message;
|
|
332
|
+
this.validateFormElement(this.nativeElement);
|
|
333
|
+
}
|
|
233
334
|
/**
|
|
234
335
|
* Validates the input without triggering UI and returns a boolean indicating its validity.
|
|
235
336
|
* @returns A boolean indicating whether the input is valid.
|
|
@@ -257,6 +358,56 @@ const RInput = class {
|
|
|
257
358
|
this.touched = false;
|
|
258
359
|
this.dirty = false;
|
|
259
360
|
}
|
|
361
|
+
get datalistId() {
|
|
362
|
+
return `${this.uniqueId}-list`;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Checks if an attribute should be excluded from passthrough.
|
|
366
|
+
*/
|
|
367
|
+
shouldExcludeAttribute(attrName) {
|
|
368
|
+
return (frameworkAttributesSet.has(attrName) ||
|
|
369
|
+
excludedAttributesSet.has(attrName) ||
|
|
370
|
+
managedAriaAttributesSet.has(attrName));
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Collects native HTML input attributes from the host element that aren't
|
|
374
|
+
* already handled by explicit props. This allows passing through attributes
|
|
375
|
+
* like 'list', 'multiple', 'size', etc. without creating explicit props.
|
|
376
|
+
* Optimized with Set lookups (O(1)) and caching.
|
|
377
|
+
*/
|
|
378
|
+
collectNativeAttributes() {
|
|
379
|
+
// Return cached result if available
|
|
380
|
+
if (this.passthroughAttrsCache !== null) {
|
|
381
|
+
return this.passthroughAttrsCache;
|
|
382
|
+
}
|
|
383
|
+
const collected = {};
|
|
384
|
+
const hostAttrs = this.host.attributes;
|
|
385
|
+
// Early return if no attributes to process
|
|
386
|
+
if (!hostAttrs || hostAttrs.length === 0) {
|
|
387
|
+
this.passthroughAttrsCache = collected;
|
|
388
|
+
return collected;
|
|
389
|
+
}
|
|
390
|
+
for (const attr of Array.from(hostAttrs)) {
|
|
391
|
+
const attrName = attr.name.toLowerCase();
|
|
392
|
+
// Skip framework/component-specific attributes using helper method
|
|
393
|
+
if (this.shouldExcludeAttribute(attrName)) {
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
// Include data-* or native input attributes (exclude aria- - component manages ARIA via inputAttrs)
|
|
397
|
+
if (attrName.startsWith('data-') || nativeInputAttributesSet.has(attrName)) {
|
|
398
|
+
// Use special camelCase mapping for certain attributes that need it for JSX properties
|
|
399
|
+
// Otherwise keep the attribute name as-is for native HTML attributes
|
|
400
|
+
const jsxAttrName = attributeCamelCaseMap[attrName] || attrName;
|
|
401
|
+
// Handle boolean attributes: if value is empty or matches attribute name, set to true
|
|
402
|
+
// This ensures proper JSX rendering for attributes like 'multiple'
|
|
403
|
+
const attrValue = attr.value;
|
|
404
|
+
collected[jsxAttrName] = (attrValue === '' || attrValue === attrName) ? true : attrValue;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
// Cache the result
|
|
408
|
+
this.passthroughAttrsCache = collected;
|
|
409
|
+
return collected;
|
|
410
|
+
}
|
|
260
411
|
/** Identify wrapping form element */
|
|
261
412
|
get parentFormEl() {
|
|
262
413
|
return this.host.closest('form') || document.querySelector(`#${this.form}`) || null;
|
|
@@ -270,7 +421,7 @@ const RInput = class {
|
|
|
270
421
|
return this.invalid && !!((_a = this.error) === null || _a === void 0 ? void 0 : _a.length);
|
|
271
422
|
}
|
|
272
423
|
get hasValidationError() {
|
|
273
|
-
return (this.validityState !== 'valid' || this.invalid) && !!(this.validityMessage || this.customErrorMessage);
|
|
424
|
+
return (this.validityState && this.validityState !== 'valid' || this.invalid) && !!(this.validityMessage || this.customErrorMessage);
|
|
274
425
|
}
|
|
275
426
|
get hasMessage() {
|
|
276
427
|
return this.hasError || this.hasValidationError;
|
|
@@ -289,12 +440,52 @@ const RInput = class {
|
|
|
289
440
|
return !!this.host.querySelector('[slot="trailing"]');
|
|
290
441
|
}
|
|
291
442
|
get validEmailPattern() {
|
|
443
|
+
if (!this.value)
|
|
444
|
+
return false;
|
|
292
445
|
const regex = new RegExp(this.pattern, 'u');
|
|
293
446
|
return regex.test(this.value);
|
|
294
447
|
}
|
|
295
448
|
componentWillLoad() {
|
|
296
449
|
this.initial['value'] = this.value;
|
|
297
450
|
this.initial['invalid'] = this.invalid;
|
|
451
|
+
// Clear passthrough attributes cache to ensure fresh collection on load
|
|
452
|
+
this.passthroughAttrsCache = null;
|
|
453
|
+
// Extract options from slotted datalist
|
|
454
|
+
this.extractSlottedDatalistOptions();
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Extracts options from a slotted <datalist> element.
|
|
458
|
+
* Supports both default slot and slot="datalist" usage.
|
|
459
|
+
*/
|
|
460
|
+
extractSlottedDatalistOptions() {
|
|
461
|
+
// First check for slot="datalist"
|
|
462
|
+
const slottedDatalist = this.host.querySelector('datalist[slot="datalist"]');
|
|
463
|
+
if (!slottedDatalist) {
|
|
464
|
+
// Check for datalist in default slot
|
|
465
|
+
const defaultSlotDatalist = Array.from(this.host.querySelectorAll('datalist'))
|
|
466
|
+
.find(el => !el.hasAttribute('slot'));
|
|
467
|
+
if (!defaultSlotDatalist) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
this.slottedOptions = this.parseDatalistOptions(defaultSlotDatalist);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
this.slottedOptions = this.parseDatalistOptions(slottedDatalist);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Parses options from a HTMLDataListElement into InputOption array.
|
|
478
|
+
*/
|
|
479
|
+
parseDatalistOptions(datalist) {
|
|
480
|
+
const options = [];
|
|
481
|
+
const optionElements = datalist.querySelectorAll('option');
|
|
482
|
+
optionElements.forEach(opt => {
|
|
483
|
+
options.push({
|
|
484
|
+
value: opt.value,
|
|
485
|
+
label: opt.label || opt.textContent || opt.value
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
return options;
|
|
298
489
|
}
|
|
299
490
|
connectFormEventListeners() {
|
|
300
491
|
var _a, _b, _c;
|
|
@@ -302,18 +493,49 @@ const RInput = class {
|
|
|
302
493
|
(_b = this.parentFormEl) === null || _b === void 0 ? void 0 : _b.addEventListener('submit', this.onSubmitForm, { capture: true });
|
|
303
494
|
(_c = this.parentFormEl) === null || _c === void 0 ? void 0 : _c.addEventListener('reset', this.onResetForm);
|
|
304
495
|
}
|
|
305
|
-
disconnectFormEventListeners() {
|
|
306
|
-
var _a, _b, _c;
|
|
307
|
-
(_a = this.parentFormEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.contributeToFormData);
|
|
308
|
-
(_b = this.parentFormEl) === null || _b === void 0 ? void 0 : _b.removeEventListener('submit', this.onSubmitForm);
|
|
309
|
-
(_c = this.parentFormEl) === null || _c === void 0 ? void 0 : _c.removeEventListener('reset', this.onResetForm);
|
|
310
|
-
}
|
|
311
496
|
connectedCallback() {
|
|
312
497
|
this.connectFormEventListeners();
|
|
313
|
-
|
|
498
|
+
this.setupDatalistObserver();
|
|
499
|
+
if (this.autofocus && !RInput.autofocusHandled) {
|
|
500
|
+
RInput.autofocusHandled = true;
|
|
501
|
+
queueMicrotask(() => { var _a; return (_a = this.host.querySelector('input[autofocus]')) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); });
|
|
502
|
+
}
|
|
314
503
|
}
|
|
315
504
|
disconnectedCallback() {
|
|
505
|
+
var _a;
|
|
316
506
|
this.disconnectFormEventListeners();
|
|
507
|
+
this.disconnectDatalistObserver();
|
|
508
|
+
(_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('beforeinput', this.onBeforeInput);
|
|
509
|
+
}
|
|
510
|
+
setupDatalistObserver() {
|
|
511
|
+
this.extractSlottedDatalistOptions();
|
|
512
|
+
if (typeof MutationObserver === 'undefined') {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
this.datalistObserver = new MutationObserver((mutations) => {
|
|
516
|
+
for (const mutation of mutations) {
|
|
517
|
+
if (mutation.type === 'childList') {
|
|
518
|
+
this.extractSlottedDatalistOptions();
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
this.datalistObserver.observe(this.host, {
|
|
524
|
+
childList: true,
|
|
525
|
+
subtree: false
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
disconnectDatalistObserver() {
|
|
529
|
+
if (this.datalistObserver) {
|
|
530
|
+
this.datalistObserver.disconnect();
|
|
531
|
+
this.datalistObserver = null;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
disconnectFormEventListeners() {
|
|
535
|
+
var _a, _b, _c;
|
|
536
|
+
(_a = this.parentFormEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.contributeToFormData);
|
|
537
|
+
(_b = this.parentFormEl) === null || _b === void 0 ? void 0 : _b.removeEventListener('submit', this.onSubmitForm);
|
|
538
|
+
(_c = this.parentFormEl) === null || _c === void 0 ? void 0 : _c.removeEventListener('reset', this.onResetForm);
|
|
317
539
|
}
|
|
318
540
|
handleValueChange() {
|
|
319
541
|
if (!this.isResetting) {
|
|
@@ -321,12 +543,18 @@ const RInput = class {
|
|
|
321
543
|
}
|
|
322
544
|
}
|
|
323
545
|
handleTypeChange() {
|
|
324
|
-
|
|
546
|
+
if (this.nativeElement) {
|
|
547
|
+
this.setValue(this.nativeElement.value);
|
|
548
|
+
}
|
|
325
549
|
}
|
|
326
550
|
render() {
|
|
327
551
|
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;
|
|
328
|
-
|
|
329
|
-
|
|
552
|
+
// Collect any native input attributes that were set on the host element
|
|
553
|
+
const passthroughAttrs = this.collectNativeAttributes();
|
|
554
|
+
// Combine options from prop and slotted datalist (prop takes precedence)
|
|
555
|
+
const options = [...(this.slottedOptions || [])];
|
|
556
|
+
const hasDatalist = options.length > 0;
|
|
557
|
+
const inputAttrs = Object.assign(Object.assign({ disabled,
|
|
330
558
|
readonly,
|
|
331
559
|
required,
|
|
332
560
|
label,
|
|
@@ -338,20 +566,15 @@ const RInput = class {
|
|
|
338
566
|
max,
|
|
339
567
|
form,
|
|
340
568
|
pattern,
|
|
341
|
-
autocomplete,
|
|
342
|
-
autofocus: autofocus || null,
|
|
343
|
-
passwordrules,
|
|
569
|
+
autocomplete, autofocus: autofocus || null, passwordrules,
|
|
344
570
|
enterkeyhint,
|
|
345
571
|
autocapitalize,
|
|
346
|
-
spellcheck,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
'aria-required': `${required || false}`,
|
|
353
|
-
'aria-describedby': this.ariaDescribedBy
|
|
354
|
-
};
|
|
572
|
+
spellcheck, inputmode: this.inputmode || null, id: uniqueId }, passthroughAttrs), {
|
|
573
|
+
// Component-controlled values always win
|
|
574
|
+
'data-value': value, 'aria-invalid': `${invalid || false}`, 'aria-required': `${required || false}`, 'aria-describedby': this.ariaDescribedBy,
|
|
575
|
+
// list attribute: use internal datalist when options provided, otherwise use passthrough value (explicit takes precedence)
|
|
576
|
+
list: hasDatalist ? this.datalistId : (passthroughAttrs.list || null)
|
|
577
|
+
});
|
|
355
578
|
const labelAttr = label ? {
|
|
356
579
|
id: `${uniqueId}-label`,
|
|
357
580
|
fieldIndicator
|
|
@@ -373,19 +596,11 @@ const RInput = class {
|
|
|
373
596
|
const iconColor = shouldShowInvalidMarker ? colors.invalid : colors.valid;
|
|
374
597
|
return h("r-icon", { class: "r-input--validation-icon", "aria-hidden": "true", size: "s", name: iconName, color: iconColor });
|
|
375
598
|
};
|
|
376
|
-
// Filter out event listener properties based on naming convention.
|
|
377
|
-
// Pass them to native element.
|
|
378
|
-
const eventListeners = Object.entries(this).reduce((acc, [key, value]) => {
|
|
379
|
-
if (typeof value === 'function' && key.startsWith('on')) {
|
|
380
|
-
acc[key] = value;
|
|
381
|
-
}
|
|
382
|
-
return acc;
|
|
383
|
-
}, {});
|
|
384
599
|
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 ?
|
|
385
600
|
h("r-label", Object.assign({ class: "r-input--label" }, labelAttr), label)
|
|
386
601
|
:
|
|
387
602
|
h("slot", { name: "label" })), h("slot", { name: "popover" })), hint &&
|
|
388
|
-
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,
|
|
603
|
+
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 &&
|
|
389
604
|
h("r-icon", { class: "r-input--readonly-icon", name: "pen-disabled", size: "s" }), renderValidationMarker(), this.hasTrailingSlot &&
|
|
390
605
|
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))))));
|
|
391
606
|
}
|
|
@@ -395,6 +610,7 @@ const RInput = class {
|
|
|
395
610
|
"type": ["handleTypeChange"]
|
|
396
611
|
}; }
|
|
397
612
|
};
|
|
613
|
+
RInput.autofocusHandled = false;
|
|
398
614
|
RInput.style = inputCss;
|
|
399
615
|
|
|
400
616
|
export { RInput as r_input };
|
|
@@ -190,6 +190,9 @@ const RPagination = class {
|
|
|
190
190
|
}
|
|
191
191
|
return isArrowButton ? buttonElement : (_e = this.el.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector(`.r-pagination--item[data-index="${this.pageActive}"]`);
|
|
192
192
|
}
|
|
193
|
+
handlePropsChange() {
|
|
194
|
+
this.setPaginationState();
|
|
195
|
+
}
|
|
193
196
|
componentWillLoad() {
|
|
194
197
|
this.setPaginationState();
|
|
195
198
|
}
|
|
@@ -201,9 +204,6 @@ const RPagination = class {
|
|
|
201
204
|
componentDidRender() {
|
|
202
205
|
this.syncHeaderWidth();
|
|
203
206
|
}
|
|
204
|
-
componentDidUpdate() {
|
|
205
|
-
this.setPaginationState(); // Recalculate when props change
|
|
206
|
-
}
|
|
207
207
|
render() {
|
|
208
208
|
const { active, previous, next, first, itemsPerPage, itemsPerPageOptions, startText, middleText, endText, selectText, listBoxPosition } = this;
|
|
209
209
|
const itemTemplate = (type, index) => {
|
|
@@ -306,6 +306,12 @@ const RPagination = class {
|
|
|
306
306
|
return (h(Host, { role: "navigation" }, h("div", { class: "r-pagination" }, this.resultsLine && renderHeader(), renderList())));
|
|
307
307
|
}
|
|
308
308
|
get el() { return getElement(this); }
|
|
309
|
+
static get watchers() { return {
|
|
310
|
+
"totalResults": ["handlePropsChange"],
|
|
311
|
+
"itemsPerPage": ["handlePropsChange"],
|
|
312
|
+
"variant": ["handlePropsChange"],
|
|
313
|
+
"pageActive": ["handlePropsChange"]
|
|
314
|
+
}; }
|
|
309
315
|
};
|
|
310
316
|
RPagination.style = paginationCss;
|
|
311
317
|
|
|
@@ -166,10 +166,10 @@ const Panel = class {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
render() {
|
|
169
|
-
return (h(Host, { key: '
|
|
169
|
+
return (h(Host, { key: '44996078c23da8ce9b5b48044d24d45778e688b4', role: "navigation", collapsed: this.isCollapsed }, h("div", { key: 'a217b08d3fda5e4f8761d971074e3de797363f32', class: "r-panel" }, h("div", { key: '8ff71b762feffd1cc9478014e011fc60875a5e3d', class: "r-panel--header" }, this.hasHeader && (h("a", { key: '9ad8475299e9f04341cc1c4b5b9e65551f2f6ca2', class: "logo-wrapper", href: this.logoLink }, this.isCollapsed ?
|
|
170
170
|
h("slot", { name: "logo-collapsed" })
|
|
171
171
|
:
|
|
172
|
-
h("slot", { name: "logo-expanded" }))), this.variant === 'modal' ? (h("r-button", { class: "r-panel--trigger", variant: "blank", icon: "cross", rAriaLabel: `${this.labelCollapse}`, onClick: this.handleFullyCollapsedButtonClick })) : this.variant === 'drawer' ? (h("r-button", { class: "r-panel--trigger", variant: "blank", icon: "angle-left", rAriaLabel: this.isCollapsed ? `${this.labelExpand}` : `${this.labelCollapse}`, onClick: this.handleSemiCollapsedButtonClick })) : this.variant === 'visible' ? (null) : null), h("div", { key: '
|
|
172
|
+
h("slot", { name: "logo-expanded" }))), this.variant === 'modal' ? (h("r-button", { class: "r-panel--trigger", variant: "blank", icon: "cross", rAriaLabel: `${this.labelCollapse}`, onClick: this.handleFullyCollapsedButtonClick })) : this.variant === 'drawer' ? (h("r-button", { class: "r-panel--trigger", variant: "blank", icon: "angle-left", rAriaLabel: this.isCollapsed ? `${this.labelExpand}` : `${this.labelCollapse}`, onClick: this.handleSemiCollapsedButtonClick })) : this.variant === 'visible' ? (null) : null), h("div", { key: '14b5a3ee0e11eda6585a84e0f05aa682950fbce2', class: "r-panel--body" }, h("slot", { key: 'e008d4f4796415779cd8e3dbda696b966b4ac184' })), this.hasFooter && !this.isCollapsed && (h("div", { key: '702c5859f2a7aa60903ec1df29f8977cf46dd0b8', class: "r-panel--footer" }, h("slot", { key: '347796d3e0bbffed77ae9368270f6e27eb93e156', name: "footer" }))))));
|
|
173
173
|
}
|
|
174
174
|
get host() { return getElement(this); }
|
|
175
175
|
static get watchers() { return {
|
|
@@ -69,7 +69,7 @@ const PopoverAction = class {
|
|
|
69
69
|
return focusableElements(this.host);
|
|
70
70
|
}
|
|
71
71
|
render() {
|
|
72
|
-
return (h(Host, { key: '
|
|
72
|
+
return (h(Host, { key: 'a2e9f0482b6de85e54d5fb6c748113efbb76b887', slot: "action" }, h("slot", { key: '656f07644cd0d2e9a15263f644676a3e698d005d', onSlotchange: this.handleSlotChange })));
|
|
73
73
|
}
|
|
74
74
|
get host() { return getElement(this); }
|
|
75
75
|
};
|
|
@@ -51,7 +51,7 @@ const PopoverContent = class {
|
|
|
51
51
|
return focusableElements(this.host);
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
|
-
return (h(Host, { key: '
|
|
54
|
+
return (h(Host, { key: '2384c04a8610e5d26bcd3e3fb4e70c99fca7d76a', slot: "content", class: "r-typography" }, h("slot", { key: '52ce40873c2e32725ee8ef8fc385d498ff8b973c' })));
|
|
55
55
|
}
|
|
56
56
|
get host() { return getElement(this); }
|
|
57
57
|
};
|
|
@@ -17,7 +17,7 @@ const PopoverHeadline = class {
|
|
|
17
17
|
stopInverseThemeAwareness(this.host, themeContextElement);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h(Host, { key: '
|
|
20
|
+
return (h(Host, { key: 'bdbaecb36f49d54a1b33ef27d1c954834df68198', slot: "headline" }, h("slot", { key: '82eb6ae289211e5a23149e12125c1c30cf6b3ffd' })));
|
|
21
21
|
}
|
|
22
22
|
get host() { return getElement(this); }
|
|
23
23
|
};
|
|
@@ -59,7 +59,7 @@ const PopoverTrigger = class {
|
|
|
59
59
|
(_a = this.activeElement) === null || _a === void 0 ? void 0 : _a.blur();
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return (h(Host, { key: '
|
|
62
|
+
return (h(Host, { key: '6c97f11b7263d0cf574fdafcef3d7a9733fe7925', slot: "trigger", onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("slot", { key: '7d434e3505eda793e8d1d50f9fb1aa608061fa50' })));
|
|
63
63
|
}
|
|
64
64
|
get host() { return getElement(this); }
|
|
65
65
|
};
|
|
@@ -329,8 +329,8 @@ const Popover = class {
|
|
|
329
329
|
}
|
|
330
330
|
render() {
|
|
331
331
|
const TAG = !this.activeElement ? 'button' : 'div';
|
|
332
|
-
return (h(Host, { key: '
|
|
333
|
-
h("r-icon-button", { key: '
|
|
332
|
+
return (h(Host, { key: '655880fb3d3f069e13bc7025f932abc192df8918', id: this.uniqueId, "data-position": this.positionState, "data-open": `${this.isOpen}`, open: this.isOpen }, h("div", { key: '6617392de14d78a1a53172fc689245749f01909a', class: "r-popover" }, h(TAG, { key: '87dc99d5ab380b7f288fa9fba0e861feacff6e20', class: "r-popover--trigger", "aria-label": !this.activeElement ? this.triggerAriaLabel : null, ref: el => this.triggerElement = el, "aria-haspopup": "dialog", popoverTarget: !this.activeElement ? `${this.uniqueId}-board` : null, popoverTargetAction: !this.activeElement ? this.triggerAction : null }, h("slot", { key: '51c875b84c1311e40292cf7fe80f7753fcd15abf', name: "trigger" })), h("div", { key: '24a2d6a90d0fe9167a08328e80ed6164c94170f0', class: "r-popover--board", id: `${this.uniqueId}-board`, role: "dialog", "aria-label": this.headlineSlotContent, popover: this.dismissMode, ref: el => this.boardElement = el, onToggle: this.onToggle, onKeyDown: this.onKeyDown }, this.hasDismiss &&
|
|
333
|
+
h("r-icon-button", { key: '51e2563b582c5300eff1a032829bfdfb4947bdb6', ref: el => this.dismissElement = el, class: "r-popover--dismiss", name: "cross", onClick: this.onClickDismiss, label: this.dismissAriaLabel }), h("div", { key: '6abf0772e1b45c1c6be7eeeb5a0b37469e17c4de', class: "r-popover--board-content" }, h("slot", { key: 'd4af6923192d72fb77e0591dbc9f163965fdb9b7', name: "headline" }), h("slot", { key: '469fb95a09ce36ad41b7a76e3f09c8834c4e7e14', name: "content" }), h("slot", { key: '17145240e43b06ae7186ad8d46a3d10b7996d3f2', name: "action" })), h("div", { key: '68e7ce9cdbe5c5b765d5866d9ea6c80d6b830630', class: "r-popover--board-pointer", "aria-hidden": "true" }, h("svg", { key: '55d0e368d2af54a082fc8323b9b1e40457a5a62b', width: "16", height: "8", viewBox: "0 0 16 8", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '86db95e48bed58187dea614c81527f6bd7ef9f3e', d: "M8 8L0 0L16 0L8 8Z", fill: "currentColor" })))))));
|
|
334
334
|
}
|
|
335
335
|
get host() { return getElement(this); }
|
|
336
336
|
static get watchers() { return {
|
|
@@ -15,7 +15,7 @@ const ProgressBar = class {
|
|
|
15
15
|
max: '100',
|
|
16
16
|
'aria-label': rAriaLabel
|
|
17
17
|
};
|
|
18
|
-
return (h(Host, { key: '
|
|
18
|
+
return (h(Host, { key: '832812688a18bea634c8ff2c5ea69599cdefdcff' }, h("progress", Object.assign({ key: 'd3384feada9ee1594e3ee331377d30ae1e8725f1' }, progressBarAttrs, { class: "r-progress-bar" }))));
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
ProgressBar.style = progressBarCss;
|
|
@@ -7,7 +7,7 @@ const RadioButtonDescription = class {
|
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: '30f29f811a727ba758a1e5b89fb86baf78076694', slot: "description" }, h("div", { key: '233da5297c2b1e47def8e92f0d8e9a5fba846dc8', class: "r-radio-button-description", style: { display: 'contents' } }, h("slot", { key: 'f00f06ec8f07b3995fb2249977cad70df930a4c9' }))));
|
|
11
11
|
}
|
|
12
12
|
get host() { return getElement(this); }
|
|
13
13
|
};
|
|
@@ -7,7 +7,7 @@ const RadioButtonLeading = class {
|
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: 'fcfa2b1df999df8a168bd0255ad7855dce28485c', slot: "leading" }, h("div", { key: '2d0e091a66adb24576f5e4a2f0959b8c83dc2017', class: "r-radio-button-leading", style: { display: 'contents' } }, h("slot", { key: 'cebdf0262db3ce092efbe2e8e830aa54903aa59e' }))));
|
|
11
11
|
}
|
|
12
12
|
get host() { return getElement(this); }
|
|
13
13
|
};
|
|
@@ -7,7 +7,7 @@ const RadioButtonTitle = class {
|
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: '12da195c66d902eba41e84b1ccaf3efbabbac144', slot: "title" }, h("div", { key: '84fc3a3e1d0b9b641a7fb859d03e904b5009cb44', class: "r-radio-button-title", style: { display: 'contents' } }, h("slot", { key: '6562965e5dfa79f4b9f80f22b4293e8ea600e4b2' }))));
|
|
11
11
|
}
|
|
12
12
|
get host() { return getElement(this); }
|
|
13
13
|
};
|