@fluid-topics/ft-file-button 2.0.21 → 2.0.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.
|
@@ -6,7 +6,8 @@ export declare class FileChangeEvent extends CustomEvent<{
|
|
|
6
6
|
}> {
|
|
7
7
|
constructor(file: File);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
declare const FtBaseFileButton_base: import("@fluid-topics/ft-wc-utils").FtdsBaseType<typeof FtLitElement>;
|
|
10
|
+
export declare class FtBaseFileButton extends FtBaseFileButton_base implements FtBaseFileButtonProperties {
|
|
10
11
|
static elementDefinitions: ElementDefinitionsMap;
|
|
11
12
|
disabled: boolean;
|
|
12
13
|
label: string;
|
|
@@ -16,8 +17,9 @@ export declare class FtBaseFileButton extends FtLitElement implements FtBaseFile
|
|
|
16
17
|
accept: string;
|
|
17
18
|
private input;
|
|
18
19
|
private button;
|
|
19
|
-
protected render(): import("lit-html").TemplateResult<1>;
|
|
20
|
-
private onFileChange;
|
|
21
20
|
focus(): void;
|
|
22
21
|
clear(): void;
|
|
22
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
23
|
+
private onFileChange;
|
|
23
24
|
}
|
|
25
|
+
export {};
|
|
@@ -5,14 +5,14 @@ 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, query } from "lit/decorators.js";
|
|
9
|
-
import { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
8
|
+
import { property, query, } from "lit/decorators.js";
|
|
9
|
+
import { FtLitElement, toFtdsBase, } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
export class FileChangeEvent extends CustomEvent {
|
|
11
11
|
constructor(file) {
|
|
12
12
|
super("change", { detail: { file } });
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
export class FtBaseFileButton extends FtLitElement {
|
|
15
|
+
export class FtBaseFileButton extends toFtdsBase(FtLitElement) {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.disabled = false;
|
|
@@ -21,15 +21,23 @@ export class FtBaseFileButton extends FtLitElement {
|
|
|
21
21
|
this.trailingIcon = false;
|
|
22
22
|
this.accept = "";
|
|
23
23
|
}
|
|
24
|
+
focus() {
|
|
25
|
+
this.button.focus();
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this.input.value = "";
|
|
29
|
+
}
|
|
24
30
|
render() {
|
|
25
31
|
return html `
|
|
26
32
|
<div class="ft-file-button">
|
|
27
33
|
<ft-or-ftds-button ?disabled=${this.disabled}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
label="${this.label}"
|
|
35
|
+
family="${this.family}"
|
|
36
|
+
size="${this.size}"
|
|
37
|
+
icon="${this.icon}"
|
|
38
|
+
.iconVariant=${this.iconVariant}
|
|
39
|
+
?trailingIcon=${this.trailingIcon}
|
|
40
|
+
@click=${() => this.input.click()}>
|
|
33
41
|
<slot></slot>
|
|
34
42
|
</ft-or-ftds-button>
|
|
35
43
|
<input class="ft-file-button--input"
|
|
@@ -41,17 +49,10 @@ export class FtBaseFileButton extends FtLitElement {
|
|
|
41
49
|
`;
|
|
42
50
|
}
|
|
43
51
|
onFileChange() {
|
|
44
|
-
|
|
45
|
-
if (((_a = this.input.files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
52
|
+
if (this.input.files.length > 0) {
|
|
46
53
|
this.dispatchEvent(new FileChangeEvent(this.input.files.item(0)));
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
|
-
focus() {
|
|
50
|
-
this.button.focus();
|
|
51
|
-
}
|
|
52
|
-
clear() {
|
|
53
|
-
this.input.value = "";
|
|
54
|
-
}
|
|
55
56
|
}
|
|
56
57
|
FtBaseFileButton.elementDefinitions = {};
|
|
57
58
|
__decorate([
|