@fluid-topics/ft-drawer 2.0.14 → 2.0.16
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-drawer.d.ts +2 -0
- package/build/ft-drawer.js +15 -6
- package/build/ft-drawer.light.js +174 -174
- package/build/ft-drawer.min.js +183 -183
- package/package.json +4 -4
package/build/ft-drawer.d.ts
CHANGED
|
@@ -16,8 +16,10 @@ export declare class FtDrawer extends FtDrawer_base implements FtDrawerPropertie
|
|
|
16
16
|
private intersectionObserver;
|
|
17
17
|
open(elementToFocusOnClose?: HTMLElement): void;
|
|
18
18
|
close(): void;
|
|
19
|
+
connectedCallback(): void;
|
|
19
20
|
disconnectedCallback(): void;
|
|
20
21
|
private onClose;
|
|
21
22
|
private onOverlayClick;
|
|
23
|
+
private onEscapePressed;
|
|
22
24
|
}
|
|
23
25
|
export {};
|
package/build/ft-drawer.js
CHANGED
|
@@ -6,7 +6,7 @@ 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 { FtdsBase, } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { focusTrap, FtdsBase, } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
11
11
|
import { FtIcons } from "@fluid-topics/ft-icon";
|
|
12
12
|
import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
@@ -26,7 +26,7 @@ class FtDrawerOpenEvent extends Event {
|
|
|
26
26
|
super("open");
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
class FtDrawer extends withI18n(FtdsBase) {
|
|
29
|
+
export class FtDrawer extends withI18n(FtdsBase) {
|
|
30
30
|
constructor() {
|
|
31
31
|
super();
|
|
32
32
|
this.buttonLabel = "";
|
|
@@ -49,7 +49,7 @@ class FtDrawer extends withI18n(FtdsBase) {
|
|
|
49
49
|
${when(this.buttonIcon, () => nothing, () => this.buttonLabel)}
|
|
50
50
|
</ft-button>
|
|
51
51
|
</slot>
|
|
52
|
-
<dialog part="dialog" aria-labelledby="heading" @close=${this.onClose}>
|
|
52
|
+
<dialog part="dialog" popover="manual" aria-labelledby="heading" @close=${this.onClose} ${focusTrap()}>
|
|
53
53
|
<div part="overlay" @click=${this.onOverlayClick}></div>
|
|
54
54
|
<div part="inner-container">
|
|
55
55
|
<div part="header">
|
|
@@ -87,18 +87,23 @@ class FtDrawer extends withI18n(FtdsBase) {
|
|
|
87
87
|
open(elementToFocusOnClose) {
|
|
88
88
|
this.elementToFocusOnClose = elementToFocusOnClose;
|
|
89
89
|
if (this.dialog) {
|
|
90
|
-
this.dialog.
|
|
90
|
+
this.dialog.showPopover();
|
|
91
91
|
this.intersectionObserver.observe(this.dialog);
|
|
92
92
|
this.dispatchEvent(new FtDrawerOpenEvent());
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
close() {
|
|
96
96
|
var _a;
|
|
97
|
-
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.
|
|
97
|
+
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.hidePopover();
|
|
98
98
|
this.onClose();
|
|
99
99
|
}
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
super.connectedCallback();
|
|
102
|
+
this.addEventListener("keydown", this.onEscapePressed);
|
|
103
|
+
}
|
|
100
104
|
disconnectedCallback() {
|
|
101
105
|
super.disconnectedCallback();
|
|
106
|
+
this.removeEventListener("keydown", this.onEscapePressed);
|
|
102
107
|
this.close();
|
|
103
108
|
}
|
|
104
109
|
onClose() {
|
|
@@ -110,6 +115,11 @@ class FtDrawer extends withI18n(FtdsBase) {
|
|
|
110
115
|
onOverlayClick() {
|
|
111
116
|
this.close();
|
|
112
117
|
}
|
|
118
|
+
onEscapePressed(e) {
|
|
119
|
+
if (e.key === "Escape") {
|
|
120
|
+
this.close();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
113
123
|
}
|
|
114
124
|
FtDrawer.elementDefinitions = {
|
|
115
125
|
"ft-button": FtButton,
|
|
@@ -128,4 +138,3 @@ __decorate([
|
|
|
128
138
|
__decorate([
|
|
129
139
|
query("dialog")
|
|
130
140
|
], FtDrawer.prototype, "dialog", void 0);
|
|
131
|
-
export { FtDrawer };
|