energy-components 1.15.0 → 1.16.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,11 +1,11 @@
1
- import { defineComponent as j, toRefs as O, ref as o, computed as W, createElementBlock as h, openBlock as x, createElementVNode as l, renderSlot as w, normalizeClass as S, createCommentVNode as z, unref as R, createVNode as E, toDisplayString as $, createTextVNode as H } from "vue";
2
- import { c as I, o as P, f as T, s as A, a as F, b as X } from "./floating-ui.vue-7LKzPqHI.js";
3
- import { R as Y } from "./icon-svg-BU0OQFKH.js";
4
- import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
- import './style/tooltip.css';const G = ["id"], J = {
1
+ import { defineComponent as E, toRefs as I, ref as o, computed as S, createElementBlock as p, openBlock as f, createElementVNode as i, renderSlot as k, normalizeClass as R, createCommentVNode as $, unref as b, createVNode as P, toDisplayString as B, createTextVNode as F, nextTick as X } from "vue";
2
+ import { c as Y, o as q, f as G, s as J, a as K, b as L } from "./floating-ui.vue-7LKzPqHI.js";
3
+ import { R as Q } from "./icon-svg-BU0OQFKH.js";
4
+ import { _ as U } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
+ import './style/tooltip.css';const Z = ["id"], ee = {
6
6
  key: 0,
7
7
  class: "rds-e-tooltip__header"
8
- }, K = { class: "rds-e-tooltip__title" }, L = { class: "rds-e-tooltip__content" }, Q = /* @__PURE__ */ j({
8
+ }, te = { class: "rds-e-tooltip__title" }, oe = { class: "rds-e-tooltip__content" }, le = /* @__PURE__ */ E({
9
9
  __name: "tooltip",
10
10
  props: {
11
11
  /**
@@ -63,105 +63,142 @@ import './style/tooltip.css';const G = ["id"], J = {
63
63
  id: {
64
64
  type: String,
65
65
  default: void 0
66
+ },
67
+ /**
68
+ * <span>Suprime el tooltip para que no se muestre</span>
69
+ */
70
+ suppressed: {
71
+ type: Boolean,
72
+ default: !1
73
+ },
74
+ /**
75
+ * <span>Oculta la flecha del tooltip</span>
76
+ */
77
+ hideArrow: {
78
+ type: Boolean,
79
+ default: !1
66
80
  }
67
81
  },
68
- setup(r) {
69
- const i = r, { large: d, fullWidth: b, title: e, inverse: k } = O(i), c = o(), n = o(), p = o(), t = o(!0), f = o(""), B = W(() => ({
82
+ emits: [
83
+ /**
84
+ * Se emite cuando el tooltip se activa para mostrarse.
85
+ * @event show
86
+ */
87
+ "show",
88
+ /**
89
+ * Se emite cuando el tooltip se oculta.
90
+ * @event hide
91
+ */
92
+ "hide"
93
+ ],
94
+ setup(l, { expose: C, emit: N }) {
95
+ const s = l, r = N, { large: u, fullWidth: D, title: t, inverse: M } = I(s), m = o(), n = o(), d = o(), e = o(!0), _ = o(""), O = S(() => ({
70
96
  "rds-e-tooltip__tooltip": !0,
71
- "rds-e-tooltip__tooltip-hidden": t.value,
72
- "rds-e-tooltip__tooltip--large": d.value,
73
- "rds-e-tooltip__tooltip--inverse": k.value
74
- })), C = async () => {
75
- const { x: a, y: s, middlewareData: _, placement: v } = await I(
76
- c.value,
97
+ "rds-e-tooltip__tooltip-hidden": e.value,
98
+ "rds-e-tooltip__tooltip--large": u.value,
99
+ "rds-e-tooltip__tooltip--inverse": M.value
100
+ })), V = async () => {
101
+ const { x: a, y, middlewareData: A, placement: g } = await Y(
102
+ m.value,
77
103
  n.value,
78
104
  {
79
- placement: i.placement,
105
+ placement: s.placement,
80
106
  middleware: [
81
- P(i.offsetSpace),
82
- T(),
83
- A(),
84
- F({
85
- apply({ availableHeight: D, availableWidth: M, elements: V }) {
86
- Object.assign(V.floating.style, {
87
- maxWidth: b.value ? `${Math.max(0, M)}px` : "380px",
107
+ q(s.offsetSpace),
108
+ G(),
109
+ J(),
110
+ K({
111
+ apply({ availableHeight: T, availableWidth: W, elements: z }) {
112
+ Object.assign(z.floating.style, {
113
+ maxWidth: D.value ? `${Math.max(0, W)}px` : "380px",
88
114
  width: "max-content",
89
- maxHeight: `${Math.max(0, D)}px`
115
+ maxHeight: `${Math.max(0, T)}px`
90
116
  });
91
117
  }
92
118
  }),
93
- X({
94
- element: p.value,
95
- padding: d.value ? 16 : 8
119
+ L({
120
+ element: d.value,
121
+ padding: u.value ? 16 : 8
96
122
  })
97
123
  ]
98
124
  }
99
125
  );
100
126
  Object.assign(n.value.style, {
101
127
  left: `${a}px`,
102
- top: `${s}px`
128
+ top: `${y}px`
103
129
  });
104
- const { x: g, y } = _.arrow, N = {
130
+ const { x, y: w } = A.arrow, H = {
105
131
  left: "right",
106
132
  right: "left",
107
133
  bottom: "top",
108
134
  top: "bottom"
109
135
  };
110
- f.value = `rds-e-tooltip__tooltip-arrow--${v}`, Object.assign(p.value.style, {
111
- left: g != null ? `${g}px` : "",
112
- top: y != null ? `${y}px` : "",
136
+ _.value = `rds-e-tooltip__tooltip-arrow--${g}`, Object.assign(d.value.style, {
137
+ left: x != null ? `${x}px` : "",
138
+ top: w != null ? `${w}px` : "",
113
139
  bottom: "",
114
140
  right: "",
115
- [N[v.split("-")[0]]]: "-4px"
141
+ [H[g.split("-")[0]]]: "-4px"
116
142
  });
117
- }, u = () => {
118
- e != null && e.value || (t.value = !0);
119
- }, m = () => {
120
- t.value = !1, C();
143
+ }, v = () => {
144
+ t != null && t.value || (e.value = !0, r("hide"));
145
+ }, c = () => {
146
+ s.suppressed || (e.value = !1, r("show"), X(() => {
147
+ V();
148
+ }));
149
+ }, h = () => {
150
+ e.value || (e.value = !0, r("hide"));
151
+ }, j = () => {
152
+ h();
121
153
  };
122
- return (a, s) => (x(), h("div", {
123
- id: r.id,
154
+ return C({
155
+ show: c,
156
+ hide: h,
157
+ isOpen: S(() => !e.value)
158
+ }), (a, y) => (f(), p("div", {
159
+ id: l.id,
124
160
  class: "rds-e-tooltip"
125
161
  }, [
126
- l("div", {
162
+ i("div", {
127
163
  ref_key: "referenceRef",
128
- ref: c,
164
+ ref: m,
129
165
  class: "rds-e-tooltip__trigger",
130
- onBlur: u,
131
- onFocus: m,
132
- onMouseenter: m,
133
- onMouseleave: u
166
+ onBlur: v,
167
+ onFocus: c,
168
+ onMouseenter: c,
169
+ onMouseleave: v
134
170
  }, [
135
- w(a.$slots, "default", {}, void 0, !0)
171
+ k(a.$slots, "default", {}, void 0, !0)
136
172
  ], 544),
137
- l("div", {
173
+ i("div", {
138
174
  ref_key: "floatingRef",
139
175
  ref: n,
140
- class: S(B.value)
176
+ class: R(O.value)
141
177
  }, [
142
- R(e) ? (x(), h("div", J, [
143
- l("h3", K, $(R(e)), 1),
144
- E(Y, {
178
+ b(t) ? (f(), p("div", ee, [
179
+ i("h3", te, B(b(t)), 1),
180
+ P(Q, {
145
181
  name: "close",
146
182
  "aria-hidden": "true",
147
183
  class: "rds-e-tooltip__icon",
148
- onClick: s[0] || (s[0] = (_) => t.value = !t.value)
184
+ onClick: j
149
185
  })
150
- ])) : z("", !0),
151
- l("div", L, [
152
- w(a.$slots, "tooltip-content", {}, () => [
153
- H($(r.content), 1)
186
+ ])) : $("", !0),
187
+ i("div", oe, [
188
+ k(a.$slots, "tooltip-content", {}, () => [
189
+ F(B(l.content), 1)
154
190
  ], !0)
155
191
  ]),
156
- l("div", {
192
+ l.hideArrow ? $("", !0) : (f(), p("div", {
193
+ key: 1,
157
194
  ref_key: "arrowRef",
158
- ref: p,
159
- class: S(["rds-e-tooltip__tooltip-arrow", f.value])
160
- }, null, 2)
195
+ ref: d,
196
+ class: R(["rds-e-tooltip__tooltip-arrow", _.value])
197
+ }, null, 2))
161
198
  ], 2)
162
- ], 8, G));
199
+ ], 8, Z));
163
200
  }
164
- }), oe = /* @__PURE__ */ q(Q, [["__scopeId", "data-v-e322ca8e"]]);
201
+ }), ne = /* @__PURE__ */ U(le, [["__scopeId", "data-v-41d4edc5"]]);
165
202
  export {
166
- oe as default
203
+ ne as default
167
204
  };