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