@fluid-topics/ft-modal 1.3.22 → 1.3.23
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/README.md +7 -10
- package/build/FtModalMessages.d.ts +6 -0
- package/build/FtModalMessages.js +5 -0
- package/build/ft-modal.d.ts +22 -0
- package/build/ft-modal.js +110 -0
- package/build/ft-modal.light.js +335 -203
- package/build/ft-modal.min.js +307 -182
- package/build/ft-modal.properties.d.ts +7 -0
- package/build/ft-modal.properties.js +2 -0
- package/build/ft-modal.styles.d.ts +21 -0
- package/build/ft-modal.styles.js +110 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +5 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Modal for Design System
|
|
1
|
+
Modal for Client Design System
|
|
2
2
|
|
|
3
3
|
## Install
|
|
4
4
|
|
|
@@ -15,20 +15,17 @@ import "@fluid-topics/ft-modal"
|
|
|
15
15
|
|
|
16
16
|
function render() {
|
|
17
17
|
return html`
|
|
18
|
-
<
|
|
19
|
-
Small example
|
|
20
|
-
</ftds-button>
|
|
21
|
-
<ftds-modal heading="Modal title" id="example-modal">
|
|
18
|
+
<ft-modal buttonLabel="Open" heading="Modal title">
|
|
22
19
|
<ft-typography variant="${ FtDsModalBodyTypography }">
|
|
23
20
|
Modal content text
|
|
24
21
|
</ft-typography>
|
|
25
|
-
<
|
|
22
|
+
<ft-button slot="actions">
|
|
26
23
|
Button 1
|
|
27
|
-
</
|
|
28
|
-
<
|
|
24
|
+
</ft-button>
|
|
25
|
+
<ft-button slot="actions">
|
|
29
26
|
Button 2
|
|
30
|
-
</
|
|
31
|
-
</
|
|
27
|
+
</ft-button>
|
|
28
|
+
</ft-modal>
|
|
32
29
|
`
|
|
33
30
|
}
|
|
34
31
|
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefaultI18nMessages, I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
|
|
2
|
+
export interface FtModalMessages extends I18nMessages {
|
|
3
|
+
closeModal(): string;
|
|
4
|
+
}
|
|
5
|
+
export declare const ftModalContext: I18nMessageContext<FtModalMessages>;
|
|
6
|
+
export declare const defaultFtModalMessages: DefaultI18nMessages<FtModalMessages>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ElementDefinitionsMap, FtdsBase } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { DesignSystemSize } from "@fluid-topics/design-system-variables";
|
|
3
|
+
import { FtModalProperties } from "./ft-modal.properties";
|
|
4
|
+
declare const FtModal_base: typeof FtdsBase & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
5
|
+
export declare class FtModal extends FtModal_base implements FtModalProperties {
|
|
6
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
7
|
+
static styles: import("lit").CSSResult;
|
|
8
|
+
buttonLabel: string;
|
|
9
|
+
heading: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
private button;
|
|
12
|
+
private dialog;
|
|
13
|
+
size: DesignSystemSize;
|
|
14
|
+
constructor();
|
|
15
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
open(): void;
|
|
17
|
+
close(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
private onClose;
|
|
20
|
+
private onOverlayClick;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
import { html } from "lit";
|
|
8
|
+
import { property, query } from "lit/decorators.js";
|
|
9
|
+
import { FtdsBase } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
11
|
+
import { DesignSystemSize } from "@fluid-topics/design-system-variables";
|
|
12
|
+
import { FtIcon, FtIcons } from "@fluid-topics/ft-icon";
|
|
13
|
+
import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
|
|
14
|
+
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
15
|
+
import { modal } from "./FtDsModalMessages";
|
|
16
|
+
import { FtButton } from "@fluid-topics/ft-button";
|
|
17
|
+
import { ftmodalStyles } from "./ft-modal.styles";
|
|
18
|
+
import { when } from "lit/directives/when.js";
|
|
19
|
+
import { defaultFtModalMessages, ftModalContext } from "./FtModalMessages";
|
|
20
|
+
class FtModalCloseEvent extends Event {
|
|
21
|
+
constructor() {
|
|
22
|
+
super("close");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class FtModal extends withI18n(FtdsBase) {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.buttonLabel = "";
|
|
29
|
+
this.heading = "";
|
|
30
|
+
this.size = DesignSystemSize.small;
|
|
31
|
+
this.addI18nContext(ftModalContext, defaultFtModalMessages);
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
const classes = {
|
|
35
|
+
"ft-modal": true,
|
|
36
|
+
};
|
|
37
|
+
return html `
|
|
38
|
+
<div class="${classMap(classes)}" part="container">
|
|
39
|
+
<ft-button part="button" @click=${this.open} ariaHasPopup="dialog">${this.buttonLabel}</ft-button>
|
|
40
|
+
<dialog part="dialog" aria-labelledby="heading" @close=${this.onClose}>
|
|
41
|
+
<div part="overlay" @click=${this.onOverlayClick}></div>
|
|
42
|
+
<div part="inner-container">
|
|
43
|
+
<div part="header">
|
|
44
|
+
${when(!!this.icon, () => html `
|
|
45
|
+
<ft-icon part="icon" value="${this.icon}"></ft-icon>
|
|
46
|
+
`)}
|
|
47
|
+
<ft-typography id="heading" part="heading" role="heading" variant="${FtTypographyVariants.title}">
|
|
48
|
+
${this.heading}
|
|
49
|
+
</ft-typography>
|
|
50
|
+
<ft-button part="closing-button"
|
|
51
|
+
icon="${FtIcons.CLOSE}"
|
|
52
|
+
tertiary
|
|
53
|
+
label="${modal.messages.closeModal()}"
|
|
54
|
+
@click=${this.close}>
|
|
55
|
+
</ft-button>
|
|
56
|
+
</div>
|
|
57
|
+
<div part="body">
|
|
58
|
+
<div part="content">
|
|
59
|
+
<slot></slot>
|
|
60
|
+
</div>
|
|
61
|
+
<div part="actions">
|
|
62
|
+
<slot name="actions"></slot>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</dialog>
|
|
67
|
+
</div>
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
open() {
|
|
71
|
+
this.dialog.showModal();
|
|
72
|
+
}
|
|
73
|
+
close() {
|
|
74
|
+
this.dialog.close();
|
|
75
|
+
this.onClose();
|
|
76
|
+
}
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
super.disconnectedCallback();
|
|
79
|
+
this.close();
|
|
80
|
+
}
|
|
81
|
+
onClose() {
|
|
82
|
+
this.button.focus();
|
|
83
|
+
this.dispatchEvent(new FtModalCloseEvent());
|
|
84
|
+
}
|
|
85
|
+
onOverlayClick() {
|
|
86
|
+
this.close();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
FtModal.elementDefinitions = {
|
|
90
|
+
"ft-button": FtButton,
|
|
91
|
+
"ft-typography": FtTypography,
|
|
92
|
+
"ft-icon": FtIcon,
|
|
93
|
+
};
|
|
94
|
+
FtModal.styles = ftmodalStyles;
|
|
95
|
+
__decorate([
|
|
96
|
+
property()
|
|
97
|
+
], FtModal.prototype, "buttonLabel", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property()
|
|
100
|
+
], FtModal.prototype, "heading", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
property()
|
|
103
|
+
], FtModal.prototype, "icon", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
query("ft-button")
|
|
106
|
+
], FtModal.prototype, "button", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
query("dialog")
|
|
109
|
+
], FtModal.prototype, "dialog", void 0);
|
|
110
|
+
export { FtModal };
|