@mekari/pixel3-dropzone 0.0.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/dist/chunk-CQO276YD.mjs +83 -0
- package/dist/chunk-DEUKYB7V.mjs +123 -0
- package/dist/chunk-PB3KHIIV.mjs +291 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/dropzone.d.mts +176 -0
- package/dist/dropzone.d.ts +176 -0
- package/dist/dropzone.js +502 -0
- package/dist/dropzone.mjs +9 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +504 -0
- package/dist/index.mjs +9 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/dropzone.hooks.d.mts +109 -0
- package/dist/modules/dropzone.hooks.d.ts +109 -0
- package/dist/modules/dropzone.hooks.js +312 -0
- package/dist/modules/dropzone.hooks.mjs +7 -0
- package/dist/modules/dropzone.props.d.mts +83 -0
- package/dist/modules/dropzone.props.d.ts +83 -0
- package/dist/modules/dropzone.props.js +108 -0
- package/dist/modules/dropzone.props.mjs +9 -0
- package/package.json +46 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
MpDropzone: () => MpDropzone
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/dropzone.tsx
|
|
29
|
+
var import_vue2 = require("vue");
|
|
30
|
+
var import_vue3 = require("vue");
|
|
31
|
+
var import_pixel3_text = require("@mekari/pixel3-text");
|
|
32
|
+
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
33
|
+
var import_pixel3_spinner = require("@mekari/pixel3-spinner");
|
|
34
|
+
|
|
35
|
+
// src/modules/dropzone.props.ts
|
|
36
|
+
var dropzoneProps = {
|
|
37
|
+
id: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
variant: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "default"
|
|
44
|
+
},
|
|
45
|
+
accept: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
name: {
|
|
49
|
+
type: String
|
|
50
|
+
},
|
|
51
|
+
placeholder: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "Drop your file(s) here or "
|
|
54
|
+
},
|
|
55
|
+
description: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "Description of dropzone"
|
|
58
|
+
},
|
|
59
|
+
loadingText: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "Uploading..."
|
|
62
|
+
},
|
|
63
|
+
buttonText: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "Change file"
|
|
66
|
+
},
|
|
67
|
+
overlayVariant: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "white"
|
|
70
|
+
},
|
|
71
|
+
isShowPreview: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true
|
|
74
|
+
},
|
|
75
|
+
isMultiple: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
isLoading: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
isDisabled: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
isInvalid: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false
|
|
90
|
+
},
|
|
91
|
+
isRequired: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false
|
|
94
|
+
},
|
|
95
|
+
hasCustomUpload: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
isEnableDragAndDrop: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: true
|
|
102
|
+
},
|
|
103
|
+
isEnableInputFile: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false
|
|
106
|
+
},
|
|
107
|
+
isShowOverlay: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
default: false
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var dropzoneEmit = ["click", "dragover", "dragleave", "drop", "change", "clear", "cancel"];
|
|
113
|
+
|
|
114
|
+
// src/modules/dropzone.hooks.ts
|
|
115
|
+
var import_vue = require("vue");
|
|
116
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
117
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
118
|
+
function useDropzone(props, emit) {
|
|
119
|
+
const {
|
|
120
|
+
id,
|
|
121
|
+
variant,
|
|
122
|
+
name,
|
|
123
|
+
accept,
|
|
124
|
+
isMultiple,
|
|
125
|
+
hasCustomUpload,
|
|
126
|
+
overlayVariant,
|
|
127
|
+
isEnableInputFile,
|
|
128
|
+
isEnableDragAndDrop,
|
|
129
|
+
isShowPreview,
|
|
130
|
+
isShowOverlay,
|
|
131
|
+
isLoading,
|
|
132
|
+
isInvalid,
|
|
133
|
+
isDisabled,
|
|
134
|
+
isRequired
|
|
135
|
+
} = (0, import_vue.toRefs)(props);
|
|
136
|
+
const files = (0, import_vue.ref)();
|
|
137
|
+
const fileInput = (0, import_vue.ref)();
|
|
138
|
+
const preview = (0, import_vue.ref)("");
|
|
139
|
+
const showOverlay = (0, import_vue.ref)(isShowOverlay.value);
|
|
140
|
+
const overlay = (0, import_vue.ref)();
|
|
141
|
+
const getId = id.value || (0, import_pixel3_utils.getUniqueId)("", "dropzone").value;
|
|
142
|
+
const hasPreview = (0, import_vue.computed)(() => {
|
|
143
|
+
return isShowPreview.value && preview.value;
|
|
144
|
+
});
|
|
145
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
146
|
+
return {
|
|
147
|
+
"data-pixel-component": "MpDropzone",
|
|
148
|
+
id: getId,
|
|
149
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().root,
|
|
150
|
+
onClick: handleClick,
|
|
151
|
+
onDragover: handleDragover,
|
|
152
|
+
onDragleave: handleDragleave,
|
|
153
|
+
onDrop: handleDrop
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
const wrapperAttrs = (0, import_vue.computed)(() => {
|
|
157
|
+
return {
|
|
158
|
+
"data-invalid": isInvalid.value || void 0,
|
|
159
|
+
"data-disabled": isDisabled.value || void 0,
|
|
160
|
+
"data-variant": variant.value,
|
|
161
|
+
tabindex: isDisabled.value ? -1 : 0,
|
|
162
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().wrapper,
|
|
163
|
+
style: {
|
|
164
|
+
background: variant.value === "default" ? "var(--mp-colors-white)" : "var(--mp-colors-background)",
|
|
165
|
+
borderRadius: variant.value === "avatar" ? "var(--mp-radii-full)" : "var(--mp-radii-md)"
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
const boxAttrs = (0, import_vue.computed)(() => {
|
|
170
|
+
return {
|
|
171
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().box
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
const logoBoxAttrs = (0, import_vue.computed)(() => {
|
|
175
|
+
return {
|
|
176
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().logoBox,
|
|
177
|
+
onClick: handleClickInput
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
const productBoxAttrs = (0, import_vue.computed)(() => {
|
|
181
|
+
return {
|
|
182
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().productBox,
|
|
183
|
+
onClick: handleClickInput
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
const avatarBoxAttrs = (0, import_vue.computed)(() => {
|
|
187
|
+
return {
|
|
188
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().avatarBox,
|
|
189
|
+
onClick: handleClickInput
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
const overlayWrapperAttrs = (0, import_vue.computed)(() => {
|
|
193
|
+
return {
|
|
194
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().overlayWrapper
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
const overlayAttrs = (0, import_vue.computed)(() => {
|
|
198
|
+
return {
|
|
199
|
+
ref: overlay,
|
|
200
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().overlay,
|
|
201
|
+
style: {
|
|
202
|
+
display: showOverlay.value ? "flex" : "none",
|
|
203
|
+
background: overlayVariant.value === "white" ? "var(--mp-colors-whiteAlpha.300)" : "var(--mp-colors-overlay)"
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
const inputAttrs = (0, import_vue.computed)(() => {
|
|
208
|
+
return {
|
|
209
|
+
ref: fileInput,
|
|
210
|
+
id: `input-${getId}`,
|
|
211
|
+
class: (0, import_recipes.sharedSlotRecipe)().hidden,
|
|
212
|
+
type: "file",
|
|
213
|
+
name: name == null ? void 0 : name.value,
|
|
214
|
+
accept: accept == null ? void 0 : accept.value,
|
|
215
|
+
multiple: isMultiple.value,
|
|
216
|
+
disabled: isDisabled.value,
|
|
217
|
+
required: isRequired.value,
|
|
218
|
+
onChange: handleChangeInput
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
const cancelButtonAttrs = (0, import_vue.computed)(() => {
|
|
222
|
+
return {
|
|
223
|
+
color: "red.400",
|
|
224
|
+
style: {
|
|
225
|
+
cursor: "pointer"
|
|
226
|
+
},
|
|
227
|
+
onClick: handleCancel
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
const browseButtonAttrs = (0, import_vue.computed)(() => {
|
|
231
|
+
return {
|
|
232
|
+
as: "span",
|
|
233
|
+
weight: "semiBold",
|
|
234
|
+
color: "blue.400",
|
|
235
|
+
style: {
|
|
236
|
+
cursor: "pointer"
|
|
237
|
+
},
|
|
238
|
+
onClick: handleClickInput
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
const previewAttrs = (0, import_vue.computed)(() => {
|
|
242
|
+
return {
|
|
243
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().preview
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
const overlayPreviewAttrs = (0, import_vue.computed)(() => {
|
|
247
|
+
return {
|
|
248
|
+
"data-overlay-preview": true,
|
|
249
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().overlayPreview,
|
|
250
|
+
onClick: handleClickInput
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
const imageAttrs = (0, import_vue.computed)(() => {
|
|
254
|
+
return {
|
|
255
|
+
src: preview.value,
|
|
256
|
+
style: {
|
|
257
|
+
borderRadius: "inherit",
|
|
258
|
+
height: "100%",
|
|
259
|
+
objectFit: "cover"
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
const clearButtonAttrs = (0, import_vue.computed)(() => {
|
|
264
|
+
return {
|
|
265
|
+
class: (0, import_recipes.dropzoneSlotRecipe)().clearButton,
|
|
266
|
+
name: "minus-circular",
|
|
267
|
+
variant: "fill",
|
|
268
|
+
color: "red.400",
|
|
269
|
+
style: {
|
|
270
|
+
top: variant.value === "avatar" ? "-4px" : "-10px",
|
|
271
|
+
right: variant.value === "avatar" ? "-4px" : "-10px"
|
|
272
|
+
},
|
|
273
|
+
onClick: handleClear
|
|
274
|
+
};
|
|
275
|
+
});
|
|
276
|
+
function handleClick(e) {
|
|
277
|
+
if (!isEnableInputFile.value) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
handleClickInput();
|
|
281
|
+
emit("click", e);
|
|
282
|
+
}
|
|
283
|
+
__name(handleClick, "handleClick");
|
|
284
|
+
function handleClickInput() {
|
|
285
|
+
if (isDisabled.value) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
files.value = null;
|
|
289
|
+
fileInput.value.value = null;
|
|
290
|
+
fileInput.value.click();
|
|
291
|
+
}
|
|
292
|
+
__name(handleClickInput, "handleClickInput");
|
|
293
|
+
function handleDragover(e) {
|
|
294
|
+
e.preventDefault();
|
|
295
|
+
if (!isEnableDragAndDrop.value) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
emit("dragover", e);
|
|
299
|
+
if (hasCustomUpload.value) {
|
|
300
|
+
showOverlay.value = true;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
__name(handleDragover, "handleDragover");
|
|
304
|
+
function handleDragleave(e) {
|
|
305
|
+
if (!isEnableDragAndDrop.value) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
emit("dragleave", e);
|
|
309
|
+
if (e.target === overlay.value) {
|
|
310
|
+
showOverlay.value = false;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
__name(handleDragleave, "handleDragleave");
|
|
314
|
+
function handleDrop(e) {
|
|
315
|
+
e.preventDefault();
|
|
316
|
+
if (!isEnableDragAndDrop.value) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
emit("drop", e);
|
|
320
|
+
const target = e.dataTransfer;
|
|
321
|
+
if (target && target.files) {
|
|
322
|
+
const {
|
|
323
|
+
files: files2
|
|
324
|
+
} = target;
|
|
325
|
+
handleFiles(files2);
|
|
326
|
+
}
|
|
327
|
+
if (hasCustomUpload.value) {
|
|
328
|
+
showOverlay.value = false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
__name(handleDrop, "handleDrop");
|
|
332
|
+
function handleChangeInput(e) {
|
|
333
|
+
const target = e.target;
|
|
334
|
+
if (target && target.files) {
|
|
335
|
+
const {
|
|
336
|
+
files: files2
|
|
337
|
+
} = target;
|
|
338
|
+
handleFiles(files2);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
__name(handleChangeInput, "handleChangeInput");
|
|
342
|
+
function handleFiles(item) {
|
|
343
|
+
if (isDisabled.value) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (item && item.length > 0) {
|
|
347
|
+
files.value = item;
|
|
348
|
+
}
|
|
349
|
+
emit("change", files.value);
|
|
350
|
+
if (files.value && files.value.length === 1) {
|
|
351
|
+
handlePreview(files.value[0]);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
__name(handleFiles, "handleFiles");
|
|
355
|
+
function handlePreview(item) {
|
|
356
|
+
if (isLoading.value) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const REGEXP_MIME_TYPE_IMAGES = /^image\/\w+$/;
|
|
360
|
+
if (REGEXP_MIME_TYPE_IMAGES.test(item.type)) {
|
|
361
|
+
preview.value = URL.createObjectURL(item);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
__name(handlePreview, "handlePreview");
|
|
365
|
+
function handleClear(e) {
|
|
366
|
+
e.stopPropagation();
|
|
367
|
+
emit("clear", e);
|
|
368
|
+
files.value = null;
|
|
369
|
+
preview.value = "";
|
|
370
|
+
}
|
|
371
|
+
__name(handleClear, "handleClear");
|
|
372
|
+
function handleCancel(e) {
|
|
373
|
+
e.stopPropagation();
|
|
374
|
+
emit("cancel", e);
|
|
375
|
+
}
|
|
376
|
+
__name(handleCancel, "handleCancel");
|
|
377
|
+
return {
|
|
378
|
+
rootAttrs,
|
|
379
|
+
wrapperAttrs,
|
|
380
|
+
boxAttrs,
|
|
381
|
+
logoBoxAttrs,
|
|
382
|
+
productBoxAttrs,
|
|
383
|
+
avatarBoxAttrs,
|
|
384
|
+
overlayWrapperAttrs,
|
|
385
|
+
overlayAttrs,
|
|
386
|
+
inputAttrs,
|
|
387
|
+
imageAttrs,
|
|
388
|
+
cancelButtonAttrs,
|
|
389
|
+
browseButtonAttrs,
|
|
390
|
+
previewAttrs,
|
|
391
|
+
overlayPreviewAttrs,
|
|
392
|
+
clearButtonAttrs,
|
|
393
|
+
hasPreview
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
__name(useDropzone, "useDropzone");
|
|
397
|
+
|
|
398
|
+
// src/dropzone.tsx
|
|
399
|
+
function _isSlot(s) {
|
|
400
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue2.isVNode)(s);
|
|
401
|
+
}
|
|
402
|
+
__name(_isSlot, "_isSlot");
|
|
403
|
+
var MpDropzone = (0, import_vue3.defineComponent)({
|
|
404
|
+
name: "MpDropzone",
|
|
405
|
+
props: dropzoneProps,
|
|
406
|
+
emits: dropzoneEmit,
|
|
407
|
+
setup(props, {
|
|
408
|
+
emit,
|
|
409
|
+
slots
|
|
410
|
+
}) {
|
|
411
|
+
const {
|
|
412
|
+
rootAttrs,
|
|
413
|
+
wrapperAttrs,
|
|
414
|
+
boxAttrs,
|
|
415
|
+
logoBoxAttrs,
|
|
416
|
+
productBoxAttrs,
|
|
417
|
+
avatarBoxAttrs,
|
|
418
|
+
overlayWrapperAttrs,
|
|
419
|
+
overlayAttrs,
|
|
420
|
+
inputAttrs,
|
|
421
|
+
imageAttrs,
|
|
422
|
+
cancelButtonAttrs,
|
|
423
|
+
browseButtonAttrs,
|
|
424
|
+
previewAttrs,
|
|
425
|
+
overlayPreviewAttrs,
|
|
426
|
+
clearButtonAttrs,
|
|
427
|
+
hasPreview
|
|
428
|
+
} = useDropzone(props, emit);
|
|
429
|
+
return () => {
|
|
430
|
+
const children = slots.default && slots.default();
|
|
431
|
+
const {
|
|
432
|
+
variant,
|
|
433
|
+
placeholder,
|
|
434
|
+
description,
|
|
435
|
+
buttonText,
|
|
436
|
+
loadingText,
|
|
437
|
+
overlayVariant,
|
|
438
|
+
isLoading,
|
|
439
|
+
isInvalid
|
|
440
|
+
} = props;
|
|
441
|
+
return (0, import_vue2.createVNode)("div", rootAttrs.value, [children ? (0, import_vue2.createVNode)("div", overlayWrapperAttrs.value, [(0, import_vue2.createVNode)("div", overlayAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
442
|
+
"weight": "semiBold",
|
|
443
|
+
"color": overlayVariant === "white" ? "dark" : "white"
|
|
444
|
+
}, _isSlot(placeholder) ? placeholder : {
|
|
445
|
+
default: () => [placeholder]
|
|
446
|
+
}), (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
447
|
+
"color": overlayVariant === "white" ? "dark" : "white"
|
|
448
|
+
}, _isSlot(description) ? description : {
|
|
449
|
+
default: () => [description]
|
|
450
|
+
})]), children]) : (0, import_vue2.createVNode)("div", wrapperAttrs.value, [isLoading && (0, import_vue2.createVNode)("div", boxAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_spinner.MpSpinner, null, null), variant !== "avatar" && (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
451
|
+
"color": "gray.600"
|
|
452
|
+
}, _isSlot(loadingText) ? loadingText : {
|
|
453
|
+
default: () => [loadingText]
|
|
454
|
+
}), variant === "default" && (0, import_vue2.createVNode)(import_pixel3_text.MpText, cancelButtonAttrs.value, {
|
|
455
|
+
default: () => [(0, import_vue2.createTextVNode)("Cancel")]
|
|
456
|
+
})]), !isLoading && hasPreview.value && (0, import_vue2.createVNode)("div", previewAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, clearButtonAttrs.value, null), (0, import_vue2.createVNode)("div", overlayPreviewAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, {
|
|
457
|
+
"name": "folder-open",
|
|
458
|
+
"variant": "fill",
|
|
459
|
+
"color": "white"
|
|
460
|
+
}, null), variant !== "avatar" && (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
461
|
+
"color": "white"
|
|
462
|
+
}, _isSlot(buttonText) ? buttonText : {
|
|
463
|
+
default: () => [buttonText]
|
|
464
|
+
})]), (0, import_vue2.createVNode)("img", imageAttrs.value, null)]), !isLoading && !hasPreview.value && variant === "default" && (0, import_vue2.createVNode)("div", boxAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, {
|
|
465
|
+
"name": "upload",
|
|
466
|
+
"variant": isInvalid ? "outline" : "duotone",
|
|
467
|
+
"color": isInvalid ? "red.400" : "gray.600"
|
|
468
|
+
}, null), (0, import_vue2.createVNode)(import_pixel3_text.MpText, null, {
|
|
469
|
+
default: () => [placeholder, (0, import_vue2.createVNode)(import_pixel3_text.MpText, browseButtonAttrs.value, {
|
|
470
|
+
default: () => [(0, import_vue2.createTextVNode)("Browse")]
|
|
471
|
+
})]
|
|
472
|
+
}), (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
473
|
+
"color": "gray.600"
|
|
474
|
+
}, _isSlot(description) ? description : {
|
|
475
|
+
default: () => [description]
|
|
476
|
+
})]), !isLoading && !hasPreview.value && variant === "logo" && (0, import_vue2.createVNode)("div", logoBoxAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, {
|
|
477
|
+
"name": "img",
|
|
478
|
+
"variant": isInvalid ? "fill" : "outline",
|
|
479
|
+
"color": isInvalid ? "red.400" : "gray.600"
|
|
480
|
+
}, null), (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
481
|
+
"color": isInvalid ? "red.400" : "gray.600"
|
|
482
|
+
}, _isSlot(placeholder) ? placeholder : {
|
|
483
|
+
default: () => [placeholder]
|
|
484
|
+
})]), !isLoading && !hasPreview.value && variant === "product" && (0, import_vue2.createVNode)("div", productBoxAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, {
|
|
485
|
+
"name": "add-circular",
|
|
486
|
+
"variant": isInvalid ? "fill" : "outline",
|
|
487
|
+
"color": isInvalid ? "red.400" : "gray.600"
|
|
488
|
+
}, null), (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
489
|
+
"color": isInvalid ? "red.400" : "gray.600"
|
|
490
|
+
}, _isSlot(placeholder) ? placeholder : {
|
|
491
|
+
default: () => [placeholder]
|
|
492
|
+
})]), !isLoading && !hasPreview.value && variant === "avatar" && (0, import_vue2.createVNode)("div", avatarBoxAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_text.MpText, {
|
|
493
|
+
"size": "h1",
|
|
494
|
+
"color": isInvalid ? "red.400" : "gray.600"
|
|
495
|
+
}, _isSlot(placeholder) ? placeholder : {
|
|
496
|
+
default: () => [placeholder]
|
|
497
|
+
})])]), (0, import_vue2.createVNode)("input", inputAttrs.value, null)]);
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
502
|
+
0 && (module.exports = {
|
|
503
|
+
MpDropzone
|
|
504
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/dropzone.props.ts":{"bytes":2052,"imports":[],"format":"esm"},"src/modules/dropzone.hooks.ts":{"bytes":6931,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/dropzone.tsx":{"bytes":4803,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"src/modules/dropzone.props.ts","kind":"import-statement","original":"./modules/dropzone.props"},{"path":"src/modules/dropzone.hooks.ts","kind":"import-statement","original":"./modules/dropzone.hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":125,"imports":[{"path":"src/dropzone.tsx","kind":"import-statement","original":"./dropzone"}],"format":"esm"}},"outputs":{"dist/dropzone.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-text","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true},{"path":"@mekari/pixel3-spinner","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/dropzone.tsx","inputs":{"src/dropzone.tsx":{"bytesInOutput":5574},"src/modules/dropzone.props.ts":{"bytesInOutput":1260},"src/modules/dropzone.hooks.ts":{"bytesInOutput":7624}},"bytes":15561},"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-text","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true},{"path":"@mekari/pixel3-spinner","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":125},"src/dropzone.tsx":{"bytesInOutput":5434},"src/modules/dropzone.props.ts":{"bytesInOutput":1260},"src/modules/dropzone.hooks.ts":{"bytesInOutput":7624}},"bytes":15563},"dist/modules/dropzone.hooks.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/dropzone.hooks.ts","inputs":{"src/modules/dropzone.hooks.ts":{"bytesInOutput":7784}},"bytes":8812},"dist/modules/dropzone.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/dropzone.props.ts","inputs":{"src/modules/dropzone.props.ts":{"bytesInOutput":1460}},"bytes":2416}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/dropzone.props.ts":{"bytes":2052,"imports":[],"format":"esm"},"src/modules/dropzone.hooks.ts":{"bytes":6931,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/dropzone.tsx":{"bytes":4803,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"src/modules/dropzone.props.ts","kind":"import-statement","original":"./modules/dropzone.props"},{"path":"src/modules/dropzone.hooks.ts","kind":"import-statement","original":"./modules/dropzone.hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":125,"imports":[{"path":"src/dropzone.tsx","kind":"import-statement","original":"./dropzone"}],"format":"esm"}},"outputs":{"dist/dropzone.mjs":{"imports":[{"path":"dist/chunk-DEUKYB7V.mjs","kind":"import-statement"},{"path":"dist/chunk-PB3KHIIV.mjs","kind":"import-statement"},{"path":"dist/chunk-CQO276YD.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpDropzone"],"entryPoint":"src/dropzone.tsx","inputs":{},"bytes":171},"dist/index.mjs":{"imports":[{"path":"dist/chunk-DEUKYB7V.mjs","kind":"import-statement"},{"path":"dist/chunk-PB3KHIIV.mjs","kind":"import-statement"},{"path":"dist/chunk-CQO276YD.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpDropzone"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":171},"dist/chunk-DEUKYB7V.mjs":{"imports":[{"path":"dist/chunk-PB3KHIIV.mjs","kind":"import-statement"},{"path":"dist/chunk-CQO276YD.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true}],"exports":["MpDropzone"],"inputs":{"src/dropzone.tsx":{"bytesInOutput":4610}},"bytes":4832},"dist/modules/dropzone.hooks.mjs":{"imports":[{"path":"dist/chunk-PB3KHIIV.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useDropzone"],"entryPoint":"src/modules/dropzone.hooks.ts","inputs":{},"bytes":113},"dist/chunk-PB3KHIIV.mjs":{"imports":[{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true}],"exports":["useDropzone"],"inputs":{"src/modules/dropzone.hooks.ts":{"bytesInOutput":7035}},"bytes":7145},"dist/modules/dropzone.props.mjs":{"imports":[{"path":"dist/chunk-CQO276YD.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["dropzoneEmit","dropzoneProps"],"entryPoint":"src/modules/dropzone.props.ts","inputs":{},"bytes":149},"dist/chunk-CQO276YD.mjs":{"imports":[],"exports":["dropzoneEmit","dropzoneProps"],"inputs":{"src/modules/dropzone.props.ts":{"bytesInOutput":1260}},"bytes":1338},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151}}}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { DropzoneProps, DropzoenEmits } from './dropzone.props.mjs';
|
|
3
|
+
|
|
4
|
+
declare function useDropzone(props: DropzoneProps, emit: DropzoenEmits): {
|
|
5
|
+
rootAttrs: vue.ComputedRef<{
|
|
6
|
+
'data-pixel-component': string;
|
|
7
|
+
id: string | undefined;
|
|
8
|
+
class: string;
|
|
9
|
+
onClick: (e: Event) => void;
|
|
10
|
+
onDragover: (e: DragEvent) => void;
|
|
11
|
+
onDragleave: (e: DragEvent) => void;
|
|
12
|
+
onDrop: (e: DragEvent) => void;
|
|
13
|
+
}>;
|
|
14
|
+
wrapperAttrs: vue.ComputedRef<{
|
|
15
|
+
'data-invalid': true | undefined;
|
|
16
|
+
'data-disabled': true | undefined;
|
|
17
|
+
'data-variant': "default" | "logo" | "product" | "avatar";
|
|
18
|
+
tabindex: number;
|
|
19
|
+
class: string;
|
|
20
|
+
style: {
|
|
21
|
+
background: string;
|
|
22
|
+
borderRadius: string;
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
boxAttrs: vue.ComputedRef<{
|
|
26
|
+
class: string;
|
|
27
|
+
}>;
|
|
28
|
+
logoBoxAttrs: vue.ComputedRef<{
|
|
29
|
+
class: string;
|
|
30
|
+
onClick: () => void;
|
|
31
|
+
}>;
|
|
32
|
+
productBoxAttrs: vue.ComputedRef<{
|
|
33
|
+
class: string;
|
|
34
|
+
onClick: () => void;
|
|
35
|
+
}>;
|
|
36
|
+
avatarBoxAttrs: vue.ComputedRef<{
|
|
37
|
+
class: string;
|
|
38
|
+
onClick: () => void;
|
|
39
|
+
}>;
|
|
40
|
+
overlayWrapperAttrs: vue.ComputedRef<{
|
|
41
|
+
class: string;
|
|
42
|
+
}>;
|
|
43
|
+
overlayAttrs: vue.ComputedRef<{
|
|
44
|
+
ref: vue.Ref<any>;
|
|
45
|
+
class: string;
|
|
46
|
+
style: {
|
|
47
|
+
display: string;
|
|
48
|
+
background: string;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
inputAttrs: vue.ComputedRef<{
|
|
52
|
+
ref: vue.Ref<any>;
|
|
53
|
+
id: string;
|
|
54
|
+
class: string;
|
|
55
|
+
type: string;
|
|
56
|
+
name: string | undefined;
|
|
57
|
+
accept: string | undefined;
|
|
58
|
+
multiple: boolean;
|
|
59
|
+
disabled: boolean;
|
|
60
|
+
required: boolean;
|
|
61
|
+
onChange: (e: Event) => void;
|
|
62
|
+
}>;
|
|
63
|
+
imageAttrs: vue.ComputedRef<{
|
|
64
|
+
src: string;
|
|
65
|
+
style: {
|
|
66
|
+
borderRadius: string;
|
|
67
|
+
height: string;
|
|
68
|
+
objectFit: "cover";
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
cancelButtonAttrs: vue.ComputedRef<{
|
|
72
|
+
color: string;
|
|
73
|
+
style: {
|
|
74
|
+
cursor: string;
|
|
75
|
+
};
|
|
76
|
+
onClick: (e: Event) => void;
|
|
77
|
+
}>;
|
|
78
|
+
browseButtonAttrs: vue.ComputedRef<{
|
|
79
|
+
as: "span";
|
|
80
|
+
weight: "semiBold";
|
|
81
|
+
color: string;
|
|
82
|
+
style: {
|
|
83
|
+
cursor: string;
|
|
84
|
+
};
|
|
85
|
+
onClick: () => void;
|
|
86
|
+
}>;
|
|
87
|
+
previewAttrs: vue.ComputedRef<{
|
|
88
|
+
class: string;
|
|
89
|
+
}>;
|
|
90
|
+
overlayPreviewAttrs: vue.ComputedRef<{
|
|
91
|
+
'data-overlay-preview': boolean;
|
|
92
|
+
class: string;
|
|
93
|
+
onClick: () => void;
|
|
94
|
+
}>;
|
|
95
|
+
clearButtonAttrs: vue.ComputedRef<{
|
|
96
|
+
class: string;
|
|
97
|
+
name: string;
|
|
98
|
+
variant: "fill";
|
|
99
|
+
color: "red.400";
|
|
100
|
+
style: {
|
|
101
|
+
top: string;
|
|
102
|
+
right: string;
|
|
103
|
+
};
|
|
104
|
+
onClick: (e: Event) => void;
|
|
105
|
+
}>;
|
|
106
|
+
hasPreview: vue.ComputedRef<string | false>;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export { useDropzone };
|