@youcan/celeste 0.6.60 → 0.6.61
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/celeste.css
CHANGED
|
@@ -3470,7 +3470,7 @@ to {
|
|
|
3470
3470
|
color: var(--color-icon-disabled-300);
|
|
3471
3471
|
}[data-v-3405639f] {
|
|
3472
3472
|
box-sizing: border-box;
|
|
3473
|
-
}.celeste-file-upload-area[data-v-
|
|
3473
|
+
}.celeste-file-upload-area[data-v-cfdea6ac] {
|
|
3474
3474
|
display: flex;
|
|
3475
3475
|
box-sizing: border-box;
|
|
3476
3476
|
flex-direction: column;
|
|
@@ -3485,40 +3485,40 @@ to {
|
|
|
3485
3485
|
background-color: var(--color-bg-white-0);
|
|
3486
3486
|
cursor: pointer;
|
|
3487
3487
|
}
|
|
3488
|
-
.celeste-file-upload-area[data-v-
|
|
3488
|
+
.celeste-file-upload-area[data-v-cfdea6ac]:hover {
|
|
3489
3489
|
background-color: var(--color-bg-weak-50);
|
|
3490
3490
|
}
|
|
3491
|
-
.celeste-file-upload-area > i[data-v-
|
|
3491
|
+
.celeste-file-upload-area > i[data-v-cfdea6ac] {
|
|
3492
3492
|
width: 24px;
|
|
3493
3493
|
height: 24px;
|
|
3494
3494
|
color: var(--color-icon-sub-600);
|
|
3495
3495
|
}
|
|
3496
|
-
.celeste-file-upload-area .celeste-file-upload-area-content[data-v-
|
|
3496
|
+
.celeste-file-upload-area .celeste-file-upload-area-content[data-v-cfdea6ac] {
|
|
3497
3497
|
display: grid;
|
|
3498
3498
|
gap: var(--spacing-6);
|
|
3499
3499
|
text-align: center;
|
|
3500
3500
|
}
|
|
3501
|
-
.celeste-file-upload-area .celeste-file-upload-area-content .celeste-file-upload-area-label[data-v-
|
|
3501
|
+
.celeste-file-upload-area .celeste-file-upload-area-content .celeste-file-upload-area-label[data-v-cfdea6ac] {
|
|
3502
3502
|
color: var(--color-text-strong-950);
|
|
3503
3503
|
font: var(--label-sm);
|
|
3504
3504
|
}
|
|
3505
|
-
.celeste-file-upload-area .celeste-file-upload-area-content .celeste-file-upload-area-description[data-v-
|
|
3505
|
+
.celeste-file-upload-area .celeste-file-upload-area-content .celeste-file-upload-area-description[data-v-cfdea6ac] {
|
|
3506
3506
|
color: var(--color-text-sub-600);
|
|
3507
3507
|
font: var(--label-xs);
|
|
3508
3508
|
}
|
|
3509
|
-
.celeste-file-upload-area .celeste-file-upload-area-trigger[data-v-
|
|
3509
|
+
.celeste-file-upload-area .celeste-file-upload-area-trigger[data-v-cfdea6ac] {
|
|
3510
3510
|
background-color: var(--color-bg-white-0) !important;
|
|
3511
3511
|
}
|
|
3512
|
-
.celeste-file-upload-area .celeste-file-upload-area-trigger[data-v-
|
|
3512
|
+
.celeste-file-upload-area .celeste-file-upload-area-trigger[data-v-cfdea6ac]:hover {
|
|
3513
3513
|
background-color: transparent !important;
|
|
3514
3514
|
box-shadow: none !important;
|
|
3515
3515
|
}
|
|
3516
|
-
.celeste-file-upload-area > input[type=file][data-v-
|
|
3516
|
+
.celeste-file-upload-area > input[type=file][data-v-cfdea6ac] {
|
|
3517
3517
|
position: absolute;
|
|
3518
3518
|
opacity: 0;
|
|
3519
3519
|
scale: 0;
|
|
3520
3520
|
}
|
|
3521
|
-
.celeste-file-upload-area[data-over-drop-zone=true][data-v-
|
|
3521
|
+
.celeste-file-upload-area[data-over-drop-zone=true][data-v-cfdea6ac] {
|
|
3522
3522
|
background-color: var(--color-bg-weak-50);
|
|
3523
3523
|
}.celeste-hint-text[data-v-0fde56ef] {
|
|
3524
3524
|
display: flex;
|
|
@@ -5,14 +5,13 @@ const index = require("./chunks/index3.js");
|
|
|
5
5
|
const clsx = require("./chunks/clsx.js");
|
|
6
6
|
;/* empty css */
|
|
7
7
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
8
|
-
const _hoisted_1 =
|
|
9
|
-
const _hoisted_2 = { class: "celeste-file-upload-area-
|
|
10
|
-
const _hoisted_3 = {
|
|
11
|
-
const _hoisted_4 = {
|
|
8
|
+
const _hoisted_1 = { class: "celeste-file-upload-area-content" };
|
|
9
|
+
const _hoisted_2 = { class: "celeste-file-upload-area-label" };
|
|
10
|
+
const _hoisted_3 = {
|
|
12
11
|
key: 0,
|
|
13
12
|
class: "celeste-file-upload-area-description"
|
|
14
13
|
};
|
|
15
|
-
const
|
|
14
|
+
const _hoisted_4 = ["multiple", "accept"];
|
|
16
15
|
const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
17
16
|
__name: "file-upload-area",
|
|
18
17
|
props: /* @__PURE__ */ Mo.mergeModels({
|
|
@@ -38,6 +37,9 @@ const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
|
38
37
|
const files = Mo.useModel(__props, "modelValue");
|
|
39
38
|
const dropZoneRef = Mo.useTemplateRef("dropZoneRef");
|
|
40
39
|
const { isOverDropZone } = index.useDropZone(dropZoneRef, { onDrop });
|
|
40
|
+
const uploadComponent = Mo.computed(() => {
|
|
41
|
+
return props.onTriggerClick ? "div" : "label";
|
|
42
|
+
});
|
|
41
43
|
function handleUpload(e) {
|
|
42
44
|
const input = e.target;
|
|
43
45
|
const newFiles = Array.from(input.files ?? []);
|
|
@@ -97,45 +99,48 @@ const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
return (_ctx, _cache) => {
|
|
100
|
-
return Mo.openBlock(), Mo.
|
|
102
|
+
return Mo.openBlock(), Mo.createBlock(Mo.resolveDynamicComponent(uploadComponent.value), {
|
|
101
103
|
ref_key: "dropZoneRef",
|
|
102
104
|
ref: dropZoneRef,
|
|
103
105
|
class: Mo.normalizeClass(Mo.unref(clsx.clsx)(
|
|
104
106
|
"celeste-file-upload-area",
|
|
105
107
|
props.class
|
|
106
108
|
)),
|
|
107
|
-
"data-over-drop-zone": Mo.unref(isOverDropZone)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
key: 0,
|
|
118
|
-
"as-child": "",
|
|
119
|
-
intent: "neutral",
|
|
120
|
-
variant: "stroke",
|
|
121
|
-
size: "xs",
|
|
122
|
-
class: "celeste-file-upload-area-trigger",
|
|
123
|
-
onClick: handleTriggerClick
|
|
124
|
-
}, {
|
|
125
|
-
default: Mo.withCtx(() => [
|
|
126
|
-
Mo.createElementVNode("span", null, Mo.toDisplayString(_ctx.triggerLabel), 1)
|
|
109
|
+
"data-over-drop-zone": Mo.unref(isOverDropZone),
|
|
110
|
+
onClick: handleTriggerClick
|
|
111
|
+
}, {
|
|
112
|
+
default: Mo.withCtx(() => [
|
|
113
|
+
Mo.createElementVNode("i", {
|
|
114
|
+
class: Mo.normalizeClass(_ctx.icon)
|
|
115
|
+
}, null, 2),
|
|
116
|
+
Mo.createElementVNode("div", _hoisted_1, [
|
|
117
|
+
Mo.createElementVNode("span", _hoisted_2, Mo.toDisplayString(Mo.unref(isOverDropZone) ? _ctx.labelOnDrop : _ctx.label), 1),
|
|
118
|
+
!Mo.unref(isOverDropZone) ? (Mo.openBlock(), Mo.createElementBlock("span", _hoisted_3, Mo.toDisplayString(_ctx.description), 1)) : Mo.createCommentVNode("", true)
|
|
127
119
|
]),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
!Mo.unref(isOverDropZone) ? (Mo.openBlock(), Mo.createBlock(button, {
|
|
121
|
+
key: 0,
|
|
122
|
+
"as-child": "",
|
|
123
|
+
intent: "neutral",
|
|
124
|
+
variant: "stroke",
|
|
125
|
+
size: "xs",
|
|
126
|
+
class: "celeste-file-upload-area-trigger"
|
|
127
|
+
}, {
|
|
128
|
+
default: Mo.withCtx(() => [
|
|
129
|
+
Mo.createElementVNode("span", null, Mo.toDisplayString(_ctx.triggerLabel), 1)
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
})) : Mo.createCommentVNode("", true),
|
|
133
|
+
!_ctx.onTriggerClick ? (Mo.openBlock(), Mo.createElementBlock("input", Mo.mergeProps({ key: 1 }, _ctx.$attrs, {
|
|
134
|
+
type: "file",
|
|
135
|
+
multiple: _ctx.multiple,
|
|
136
|
+
accept: _ctx.accept,
|
|
137
|
+
onChange: handleUpload
|
|
138
|
+
}), null, 16, _hoisted_4)) : Mo.createCommentVNode("", true)
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
}, 8, ["class", "data-over-drop-zone"]);
|
|
137
142
|
};
|
|
138
143
|
}
|
|
139
144
|
});
|
|
140
|
-
const fileUploadArea = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
145
|
+
const fileUploadArea = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-cfdea6ac"]]);
|
|
141
146
|
module.exports = fileUploadArea;
|
|
@@ -39,5 +39,5 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
39
39
|
triggerLabel: string;
|
|
40
40
|
maxSize: number;
|
|
41
41
|
maxFiles: number;
|
|
42
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
43
43
|
export default _default;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useModel, useTemplateRef, openBlock,
|
|
1
|
+
import { defineComponent, mergeModels, useModel, useTemplateRef, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, unref, withCtx, createElementVNode, toDisplayString, createElementBlock, createCommentVNode, mergeProps } from "vue";
|
|
2
2
|
import Button from "./button.js";
|
|
3
3
|
import { c as useDropZone } from "./chunks/index3.js";
|
|
4
4
|
import { c as clsx } from "./chunks/clsx.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
7
|
-
const _hoisted_1 =
|
|
8
|
-
const _hoisted_2 = { class: "celeste-file-upload-area-
|
|
9
|
-
const _hoisted_3 = {
|
|
10
|
-
const _hoisted_4 = {
|
|
7
|
+
const _hoisted_1 = { class: "celeste-file-upload-area-content" };
|
|
8
|
+
const _hoisted_2 = { class: "celeste-file-upload-area-label" };
|
|
9
|
+
const _hoisted_3 = {
|
|
11
10
|
key: 0,
|
|
12
11
|
class: "celeste-file-upload-area-description"
|
|
13
12
|
};
|
|
14
|
-
const
|
|
13
|
+
const _hoisted_4 = ["multiple", "accept"];
|
|
15
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
15
|
__name: "file-upload-area",
|
|
17
16
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -37,6 +36,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
36
|
const files = useModel(__props, "modelValue");
|
|
38
37
|
const dropZoneRef = useTemplateRef("dropZoneRef");
|
|
39
38
|
const { isOverDropZone } = useDropZone(dropZoneRef, { onDrop });
|
|
39
|
+
const uploadComponent = computed(() => {
|
|
40
|
+
return props.onTriggerClick ? "div" : "label";
|
|
41
|
+
});
|
|
40
42
|
function handleUpload(e) {
|
|
41
43
|
const input = e.target;
|
|
42
44
|
const newFiles = Array.from(input.files ?? []);
|
|
@@ -96,47 +98,50 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
return (_ctx, _cache) => {
|
|
99
|
-
return openBlock(),
|
|
101
|
+
return openBlock(), createBlock(resolveDynamicComponent(uploadComponent.value), {
|
|
100
102
|
ref_key: "dropZoneRef",
|
|
101
103
|
ref: dropZoneRef,
|
|
102
104
|
class: normalizeClass(unref(clsx)(
|
|
103
105
|
"celeste-file-upload-area",
|
|
104
106
|
props.class
|
|
105
107
|
)),
|
|
106
|
-
"data-over-drop-zone": unref(isOverDropZone)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
key: 0,
|
|
117
|
-
"as-child": "",
|
|
118
|
-
intent: "neutral",
|
|
119
|
-
variant: "stroke",
|
|
120
|
-
size: "xs",
|
|
121
|
-
class: "celeste-file-upload-area-trigger",
|
|
122
|
-
onClick: handleTriggerClick
|
|
123
|
-
}, {
|
|
124
|
-
default: withCtx(() => [
|
|
125
|
-
createElementVNode("span", null, toDisplayString(_ctx.triggerLabel), 1)
|
|
108
|
+
"data-over-drop-zone": unref(isOverDropZone),
|
|
109
|
+
onClick: handleTriggerClick
|
|
110
|
+
}, {
|
|
111
|
+
default: withCtx(() => [
|
|
112
|
+
createElementVNode("i", {
|
|
113
|
+
class: normalizeClass(_ctx.icon)
|
|
114
|
+
}, null, 2),
|
|
115
|
+
createElementVNode("div", _hoisted_1, [
|
|
116
|
+
createElementVNode("span", _hoisted_2, toDisplayString(unref(isOverDropZone) ? _ctx.labelOnDrop : _ctx.label), 1),
|
|
117
|
+
!unref(isOverDropZone) ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(_ctx.description), 1)) : createCommentVNode("", true)
|
|
126
118
|
]),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
!unref(isOverDropZone) ? (openBlock(), createBlock(Button, {
|
|
120
|
+
key: 0,
|
|
121
|
+
"as-child": "",
|
|
122
|
+
intent: "neutral",
|
|
123
|
+
variant: "stroke",
|
|
124
|
+
size: "xs",
|
|
125
|
+
class: "celeste-file-upload-area-trigger"
|
|
126
|
+
}, {
|
|
127
|
+
default: withCtx(() => [
|
|
128
|
+
createElementVNode("span", null, toDisplayString(_ctx.triggerLabel), 1)
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
})) : createCommentVNode("", true),
|
|
132
|
+
!_ctx.onTriggerClick ? (openBlock(), createElementBlock("input", mergeProps({ key: 1 }, _ctx.$attrs, {
|
|
133
|
+
type: "file",
|
|
134
|
+
multiple: _ctx.multiple,
|
|
135
|
+
accept: _ctx.accept,
|
|
136
|
+
onChange: handleUpload
|
|
137
|
+
}), null, 16, _hoisted_4)) : createCommentVNode("", true)
|
|
138
|
+
]),
|
|
139
|
+
_: 1
|
|
140
|
+
}, 8, ["class", "data-over-drop-zone"]);
|
|
136
141
|
};
|
|
137
142
|
}
|
|
138
143
|
});
|
|
139
|
-
const fileUploadArea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
144
|
+
const fileUploadArea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cfdea6ac"]]);
|
|
140
145
|
export {
|
|
141
146
|
fileUploadArea as default
|
|
142
147
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youcan/celeste",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.61",
|
|
5
5
|
"author": "YouCan <tech@youcan.shop>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"youcan",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"radix-vue": "^1.9.12",
|
|
45
45
|
"tinycolor2": "^1.6.0",
|
|
46
46
|
"vue-sonner": "^2.0.2",
|
|
47
|
-
"@youcan/celeste-icons": "0.6.
|
|
48
|
-
"@youcan/celeste-tokens": "0.6.
|
|
47
|
+
"@youcan/celeste-icons": "0.6.61",
|
|
48
|
+
"@youcan/celeste-tokens": "0.6.61"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@chromatic-com/storybook": "^4.1.1",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Button from '@/components/button/button.vue';
|
|
3
3
|
import { useDropZone } from '@vueuse/core';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { type InputHTMLAttributes, useTemplateRef } from 'vue';
|
|
5
|
+
import { computed, type InputHTMLAttributes, useTemplateRef } from 'vue';
|
|
6
6
|
|
|
7
7
|
const props = withDefaults(defineProps<FileUploadAreaProps>(), {
|
|
8
8
|
icon: 'i-celeste-upload-cloud-2-line',
|
|
@@ -22,6 +22,10 @@ const files = defineModel<File[]>({ default: [] });
|
|
|
22
22
|
const dropZoneRef = useTemplateRef<HTMLElement>('dropZoneRef');
|
|
23
23
|
const { isOverDropZone } = useDropZone(dropZoneRef, { onDrop });
|
|
24
24
|
|
|
25
|
+
const uploadComponent = computed(() => {
|
|
26
|
+
return props.onTriggerClick ? 'div' : 'label';
|
|
27
|
+
});
|
|
28
|
+
|
|
25
29
|
function handleUpload(e: Event) {
|
|
26
30
|
const input = e.target as HTMLInputElement;
|
|
27
31
|
const newFiles = Array.from(input.files ?? []);
|
|
@@ -124,13 +128,15 @@ export interface FileUploadAreaEmit {
|
|
|
124
128
|
</script>
|
|
125
129
|
|
|
126
130
|
<template>
|
|
127
|
-
<
|
|
131
|
+
<component
|
|
132
|
+
:is="uploadComponent"
|
|
128
133
|
ref="dropZoneRef"
|
|
129
134
|
:class="clsx(
|
|
130
135
|
'celeste-file-upload-area',
|
|
131
136
|
props.class,
|
|
132
137
|
)"
|
|
133
138
|
:data-over-drop-zone="isOverDropZone"
|
|
139
|
+
@click="handleTriggerClick"
|
|
134
140
|
>
|
|
135
141
|
<i :class="icon" />
|
|
136
142
|
<div class="celeste-file-upload-area-content">
|
|
@@ -151,18 +157,18 @@ export interface FileUploadAreaEmit {
|
|
|
151
157
|
variant="stroke"
|
|
152
158
|
size="xs"
|
|
153
159
|
class="celeste-file-upload-area-trigger"
|
|
154
|
-
@click="handleTriggerClick"
|
|
155
160
|
>
|
|
156
161
|
<span>{{ triggerLabel }}</span>
|
|
157
162
|
</Button>
|
|
158
163
|
<input
|
|
164
|
+
v-if="!onTriggerClick"
|
|
159
165
|
v-bind="$attrs"
|
|
160
166
|
type="file"
|
|
161
167
|
:multiple="multiple"
|
|
162
168
|
:accept="accept"
|
|
163
169
|
@change="handleUpload"
|
|
164
170
|
>
|
|
165
|
-
</
|
|
171
|
+
</component>
|
|
166
172
|
</template>
|
|
167
173
|
|
|
168
174
|
<style scoped lang="scss">
|