@gcsa/console-vue 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/GcsaCascader.vue.js +8 -7
- package/dist/components/GcsaCascader.vue.js.map +1 -1
- package/dist/components/GcsaPopover.vue.d.ts +3 -0
- package/dist/components/GcsaPopover.vue.js +61 -59
- package/dist/components/GcsaPopover.vue.js.map +1 -1
- package/dist/components/GcsaPortal.vue.js +30 -16
- package/dist/components/GcsaPortal.vue.js.map +1 -1
- package/dist/components/GcsaTransfer.vue.js +117 -79
- package/dist/components/GcsaTransfer.vue.js.map +1 -1
- package/dist/components/GcsaUpload.vue.js +1 -1
- package/dist/components/GcsaUpload.vue.js.map +1 -1
- package/dist/icons/iconNames.d.ts +2 -2
- package/dist/icons/iconNames.js +1 -0
- package/dist/icons/iconNames.js.map +1 -1
- package/dist/icons/registry.d.ts +1 -1
- package/dist/icons/registry.js +38 -35
- package/dist/icons/registry.js.map +1 -1
- package/dist/icons/svg/result-empty.svg.js +12 -2
- package/dist/icons/svg/result-empty.svg.js.map +1 -1
- package/dist/icons/svg/upload.svg.js +10 -0
- package/dist/icons/svg/upload.svg.js.map +1 -0
- package/dist/icons/svg/users.svg.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +56 -55
- package/dist/style.css +223 -140
- package/dist/types/componentProps.d.ts +2 -0
- package/package.json +3 -3
- package/src/components/GcsaCascader.vue +1 -1
- package/src/components/GcsaPopover.vue +11 -13
- package/src/components/GcsaPortal.vue +26 -2
- package/src/components/GcsaTransfer.vue +125 -13
- package/src/components/GcsaUpload.vue +1 -1
- package/src/icons/iconNames.ts +1 -0
- package/src/icons/registry.ts +3 -1
- package/src/icons/svg/result-empty.svg +11 -1
- package/src/icons/svg/upload.svg +5 -0
- package/src/index.ts +1 -1
- package/src/types/componentProps.ts +2 -0
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useGcsaLocaleMessages as
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as Q, computed as _, ref as p, openBlock as u, createElementBlock as v, normalizeClass as T, createElementVNode as l, toDisplayString as i, createVNode as h, unref as f, Fragment as K, renderList as I, withKeys as m, withModifiers as g, createCommentVNode as M } from "vue";
|
|
2
|
+
import { useGcsaLocaleMessages as R } from "../composables/useGcsaLocale.js";
|
|
3
|
+
import B from "./GcsaCheckbox.vue.js";
|
|
4
|
+
import G from "./GcsaInput.vue.js";
|
|
5
|
+
const z = ["aria-label"], A = { class: "gcsa-transfer__header" }, D = { class: "gcsa-transfer__search" }, F = {
|
|
5
6
|
class: "gcsa-transfer__list",
|
|
6
7
|
role: "listbox",
|
|
7
8
|
"aria-multiselectable": "true"
|
|
8
|
-
},
|
|
9
|
-
class: "gcsa-transfer__check",
|
|
10
|
-
"aria-hidden": "true"
|
|
11
|
-
}, j = {
|
|
9
|
+
}, j = ["tabindex", "aria-selected", "aria-disabled", "onClick", "onKeydown"], q = { class: "gcsa-transfer__label" }, H = {
|
|
12
10
|
key: 0,
|
|
13
11
|
class: "gcsa-transfer__empty"
|
|
14
|
-
},
|
|
12
|
+
}, J = { class: "gcsa-transfer__actions" }, W = ["disabled", "aria-label"], X = ["disabled", "aria-label"], Y = ["aria-label"], Z = { class: "gcsa-transfer__header" }, ee = { class: "gcsa-transfer__search" }, ae = {
|
|
15
13
|
class: "gcsa-transfer__list",
|
|
16
14
|
role: "listbox",
|
|
17
15
|
"aria-multiselectable": "true"
|
|
18
|
-
},
|
|
19
|
-
class: "gcsa-transfer__check",
|
|
20
|
-
"aria-hidden": "true"
|
|
21
|
-
}, ee = {
|
|
16
|
+
}, le = ["tabindex", "aria-selected", "aria-disabled", "onClick", "onKeydown"], se = { class: "gcsa-transfer__label" }, te = {
|
|
22
17
|
key: 0,
|
|
23
18
|
class: "gcsa-transfer__empty"
|
|
24
|
-
},
|
|
19
|
+
}, ce = /* @__PURE__ */ Q({
|
|
25
20
|
name: "GcsaTransfer",
|
|
26
21
|
__name: "GcsaTransfer",
|
|
27
22
|
props: {
|
|
@@ -32,108 +27,151 @@ const Q = ["aria-label"], R = { class: "gcsa-transfer__header" }, U = { class: "
|
|
|
32
27
|
disabled: { type: Boolean, default: !1 }
|
|
33
28
|
},
|
|
34
29
|
emits: ["update:modelValue", "change"],
|
|
35
|
-
setup(n, { emit:
|
|
36
|
-
const o =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
setup(n, { emit: N }) {
|
|
31
|
+
const o = R(), d = n, w = _(() => d.sourceTitle ?? o.value.transferSourceTitle), x = _(() => d.targetTitle ?? o.value.transferTargetTitle), L = N, r = p([]), c = p([]), V = p(""), y = p(""), $ = _(() => d.options.filter((a) => d.modelValue.includes(a.value))), k = _(
|
|
32
|
+
() => d.options.filter(
|
|
33
|
+
(a) => !d.modelValue.includes(a.value) && a.label.toLowerCase().includes(V.value.trim().toLowerCase())
|
|
34
|
+
)
|
|
35
|
+
), S = _(
|
|
36
|
+
() => $.value.filter((a) => a.label.toLowerCase().includes(y.value.trim().toLowerCase()))
|
|
37
|
+
);
|
|
38
|
+
function C(a, t, e) {
|
|
39
|
+
const s = t === "source" ? r : c;
|
|
40
|
+
e ? s.value.includes(a) || (s.value = [...s.value, a]) : s.value = s.value.filter((P) => P !== a);
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
42
|
+
function b(a, t) {
|
|
43
|
+
if (d.disabled || a.disabled) return;
|
|
44
|
+
const e = t === "source" ? r : c;
|
|
45
|
+
C(a.value, t, !e.value.includes(a.value));
|
|
43
46
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
47
|
+
function U(a) {
|
|
48
|
+
L("update:modelValue", a), L("change", a), r.value = [], c.value = [];
|
|
46
49
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
50
|
+
function E() {
|
|
51
|
+
U([...d.modelValue, ...r.value.filter((a) => !d.modelValue.includes(a))]);
|
|
49
52
|
}
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
function O() {
|
|
54
|
+
U(d.modelValue.filter((a) => !c.value.includes(a)));
|
|
55
|
+
}
|
|
56
|
+
return (a, t) => (u(), v("div", {
|
|
57
|
+
class: T(["gcsa-transfer", { "gcsa-transfer--disabled": n.disabled }])
|
|
52
58
|
}, [
|
|
53
|
-
|
|
59
|
+
l("section", {
|
|
54
60
|
class: "gcsa-transfer__panel",
|
|
55
|
-
"aria-label":
|
|
61
|
+
"aria-label": w.value
|
|
56
62
|
}, [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
l("header", A, [
|
|
64
|
+
l("span", null, i(w.value), 1),
|
|
65
|
+
l("span", null, i(k.value.length), 1)
|
|
60
66
|
]),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
modelValue:
|
|
64
|
-
"onUpdate:modelValue":
|
|
65
|
-
placeholder:
|
|
67
|
+
l("div", D, [
|
|
68
|
+
h(G, {
|
|
69
|
+
modelValue: V.value,
|
|
70
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => V.value = e),
|
|
71
|
+
placeholder: f(o).searchPlaceholder,
|
|
66
72
|
disabled: n.disabled
|
|
67
73
|
}, null, 8, ["modelValue", "placeholder", "disabled"])
|
|
68
74
|
]),
|
|
69
|
-
|
|
70
|
-
(
|
|
75
|
+
l("div", F, [
|
|
76
|
+
(u(!0), v(K, null, I(k.value, (e) => (u(), v("div", {
|
|
71
77
|
key: e.value,
|
|
72
|
-
|
|
73
|
-
class: p(["gcsa-transfer__item gcsa-focus-ring", { "gcsa-transfer__item--selected": r.value.includes(e.value) }]),
|
|
74
|
-
disabled: n.disabled || e.disabled,
|
|
78
|
+
class: T(["gcsa-transfer__item gcsa-focus-ring", { "gcsa-transfer__item--selected": r.value.includes(e.value) }]),
|
|
75
79
|
role: "option",
|
|
80
|
+
tabindex: n.disabled || e.disabled ? -1 : 0,
|
|
76
81
|
"aria-selected": r.value.includes(e.value),
|
|
77
|
-
|
|
82
|
+
"aria-disabled": n.disabled || e.disabled || void 0,
|
|
83
|
+
onClick: (s) => b(e, "source"),
|
|
84
|
+
onKeydown: [
|
|
85
|
+
m(g((s) => b(e, "source"), ["prevent"]), ["enter"]),
|
|
86
|
+
m(g((s) => b(e, "source"), ["prevent"]), ["space"])
|
|
87
|
+
]
|
|
78
88
|
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
l("span", {
|
|
90
|
+
class: "gcsa-transfer__check-wrap",
|
|
91
|
+
onClick: t[1] || (t[1] = g(() => {
|
|
92
|
+
}, ["stop"]))
|
|
93
|
+
}, [
|
|
94
|
+
h(B, {
|
|
95
|
+
"model-value": r.value.includes(e.value),
|
|
96
|
+
disabled: n.disabled || e.disabled,
|
|
97
|
+
"aria-label": e.label,
|
|
98
|
+
tabindex: "-1",
|
|
99
|
+
"onUpdate:modelValue": (s) => C(e.value, "source", s)
|
|
100
|
+
}, null, 8, ["model-value", "disabled", "aria-label", "onUpdate:modelValue"])
|
|
101
|
+
]),
|
|
102
|
+
l("span", q, i(e.label), 1)
|
|
103
|
+
], 42, j))), 128)),
|
|
104
|
+
k.value.length ? M("", !0) : (u(), v("span", H, i(f(o).noOptions), 1))
|
|
83
105
|
])
|
|
84
|
-
], 8,
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
], 8, z),
|
|
107
|
+
l("div", J, [
|
|
108
|
+
l("button", {
|
|
87
109
|
type: "button",
|
|
88
110
|
class: "gcsa-transfer__action gcsa-focus-ring",
|
|
89
111
|
disabled: n.disabled || !r.value.length,
|
|
90
|
-
"aria-label":
|
|
91
|
-
onClick:
|
|
92
|
-
}, "›", 8,
|
|
93
|
-
|
|
112
|
+
"aria-label": f(o).transferMoveRight,
|
|
113
|
+
onClick: E
|
|
114
|
+
}, " › ", 8, W),
|
|
115
|
+
l("button", {
|
|
94
116
|
type: "button",
|
|
95
117
|
class: "gcsa-transfer__action gcsa-focus-ring",
|
|
96
118
|
disabled: n.disabled || !c.value.length,
|
|
97
|
-
"aria-label":
|
|
98
|
-
onClick:
|
|
99
|
-
}, "‹", 8,
|
|
119
|
+
"aria-label": f(o).transferMoveLeft,
|
|
120
|
+
onClick: O
|
|
121
|
+
}, " ‹ ", 8, X)
|
|
100
122
|
]),
|
|
101
|
-
|
|
123
|
+
l("section", {
|
|
102
124
|
class: "gcsa-transfer__panel",
|
|
103
|
-
"aria-label":
|
|
125
|
+
"aria-label": x.value
|
|
104
126
|
}, [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
127
|
+
l("header", Z, [
|
|
128
|
+
l("span", null, i(x.value), 1),
|
|
129
|
+
l("span", null, i($.value.length), 1)
|
|
108
130
|
]),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
modelValue:
|
|
112
|
-
"onUpdate:modelValue":
|
|
113
|
-
placeholder:
|
|
131
|
+
l("div", ee, [
|
|
132
|
+
h(G, {
|
|
133
|
+
modelValue: y.value,
|
|
134
|
+
"onUpdate:modelValue": t[2] || (t[2] = (e) => y.value = e),
|
|
135
|
+
placeholder: f(o).searchPlaceholder,
|
|
114
136
|
disabled: n.disabled
|
|
115
137
|
}, null, 8, ["modelValue", "placeholder", "disabled"])
|
|
116
138
|
]),
|
|
117
|
-
|
|
118
|
-
(
|
|
139
|
+
l("div", ae, [
|
|
140
|
+
(u(!0), v(K, null, I(S.value, (e) => (u(), v("div", {
|
|
119
141
|
key: e.value,
|
|
120
|
-
|
|
121
|
-
class: p(["gcsa-transfer__item gcsa-focus-ring", { "gcsa-transfer__item--selected": c.value.includes(e.value) }]),
|
|
122
|
-
disabled: n.disabled || e.disabled,
|
|
142
|
+
class: T(["gcsa-transfer__item gcsa-focus-ring", { "gcsa-transfer__item--selected": c.value.includes(e.value) }]),
|
|
123
143
|
role: "option",
|
|
144
|
+
tabindex: n.disabled || e.disabled ? -1 : 0,
|
|
124
145
|
"aria-selected": c.value.includes(e.value),
|
|
125
|
-
|
|
146
|
+
"aria-disabled": n.disabled || e.disabled || void 0,
|
|
147
|
+
onClick: (s) => b(e, "target"),
|
|
148
|
+
onKeydown: [
|
|
149
|
+
m(g((s) => b(e, "target"), ["prevent"]), ["enter"]),
|
|
150
|
+
m(g((s) => b(e, "target"), ["prevent"]), ["space"])
|
|
151
|
+
]
|
|
126
152
|
}, [
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
153
|
+
l("span", {
|
|
154
|
+
class: "gcsa-transfer__check-wrap",
|
|
155
|
+
onClick: t[3] || (t[3] = g(() => {
|
|
156
|
+
}, ["stop"]))
|
|
157
|
+
}, [
|
|
158
|
+
h(B, {
|
|
159
|
+
"model-value": c.value.includes(e.value),
|
|
160
|
+
disabled: n.disabled || e.disabled,
|
|
161
|
+
"aria-label": e.label,
|
|
162
|
+
tabindex: "-1",
|
|
163
|
+
"onUpdate:modelValue": (s) => C(e.value, "target", s)
|
|
164
|
+
}, null, 8, ["model-value", "disabled", "aria-label", "onUpdate:modelValue"])
|
|
165
|
+
]),
|
|
166
|
+
l("span", se, i(e.label), 1)
|
|
167
|
+
], 42, le))), 128)),
|
|
168
|
+
S.value.length ? M("", !0) : (u(), v("span", te, i(f(o).noOptions), 1))
|
|
131
169
|
])
|
|
132
|
-
], 8,
|
|
170
|
+
], 8, Y)
|
|
133
171
|
], 2));
|
|
134
172
|
}
|
|
135
173
|
});
|
|
136
174
|
export {
|
|
137
|
-
|
|
175
|
+
ce as default
|
|
138
176
|
};
|
|
139
177
|
//# sourceMappingURL=GcsaTransfer.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GcsaTransfer.vue.js","sources":["../../src/components/GcsaTransfer.vue"],"sourcesContent":["<template>\n <div class=\"gcsa-transfer\" :class=\"{ 'gcsa-transfer--disabled': disabled }\">\n <section class=\"gcsa-transfer__panel\" :aria-label=\"resolvedSourceTitle\">\n <header class=\"gcsa-transfer__header\"><span>{{ resolvedSourceTitle }}</span><span>{{ availableItems.length }}</span></header>\n <div class=\"gcsa-transfer__search\"><GcsaInput v-model=\"sourceQuery\" :placeholder=\"messages.searchPlaceholder\" :disabled=\"disabled\" /></div>\n <div class=\"gcsa-transfer__list\" role=\"listbox\" aria-multiselectable=\"true\">\n <button v-for=\"item in availableItems\" :key=\"item.value\" type=\"button\" class=\"gcsa-transfer__item gcsa-focus-ring\" :class=\"{ 'gcsa-transfer__item--selected': sourceSelected.includes(item.value) }\" :disabled=\"disabled || item.disabled\" role=\"option\" :aria-selected=\"sourceSelected.includes(item.value)\" @click=\"toggleSelected(item.value, 'source')\"><span class=\"gcsa-transfer__check\" aria-hidden=\"true\">{{ sourceSelected.includes(item.value) ? '✓' : '' }}</span><span>{{ item.label }}</span></button>\n <span v-if=\"!availableItems.length\" class=\"gcsa-transfer__empty\">{{ messages.noOptions }}</span>\n </div>\n </section>\n <div class=\"gcsa-transfer__actions\"><button type=\"button\" class=\"gcsa-transfer__action gcsa-focus-ring\" :disabled=\"disabled || !sourceSelected.length\" :aria-label=\"messages.transferMoveRight\" @click=\"moveRight\">›</button><button type=\"button\" class=\"gcsa-transfer__action gcsa-focus-ring\" :disabled=\"disabled || !targetSelected.length\" :aria-label=\"messages.transferMoveLeft\" @click=\"moveLeft\">‹</button></div>\n <section class=\"gcsa-transfer__panel\" :aria-label=\"resolvedTargetTitle\">\n <header class=\"gcsa-transfer__header\"><span>{{ resolvedTargetTitle }}</span><span>{{ targetItems.length }}</span></header>\n <div class=\"gcsa-transfer__search\"><GcsaInput v-model=\"targetQuery\" :placeholder=\"messages.searchPlaceholder\" :disabled=\"disabled\" /></div>\n <div class=\"gcsa-transfer__list\" role=\"listbox\" aria-multiselectable=\"true\">\n <button v-for=\"item in filteredTargetItems\" :key=\"item.value\" type=\"button\" class=\"gcsa-transfer__item gcsa-focus-ring\" :class=\"{ 'gcsa-transfer__item--selected': targetSelected.includes(item.value) }\" :disabled=\"disabled || item.disabled\" role=\"option\" :aria-selected=\"targetSelected.includes(item.value)\" @click=\"toggleSelected(item.value, 'target')\"><span class=\"gcsa-transfer__check\" aria-hidden=\"true\">{{ targetSelected.includes(item.value) ? '✓' : '' }}</span><span>{{ item.label }}</span></button>\n <span v-if=\"!filteredTargetItems.length\" class=\"gcsa-transfer__empty\">{{ messages.noOptions }}</span>\n </div>\n </section>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { GcsaTransferProps } from '../types/componentProps';\nimport { useGcsaLocaleMessages } from '../composables/useGcsaLocale';\nimport GcsaInput from './GcsaInput.vue';\n\ndefineOptions({ name: 'GcsaTransfer' });\n\nconst messages = useGcsaLocaleMessages();\n\nconst props = withDefaults(defineProps<GcsaTransferProps>(), { modelValue: () => [], disabled: false });\n\nconst resolvedSourceTitle = computed(() => props.sourceTitle ?? messages.value.transferSourceTitle);\nconst resolvedTargetTitle = computed(() => props.targetTitle ?? messages.value.transferTargetTitle);\n\nconst emit = defineEmits<{ 'update:modelValue': [keys: string[]]; change: [keys: string[]] }>();\nconst sourceSelected = ref<string[]>([]);\nconst targetSelected = ref<string[]>([]);\nconst sourceQuery = ref('');\nconst targetQuery = ref('');\nconst targetItems = computed(() => props.options.filter(item => props.modelValue.includes(item.value)));\nconst availableItems = computed(() => props.options.filter(item => !props.modelValue.includes(item.value) && item.label.toLowerCase().includes(sourceQuery.value.trim().toLowerCase())));\nconst filteredTargetItems = computed(() => targetItems.value.filter(item => item.label.toLowerCase().includes(targetQuery.value.trim().toLowerCase())));\nfunction toggleSelected(value: string, side: 'source' | 'target') { const selected = side === 'source' ? sourceSelected : targetSelected; const next = selected.value.includes(value) ? selected.value.filter(item => item !== value) : [...selected.value, value]; selected.value = next; }\nfunction update(next: string[]) { emit('update:modelValue', next); emit('change', next); sourceSelected.value = []; targetSelected.value = []; }\nfunction moveRight() { update([...props.modelValue, ...sourceSelected.value.filter(value => !props.modelValue.includes(value))]); }\nfunction moveLeft() { update(props.modelValue.filter(value => !targetSelected.value.includes(value))); }\n</script>\n"],"names":["messages","useGcsaLocaleMessages","props","__props","resolvedSourceTitle","computed","resolvedTargetTitle","emit","__emit","sourceSelected","ref","targetSelected","sourceQuery","targetQuery","targetItems","item","availableItems","filteredTargetItems","toggleSelected","value","side","selected","next","update","moveRight","moveLeft","_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_2","_toDisplayString","_hoisted_3","_createVNode","GcsaInput","$event","_unref","_hoisted_4","_Fragment","_renderList","_hoisted_6","_openBlock","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,UAAMA,IAAWC,EAAA,GAEXC,IAAQC,GAERC,IAAsBC,EAAS,MAAMH,EAAM,eAAeF,EAAS,MAAM,mBAAmB,GAC5FM,IAAsBD,EAAS,MAAMH,EAAM,eAAeF,EAAS,MAAM,mBAAmB,GAE5FO,IAAOC,GACPC,IAAiBC,EAAc,EAAE,GACjCC,IAAiBD,EAAc,EAAE,GACjCE,IAAcF,EAAI,EAAE,GACpBG,IAAcH,EAAI,EAAE,GACpBI,IAAcT,EAAS,MAAMH,EAAM,QAAQ,OAAO,CAAAa,MAAQb,EAAM,WAAW,SAASa,EAAK,KAAK,CAAC,CAAC,GAChGC,IAAiBX,EAAS,MAAMH,EAAM,QAAQ,OAAO,CAAAa,MAAQ,CAACb,EAAM,WAAW,SAASa,EAAK,KAAK,KAAKA,EAAK,MAAM,YAAA,EAAc,SAASH,EAAY,MAAM,KAAA,EAAO,YAAA,CAAa,CAAC,CAAC,GACjLK,IAAsBZ,EAAS,MAAMS,EAAY,MAAM,OAAO,OAAQC,EAAK,MAAM,cAAc,SAASF,EAAY,MAAM,OAAO,YAAA,CAAa,CAAC,CAAC;AACtJ,aAASK,EAAeC,GAAeC,GAA2B;AAAE,YAAMC,IAAWD,MAAS,WAAWX,IAAiBE,GAAsBW,IAAOD,EAAS,MAAM,SA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 'gcsa-transfer--disabled': disabled }\">\n <section class=\"gcsa-transfer__panel\" :aria-label=\"resolvedSourceTitle\">\n <header class=\"gcsa-transfer__header\">\n <span>{{ resolvedSourceTitle }}</span>\n <span>{{ availableItems.length }}</span>\n </header>\n <div class=\"gcsa-transfer__search\">\n <GcsaInput v-model=\"sourceQuery\" :placeholder=\"messages.searchPlaceholder\" :disabled=\"disabled\" />\n </div>\n <div class=\"gcsa-transfer__list\" role=\"listbox\" aria-multiselectable=\"true\">\n <div\n v-for=\"item in availableItems\"\n :key=\"item.value\"\n class=\"gcsa-transfer__item gcsa-focus-ring\"\n :class=\"{ 'gcsa-transfer__item--selected': sourceSelected.includes(item.value) }\"\n role=\"option\"\n :tabindex=\"disabled || item.disabled ? -1 : 0\"\n :aria-selected=\"sourceSelected.includes(item.value)\"\n :aria-disabled=\"disabled || item.disabled || undefined\"\n @click=\"onItemActivate(item, 'source')\"\n @keydown.enter.prevent=\"onItemActivate(item, 'source')\"\n @keydown.space.prevent=\"onItemActivate(item, 'source')\"\n >\n <span class=\"gcsa-transfer__check-wrap\" @click.stop>\n <GcsaCheckbox\n :model-value=\"sourceSelected.includes(item.value)\"\n :disabled=\"disabled || item.disabled\"\n :aria-label=\"item.label\"\n tabindex=\"-1\"\n @update:model-value=\"checked => setSelected(item.value, 'source', checked)\"\n />\n </span>\n <span class=\"gcsa-transfer__label\">{{ item.label }}</span>\n </div>\n <span v-if=\"!availableItems.length\" class=\"gcsa-transfer__empty\">{{ messages.noOptions }}</span>\n </div>\n </section>\n\n <div class=\"gcsa-transfer__actions\">\n <button\n type=\"button\"\n class=\"gcsa-transfer__action gcsa-focus-ring\"\n :disabled=\"disabled || !sourceSelected.length\"\n :aria-label=\"messages.transferMoveRight\"\n @click=\"moveRight\"\n >\n ›\n </button>\n <button\n type=\"button\"\n class=\"gcsa-transfer__action gcsa-focus-ring\"\n :disabled=\"disabled || !targetSelected.length\"\n :aria-label=\"messages.transferMoveLeft\"\n @click=\"moveLeft\"\n >\n ‹\n </button>\n </div>\n\n <section class=\"gcsa-transfer__panel\" :aria-label=\"resolvedTargetTitle\">\n <header class=\"gcsa-transfer__header\">\n <span>{{ resolvedTargetTitle }}</span>\n <span>{{ targetItems.length }}</span>\n </header>\n <div class=\"gcsa-transfer__search\">\n <GcsaInput v-model=\"targetQuery\" :placeholder=\"messages.searchPlaceholder\" :disabled=\"disabled\" />\n </div>\n <div class=\"gcsa-transfer__list\" role=\"listbox\" aria-multiselectable=\"true\">\n <div\n v-for=\"item in filteredTargetItems\"\n :key=\"item.value\"\n class=\"gcsa-transfer__item gcsa-focus-ring\"\n :class=\"{ 'gcsa-transfer__item--selected': targetSelected.includes(item.value) }\"\n role=\"option\"\n :tabindex=\"disabled || item.disabled ? -1 : 0\"\n :aria-selected=\"targetSelected.includes(item.value)\"\n :aria-disabled=\"disabled || item.disabled || undefined\"\n @click=\"onItemActivate(item, 'target')\"\n @keydown.enter.prevent=\"onItemActivate(item, 'target')\"\n @keydown.space.prevent=\"onItemActivate(item, 'target')\"\n >\n <span class=\"gcsa-transfer__check-wrap\" @click.stop>\n <GcsaCheckbox\n :model-value=\"targetSelected.includes(item.value)\"\n :disabled=\"disabled || item.disabled\"\n :aria-label=\"item.label\"\n tabindex=\"-1\"\n @update:model-value=\"checked => setSelected(item.value, 'target', checked)\"\n />\n </span>\n <span class=\"gcsa-transfer__label\">{{ item.label }}</span>\n </div>\n <span v-if=\"!filteredTargetItems.length\" class=\"gcsa-transfer__empty\">{{ messages.noOptions }}</span>\n </div>\n </section>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { GcsaTransferOption } from '@gcsa/console-core';\nimport type { GcsaTransferProps } from '../types/componentProps';\nimport { useGcsaLocaleMessages } from '../composables/useGcsaLocale';\nimport GcsaCheckbox from './GcsaCheckbox.vue';\nimport GcsaInput from './GcsaInput.vue';\n\ndefineOptions({ name: 'GcsaTransfer' });\n\nconst messages = useGcsaLocaleMessages();\n\nconst props = withDefaults(defineProps<GcsaTransferProps>(), { modelValue: () => [], disabled: false });\n\nconst resolvedSourceTitle = computed(() => props.sourceTitle ?? messages.value.transferSourceTitle);\nconst resolvedTargetTitle = computed(() => props.targetTitle ?? messages.value.transferTargetTitle);\n\nconst emit = defineEmits<{ 'update:modelValue': [keys: string[]]; change: [keys: string[]] }>();\nconst sourceSelected = ref<string[]>([]);\nconst targetSelected = ref<string[]>([]);\nconst sourceQuery = ref('');\nconst targetQuery = ref('');\n\nconst targetItems = computed(() => props.options.filter(item => props.modelValue.includes(item.value)));\nconst availableItems = computed(() =>\n props.options.filter(\n item => !props.modelValue.includes(item.value) && item.label.toLowerCase().includes(sourceQuery.value.trim().toLowerCase())\n )\n);\nconst filteredTargetItems = computed(() =>\n targetItems.value.filter(item => item.label.toLowerCase().includes(targetQuery.value.trim().toLowerCase()))\n);\n\nfunction setSelected(value: string, side: 'source' | 'target', checked: boolean) {\n const selected = side === 'source' ? sourceSelected : targetSelected;\n if (checked) {\n if (!selected.value.includes(value)) selected.value = [...selected.value, value];\n } else {\n selected.value = selected.value.filter(item => item !== value);\n }\n}\n\nfunction onItemActivate(item: GcsaTransferOption, side: 'source' | 'target') {\n if (props.disabled || item.disabled) return;\n const selected = side === 'source' ? sourceSelected : targetSelected;\n setSelected(item.value, side, !selected.value.includes(item.value));\n}\n\nfunction update(next: string[]) {\n emit('update:modelValue', next);\n emit('change', next);\n sourceSelected.value = [];\n targetSelected.value = [];\n}\n\nfunction moveRight() {\n update([...props.modelValue, ...sourceSelected.value.filter(value => !props.modelValue.includes(value))]);\n}\n\nfunction moveLeft() {\n update(props.modelValue.filter(value => !targetSelected.value.includes(value)));\n}\n</script>\n"],"names":["messages","useGcsaLocaleMessages","props","__props","resolvedSourceTitle","computed","resolvedTargetTitle","emit","__emit","sourceSelected","ref","targetSelected","sourceQuery","targetQuery","targetItems","item","availableItems","filteredTargetItems","setSelected","value","side","checked","selected","onItemActivate","update","next","moveRight","moveLeft","_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_2","_toDisplayString","_hoisted_3","_createVNode","GcsaInput","$event","_unref","_hoisted_4","_Fragment","_renderList","_withKeys","_withModifiers","GcsaCheckbox","_hoisted_6","_openBlock","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,UAAMA,IAAWC,EAAA,GAEXC,IAAQC,GAERC,IAAsBC,EAAS,MAAMH,EAAM,eAAeF,EAAS,MAAM,mBAAmB,GAC5FM,IAAsBD,EAAS,MAAMH,EAAM,eAAeF,EAAS,MAAM,mBAAmB,GAE5FO,IAAOC,GACPC,IAAiBC,EAAc,EAAE,GACjCC,IAAiBD,EAAc,EAAE,GACjCE,IAAcF,EAAI,EAAE,GACpBG,IAAcH,EAAI,EAAE,GAEpBI,IAAcT,EAAS,MAAMH,EAAM,QAAQ,OAAO,CAAAa,MAAQb,EAAM,WAAW,SAASa,EAAK,KAAK,CAAC,CAAC,GAChGC,IAAiBX;AAAA,MAAS,MAC9BH,EAAM,QAAQ;AAAA,QACZ,OAAQ,CAACA,EAAM,WAAW,SAASa,EAAK,KAAK,KAAKA,EAAK,MAAM,YAAA,EAAc,SAASH,EAAY,MAAM,KAAA,EAAO,aAAa;AAAA,MAAA;AAAA,IAC5H,GAEIK,IAAsBZ;AAAA,MAAS,MACnCS,EAAY,MAAM,OAAO,CAAAC,MAAQA,EAAK,MAAM,YAAA,EAAc,SAASF,EAAY,MAAM,KAAA,EAAO,YAAA,CAAa,CAAC;AAAA,IAAA;AAG5G,aAASK,EAAYC,GAAeC,GAA2BC,GAAkB;AAC/E,YAAMC,IAAWF,MAAS,WAAWX,IAAiBE;AACtD,MAAIU,IACGC,EAAS,MAAM,SAASH,CAAK,MAAGG,EAAS,QAAQ,CAAC,GAAGA,EAAS,OAAOH,CAAK,KAE/EG,EAAS,QAAQA,EAAS,MAAM,OAAO,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C7E,MAAK;AAAA,YACJ,UAAUZ,EAAA,YAAYY,EAAK,WAAQ,KAAA;AAAA,YACnC,iBAAeJ,EAAA,MAAe,SAASI,EAAK,KAAK;AAAA,YACjD,iBAAeZ,EAAA,YAAYY,EAAK,YAAY;AAAA,YAC5C,SAAK,CAAAqB,MAAEb,EAAeR,GAAI,QAAA;AAAA,YAC1B,WAAO;AAAA,cAAgB0B,EAAAC,EAAA,CAAAN,MAAAb,EAAeR,GAAI,QAAA,GAAA,CAAA,SAAA,CAAA,GAAA,CAAA,OAAA,CAAA;AAAA,cACnB0B,EAAAC,EAAA,CAAAN,MAAAb,EAAeR,GAAI,QAAA,GAAA,CAAA,SAAA,CAAA,GAAA,CAAA,OAAA,CAAA;AAAA,YAAA;AAAA;YAE3Ce,EAQO,QAAA;AAAA,cARD,OAAM;AAAA,cAA6B,2BAAD,MAAA;AAAA,cAAA,GAAW,CAAA,MAAA,CAAA;AAAA,YAAA;cACjDI,EAMES,GAAA;AAAA,gBALC,eAAahC,EAAA,MAAe,SAASI,EAAK,KAAK;AAAA,gBAC/C,UAAUZ,EAAA,YAAYY,EAAK;AAAA,gBAC3B,cAAYA,EAAK;AAAA,gBAClB,UAAS;AAAA,gBACR,uBAAoB,CAAAM,MAAWH,EAAYH,EAAK,OAAK,UAAYM,CAAO;AAAA,cAAA;;YAG7ES,EAA0D,QAA1DuB,IAA0DrB,EAApBjB,EAAK,KAAK,GAAA,CAAA;AAAA,UAAA;UAErCE,EAAA,MAAoB,sBAAjC4B,EAAA,GAAAjB,EAAqG,QAArG0B,IAAqGtB,EAA5BK,EAAArC,CAAA,EAAS,SAAS,GAAA,CAAA;AAAA;;;;;"}
|
|
@@ -117,7 +117,7 @@ const I = ["accept", "multiple", "webkitdirectory", "disabled"], J = ["onKeydown
|
|
|
117
117
|
onDrop: v(R, ["prevent"])
|
|
118
118
|
}, [
|
|
119
119
|
c("span", O, [
|
|
120
|
-
P(j, { name: "
|
|
120
|
+
P(j, { name: "upload" })
|
|
121
121
|
]),
|
|
122
122
|
c("span", Q, d(B.value), 1),
|
|
123
123
|
y.value ? (r(), u("p", W, d(y.value), 1)) : _("", !0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GcsaUpload.vue.js","sources":["../../src/components/GcsaUpload.vue"],"sourcesContent":["<template>\n <div class=\"gcsa-upload\" :class=\"{ 'gcsa-upload--disabled': disabled, 'gcsa-upload--dragging': dragging }\">\n <input\n ref=\"inputRef\"\n type=\"file\"\n class=\"gcsa-upload__native\"\n :accept=\"accept\"\n :multiple=\"multiple\"\n :webkitdirectory=\"directory || undefined\"\n :disabled=\"disabled\"\n @change=\"onNativeChange\"\n />\n <div\n class=\"gcsa-upload__dropzone\"\n role=\"button\"\n tabindex=\"0\"\n @click=\"openPicker\"\n @keydown.enter.prevent=\"openPicker\"\n @keydown.space.prevent=\"openPicker\"\n @dragenter.prevent=\"onDragEnter\"\n @dragover.prevent=\"onDragEnter\"\n @dragleave.prevent=\"dragging = false\"\n @drop.prevent=\"onDrop\"\n >\n <span class=\"gcsa-upload__icon\" aria-hidden=\"true\">\n <GcsaIcon name=\"plus\" />\n </span>\n <span class=\"gcsa-upload__title\">{{ resolvedButtonLabel }}</span>\n <p v-if=\"resolvedHint\" class=\"gcsa-upload__hint\">{{ resolvedHint }}</p>\n </div>\n <ul v-if=\"files.length\" class=\"gcsa-upload__list\">\n <li v-for=\"(file, index) in files\" :key=\"`${file.name}-${index}`\" class=\"gcsa-upload__item\">\n <span class=\"gcsa-upload__name\">{{ file.name }}</span>\n <span class=\"gcsa-upload__size\">{{ formatSize(file.size) }}</span>\n <span v-if=\"statuses.get(file) === 'uploading'\" class=\"gcsa-upload__status\" role=\"status\">{{ resolvedUploadingLabel }} {{ progress.get(file) ?? 0 }}%</span>\n <span v-else-if=\"statuses.get(file) === 'error'\" class=\"gcsa-upload__status gcsa-upload__status--error\" role=\"alert\">{{ resolvedUploadErrorLabel }}</span>\n <div v-if=\"statuses.get(file) === 'uploading'\" class=\"gcsa-upload__progress\" aria-hidden=\"true\"><span :style=\"{ width: `${progress.get(file) ?? 0}%` }\" /></div>\n <button v-if=\"statuses.get(file) === 'error'\" type=\"button\" class=\"gcsa-upload__retry gcsa-focus-ring\" :disabled=\"disabled\" @click=\"uploadFile(file)\">{{ resolvedRetryLabel }}</button>\n <button\n type=\"button\"\n class=\"gcsa-upload__remove gcsa-focus-ring\"\n :disabled=\"disabled\"\n :aria-label=\"messages.uploadRemoveFile\"\n @click=\"removeAt(index)\"\n >\n {{ messages.remove }}\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { GcsaUploadProps } from '../types/componentProps';\nimport GcsaIcon from './GcsaIcon.vue';\nimport { useGcsaLocaleMessages } from '../composables/useGcsaLocale';\n\ndefineOptions({ name: 'GcsaUpload' });\n\nconst props = withDefaults(\n defineProps<GcsaUploadProps>(),\n {\n files: () => [],\n multiple: false,\n drag: false,\n directory: false\n }\n);\n\nconst messages = useGcsaLocaleMessages();\nconst resolvedButtonLabel = computed(() => props.buttonLabel ?? messages.value.uploadSelectFile);\nconst resolvedHint = computed(() => props.hint || (props.drag ? resolvedDragLabel.value : undefined));\nconst resolvedDragLabel = computed(() => props.dragLabel ?? messages.value.uploadDragHint);\nconst resolvedUploadingLabel = computed(() => props.uploadingLabel ?? messages.value.uploadUploading);\nconst resolvedUploadErrorLabel = computed(() => props.uploadErrorLabel ?? messages.value.uploadFailed);\nconst resolvedRetryLabel = computed(() => props.retryLabel ?? messages.value.uploadRetry);\n\nconst emit = defineEmits<{\n 'update:files': [files: File[]];\n 'upload-start': [file: File];\n 'upload-success': [file: File];\n 'upload-error': [details: { file: File; error: unknown }];\n}>();\n\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst dragging = ref(false);\nconst statuses = ref(new Map<File, 'uploading' | 'success' | 'error'>());\nconst progress = ref(new Map<File, number>());\n\nfunction openPicker() {\n inputRef.value?.click();\n}\n\nfunction onDragEnter() {\n if (!props.drag || props.disabled) return;\n dragging.value = true;\n}\n\nfunction onNativeChange(event: Event) {\n const input = event.target as HTMLInputElement;\n const picked = Array.from(input.files ?? []);\n input.value = '';\n if (!picked.length) return;\n\n acceptFiles(picked);\n}\n\nfunction onDrop(event: DragEvent) {\n dragging.value = false;\n if (!props.drag || props.disabled) return;\n acceptFiles(Array.from(event.dataTransfer?.files ?? []));\n}\n\nfunction acceptFiles(picked: File[]) {\n if (!picked.length || props.disabled) return;\n const valid = props.maxSize == null ? picked : picked.filter(file => file.size <= props.maxSize!);\n let next = props.multiple ? [...props.files, ...valid] : valid.slice(0, 1);\n if (props.maxCount != null) next = next.slice(0, props.maxCount);\n emit('update:files', next);\n if (props.upload) next.filter(file => valid.includes(file)).forEach(uploadFile);\n}\n\nasync function uploadFile(file: File) {\n if (!props.upload) return;\n statuses.value = new Map(statuses.value).set(file, 'uploading');\n progress.value = new Map(progress.value).set(file, 0);\n emit('upload-start', file);\n try {\n await props.upload(file, percent => {\n const next = Math.max(0, Math.min(100, Math.round(percent)));\n progress.value = new Map(progress.value).set(file, next);\n props.onProgress?.(file, next);\n });\n statuses.value = new Map(statuses.value).set(file, 'success');\n progress.value = new Map(progress.value).set(file, 100);\n emit('upload-success', file);\n } catch (error) {\n statuses.value = new Map(statuses.value).set(file, 'error');\n emit('upload-error', { file, error });\n }\n}\n\nfunction removeAt(index: number) {\n const next = props.files.filter((_, i) => i !== index);\n emit('update:files', next);\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n</script>\n"],"names":["props","__props","messages","useGcsaLocaleMessages","resolvedButtonLabel","computed","resolvedHint","resolvedDragLabel","resolvedUploadingLabel","resolvedUploadErrorLabel","resolvedRetryLabel","emit","__emit","inputRef","ref","dragging","statuses","progress","openPicker","_a","onDragEnter","onNativeChange","event","input","picked","acceptFiles","onDrop","valid","file","next","uploadFile","percent","error","removeAt","index","_","i","formatSize","bytes","_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_3","_createVNode","GcsaIcon","_hoisted_4","_toDisplayString","_hoisted_5","_openBlock","_hoisted_6","_Fragment","_renderList","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_normalizeStyle","$event","_hoisted_12","_unref","_hoisted_13"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,UAAMA,IAAQC,GAURC,IAAWC,EAAA,GACXC,IAAsBC,EAAS,MAAML,EAAM,eAAeE,EAAS,MAAM,gBAAgB,GACzFI,IAAeD,EAAS,MAAML,EAAM,SAASA,EAAM,OAAOO,EAAkB,QAAQ,OAAU,GAC9FA,IAAoBF,EAAS,MAAML,EAAM,aAAaE,EAAS,MAAM,cAAc,GACnFM,IAAyBH,EAAS,MAAML,EAAM,kBAAkBE,EAAS,MAAM,eAAe,GAC9FO,IAA2BJ,EAAS,MAAML,EAAM,oBAAoBE,EAAS,MAAM,YAAY,GAC/FQ,IAAqBL,EAAS,MAAML,EAAM,cAAcE,EAAS,MAAM,WAAW,GAElFS,IAAOC,GAOPC,IAAWC,EAA6B,IAAI,GAC5CC,IAAWD,EAAI,EAAK,GACpBE,IAAWF,EAAI,oBAAI,KAA8C,GACjEG,IAAWH,EAAI,oBAAI,KAAmB;AAE5C,aAASI,IAAa;;AACpB,OAAAC,IAAAN,EAAS,UAAT,QAAAM,EAAgB;AAAA,IAClB;AAEA,aAASC,IAAc;AACrB,MAAI,CAACpB,EAAM,QAAQA,EAAM,aACzBe,EAAS,QAAQ;AAAA,IACnB;AAEA,aAASM,EAAeC,GAAc;AACpC,YAAMC,IAAQD,EAAM,QACdE,IAAS,MAAM,KAAKD,EAAM,SAAS,CAAA,CAAE;AAE3C,MADAA,EAAM,QAAQ,IACTC,EAAO,UAEZC,EAAYD,CAAM;AAAA,IAC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,EAAA,MAAS,IAAIY,CAAI,MAAA,eAA5BoB,KAAAT,EAAgK,OAAhKiB,IAAgK;AAAA,YAAhEf,EAA0D,QAAA;AAAA,cAAnD,OAAKgB,EAAA,EAAA,OAAA,GAAcxC,EAAA,MAAS,IAAIW,CAAI,KAAA,CAAA,IAAA,CAAA;AAAA,YAAA;;UAC7HZ,EAAA,MAAS,IAAIY,CAAI,MAAA,gBAA/BW,EAAuL,UAAA;AAAA;YAAzI,MAAK;AAAA,YAAS,OAAM;AAAA,YAAsC,UAAUtC,EAAA;AAAA,YAAW,SAAK,CAAAyD,MAAE5B,EAAWF,CAAI;AAAA,UAAA,KAAMlB,EAAA,KAAkB,GAAA,GAAAiD,EAAA;UAC3KlB,EAQS,UAAA;AAAA,YAPP,MAAK;AAAA,YACL,OAAM;AAAA,YACL,UAAUxC,EAAA;AAAA,YACV,cAAY2D,EAAA1D,CAAA,EAAS;AAAA,YACrB,SAAK,CAAAwD,MAAEzB,EAASC,CAAK;AAAA,UAAA,GAEnBY,EAAAc,EAAA1D,CAAA,EAAS,MAAM,GAAA,GAAA2D,EAAA;AAAA,QAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"GcsaUpload.vue.js","sources":["../../src/components/GcsaUpload.vue"],"sourcesContent":["<template>\n <div class=\"gcsa-upload\" :class=\"{ 'gcsa-upload--disabled': disabled, 'gcsa-upload--dragging': dragging }\">\n <input\n ref=\"inputRef\"\n type=\"file\"\n class=\"gcsa-upload__native\"\n :accept=\"accept\"\n :multiple=\"multiple\"\n :webkitdirectory=\"directory || undefined\"\n :disabled=\"disabled\"\n @change=\"onNativeChange\"\n />\n <div\n class=\"gcsa-upload__dropzone\"\n role=\"button\"\n tabindex=\"0\"\n @click=\"openPicker\"\n @keydown.enter.prevent=\"openPicker\"\n @keydown.space.prevent=\"openPicker\"\n @dragenter.prevent=\"onDragEnter\"\n @dragover.prevent=\"onDragEnter\"\n @dragleave.prevent=\"dragging = false\"\n @drop.prevent=\"onDrop\"\n >\n <span class=\"gcsa-upload__icon\" aria-hidden=\"true\">\n <GcsaIcon name=\"upload\" />\n </span>\n <span class=\"gcsa-upload__title\">{{ resolvedButtonLabel }}</span>\n <p v-if=\"resolvedHint\" class=\"gcsa-upload__hint\">{{ resolvedHint }}</p>\n </div>\n <ul v-if=\"files.length\" class=\"gcsa-upload__list\">\n <li v-for=\"(file, index) in files\" :key=\"`${file.name}-${index}`\" class=\"gcsa-upload__item\">\n <span class=\"gcsa-upload__name\">{{ file.name }}</span>\n <span class=\"gcsa-upload__size\">{{ formatSize(file.size) }}</span>\n <span v-if=\"statuses.get(file) === 'uploading'\" class=\"gcsa-upload__status\" role=\"status\">{{ resolvedUploadingLabel }} {{ progress.get(file) ?? 0 }}%</span>\n <span v-else-if=\"statuses.get(file) === 'error'\" class=\"gcsa-upload__status gcsa-upload__status--error\" role=\"alert\">{{ resolvedUploadErrorLabel }}</span>\n <div v-if=\"statuses.get(file) === 'uploading'\" class=\"gcsa-upload__progress\" aria-hidden=\"true\"><span :style=\"{ width: `${progress.get(file) ?? 0}%` }\" /></div>\n <button v-if=\"statuses.get(file) === 'error'\" type=\"button\" class=\"gcsa-upload__retry gcsa-focus-ring\" :disabled=\"disabled\" @click=\"uploadFile(file)\">{{ resolvedRetryLabel }}</button>\n <button\n type=\"button\"\n class=\"gcsa-upload__remove gcsa-focus-ring\"\n :disabled=\"disabled\"\n :aria-label=\"messages.uploadRemoveFile\"\n @click=\"removeAt(index)\"\n >\n {{ messages.remove }}\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { GcsaUploadProps } from '../types/componentProps';\nimport GcsaIcon from './GcsaIcon.vue';\nimport { useGcsaLocaleMessages } from '../composables/useGcsaLocale';\n\ndefineOptions({ name: 'GcsaUpload' });\n\nconst props = withDefaults(\n defineProps<GcsaUploadProps>(),\n {\n files: () => [],\n multiple: false,\n drag: false,\n directory: false\n }\n);\n\nconst messages = useGcsaLocaleMessages();\nconst resolvedButtonLabel = computed(() => props.buttonLabel ?? messages.value.uploadSelectFile);\nconst resolvedHint = computed(() => props.hint || (props.drag ? resolvedDragLabel.value : undefined));\nconst resolvedDragLabel = computed(() => props.dragLabel ?? messages.value.uploadDragHint);\nconst resolvedUploadingLabel = computed(() => props.uploadingLabel ?? messages.value.uploadUploading);\nconst resolvedUploadErrorLabel = computed(() => props.uploadErrorLabel ?? messages.value.uploadFailed);\nconst resolvedRetryLabel = computed(() => props.retryLabel ?? messages.value.uploadRetry);\n\nconst emit = defineEmits<{\n 'update:files': [files: File[]];\n 'upload-start': [file: File];\n 'upload-success': [file: File];\n 'upload-error': [details: { file: File; error: unknown }];\n}>();\n\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst dragging = ref(false);\nconst statuses = ref(new Map<File, 'uploading' | 'success' | 'error'>());\nconst progress = ref(new Map<File, number>());\n\nfunction openPicker() {\n inputRef.value?.click();\n}\n\nfunction onDragEnter() {\n if (!props.drag || props.disabled) return;\n dragging.value = true;\n}\n\nfunction onNativeChange(event: Event) {\n const input = event.target as HTMLInputElement;\n const picked = Array.from(input.files ?? []);\n input.value = '';\n if (!picked.length) return;\n\n acceptFiles(picked);\n}\n\nfunction onDrop(event: DragEvent) {\n dragging.value = false;\n if (!props.drag || props.disabled) return;\n acceptFiles(Array.from(event.dataTransfer?.files ?? []));\n}\n\nfunction acceptFiles(picked: File[]) {\n if (!picked.length || props.disabled) return;\n const valid = props.maxSize == null ? picked : picked.filter(file => file.size <= props.maxSize!);\n let next = props.multiple ? [...props.files, ...valid] : valid.slice(0, 1);\n if (props.maxCount != null) next = next.slice(0, props.maxCount);\n emit('update:files', next);\n if (props.upload) next.filter(file => valid.includes(file)).forEach(uploadFile);\n}\n\nasync function uploadFile(file: File) {\n if (!props.upload) return;\n statuses.value = new Map(statuses.value).set(file, 'uploading');\n progress.value = new Map(progress.value).set(file, 0);\n emit('upload-start', file);\n try {\n await props.upload(file, percent => {\n const next = Math.max(0, Math.min(100, Math.round(percent)));\n progress.value = new Map(progress.value).set(file, next);\n props.onProgress?.(file, next);\n });\n statuses.value = new Map(statuses.value).set(file, 'success');\n progress.value = new Map(progress.value).set(file, 100);\n emit('upload-success', file);\n } catch (error) {\n statuses.value = new Map(statuses.value).set(file, 'error');\n emit('upload-error', { file, error });\n }\n}\n\nfunction removeAt(index: number) {\n const next = props.files.filter((_, i) => i !== index);\n emit('update:files', next);\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n</script>\n"],"names":["props","__props","messages","useGcsaLocaleMessages","resolvedButtonLabel","computed","resolvedHint","resolvedDragLabel","resolvedUploadingLabel","resolvedUploadErrorLabel","resolvedRetryLabel","emit","__emit","inputRef","ref","dragging","statuses","progress","openPicker","_a","onDragEnter","onNativeChange","event","input","picked","acceptFiles","onDrop","valid","file","next","uploadFile","percent","error","removeAt","index","_","i","formatSize","bytes","_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_3","_createVNode","GcsaIcon","_hoisted_4","_toDisplayString","_hoisted_5","_openBlock","_hoisted_6","_Fragment","_renderList","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_normalizeStyle","$event","_hoisted_12","_unref","_hoisted_13"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,UAAMA,IAAQC,GAURC,IAAWC,EAAA,GACXC,IAAsBC,EAAS,MAAML,EAAM,eAAeE,EAAS,MAAM,gBAAgB,GACzFI,IAAeD,EAAS,MAAML,EAAM,SAASA,EAAM,OAAOO,EAAkB,QAAQ,OAAU,GAC9FA,IAAoBF,EAAS,MAAML,EAAM,aAAaE,EAAS,MAAM,cAAc,GACnFM,IAAyBH,EAAS,MAAML,EAAM,kBAAkBE,EAAS,MAAM,eAAe,GAC9FO,IAA2B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A1D,CAAA,EAAS,MAAM,GAAA,GAAA2D,EAAA;AAAA,QAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** 导航侧栏图标 — 与 @gcsa/console-core GcsaNavItem.iconKey 对齐 */
|
|
2
2
|
export declare const GCSA_NAV_ICON_NAMES: readonly ["dashboard", "alert", "assets", "settings", "users", "chat"];
|
|
3
3
|
/** 组件内部 UI 图标(文件名 kebab-case → 注册为 camelCase key) */
|
|
4
|
-
export declare const GCSA_UI_ICON_NAMES: readonly ["chevronDown", "chevronUp", "chevronLeft", "chevronRight", "check", "close", "menu", "plus", "resultEmpty"];
|
|
5
|
-
export declare const GCSA_ICON_NAMES: readonly ["dashboard", "alert", "assets", "settings", "users", "chat", "chevronDown", "chevronUp", "chevronLeft", "chevronRight", "check", "close", "menu", "plus", "resultEmpty"];
|
|
4
|
+
export declare const GCSA_UI_ICON_NAMES: readonly ["chevronDown", "chevronUp", "chevronLeft", "chevronRight", "check", "close", "menu", "plus", "upload", "resultEmpty"];
|
|
5
|
+
export declare const GCSA_ICON_NAMES: readonly ["dashboard", "alert", "assets", "settings", "users", "chat", "chevronDown", "chevronUp", "chevronLeft", "chevronRight", "check", "close", "menu", "plus", "upload", "resultEmpty"];
|
|
6
6
|
export type GcsaNavIconName = (typeof GCSA_NAV_ICON_NAMES)[number];
|
|
7
7
|
export type GcsaIconName = (typeof GCSA_ICON_NAMES)[number];
|
package/dist/icons/iconNames.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconNames.js","sources":["../../src/icons/iconNames.ts"],"sourcesContent":["/** 导航侧栏图标 — 与 @gcsa/console-core GcsaNavItem.iconKey 对齐 */\nexport const GCSA_NAV_ICON_NAMES = [\n 'dashboard',\n 'alert',\n 'assets',\n 'settings',\n 'users',\n 'chat'\n] as const;\n\n/** 组件内部 UI 图标(文件名 kebab-case → 注册为 camelCase key) */\nexport const GCSA_UI_ICON_NAMES = [\n 'chevronDown',\n 'chevronUp',\n 'chevronLeft',\n 'chevronRight',\n 'check',\n 'close',\n 'menu',\n 'plus',\n 'resultEmpty'\n] as const;\n\nexport const GCSA_ICON_NAMES = [...GCSA_NAV_ICON_NAMES, ...GCSA_UI_ICON_NAMES] as const;\n\nexport type GcsaNavIconName = (typeof GCSA_NAV_ICON_NAMES)[number];\nexport type GcsaIconName = (typeof GCSA_ICON_NAMES)[number];\n"],"names":["GCSA_NAV_ICON_NAMES","GCSA_UI_ICON_NAMES","GCSA_ICON_NAMES"],"mappings":"AACO,MAAMA,IAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGaC,IAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAkB,CAAC,GAAGF,GAAqB,GAAGC,CAAkB;"}
|
|
1
|
+
{"version":3,"file":"iconNames.js","sources":["../../src/icons/iconNames.ts"],"sourcesContent":["/** 导航侧栏图标 — 与 @gcsa/console-core GcsaNavItem.iconKey 对齐 */\nexport const GCSA_NAV_ICON_NAMES = [\n 'dashboard',\n 'alert',\n 'assets',\n 'settings',\n 'users',\n 'chat'\n] as const;\n\n/** 组件内部 UI 图标(文件名 kebab-case → 注册为 camelCase key) */\nexport const GCSA_UI_ICON_NAMES = [\n 'chevronDown',\n 'chevronUp',\n 'chevronLeft',\n 'chevronRight',\n 'check',\n 'close',\n 'menu',\n 'plus',\n 'upload',\n 'resultEmpty'\n] as const;\n\nexport const GCSA_ICON_NAMES = [...GCSA_NAV_ICON_NAMES, ...GCSA_UI_ICON_NAMES] as const;\n\nexport type GcsaNavIconName = (typeof GCSA_NAV_ICON_NAMES)[number];\nexport type GcsaIconName = (typeof GCSA_ICON_NAMES)[number];\n"],"names":["GCSA_NAV_ICON_NAMES","GCSA_UI_ICON_NAMES","GCSA_ICON_NAMES"],"mappings":"AACO,MAAMA,IAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGaC,IAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAkB,CAAC,GAAGF,GAAqB,GAAGC,CAAkB;"}
|
package/dist/icons/registry.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GcsaIconName } from './iconNames';
|
|
2
|
-
export declare const GcsaIcons: Record<"dashboard" | "alert" | "assets" | "settings" | "users" | "chat" | "chevronDown" | "chevronUp" | "chevronLeft" | "chevronRight" | "check" | "close" | "menu" | "plus" | "resultEmpty", string>;
|
|
2
|
+
export declare const GcsaIcons: Record<"dashboard" | "alert" | "assets" | "settings" | "users" | "chat" | "chevronDown" | "chevronUp" | "chevronLeft" | "chevronRight" | "check" | "close" | "menu" | "plus" | "upload" | "resultEmpty", string>;
|
|
3
3
|
export declare function getGcsaIconSvg(name: GcsaIconName): string;
|
package/dist/icons/registry.js
CHANGED
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import v from "./svg/alert.svg.js";
|
|
2
|
+
import i from "./svg/assets.svg.js";
|
|
3
|
+
import m from "./svg/chat.svg.js";
|
|
4
|
+
import n from "./svg/check.svg.js";
|
|
5
|
+
import f from "./svg/chevron-down.svg.js";
|
|
6
6
|
import s from "./svg/chevron-left.svg.js";
|
|
7
7
|
import c from "./svg/chevron-right.svg.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import l from "./svg/chevron-up.svg.js";
|
|
9
|
+
import p from "./svg/close.svg.js";
|
|
10
|
+
import a from "./svg/dashboard.svg.js";
|
|
11
11
|
import r from "./svg/menu.svg.js";
|
|
12
12
|
import b from "./svg/plus.svg.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import u from "./svg/result-empty.svg.js";
|
|
14
|
+
import h from "./svg/settings.svg.js";
|
|
15
|
+
import t from "./svg/upload.svg.js";
|
|
16
|
+
import d from "./svg/users.svg.js";
|
|
16
17
|
import { GCSA_ICON_NAMES as S } from "./iconNames.js";
|
|
17
|
-
const
|
|
18
|
-
"./svg/alert.svg":
|
|
19
|
-
"./svg/assets.svg":
|
|
20
|
-
"./svg/chat.svg":
|
|
21
|
-
"./svg/check.svg":
|
|
22
|
-
"./svg/chevron-down.svg":
|
|
18
|
+
const I = /* @__PURE__ */ Object.assign({
|
|
19
|
+
"./svg/alert.svg": v,
|
|
20
|
+
"./svg/assets.svg": i,
|
|
21
|
+
"./svg/chat.svg": m,
|
|
22
|
+
"./svg/check.svg": n,
|
|
23
|
+
"./svg/chevron-down.svg": f,
|
|
23
24
|
"./svg/chevron-left.svg": s,
|
|
24
25
|
"./svg/chevron-right.svg": c,
|
|
25
|
-
"./svg/chevron-up.svg":
|
|
26
|
-
"./svg/close.svg":
|
|
27
|
-
"./svg/dashboard.svg":
|
|
26
|
+
"./svg/chevron-up.svg": l,
|
|
27
|
+
"./svg/close.svg": p,
|
|
28
|
+
"./svg/dashboard.svg": a,
|
|
28
29
|
"./svg/menu.svg": r,
|
|
29
30
|
"./svg/plus.svg": b,
|
|
30
|
-
"./svg/result-empty.svg":
|
|
31
|
-
"./svg/settings.svg":
|
|
32
|
-
"./svg/
|
|
31
|
+
"./svg/result-empty.svg": u,
|
|
32
|
+
"./svg/settings.svg": h,
|
|
33
|
+
"./svg/upload.svg": t,
|
|
34
|
+
"./svg/users.svg": d
|
|
33
35
|
});
|
|
34
|
-
function
|
|
36
|
+
function O(o) {
|
|
35
37
|
return o.slice(o.lastIndexOf("/") + 1).replace(/\.svg$/, "");
|
|
36
38
|
}
|
|
37
|
-
function
|
|
38
|
-
return o.replace(/-([a-z])/g, (_,
|
|
39
|
+
function j(o) {
|
|
40
|
+
return o.replace(/-([a-z])/g, (_, g) => g.toUpperCase());
|
|
39
41
|
}
|
|
40
|
-
const
|
|
42
|
+
const e = {
|
|
41
43
|
...Object.fromEntries(
|
|
42
|
-
Object.entries(
|
|
44
|
+
Object.entries(I).map(([o, _]) => [j(O(o)), _])
|
|
43
45
|
),
|
|
44
46
|
menu: r,
|
|
45
|
-
chevronLeft: s
|
|
47
|
+
chevronLeft: s,
|
|
48
|
+
upload: t
|
|
46
49
|
};
|
|
47
50
|
for (const o of S)
|
|
48
|
-
if (!
|
|
51
|
+
if (!e[o])
|
|
49
52
|
throw new Error(`[gcsa-icons] missing svg file for icon "${o}"`);
|
|
50
|
-
const
|
|
51
|
-
function
|
|
52
|
-
return
|
|
53
|
+
const w = e;
|
|
54
|
+
function F(o) {
|
|
55
|
+
return w[o];
|
|
53
56
|
}
|
|
54
57
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
w as GcsaIcons,
|
|
59
|
+
F as getGcsaIconSvg
|
|
57
60
|
};
|
|
58
61
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sources":["../../src/icons/registry.ts"],"sourcesContent":["import {\n GCSA_ICON_NAMES,\n type GcsaIconName\n} from './iconNames';\n// 显式导入:避免 dev 下 glob 缓存未收录新 SVG 时模块加载即抛错白屏\nimport chevronLeftSvg from './svg/chevron-left.svg?raw';\nimport menuSvg from './svg/menu.svg?raw';\n\nconst svgModules = import.meta.glob('./svg/*.svg', {\n query: '?raw',\n import: 'default',\n eager: true\n}) as Record<string, string>;\n\nfunction fileStem(path: string): string {\n const file = path.slice(path.lastIndexOf('/') + 1);\n return file.replace(/\\.svg$/, '');\n}\n\n/** kebab-case 文件名 → camelCase 注册 key(chevron-down → chevronDown) */\nfunction toIconKey(stem: string): string {\n return stem.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase());\n}\n\nconst registry = {\n ...Object.fromEntries(\n Object.entries(svgModules).map(([path, svg]) => [toIconKey(fileStem(path)), svg])\n ),\n menu: menuSvg,\n chevronLeft: chevronLeftSvg\n} as Record<GcsaIconName, string>;\n\nfor (const name of GCSA_ICON_NAMES) {\n if (!registry[name]) {\n throw new Error(`[gcsa-icons] missing svg file for icon \"${name}\"`);\n }\n}\n\nexport const GcsaIcons = registry;\n\nexport function getGcsaIconSvg(name: GcsaIconName): string {\n return GcsaIcons[name];\n}\n"],"names":["svgModules","__vite_glob_0_0","__vite_glob_0_1","__vite_glob_0_2","__vite_glob_0_3","__vite_glob_0_4","__vite_glob_0_5","__vite_glob_0_6","__vite_glob_0_7","__vite_glob_0_8","__vite_glob_0_9","__vite_glob_0_10","__vite_glob_0_11","__vite_glob_0_12","__vite_glob_0_13","__vite_glob_0_14","fileStem","path","toIconKey","stem","letter","registry","svg","menuSvg","chevronLeftSvg","name","GCSA_ICON_NAMES","GcsaIcons","getGcsaIconSvg"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sources":["../../src/icons/registry.ts"],"sourcesContent":["import {\n GCSA_ICON_NAMES,\n type GcsaIconName\n} from './iconNames';\n// 显式导入:避免 dev 下 glob 缓存未收录新 SVG 时模块加载即抛错白屏\nimport chevronLeftSvg from './svg/chevron-left.svg?raw';\nimport menuSvg from './svg/menu.svg?raw';\nimport uploadSvg from './svg/upload.svg?raw';\n\nconst svgModules = import.meta.glob('./svg/*.svg', {\n query: '?raw',\n import: 'default',\n eager: true\n}) as Record<string, string>;\n\nfunction fileStem(path: string): string {\n const file = path.slice(path.lastIndexOf('/') + 1);\n return file.replace(/\\.svg$/, '');\n}\n\n/** kebab-case 文件名 → camelCase 注册 key(chevron-down → chevronDown) */\nfunction toIconKey(stem: string): string {\n return stem.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase());\n}\n\nconst registry = {\n ...Object.fromEntries(\n Object.entries(svgModules).map(([path, svg]) => [toIconKey(fileStem(path)), svg])\n ),\n menu: menuSvg,\n chevronLeft: chevronLeftSvg,\n upload: uploadSvg\n} as Record<GcsaIconName, string>;\n\nfor (const name of GCSA_ICON_NAMES) {\n if (!registry[name]) {\n throw new Error(`[gcsa-icons] missing svg file for icon \"${name}\"`);\n }\n}\n\nexport const GcsaIcons = registry;\n\nexport function getGcsaIconSvg(name: GcsaIconName): string {\n return GcsaIcons[name];\n}\n"],"names":["svgModules","__vite_glob_0_0","__vite_glob_0_1","__vite_glob_0_2","__vite_glob_0_3","__vite_glob_0_4","__vite_glob_0_5","__vite_glob_0_6","__vite_glob_0_7","__vite_glob_0_8","__vite_glob_0_9","__vite_glob_0_10","__vite_glob_0_11","__vite_glob_0_12","__vite_glob_0_13","__vite_glob_0_14","__vite_glob_0_15","fileStem","path","toIconKey","stem","letter","registry","svg","menuSvg","chevronLeftSvg","uploadSvg","name","GCSA_ICON_NAMES","GcsaIcons","getGcsaIconSvg"],"mappings":";;;;;;;;;;;;;;;;;AASA,MAAMA,IAAa,uBAAA,OAAA;AAAA,EAAA,mBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA,mBAAAC;AAAA,EAAA,0BAAAC;AAAA,EAAA,0BAAAC;AAAAA,EAAA,2BAAAC;AAAA,EAAA,wBAAAC;AAAA,EAAA,mBAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,kBAAAC;AAAAA,EAAA,kBAAAC;AAAA,EAAA,0BAAAC;AAAA,EAAA,sBAAAC;AAAA,EAAA,oBAAAC;AAAAA,EAAA,mBAAAC;AAAA,CAAA;AAMnB,SAASC,EAASC,GAAsB;AAEtC,SADaA,EAAK,MAAMA,EAAK,YAAY,GAAG,IAAI,CAAC,EACrC,QAAQ,UAAU,EAAE;AAClC;AAGA,SAASC,EAAUC,GAAsB;AACvC,SAAOA,EAAK,QAAQ,aAAa,CAAC,GAAGC,MAAmBA,EAAO,aAAa;AAC9E;AAEA,MAAMC,IAAW;AAAA,EACf,GAAG,OAAO;AAAA,IACR,OAAO,QAAQtB,CAAU,EAAE,IAAI,CAAC,CAACkB,GAAMK,CAAG,MAAM,CAACJ,EAAUF,EAASC,CAAI,CAAC,GAAGK,CAAG,CAAC;AAAA,EAAA;AAAA,EAElF,MAAMC;AAAA,EACN,aAAaC;AAAA,EACb,QAAQC;AACV;AAEA,WAAWC,KAAQC;AACjB,MAAI,CAACN,EAASK,CAAI;AAChB,UAAM,IAAI,MAAM,2CAA2CA,CAAI,GAAG;AAI/D,MAAME,IAAYP;AAElB,SAASQ,EAAeH,GAA4B;AACzD,SAAOE,EAAUF,CAAI;AACvB;"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = `<svg width="66" height="66" viewBox="0 0 66 66" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<ellipse cx="33" cy="53" rx="33" ry="8" fill="#00BBCC" fill-opacity="0.1"/>
|
|
3
|
+
<path d="M35 19.5L12 26V49L35 47.5V19.5Z" fill="#00BBCC" fill-opacity="0.3"/>
|
|
4
|
+
<path d="M55 46.5V25L35 19.5V42L55 46.5Z" fill="#00BBCC" fill-opacity="0.4"/>
|
|
5
|
+
<path d="M54.4179 7.58906L57 9.00955L54.4106 10.4173L52.9909 13L51.5821 10.4109L49 8.99045L51.5894 7.5827L53.0091 5L54.4179 7.58906Z" fill="#00BBCC" fill-opacity="0.4"/>
|
|
6
|
+
<path d="M32 56.0806V32L55 25V48L32 56.0806Z" fill="#7CDBE4"/>
|
|
7
|
+
<path d="M32 56.0806V32L12 26V49L32 56.0806Z" fill="#97E3EA"/>
|
|
8
|
+
<path d="M25 7.5L35 19.5L12 26L2 14L25 7.5Z" fill="#CCF1F5"/>
|
|
9
|
+
<circle cx="35" cy="17.5" r="9" fill="#00BBCC"/>
|
|
10
|
+
<path d="M34.4 19.875V18.625H35C36.02 18.625 36.8 17.8125 36.8 16.75V16.125C36.8 15.0625 36.02 14.25 35 14.25C33.98 14.25 33.2 15.0625 33.2 16.125V16.75H32V16.125C32 14.375 33.32 13 35 13C36.68 13 38 14.375 38 16.125V16.75C38 18.25 36.98 19.5 35.6 19.8125V21.125H34.4V19.875ZM34.4 21.75H35.6V23H34.4V21.75Z" fill="white"/>
|
|
11
|
+
</svg>
|
|
2
12
|
`;
|
|
3
13
|
export {
|
|
4
|
-
|
|
14
|
+
l as default
|
|
5
15
|
};
|
|
6
16
|
//# sourceMappingURL=result-empty.svg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-empty.svg.js","sources":["../../../src/icons/svg/result-empty.svg?raw"],"sourcesContent":["export default \"<svg viewBox=\\\"0 0
|
|
1
|
+
{"version":3,"file":"result-empty.svg.js","sources":["../../../src/icons/svg/result-empty.svg?raw"],"sourcesContent":["export default \"<svg width=\\\"66\\\" height=\\\"66\\\" viewBox=\\\"0 0 66 66\\\" fill=\\\"none\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\">\\n<ellipse cx=\\\"33\\\" cy=\\\"53\\\" rx=\\\"33\\\" ry=\\\"8\\\" fill=\\\"#00BBCC\\\" fill-opacity=\\\"0.1\\\"/>\\n<path d=\\\"M35 19.5L12 26V49L35 47.5V19.5Z\\\" fill=\\\"#00BBCC\\\" fill-opacity=\\\"0.3\\\"/>\\n<path d=\\\"M55 46.5V25L35 19.5V42L55 46.5Z\\\" fill=\\\"#00BBCC\\\" fill-opacity=\\\"0.4\\\"/>\\n<path d=\\\"M54.4179 7.58906L57 9.00955L54.4106 10.4173L52.9909 13L51.5821 10.4109L49 8.99045L51.5894 7.5827L53.0091 5L54.4179 7.58906Z\\\" fill=\\\"#00BBCC\\\" fill-opacity=\\\"0.4\\\"/>\\n<path d=\\\"M32 56.0806V32L55 25V48L32 56.0806Z\\\" fill=\\\"#7CDBE4\\\"/>\\n<path d=\\\"M32 56.0806V32L12 26V49L32 56.0806Z\\\" fill=\\\"#97E3EA\\\"/>\\n<path d=\\\"M25 7.5L35 19.5L12 26L2 14L25 7.5Z\\\" fill=\\\"#CCF1F5\\\"/>\\n<circle cx=\\\"35\\\" cy=\\\"17.5\\\" r=\\\"9\\\" fill=\\\"#00BBCC\\\"/>\\n<path d=\\\"M34.4 19.875V18.625H35C36.02 18.625 36.8 17.8125 36.8 16.75V16.125C36.8 15.0625 36.02 14.25 35 14.25C33.98 14.25 33.2 15.0625 33.2 16.125V16.75H32V16.125C32 14.375 33.32 13 35 13C36.68 13 38 14.375 38 16.125V16.75C38 18.25 36.98 19.5 35.6 19.8125V21.125H34.4V19.875ZM34.4 21.75H35.6V23H34.4V21.75Z\\\" fill=\\\"white\\\"/>\\n</svg>\\n\""],"names":["__vite_glob_0_12"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const o = `<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
2
|
+
<path d="M32.5 20.2C31.4 15.7 27.5 12.5 22.8 12.5C18.6 12.5 15 15 13.5 18.6C10 19.1 7.5 22.1 7.5 25.7C7.5 29.6 10.7 32.8 14.6 32.8H32.2C35.6 32.8 38.5 30 38.5 26.5C38.5 23.3 35.9 20.7 32.5 20.2Z" stroke="currentColor" stroke-width="1.75" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M24 22.5V36" stroke="currentColor" stroke-width="1.75" stroke-linecap="round"/>
|
|
4
|
+
<path d="M19.5 27L24 22.5L28.5 27" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
|
6
|
+
`;
|
|
7
|
+
export {
|
|
8
|
+
o as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=upload.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.svg.js","sources":["../../../src/icons/svg/upload.svg?raw"],"sourcesContent":["export default \"<svg viewBox=\\\"0 0 48 48\\\" fill=\\\"none\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" aria-hidden=\\\"true\\\">\\n <path d=\\\"M32.5 20.2C31.4 15.7 27.5 12.5 22.8 12.5C18.6 12.5 15 15 13.5 18.6C10 19.1 7.5 22.1 7.5 25.7C7.5 29.6 10.7 32.8 14.6 32.8H32.2C35.6 32.8 38.5 30 38.5 26.5C38.5 23.3 35.9 20.7 32.5 20.2Z\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.75\\\" stroke-linejoin=\\\"round\\\"/>\\n <path d=\\\"M24 22.5V36\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.75\\\" stroke-linecap=\\\"round\\\"/>\\n <path d=\\\"M19.5 27L24 22.5L28.5 27\\\" stroke=\\\"currentColor\\\" stroke-width=\\\"1.75\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\"/>\\n</svg>\\n\""],"names":["uploadSvg"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|