@momentum-design/components 0.99.0 → 0.100.1

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 (49) hide show
  1. package/dist/browser/index.js +321 -319
  2. package/dist/browser/index.js.map +3 -3
  3. package/dist/components/animation/animation.component.d.ts +1 -0
  4. package/dist/components/animation/animation.component.js +9 -0
  5. package/dist/components/cardcheckbox/cardcheckbox.component.js +3 -3
  6. package/dist/components/cardradio/cardradio.component.js +3 -3
  7. package/dist/components/dialog/dialog.component.js +5 -0
  8. package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +1 -0
  9. package/dist/components/icon/icon.component.d.ts +2 -1
  10. package/dist/components/icon/icon.component.js +9 -1
  11. package/dist/components/linksimple/linksimple.component.js +11 -11
  12. package/dist/components/listitem/listitem.component.js +6 -6
  13. package/dist/components/listitem/listitem.events.js +3 -1
  14. package/dist/components/menubar/menubar.component.d.ts +9 -0
  15. package/dist/components/menubar/menubar.component.js +38 -4
  16. package/dist/components/menuitem/menuitem.component.js +1 -1
  17. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +12 -12
  18. package/dist/components/menuitemradio/menuitemradio.component.js +13 -13
  19. package/dist/components/menupopover/menupopover.component.d.ts +30 -12
  20. package/dist/components/menupopover/menupopover.component.js +231 -179
  21. package/dist/components/menupopover/menupopover.utils.d.ts +2 -2
  22. package/dist/components/menupopover/menupopover.utils.js +2 -2
  23. package/dist/components/navmenuitem/navmenuitem.component.js +1 -1
  24. package/dist/components/popover/popover.component.d.ts +29 -9
  25. package/dist/components/popover/popover.component.js +277 -212
  26. package/dist/components/popover/popover.constants.d.ts +1 -0
  27. package/dist/components/popover/popover.constants.js +1 -0
  28. package/dist/components/popover/popover.types.d.ts +19 -6
  29. package/dist/components/popover/popover.utils.d.ts +7 -2
  30. package/dist/components/popover/popover.utils.js +19 -8
  31. package/dist/components/select/select.component.js +2 -0
  32. package/dist/components/select/select.styles.js +1 -1
  33. package/dist/components/select/select.types.d.ts +5 -1
  34. package/dist/components/sidenavigation/sidenavigation.component.js +1 -1
  35. package/dist/components/spinner/spinner.component.d.ts +1 -1
  36. package/dist/components/spinner/spinner.component.js +1 -1
  37. package/dist/components/tablist/tablist.component.d.ts +1 -0
  38. package/dist/components/tablist/tablist.component.js +284 -273
  39. package/dist/components/textarea/textarea.component.d.ts +2 -2
  40. package/dist/components/textarea/textarea.component.js +2 -2
  41. package/dist/components/tooltip/tooltip.component.d.ts +1 -1
  42. package/dist/components/tooltip/tooltip.component.js +14 -15
  43. package/dist/custom-elements.json +496 -154
  44. package/dist/react/coachmark/index.d.ts +12 -4
  45. package/dist/react/menupopover/index.d.ts +12 -4
  46. package/dist/react/popover/index.d.ts +12 -4
  47. package/dist/react/toggletip/index.d.ts +12 -4
  48. package/dist/react/tooltip/index.d.ts +12 -4
  49. package/package.json +2 -2
@@ -50,5 +50,6 @@ declare const DEFAULTS: {
50
50
  readonly DISABLE_ARIA_EXPANDED: false;
51
51
  readonly DISABLE_ARIA_HAS_POPUP: false;
52
52
  readonly PROPAGATE_EVENT_ON_ESCAPE: false;
53
+ readonly KEEP_CONNECTED_TOOLTIP_CLOSED: true;
53
54
  };
54
55
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
@@ -51,5 +51,6 @@ const DEFAULTS = {
51
51
  DISABLE_ARIA_EXPANDED: false,
52
52
  DISABLE_ARIA_HAS_POPUP: false,
53
53
  PROPAGATE_EVENT_ON_ESCAPE: false,
54
+ KEEP_CONNECTED_TOOLTIP_CLOSED: true,
54
55
  };
55
56
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
@@ -1,12 +1,25 @@
1
- import type { ValueOf } from '../../utils/types';
1
+ import type { ValueOf, TypedEvent } from '../../utils/types';
2
+ import type Popover from './popover.component';
2
3
  import { POPOVER_PLACEMENT, TRIGGER, COLOR } from './popover.constants';
3
4
  type PopoverPlacement = ValueOf<typeof POPOVER_PLACEMENT>;
4
5
  type PopoverColor = ValueOf<typeof COLOR>;
5
6
  type PopoverTrigger = ValueOf<typeof TRIGGER> | `${ValueOf<typeof TRIGGER>} ${ValueOf<typeof TRIGGER>}`;
7
+ type PopoverShownEvent = TypedEvent<Popover, {
8
+ show: boolean;
9
+ }>;
10
+ type PopoverHiddenEvent = TypedEvent<Popover, {
11
+ show: boolean;
12
+ }>;
13
+ type PopoverCreatedEvent = TypedEvent<Popover, {
14
+ show: boolean;
15
+ }>;
16
+ type PopoverDestroyedEvent = TypedEvent<Popover, {
17
+ show: boolean;
18
+ }>;
6
19
  interface Events {
7
- onShownEvent: Event;
8
- onHiddenEvent: Event;
9
- onCreatedEvent: Event;
10
- onDestroyedEvent: Event;
20
+ onShownEvent: PopoverShownEvent;
21
+ onHiddenEvent: PopoverHiddenEvent;
22
+ onCreatedEvent: PopoverCreatedEvent;
23
+ onDestroyedEvent: PopoverDestroyedEvent;
11
24
  }
12
- export type { PopoverPlacement, PopoverColor, PopoverTrigger, Events };
25
+ export type { PopoverPlacement, PopoverColor, PopoverTrigger, Events, PopoverShownEvent, PopoverHiddenEvent };
@@ -25,9 +25,13 @@ export declare class PopoverUtils {
25
25
  */
26
26
  setupAppendTo(): void;
27
27
  /**
28
- * Sets up the accessibility attributes for the popover.
28
+ * Sets up the aria labels
29
29
  */
30
- setupAccessibility(): void;
30
+ updateAriaLabels(): void;
31
+ /**
32
+ * Updates the aria-modal attribute based on the popover's role.
33
+ */
34
+ updateAriaModal(): void;
31
35
  /**
32
36
  * Updates the aria-haspopup attribute on the trigger element.
33
37
  */
@@ -54,4 +58,5 @@ export declare class PopoverUtils {
54
58
  */
55
59
  updatePopoverStyle(x: number, y: number): void;
56
60
  createBackdrop(): void;
61
+ removeBackdrop(): void;
57
62
  }
@@ -86,16 +86,10 @@ export class PopoverUtils {
86
86
  }
87
87
  }
88
88
  /**
89
- * Sets up the accessibility attributes for the popover.
89
+ * Sets up the aria labels
90
90
  */
91
- setupAccessibility() {
91
+ updateAriaLabels() {
92
92
  var _a, _b, _c;
93
- if (this.popover.role === ROLE.DIALOG || this.popover.role === ROLE.ALERTDIALOG) {
94
- this.popover.setAttribute('aria-modal', 'true');
95
- }
96
- else {
97
- this.popover.removeAttribute('aria-modal');
98
- }
99
93
  if (this.popover.interactive && this.popover.role) {
100
94
  if (!this.popover.ariaLabel) {
101
95
  this.popover.ariaLabel =
@@ -106,6 +100,17 @@ export class PopoverUtils {
106
100
  }
107
101
  }
108
102
  }
103
+ /**
104
+ * Updates the aria-modal attribute based on the popover's role.
105
+ */
106
+ updateAriaModal() {
107
+ if (this.popover.role === ROLE.DIALOG || this.popover.role === ROLE.ALERTDIALOG) {
108
+ this.popover.setAttribute('aria-modal', 'true');
109
+ }
110
+ else {
111
+ this.popover.removeAttribute('aria-modal');
112
+ }
113
+ }
109
114
  /**
110
115
  * Updates the aria-haspopup attribute on the trigger element.
111
116
  */
@@ -201,4 +206,10 @@ export class PopoverUtils {
201
206
  this.popover.backdropElement = backdrop;
202
207
  }
203
208
  }
209
+ removeBackdrop() {
210
+ if (this.popover.backdropElement) {
211
+ this.popover.backdropElement.remove();
212
+ this.popover.backdropElement = null;
213
+ }
214
+ }
204
215
  }
@@ -307,6 +307,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
307
307
  this.displayPopover = true;
308
308
  // Prevent the default browser behavior of scrolling down
309
309
  event.preventDefault();
310
+ event.stopPropagation();
310
311
  break;
311
312
  case KEYS.ENTER:
312
313
  case KEYS.SPACE:
@@ -503,6 +504,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
503
504
  interactive
504
505
  ?visible="${this.displayPopover}"
505
506
  role=""
507
+ backdrop
506
508
  hide-on-outside-click
507
509
  hide-on-escape
508
510
  focus-back-to-trigger
@@ -78,7 +78,7 @@ const styles = css `
78
78
  display: flex;
79
79
  padding: 2px;
80
80
  }
81
- :host::part(popover-content) {
81
+ :host mdc-popover::part(popover-content) {
82
82
  min-width: auto;
83
83
  max-height: var(--mdc-popover-max-height);
84
84
  padding: 0.75rem 0.5rem;
@@ -1,12 +1,14 @@
1
1
  import type { ValueOf, TypedEvent } from '../../utils/types';
2
- import type { PopoverPlacement } from '../popover/popover.types';
2
+ import type { PopoverPlacement, PopoverShownEvent, PopoverHiddenEvent } from '../popover/popover.types';
3
3
  import type Select from './select.component';
4
4
  import { ARROW_ICON } from './select.constants';
5
5
  type SelectChangeEvent = TypedEvent<Select, {
6
6
  value: string;
7
+ label?: string;
7
8
  }>;
8
9
  type SelectInputEvent = TypedEvent<Select, {
9
10
  value: string;
11
+ label?: string;
10
12
  }>;
11
13
  interface Events {
12
14
  onClickEvent: MouseEvent;
@@ -14,6 +16,8 @@ interface Events {
14
16
  onInputEvent: SelectInputEvent;
15
17
  onKeyDownEvent: KeyboardEvent;
16
18
  onFocusEvent: FocusEvent;
19
+ onShownEvent: PopoverShownEvent;
20
+ onHiddenEvent: PopoverHiddenEvent;
17
21
  }
18
22
  type Placement = Extract<PopoverPlacement, 'bottom-start' | 'top-start'>;
19
23
  type ArrowIcon = ValueOf<typeof ARROW_ICON>;
@@ -145,7 +145,7 @@ class SideNavigation extends Provider {
145
145
  default:
146
146
  }
147
147
  };
148
- this.addEventListener('activechange', this.handleNestedNavMenuItemActiveChange);
148
+ this.addEventListener('activechange', this.handleNestedNavMenuItemActiveChange.bind(this));
149
149
  }
150
150
  connectedCallback() {
151
151
  super.connectedCallback();
@@ -42,7 +42,7 @@ declare class Spinner extends Component {
42
42
  * The spinner color can be inverted by setting the inverted attribute to true.
43
43
  * @default false
44
44
  */
45
- inverted: false;
45
+ inverted?: boolean;
46
46
  /**
47
47
  * Size of the spinner.
48
48
  * Acceptable values include:
@@ -101,7 +101,7 @@ class Spinner extends Component {
101
101
  Spinner.styles = [...Component.styles, ...styles];
102
102
  __decorate([
103
103
  property({ type: Boolean, reflect: true }),
104
- __metadata("design:type", Object)
104
+ __metadata("design:type", Boolean)
105
105
  ], Spinner.prototype, "inverted", void 0);
106
106
  __decorate([
107
107
  property({ type: String, reflect: true }),
@@ -97,6 +97,7 @@ declare class TabList extends Component {
97
97
  * Also set up the event listeners.
98
98
  */
99
99
  protected firstUpdated(): Promise<void>;
100
+ disconnectedCallback(): void;
100
101
  /**
101
102
  * Observe the tablist element for changes in the activeTabId attribute.
102
103
  * Find the new tab with the new activeTabId.