@momentum-design/components 0.66.3 → 0.67.0

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 (53) hide show
  1. package/dist/browser/index.js +456 -238
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/card/card.component.d.ts +4 -35
  4. package/dist/components/card/card.component.js +9 -79
  5. package/dist/components/dialog/dialog.component.d.ts +150 -0
  6. package/dist/components/dialog/dialog.component.js +340 -0
  7. package/dist/components/dialog/dialog.constants.d.ts +18 -0
  8. package/dist/components/dialog/dialog.constants.js +19 -0
  9. package/dist/components/dialog/dialog.events.d.ts +34 -0
  10. package/dist/components/dialog/dialog.events.js +47 -0
  11. package/dist/components/dialog/dialog.styles.d.ts +2 -0
  12. package/dist/components/dialog/dialog.styles.js +108 -0
  13. package/dist/components/dialog/dialog.types.d.ts +12 -0
  14. package/dist/components/dialog/dialog.types.js +1 -0
  15. package/dist/components/dialog/dialog.utils.d.ts +7 -0
  16. package/dist/components/dialog/dialog.utils.js +33 -0
  17. package/dist/components/dialog/index.d.ts +9 -0
  18. package/dist/components/dialog/index.js +6 -0
  19. package/dist/components/menuitemcheckbox/index.d.ts +12 -0
  20. package/dist/components/menuitemcheckbox/index.js +9 -0
  21. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +54 -0
  22. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +137 -0
  23. package/dist/components/menuitemcheckbox/menuitemcheckbox.constants.d.ts +15 -0
  24. package/dist/components/menuitemcheckbox/menuitemcheckbox.constants.js +16 -0
  25. package/dist/components/menuitemcheckbox/menuitemcheckbox.styles.d.ts +2 -0
  26. package/dist/components/menuitemcheckbox/menuitemcheckbox.styles.js +13 -0
  27. package/dist/components/menuitemcheckbox/menuitemcheckbox.types.d.ts +10 -0
  28. package/dist/components/menuitemcheckbox/menuitemcheckbox.types.js +1 -0
  29. package/dist/components/menuitemradio/index.d.ts +10 -0
  30. package/dist/components/menuitemradio/index.js +7 -0
  31. package/dist/components/menuitemradio/menuitemradio.component.d.ts +34 -0
  32. package/dist/components/menuitemradio/menuitemradio.component.js +70 -0
  33. package/dist/components/menuitemradio/menuitemradio.constants.d.ts +6 -0
  34. package/dist/components/menuitemradio/menuitemradio.constants.js +7 -0
  35. package/dist/components/menuitemradio/menuitemradio.types.d.ts +9 -0
  36. package/dist/components/menuitemradio/menuitemradio.types.js +1 -0
  37. package/dist/components/popover/popover.styles.js +5 -0
  38. package/dist/components/toggletip/toggletip.styles.js +8 -0
  39. package/dist/custom-elements.json +5152 -2804
  40. package/dist/index.d.ts +6 -3
  41. package/dist/index.js +6 -3
  42. package/dist/react/dialog/index.d.ts +51 -0
  43. package/dist/react/dialog/index.js +59 -0
  44. package/dist/react/index.d.ts +3 -0
  45. package/dist/react/index.js +3 -0
  46. package/dist/react/menuitemcheckbox/index.d.ts +42 -0
  47. package/dist/react/menuitemcheckbox/index.js +50 -0
  48. package/dist/react/menuitemradio/index.d.ts +30 -0
  49. package/dist/react/menuitemradio/index.js +38 -0
  50. package/dist/utils/mixins/CardAndDialogFooterMixin.d.ts +11 -0
  51. package/dist/utils/mixins/CardAndDialogFooterMixin.js +102 -0
  52. package/dist/utils/mixins/FocusTrapMixin.js +4 -5
  53. package/package.json +1 -1
@@ -0,0 +1,70 @@
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 } from 'lit';
11
+ import { property } from 'lit/decorators.js';
12
+ import { ROLE } from '../../utils/roles';
13
+ import MenuItem from '../menuitem/menuitem.component';
14
+ import { TYPE } from '../text/text.constants';
15
+ import { ARIA_CHECKED_STATES } from './menuitemradio.constants';
16
+ /**
17
+ * A menuitemradio component is a checkable menuitem that is used in a menu.
18
+ * A menuitemradio should be checked only one at a time. <br/>
19
+ * There should be no focusable descendants inside this menuitemradio component.
20
+ *
21
+ * The `aria-checked` menuitemradio attribute is used to indicate that the menuitemradio is checked or not.
22
+ *
23
+ * If you want more than one item in a group to be checked, consider using menuitemcheckbox component.
24
+ *
25
+ * If a menuitemradio is disabled, then the `aria-disabled` attribute is set to `true`.
26
+ *
27
+ * @dependency mdc-staticradio
28
+ * @dependency mdc-text
29
+ *
30
+ * @tagname mdc-menuitemradio
31
+ *
32
+ * @event change - (React: onChange) This event is dispatched when the menuitemradio changes.
33
+ * @event click - (React: onClick) This event is dispatched when the menuitemradio is clicked.
34
+ * @event focus - (React: onFocus) This event is dispatched when the menuitemradio receives focus.
35
+ */
36
+ class MenuItemRadio extends MenuItem {
37
+ constructor() {
38
+ super(...arguments);
39
+ /**
40
+ * The aria-checked attribute is used to indicate that the menuitemradio is checked or not.
41
+ * @default 'false'
42
+ */
43
+ this.ariaChecked = ARIA_CHECKED_STATES.FALSE;
44
+ }
45
+ connectedCallback() {
46
+ super.connectedCallback();
47
+ this.role = ROLE.MENUITEMRADIO;
48
+ }
49
+ render() {
50
+ return html `
51
+ <div part="leading-controls">
52
+ <mdc-staticradio
53
+ slot="leading-controls"
54
+ ?checked="${this.ariaChecked === ARIA_CHECKED_STATES.TRUE}"
55
+ ?disabled="${this.disabled}"
56
+ ></mdc-staticradio>
57
+ </div>
58
+ <div part="leading-text">
59
+ ${this.getText('leading-text-primary-label', TYPE.BODY_MIDSIZE_REGULAR, this.label)}
60
+ ${this.getText('leading-text-secondary-label', TYPE.BODY_MIDSIZE_REGULAR, this.secondaryLabel)}
61
+ </div>
62
+ `;
63
+ }
64
+ }
65
+ MenuItemRadio.styles = [...MenuItem.styles];
66
+ __decorate([
67
+ property({ type: String, reflect: true, attribute: 'aria-checked' }),
68
+ __metadata("design:type", String)
69
+ ], MenuItemRadio.prototype, "ariaChecked", void 0);
70
+ export default MenuItemRadio;
@@ -0,0 +1,6 @@
1
+ declare const TAG_NAME: "mdc-menuitemradio";
2
+ declare const ARIA_CHECKED_STATES: {
3
+ readonly TRUE: "true";
4
+ readonly FALSE: "false";
5
+ };
6
+ export { TAG_NAME, ARIA_CHECKED_STATES };
@@ -0,0 +1,7 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('menuitemradio');
3
+ const ARIA_CHECKED_STATES = {
4
+ TRUE: 'true',
5
+ FALSE: 'false',
6
+ };
7
+ export { TAG_NAME, ARIA_CHECKED_STATES };
@@ -0,0 +1,9 @@
1
+ import { ValueOf } from '../../utils/types';
2
+ import { ARIA_CHECKED_STATES } from './menuitemradio.constants';
3
+ type AriaChecked = ValueOf<typeof ARIA_CHECKED_STATES>;
4
+ interface Events {
5
+ onChangeEvent: Event;
6
+ onClickEvent: MouseEvent;
7
+ onFocusEvent: FocusEvent;
8
+ }
9
+ export type { Events, AriaChecked };
@@ -81,6 +81,11 @@ const styles = css `
81
81
  z-index: 9999;
82
82
  }
83
83
 
84
+ :host(:dir(rtl)) .popover-close {
85
+ right: auto;
86
+ left: 0.75rem;
87
+ }
88
+
84
89
  .popover-arrow[data-side='top'] {
85
90
  border-top: none;
86
91
  border-left: none;
@@ -21,5 +21,13 @@ const styles = css `
21
21
  :host([color='contrast'])::part(popover-content) {
22
22
  color: var(--mdc-toggletip-text-color-contrast);
23
23
  }
24
+
25
+ :host(:dir(ltr))::part(popover-content) {
26
+ margin-right: 2rem;
27
+ }
28
+
29
+ :host(:dir(rtl))::part(popover-content) {
30
+ margin-left: 2rem;
31
+ }
24
32
  `;
25
33
  export default [styles];