energy-components 1.0.2
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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/.empty +0 -0
- package/dist/components/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/components/accordion.es.js +121 -0
- package/dist/components/accordionGroup.es.js +32 -0
- package/dist/components/actionButton.es.js +64 -0
- package/dist/components/breadcrumbs.es.js +90 -0
- package/dist/components/button.es.js +144 -0
- package/dist/components/checkbox.es.js +130 -0
- package/dist/components/divider.es.js +35 -0
- package/dist/components/dropdown.es.js +331 -0
- package/dist/components/floatingActionButton.es.js +97 -0
- package/dist/components/functions-DIHwdgF0.js +18 -0
- package/dist/components/icon-svg-Cpx09myr.js +10818 -0
- package/dist/components/iconList.es.js +49 -0
- package/dist/components/iconSvg.es.js +5 -0
- package/dist/components/index.es.js +81 -0
- package/dist/components/indicator.es.js +175 -0
- package/dist/components/link.es.js +147 -0
- package/dist/components/multiselect.es.js +1039 -0
- package/dist/components/pagination.es.js +138 -0
- package/dist/components/radioButton.es.js +111 -0
- package/dist/components/style/accordion.css +1 -0
- package/dist/components/style/accordionGroup.css +1 -0
- package/dist/components/style/actionButton.css +1 -0
- package/dist/components/style/breadcrumbs.css +1 -0
- package/dist/components/style/button.css +1 -0
- package/dist/components/style/checkbox.css +1 -0
- package/dist/components/style/divider.css +1 -0
- package/dist/components/style/dropdown.css +1 -0
- package/dist/components/style/floatingActionButton.css +1 -0
- package/dist/components/style/icon-svg.css +1 -0
- package/dist/components/style/iconList.css +1 -0
- package/dist/components/style/indicator.css +1 -0
- package/dist/components/style/link.css +1 -0
- package/dist/components/style/multiselect.css +1 -0
- package/dist/components/style/pagination.css +1 -0
- package/dist/components/style/radioButton.css +1 -0
- package/dist/components/style/switch.css +1 -0
- package/dist/components/style/tabBar.css +1 -0
- package/dist/components/style/tag.css +1 -0
- package/dist/components/style/textArea.css +1 -0
- package/dist/components/style/textField.css +1 -0
- package/dist/components/style/tooltip.css +1 -0
- package/dist/components/switch.es.js +96 -0
- package/dist/components/tabBar.es.js +181 -0
- package/dist/components/tag.es.js +91 -0
- package/dist/components/textArea.es.js +259 -0
- package/dist/components/textField.es.js +254 -0
- package/dist/components/tooltip.es.js +1082 -0
- package/dist/energy-components.es.js +15368 -0
- package/dist/energy-components.umd.js +1 -0
- package/dist/style.css +1 -0
- package/dist/types/src/components/buttons/action-button/action-button.vue.d.ts +100 -0
- package/dist/types/src/components/buttons/button/button.vue.d.ts +196 -0
- package/dist/types/src/components/buttons/constants/buttonDocs.d.ts +1 -0
- package/dist/types/src/components/buttons/constants/buttonPosition.d.ts +1 -0
- package/dist/types/src/components/buttons/constants/socialMedia.d.ts +1 -0
- package/dist/types/src/components/buttons/floating-action-button/floating-action-button.vue.d.ts +136 -0
- package/dist/types/src/components/content/accordion/accordion.vue.d.ts +122 -0
- package/dist/types/src/components/content/acordion-group/accordion-group.d.ts +6 -0
- package/dist/types/src/components/content/acordion-group/accordion-group.vue.d.ts +33 -0
- package/dist/types/src/components/content/divider/divider.vue.d.ts +35 -0
- package/dist/types/src/components/content/tag/tag.vue.d.ts +105 -0
- package/dist/types/src/components/feedback/indicator/indicator.vue.d.ts +100 -0
- package/dist/types/src/components/icon-svg/icon-list.d.ts +11 -0
- package/dist/types/src/components/icon-svg/icon-list.vue.d.ts +2 -0
- package/dist/types/src/components/icon-svg/icon-svg.vue.d.ts +68 -0
- package/dist/types/src/components/index.d.ts +20 -0
- package/dist/types/src/components/input/checkbox/checkbox.vue.d.ts +151 -0
- package/dist/types/src/components/input/dropdown/Multiselect/Multiselect.vue.d.ts +2 -0
- package/dist/types/src/components/input/dropdown/dropdown.vue.d.ts +270 -0
- package/dist/types/src/components/input/radio-button/radio-button.vue.d.ts +114 -0
- package/dist/types/src/components/input/switch/switch.vue.d.ts +104 -0
- package/dist/types/src/components/input/text-area/text-area.vue.d.ts +281 -0
- package/dist/types/src/components/input/text-field/text-field.vue.d.ts +271 -0
- package/dist/types/src/components/navigation/breadcrumbs/breadcrumbs.vue.d.ts +63 -0
- package/dist/types/src/components/navigation/link/link.types.d.ts +15 -0
- package/dist/types/src/components/navigation/link/link.vue.d.ts +175 -0
- package/dist/types/src/components/navigation/pagination/pagination.vue.d.ts +67 -0
- package/dist/types/src/components/navigation/tab-bar/tab-bar.vue.d.ts +132 -0
- package/dist/types/src/components/overlay/tooltip/tooltip.vue.d.ts +118 -0
- package/dist/types/src/helpers/functions.d.ts +3 -0
- package/dist/types/src/helpers/stories.helpers.d.ts +1 -0
- package/dist/types/src/helpers/validation.d.ts +1 -0
- package/dist/types/src/index.d.ts +8 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +156 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineComponent as v, ref as c, onMounted as k, onBeforeUnmount as y, openBlock as n, createElementBlock as i, normalizeClass as g, createElementVNode as r, renderSlot as S, createTextVNode as p, toDisplayString as B, createBlock as V, createCommentVNode as u } from "vue";
|
|
2
|
+
import { R as x } from "./icon-svg-Cpx09myr.js";
|
|
3
|
+
import { _ as E } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import './style/switch.css';const _ = ["id", "disabled", "checked"], N = ["for", "aria-label"], C = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "rds-switch__label-text"
|
|
7
|
+
}, D = /* @__PURE__ */ v({
|
|
8
|
+
__name: "switch",
|
|
9
|
+
props: {
|
|
10
|
+
/**
|
|
11
|
+
* ID del interruptor
|
|
12
|
+
*/
|
|
13
|
+
id: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
required: !0
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Etiqueta para el interruptor
|
|
19
|
+
*/
|
|
20
|
+
label: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ""
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Icono para el interruptor, se mostrara a la derecha del texto
|
|
26
|
+
*/
|
|
27
|
+
icon: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Si el interruptor está deshabilitado
|
|
33
|
+
*/
|
|
34
|
+
disabled: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Si el interruptor está marcado o no
|
|
40
|
+
*/
|
|
41
|
+
checked: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: ["update:modelValue"],
|
|
47
|
+
setup(e, { emit: m }) {
|
|
48
|
+
const f = e, l = m, a = c(!1), o = c(!1), h = () => {
|
|
49
|
+
o.value && (a.value = !0);
|
|
50
|
+
}, w = () => a.value = !1, s = (t) => {
|
|
51
|
+
t.key === "Tab" && (o.value = !0);
|
|
52
|
+
}, d = () => {
|
|
53
|
+
o.value = !1;
|
|
54
|
+
}, b = (t) => {
|
|
55
|
+
l("update:modelValue", t.target.checked);
|
|
56
|
+
};
|
|
57
|
+
return k(() => {
|
|
58
|
+
l("update:modelValue", f.checked), window.addEventListener("keydown", s), window.addEventListener("mousedown", d);
|
|
59
|
+
}), y(() => {
|
|
60
|
+
window.removeEventListener("keydown", s), window.removeEventListener("mousedown", d);
|
|
61
|
+
}), (t, L) => (n(), i("div", {
|
|
62
|
+
class: g(["rds-switch", { "rds-switch--focused": a.value }])
|
|
63
|
+
}, [
|
|
64
|
+
r("input", {
|
|
65
|
+
id: e.id.toString(),
|
|
66
|
+
class: "rds-switch__input",
|
|
67
|
+
type: "checkbox",
|
|
68
|
+
disabled: e.disabled,
|
|
69
|
+
checked: e.checked,
|
|
70
|
+
onChange: b,
|
|
71
|
+
onFocus: h,
|
|
72
|
+
onBlur: w
|
|
73
|
+
}, null, 40, _),
|
|
74
|
+
r("label", {
|
|
75
|
+
class: "rds-switch__label",
|
|
76
|
+
for: e.id.toString(),
|
|
77
|
+
"aria-label": e.label
|
|
78
|
+
}, [
|
|
79
|
+
e.label || t.$slots["text-label"] ? (n(), i("span", C, [
|
|
80
|
+
S(t.$slots, "text-label", {}, () => [
|
|
81
|
+
p(B(e.label), 1)
|
|
82
|
+
], !0),
|
|
83
|
+
e.icon ? (n(), V(x, {
|
|
84
|
+
key: 0,
|
|
85
|
+
name: e.icon,
|
|
86
|
+
class: "rds-switch__label-icon",
|
|
87
|
+
"aria-hidden": "true"
|
|
88
|
+
}, null, 8, ["name"])) : u("", !0)
|
|
89
|
+
])) : u("", !0)
|
|
90
|
+
], 8, N)
|
|
91
|
+
], 2));
|
|
92
|
+
}
|
|
93
|
+
}), M = /* @__PURE__ */ E(D, [["__scopeId", "data-v-69c77348"]]);
|
|
94
|
+
export {
|
|
95
|
+
M as default
|
|
96
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { defineComponent as N, mergeModels as B, toRefs as W, useModel as D, ref as m, computed as h, onMounted as K, nextTick as $, onUnmounted as F, watch as L, openBlock as s, createElementBlock as d, normalizeClass as u, createVNode as R, createCommentVNode as g, createElementVNode as f, Fragment as q, renderList as H, unref as O, withKeys as S, withModifiers as V, createBlock as P, createTextVNode as U, toDisplayString as j, renderSlot as G } from "vue";
|
|
2
|
+
import { R as w } from "./icon-svg-Cpx09myr.js";
|
|
3
|
+
import { d as J } from "./functions-DIHwdgF0.js";
|
|
4
|
+
import { _ as Q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
import './style/tabBar.css';const X = ["aria-selected", "tabindex", "onClick", "onKeydown"], Y = { class: "rds-top-bar__item-title" }, Z = {
|
|
6
|
+
class: "rds-top-bar__content",
|
|
7
|
+
role: "tabpanel"
|
|
8
|
+
}, ee = /* @__PURE__ */ N({
|
|
9
|
+
__name: "tab-bar",
|
|
10
|
+
props: /* @__PURE__ */ B({
|
|
11
|
+
/**
|
|
12
|
+
* Pestaña activa
|
|
13
|
+
*/
|
|
14
|
+
activeTab: {
|
|
15
|
+
type: String
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Un array de objetos que representan las pestañas
|
|
19
|
+
* `{ id: string, title: string, icon?: string }`
|
|
20
|
+
*/
|
|
21
|
+
options: {
|
|
22
|
+
type: Array,
|
|
23
|
+
required: !0
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Si es `true` el componente ocupatra lo minimo posible
|
|
27
|
+
*/
|
|
28
|
+
fluid: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Si es `true`, los arrow de navegacion aplican diferente color.
|
|
34
|
+
*/
|
|
35
|
+
backgroundAlternative: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Si es `true`, se mostrara un divider entre el top-bar y el contenido.
|
|
41
|
+
*/
|
|
42
|
+
divider: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Funcion async que se ejecuta antes de cambiar de pestaña.
|
|
48
|
+
* Debe retornar un booleano, si es `true` se cambiara de pestaña, si es `false` no se cambiara.
|
|
49
|
+
*/
|
|
50
|
+
beforeTabChange: {
|
|
51
|
+
type: Function,
|
|
52
|
+
default: (o, v) => {
|
|
53
|
+
if (o === v.id) return Promise.resolve(!0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
activeTab: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ""
|
|
60
|
+
},
|
|
61
|
+
activeTabModifiers: {}
|
|
62
|
+
}),
|
|
63
|
+
emits: /* @__PURE__ */ B(["activeTabChanged"], ["update:activeTab"]),
|
|
64
|
+
setup(o, { emit: v }) {
|
|
65
|
+
const i = o, A = v, {
|
|
66
|
+
options: n
|
|
67
|
+
} = W(i), M = D(o, "activeTab"), a = m(""), b = m(null), l = m(null);
|
|
68
|
+
let p = [];
|
|
69
|
+
const y = h(() => l.value ? l.value.scrollWidth > l.value.clientWidth : !1), z = h(() => n.value.findIndex((t) => t.id === a.value) > 0 && y.value), E = h(() => l.value ? n.value.findIndex((t) => t.id === a.value) < i.options.length - 1 && y.value : !1), k = (e) => {
|
|
70
|
+
const t = i.options.find((r) => r.id === a.value);
|
|
71
|
+
return e ? t : t == null ? void 0 : t.id;
|
|
72
|
+
}, c = async (e) => {
|
|
73
|
+
const t = n.value.find((_) => _.id === e);
|
|
74
|
+
return t ? await i.beforeTabChange(e, t) ? (a.value = e, !0) : !1 : (console.error(`[RDSTabBar]: Tab with id ${e} not found`), !1);
|
|
75
|
+
}, x = async () => {
|
|
76
|
+
let e = n.value.findIndex((t) => t.id === a.value);
|
|
77
|
+
for (; e > 0 && (e--, !await c(n.value[e].id)); )
|
|
78
|
+
;
|
|
79
|
+
}, I = async () => {
|
|
80
|
+
let e = n.value.findIndex((t) => t.id === a.value);
|
|
81
|
+
for (; e < i.options.length - 1 && (e++, !await c(n.value[e].id)); )
|
|
82
|
+
;
|
|
83
|
+
};
|
|
84
|
+
function T(e) {
|
|
85
|
+
const t = n.value.findIndex((r) => r.id === e);
|
|
86
|
+
p[t] && p[t].scrollIntoView({
|
|
87
|
+
behavior: "smooth",
|
|
88
|
+
block: "nearest",
|
|
89
|
+
inline: "start"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const C = () => {
|
|
93
|
+
T(a.value);
|
|
94
|
+
};
|
|
95
|
+
return K(async () => {
|
|
96
|
+
await $(), b.value && (p = Array.from(
|
|
97
|
+
b.value.children
|
|
98
|
+
)), a.value = i.options[0].id ?? "", window.addEventListener("resize", J(C, 200));
|
|
99
|
+
}), F(() => {
|
|
100
|
+
window.removeEventListener("resize", C);
|
|
101
|
+
}), L(a, (e) => {
|
|
102
|
+
T(e), A("activeTabChanged", k(!1));
|
|
103
|
+
}), L(M, (e) => c(e)), (e, t) => (s(), d("div", {
|
|
104
|
+
class: u(["rds-top-bar", {
|
|
105
|
+
"rds-top-bar--fluid": o.fluid,
|
|
106
|
+
"rds-top-bar--divider": o.divider
|
|
107
|
+
}])
|
|
108
|
+
}, [
|
|
109
|
+
z.value ? (s(), d("div", {
|
|
110
|
+
key: 0,
|
|
111
|
+
class: u([
|
|
112
|
+
"rds-top-bar__button",
|
|
113
|
+
o.backgroundAlternative ? "rds-top-bar__button--left-bg2" : "rds-top-bar__button--left"
|
|
114
|
+
]),
|
|
115
|
+
onClick: x
|
|
116
|
+
}, [
|
|
117
|
+
R(w, {
|
|
118
|
+
class: "rds-top-bar__icon",
|
|
119
|
+
name: "arrow_left"
|
|
120
|
+
})
|
|
121
|
+
], 2)) : g("", !0),
|
|
122
|
+
f("div", {
|
|
123
|
+
ref_key: "tabsListWrapper",
|
|
124
|
+
ref: l,
|
|
125
|
+
class: "rds-top-bar__wrapper"
|
|
126
|
+
}, [
|
|
127
|
+
f("ul", {
|
|
128
|
+
ref_key: "tabsList",
|
|
129
|
+
ref: b,
|
|
130
|
+
class: "rds-top-bar__list",
|
|
131
|
+
role: "tablist"
|
|
132
|
+
}, [
|
|
133
|
+
(s(!0), d(q, null, H(O(n), (r, _) => (s(), d("li", {
|
|
134
|
+
key: _,
|
|
135
|
+
class: u(["rds-top-bar__item", {
|
|
136
|
+
active: a.value === r.id
|
|
137
|
+
}]),
|
|
138
|
+
role: "tab",
|
|
139
|
+
"aria-selected": a.value === r.id,
|
|
140
|
+
tabindex: a.value === r.id ? 0 : -1,
|
|
141
|
+
onClick: (te) => c(r.id),
|
|
142
|
+
onKeydown: [
|
|
143
|
+
S(V(x, ["prevent"]), ["left"]),
|
|
144
|
+
S(V(I, ["prevent"]), ["right"])
|
|
145
|
+
]
|
|
146
|
+
}, [
|
|
147
|
+
f("span", Y, [
|
|
148
|
+
r.icon ? (s(), P(w, {
|
|
149
|
+
key: 0,
|
|
150
|
+
class: "rds-top-bar__item-title--icon",
|
|
151
|
+
name: r.icon
|
|
152
|
+
}, null, 8, ["name"])) : g("", !0),
|
|
153
|
+
U(" " + j(r.title), 1)
|
|
154
|
+
])
|
|
155
|
+
], 42, X))), 128))
|
|
156
|
+
], 512)
|
|
157
|
+
], 512),
|
|
158
|
+
E.value ? (s(), d("div", {
|
|
159
|
+
key: 1,
|
|
160
|
+
class: u([
|
|
161
|
+
"rds-top-bar__button",
|
|
162
|
+
o.backgroundAlternative ? "rds-top-bar__button--right-bg2" : "rds-top-bar__button--right"
|
|
163
|
+
]),
|
|
164
|
+
onClick: I
|
|
165
|
+
}, [
|
|
166
|
+
R(w, {
|
|
167
|
+
class: "rds-top-bar__icon",
|
|
168
|
+
name: "arrow_right"
|
|
169
|
+
})
|
|
170
|
+
], 2)) : g("", !0),
|
|
171
|
+
f("div", Z, [
|
|
172
|
+
G(e.$slots, a.value, {
|
|
173
|
+
tab: k(!0)
|
|
174
|
+
}, void 0, !0)
|
|
175
|
+
])
|
|
176
|
+
], 2));
|
|
177
|
+
}
|
|
178
|
+
}), ie = /* @__PURE__ */ Q(ee, [["__scopeId", "data-v-1eaefe52"]]);
|
|
179
|
+
export {
|
|
180
|
+
ie as default
|
|
181
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineComponent as h, toRefs as x, computed as u, openBlock as o, createElementBlock as $, normalizeClass as r, unref as t, createBlock as p, createCommentVNode as d, createTextVNode as S, toDisplayString as B } from "vue";
|
|
2
|
+
import { R as f } from "./icon-svg-Cpx09myr.js";
|
|
3
|
+
import { _ as b } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import './style/tag.css';const k = /* @__PURE__ */ h({
|
|
5
|
+
__name: "tag",
|
|
6
|
+
props: {
|
|
7
|
+
/**
|
|
8
|
+
* Nombre del icono a mostrar en la parte izquierda del tag
|
|
9
|
+
*/
|
|
10
|
+
icon: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ""
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* Texto del tag
|
|
16
|
+
*/
|
|
17
|
+
text: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Typo de tag
|
|
23
|
+
* <br>
|
|
24
|
+
* `[ default, information, success, error, warning, promo ]`
|
|
25
|
+
*/
|
|
26
|
+
type: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "default",
|
|
29
|
+
validator: (s) => ["default", "information", "success", "error", "warning", "promo"].includes(s)
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Define si el tag tiene una acción asociada.
|
|
33
|
+
*/
|
|
34
|
+
actionable: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Indica si el esquema de colores es inverso
|
|
40
|
+
* <br>
|
|
41
|
+
* Solo para type `default`
|
|
42
|
+
*/
|
|
43
|
+
inverse: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Define si el tag es pequeño
|
|
49
|
+
*/
|
|
50
|
+
small: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !1
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
setup(s) {
|
|
56
|
+
const m = s, {
|
|
57
|
+
type: l,
|
|
58
|
+
actionable: c,
|
|
59
|
+
icon: n,
|
|
60
|
+
text: _,
|
|
61
|
+
inverse: g,
|
|
62
|
+
small: v
|
|
63
|
+
} = x(m), y = u(() => {
|
|
64
|
+
const a = "rds-tag", e = [];
|
|
65
|
+
return g.value && e.push(`${a}--inverse`), c.value && e.push(`${a}--actionable`), n.value && e.push(`${a}--icon`), v.value && e.push(`${a}--small`), e.push(`${a}--${l.value}`), e.join(" ");
|
|
66
|
+
}), i = u(() => {
|
|
67
|
+
const a = "rds-tag_icon", e = [];
|
|
68
|
+
return e.push(`${a}--${l.value}`), e.join(" ");
|
|
69
|
+
});
|
|
70
|
+
return (a, e) => (o(), $("div", {
|
|
71
|
+
class: r(["rds-tag rds-caption-tag", y.value])
|
|
72
|
+
}, [
|
|
73
|
+
t(n) ? (o(), p(f, {
|
|
74
|
+
key: 0,
|
|
75
|
+
name: t(n),
|
|
76
|
+
class: r(["rds-tag__icon", i.value]),
|
|
77
|
+
"aria-hidden": "true"
|
|
78
|
+
}, null, 8, ["name", "class"])) : d("", !0),
|
|
79
|
+
S(" " + B(t(_)) + " ", 1),
|
|
80
|
+
t(c) ? (o(), p(f, {
|
|
81
|
+
key: 1,
|
|
82
|
+
name: "arrow_right",
|
|
83
|
+
class: r(["rds-tag__icon-actionable", i.value]),
|
|
84
|
+
"aria-hidden": "true"
|
|
85
|
+
}, null, 8, ["class"])) : d("", !0)
|
|
86
|
+
], 2));
|
|
87
|
+
}
|
|
88
|
+
}), D = /* @__PURE__ */ b(k, [["__scopeId", "data-v-9781baa5"]]);
|
|
89
|
+
export {
|
|
90
|
+
D as default
|
|
91
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { defineComponent as H, mergeModels as U, useModel as F, toRefs as G, computed as o, openBlock as l, createElementBlock as h, normalizeClass as g, createElementVNode as a, withDirectives as J, unref as t, vModelText as K, renderSlot as x, createBlock as C, mergeProps as M, toHandlers as q, createCommentVNode as s, createTextVNode as L, toDisplayString as i, pushScopeId as O, popScopeId as Q } from "vue";
|
|
2
|
+
import { R as T } from "./icon-svg-Cpx09myr.js";
|
|
3
|
+
import { _ as W } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
import './style/textArea.css';function y(e, f = !0, u = !0) {
|
|
5
|
+
return f && !e.trim() ? (console.warn("Advertencia: El valor no puede estar vacío"), !1) : u && !/^[a-z0-9\s]+$/i.test(e) ? (console.warn("Advertencia: El valor contiene caracteres inválidos"), !1) : !0;
|
|
6
|
+
}
|
|
7
|
+
const X = (e) => (O("data-v-dc860073"), e = e(), Q(), e), Y = { class: "rds-textarea__container" }, Z = { class: "rds-textarea__input-container" }, ee = ["id", "name", "maxlength", "minlength", "rows", "disabled"], te = /* @__PURE__ */ X(() => /* @__PURE__ */ a("div", { class: "rds-textarea__resize-handle" }, [
|
|
8
|
+
/* @__PURE__ */ a("svg", {
|
|
9
|
+
width: "12",
|
|
10
|
+
height: "14",
|
|
11
|
+
viewBox: "0 0 12 14",
|
|
12
|
+
fill: "none",
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
14
|
+
}, [
|
|
15
|
+
/* @__PURE__ */ a("path", {
|
|
16
|
+
d: "M11 1V3C11 8.52285 6.52285 13 1 13V13",
|
|
17
|
+
"stroke-width": "1.2",
|
|
18
|
+
"stroke-linecap": "round"
|
|
19
|
+
})
|
|
20
|
+
])
|
|
21
|
+
], -1)), re = ["for"], ae = { key: 0 }, le = { key: 0 }, ne = { key: 1 }, oe = { key: 0 }, se = /* @__PURE__ */ H({
|
|
22
|
+
__name: "text-area",
|
|
23
|
+
props: /* @__PURE__ */ U({
|
|
24
|
+
/**
|
|
25
|
+
* Etiqueta que se muestra sobre el campo de entrada. y Placeholder
|
|
26
|
+
*/
|
|
27
|
+
label: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: !0,
|
|
30
|
+
validator(e) {
|
|
31
|
+
return y(e, !0, !0);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Etiqueta que se muestra el nombre del control
|
|
36
|
+
*/
|
|
37
|
+
name: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: !1,
|
|
40
|
+
validator(e) {
|
|
41
|
+
return y(e, !1, !0);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Identificador único del campo de entrada.
|
|
46
|
+
*/
|
|
47
|
+
id: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: !1,
|
|
50
|
+
validator(e) {
|
|
51
|
+
return y(e, !1, !0);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* v-model valor de entrada y salida
|
|
56
|
+
*/
|
|
57
|
+
modelValue: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: !0
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Indica si el campo de entrada está deshabilitado o no.
|
|
63
|
+
*/
|
|
64
|
+
disabled: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !1
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Número máximo de caracteres permitidos en el campo de entrada.
|
|
70
|
+
*/
|
|
71
|
+
maxlength: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: 100
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Número mínimo de caracteres permitidos en el campo de entrada.
|
|
77
|
+
*/
|
|
78
|
+
minlength: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 0
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Muestra estilos de error si el length del input no es correcto.
|
|
84
|
+
*/
|
|
85
|
+
lengthError: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: !1
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Número de rows.
|
|
91
|
+
*/
|
|
92
|
+
rows: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: 0
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Nombre del icono que se mostrará dentro del campo de entrada.
|
|
98
|
+
* por defecto se mosrtrara a al izquierda del campo
|
|
99
|
+
*/
|
|
100
|
+
icon: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: ""
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* Muestra un icono a la derecha
|
|
106
|
+
* Se desactiva si la opccion de `clearable` esta activa
|
|
107
|
+
*/
|
|
108
|
+
rightIcon: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: ""
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Indica si se debe mostrar un mensaje de ayuda debajo del campo de entrada o no.
|
|
114
|
+
*/
|
|
115
|
+
helper: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: !1
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* Indica si se debe mostrar el counter.
|
|
121
|
+
*/
|
|
122
|
+
counter: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: !0
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* Indica si el campo de entrada contiene un error o no.
|
|
128
|
+
*/
|
|
129
|
+
error: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: !1
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Muestra un boton para limpiar el campo de texto
|
|
135
|
+
*/
|
|
136
|
+
clearable: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: !1
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* Texto que se muestra como mensaje de ayuda debajo del campo de entrada.
|
|
142
|
+
*/
|
|
143
|
+
helperText: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: ""
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
modelValue: {},
|
|
149
|
+
modelModifiers: {}
|
|
150
|
+
}),
|
|
151
|
+
emits: ["update:modelValue"],
|
|
152
|
+
setup(e) {
|
|
153
|
+
const f = e, u = F(e, "modelValue"), {
|
|
154
|
+
label: S,
|
|
155
|
+
id: b,
|
|
156
|
+
disabled: p,
|
|
157
|
+
maxlength: v,
|
|
158
|
+
minlength: m,
|
|
159
|
+
modelValue: d,
|
|
160
|
+
icon: $,
|
|
161
|
+
rightIcon: w,
|
|
162
|
+
helper: z,
|
|
163
|
+
error: _,
|
|
164
|
+
helperText: A,
|
|
165
|
+
clearable: k,
|
|
166
|
+
lengthError: D
|
|
167
|
+
} = G(f), V = o(() => d.value.length === v.value), B = o(() => d.value.length === 0 ? !1 : d.value.length < m.value), E = o(() => D.value && (V.value || B.value)), R = o(() => {
|
|
168
|
+
const r = [];
|
|
169
|
+
return d.value && r.push("rds-textarea--filled"), _.value && r.push("rds-textarea--error"), p.value && r.push("rds-textarea--disabled"), E.value && r.push("rds-textarea--error"), r.join(" ");
|
|
170
|
+
}), n = o(() => {
|
|
171
|
+
const r = {
|
|
172
|
+
name: $.value,
|
|
173
|
+
class: "",
|
|
174
|
+
events: {
|
|
175
|
+
click: () => {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, c = {
|
|
179
|
+
left: { ...r },
|
|
180
|
+
right: { ...r, name: w.value }
|
|
181
|
+
};
|
|
182
|
+
return k.value && (c.right = {
|
|
183
|
+
...r,
|
|
184
|
+
name: "close",
|
|
185
|
+
class: "rds-textfield__icon--clear",
|
|
186
|
+
events: {
|
|
187
|
+
click: () => u.value = ""
|
|
188
|
+
}
|
|
189
|
+
}), c;
|
|
190
|
+
}), P = o(() => d.value.length);
|
|
191
|
+
return (r, c) => {
|
|
192
|
+
var I, N;
|
|
193
|
+
return l(), h("div", {
|
|
194
|
+
class: g(["rds-textarea", R.value])
|
|
195
|
+
}, [
|
|
196
|
+
a("div", Y, [
|
|
197
|
+
a("div", Z, [
|
|
198
|
+
J(a("textarea", {
|
|
199
|
+
id: (I = t(b)) == null ? void 0 : I.toString(),
|
|
200
|
+
"onUpdate:modelValue": c[0] || (c[0] = (j) => u.value = j),
|
|
201
|
+
type: "text",
|
|
202
|
+
class: "rds-textarea__input",
|
|
203
|
+
name: e.name,
|
|
204
|
+
maxlength: t(v),
|
|
205
|
+
minlength: t(m),
|
|
206
|
+
rows: e.rows,
|
|
207
|
+
disabled: t(p)
|
|
208
|
+
}, null, 8, ee), [
|
|
209
|
+
[K, u.value]
|
|
210
|
+
]),
|
|
211
|
+
te,
|
|
212
|
+
a("label", {
|
|
213
|
+
for: (N = t(b)) == null ? void 0 : N.toString(),
|
|
214
|
+
class: "rds-textarea__label"
|
|
215
|
+
}, [
|
|
216
|
+
x(r.$slots, "left-icon", {}, () => [
|
|
217
|
+
n.value.left.name ? (l(), C(T, M({
|
|
218
|
+
key: 0,
|
|
219
|
+
class: "rds-textarea__icon rds-textarea__icon--left",
|
|
220
|
+
"aria-hidden": "true"
|
|
221
|
+
}, n.value.left, q(n.value.left.events)), null, 16)) : s("", !0)
|
|
222
|
+
], !0),
|
|
223
|
+
L(" " + i(t(S)), 1)
|
|
224
|
+
], 8, re),
|
|
225
|
+
a("div", {
|
|
226
|
+
class: g(["rds-textarea__counter", {
|
|
227
|
+
"rds-textarea__counter--disabled": t(p),
|
|
228
|
+
"rds-textarea__counter--clearable": t(k)
|
|
229
|
+
}])
|
|
230
|
+
}, [
|
|
231
|
+
e.counter && !t(w) ? (l(), h("p", ae, i(P.value) + "/" + i(t(v)), 1)) : s("", !0),
|
|
232
|
+
x(r.$slots, "right-icon", {}, () => [
|
|
233
|
+
n.value.right.name ? (l(), C(T, M({
|
|
234
|
+
key: 0,
|
|
235
|
+
class: "rds-textarea__icon rds-textarea__icon--right",
|
|
236
|
+
"aria-hidden": "true"
|
|
237
|
+
}, n.value.right, q(n.value.right.events)), null, 16)) : s("", !0)
|
|
238
|
+
], !0)
|
|
239
|
+
], 2)
|
|
240
|
+
])
|
|
241
|
+
]),
|
|
242
|
+
a("ul", {
|
|
243
|
+
class: g(["rds-textarea__helper", t(_) || E.value ? "rds-textarea__helper--error" : ""])
|
|
244
|
+
}, [
|
|
245
|
+
V.value ? (l(), h("li", le, " Max text length is " + i(t(v)), 1)) : s("", !0),
|
|
246
|
+
B.value ? (l(), h("li", ne, " Min text length is " + i(t(m)), 1)) : s("", !0),
|
|
247
|
+
a("li", null, [
|
|
248
|
+
x(r.$slots, "helper-text", {}, () => [
|
|
249
|
+
t(z) || t(_) ? (l(), h("span", oe, i(t(A)), 1)) : s("", !0)
|
|
250
|
+
], !0)
|
|
251
|
+
])
|
|
252
|
+
], 2)
|
|
253
|
+
], 2);
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}), ce = /* @__PURE__ */ W(se, [["__scopeId", "data-v-dc860073"]]);
|
|
257
|
+
export {
|
|
258
|
+
ce as default
|
|
259
|
+
};
|