@fluid-topics/ft-dialog 0.3.54 → 0.3.56
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 -3
- package/build/ft-dialog.js +28 -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,13 @@ 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
|
-
private
|
|
20
|
+
private onClickOutside;
|
|
22
21
|
}
|
|
23
22
|
//# 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,11 @@ 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
|
+
};
|
|
24
29
|
}
|
|
25
30
|
render() {
|
|
26
31
|
if (!this.opened) {
|
|
@@ -28,41 +33,43 @@ export class FtDialog extends FtLitElement {
|
|
|
28
33
|
}
|
|
29
34
|
return html `
|
|
30
35
|
<div class="ft-dialog">
|
|
31
|
-
<div class="ft-dialog-overlay" @click="${() => this.
|
|
36
|
+
<div class="ft-dialog-overlay" @click="${() => this.onClickOutside()}"></div>
|
|
32
37
|
<div class="ft-dialog-wrapper">
|
|
33
38
|
${this.heading ? html `
|
|
34
39
|
<div class="ft-dialog-heading">
|
|
35
40
|
${this.icon ? html `
|
|
36
|
-
|
|
41
|
+
<ft-icon variant="material">${this.icon}</ft-icon>
|
|
42
|
+
` : undefined}
|
|
37
43
|
<ft-typography element="span" variant="title">${this.heading}</ft-typography>
|
|
38
44
|
${this.closable ? html `
|
|
39
|
-
|
|
45
|
+
<ft-button round icon="close" @click=${this.close}></ft-button>
|
|
46
|
+
` : undefined}
|
|
40
47
|
</div>
|
|
41
48
|
` : null}
|
|
42
49
|
<div class="ft-dialog-content">
|
|
43
50
|
<slot></slot>
|
|
44
51
|
</div>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
<slot name="buttons"
|
|
53
|
+
class="ft-dialog-buttons ${this.buttons.length > 0 ? "" : "ft-dialog-no-buttons"}"
|
|
54
|
+
@slotchange=${() => this.requestUpdate()}
|
|
55
|
+
></slot>
|
|
48
56
|
</div>
|
|
49
57
|
</div>
|
|
50
58
|
`;
|
|
51
59
|
}
|
|
52
60
|
updated(properties) {
|
|
53
61
|
if (properties.has("opened")) {
|
|
54
|
-
|
|
55
|
-
this.
|
|
62
|
+
this.dispatchEvent(new CustomEvent("opened-changed", { detail: { opened: this.opened } }));
|
|
63
|
+
if (this.opened) {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
document.addEventListener("keydown", this.watchEscapeKey);
|
|
66
|
+
}, 0);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
document.removeEventListener("keydown", this.watchEscapeKey);
|
|
70
|
+
}
|
|
56
71
|
}
|
|
57
72
|
}
|
|
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
73
|
close() {
|
|
67
74
|
if (this.beforeClose()) {
|
|
68
75
|
this.opened = false;
|
|
@@ -71,12 +78,7 @@ export class FtDialog extends FtLitElement {
|
|
|
71
78
|
open() {
|
|
72
79
|
this.opened = true;
|
|
73
80
|
}
|
|
74
|
-
|
|
75
|
-
if (event.key === "Escape" && this.closeOnEsc) {
|
|
76
|
-
this.close();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
watchClickOutside() {
|
|
81
|
+
onClickOutside() {
|
|
80
82
|
if (this.closeOnClickOutside) {
|
|
81
83
|
this.close();
|
|
82
84
|
}
|
|
@@ -115,4 +117,7 @@ __decorate([
|
|
|
115
117
|
__decorate([
|
|
116
118
|
property({ type: String })
|
|
117
119
|
], FtDialog.prototype, "icon", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
queryAssignedElements({ slot: "buttons" })
|
|
122
|
+
], FtDialog.prototype, "buttons", void 0);
|
|
118
123
|
//# sourceMappingURL=ft-dialog.js.map
|