@momentum-design/components 0.107.0 → 0.107.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.
- package/dist/browser/index.js +101 -101
- package/dist/browser/index.js.map +2 -2
- package/dist/components/menupopover/menupopover.component.js +0 -2
- package/dist/components/popover/popover.component.d.ts +12 -9
- package/dist/components/popover/popover.component.js +12 -23
- package/dist/components/popover/popover.constants.d.ts +0 -1
- package/dist/components/popover/popover.constants.js +0 -1
- package/dist/components/popover/popover.utils.d.ts +0 -4
- package/dist/components/popover/popover.utils.js +4 -18
- package/dist/custom-elements.json +562 -694
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/popover/index.d.ts +4 -0
- package/dist/react/popover/index.js +4 -0
- package/package.json +1 -1
@@ -374,11 +374,9 @@ class MenuPopover extends Popover {
|
|
374
374
|
return super.isOpenUpdated(oldValue, newValue);
|
375
375
|
}
|
376
376
|
async firstUpdated(changedProperties) {
|
377
|
-
var _a;
|
378
377
|
await super.firstUpdated(changedProperties);
|
379
378
|
this.collectMenuItems();
|
380
379
|
this.resetTabIndexes(0);
|
381
|
-
(_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', ROLE.MENU);
|
382
380
|
}
|
383
381
|
/**
|
384
382
|
* Reset all tabindex to -1 and set the tabindex of the current menu item to 0
|
@@ -8,6 +8,10 @@ declare const Popover_base: import("../../utils/mixins/index.types").Constructor
|
|
8
8
|
* The popover automatically positions itself based on available space and
|
9
9
|
* supports dynamic height adjustments with scrollable content when needed。
|
10
10
|
*
|
11
|
+
* Note:
|
12
|
+
* - A component (button) can trigger more than one popover, but only one of them should change the
|
13
|
+
* aria-expanded and aria-haspopup, the rest of the popovers must have `disable-aria-expanded` attribute.
|
14
|
+
*
|
11
15
|
* @dependency mdc-button
|
12
16
|
*
|
13
17
|
* @tagname mdc-popover
|
@@ -261,18 +265,17 @@ declare class Popover extends Popover_base {
|
|
261
265
|
*/
|
262
266
|
ariaDescribedby: string | null;
|
263
267
|
/**
|
264
|
-
* Disable setting the aria-expanded attribute on trigger element.
|
265
|
-
*
|
268
|
+
* Disable setting the `aria-expanded` attribute on trigger element.
|
269
|
+
*
|
270
|
+
* Note, when `disable-aria-expanded` is true
|
271
|
+
* - when its value change after first update to
|
272
|
+
* - `true`: popover will not remove the `aria-expanded` to avoid conflicts when there are more than one popover
|
273
|
+
* registered to the same trigger
|
274
|
+
* - `false`: check `aria-expanded` value and update it if necessary.
|
275
|
+
* - aria-haspopup will be disabled as well
|
266
276
|
* @default false
|
267
277
|
*/
|
268
278
|
disableAriaExpanded: boolean;
|
269
|
-
/**
|
270
|
-
* Disable setting the aria-haspopup attribute on trigger element.
|
271
|
-
* Make sure to set this to true when the popover is extended and its role
|
272
|
-
* is not 'dialog' or 'alertdialog' i.e. listbox, menu, etc.
|
273
|
-
* @default false
|
274
|
-
*/
|
275
|
-
disableAriaHasPopup: boolean;
|
276
279
|
/**
|
277
280
|
* If a tooltip is connected to the same trigger element,
|
278
281
|
* this property will keep the connected tooltip closed if this popover is open.
|
@@ -27,6 +27,10 @@ import { PopoverUtils } from './popover.utils';
|
|
27
27
|
* The popover automatically positions itself based on available space and
|
28
28
|
* supports dynamic height adjustments with scrollable content when needed。
|
29
29
|
*
|
30
|
+
* Note:
|
31
|
+
* - A component (button) can trigger more than one popover, but only one of them should change the
|
32
|
+
* aria-expanded and aria-haspopup, the rest of the popovers must have `disable-aria-expanded` attribute.
|
33
|
+
*
|
30
34
|
* @dependency mdc-button
|
31
35
|
*
|
32
36
|
* @tagname mdc-popover
|
@@ -261,18 +265,17 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
261
265
|
*/
|
262
266
|
this.ariaDescribedby = null;
|
263
267
|
/**
|
264
|
-
* Disable setting the aria-expanded attribute on trigger element.
|
265
|
-
*
|
268
|
+
* Disable setting the `aria-expanded` attribute on trigger element.
|
269
|
+
*
|
270
|
+
* Note, when `disable-aria-expanded` is true
|
271
|
+
* - when its value change after first update to
|
272
|
+
* - `true`: popover will not remove the `aria-expanded` to avoid conflicts when there are more than one popover
|
273
|
+
* registered to the same trigger
|
274
|
+
* - `false`: check `aria-expanded` value and update it if necessary.
|
275
|
+
* - aria-haspopup will be disabled as well
|
266
276
|
* @default false
|
267
277
|
*/
|
268
278
|
this.disableAriaExpanded = DEFAULTS.DISABLE_ARIA_EXPANDED;
|
269
|
-
/**
|
270
|
-
* Disable setting the aria-haspopup attribute on trigger element.
|
271
|
-
* Make sure to set this to true when the popover is extended and its role
|
272
|
-
* is not 'dialog' or 'alertdialog' i.e. listbox, menu, etc.
|
273
|
-
* @default false
|
274
|
-
*/
|
275
|
-
this.disableAriaHasPopup = DEFAULTS.DISABLE_ARIA_HAS_POPUP;
|
276
279
|
/**
|
277
280
|
* If a tooltip is connected to the same trigger element,
|
278
281
|
* this property will keep the connected tooltip closed if this popover is open.
|
@@ -699,9 +702,6 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
699
702
|
if (changedProperties.has('disableAriaExpanded')) {
|
700
703
|
this.utils.updateAriaExpandedAttribute();
|
701
704
|
}
|
702
|
-
if (changedProperties.has('interactive') || changedProperties.has('disableAriaHasPopup')) {
|
703
|
-
this.utils.updateAriaHasPopupAttribute();
|
704
|
-
}
|
705
705
|
if (changedProperties.has('focusTrap')) {
|
706
706
|
// if focusTrap turned false and the popover is visible, deactivate the focus trap
|
707
707
|
if (!this.focusTrap && this.visible) {
|
@@ -795,13 +795,6 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
795
795
|
this.removeEventListener('keydown', this.onEscapeKeydown);
|
796
796
|
(_c = this.triggerElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('keydown', this.onEscapeKeydown);
|
797
797
|
}
|
798
|
-
if (this.disableAriaExpanded) {
|
799
|
-
this.triggerElement.removeAttribute('aria-expanded');
|
800
|
-
}
|
801
|
-
// Remove aria-haspopup if the popover is not interactive
|
802
|
-
if (!this.interactive) {
|
803
|
-
this.triggerElement.removeAttribute('aria-haspopup');
|
804
|
-
}
|
805
798
|
this.deactivatePreventScroll();
|
806
799
|
(_d = this.deactivateFocusTrap) === null || _d === void 0 ? void 0 : _d.call(this);
|
807
800
|
if (this.focusBackToTrigger) {
|
@@ -972,10 +965,6 @@ __decorate([
|
|
972
965
|
property({ type: Boolean, reflect: true, attribute: 'disable-aria-expanded' }),
|
973
966
|
__metadata("design:type", Boolean)
|
974
967
|
], Popover.prototype, "disableAriaExpanded", void 0);
|
975
|
-
__decorate([
|
976
|
-
property({ type: Boolean, reflect: true, attribute: 'disable-aria-haspopup' }),
|
977
|
-
__metadata("design:type", Boolean)
|
978
|
-
], Popover.prototype, "disableAriaHasPopup", void 0);
|
979
968
|
__decorate([
|
980
969
|
property({ type: Boolean, reflect: true, attribute: 'keep-connected-tooltip-closed' }),
|
981
970
|
__metadata("design:type", Boolean)
|
@@ -48,7 +48,6 @@ declare const DEFAULTS: {
|
|
48
48
|
readonly ROLE: "dialog";
|
49
49
|
readonly Z_INDEX: 1000;
|
50
50
|
readonly DISABLE_ARIA_EXPANDED: false;
|
51
|
-
readonly DISABLE_ARIA_HAS_POPUP: false;
|
52
51
|
readonly PROPAGATE_EVENT_ON_ESCAPE: false;
|
53
52
|
readonly KEEP_CONNECTED_TOOLTIP_CLOSED: true;
|
54
53
|
readonly STRATEGY: "absolute";
|
@@ -32,10 +32,6 @@ export declare class PopoverUtils {
|
|
32
32
|
* Updates the aria-modal attribute based on the popover's role.
|
33
33
|
*/
|
34
34
|
updateAriaModal(): void;
|
35
|
-
/**
|
36
|
-
* Updates the aria-haspopup attribute on the trigger element.
|
37
|
-
*/
|
38
|
-
updateAriaHasPopupAttribute(): void;
|
39
35
|
/**
|
40
36
|
* Updates the aria-expanded attribute on the trigger element.
|
41
37
|
*/
|
@@ -111,28 +111,14 @@ export class PopoverUtils {
|
|
111
111
|
this.popover.removeAttribute('aria-modal');
|
112
112
|
}
|
113
113
|
}
|
114
|
-
/**
|
115
|
-
* Updates the aria-haspopup attribute on the trigger element.
|
116
|
-
*/
|
117
|
-
updateAriaHasPopupAttribute() {
|
118
|
-
var _a, _b, _c;
|
119
|
-
if (this.popover.interactive && !this.popover.disableAriaHasPopup) {
|
120
|
-
(_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', ((_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-haspopup')) || 'dialog');
|
121
|
-
}
|
122
|
-
else {
|
123
|
-
(_c = this.popover.triggerElement) === null || _c === void 0 ? void 0 : _c.removeAttribute('aria-haspopup');
|
124
|
-
}
|
125
|
-
}
|
126
114
|
/**
|
127
115
|
* Updates the aria-expanded attribute on the trigger element.
|
128
116
|
*/
|
129
117
|
updateAriaExpandedAttribute() {
|
130
|
-
var _a, _b;
|
131
|
-
if (this.popover.disableAriaExpanded) {
|
132
|
-
(_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.
|
133
|
-
|
134
|
-
else {
|
135
|
-
(_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-expanded', `${this.popover.visible}`);
|
118
|
+
var _a, _b, _c;
|
119
|
+
if (!this.popover.disableAriaExpanded) {
|
120
|
+
(_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', `${this.popover.visible}`);
|
121
|
+
(_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-haspopup', ((_c = this.popover.triggerElement) === null || _c === void 0 ? void 0 : _c.getAttribute('aria-haspopup')) || this.popover.role || 'dialog');
|
136
122
|
}
|
137
123
|
}
|
138
124
|
/**
|