energy-components 1.2.0 → 1.3.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.
@@ -1,12 +1,12 @@
1
- import { defineComponent as R, mergeModels as U, useModel as F, toRefs as G, computed as o, openBlock as s, createElementBlock as f, normalizeClass as h, createElementVNode as a, withDirectives as J, unref as e, vModelText as K, renderSlot as x, createBlock as M, mergeProps as I, toHandlers as q, createCommentVNode as i, createTextVNode as L, toDisplayString as u } from "vue";
2
- import { I as T } from "./icon-svg-GoL3_ayS.js";
3
- import { _ as O } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- import './style/textArea.css';function y(t, m = !0, d = !0) {
5
- return m && !t.trim() ? (console.warn("Advertencia: El valor no puede estar vacío"), !1) : d && !/^[\w\-:]+$/.test(t) ? (console.warn("Advertencia: El valor contiene caracteres inválidos"), !1) : !0;
1
+ import { defineComponent as G, mergeModels as J, useModel as K, toRefs as L, ref as O, computed as o, openBlock as s, createElementBlock as f, normalizeClass as h, createElementVNode as a, withDirectives as Q, unref as e, vModelText as W, renderSlot as y, createBlock as M, mergeProps as q, toHandlers as T, createCommentVNode as i, createTextVNode as X, toDisplayString as u } from "vue";
2
+ import { I as $ } from "./icon-svg-GoL3_ayS.js";
3
+ import { _ as Y } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
+ import './style/textArea.css';function b(t, _ = !0, d = !0) {
5
+ return _ && !t.trim() ? (console.warn("Advertencia: El valor no puede estar vacío"), !1) : d && !/^[\w\-:]+$/.test(t) ? (console.warn("Advertencia: El valor contiene caracteres inválidos"), !1) : !0;
6
6
  }
7
- const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__input-container" }, X = ["id", "name", "maxlength", "minlength", "rows", "disabled"], Y = ["for"], Z = { key: 0 }, ee = { key: 0 }, te = { key: 1 }, re = { key: 0 }, ae = /* @__PURE__ */ R({
7
+ const Z = { class: "rds-e-textarea__container" }, ee = { class: "rds-e-textarea__input-container" }, te = ["id", "name", "maxlength", "minlength", "rows", "disabled"], re = ["for"], ae = { key: 0 }, le = { key: 0 }, ne = { key: 1 }, se = { key: 0 }, oe = /* @__PURE__ */ G({
8
8
  __name: "text-area",
9
- props: /* @__PURE__ */ U({
9
+ props: /* @__PURE__ */ J({
10
10
  /**
11
11
  * Etiqueta que se muestra sobre el campo de entrada. y Placeholder
12
12
  */
@@ -14,7 +14,7 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
14
14
  type: String,
15
15
  required: !0,
16
16
  validator(t) {
17
- return y(t, !0, !0);
17
+ return b(t, !0, !0);
18
18
  }
19
19
  },
20
20
  /**
@@ -24,7 +24,7 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
24
24
  type: String,
25
25
  required: !1,
26
26
  validator(t) {
27
- return y(t, !1, !0);
27
+ return b(t, !1, !0);
28
28
  }
29
29
  },
30
30
  /**
@@ -34,7 +34,7 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
34
34
  type: String,
35
35
  required: !1,
36
36
  validator(t) {
37
- return y(t, !1, !0);
37
+ return b(t, !1, !0);
38
38
  }
39
39
  },
40
40
  /**
@@ -136,26 +136,30 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
136
136
  }),
137
137
  emits: ["update:modelValue"],
138
138
  setup(t) {
139
- const m = t, d = F(t, "modelValue"), {
140
- label: b,
141
- id: w,
139
+ const _ = t, d = K(t, "modelValue"), {
140
+ label: w,
141
+ id: k,
142
142
  disabled: p,
143
- maxlength: v,
143
+ maxlength: m,
144
144
  minlength: g,
145
145
  modelValue: c,
146
- icon: $,
147
- rightIcon: k,
148
- helper: A,
149
- error: _,
150
- helperText: z,
151
- clearable: S,
152
- lengthError: D
153
- } = G(m), V = o(() => c.value.length === v.value), B = o(() => c.value.length === 0 ? !1 : c.value.length < g.value), E = o(() => D.value && (V.value || B.value)), P = o(() => {
146
+ icon: A,
147
+ rightIcon: S,
148
+ helper: z,
149
+ error: x,
150
+ helperText: D,
151
+ clearable: V,
152
+ lengthError: F
153
+ } = L(_), v = O(!1), P = () => {
154
+ v.value = !1;
155
+ }, j = () => {
156
+ v.value = !0;
157
+ }, B = o(() => c.value.length === m.value), E = o(() => c.value.length === 0 ? !1 : c.value.length < g.value), N = o(() => F.value && (B.value || E.value)), H = o(() => {
154
158
  const r = [];
155
- return c.value && r.push("rds-e-textarea--filled"), _.value && r.push("rds-e-textarea--error"), p.value && r.push("rds-e-textarea--disabled"), E.value && r.push("rds-e-textarea--error"), r.join(" ");
159
+ return c.value && r.push("rds-e-textarea--filled"), x.value && r.push("rds-e-textarea--error"), p.value && r.push("rds-e-textarea--disabled"), N.value && r.push("rds-e-textarea--error"), r.join(" ");
156
160
  }), l = o(() => {
157
161
  const r = {
158
- name: $.value,
162
+ name: A.value,
159
163
  class: "",
160
164
  events: {
161
165
  click: () => {
@@ -163,9 +167,9 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
163
167
  }
164
168
  }, n = {
165
169
  left: { ...r },
166
- right: { ...r, name: k.value }
170
+ right: { ...r, name: S.value }
167
171
  };
168
- return S.value && (n.right = {
172
+ return V.value && (n.right = {
169
173
  ...r,
170
174
  name: "close",
171
175
  class: "rds-e-textfield__icon--clear",
@@ -173,26 +177,28 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
173
177
  click: () => d.value = ""
174
178
  }
175
179
  }), n;
176
- }), j = o(() => c.value.length);
180
+ }), R = o(() => c.value.length);
177
181
  return (r, n) => {
178
- var N, C;
182
+ var C, I;
179
183
  return s(), f("div", {
180
- class: h(["rds-e-textarea", P.value])
184
+ class: h(["rds-e-textarea", H.value])
181
185
  }, [
182
- a("div", Q, [
183
- a("div", W, [
184
- J(a("textarea", {
185
- id: (N = e(w)) == null ? void 0 : N.toString(),
186
- "onUpdate:modelValue": n[0] || (n[0] = (H) => d.value = H),
186
+ a("div", Z, [
187
+ a("div", ee, [
188
+ Q(a("textarea", {
189
+ id: (C = e(k)) == null ? void 0 : C.toString(),
190
+ "onUpdate:modelValue": n[0] || (n[0] = (U) => d.value = U),
187
191
  type: "text",
188
- class: "rds-e-textarea__input",
192
+ class: h(["rds-e-textarea__input", { "rds-e-textarea__input--active": v.value }]),
189
193
  name: t.name,
190
- maxlength: e(v),
194
+ maxlength: e(m),
191
195
  minlength: e(g),
192
196
  rows: t.rows,
193
- disabled: e(p)
194
- }, null, 8, X), [
195
- [K, d.value]
197
+ disabled: e(p),
198
+ onBlur: P,
199
+ onFocus: j
200
+ }, null, 42, te), [
201
+ [W, d.value]
196
202
  ]),
197
203
  n[1] || (n[1] = a("div", { class: "rds-e-textarea__resize-handle" }, [
198
204
  a("svg", {
@@ -210,52 +216,53 @@ const Q = { class: "rds-e-textarea__container" }, W = { class: "rds-e-textarea__
210
216
  ])
211
217
  ], -1)),
212
218
  a("label", {
213
- for: (C = e(w)) == null ? void 0 : C.toString(),
219
+ for: (I = e(k)) == null ? void 0 : I.toString(),
214
220
  class: h(["rds-e-textarea__label", {
215
- "rds-e-textarea__label--with-icon": l.value.left.name
221
+ "rds-e-textarea__label--with-icon": l.value.left.name,
222
+ "rds-e-textarea__label--active": v.value
216
223
  }])
217
224
  }, [
218
- x(r.$slots, "left-icon", {}, () => [
219
- l.value.left.name ? (s(), M(T, I({
225
+ y(r.$slots, "left-icon", {}, () => [
226
+ l.value.left.name ? (s(), M($, q({
220
227
  key: 0,
221
- class: "rds-e-textarea__icon rds-e-textarea__icon--left",
228
+ class: ["rds-e-textarea__icon rds-e-textarea__icon--left", { "rds-e-textarea__icon--hidden": v.value }],
222
229
  "aria-hidden": "true"
223
- }, l.value.left, q(l.value.left.events)), null, 16)) : i("", !0)
230
+ }, l.value.left, T(l.value.left.events)), null, 16, ["class"])) : i("", !0)
224
231
  ], !0),
225
- L(" " + u(e(b)), 1)
226
- ], 10, Y),
232
+ X(" " + u(e(w)), 1)
233
+ ], 10, re),
227
234
  a("div", {
228
235
  class: h(["rds-e-textarea__counter", {
229
236
  "rds-e-textarea__counter--disabled": e(p),
230
- "rds-e-textarea__counter--clearable": e(S)
237
+ "rds-e-textarea__counter--clearable": e(V)
231
238
  }])
232
239
  }, [
233
- t.counter && !e(k) ? (s(), f("p", Z, u(j.value) + "/" + u(e(v)), 1)) : i("", !0),
234
- x(r.$slots, "right-icon", {}, () => [
235
- l.value.right.name && !l.value.left.name ? (s(), M(T, I({
240
+ t.counter && !e(S) ? (s(), f("p", ae, u(R.value) + "/" + u(e(m)), 1)) : i("", !0),
241
+ y(r.$slots, "right-icon", {}, () => [
242
+ l.value.right.name && !l.value.left.name ? (s(), M($, q({
236
243
  key: 0,
237
244
  class: "rds-e-textarea__icon rds-e-textarea__icon--right",
238
245
  "aria-hidden": "true"
239
- }, l.value.right, q(l.value.right.events)), null, 16)) : i("", !0)
246
+ }, l.value.right, T(l.value.right.events)), null, 16)) : i("", !0)
240
247
  ], !0)
241
248
  ], 2)
242
249
  ])
243
250
  ]),
244
251
  a("ul", {
245
- class: h(["rds-e-textarea__helper", e(_) || E.value ? "rds-e-textarea__helper--error" : ""])
252
+ class: h(["rds-e-textarea__helper", e(x) || N.value ? "rds-e-textarea__helper--error" : ""])
246
253
  }, [
247
- V.value ? (s(), f("li", ee, " Max text length is " + u(e(v)), 1)) : i("", !0),
248
- B.value ? (s(), f("li", te, " Min text length is " + u(e(g)), 1)) : i("", !0),
254
+ B.value ? (s(), f("li", le, " Max text length is " + u(e(m)), 1)) : i("", !0),
255
+ E.value ? (s(), f("li", ne, " Min text length is " + u(e(g)), 1)) : i("", !0),
249
256
  a("li", null, [
250
- x(r.$slots, "helper-text", {}, () => [
251
- e(A) || e(_) ? (s(), f("span", re, u(e(z)), 1)) : i("", !0)
257
+ y(r.$slots, "helper-text", {}, () => [
258
+ e(z) || e(x) ? (s(), f("span", se, u(e(D)), 1)) : i("", !0)
252
259
  ], !0)
253
260
  ])
254
261
  ], 2)
255
262
  ], 2);
256
263
  };
257
264
  }
258
- }), oe = /* @__PURE__ */ O(ae, [["__scopeId", "data-v-51c6b51e"]]);
265
+ }), ce = /* @__PURE__ */ Y(oe, [["__scopeId", "data-v-e01ef58d"]]);
259
266
  export {
260
- oe as default
267
+ ce as default
261
268
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as H, toRefs as M, ref as L, computed as s, watch as U, openBlock as u, createElementBlock as v, normalizeClass as h, createElementVNode as i, renderSlot as _, createBlock as A, mergeProps as S, toHandlers as G, createCommentVNode as g, unref as t, toDisplayString as B, createVNode as J, withModifiers as K } from "vue";
2
- import { g as O } from "./getInstance-GhoEcxLF.js";
3
- import { I as V } from "./icon-svg-GoL3_ayS.js";
4
- import { _ as Q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
- import './style/textField.css';const W = { class: "rds-e-textfield__container" }, X = { class: "rds-e-textfield__input-container" }, Y = ["id", "type", "maxLength", "minLength", "disabled", "value", "autocomplete", "readonly"], Z = ["for"], ee = {
1
+ import { defineComponent as M, toRefs as U, ref as w, computed as s, watch as A, openBlock as u, createElementBlock as v, normalizeClass as h, createElementVNode as i, renderSlot as _, createBlock as G, mergeProps as L, toHandlers as J, createCommentVNode as g, unref as t, toDisplayString as S, createVNode as K, withModifiers as O } from "vue";
2
+ import { g as Q } from "./getInstance-GhoEcxLF.js";
3
+ import { I as B } from "./icon-svg-GoL3_ayS.js";
4
+ import { _ as W } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
+ import './style/textField.css';const X = { class: "rds-e-textfield__container" }, Y = { class: "rds-e-textfield__input-container" }, Z = ["id", "type", "maxLength", "minLength", "disabled", "value", "autocomplete", "readonly"], ee = ["for"], te = {
6
6
  key: 0,
7
7
  class: "rds-e-textfield__icon rds-e-textfield__icon--right"
8
- }, te = { class: "rds-e-textfield__helper" }, le = /* @__PURE__ */ H({
8
+ }, le = { class: "rds-e-textfield__helper" }, re = /* @__PURE__ */ M({
9
9
  __name: "text-field",
10
10
  props: {
11
11
  /**
@@ -126,47 +126,49 @@ import './style/textField.css';const W = { class: "rds-e-textfield__container" }
126
126
  emits: ["update:modelValue"],
127
127
  setup(l, { emit: c }) {
128
128
  const a = l, x = c, {
129
- label: E,
129
+ label: V,
130
130
  disabled: d,
131
131
  maxLength: y,
132
132
  minLength: b,
133
133
  modelValue: o,
134
- icon: I,
135
- rightIcon: T,
136
- helper: $,
134
+ icon: E,
135
+ rightIcon: I,
136
+ helper: T,
137
137
  error: f,
138
- helperText: C,
139
- clearable: R,
138
+ helperText: $,
139
+ clearable: C,
140
140
  password: p,
141
- autocomplete: q
142
- } = M(a), n = L(!0), m = L(!1), D = O(), N = s(() => a.id || `text-field-${D}`), F = s(() => {
141
+ autocomplete: R
142
+ } = U(a), n = w(!0), m = w(!1), q = Q(), N = s(() => a.id || `text-field-${q}`), D = s(() => {
143
143
  if (p.value)
144
- return q.value;
145
- }), k = (e) => {
146
- m.value = !1, x(
144
+ return R.value;
145
+ }), F = (e) => {
146
+ x(
147
147
  "update:modelValue",
148
148
  e.target.value
149
149
  );
150
150
  }, j = () => {
151
+ m.value = !1;
152
+ }, P = () => {
151
153
  m.value = !0;
152
- }, P = s(() => !!(f.value || o.value.length && (o.value.length < b.value || o.value.length > y.value))), z = s(() => {
154
+ }, z = s(() => !!(f.value || o.value.length && (o.value.length < b.value || o.value.length > y.value))), H = s(() => {
153
155
  const e = [];
154
- return o.value && e.push("rds-e-textfield--filled"), P.value && e.push("rds-e-textfield--error"), d.value && e.push("rds-e-textfield--disabled"), e.join(" ");
156
+ return o.value && e.push("rds-e-textfield--filled"), z.value && e.push("rds-e-textfield--error"), d.value && e.push("rds-e-textfield--disabled"), e.join(" ");
155
157
  }), r = s(() => {
156
158
  const e = {
157
- name: I.value,
159
+ name: E.value,
158
160
  class: "",
159
161
  events: {
160
162
  click: () => {
161
163
  }
162
164
  }
163
- }, w = {
165
+ }, k = {
164
166
  left: {
165
167
  ...e
166
168
  },
167
169
  right: {
168
170
  ...e,
169
- name: T.value
171
+ name: I.value
170
172
  }
171
173
  };
172
174
  return p.value ? {
@@ -182,7 +184,7 @@ import './style/textField.css';const W = { class: "rds-e-textfield__container" }
182
184
  click: () => n.value = !n.value
183
185
  }
184
186
  }
185
- } : R.value ? {
187
+ } : C.value ? {
186
188
  left: {
187
189
  ...e
188
190
  },
@@ -194,24 +196,24 @@ import './style/textField.css';const W = { class: "rds-e-textfield__container" }
194
196
  click: () => x("update:modelValue", "")
195
197
  }
196
198
  }
197
- } : w;
199
+ } : k;
198
200
  });
199
- return U(
201
+ return A(
200
202
  p,
201
203
  (e) => n.value = !e,
202
204
  { immediate: !0 }
203
- ), (e, w) => (u(), v("div", {
204
- class: h(["rds-e-textfield", z.value])
205
+ ), (e, k) => (u(), v("div", {
206
+ class: h(["rds-e-textfield", H.value])
205
207
  }, [
206
- i("div", W, [
208
+ i("div", X, [
207
209
  _(e.$slots, "left-icon", {}, () => [
208
- r.value.left.name ? (u(), A(V, S({
210
+ r.value.left.name ? (u(), G(B, L({
209
211
  key: 0,
210
212
  class: ["rds-e-textfield__icon rds-e-textfield__icon--left", { "rds-e-textfield__icon--hidden": m.value }],
211
213
  "aria-hidden": "true"
212
- }, r.value.left, G(r.value.left.events)), null, 16, ["class"])) : g("", !0)
214
+ }, r.value.left, J(r.value.left.events)), null, 16, ["class"])) : g("", !0)
213
215
  ], !0),
214
- i("div", X, [
216
+ i("div", Y, [
215
217
  i("input", {
216
218
  id: N.value,
217
219
  type: n.value ? "text" : "password",
@@ -220,39 +222,39 @@ import './style/textField.css';const W = { class: "rds-e-textfield__container" }
220
222
  minLength: t(b),
221
223
  disabled: t(d),
222
224
  value: t(o),
223
- autocomplete: F.value,
225
+ autocomplete: D.value,
224
226
  readonly: l.readonly,
225
- onInput: k,
226
- onBlur: k,
227
- onFocus: j
228
- }, null, 40, Y),
227
+ onInput: F,
228
+ onBlur: j,
229
+ onFocus: P
230
+ }, null, 40, Z),
229
231
  i("label", {
230
232
  for: N.value,
231
233
  class: h(["rds-e-textfield__label", t(d) ? "rds-e-textfield__label--disabled" : ""])
232
- }, B(t(E)), 11, Z)
234
+ }, S(t(V)), 11, ee)
233
235
  ]),
234
- r.value.right.name || e.$slots["right-icon"] ? (u(), v("span", ee, [
236
+ r.value.right.name || e.$slots["right-icon"] ? (u(), v("span", te, [
235
237
  _(e.$slots, "right-icon", {}, () => [
236
- J(V, S({
238
+ K(B, L({
237
239
  "aria-hidden": "true",
238
240
  class: "rds-e-textfield__icon rds-e-textfield__icon--right"
239
241
  }, r.value.right, {
240
- onClick: K(r.value.right.events.click, ["stop"])
242
+ onClick: O(r.value.right.events.click, ["stop"])
241
243
  }), null, 16, ["onClick"])
242
244
  ], !0)
243
245
  ])) : g("", !0)
244
246
  ]),
245
- i("div", te, [
247
+ i("div", le, [
246
248
  _(e.$slots, "helper-text", {}, () => [
247
- (t($) || t(f)) && !t(d) ? (u(), v("span", {
249
+ (t(T) || t(f)) && !t(d) ? (u(), v("span", {
248
250
  key: 0,
249
251
  class: h(t(f) ? "rds-e-textfield__helper--error" : "")
250
- }, B(t(C)), 3)) : g("", !0)
252
+ }, S(t($)), 3)) : g("", !0)
251
253
  ], !0)
252
254
  ])
253
255
  ], 2));
254
256
  }
255
- }), se = /* @__PURE__ */ Q(le, [["__scopeId", "data-v-2a397de0"]]);
257
+ }), ie = /* @__PURE__ */ W(re, [["__scopeId", "data-v-ec322549"]]);
256
258
  export {
257
- se as default
259
+ ie as default
258
260
  };
@@ -0,0 +1,53 @@
1
+ import { defineComponent as T, toRefs as E, ref as L, onMounted as _, openBlock as y, createElementBlock as B, normalizeClass as d, createElementVNode as p, unref as i, toDisplayString as m } from "vue";
2
+ import { _ as F } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ import './style/toggle.css';const I = /* @__PURE__ */ T({
4
+ __name: "toggle",
5
+ props: {
6
+ small: { type: Boolean },
7
+ modelValue: { type: [Number, Boolean, String] },
8
+ switchType: { type: Boolean },
9
+ fullWidth: { type: Boolean },
10
+ valueLeft: {},
11
+ valueRight: {},
12
+ labelLeft: {},
13
+ labelRight: {}
14
+ },
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 = {
18
+ LEFT: "left",
19
+ RIGHT: "right"
20
+ }, a = L(t.LEFT), g = (l) => {
21
+ n("update:modelValue", l);
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) => (y(), B("div", {
26
+ class: d(["rds-e-toggle", [
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
31
+ }
32
+ ]])
33
+ }, [
34
+ p("button", {
35
+ class: d(["rds-e-toggle__tab", {
36
+ "rds-e-toggle__tab--active": a.value === t.LEFT
37
+ }]),
38
+ type: "button",
39
+ onClick: r[0] || (r[0] = (c) => (g(i(s) ? !0 : i(u)), a.value = t.LEFT))
40
+ }, m(l.labelLeft), 3),
41
+ p("button", {
42
+ class: d(["rds-e-toggle__tab", {
43
+ "rds-e-toggle__tab--active": a.value === t.RIGHT
44
+ }]),
45
+ type: "button",
46
+ onClick: r[1] || (r[1] = (c) => (g(i(s) ? !1 : i(o)), a.value = t.RIGHT))
47
+ }, m(l.labelRight), 3)
48
+ ], 2));
49
+ }
50
+ }), H = /* @__PURE__ */ F(I, [["__scopeId", "data-v-191362c2"]]);
51
+ export {
52
+ H as default
53
+ };