@momentum-design/components 0.28.2 → 0.28.3
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/dist/browser/index.js +136 -122
- package/dist/browser/index.js.map +4 -4
- package/dist/components/buttonsimple/buttonsimple.component.d.ts +1 -7
- package/dist/components/buttonsimple/buttonsimple.component.js +6 -13
- package/dist/components/checkbox/checkbox.component.d.ts +26 -13
- package/dist/components/checkbox/checkbox.component.js +62 -22
- package/dist/components/formfieldgroup/formfieldgroup.component.js +2 -1
- package/dist/components/input/input.component.d.ts +59 -72
- package/dist/components/input/input.component.js +85 -100
- package/dist/components/radio/radio.component.d.ts +51 -36
- package/dist/components/radio/radio.component.js +126 -46
- package/dist/components/radio/radio.styles.js +4 -0
- package/dist/components/radiogroup/radiogroup.component.d.ts +7 -2
- package/dist/components/radiogroup/radiogroup.component.js +26 -3
- package/dist/components/themeprovider/themeprovider.component.d.ts +1 -1
- package/dist/components/themeprovider/themeprovider.component.js +1 -1
- package/dist/components/toggle/toggle.component.d.ts +43 -24
- package/dist/components/toggle/toggle.component.js +79 -31
- package/dist/components/toggle/toggle.constants.d.ts +1 -0
- package/dist/components/toggle/toggle.constants.js +1 -0
- package/dist/custom-elements.json +1334 -433
- package/dist/react/themeprovider/index.d.ts +1 -1
- package/dist/react/themeprovider/index.js +1 -1
- package/dist/utils/mixins/FormInternalsMixin.d.ts +38 -0
- package/dist/utils/mixins/FormInternalsMixin.js +79 -0
- package/package.json +1 -1
- package/dist/utils/mixins/NameMixin.d.ts +0 -6
- package/dist/utils/mixins/NameMixin.js +0 -29
- package/dist/utils/mixins/ReadonlyMixin.d.ts +0 -6
- package/dist/utils/mixins/ReadonlyMixin.js +0 -29
- package/dist/utils/mixins/RequiredMixin.d.ts +0 -6
- package/dist/utils/mixins/RequiredMixin.js +0 -29
- package/dist/utils/mixins/ValueMixin.d.ts +0 -6
- package/dist/utils/mixins/ValueMixin.js +0 -28
@@ -2,7 +2,7 @@ import type { PropertyValues } from 'lit';
|
|
2
2
|
import { CSSResult } from 'lit';
|
3
3
|
import { Component } from '../../models';
|
4
4
|
import type { ButtonSize, ButtonType } from './buttonsimple.types';
|
5
|
-
declare const Buttonsimple_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
5
|
+
declare const Buttonsimple_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
6
6
|
/**
|
7
7
|
* `mdc-buttonsimple` is a component that can be configured in various ways to suit different use cases.
|
8
8
|
* It is used as an internal component and is not intended to be used directly by consumers.
|
@@ -60,12 +60,6 @@ declare class Buttonsimple extends Buttonsimple_base {
|
|
60
60
|
* @internal
|
61
61
|
*/
|
62
62
|
private prevTabindex;
|
63
|
-
/** @internal */
|
64
|
-
static formAssociated: boolean;
|
65
|
-
/** @internal */
|
66
|
-
private internals;
|
67
|
-
/** @internal */
|
68
|
-
get form(): HTMLFormElement | null;
|
69
63
|
constructor();
|
70
64
|
update(changedProperties: PropertyValues): void;
|
71
65
|
protected executeAction(): void;
|
@@ -11,6 +11,7 @@ import { html } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { Component } from '../../models';
|
13
13
|
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
14
|
+
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
14
15
|
import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
|
15
16
|
import { BUTTON_TYPE, DEFAULTS } from './buttonsimple.constants';
|
16
17
|
import styles from './buttonsimple.styles';
|
@@ -26,11 +27,7 @@ import styles from './buttonsimple.styles';
|
|
26
27
|
*
|
27
28
|
* @tagname mdc-buttonsimple
|
28
29
|
*/
|
29
|
-
class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
|
30
|
-
/** @internal */
|
31
|
-
get form() {
|
32
|
-
return this.internals.form;
|
33
|
-
}
|
30
|
+
class Buttonsimple extends FormInternalsMixin(TabIndexMixin(DisabledMixin(Component))) {
|
34
31
|
constructor() {
|
35
32
|
super();
|
36
33
|
/**
|
@@ -81,8 +78,6 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
|
|
81
78
|
this.addEventListener('keydown', this.handleKeyDown.bind(this));
|
82
79
|
this.addEventListener('keyup', this.handleKeyUp.bind(this));
|
83
80
|
this.addEventListener('blur', this.handleBlur.bind(this));
|
84
|
-
/** @internal */
|
85
|
-
this.internals = this.attachInternals();
|
86
81
|
}
|
87
82
|
update(changedProperties) {
|
88
83
|
super.update(changedProperties);
|
@@ -97,11 +92,11 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
|
|
97
92
|
}
|
98
93
|
}
|
99
94
|
executeAction() {
|
100
|
-
if (this.type === BUTTON_TYPE.SUBMIT && this.
|
101
|
-
this.
|
95
|
+
if (this.type === BUTTON_TYPE.SUBMIT && this.form) {
|
96
|
+
this.form.requestSubmit();
|
102
97
|
}
|
103
|
-
if (this.type === BUTTON_TYPE.RESET && this.
|
104
|
-
this.
|
98
|
+
if (this.type === BUTTON_TYPE.RESET && this.form) {
|
99
|
+
this.form.reset();
|
105
100
|
}
|
106
101
|
}
|
107
102
|
/**
|
@@ -208,8 +203,6 @@ class Buttonsimple extends TabIndexMixin(DisabledMixin(Component)) {
|
|
208
203
|
`;
|
209
204
|
}
|
210
205
|
}
|
211
|
-
/** @internal */
|
212
|
-
Buttonsimple.formAssociated = true;
|
213
206
|
Buttonsimple.styles = [...Component.styles, ...styles];
|
214
207
|
__decorate([
|
215
208
|
property({ type: Boolean, reflect: true }),
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { CSSResult, PropertyValues } from 'lit';
|
2
|
+
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
2
3
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
3
|
-
declare const Checkbox_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/
|
4
|
+
declare const Checkbox_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
4
5
|
/**
|
5
6
|
* Checkboxes allow users to select multiple options from a list or turn an item/feature on or off.
|
6
7
|
* These are often used in forms, settings, and selections in lists.
|
@@ -30,7 +31,7 @@ declare const Checkbox_base: import("../../utils/mixins/index.types").Constructo
|
|
30
31
|
* @cssproperty --mdc-checkbox-icon-color - Icon color for an unselected checkbox.
|
31
32
|
* @cssproperty --mdc-checkbox-pressed-icon-color - Background color for a selected checkbox when pressed.
|
32
33
|
*/
|
33
|
-
declare class Checkbox extends Checkbox_base {
|
34
|
+
declare class Checkbox extends Checkbox_base implements AssociatedFormControl {
|
34
35
|
/**
|
35
36
|
* Determines whether the checkbox is selected or unselected.
|
36
37
|
*
|
@@ -45,12 +46,12 @@ declare class Checkbox extends Checkbox_base {
|
|
45
46
|
* @default false
|
46
47
|
*/
|
47
48
|
indeterminate: boolean;
|
48
|
-
/**
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
/**
|
50
|
+
* Automatically focus on the element when the page loads.
|
51
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
52
|
+
* @default false
|
53
|
+
*/
|
54
|
+
autofocus: boolean;
|
54
55
|
constructor();
|
55
56
|
/**
|
56
57
|
* Updates the form value to reflect the current state of the checkbox.
|
@@ -58,23 +59,35 @@ declare class Checkbox extends Checkbox_base {
|
|
58
59
|
* If unchecked, the value is set to null.
|
59
60
|
*/
|
60
61
|
private setFormValue;
|
62
|
+
/**
|
63
|
+
* Manages the required state of the checkbox.
|
64
|
+
* If the checkbox is not checked and the requiredLabel property is set, then the checkbox is invalid.
|
65
|
+
*/
|
66
|
+
private manageRequired;
|
67
|
+
/** @internal
|
68
|
+
* Resets the checkbox to its initial state.
|
69
|
+
* The checked property is set to false.
|
70
|
+
*/
|
71
|
+
formResetCallback(): void;
|
72
|
+
/** @internal */
|
73
|
+
formStateRestoreCallback(state: string): void;
|
61
74
|
/**
|
62
75
|
* Toggles the state of the checkbox element.
|
63
76
|
* If the element is not disabled, then
|
64
77
|
* the checked property is toggled and the indeterminate property is set to false.
|
65
78
|
*/
|
66
79
|
private toggleState;
|
67
|
-
/**
|
68
|
-
* Toggles the state of the checkbox element.
|
69
|
-
* and dispatch the new change event.
|
70
|
-
*/
|
71
|
-
handleChange(event: Event): void;
|
72
80
|
/**
|
73
81
|
* Handles the keydown event on the checkbox.
|
74
82
|
* When the user presses Enter, the form is submitted.
|
75
83
|
* @param event - The keyboard event.
|
76
84
|
*/
|
77
85
|
private handleKeyDown;
|
86
|
+
/**
|
87
|
+
* Toggles the state of the checkbox element.
|
88
|
+
* and dispatch the new change event.
|
89
|
+
*/
|
90
|
+
handleChange(event: Event): void;
|
78
91
|
update(changedProperties: PropertyValues): void;
|
79
92
|
render(): import("lit-html").TemplateResult<1>;
|
80
93
|
static styles: Array<CSSResult>;
|
@@ -10,10 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
13
|
-
import { v4 as uuidv4 } from 'uuid';
|
14
13
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
15
|
-
import {
|
16
|
-
import { ValueMixin } from '../../utils/mixins/ValueMixin';
|
14
|
+
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
17
15
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
18
16
|
import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
|
19
17
|
import { ICON_NAME } from './checkbox.constants';
|
@@ -47,11 +45,7 @@ import styles from './checkbox.styles';
|
|
47
45
|
* @cssproperty --mdc-checkbox-icon-color - Icon color for an unselected checkbox.
|
48
46
|
* @cssproperty --mdc-checkbox-pressed-icon-color - Background color for a selected checkbox when pressed.
|
49
47
|
*/
|
50
|
-
class Checkbox extends
|
51
|
-
/** @internal */
|
52
|
-
get form() {
|
53
|
-
return this.internals.form;
|
54
|
-
}
|
48
|
+
class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
55
49
|
constructor() {
|
56
50
|
super();
|
57
51
|
/**
|
@@ -68,10 +62,14 @@ class Checkbox extends NameMixin(ValueMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
68
62
|
* @default false
|
69
63
|
*/
|
70
64
|
this.indeterminate = false;
|
71
|
-
|
65
|
+
/**
|
66
|
+
* Automatically focus on the element when the page loads.
|
67
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
68
|
+
* @default false
|
69
|
+
*/
|
70
|
+
this.autofocus = false;
|
72
71
|
// Checkbox does not contain helpTextType property.
|
73
72
|
this.helpTextType = undefined;
|
74
|
-
this.id = `mdc-input-${uuidv4()}`;
|
75
73
|
}
|
76
74
|
/**
|
77
75
|
* Updates the form value to reflect the current state of the checkbox.
|
@@ -83,8 +81,44 @@ class Checkbox extends NameMixin(ValueMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
83
81
|
if (this.checked) {
|
84
82
|
actualValue = !this.value ? 'on' : this.value;
|
85
83
|
}
|
84
|
+
else {
|
85
|
+
actualValue = null;
|
86
|
+
}
|
87
|
+
this.manageRequired();
|
86
88
|
this.internals.setFormValue(actualValue);
|
87
89
|
}
|
90
|
+
/**
|
91
|
+
* Manages the required state of the checkbox.
|
92
|
+
* If the checkbox is not checked and the requiredLabel property is set, then the checkbox is invalid.
|
93
|
+
*/
|
94
|
+
manageRequired() {
|
95
|
+
if (!this.checked && this.requiredLabel) {
|
96
|
+
if (this.validationMessage) {
|
97
|
+
this.inputElement.setCustomValidity(this.validationMessage);
|
98
|
+
}
|
99
|
+
else {
|
100
|
+
this.inputElement.setCustomValidity('');
|
101
|
+
}
|
102
|
+
this.setValidity();
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
this.internals.setValidity({});
|
106
|
+
}
|
107
|
+
}
|
108
|
+
/** @internal
|
109
|
+
* Resets the checkbox to its initial state.
|
110
|
+
* The checked property is set to false.
|
111
|
+
*/
|
112
|
+
formResetCallback() {
|
113
|
+
this.checked = false;
|
114
|
+
this.indeterminate = false;
|
115
|
+
}
|
116
|
+
/** @internal */
|
117
|
+
formStateRestoreCallback(state) {
|
118
|
+
if (state) {
|
119
|
+
this.checked = true;
|
120
|
+
}
|
121
|
+
}
|
88
122
|
/**
|
89
123
|
* Toggles the state of the checkbox element.
|
90
124
|
* If the element is not disabled, then
|
@@ -96,15 +130,6 @@ class Checkbox extends NameMixin(ValueMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
96
130
|
this.indeterminate = false;
|
97
131
|
}
|
98
132
|
}
|
99
|
-
/**
|
100
|
-
* Toggles the state of the checkbox element.
|
101
|
-
* and dispatch the new change event.
|
102
|
-
*/
|
103
|
-
handleChange(event) {
|
104
|
-
this.toggleState();
|
105
|
-
const EventConstructor = event.constructor;
|
106
|
-
this.dispatchEvent(new EventConstructor(event.type, event));
|
107
|
-
}
|
108
133
|
/**
|
109
134
|
* Handles the keydown event on the checkbox.
|
110
135
|
* When the user presses Enter, the form is submitted.
|
@@ -116,6 +141,15 @@ class Checkbox extends NameMixin(ValueMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
116
141
|
(_a = this.form) === null || _a === void 0 ? void 0 : _a.requestSubmit();
|
117
142
|
}
|
118
143
|
}
|
144
|
+
/**
|
145
|
+
* Toggles the state of the checkbox element.
|
146
|
+
* and dispatch the new change event.
|
147
|
+
*/
|
148
|
+
handleChange(event) {
|
149
|
+
this.toggleState();
|
150
|
+
const EventConstructor = event.constructor;
|
151
|
+
this.dispatchEvent(new EventConstructor(event.type, event));
|
152
|
+
}
|
119
153
|
update(changedProperties) {
|
120
154
|
super.update(changedProperties);
|
121
155
|
if (changedProperties.has('checked')) {
|
@@ -139,13 +173,17 @@ class Checkbox extends NameMixin(ValueMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
139
173
|
id="${this.id}"
|
140
174
|
type="checkbox"
|
141
175
|
class="input"
|
176
|
+
?autofocus="${this.autofocus}"
|
142
177
|
name="${ifDefined(this.name)}"
|
143
178
|
value="${ifDefined(this.value)}"
|
179
|
+
?required="${!!this.requiredLabel}"
|
144
180
|
.checked="${this.checked}"
|
181
|
+
aria-checked="${this.indeterminate ? 'mixed' : this.checked}"
|
145
182
|
.indeterminate="${this.indeterminate}"
|
146
183
|
.disabled="${this.disabled}"
|
147
184
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
148
|
-
|
185
|
+
tabindex="${this.disabled ? -1 : 0}"
|
186
|
+
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
149
187
|
@change=${this.handleChange}
|
150
188
|
@keydown=${this.handleKeyDown}
|
151
189
|
/>
|
@@ -158,8 +196,6 @@ class Checkbox extends NameMixin(ValueMixin(DataAriaLabelMixin(FormfieldWrapper)
|
|
158
196
|
`;
|
159
197
|
}
|
160
198
|
}
|
161
|
-
/** @internal */
|
162
|
-
Checkbox.formAssociated = true;
|
163
199
|
Checkbox.styles = [...FormfieldWrapper.styles, ...styles];
|
164
200
|
__decorate([
|
165
201
|
property({ type: Boolean, reflect: true }),
|
@@ -169,4 +205,8 @@ __decorate([
|
|
169
205
|
property({ type: Boolean, reflect: true }),
|
170
206
|
__metadata("design:type", Object)
|
171
207
|
], Checkbox.prototype, "indeterminate", void 0);
|
208
|
+
__decorate([
|
209
|
+
property({ type: Boolean, reflect: true }),
|
210
|
+
__metadata("design:type", Object)
|
211
|
+
], Checkbox.prototype, "autofocus", void 0);
|
172
212
|
export default Checkbox;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { html } from 'lit';
|
2
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
2
3
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
3
4
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
4
5
|
import { ROLE } from './formfieldgroup.constants';
|
@@ -45,7 +46,7 @@ class FormfieldGroup extends DataAriaLabelMixin(FormfieldWrapper) {
|
|
45
46
|
part="container"
|
46
47
|
role="${this.isRadio ? ROLE.RADIOGROUP : ROLE.GROUP}"
|
47
48
|
aria-labelledby="${FORMFIELD_DEFAULTS.HEADING_ID}"
|
48
|
-
aria-describedby="${FORMFIELD_DEFAULTS.HELPER_TEXT_ID}"
|
49
|
+
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
49
50
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
50
51
|
>
|
51
52
|
<div part="group-header">
|
@@ -2,7 +2,8 @@ import { CSSResult, nothing, PropertyValueMap } from 'lit';
|
|
2
2
|
import FormfieldWrapper from '../formfieldwrapper';
|
3
3
|
import type { IconNames } from '../icon/icon.types';
|
4
4
|
import type { AutoCapitalizeType } from './input.types';
|
5
|
-
|
5
|
+
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
6
|
+
declare const Input_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
6
7
|
/**
|
7
8
|
* mdc-input is a component that allows users to input text.
|
8
9
|
* It contains:
|
@@ -44,7 +45,7 @@ declare const Input_base: import("../../utils/mixins/index.types").Constructor<i
|
|
44
45
|
* @cssproperty --mdc-input-primary-border-color - Border color for the input container when primary
|
45
46
|
*
|
46
47
|
*/
|
47
|
-
declare class Input extends Input_base {
|
48
|
+
declare class Input extends Input_base implements AssociatedFormControl {
|
48
49
|
/**
|
49
50
|
* The placeholder text that is displayed when the input field is empty.
|
50
51
|
*/
|
@@ -116,97 +117,83 @@ declare class Input extends Input_base {
|
|
116
117
|
* @default ''
|
117
118
|
*/
|
118
119
|
clearAriaLabel: string;
|
119
|
-
|
120
|
-
reportValidity(): boolean;
|
121
|
-
/** @internal */
|
122
|
-
private internals;
|
120
|
+
connectedCallback(): void;
|
123
121
|
/** @internal */
|
124
|
-
|
122
|
+
formResetCallback(): void;
|
125
123
|
/** @internal */
|
126
|
-
|
127
|
-
constructor();
|
128
|
-
/**
|
129
|
-
* @internal
|
130
|
-
* The input element
|
131
|
-
*/
|
132
|
-
private inputElement;
|
133
|
-
connectedCallback(): void;
|
134
|
-
protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
124
|
+
formStateRestoreCallback(state: string): void;
|
135
125
|
/**
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
126
|
+
* Handles the value change of the input field.
|
127
|
+
* Sets the form value and updates the validity of the input field.
|
128
|
+
* @returns void
|
129
|
+
*/
|
140
130
|
handleValueChange(): void;
|
131
|
+
protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
132
|
+
private setInputValidity;
|
141
133
|
/**
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
134
|
+
* This function is called when the attribute changes.
|
135
|
+
* It updates the validity of the input field based on the input field's validity.
|
136
|
+
*
|
137
|
+
* @param name - attribute name
|
138
|
+
* @param old - old value
|
139
|
+
* @param value - new value
|
140
|
+
*/
|
149
141
|
attributeChangedCallback(name: string, old: string | null, value: string | null): void;
|
150
142
|
/**
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Updates the value of the input field.
|
157
|
-
* Sets the form value.
|
158
|
-
* @returns void
|
159
|
-
*/
|
143
|
+
* Updates the value of the input field.
|
144
|
+
* Sets the form value.
|
145
|
+
* @returns void
|
146
|
+
*/
|
160
147
|
private updateValue;
|
161
148
|
/**
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
149
|
+
* Handles the input event of the input field.
|
150
|
+
* Updates the value and sets the validity of the input field.
|
151
|
+
*
|
152
|
+
*/
|
166
153
|
private onInput;
|
167
154
|
/**
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
155
|
+
* Handles the change event of the input field.
|
156
|
+
* Updates the value and sets the validity of the input field.
|
157
|
+
*
|
158
|
+
* The 'change' event does not bubble up through the shadow DOM as it was not composed.
|
159
|
+
* Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
|
160
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
|
161
|
+
*
|
162
|
+
* @param event - Event which contains information about the value change.
|
163
|
+
*/
|
177
164
|
private onChange;
|
178
165
|
/**
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
166
|
+
* Handles the keydown event of the input field.
|
167
|
+
* If the key pressed is 'Enter', it submits the form.
|
168
|
+
* @param event - Keyboard event
|
169
|
+
*/
|
183
170
|
private handleKeyDown;
|
184
171
|
/**
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
172
|
+
* Renders the leading icon before the input field.
|
173
|
+
* If the leading icon is not set, it will not be displayed.
|
174
|
+
*
|
175
|
+
* @returns void
|
176
|
+
*/
|
190
177
|
protected renderLeadingIcon(): import("lit-html").TemplateResult<1> | typeof nothing;
|
191
178
|
/**
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
179
|
+
* Renders the prefix text before the input field.
|
180
|
+
* If the prefix text is more than 10 characters,
|
181
|
+
* - it will not be displayed.
|
182
|
+
* - the validation messsage will be displayed.
|
183
|
+
*
|
184
|
+
* Note: We are setting aria-hidden so that the screen reader does not read the prefix text.
|
185
|
+
* The consumers should set the appropriate aria-label for the input field using 'data-aria-label' attribute.
|
186
|
+
* @returns void
|
187
|
+
*/
|
201
188
|
protected renderPrefixText(): import("lit-html").TemplateResult<1> | typeof nothing;
|
202
189
|
/**
|
203
|
-
|
204
|
-
|
190
|
+
* Clears the input field.
|
191
|
+
*/
|
205
192
|
private clearInputText;
|
206
193
|
/**
|
207
|
-
|
208
|
-
|
209
|
-
|
194
|
+
* Renders the trailing button to clear the input field if the trailingButton is set to true.
|
195
|
+
* @returns void
|
196
|
+
*/
|
210
197
|
protected renderTrailingButton(): import("lit-html").TemplateResult<1> | typeof nothing;
|
211
198
|
render(): import("lit-html").TemplateResult<1>;
|
212
199
|
static styles: Array<CSSResult>;
|