@fluid-topics/ft-file-drop 0.1.15 → 0.1.18

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,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { css, html } from "lit";
8
8
  import { property, state } from "lit/decorators.js";
9
- import { customElement, designSystemVariables, FtCssVariable, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
9
+ import { designSystemVariables, FtCssVariable, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
10
10
  import { classMap } from "lit/directives/class-map.js";
11
11
  import { matchAccept } from "./match-accept";
12
12
  import { FtChip, FtChipCssVariables } from "@fluid-topics/ft-chip";
@@ -26,7 +26,7 @@ export class FileDropEvent extends CustomEvent {
26
26
  super("file-drop", { detail: { file } });
27
27
  }
28
28
  }
29
- let FtFileDrop = class FtFileDrop extends FtLitElement {
29
+ export class FtFileDrop extends FtLitElement {
30
30
  constructor() {
31
31
  super(...arguments);
32
32
  this.dropHint = "Drop your file here";
@@ -36,89 +36,7 @@ let FtFileDrop = class FtFileDrop extends FtLitElement {
36
36
  this.dragging = false;
37
37
  this.fileError = false;
38
38
  }
39
- // language=CSS
40
- getStyles() {
41
- return css `
42
- :host {
43
- display: block;
44
- position: relative;
45
- }
46
-
47
- #container {
48
- position: absolute;
49
- inset: 0;
50
- border: dashed ${FtFileDropCssVariables.borderWidth} ${FtFileDropCssVariables.borderColor};
51
- border-radius: ${FtFileDropCssVariables.borderRadius};
52
- }
53
-
54
- #container.visible {
55
- border-color: ${FtFileDropCssVariables.visibleBorderColor}
56
- }
57
-
58
- #container.dragging {
59
- border-color: ${FtFileDropCssVariables.activeBorderColor}
60
- }
61
-
62
- slot {
63
- position: absolute;
64
- inset: 0;
65
- display: block;
66
- overflow: auto;
67
- }
68
-
69
- #overlay {
70
- display: none;
71
- position: absolute;
72
- inset: 0;
73
- z-index: ${FtFileDropCssVariables.zIndex};
74
- }
75
-
76
- #container.dragging #overlay {
77
- display: block;
78
- }
79
-
80
- #overlay-background {
81
- z-index: 1;
82
- position: absolute;
83
- inset: 0;
84
- background-color: ${FtFileDropCssVariables.activeBorderColor};
85
- opacity: 0.20;
86
- border-radius: ${FtFileDropCssVariables.borderRadius};
87
- }
88
-
89
- #overlay-drop {
90
- z-index: 2;
91
- position: absolute;
92
- inset: 0;
93
- }
94
-
95
- #overlay-content {
96
- z-index: 1;
97
- position: absolute;
98
- inset: 0;
99
- display: flex;
100
- align-items: flex-end;
101
- justify-content: center;
102
- }
103
-
104
- #overlay-content ft-chip {
105
- margin-bottom: 10%;
106
- ${setVariable(FtChipCssVariables.color, FtFileDropCssVariables.hintColor)};
107
- ${setVariable(FtChipCssVariables.iconSize, "32px")};
108
- ${setVariable(FtChipCssVariables.colorOutline, "transparent")};
109
- }
110
-
111
- #overlay-content xft-chip[icon=error] {
112
- ${setVariable(FtChipCssVariables.color, FtFileDropCssVariables.errorColor)};
113
- ${setVariable(FtChipCssVariables.backgroundColor, FtFileDropCssVariables.hintBackgroundColor)};
114
- }
115
-
116
- [hidden] {
117
- display: none;
118
- }
119
- `;
120
- }
121
- getTemplate() {
39
+ render() {
122
40
  let contentClasses = {
123
41
  dragging: this.dragging,
124
42
  visible: this.visible,
@@ -171,10 +89,90 @@ let FtFileDrop = class FtFileDrop extends FtLitElement {
171
89
  }
172
90
  }
173
91
  }
174
- };
92
+ }
175
93
  FtFileDrop.elementDefinitions = {
176
94
  "ft-chip": FtChip,
177
95
  };
96
+ // language=CSS
97
+ FtFileDrop.styles = css `
98
+ :host {
99
+ display: block;
100
+ position: relative;
101
+ }
102
+
103
+ #container {
104
+ position: absolute;
105
+ inset: 0;
106
+ border: dashed ${FtFileDropCssVariables.borderWidth} ${FtFileDropCssVariables.borderColor};
107
+ border-radius: ${FtFileDropCssVariables.borderRadius};
108
+ }
109
+
110
+ #container.visible {
111
+ border-color: ${FtFileDropCssVariables.visibleBorderColor}
112
+ }
113
+
114
+ #container.dragging {
115
+ border-color: ${FtFileDropCssVariables.activeBorderColor}
116
+ }
117
+
118
+ slot {
119
+ position: absolute;
120
+ inset: 0;
121
+ display: block;
122
+ overflow: auto;
123
+ }
124
+
125
+ #overlay {
126
+ display: none;
127
+ position: absolute;
128
+ inset: 0;
129
+ z-index: ${FtFileDropCssVariables.zIndex};
130
+ }
131
+
132
+ #container.dragging #overlay {
133
+ display: block;
134
+ }
135
+
136
+ #overlay-background {
137
+ z-index: 1;
138
+ position: absolute;
139
+ inset: 0;
140
+ background-color: ${FtFileDropCssVariables.activeBorderColor};
141
+ opacity: 0.20;
142
+ border-radius: ${FtFileDropCssVariables.borderRadius};
143
+ }
144
+
145
+ #overlay-drop {
146
+ z-index: 2;
147
+ position: absolute;
148
+ inset: 0;
149
+ }
150
+
151
+ #overlay-content {
152
+ z-index: 1;
153
+ position: absolute;
154
+ inset: 0;
155
+ display: flex;
156
+ align-items: flex-end;
157
+ justify-content: center;
158
+ }
159
+
160
+ #overlay-content ft-chip {
161
+ margin-bottom: 10%;
162
+ ${setVariable(FtChipCssVariables.color, FtFileDropCssVariables.hintColor)};
163
+ ${setVariable(FtChipCssVariables.iconSize, "32px")};
164
+ ${setVariable(FtChipCssVariables.colorOutline, "transparent")};
165
+ }
166
+
167
+ #overlay-content xft-chip[icon=error] {
168
+ ${setVariable(FtChipCssVariables.color, FtFileDropCssVariables.errorColor)};
169
+ ${setVariable(FtChipCssVariables.backgroundColor, FtFileDropCssVariables.hintBackgroundColor)};
170
+ }
171
+
172
+ [hidden] {
173
+ display: none;
174
+ }
175
+ `;
178
176
  __decorate([
179
177
  property()
180
178
  ], FtFileDrop.prototype, "dropHint", void 0);
@@ -193,8 +191,4 @@ __decorate([
193
191
  __decorate([
194
192
  state()
195
193
  ], FtFileDrop.prototype, "fileError", void 0);
196
- FtFileDrop = __decorate([
197
- customElement("ft-file-drop")
198
- ], FtFileDrop);
199
- export { FtFileDrop };
200
194
  //# sourceMappingURL=ft-file-drop.js.map