@momentum-design/components 0.66.1 → 0.66.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.
Files changed (42) hide show
  1. package/dist/browser/index.js +211 -202
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -1
  4. package/dist/components/formfieldgroup/formfieldgroup.constants.d.ts +1 -5
  5. package/dist/components/formfieldgroup/formfieldgroup.constants.js +1 -5
  6. package/dist/components/list/list.component.d.ts +3 -0
  7. package/dist/components/list/list.component.js +5 -2
  8. package/dist/components/listitem/index.d.ts +1 -0
  9. package/dist/components/listitem/index.js +1 -0
  10. package/dist/components/listitem/listitem.component.d.ts +30 -1
  11. package/dist/components/listitem/listitem.component.js +65 -3
  12. package/dist/components/listitem/listitem.constants.d.ts +4 -1
  13. package/dist/components/listitem/listitem.constants.js +5 -1
  14. package/dist/components/listitem/listitem.styles.js +20 -8
  15. package/dist/components/menuitem/index.d.ts +1 -0
  16. package/dist/components/menuitem/index.js +1 -0
  17. package/dist/components/menuitem/menuitem.component.js +2 -1
  18. package/dist/components/option/option.component.d.ts +3 -14
  19. package/dist/components/option/option.component.js +3 -54
  20. package/dist/components/option/option.constants.d.ts +1 -2
  21. package/dist/components/option/option.constants.js +1 -2
  22. package/dist/components/option/option.styles.js +0 -5
  23. package/dist/components/tooltip/tooltip.component.d.ts +1 -1
  24. package/dist/components/tooltip/tooltip.component.js +7 -6
  25. package/dist/custom-elements.json +4011 -3352
  26. package/dist/react/index.d.ts +6 -6
  27. package/dist/react/index.js +6 -6
  28. package/dist/react/listitem/index.d.ts +6 -0
  29. package/dist/react/listitem/index.js +6 -0
  30. package/dist/react/option/index.d.ts +2 -0
  31. package/dist/react/option/index.js +2 -0
  32. package/dist/utils/mixins/ButtonComponentMixin.d.ts +6 -6
  33. package/dist/utils/mixins/ButtonComponentMixin.js +1 -0
  34. package/dist/utils/mixins/CardComponentMixin.d.ts +4 -4
  35. package/dist/utils/mixins/CardComponentMixin.js +27 -21
  36. package/dist/utils/mixins/FocusTrapMixin.d.ts +1 -1
  37. package/dist/utils/mixins/FocusTrapMixin.js +1 -0
  38. package/dist/utils/mixins/FormInternalsMixin.d.ts +3 -3
  39. package/dist/utils/mixins/FormInternalsMixin.js +10 -10
  40. package/dist/utils/roles.d.ts +17 -0
  41. package/dist/utils/roles.js +16 -0
  42. package/package.json +1 -1
@@ -7,12 +7,12 @@ export { default as Brandvisual } from './brandvisual';
7
7
  export { default as Bullet } from './bullet';
8
8
  export { default as Button } from './button';
9
9
  export { default as ButtonLink } from './buttonlink';
10
- export { default as Card } from './card';
11
10
  export { default as Buttonsimple } from './buttonsimple';
11
+ export { default as Card } from './card';
12
+ export { default as CardButton } from './cardbutton';
12
13
  export { default as CardCheckbox } from './cardcheckbox';
13
14
  export { default as CardRadio } from './cardradio';
14
15
  export { default as Checkbox } from './checkbox';
15
- export { default as CardButton } from './cardbutton';
16
16
  export { default as Chip } from './chip';
17
17
  export { default as Coachmark } from './coachmark';
18
18
  export { default as Divider } from './divider';
@@ -31,23 +31,23 @@ export { default as Marker } from './marker';
31
31
  export { default as MenuItem } from './menuitem';
32
32
  export { default as OptGroup } from './optgroup';
33
33
  export { default as Option } from './option';
34
- export { default as Presence } from './presence';
35
34
  export { default as Popover } from './popover';
35
+ export { default as Presence } from './presence';
36
36
  export { default as Progressbar } from './progressbar';
37
+ export { default as Progressspinner } from './progressspinner';
37
38
  export { default as Radio } from './radio';
38
39
  export { default as RadioGroup } from './radiogroup';
39
- export { default as Progressspinner } from './progressspinner';
40
40
  export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
41
41
  export { default as Searchfield } from './searchfield';
42
42
  export { default as Select } from './select';
43
43
  export { default as Spinner } from './spinner';
44
44
  export { default as StaticCheckbox } from './staticcheckbox';
45
45
  export { default as StaticRadio } from './staticradio';
46
+ export { default as StaticToggle } from './statictoggle';
46
47
  export { default as Tab } from './tab';
47
48
  export { default as TabList } from './tablist';
48
- export { default as StaticToggle } from './statictoggle';
49
- export { default as Textarea } from './textarea';
50
49
  export { default as Text } from './text';
50
+ export { default as Textarea } from './textarea';
51
51
  export { default as ThemeProvider } from './themeprovider';
52
52
  export { default as Toggle } from './toggle';
53
53
  export { default as ToggleTip } from './toggletip';
@@ -7,12 +7,12 @@ export { default as Brandvisual } from './brandvisual';
7
7
  export { default as Bullet } from './bullet';
8
8
  export { default as Button } from './button';
9
9
  export { default as ButtonLink } from './buttonlink';
10
- export { default as Card } from './card';
11
10
  export { default as Buttonsimple } from './buttonsimple';
11
+ export { default as Card } from './card';
12
+ export { default as CardButton } from './cardbutton';
12
13
  export { default as CardCheckbox } from './cardcheckbox';
13
14
  export { default as CardRadio } from './cardradio';
14
15
  export { default as Checkbox } from './checkbox';
15
- export { default as CardButton } from './cardbutton';
16
16
  export { default as Chip } from './chip';
17
17
  export { default as Coachmark } from './coachmark';
18
18
  export { default as Divider } from './divider';
@@ -31,23 +31,23 @@ export { default as Marker } from './marker';
31
31
  export { default as MenuItem } from './menuitem';
32
32
  export { default as OptGroup } from './optgroup';
33
33
  export { default as Option } from './option';
34
- export { default as Presence } from './presence';
35
34
  export { default as Popover } from './popover';
35
+ export { default as Presence } from './presence';
36
36
  export { default as Progressbar } from './progressbar';
37
+ export { default as Progressspinner } from './progressspinner';
37
38
  export { default as Radio } from './radio';
38
39
  export { default as RadioGroup } from './radiogroup';
39
- export { default as Progressspinner } from './progressspinner';
40
40
  export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
41
41
  export { default as Searchfield } from './searchfield';
42
42
  export { default as Select } from './select';
43
43
  export { default as Spinner } from './spinner';
44
44
  export { default as StaticCheckbox } from './staticcheckbox';
45
45
  export { default as StaticRadio } from './staticradio';
46
+ export { default as StaticToggle } from './statictoggle';
46
47
  export { default as Tab } from './tab';
47
48
  export { default as TabList } from './tablist';
48
- export { default as StaticToggle } from './statictoggle';
49
- export { default as Textarea } from './textarea';
50
49
  export { default as Text } from './text';
50
+ export { default as Textarea } from './textarea';
51
51
  export { default as ThemeProvider } from './themeprovider';
52
52
  export { default as Toggle } from './toggle';
53
53
  export { default as ToggleTip } from './toggletip';
@@ -11,6 +11,11 @@ import Component from '../../components/listitem';
11
11
  * Based on the leading/trailing slot, the position of the controls and text can be adjusted. <br/>
12
12
  * Please use mdc-list as a parent element even when there is only listitem for a11y purpose.
13
13
  *
14
+ * By providing the tooltip-text attribute, a tooltip will be displayed on hover of the listitem.
15
+ * The placement of the tooltip can be adjusted using the tooltip-placement attribute.
16
+ * This will be helpful when the listitem text is truncated or
17
+ * when you want to display additional information about the listitem.
18
+ *
14
19
  * @tagname mdc-listitem
15
20
  *
16
21
  * @dependency mdc-text
@@ -32,6 +37,7 @@ import Component from '../../components/listitem';
32
37
  * - Allows customization of the secondary and tertiary label text slot color.
33
38
  * @cssproperty --mdc-listitem-disabled-color - Allows customization of the disabled color.
34
39
  * @cssproperty --mdc-listitem-column-gap - Allows customization of column gap.
40
+ * @cssproperty --mdc-listitem-padding-left-and-right - Allows customization of padding left and right.
35
41
  *
36
42
  * @event click - (React: onClick) This event is dispatched when the listitem is clicked.
37
43
  * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the listitem.
@@ -13,6 +13,11 @@ import { TAG_NAME } from '../../components/listitem/listitem.constants';
13
13
  * Based on the leading/trailing slot, the position of the controls and text can be adjusted. <br/>
14
14
  * Please use mdc-list as a parent element even when there is only listitem for a11y purpose.
15
15
  *
16
+ * By providing the tooltip-text attribute, a tooltip will be displayed on hover of the listitem.
17
+ * The placement of the tooltip can be adjusted using the tooltip-placement attribute.
18
+ * This will be helpful when the listitem text is truncated or
19
+ * when you want to display additional information about the listitem.
20
+ *
16
21
  * @tagname mdc-listitem
17
22
  *
18
23
  * @dependency mdc-text
@@ -34,6 +39,7 @@ import { TAG_NAME } from '../../components/listitem/listitem.constants';
34
39
  * - Allows customization of the secondary and tertiary label text slot color.
35
40
  * @cssproperty --mdc-listitem-disabled-color - Allows customization of the disabled color.
36
41
  * @cssproperty --mdc-listitem-column-gap - Allows customization of column gap.
42
+ * @cssproperty --mdc-listitem-padding-left-and-right - Allows customization of padding left and right.
37
43
  *
38
44
  * @event click - (React: onClick) This event is dispatched when the listitem is clicked.
39
45
  * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the listitem.
@@ -3,6 +3,8 @@ import Component from '../../components/option';
3
3
  /**
4
4
  * option component, which is used as a list item in a select component.<br/>
5
5
  * We can pass an icon which will be displayed in leading position of the option label text.
6
+ * We can pass a tooltip which will be displayed on hover of the option label text.
7
+ * The tooltip will be helpful for a long label text which is truncated with ellipsis.
6
8
  *
7
9
  * @dependency mdc-icon
8
10
  * @dependency mdc-text
@@ -5,6 +5,8 @@ import { TAG_NAME } from '../../components/option/option.constants';
5
5
  /**
6
6
  * option component, which is used as a list item in a select component.<br/>
7
7
  * We can pass an icon which will be displayed in leading position of the option label text.
8
+ * We can pass a tooltip which will be displayed on hover of the option label text.
9
+ * The tooltip will be helpful for a long label text which is truncated with ellipsis.
8
10
  *
9
11
  * @dependency mdc-icon
10
12
  * @dependency mdc-text
@@ -2,15 +2,15 @@ import type { ButtonColor, ButtonTypeInternal, ButtonVariant, IconButtonSize, Pi
2
2
  import type { IconNames } from '../../components/icon/icon.types';
3
3
  import type { Component } from '../../models';
4
4
  import type { Constructor } from './index.types';
5
- export interface ButtonComponentMixinInterface {
5
+ export declare class ButtonComponentMixinInterface {
6
6
  prefixIcon?: IconNames;
7
7
  postfixIcon?: IconNames;
8
8
  variant: ButtonVariant;
9
9
  color: ButtonColor;
10
- typeInternal: ButtonTypeInternal;
11
- setSize(size: PillButtonSize | IconButtonSize): void;
12
- setVariant(variant: ButtonVariant): void;
13
- setColor(color: ButtonColor): void;
14
- inferButtonType(): void;
10
+ protected typeInternal: ButtonTypeInternal;
11
+ protected setSize(size: PillButtonSize | IconButtonSize): void;
12
+ protected setVariant(variant: ButtonVariant): void;
13
+ protected setColor(color: ButtonColor): void;
14
+ protected inferButtonType(): void;
15
15
  }
16
16
  export declare const ButtonComponentMixin: <T extends Constructor<Component>>(superClass: T) => Constructor<ButtonComponentMixinInterface> & T;
@@ -7,6 +7,7 @@ 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
+ /* eslint-disable max-classes-per-file */
10
11
  import { property, state } from 'lit/decorators.js';
11
12
  import { BUTTON_COLORS, BUTTON_TYPE_INTERNAL, BUTTON_VARIANTS, DEFAULTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from '../../components/button/button.constants';
12
13
  export const ButtonComponentMixin = (superClass) => {
@@ -3,7 +3,7 @@ import type { CardOrientation, CardVariant } from '../../components/card/card.ty
3
3
  import type { TagName as TagNameType } from '../../components/text/text.types';
4
4
  import type { IconNames } from '../../components/icon/icon.types';
5
5
  import type { Constructor } from './index.types';
6
- export interface CardComponentMixinInterface {
6
+ export declare class CardComponentMixinInterface {
7
7
  cardTitle: string;
8
8
  subtitle: string;
9
9
  imageSrc: string;
@@ -13,8 +13,8 @@ export interface CardComponentMixinInterface {
13
13
  titleTagName: TagNameType;
14
14
  subtitleTagName: TagNameType;
15
15
  iconName?: IconNames;
16
- renderIcon: () => TemplateResult;
17
- renderImage: () => TemplateResult;
18
- renderTitle: () => TemplateResult;
16
+ protected renderIcon: () => TemplateResult;
17
+ protected renderImage: () => TemplateResult;
18
+ protected renderTitle: () => TemplateResult;
19
19
  }
20
20
  export declare const CardComponentMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<CardComponentMixinInterface> & T;
@@ -7,6 +7,7 @@ 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
+ /* eslint-disable max-classes-per-file */
10
11
  import { html, nothing } from 'lit';
11
12
  import { property } from 'lit/decorators.js';
12
13
  import { DEFAULTS } from '../../components/card/card.constants';
@@ -15,9 +16,9 @@ export const CardComponentMixin = (superClass) => {
15
16
  constructor() {
16
17
  super(...arguments);
17
18
  /**
18
- * The title of the card - part of header section
19
- * @default ''
20
- */
19
+ * The title of the card - part of header section
20
+ * @default ''
21
+ */
21
22
  this.cardTitle = '';
22
23
  /**
23
24
  * The subtitle of the card - part of header section
@@ -56,37 +57,42 @@ export const CardComponentMixin = (superClass) => {
56
57
  this.subtitleTagName = DEFAULTS.TAGNAME;
57
58
  }
58
59
  /**
59
- * Renders the image on the card if image source is provided
60
- * @returns The image element
61
- */
60
+ * Renders the image on the card if image source is provided
61
+ * @returns The image element
62
+ */
62
63
  renderImage() {
63
64
  if (!this.imageSrc) {
64
65
  return nothing;
65
66
  }
66
- return html `<img part="image" src="${this.imageSrc}" alt="${this.imageAlt}"/>`;
67
+ return html `<img part="image" src="${this.imageSrc}" alt="${this.imageAlt}" />`;
67
68
  }
68
69
  /**
69
- * Renders the icon on the card if icon name is provided
70
- * @returns The icon element
71
- */
70
+ * Renders the icon on the card if icon name is provided
71
+ * @returns The icon element
72
+ */
72
73
  renderIcon() {
73
- return this.iconName ? html `<mdc-icon part="icon"
74
- size="${DEFAULTS.ICON_SIZE}"
75
- length-unit="${DEFAULTS.ICON_LENGTH_UNIT}"
76
- name="${this.iconName}"></mdc-icon>`
74
+ return this.iconName
75
+ ? html `<mdc-icon
76
+ part="icon"
77
+ size="${DEFAULTS.ICON_SIZE}"
78
+ length-unit="${DEFAULTS.ICON_LENGTH_UNIT}"
79
+ name="${this.iconName}"
80
+ ></mdc-icon>`
77
81
  : nothing;
78
82
  }
79
83
  /**
80
- * Renders the title and subtitle on the card
81
- * @returns The title and subtitle elements
82
- */
84
+ * Renders the title and subtitle on the card
85
+ * @returns The title and subtitle elements
86
+ */
83
87
  renderTitle() {
84
88
  return html `<div part="title-container">
85
89
  <mdc-text part="title" type="${DEFAULTS.TITLE_TYPE}" tagname="${this.titleTagName}">${this.cardTitle}</mdc-text>
86
- ${this.subtitle ? html `<mdc-text part="subtitle"
87
- type="${DEFAULTS.SUBTITLE_TYPE}"
88
- tagname="${this.subtitleTagName}">${this.subtitle}</mdc-text>` : nothing}
89
- </div>`;
90
+ ${this.subtitle
91
+ ? html `<mdc-text part="subtitle" type="${DEFAULTS.SUBTITLE_TYPE}" tagname="${this.subtitleTagName}"
92
+ >${this.subtitle}</mdc-text
93
+ >`
94
+ : nothing}
95
+ </div>`;
90
96
  }
91
97
  }
92
98
  __decorate([
@@ -1,5 +1,5 @@
1
1
  import type { Constructor } from './index.types';
2
- export interface FocusTrapClassInterface {
2
+ export declare class FocusTrapClassInterface {
3
3
  enabledFocusTrap: boolean;
4
4
  enabledPreventScroll: boolean;
5
5
  setFocusableElements(): void;
@@ -7,6 +7,7 @@ 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
+ /* eslint-disable max-classes-per-file */
10
11
  import { property } from 'lit/decorators.js';
11
12
  import { DEFAULTS as POPOVER_DEFAULTS } from '../../components/popover/popover.constants';
12
13
  export const FocusTrapMixin = (superClass) => {
@@ -22,15 +22,15 @@ export interface AssociatedFormControl {
22
22
  formResetCallback(): void;
23
23
  formStateRestoreCallback(state: string | FormData | File, mode: 'restore' | 'autocomplete'): void;
24
24
  }
25
- export interface FormInternalsMixinInterface {
25
+ export declare class FormInternalsMixinInterface {
26
26
  name: string;
27
27
  value: string;
28
28
  form: HTMLFormElement | null;
29
29
  validity: ValidityState;
30
30
  validationMessage: string;
31
31
  willValidate: boolean;
32
- internals: ElementInternals;
33
- inputElement: HTMLInputElement | HTMLTextAreaElement;
32
+ protected internals: ElementInternals;
33
+ protected inputElement: HTMLInputElement | HTMLTextAreaElement;
34
34
  setValidity(): void;
35
35
  checkValidity(): boolean;
36
36
  reportValidity(): boolean;
@@ -14,15 +14,15 @@ export const FormInternalsMixin = (superClass) => {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  /**
17
- * Indicates the name of the component group.
18
- * They are used to group elements in a form together.
19
- * @default ''
20
- */
17
+ * Indicates the name of the component group.
18
+ * They are used to group elements in a form together.
19
+ * @default ''
20
+ */
21
21
  this.name = '';
22
22
  /**
23
- * Indicates the value of the component group (ex: input, checkbox, radio, select etc...)
24
- * @default ''
25
- */
23
+ * Indicates the value of the component group (ex: input, checkbox, radio, select etc...)
24
+ * @default ''
25
+ */
26
26
  this.value = '';
27
27
  /** @internal */
28
28
  this.internals = this.attachInternals();
@@ -43,9 +43,9 @@ export const FormInternalsMixin = (superClass) => {
43
43
  this.id = `mdc-input-${uuidv4()}`;
44
44
  }
45
45
  /**
46
- * Sets the validity of the input field based on the input field's validity.
47
- * @returns void
48
- */
46
+ * Sets the validity of the input field based on the input field's validity.
47
+ * @returns void
48
+ */
49
49
  setValidity() {
50
50
  if (this.inputElement) {
51
51
  this.internals.setValidity(this.inputElement.validity, this.inputElement.validationMessage, this.inputElement);
@@ -0,0 +1,17 @@
1
+ import type { ValueOf } from './types';
2
+ declare const ROLE: {
3
+ readonly BUTTON: "button";
4
+ readonly CHECKBOX: "checkbox";
5
+ readonly GROUP: "group";
6
+ readonly LIST: "list";
7
+ readonly LISTITEM: "listitem";
8
+ readonly MENU: "menu";
9
+ readonly MENUBAR: "menubar";
10
+ readonly MENUITEM: "menuitem";
11
+ readonly MENUITEMCHECKBOX: "menuitemcheckbox";
12
+ readonly MENUITEMRADIO: "menuitemradio";
13
+ readonly RADIOGROUP: "radiogroup";
14
+ readonly TOOLTIP: "tooltip";
15
+ };
16
+ type RoleType = ValueOf<typeof ROLE>;
17
+ export { ROLE, RoleType };
@@ -0,0 +1,16 @@
1
+ // When adding a new role in this list, please sort this list.
2
+ const ROLE = {
3
+ BUTTON: 'button',
4
+ CHECKBOX: 'checkbox',
5
+ GROUP: 'group',
6
+ LIST: 'list',
7
+ LISTITEM: 'listitem',
8
+ MENU: 'menu',
9
+ MENUBAR: 'menubar',
10
+ MENUITEM: 'menuitem',
11
+ MENUITEMCHECKBOX: 'menuitemcheckbox',
12
+ MENUITEMRADIO: 'menuitemradio',
13
+ RADIOGROUP: 'radiogroup',
14
+ TOOLTIP: 'tooltip',
15
+ };
16
+ export { ROLE };
package/package.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "lit": "^3.2.0",
40
40
  "uuid": "^11.0.5"
41
41
  },
42
- "version": "0.66.1"
42
+ "version": "0.66.3"
43
43
  }