@momentum-design/components 0.102.3 → 0.102.5
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 +240 -246
- package/dist/browser/index.js.map +4 -4
- package/dist/components/input/input.component.d.ts +1 -0
- package/dist/components/input/input.component.js +2 -0
- package/dist/components/input/input.types.d.ts +7 -3
- package/dist/components/list/index.d.ts +0 -1
- package/dist/components/list/index.js +0 -1
- package/dist/components/list/list.component.d.ts +9 -12
- package/dist/components/list/list.component.js +17 -34
- package/dist/components/list/list.styles.js +9 -2
- package/dist/components/searchfield/searchfield.component.d.ts +7 -2
- package/dist/components/searchfield/searchfield.component.js +8 -3
- package/dist/components/searchfield/searchfield.types.d.ts +2 -0
- package/dist/components/searchfield/searchfield.types.js +1 -0
- package/dist/custom-elements.json +236 -248
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/input/index.d.ts +3 -1
- package/dist/react/input/index.js +2 -0
- package/dist/react/list/index.d.ts +6 -2
- package/dist/react/list/index.js +6 -2
- package/dist/react/password/index.d.ts +2 -1
- package/dist/react/password/index.js +1 -0
- package/dist/react/searchfield/index.d.ts +9 -3
- package/dist/react/searchfield/index.js +8 -2
- package/package.json +1 -1
@@ -22,6 +22,7 @@ declare const Input_base: import("../../utils/mixins/index.types").Constructor<i
|
|
22
22
|
* @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
|
23
23
|
* @event focus - (React: onFocus) This event is dispatched when the input receives focus.
|
24
24
|
* @event blur - (React: onBlur) This event is dispatched when the input loses focus.
|
25
|
+
* @event clear - (React: onClear) This event is dispatched when the input text is cleared.
|
25
26
|
*
|
26
27
|
* @dependency mdc-icon
|
27
28
|
* @dependency mdc-text
|
@@ -36,6 +36,7 @@ import styles from './input.styles';
|
|
36
36
|
* @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
|
37
37
|
* @event focus - (React: onFocus) This event is dispatched when the input receives focus.
|
38
38
|
* @event blur - (React: onBlur) This event is dispatched when the input loses focus.
|
39
|
+
* @event clear - (React: onClear) This event is dispatched when the input text is cleared.
|
39
40
|
*
|
40
41
|
* @dependency mdc-icon
|
41
42
|
* @dependency mdc-text
|
@@ -252,6 +253,7 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
252
253
|
this.value = '';
|
253
254
|
// focus the input field after clearing the text
|
254
255
|
(_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.focus();
|
256
|
+
this.dispatchEvent(new CustomEvent('clear', { bubbles: true, composed: true }));
|
255
257
|
}
|
256
258
|
/**
|
257
259
|
* Renders the trailing button to clear the input field if the trailingButton is set to true.
|
@@ -1,12 +1,16 @@
|
|
1
|
-
import type { ValueOf } from '../../utils/types';
|
1
|
+
import type { TypedEvent, ValueOf } from '../../utils/types';
|
2
|
+
import type Input from './input.component';
|
2
3
|
import { AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_TYPE } from './input.constants';
|
3
4
|
type AutoCapitalizeType = ValueOf<typeof AUTO_CAPITALIZE>;
|
4
5
|
type AutoCompleteType = ValueOf<typeof AUTO_COMPLETE>;
|
5
6
|
type InputType = ValueOf<typeof INPUT_TYPE>;
|
7
|
+
type InputClearEvent = TypedEvent<Input>;
|
8
|
+
type InputChangeEvent = TypedEvent<Input>;
|
6
9
|
interface Events {
|
7
10
|
onInputEvent: InputEvent;
|
8
|
-
onChangeEvent:
|
11
|
+
onChangeEvent: InputChangeEvent;
|
9
12
|
onFocusEvent: FocusEvent;
|
10
13
|
onBlurEvent: FocusEvent;
|
14
|
+
onClearEvent: InputClearEvent;
|
11
15
|
}
|
12
|
-
export type { AutoCapitalizeType, AutoCompleteType, InputType, Events };
|
16
|
+
export type { AutoCapitalizeType, AutoCompleteType, InputType, InputClearEvent, InputChangeEvent, Events };
|
@@ -1,29 +1,26 @@
|
|
1
1
|
import type { CSSResult } from 'lit';
|
2
2
|
import { Component } from '../../models';
|
3
|
-
import type { RoleType } from '../../utils/roles';
|
4
|
-
declare const List_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof Component;
|
5
3
|
/**
|
6
4
|
* mdc-list component is used to display a group of list items. It is used as a container to wrap other list items.
|
7
5
|
*
|
6
|
+
* To add a header to the list, use the `mdc-listheader` component and place it in the `list-header` slot.
|
7
|
+
* `mdc-listitem` components can be placed in the default slot.
|
8
|
+
*
|
8
9
|
* @tagname mdc-list
|
9
10
|
*
|
10
|
-
* @
|
11
|
+
* @slot default - This is a default/unnamed slot, where listitems can be placed.
|
12
|
+
* @slot list-header - This slot is used to pass a header for the list, which can be a `mdc-listheader` component.
|
11
13
|
*
|
12
|
-
* @
|
14
|
+
* @csspart container - The container slot around the list items
|
13
15
|
*/
|
14
|
-
declare class List extends
|
16
|
+
declare class List extends Component {
|
15
17
|
/**
|
16
18
|
* @internal
|
17
19
|
* Get all listitem elements which are not disabled in the list.
|
18
20
|
*/
|
19
|
-
listItems
|
20
|
-
/**
|
21
|
-
* The header text of the list.
|
22
|
-
*/
|
23
|
-
headerText?: string;
|
24
|
-
/** @internal */
|
25
|
-
protected dataRole: RoleType;
|
21
|
+
private listItems;
|
26
22
|
constructor();
|
23
|
+
connectedCallback(): void;
|
27
24
|
/**
|
28
25
|
* Handles the keydown event on the list element.
|
29
26
|
* If the key is 'ArrowUp' or 'ArrowDown', it focuses to the previous or next list item
|
@@ -7,32 +7,36 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
9
|
};
|
10
|
-
import { html
|
11
|
-
import {
|
10
|
+
import { html } from 'lit';
|
11
|
+
import { queryAssignedElements } from 'lit/decorators.js';
|
12
12
|
import { Component } from '../../models';
|
13
13
|
import { KEYS } from '../../utils/keys';
|
14
|
-
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
15
14
|
import { ROLE } from '../../utils/roles';
|
16
15
|
import { TAG_NAME as LISTITEM_TAGNAME } from '../listitem/listitem.constants';
|
17
|
-
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
18
|
-
import { HEADER_ID } from './list.constants';
|
19
16
|
import styles from './list.styles';
|
20
17
|
/**
|
21
18
|
* mdc-list component is used to display a group of list items. It is used as a container to wrap other list items.
|
22
19
|
*
|
20
|
+
* To add a header to the list, use the `mdc-listheader` component and place it in the `list-header` slot.
|
21
|
+
* `mdc-listitem` components can be placed in the default slot.
|
22
|
+
*
|
23
23
|
* @tagname mdc-list
|
24
24
|
*
|
25
|
-
* @
|
25
|
+
* @slot default - This is a default/unnamed slot, where listitems can be placed.
|
26
|
+
* @slot list-header - This slot is used to pass a header for the list, which can be a `mdc-listheader` component.
|
26
27
|
*
|
27
|
-
* @
|
28
|
+
* @csspart container - The container slot around the list items
|
28
29
|
*/
|
29
|
-
class List extends
|
30
|
+
class List extends Component {
|
30
31
|
constructor() {
|
31
32
|
super();
|
32
|
-
/** @internal */
|
33
|
-
this.dataRole = ROLE.LIST;
|
34
33
|
this.addEventListener('keydown', this.handleKeyDown);
|
35
34
|
}
|
35
|
+
connectedCallback() {
|
36
|
+
super.connectedCallback();
|
37
|
+
// Set the role attribute for accessibility.
|
38
|
+
this.setAttribute('role', ROLE.LIST);
|
39
|
+
}
|
36
40
|
/**
|
37
41
|
* Handles the keydown event on the list element.
|
38
42
|
* If the key is 'ArrowUp' or 'ArrowDown', it focuses to the previous or next list item
|
@@ -109,27 +113,10 @@ class List extends DataAriaLabelMixin(Component) {
|
|
109
113
|
this.resetTabIndexAndSetActiveTabIndex(0);
|
110
114
|
}
|
111
115
|
render() {
|
112
|
-
var _a;
|
113
|
-
const headerText = this.headerText
|
114
|
-
? html `
|
115
|
-
<mdc-text
|
116
|
-
id="${HEADER_ID}"
|
117
|
-
part="header-text"
|
118
|
-
type="${TYPE.BODY_MIDSIZE_BOLD}"
|
119
|
-
tagname="${VALID_TEXT_TAGS.SPAN}"
|
120
|
-
>${this.headerText}</mdc-text
|
121
|
-
>
|
122
|
-
`
|
123
|
-
: nothing;
|
124
116
|
return html `
|
125
|
-
<
|
126
|
-
|
127
|
-
|
128
|
-
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
129
|
-
>
|
130
|
-
${headerText}
|
131
|
-
<slot role="presentation" @click="${this.handleMouseClick}"></slot>
|
132
|
-
</div>
|
117
|
+
<slot name="list-header"></slot>
|
118
|
+
<!-- make the container slot role presentation to keep it ignored in a11y tree -->
|
119
|
+
<slot part="container" @click="${this.handleMouseClick}" role="presentation"></slot>
|
133
120
|
`;
|
134
121
|
}
|
135
122
|
}
|
@@ -138,8 +125,4 @@ __decorate([
|
|
138
125
|
queryAssignedElements({ selector: `${LISTITEM_TAGNAME}:not([disabled])` }),
|
139
126
|
__metadata("design:type", Array)
|
140
127
|
], List.prototype, "listItems", void 0);
|
141
|
-
__decorate([
|
142
|
-
property({ type: String, attribute: 'header-text', reflect: true }),
|
143
|
-
__metadata("design:type", String)
|
144
|
-
], List.prototype, "headerText", void 0);
|
145
128
|
export default List;
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
const styles = css `
|
3
|
-
:host
|
4
|
-
|
3
|
+
:host {
|
4
|
+
display: flex;
|
5
|
+
flex-direction: column;
|
6
|
+
}
|
7
|
+
|
8
|
+
:host::part(container) {
|
9
|
+
display: flex;
|
10
|
+
flex-direction: column;
|
11
|
+
gap: 0rem;
|
5
12
|
}
|
6
13
|
`;
|
7
14
|
export default [styles];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CSSResult } from 'lit';
|
2
2
|
import Input from '../input/input.component';
|
3
3
|
/**
|
4
|
-
* searchfield component is used as an input field for search functionality.
|
4
|
+
* `mdc-searchfield` component is used as an input field for search functionality.
|
5
5
|
*
|
6
6
|
* It supports `mdc-inputchip` as filters.
|
7
7
|
*
|
@@ -9,8 +9,13 @@ import Input from '../input/input.component';
|
|
9
9
|
*
|
10
10
|
* @tagname mdc-searchfield
|
11
11
|
*
|
12
|
-
* @
|
12
|
+
* @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
|
13
|
+
* @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
|
14
|
+
* @event focus - (React: onFocus) This event is dispatched when the input receives focus.
|
15
|
+
* @event blur - (React: onBlur) This event is dispatched when the input loses focus.
|
16
|
+
* @event clear - (React: onClear) This event is dispatched when the input text is cleared.
|
13
17
|
*
|
18
|
+
* @slot filters - Slot for input chips
|
14
19
|
*/
|
15
20
|
declare class Searchfield extends Input {
|
16
21
|
inputChips?: Array<HTMLElement>;
|
@@ -15,7 +15,7 @@ import { KEYS } from '../../utils/keys';
|
|
15
15
|
import styles from './searchfield.styles';
|
16
16
|
import { DEFAULTS } from './searchfield.constants';
|
17
17
|
/**
|
18
|
-
* searchfield component is used as an input field for search functionality.
|
18
|
+
* `mdc-searchfield` component is used as an input field for search functionality.
|
19
19
|
*
|
20
20
|
* It supports `mdc-inputchip` as filters.
|
21
21
|
*
|
@@ -23,8 +23,13 @@ import { DEFAULTS } from './searchfield.constants';
|
|
23
23
|
*
|
24
24
|
* @tagname mdc-searchfield
|
25
25
|
*
|
26
|
-
* @
|
26
|
+
* @event input - (React: onInput) This event is dispatched when the value of the input field changes (every press).
|
27
|
+
* @event change - (React: onChange) This event is dispatched when the value of the input field changes (on blur).
|
28
|
+
* @event focus - (React: onFocus) This event is dispatched when the input receives focus.
|
29
|
+
* @event blur - (React: onBlur) This event is dispatched when the input loses focus.
|
30
|
+
* @event clear - (React: onClear) This event is dispatched when the input text is cleared.
|
27
31
|
*
|
32
|
+
* @slot filters - Slot for input chips
|
28
33
|
*/
|
29
34
|
class Searchfield extends Input {
|
30
35
|
constructor() {
|
@@ -46,7 +51,7 @@ class Searchfield extends Input {
|
|
46
51
|
*/
|
47
52
|
handleKeyDown(event) {
|
48
53
|
super.handleKeyDown(event);
|
49
|
-
if (event.key ===
|
54
|
+
if (event.key === KEYS.ESCAPE) {
|
50
55
|
this.clearInputText();
|
51
56
|
}
|
52
57
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|