energy-components 1.14.2 → 1.15.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 (113) hide show
  1. package/README.md +1 -1
  2. package/dist/components/accordion.es.js +30 -27
  3. package/dist/components/actionButton.es.js +56 -11
  4. package/dist/components/avatar.es.js +24 -16
  5. package/dist/components/breadcrumbs.es.js +37 -29
  6. package/dist/components/button.es.js +31 -22
  7. package/dist/components/card.es.js +17 -9
  8. package/dist/components/checkbox.es.js +67 -56
  9. package/dist/components/collapsable.es.js +1 -1
  10. package/dist/components/{collapsable.scss_vue_type_style_index_0_src_true_lang-DfOWp1XD.js → collapsable.scss_vue_type_style_index_0_src_true_lang-CWwaY_PV.js} +1 -1
  11. package/dist/components/directAccess.es.js +26 -18
  12. package/dist/components/dragAndDrop.es.js +1 -1
  13. package/dist/components/dropdown.es.js +27 -27
  14. package/dist/components/fileUploadItem.es.js +23 -21
  15. package/dist/components/filterChip.es.js +22 -14
  16. package/dist/components/filterTag.es.js +27 -19
  17. package/dist/components/floating-ui.vue-7LKzPqHI.js +1148 -0
  18. package/dist/components/floatingActionButton.es.js +19 -11
  19. package/dist/components/{icon-svg-DuzOdbk1.js → icon-svg-BGa9K9qG.js} +993 -745
  20. package/dist/components/iconList.es.js +1 -1
  21. package/dist/components/iconSvg.es.js +1 -1
  22. package/dist/components/index.es.js +83 -77
  23. package/dist/components/indicator.es.js +37 -29
  24. package/dist/components/infoBox.es.js +47 -39
  25. package/dist/components/link.es.js +22 -13
  26. package/dist/components/loader.es.js +22 -21
  27. package/dist/components/modal.es.js +37 -28
  28. package/dist/components/overlay.es.js +21 -11
  29. package/dist/components/pagination.es.js +164 -109
  30. package/dist/components/persistentToast.es.js +32 -24
  31. package/dist/components/popover.es.js +166 -0
  32. package/dist/components/progressBar.es.js +30 -22
  33. package/dist/components/quantitySelector.es.js +60 -48
  34. package/dist/components/radioButton.es.js +1 -1
  35. package/dist/components/selectionChip.es.js +15 -7
  36. package/dist/components/sidedrawer.es.js +1 -1
  37. package/dist/components/snackBar.es.js +131 -0
  38. package/dist/components/style/accordion.css +1 -1
  39. package/dist/components/style/actionButton.css +1 -1
  40. package/dist/components/style/avatar.css +1 -1
  41. package/dist/components/style/breadcrumbs.css +1 -1
  42. package/dist/components/style/button.css +1 -1
  43. package/dist/components/style/card.css +1 -1
  44. package/dist/components/style/checkbox.css +1 -1
  45. package/dist/components/style/directAccess.css +1 -1
  46. package/dist/components/style/fileUploadItem.css +1 -1
  47. package/dist/components/style/filterChip.css +1 -1
  48. package/dist/components/style/filterTag.css +1 -1
  49. package/dist/components/style/floatingActionButton.css +1 -1
  50. package/dist/components/style/icon-svg.css +1 -1
  51. package/dist/components/style/indicator.css +1 -1
  52. package/dist/components/style/infoBox.css +1 -1
  53. package/dist/components/style/link.css +1 -1
  54. package/dist/components/style/loader.css +1 -1
  55. package/dist/components/style/modal.css +1 -1
  56. package/dist/components/style/overlay.css +1 -1
  57. package/dist/components/style/pagination.css +1 -1
  58. package/dist/components/style/persistentToast.css +1 -1
  59. package/dist/components/style/popover.css +1 -0
  60. package/dist/components/style/progressBar.css +1 -1
  61. package/dist/components/style/quantitySelector.css +1 -1
  62. package/dist/components/style/selectionChip.css +1 -1
  63. package/dist/components/style/snackBar.css +1 -0
  64. package/dist/components/style/tabBar.css +1 -1
  65. package/dist/components/style/tag.css +1 -1
  66. package/dist/components/style/toggle.css +1 -1
  67. package/dist/components/style/tooltip.css +1 -1
  68. package/dist/components/switch.es.js +1 -1
  69. package/dist/components/tabBar.es.js +23 -15
  70. package/dist/components/tableslotedcomponent.es.js +1 -1
  71. package/dist/components/tag.es.js +31 -23
  72. package/dist/components/textArea.es.js +1 -1
  73. package/dist/components/textField.es.js +1 -1
  74. package/dist/components/toggle.es.js +20 -16
  75. package/dist/components/tooltip.es.js +71 -1019
  76. package/dist/energy-components.es.js +6847 -5846
  77. package/dist/energy-components.umd.js +2 -2
  78. package/dist/style.css +1 -1
  79. package/dist/types/src/components/buttons/action-button/action-button.vue.d.ts +47 -0
  80. package/dist/types/src/components/buttons/button/button.vue.d.ts +15 -0
  81. package/dist/types/src/components/buttons/floating-action-button/floating-action-button.vue.d.ts +15 -0
  82. package/dist/types/src/components/content/avatar/avatar.vue.d.ts +15 -0
  83. package/dist/types/src/components/content/card/card.vue.d.ts +15 -0
  84. package/dist/types/src/components/content/collapsable/collapsable.vue.d.ts +1 -1
  85. package/dist/types/src/components/content/tag/tag.vue.d.ts +15 -0
  86. package/dist/types/src/components/feedback/indicator/indicator.vue.d.ts +15 -0
  87. package/dist/types/src/components/feedback/info-box/info-box.vue.d.ts +15 -0
  88. package/dist/types/src/components/feedback/loader/loader.vue.d.ts +1 -1
  89. package/dist/types/src/components/feedback/persistent-toast/persistent-toast.vue.d.ts +15 -0
  90. package/dist/types/src/components/feedback/progress-bar/progress-bar.vue.d.ts +15 -0
  91. package/dist/types/src/components/feedback/snack-bar/snack-bar.vue.d.ts +180 -0
  92. package/dist/types/src/components/icon-svg/icon-svg.vue.d.ts +15 -0
  93. package/dist/types/src/components/index.d.ts +2 -0
  94. package/dist/types/src/components/input/checkbox/checkbox.vue.d.ts +24 -7
  95. package/dist/types/src/components/input/drag-and-drop/drag-and-drop.vue.d.ts +1 -1
  96. package/dist/types/src/components/input/file-upload-item/file-upload-item.vue.d.ts +1 -1
  97. package/dist/types/src/components/input/filter-chip/filter-chip.vue.d.ts +15 -0
  98. package/dist/types/src/components/input/filter-tag/filter-tag.vue.d.ts +15 -0
  99. package/dist/types/src/components/input/quantity-selector/quantity-selector.vue.d.ts +15 -0
  100. package/dist/types/src/components/input/selection-chip/selection-chip.vue.d.ts +15 -0
  101. package/dist/types/src/components/input/switch/switch.vue.d.ts +1 -1
  102. package/dist/types/src/components/input/toggle/toggle.vue.d.ts +4 -0
  103. package/dist/types/src/components/navigation/breadcrumbs/breadcrumbs.vue.d.ts +15 -0
  104. package/dist/types/src/components/navigation/direct-access/direct-access.vue.d.ts +15 -0
  105. package/dist/types/src/components/navigation/link/link.vue.d.ts +15 -0
  106. package/dist/types/src/components/navigation/pagination/pagination.vue.d.ts +47 -0
  107. package/dist/types/src/components/navigation/tab-bar/tab-bar.vue.d.ts +15 -0
  108. package/dist/types/src/components/overlay/modal/modal.vue.d.ts +15 -0
  109. package/dist/types/src/components/overlay/overlay/overlay.vue.d.ts +15 -0
  110. package/dist/types/src/components/overlay/popover/popover.vue.d.ts +35 -0
  111. package/dist/types/src/components/overlay/tooltip/tooltip.vue.d.ts +15 -0
  112. package/dist/types/tsconfig.tsbuildinfo +1 -1
  113. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- import { defineComponent as w, toRefs as b, computed as o, createElementBlock as f, openBlock as h, unref as n, normalizeStyle as S, normalizeClass as C, createElementVNode as a, mergeProps as B } from "vue";
1
+ import { defineComponent as w, toRefs as b, computed as o, createElementBlock as f, openBlock as h, unref as s, normalizeStyle as S, normalizeClass as C, createElementVNode as a, mergeProps as B } from "vue";
2
2
  import { _ as z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- import './style/loader.css';const F = ["aria-label"], N = ["width", "height", "viewBox"], W = ["id"], E = ["stop-color"], M = ["stop-color"], D = ["stop-color"], I = ["stop-color"], L = ["cx", "cy", "r", "stroke-width"], P = ["cx", "cy", "r", "stroke-width", "stroke"], T = /* @__PURE__ */ w({
3
+ import './style/loader.css';const F = ["id", "aria-label"], N = ["width", "height", "viewBox"], W = ["id"], E = ["stop-color"], M = ["stop-color"], D = ["stop-color"], I = ["stop-color"], L = ["cx", "cy", "r", "stroke-width"], P = ["cx", "cy", "r", "stroke-width", "stroke"], T = /* @__PURE__ */ w({
4
4
  __name: "loader",
5
5
  props: {
6
6
  /**
@@ -77,11 +77,11 @@ import './style/loader.css';const F = ["aria-label"], N = ["width", "height", "v
77
77
  setup(r) {
78
78
  const _ = r, {
79
79
  size: m,
80
- variant: p,
81
- animationType: s,
82
- strokeWidth: u,
80
+ variant: v,
81
+ animationType: n,
82
+ strokeWidth: d,
83
83
  ariaLabel: g,
84
- id: v
84
+ id: u
85
85
  } = b(_), i = {
86
86
  stop000: "#FF9C00",
87
87
  stop024: "#FF7E45",
@@ -90,12 +90,12 @@ import './style/loader.css';const F = ["aria-label"], N = ["width", "height", "v
90
90
  }, e = o(() => {
91
91
  const t = Number(m.value);
92
92
  return t < 32 ? 32 : t > 120 ? 120 : t;
93
- }), d = o(() => u.value !== void 0 && u.value > 0 ? Number(u.value) : Math.max(2, Math.round(e.value / 8))), c = o(() => (e.value - d.value) / 2), l = o(() => 2 * Math.PI * c.value), y = o(() => [
93
+ }), c = o(() => d.value !== void 0 && d.value > 0 ? Number(d.value) : Math.max(2, Math.round(e.value / 8))), p = o(() => (e.value - c.value) / 2), l = o(() => 2 * Math.PI * p.value), y = o(() => [
94
94
  "rds-e-loader",
95
- `rds-e-loader--${p.value}`,
96
- `rds-e-loader--animation-${s.value}`
95
+ `rds-e-loader--${v.value}`,
96
+ `rds-e-loader--animation-${n.value}`
97
97
  ]), x = o(() => {
98
- if (p.value === "contained") {
98
+ if (v.value === "contained") {
99
99
  const t = e.value + 48;
100
100
  return {
101
101
  width: `${t}px`,
@@ -107,12 +107,13 @@ import './style/loader.css';const F = ["aria-label"], N = ["width", "height", "v
107
107
  width: `${e.value}px`,
108
108
  height: `${e.value}px`
109
109
  };
110
- }), k = o(() => s.value === "normal" ? `${l.value * 0.75} ${l.value * 0.25}` : e.value > 70 ? `${l.value * 0.05} ${l.value * 0.95}` : `${l.value * 0.1} ${l.value * 0.9}`), $ = o(() => (s.value === "normal", 0));
110
+ }), k = o(() => n.value === "normal" ? `${l.value * 0.75} ${l.value * 0.25}` : e.value > 70 ? `${l.value * 0.05} ${l.value * 0.95}` : `${l.value * 0.1} ${l.value * 0.9}`), $ = o(() => (n.value === "normal", 0));
111
111
  return (t, j) => (h(), f("div", {
112
+ id: s(u),
112
113
  class: C(y.value),
113
114
  style: S(x.value),
114
115
  role: "progressbar",
115
- "aria-label": n(g),
116
+ "aria-label": s(g),
116
117
  "aria-busy": "true"
117
118
  }, [
118
119
  (h(), f("svg", {
@@ -124,7 +125,7 @@ import './style/loader.css';const F = ["aria-label"], N = ["width", "height", "v
124
125
  }, [
125
126
  a("defs", null, [
126
127
  a("linearGradient", {
127
- id: `rds-loader-gradient-${n(v)}`,
128
+ id: `rds-loader-gradient-${s(u)}`,
128
129
  x1: "0.1605",
129
130
  y1: "0.133",
130
131
  x2: "0.8395",
@@ -153,26 +154,26 @@ import './style/loader.css';const F = ["aria-label"], N = ["width", "height", "v
153
154
  class: "rds-e-loader__track",
154
155
  cx: e.value / 2,
155
156
  cy: e.value / 2,
156
- r: c.value,
157
- "stroke-width": d.value,
157
+ r: p.value,
158
+ "stroke-width": c.value,
158
159
  fill: "none"
159
160
  }, null, 8, L),
160
161
  a("circle", B({
161
162
  class: "rds-e-loader__arc",
162
163
  cx: e.value / 2,
163
164
  cy: e.value / 2,
164
- r: c.value,
165
- "stroke-width": d.value,
166
- stroke: `url(#rds-loader-gradient-${n(v)})`,
165
+ r: p.value,
166
+ "stroke-width": c.value,
167
+ stroke: `url(#rds-loader-gradient-${s(u)})`,
167
168
  fill: "none",
168
169
  "stroke-linecap": "round"
169
- }, n(s) === "normal" ? { "stroke-dasharray": k.value, "stroke-dashoffset": $.value } : {}, {
170
- style: n(s) === "infinite" ? { "--circumference": `${l.value}px` } : {}
170
+ }, s(n) === "normal" ? { "stroke-dasharray": k.value, "stroke-dashoffset": $.value } : {}, {
171
+ style: s(n) === "infinite" ? { "--circumference": `${l.value}px` } : {}
171
172
  }), null, 16, P)
172
173
  ], 8, N))
173
174
  ], 14, F));
174
175
  }
175
- }), O = /* @__PURE__ */ z(T, [["__scopeId", "data-v-30cf8a40"]]);
176
+ }), O = /* @__PURE__ */ z(T, [["__scopeId", "data-v-9f7a590b"]]);
176
177
  export {
177
178
  O as default
178
179
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as C, ref as v, computed as R, createBlock as u, createCommentVNode as l, openBlock as a, unref as n, withCtx as c, createVNode as k, withModifiers as g, normalizeStyle as w, createElementVNode as d, createElementBlock as p, renderSlot as i } from "vue";
2
- import x from "./overlay.es.js";
3
- import S from "./card.es.js";
4
- import { R as b } from "./icon-svg-DuzOdbk1.js";
1
+ import { defineComponent as v, ref as C, computed as R, createBlock as u, createCommentVNode as l, openBlock as a, unref as n, withCtx as c, createVNode as k, withModifiers as g, normalizeStyle as S, createElementVNode as r, createElementBlock as p, renderSlot as i } from "vue";
2
+ import w from "./overlay.es.js";
3
+ import x from "./card.es.js";
4
+ import { R as b } from "./icon-svg-BGa9K9qG.js";
5
5
  import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
6
  import './style/modal.css';const $ = { class: "rds-e-modal__container" }, B = { class: "rds-e-modal__header" }, O = { class: "rds-e-modal__header-text" }, M = {
7
7
  key: 0,
@@ -9,7 +9,7 @@ import './style/modal.css';const $ = { class: "rds-e-modal__container" }, B = {
9
9
  }, N = { class: "rds-e-modal__body" }, W = {
10
10
  key: 1,
11
11
  class: "rds-e-modal__section-spacer"
12
- }, D = { class: "rds-e-modal__footer" }, V = /* @__PURE__ */ C({
12
+ }, D = { class: "rds-e-modal__footer" }, V = /* @__PURE__ */ v({
13
13
  __name: "modal",
14
14
  props: {
15
15
  /**
@@ -48,7 +48,7 @@ import './style/modal.css';const $ = { class: "rds-e-modal__container" }, B = {
48
48
  maxWidth: {
49
49
  type: [String, Number],
50
50
  default: 820,
51
- validator: (t) => typeof t == "number" ? !0 : /^\d+(?:px|em|rem|%)$/.test(t)
51
+ validator: (e) => typeof e == "number" ? !0 : /^\d+(?:px|em|rem|%)$/.test(e)
52
52
  },
53
53
  /**
54
54
  * Ancho del modal en dispositivos de escritorio.
@@ -56,21 +56,28 @@ import './style/modal.css';const $ = { class: "rds-e-modal__container" }, B = {
56
56
  width: {
57
57
  type: [String, Number],
58
58
  default: 600,
59
- validator: (t) => typeof t == "number" ? !0 : /^\d+(?:px|em|rem|%)$/.test(t)
59
+ validator: (e) => typeof e == "number" ? !0 : /^\d+(?:px|em|rem|%)$/.test(e)
60
+ },
61
+ /**
62
+ * ID del modal para testing
63
+ */
64
+ id: {
65
+ type: String,
66
+ default: void 0
60
67
  }
61
68
  },
62
69
  emits: ["onCloseRequest", "onOpenRequest", "onToggleRequest"],
63
- setup(t, { expose: _, emit: f }) {
64
- const e = t, s = f, y = v(null), h = R(() => {
65
- const o = typeof e.maxWidth == "number" ? `${e.maxWidth}px` : e.maxWidth, r = typeof e.width == "number" ? `${e.width}px` : e.width;
70
+ setup(e, { expose: f, emit: _ }) {
71
+ const t = e, s = _, y = C(null), h = R(() => {
72
+ const o = typeof t.maxWidth == "number" ? `${t.maxWidth}px` : t.maxWidth, d = typeof t.width == "number" ? `${t.width}px` : t.width;
66
73
  return {
67
74
  "--rds-modal-max-width": o,
68
- "--rds-modal-width": r
75
+ "--rds-modal-width": d
69
76
  };
70
77
  }), m = () => {
71
- e.preventClose || s("onCloseRequest");
78
+ t.preventClose || s("onCloseRequest");
72
79
  };
73
- return _({
80
+ return f({
74
81
  /**
75
82
  * { () => void } Gestiona el clic fuera del modal.
76
83
  */
@@ -100,52 +107,54 @@ import './style/modal.css';const $ = { class: "rds-e-modal__container" }, B = {
100
107
  toggleModal: () => {
101
108
  s("onToggleRequest");
102
109
  }
103
- }), (o, r) => t.open ? (a(), u(n(x), {
110
+ }), (o, d) => e.open ? (a(), u(n(w), {
104
111
  key: 0,
112
+ id: e.id,
105
113
  ref_key: "overlay",
106
114
  ref: y,
107
115
  class: "rds-e-modal__overlay",
108
- teleport: e.teleport,
116
+ teleport: t.teleport,
109
117
  onClick: m
110
118
  }, {
111
119
  default: c(() => [
112
- k(n(S), {
120
+ k(n(x), {
121
+ id: e.id ? `${e.id}-card` : void 0,
113
122
  class: "rds-e-modal__card",
114
- style: w(h.value),
115
- onClick: r[1] || (r[1] = g(() => {
123
+ style: S(h.value),
124
+ onClick: d[1] || (d[1] = g(() => {
116
125
  }, ["stop"]))
117
126
  }, {
118
127
  default: c(() => [
119
- d("div", $, [
120
- d("div", B, [
121
- d("div", O, [
128
+ r("div", $, [
129
+ r("div", B, [
130
+ r("div", O, [
122
131
  i(o.$slots, "header", {}, void 0, !0)
123
132
  ]),
124
- e.showClose ? (a(), u(n(b), {
133
+ t.showClose ? (a(), u(n(b), {
125
134
  key: 0,
126
135
  class: "rds-e-modal__header-close",
127
136
  name: "close",
128
137
  small: "",
129
- onClick: r[0] || (r[0] = () => s("onCloseRequest"))
138
+ onClick: d[0] || (d[0] = () => s("onCloseRequest"))
130
139
  })) : l("", !0)
131
140
  ]),
132
141
  o.$slots.body ? (a(), p("span", M)) : l("", !0),
133
- d("div", N, [
142
+ r("div", N, [
134
143
  i(o.$slots, "body", {}, void 0, !0)
135
144
  ]),
136
145
  o.$slots.footer ? (a(), p("span", W)) : l("", !0),
137
- d("div", D, [
146
+ r("div", D, [
138
147
  i(o.$slots, "footer", {}, void 0, !0)
139
148
  ])
140
149
  ])
141
150
  ]),
142
151
  _: 3
143
- }, 8, ["style"])
152
+ }, 8, ["id", "style"])
144
153
  ]),
145
154
  _: 3
146
- }, 8, ["teleport"])) : l("", !0);
155
+ }, 8, ["id", "teleport"])) : l("", !0);
147
156
  }
148
- }), A = /* @__PURE__ */ q(V, [["__scopeId", "data-v-53dfc378"]]);
157
+ }), A = /* @__PURE__ */ q(V, [["__scopeId", "data-v-c9a881de"]]);
149
158
  export {
150
159
  A as default
151
160
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as s, createBlock as a, openBlock as d, Teleport as l, createElementVNode as t, mergeProps as n, renderSlot as p } from "vue";
1
+ import { defineComponent as d, createBlock as s, openBlock as a, Teleport as n, createElementVNode as o, mergeProps as l, renderSlot as i } from "vue";
2
2
  import { _ as c } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- import './style/overlay.css';const _ = { class: "rds-e-overlay__content" }, i = /* @__PURE__ */ s({
3
+ import './style/overlay.css';const p = ["id"], _ = { class: "rds-e-overlay__content" }, f = /* @__PURE__ */ d({
4
4
  __name: "overlay",
5
5
  props: {
6
6
  /**
@@ -11,21 +11,31 @@ import './style/overlay.css';const _ = { class: "rds-e-overlay__content" }, i =
11
11
  type: String,
12
12
  default: "body",
13
13
  required: !0
14
+ },
15
+ /**
16
+ * ID para testing
17
+ */
18
+ id: {
19
+ type: String,
20
+ default: void 0
14
21
  }
15
22
  },
16
- setup(o) {
17
- const r = o;
18
- return (e, m) => (d(), a(l, {
23
+ setup(e) {
24
+ const r = e;
25
+ return (t, u) => (a(), s(n, {
19
26
  to: r.teleport
20
27
  }, [
21
- t("div", n({ class: "rds-e-overlay" }, e.$attrs), [
22
- t("div", _, [
23
- p(e.$slots, "default", {}, void 0, !0)
28
+ o("div", l({
29
+ id: e.id,
30
+ class: "rds-e-overlay"
31
+ }, t.$attrs), [
32
+ o("div", _, [
33
+ i(t.$slots, "default", {}, void 0, !0)
24
34
  ])
25
- ], 16)
35
+ ], 16, p)
26
36
  ], 8, ["to"]));
27
37
  }
28
- }), v = /* @__PURE__ */ c(i, [["__scopeId", "data-v-969ad8b6"]]);
38
+ }), y = /* @__PURE__ */ c(f, [["__scopeId", "data-v-f5f6d56b"]]);
29
39
  export {
30
- v as default
40
+ y as default
31
41
  };
@@ -1,13 +1,17 @@
1
- import { defineComponent as H, toRefs as O, ref as U, computed as u, watch as z, onBeforeMount as G, createElementBlock as g, openBlock as o, createElementVNode as m, createCommentVNode as _, createBlock as k, createVNode as P, Fragment as J, renderList as K, toDisplayString as C, unref as Q } from "vue";
2
- import f from "./actionButton.es.js";
3
- import { _ as W } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- import './style/pagination.css';const X = { class: "rds-e-pagination-container rds-flex" }, Y = { class: "rds-e-pagination" }, Z = {
1
+ import { defineComponent as J, toRefs as K, ref as Q, computed as o, watch as W, onBeforeMount as X, createElementBlock as c, openBlock as r, createElementVNode as b, createCommentVNode as k, createBlock as x, createVNode as P, Fragment as Y, renderList as Z, unref as C, toDisplayString as B } from "vue";
2
+ import p from "./actionButton.es.js";
3
+ import T from "./dropdown.es.js";
4
+ import { _ as I } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
+ import './style/pagination.css';const ee = ["id"], ae = { class: "rds-e-pagination" }, le = {
5
6
  key: 0,
6
7
  class: "rds-e-pagination__item rds-e-pagination__item-elipsis"
7
- }, T = {
8
+ }, ie = {
9
+ key: 0,
10
+ class: "rds-e-pagination__dropdown"
11
+ }, te = {
8
12
  key: 0,
9
13
  class: "rds-e-pagination-leyend"
10
- }, I = /* @__PURE__ */ H({
14
+ }, ne = /* @__PURE__ */ J({
11
15
  __name: "pagination",
12
16
  props: {
13
17
  /**
@@ -81,172 +85,223 @@ import './style/pagination.css';const X = { class: "rds-e-pagination-container r
81
85
  enableEllipsis: {
82
86
  type: Boolean,
83
87
  default: !1
88
+ },
89
+ /**
90
+ * Habilita la funcionalidad de selector de paginación.
91
+ * Añade un dropdown para seleccionar la página. Cómo máximo se muestran 3 páginas en la paginación
92
+ */
93
+ enablePageDropdown: {
94
+ type: Boolean,
95
+ default: !1
96
+ },
97
+ /**
98
+ * Label para el dropdown de selección de página.
99
+ */
100
+ pageDropdownLabel: {
101
+ type: String,
102
+ default: ""
103
+ },
104
+ /**
105
+ * ID de la paginación para testing
106
+ */
107
+ id: {
108
+ type: String,
109
+ default: void 0
84
110
  }
85
111
  },
86
112
  emits: ["pageChanged", "ellipsisClicked"],
87
- setup(y, { expose: M, emit: E }) {
88
- const b = y, B = E, {
89
- itemsPerPage: p,
90
- totalItems: t,
91
- totalPages: r,
92
- hideLeyend: L,
93
- disableFirstLoad: $,
94
- enableEllipsis: S
95
- } = O(b), i = U(b.currentPage), c = u(() => typeof (t == null ? void 0 : t.value) == "number" && t.value >= 0), d = u(() => c.value && typeof (t == null ? void 0 : t.value) == "number" ? t.value <= 0 || p.value <= 0 ? 1 : Math.ceil(t.value / p.value) : typeof (r == null ? void 0 : r.value) == "number" && r.value > 0 ? r.value : (typeof (r == null ? void 0 : r.value) > "u" && typeof (t == null ? void 0 : t.value) > "u" && console.warn("[RDSPagination] Props `totalItems` o `totalPages` son requeridas."), 1)), w = u(() => c.value && !L.value && typeof (t == null ? void 0 : t.value) == "number" && t.value > 0), F = u(() => !c.value || typeof (t == null ? void 0 : t.value) != "number" || t.value === 0 ? 0 : (i.value - 1) * p.value + 1), q = u(() => {
96
- if (!c.value || typeof (t == null ? void 0 : t.value) != "number") return 0;
97
- const e = i.value * p.value;
98
- return Math.min(e, t.value);
99
- }), x = u(() => i.value === 1), N = u(() => i.value === d.value), D = u(() => {
100
- const e = [], a = d.value, l = i.value;
101
- if (!S.value) {
102
- if (a <= 3)
103
- for (let n = 1; n <= a; n++)
104
- e.push(n);
105
- else l === 1 ? e.push(1, 2, Math.min(3, a)) : l === a ? e.push(Math.max(1, a - 2), a - 1, a) : e.push(l - 1, l, l + 1);
106
- return [...new Set(e)].filter((n) => typeof n == "number" && n >= 1 && n <= a);
113
+ setup(s, { expose: L, emit: M }) {
114
+ const h = s, $ = M, {
115
+ itemsPerPage: g,
116
+ totalItems: i,
117
+ totalPages: d,
118
+ hideLeyend: E,
119
+ disableFirstLoad: V,
120
+ enableEllipsis: _,
121
+ enablePageDropdown: w,
122
+ pageDropdownLabel: S
123
+ } = K(h), t = Q(h.currentPage), m = o(() => typeof (i == null ? void 0 : i.value) == "number" && i.value >= 0), v = o(() => m.value && typeof (i == null ? void 0 : i.value) == "number" ? i.value <= 0 || g.value <= 0 ? 1 : Math.ceil(i.value / g.value) : typeof (d == null ? void 0 : d.value) == "number" && d.value > 0 ? d.value : (typeof (d == null ? void 0 : d.value) > "u" && typeof (i == null ? void 0 : i.value) > "u" && console.warn("[RDSPagination] Props `totalItems` o `totalPages` son requeridas."), 1)), F = o(() => m.value && !E.value && typeof (i == null ? void 0 : i.value) == "number" && i.value > 0), R = o(() => !m.value || typeof (i == null ? void 0 : i.value) != "number" || i.value === 0 ? 0 : (t.value - 1) * g.value + 1), q = o(() => {
124
+ if (!m.value || typeof (i == null ? void 0 : i.value) != "number") return 0;
125
+ const a = t.value * g.value;
126
+ return Math.min(a, i.value);
127
+ }), D = o(() => t.value === 1), N = o(() => t.value === v.value), j = o(() => {
128
+ const a = [], e = v.value, l = t.value;
129
+ if (!_.value || w.value) {
130
+ if (e <= 3)
131
+ for (let n = 1; n <= e; n++)
132
+ a.push(n);
133
+ else l === 1 ? a.push(1, 2, Math.min(3, e)) : l === e ? a.push(Math.max(1, e - 2), e - 1, e) : a.push(l - 1, l, l + 1);
134
+ return [...new Set(a)].filter((n) => typeof n == "number" && n >= 1 && n <= e);
107
135
  }
108
- if (a <= 5) {
109
- for (let n = 1; n <= a; n++)
110
- e.push(n);
111
- return e;
136
+ if (e <= 5) {
137
+ for (let n = 1; n <= e; n++)
138
+ a.push(n);
139
+ return a;
112
140
  }
113
- return e.push(1), l <= 3 ? (e.push(2, 3), a > 4 && e.push("ellipsis_end"), e.push(a)) : l >= a - 2 ? (a > 4 && e.push("ellipsis_start"), e.push(a - 2, a - 1, a)) : (e.push("ellipsis_start"), e.push(l - 1, l, l + 1), e.push("ellipsis_end"), e.push(a)), e.filter((n, s, h) => h.indexOf(n) === s);
114
- }), R = (e) => {
115
- const a = d.value, l = i.value, n = [];
116
- if (e === "ellipsis_start")
117
- for (let s = 2; s < l - 1; s++)
118
- n.push(s);
119
- else if (e === "ellipsis_end")
120
- for (let s = l + 2; s < a; s++)
121
- n.push(s);
141
+ return a.push(1), l <= 3 ? (a.push(2, 3), e > 4 && a.push("ellipsis_end"), a.push(e)) : l >= e - 2 ? (e > 4 && a.push("ellipsis_start"), a.push(e - 2, e - 1, e)) : (a.push("ellipsis_start"), a.push(l - 1, l, l + 1), a.push("ellipsis_end"), a.push(e)), a.filter((n, u, y) => y.indexOf(n) === u);
142
+ }), A = o(() => {
143
+ const a = v.value;
144
+ return Array.from({ length: a }, (e, l) => String(l + 1));
145
+ }), O = (a) => {
146
+ const e = v.value, l = t.value, n = [];
147
+ if (a === "ellipsis_start")
148
+ for (let u = 2; u < l - 1; u++)
149
+ n.push(u);
150
+ else if (a === "ellipsis_end")
151
+ for (let u = l + 2; u < e; u++)
152
+ n.push(u);
122
153
  return n;
123
- }, j = (e) => {
124
- const a = R(e);
125
- B("ellipsisClicked", {
126
- hiddenPages: a,
127
- ellipsisType: e,
128
- currentPage: i.value,
129
- totalPages: d.value
154
+ }, U = (a) => {
155
+ const e = O(a);
156
+ $("ellipsisClicked", {
157
+ hiddenPages: e,
158
+ ellipsisType: a,
159
+ currentPage: t.value,
160
+ totalPages: v.value
130
161
  });
131
- }, V = (e) => {
132
- let a = i.value;
133
- const l = d.value;
134
- if ("navigator" in e)
135
- switch (e.navigator) {
162
+ }, H = (a) => {
163
+ let e = t.value;
164
+ const l = v.value;
165
+ if ("navigator" in a)
166
+ switch (a.navigator) {
136
167
  case "next":
137
- i.value < l && (a = i.value + 1);
168
+ t.value < l && (e = t.value + 1);
138
169
  break;
139
170
  case "prev":
140
- i.value > 1 && (a = i.value - 1);
171
+ t.value > 1 && (e = t.value - 1);
141
172
  break;
142
173
  case "first":
143
- i.value !== 1 && (a = 1);
174
+ t.value !== 1 && (e = 1);
144
175
  break;
145
176
  case "last":
146
- i.value !== l && (a = l);
177
+ t.value !== l && (e = l);
147
178
  break;
148
179
  }
149
- else "page" in e && typeof e.page == "number" && e.page >= 1 && e.page <= l && e.page !== i.value && (a = e.page);
150
- return a !== i.value ? (i.value = a, !0) : !1;
151
- }, v = (e, a = !1) => {
152
- if (V(e) || a) {
153
- const n = p.value, s = (i.value - 1) * n;
154
- let h = s + n;
155
- c.value && typeof (t == null ? void 0 : t.value) == "number" && (h = Math.min(s + n, t.value));
156
- const A = {
157
- ...e,
158
- page: i.value,
159
- offset: s,
180
+ else "page" in a && typeof a.page == "number" && a.page >= 1 && a.page <= l && a.page !== t.value && (e = a.page);
181
+ return e !== t.value ? (t.value = e, !0) : !1;
182
+ }, f = (a, e = !1) => {
183
+ if (H(a) || e) {
184
+ const n = g.value, u = (t.value - 1) * n;
185
+ let y = u + n;
186
+ m.value && typeof (i == null ? void 0 : i.value) == "number" && (y = Math.min(u + n, i.value));
187
+ const G = {
188
+ ...a,
189
+ page: t.value,
190
+ offset: u,
160
191
  limit: n,
161
- end: h,
162
- reset: a || void 0
192
+ end: y,
193
+ reset: e || void 0
163
194
  };
164
- B("pageChanged", A);
195
+ $("pageChanged", G);
165
196
  }
197
+ }, z = (a) => {
198
+ const e = Number(a);
199
+ e !== t.value && e >= 1 && e <= v.value && f({ page: e });
166
200
  };
167
- return z(() => b.currentPage, (e) => {
168
- e !== i.value && e >= 1 && e <= d.value && (i.value = e);
169
- }), G(() => {
170
- $.value || v({ navigator: "first", page: 1 });
171
- }), M({
201
+ return W(() => h.currentPage, (a) => {
202
+ a !== t.value && a >= 1 && a <= v.value && (t.value = a);
203
+ }), X(() => {
204
+ V.value || f({ navigator: "first", page: 1 });
205
+ }), L({
172
206
  /** Resetea la paginación a la primera página y emite el evento pageChanged. */
173
207
  resetPagination: () => {
174
- i.value !== 1 && v({ page: 1 }, !0);
208
+ t.value !== 1 && f({ page: 1 }, !0);
175
209
  }
176
- }), (e, a) => (o(), g("div", X, [
177
- m("ul", Y, [
178
- m("li", null, [
179
- y.jumpTo ? (o(), k(f, {
210
+ }), (a, e) => (r(), c("div", {
211
+ id: s.id,
212
+ class: "rds-e-pagination-container rds-flex"
213
+ }, [
214
+ b("ul", ae, [
215
+ b("li", null, [
216
+ s.jumpTo ? (r(), x(p, {
180
217
  key: 0,
218
+ id: s.id ? `${s.id}-first` : void 0,
181
219
  class: "rds-e-pagination__actionBtn",
182
220
  variant: "ghost",
183
221
  small: "",
184
222
  icon: "back",
185
223
  "aria-label": "First Page",
186
- disabled: x.value,
187
- onClick: a[0] || (a[0] = (l) => v({ navigator: "first" }))
188
- }, null, 8, ["disabled"])) : _("", !0)
224
+ disabled: D.value,
225
+ onClick: e[0] || (e[0] = (l) => f({ navigator: "first" }))
226
+ }, null, 8, ["id", "disabled"])) : k("", !0)
189
227
  ]),
190
- m("li", null, [
191
- P(f, {
228
+ b("li", null, [
229
+ P(p, {
230
+ id: s.id ? `${s.id}-prev` : void 0,
192
231
  class: "rds-e-pagination__actionBtn",
193
232
  variant: "ghost",
194
233
  small: "",
195
234
  icon: "arrow_left",
196
235
  "aria-label": "Prev page",
197
- disabled: x.value,
198
- onClick: a[1] || (a[1] = (l) => v({ navigator: "prev" }))
199
- }, null, 8, ["disabled"])
236
+ disabled: D.value,
237
+ onClick: e[1] || (e[1] = (l) => f({ navigator: "prev" }))
238
+ }, null, 8, ["id", "disabled"])
200
239
  ]),
201
- (o(!0), g(J, null, K(D.value, (l) => (o(), g("li", { key: l }, [
202
- typeof l == "string" && l.includes("ellipsis") ? (o(), g("div", Z, [
203
- P(f, {
240
+ (r(!0), c(Y, null, Z(j.value, (l) => (r(), c("li", { key: l }, [
241
+ typeof l == "string" && l.includes("ellipsis") ? (r(), c("div", le, [
242
+ P(p, {
243
+ id: s.id ? `${s.id}-ellipsis-${l}` : void 0,
204
244
  variant: "ghost",
205
245
  small: "",
206
246
  text: "...",
207
247
  icon: "",
208
248
  "aria-label": "Más páginas",
209
- onClick: (n) => j(l)
210
- }, null, 8, ["onClick"])
211
- ])) : (o(), k(f, {
249
+ onClick: (n) => U(l)
250
+ }, null, 8, ["id", "onClick"])
251
+ ])) : (r(), x(p, {
212
252
  key: 1,
253
+ id: s.id ? `${s.id}-page-${l}` : void 0,
213
254
  class: "rds-e-pagination__item",
214
- variant: l === i.value && b.selected ? "primary" : "ghost",
255
+ variant: l === t.value && h.selected ? "primary" : "ghost",
215
256
  small: "",
216
257
  text: String(l),
217
258
  icon: "",
218
259
  "aria-label": `page number ${l}`,
219
- onClick: (n) => v({ page: l })
220
- }, null, 8, ["variant", "text", "aria-label", "onClick"]))
260
+ onClick: (n) => f({ page: l })
261
+ }, null, 8, ["id", "variant", "text", "aria-label", "onClick"]))
221
262
  ]))), 128)),
222
- m("li", null, [
223
- P(f, {
263
+ b("li", null, [
264
+ P(p, {
265
+ id: s.id ? `${s.id}-next` : void 0,
224
266
  class: "rds-e-pagination__actionBtn",
225
267
  variant: "ghost",
226
268
  icon: "arrow_right",
227
269
  small: "",
228
270
  "aria-label": "next page",
229
271
  disabled: N.value,
230
- onClick: a[2] || (a[2] = (l) => v({ navigator: "next" }))
231
- }, null, 8, ["disabled"])
272
+ onClick: e[2] || (e[2] = (l) => f({ navigator: "next" }))
273
+ }, null, 8, ["id", "disabled"])
232
274
  ]),
233
- m("li", null, [
234
- y.jumpTo ? (o(), k(f, {
275
+ b("li", null, [
276
+ s.jumpTo ? (r(), x(p, {
235
277
  key: 0,
278
+ id: s.id ? `${s.id}-last` : void 0,
236
279
  class: "rds-e-pagination__actionBtn",
237
280
  variant: "ghost",
238
281
  small: "",
239
282
  icon: "last",
240
283
  "aria-label": "last page",
241
284
  disabled: N.value,
242
- onClick: a[3] || (a[3] = (l) => v({ navigator: "last" }))
243
- }, null, 8, ["disabled"])) : _("", !0)
244
- ])
285
+ onClick: e[3] || (e[3] = (l) => f({ navigator: "last" }))
286
+ }, null, 8, ["id", "disabled"])) : k("", !0)
287
+ ]),
288
+ C(w) ? (r(), c("li", ie, [
289
+ P(T, {
290
+ id: "rds-dropdown-pagination",
291
+ modelValue: t.value,
292
+ "onUpdate:modelValue": e[4] || (e[4] = (l) => t.value = l),
293
+ label: C(S) ? C(S) : t.value.toString(),
294
+ options: A.value,
295
+ small: "",
296
+ "text-only": "",
297
+ onSelect: z
298
+ }, null, 8, ["modelValue", "label", "options"])
299
+ ])) : k("", !0)
245
300
  ]),
246
- w.value ? (o(), g("p", T, " Mostrando resultados " + C(F.value) + "-" + C(q.value) + " de " + C(Q(t)), 1)) : _("", !0)
247
- ]));
301
+ F.value ? (r(), c("p", te, " Mostrando resultados " + B(R.value) + "-" + B(q.value) + " de " + B(C(i)), 1)) : k("", !0)
302
+ ], 8, ee));
248
303
  }
249
- }), te = /* @__PURE__ */ W(I, [["__scopeId", "data-v-7bb8233b"]]);
304
+ }), de = /* @__PURE__ */ I(ne, [["__scopeId", "data-v-755635ef"]]);
250
305
  export {
251
- te as default
306
+ de as default
252
307
  };