@momentum-design/components 0.105.2 → 0.105.4
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 +236 -241
- package/dist/browser/index.js.map +4 -4
- package/dist/components/buttonsimple/buttonsimple.component.d.ts +1 -1
- package/dist/components/buttonsimple/buttonsimple.component.js +2 -2
- package/dist/components/checkbox/checkbox.component.d.ts +3 -2
- package/dist/components/checkbox/checkbox.component.js +11 -2
- package/dist/components/input/input.component.d.ts +3 -7
- package/dist/components/input/input.component.js +11 -11
- package/dist/components/radio/radio.component.d.ts +3 -9
- package/dist/components/radio/radio.component.js +10 -12
- package/dist/components/searchfield/searchfield.component.d.ts +2 -2
- package/dist/components/searchfield/searchfield.component.js +2 -1
- package/dist/components/select/select.component.d.ts +3 -3
- package/dist/components/select/select.component.js +10 -3
- package/dist/components/textarea/textarea.component.d.ts +2 -6
- package/dist/components/textarea/textarea.component.js +11 -11
- package/dist/components/toggle/toggle.component.d.ts +2 -7
- package/dist/components/toggle/toggle.component.js +11 -12
- package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +5 -8
- package/dist/components/virtualizedlist/virtualizedlist.component.js +10 -7
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +1 -1
- package/dist/components/virtualizedlist/virtualizedlist.types.d.ts +3 -2
- package/dist/custom-elements.json +1056 -897
- package/dist/index.d.ts +2 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/dist/react/virtualizedlist/index.d.ts +2 -2
- package/dist/react/virtualizedlist/index.js +2 -2
- package/dist/utils/mixins/AutoFocusOnMountMixin.d.ts +7 -0
- package/dist/utils/mixins/{AutoFocusMixin.js → AutoFocusOnMountMixin.js} +17 -8
- package/dist/utils/mixins/FormInternalsMixin.d.ts +0 -1
- package/package.json +1 -1
- package/dist/utils/mixins/AutoFocusMixin.d.ts +0 -6
@@ -3,7 +3,7 @@ import { CSSResult } from 'lit';
|
|
3
3
|
import { Component } from '../../models';
|
4
4
|
import type { RoleType } from '../../utils/roles';
|
5
5
|
import type { ButtonSize, ButtonType } from './buttonsimple.types';
|
6
|
-
declare const Buttonsimple_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/
|
6
|
+
declare const Buttonsimple_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & typeof Component;
|
7
7
|
/**
|
8
8
|
* `mdc-buttonsimple` is a component that can be configured in various ways to suit different use cases.
|
9
9
|
* It is used as an internal component and is not intended to be used directly by consumers.
|
@@ -11,7 +11,7 @@ import { html } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { Component } from '../../models';
|
13
13
|
import { KEYS } from '../../utils/keys';
|
14
|
-
import {
|
14
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
15
15
|
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
16
16
|
import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
|
17
17
|
import { BUTTON_TYPE, DEFAULTS } from './buttonsimple.constants';
|
@@ -28,7 +28,7 @@ import styles from './buttonsimple.styles';
|
|
28
28
|
*
|
29
29
|
* @tagname mdc-buttonsimple
|
30
30
|
*/
|
31
|
-
class Buttonsimple extends
|
31
|
+
class Buttonsimple extends AutoFocusOnMountMixin(TabIndexMixin(DisabledMixin(Component))) {
|
32
32
|
/** @internal */
|
33
33
|
get form() {
|
34
34
|
return this.internals.form;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { CSSResult, PropertyValues } from 'lit';
|
1
|
+
import { CSSResult, PropertyValueMap, PropertyValues } from 'lit';
|
2
2
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
3
3
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
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
|
+
declare const Checkbox_base: import("../../utils/mixins/index.types").Constructor<import("../../models/component/component.component").default & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
5
5
|
/**
|
6
6
|
* Checkboxes allow users to select multiple options from a list or turn an item/feature on or off.
|
7
7
|
* These are often used in forms, settings, and selections in lists.
|
@@ -49,6 +49,7 @@ declare class Checkbox extends Checkbox_base implements AssociatedFormControl {
|
|
49
49
|
*/
|
50
50
|
autofocus: boolean;
|
51
51
|
connectedCallback(): void;
|
52
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
52
53
|
/**
|
53
54
|
* Updates the form value to reflect the current state of the checkbox.
|
54
55
|
* If checked, the value is set to either the user-provided value or 'on' if no value is provided.
|
@@ -11,6 +11,7 @@ import { html, nothing } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
13
13
|
import { KEYS } from '../../utils/keys';
|
14
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
14
15
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
15
16
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
16
17
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
@@ -41,7 +42,7 @@ import styles from './checkbox.styles';
|
|
41
42
|
* @cssproperty --mdc-checkbox-pressed-icon-color - Background color for a selected checkbox when pressed.
|
42
43
|
* @cssproperty --mdc-checkbox-disabled-checked-icon-color - Background color for a selected checkbox when disabled.
|
43
44
|
*/
|
44
|
-
class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
45
|
+
class Checkbox extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
45
46
|
constructor() {
|
46
47
|
super(...arguments);
|
47
48
|
/**
|
@@ -75,6 +76,15 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
75
76
|
// Checkbox does not contain helpTextType property.
|
76
77
|
this.helpTextType = undefined;
|
77
78
|
}
|
79
|
+
firstUpdated(_changedProperties) {
|
80
|
+
// set the element to auto focus if autoFocusOnMount is set to true
|
81
|
+
// before running the super method, so that the AutoFocusOnMountMixin can use it
|
82
|
+
// to focus the correct element
|
83
|
+
if (this.inputElement && this.autoFocusOnMount) {
|
84
|
+
this.elementToAutoFocus = this.inputElement;
|
85
|
+
}
|
86
|
+
super.firstUpdated(_changedProperties);
|
87
|
+
}
|
78
88
|
/**
|
79
89
|
* Updates the form value to reflect the current state of the checkbox.
|
80
90
|
* If checked, the value is set to either the user-provided value or 'on' if no value is provided.
|
@@ -173,7 +183,6 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
173
183
|
id="${this.inputId}"
|
174
184
|
type="checkbox"
|
175
185
|
class="input"
|
176
|
-
?autofocus="${this.autofocus}"
|
177
186
|
name="${ifDefined(this.name)}"
|
178
187
|
value="${ifDefined(this.value)}"
|
179
188
|
?required="${this.required}"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { CSSResult, nothing } from 'lit';
|
1
|
+
import { CSSResult, nothing, PropertyValueMap } from 'lit';
|
2
2
|
import FormfieldWrapper from '../formfieldwrapper';
|
3
3
|
import type { IconNames } from '../icon/icon.types';
|
4
4
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
5
5
|
import type { AutoCapitalizeType, AutoCompleteType, InputType } from './input.types';
|
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
|
+
declare const Input_base: import("../../utils/mixins/index.types").Constructor<import("../../models/component/component.component").default & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
7
7
|
/**
|
8
8
|
* mdc-input is a component that allows users to input text.
|
9
9
|
* It contains:
|
@@ -89,11 +89,6 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
89
89
|
* @default 'off'
|
90
90
|
*/
|
91
91
|
autocomplete: AutoCompleteType;
|
92
|
-
/**
|
93
|
-
* If true, the input field is focused when the component is rendered.
|
94
|
-
* @default false
|
95
|
-
*/
|
96
|
-
autofocus: boolean;
|
97
92
|
/**
|
98
93
|
* Specifies the name of the directionality of text for submission purposes (e.g., "rtl" for right-to-left).
|
99
94
|
*/
|
@@ -120,6 +115,7 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
120
115
|
*/
|
121
116
|
clearAriaLabel: string;
|
122
117
|
connectedCallback(): void;
|
118
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
123
119
|
/** @internal */
|
124
120
|
formResetCallback(): void;
|
125
121
|
/** @internal */
|
@@ -16,6 +16,7 @@ import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwra
|
|
16
16
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
17
17
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
18
18
|
import { KEYS } from '../../utils/keys';
|
19
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
19
20
|
import { AUTO_CAPITALIZE, AUTO_COMPLETE, DEFAULTS, PREFIX_TEXT_OPTIONS } from './input.constants';
|
20
21
|
import styles from './input.styles';
|
21
22
|
/**
|
@@ -61,7 +62,7 @@ import styles from './input.styles';
|
|
61
62
|
* @cssproperty --mdc-input-primary-border-color - Border color for the input container when primary
|
62
63
|
*
|
63
64
|
*/
|
64
|
-
class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
65
|
+
class Input extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
65
66
|
constructor() {
|
66
67
|
super(...arguments);
|
67
68
|
/**
|
@@ -87,11 +88,6 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
87
88
|
* @default 'off'
|
88
89
|
*/
|
89
90
|
this.autocomplete = AUTO_COMPLETE.OFF;
|
90
|
-
/**
|
91
|
-
* If true, the input field is focused when the component is rendered.
|
92
|
-
* @default false
|
93
|
-
*/
|
94
|
-
this.autofocus = false;
|
95
91
|
/**
|
96
92
|
* Aria label for the trailing button. If trailing button is set to true, this label is used for the clear button.
|
97
93
|
* @default ''
|
@@ -113,6 +109,15 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
113
109
|
}
|
114
110
|
});
|
115
111
|
}
|
112
|
+
firstUpdated(_changedProperties) {
|
113
|
+
// set the element to auto focus if autoFocusOnMount is set to true
|
114
|
+
// before running the super method, so that the AutoFocusOnMountMixin can use it
|
115
|
+
// to focus the correct element
|
116
|
+
if (this.inputElement && this.autoFocusOnMount) {
|
117
|
+
this.elementToAutoFocus = this.inputElement;
|
118
|
+
}
|
119
|
+
super.firstUpdated(_changedProperties);
|
120
|
+
}
|
116
121
|
/** @internal */
|
117
122
|
formResetCallback() {
|
118
123
|
this.value = '';
|
@@ -298,7 +303,6 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
298
303
|
maxlength=${ifDefined(this.maxlength)}
|
299
304
|
autocapitalize=${this.autocapitalize}
|
300
305
|
autocomplete=${this.autocomplete}
|
301
|
-
?autofocus="${this.autofocus}"
|
302
306
|
dirname=${ifDefined(this.dirname)}
|
303
307
|
pattern=${ifDefined(this.pattern)}
|
304
308
|
list=${ifDefined(this.list)}
|
@@ -360,10 +364,6 @@ __decorate([
|
|
360
364
|
property({ type: String }),
|
361
365
|
__metadata("design:type", String)
|
362
366
|
], Input.prototype, "autocomplete", void 0);
|
363
|
-
__decorate([
|
364
|
-
property({ type: Boolean }),
|
365
|
-
__metadata("design:type", Object)
|
366
|
-
], Input.prototype, "autofocus", void 0);
|
367
367
|
__decorate([
|
368
368
|
property({ type: String }),
|
369
369
|
__metadata("design:type", String)
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { CSSResult, PropertyValues } from 'lit';
|
1
|
+
import { CSSResult, PropertyValueMap, PropertyValues } from 'lit';
|
2
2
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
3
3
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
4
|
-
declare const Radio_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
|
+
declare const Radio_base: import("../../utils/mixins/index.types").Constructor<import("../../models/component/component.component").default & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
5
5
|
/**
|
6
6
|
* Radio allow users to select single options from a list or turn an item/feature on or off.
|
7
7
|
* These are often used in forms, settings, and selection in lists.
|
@@ -42,14 +42,8 @@ declare class Radio extends Radio_base implements AssociatedFormControl {
|
|
42
42
|
* @default false
|
43
43
|
*/
|
44
44
|
readonly: boolean;
|
45
|
-
/**
|
46
|
-
* Automatically focus on the element when the page loads.
|
47
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
48
|
-
* @default false
|
49
|
-
*/
|
50
|
-
autofocus: boolean;
|
51
45
|
connectedCallback(): void;
|
52
|
-
firstUpdated(): void;
|
46
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
53
47
|
/**
|
54
48
|
* Returns all radios within the same group (name).
|
55
49
|
*/
|
@@ -17,6 +17,7 @@ import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
|
17
17
|
import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
|
18
18
|
import { ROLE } from '../../utils/roles';
|
19
19
|
import { KEYS } from '../../utils/keys';
|
20
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
20
21
|
import styles from './radio.styles';
|
21
22
|
/**
|
22
23
|
* Radio allow users to select single options from a list or turn an item/feature on or off.
|
@@ -45,7 +46,7 @@ import styles from './radio.styles';
|
|
45
46
|
* @cssproperty --mdc-radio-control-inactive-disabled-background - color of the radio button when inactive and disabled
|
46
47
|
*
|
47
48
|
*/
|
48
|
-
class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
49
|
+
class Radio extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
49
50
|
constructor() {
|
50
51
|
super(...arguments);
|
51
52
|
/**
|
@@ -60,12 +61,6 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
60
61
|
* @default false
|
61
62
|
*/
|
62
63
|
this.readonly = false;
|
63
|
-
/**
|
64
|
-
* Automatically focus on the element when the page loads.
|
65
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
66
|
-
* @default false
|
67
|
-
*/
|
68
|
-
this.autofocus = false;
|
69
64
|
this.renderLabelAndHelperText = () => {
|
70
65
|
if (!this.label)
|
71
66
|
return nothing;
|
@@ -77,8 +72,15 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
77
72
|
// Radio does not contain helpTextType property.
|
78
73
|
this.helpTextType = undefined;
|
79
74
|
}
|
80
|
-
firstUpdated() {
|
75
|
+
firstUpdated(_changedProperties) {
|
81
76
|
this.updateTabIndex();
|
77
|
+
// set the element to auto focus if autoFocusOnMount is set to true
|
78
|
+
// before running the super method, so that the AutoFocusOnMountMixin can use it
|
79
|
+
// to focus the correct element
|
80
|
+
if (this.inputElement && this.autoFocusOnMount) {
|
81
|
+
this.elementToAutoFocus = this.inputElement;
|
82
|
+
}
|
83
|
+
super.firstUpdated(_changedProperties);
|
82
84
|
}
|
83
85
|
/**
|
84
86
|
* Returns all radios within the same group (name).
|
@@ -307,8 +309,4 @@ __decorate([
|
|
307
309
|
property({ type: Boolean, reflect: true }),
|
308
310
|
__metadata("design:type", Object)
|
309
311
|
], Radio.prototype, "readonly", void 0);
|
310
|
-
__decorate([
|
311
|
-
property({ type: Boolean, reflect: true }),
|
312
|
-
__metadata("design:type", Object)
|
313
|
-
], Radio.prototype, "autofocus", void 0);
|
314
312
|
export default Radio;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CSSResult } from 'lit';
|
1
|
+
import { CSSResult, PropertyValueMap } from 'lit';
|
2
2
|
import Input from '../input/input.component';
|
3
3
|
/**
|
4
4
|
* `mdc-searchfield` component is used as an input field for search functionality.
|
@@ -45,7 +45,7 @@ declare class Searchfield extends Input {
|
|
45
45
|
* Eventually, this logic has to be omitted and achieved using CSS instead.
|
46
46
|
* @override
|
47
47
|
*/
|
48
|
-
firstUpdated(): void;
|
48
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
49
49
|
clearInputText(): void;
|
50
50
|
render(): import("lit-html").TemplateResult<1>;
|
51
51
|
static styles: Array<CSSResult>;
|
@@ -85,13 +85,14 @@ class Searchfield extends Input {
|
|
85
85
|
* Eventually, this logic has to be omitted and achieved using CSS instead.
|
86
86
|
* @override
|
87
87
|
*/
|
88
|
-
firstUpdated() {
|
88
|
+
firstUpdated(_changedProperties) {
|
89
89
|
this.inputElement.onfocus = () => {
|
90
90
|
this.isInputFocused = true;
|
91
91
|
};
|
92
92
|
this.inputElement.onblur = () => {
|
93
93
|
this.isInputFocused = false;
|
94
94
|
};
|
95
|
+
super.firstUpdated(_changedProperties);
|
95
96
|
}
|
96
97
|
clearInputText() {
|
97
98
|
var _a;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import type { PropertyValues } from 'lit';
|
1
|
+
import type { PropertyValueMap, PropertyValues } from 'lit';
|
2
2
|
import { CSSResult } from 'lit';
|
3
3
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
4
4
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
5
5
|
import type Option from '../option/option.component';
|
6
6
|
import type { Placement } from './select.types';
|
7
|
-
declare const Select_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;
|
7
|
+
declare const Select_base: import("../../utils/mixins/index.types").Constructor<import("../../models/component/component.component").default & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
8
8
|
/**
|
9
9
|
* The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
|
10
10
|
* It is designed to work with `mdc-option` for individual options and `mdc-optgroup` for grouping related options.
|
@@ -129,7 +129,7 @@ declare class Select extends Select_base implements AssociatedFormControl {
|
|
129
129
|
* If an option is selected, use that as the value.
|
130
130
|
* If not, use the placeholder if it exists, otherwise use the first option.
|
131
131
|
*/
|
132
|
-
firstUpdated(): Promise<void>;
|
132
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void>;
|
133
133
|
updated(changedProperties: PropertyValues): void;
|
134
134
|
/**
|
135
135
|
* Modifies the listbox wrapper to ensure it has the correct attributes
|
@@ -12,6 +12,7 @@ import { property, query, queryAssignedElements, state } from 'lit/decorators.js
|
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
13
13
|
import { KEYS } from '../../utils/keys';
|
14
14
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
15
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
15
16
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
16
17
|
import { ROLE } from '../../utils/roles';
|
17
18
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
@@ -65,7 +66,7 @@ import styles from './select.styles';
|
|
65
66
|
* @cssproperty --mdc-select-listbox-height - The height of the listbox inside the select.
|
66
67
|
* @cssproperty --mdc-select-listbox-width - The width of the listbox inside the select (default: `--mdc-select-width`).
|
67
68
|
*/
|
68
|
-
class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
69
|
+
class Select extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
69
70
|
constructor() {
|
70
71
|
super(...arguments);
|
71
72
|
/**
|
@@ -136,7 +137,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
136
137
|
* If an option is selected, use that as the value.
|
137
138
|
* If not, use the placeholder if it exists, otherwise use the first option.
|
138
139
|
*/
|
139
|
-
async firstUpdated() {
|
140
|
+
async firstUpdated(_changedProperties) {
|
140
141
|
await this.updateComplete;
|
141
142
|
this.modifyListBoxWrapper();
|
142
143
|
const firstSelectedOption = this.getFirstSelectedOption();
|
@@ -158,6 +159,13 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
158
159
|
// then we call the native validity
|
159
160
|
this.setInputValidity();
|
160
161
|
}
|
162
|
+
// set the element to auto focus if autoFocusOnMount is set to true
|
163
|
+
// before running the super method, so that the AutoFocusOnMountMixin can use it
|
164
|
+
// to focus the correct element
|
165
|
+
if (this.inputElement && this.autoFocusOnMount) {
|
166
|
+
this.elementToAutoFocus = this.inputElement;
|
167
|
+
}
|
168
|
+
super.firstUpdated(_changedProperties);
|
161
169
|
}
|
162
170
|
updated(changedProperties) {
|
163
171
|
super.updated(changedProperties);
|
@@ -538,7 +546,6 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
538
546
|
part="native-input"
|
539
547
|
name="${this.name}"
|
540
548
|
type="text"
|
541
|
-
?autofocus="${this.autofocus}"
|
542
549
|
?disabled=${this.disabled}
|
543
550
|
?required=${this.required}
|
544
551
|
?readonly=${this.readonly}
|
@@ -2,7 +2,7 @@ import { CSSResult, nothing, PropertyValueMap } from 'lit';
|
|
2
2
|
import FormfieldWrapper from '../formfieldwrapper';
|
3
3
|
import type { AutoCapitalizeType } from '../input/input.types';
|
4
4
|
import type { WrapType, AutoCompleteType } from './textarea.types';
|
5
|
-
declare const Textarea_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;
|
5
|
+
declare const Textarea_base: import("../../utils/mixins/index.types").Constructor<import("../../models/component/component.component").default & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & 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
6
|
/**
|
7
7
|
* mdc-textarea component, which is used to get the multi-line text input from the user.
|
8
8
|
* It contains:
|
@@ -87,11 +87,6 @@ declare class Textarea extends Textarea_base {
|
|
87
87
|
* @default 'off'
|
88
88
|
*/
|
89
89
|
autocomplete: AutoCompleteType;
|
90
|
-
/**
|
91
|
-
* If true, the textarea field is focused when the component is rendered.
|
92
|
-
* @default false
|
93
|
-
*/
|
94
|
-
autofocus: boolean;
|
95
90
|
/**
|
96
91
|
* Specifies the name of the directionality of text for submission purposes (e.g., "rtl" for right-to-left).
|
97
92
|
*/
|
@@ -116,6 +111,7 @@ declare class Textarea extends Textarea_base {
|
|
116
111
|
private characterLimitExceedingFired;
|
117
112
|
protected get textarea(): HTMLTextAreaElement;
|
118
113
|
connectedCallback(): void;
|
114
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
119
115
|
private setTextareaValidity;
|
120
116
|
/** @internal */
|
121
117
|
formResetCallback(): void;
|
@@ -15,6 +15,7 @@ import { DEFAULTS as FORMFIELD_DEFAULTS, VALIDATION } from '../formfieldwrapper/
|
|
15
15
|
import { AUTO_CAPITALIZE } from '../input/input.constants';
|
16
16
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
17
17
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
18
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
18
19
|
import { AUTO_COMPLETE, WRAP, DEFAULTS } from './textarea.constants';
|
19
20
|
import styles from './textarea.styles';
|
20
21
|
/**
|
@@ -66,7 +67,7 @@ import styles from './textarea.styles';
|
|
66
67
|
* @cssproperty --mdc-textarea-focused-background-color - Background color for the textarea container when focused
|
67
68
|
* @cssproperty --mdc-textarea-focused-border-color - Border color for the textarea container when focused
|
68
69
|
*/
|
69
|
-
class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
70
|
+
class Textarea extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
70
71
|
constructor() {
|
71
72
|
super(...arguments);
|
72
73
|
/**
|
@@ -99,11 +100,6 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
99
100
|
* @default 'off'
|
100
101
|
*/
|
101
102
|
this.autocomplete = AUTO_COMPLETE.OFF;
|
102
|
-
/**
|
103
|
-
* If true, the textarea field is focused when the component is rendered.
|
104
|
-
* @default false
|
105
|
-
*/
|
106
|
-
this.autofocus = false;
|
107
103
|
this.characterLimitExceedingFired = false;
|
108
104
|
}
|
109
105
|
get textarea() {
|
@@ -128,6 +124,15 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
128
124
|
}
|
129
125
|
});
|
130
126
|
}
|
127
|
+
firstUpdated(_changedProperties) {
|
128
|
+
// set the element to auto focus if autoFocusOnMount is set to true
|
129
|
+
// before running the super method, so that the AutoFocusOnMountMixin can use it
|
130
|
+
// to focus the correct element
|
131
|
+
if (this.inputElement && this.autoFocusOnMount) {
|
132
|
+
this.elementToAutoFocus = this.inputElement;
|
133
|
+
}
|
134
|
+
super.firstUpdated(_changedProperties);
|
135
|
+
}
|
131
136
|
setTextareaValidity() {
|
132
137
|
if (this.required && this.validationMessage && this.value === '') {
|
133
138
|
this.textarea.setCustomValidity(this.validationMessage);
|
@@ -290,7 +295,6 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
290
295
|
rows=${ifDefined(this.rows)}
|
291
296
|
cols=${ifDefined(this.cols)}
|
292
297
|
wrap=${ifDefined(this.wrap)}
|
293
|
-
?autofocus="${this.autofocus}"
|
294
298
|
autocapitalize=${this.autocapitalize}
|
295
299
|
autocomplete=${this.autocomplete}
|
296
300
|
minlength=${ifDefined(this.minlength)}
|
@@ -335,10 +339,6 @@ __decorate([
|
|
335
339
|
property({ type: String }),
|
336
340
|
__metadata("design:type", String)
|
337
341
|
], Textarea.prototype, "autocomplete", void 0);
|
338
|
-
__decorate([
|
339
|
-
property({ type: Boolean }),
|
340
|
-
__metadata("design:type", Boolean)
|
341
|
-
], Textarea.prototype, "autofocus", void 0);
|
342
342
|
__decorate([
|
343
343
|
property({ type: String }),
|
344
344
|
__metadata("design:type", String)
|
@@ -2,7 +2,7 @@ import { CSSResult, PropertyValueMap } from 'lit';
|
|
2
2
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
3
3
|
import FormfieldWrapper from '../formfieldwrapper';
|
4
4
|
import type { ToggleSize } from './toggle.types';
|
5
|
-
declare const Toggle_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;
|
5
|
+
declare const Toggle_base: import("../../utils/mixins/index.types").Constructor<import("../../models/component/component.component").default & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & 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
6
|
/**
|
7
7
|
* Toggle Component is an interactive control used to switch between two mutually exclusive options,
|
8
8
|
* such as On/Off, Active/Inactive. These are commonly used in settings panels, forms, and preference selections
|
@@ -51,13 +51,8 @@ declare class Toggle extends Toggle_base implements AssociatedFormControl {
|
|
51
51
|
* @default default
|
52
52
|
*/
|
53
53
|
size: ToggleSize;
|
54
|
-
/**
|
55
|
-
* Automatically focus on the element when the page loads.
|
56
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
57
|
-
* @default false
|
58
|
-
*/
|
59
|
-
autofocus: boolean;
|
60
54
|
connectedCallback(): void;
|
55
|
+
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
61
56
|
/** @internal
|
62
57
|
* Resets the checkbox to its initial state.
|
63
58
|
* The checked property is set to false.
|
@@ -11,6 +11,7 @@ import { html } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
13
13
|
import { KEYS } from '../../utils/keys';
|
14
|
+
import { AutoFocusOnMountMixin } from '../../utils/mixins/AutoFocusOnMountMixin';
|
14
15
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
15
16
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
16
17
|
import { ROLE } from '../../utils/roles';
|
@@ -53,7 +54,7 @@ import styles from './toggle.styles';
|
|
53
54
|
* @cssproperty --mdc-toggle-inactive-hover-color - Background color of the inactive toggle in hover state
|
54
55
|
* @cssproperty --mdc-toggle-inactive-pressed-color - Background color of the inactive toggle in pressed state
|
55
56
|
*/
|
56
|
-
class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
57
|
+
class Toggle extends AutoFocusOnMountMixin(FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))) {
|
57
58
|
constructor() {
|
58
59
|
super(...arguments);
|
59
60
|
/**
|
@@ -68,18 +69,21 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
68
69
|
* @default default
|
69
70
|
*/
|
70
71
|
this.size = DEFAULTS.SIZE;
|
71
|
-
/**
|
72
|
-
* Automatically focus on the element when the page loads.
|
73
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
74
|
-
* @default false
|
75
|
-
*/
|
76
|
-
this.autofocus = false;
|
77
72
|
}
|
78
73
|
connectedCallback() {
|
79
74
|
super.connectedCallback();
|
80
75
|
// Toggle does not contain helpTextType property.
|
81
76
|
this.helpTextType = undefined;
|
82
77
|
}
|
78
|
+
firstUpdated(_changedProperties) {
|
79
|
+
// set the element to auto focus if autoFocusOnMount is set to true
|
80
|
+
// before running the super method, so that the AutoFocusOnMountMixin can use it
|
81
|
+
// to focus the correct element
|
82
|
+
if (this.inputElement && this.autoFocusOnMount) {
|
83
|
+
this.elementToAutoFocus = this.inputElement;
|
84
|
+
}
|
85
|
+
super.firstUpdated(_changedProperties);
|
86
|
+
}
|
83
87
|
/** @internal
|
84
88
|
* Resets the checkbox to its initial state.
|
85
89
|
* The checked property is set to false.
|
@@ -192,7 +196,6 @@ class Toggle extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
192
196
|
type="checkbox"
|
193
197
|
part="toggle-input"
|
194
198
|
role="${ROLE.CHECKBOX}"
|
195
|
-
?autofocus="${this.autofocus}"
|
196
199
|
?required="${this.required}"
|
197
200
|
name="${ifDefined(this.name)}"
|
198
201
|
value="${ifDefined(this.value)}"
|
@@ -219,8 +222,4 @@ __decorate([
|
|
219
222
|
property({ type: String, reflect: true }),
|
220
223
|
__metadata("design:type", String)
|
221
224
|
], Toggle.prototype, "size", void 0);
|
222
|
-
__decorate([
|
223
|
-
property({ type: Boolean, reflect: true }),
|
224
|
-
__metadata("design:type", Object)
|
225
|
-
], Toggle.prototype, "autofocus", void 0);
|
226
225
|
export default Toggle;
|
@@ -13,18 +13,11 @@ import { SetListDataProps, VirtualizerProps } from './virtualizedlist.types';
|
|
13
13
|
*
|
14
14
|
* @tagname mdc-virtualizedlist
|
15
15
|
*
|
16
|
-
* @event
|
16
|
+
* @event scroll - (React: onScroll) Event that gets called when user scrolls inside of list.
|
17
17
|
*
|
18
18
|
* @slot - Client side List with nested list items.
|
19
19
|
*/
|
20
20
|
declare class VirtualizedList extends Component {
|
21
|
-
/**
|
22
|
-
* Callback that gets called when user scrolls inside of list. This gives access to the scroll container element
|
23
|
-
* as well via the event. Particularly useful for
|
24
|
-
* handling logic related when the user scrolls to the top or bottom of a list.
|
25
|
-
* @default undefined
|
26
|
-
*/
|
27
|
-
onscroll: ((this: GlobalEventHandlers, ev: Event) => void) | null;
|
28
21
|
/**
|
29
22
|
* Object that sets and updates the virtualizer with any relevant props.
|
30
23
|
* There are two required object props in order to get virtualization to work properly.
|
@@ -85,6 +78,10 @@ declare class VirtualizedList extends Component {
|
|
85
78
|
* @returns The template result containing the list wrapper.
|
86
79
|
*/
|
87
80
|
private getVirtualizedListWrapper;
|
81
|
+
/**
|
82
|
+
* Refires the scroll event from the internal scroll container to the host element
|
83
|
+
*/
|
84
|
+
private handleScroll;
|
88
85
|
render(): TemplateResult<1>;
|
89
86
|
static styles: Array<CSSResult>;
|
90
87
|
}
|
@@ -24,7 +24,7 @@ import { DEFAULTS } from './virtualizedlist.constants';
|
|
24
24
|
*
|
25
25
|
* @tagname mdc-virtualizedlist
|
26
26
|
*
|
27
|
-
* @event
|
27
|
+
* @event scroll - (React: onScroll) Event that gets called when user scrolls inside of list.
|
28
28
|
*
|
29
29
|
* @slot - Client side List with nested list items.
|
30
30
|
*/
|
@@ -125,17 +125,20 @@ class VirtualizedList extends Component {
|
|
125
125
|
<slot></slot>
|
126
126
|
</div>`;
|
127
127
|
}
|
128
|
+
/**
|
129
|
+
* Refires the scroll event from the internal scroll container to the host element
|
130
|
+
*/
|
131
|
+
handleScroll(event) {
|
132
|
+
const EventConstructor = event.constructor;
|
133
|
+
this.dispatchEvent(new EventConstructor(event.type, event));
|
134
|
+
}
|
128
135
|
render() {
|
129
|
-
return html `<div ${ref(this.scrollElementRef)} part="scroll" @scroll=${this.
|
136
|
+
return html `<div ${ref(this.scrollElementRef)} part="scroll" @scroll=${this.handleScroll}>
|
130
137
|
${this.virtualizerController ? this.getVirtualizedListWrapper(this.virtualizerController) : html ``}
|
131
|
-
</div
|
138
|
+
</div>`;
|
132
139
|
}
|
133
140
|
}
|
134
141
|
VirtualizedList.styles = [...Component.styles, ...styles];
|
135
|
-
__decorate([
|
136
|
-
property({ type: Function, attribute: 'onscroll' }),
|
137
|
-
__metadata("design:type", Object)
|
138
|
-
], VirtualizedList.prototype, "onscroll", void 0);
|
139
142
|
__decorate([
|
140
143
|
property({ type: Object, attribute: 'virtualizerprops' }),
|
141
144
|
__metadata("design:type", Object)
|
@@ -53,7 +53,7 @@ class VirtualizedWrapper extends Component {
|
|
53
53
|
return html `
|
54
54
|
<div style="height: 500px; width: 500px;">
|
55
55
|
<mdc-virtualizedlist
|
56
|
-
|
56
|
+
@scroll=${this.onscroll}
|
57
57
|
.virtualizerProps=${this.virtualizerProps}
|
58
58
|
.setlistdata=${this.setListData}
|
59
59
|
>${this.list}</mdc-virtualizedlist
|