energy-components 1.8.1 → 1.9.0
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/avatar.es.js +161 -0
- package/dist/components/checkbox.es.js +51 -35
- package/dist/components/directAccess.es.js +146 -0
- package/dist/components/dragAndDrop.es.js +77 -60
- package/dist/components/fileUploadItem.es.js +182 -0
- package/dist/components/filterChip.es.js +26 -22
- package/dist/components/index.es.js +76 -64
- package/dist/components/link.es.js +67 -55
- package/dist/components/loader.es.js +178 -0
- package/dist/components/progressBar.es.js +52 -28
- package/dist/components/selectionChip.es.js +15 -14
- package/dist/components/style/avatar.css +1 -0
- package/dist/components/style/button.css +1 -1
- package/dist/components/style/checkbox.css +1 -1
- package/dist/components/style/directAccess.css +1 -0
- package/dist/components/style/dragAndDrop.css +1 -1
- package/dist/components/style/fileUploadItem.css +1 -0
- package/dist/components/style/filterChip.css +1 -1
- package/dist/components/style/link.css +1 -1
- package/dist/components/style/loader.css +1 -0
- package/dist/components/style/progressBar.css +1 -1
- package/dist/components/style/selectionChip.css +1 -1
- package/dist/components/style/toggle.css +1 -1
- package/dist/components/toggle.es.js +21 -20
- package/dist/energy-components.es.js +5025 -4303
- package/dist/energy-components.umd.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/src/components/content/avatar/avatar.vue.d.ts +153 -0
- package/dist/types/src/components/feedback/loader/loader.vue.d.ts +151 -0
- package/dist/types/src/components/feedback/progress-bar/progress-bar.vue.d.ts +34 -0
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/input/checkbox/checkbox.vue.d.ts +15 -0
- package/dist/types/src/components/input/drag-and-drop/drag-and-drop.vue.d.ts +14 -2
- package/dist/types/src/components/input/file-upload-item/file-upload-item.vue.d.ts +229 -0
- package/dist/types/src/components/input/filter-chip/filter-chip.vue.d.ts +2 -0
- package/dist/types/src/components/navigation/direct-access/direct-access.vue.d.ts +178 -0
- package/dist/types/src/components/navigation/link/link.vue.d.ts +15 -0
- package/dist/types/src/components/overlay/tooltip/tooltip.vue.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { defineComponent as _, computed as a, createElementBlock as s, openBlock as r, withKeys as o, normalizeStyle as u, normalizeClass as h, createBlock as k, createCommentVNode as b, toDisplayString as z } from "vue";
|
|
2
|
+
import { R as C } from "./icon-svg-_WCkLP8-.js";
|
|
3
|
+
import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import './style/avatar.css';const A = ["aria-label"], B = ["src", "alt"], D = {
|
|
5
|
+
key: 1,
|
|
6
|
+
class: "rds-e-avatar__initials"
|
|
7
|
+
}, N = {
|
|
8
|
+
key: 3,
|
|
9
|
+
class: "rds-e-avatar__badge",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
}, E = /* @__PURE__ */ _({
|
|
12
|
+
__name: "avatar",
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* Tipo de contenido para el avatar.
|
|
16
|
+
* <br>
|
|
17
|
+
* `['icon', 'image', 'initials']`
|
|
18
|
+
*/
|
|
19
|
+
type: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "icon",
|
|
22
|
+
validator: (t) => ["icon", "image", "initials"].includes(t)
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* URL de la imagen a mostrar si el tipo es 'image'.
|
|
26
|
+
*/
|
|
27
|
+
src: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Nombre del icono a mostrar si el tipo es 'icon'.
|
|
33
|
+
* Por defecto es 'user_default'.
|
|
34
|
+
*/
|
|
35
|
+
iconName: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "user_default"
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Texto de las iniciales a mostrar si el tipo es 'initials'.
|
|
41
|
+
* Se mostrarán como máximo los dos primeros caracteres en mayúsculas.
|
|
42
|
+
*/
|
|
43
|
+
initials: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ""
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Indica si se debe mostrar un badge de notificación en el avatar.
|
|
49
|
+
*/
|
|
50
|
+
badge: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !1
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Color de fondo del avatar.
|
|
56
|
+
* Puede ser un valor de color CSS válido (ej: '#333', 'rgb(255,0,0)', 'red') o una variable CSS.
|
|
57
|
+
* Por defecto es '#DBE6F0'.
|
|
58
|
+
*/
|
|
59
|
+
backgroundColor: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "#DBE6F0"
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Tamaño del avatar.
|
|
65
|
+
* <br>
|
|
66
|
+
* `'s'` (24px), `'m'` (32px), `'l'` (40px), `'xl'` (48px)
|
|
67
|
+
* Por defecto es 'l'.
|
|
68
|
+
*/
|
|
69
|
+
size: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "l",
|
|
72
|
+
// Corresponds to '40px'
|
|
73
|
+
validator: (t) => Object.keys({ s: "24px", m: "32px", l: "40px", xl: "48px" }).includes(t)
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Texto alternativo para la imagen del avatar (usado para accesibilidad si el tipo es 'image').
|
|
77
|
+
*/
|
|
78
|
+
alt: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: "Avatar"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
emits: ["click"],
|
|
84
|
+
setup(t, { emit: d }) {
|
|
85
|
+
const e = t, p = d, m = {
|
|
86
|
+
s: "24px",
|
|
87
|
+
m: "32px",
|
|
88
|
+
l: "40px",
|
|
89
|
+
xl: "48px"
|
|
90
|
+
}, v = a(() => `rds-e-avatar--${e.size}`), n = a(() => !e.initials || typeof e.initials != "string" ? "" : e.initials.trim().substring(0, 2).toUpperCase()), y = a(() => {
|
|
91
|
+
switch (e.size) {
|
|
92
|
+
case "s":
|
|
93
|
+
return "10px";
|
|
94
|
+
case "m":
|
|
95
|
+
return "12px";
|
|
96
|
+
case "l":
|
|
97
|
+
return "14px";
|
|
98
|
+
case "xl":
|
|
99
|
+
return "16px";
|
|
100
|
+
default:
|
|
101
|
+
return "14px";
|
|
102
|
+
}
|
|
103
|
+
}), f = a(() => {
|
|
104
|
+
const i = m[e.size];
|
|
105
|
+
return {
|
|
106
|
+
width: i,
|
|
107
|
+
height: i,
|
|
108
|
+
backgroundColor: e.type === "image" && e.src ? "transparent" : e.backgroundColor,
|
|
109
|
+
fontSize: y.value,
|
|
110
|
+
lineHeight: i
|
|
111
|
+
};
|
|
112
|
+
}), c = a(() => e.type === "icon" && e.iconName ? e.iconName : "user_default"), x = a(() => {
|
|
113
|
+
switch (e.size) {
|
|
114
|
+
case "s":
|
|
115
|
+
return "12px";
|
|
116
|
+
case "m":
|
|
117
|
+
return "16px";
|
|
118
|
+
case "l":
|
|
119
|
+
return "20px";
|
|
120
|
+
case "xl":
|
|
121
|
+
return "24px";
|
|
122
|
+
default:
|
|
123
|
+
return "20px";
|
|
124
|
+
}
|
|
125
|
+
}), g = a(() => ({
|
|
126
|
+
fontSize: x.value,
|
|
127
|
+
color: "#001E37"
|
|
128
|
+
})), S = a(() => e.alt && e.type === "image" ? e.alt : e.type === "initials" && n.value ? `Avatar con iniciales ${n.value}` : e.type === "icon" ? `Avatar con icono ${c.value}` : e.badge ? "Avatar de usuario con notificación" : "Avatar de usuario"), l = (i) => {
|
|
129
|
+
p("click", i);
|
|
130
|
+
};
|
|
131
|
+
return (i, I) => (r(), s("div", {
|
|
132
|
+
class: h(["rds-e-avatar", [v.value]]),
|
|
133
|
+
style: u(f.value),
|
|
134
|
+
role: "button",
|
|
135
|
+
tabindex: "0",
|
|
136
|
+
"aria-label": S.value,
|
|
137
|
+
onClick: l,
|
|
138
|
+
onKeydown: [
|
|
139
|
+
o(l, ["enter"]),
|
|
140
|
+
o(l, ["space"])
|
|
141
|
+
]
|
|
142
|
+
}, [
|
|
143
|
+
t.type === "image" && t.src ? (r(), s("img", {
|
|
144
|
+
key: 0,
|
|
145
|
+
src: t.src,
|
|
146
|
+
alt: t.alt,
|
|
147
|
+
class: "rds-e-avatar__image"
|
|
148
|
+
}, null, 8, B)) : t.type === "initials" && n.value ? (r(), s("span", D, z(n.value), 1)) : (r(), k(C, {
|
|
149
|
+
key: 2,
|
|
150
|
+
name: c.value,
|
|
151
|
+
class: "rds-e-avatar__icon",
|
|
152
|
+
style: u(g.value),
|
|
153
|
+
"aria-hidden": "true"
|
|
154
|
+
}, null, 8, ["name", "style"])),
|
|
155
|
+
t.badge ? (r(), s("span", N)) : b("", !0)
|
|
156
|
+
], 46, A));
|
|
157
|
+
}
|
|
158
|
+
}), R = /* @__PURE__ */ w(E, [["__scopeId", "data-v-194a7f49"]]);
|
|
159
|
+
export {
|
|
160
|
+
R as default
|
|
161
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as y, ref as n, watch as b, onMounted as w, onBeforeUnmount as g, createElementBlock as S, openBlock as f, normalizeClass as d, createElementVNode as r, renderSlot as B, createTextVNode as C, createBlock as _, createCommentVNode as E, toDisplayString as L } from "vue";
|
|
2
2
|
import { R as V } from "./icon-svg-_WCkLP8-.js";
|
|
3
|
-
import { _ } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
-
import './style/checkbox.css';const
|
|
3
|
+
import { _ as D } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import './style/checkbox.css';const N = ["id", "checked", "aria-label", "required", "disabled"], R = ["for"], q = /* @__PURE__ */ y({
|
|
5
5
|
__name: "checkbox",
|
|
6
6
|
props: {
|
|
7
7
|
/**
|
|
@@ -59,52 +59,68 @@ import './style/checkbox.css';const D = ["id", "checked", "aria-label", "require
|
|
|
59
59
|
disabled: {
|
|
60
60
|
type: Boolean,
|
|
61
61
|
default: !1
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* <span>Estado "indeterminado" visual del checkbox. Solo afecta si está checked.</span>
|
|
65
|
+
*/
|
|
66
|
+
indeterminate: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
62
69
|
}
|
|
63
70
|
},
|
|
64
71
|
emits: ["update:modelValue"],
|
|
65
|
-
setup(e, { emit:
|
|
66
|
-
const
|
|
67
|
-
|
|
72
|
+
setup(e, { emit: m }) {
|
|
73
|
+
const o = e, k = m, t = n(o.isChecked), c = n(!1), i = n(!1), l = n(null);
|
|
74
|
+
b(() => o.isChecked, (a) => {
|
|
68
75
|
t.value = a;
|
|
69
|
-
})
|
|
76
|
+
}), b(
|
|
77
|
+
() => o.indeterminate,
|
|
78
|
+
(a) => {
|
|
79
|
+
l.value && (l.value.indeterminate = !!(a && t.value));
|
|
80
|
+
},
|
|
81
|
+
{ immediate: !0 }
|
|
82
|
+
);
|
|
70
83
|
const h = () => {
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
t.value = a.target.checked,
|
|
74
|
-
},
|
|
75
|
-
a.key === "Tab" && (
|
|
76
|
-
},
|
|
77
|
-
|
|
84
|
+
i.value && (c.value = !0);
|
|
85
|
+
}, v = () => c.value = !1, x = (a) => {
|
|
86
|
+
t.value = a.target.checked, k("update:modelValue", a.target.checked);
|
|
87
|
+
}, s = (a) => {
|
|
88
|
+
a.key === "Tab" && (i.value = !0);
|
|
89
|
+
}, u = () => {
|
|
90
|
+
i.value = !1;
|
|
78
91
|
};
|
|
79
|
-
return
|
|
80
|
-
window.addEventListener("keydown",
|
|
81
|
-
}),
|
|
82
|
-
window.removeEventListener("keydown",
|
|
83
|
-
}), (a,
|
|
84
|
-
class:
|
|
92
|
+
return w(() => {
|
|
93
|
+
l.value && (l.value.indeterminate = !!(o.indeterminate && t.value)), window.addEventListener("keydown", s), window.addEventListener("mousedown", u);
|
|
94
|
+
}), g(() => {
|
|
95
|
+
window.removeEventListener("keydown", s), window.removeEventListener("mousedown", u);
|
|
96
|
+
}), (a, p) => (f(), S("div", {
|
|
97
|
+
class: d(["rds-e-checkbox__container", { "rds-e-checkbox__container--focused": c.value }])
|
|
85
98
|
}, [
|
|
86
|
-
|
|
99
|
+
r("input", {
|
|
87
100
|
id: e.id.toString(),
|
|
101
|
+
ref_key: "inputRef",
|
|
102
|
+
ref: l,
|
|
88
103
|
checked: e.isChecked,
|
|
89
104
|
"aria-label": e.accessibilityLabel,
|
|
90
105
|
type: "checkbox",
|
|
91
|
-
class:
|
|
106
|
+
class: d(["rds-e-checkbox", { "rds-e-checkbox--error": e.error }]),
|
|
92
107
|
required: e.required,
|
|
93
108
|
disabled: e.disabled,
|
|
94
|
-
onChange:
|
|
109
|
+
onChange: x,
|
|
95
110
|
onFocus: h,
|
|
96
|
-
onBlur:
|
|
97
|
-
}, null, 42,
|
|
98
|
-
|
|
111
|
+
onBlur: v
|
|
112
|
+
}, null, 42, N),
|
|
113
|
+
r("label", {
|
|
99
114
|
for: e.id.toString(),
|
|
100
|
-
class:
|
|
115
|
+
class: d(["rds-e-checkbox__label", {
|
|
101
116
|
"rds-e-checkbox__label--disabled": e.disabled,
|
|
102
|
-
"rds-e-checkbox__label--checked": t.value
|
|
117
|
+
"rds-e-checkbox__label--checked": t.value,
|
|
118
|
+
"rds-e-checkbox__label--indeterminate": e.indeterminate && t.value
|
|
103
119
|
}])
|
|
104
120
|
}, [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
class:
|
|
121
|
+
B(a.$slots, "label-text", {}, () => [
|
|
122
|
+
r("span", {
|
|
123
|
+
class: d([
|
|
108
124
|
"rds-e-checkbox__label-box",
|
|
109
125
|
{
|
|
110
126
|
"rds-e-checkbox__label-box--disabled": e.disabled,
|
|
@@ -112,8 +128,8 @@ import './style/checkbox.css';const D = ["id", "checked", "aria-label", "require
|
|
|
112
128
|
}
|
|
113
129
|
])
|
|
114
130
|
}, [
|
|
115
|
-
|
|
116
|
-
e.icon ? (
|
|
131
|
+
C(L(e.label) + " ", 1),
|
|
132
|
+
e.icon ? (f(), _(V, {
|
|
117
133
|
key: 0,
|
|
118
134
|
class: "rds-e-checkbox__label-box--icon",
|
|
119
135
|
name: e.icon,
|
|
@@ -121,10 +137,10 @@ import './style/checkbox.css';const D = ["id", "checked", "aria-label", "require
|
|
|
121
137
|
}, null, 8, ["name"])) : E("", !0)
|
|
122
138
|
], 2)
|
|
123
139
|
], !0)
|
|
124
|
-
], 10,
|
|
140
|
+
], 10, R)
|
|
125
141
|
], 2));
|
|
126
142
|
}
|
|
127
|
-
}), K = /* @__PURE__ */
|
|
143
|
+
}), K = /* @__PURE__ */ D(q, [["__scopeId", "data-v-1f3c3114"]]);
|
|
128
144
|
export {
|
|
129
145
|
K as default
|
|
130
146
|
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { defineComponent as j, toRefs as E, computed as o, createBlock as d, openBlock as i, resolveDynamicComponent as I, unref as t, normalizeClass as N, withCtx as O, renderSlot as u, createElementVNode as m, createCommentVNode as w, createElementBlock as T, normalizeStyle as b, toDisplayString as V } from "vue";
|
|
2
|
+
import { R as S } from "./icon-svg-_WCkLP8-.js";
|
|
3
|
+
import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import './style/directAccess.css';const A = { class: "rds-e-direct-access__artwork-container" }, M = ["src", "alt", "aria-hidden"], F = { class: "rds-e-direct-access__text-container" }, G = { class: "rds-e-direct-access__text" }, H = /* @__PURE__ */ j({
|
|
5
|
+
__name: "direct-access",
|
|
6
|
+
props: {
|
|
7
|
+
/**
|
|
8
|
+
* Texto principal a mostrar en el componente.
|
|
9
|
+
*/
|
|
10
|
+
text: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: !0
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* Define la disposición de los elementos: 'horizontal' o 'vertical'.
|
|
16
|
+
* <br>
|
|
17
|
+
* `['horizontal', 'vertical']`
|
|
18
|
+
*/
|
|
19
|
+
layout: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "horizontal",
|
|
22
|
+
validator: (l) => ["horizontal", "vertical"].includes(l)
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Objeto para configurar el arte gráfico (icono o microilustración).
|
|
26
|
+
* <br>
|
|
27
|
+
* Ejemplo para icono: `{ icon: { name: 'icon-name', size: 24, color: 'blue' } }`
|
|
28
|
+
* <br>
|
|
29
|
+
* Ejemplo para microilustración: `{ microillustration: { path: 'path/to/image.svg', alt: 'Descripción', size: 48 } }`
|
|
30
|
+
*/
|
|
31
|
+
artwork: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: () => ({})
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Indica si se debe mostrar una flecha a la derecha (generalmente en layout horizontal).
|
|
37
|
+
*/
|
|
38
|
+
arrow: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Indica si el componente está deshabilitado.
|
|
44
|
+
*/
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Etiqueta ARIA para accesibilidad. Si no se proporciona, se usará el texto del componente.
|
|
51
|
+
*/
|
|
52
|
+
ariaLabel: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ""
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* URL de destino si el componente debe funcionar como un enlace.
|
|
58
|
+
* Si se proporciona, el componente se renderizará como <a> o <router-link>.
|
|
59
|
+
*/
|
|
60
|
+
linkTo: {
|
|
61
|
+
type: [String, Object],
|
|
62
|
+
default: ""
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Determina si linkTo debe tratarse como ruta de Vue Router.
|
|
66
|
+
* Si es true y linkTo está presente, se usará <router-link>.
|
|
67
|
+
*/
|
|
68
|
+
useRouterLink: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !1
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
emits: ["click"],
|
|
74
|
+
setup(l, { emit: g }) {
|
|
75
|
+
const x = l, z = g, { text: _, layout: C, disabled: c, arrow: p, artwork: r, ariaLabel: $, linkTo: a, useRouterLink: B } = E(x), L = o(() => [
|
|
76
|
+
"rds-e-direct-access",
|
|
77
|
+
`rds-e-direct-access--${C.value}`,
|
|
78
|
+
{ "rds-e-direct-access--disabled": c.value },
|
|
79
|
+
{ "rds-e-direct-access--with-arrow": p.value }
|
|
80
|
+
]), n = o(() => B.value && !!a.value), R = o(() => $.value || _.value), f = o(() => {
|
|
81
|
+
var e;
|
|
82
|
+
return (e = r.value) != null && e.microillustration && (r.value.microillustration.path || r.value.microillustration.url) || "";
|
|
83
|
+
}), v = (e) => {
|
|
84
|
+
if (!e) return {};
|
|
85
|
+
const s = {};
|
|
86
|
+
return e.size && (s.fontSize = `${e.size}px`, s.width = `${e.size}px`, s.height = `${e.size}px`), e.color && "name" in e && (s.color = e.color), s;
|
|
87
|
+
}, D = (e) => {
|
|
88
|
+
if (c.value) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
z("click", e);
|
|
93
|
+
};
|
|
94
|
+
return (e, s) => (i(), d(I(t(a) ? n.value ? "router-link" : "a" : "button"), {
|
|
95
|
+
type: t(a) ? void 0 : "button",
|
|
96
|
+
href: !n.value && t(a) ? t(a) : void 0,
|
|
97
|
+
to: n.value && t(a) ? t(a) : void 0,
|
|
98
|
+
class: N(L.value),
|
|
99
|
+
disabled: t(c),
|
|
100
|
+
"aria-label": R.value,
|
|
101
|
+
onClick: D
|
|
102
|
+
}, {
|
|
103
|
+
default: O(() => [
|
|
104
|
+
u(e.$slots, "default", {}, () => [
|
|
105
|
+
m("div", A, [
|
|
106
|
+
u(e.$slots, "artwork", {}, () => {
|
|
107
|
+
var k, y, h;
|
|
108
|
+
return [
|
|
109
|
+
(y = (k = t(r)) == null ? void 0 : k.icon) != null && y.name ? (i(), d(S, {
|
|
110
|
+
key: 0,
|
|
111
|
+
name: t(r).icon.name,
|
|
112
|
+
style: b(v(t(r).icon)),
|
|
113
|
+
class: "rds-e-direct-access__artwork-item rds-e-direct-access__artwork-item--icon",
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
}, null, 8, ["name", "style"])) : (h = t(r)) != null && h.microillustration && f.value ? (i(), T("img", {
|
|
116
|
+
key: 1,
|
|
117
|
+
src: f.value,
|
|
118
|
+
alt: t(r).microillustration.alt || "",
|
|
119
|
+
style: b(v(t(r).microillustration)),
|
|
120
|
+
class: "rds-e-direct-access__artwork-item rds-e-direct-access__artwork-item--microillustration",
|
|
121
|
+
"aria-hidden": !t(r).microillustration.alt
|
|
122
|
+
}, null, 12, M)) : w("", !0)
|
|
123
|
+
];
|
|
124
|
+
}, !0)
|
|
125
|
+
]),
|
|
126
|
+
m("div", F, [
|
|
127
|
+
u(e.$slots, "text", {}, () => [
|
|
128
|
+
m("span", G, V(t(_)), 1)
|
|
129
|
+
], !0)
|
|
130
|
+
]),
|
|
131
|
+
t(p) ? (i(), d(S, {
|
|
132
|
+
key: 0,
|
|
133
|
+
name: "arrow_right",
|
|
134
|
+
small: "",
|
|
135
|
+
class: "rds-e-direct-access__arrow",
|
|
136
|
+
"aria-hidden": "true"
|
|
137
|
+
})) : w("", !0)
|
|
138
|
+
], !0)
|
|
139
|
+
]),
|
|
140
|
+
_: 3
|
|
141
|
+
}, 8, ["type", "href", "to", "class", "disabled", "aria-label"]));
|
|
142
|
+
}
|
|
143
|
+
}), Q = /* @__PURE__ */ q(H, [["__scopeId", "data-v-d6ee1420"]]);
|
|
144
|
+
export {
|
|
145
|
+
Q as default
|
|
146
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as k, ref as _, computed as c, createElementBlock as b, openBlock as x, withModifiers as f, normalizeClass as q, createElementVNode as u, renderSlot as L, createVNode as M, createCommentVNode as z, toDisplayString as D } from "vue";
|
|
2
2
|
import { g as A } from "./getInstance-GhoEcxLF.js";
|
|
3
|
-
import { R as
|
|
4
|
-
import { _ as
|
|
5
|
-
import './style/dragAndDrop.css';const
|
|
3
|
+
import { R as U } from "./icon-svg-_WCkLP8-.js";
|
|
4
|
+
import { _ as V } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
import './style/dragAndDrop.css';const O = ["id", "accept", "multiple", "disabled"], P = ["for"], j = { class: "rds-e-drag-and-drop__icon-wrapper" }, G = { class: "rds-e-drag-and-drop__text-container" }, H = { class: "rds-e-drag-and-drop__text" }, J = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "rds-e-drag-and-drop__detail"
|
|
8
|
-
},
|
|
8
|
+
}, K = /* @__PURE__ */ k({
|
|
9
9
|
__name: "drag-and-drop",
|
|
10
10
|
props: {
|
|
11
11
|
/**
|
|
@@ -49,7 +49,6 @@ import './style/dragAndDrop.css';const z = ["id", "accept", "multiple", "disable
|
|
|
49
49
|
icon: {
|
|
50
50
|
type: String,
|
|
51
51
|
default: "add_file"
|
|
52
|
-
// Default icon from the design
|
|
53
52
|
},
|
|
54
53
|
/**
|
|
55
54
|
* Identificador único para el input de archivo. Si no se proporciona, se genera uno automáticamente.
|
|
@@ -95,62 +94,80 @@ import './style/dragAndDrop.css';const z = ["id", "accept", "multiple", "disable
|
|
|
95
94
|
default: !1
|
|
96
95
|
}
|
|
97
96
|
},
|
|
98
|
-
emits: ["filesSelected", "
|
|
97
|
+
emits: ["filesSelected", "validationError", "fileReady"],
|
|
99
98
|
setup(r, { emit: y }) {
|
|
100
|
-
const
|
|
99
|
+
const t = r, p = y;
|
|
100
|
+
let S = 0;
|
|
101
|
+
const C = () => `rds-dd-file-${S++}`, s = _(null), i = _(!1), w = A(), g = c(() => t.id || `rds-drag-drop-${w}`), F = c(() => [
|
|
101
102
|
"rds-e-drag-and-drop",
|
|
102
103
|
{
|
|
103
|
-
"rds-e-drag-and-drop--dragging":
|
|
104
|
-
"rds-e-drag-and-drop--disabled":
|
|
105
|
-
"rds-e-drag-and-drop--full-width":
|
|
106
|
-
"rds-e-drag-and-drop--error":
|
|
104
|
+
"rds-e-drag-and-drop--dragging": i.value && !t.disabled,
|
|
105
|
+
"rds-e-drag-and-drop--disabled": t.disabled,
|
|
106
|
+
"rds-e-drag-and-drop--full-width": t.fullWidth,
|
|
107
|
+
"rds-e-drag-and-drop--error": t.error && !t.disabled
|
|
107
108
|
}
|
|
108
|
-
]), m = c(() =>
|
|
109
|
+
]), m = c(() => t.error && t.errorMessage ? t.errorMessage : t.detailText), I = c(() => t.showDetailText && (m.value || !t.error)), T = (e) => {
|
|
109
110
|
var a;
|
|
110
|
-
if (!
|
|
111
|
+
if (!e || e.length === 0)
|
|
111
112
|
return { valid: !1, message: "No se seleccionaron archivos." };
|
|
112
|
-
if (!
|
|
113
|
+
if (!t.multiple && e.length > 1)
|
|
113
114
|
return { valid: !1, message: "Solo se permite seleccionar un archivo." };
|
|
114
|
-
if (
|
|
115
|
-
return { valid: !1, message: `Se permite un máximo de ${
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
for (let
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
return { valid: !1, message: `El tipo de archivo '${
|
|
115
|
+
if (t.maxFiles !== null && t.maxFiles > 0 && e.length > t.maxFiles)
|
|
116
|
+
return { valid: !1, message: `Se permite un máximo de ${t.maxFiles} archivos por selección.` };
|
|
117
|
+
if (t.accept) {
|
|
118
|
+
const n = t.accept.split(",").map((l) => l.trim().toLowerCase());
|
|
119
|
+
for (let l = 0; l < e.length; l++) {
|
|
120
|
+
const o = e[l], W = `.${(a = o.name.split(".").pop()) == null ? void 0 : a.toLowerCase()}`, h = o.type.toLowerCase();
|
|
121
|
+
if (!n.some((d) => d.startsWith(".") ? W === d : d.includes("/") ? d.endsWith("/*") ? h.startsWith(d.replace("/*", "")) : h === d : !1))
|
|
122
|
+
return { valid: !1, message: `El tipo de archivo '${o.name}' no es válido. Permitidos: ${t.accept}` };
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
return { valid: !0 };
|
|
125
|
-
}, v = (
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
}, v = (e) => {
|
|
127
|
+
if (t.disabled) return;
|
|
128
|
+
if (!e || e.length === 0) {
|
|
129
|
+
s.value && (s.value.value = "");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
p("filesSelected", e);
|
|
133
|
+
const a = T(e);
|
|
134
|
+
if (a.valid) {
|
|
135
|
+
for (let n = 0; n < e.length; n++) {
|
|
136
|
+
const l = e[n], o = C();
|
|
137
|
+
p("fileReady", {
|
|
138
|
+
id: o,
|
|
139
|
+
file: l,
|
|
140
|
+
name: l.name,
|
|
141
|
+
size: l.size
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
s.value && (s.value.value = "");
|
|
145
|
+
} else a.message && (p("validationError", a.message), s.value && (s.value.value = ""));
|
|
146
|
+
}, B = (e) => {
|
|
147
|
+
const a = e.target;
|
|
131
148
|
v(a.files);
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
}, $ = (
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
const a =
|
|
138
|
-
(!
|
|
139
|
-
},
|
|
140
|
-
var
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
const a = (
|
|
149
|
+
}, E = () => {
|
|
150
|
+
t.disabled || (i.value = !0);
|
|
151
|
+
}, $ = (e) => {
|
|
152
|
+
t.disabled || (e.preventDefault(), i.value = !0);
|
|
153
|
+
}, R = (e) => {
|
|
154
|
+
const a = e.relatedTarget;
|
|
155
|
+
(!e.currentTarget || !e.currentTarget.contains(a)) && (i.value = !1);
|
|
156
|
+
}, N = (e) => {
|
|
157
|
+
var n;
|
|
158
|
+
if (t.disabled) return;
|
|
159
|
+
i.value = !1;
|
|
160
|
+
const a = (n = e.dataTransfer) == null ? void 0 : n.files;
|
|
144
161
|
v(a || null);
|
|
145
162
|
};
|
|
146
|
-
return (
|
|
147
|
-
class:
|
|
148
|
-
onDragenter:
|
|
149
|
-
onDragover:
|
|
150
|
-
onDragleave:
|
|
151
|
-
onDrop:
|
|
163
|
+
return (e, a) => (x(), b("div", {
|
|
164
|
+
class: q(F.value),
|
|
165
|
+
onDragenter: f(E, ["prevent"]),
|
|
166
|
+
onDragover: f($, ["prevent"]),
|
|
167
|
+
onDragleave: f(R, ["prevent"]),
|
|
168
|
+
onDrop: f(N, ["prevent"])
|
|
152
169
|
}, [
|
|
153
|
-
|
|
170
|
+
u("input", {
|
|
154
171
|
id: g.value,
|
|
155
172
|
ref_key: "fileInputRef",
|
|
156
173
|
ref: s,
|
|
@@ -159,29 +176,29 @@ import './style/dragAndDrop.css';const z = ["id", "accept", "multiple", "disable
|
|
|
159
176
|
accept: r.accept,
|
|
160
177
|
multiple: r.multiple,
|
|
161
178
|
disabled: r.disabled,
|
|
162
|
-
onChange:
|
|
163
|
-
}, null, 40,
|
|
164
|
-
|
|
179
|
+
onChange: B
|
|
180
|
+
}, null, 40, O),
|
|
181
|
+
u("label", {
|
|
165
182
|
for: g.value,
|
|
166
183
|
class: "rds-e-drag-and-drop__label"
|
|
167
184
|
}, [
|
|
168
|
-
L(
|
|
169
|
-
|
|
170
|
-
M(
|
|
185
|
+
L(e.$slots, "content", {}, () => [
|
|
186
|
+
u("span", j, [
|
|
187
|
+
M(U, {
|
|
171
188
|
name: r.icon,
|
|
172
189
|
class: "rds-e-drag-and-drop__icon",
|
|
173
190
|
"aria-hidden": "true"
|
|
174
191
|
}, null, 8, ["name"])
|
|
175
192
|
]),
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
193
|
+
u("div", G, [
|
|
194
|
+
u("span", H, D(r.label), 1),
|
|
195
|
+
I.value ? (x(), b("span", J, D(m.value), 1)) : z("", !0)
|
|
179
196
|
])
|
|
180
197
|
], !0)
|
|
181
|
-
], 8,
|
|
198
|
+
], 8, P)
|
|
182
199
|
], 34));
|
|
183
200
|
}
|
|
184
|
-
}),
|
|
201
|
+
}), te = /* @__PURE__ */ V(K, [["__scopeId", "data-v-3928ef06"]]);
|
|
185
202
|
export {
|
|
186
|
-
|
|
203
|
+
te as default
|
|
187
204
|
};
|