@fluid-topics/ft-dialog 0.3.53 → 0.3.55
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-dialog.css.js +27 -20
- package/build/ft-dialog.d.ts +2 -2
- package/build/ft-dialog.js +35 -23
- package/build/ft-dialog.light.js +74 -74
- package/build/ft-dialog.min.js +232 -222
- package/package.json +6 -6
package/build/ft-dialog.css.js
CHANGED
|
@@ -51,6 +51,7 @@ export const styles = css `
|
|
|
51
51
|
position: fixed;
|
|
52
52
|
display: flex;
|
|
53
53
|
flex-direction: column;
|
|
54
|
+
gap: ${FtDialogCssVariables.paddingButtons};
|
|
54
55
|
|
|
55
56
|
width: ${FtDialogCssVariables.width};
|
|
56
57
|
height: ${FtDialogCssVariables.height};
|
|
@@ -59,8 +60,7 @@ export const styles = css `
|
|
|
59
60
|
min-width: ${FtDialogCssVariables.minWidth};
|
|
60
61
|
|
|
61
62
|
padding-top: ${FtDialogCssVariables.paddingTop};
|
|
62
|
-
padding-
|
|
63
|
-
padding-left: ${FtDialogCssVariables.paddingSide};
|
|
63
|
+
padding-bottom: ${FtDialogCssVariables.paddingTop};
|
|
64
64
|
|
|
65
65
|
background-color: ${FtDialogCssVariables.colorSurface};
|
|
66
66
|
|
|
@@ -68,45 +68,52 @@ export const styles = css `
|
|
|
68
68
|
box-shadow: ${FtDialogCssVariables.elevation24};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
.ft-dialog-wrapper > * {
|
|
72
|
+
padding-right: ${FtDialogCssVariables.paddingSide};
|
|
73
|
+
padding-left: ${FtDialogCssVariables.paddingSide};
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
.ft-dialog-content {
|
|
72
77
|
flex-grow: 2;
|
|
73
|
-
overflow: auto;
|
|
78
|
+
overflow-y: auto;
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
.ft-dialog-heading {
|
|
77
|
-
text-overflow: ellipsis;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
white-space: nowrap;
|
|
80
82
|
flex-shrink: 0;
|
|
81
83
|
|
|
82
84
|
display: flex;
|
|
83
85
|
align-items: center;
|
|
84
|
-
margin-bottom: 20px;
|
|
85
86
|
gap: 8px;
|
|
86
87
|
|
|
87
88
|
color: ${FtDialogCssVariables.headingColor};
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
.ft-dialog-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
slot[name=buttons] {
|
|
95
|
-
display: flex;
|
|
96
|
-
align-items: center;
|
|
97
|
-
justify-content: flex-end;
|
|
98
|
-
gap: 8px;
|
|
91
|
+
.ft-dialog-heading * {
|
|
92
|
+
flex-shrink: 0;
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
.ft-dialog-heading ft-typography {
|
|
96
|
+
flex-grow: 1;
|
|
97
|
+
flex-shrink: 1;
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
white-space: nowrap;
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
.ft-dialog-heading ft-button {
|
|
107
|
-
margin-left: auto;
|
|
108
104
|
${setVariable(FtButtonCssVariables.color, FtDialogCssVariables.headingColor)};
|
|
109
105
|
}
|
|
110
106
|
|
|
107
|
+
.ft-dialog-buttons.ft-dialog-no-buttons {
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ft-dialog-buttons {
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: flex-end;
|
|
115
|
+
gap: 8px;
|
|
116
|
+
}
|
|
117
|
+
|
|
111
118
|
`;
|
|
112
119
|
//# sourceMappingURL=ft-dialog.css.js.map
|
package/build/ft-dialog.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export declare class FtDialog extends FtLitElement implements FtDialogProperties
|
|
|
10
10
|
beforeClose: () => boolean;
|
|
11
11
|
heading: string;
|
|
12
12
|
icon: string;
|
|
13
|
+
buttons: Array<HTMLElement>;
|
|
13
14
|
static styles: import("lit").CSSResult;
|
|
14
15
|
protected render(): import("lit-html").TemplateResult<1> | null;
|
|
15
16
|
updated(properties: PropertyValues<FtDialog>): void;
|
|
16
|
-
connectedCallback(): void;
|
|
17
|
-
disconnectedCallback(): void;
|
|
18
17
|
close(): void;
|
|
19
18
|
open(): void;
|
|
20
19
|
private watchEscapeKey;
|
|
21
20
|
private watchClickOutside;
|
|
21
|
+
private onClickOutside;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=ft-dialog.d.ts.map
|
package/build/ft-dialog.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html } from "lit";
|
|
8
|
-
import { property, } from "lit/decorators.js";
|
|
8
|
+
import { property, queryAssignedElements, } from "lit/decorators.js";
|
|
9
9
|
import { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
11
11
|
import { FtIcon } from "@fluid-topics/ft-icon";
|
|
@@ -21,6 +21,16 @@ export class FtDialog extends FtLitElement {
|
|
|
21
21
|
this.beforeClose = () => true;
|
|
22
22
|
this.heading = "";
|
|
23
23
|
this.icon = "";
|
|
24
|
+
this.watchEscapeKey = (event) => {
|
|
25
|
+
if (event.key === "Escape" && this.closeOnEsc) {
|
|
26
|
+
this.close();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this.watchClickOutside = (event) => {
|
|
30
|
+
if (this.closeOnClickOutside && !event.composedPath().includes(this)) {
|
|
31
|
+
this.close();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
24
34
|
}
|
|
25
35
|
render() {
|
|
26
36
|
if (!this.opened) {
|
|
@@ -28,41 +38,45 @@ export class FtDialog extends FtLitElement {
|
|
|
28
38
|
}
|
|
29
39
|
return html `
|
|
30
40
|
<div class="ft-dialog">
|
|
31
|
-
<div class="ft-dialog-overlay" @click="${() => this.
|
|
41
|
+
<div class="ft-dialog-overlay" @click="${() => this.onClickOutside()}"></div>
|
|
32
42
|
<div class="ft-dialog-wrapper">
|
|
33
43
|
${this.heading ? html `
|
|
34
44
|
<div class="ft-dialog-heading">
|
|
35
45
|
${this.icon ? html `
|
|
36
|
-
<ft-icon variant="material">${this.icon}</ft-icon
|
|
46
|
+
<ft-icon variant="material">${this.icon}</ft-icon>
|
|
47
|
+
` : undefined}
|
|
37
48
|
<ft-typography element="span" variant="title">${this.heading}</ft-typography>
|
|
38
49
|
${this.closable ? html `
|
|
39
|
-
<ft-button icon="close" @click=${this.close}></ft-button
|
|
50
|
+
<ft-button round icon="close" @click=${this.close}></ft-button>
|
|
51
|
+
` : undefined}
|
|
40
52
|
</div>
|
|
41
53
|
` : null}
|
|
42
54
|
<div class="ft-dialog-content">
|
|
43
55
|
<slot></slot>
|
|
44
56
|
</div>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
<slot name="buttons"
|
|
58
|
+
class="ft-dialog-buttons ${this.buttons.length > 0 ? "" : "ft-dialog-no-buttons"}"
|
|
59
|
+
@slotchange=${() => this.requestUpdate()}
|
|
60
|
+
></slot>
|
|
48
61
|
</div>
|
|
49
62
|
</div>
|
|
50
63
|
`;
|
|
51
64
|
}
|
|
52
65
|
updated(properties) {
|
|
53
66
|
if (properties.has("opened")) {
|
|
54
|
-
|
|
55
|
-
this.
|
|
67
|
+
this.dispatchEvent(new CustomEvent("opened-changed", { detail: { opened: this.opened } }));
|
|
68
|
+
if (this.opened) {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
document.addEventListener("keydown", this.watchEscapeKey);
|
|
71
|
+
document.addEventListener("click", this.watchClickOutside);
|
|
72
|
+
}, 0);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
document.removeEventListener("keydown", this.watchEscapeKey);
|
|
76
|
+
document.removeEventListener("click", this.watchClickOutside);
|
|
77
|
+
}
|
|
56
78
|
}
|
|
57
79
|
}
|
|
58
|
-
connectedCallback() {
|
|
59
|
-
super.connectedCallback();
|
|
60
|
-
document.addEventListener("keydown", this.watchEscapeKey.bind(this));
|
|
61
|
-
}
|
|
62
|
-
disconnectedCallback() {
|
|
63
|
-
super.disconnectedCallback();
|
|
64
|
-
document.removeEventListener("keydown", this.watchEscapeKey.bind(this));
|
|
65
|
-
}
|
|
66
80
|
close() {
|
|
67
81
|
if (this.beforeClose()) {
|
|
68
82
|
this.opened = false;
|
|
@@ -71,12 +85,7 @@ export class FtDialog extends FtLitElement {
|
|
|
71
85
|
open() {
|
|
72
86
|
this.opened = true;
|
|
73
87
|
}
|
|
74
|
-
|
|
75
|
-
if (event.key === "Escape" && this.closeOnEsc) {
|
|
76
|
-
this.close();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
watchClickOutside() {
|
|
88
|
+
onClickOutside() {
|
|
80
89
|
if (this.closeOnClickOutside) {
|
|
81
90
|
this.close();
|
|
82
91
|
}
|
|
@@ -115,4 +124,7 @@ __decorate([
|
|
|
115
124
|
__decorate([
|
|
116
125
|
property({ type: String })
|
|
117
126
|
], FtDialog.prototype, "icon", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
queryAssignedElements({ slot: "buttons" })
|
|
129
|
+
], FtDialog.prototype, "buttons", void 0);
|
|
118
130
|
//# sourceMappingURL=ft-dialog.js.map
|