energy-components 1.0.3 → 1.1.1

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 (79) hide show
  1. package/dist/components/accordion.es.js +46 -47
  2. package/dist/components/accordionGroup.es.js +12 -12
  3. package/dist/components/actionButton.es.js +2 -2
  4. package/dist/components/breadcrumbs.es.js +8 -8
  5. package/dist/components/button.es.js +16 -16
  6. package/dist/components/card.es.js +2 -2
  7. package/dist/components/checkbox.es.js +11 -11
  8. package/dist/components/datepicker.es.js +4 -4
  9. package/dist/components/divider.es.js +6 -6
  10. package/dist/components/dropdown.es.js +25 -25
  11. package/dist/components/floatingActionButton.es.js +4 -4
  12. package/dist/components/{icon-svg-7Vih8GMM.js → icon-svg-CEZ-L3iv.js} +4 -4
  13. package/dist/components/iconList.es.js +7 -7
  14. package/dist/components/iconSvg.es.js +1 -1
  15. package/dist/components/index.es.js +59 -50
  16. package/dist/components/indicator.es.js +21 -21
  17. package/dist/components/infoBox.es.js +152 -0
  18. package/dist/components/link.es.js +16 -16
  19. package/dist/components/modal.es.js +62 -37
  20. package/dist/components/overlay.es.js +4 -4
  21. package/dist/components/pagination.es.js +20 -20
  22. package/dist/components/persistentToast.es.js +130 -0
  23. package/dist/components/radio-group.vue_vue_type_script_setup_true_lang-B-kg-575.js +28 -0
  24. package/dist/components/radioButton.es.js +66 -45
  25. package/dist/components/radioGroup.es.js +1 -1
  26. package/dist/components/sidebar.es.js +104 -0
  27. package/dist/components/style/accordion.css +1 -1
  28. package/dist/components/style/accordionGroup.css +1 -1
  29. package/dist/components/style/actionButton.css +1 -1
  30. package/dist/components/style/breadcrumbs.css +1 -1
  31. package/dist/components/style/button.css +1 -1
  32. package/dist/components/style/card.css +1 -1
  33. package/dist/components/style/checkbox.css +1 -1
  34. package/dist/components/style/datepicker.css +1 -1
  35. package/dist/components/style/divider.css +1 -1
  36. package/dist/components/style/dropdown.css +1 -1
  37. package/dist/components/style/floatingActionButton.css +1 -1
  38. package/dist/components/style/icon-svg.css +1 -1
  39. package/dist/components/style/iconList.css +1 -1
  40. package/dist/components/style/indicator.css +1 -1
  41. package/dist/components/style/infoBox.css +1 -0
  42. package/dist/components/style/link.css +1 -1
  43. package/dist/components/style/modal.css +1 -1
  44. package/dist/components/style/multiselect.css +1 -1
  45. package/dist/components/style/overlay.css +1 -1
  46. package/dist/components/style/pagination.css +1 -1
  47. package/dist/components/style/persistentToast.css +1 -0
  48. package/dist/components/style/radioButton.css +1 -1
  49. package/dist/components/style/sidebar.css +1 -0
  50. package/dist/components/style/switch.css +1 -1
  51. package/dist/components/style/tabBar.css +1 -1
  52. package/dist/components/style/tag.css +1 -1
  53. package/dist/components/style/textArea.css +1 -1
  54. package/dist/components/style/textField.css +1 -1
  55. package/dist/components/style/tooltip.css +1 -1
  56. package/dist/components/switch.es.js +11 -11
  57. package/dist/components/tabBar.es.js +26 -26
  58. package/dist/components/tag.es.js +9 -9
  59. package/dist/components/textArea.es.js +14 -14
  60. package/dist/components/textField.es.js +14 -14
  61. package/dist/components/tooltip.es.js +10 -10
  62. package/dist/composables/index.es.js +37 -0
  63. package/dist/energy-components.es.js +4075 -3646
  64. package/dist/energy-components.umd.js +1 -1
  65. package/dist/style.css +1 -1
  66. package/dist/types/src/components/content/accordion/accordion.vue.d.ts +0 -2
  67. package/dist/types/src/components/feedback/info-box/info-box.vue.d.ts +134 -0
  68. package/dist/types/src/components/feedback/persistent-toast/persistent-toast.vue.d.ts +161 -0
  69. package/dist/types/src/components/index.d.ts +3 -0
  70. package/dist/types/src/components/input/radio-button/radio-button.vue.d.ts +12 -12
  71. package/dist/types/src/components/input/radio-button/radio-group.vue.d.ts +24 -14
  72. package/dist/types/src/components/layout/sidebar/sidebar.vue.d.ts +49 -0
  73. package/dist/types/src/components/overlay/modal/modal.vue.d.ts +34 -0
  74. package/dist/types/src/composables/breakpoints.d.ts +5 -0
  75. package/dist/types/src/composables/index.d.ts +1 -0
  76. package/dist/types/src/helpers/getInstance.d.ts +6 -0
  77. package/dist/types/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +7 -3
  79. package/dist/components/radio-group.vue_vue_type_script_setup_true_lang-D-Dl5aHN.js +0 -18
@@ -1,15 +1,15 @@
1
- import { defineComponent as v, ref as y, onMounted as C, openBlock as o, createBlock as m, unref as l, withCtx as p, createVNode as h, createElementVNode as t, renderSlot as d, createCommentVNode as s, createElementBlock as u } from "vue";
2
- import k from "./overlay.es.js";
3
- import B from "./card.es.js";
4
- import { I as b } from "./icon-svg-7Vih8GMM.js";
5
- import { _ as R } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
- import './style/modal.css';const S = { class: "rds-modal__container" }, $ = { class: "rds-modal__header" }, q = {
1
+ import { defineComponent as h, ref as v, computed as C, onMounted as k, openBlock as s, createBlock as u, unref as a, withCtx as p, createVNode as b, normalizeStyle as w, createElementVNode as d, renderSlot as n, createCommentVNode as l, createElementBlock as _ } from "vue";
2
+ import x from "./overlay.es.js";
3
+ import S from "./card.es.js";
4
+ import { I as $ } from "./icon-svg-CEZ-L3iv.js";
5
+ import { _ as B } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
+ import './style/modal.css';const N = { class: "rds-e-modal__container" }, R = { class: "rds-e-modal__header" }, W = {
7
7
  key: 0,
8
- class: "rds-modal__section-spacer"
9
- }, w = { class: "rds-modal__body" }, E = {
8
+ class: "rds-e-modal__section-spacer"
9
+ }, g = { class: "rds-e-modal__body" }, q = {
10
10
  key: 1,
11
- class: "rds-modal__section-spacer"
12
- }, I = { class: "rds-modal__footer" }, N = /* @__PURE__ */ v({
11
+ class: "rds-e-modal__section-spacer"
12
+ }, E = { class: "rds-e-modal__footer" }, I = /* @__PURE__ */ h({
13
13
  __name: "modal",
14
14
  props: {
15
15
  /**
@@ -42,55 +42,80 @@ import './style/modal.css';const S = { class: "rds-modal__container" }, $ = { cl
42
42
  preventClose: {
43
43
  type: Boolean,
44
44
  default: !0
45
+ },
46
+ /**
47
+ * Ancho máximo del modal en dispositivos de escritorio.
48
+ */
49
+ maxWidth: {
50
+ type: [String, Number],
51
+ default: 820,
52
+ validator: (o) => typeof o == "number" ? !0 : /^\d+(?:px|em|rem|%)$/.test(o)
53
+ },
54
+ /**
55
+ * Ancho del modal en dispositivos de escritorio.
56
+ */
57
+ width: {
58
+ type: [String, Number],
59
+ default: 600,
60
+ validator: (o) => typeof o == "number" ? !0 : /^\d+(?:px|em|rem|%)$/.test(o)
45
61
  }
46
62
  },
47
63
  emits: ["onCloseRequest"],
48
- setup(a, { emit: f }) {
49
- const r = a, n = f, c = y(null), i = () => {
50
- r.preventClose || n("onCloseRequest");
64
+ setup(o, { emit: f }) {
65
+ const t = o, i = f, m = v(null), y = C(() => {
66
+ const e = typeof t.maxWidth == "number" ? `${t.maxWidth}px` : t.maxWidth, r = typeof t.width == "number" ? `${t.width}px` : t.width;
67
+ return {
68
+ "--rds-modal-max-width": e,
69
+ "--rds-modal-width": r
70
+ };
71
+ }), c = () => {
72
+ t.preventClose || i("onCloseRequest");
51
73
  };
52
- return C(() => {
74
+ return k(() => {
53
75
  var e;
54
- (e = c.value) == null || e.addEventListener("click", i);
55
- }), (e, _) => a.open ? (o(), m(l(k), {
76
+ (e = m.value) == null || e.addEventListener("click", c);
77
+ }), (e, r) => o.open ? (s(), u(a(x), {
56
78
  key: 0,
57
79
  ref_key: "overlay",
58
- ref: c,
59
- class: "rds-modal__overlay",
60
- teleport: r.teleport,
61
- onClick: i
80
+ ref: m,
81
+ class: "rds-e-modal__overlay",
82
+ teleport: t.teleport,
83
+ onClick: c
62
84
  }, {
63
85
  default: p(() => [
64
- h(l(B), { class: "rds-modal__card" }, {
86
+ b(a(S), {
87
+ class: "rds-e-modal__card",
88
+ style: w(y.value)
89
+ }, {
65
90
  default: p(() => [
66
- t("div", S, [
67
- t("div", $, [
68
- d(e.$slots, "header", {}, void 0, !0),
69
- r.showClose ? (o(), m(l(b), {
91
+ d("div", N, [
92
+ d("div", R, [
93
+ n(e.$slots, "header", {}, void 0, !0),
94
+ t.showClose ? (s(), u(a($), {
70
95
  key: 0,
71
- class: "rds-modal__header-close",
96
+ class: "rds-e-modal__header-close",
72
97
  name: "close",
73
98
  small: "",
74
- onClick: _[0] || (_[0] = () => n("onCloseRequest"))
75
- })) : s("", !0)
99
+ onClick: r[0] || (r[0] = () => i("onCloseRequest"))
100
+ })) : l("", !0)
76
101
  ]),
77
- e.$slots.body ? (o(), u("span", q)) : s("", !0),
78
- t("div", w, [
79
- d(e.$slots, "body", {}, void 0, !0)
102
+ e.$slots.body ? (s(), _("span", W)) : l("", !0),
103
+ d("div", g, [
104
+ n(e.$slots, "body", {}, void 0, !0)
80
105
  ]),
81
- e.$slots.footer ? (o(), u("span", E)) : s("", !0),
82
- t("div", I, [
83
- d(e.$slots, "footer", {}, void 0, !0)
106
+ e.$slots.footer ? (s(), _("span", q)) : l("", !0),
107
+ d("div", E, [
108
+ n(e.$slots, "footer", {}, void 0, !0)
84
109
  ])
85
110
  ])
86
111
  ]),
87
112
  _: 3
88
- })
113
+ }, 8, ["style"])
89
114
  ]),
90
115
  _: 3
91
- }, 8, ["teleport"])) : s("", !0);
116
+ }, 8, ["teleport"])) : l("", !0);
92
117
  }
93
- }), M = /* @__PURE__ */ R(N, [["__scopeId", "data-v-d1fb90c2"]]);
118
+ }), M = /* @__PURE__ */ B(I, [["__scopeId", "data-v-a3839f6f"]]);
94
119
  export {
95
120
  M as default
96
121
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as s, openBlock as a, createBlock as d, Teleport as l, createElementVNode as t, mergeProps as n, renderSlot as p } from "vue";
2
2
  import { _ as c } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- import './style/overlay.css';const _ = { class: "rds-overlay__content" }, i = /* @__PURE__ */ s({
3
+ import './style/overlay.css';const _ = { class: "rds-e-overlay__content" }, i = /* @__PURE__ */ s({
4
4
  __name: "overlay",
5
5
  props: {
6
6
  /**
@@ -15,17 +15,17 @@ import './style/overlay.css';const _ = { class: "rds-overlay__content" }, i = /*
15
15
  },
16
16
  setup(o) {
17
17
  const r = o;
18
- return (e, f) => (a(), d(l, {
18
+ return (e, m) => (a(), d(l, {
19
19
  to: r.teleport
20
20
  }, [
21
- t("div", n({ class: "rds-overlay" }, e.$attrs), [
21
+ t("div", n({ class: "rds-e-overlay" }, e.$attrs), [
22
22
  t("div", _, [
23
23
  p(e.$slots, "default", {}, void 0, !0)
24
24
  ])
25
25
  ], 16)
26
26
  ], 8, ["to"]));
27
27
  }
28
- }), v = /* @__PURE__ */ c(i, [["__scopeId", "data-v-57d6df54"]]);
28
+ }), v = /* @__PURE__ */ c(i, [["__scopeId", "data-v-969ad8b6"]]);
29
29
  export {
30
30
  v as default
31
31
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as L, ref as v, computed as o, watchEffect as V, openBlock as t, createElementBlock as c, createElementVNode as u, createBlock as k, createCommentVNode as d, createVNode as C, Fragment as j, renderList as E, normalizeClass as T, toDisplayString as y } from "vue";
1
+ import { defineComponent as L, ref as v, computed as o, watchEffect as V, openBlock as t, createElementBlock as c, createElementVNode as u, createBlock as k, createCommentVNode as g, createVNode as C, Fragment as j, renderList as E, normalizeClass as T, toDisplayString as y } from "vue";
2
2
  import m from "./actionButton.es.js";
3
3
  import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- import './style/pagination.css';const A = { class: "rds-pagination" }, S = ["disabled", "aria-label", "onClick"], $ = {
4
+ import './style/pagination.css';const A = { class: "rds-e-pagination" }, S = ["disabled", "aria-label", "onClick"], $ = {
5
5
  key: 0,
6
- class: "rds-pagination__item rds-pagination__item-elipsis"
6
+ class: "rds-e-pagination__item rds-e-pagination__item-elipsis"
7
7
  }, z = /* @__PURE__ */ L({
8
8
  __name: "pagination",
9
9
  props: {
@@ -49,16 +49,16 @@ import './style/pagination.css';const A = { class: "rds-pagination" }, S = ["dis
49
49
  isDisabled: r === e.currentPage
50
50
  });
51
51
  return a;
52
- }), g = (a) => {
52
+ }), d = (a) => {
53
53
  a === e.totalPages - 1 ? s.value = !1 : s.value = !0;
54
54
  }, _ = o(() => e.currentPage === 1), b = o(() => e.currentPage === e.totalPages), x = () => {
55
- g(e.currentPage), i("pageChanged", 1);
55
+ d(e.currentPage), i("pageChanged", 1);
56
56
  }, w = () => {
57
- g(e.currentPage - 1), e.currentPage > 1 && i("pageChanged", e.currentPage - 1);
57
+ d(e.currentPage - 1), e.currentPage > 1 && i("pageChanged", e.currentPage - 1);
58
58
  }, D = (a) => {
59
- g(a), i("pageChanged", a);
59
+ d(a), i("pageChanged", a);
60
60
  }, F = () => {
61
- g(e.currentPage + 1), i("pageChanged", e.currentPage + 1);
61
+ d(e.currentPage + 1), i("pageChanged", e.currentPage + 1);
62
62
  }, f = () => {
63
63
  i("pageChanged", e.totalPages);
64
64
  }, I = (a) => e.currentPage === a;
@@ -68,18 +68,18 @@ import './style/pagination.css';const A = { class: "rds-pagination" }, S = ["dis
68
68
  u("li", null, [
69
69
  l.jumpTo ? (t(), k(m, {
70
70
  key: 0,
71
- class: "rds-pagination__actionBtn",
71
+ class: "rds-e-pagination__actionBtn",
72
72
  type: "secondary",
73
73
  small: "",
74
74
  icon: "back",
75
75
  "aria-label": "First Page",
76
76
  disabled: _.value,
77
77
  onClick: x
78
- }, null, 8, ["disabled"])) : d("", !0)
78
+ }, null, 8, ["disabled"])) : g("", !0)
79
79
  ]),
80
80
  u("li", null, [
81
81
  C(m, {
82
- class: "rds-pagination__actionBtn",
82
+ class: "rds-e-pagination__actionBtn",
83
83
  type: "secondary",
84
84
  small: "",
85
85
  icon: "arrow_left",
@@ -92,8 +92,8 @@ import './style/pagination.css';const A = { class: "rds-pagination" }, S = ["dis
92
92
  key: n.name
93
93
  }, [
94
94
  u("button", {
95
- class: T(["rds-pagination__item", {
96
- "rds-pagination__item--active": I(n.name) && l.selected
95
+ class: T(["rds-e-pagination__item", {
96
+ "rds-e-pagination__item--active": I(n.name) && l.selected
97
97
  }]),
98
98
  type: "button",
99
99
  disabled: n.isDisabled,
@@ -101,15 +101,15 @@ import './style/pagination.css';const A = { class: "rds-pagination" }, S = ["dis
101
101
  onClick: (M) => D(n.name)
102
102
  }, y(n.name), 11, S)
103
103
  ]))), 128)),
104
- s.value ? (t(), c("li", $, " ... ")) : d("", !0),
104
+ s.value ? (t(), c("li", $, " ... ")) : g("", !0),
105
105
  s.value ? (t(), c("li", {
106
106
  key: 1,
107
- class: "rds-pagination__item rds-pagination__item-elipsis",
107
+ class: "rds-e-pagination__item rds-e-pagination__item-elipsis",
108
108
  onClick: f
109
- }, y(l.totalPages), 1)) : d("", !0),
109
+ }, y(l.totalPages), 1)) : g("", !0),
110
110
  u("li", null, [
111
111
  C(m, {
112
- class: "rds-pagination__actionBtn",
112
+ class: "rds-e-pagination__actionBtn",
113
113
  type: "secondary",
114
114
  icon: "arrow_right",
115
115
  small: "",
@@ -121,18 +121,18 @@ import './style/pagination.css';const A = { class: "rds-pagination" }, S = ["dis
121
121
  u("li", null, [
122
122
  l.jumpTo ? (t(), k(m, {
123
123
  key: 0,
124
- class: "rds-pagination__actionBtn",
124
+ class: "rds-e-pagination__actionBtn",
125
125
  type: "secondary",
126
126
  small: "",
127
127
  icon: "last",
128
128
  "aria-label": "last page",
129
129
  disabled: b.value,
130
130
  onClick: f
131
- }, null, 8, ["disabled"])) : d("", !0)
131
+ }, null, 8, ["disabled"])) : g("", !0)
132
132
  ])
133
133
  ]));
134
134
  }
135
- }), J = /* @__PURE__ */ q(z, [["__scopeId", "data-v-165224e9"]]);
135
+ }), J = /* @__PURE__ */ q(z, [["__scopeId", "data-v-35362a0d"]]);
136
136
  export {
137
137
  J as default
138
138
  };
@@ -0,0 +1,130 @@
1
+ import { defineComponent as f, toRefs as v, computed as y, openBlock as t, createElementBlock as s, normalizeClass as g, createElementVNode as i, createVNode as a, createCommentVNode as o, toDisplayString as c, renderSlot as h } from "vue";
2
+ import { I as l } from "./icon-svg-CEZ-L3iv.js";
3
+ import { _ as k } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
+ import './style/persistentToast.css';const C = { class: "max-layout alert" }, S = {
5
+ key: 0,
6
+ class: "rds-e-persistent-toast__custom-icon-block"
7
+ }, $ = { class: "rds-e-persistent-toast__wrapper" }, b = { class: "rds-e-persistent-toast__title__wrapper" }, q = {
8
+ key: 0,
9
+ class: "rds-e-persistent-toast__title rds-mb-03"
10
+ }, w = {
11
+ key: 1,
12
+ class: "rds-e-persistent-toast__text"
13
+ }, T = {
14
+ key: 0,
15
+ class: "rds-e-persistent-toast__action-section"
16
+ }, x = /* @__PURE__ */ f({
17
+ __name: "persistent-toast",
18
+ props: {
19
+ /**
20
+ * Tipo del mensaje.
21
+ *
22
+ * Define el tipo de mensaje que se mostrará. Puede ser uno de los siguientes valores:
23
+ * - `warning`: Indica un mensaje de advertencia.
24
+ * - `success`: Indica un mensaje de éxito.
25
+ * - `error`: Indica un mensaje de error.
26
+ * - `info`: Indica un mensaje informativo.
27
+ *
28
+ * @type {string}
29
+ * @required
30
+ */
31
+ type: {
32
+ type: String,
33
+ required: !0,
34
+ validator: (e) => typeof e == "string" && ["warning", "success", "error", "info"].includes(e)
35
+ },
36
+ /**
37
+ * El contenido del mensaje.
38
+ *
39
+ * El texto principal que se mostrará en el mensaje.
40
+ *
41
+ * @type {string}
42
+ * @required
43
+ */
44
+ message: {
45
+ type: String,
46
+ required: !0
47
+ },
48
+ /**
49
+ * El título del mensaje.
50
+ *
51
+ * Un título opcional que se mostrará en la parte superior del mensaje.
52
+ *
53
+ * @type {string}
54
+ * @optional
55
+ */
56
+ title: {
57
+ type: String,
58
+ required: !1
59
+ },
60
+ /**
61
+ * El icono asociado con el mensaje.
62
+ *
63
+ * Un icono opcional que se mostrará junto al mensaje. Puede ser el nombre de un icono de una biblioteca de iconos.
64
+ *
65
+ * @type {string}
66
+ * @optional
67
+ */
68
+ icon: {
69
+ type: String,
70
+ required: !1
71
+ },
72
+ /**
73
+ * Indica si se debe mostrar el botón de cierre.
74
+ *
75
+ * Si es `true`, se mostrará un botón para cerrar el mensaje.
76
+ *
77
+ * @type {boolean}
78
+ * @optional
79
+ */
80
+ close: {
81
+ type: Boolean,
82
+ required: !1
83
+ }
84
+ },
85
+ emits: ["onCloseToastAction"],
86
+ setup(e, { emit: d }) {
87
+ const u = e, m = d, { type: r } = v(u), _ = y(
88
+ () => `rds-e-persistent-toast rds-mb-03 rds-e-persistent-toast${r.value === "success" ? "--success" : ""}${r.value === "error" ? "--error" : ""}${r.value === "warning" ? "--warning" : ""}${r.value === "info" ? "--info" : ""}`
89
+ ), p = () => {
90
+ m("onCloseToastAction");
91
+ };
92
+ return (n, B) => (t(), s("div", {
93
+ class: g(["rds-e-persistent-toast", _.value]),
94
+ role: "alert"
95
+ }, [
96
+ i("div", C, [
97
+ e.icon ? (t(), s("div", S, [
98
+ a(l, {
99
+ name: e.icon,
100
+ class: "rds-e-persistent-toast__custom-icon",
101
+ "aria-hidden": "true"
102
+ }, null, 8, ["name"])
103
+ ])) : o("", !0),
104
+ i("div", $, [
105
+ i("div", b, [
106
+ e.title ? (t(), s("div", q, c(e.title), 1)) : o("", !0),
107
+ e.message ? (t(), s("p", w, c(e.message), 1)) : o("", !0)
108
+ ]),
109
+ e.close ? (t(), s("div", {
110
+ key: 0,
111
+ class: "rds-e-persistent-toast__close-block",
112
+ onClick: p
113
+ }, [
114
+ a(l, {
115
+ name: "close",
116
+ class: "rds-e-persistent-toast__custom-icon",
117
+ "aria-hidden": "true"
118
+ })
119
+ ])) : o("", !0)
120
+ ])
121
+ ]),
122
+ n.$slots["action-section"] ? (t(), s("div", T, [
123
+ h(n.$slots, "action-section", {}, void 0, !0)
124
+ ])) : o("", !0)
125
+ ], 2));
126
+ }
127
+ }), A = /* @__PURE__ */ k(x, [["__scopeId", "data-v-51c9df5b"]]);
128
+ export {
129
+ A as default
130
+ };
@@ -0,0 +1,28 @@
1
+ import { defineComponent as l, mergeModels as u, useModel as s, provide as o, ref as n, openBlock as i, createElementBlock as p, renderSlot as m } from "vue";
2
+ const c = { class: "rds-e-radio-group" }, v = /* @__PURE__ */ l({
3
+ __name: "radio-group",
4
+ props: /* @__PURE__ */ u({
5
+ /**
6
+ * <span>Nombre del grupo de radio. Es importante usar un group-name único para cada grupo de radio.</span>
7
+ */
8
+ groupName: {
9
+ type: String,
10
+ required: !0
11
+ }
12
+ }, {
13
+ modelValue: { default: null },
14
+ modelModifiers: {}
15
+ }),
16
+ emits: ["update:modelValue"],
17
+ setup(r) {
18
+ const t = r, a = s(r, "modelValue");
19
+ o("radioGroupValue", a), o("radioGroupName", t.groupName);
20
+ const d = n(/* @__PURE__ */ new Set());
21
+ return o("validateId", (e) => d.value.has(e) ? !1 : (d.value.add(e), !0)), (e, f) => (i(), p("div", c, [
22
+ m(e.$slots, "default")
23
+ ]));
24
+ }
25
+ });
26
+ export {
27
+ v as _
28
+ };
@@ -1,21 +1,38 @@
1
- import { defineComponent as k, ref as c, inject as h, computed as g, onMounted as B, onBeforeUnmount as S, openBlock as r, createElementBlock as u, normalizeClass as a, createElementVNode as f, toDisplayString as p, createCommentVNode as m, createBlock as D } from "vue";
2
- import { I as E } from "./icon-svg-7Vih8GMM.js";
3
- import { _ as R } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- import './style/radioButton.css';const x = ["id", "value", "name", "disabled", "checked"], C = ["for"], N = /* @__PURE__ */ k({
1
+ import { getCurrentInstance as I, defineComponent as D, ref as m, computed as v, inject as r, onMounted as E, onBeforeUnmount as N, openBlock as s, createElementBlock as b, normalizeClass as t, createElementVNode as w, unref as x, toDisplayString as $, createCommentVNode as p, createBlock as G } from "vue";
2
+ import { I as L } from "./icon-svg-CEZ-L3iv.js";
3
+ import { _ as M } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
+ import './style/radioButton.css';function U(e) {
5
+ const n = I();
6
+ if (!n)
7
+ throw new Error(`[energy-components] ${e} must be called from inside a setup function`);
8
+ return n;
9
+ }
10
+ let y = 0, a = /* @__PURE__ */ new WeakMap();
11
+ function g() {
12
+ const e = U("getUid");
13
+ if (a.has(e))
14
+ return a.get(e);
15
+ const n = y++;
16
+ return a.set(e, n), n;
17
+ }
18
+ g.reset = () => {
19
+ y = 0, a = /* @__PURE__ */ new WeakMap();
20
+ };
21
+ const j = ["id", "value", "name", "disabled", "checked"], q = ["for"], F = /* @__PURE__ */ D({
5
22
  __name: "radio-button",
6
23
  props: {
7
24
  /**
8
- * <span>Opción del radio button</span>
25
+ * <span>Id del radio button</span>
9
26
  */
10
- option: {
27
+ id: {
11
28
  type: String,
12
- required: !0
29
+ required: !1
13
30
  },
14
31
  /**
15
- * <span>Nombre del grupo al que pertenece el radio button</span>
32
+ * <span>Opción del radio button</span>
16
33
  */
17
- groupName: {
18
- type: String,
34
+ option: {
35
+ type: [String, Number],
19
36
  required: !0
20
37
  },
21
38
  /**
@@ -49,54 +66,58 @@ import './style/radioButton.css';const x = ["id", "value", "name", "disabled", "
49
66
  }
50
67
  },
51
68
  setup(e) {
52
- const n = e, t = c(!1), d = c(!1), o = h("radioGroupValue");
69
+ const n = e, d = m(!1), i = m(!1), k = g(), l = v(() => n.id || `input-${k}`), o = r("radioGroupValue"), h = r("radioGroupName");
53
70
  o || console.warn("RDSRadioButton debe estar dentro de un RDSRadioGroup");
54
- const b = g(() => (o == null ? void 0 : o.value) === n.option), v = () => {
71
+ const S = r("validateId");
72
+ n.id && !S(n.id) && console.warn(
73
+ `RDSRadioButton con id ${n.id} tiene un id duplicado. Se generará un id único.`
74
+ );
75
+ const _ = v(() => (o == null ? void 0 : o.value) === n.option), B = () => {
55
76
  !n.disabled && o && (o.value = n.option);
56
- }, w = () => {
57
- d.value && (t.value = !0);
58
- }, y = () => t.value = !1, i = (s) => {
59
- s.key === "Tab" && (d.value = !0);
60
- }, l = () => {
61
- d.value = !1;
77
+ }, R = () => {
78
+ i.value && (d.value = !0);
79
+ }, C = () => d.value = !1, c = (f) => {
80
+ f.key === "Tab" && (i.value = !0);
81
+ }, u = () => {
82
+ i.value = !1;
62
83
  };
63
- return B(() => {
64
- window.addEventListener("keydown", i), window.addEventListener("mousedown", l);
65
- }), S(() => {
66
- window.removeEventListener("keydown", i), window.removeEventListener("mousedown", l);
67
- }), (s, L) => (r(), u("div", {
68
- class: a(["rds-radio__container", { "rds-radio__container--focused": t.value }])
84
+ return E(() => {
85
+ window.addEventListener("keydown", c), window.addEventListener("mousedown", u);
86
+ }), N(() => {
87
+ window.removeEventListener("keydown", c), window.removeEventListener("mousedown", u);
88
+ }), (f, K) => (s(), b("div", {
89
+ class: t(["rds-e-radio__container", { "rds-e-radio__container--focused": d.value }])
69
90
  }, [
70
- f("input", {
71
- id: e.option,
91
+ w("input", {
92
+ id: l.value,
72
93
  type: "radio",
73
94
  value: e.option,
74
- class: a(`rds-radio ${e.error ? " rds-radio--error" : ""}`),
75
- name: e.groupName,
95
+ class: t(`rds-e-radio ${e.error ? " rds-e-radio--error" : ""}`),
96
+ name: x(h),
76
97
  disabled: e.disabled,
77
- checked: b.value,
78
- onChange: v,
79
- onFocus: w,
80
- onBlur: y
81
- }, null, 42, x),
82
- f("label", {
83
- for: e.option,
84
- class: a(["rds-radio__label", { "rds-radio__label--error": e.error }])
98
+ checked: _.value,
99
+ onChange: B,
100
+ onFocus: R,
101
+ onBlur: C
102
+ }, null, 42, j),
103
+ w("label", {
104
+ for: l.value,
105
+ class: t(["rds-e-radio__label", { "rds-e-radio__label--error": e.error }])
85
106
  }, [
86
- e.label ? (r(), u("span", {
107
+ e.label ? (s(), b("span", {
87
108
  key: 0,
88
- class: a(["rds-radio__label-text", { "rds-radio__label-text--disabled": e.disabled }])
89
- }, p(e.label), 3)) : m("", !0),
90
- e.label && e.icon ? (r(), D(E, {
109
+ class: t(["rds-e-radio__label-text", { "rds-e-radio__label-text--disabled": e.disabled }])
110
+ }, $(e.label), 3)) : p("", !0),
111
+ e.label && e.icon ? (s(), G(L, {
91
112
  key: 1,
92
- class: a(["rds-radio__label-icon", { "rds-radio__label-icon--disabled": e.disabled }]),
113
+ class: t(["rds-e-radio__label-icon", { "rds-e-radio__label-icon--disabled": e.disabled }]),
93
114
  name: e.icon,
94
115
  "aria-hidden": "true"
95
- }, null, 8, ["class", "name"])) : m("", !0)
96
- ], 10, C)
116
+ }, null, 8, ["class", "name"])) : p("", !0)
117
+ ], 10, q)
97
118
  ], 2));
98
119
  }
99
- }), F = /* @__PURE__ */ R(N, [["__scopeId", "data-v-be9ee771"]]);
120
+ }), O = /* @__PURE__ */ M(F, [["__scopeId", "data-v-c8280e86"]]);
100
121
  export {
101
- F as default
122
+ O as default
102
123
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./radio-group.vue_vue_type_script_setup_true_lang-D-Dl5aHN.js";
1
+ import { _ as f } from "./radio-group.vue_vue_type_script_setup_true_lang-B-kg-575.js";
2
2
  export {
3
3
  f as default
4
4
  };