@momentum-design/components 0.83.1 → 0.83.2
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 +6 -6
- package/dist/browser/index.js.map +3 -3
- package/dist/components/popover/popover.component.d.ts +13 -0
- package/dist/components/popover/popover.component.js +29 -6
- package/dist/components/popover/popover.constants.d.ts +1 -0
- package/dist/components/popover/popover.constants.js +1 -0
- package/dist/custom-elements.json +1342 -1210
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +5 -5
- package/dist/utils/mixins/FocusTrapMixin.js +11 -8
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
@@ -4,17 +4,17 @@ export { default as Appheader } from './appheader';
|
|
4
4
|
export { default as Avatar } from './avatar';
|
5
5
|
export { default as AvatarButton } from './avatarbutton';
|
6
6
|
export { default as Badge } from './badge';
|
7
|
-
export { default as Brandvisual } from './brandvisual';
|
8
|
-
export { default as Button } from './button';
|
9
7
|
export { default as Bullet } from './bullet';
|
10
|
-
export { default as
|
8
|
+
export { default as Button } from './button';
|
9
|
+
export { default as Brandvisual } from './brandvisual';
|
11
10
|
export { default as ButtonLink } from './buttonlink';
|
11
|
+
export { default as ButtonGroup } from './buttongroup';
|
12
12
|
export { default as Buttonsimple } from './buttonsimple';
|
13
13
|
export { default as Card } from './card';
|
14
14
|
export { default as CardButton } from './cardbutton';
|
15
15
|
export { default as CardCheckbox } from './cardcheckbox';
|
16
|
-
export { default as CardRadio } from './cardradio';
|
17
16
|
export { default as Checkbox } from './checkbox';
|
17
|
+
export { default as CardRadio } from './cardradio';
|
18
18
|
export { default as Chip } from './chip';
|
19
19
|
export { default as Coachmark } from './coachmark';
|
20
20
|
export { default as Dialog } from './dialog';
|
@@ -32,8 +32,8 @@ export { default as List } from './list';
|
|
32
32
|
export { default as ListItem } from './listitem';
|
33
33
|
export { default as Marker } from './marker';
|
34
34
|
export { default as MenuBar } from './menubar';
|
35
|
-
export { default as MenuItem } from './menuitem';
|
36
35
|
export { default as MenuItemCheckbox } from './menuitemcheckbox';
|
36
|
+
export { default as MenuItem } from './menuitem';
|
37
37
|
export { default as MenuItemRadio } from './menuitemradio';
|
38
38
|
export { default as MenuPopover } from './menupopover';
|
39
39
|
export { default as MenuSection } from './menusection';
|
package/dist/react/index.js
CHANGED
@@ -4,17 +4,17 @@ export { default as Appheader } from './appheader';
|
|
4
4
|
export { default as Avatar } from './avatar';
|
5
5
|
export { default as AvatarButton } from './avatarbutton';
|
6
6
|
export { default as Badge } from './badge';
|
7
|
-
export { default as Brandvisual } from './brandvisual';
|
8
|
-
export { default as Button } from './button';
|
9
7
|
export { default as Bullet } from './bullet';
|
10
|
-
export { default as
|
8
|
+
export { default as Button } from './button';
|
9
|
+
export { default as Brandvisual } from './brandvisual';
|
11
10
|
export { default as ButtonLink } from './buttonlink';
|
11
|
+
export { default as ButtonGroup } from './buttongroup';
|
12
12
|
export { default as Buttonsimple } from './buttonsimple';
|
13
13
|
export { default as Card } from './card';
|
14
14
|
export { default as CardButton } from './cardbutton';
|
15
15
|
export { default as CardCheckbox } from './cardcheckbox';
|
16
|
-
export { default as CardRadio } from './cardradio';
|
17
16
|
export { default as Checkbox } from './checkbox';
|
17
|
+
export { default as CardRadio } from './cardradio';
|
18
18
|
export { default as Chip } from './chip';
|
19
19
|
export { default as Coachmark } from './coachmark';
|
20
20
|
export { default as Dialog } from './dialog';
|
@@ -32,8 +32,8 @@ export { default as List } from './list';
|
|
32
32
|
export { default as ListItem } from './listitem';
|
33
33
|
export { default as Marker } from './marker';
|
34
34
|
export { default as MenuBar } from './menubar';
|
35
|
-
export { default as MenuItem } from './menuitem';
|
36
35
|
export { default as MenuItemCheckbox } from './menuitemcheckbox';
|
36
|
+
export { default as MenuItem } from './menuitem';
|
37
37
|
export { default as MenuItemRadio } from './menuitemradio';
|
38
38
|
export { default as MenuPopover } from './menupopover';
|
39
39
|
export { default as MenuSection } from './menusection';
|
@@ -17,7 +17,7 @@ export const FocusTrapMixin = (superClass) => {
|
|
17
17
|
* Determines whether focus should wrap around when reaching the first or last focusable element.
|
18
18
|
* If true, focus will cycle from end to start and vice versa.
|
19
19
|
*
|
20
|
-
* This only applies when `
|
20
|
+
* This only applies when `focusTrap` is true.
|
21
21
|
* @default true
|
22
22
|
*/
|
23
23
|
this.shouldFocusTrapWrap = true;
|
@@ -54,10 +54,7 @@ export const FocusTrapMixin = (superClass) => {
|
|
54
54
|
* This calculates the focusable elements within the component's shadow root
|
55
55
|
*/
|
56
56
|
activateFocusTrap() {
|
57
|
-
|
58
|
-
this.isFocusTrapActivated = true;
|
59
|
-
this.setFocusableElements();
|
60
|
-
}
|
57
|
+
this.isFocusTrapActivated = !!this.focusTrap;
|
61
58
|
}
|
62
59
|
/**
|
63
60
|
* Deactivate the focus trap.
|
@@ -65,8 +62,8 @@ export const FocusTrapMixin = (superClass) => {
|
|
65
62
|
deactivateFocusTrap() {
|
66
63
|
this.isFocusTrapActivated = false;
|
67
64
|
this.focusTrapIndex = -1;
|
68
|
-
// todo: this should not override the body overflow style, but reset it instead
|
69
65
|
this.enabledPreventScroll = false;
|
66
|
+
// todo: this should not override the body overflow style, but reset it instead
|
70
67
|
document.body.style.overflow = '';
|
71
68
|
}
|
72
69
|
/**
|
@@ -185,6 +182,8 @@ export const FocusTrapMixin = (superClass) => {
|
|
185
182
|
/**
|
186
183
|
* Recursively finds all focusable elements within the given root and its descendants.
|
187
184
|
*
|
185
|
+
* Make sure this is performant, as it will be called multiple times.
|
186
|
+
*
|
188
187
|
* @param root - The root element to search for focusable elements.
|
189
188
|
* @param matches - The set of focusable elements.
|
190
189
|
* @returns The list of focusable elements.
|
@@ -230,8 +229,10 @@ export const FocusTrapMixin = (superClass) => {
|
|
230
229
|
* @param elementIndexToReceiveFocus - The index of the preferable element to focus.
|
231
230
|
*/
|
232
231
|
setInitialFocus(elementIndexToReceiveFocus = 0) {
|
233
|
-
|
232
|
+
this.setFocusableElements();
|
233
|
+
if (this.focusableElements.length === 0 || !this.focusTrap) {
|
234
234
|
return;
|
235
|
+
}
|
235
236
|
if (this.enabledPreventScroll) {
|
236
237
|
document.body.style.overflow = 'hidden';
|
237
238
|
}
|
@@ -309,6 +310,8 @@ export const FocusTrapMixin = (superClass) => {
|
|
309
310
|
* If true, the focus will be trapped in the previous element.
|
310
311
|
*/
|
311
312
|
trapFocus(direction) {
|
313
|
+
// calculate the focusable elements
|
314
|
+
this.setFocusableElements();
|
312
315
|
if (this.focusableElements.length === 0) {
|
313
316
|
return;
|
314
317
|
}
|
@@ -331,7 +334,7 @@ export const FocusTrapMixin = (superClass) => {
|
|
331
334
|
* @param event - The keyboard event.
|
332
335
|
*/
|
333
336
|
handleTabKeydown(event) {
|
334
|
-
if (!this.isFocusTrapActivated
|
337
|
+
if (!this.isFocusTrapActivated) {
|
335
338
|
return;
|
336
339
|
}
|
337
340
|
if (event.key === 'Tab') {
|
package/package.json
CHANGED