@momentum-design/components 0.62.1 → 0.62.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.
@@ -1,5 +1,5 @@
1
- import ListItem from './listitem.component';
2
1
  import '../text';
2
+ import ListItem from './listitem.component';
3
3
  declare global {
4
4
  interface HTMLElementTagNameMap {
5
5
  ['mdc-listitem']: ListItem;
@@ -1,5 +1,5 @@
1
+ import '../text';
1
2
  import ListItem from './listitem.component';
2
3
  import { TAG_NAME } from './listitem.constants';
3
- import '../text';
4
4
  ListItem.register(TAG_NAME);
5
5
  export default ListItem;
@@ -1,9 +1,9 @@
1
- import type { CSSResult, PropertyValues } from 'lit';
2
- import { nothing, TemplateResult } from 'lit';
1
+ import type { CSSResult, PropertyValues, TemplateResult } from 'lit';
2
+ import { nothing } from 'lit';
3
3
  import { Component } from '../../models';
4
- import type { TextType } from '../text/text.types';
4
+ import { TextType } from '../text/text.types';
5
5
  import type { ListItemVariants } from './listitem.types';
6
- declare const ListItem_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & typeof Component;
6
+ declare const ListItem_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & typeof Component;
7
7
  /**
8
8
  * mdc-listitem component is used to display a label with different types of controls.
9
9
  * There can be three types of controls, a radio button, a checkbox on the
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { html, nothing } from 'lit';
11
11
  import { property, queryAssignedElements } from 'lit/decorators.js';
12
12
  import { Component } from '../../models';
13
- import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
14
13
  import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
15
14
  import { TabIndexMixin } from '../../utils/mixins/TabIndexMixin';
16
15
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
@@ -54,7 +53,7 @@ import styles from './listitem.styles';
54
53
  * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the listitem.
55
54
  * @event focus - (React: onFocus) This event is dispatched when the listitem receives focus.
56
55
  */
57
- class ListItem extends DataAriaLabelMixin(DisabledMixin(TabIndexMixin(Component))) {
56
+ class ListItem extends DisabledMixin(TabIndexMixin(Component)) {
58
57
  constructor() {
59
58
  super(...arguments);
60
59
  /**
@@ -105,6 +104,7 @@ class ListItem extends DataAriaLabelMixin(DisabledMixin(TabIndexMixin(Component)
105
104
  if (changedProperties.has('disabled')) {
106
105
  this.tabIndex = this.disabled ? -1 : 0;
107
106
  this.disableSlottedChildren(this.disabled);
107
+ this.setAttribute('aria-disabled', `${this.disabled}`);
108
108
  }
109
109
  }
110
110
  render() {
@@ -0,0 +1,8 @@
1
+ import '../text';
2
+ import MenuItem from './menuitem.component';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ ['mdc-menuitem']: MenuItem;
6
+ }
7
+ }
8
+ export default MenuItem;
@@ -0,0 +1,5 @@
1
+ import '../text';
2
+ import MenuItem from './menuitem.component';
3
+ import { TAG_NAME } from './menuitem.constants';
4
+ MenuItem.register(TAG_NAME);
5
+ export default MenuItem;
@@ -0,0 +1,25 @@
1
+ import type { CSSResult } from 'lit';
2
+ import ListItem from '../listitem/listitem.component';
3
+ /**
4
+ * menuitem component is inherited by listitem component with the role set `menuitem`.<br/>
5
+ * A menu item can contain an icon on the leading or trailing side.
6
+ *
7
+ * The leading and trailing slots can be used to display controls and text.<br/>
8
+ * Based on the leading/trailing slot, the position of the controls and text can be adjusted.
9
+ *
10
+ * Please use mdc-menu as a parent element even when there is only menuitem for a11y purpose.
11
+ *
12
+ * @dependency mdc-text
13
+ *
14
+ * @tagname mdc-menuitem
15
+ *
16
+ * @event click - (React: onClick) This event is dispatched when the menuitem is clicked.
17
+ * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the menuitem.
18
+ * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the menuitem.
19
+ * @event focus - (React: onFocus) This event is dispatched when the menuitem receives focus.
20
+ */
21
+ declare class MenuItem extends ListItem {
22
+ connectedCallback(): void;
23
+ static styles: Array<CSSResult>;
24
+ }
25
+ export default MenuItem;
@@ -0,0 +1,29 @@
1
+ import ListItem from '../listitem/listitem.component';
2
+ import { LISTITEM_VARIANTS } from '../listitem/listitem.constants';
3
+ /**
4
+ * menuitem component is inherited by listitem component with the role set `menuitem`.<br/>
5
+ * A menu item can contain an icon on the leading or trailing side.
6
+ *
7
+ * The leading and trailing slots can be used to display controls and text.<br/>
8
+ * Based on the leading/trailing slot, the position of the controls and text can be adjusted.
9
+ *
10
+ * Please use mdc-menu as a parent element even when there is only menuitem for a11y purpose.
11
+ *
12
+ * @dependency mdc-text
13
+ *
14
+ * @tagname mdc-menuitem
15
+ *
16
+ * @event click - (React: onClick) This event is dispatched when the menuitem is clicked.
17
+ * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the menuitem.
18
+ * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the menuitem.
19
+ * @event focus - (React: onFocus) This event is dispatched when the menuitem receives focus.
20
+ */
21
+ class MenuItem extends ListItem {
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ this.role = 'menuitem';
25
+ this.variant = LISTITEM_VARIANTS.INSET_RECTANGLE;
26
+ }
27
+ }
28
+ MenuItem.styles = [...ListItem.styles];
29
+ export default MenuItem;
@@ -0,0 +1,2 @@
1
+ declare const TAG_NAME: "mdc-menuitem";
2
+ export { TAG_NAME };
@@ -0,0 +1,3 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('menuitem');
3
+ export { TAG_NAME };
@@ -0,0 +1,6 @@
1
+ interface Events {
2
+ onChangeEvent: Event;
3
+ onClickEvent: MouseEvent;
4
+ onFocusEvent: FocusEvent;
5
+ }
6
+ export type { Events };
@@ -0,0 +1 @@
1
+ export {};
@@ -58,7 +58,6 @@ class Option extends FormInternalsMixin(ListItem) {
58
58
  this.secondaryLabel = undefined;
59
59
  this.sideHeaderText = undefined;
60
60
  this.sublineText = undefined;
61
- this.dataAriaLabel = undefined;
62
61
  this.addEventListener('focusin', this.displayTooltipForLongText);
63
62
  this.addEventListener('mouseover', this.displayTooltipForLongText);
64
63
  this.addEventListener('focusout', this.hideTooltipOnLeave);
@@ -131,9 +130,6 @@ class Option extends FormInternalsMixin(ListItem) {
131
130
  }
132
131
  update(changedProperties) {
133
132
  super.update(changedProperties);
134
- if (changedProperties.has('disabled')) {
135
- this.updateAttribute('aria-disabled', `${this.disabled}`);
136
- }
137
133
  if (changedProperties.has('selected')) {
138
134
  this.updateAttribute('aria-selected', `${this.selected}`);
139
135
  }