energy-components 1.8.0 → 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.
Files changed (45) hide show
  1. package/dist/components/avatar.es.js +161 -0
  2. package/dist/components/checkbox.es.js +51 -35
  3. package/dist/components/directAccess.es.js +146 -0
  4. package/dist/components/dragAndDrop.es.js +77 -60
  5. package/dist/components/fileUploadItem.es.js +182 -0
  6. package/dist/components/filterChip.es.js +26 -22
  7. package/dist/components/index.es.js +76 -64
  8. package/dist/components/link.es.js +67 -55
  9. package/dist/components/loader.es.js +178 -0
  10. package/dist/components/progressBar.es.js +52 -28
  11. package/dist/components/selectionChip.es.js +15 -14
  12. package/dist/components/style/avatar.css +1 -0
  13. package/dist/components/style/button.css +1 -1
  14. package/dist/components/style/checkbox.css +1 -1
  15. package/dist/components/style/directAccess.css +1 -0
  16. package/dist/components/style/dragAndDrop.css +1 -1
  17. package/dist/components/style/fileUploadItem.css +1 -0
  18. package/dist/components/style/filterChip.css +1 -1
  19. package/dist/components/style/link.css +1 -1
  20. package/dist/components/style/loader.css +1 -0
  21. package/dist/components/style/progressBar.css +1 -1
  22. package/dist/components/style/selectionChip.css +1 -1
  23. package/dist/components/style/tabBar.css +1 -1
  24. package/dist/components/style/textField.css +1 -1
  25. package/dist/components/style/toggle.css +1 -1
  26. package/dist/components/tabBar.es.js +63 -64
  27. package/dist/components/textField.es.js +134 -110
  28. package/dist/components/toggle.es.js +21 -20
  29. package/dist/energy-components.es.js +5424 -4679
  30. package/dist/energy-components.umd.js +2 -2
  31. package/dist/style.css +1 -1
  32. package/dist/types/src/components/content/avatar/avatar.vue.d.ts +153 -0
  33. package/dist/types/src/components/feedback/loader/loader.vue.d.ts +151 -0
  34. package/dist/types/src/components/feedback/progress-bar/progress-bar.vue.d.ts +34 -0
  35. package/dist/types/src/components/index.d.ts +4 -0
  36. package/dist/types/src/components/input/checkbox/checkbox.vue.d.ts +15 -0
  37. package/dist/types/src/components/input/drag-and-drop/drag-and-drop.vue.d.ts +14 -2
  38. package/dist/types/src/components/input/file-upload-item/file-upload-item.vue.d.ts +229 -0
  39. package/dist/types/src/components/input/filter-chip/filter-chip.vue.d.ts +2 -0
  40. package/dist/types/src/components/input/text-field/text-field.vue.d.ts +23 -4
  41. package/dist/types/src/components/navigation/direct-access/direct-access.vue.d.ts +178 -0
  42. package/dist/types/src/components/navigation/link/link.vue.d.ts +15 -0
  43. package/dist/types/src/components/overlay/tooltip/tooltip.vue.d.ts +1 -1
  44. package/dist/types/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +2 -2
@@ -1,11 +1,11 @@
1
- import { defineComponent as W, toRefs as X, ref as y, computed as u, watch as Y, createElementBlock as x, openBlock as d, normalizeClass as b, createElementVNode as c, renderSlot as k, createCommentVNode as m, createBlock as I, mergeProps as R, toHandlers as Z, unref as t, toDisplayString as T, withModifiers as ee } from "vue";
2
- import { g as te } from "./getInstance-GhoEcxLF.js";
3
- import { R as $, s as le } from "./icon-svg-_WCkLP8-.js";
4
- import { _ as oe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
- import './style/textField.css';const ne = { class: "rds-e-textfield__container" }, ae = { class: "rds-e-textfield__input-container" }, re = ["id", "type", "maxLength", "minLength", "disabled", "value", "autocomplete", "readonly"], se = ["for"], ie = {
1
+ import { defineComponent as ee, toRefs as te, ref as w, computed as d, watch as le, createElementBlock as k, openBlock as p, normalizeClass as S, createElementVNode as m, renderSlot as N, createCommentVNode as y, createBlock as I, mergeProps as $, toHandlers as ne, unref as o, toDisplayString as C, withModifiers as ae } from "vue";
2
+ import { g as oe } from "./getInstance-GhoEcxLF.js";
3
+ import { R, s as re } from "./icon-svg-_WCkLP8-.js";
4
+ import { _ as se } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
+ import './style/textField.css';const ie = { class: "rds-e-textfield__container" }, ue = { class: "rds-e-textfield__input-container" }, de = ["id", "type", "maxlength", "minlength", "disabled", "value", "autocomplete", "readonly"], ce = ["for"], fe = {
6
6
  key: 0,
7
7
  class: "rds-e-textfield__icon rds-e-textfield__icon--right"
8
- }, ue = { class: "rds-e-textfield__helper" }, de = /* @__PURE__ */ W({
8
+ }, pe = { class: "rds-e-textfield__helper" }, me = /* @__PURE__ */ ee({
9
9
  __name: "text-field",
10
10
  props: {
11
11
  /**
@@ -26,7 +26,7 @@ import './style/textField.css';const ne = { class: "rds-e-textfield__container"
26
26
  * v-model valor de entrada y salida
27
27
  */
28
28
  modelValue: {
29
- type: [String, null],
29
+ type: [String, Number, null],
30
30
  required: !0
31
31
  },
32
32
  /**
@@ -49,7 +49,7 @@ import './style/textField.css';const ne = { class: "rds-e-textfield__container"
49
49
  maxLength: {
50
50
  type: Number,
51
51
  default: 100,
52
- validator: (l) => l < 0 ? (console.info("El valor de maxLength no puede ser menor a 0"), !1) : Number.isNaN(l) ? (console.info("El valor de maxLength debe ser un número"), !1) : !0
52
+ validator: (t) => t < 0 ? (console.info("El valor de maxLength no puede ser menor a 0"), !1) : Number.isNaN(t) ? (console.info("El valor de maxLength debe ser un número"), !1) : !0
53
53
  },
54
54
  /**
55
55
  * Número mínimo de caracteres permitidos en el campo de entrada.
@@ -57,7 +57,19 @@ import './style/textField.css';const ne = { class: "rds-e-textfield__container"
57
57
  minLength: {
58
58
  type: Number,
59
59
  default: 0,
60
- validator: (l) => l < 0 ? (console.info("El valor de minLength no puede ser menor a 0"), !1) : Number.isNaN(l) ? (console.info("El valor de minLength debe ser un número"), !1) : !0
60
+ validator: (t) => t < 0 ? (console.info("El valor de minLength no puede ser menor a 0"), !1) : Number.isNaN(t) ? (console.info("El valor de minLength debe ser un número"), !1) : !0
61
+ },
62
+ /**
63
+ * Tipo del input HTML. Por defecto 'text'.
64
+ * Puede ser 'text' o 'number'. La prop 'password' tiene precedencia.
65
+ */
66
+ type: {
67
+ type: String,
68
+ default: "text",
69
+ validator: (t) => {
70
+ const r = ["text", "number", "password", "email", "tel", "url"], s = r.includes(t);
71
+ return s || console.warn(`[RDSTextfield]: El valor de la prop 'type' debe ser uno de: ${r.join(", ")}. Valor recibido: ${t}`), s;
72
+ }
61
73
  },
62
74
  /**
63
75
  * Nombre del icono que se mostrará dentro del campo de entrada.
@@ -117,60 +129,72 @@ import './style/textField.css';const ne = { class: "rds-e-textfield__container"
117
129
  autocomplete: {
118
130
  type: String,
119
131
  default: "off",
120
- validator: (l, v) => {
121
- const f = ["new-password", "current-password", "off"];
122
- return v.password && !f.includes(l) ? (console.info(`[RDSTextfield]: El valor de autocomplete para un campo de contraseña debe ser uno de los siguientes: ${f.join(", ")}`), !1) : !0;
132
+ validator: (t, r) => {
133
+ const s = ["new-password", "current-password", "off"];
134
+ return (r.password || r.type === "password") && !s.includes(t) ? (console.info(`[RDSTextfield]: El valor de autocomplete para un campo de contraseña debe ser uno de los siguientes: ${s.join(", ")}`), !1) : !0;
123
135
  }
124
136
  }
125
137
  },
126
138
  emits: ["update:modelValue", "keydown", "keyup", "keypress", "change"],
127
- setup(l, { expose: v, emit: f }) {
128
- const w = l, a = f, {
129
- label: C,
130
- disabled: p,
131
- maxLength: S,
132
- minLength: L,
133
- modelValue: n,
134
- icon: D,
139
+ setup(t, { expose: r, emit: s }) {
140
+ const n = t, i = s, {
141
+ type: v,
142
+ label: D,
143
+ disabled: h,
144
+ maxLength: F,
145
+ minLength: P,
146
+ modelValue: u,
147
+ icon: j,
135
148
  rightIcon: q,
136
- helper: F,
137
- error: h,
138
- helperText: K,
139
- clearable: j,
140
- password: _,
141
- autocomplete: P
142
- } = X(w), r = y(null), s = y(!0), g = y(!1), z = te(), N = u(() => w.id || `text-field-${z}`), H = u(() => {
143
- if (_.value)
144
- return P.value;
145
- }), M = (e) => {
146
- a(
147
- "update:modelValue",
148
- e.target.value
149
- );
150
- }, V = () => {
151
- g.value = !1;
152
- }, B = () => {
153
- g.value = !0;
154
- }, U = (e) => {
155
- a("keydown", e);
156
- }, A = (e) => {
157
- a("keyup", e);
158
- }, G = (e) => {
159
- a("keypress", e);
160
- }, J = (e) => {
161
- a("change", e);
162
- }, O = u(() => !!(h.value || n.value && n.value.length && (n.value.length < L.value || n.value.length > S.value))), Q = u(() => {
149
+ helper: K,
150
+ error: x,
151
+ helperText: z,
152
+ clearable: A,
153
+ password: g,
154
+ autocomplete: H
155
+ } = te(n), c = w(null), f = w(!0), b = w(!1), M = oe(), V = d(() => n.id || `text-field-${M}`), U = d(() => g.value ? f.value ? "text" : "password" : v.value), G = d(() => {
156
+ if (g.value || v.value === "password")
157
+ return H.value;
158
+ }), J = (e) => {
159
+ const l = e.target;
160
+ let _ = l.value;
161
+ if (v.value === "number")
162
+ if (l.value.trim() === "")
163
+ _ = null;
164
+ else {
165
+ const B = Number.parseFloat(l.value);
166
+ _ = Number.isNaN(B) ? l.value : B;
167
+ }
168
+ else l.value === "" && u.value === null && (_ = null);
169
+ i("update:modelValue", _);
170
+ }, E = () => {
171
+ b.value = !1;
172
+ }, L = () => {
173
+ b.value = !0;
174
+ }, O = (e) => {
175
+ i("keydown", e);
176
+ }, Q = (e) => {
177
+ i("keyup", e);
178
+ }, W = (e) => {
179
+ i("keypress", e);
180
+ }, X = (e) => {
181
+ i("change", e);
182
+ }, Y = d(() => {
183
+ if (x.value) return !0;
184
+ const e = u.value === null || u.value === void 0 ? "" : String(u.value);
185
+ return e.length > 0 && (e.length < P.value || v.value !== "number" && e.length > F.value);
186
+ }), Z = d(() => {
163
187
  const e = [];
164
- return n.value !== null && n.value !== "" && e.push("rds-e-textfield--filled"), O.value && e.push("rds-e-textfield--error"), p.value && e.push("rds-e-textfield--disabled"), e.join(" ");
165
- }), o = u(() => {
188
+ return u.value !== null && String(u.value).length > 0 && e.push("rds-e-textfield--filled"), Y.value && e.push("rds-e-textfield--error"), h.value && e.push("rds-e-textfield--disabled"), e.join(" ");
189
+ }), a = d(() => {
166
190
  const e = {
167
- name: D.value,
191
+ name: j.value,
168
192
  class: "",
169
193
  events: {
170
194
  click: () => {
171
195
  }
172
196
  }
173
- }, i = {
197
+ }, l = {
174
198
  left: {
175
199
  ...e
176
200
  },
@@ -179,20 +203,20 @@ import './style/textField.css';const ne = { class: "rds-e-textfield__container"
179
203
  name: q.value
180
204
  }
181
205
  };
182
- return _.value ? {
206
+ return g.value ? {
183
207
  left: {
184
208
  ...e,
185
209
  name: null
186
210
  },
187
211
  right: {
188
212
  ...e,
189
- name: s.value ? "eye_open" : "eye_close",
213
+ name: f.value ? "eye_open" : "eye_close",
190
214
  class: "rds-e-textfield__icon--password",
191
215
  events: {
192
- click: () => s.value = !s.value
216
+ click: () => f.value = !f.value
193
217
  }
194
218
  }
195
- } : j.value ? {
219
+ } : A.value ? {
196
220
  left: {
197
221
  ...e
198
222
  },
@@ -201,87 +225,87 @@ import './style/textField.css';const ne = { class: "rds-e-textfield__container"
201
225
  name: "close",
202
226
  class: "rds-e-textfield__icon--clear",
203
227
  events: {
204
- click: () => a("update:modelValue", "")
228
+ click: () => i("update:modelValue", "")
205
229
  }
206
230
  }
207
- } : i;
231
+ } : l;
208
232
  });
209
- Y(
210
- _,
211
- (e) => s.value = !e,
233
+ le(
234
+ g,
235
+ (e) => f.value = !e,
212
236
  { immediate: !0 }
213
237
  );
214
- const E = (e) => {
215
- const i = le.includes(e);
216
- return i || console.warn(`[RDSTextfield]: El icono "${e}" no es un icono válido.`), i;
238
+ const T = (e) => {
239
+ const l = re.includes(e);
240
+ return l || console.warn(`[RDSTextfield]: El icono "${e}" no es un icono válido.`), l;
217
241
  };
218
- return v({
242
+ return r({
219
243
  focus: () => {
220
- r.value && (r.value.focus(), B());
244
+ c.value && (c.value.focus(), L());
221
245
  },
222
246
  blur: () => {
223
- r.value && (r.value.blur(), V());
247
+ c.value && (c.value.blur(), E());
224
248
  }
225
- }), (e, i) => (d(), x("div", {
226
- class: b(["rds-e-textfield", Q.value])
249
+ }), (e, l) => (p(), k("div", {
250
+ class: S(["rds-e-textfield", Z.value])
227
251
  }, [
228
- c("div", ne, [
229
- k(e.$slots, "left-icon", {}, () => [
230
- o.value.left.name && E(o.value.left.name) ? (d(), I($, R({
252
+ m("div", ie, [
253
+ N(e.$slots, "left-icon", {}, () => [
254
+ a.value.left.name && T(a.value.left.name) ? (p(), I(R, $({
231
255
  key: 0,
232
- class: ["rds-e-textfield__icon rds-e-textfield__icon--left", { "rds-e-textfield__icon--hidden": g.value }],
256
+ class: ["rds-e-textfield__icon rds-e-textfield__icon--left", { "rds-e-textfield__icon--hidden": b.value }],
233
257
  "aria-hidden": "true"
234
- }, o.value.left, Z(o.value.left.events)), null, 16, ["class"])) : m("", !0)
258
+ }, a.value.left, ne(a.value.left.events)), null, 16, ["class"])) : y("", !0)
235
259
  ], !0),
236
- c("div", ae, [
237
- c("input", {
238
- id: N.value,
260
+ m("div", ue, [
261
+ m("input", {
262
+ id: V.value,
239
263
  ref_key: "input",
240
- ref: r,
241
- type: s.value ? "text" : "password",
264
+ ref: c,
265
+ type: U.value,
242
266
  class: "rds-e-textfield__input",
243
- maxLength: t(S),
244
- minLength: t(L),
245
- disabled: t(p),
246
- value: t(n),
247
- autocomplete: H.value,
248
- readonly: l.readonly,
249
- onInput: M,
250
- onBlur: V,
251
- onFocus: B,
252
- onKeydown: U,
253
- onKeyup: A,
254
- onKeypress: G,
255
- onChange: J
256
- }, null, 40, re),
257
- c("label", {
258
- for: N.value,
259
- class: b(["rds-e-textfield__label", t(p) ? "rds-e-textfield__label--disabled" : ""])
260
- }, T(t(C)), 11, se)
267
+ maxlength: n.type === "number" ? void 0 : n.maxLength,
268
+ minlength: n.type === "number" ? void 0 : n.minLength,
269
+ disabled: o(h),
270
+ value: n.modelValue === null ? "" : n.modelValue,
271
+ autocomplete: G.value,
272
+ readonly: t.readonly,
273
+ onInput: J,
274
+ onBlur: E,
275
+ onFocus: L,
276
+ onKeydown: O,
277
+ onKeyup: Q,
278
+ onKeypress: W,
279
+ onChange: X
280
+ }, null, 40, de),
281
+ m("label", {
282
+ for: V.value,
283
+ class: S(["rds-e-textfield__label", o(h) ? "rds-e-textfield__label--disabled" : ""])
284
+ }, C(o(D)), 11, ce)
261
285
  ]),
262
- o.value.right.name || e.$slots["right-icon"] ? (d(), x("span", ie, [
263
- k(e.$slots, "right-icon", {}, () => [
264
- o.value.right.name && E(o.value.right.name) ? (d(), I($, R({
286
+ a.value.right.name || e.$slots["right-icon"] ? (p(), k("span", fe, [
287
+ N(e.$slots, "right-icon", {}, () => [
288
+ a.value.right.name && T(a.value.right.name) ? (p(), I(R, $({
265
289
  key: 0,
266
290
  "aria-hidden": "true",
267
291
  class: "rds-e-textfield__icon rds-e-textfield__icon--right"
268
- }, o.value.right, {
269
- onClick: ee(o.value.right.events.click, ["stop"])
270
- }), null, 16, ["onClick"])) : m("", !0)
292
+ }, a.value.right, {
293
+ onClick: ae(a.value.right.events.click, ["stop"])
294
+ }), null, 16, ["onClick"])) : y("", !0)
271
295
  ], !0)
272
- ])) : m("", !0)
296
+ ])) : y("", !0)
273
297
  ]),
274
- c("div", ue, [
275
- k(e.$slots, "helper-text", {}, () => [
276
- (t(F) || t(h)) && !t(p) ? (d(), x("span", {
298
+ m("div", pe, [
299
+ N(e.$slots, "helper-text", {}, () => [
300
+ (o(K) || o(x)) && !o(h) ? (p(), k("span", {
277
301
  key: 0,
278
- class: b(t(h) ? "rds-e-textfield__helper--error" : "")
279
- }, T(t(K)), 3)) : m("", !0)
302
+ class: S(o(x) ? "rds-e-textfield__helper--error" : "")
303
+ }, C(o(z)), 3)) : y("", !0)
280
304
  ], !0)
281
305
  ])
282
306
  ], 2));
283
307
  }
284
- }), ve = /* @__PURE__ */ oe(de, [["__scopeId", "data-v-5cc94c78"]]);
308
+ }), ye = /* @__PURE__ */ se(me, [["__scopeId", "data-v-a6ab314d"]]);
285
309
  export {
286
- ve as default
310
+ ye as default
287
311
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as T, toRefs as E, ref as L, onMounted as _, createElementBlock as y, openBlock as B, normalizeClass as d, createElementVNode as p, unref as i, toDisplayString as m } from "vue";
1
+ import { defineComponent as c, toRefs as E, ref as L, onMounted as h, createElementBlock as y, openBlock as B, normalizeClass as r, createElementVNode as p, unref as i, toDisplayString as f } from "vue";
2
2
  import { _ as F } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- import './style/toggle.css';const I = /* @__PURE__ */ T({
3
+ import './style/toggle.css';const I = /* @__PURE__ */ c({
4
4
  __name: "toggle",
5
5
  props: {
6
6
  small: { type: Boolean },
@@ -13,41 +13,42 @@ import './style/toggle.css';const I = /* @__PURE__ */ T({
13
13
  labelRight: {}
14
14
  },
15
15
  emits: ["update:modelValue"],
16
- setup(f, { emit: v }) {
17
- const b = f, n = v, { modelValue: e, switchType: s, valueLeft: u, valueRight: o } = E(b), t = {
16
+ setup(m, { emit: v }) {
17
+ const b = m, u = v, { modelValue: l, switchType: s, valueLeft: n, valueRight: o } = E(b), t = {
18
18
  LEFT: "left",
19
19
  RIGHT: "right"
20
- }, a = L(t.LEFT), g = (l) => {
21
- n("update:modelValue", l);
20
+ }, a = L(t.LEFT), g = (e) => {
21
+ u("update:modelValue", e);
22
22
  };
23
- return _(() => {
24
- s != null && s.value ? (n("update:modelValue", e == null ? void 0 : e.value), a.value = e != null && e.value ? t.RIGHT : t.LEFT) : (e == null ? void 0 : e.value) === (o == null ? void 0 : o.value) ? (n("update:modelValue", o == null ? void 0 : o.value), a.value = t.RIGHT) : (n("update:modelValue", u == null ? void 0 : u.value), a.value = t.LEFT);
25
- }), (l, r) => (B(), y("div", {
26
- class: d(["rds-e-toggle", [
23
+ return h(() => {
24
+ s != null && s.value ? (u("update:modelValue", l == null ? void 0 : l.value), a.value = l != null && l.value ? t.RIGHT : t.LEFT) : (l == null ? void 0 : l.value) === (o == null ? void 0 : o.value) ? (u("update:modelValue", o == null ? void 0 : o.value), a.value = t.RIGHT) : (u("update:modelValue", n == null ? void 0 : n.value), a.value = t.LEFT);
25
+ }), (e, d) => (B(), y("div", {
26
+ class: r(["rds-e-toggle", [
27
27
  {
28
- "rds-e-toggle--full-width": l.fullWidth && !l.small,
29
- "rds-e-toggle--width": !l.fullWidth && !l.small,
30
- "rds-e-toggle--small": l.small
28
+ "rds-e-toggle--small-full-width": e.small && e.fullWidth,
29
+ "rds-e-toggle--full-width": e.fullWidth && !e.small,
30
+ "rds-e-toggle--small": e.small && !e.fullWidth,
31
+ "rds-e-toggle--width": !e.small && !e.fullWidth
31
32
  }
32
33
  ]])
33
34
  }, [
34
35
  p("button", {
35
- class: d(["rds-e-toggle__tab", {
36
+ class: r(["rds-e-toggle__tab", {
36
37
  "rds-e-toggle__tab--active": a.value === t.LEFT
37
38
  }]),
38
39
  type: "button",
39
- onClick: r[0] || (r[0] = (c) => (g(i(s) ? !0 : i(u)), a.value = t.LEFT))
40
- }, m(l.labelLeft), 3),
40
+ onClick: d[0] || (d[0] = (T) => (g(i(s) ? !0 : i(n)), a.value = t.LEFT))
41
+ }, f(e.labelLeft), 3),
41
42
  p("button", {
42
- class: d(["rds-e-toggle__tab", {
43
+ class: r(["rds-e-toggle__tab", {
43
44
  "rds-e-toggle__tab--active": a.value === t.RIGHT
44
45
  }]),
45
46
  type: "button",
46
- onClick: r[1] || (r[1] = (c) => (g(i(s) ? !1 : i(o)), a.value = t.RIGHT))
47
- }, m(l.labelRight), 3)
47
+ onClick: d[1] || (d[1] = (T) => (g(i(s) ? !1 : i(o)), a.value = t.RIGHT))
48
+ }, f(e.labelRight), 3)
48
49
  ], 2));
49
50
  }
50
- }), H = /* @__PURE__ */ F(I, [["__scopeId", "data-v-191362c2"]]);
51
+ }), H = /* @__PURE__ */ F(I, [["__scopeId", "data-v-30b07e72"]]);
51
52
  export {
52
53
  H as default
53
54
  };