@fluid-topics/ft-confirm-button 1.1.121
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 +25 -0
- package/build/ConfirmButtonTestHelper.d.ts +6 -0
- package/build/ConfirmButtonTestHelper.js +9 -0
- package/build/ft-confirm-button.light.js +1218 -0
- package/build/ft-confirm-button.min.js +1440 -0
- package/build/ftds-confirm-button.d.ts +26 -0
- package/build/ftds-confirm-button.js +106 -0
- package/build/ftds-confirm-button.properties.d.ts +15 -0
- package/build/ftds-confirm-button.properties.js +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/package.json +29 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtIcons } from "@fluid-topics/ft-icon";
|
|
3
|
+
import { FtdsModalConfirm } from "@fluid-topics/ft-modal";
|
|
4
|
+
import { FtdsConfirmButtonProperties } from "./ftds-confirm-button.properties";
|
|
5
|
+
export declare class ConfirmEvent extends CustomEvent<void> {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export declare class FtdsConfirmButton extends FtLitElement implements FtdsConfirmButtonProperties {
|
|
9
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
10
|
+
static styles: import("lit").CSSResult;
|
|
11
|
+
primary: boolean;
|
|
12
|
+
secondary: boolean;
|
|
13
|
+
buttonText: string;
|
|
14
|
+
buttonIcon: FtIcons;
|
|
15
|
+
heading: string;
|
|
16
|
+
text: string;
|
|
17
|
+
confirmText: string;
|
|
18
|
+
cancelText: string;
|
|
19
|
+
confirmIcon: FtIcons;
|
|
20
|
+
cancelIcon: FtIcons;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
modal: FtdsModalConfirm;
|
|
24
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
25
|
+
private askConfirmation;
|
|
26
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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 { customElement, property, query } from "lit/decorators.js";
|
|
8
|
+
import { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { css, html } from "lit";
|
|
10
|
+
import { FtdsButton } from "@fluid-topics/ft-button";
|
|
11
|
+
import { FtIcons } from "@fluid-topics/ft-icon";
|
|
12
|
+
import { FtdsModalConfirm } from "@fluid-topics/ft-modal";
|
|
13
|
+
export class ConfirmEvent extends CustomEvent {
|
|
14
|
+
constructor() {
|
|
15
|
+
super("confirm");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
let FtdsConfirmButton = class FtdsConfirmButton extends FtLitElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.primary = false;
|
|
22
|
+
this.secondary = false;
|
|
23
|
+
this.buttonIcon = FtIcons.CLOSE;
|
|
24
|
+
this.heading = "";
|
|
25
|
+
this.text = "";
|
|
26
|
+
this.confirmText = "";
|
|
27
|
+
this.cancelText = "";
|
|
28
|
+
this.confirmIcon = FtIcons.CHECK;
|
|
29
|
+
this.cancelIcon = FtIcons.CLOSE;
|
|
30
|
+
this.loading = false;
|
|
31
|
+
this.disabled = false;
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return html `
|
|
35
|
+
<ftds-button icon=${this.buttonIcon}
|
|
36
|
+
?primary=${this.primary}
|
|
37
|
+
?secondary=${this.secondary}
|
|
38
|
+
?loading=${this.loading}
|
|
39
|
+
?disabled=${this.disabled}
|
|
40
|
+
@click=${() => this.askConfirmation()}>
|
|
41
|
+
${this.buttonText}
|
|
42
|
+
</ftds-button>
|
|
43
|
+
<ftds-modal-confirm heading=${this.heading}
|
|
44
|
+
text=${this.text}
|
|
45
|
+
confirmText=${this.confirmText}
|
|
46
|
+
confirmIcon=${this.confirmIcon}
|
|
47
|
+
cancelText=${this.cancelText}
|
|
48
|
+
cancelIcon=${this.cancelIcon}
|
|
49
|
+
></ftds-modal-confirm>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
async askConfirmation() {
|
|
53
|
+
const confirmation = await this.modal.askConfirmation();
|
|
54
|
+
if (confirmation) {
|
|
55
|
+
this.dispatchEvent(new ConfirmEvent());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
FtdsConfirmButton.elementDefinitions = {
|
|
60
|
+
"ftds-button": FtdsButton,
|
|
61
|
+
"ftds-modal-confirm": FtdsModalConfirm,
|
|
62
|
+
};
|
|
63
|
+
FtdsConfirmButton.styles = css ``;
|
|
64
|
+
__decorate([
|
|
65
|
+
property({ type: Boolean })
|
|
66
|
+
], FtdsConfirmButton.prototype, "primary", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ type: Boolean })
|
|
69
|
+
], FtdsConfirmButton.prototype, "secondary", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
property()
|
|
72
|
+
], FtdsConfirmButton.prototype, "buttonText", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
property()
|
|
75
|
+
], FtdsConfirmButton.prototype, "buttonIcon", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
property()
|
|
78
|
+
], FtdsConfirmButton.prototype, "heading", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
property()
|
|
81
|
+
], FtdsConfirmButton.prototype, "text", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
property()
|
|
84
|
+
], FtdsConfirmButton.prototype, "confirmText", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
property()
|
|
87
|
+
], FtdsConfirmButton.prototype, "cancelText", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
property()
|
|
90
|
+
], FtdsConfirmButton.prototype, "confirmIcon", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
property()
|
|
93
|
+
], FtdsConfirmButton.prototype, "cancelIcon", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
property({ type: Boolean })
|
|
96
|
+
], FtdsConfirmButton.prototype, "loading", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property({ type: Boolean })
|
|
99
|
+
], FtdsConfirmButton.prototype, "disabled", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
query("ftds-modal-confirm")
|
|
102
|
+
], FtdsConfirmButton.prototype, "modal", void 0);
|
|
103
|
+
FtdsConfirmButton = __decorate([
|
|
104
|
+
customElement("ftds-confirm-button")
|
|
105
|
+
], FtdsConfirmButton);
|
|
106
|
+
export { FtdsConfirmButton };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FtIcons } from "@fluid-topics/ft-icon";
|
|
2
|
+
export interface FtdsConfirmButtonProperties {
|
|
3
|
+
primary?: boolean;
|
|
4
|
+
secondary?: boolean;
|
|
5
|
+
buttonText: string;
|
|
6
|
+
buttonIcon?: FtIcons;
|
|
7
|
+
heading?: string;
|
|
8
|
+
text: string;
|
|
9
|
+
confirmText: string;
|
|
10
|
+
cancelText: string;
|
|
11
|
+
confirmIcon?: FtIcons;
|
|
12
|
+
cancelIcon?: FtIcons;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluid-topics/ft-confirm-button",
|
|
3
|
+
"version": "1.1.121",
|
|
4
|
+
"description": "A two step confirmation button",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Lit"
|
|
7
|
+
],
|
|
8
|
+
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"main": "build/index.js",
|
|
11
|
+
"web": "build/ft-confirm-button.min.js",
|
|
12
|
+
"typings": "build/index",
|
|
13
|
+
"files": [
|
|
14
|
+
"build/**/*.js",
|
|
15
|
+
"build/**/*.ts"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.1.121",
|
|
23
|
+
"lit": "3.1.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@fluid-topics/ft-wc-test-utils": "1.1.121"
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "4807539dff1eb761cde7a11bd52bb7cb197a114d"
|
|
29
|
+
}
|