@nuralyui/file-upload 0.0.3 → 0.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"file-upload-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/file-upload/demo/file-upload-demo.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,0BAA0B,CAAC;AAGlC,qBACa,cAAe,SAAQ,UAAU;IACnC,KAAK,SAAU;IACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAEjD,YAAY;IAYrB,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,iBAAiB;cAMN,MAAM;IA0BzB,OAAgB,MAAM,4BA6CpB;CACH"}
1
+ {"version":3,"file":"file-upload-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/file-upload/demo/file-upload-demo.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,0BAA0B,CAAC;AAGlC,qBACa,cAAe,SAAQ,UAAU;IACnC,KAAK,SAAU;IACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAEjD,YAAY;IAYrB,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,iBAAiB;cAMN,MAAM;IA0BzB,OAAgB,MAAM,4BA4CpB;CACH"}
@@ -101,7 +101,6 @@ let ElMeenuElement = class ElMeenuElement extends LitElement {
101
101
  ElMeenuElement.styles = [
102
102
  css `
103
103
  :host {
104
- width: 800px;
105
104
  display: flex;
106
105
  flex-direction: column;
107
106
  align-items: center;
@@ -1 +1 @@
1
- {"version":3,"file":"file-upload-demo.js","sourceRoot":"","sources":["../../../../src/components/file-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,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACvC;IACH,CAAC;IAEO,iBAAiB,CAAC,KAAkB;QAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,0CAA0C,KAAK,CAAC,MAAM,oBAAoB,CAAC,CAAC;QACzF,0CAA0C;IAC5C,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;KAsBV,CAAC;IACJ,CAAC;CAgDF,CAAA;AA9CiB,qBAAM,GAAG;IACvB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2CF;CACD,CAAA;AAzIO;IAAR,KAAK,EAAE;6CAAgB;AACf;IAAR,KAAK,EAAE;uDAAkD;AAF/C,cAAc;IAD1B,aAAa,CAAC,cAAc,CAAC;GACjB,cAAc,CA2I1B;SA3IY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\nimport { LitElement, css, html } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport \"../file-upload.component\";\nimport { UploadFile } from '../types';\n\n@customElement('hy-file-demo')\nexport class ElMeenuElement extends LitElement {\n @state() float = 'left';\n @state() uploadProcesses: Map<string, number> = new Map();\n\n override firstUpdated() {\n // Get reference to the file upload component\n const fileUpload : any = this.shadowRoot?.querySelector('nr-file-upload');\n \n if (fileUpload) {\n // Add event listeners to the component\n fileUpload.addEventListener('file-select', this._handleFileSelect.bind(this));\n fileUpload.addEventListener('file-remove', this._handleFileRemove.bind(this));\n fileUpload.addEventListener('file-exceed', this._handleFileExceed.bind(this));\n }\n }\n\n private _handleFileSelect(event: CustomEvent) {\n const { files } = event.detail;\n const fileUpload : any= this.shadowRoot?.querySelector('nr-file-upload');\n \n if (!fileUpload) return;\n \n files.forEach((file: UploadFile) => {\n // Update status to 'uploading'\n fileUpload.updateFileStatus(file.uid, 'uploading', 0);\n \n // Simulate upload process with interval\n const intervalId = window.setInterval(() => {\n const currentPercentage = file.percentage || 0;\n const percentage = Math.min(100, currentPercentage + 10);\n \n fileUpload.updateFileStatus(file.uid, 'uploading', percentage);\n \n if (percentage === 100) {\n window.clearInterval(intervalId);\n // Set file as successfully uploaded after a small delay\n setTimeout(() => {\n fileUpload.updateFileStatus(file.uid, 'success');\n }, 300);\n \n // Remove from tracking\n this.uploadProcesses.delete(file.uid);\n }\n }, 500);\n \n // Store the interval ID for potential cancellation\n this.uploadProcesses.set(file.uid, intervalId);\n });\n }\n\n private _handleFileRemove(event: CustomEvent) {\n const { file } = event.detail;\n console.log(`File removed: ${file.name}`);\n \n // Cancel upload process if it's still running\n if (this.uploadProcesses.has(file.uid)) {\n window.clearInterval(this.uploadProcesses.get(file.uid));\n this.uploadProcesses.delete(file.uid);\n }\n }\n\n private _handleFileExceed(event: CustomEvent) {\n const { files } = event.detail;\n console.warn(`Upload limit exceeded. Tried to upload ${files.length} additional files.`);\n // Could show a notification or alert here\n }\n\n protected override render() {\n return html`\n <div class=\"demo-container\">\n <h2>File Upload Demo</h2>\n <nr-file-upload\n accept=\"image/*\"\n multiple\n drag\n limit=\"5\"\n tip=\"JPG/PNG files up to 500kb\">\n </nr-file-upload>\n \n <div class=\"usage-info\">\n <h3>Usage:</h3>\n <ul>\n <li>Drag & drop files here</li>\n <li>Or click to select files</li>\n <li>Files will automatically start uploading</li>\n <li>Use the X button to remove files</li>\n <li>Click on eye icon to preview images</li>\n </ul>\n </div>\n </div>\n `;\n }\n\n static override styles = [\n css`\n :host {\n width: 800px;\n display: flex;\n flex-direction: column;\n align-items: center;\n font-family: sans-serif;\n }\n \n .demo-container {\n width: 100%;\n max-width: 700px;\n padding: 20px;\n border-radius: 8px;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n background-color: #fff;\n }\n \n h2 {\n color: #333;\n margin-top: 0;\n }\n \n .usage-info {\n margin-top: 30px;\n padding: 15px;\n background-color: #f5f5f5;\n border-radius: 6px;\n }\n \n .usage-info h3 {\n margin-top: 0;\n color: #555;\n }\n \n ul {\n padding-left: 20px;\n }\n \n li {\n margin-bottom: 8px;\n color: #666;\n }\n `,\n ];\n}\n"]}
1
+ {"version":3,"file":"file-upload-demo.js","sourceRoot":"","sources":["../../../../src/components/file-upload/demo/file-upload-demo.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,0BAA0B,CAAC;AAIlC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QACW,UAAK,GAAG,MAAM,CAAC;QACf,oBAAe,GAAwB,IAAI,GAAG,EAAE,CAAC;IAwI5D,CAAC;IAtIU,YAAY;;QACnB,6CAA6C;QAC7C,MAAM,UAAU,GAAS,MAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;QAE1E,IAAI,UAAU,EAAE;YACd,uCAAuC;YACvC,UAAU,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9E,UAAU,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9E,UAAU,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC/E;IACH,CAAC;IAEO,iBAAiB,CAAC,KAAkB;;QAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,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GAAG,CAAC,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE1C,8CAA8C;QAC9C,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACzD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACvC;IACH,CAAC;IAEO,iBAAiB,CAAC,KAAkB;QAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,0CAA0C,KAAK,CAAC,MAAM,oBAAoB,CAAC,CAAC;QACzF,0CAA0C;IAC5C,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;KAsBV,CAAC;IACJ,CAAC;CA+CF,CAAA;AA7CiB,qBAAM,GAAG;IACvB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0CF;CACD,CAAA;AAxIO;IAAR,KAAK,EAAE;6CAAgB;AACf;IAAR,KAAK,EAAE;uDAAkD;AAF/C,cAAc;IAD1B,aAAa,CAAC,cAAc,CAAC;GACjB,cAAc,CA0I1B;SA1IY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\nimport { LitElement, css, html } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport \"../file-upload.component\";\nimport { UploadFile } from '../types';\n\n@customElement('hy-file-demo')\nexport class ElMeenuElement extends LitElement {\n @state() float = 'left';\n @state() uploadProcesses: Map<string, number> = new Map();\n\n override firstUpdated() {\n // Get reference to the file upload component\n const fileUpload : any = this.shadowRoot?.querySelector('nr-file-upload');\n \n if (fileUpload) {\n // Add event listeners to the component\n fileUpload.addEventListener('file-select', this._handleFileSelect.bind(this));\n fileUpload.addEventListener('file-remove', this._handleFileRemove.bind(this));\n fileUpload.addEventListener('file-exceed', this._handleFileExceed.bind(this));\n }\n }\n\n private _handleFileSelect(event: CustomEvent) {\n const { files } = event.detail;\n const fileUpload : any= this.shadowRoot?.querySelector('nr-file-upload');\n \n if (!fileUpload) return;\n \n files.forEach((file: UploadFile) => {\n // Update status to 'uploading'\n fileUpload.updateFileStatus(file.uid, 'uploading', 0);\n \n // Simulate upload process with interval\n const intervalId = window.setInterval(() => {\n const currentPercentage = file.percentage || 0;\n const percentage = Math.min(100, currentPercentage + 10);\n \n fileUpload.updateFileStatus(file.uid, 'uploading', percentage);\n \n if (percentage === 100) {\n window.clearInterval(intervalId);\n // Set file as successfully uploaded after a small delay\n setTimeout(() => {\n fileUpload.updateFileStatus(file.uid, 'success');\n }, 300);\n \n // Remove from tracking\n this.uploadProcesses.delete(file.uid);\n }\n }, 500);\n \n // Store the interval ID for potential cancellation\n this.uploadProcesses.set(file.uid, intervalId);\n });\n }\n\n private _handleFileRemove(event: CustomEvent) {\n const { file } = event.detail;\n console.log(`File removed: ${file.name}`);\n \n // Cancel upload process if it's still running\n if (this.uploadProcesses.has(file.uid)) {\n window.clearInterval(this.uploadProcesses.get(file.uid));\n this.uploadProcesses.delete(file.uid);\n }\n }\n\n private _handleFileExceed(event: CustomEvent) {\n const { files } = event.detail;\n console.warn(`Upload limit exceeded. Tried to upload ${files.length} additional files.`);\n // Could show a notification or alert here\n }\n\n protected override render() {\n return html`\n <div class=\"demo-container\">\n <h2>File Upload Demo</h2>\n <nr-file-upload\n accept=\"image/*\"\n multiple\n drag\n limit=\"5\"\n tip=\"JPG/PNG files up to 500kb\">\n </nr-file-upload>\n \n <div class=\"usage-info\">\n <h3>Usage:</h3>\n <ul>\n <li>Drag & drop files here</li>\n <li>Or click to select files</li>\n <li>Files will automatically start uploading</li>\n <li>Use the X button to remove files</li>\n <li>Click on eye icon to preview images</li>\n </ul>\n </div>\n </div>\n `;\n }\n\n static override styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-items: center;\n font-family: sans-serif;\n }\n \n .demo-container {\n width: 100%;\n max-width: 700px;\n padding: 20px;\n border-radius: 8px;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n background-color: #fff;\n }\n \n h2 {\n color: #333;\n margin-top: 0;\n }\n \n .usage-info {\n margin-top: 30px;\n padding: 15px;\n background-color: #f5f5f5;\n border-radius: 6px;\n }\n \n .usage-info h3 {\n margin-top: 0;\n color: #555;\n }\n \n ul {\n padding-left: 20px;\n }\n \n li {\n margin-bottom: 8px;\n color: #666;\n }\n `,\n ];\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/file-upload",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/styles.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAwMlB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/styles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM,yBAmQlB,CAAC"}
package/styles.js CHANGED
@@ -1,203 +1,262 @@
1
1
  import { css } from 'lit';
2
2
  export const styles = css `
3
- :host {
4
- display: block;
5
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
6
- }
3
+ :host {
4
+ display: block;
5
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
6
+ }
7
+ .upload {
8
+ width: 100%;
9
+ }
10
+ .upload-dragger {
11
+ background-color: #f8f9fa;
12
+ border: 1px dashed #d9d9d9;
13
+ border-radius: 6px;
14
+ box-sizing: border-box;
15
+ width: 100%;
16
+ height: 180px;
17
+ text-align: center;
18
+ cursor: pointer;
19
+ position: relative;
20
+ overflow: hidden;
21
+ transition: border-color 0.3s;
22
+ display: flex;
23
+ flex-direction: column;
24
+ justify-content: center;
25
+ align-items: center;
26
+ }
27
+ .upload-dragger:hover {
28
+ border-color: #409eff;
29
+ }
30
+ .upload-dragger.is-dragover {
31
+ background-color: rgba(64, 158, 255, 0.06);
32
+ border-color: #409eff;
33
+ }
34
+ .upload-icon {
35
+ font-size: 28px;
36
+ color: #c0c4cc;
37
+ margin-bottom: 8px;
38
+ }
39
+ .upload-text {
40
+ color: #606266;
41
+ font-size: 14px;
42
+ text-align: center;
43
+ padding: 0 12px;
44
+ }
45
+ .upload-tip {
46
+ font-size: 12px;
47
+ color: #909399;
48
+ margin-top: 7px;
49
+ padding: 0 12px;
50
+ }
51
+ .upload-button {
52
+ padding: 8px 16px;
53
+ background-color: #409eff;
54
+ color: white;
55
+ border: none;
56
+ border-radius: 4px;
57
+ cursor: pointer;
58
+ font-size: 14px;
59
+ transition: background-color 0.3s;
60
+ }
61
+ .upload-button:hover {
62
+ background-color: #66b1ff;
63
+ }
64
+ .file-list {
65
+ margin-top: 10px;
66
+ width: 100%;
67
+ }
68
+ .file-item {
69
+ display: flex;
70
+ align-items: center;
71
+ margin-bottom: 8px;
72
+ transition: all 0.3s;
73
+ padding: 8px;
74
+ border-radius: 4px;
75
+ gap: 10px; /* Add consistent spacing between items */
76
+ }
77
+ .file-item:hover {
78
+ background-color: #f8f9fa;
79
+ }
80
+ .file-name {
81
+ flex: 1;
82
+ white-space: nowrap;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ color: #606266;
86
+ min-width: 0;
87
+ }
88
+ .file-size {
89
+ color: #909399;
90
+ font-size: 12px;
91
+ flex-shrink: 0; /* Prevent shrinking */
92
+ }
93
+ .file-status {
94
+ display: flex;
95
+ align-items: center;
96
+ flex-shrink: 0; /* Prevent shrinking */
97
+ }
98
+ .file-actions {
99
+ display: flex;
100
+ gap: 4px;
101
+ flex-shrink: 0; /* Prevent shrinking */
102
+ }
103
+ .file-actions button {
104
+ background: none;
105
+ border: none;
106
+ padding: 4px;
107
+ cursor: pointer;
108
+ color: #909399;
109
+ }
110
+ .file-actions button:hover {
111
+ color: #409eff;
112
+ }
7
113
 
8
- .upload {
9
- width: 100%;
10
- }
114
+ /* Progress bar styles - fixed to ensure full width */
115
+ .progress-bar {
116
+ height: 2px;
117
+ width: 100%;
118
+ background-color: #e6e6e6;
119
+ margin-top: 4px;
120
+ position: relative;
121
+ border-radius: 2px;
122
+ overflow: hidden;
123
+ }
124
+ .progress-inner {
125
+ height: 100%;
126
+ background-color: #409eff;
127
+ position: absolute;
128
+ left: 0;
129
+ top: 0;
130
+ transition: width 0.3s ease;
131
+ }
11
132
 
12
- .upload-dragger {
13
- background-color: #f8f9fa;
14
- border: 1px dashed #d9d9d9;
15
- border-radius: 6px;
16
- box-sizing: border-box;
17
- width: 100%;
18
- height: 180px;
19
- text-align: center;
20
- cursor: pointer;
21
- position: relative;
22
- overflow: hidden;
23
- transition: border-color .3s;
24
- display: flex;
25
- flex-direction: column;
26
- justify-content: center;
27
- align-items: center;
28
- }
133
+ /* Progress percentage indicator */
134
+ .progress-percentage {
135
+ position: absolute;
136
+ right: 0;
137
+ top: -18px;
138
+ font-size: 12px;
139
+ color: #409eff;
140
+ }
29
141
 
30
- .upload-dragger:hover {
31
- border-color: #409eff;
32
- }
142
+ .hidden {
143
+ display: none;
144
+ }
145
+ .success {
146
+ color: #67c23a;
147
+ }
148
+ .error {
149
+ color: #f56c6c;
150
+ }
151
+ .icon-delete {
152
+ color: #f56c6c;
153
+ }
154
+ .file-preview {
155
+ width: 100%;
156
+ margin-top: 4px;
157
+ }
158
+ .image-preview {
159
+ display: block;
160
+ max-width: 100%;
161
+ max-height: 200px;
162
+ border-radius: 4px;
163
+ object-fit: contain;
164
+ cursor: zoom-in;
165
+ }
166
+ .preview-modal {
167
+ position: fixed;
168
+ top: 0;
169
+ left: 0;
170
+ width: 100%;
171
+ height: 100%;
172
+ background-color: rgba(0, 0, 0, 0.7);
173
+ display: flex;
174
+ justify-content: center;
175
+ align-items: center;
176
+ z-index: 1000;
177
+ }
178
+ .preview-modal img {
179
+ max-width: 90%;
180
+ max-height: 90%;
181
+ object-fit: contain;
182
+ }
183
+ .preview-close {
184
+ position: absolute;
185
+ top: 20px;
186
+ right: 20px;
187
+ color: white;
188
+ font-size: 30px;
189
+ background: none;
190
+ border: none;
191
+ cursor: pointer;
192
+ }
193
+ .preview-icon {
194
+ padding: 4px;
195
+ color: #409eff;
196
+ cursor: zoom-in;
197
+ }
33
198
 
34
- .upload-dragger.is-dragover {
35
- background-color: rgba(64, 158, 255, .06);
36
- border-color: #409eff;
37
- }
199
+ /* File item container with progress bar */
200
+ .file-container {
201
+ width: 100%;
202
+ position: relative;
203
+ }
38
204
 
39
- .upload-icon {
40
- font-size: 28px;
41
- color: #c0c4cc;
42
- margin-bottom: 8px;
205
+ /* Responsive styles */
206
+ @media (max-width: 600px) {
207
+ .upload-dragger {
208
+ height: 140px;
209
+ padding: 12px;
43
210
  }
44
-
45
- .upload-text {
46
- color: #606266;
47
- font-size: 14px;
48
- text-align: center;
211
+ .upload-icon {
212
+ font-size: 24px;
49
213
  }
50
-
214
+ .upload-text,
51
215
  .upload-tip {
52
- font-size: 12px;
53
- color: #909399;
54
- margin-top: 7px;
216
+ font-size: 13px;
55
217
  }
56
-
57
- .upload-button {
58
- padding: 8px 16px;
59
- background-color: #409eff;
60
- color: white;
61
- border: none;
62
- border-radius: 4px;
63
- cursor: pointer;
64
- font-size: 14px;
65
- transition: background-color 0.3s;
66
- }
67
-
68
- .upload-button:hover {
69
- background-color: #66b1ff;
70
- }
71
-
72
- .file-list {
73
- margin-top: 10px;
74
- }
75
-
76
218
  .file-item {
77
- display: flex;
219
+ display: grid;
220
+ grid-template-columns: auto 1fr;
221
+ grid-template-areas:
222
+ "icon filename"
223
+ "size status"
224
+ "progress progress"
225
+ "actions actions";
226
+ gap: 4px 8px;
78
227
  align-items: center;
79
- margin-bottom: 8px;
80
- transition: all .3s;
81
- padding: 8px;
82
- border-radius: 4px;
83
228
  }
84
-
85
- .file-item:hover {
86
- background-color: #f8f9fa;
229
+ .file-item > svg:first-child {
230
+ grid-area: icon;
231
+ align-self: start;
87
232
  }
88
-
89
233
  .file-name {
90
- margin-left: 6px;
91
- flex: 1;
92
- color: #606266;
234
+ grid-area: filename;
235
+ margin: 0;
236
+ padding: 2px 0;
93
237
  }
94
-
95
238
  .file-size {
96
- color: #909399;
97
- font-size: 12px;
98
- margin-right: 10px;
239
+ grid-area: size;
240
+ margin: 0;
99
241
  }
100
-
101
242
  .file-status {
102
- display: flex;
103
- align-items: center;
104
- }
105
-
106
- .file-actions {
107
- margin-left: 10px;
108
- display: flex;
109
- gap: 4px;
110
- }
111
-
112
- .file-actions button {
113
- background: none;
114
- border: none;
115
- padding: 4px;
116
- cursor: pointer;
117
- color: #909399;
118
- }
119
-
120
- .file-actions button:hover {
121
- color: #409eff;
243
+ grid-area: status;
244
+ justify-self: end;
122
245
  }
123
-
124
246
  .progress-bar {
125
- height: 2px;
247
+ grid-area: progress;
126
248
  width: 100%;
127
- background-color: #e6e6e6;
128
- margin-top: 4px;
129
- }
130
-
131
- .progress-inner {
132
- height: 100%;
133
- background-color: #409eff;
134
- transition: width .3s;
135
249
  }
136
-
137
- .hidden {
138
- display: none;
139
- }
140
-
141
- .success {
142
- color: #67c23a;
143
- }
144
-
145
- .error {
146
- color: #f56c6c;
147
- }
148
-
149
- .icon-delete {
150
- color: #f56c6c;
151
- }
152
-
153
- .file-preview {
250
+ .file-actions {
251
+ grid-area: actions;
252
+ margin: 4px 0 0 0;
253
+ justify-content: flex-end;
154
254
  width: 100%;
155
- margin-top: 4px;
156
255
  }
157
-
158
- .image-preview {
159
- display: block;
160
- max-width: 100%;
161
- max-height: 200px;
162
- border-radius: 4px;
163
- object-fit: contain;
164
- cursor: zoom-in;
165
- }
166
-
167
- .preview-modal {
168
- position: fixed;
169
- top: 0;
170
- left: 0;
256
+ .upload-button {
171
257
  width: 100%;
172
- height: 100%;
173
- background-color: rgba(0, 0, 0, 0.7);
174
- display: flex;
175
- justify-content: center;
176
- align-items: center;
177
- z-index: 1000;
178
- }
179
-
180
- .preview-modal img {
181
- max-width: 90%;
182
- max-height: 90%;
183
- object-fit: contain;
184
- }
185
-
186
- .preview-close {
187
- position: absolute;
188
- top: 20px;
189
- right: 20px;
190
- color: white;
191
- font-size: 30px;
192
- background: none;
193
- border: none;
194
- cursor: pointer;
195
- }
196
-
197
- .preview-icon {
198
- padding: 4px;
199
- color: #409eff;
200
- cursor: zoom-in;
258
+ font-size: 16px;
201
259
  }
260
+ }
202
261
  `;
203
262
  //# sourceMappingURL=styles.js.map
package/styles.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/file-upload/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwMxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n :host {\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n }\n\n .upload {\n width: 100%;\n }\n\n .upload-dragger {\n background-color: #f8f9fa;\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n box-sizing: border-box;\n width: 100%;\n height: 180px;\n text-align: center;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n transition: border-color .3s;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .upload-dragger:hover {\n border-color: #409eff;\n }\n\n .upload-dragger.is-dragover {\n background-color: rgba(64, 158, 255, .06);\n border-color: #409eff;\n }\n\n .upload-icon {\n font-size: 28px;\n color: #c0c4cc;\n margin-bottom: 8px;\n }\n\n .upload-text {\n color: #606266;\n font-size: 14px;\n text-align: center;\n }\n\n .upload-tip {\n font-size: 12px;\n color: #909399;\n margin-top: 7px;\n }\n\n .upload-button {\n padding: 8px 16px;\n background-color: #409eff;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n transition: background-color 0.3s;\n }\n\n .upload-button:hover {\n background-color: #66b1ff;\n }\n\n .file-list {\n margin-top: 10px;\n }\n\n .file-item {\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n transition: all .3s;\n padding: 8px;\n border-radius: 4px;\n }\n\n .file-item:hover {\n background-color: #f8f9fa;\n }\n\n .file-name {\n margin-left: 6px;\n flex: 1;\n color: #606266;\n }\n\n .file-size {\n color: #909399;\n font-size: 12px;\n margin-right: 10px;\n }\n\n .file-status {\n display: flex;\n align-items: center;\n }\n\n .file-actions {\n margin-left: 10px;\n display: flex;\n gap: 4px;\n }\n\n .file-actions button {\n background: none;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: #909399;\n }\n\n .file-actions button:hover {\n color: #409eff;\n }\n\n .progress-bar {\n height: 2px;\n width: 100%;\n background-color: #e6e6e6;\n margin-top: 4px;\n }\n\n .progress-inner {\n height: 100%;\n background-color: #409eff;\n transition: width .3s;\n }\n\n .hidden {\n display: none;\n }\n\n .success {\n color: #67c23a;\n }\n\n .error {\n color: #f56c6c;\n }\n\n .icon-delete {\n color: #f56c6c;\n }\n\n .file-preview {\n width: 100%;\n margin-top: 4px;\n }\n\n .image-preview {\n display: block;\n max-width: 100%;\n max-height: 200px;\n border-radius: 4px;\n object-fit: contain;\n cursor: zoom-in;\n }\n\n .preview-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n }\n\n .preview-modal img {\n max-width: 90%;\n max-height: 90%;\n object-fit: contain;\n }\n\n .preview-close {\n position: absolute;\n top: 20px;\n right: 20px;\n color: white;\n font-size: 30px;\n background: none;\n border: none;\n cursor: pointer;\n }\n\n .preview-icon {\n padding: 4px;\n color: #409eff;\n cursor: zoom-in;\n }\n`;"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/file-upload/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmQxB,CAAC","sourcesContent":["import { css } from 'lit';\nexport const styles = css`\n:host {\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n}\n.upload {\n width: 100%;\n}\n.upload-dragger {\n background-color: #f8f9fa;\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n box-sizing: border-box;\n width: 100%;\n height: 180px;\n text-align: center;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n transition: border-color 0.3s;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n.upload-dragger:hover {\n border-color: #409eff;\n}\n.upload-dragger.is-dragover {\n background-color: rgba(64, 158, 255, 0.06);\n border-color: #409eff;\n}\n.upload-icon {\n font-size: 28px;\n color: #c0c4cc;\n margin-bottom: 8px;\n}\n.upload-text {\n color: #606266;\n font-size: 14px;\n text-align: center;\n padding: 0 12px;\n}\n.upload-tip {\n font-size: 12px;\n color: #909399;\n margin-top: 7px;\n padding: 0 12px;\n}\n.upload-button {\n padding: 8px 16px;\n background-color: #409eff;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n transition: background-color 0.3s;\n}\n.upload-button:hover {\n background-color: #66b1ff;\n}\n.file-list {\n margin-top: 10px;\n width: 100%;\n}\n.file-item {\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n transition: all 0.3s;\n padding: 8px;\n border-radius: 4px;\n gap: 10px; /* Add consistent spacing between items */\n}\n.file-item:hover {\n background-color: #f8f9fa;\n}\n.file-name {\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: #606266;\n min-width: 0;\n}\n.file-size {\n color: #909399;\n font-size: 12px;\n flex-shrink: 0; /* Prevent shrinking */\n}\n.file-status {\n display: flex;\n align-items: center;\n flex-shrink: 0; /* Prevent shrinking */\n}\n.file-actions {\n display: flex;\n gap: 4px;\n flex-shrink: 0; /* Prevent shrinking */\n}\n.file-actions button {\n background: none;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: #909399;\n}\n.file-actions button:hover {\n color: #409eff;\n}\n\n/* Progress bar styles - fixed to ensure full width */\n.progress-bar {\n height: 2px;\n width: 100%;\n background-color: #e6e6e6;\n margin-top: 4px;\n position: relative;\n border-radius: 2px;\n overflow: hidden;\n}\n.progress-inner {\n height: 100%;\n background-color: #409eff;\n position: absolute;\n left: 0;\n top: 0;\n transition: width 0.3s ease;\n}\n\n/* Progress percentage indicator */\n.progress-percentage {\n position: absolute;\n right: 0;\n top: -18px;\n font-size: 12px;\n color: #409eff;\n}\n\n.hidden {\n display: none;\n}\n.success {\n color: #67c23a;\n}\n.error {\n color: #f56c6c;\n}\n.icon-delete {\n color: #f56c6c;\n}\n.file-preview {\n width: 100%;\n margin-top: 4px;\n}\n.image-preview {\n display: block;\n max-width: 100%;\n max-height: 200px;\n border-radius: 4px;\n object-fit: contain;\n cursor: zoom-in;\n}\n.preview-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n}\n.preview-modal img {\n max-width: 90%;\n max-height: 90%;\n object-fit: contain;\n}\n.preview-close {\n position: absolute;\n top: 20px;\n right: 20px;\n color: white;\n font-size: 30px;\n background: none;\n border: none;\n cursor: pointer;\n}\n.preview-icon {\n padding: 4px;\n color: #409eff;\n cursor: zoom-in;\n}\n\n/* File item container with progress bar */\n.file-container {\n width: 100%;\n position: relative;\n}\n\n/* Responsive styles */\n@media (max-width: 600px) {\n .upload-dragger {\n height: 140px;\n padding: 12px;\n }\n .upload-icon {\n font-size: 24px;\n }\n .upload-text,\n .upload-tip {\n font-size: 13px;\n }\n .file-item {\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-areas: \n \"icon filename\"\n \"size status\"\n \"progress progress\"\n \"actions actions\";\n gap: 4px 8px;\n align-items: center;\n }\n .file-item > svg:first-child {\n grid-area: icon;\n align-self: start;\n }\n .file-name {\n grid-area: filename;\n margin: 0;\n padding: 2px 0;\n }\n .file-size {\n grid-area: size;\n margin: 0;\n }\n .file-status {\n grid-area: status;\n justify-self: end;\n }\n .progress-bar {\n grid-area: progress;\n width: 100%;\n }\n .file-actions {\n grid-area: actions;\n margin: 4px 0 0 0;\n justify-content: flex-end;\n width: 100%;\n }\n .upload-button {\n width: 100%;\n font-size: 16px;\n }\n}\n`;"]}