@momentum-design/components 0.36.1 → 0.36.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 (79) hide show
  1. package/dist/browser/index.js +836 -447
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/alertchip/alertchip.component.d.ts +46 -0
  4. package/dist/components/alertchip/alertchip.component.js +79 -0
  5. package/dist/components/alertchip/alertchip.constants.d.ts +16 -0
  6. package/dist/components/alertchip/alertchip.constants.js +19 -0
  7. package/dist/components/alertchip/alertchip.styles.d.ts +2 -0
  8. package/dist/components/alertchip/alertchip.styles.js +106 -0
  9. package/dist/components/alertchip/alertchip.types.d.ts +6 -0
  10. package/dist/components/alertchip/alertchip.types.js +1 -0
  11. package/dist/components/alertchip/alertchip.utils.d.ts +3 -0
  12. package/dist/components/alertchip/alertchip.utils.js +12 -0
  13. package/dist/components/alertchip/index.d.ts +9 -0
  14. package/dist/components/alertchip/index.js +6 -0
  15. package/dist/components/chip/chip.component.d.ts +57 -0
  16. package/dist/components/chip/chip.component.js +97 -0
  17. package/dist/components/chip/chip.constants.d.ts +20 -0
  18. package/dist/components/chip/chip.constants.js +23 -0
  19. package/dist/components/chip/chip.styles.d.ts +2 -0
  20. package/dist/components/chip/chip.styles.js +140 -0
  21. package/dist/components/chip/chip.types.d.ts +4 -0
  22. package/dist/components/chip/chip.types.js +1 -0
  23. package/dist/components/chip/index.d.ts +9 -0
  24. package/dist/components/chip/index.js +6 -0
  25. package/dist/components/filterchip/filterchip.component.d.ts +30 -0
  26. package/dist/components/filterchip/filterchip.component.js +64 -0
  27. package/dist/components/filterchip/filterchip.constants.d.ts +6 -0
  28. package/dist/components/filterchip/filterchip.constants.js +7 -0
  29. package/dist/components/filterchip/filterchip.styles.d.ts +2 -0
  30. package/dist/components/filterchip/filterchip.styles.js +23 -0
  31. package/dist/components/filterchip/index.d.ts +7 -0
  32. package/dist/components/filterchip/index.js +4 -0
  33. package/dist/components/input/input.constants.d.ts +0 -1
  34. package/dist/components/input/input.constants.js +0 -1
  35. package/dist/components/inputchip/index.d.ts +10 -0
  36. package/dist/components/inputchip/index.js +7 -0
  37. package/dist/components/inputchip/inputchip.component.d.ts +58 -0
  38. package/dist/components/inputchip/inputchip.component.js +113 -0
  39. package/dist/components/inputchip/inputchip.constants.d.ts +7 -0
  40. package/dist/components/inputchip/inputchip.constants.js +9 -0
  41. package/dist/components/inputchip/inputchip.styles.d.ts +2 -0
  42. package/dist/components/inputchip/inputchip.styles.js +53 -0
  43. package/dist/components/listitem/listitem.component.d.ts +3 -2
  44. package/dist/components/listitem/listitem.component.js +1 -1
  45. package/dist/components/listitem/listitem.styles.js +3 -0
  46. package/dist/components/optgroup/index.d.ts +8 -0
  47. package/dist/components/optgroup/index.js +5 -0
  48. package/dist/components/optgroup/optgroup.component.d.ts +28 -0
  49. package/dist/components/optgroup/optgroup.component.js +77 -0
  50. package/dist/components/optgroup/optgroup.constants.d.ts +3 -0
  51. package/dist/components/optgroup/optgroup.constants.js +4 -0
  52. package/dist/components/optgroup/optgroup.styles.d.ts +2 -0
  53. package/dist/components/optgroup/optgroup.styles.js +16 -0
  54. package/dist/components/option/index.d.ts +8 -0
  55. package/dist/components/option/index.js +5 -0
  56. package/dist/components/option/option.component.d.ts +46 -0
  57. package/dist/components/option/option.component.js +115 -0
  58. package/dist/components/option/option.constants.d.ts +4 -0
  59. package/dist/components/option/option.constants.js +4 -0
  60. package/dist/components/option/option.styles.d.ts +2 -0
  61. package/dist/components/option/option.styles.js +10 -0
  62. package/dist/custom-elements.json +5641 -3003
  63. package/dist/index.d.ts +7 -1
  64. package/dist/index.js +7 -1
  65. package/dist/react/alertchip/index.d.ts +27 -0
  66. package/dist/react/alertchip/index.js +36 -0
  67. package/dist/react/chip/index.d.ts +28 -0
  68. package/dist/react/chip/index.js +37 -0
  69. package/dist/react/filterchip/index.d.ts +17 -0
  70. package/dist/react/filterchip/index.js +26 -0
  71. package/dist/react/index.d.ts +7 -1
  72. package/dist/react/index.js +7 -1
  73. package/dist/react/inputchip/index.d.ts +32 -0
  74. package/dist/react/inputchip/index.js +41 -0
  75. package/dist/react/optgroup/index.d.ts +14 -0
  76. package/dist/react/optgroup/index.js +23 -0
  77. package/dist/react/option/index.d.ts +21 -0
  78. package/dist/react/option/index.js +30 -0
  79. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import '../icon';
2
+ import Option from './option.component';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ ['mdc-option']: Option;
6
+ }
7
+ }
8
+ export default Option;
@@ -0,0 +1,5 @@
1
+ import '../icon';
2
+ import Option from './option.component';
3
+ import { TAG_NAME } from './option.constants';
4
+ Option.register(TAG_NAME);
5
+ export default Option;
@@ -0,0 +1,46 @@
1
+ import { CSSResult, PropertyValues } from 'lit';
2
+ import type { IconNames } from '../icon/icon.types';
3
+ import ListItem from '../listitem/listitem.component';
4
+ declare const Option_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & typeof ListItem;
5
+ /**
6
+ * option component, which is used as a list item in a select component.<br/>
7
+ * We can pass an icon which will be displayed in leading position of the option label text.
8
+ *
9
+ * @tagname mdc-option
10
+ *
11
+ * @slot default - This is a default/unnamed slot
12
+ *
13
+ * @event click - (React: onClick) This event is dispatched when the option is clicked.
14
+ * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the option.
15
+ * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the option.
16
+ * @event focus - (React: onFocus) This event is dispatched when the option receives focus.
17
+ */
18
+ declare class Option extends Option_base {
19
+ /**
20
+ * The selected attribute is used to indicate that the option is selected.
21
+ */
22
+ selected: boolean;
23
+ /**
24
+ * The prefix icon attribute is used to display the icon name on the left of the option label.
25
+ */
26
+ prefixIcon?: IconNames;
27
+ /**
28
+ * Any additional description can be provided here for screen readers.
29
+ */
30
+ ariaLabel: string | null;
31
+ constructor();
32
+ /**
33
+ * Listens to changes in the default slot and updates the label of the option accordingly.
34
+ * This is used to set the label of the option when it is not explicitly set.
35
+ * It is called internally when the slot is changed.
36
+ */
37
+ private handleDefaultSlotChange;
38
+ /**
39
+ * Updates the attribute of the option to reflect the current state.
40
+ */
41
+ private updateAttribute;
42
+ update(changedProperties: PropertyValues): void;
43
+ render(): import("lit-html").TemplateResult<1>;
44
+ static styles: Array<CSSResult>;
45
+ }
46
+ export default Option;
@@ -0,0 +1,115 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { html, nothing } from 'lit';
11
+ import { property } from 'lit/decorators.js';
12
+ import { ifDefined } from 'lit/directives/if-defined.js';
13
+ import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
14
+ import ListItem from '../listitem/listitem.component';
15
+ import { LISTITEM_VARIANTS } from '../listitem/listitem.constants';
16
+ import { TYPE } from '../text/text.constants';
17
+ import { SELECTED_ICON_NAME } from './option.constants';
18
+ import styles from './option.styles';
19
+ /**
20
+ * option component, which is used as a list item in a select component.<br/>
21
+ * We can pass an icon which will be displayed in leading position of the option label text.
22
+ *
23
+ * @tagname mdc-option
24
+ *
25
+ * @slot default - This is a default/unnamed slot
26
+ *
27
+ * @event click - (React: onClick) This event is dispatched when the option is clicked.
28
+ * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the option.
29
+ * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the option.
30
+ * @event focus - (React: onFocus) This event is dispatched when the option receives focus.
31
+ */
32
+ class Option extends FormInternalsMixin(ListItem) {
33
+ constructor() {
34
+ super();
35
+ /**
36
+ * The selected attribute is used to indicate that the option is selected.
37
+ */
38
+ this.selected = false;
39
+ /**
40
+ * Any additional description can be provided here for screen readers.
41
+ */
42
+ this.ariaLabel = null;
43
+ this.role = 'option';
44
+ this.variant = LISTITEM_VARIANTS.INSET_RECTANGLE;
45
+ this.updateAttribute('aria-selected', `${this.selected}`);
46
+ this.updateAttribute('aria-disabled', `${this.disabled}`);
47
+ // Option will not contain below fields
48
+ this.name = undefined;
49
+ this.secondaryLabel = undefined;
50
+ this.sideHeaderText = undefined;
51
+ this.sublineText = undefined;
52
+ this.dataAriaLabel = undefined;
53
+ }
54
+ /**
55
+ * Listens to changes in the default slot and updates the label of the option accordingly.
56
+ * This is used to set the label of the option when it is not explicitly set.
57
+ * It is called internally when the slot is changed.
58
+ */
59
+ handleDefaultSlotChange() {
60
+ var _a, _b, _c;
61
+ const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
62
+ if (slot && !this.label) {
63
+ this.label = (_c = (_b = slot.assignedNodes()[0]) === null || _b === void 0 ? void 0 : _b.textContent) === null || _c === void 0 ? void 0 : _c.trim();
64
+ }
65
+ }
66
+ /**
67
+ * Updates the attribute of the option to reflect the current state.
68
+ */
69
+ updateAttribute(attributeName, value) {
70
+ this.setAttribute(attributeName, value);
71
+ }
72
+ update(changedProperties) {
73
+ super.update(changedProperties);
74
+ if (changedProperties.has('disabled')) {
75
+ this.updateAttribute('aria-disabled', `${this.disabled}`);
76
+ }
77
+ if (changedProperties.has('selected')) {
78
+ this.updateAttribute('aria-selected', `${this.selected}`);
79
+ }
80
+ }
81
+ render() {
82
+ const selectedIcon = this.selected ? html `
83
+ <mdc-icon slot="trailing-controls" name="${SELECTED_ICON_NAME}"></mdc-icon>
84
+ ` : nothing;
85
+ const prefixIcon = this.prefixIcon ? html `
86
+ <mdc-icon slot="leading-controls" name="${ifDefined(this.prefixIcon)}"></mdc-icon>
87
+ ` : nothing;
88
+ return html `
89
+ <div part="leading">
90
+ ${prefixIcon}
91
+ <div part="leading-text">
92
+ ${this.getText('leading-text-primary-label', TYPE.BODY_MIDSIZE_REGULAR, this.label)}
93
+ </div>
94
+ </div>
95
+ <div part="trailing">
96
+ ${selectedIcon}
97
+ </div>
98
+ <slot part="default-slot" @slotchange="${this.handleDefaultSlotChange}"></slot>
99
+ `;
100
+ }
101
+ }
102
+ Option.styles = [...ListItem.styles, ...styles];
103
+ __decorate([
104
+ property({ type: Boolean, reflect: true }),
105
+ __metadata("design:type", Object)
106
+ ], Option.prototype, "selected", void 0);
107
+ __decorate([
108
+ property({ type: String, reflect: true, attribute: 'prefix-icon' }),
109
+ __metadata("design:type", String)
110
+ ], Option.prototype, "prefixIcon", void 0);
111
+ __decorate([
112
+ property({ type: String, reflect: true, attribute: 'aria-label' }),
113
+ __metadata("design:type", Object)
114
+ ], Option.prototype, "ariaLabel", void 0);
115
+ export default Option;
@@ -0,0 +1,4 @@
1
+ import type { IconNames } from '../icon/icon.types';
2
+ declare const SELECTED_ICON_NAME: Extract<IconNames, 'check-bold'>;
3
+ declare const TAG_NAME: "mdc-option";
4
+ export { SELECTED_ICON_NAME, TAG_NAME };
@@ -0,0 +1,4 @@
1
+ import utils from '../../utils/tag-name';
2
+ const SELECTED_ICON_NAME = 'check-bold';
3
+ const TAG_NAME = utils.constructTagName('option');
4
+ export { SELECTED_ICON_NAME, TAG_NAME };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { css } from 'lit';
2
+ const styles = css `
3
+ :host::part(list-item) {
4
+ height: 2.25rem;
5
+ }
6
+ :host::part(default-slot) {
7
+ display: none;
8
+ }
9
+ `;
10
+ export default [styles];