@momentum-design/components 0.66.4 → 0.68.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.
- package/dist/browser/index.js +369 -211
- package/dist/browser/index.js.map +4 -4
- package/dist/components/card/card.component.d.ts +4 -35
- package/dist/components/card/card.component.js +9 -79
- package/dist/components/dialog/dialog.component.d.ts +150 -0
- package/dist/components/dialog/dialog.component.js +340 -0
- package/dist/components/dialog/dialog.constants.d.ts +18 -0
- package/dist/components/dialog/dialog.constants.js +19 -0
- package/dist/components/dialog/dialog.events.d.ts +34 -0
- package/dist/components/dialog/dialog.events.js +47 -0
- package/dist/components/dialog/dialog.styles.d.ts +2 -0
- package/dist/components/dialog/dialog.styles.js +108 -0
- package/dist/components/dialog/dialog.types.d.ts +12 -0
- package/dist/components/dialog/dialog.types.js +1 -0
- package/dist/components/dialog/dialog.utils.d.ts +7 -0
- package/dist/components/dialog/dialog.utils.js +33 -0
- package/dist/components/dialog/index.d.ts +9 -0
- package/dist/components/dialog/index.js +6 -0
- package/dist/components/popover/popover.styles.js +5 -0
- package/dist/components/toggletip/toggletip.styles.js +8 -0
- package/dist/custom-elements.json +1211 -105
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/react/dialog/index.d.ts +51 -0
- package/dist/react/dialog/index.js +59 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utils/mixins/CardAndDialogFooterMixin.d.ts +11 -0
- package/dist/utils/mixins/CardAndDialogFooterMixin.js +102 -0
- package/dist/utils/mixins/FocusTrapMixin.js +4 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -14,6 +14,7 @@ import CardRadio from './components/cardradio';
|
|
14
14
|
import Checkbox from './components/checkbox';
|
15
15
|
import Chip from './components/chip';
|
16
16
|
import Coachmark from './components/coachmark';
|
17
|
+
import Dialog from './components/dialog';
|
17
18
|
import Divider from './components/divider';
|
18
19
|
import FilterChip from './components/filterchip';
|
19
20
|
import FormfieldGroup from './components/formfieldgroup';
|
@@ -26,6 +27,7 @@ import Linksimple from './components/linksimple';
|
|
26
27
|
import List from './components/list';
|
27
28
|
import ListItem from './components/listitem';
|
28
29
|
import Marker from './components/marker';
|
30
|
+
import MenuItem from './components/menuitem';
|
29
31
|
import OptGroup from './components/optgroup';
|
30
32
|
import Option from './components/option';
|
31
33
|
import Popover from './components/popover';
|
@@ -47,10 +49,9 @@ import Text from './components/text';
|
|
47
49
|
import Textarea from './components/textarea';
|
48
50
|
import ThemeProvider from './components/themeprovider';
|
49
51
|
import Toggle from './components/toggle';
|
50
|
-
import Tooltip from './components/tooltip';
|
51
52
|
import ToggleTip from './components/toggletip';
|
53
|
+
import Tooltip from './components/tooltip';
|
52
54
|
import VirtualizedList from './components/virtualizedlist';
|
53
|
-
import MenuItem from './components/menuitem';
|
54
55
|
import MenuItemRadio from './components/menuitemradio';
|
55
56
|
import MenuItemCheckbox from './components/menuitemcheckbox';
|
56
57
|
import type { BadgeType } from './components/badge/badge.types';
|
@@ -60,6 +61,6 @@ import type { SpinnerSize, SpinnerVariant } from './components/spinner/spinner.t
|
|
60
61
|
import type { TextType } from './components/text/text.types';
|
61
62
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
62
63
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from './components/button/button.constants';
|
63
|
-
export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker,
|
64
|
+
export { AlertChip, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, MenuItem, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, VirtualizedList, StaticCheckbox, StaticRadio, StaticToggle, ToggleTip, Tooltip, MenuItemRadio, MenuItemCheckbox, };
|
64
65
|
export type { TextType, SpinnerSize, SpinnerVariant, PopoverPlacement, BadgeType, IconButtonSize, PillButtonSize, ButtonVariant, ButtonColor, };
|
65
66
|
export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
|
package/dist/index.js
CHANGED
@@ -15,6 +15,7 @@ import CardRadio from './components/cardradio';
|
|
15
15
|
import Checkbox from './components/checkbox';
|
16
16
|
import Chip from './components/chip';
|
17
17
|
import Coachmark from './components/coachmark';
|
18
|
+
import Dialog from './components/dialog';
|
18
19
|
import Divider from './components/divider';
|
19
20
|
import FilterChip from './components/filterchip';
|
20
21
|
import FormfieldGroup from './components/formfieldgroup';
|
@@ -27,6 +28,7 @@ import Linksimple from './components/linksimple';
|
|
27
28
|
import List from './components/list';
|
28
29
|
import ListItem from './components/listitem';
|
29
30
|
import Marker from './components/marker';
|
31
|
+
import MenuItem from './components/menuitem';
|
30
32
|
import OptGroup from './components/optgroup';
|
31
33
|
import Option from './components/option';
|
32
34
|
import Popover from './components/popover';
|
@@ -48,16 +50,15 @@ import Text from './components/text';
|
|
48
50
|
import Textarea from './components/textarea';
|
49
51
|
import ThemeProvider from './components/themeprovider';
|
50
52
|
import Toggle from './components/toggle';
|
51
|
-
import Tooltip from './components/tooltip';
|
52
53
|
import ToggleTip from './components/toggletip';
|
54
|
+
import Tooltip from './components/tooltip';
|
53
55
|
import VirtualizedList from './components/virtualizedlist';
|
54
|
-
import MenuItem from './components/menuitem';
|
55
56
|
import MenuItemRadio from './components/menuitemradio';
|
56
57
|
import MenuItemCheckbox from './components/menuitemcheckbox';
|
57
58
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
58
59
|
// Constants / Utils Imports
|
59
60
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
|
60
61
|
// Components Exports
|
61
|
-
export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker,
|
62
|
+
export { AlertChip, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, MenuItem, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, VirtualizedList, StaticCheckbox, StaticRadio, StaticToggle, ToggleTip, Tooltip, MenuItemRadio, MenuItemCheckbox, };
|
62
63
|
// Constants / Utils Exports
|
63
64
|
export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { type EventName } from '@lit/react';
|
2
|
+
import Component from '../../components/dialog';
|
3
|
+
/**
|
4
|
+
* Dialog component is a modal dialog that can be used to display information or prompt the user for input.
|
5
|
+
* It can be used to create custom dialogs where content for the body and footer actions is provided by the consumer.
|
6
|
+
* The dialog is available in three sizes: small, medium, and large. It may also receive custom styling/sizing.
|
7
|
+
* The dialog interrupts the user and will block interaction with the rest of the application until it is closed.
|
8
|
+
*
|
9
|
+
* Dialog component have 2 variants: default and promotional.
|
10
|
+
*
|
11
|
+
* **Accessibility notes for consuming (have to be explicitly set when you consume the component)**
|
12
|
+
*
|
13
|
+
* - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
14
|
+
* - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
15
|
+
*
|
16
|
+
* **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
|
17
|
+
* - Use `?visible=true/false` as an attribute instead of `visible=true/false`
|
18
|
+
* - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
|
19
|
+
*
|
20
|
+
* @dependency mdc-button
|
21
|
+
* @dependency mdc-text
|
22
|
+
*
|
23
|
+
* @tagname mdc-dialog
|
24
|
+
*
|
25
|
+
* @event shown - (React: onShown) Dispatched when the dialog is shown
|
26
|
+
* @event hidden - (React: onHidden) Dispatched when the dialog is hidden
|
27
|
+
* @event created - (React: onCreated) Dispatched when the dialog is created (added to the DOM)
|
28
|
+
* @event destroyed - (React: onDestroyed) Dispatched when the dialog is destroyed (removed from the DOM)
|
29
|
+
*
|
30
|
+
* @cssproperty --mdc-dialog-primary-background-color - primary background color of the dialog
|
31
|
+
* @cssproperty --mdc-dialog-border-color - border color of the dialog
|
32
|
+
* @cssproperty --mdc-dialog-header-text-color - text color of the header/title of the dialog
|
33
|
+
* @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
|
34
|
+
* @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
|
35
|
+
* @cssproperty --mdc-dialog-width - width of the dialog
|
36
|
+
*
|
37
|
+
* @slot dialog-body - Slot for the dialog body content
|
38
|
+
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
39
|
+
* @slot footer-button-secondary - This slot is for passing secondary variant of `mdc-button` component
|
40
|
+
* within the footer section.
|
41
|
+
* @slot footer-button-primary - This slot is for passing primary variant of
|
42
|
+
* `mdc-button` component within the footer section.
|
43
|
+
*
|
44
|
+
*/
|
45
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
46
|
+
onShown: EventName<Event>;
|
47
|
+
onHidden: EventName<Event>;
|
48
|
+
onCreated: EventName<Event>;
|
49
|
+
onDestroyed: EventName<Event>;
|
50
|
+
}>;
|
51
|
+
export default reactWrapper;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/dialog';
|
4
|
+
import { TAG_NAME } from '../../components/dialog/dialog.constants';
|
5
|
+
/**
|
6
|
+
* Dialog component is a modal dialog that can be used to display information or prompt the user for input.
|
7
|
+
* It can be used to create custom dialogs where content for the body and footer actions is provided by the consumer.
|
8
|
+
* The dialog is available in three sizes: small, medium, and large. It may also receive custom styling/sizing.
|
9
|
+
* The dialog interrupts the user and will block interaction with the rest of the application until it is closed.
|
10
|
+
*
|
11
|
+
* Dialog component have 2 variants: default and promotional.
|
12
|
+
*
|
13
|
+
* **Accessibility notes for consuming (have to be explicitly set when you consume the component)**
|
14
|
+
*
|
15
|
+
* - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
|
16
|
+
* - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
|
17
|
+
*
|
18
|
+
* **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
|
19
|
+
* - Use `?visible=true/false` as an attribute instead of `visible=true/false`
|
20
|
+
* - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
|
21
|
+
*
|
22
|
+
* @dependency mdc-button
|
23
|
+
* @dependency mdc-text
|
24
|
+
*
|
25
|
+
* @tagname mdc-dialog
|
26
|
+
*
|
27
|
+
* @event shown - (React: onShown) Dispatched when the dialog is shown
|
28
|
+
* @event hidden - (React: onHidden) Dispatched when the dialog is hidden
|
29
|
+
* @event created - (React: onCreated) Dispatched when the dialog is created (added to the DOM)
|
30
|
+
* @event destroyed - (React: onDestroyed) Dispatched when the dialog is destroyed (removed from the DOM)
|
31
|
+
*
|
32
|
+
* @cssproperty --mdc-dialog-primary-background-color - primary background color of the dialog
|
33
|
+
* @cssproperty --mdc-dialog-border-color - border color of the dialog
|
34
|
+
* @cssproperty --mdc-dialog-header-text-color - text color of the header/title of the dialog
|
35
|
+
* @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
|
36
|
+
* @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
|
37
|
+
* @cssproperty --mdc-dialog-width - width of the dialog
|
38
|
+
*
|
39
|
+
* @slot dialog-body - Slot for the dialog body content
|
40
|
+
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
41
|
+
* @slot footer-button-secondary - This slot is for passing secondary variant of `mdc-button` component
|
42
|
+
* within the footer section.
|
43
|
+
* @slot footer-button-primary - This slot is for passing primary variant of
|
44
|
+
* `mdc-button` component within the footer section.
|
45
|
+
*
|
46
|
+
*/
|
47
|
+
const reactWrapper = createComponent({
|
48
|
+
tagName: TAG_NAME,
|
49
|
+
elementClass: Component,
|
50
|
+
react: React,
|
51
|
+
events: {
|
52
|
+
onShown: 'shown',
|
53
|
+
onHidden: 'hidden',
|
54
|
+
onCreated: 'created',
|
55
|
+
onDestroyed: 'destroyed',
|
56
|
+
},
|
57
|
+
displayName: 'Dialog',
|
58
|
+
});
|
59
|
+
export default reactWrapper;
|
package/dist/react/index.d.ts
CHANGED
@@ -15,6 +15,7 @@ export { default as CardRadio } from './cardradio';
|
|
15
15
|
export { default as Checkbox } from './checkbox';
|
16
16
|
export { default as Chip } from './chip';
|
17
17
|
export { default as Coachmark } from './coachmark';
|
18
|
+
export { default as Dialog } from './dialog';
|
18
19
|
export { default as Divider } from './divider';
|
19
20
|
export { default as FilterChip } from './filterchip';
|
20
21
|
export { default as FormfieldGroup } from './formfieldgroup';
|
package/dist/react/index.js
CHANGED
@@ -15,6 +15,7 @@ export { default as CardRadio } from './cardradio';
|
|
15
15
|
export { default as Checkbox } from './checkbox';
|
16
16
|
export { default as Chip } from './chip';
|
17
17
|
export { default as Coachmark } from './coachmark';
|
18
|
+
export { default as Dialog } from './dialog';
|
18
19
|
export { default as Divider } from './divider';
|
19
20
|
export { default as FilterChip } from './filterchip';
|
20
21
|
export { default as FormfieldGroup } from './formfieldgroup';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
2
|
+
import type { Constructor } from './index.types';
|
3
|
+
export declare class CardAndDialogFooterMixinInterface {
|
4
|
+
footerLink?: Array<HTMLElement>;
|
5
|
+
footerButtonPrimary?: Array<HTMLElement>;
|
6
|
+
footerButtonSecondary?: Array<HTMLElement>;
|
7
|
+
protected updateFooterButtonColors(variant: string): void;
|
8
|
+
protected handleFooterSlot(tagname: string, variant?: string): void;
|
9
|
+
protected renderFooter(): TemplateResult;
|
10
|
+
}
|
11
|
+
export declare const CardAndDialogFooterMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<CardAndDialogFooterMixinInterface> & T;
|
@@ -0,0 +1,102 @@
|
|
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
|
+
/* eslint-disable max-classes-per-file */
|
11
|
+
import { html } from 'lit';
|
12
|
+
import { queryAssignedElements } from 'lit/decorators.js';
|
13
|
+
import { DEFAULTS, VARIANTS } from '../../components/card/card.constants';
|
14
|
+
import { BUTTON_COLORS, BUTTON_VARIANTS } from '../../components/button/button.constants';
|
15
|
+
export const CardAndDialogFooterMixin = (superClass) => {
|
16
|
+
class InnerMixinClass extends superClass {
|
17
|
+
/**
|
18
|
+
* Updates the color of the footer buttons based on the variant.
|
19
|
+
* If the variant is promotional, the color is promotional, else default.
|
20
|
+
*
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
updateFooterButtonColors(variant) {
|
24
|
+
const footerButtons = [...(this.footerButtonPrimary || []), ...(this.footerButtonSecondary || [])];
|
25
|
+
footerButtons === null || footerButtons === void 0 ? void 0 : footerButtons.forEach((button) => {
|
26
|
+
if (variant === VARIANTS.PROMOTIONAL) {
|
27
|
+
button.setAttribute('color', BUTTON_COLORS.PROMOTIONAL);
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
button.setAttribute('color', BUTTON_COLORS.DEFAULT);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Filters and renders only the following content into the footer section and removes anything other than it
|
36
|
+
* - One mdc-link element in the footer-link slot
|
37
|
+
* - One secondary variant of the mdc-button element in the footer-button-secondary slot
|
38
|
+
* - One primary variant of the mdc-button element in the footer-button-primary slot
|
39
|
+
*
|
40
|
+
* @internal
|
41
|
+
*/
|
42
|
+
handleFooterSlot(tagname, variant) {
|
43
|
+
var _a, _b, _c;
|
44
|
+
let arrayItems = [];
|
45
|
+
if (tagname === DEFAULTS.LINK && ((_a = this.footerLink) === null || _a === void 0 ? void 0 : _a.length)) {
|
46
|
+
arrayItems = this.footerLink;
|
47
|
+
}
|
48
|
+
else if (tagname === DEFAULTS.BUTTON
|
49
|
+
&& variant === BUTTON_VARIANTS.PRIMARY
|
50
|
+
&& ((_b = this.footerButtonPrimary) === null || _b === void 0 ? void 0 : _b.length)) {
|
51
|
+
arrayItems = this.footerButtonPrimary;
|
52
|
+
}
|
53
|
+
else if (tagname === DEFAULTS.BUTTON
|
54
|
+
&& variant === BUTTON_VARIANTS.SECONDARY
|
55
|
+
&& ((_c = this.footerButtonSecondary) === null || _c === void 0 ? void 0 : _c.length)) {
|
56
|
+
arrayItems = this.footerButtonSecondary;
|
57
|
+
}
|
58
|
+
// if there are more than one instance, remove them.
|
59
|
+
for (let i = 1; i < arrayItems.length; i += 1) {
|
60
|
+
arrayItems[i].remove();
|
61
|
+
}
|
62
|
+
arrayItems.forEach((element) => {
|
63
|
+
// remove the element if it doesn't match with the tagname
|
64
|
+
if (!element.matches(tagname)) {
|
65
|
+
element.remove();
|
66
|
+
}
|
67
|
+
// set the variant if it is provided
|
68
|
+
if (variant) {
|
69
|
+
element.setAttribute('variant', variant);
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* Renders the footer of the card if footer-link,
|
75
|
+
* footer-button-primary, or footer-button-secondary slots are provided
|
76
|
+
* @returns The footer element
|
77
|
+
*/
|
78
|
+
renderFooter() {
|
79
|
+
return html `<div part="footer">
|
80
|
+
<slot name="footer-link" @slotchange=${() => this.handleFooterSlot(DEFAULTS.LINK)}></slot>
|
81
|
+
<slot name="footer-button-secondary"
|
82
|
+
@slotchange=${() => this.handleFooterSlot(DEFAULTS.BUTTON, BUTTON_VARIANTS.SECONDARY)}></slot>
|
83
|
+
<slot name="footer-button-primary"
|
84
|
+
@slotchange=${() => this.handleFooterSlot(DEFAULTS.BUTTON, BUTTON_VARIANTS.PRIMARY)}></slot>
|
85
|
+
</div>`;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
__decorate([
|
89
|
+
queryAssignedElements({ slot: 'footer-link' }),
|
90
|
+
__metadata("design:type", Array)
|
91
|
+
], InnerMixinClass.prototype, "footerLink", void 0);
|
92
|
+
__decorate([
|
93
|
+
queryAssignedElements({ slot: 'footer-button-primary' }),
|
94
|
+
__metadata("design:type", Array)
|
95
|
+
], InnerMixinClass.prototype, "footerButtonPrimary", void 0);
|
96
|
+
__decorate([
|
97
|
+
queryAssignedElements({ slot: 'footer-button-secondary' }),
|
98
|
+
__metadata("design:type", Array)
|
99
|
+
], InnerMixinClass.prototype, "footerButtonSecondary", void 0);
|
100
|
+
// Cast return type to your mixin's interface intersected with the superClass type
|
101
|
+
return InnerMixinClass;
|
102
|
+
};
|
@@ -9,7 +9,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
/* eslint-disable max-classes-per-file */
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
|
-
import { DEFAULTS as POPOVER_DEFAULTS } from '../../components/popover/popover.constants';
|
13
12
|
export const FocusTrapMixin = (superClass) => {
|
14
13
|
class FocusTrap extends superClass {
|
15
14
|
constructor(...args) {
|
@@ -19,12 +18,12 @@ export const FocusTrapMixin = (superClass) => {
|
|
19
18
|
* If true, focus will be restricted to the content within this component.
|
20
19
|
* @default false
|
21
20
|
*/
|
22
|
-
this.enabledFocusTrap =
|
21
|
+
this.enabledFocusTrap = false;
|
23
22
|
/**
|
24
|
-
* Prevent outside scrolling when
|
23
|
+
* Prevent outside scrolling when element is shown.
|
25
24
|
* @default false
|
26
25
|
*/
|
27
|
-
this.enabledPreventScroll =
|
26
|
+
this.enabledPreventScroll = false;
|
28
27
|
/** @internal */
|
29
28
|
this.focusTrapIndex = -1;
|
30
29
|
/** @internal */
|
@@ -199,7 +198,7 @@ export const FocusTrapMixin = (superClass) => {
|
|
199
198
|
/**
|
200
199
|
* Sets the initial focus within the container.
|
201
200
|
*
|
202
|
-
* @param prefferableElement - The index of the
|
201
|
+
* @param prefferableElement - The index of the preferable element to focus.
|
203
202
|
*/
|
204
203
|
setInitialFocus(prefferableElement = 0) {
|
205
204
|
if (this.focusableElements.length === 0)
|
package/package.json
CHANGED