@fluid-topics/ft-file-button 1.2.73 → 1.3.1
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-base-file-button.d.ts +23 -0
- package/build/ft-base-file-button.js +81 -0
- package/build/{ft-file-button.properties.d.ts → ft-base-file-button.properties.d.ts} +1 -1
- package/build/ft-file-button.d.ts +3 -21
- package/build/ft-file-button.js +3 -79
- package/build/ft-file-button.light.js +109 -109
- package/build/ft-file-button.min.js +115 -115
- package/build/ftds-file-button.d.ts +6 -0
- package/build/ftds-file-button.js +10 -0
- package/build/ftds-file-button.styles.d.ts +1 -0
- package/build/ftds-file-button.styles.js +3 -0
- package/build/index.d.ts +3 -1
- package/build/index.js +5 -1
- package/package.json +4 -4
- /package/build/{ft-file-button.properties.js → ft-base-file-button.properties.js} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtBaseFileButtonProperties } from "./ft-base-file-button.properties";
|
|
3
|
+
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
4
|
+
export declare class FileChangeEvent extends CustomEvent<{
|
|
5
|
+
file: File;
|
|
6
|
+
}> {
|
|
7
|
+
constructor(file: File);
|
|
8
|
+
}
|
|
9
|
+
export declare class FtBaseFileButton extends FtLitElement implements FtBaseFileButtonProperties {
|
|
10
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
label: string;
|
|
13
|
+
icon?: string;
|
|
14
|
+
iconVariant?: FtIconVariants;
|
|
15
|
+
trailingIcon: boolean;
|
|
16
|
+
accept: string;
|
|
17
|
+
private input;
|
|
18
|
+
private button;
|
|
19
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
private onFileChange;
|
|
21
|
+
focus(): void;
|
|
22
|
+
clear(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
export class FileChangeEvent extends CustomEvent {
|
|
11
|
+
constructor(file) {
|
|
12
|
+
super("change", { detail: { file } });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class FtBaseFileButton extends FtLitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.disabled = false;
|
|
19
|
+
this.label = "";
|
|
20
|
+
this.icon = undefined;
|
|
21
|
+
this.trailingIcon = false;
|
|
22
|
+
this.accept = "";
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `
|
|
26
|
+
<div class="ft-file-button">
|
|
27
|
+
<ft-or-ftds-button ?disabled=${this.disabled}
|
|
28
|
+
label="${this.label}"
|
|
29
|
+
icon="${this.icon}"
|
|
30
|
+
.iconVariant="${this.iconVariant}"
|
|
31
|
+
?trailingIcon=${this.trailingIcon}
|
|
32
|
+
@click=${() => this.input.click()}>
|
|
33
|
+
<slot></slot>
|
|
34
|
+
</ft-or-ftds-button>
|
|
35
|
+
<input class="ft-file-button--input"
|
|
36
|
+
type="file"
|
|
37
|
+
accept="${this.accept}"
|
|
38
|
+
@change=${this.onFileChange}
|
|
39
|
+
hidden/>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
onFileChange() {
|
|
44
|
+
var _a;
|
|
45
|
+
if (((_a = this.input.files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
46
|
+
this.dispatchEvent(new FileChangeEvent(this.input.files.item(0)));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
focus() {
|
|
50
|
+
this.button.focus();
|
|
51
|
+
}
|
|
52
|
+
clear() {
|
|
53
|
+
this.input.value = "";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
FtBaseFileButton.elementDefinitions = {};
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: Boolean })
|
|
59
|
+
], FtBaseFileButton.prototype, "disabled", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
property()
|
|
62
|
+
], FtBaseFileButton.prototype, "label", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
property()
|
|
65
|
+
], FtBaseFileButton.prototype, "icon", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
property()
|
|
68
|
+
], FtBaseFileButton.prototype, "iconVariant", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Boolean })
|
|
71
|
+
], FtBaseFileButton.prototype, "trailingIcon", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property()
|
|
74
|
+
], FtBaseFileButton.prototype, "accept", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
query(".ft-file-button--input")
|
|
77
|
+
], FtBaseFileButton.prototype, "input", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
query("ft-or-ftds-button")
|
|
80
|
+
], FtBaseFileButton.prototype, "button", void 0);
|
|
81
|
+
export { FtBaseFileButton };
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare class FileChangeEvent extends CustomEvent<{
|
|
5
|
-
file: File;
|
|
6
|
-
}> {
|
|
7
|
-
constructor(file: File);
|
|
8
|
-
}
|
|
9
|
-
export declare class FtFileButton extends FtLitElement implements FtFileButtonProperties {
|
|
1
|
+
import { FtBaseFileButton } from "./ft-base-file-button";
|
|
2
|
+
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
export declare class FtFileButton extends FtBaseFileButton {
|
|
10
4
|
static elementDefinitions: ElementDefinitionsMap;
|
|
11
5
|
static styles: import("lit").CSSResult;
|
|
12
|
-
disabled: boolean;
|
|
13
|
-
label: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
iconVariant?: FtIconVariants;
|
|
16
|
-
trailingIcon: boolean;
|
|
17
|
-
accept: string;
|
|
18
|
-
private input;
|
|
19
|
-
private button;
|
|
20
|
-
protected render(): import("lit-html").TemplateResult<1>;
|
|
21
|
-
private onFileChange;
|
|
22
|
-
focus(): void;
|
|
23
|
-
clear(): void;
|
|
24
6
|
}
|
package/build/ft-file-button.js
CHANGED
|
@@ -1,86 +1,10 @@
|
|
|
1
|
-
|
|
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 { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
1
|
+
import { FtBaseFileButton } from "./ft-base-file-button";
|
|
10
2
|
import { FtButton } from "@fluid-topics/ft-button";
|
|
11
3
|
import { styles } from "./ft-file-button.styles";
|
|
12
|
-
|
|
13
|
-
constructor(file) {
|
|
14
|
-
super("change", { detail: { file } });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
class FtFileButton extends FtLitElement {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.disabled = false;
|
|
21
|
-
this.label = "";
|
|
22
|
-
this.icon = undefined;
|
|
23
|
-
this.trailingIcon = false;
|
|
24
|
-
this.accept = "";
|
|
25
|
-
}
|
|
26
|
-
render() {
|
|
27
|
-
return html `
|
|
28
|
-
<div class="ft-file-button">
|
|
29
|
-
<ft-button ?disabled=${this.disabled}
|
|
30
|
-
label="${this.label}"
|
|
31
|
-
icon="${this.icon}"
|
|
32
|
-
.iconVariant="${this.iconVariant}"
|
|
33
|
-
?trailingIcon=${this.trailingIcon}
|
|
34
|
-
@click=${() => this.input.click()}>
|
|
35
|
-
<slot></slot>
|
|
36
|
-
</ft-button>
|
|
37
|
-
<input class="ft-file-button--input"
|
|
38
|
-
type="file"
|
|
39
|
-
accept="${this.accept}"
|
|
40
|
-
@change=${this.onFileChange}
|
|
41
|
-
hidden/>
|
|
42
|
-
</div>
|
|
43
|
-
`;
|
|
44
|
-
}
|
|
45
|
-
onFileChange() {
|
|
46
|
-
var _a;
|
|
47
|
-
if (((_a = this.input.files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
48
|
-
this.dispatchEvent(new FileChangeEvent(this.input.files.item(0)));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
focus() {
|
|
52
|
-
this.button.focus();
|
|
53
|
-
}
|
|
54
|
-
clear() {
|
|
55
|
-
this.input.value = "";
|
|
56
|
-
}
|
|
4
|
+
class FtFileButton extends FtBaseFileButton {
|
|
57
5
|
}
|
|
58
6
|
FtFileButton.elementDefinitions = {
|
|
59
|
-
"ft-button": FtButton,
|
|
7
|
+
"ft-or-ftds-button": FtButton,
|
|
60
8
|
};
|
|
61
9
|
FtFileButton.styles = styles;
|
|
62
|
-
__decorate([
|
|
63
|
-
property({ type: Boolean })
|
|
64
|
-
], FtFileButton.prototype, "disabled", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
property()
|
|
67
|
-
], FtFileButton.prototype, "label", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
property()
|
|
70
|
-
], FtFileButton.prototype, "icon", void 0);
|
|
71
|
-
__decorate([
|
|
72
|
-
property()
|
|
73
|
-
], FtFileButton.prototype, "iconVariant", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
property({ type: Boolean })
|
|
76
|
-
], FtFileButton.prototype, "trailingIcon", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
property()
|
|
79
|
-
], FtFileButton.prototype, "accept", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
query(".ft-file-button--input")
|
|
82
|
-
], FtFileButton.prototype, "input", void 0);
|
|
83
|
-
__decorate([
|
|
84
|
-
query("ft-button")
|
|
85
|
-
], FtFileButton.prototype, "button", void 0);
|
|
86
10
|
export { FtFileButton };
|