@mekari/pixel3-upload 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-IEVDIM2Y.mjs +257 -0
- package/dist/chunk-P2IS3QXL.mjs +113 -0
- package/dist/chunk-QH7SBWSH.mjs +71 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-XCJP2E47.mjs +54 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +487 -0
- package/dist/index.mjs +13 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/upload.hooks.d.mts +97 -0
- package/dist/modules/upload.hooks.d.ts +97 -0
- package/dist/modules/upload.hooks.js +279 -0
- package/dist/modules/upload.hooks.mjs +9 -0
- package/dist/modules/upload.props.d.mts +116 -0
- package/dist/modules/upload.props.d.ts +116 -0
- package/dist/modules/upload.props.js +140 -0
- package/dist/modules/upload.props.mjs +13 -0
- package/dist/upload-list.d.mts +101 -0
- package/dist/upload-list.d.ts +101 -0
- package/dist/upload-list.js +243 -0
- package/dist/upload-list.mjs +9 -0
- package/dist/upload.d.mts +141 -0
- package/dist/upload.d.ts +141 -0
- package/dist/upload.js +277 -0
- package/dist/upload.mjs +9 -0
- package/package.json +46 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
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
|
+
MpUpload: () => MpUpload,
|
|
25
|
+
MpUploadList: () => MpUploadList
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
|
|
29
|
+
// src/upload.tsx
|
|
30
|
+
var import_vue2 = require("vue");
|
|
31
|
+
var import_vue3 = require("vue");
|
|
32
|
+
var import_pixel3_button = require("@mekari/pixel3-button");
|
|
33
|
+
var import_pixel3_text = require("@mekari/pixel3-text");
|
|
34
|
+
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
35
|
+
|
|
36
|
+
// src/modules/upload.props.ts
|
|
37
|
+
var uploadProps = {
|
|
38
|
+
id: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ""
|
|
41
|
+
},
|
|
42
|
+
fileList: {
|
|
43
|
+
type: Array
|
|
44
|
+
},
|
|
45
|
+
accept: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
name: {
|
|
49
|
+
type: String
|
|
50
|
+
},
|
|
51
|
+
placeholder: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "No file selected"
|
|
54
|
+
},
|
|
55
|
+
loadingText: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "Uploading..."
|
|
58
|
+
},
|
|
59
|
+
buttonCaption: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "Choose file"
|
|
62
|
+
},
|
|
63
|
+
value: {
|
|
64
|
+
type: String
|
|
65
|
+
},
|
|
66
|
+
modelValue: {
|
|
67
|
+
type: String
|
|
68
|
+
},
|
|
69
|
+
isLoading: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
isDisabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
isInvalid: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
isRequired: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
isResetOnChange: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
isMultiple: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
isFullWidth: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var uploadListProps = {
|
|
99
|
+
id: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: ""
|
|
102
|
+
},
|
|
103
|
+
status: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: "success"
|
|
106
|
+
},
|
|
107
|
+
title: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ""
|
|
110
|
+
},
|
|
111
|
+
subtitle: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: ""
|
|
114
|
+
},
|
|
115
|
+
iconName: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: "image-document"
|
|
118
|
+
},
|
|
119
|
+
iconColor: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "gray.600"
|
|
122
|
+
},
|
|
123
|
+
iconVariant: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "outline"
|
|
126
|
+
},
|
|
127
|
+
isShowDownloadButton: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: true
|
|
130
|
+
},
|
|
131
|
+
isShowRemoveButton: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: true
|
|
134
|
+
},
|
|
135
|
+
isShowCancelButton: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: true
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var uploadEmit = ["click", "change", "clear"];
|
|
141
|
+
var uploadListEmit = ["click", "cancel", "remove", "download"];
|
|
142
|
+
|
|
143
|
+
// src/modules/upload.hooks.ts
|
|
144
|
+
var import_vue = require("vue");
|
|
145
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
146
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
147
|
+
function useUpload(props, emit) {
|
|
148
|
+
const {
|
|
149
|
+
id,
|
|
150
|
+
fileList,
|
|
151
|
+
placeholder,
|
|
152
|
+
accept,
|
|
153
|
+
name,
|
|
154
|
+
loadingText,
|
|
155
|
+
isLoading,
|
|
156
|
+
isDisabled,
|
|
157
|
+
isInvalid,
|
|
158
|
+
isRequired,
|
|
159
|
+
isResetOnChange,
|
|
160
|
+
isMultiple,
|
|
161
|
+
isFullWidth
|
|
162
|
+
} = (0, import_vue.toRefs)(props);
|
|
163
|
+
const files = (0, import_vue.ref)(fileList == null ? void 0 : fileList.value);
|
|
164
|
+
const fileInput = (0, import_vue.ref)();
|
|
165
|
+
const getId = id.value || (0, import_pixel3_utils.getUniqueId)("", "upload").value;
|
|
166
|
+
const fileName = (0, import_vue.computed)(() => {
|
|
167
|
+
if (isLoading.value) {
|
|
168
|
+
return loadingText.value;
|
|
169
|
+
} else {
|
|
170
|
+
if (totalFiles.value === 0) {
|
|
171
|
+
return placeholder.value;
|
|
172
|
+
} else if (files.value && totalFiles.value === 1) {
|
|
173
|
+
return files.value[0].name;
|
|
174
|
+
} else {
|
|
175
|
+
return `${totalFiles.value} files`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
const totalFiles = (0, import_vue.computed)(() => {
|
|
180
|
+
var _a;
|
|
181
|
+
return ((_a = files.value) == null ? void 0 : _a.length) || 0;
|
|
182
|
+
});
|
|
183
|
+
const isShowTooltip = (0, import_vue.computed)(() => {
|
|
184
|
+
var _a;
|
|
185
|
+
return ((_a = files.value) == null ? void 0 : _a.length) === 1;
|
|
186
|
+
});
|
|
187
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
188
|
+
return {
|
|
189
|
+
"data-pixel-component": "MpUpload",
|
|
190
|
+
"data-invalid": isInvalid.value || void 0,
|
|
191
|
+
"data-disabled": isDisabled.value || void 0,
|
|
192
|
+
id: getId,
|
|
193
|
+
tabindex: isDisabled.value ? -1 : 0,
|
|
194
|
+
class: (0, import_recipes.uploadSlotRecipe)().root,
|
|
195
|
+
style: {
|
|
196
|
+
maxWidth: isFullWidth.value ? "100%" : "var(--mp-sizes-65)"
|
|
197
|
+
},
|
|
198
|
+
onClick: handleClick
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
const buttonAttrs = (0, import_vue.computed)(() => {
|
|
202
|
+
return {
|
|
203
|
+
variant: "secondary",
|
|
204
|
+
size: "sm",
|
|
205
|
+
isDisabled: isDisabled.value
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
const textAttrs = (0, import_vue.computed)(() => {
|
|
209
|
+
return {
|
|
210
|
+
color: !isLoading.value && totalFiles.value >= 1 ? "dark" : "gray.400",
|
|
211
|
+
isTruncated: true
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
const resetButtonAttrs = (0, import_vue.computed)(() => {
|
|
215
|
+
return {
|
|
216
|
+
class: (0, import_recipes.uploadSlotRecipe)().resetButton,
|
|
217
|
+
"aria-label": "reset button",
|
|
218
|
+
name: "reset",
|
|
219
|
+
size: "sm",
|
|
220
|
+
color: "gray.400",
|
|
221
|
+
onClick: handleClear
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
const inputAttrs = (0, import_vue.computed)(() => {
|
|
225
|
+
return {
|
|
226
|
+
ref: fileInput,
|
|
227
|
+
id: `input-${getId}`,
|
|
228
|
+
class: (0, import_recipes.sharedSlotRecipe)().hidden,
|
|
229
|
+
type: "file",
|
|
230
|
+
name: name == null ? void 0 : name.value,
|
|
231
|
+
accept: accept == null ? void 0 : accept.value,
|
|
232
|
+
multiple: isMultiple.value,
|
|
233
|
+
disabled: isDisabled.value,
|
|
234
|
+
required: isRequired.value,
|
|
235
|
+
onChange: handleChange
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
function clear() {
|
|
239
|
+
files.value = void 0;
|
|
240
|
+
fileInput.value.value = "";
|
|
241
|
+
}
|
|
242
|
+
__name(clear, "clear");
|
|
243
|
+
function handleClear(e) {
|
|
244
|
+
e.stopPropagation();
|
|
245
|
+
clear();
|
|
246
|
+
emit("clear", e);
|
|
247
|
+
}
|
|
248
|
+
__name(handleClear, "handleClear");
|
|
249
|
+
function handleChange(e) {
|
|
250
|
+
const target = e.target;
|
|
251
|
+
if (target && target.files) {
|
|
252
|
+
files.value = target.files;
|
|
253
|
+
}
|
|
254
|
+
emit("change", e);
|
|
255
|
+
}
|
|
256
|
+
__name(handleChange, "handleChange");
|
|
257
|
+
function handleClick(e) {
|
|
258
|
+
if (isDisabled.value) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (isResetOnChange.value) {
|
|
262
|
+
clear();
|
|
263
|
+
}
|
|
264
|
+
fileInput.value.click();
|
|
265
|
+
emit("click", e);
|
|
266
|
+
}
|
|
267
|
+
__name(handleClick, "handleClick");
|
|
268
|
+
(0, import_vue.watch)(() => fileList == null ? void 0 : fileList.value, (newValue) => {
|
|
269
|
+
if (newValue) {
|
|
270
|
+
files.value = newValue;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
return {
|
|
274
|
+
rootAttrs,
|
|
275
|
+
buttonAttrs,
|
|
276
|
+
textAttrs,
|
|
277
|
+
resetButtonAttrs,
|
|
278
|
+
inputAttrs,
|
|
279
|
+
fileName,
|
|
280
|
+
totalFiles,
|
|
281
|
+
isShowTooltip
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
__name(useUpload, "useUpload");
|
|
285
|
+
function useUploadList(props, emit) {
|
|
286
|
+
const {
|
|
287
|
+
id,
|
|
288
|
+
status,
|
|
289
|
+
iconName,
|
|
290
|
+
iconColor,
|
|
291
|
+
iconVariant,
|
|
292
|
+
isShowCancelButton,
|
|
293
|
+
isShowDownloadButton,
|
|
294
|
+
isShowRemoveButton
|
|
295
|
+
} = (0, import_vue.toRefs)(props);
|
|
296
|
+
const getId = id.value || (0, import_pixel3_utils.getUniqueId)("", "upload-list").value;
|
|
297
|
+
const color = (0, import_vue.computed)(() => {
|
|
298
|
+
let title = "dark";
|
|
299
|
+
let subtitle = "gray.600";
|
|
300
|
+
if (status.value === "success") {
|
|
301
|
+
title = "blue.700";
|
|
302
|
+
}
|
|
303
|
+
if (status.value === "error") {
|
|
304
|
+
title = "red.400";
|
|
305
|
+
subtitle = "red.400";
|
|
306
|
+
}
|
|
307
|
+
return {
|
|
308
|
+
title,
|
|
309
|
+
subtitle
|
|
310
|
+
};
|
|
311
|
+
});
|
|
312
|
+
const hasCancelButton = (0, import_vue.computed)(() => {
|
|
313
|
+
return isShowCancelButton.value && status.value === "loading";
|
|
314
|
+
});
|
|
315
|
+
const hasDownloadButton = (0, import_vue.computed)(() => {
|
|
316
|
+
return isShowDownloadButton.value && status.value === "success";
|
|
317
|
+
});
|
|
318
|
+
const hasRemoveButton = (0, import_vue.computed)(() => {
|
|
319
|
+
return isShowRemoveButton.value && (status.value === "success" || status.value === "error");
|
|
320
|
+
});
|
|
321
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
322
|
+
return {
|
|
323
|
+
"data-pixel-component": "MpUploadList",
|
|
324
|
+
id: getId,
|
|
325
|
+
tabindex: 0,
|
|
326
|
+
class: (0, import_recipes.uploadListSlotRecipe)().root
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
const iconAttrs = (0, import_vue.computed)(() => {
|
|
330
|
+
return {
|
|
331
|
+
size: "md",
|
|
332
|
+
name: status.value === "error" ? "error" : iconName.value,
|
|
333
|
+
color: status.value === "error" ? "red.700" : iconColor.value,
|
|
334
|
+
variant: status.value === "error" ? "duotone" : iconVariant.value
|
|
335
|
+
};
|
|
336
|
+
});
|
|
337
|
+
const titleWrapperAttrs = (0, import_vue.computed)(() => {
|
|
338
|
+
return {
|
|
339
|
+
class: (0, import_recipes.uploadListSlotRecipe)().titleWrapper,
|
|
340
|
+
style: {
|
|
341
|
+
cursor: status.value === "success" ? "pointer" : "default"
|
|
342
|
+
},
|
|
343
|
+
onClick: handleClick
|
|
344
|
+
};
|
|
345
|
+
});
|
|
346
|
+
const buttonCancelAttrs = (0, import_vue.computed)(() => {
|
|
347
|
+
return {
|
|
348
|
+
variant: "ghost",
|
|
349
|
+
size: "sm",
|
|
350
|
+
leftIcon: "close",
|
|
351
|
+
onClick: (e) => emit("cancel", e)
|
|
352
|
+
};
|
|
353
|
+
});
|
|
354
|
+
const buttonDownloadAttrs = (0, import_vue.computed)(() => {
|
|
355
|
+
return {
|
|
356
|
+
variant: "ghost",
|
|
357
|
+
size: "sm",
|
|
358
|
+
leftIcon: "download",
|
|
359
|
+
onClick: (e) => emit("download", e)
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
const buttonRemoveAttrs = (0, import_vue.computed)(() => {
|
|
363
|
+
return {
|
|
364
|
+
variant: "ghost",
|
|
365
|
+
size: "sm",
|
|
366
|
+
leftIcon: "minus-circular",
|
|
367
|
+
onClick: (e) => emit("remove", e)
|
|
368
|
+
};
|
|
369
|
+
});
|
|
370
|
+
function handleClick(e) {
|
|
371
|
+
if (status.value !== "success") {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
emit("click", e);
|
|
375
|
+
}
|
|
376
|
+
__name(handleClick, "handleClick");
|
|
377
|
+
return {
|
|
378
|
+
color,
|
|
379
|
+
rootAttrs,
|
|
380
|
+
iconAttrs,
|
|
381
|
+
titleWrapperAttrs,
|
|
382
|
+
buttonCancelAttrs,
|
|
383
|
+
buttonDownloadAttrs,
|
|
384
|
+
buttonRemoveAttrs,
|
|
385
|
+
hasCancelButton,
|
|
386
|
+
hasDownloadButton,
|
|
387
|
+
hasRemoveButton
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
__name(useUploadList, "useUploadList");
|
|
391
|
+
|
|
392
|
+
// src/upload.tsx
|
|
393
|
+
function _isSlot(s) {
|
|
394
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue2.isVNode)(s);
|
|
395
|
+
}
|
|
396
|
+
__name(_isSlot, "_isSlot");
|
|
397
|
+
var MpUpload = (0, import_vue3.defineComponent)({
|
|
398
|
+
name: "MpUpload",
|
|
399
|
+
props: uploadProps,
|
|
400
|
+
emits: uploadEmit,
|
|
401
|
+
setup(props, {
|
|
402
|
+
emit
|
|
403
|
+
}) {
|
|
404
|
+
const {
|
|
405
|
+
rootAttrs,
|
|
406
|
+
buttonAttrs,
|
|
407
|
+
textAttrs,
|
|
408
|
+
resetButtonAttrs,
|
|
409
|
+
inputAttrs,
|
|
410
|
+
fileName,
|
|
411
|
+
totalFiles,
|
|
412
|
+
isShowTooltip
|
|
413
|
+
} = useUpload(props, emit);
|
|
414
|
+
return () => {
|
|
415
|
+
const {
|
|
416
|
+
buttonCaption
|
|
417
|
+
} = props;
|
|
418
|
+
return (0, import_vue2.createVNode)("div", rootAttrs.value, [(0, import_vue2.createVNode)(import_pixel3_button.MpButton, buttonAttrs.value, _isSlot(buttonCaption) ? buttonCaption : {
|
|
419
|
+
default: () => [buttonCaption]
|
|
420
|
+
}), (0, import_vue2.withDirectives)((0, import_vue2.createVNode)(import_pixel3_text.MpText, textAttrs.value, {
|
|
421
|
+
default: () => [fileName.value]
|
|
422
|
+
}), [[(0, import_vue2.resolveDirective)("tooltip"), isShowTooltip.value ? fileName.value : ""]]), totalFiles.value > 0 && (0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, resetButtonAttrs.value, null), (0, import_vue2.createVNode)("input", inputAttrs.value, null)]);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// src/upload-list.tsx
|
|
428
|
+
var import_vue4 = require("vue");
|
|
429
|
+
var import_vue5 = require("vue");
|
|
430
|
+
var import_pixel3_button2 = require("@mekari/pixel3-button");
|
|
431
|
+
var import_pixel3_text2 = require("@mekari/pixel3-text");
|
|
432
|
+
var import_pixel3_icon2 = require("@mekari/pixel3-icon");
|
|
433
|
+
var import_pixel3_spinner = require("@mekari/pixel3-spinner");
|
|
434
|
+
var import_recipes2 = require("@mekari/pixel3-styled-system/recipes");
|
|
435
|
+
function _isSlot2(s) {
|
|
436
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue4.isVNode)(s);
|
|
437
|
+
}
|
|
438
|
+
__name(_isSlot2, "_isSlot");
|
|
439
|
+
var MpUploadList = (0, import_vue5.defineComponent)({
|
|
440
|
+
name: "MpUploadList",
|
|
441
|
+
props: uploadListProps,
|
|
442
|
+
emits: uploadListEmit,
|
|
443
|
+
setup(props, {
|
|
444
|
+
emit
|
|
445
|
+
}) {
|
|
446
|
+
const {
|
|
447
|
+
color,
|
|
448
|
+
rootAttrs,
|
|
449
|
+
iconAttrs,
|
|
450
|
+
titleWrapperAttrs,
|
|
451
|
+
buttonCancelAttrs,
|
|
452
|
+
buttonDownloadAttrs,
|
|
453
|
+
buttonRemoveAttrs,
|
|
454
|
+
hasCancelButton,
|
|
455
|
+
hasDownloadButton,
|
|
456
|
+
hasRemoveButton
|
|
457
|
+
} = useUploadList(props, emit);
|
|
458
|
+
return () => {
|
|
459
|
+
const {
|
|
460
|
+
status,
|
|
461
|
+
title,
|
|
462
|
+
subtitle
|
|
463
|
+
} = props;
|
|
464
|
+
return (0, import_vue4.createVNode)("div", rootAttrs.value, [status === "loading" ? (0, import_vue4.createVNode)(import_pixel3_spinner.MpSpinner, {
|
|
465
|
+
"size": "sm"
|
|
466
|
+
}, null) : (0, import_vue4.createVNode)(import_pixel3_icon2.MpIcon, iconAttrs.value, null), (0, import_vue4.createVNode)("div", titleWrapperAttrs.value, [(0, import_vue4.withDirectives)((0, import_vue4.createVNode)(import_pixel3_text2.MpText, {
|
|
467
|
+
"color": color.value.title,
|
|
468
|
+
"is-truncated": true
|
|
469
|
+
}, _isSlot2(title) ? title : {
|
|
470
|
+
default: () => [title]
|
|
471
|
+
}), [[(0, import_vue4.resolveDirective)("tooltip"), title]]), (0, import_vue4.createVNode)(import_pixel3_text2.MpText, {
|
|
472
|
+
"color": color.value.subtitle,
|
|
473
|
+
"size": "body-small",
|
|
474
|
+
"is-truncated": true
|
|
475
|
+
}, _isSlot2(subtitle) ? subtitle : {
|
|
476
|
+
default: () => [subtitle]
|
|
477
|
+
})]), (0, import_vue4.createVNode)("div", {
|
|
478
|
+
"class": (0, import_recipes2.uploadListSlotRecipe)().actionWrapper
|
|
479
|
+
}, [hasCancelButton.value && (0, import_vue4.withDirectives)((0, import_vue4.createVNode)(import_pixel3_button2.MpButton, buttonCancelAttrs.value, null), [[(0, import_vue4.resolveDirective)("tooltip"), "cancel"]]), hasDownloadButton.value && (0, import_vue4.withDirectives)((0, import_vue4.createVNode)(import_pixel3_button2.MpButton, buttonDownloadAttrs.value, null), [[(0, import_vue4.resolveDirective)("tooltip"), "download"]]), hasRemoveButton.value && (0, import_vue4.withDirectives)((0, import_vue4.createVNode)(import_pixel3_button2.MpButton, buttonRemoveAttrs.value, null), [[(0, import_vue4.resolveDirective)("tooltip"), "remove"]])])]);
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
484
|
+
0 && (module.exports = {
|
|
485
|
+
MpUpload,
|
|
486
|
+
MpUploadList
|
|
487
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MpUploadList
|
|
3
|
+
} from "./chunk-QH7SBWSH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
MpUpload
|
|
6
|
+
} from "./chunk-XCJP2E47.mjs";
|
|
7
|
+
import "./chunk-IEVDIM2Y.mjs";
|
|
8
|
+
import "./chunk-P2IS3QXL.mjs";
|
|
9
|
+
import "./chunk-QZ7VFGWC.mjs";
|
|
10
|
+
export {
|
|
11
|
+
MpUpload,
|
|
12
|
+
MpUploadList
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/upload.props.ts":{"bytes":2758,"imports":[],"format":"esm"},"src/modules/upload.hooks.ts":{"bytes":6400,"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/upload.tsx":{"bytes":1574,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"src/modules/upload.props.ts","kind":"import-statement","original":"./modules/upload.props"},{"path":"src/modules/upload.hooks.ts","kind":"import-statement","original":"./modules/upload.hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/upload-list.tsx":{"bytes":2517,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","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":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/upload.props.ts","kind":"import-statement","original":"./modules/upload.props"},{"path":"src/modules/upload.hooks.ts","kind":"import-statement","original":"./modules/upload.hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":167,"imports":[{"path":"src/upload.tsx","kind":"import-statement","original":"./upload"},{"path":"src/upload-list.tsx","kind":"import-statement","original":"./upload-list"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","kind":"require-call","external":true},{"path":"@mekari/pixel3-text","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","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},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","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":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":157},"src/upload.tsx":{"bytesInOutput":1511},"src/modules/upload.props.ts":{"bytesInOutput":1604},"src/modules/upload.hooks.ts":{"bytesInOutput":6686},"src/upload-list.tsx":{"bytesInOutput":2740}},"bytes":13848},"dist/upload-list.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","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":"@mekari/pixel3-styled-system/recipes","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/upload-list.tsx","inputs":{"src/upload-list.tsx":{"bytesInOutput":2880},"src/modules/upload.props.ts":{"bytesInOutput":690},"src/modules/upload.hooks.ts":{"bytesInOutput":3035}},"bytes":7712},"dist/upload.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","kind":"require-call","external":true},{"path":"@mekari/pixel3-text","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","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/upload.tsx","inputs":{"src/upload.tsx":{"bytesInOutput":1641},"src/modules/upload.props.ts":{"bytesInOutput":914},"src/modules/upload.hooks.ts":{"bytesInOutput":3813}},"bytes":7461},"dist/modules/upload.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/upload.hooks.ts","inputs":{"src/modules/upload.hooks.ts":{"bytesInOutput":6874}},"bytes":7915},"dist/modules/upload.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/upload.props.ts","inputs":{"src/modules/upload.props.ts":{"bytesInOutput":1872}},"bytes":2859}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/upload.props.ts":{"bytes":2758,"imports":[],"format":"esm"},"src/modules/upload.hooks.ts":{"bytes":6400,"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/upload.tsx":{"bytes":1574,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"src/modules/upload.props.ts","kind":"import-statement","original":"./modules/upload.props"},{"path":"src/modules/upload.hooks.ts","kind":"import-statement","original":"./modules/upload.hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/upload-list.tsx":{"bytes":2517,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","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":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/upload.props.ts","kind":"import-statement","original":"./modules/upload.props"},{"path":"src/modules/upload.hooks.ts","kind":"import-statement","original":"./modules/upload.hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":167,"imports":[{"path":"src/upload.tsx","kind":"import-statement","original":"./upload"},{"path":"src/upload-list.tsx","kind":"import-statement","original":"./upload-list"}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-QH7SBWSH.mjs","kind":"import-statement"},{"path":"dist/chunk-XCJP2E47.mjs","kind":"import-statement"},{"path":"dist/chunk-IEVDIM2Y.mjs","kind":"import-statement"},{"path":"dist/chunk-P2IS3QXL.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpUpload","MpUploadList"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":238},"dist/upload-list.mjs":{"imports":[{"path":"dist/chunk-QH7SBWSH.mjs","kind":"import-statement"},{"path":"dist/chunk-IEVDIM2Y.mjs","kind":"import-statement"},{"path":"dist/chunk-P2IS3QXL.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpUploadList"],"entryPoint":"src/upload-list.tsx","inputs":{},"bytes":175},"dist/chunk-QH7SBWSH.mjs":{"imports":[{"path":"dist/chunk-IEVDIM2Y.mjs","kind":"import-statement"},{"path":"dist/chunk-P2IS3QXL.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-button","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":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true}],"exports":["MpUploadList"],"inputs":{"src/upload-list.tsx":{"bytesInOutput":2322}},"bytes":2555},"dist/upload.mjs":{"imports":[{"path":"dist/chunk-XCJP2E47.mjs","kind":"import-statement"},{"path":"dist/chunk-IEVDIM2Y.mjs","kind":"import-statement"},{"path":"dist/chunk-P2IS3QXL.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpUpload"],"entryPoint":"src/upload.tsx","inputs":{},"bytes":167},"dist/chunk-XCJP2E47.mjs":{"imports":[{"path":"dist/chunk-IEVDIM2Y.mjs","kind":"import-statement"},{"path":"dist/chunk-P2IS3QXL.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-button","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true}],"exports":["MpUpload"],"inputs":{"src/upload.tsx":{"bytesInOutput":1391}},"bytes":1603},"dist/modules/upload.hooks.mjs":{"imports":[{"path":"dist/chunk-IEVDIM2Y.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useUpload","useUploadList"],"entryPoint":"src/modules/upload.hooks.ts","inputs":{},"bytes":143},"dist/chunk-IEVDIM2Y.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":["useUpload","useUploadList"],"inputs":{"src/modules/upload.hooks.ts":{"bytesInOutput":6223}},"bytes":6346},"dist/modules/upload.props.mjs":{"imports":[{"path":"dist/chunk-P2IS3QXL.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["uploadEmit","uploadListEmit","uploadListProps","uploadProps"],"entryPoint":"src/modules/upload.props.ts","inputs":{},"bytes":215},"dist/chunk-P2IS3QXL.mjs":{"imports":[],"exports":["uploadEmit","uploadListEmit","uploadListProps","uploadProps"],"inputs":{"src/modules/upload.props.ts":{"bytesInOutput":1604}},"bytes":1713},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151}}}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { UploadProps, UploadEmits, UploadListProps, UploadListEmits } from './upload.props.mjs';
|
|
3
|
+
|
|
4
|
+
declare function useUpload(props: UploadProps, emit: UploadEmits): {
|
|
5
|
+
rootAttrs: vue.ComputedRef<{
|
|
6
|
+
'data-pixel-component': string;
|
|
7
|
+
'data-invalid': true | undefined;
|
|
8
|
+
'data-disabled': true | undefined;
|
|
9
|
+
id: string | undefined;
|
|
10
|
+
tabindex: number;
|
|
11
|
+
class: string;
|
|
12
|
+
style: {
|
|
13
|
+
maxWidth: string;
|
|
14
|
+
};
|
|
15
|
+
onClick: (e: Event) => void;
|
|
16
|
+
}>;
|
|
17
|
+
buttonAttrs: vue.ComputedRef<{
|
|
18
|
+
variant: "secondary";
|
|
19
|
+
size: "sm";
|
|
20
|
+
isDisabled: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
textAttrs: vue.ComputedRef<{
|
|
23
|
+
color: string;
|
|
24
|
+
isTruncated: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
resetButtonAttrs: vue.ComputedRef<{
|
|
27
|
+
class: string;
|
|
28
|
+
'aria-label': string;
|
|
29
|
+
name: string;
|
|
30
|
+
size: "sm";
|
|
31
|
+
color: string;
|
|
32
|
+
onClick: (e: Event) => void;
|
|
33
|
+
}>;
|
|
34
|
+
inputAttrs: vue.ComputedRef<{
|
|
35
|
+
ref: vue.Ref<any>;
|
|
36
|
+
id: string;
|
|
37
|
+
class: string;
|
|
38
|
+
type: string;
|
|
39
|
+
name: string | undefined;
|
|
40
|
+
accept: string | undefined;
|
|
41
|
+
multiple: boolean;
|
|
42
|
+
disabled: boolean;
|
|
43
|
+
required: boolean;
|
|
44
|
+
onChange: (e: Event) => void;
|
|
45
|
+
}>;
|
|
46
|
+
fileName: vue.ComputedRef<unknown>;
|
|
47
|
+
totalFiles: vue.ComputedRef<number>;
|
|
48
|
+
isShowTooltip: vue.ComputedRef<boolean>;
|
|
49
|
+
};
|
|
50
|
+
declare function useUploadList(props: UploadListProps, emit: UploadListEmits): {
|
|
51
|
+
color: vue.ComputedRef<{
|
|
52
|
+
title: string;
|
|
53
|
+
subtitle: string;
|
|
54
|
+
}>;
|
|
55
|
+
rootAttrs: vue.ComputedRef<{
|
|
56
|
+
'data-pixel-component': string;
|
|
57
|
+
id: string | undefined;
|
|
58
|
+
tabindex: number;
|
|
59
|
+
class: string;
|
|
60
|
+
}>;
|
|
61
|
+
iconAttrs: vue.ComputedRef<{
|
|
62
|
+
size: "md";
|
|
63
|
+
name: string;
|
|
64
|
+
color: string;
|
|
65
|
+
variant: "outline" | "duotone" | "fill";
|
|
66
|
+
}>;
|
|
67
|
+
titleWrapperAttrs: vue.ComputedRef<{
|
|
68
|
+
class: string;
|
|
69
|
+
style: {
|
|
70
|
+
cursor: string;
|
|
71
|
+
};
|
|
72
|
+
onClick: (e: Event) => void;
|
|
73
|
+
}>;
|
|
74
|
+
buttonCancelAttrs: vue.ComputedRef<{
|
|
75
|
+
variant: "ghost";
|
|
76
|
+
size: "sm";
|
|
77
|
+
leftIcon: string;
|
|
78
|
+
onClick: (e: Event) => void;
|
|
79
|
+
}>;
|
|
80
|
+
buttonDownloadAttrs: vue.ComputedRef<{
|
|
81
|
+
variant: "ghost";
|
|
82
|
+
size: "sm";
|
|
83
|
+
leftIcon: string;
|
|
84
|
+
onClick: (e: Event) => void;
|
|
85
|
+
}>;
|
|
86
|
+
buttonRemoveAttrs: vue.ComputedRef<{
|
|
87
|
+
variant: "ghost";
|
|
88
|
+
size: "sm";
|
|
89
|
+
leftIcon: string;
|
|
90
|
+
onClick: (e: Event) => void;
|
|
91
|
+
}>;
|
|
92
|
+
hasCancelButton: vue.ComputedRef<boolean>;
|
|
93
|
+
hasDownloadButton: vue.ComputedRef<boolean>;
|
|
94
|
+
hasRemoveButton: vue.ComputedRef<boolean>;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { useUpload, useUploadList };
|