energy-components 2.3.1 → 2.5.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 (53) hide show
  1. package/dist/components/actionButton.es.js +31 -18
  2. package/dist/components/breadcrumbs.es.js +76 -52
  3. package/dist/components/link.es.js +63 -48
  4. package/dist/components/pagination.es.js +58 -47
  5. package/dist/components/persistentToast.es.js +34 -25
  6. package/dist/components/searchField.es.js +18 -9
  7. package/dist/components/sidedrawer.es.js +53 -40
  8. package/dist/components/style/actionButton.css +1 -1
  9. package/dist/components/style/breadcrumbs.css +1 -1
  10. package/dist/components/style/link.css +1 -1
  11. package/dist/components/style/pagination.css +1 -1
  12. package/dist/components/style/persistentToast.css +1 -1
  13. package/dist/components/style/searchField.css +1 -1
  14. package/dist/components/style/sidedrawer.css +1 -1
  15. package/dist/components/style/table.css +1 -1
  16. package/dist/components/style/toggle.css +1 -1
  17. package/dist/components/table.es.js +85 -82
  18. package/dist/components/toggle.es.js +92 -36
  19. package/dist/energy-components.css +1 -1
  20. package/dist/energy-components.es.js +4842 -4690
  21. package/dist/energy-components.umd.js +2 -2
  22. package/dist/style.css +1 -1
  23. package/dist/types/src/components/buttons/action-button/action-button.vue.d.ts +62 -0
  24. package/dist/types/src/components/content/table/table.vue.d.ts +13 -0
  25. package/dist/types/src/components/feedback/persistent-toast/persistent-toast.vue.d.ts +15 -0
  26. package/dist/types/src/components/input/search-field/search-field.vue.d.ts +15 -0
  27. package/dist/types/src/components/input/toggle/toggle.vue.d.ts +20 -0
  28. package/dist/types/src/components/layout/sidedrawer/sidedrawer.vue.d.ts +18 -3
  29. package/dist/types/src/components/navigation/breadcrumbs/breadcrumbs.vue.d.ts +30 -0
  30. package/dist/types/src/components/navigation/link/link.vue.d.ts +5 -5
  31. package/dist/types/src/components/navigation/pagination/pagination.vue.d.ts +21 -0
  32. package/dist/types/tsconfig.tsbuildinfo +1 -1
  33. package/llms/rdsaccordion-group.md +6 -0
  34. package/llms/rdsaccordion.md +6 -0
  35. package/llms/rdsaction-button.md +1 -0
  36. package/llms/rdsbadge.md +5 -0
  37. package/llms/rdsbreadcrumbs.md +2 -0
  38. package/llms/rdsdate-picker.md +6 -0
  39. package/llms/rdsdropdown.md +6 -0
  40. package/llms/rdslink.md +1 -1
  41. package/llms/rdsmodal.md +9 -0
  42. package/llms/rdspagination.md +6 -0
  43. package/llms/rdspersistent-toast.md +1 -0
  44. package/llms/rdspopover-menu.md +7 -0
  45. package/llms/rdspopover.md +7 -0
  46. package/llms/rdssearch-field.md +7 -0
  47. package/llms/rdssidebar.md +9 -0
  48. package/llms/rdssidedrawer.md +9 -0
  49. package/llms/rdstable.md +8 -1
  50. package/llms/rdstext-field.md +6 -0
  51. package/llms/rdstoggle.md +5 -0
  52. package/llms/rdstooltip.md +7 -0
  53. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
- import { defineComponent as L, toRefs as R, ref as V, computed as E, onMounted as w, openBlock as B, createElementBlock as F, normalizeClass as g, createElementVNode as m, unref as d, toDisplayString as r } from "vue";
2
- import { _ as I } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- import './style/toggle.css';const C = ["id"], G = ["id"], H = ["id"], W = /* @__PURE__ */ L({
1
+ import { defineComponent as V, toRefs as D, ref as b, computed as h, onMounted as A, openBlock as c, createElementBlock as L, normalizeClass as m, createElementVNode as E, createBlock as I, createCommentVNode as u, toDisplayString as F, nextTick as C } from "vue";
2
+ import { R as x } from "./icon-svg-CW3eQRcp.js";
3
+ import { _ as W } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
+ import './style/toggle.css';const $ = ["id", "aria-label"], N = ["id", "aria-checked", "aria-label", "tabindex"], K = { key: 1 }, M = ["id", "aria-checked", "aria-label", "tabindex"], j = { key: 1 }, q = /* @__PURE__ */ V({
4
5
  __name: "toggle",
5
6
  props: {
6
7
  small: { type: Boolean },
@@ -11,53 +12,108 @@ import './style/toggle.css';const C = ["id"], G = ["id"], H = ["id"], W = /* @__
11
12
  valueRight: {},
12
13
  labelLeft: {},
13
14
  labelRight: {},
15
+ iconLeft: {},
16
+ iconRight: {},
17
+ ariaLabelLeft: {},
18
+ ariaLabelRight: {},
19
+ ariaLabel: {},
14
20
  id: {},
15
21
  variant: {}
16
22
  },
17
23
  emits: ["update:modelValue"],
18
- setup(e, { emit: c }) {
19
- const h = e, o = c, { modelValue: u, switchType: n, valueLeft: v, valueRight: s, variant: b } = R(h), t = {
24
+ setup(a, { emit: B }) {
25
+ const t = a, s = B, { modelValue: d, switchType: g, valueLeft: R, valueRight: f, variant: G } = D(t), e = {
20
26
  LEFT: "left",
21
27
  RIGHT: "right"
22
- }, l = V(t.LEFT), T = E(() => {
23
- const a = b?.value ?? "default";
24
- return a === "navy" ? "rds-e-toggle--navy" : a === "floating" ? "rds-e-toggle--floating" : "";
25
- }), f = (a) => {
26
- o("update:modelValue", a);
28
+ }, i = b(e.LEFT), T = b(null), y = b(null), H = h(() => {
29
+ const l = G?.value ?? "default";
30
+ return l === "navy" ? "rds-e-toggle--navy" : l === "floating" ? "rds-e-toggle--floating" : "";
31
+ }), n = h(() => !(t.iconLeft || t.iconRight) ? "label" : !!(t.labelLeft || t.labelRight) ? "icon-label" : "icon"), k = h(() => t.small ? 16 : 20), z = (l) => {
32
+ s("update:modelValue", l);
33
+ }, r = async (l) => {
34
+ i.value = l, z(
35
+ l === e.LEFT ? g?.value ? !0 : R?.value : g?.value ? !1 : f?.value
36
+ ), await C(), l === e.LEFT ? T.value?.focus() : y.value?.focus();
37
+ }, S = (l) => {
38
+ if (["ArrowLeft", "ArrowRight", "Enter", " "].includes(l.key))
39
+ if (l.preventDefault(), l.key === "ArrowRight") {
40
+ const o = i.value === e.LEFT ? e.RIGHT : e.LEFT;
41
+ r(o);
42
+ } else if (l.key === "ArrowLeft") {
43
+ const o = i.value === e.RIGHT ? e.LEFT : e.RIGHT;
44
+ r(o);
45
+ } else {
46
+ const o = l.target, v = l.currentTarget.querySelectorAll(".rds-e-toggle__tab"), w = Array.from(v).indexOf(o);
47
+ r(w === 0 ? e.LEFT : w === 1 ? e.RIGHT : i.value);
48
+ }
27
49
  };
28
- return w(() => {
29
- n?.value ? (o("update:modelValue", u?.value), l.value = u?.value ? t.RIGHT : t.LEFT) : u?.value === s?.value ? (o("update:modelValue", s?.value), l.value = t.RIGHT) : (o("update:modelValue", v?.value), l.value = t.LEFT);
30
- }), (a, i) => (B(), F("div", {
31
- id: e.id,
32
- class: g(["rds-e-toggle", [
50
+ return A(() => {
51
+ !!t.iconLeft != !!t.iconRight && console.warn("[RDSToggle] iconLeft e iconRight deben proporcionarse juntos para una visualización consistente."), n.value === "icon" && !t.ariaLabel && console.warn("[RDSToggle] ariaLabel es obligatorio en modo icon-only para garantizar accesibilidad."), n.value === "icon" && !t.ariaLabelLeft && console.warn("[RDSToggle] ariaLabelLeft es obligatorio en modo icon-only para garantizar accesibilidad."), n.value === "icon" && !t.ariaLabelRight && console.warn("[RDSToggle] ariaLabelRight es obligatorio en modo icon-only para garantizar accesibilidad."), g?.value ? (s("update:modelValue", d?.value), i.value = d?.value ? e.RIGHT : e.LEFT) : d?.value === f?.value ? (s("update:modelValue", f?.value), i.value = e.RIGHT) : (s("update:modelValue", R?.value), i.value = e.LEFT);
52
+ }), (l, o) => (c(), L("div", {
53
+ id: a.id,
54
+ class: m(["rds-e-toggle", [
33
55
  {
34
- "rds-e-toggle--small-full-width": e.small && e.fullWidth,
35
- "rds-e-toggle--full-width": e.fullWidth && !e.small,
36
- "rds-e-toggle--small": e.small && !e.fullWidth,
37
- "rds-e-toggle--width": !e.small && !e.fullWidth
56
+ "rds-e-toggle--small-full-width": a.small && a.fullWidth,
57
+ "rds-e-toggle--full-width": a.fullWidth && !a.small,
58
+ "rds-e-toggle--small": a.small && !a.fullWidth,
59
+ "rds-e-toggle--width": !a.small && !a.fullWidth,
60
+ "rds-e-toggle--icon-mode": n.value === "icon"
38
61
  },
39
- T.value
40
- ]])
62
+ H.value
63
+ ]]),
64
+ role: "radiogroup",
65
+ "aria-label": a.ariaLabel,
66
+ onKeydown: S
41
67
  }, [
42
- m("button", {
43
- id: e.id ? `${e.id}-left` : void 0,
44
- class: g(["rds-e-toggle__tab", {
45
- "rds-e-toggle__tab--active": l.value === t.LEFT
68
+ E("button", {
69
+ id: a.id ? `${a.id}-left` : void 0,
70
+ ref_key: "leftBtnRef",
71
+ ref: T,
72
+ class: m(["rds-e-toggle__tab", {
73
+ "rds-e-toggle__tab--active": i.value === e.LEFT,
74
+ "rds-e-toggle__tab--icon-only": n.value === "icon"
46
75
  }]),
47
76
  type: "button",
48
- onClick: i[0] || (i[0] = (y) => (f(d(n) ? !0 : d(v)), l.value = t.LEFT))
49
- }, r(e.labelLeft), 11, G),
50
- m("button", {
51
- id: e.id ? `${e.id}-right` : void 0,
52
- class: g(["rds-e-toggle__tab", {
53
- "rds-e-toggle__tab--active": l.value === t.RIGHT
77
+ role: "radio",
78
+ "aria-checked": i.value === e.LEFT,
79
+ "aria-label": n.value === "icon" ? a.ariaLabelLeft : void 0,
80
+ tabindex: i.value === e.LEFT ? 0 : -1,
81
+ onClick: o[0] || (o[0] = (v) => r(e.LEFT))
82
+ }, [
83
+ n.value !== "label" ? (c(), I(x, {
84
+ key: 0,
85
+ class: "rds-e-toggle__tab-icon",
86
+ name: t.iconLeft ?? "replace_this_icon",
87
+ size: k.value
88
+ }, null, 8, ["name", "size"])) : u("", !0),
89
+ a.labelLeft ? (c(), L("span", K, F(a.labelLeft), 1)) : u("", !0)
90
+ ], 10, N),
91
+ E("button", {
92
+ id: a.id ? `${a.id}-right` : void 0,
93
+ ref_key: "rightBtnRef",
94
+ ref: y,
95
+ class: m(["rds-e-toggle__tab", {
96
+ "rds-e-toggle__tab--active": i.value === e.RIGHT,
97
+ "rds-e-toggle__tab--icon-only": n.value === "icon"
54
98
  }]),
55
99
  type: "button",
56
- onClick: i[1] || (i[1] = (y) => (f(d(n) ? !1 : d(s)), l.value = t.RIGHT))
57
- }, r(e.labelRight), 11, H)
58
- ], 10, C));
100
+ role: "radio",
101
+ "aria-checked": i.value === e.RIGHT,
102
+ "aria-label": n.value === "icon" ? a.ariaLabelRight : void 0,
103
+ tabindex: i.value === e.RIGHT ? 0 : -1,
104
+ onClick: o[1] || (o[1] = (v) => r(e.RIGHT))
105
+ }, [
106
+ n.value !== "label" ? (c(), I(x, {
107
+ key: 0,
108
+ class: "rds-e-toggle__tab-icon",
109
+ name: t.iconRight ?? "replace_this_icon",
110
+ size: k.value
111
+ }, null, 8, ["name", "size"])) : u("", !0),
112
+ a.labelRight ? (c(), L("span", j, F(a.labelRight), 1)) : u("", !0)
113
+ ], 10, M)
114
+ ], 42, $));
59
115
  }
60
- }), x = /* @__PURE__ */ I(W, [["__scopeId", "data-v-8469b457"]]);
116
+ }), p = /* @__PURE__ */ W(q, [["__scopeId", "data-v-4dc4c0be"]]);
61
117
  export {
62
- x as default
118
+ p as default
63
119
  };