@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.
@@ -0,0 +1,140 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/modules/upload.props.ts
21
+ var upload_props_exports = {};
22
+ __export(upload_props_exports, {
23
+ uploadEmit: () => uploadEmit,
24
+ uploadListEmit: () => uploadListEmit,
25
+ uploadListProps: () => uploadListProps,
26
+ uploadProps: () => uploadProps
27
+ });
28
+ module.exports = __toCommonJS(upload_props_exports);
29
+ var uploadProps = {
30
+ id: {
31
+ type: String,
32
+ default: ""
33
+ },
34
+ fileList: {
35
+ type: Array
36
+ },
37
+ accept: {
38
+ type: String
39
+ },
40
+ name: {
41
+ type: String
42
+ },
43
+ placeholder: {
44
+ type: String,
45
+ default: "No file selected"
46
+ },
47
+ loadingText: {
48
+ type: String,
49
+ default: "Uploading..."
50
+ },
51
+ buttonCaption: {
52
+ type: String,
53
+ default: "Choose file"
54
+ },
55
+ value: {
56
+ type: String
57
+ },
58
+ modelValue: {
59
+ type: String
60
+ },
61
+ isLoading: {
62
+ type: Boolean,
63
+ default: false
64
+ },
65
+ isDisabled: {
66
+ type: Boolean,
67
+ default: false
68
+ },
69
+ isInvalid: {
70
+ type: Boolean,
71
+ default: false
72
+ },
73
+ isRequired: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ isResetOnChange: {
78
+ type: Boolean,
79
+ default: false
80
+ },
81
+ isMultiple: {
82
+ type: Boolean,
83
+ default: false
84
+ },
85
+ isFullWidth: {
86
+ type: Boolean,
87
+ default: false
88
+ }
89
+ };
90
+ var uploadListProps = {
91
+ id: {
92
+ type: String,
93
+ default: ""
94
+ },
95
+ status: {
96
+ type: String,
97
+ default: "success"
98
+ },
99
+ title: {
100
+ type: String,
101
+ default: ""
102
+ },
103
+ subtitle: {
104
+ type: String,
105
+ default: ""
106
+ },
107
+ iconName: {
108
+ type: String,
109
+ default: "image-document"
110
+ },
111
+ iconColor: {
112
+ type: String,
113
+ default: "gray.600"
114
+ },
115
+ iconVariant: {
116
+ type: String,
117
+ default: "outline"
118
+ },
119
+ isShowDownloadButton: {
120
+ type: Boolean,
121
+ default: true
122
+ },
123
+ isShowRemoveButton: {
124
+ type: Boolean,
125
+ default: true
126
+ },
127
+ isShowCancelButton: {
128
+ type: Boolean,
129
+ default: true
130
+ }
131
+ };
132
+ var uploadEmit = ["click", "change", "clear"];
133
+ var uploadListEmit = ["click", "cancel", "remove", "download"];
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ uploadEmit,
137
+ uploadListEmit,
138
+ uploadListProps,
139
+ uploadProps
140
+ });
@@ -0,0 +1,13 @@
1
+ import {
2
+ uploadEmit,
3
+ uploadListEmit,
4
+ uploadListProps,
5
+ uploadProps
6
+ } from "../chunk-P2IS3QXL.mjs";
7
+ import "../chunk-QZ7VFGWC.mjs";
8
+ export {
9
+ uploadEmit,
10
+ uploadListEmit,
11
+ uploadListProps,
12
+ uploadProps
13
+ };
@@ -0,0 +1,101 @@
1
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
2
+ import * as vue from 'vue';
3
+
4
+ declare const MpUploadList: vue.DefineComponent<{
5
+ id: {
6
+ type: vue.PropType<string>;
7
+ default: string;
8
+ };
9
+ status: {
10
+ type: vue.PropType<"error" | "success" | "loading">;
11
+ default: string;
12
+ };
13
+ title: {
14
+ type: vue.PropType<string>;
15
+ default: string;
16
+ };
17
+ subtitle: {
18
+ type: vue.PropType<string>;
19
+ default: string;
20
+ };
21
+ iconName: {
22
+ type: vue.PropType<string>;
23
+ default: string;
24
+ };
25
+ iconColor: {
26
+ type: vue.PropType<string>;
27
+ default: string;
28
+ };
29
+ iconVariant: {
30
+ type: vue.PropType<string>;
31
+ default: string;
32
+ };
33
+ isShowDownloadButton: {
34
+ type: vue.PropType<boolean>;
35
+ default: boolean;
36
+ };
37
+ isShowRemoveButton: {
38
+ type: vue.PropType<boolean>;
39
+ default: boolean;
40
+ };
41
+ isShowCancelButton: {
42
+ type: vue.PropType<boolean>;
43
+ default: boolean;
44
+ };
45
+ }, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, string[], string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
46
+ id: {
47
+ type: vue.PropType<string>;
48
+ default: string;
49
+ };
50
+ status: {
51
+ type: vue.PropType<"error" | "success" | "loading">;
52
+ default: string;
53
+ };
54
+ title: {
55
+ type: vue.PropType<string>;
56
+ default: string;
57
+ };
58
+ subtitle: {
59
+ type: vue.PropType<string>;
60
+ default: string;
61
+ };
62
+ iconName: {
63
+ type: vue.PropType<string>;
64
+ default: string;
65
+ };
66
+ iconColor: {
67
+ type: vue.PropType<string>;
68
+ default: string;
69
+ };
70
+ iconVariant: {
71
+ type: vue.PropType<string>;
72
+ default: string;
73
+ };
74
+ isShowDownloadButton: {
75
+ type: vue.PropType<boolean>;
76
+ default: boolean;
77
+ };
78
+ isShowRemoveButton: {
79
+ type: vue.PropType<boolean>;
80
+ default: boolean;
81
+ };
82
+ isShowCancelButton: {
83
+ type: vue.PropType<boolean>;
84
+ default: boolean;
85
+ };
86
+ }>> & {
87
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
88
+ }, {
89
+ title: string;
90
+ id: string;
91
+ status: "error" | "success" | "loading";
92
+ subtitle: string;
93
+ iconName: string;
94
+ iconColor: string;
95
+ iconVariant: string;
96
+ isShowDownloadButton: boolean;
97
+ isShowRemoveButton: boolean;
98
+ isShowCancelButton: boolean;
99
+ }, {}>;
100
+
101
+ export { MpUploadList };
@@ -0,0 +1,101 @@
1
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
2
+ import * as vue from 'vue';
3
+
4
+ declare const MpUploadList: vue.DefineComponent<{
5
+ id: {
6
+ type: vue.PropType<string>;
7
+ default: string;
8
+ };
9
+ status: {
10
+ type: vue.PropType<"error" | "success" | "loading">;
11
+ default: string;
12
+ };
13
+ title: {
14
+ type: vue.PropType<string>;
15
+ default: string;
16
+ };
17
+ subtitle: {
18
+ type: vue.PropType<string>;
19
+ default: string;
20
+ };
21
+ iconName: {
22
+ type: vue.PropType<string>;
23
+ default: string;
24
+ };
25
+ iconColor: {
26
+ type: vue.PropType<string>;
27
+ default: string;
28
+ };
29
+ iconVariant: {
30
+ type: vue.PropType<string>;
31
+ default: string;
32
+ };
33
+ isShowDownloadButton: {
34
+ type: vue.PropType<boolean>;
35
+ default: boolean;
36
+ };
37
+ isShowRemoveButton: {
38
+ type: vue.PropType<boolean>;
39
+ default: boolean;
40
+ };
41
+ isShowCancelButton: {
42
+ type: vue.PropType<boolean>;
43
+ default: boolean;
44
+ };
45
+ }, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, string[], string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
46
+ id: {
47
+ type: vue.PropType<string>;
48
+ default: string;
49
+ };
50
+ status: {
51
+ type: vue.PropType<"error" | "success" | "loading">;
52
+ default: string;
53
+ };
54
+ title: {
55
+ type: vue.PropType<string>;
56
+ default: string;
57
+ };
58
+ subtitle: {
59
+ type: vue.PropType<string>;
60
+ default: string;
61
+ };
62
+ iconName: {
63
+ type: vue.PropType<string>;
64
+ default: string;
65
+ };
66
+ iconColor: {
67
+ type: vue.PropType<string>;
68
+ default: string;
69
+ };
70
+ iconVariant: {
71
+ type: vue.PropType<string>;
72
+ default: string;
73
+ };
74
+ isShowDownloadButton: {
75
+ type: vue.PropType<boolean>;
76
+ default: boolean;
77
+ };
78
+ isShowRemoveButton: {
79
+ type: vue.PropType<boolean>;
80
+ default: boolean;
81
+ };
82
+ isShowCancelButton: {
83
+ type: vue.PropType<boolean>;
84
+ default: boolean;
85
+ };
86
+ }>> & {
87
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
88
+ }, {
89
+ title: string;
90
+ id: string;
91
+ status: "error" | "success" | "loading";
92
+ subtitle: string;
93
+ iconName: string;
94
+ iconColor: string;
95
+ iconVariant: string;
96
+ isShowDownloadButton: boolean;
97
+ isShowRemoveButton: boolean;
98
+ isShowCancelButton: boolean;
99
+ }, {}>;
100
+
101
+ export { MpUploadList };
@@ -0,0 +1,243 @@
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/upload-list.tsx
22
+ var upload_list_exports = {};
23
+ __export(upload_list_exports, {
24
+ MpUploadList: () => MpUploadList
25
+ });
26
+ module.exports = __toCommonJS(upload_list_exports);
27
+ var import_vue2 = require("vue");
28
+ var import_vue3 = require("vue");
29
+ var import_pixel3_button = require("@mekari/pixel3-button");
30
+ var import_pixel3_text = require("@mekari/pixel3-text");
31
+ var import_pixel3_icon = require("@mekari/pixel3-icon");
32
+ var import_pixel3_spinner = require("@mekari/pixel3-spinner");
33
+ var import_recipes2 = require("@mekari/pixel3-styled-system/recipes");
34
+
35
+ // src/modules/upload.props.ts
36
+ var uploadListProps = {
37
+ id: {
38
+ type: String,
39
+ default: ""
40
+ },
41
+ status: {
42
+ type: String,
43
+ default: "success"
44
+ },
45
+ title: {
46
+ type: String,
47
+ default: ""
48
+ },
49
+ subtitle: {
50
+ type: String,
51
+ default: ""
52
+ },
53
+ iconName: {
54
+ type: String,
55
+ default: "image-document"
56
+ },
57
+ iconColor: {
58
+ type: String,
59
+ default: "gray.600"
60
+ },
61
+ iconVariant: {
62
+ type: String,
63
+ default: "outline"
64
+ },
65
+ isShowDownloadButton: {
66
+ type: Boolean,
67
+ default: true
68
+ },
69
+ isShowRemoveButton: {
70
+ type: Boolean,
71
+ default: true
72
+ },
73
+ isShowCancelButton: {
74
+ type: Boolean,
75
+ default: true
76
+ }
77
+ };
78
+ var uploadListEmit = ["click", "cancel", "remove", "download"];
79
+
80
+ // src/modules/upload.hooks.ts
81
+ var import_vue = require("vue");
82
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
83
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
84
+ function useUploadList(props, emit) {
85
+ const {
86
+ id,
87
+ status,
88
+ iconName,
89
+ iconColor,
90
+ iconVariant,
91
+ isShowCancelButton,
92
+ isShowDownloadButton,
93
+ isShowRemoveButton
94
+ } = (0, import_vue.toRefs)(props);
95
+ const getId = id.value || (0, import_pixel3_utils.getUniqueId)("", "upload-list").value;
96
+ const color = (0, import_vue.computed)(() => {
97
+ let title = "dark";
98
+ let subtitle = "gray.600";
99
+ if (status.value === "success") {
100
+ title = "blue.700";
101
+ }
102
+ if (status.value === "error") {
103
+ title = "red.400";
104
+ subtitle = "red.400";
105
+ }
106
+ return {
107
+ title,
108
+ subtitle
109
+ };
110
+ });
111
+ const hasCancelButton = (0, import_vue.computed)(() => {
112
+ return isShowCancelButton.value && status.value === "loading";
113
+ });
114
+ const hasDownloadButton = (0, import_vue.computed)(() => {
115
+ return isShowDownloadButton.value && status.value === "success";
116
+ });
117
+ const hasRemoveButton = (0, import_vue.computed)(() => {
118
+ return isShowRemoveButton.value && (status.value === "success" || status.value === "error");
119
+ });
120
+ const rootAttrs = (0, import_vue.computed)(() => {
121
+ return {
122
+ "data-pixel-component": "MpUploadList",
123
+ id: getId,
124
+ tabindex: 0,
125
+ class: (0, import_recipes.uploadListSlotRecipe)().root
126
+ };
127
+ });
128
+ const iconAttrs = (0, import_vue.computed)(() => {
129
+ return {
130
+ size: "md",
131
+ name: status.value === "error" ? "error" : iconName.value,
132
+ color: status.value === "error" ? "red.700" : iconColor.value,
133
+ variant: status.value === "error" ? "duotone" : iconVariant.value
134
+ };
135
+ });
136
+ const titleWrapperAttrs = (0, import_vue.computed)(() => {
137
+ return {
138
+ class: (0, import_recipes.uploadListSlotRecipe)().titleWrapper,
139
+ style: {
140
+ cursor: status.value === "success" ? "pointer" : "default"
141
+ },
142
+ onClick: handleClick
143
+ };
144
+ });
145
+ const buttonCancelAttrs = (0, import_vue.computed)(() => {
146
+ return {
147
+ variant: "ghost",
148
+ size: "sm",
149
+ leftIcon: "close",
150
+ onClick: (e) => emit("cancel", e)
151
+ };
152
+ });
153
+ const buttonDownloadAttrs = (0, import_vue.computed)(() => {
154
+ return {
155
+ variant: "ghost",
156
+ size: "sm",
157
+ leftIcon: "download",
158
+ onClick: (e) => emit("download", e)
159
+ };
160
+ });
161
+ const buttonRemoveAttrs = (0, import_vue.computed)(() => {
162
+ return {
163
+ variant: "ghost",
164
+ size: "sm",
165
+ leftIcon: "minus-circular",
166
+ onClick: (e) => emit("remove", e)
167
+ };
168
+ });
169
+ function handleClick(e) {
170
+ if (status.value !== "success") {
171
+ return;
172
+ }
173
+ emit("click", e);
174
+ }
175
+ __name(handleClick, "handleClick");
176
+ return {
177
+ color,
178
+ rootAttrs,
179
+ iconAttrs,
180
+ titleWrapperAttrs,
181
+ buttonCancelAttrs,
182
+ buttonDownloadAttrs,
183
+ buttonRemoveAttrs,
184
+ hasCancelButton,
185
+ hasDownloadButton,
186
+ hasRemoveButton
187
+ };
188
+ }
189
+ __name(useUploadList, "useUploadList");
190
+
191
+ // src/upload-list.tsx
192
+ function _isSlot(s) {
193
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue2.isVNode)(s);
194
+ }
195
+ __name(_isSlot, "_isSlot");
196
+ var MpUploadList = (0, import_vue3.defineComponent)({
197
+ name: "MpUploadList",
198
+ props: uploadListProps,
199
+ emits: uploadListEmit,
200
+ setup(props, {
201
+ emit
202
+ }) {
203
+ const {
204
+ color,
205
+ rootAttrs,
206
+ iconAttrs,
207
+ titleWrapperAttrs,
208
+ buttonCancelAttrs,
209
+ buttonDownloadAttrs,
210
+ buttonRemoveAttrs,
211
+ hasCancelButton,
212
+ hasDownloadButton,
213
+ hasRemoveButton
214
+ } = useUploadList(props, emit);
215
+ return () => {
216
+ const {
217
+ status,
218
+ title,
219
+ subtitle
220
+ } = props;
221
+ return (0, import_vue2.createVNode)("div", rootAttrs.value, [status === "loading" ? (0, import_vue2.createVNode)(import_pixel3_spinner.MpSpinner, {
222
+ "size": "sm"
223
+ }, null) : (0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, iconAttrs.value, null), (0, import_vue2.createVNode)("div", titleWrapperAttrs.value, [(0, import_vue2.withDirectives)((0, import_vue2.createVNode)(import_pixel3_text.MpText, {
224
+ "color": color.value.title,
225
+ "is-truncated": true
226
+ }, _isSlot(title) ? title : {
227
+ default: () => [title]
228
+ }), [[(0, import_vue2.resolveDirective)("tooltip"), title]]), (0, import_vue2.createVNode)(import_pixel3_text.MpText, {
229
+ "color": color.value.subtitle,
230
+ "size": "body-small",
231
+ "is-truncated": true
232
+ }, _isSlot(subtitle) ? subtitle : {
233
+ default: () => [subtitle]
234
+ })]), (0, import_vue2.createVNode)("div", {
235
+ "class": (0, import_recipes2.uploadListSlotRecipe)().actionWrapper
236
+ }, [hasCancelButton.value && (0, import_vue2.withDirectives)((0, import_vue2.createVNode)(import_pixel3_button.MpButton, buttonCancelAttrs.value, null), [[(0, import_vue2.resolveDirective)("tooltip"), "cancel"]]), hasDownloadButton.value && (0, import_vue2.withDirectives)((0, import_vue2.createVNode)(import_pixel3_button.MpButton, buttonDownloadAttrs.value, null), [[(0, import_vue2.resolveDirective)("tooltip"), "download"]]), hasRemoveButton.value && (0, import_vue2.withDirectives)((0, import_vue2.createVNode)(import_pixel3_button.MpButton, buttonRemoveAttrs.value, null), [[(0, import_vue2.resolveDirective)("tooltip"), "remove"]])])]);
237
+ };
238
+ }
239
+ });
240
+ // Annotate the CommonJS export names for ESM import in node:
241
+ 0 && (module.exports = {
242
+ MpUploadList
243
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ MpUploadList
3
+ } from "./chunk-QH7SBWSH.mjs";
4
+ import "./chunk-IEVDIM2Y.mjs";
5
+ import "./chunk-P2IS3QXL.mjs";
6
+ import "./chunk-QZ7VFGWC.mjs";
7
+ export {
8
+ MpUploadList
9
+ };