@fluid-topics/ft-modal 2.2.36 → 2.2.38
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/build/ft-modal.d.ts +6 -7
- package/build/ft-modal.js +16 -10
- package/build/ft-modal.light.js +207 -205
- package/build/ft-modal.min.js +99 -96
- package/package.json +8 -8
package/build/ft-modal.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ElementDefinitionsMap
|
|
2
|
-
import {
|
|
1
|
+
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtLitElementWithI18n } from "@fluid-topics/ft-i18n";
|
|
3
3
|
import { FtModalProperties } from "./ft-modal.properties";
|
|
4
|
-
declare
|
|
5
|
-
export declare class FtModal extends FtModal_base implements FtModalProperties {
|
|
4
|
+
export declare class FtModal extends FtLitElementWithI18n implements FtModalProperties {
|
|
6
5
|
static elementDefinitions: ElementDefinitionsMap;
|
|
7
6
|
static styles: import("lit").CSSResult;
|
|
8
7
|
buttonLabel: string;
|
|
@@ -10,10 +9,11 @@ export declare class FtModal extends FtModal_base implements FtModalProperties {
|
|
|
10
9
|
heading: string;
|
|
11
10
|
icon?: string;
|
|
12
11
|
dialog?: HTMLDialogElement;
|
|
13
|
-
size: DesignSystemSize;
|
|
14
12
|
constructor();
|
|
13
|
+
protected setupI18nContext(): void;
|
|
14
|
+
protected getContainerClasses(): Record<string, boolean>;
|
|
15
15
|
protected render(): import("lit").TemplateResult<1>;
|
|
16
|
-
|
|
16
|
+
protected renderCloseButton(): import("lit").TemplateResult<1>;
|
|
17
17
|
protected onTriggerClick(e: MouseEvent): void;
|
|
18
18
|
protected elementToFocusOnClose?: HTMLElement;
|
|
19
19
|
private intersectionObserver;
|
|
@@ -25,4 +25,3 @@ export declare class FtModal extends FtModal_base implements FtModalProperties {
|
|
|
25
25
|
private onOverlayClick;
|
|
26
26
|
private onEscapePressed;
|
|
27
27
|
}
|
|
28
|
-
export {};
|
package/build/ft-modal.js
CHANGED
|
@@ -6,12 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing, } from "lit";
|
|
8
8
|
import { property, query, } from "lit/decorators.js";
|
|
9
|
-
import { focusTrap,
|
|
9
|
+
import { focusTrap, } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
11
|
-
import { DesignSystemSize } from "@fluid-topics/design-system-variables";
|
|
12
11
|
import { FtIcon, FtIcons, } from "@fluid-topics/ft-icon";
|
|
13
12
|
import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
14
|
-
import {
|
|
13
|
+
import { FtLitElementWithI18n } from "@fluid-topics/ft-i18n";
|
|
15
14
|
import { FtButton } from "@fluid-topics/ft-button";
|
|
16
15
|
import { ftmodalStyles } from "./ft-modal.styles";
|
|
17
16
|
import { when } from "lit/directives/when.js";
|
|
@@ -27,31 +26,38 @@ class FtModalOpenEvent extends Event {
|
|
|
27
26
|
super("open");
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
export class FtModal extends
|
|
29
|
+
export class FtModal extends FtLitElementWithI18n {
|
|
31
30
|
constructor() {
|
|
32
31
|
super();
|
|
33
32
|
this.buttonLabel = "";
|
|
34
33
|
this.heading = "";
|
|
35
|
-
this.size = DesignSystemSize.small;
|
|
36
34
|
this.intersectionObserver = new IntersectionObserver(() => {
|
|
37
35
|
if (this.dialog && !this.dialog.checkVisibility()) {
|
|
38
36
|
this.close();
|
|
39
37
|
}
|
|
40
38
|
});
|
|
39
|
+
this.setupI18nContext();
|
|
40
|
+
}
|
|
41
|
+
setupI18nContext() {
|
|
41
42
|
this.addI18nContext(ftModalContext, defaultFtModalMessages);
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
getContainerClasses() {
|
|
45
|
+
return {
|
|
45
46
|
"ft-modal": true,
|
|
46
47
|
};
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
47
50
|
return html `
|
|
48
|
-
<div class="${classMap(
|
|
51
|
+
<div class="${classMap(this.getContainerClasses())}" part="container">
|
|
49
52
|
<slot @click=${this.onTriggerClick} name="trigger">
|
|
50
53
|
<ft-button part="button" icon="${ifDefined(this.buttonIcon)}" label="${this.buttonLabel}" ariaHasPopup="dialog">
|
|
51
54
|
${when(this.buttonIcon, () => nothing, () => this.buttonLabel)}
|
|
52
55
|
</ft-button>
|
|
53
56
|
</slot>
|
|
54
|
-
<dialog part="dialog" popover="manual"
|
|
57
|
+
<dialog part="dialog" popover="manual"
|
|
58
|
+
aria-labelledby="heading"
|
|
59
|
+
aria-modal="true"
|
|
60
|
+
${focusTrap()}>
|
|
55
61
|
<div part="overlay" @click=${this.onOverlayClick}></div>
|
|
56
62
|
<div part="inner-container">
|
|
57
63
|
<div part="header">
|
|
@@ -92,7 +98,7 @@ export class FtModal extends withI18n(FtdsBase) {
|
|
|
92
98
|
open(elementToFocusOnClose) {
|
|
93
99
|
this.elementToFocusOnClose = elementToFocusOnClose;
|
|
94
100
|
if (this.dialog) {
|
|
95
|
-
this.dialog.showPopover();
|
|
101
|
+
this.dialog.showPopover({ source: elementToFocusOnClose });
|
|
96
102
|
this.intersectionObserver.observe(this.dialog);
|
|
97
103
|
this.dispatchEvent(new FtModalOpenEvent());
|
|
98
104
|
}
|