@robosophy/ui-vue 1.0.10 → 1.0.12

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.
package/dist/index.js CHANGED
@@ -1,85 +1,126 @@
1
1
  // AUTO-GENERATED FILE. DO NOT EDIT MANUALLY.
2
2
  import "./index.css";
3
- import { defineComponent as ae, computed as d, openBlock as s, createElementBlock as i, normalizeStyle as te, normalizeClass as A, toDisplayString as m, ref as C, onMounted as oe, onBeforeUnmount as re, watch as Q, nextTick as ie, createVNode as M, unref as v, withModifiers as F, withCtx as H, renderSlot as y, createElementVNode as o, createBlock as k, Teleport as ce, createCommentVNode as b, Fragment as O, renderList as W, mergeProps as ne, createTextVNode as ue } from "vue";
4
- import D from "primevue/button";
5
- import de from "primevue/menu";
6
- const ve = ["aria-hidden", "aria-label", "role"], h = /* @__PURE__ */ ae({
7
- name: "RsIcon",
3
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, normalizeClass, toDisplayString, ref, onMounted, onBeforeUnmount, watch, nextTick, createVNode, unref, withModifiers, withCtx, renderSlot, createElementVNode, createBlock, Teleport, createCommentVNode, Fragment, renderList, mergeProps, createTextVNode } from "vue";
4
+ import Button from "primevue/button";
5
+ import Menu from "primevue/menu";
6
+ const _hoisted_1$2 = ["aria-hidden", "aria-label", "role"];
7
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
8
+ ...{
9
+ name: "RsIcon"
10
+ },
8
11
  __name: "RsIcon",
9
12
  props: {
10
13
  name: {},
11
14
  family: { default: "outlined" },
12
15
  size: { default: "md" },
13
16
  color: { default: "inherit" },
14
- fill: { type: Boolean, default: !1 },
17
+ fill: { type: Boolean, default: false },
15
18
  weight: { default: 400 },
16
19
  grade: { default: 0 },
17
20
  opticalSize: {},
18
- interactive: { type: Boolean, default: !1 },
21
+ interactive: { type: Boolean, default: false },
19
22
  ariaLabel: {}
20
23
  },
21
- setup(e) {
22
- const c = e, l = d(() => [
24
+ setup(__props) {
25
+ const props = __props;
26
+ const rootClass = computed(() => [
23
27
  "rs-icon",
24
- `rs-icon--${c.family}`,
25
- `rs-icon--${c.color}`,
28
+ `rs-icon--${props.family}`,
29
+ `rs-icon--${props.color}`,
26
30
  {
27
- "rs-icon--interactive": c.interactive,
28
- "rs-icon--sm": c.size === "sm",
29
- "rs-icon--md": c.size === "md",
30
- "rs-icon--lg": c.size === "lg"
31
+ "rs-icon--interactive": props.interactive,
32
+ "rs-icon--sm": props.size === "sm",
33
+ "rs-icon--md": props.size === "md",
34
+ "rs-icon--lg": props.size === "lg"
31
35
  }
32
- ]), _ = d(() => ({
33
- "--rs-icon-fill": c.fill ? 1 : 0,
34
- "--rs-icon-grade": c.grade,
35
- "--rs-icon-optical-size": c.opticalSize,
36
- "--rs-icon-size": typeof c.size == "number" ? `${c.size}px` : void 0,
37
- "--rs-icon-weight": c.weight
38
- })), w = d(() => c.ariaLabel ? void 0 : "true"), u = d(() => c.ariaLabel ? "img" : void 0);
39
- return (f, z) => (s(), i("span", {
40
- "aria-hidden": w.value,
41
- "aria-label": e.ariaLabel,
42
- class: A(l.value),
43
- role: u.value,
44
- style: te(_.value)
45
- }, m(e.name), 15, ve));
36
+ ]);
37
+ const rootStyle = computed(() => ({
38
+ "--rs-icon-fill": props.fill ? 1 : 0,
39
+ "--rs-icon-grade": props.grade,
40
+ "--rs-icon-optical-size": props.opticalSize,
41
+ "--rs-icon-size": typeof props.size === "number" ? `${props.size}px` : void 0,
42
+ "--rs-icon-weight": props.weight
43
+ }));
44
+ const ariaHidden = computed(() => props.ariaLabel ? void 0 : "true");
45
+ const role = computed(() => props.ariaLabel ? "img" : void 0);
46
+ return (_ctx, _cache) => {
47
+ return openBlock(), createElementBlock("span", {
48
+ "aria-hidden": ariaHidden.value,
49
+ "aria-label": __props.ariaLabel,
50
+ class: normalizeClass(rootClass.value),
51
+ role: role.value,
52
+ style: normalizeStyle(rootStyle.value)
53
+ }, toDisplayString(__props.name), 15, _hoisted_1$2);
54
+ };
46
55
  }
47
- }), _e = /^[a-z0-9_]+$/;
48
- function it(e, c = {}) {
49
- const l = c.family ?? "outlined", _ = e.trim();
50
- if (!_e.test(_))
51
- throw new Error(`Invalid Material Symbols icon name: "${e}"`);
52
- return `rs-icon rs-icon--prime rs-icon--${l} rs-icon-${_}`;
56
+ });
57
+ const iconNamePattern = /^[a-z0-9_]+$/;
58
+ function rsPrimeIcon(name, options = {}) {
59
+ const family = options.family ?? "outlined";
60
+ const normalizedName = name.trim();
61
+ if (!iconNamePattern.test(normalizedName)) {
62
+ throw new Error(`Invalid Material Symbols icon name: "${name}"`);
63
+ }
64
+ return `rs-icon rs-icon--prime rs-icon--${family} rs-icon-${normalizedName}`;
53
65
  }
54
- const fe = { class: "rs-account-selector__trigger-avatar" }, me = ["src", "alt"], be = {
66
+ const _hoisted_1$1 = { class: "rs-account-selector__trigger-avatar" };
67
+ const _hoisted_2$1 = ["src", "alt"];
68
+ const _hoisted_3$1 = {
55
69
  key: 1,
56
70
  class: "rs-account-selector__avatar-placeholder",
57
71
  "aria-hidden": "true"
58
- }, he = ["aria-busy"], pe = { class: "rs-account-selector__summary" }, ge = { class: "rs-account-selector__avatar-stack" }, ye = { class: "rs-account-selector__avatar rs-account-selector__avatar--lg" }, ke = ["src", "alt"], $e = {
72
+ };
73
+ const _hoisted_4$1 = ["aria-busy"];
74
+ const _hoisted_5$1 = { class: "rs-account-selector__summary" };
75
+ const _hoisted_6$1 = { class: "rs-account-selector__avatar-stack" };
76
+ const _hoisted_7$1 = { class: "rs-account-selector__avatar rs-account-selector__avatar--lg" };
77
+ const _hoisted_8$1 = ["src", "alt"];
78
+ const _hoisted_9$1 = {
59
79
  key: 1,
60
80
  class: "rs-account-selector__avatar-placeholder",
61
81
  "aria-hidden": "true"
62
- }, we = {
82
+ };
83
+ const _hoisted_10$1 = {
63
84
  key: 0,
64
85
  class: "rs-account-selector__avatar rs-account-selector__avatar--lg rs-account-selector__secondary-avatar"
65
- }, Se = ["src", "alt"], xe = { class: "rs-account-selector__user" }, Ce = { class: "rs-account-selector__title" }, Ae = {
86
+ };
87
+ const _hoisted_11$1 = ["src", "alt"];
88
+ const _hoisted_12$1 = { class: "rs-account-selector__user" };
89
+ const _hoisted_13$1 = { class: "rs-account-selector__title" };
90
+ const _hoisted_14$1 = {
66
91
  key: 0,
67
92
  class: "rs-account-selector__name"
68
- }, ze = { class: "rs-account-selector__email" }, Re = { class: "rs-account-selector__actions" }, Be = {
93
+ };
94
+ const _hoisted_15$1 = { class: "rs-account-selector__email" };
95
+ const _hoisted_16 = { class: "rs-account-selector__actions" };
96
+ const _hoisted_17 = {
69
97
  key: 0,
70
98
  class: "rs-account-selector__state"
71
- }, Me = { class: "rs-account-selector__state" }, Le = {
99
+ };
100
+ const _hoisted_18 = { class: "rs-account-selector__state" };
101
+ const _hoisted_19 = {
72
102
  key: 2,
73
103
  class: "rs-account-selector__accounts"
74
- }, Ve = { class: "rs-account-selector__avatar rs-account-selector__avatar--sm rs-account-selector__account-avatar" }, Ee = ["src", "alt"], Ie = {
104
+ };
105
+ const _hoisted_20 = { class: "rs-account-selector__avatar rs-account-selector__avatar--sm rs-account-selector__account-avatar" };
106
+ const _hoisted_21 = ["src", "alt"];
107
+ const _hoisted_22 = {
75
108
  key: 1,
76
109
  class: "rs-account-selector__avatar-placeholder",
77
110
  "aria-hidden": "true"
78
- }, Pe = { class: "rs-account-selector__account-info" }, Oe = { class: "rs-account-selector__account-label" }, Te = { class: "rs-account-selector__account-trailing" }, Ne = {
111
+ };
112
+ const _hoisted_23 = { class: "rs-account-selector__account-info" };
113
+ const _hoisted_24 = { class: "rs-account-selector__account-label" };
114
+ const _hoisted_25 = { class: "rs-account-selector__account-trailing" };
115
+ const _hoisted_26 = {
79
116
  key: 0,
80
117
  class: "rs-account-selector__footer"
81
- }, Fe = { class: "rs-account-selector__button-content" }, He = /* @__PURE__ */ ae({
82
- name: "RsAccountSelector",
118
+ };
119
+ const _hoisted_27 = { class: "rs-account-selector__button-content" };
120
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
121
+ ...{
122
+ name: "RsAccountSelector"
123
+ },
83
124
  __name: "RsAccountSelector",
84
125
  props: {
85
126
  user: {},
@@ -88,7 +129,7 @@ const fe = { class: "rs-account-selector__trigger-avatar" }, me = ["src", "alt"]
88
129
  footerActions: { default: () => [] },
89
130
  modelValue: { type: [Boolean, null], default: null },
90
131
  title: {},
91
- loading: { type: Boolean, default: !1 },
132
+ loading: { type: Boolean, default: false },
92
133
  emptyText: { default: "No hay cuentas disponibles" },
93
134
  activeText: { default: "Activo en pantalla" },
94
135
  selectText: { default: "Ingresar" },
@@ -96,526 +137,694 @@ const fe = { class: "rs-account-selector__trigger-avatar" }, me = ["src", "alt"]
96
137
  width: { default: "270px" }
97
138
  },
98
139
  emits: ["select-account", "action", "footer-action", "update:modelValue", "open", "close"],
99
- setup(e, { emit: c }) {
100
- const l = e, _ = c, w = C(null), u = C(null), f = C(!1), z = C("right"), U = C({});
101
- let S = null;
102
- const q = d(() => l.modelValue !== null), p = d(
103
- () => q.value ? !!l.modelValue : f.value
104
- ), T = d(() => ({
105
- "--rs-account-selector-width": l.width
106
- })), X = d(() => l.title ? l.title : l.accounts.length > 1 ? `Acceso a ${l.accounts.length} Cuentas` : "Acceso a"), N = d(
107
- () => l.actions.filter((a) => a.visible !== !1)
108
- ), $ = d(
109
- () => l.footerActions.filter((a) => a.visible !== !1)
110
- ), Y = d(() => l.accounts.length > 1), L = {
140
+ setup(__props, { emit: __emit }) {
141
+ const props = __props;
142
+ const emit = __emit;
143
+ const rootRef = ref(null);
144
+ const panelRef = ref(null);
145
+ const internalOpen = ref(false);
146
+ const panelCSSVars = {
147
+ "--rs-account-selector-width": props.width,
148
+ "--rs-account-selector-background": "var(--rs-color-surface-primary, #ffffff)",
149
+ "--rs-account-selector-border": "var(--rs-color-stroke-default, #d1d1d1)",
150
+ "--rs-account-selector-color": "var(--rs-color-text-primary, #000000)",
151
+ "--rs-account-selector-muted": "var(--rs-color-text-secondary, #909090)",
152
+ "--rs-account-selector-active": "var(--rs-color-text-brand-green, #4eae01)",
153
+ "--rs-account-selector-danger": "var(--rs-color-text-brand-red, #d80115)"
154
+ };
155
+ const panelPosition = ref({});
156
+ let scrollRAF = null;
157
+ const isControlled = computed(() => props.modelValue !== null);
158
+ const isOpen = computed(
159
+ () => isControlled.value ? Boolean(props.modelValue) : internalOpen.value
160
+ );
161
+ const rootStyle = computed(() => ({
162
+ "--rs-account-selector-width": props.width
163
+ }));
164
+ const computedTitle = computed(() => {
165
+ if (props.title) {
166
+ return props.title;
167
+ }
168
+ return props.accounts.length > 1 ? `Acceso a ${props.accounts.length} Cuentas` : "Acceso a";
169
+ });
170
+ const visibleActions = computed(
171
+ () => props.actions.filter((action) => action.visible !== false)
172
+ );
173
+ const visibleFooterActions = computed(
174
+ () => props.footerActions.filter((action) => action.visible !== false)
175
+ );
176
+ const shouldShowAccounts = computed(() => props.accounts.length > 1);
177
+ const profileAction = {
111
178
  id: "profile",
112
179
  label: "Ver mi perfil"
113
180
  };
114
- function Z(a) {
115
- return a.variant === "danger" ? { severity: "danger", outlined: !0, rounded: !0 } : { severity: "secondary", outlined: !0, rounded: !0 };
181
+ function headerButtonProps(action) {
182
+ return action.variant === "danger" ? { severity: "danger", outlined: true, rounded: true } : { severity: "secondary", outlined: true, rounded: true };
116
183
  }
117
- function V(a) {
118
- return a.variant === "danger" ? { severity: "danger", text: !0 } : { severity: "secondary", text: !0 };
184
+ function footerButtonProps(action) {
185
+ return action.variant === "danger" ? { severity: "danger", text: true } : { severity: "secondary", text: true };
119
186
  }
120
- function E(a) {
121
- a.disabled || (_("action", a), P());
187
+ function emitAction(action) {
188
+ if (!action.disabled) {
189
+ emit("action", action);
190
+ closeSelector();
191
+ }
122
192
  }
123
- function j(a) {
124
- a.disabled || (_("footer-action", a), P());
193
+ function emitFooterAction(action) {
194
+ if (!action.disabled) {
195
+ emit("footer-action", action);
196
+ closeSelector();
197
+ }
125
198
  }
126
- function G(a) {
127
- !a.active && !a.disabled && (_("select-account", a), P());
199
+ function selectAccount(account) {
200
+ if (!account.active && !account.disabled) {
201
+ emit("select-account", account);
202
+ closeSelector();
203
+ }
128
204
  }
129
- function R(a) {
130
- return (a?.trim() || "?").slice(0, 3);
205
+ function getInitials(initials) {
206
+ return (initials?.trim() || "?").slice(0, 3);
131
207
  }
132
- function I(a) {
133
- q.value || (f.value = a), _("update:modelValue", a), _(a ? "open" : "close");
208
+ function setOpen(nextOpen) {
209
+ if (!isControlled.value) {
210
+ internalOpen.value = nextOpen;
211
+ }
212
+ emit("update:modelValue", nextOpen);
213
+ if (nextOpen) {
214
+ emit("open");
215
+ } else {
216
+ emit("close");
217
+ }
134
218
  }
135
- function ee() {
136
- I(!p.value);
219
+ function toggleSelector() {
220
+ setOpen(!isOpen.value);
137
221
  }
138
- function P() {
139
- p.value && I(!1);
222
+ function closeSelector() {
223
+ if (isOpen.value) {
224
+ setOpen(false);
225
+ }
140
226
  }
141
- function B() {
142
- const a = w.value, g = u.value;
143
- if (!a || !g)
227
+ function updatePanelPosition() {
228
+ const root = rootRef.value;
229
+ const panel = panelRef.value;
230
+ if (!root || !panel) {
144
231
  return;
145
- const n = window.innerWidth, J = 16, K = a.getBoundingClientRect(), se = g.getBoundingClientRect(), le = K.left + se.width <= n - J;
146
- z.value = le ? "left" : "right", U.value = {
232
+ }
233
+ const viewportWidth = window.innerWidth;
234
+ const viewportPadding = 16;
235
+ const rootRect = root.getBoundingClientRect();
236
+ const panelRect = panel.getBoundingClientRect();
237
+ const fitsRight = rootRect.left + panelRect.width <= viewportWidth - viewportPadding;
238
+ const fitsLeft = rootRect.right - panelRect.width >= viewportPadding;
239
+ let left;
240
+ if (fitsRight) {
241
+ left = rootRect.left;
242
+ } else if (fitsLeft) {
243
+ left = rootRect.right - panelRect.width;
244
+ } else {
245
+ left = Math.max(
246
+ viewportPadding,
247
+ Math.min(rootRect.left, viewportWidth - viewportPadding - panelRect.width)
248
+ );
249
+ }
250
+ panelPosition.value = {
147
251
  position: "fixed",
148
- top: `${K.bottom + 8}px`,
149
- left: le ? `${K.left}px` : `${K.right - se.width}px`,
150
- "--rs-account-selector-width": l.width
252
+ top: `${rootRect.bottom + 8}px`,
253
+ left: `${left}px`
151
254
  };
152
255
  }
153
- function t() {
154
- p.value && B();
256
+ function handleWindowResize() {
257
+ if (isOpen.value) {
258
+ void updatePanelPosition();
259
+ }
155
260
  }
156
- function x() {
157
- p.value && S === null && (S = window.requestAnimationFrame(() => {
158
- S = null, B();
159
- }));
261
+ function handleScroll() {
262
+ if (isOpen.value) {
263
+ if (scrollRAF === null) {
264
+ scrollRAF = window.requestAnimationFrame(() => {
265
+ scrollRAF = null;
266
+ void updatePanelPosition();
267
+ });
268
+ }
269
+ }
160
270
  }
161
- function r(a) {
162
- const g = a.target;
163
- g instanceof Node && w.value && !w.value.contains(g) && !u.value?.contains(g) && P();
271
+ function handleDocumentPointerDown(event) {
272
+ const target = event.target;
273
+ if (target instanceof Node && rootRef.value && !rootRef.value.contains(target) && !panelRef.value?.contains(target)) {
274
+ closeSelector();
275
+ }
164
276
  }
165
- return oe(() => {
166
- document.addEventListener("pointerdown", r), window.addEventListener("resize", t), window.addEventListener("scroll", x, { passive: !0 }), p.value && B();
167
- }), re(() => {
168
- document.removeEventListener("pointerdown", r), window.removeEventListener("resize", t), window.removeEventListener("scroll", x), S !== null && cancelAnimationFrame(S);
169
- }), Q(p, (a) => {
170
- a && ie().then(B);
171
- }), (a, g) => (s(), i("div", {
172
- ref_key: "rootRef",
173
- ref: w,
174
- class: "rs-account-selector-host",
175
- style: te(T.value)
176
- }, [
177
- M(v(D), {
178
- "aria-expanded": p.value,
179
- "aria-label": e.triggerAriaLabel,
180
- "aria-haspopup": "menu",
181
- class: A([
182
- "rs-account-selector__trigger",
183
- { "rs-account-selector__trigger--open": p.value }
184
- ]),
185
- text: "",
186
- onClick: F(ee, ["stop"])
187
- }, {
188
- default: H(() => [
189
- M(v(h), {
190
- class: "rs-account-selector__trigger-chevron",
191
- family: "rounded",
192
- name: "arrow_drop_down",
193
- size: 22
194
- }),
195
- y(a.$slots, "trigger-avatar", { user: e.user }, () => [
196
- o("span", fe, [
197
- e.user.avatarSrc ? (s(), i("img", {
198
- key: 0,
199
- class: "rs-account-selector__avatar-image",
200
- src: e.user.avatarSrc,
201
- alt: e.user.name || e.user.email
202
- }, null, 8, me)) : (s(), i("span", be, m(R(e.user.initials)), 1))
203
- ])
204
- ])
205
- ]),
206
- _: 3
207
- }, 8, ["aria-expanded", "aria-label", "class"]),
208
- p.value ? (s(), k(ce, {
209
- key: 0,
210
- to: "body"
277
+ onMounted(() => {
278
+ document.addEventListener("pointerdown", handleDocumentPointerDown);
279
+ window.addEventListener("resize", handleWindowResize);
280
+ window.addEventListener("scroll", handleScroll, { passive: true });
281
+ if (isOpen.value) {
282
+ void updatePanelPosition();
283
+ }
284
+ });
285
+ onBeforeUnmount(() => {
286
+ document.removeEventListener("pointerdown", handleDocumentPointerDown);
287
+ window.removeEventListener("resize", handleWindowResize);
288
+ window.removeEventListener("scroll", handleScroll);
289
+ if (scrollRAF !== null) {
290
+ cancelAnimationFrame(scrollRAF);
291
+ }
292
+ });
293
+ watch(isOpen, (open) => {
294
+ if (open) {
295
+ void nextTick().then(updatePanelPosition);
296
+ }
297
+ });
298
+ return (_ctx, _cache) => {
299
+ return openBlock(), createElementBlock("div", {
300
+ ref_key: "rootRef",
301
+ ref: rootRef,
302
+ class: "rs-account-selector-host",
303
+ style: normalizeStyle(rootStyle.value)
211
304
  }, [
212
- o("section", {
213
- ref_key: "panelRef",
214
- ref: u,
215
- "aria-busy": e.loading || void 0,
216
- class: A([
217
- "rs-account-selector",
218
- `rs-account-selector--align-${z.value}`
305
+ createVNode(unref(Button), {
306
+ "aria-expanded": isOpen.value,
307
+ "aria-label": __props.triggerAriaLabel,
308
+ "aria-haspopup": "menu",
309
+ class: normalizeClass([
310
+ "rs-account-selector__trigger",
311
+ { "rs-account-selector__trigger--open": isOpen.value }
219
312
  ]),
220
- style: te(U.value)
221
- }, [
222
- o("header", pe, [
223
- y(a.$slots, "user-avatar", { user: e.user }, () => [
224
- o("span", ge, [
225
- o("span", ye, [
226
- e.user.avatarSrc ? (s(), i("img", {
227
- key: 0,
228
- class: "rs-account-selector__avatar-image",
229
- src: e.user.avatarSrc,
230
- alt: e.user.name || e.user.email
231
- }, null, 8, ke)) : (s(), i("span", $e, m(R(e.user.initials)), 1))
232
- ]),
233
- e.user.secondaryAvatarSrc ? (s(), i("span", we, [
234
- o("img", {
235
- class: "rs-account-selector__avatar-image",
236
- src: e.user.secondaryAvatarSrc,
237
- alt: e.user.name || e.user.email
238
- }, null, 8, Se)
239
- ])) : b("", !0)
240
- ])
241
- ]),
242
- o("div", xe, [
243
- o("p", Ce, m(X.value), 1),
244
- e.user.name ? (s(), i("p", Ae, m(e.user.name), 1)) : b("", !0),
245
- o("p", ze, m(e.user.email), 1)
246
- ]),
247
- y(a.$slots, "actions", { actions: N.value }, () => [
248
- o("div", Re, [
249
- N.value.length > 0 ? (s(!0), i(O, { key: 0 }, W(N.value, (n) => (s(), k(v(D), ne({
250
- key: n.id,
251
- class: "rs-account-selector__button",
252
- disabled: n.disabled,
253
- size: "small"
254
- }, { ref_for: !0 }, Z(n), {
255
- onClick: F((J) => E(n), ["stop"])
256
- }), {
257
- default: H(() => [
258
- o("span", null, m(n.label), 1),
259
- n.icon ? (s(), k(v(h), {
260
- key: 0,
261
- name: n.icon,
262
- size: "sm"
263
- }, null, 8, ["name"])) : b("", !0)
264
- ]),
265
- _: 2
266
- }, 1040, ["disabled", "onClick"]))), 128)) : (s(), k(v(D), {
267
- key: 1,
268
- class: "rs-account-selector__button rs-account-selector__profile-button",
269
- severity: "secondary",
270
- outlined: "",
271
- rounded: "",
272
- size: "small",
273
- onClick: g[0] || (g[0] = F((n) => E(L), ["stop"]))
274
- }, {
275
- default: H(() => [...g[1] || (g[1] = [
276
- ue(" Ver mi perfil ", -1)
277
- ])]),
278
- _: 1
279
- }))
313
+ text: "",
314
+ onClick: withModifiers(toggleSelector, ["stop"])
315
+ }, {
316
+ default: withCtx(() => [
317
+ createVNode(unref(_sfc_main$2), {
318
+ class: "rs-account-selector__trigger-chevron",
319
+ family: "rounded",
320
+ name: "arrow_drop_down",
321
+ size: 22
322
+ }),
323
+ renderSlot(_ctx.$slots, "trigger-avatar", { user: __props.user }, () => [
324
+ createElementVNode("span", _hoisted_1$1, [
325
+ __props.user.avatarSrc ? (openBlock(), createElementBlock("img", {
326
+ key: 0,
327
+ class: "rs-account-selector__avatar-image",
328
+ src: __props.user.avatarSrc,
329
+ alt: __props.user.name || __props.user.email
330
+ }, null, 8, _hoisted_2$1)) : (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(getInitials(__props.user.initials)), 1))
280
331
  ])
281
332
  ])
282
333
  ]),
283
- e.loading ? (s(), i("p", Be, " Cargando cuentas... ")) : e.accounts.length === 0 ? y(a.$slots, "empty", { key: 1 }, () => [
284
- o("p", Me, m(e.emptyText), 1)
285
- ]) : Y.value ? (s(), i("div", Le, [
286
- (s(!0), i(O, null, W(e.accounts, (n) => (s(), k(v(D), {
287
- key: n.id,
288
- class: A([
289
- "rs-account-selector__account",
290
- {
291
- "rs-account-selector__account--active": n.active,
292
- "rs-account-selector__account--disabled": n.disabled
293
- }
294
- ]),
295
- disabled: n.active || n.disabled,
296
- text: "",
297
- severity: "secondary",
298
- onClick: F((J) => G(n), ["stop"])
299
- }, {
300
- default: H(() => [
301
- y(a.$slots, "account-avatar", { account: n }, () => [
302
- o("span", Ve, [
303
- n.avatarSrc ? (s(), i("img", {
334
+ _: 3
335
+ }, 8, ["aria-expanded", "aria-label", "class"]),
336
+ isOpen.value ? (openBlock(), createBlock(Teleport, {
337
+ key: 0,
338
+ to: "body"
339
+ }, [
340
+ createElementVNode("section", {
341
+ ref_key: "panelRef",
342
+ ref: panelRef,
343
+ "aria-busy": __props.loading || void 0,
344
+ class: "rs-account-selector",
345
+ style: normalizeStyle([panelCSSVars, panelPosition.value])
346
+ }, [
347
+ createElementVNode("header", _hoisted_5$1, [
348
+ renderSlot(_ctx.$slots, "user-avatar", { user: __props.user }, () => [
349
+ createElementVNode("span", _hoisted_6$1, [
350
+ createElementVNode("span", _hoisted_7$1, [
351
+ __props.user.avatarSrc ? (openBlock(), createElementBlock("img", {
304
352
  key: 0,
305
353
  class: "rs-account-selector__avatar-image",
306
- src: n.avatarSrc,
307
- alt: n.label
308
- }, null, 8, Ee)) : (s(), i("span", Ie, m(R(n.initials)), 1))
309
- ])
310
- ]),
311
- o("span", Pe, [
312
- o("span", Oe, m(n.label), 1),
313
- o("span", {
314
- class: A([
315
- "rs-account-selector__account-state",
316
- n.active ? "rs-account-selector__account-state--active" : "rs-account-selector__account-state--inactive"
317
- ])
318
- }, m(n.active ? e.activeText : e.selectText), 3)
319
- ]),
320
- o("span", Te, [
321
- y(a.$slots, "account-trailing", { account: n }, () => [
322
- M(v(h), { name: "login" })
323
- ])
354
+ src: __props.user.avatarSrc,
355
+ alt: __props.user.name || __props.user.email
356
+ }, null, 8, _hoisted_8$1)) : (openBlock(), createElementBlock("span", _hoisted_9$1, toDisplayString(getInitials(__props.user.initials)), 1))
357
+ ]),
358
+ __props.user.secondaryAvatarSrc ? (openBlock(), createElementBlock("span", _hoisted_10$1, [
359
+ createElementVNode("img", {
360
+ class: "rs-account-selector__avatar-image",
361
+ src: __props.user.secondaryAvatarSrc,
362
+ alt: __props.user.name || __props.user.email
363
+ }, null, 8, _hoisted_11$1)
364
+ ])) : createCommentVNode("", true)
324
365
  ])
325
366
  ]),
326
- _: 2
327
- }, 1032, ["class", "disabled", "onClick"]))), 128))
328
- ])) : b("", !0),
329
- y(a.$slots, "footer", { actions: $.value }, () => [
330
- $.value.length > 0 ? (s(), i("footer", Ne, [
331
- (s(!0), i(O, null, W($.value, (n) => (s(), k(v(D), ne({
332
- key: n.id,
333
- class: "rs-account-selector__button",
334
- disabled: n.disabled,
335
- size: "small"
336
- }, { ref_for: !0 }, V(n), {
337
- onClick: F((J) => j(n), ["stop"])
338
- }), {
339
- default: H(() => [
340
- o("span", Fe, [
341
- o("span", null, m(n.label), 1),
342
- n.icon ? (s(), k(v(h), {
343
- key: 0,
344
- name: n.icon,
345
- size: "sm"
346
- }, null, 8, ["name"])) : b("", !0)
347
- ])
348
- ]),
349
- _: 2
350
- }, 1040, ["disabled", "onClick"]))), 128))
351
- ])) : b("", !0)
352
- ])
353
- ], 14, he)
354
- ])) : b("", !0)
355
- ], 4));
367
+ createElementVNode("div", _hoisted_12$1, [
368
+ createElementVNode("p", _hoisted_13$1, toDisplayString(computedTitle.value), 1),
369
+ __props.user.name ? (openBlock(), createElementBlock("p", _hoisted_14$1, toDisplayString(__props.user.name), 1)) : createCommentVNode("", true),
370
+ createElementVNode("p", _hoisted_15$1, toDisplayString(__props.user.email), 1)
371
+ ]),
372
+ renderSlot(_ctx.$slots, "actions", { actions: visibleActions.value }, () => [
373
+ createElementVNode("div", _hoisted_16, [
374
+ visibleActions.value.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(visibleActions.value, (action) => {
375
+ return openBlock(), createBlock(unref(Button), mergeProps({
376
+ key: action.id,
377
+ class: "rs-account-selector__button",
378
+ disabled: action.disabled,
379
+ size: "small"
380
+ }, { ref_for: true }, headerButtonProps(action), {
381
+ onClick: withModifiers(($event) => emitAction(action), ["stop"])
382
+ }), {
383
+ default: withCtx(() => [
384
+ createElementVNode("span", null, toDisplayString(action.label), 1),
385
+ action.icon ? (openBlock(), createBlock(unref(_sfc_main$2), {
386
+ key: 0,
387
+ name: action.icon,
388
+ size: "sm"
389
+ }, null, 8, ["name"])) : createCommentVNode("", true)
390
+ ]),
391
+ _: 2
392
+ }, 1040, ["disabled", "onClick"]);
393
+ }), 128)) : (openBlock(), createBlock(unref(Button), {
394
+ key: 1,
395
+ class: "rs-account-selector__button rs-account-selector__profile-button",
396
+ severity: "secondary",
397
+ outlined: "",
398
+ rounded: "",
399
+ size: "small",
400
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emitAction(profileAction), ["stop"]))
401
+ }, {
402
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
403
+ createTextVNode(" Ver mi perfil ", -1)
404
+ ])]),
405
+ _: 1
406
+ }))
407
+ ])
408
+ ])
409
+ ]),
410
+ __props.loading ? (openBlock(), createElementBlock("p", _hoisted_17, " Cargando cuentas... ")) : __props.accounts.length === 0 ? renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
411
+ createElementVNode("p", _hoisted_18, toDisplayString(__props.emptyText), 1)
412
+ ]) : shouldShowAccounts.value ? (openBlock(), createElementBlock("div", _hoisted_19, [
413
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.accounts, (account) => {
414
+ return openBlock(), createBlock(unref(Button), {
415
+ key: account.id,
416
+ class: normalizeClass([
417
+ "rs-account-selector__account",
418
+ {
419
+ "rs-account-selector__account--active": account.active,
420
+ "rs-account-selector__account--disabled": account.disabled
421
+ }
422
+ ]),
423
+ disabled: account.active || account.disabled,
424
+ text: "",
425
+ severity: "secondary",
426
+ onClick: withModifiers(($event) => selectAccount(account), ["stop"])
427
+ }, {
428
+ default: withCtx(() => [
429
+ renderSlot(_ctx.$slots, "account-avatar", { account }, () => [
430
+ createElementVNode("span", _hoisted_20, [
431
+ account.avatarSrc ? (openBlock(), createElementBlock("img", {
432
+ key: 0,
433
+ class: "rs-account-selector__avatar-image",
434
+ src: account.avatarSrc,
435
+ alt: account.label
436
+ }, null, 8, _hoisted_21)) : (openBlock(), createElementBlock("span", _hoisted_22, toDisplayString(getInitials(account.initials)), 1))
437
+ ])
438
+ ]),
439
+ createElementVNode("span", _hoisted_23, [
440
+ createElementVNode("span", _hoisted_24, toDisplayString(account.label), 1),
441
+ createElementVNode("span", {
442
+ class: normalizeClass([
443
+ "rs-account-selector__account-state",
444
+ account.active ? "rs-account-selector__account-state--active" : "rs-account-selector__account-state--inactive"
445
+ ])
446
+ }, toDisplayString(account.active ? __props.activeText : __props.selectText), 3)
447
+ ]),
448
+ createElementVNode("span", _hoisted_25, [
449
+ renderSlot(_ctx.$slots, "account-trailing", { account }, () => [
450
+ createVNode(unref(_sfc_main$2), { name: "login" })
451
+ ])
452
+ ])
453
+ ]),
454
+ _: 2
455
+ }, 1032, ["class", "disabled", "onClick"]);
456
+ }), 128))
457
+ ])) : createCommentVNode("", true),
458
+ renderSlot(_ctx.$slots, "footer", { actions: visibleFooterActions.value }, () => [
459
+ visibleFooterActions.value.length > 0 ? (openBlock(), createElementBlock("footer", _hoisted_26, [
460
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFooterActions.value, (action) => {
461
+ return openBlock(), createBlock(unref(Button), mergeProps({
462
+ key: action.id,
463
+ class: "rs-account-selector__button",
464
+ disabled: action.disabled,
465
+ size: "small"
466
+ }, { ref_for: true }, footerButtonProps(action), {
467
+ onClick: withModifiers(($event) => emitFooterAction(action), ["stop"])
468
+ }), {
469
+ default: withCtx(() => [
470
+ createElementVNode("span", _hoisted_27, [
471
+ createElementVNode("span", null, toDisplayString(action.label), 1),
472
+ action.icon ? (openBlock(), createBlock(unref(_sfc_main$2), {
473
+ key: 0,
474
+ name: action.icon,
475
+ size: "sm"
476
+ }, null, 8, ["name"])) : createCommentVNode("", true)
477
+ ])
478
+ ]),
479
+ _: 2
480
+ }, 1040, ["disabled", "onClick"]);
481
+ }), 128))
482
+ ])) : createCommentVNode("", true)
483
+ ])
484
+ ], 12, _hoisted_4$1)
485
+ ])) : createCommentVNode("", true)
486
+ ], 4);
487
+ };
356
488
  }
357
- }), De = ["aria-label"], We = { class: "rs-sidebar__header" }, Ue = ["aria-expanded"], qe = { class: "rs-sidebar__title" }, je = { class: "rs-sidebar__title" }, Ge = ["aria-label"], Je = { class: "rs-sidebar__content" }, Ke = {
489
+ });
490
+ const _hoisted_1 = ["aria-label"];
491
+ const _hoisted_2 = { class: "rs-sidebar__header" };
492
+ const _hoisted_3 = ["aria-expanded"];
493
+ const _hoisted_4 = { class: "rs-sidebar__title" };
494
+ const _hoisted_5 = { class: "rs-sidebar__title" };
495
+ const _hoisted_6 = ["aria-label"];
496
+ const _hoisted_7 = { class: "rs-sidebar__content" };
497
+ const _hoisted_8 = {
358
498
  class: "rs-sidebar__nav",
359
499
  "aria-label": "Secciones"
360
- }, Qe = { class: "rs-sidebar__list" }, Xe = ["disabled", "onClick"], Ye = { class: "rs-sidebar__item-label" }, Ze = {
500
+ };
501
+ const _hoisted_9 = { class: "rs-sidebar__list" };
502
+ const _hoisted_10 = ["disabled", "onClick"];
503
+ const _hoisted_11 = { class: "rs-sidebar__item-label" };
504
+ const _hoisted_12 = {
361
505
  key: 0,
362
506
  class: "rs-sidebar__footer",
363
507
  "aria-label": "Acciones secundarias"
364
- }, et = { class: "rs-sidebar__list" }, tt = ["disabled", "onClick"], at = { class: "rs-sidebar__item-label" }, st = /* @__PURE__ */ ae({
365
- name: "RsSidebar",
508
+ };
509
+ const _hoisted_13 = { class: "rs-sidebar__list" };
510
+ const _hoisted_14 = ["disabled", "onClick"];
511
+ const _hoisted_15 = { class: "rs-sidebar__item-label" };
512
+ const _sfc_main = /* @__PURE__ */ defineComponent({
513
+ ...{
514
+ name: "RsSidebar"
515
+ },
366
516
  __name: "RsSidebar",
367
517
  props: {
368
518
  items: {},
369
519
  footerItems: { default: () => [] },
370
520
  modules: { default: () => [] },
371
- navigateOnModuleSelect: { type: Boolean, default: !1 },
521
+ navigateOnModuleSelect: { type: Boolean, default: false },
372
522
  title: { default: "" },
373
523
  icon: { default: "nest_eco_leaf" },
374
- expanded: { type: Boolean, default: !1 },
375
- expandOnHover: { type: Boolean, default: !0 },
376
- mobileOpen: { type: Boolean, default: !1 },
524
+ expanded: { type: Boolean, default: false },
525
+ expandOnHover: { type: Boolean, default: true },
526
+ mobileOpen: { type: Boolean, default: false },
377
527
  ariaLabel: { default: "Navegacion principal" },
378
528
  variant: { default: "cyo" }
379
529
  },
380
530
  emits: ["item-click", "close-mobile", "expanded-change", "module-select"],
381
- setup(e, { emit: c }) {
382
- const l = e, _ = c, w = C(!1), u = C(null), f = C(!1), z = C(null), U = d(() => l.items.filter(V)), S = d(() => l.footerItems.filter(V)), q = d(() => l.modules), p = d(
383
- () => l.modules.find((t) => t.active) ?? l.modules.find((t) => t.text === l.title) ?? l.modules[0] ?? null
384
- ), T = d(() => u.value?.label || p.value?.text || l.title), X = d(
385
- () => q.value.map((t) => ({
531
+ setup(__props, { emit: __emit }) {
532
+ const props = __props;
533
+ const emit = __emit;
534
+ const isHovered = ref(false);
535
+ const activeParent = ref(null);
536
+ const isModuleMenuOpen = ref(false);
537
+ const rootElement = ref(null);
538
+ const visibleItems = computed(() => props.items.filter(isVisible));
539
+ const visibleFooterItems = computed(() => props.footerItems.filter(isVisible));
540
+ const visibleModules = computed(() => props.modules);
541
+ const activeModule = computed(
542
+ () => props.modules.find((module) => module.active) ?? props.modules.find((module) => module.text === props.title) ?? props.modules[0] ?? null
543
+ );
544
+ const displayedHeaderTitle = computed(() => activeParent.value?.label || activeModule.value?.text || props.title);
545
+ const moduleMenuItems = computed(
546
+ () => visibleModules.value.map((module) => ({
386
547
  class: [
387
548
  "rs-sidebar__module-option",
388
549
  {
389
- "rs-sidebar__module-option--active": t.active || t.text === T.value,
390
- "rs-sidebar__module-option--disabled": t.disabled
550
+ "rs-sidebar__module-option--active": module.active || module.text === displayedHeaderTitle.value,
551
+ "rs-sidebar__module-option--disabled": module.disabled
391
552
  }
392
553
  ],
393
- command: () => P(t),
394
- disabled: t.disabled,
395
- label: t.text
554
+ command: () => selectModule(module),
555
+ disabled: module.disabled,
556
+ label: module.text
396
557
  }))
397
- ), N = d(
398
- () => u.value ? u.value.children?.filter(V) ?? [] : U.value
399
- ), $ = d(() => l.expanded || l.mobileOpen || w.value), Y = d(() => l.mobileOpen || !!u.value), L = d(() => !u.value && l.modules.length > 0), Z = d(() => [
558
+ );
559
+ const displayedItems = computed(
560
+ () => activeParent.value ? activeParent.value.children?.filter(isVisible) ?? [] : visibleItems.value
561
+ );
562
+ const isExpanded = computed(() => props.expanded || props.mobileOpen || isHovered.value);
563
+ const hasHeaderAction = computed(() => props.mobileOpen || !!activeParent.value);
564
+ const hasModuleSelector = computed(() => !activeParent.value && props.modules.length > 0);
565
+ const rootClass = computed(() => [
400
566
  "rs-sidebar",
401
- `rs-sidebar--${l.variant}`,
567
+ `rs-sidebar--${props.variant}`,
402
568
  {
403
- "rs-sidebar--expanded": $.value,
404
- "rs-sidebar--mobile-open": l.mobileOpen,
405
- "rs-sidebar--submenu": !!u.value
569
+ "rs-sidebar--expanded": isExpanded.value,
570
+ "rs-sidebar--mobile-open": props.mobileOpen,
571
+ "rs-sidebar--submenu": !!activeParent.value
406
572
  }
407
573
  ]);
408
- Q(
409
- () => l.mobileOpen,
410
- (t) => {
411
- t || (u.value = null), f.value = !1;
574
+ watch(
575
+ () => props.mobileOpen,
576
+ (isOpen) => {
577
+ if (!isOpen) {
578
+ activeParent.value = null;
579
+ }
580
+ isModuleMenuOpen.value = false;
581
+ }
582
+ );
583
+ watch(isExpanded, (expanded) => {
584
+ if (!expanded) {
585
+ activeParent.value = null;
412
586
  }
413
- ), Q($, (t) => {
414
- t || (u.value = null), _("expanded-change", t);
415
- }), Q(
416
- () => u.value,
587
+ emit("expanded-change", expanded);
588
+ });
589
+ watch(
590
+ () => activeParent.value,
417
591
  () => {
418
- f.value = !1;
592
+ isModuleMenuOpen.value = false;
419
593
  }
420
- ), oe(() => {
421
- document.addEventListener("pointerdown", B);
422
- }), re(() => {
423
- document.removeEventListener("pointerdown", B);
594
+ );
595
+ onMounted(() => {
596
+ document.addEventListener("pointerdown", handleDocumentPointerDown);
597
+ });
598
+ onBeforeUnmount(() => {
599
+ document.removeEventListener("pointerdown", handleDocumentPointerDown);
424
600
  });
425
- function V(t) {
426
- return t.visible !== !1;
601
+ function isVisible(item) {
602
+ return item.visible !== false;
427
603
  }
428
- function E(t) {
429
- return (t.children ?? []).some(V);
604
+ function hasVisibleChildren(item) {
605
+ return (item.children ?? []).some(isVisible);
430
606
  }
431
- function j(t) {
432
- !l.expandOnHover || l.mobileOpen || (w.value = t, t || (f.value = !1));
607
+ function setHovered(value) {
608
+ if (!props.expandOnHover || props.mobileOpen) {
609
+ return;
610
+ }
611
+ isHovered.value = value;
612
+ if (!value) {
613
+ isModuleMenuOpen.value = false;
614
+ }
433
615
  }
434
- function G(t) {
435
- if (!t.disabled) {
436
- if (E(t)) {
437
- u.value = t;
438
- return;
439
- }
440
- _("item-click", t);
616
+ function handleItemClick(item) {
617
+ if (item.disabled) {
618
+ return;
619
+ }
620
+ if (hasVisibleChildren(item)) {
621
+ activeParent.value = item;
622
+ return;
441
623
  }
624
+ emit("item-click", item);
442
625
  }
443
- function R() {
444
- u.value = null;
626
+ function goBack() {
627
+ activeParent.value = null;
445
628
  }
446
- function I() {
447
- u.value = null, f.value = !1, _("close-mobile");
629
+ function closeMobile() {
630
+ activeParent.value = null;
631
+ isModuleMenuOpen.value = false;
632
+ emit("close-mobile");
448
633
  }
449
- function ee() {
450
- !L.value || !$.value || (f.value = !f.value);
634
+ function toggleModuleMenu() {
635
+ if (!hasModuleSelector.value || !isExpanded.value) {
636
+ return;
637
+ }
638
+ isModuleMenuOpen.value = !isModuleMenuOpen.value;
451
639
  }
452
- function P(t) {
453
- t.disabled || (f.value = !1, _("module-select", t), l.navigateOnModuleSelect && typeof window < "u" && t.link && (window.location.href = t.link));
640
+ function selectModule(module) {
641
+ if (module.disabled) {
642
+ return;
643
+ }
644
+ isModuleMenuOpen.value = false;
645
+ emit("module-select", module);
646
+ if (props.navigateOnModuleSelect && typeof window !== "undefined" && module.link) {
647
+ window.location.href = module.link;
648
+ }
454
649
  }
455
- function B(t) {
456
- !f.value || !z.value || z.value.contains(t.target) || (f.value = !1);
650
+ function handleDocumentPointerDown(event) {
651
+ if (!isModuleMenuOpen.value || !rootElement.value) {
652
+ return;
653
+ }
654
+ if (!rootElement.value.contains(event.target)) {
655
+ isModuleMenuOpen.value = false;
656
+ }
457
657
  }
458
- return (t, x) => (s(), i("aside", {
459
- ref_key: "rootElement",
460
- ref: z,
461
- "aria-label": e.ariaLabel,
462
- class: A(Z.value),
463
- onMouseenter: x[1] || (x[1] = (r) => j(!0)),
464
- onMouseleave: x[2] || (x[2] = (r) => j(!1))
465
- }, [
466
- y(t.$slots, "header", {
467
- expanded: $.value,
468
- activeParent: u.value,
469
- closeMobile: I,
470
- goBack: R
471
- }, () => [
472
- o("header", We, [
473
- o("div", {
474
- class: A([
475
- "rs-sidebar__brand",
476
- {
477
- "rs-sidebar__brand--trigger": L.value
478
- }
479
- ])
480
- }, [
481
- L.value ? (s(), i("button", {
482
- key: 0,
483
- class: "rs-sidebar__module-trigger",
484
- type: "button",
485
- "aria-expanded": f.value,
486
- "aria-haspopup": "menu",
487
- onClick: ee
488
- }, [
489
- M(v(h), { name: e.icon }, null, 8, ["name"]),
490
- o("span", qe, m(T.value), 1),
491
- M(v(h), {
492
- class: "rs-sidebar__module-chevron",
493
- name: f.value ? "arrow_drop_up" : "arrow_drop_down",
494
- size: "sm"
495
- }, null, 8, ["name"])
496
- ], 8, Ue)) : (s(), i(O, { key: 1 }, [
497
- M(v(h), { name: e.icon }, null, 8, ["name"]),
498
- o("span", je, m(T.value), 1)
499
- ], 64))
500
- ], 2),
501
- y(t.$slots, "header-action", {
502
- activeParent: u.value,
503
- closeMobile: I,
504
- goBack: R
505
- }, () => [
506
- Y.value ? (s(), i("button", {
507
- key: 0,
508
- class: "rs-sidebar__header-button",
509
- type: "button",
510
- "aria-label": u.value ? "Volver" : "Cerrar menu",
511
- onClick: x[0] || (x[0] = (r) => u.value ? R() : I())
512
- }, [
513
- M(v(h), {
514
- name: u.value ? "arrow_left" : "close"
515
- }, null, 8, ["name"])
516
- ], 8, Ge)) : b("", !0)
517
- ])
518
- ]),
519
- L.value && f.value ? (s(), k(v(de), {
520
- key: 0,
521
- class: "rs-sidebar__module-menu",
522
- model: X.value,
523
- pt: {
524
- root: { role: "menu" }
525
- }
526
- }, null, 8, ["model"])) : b("", !0)
527
- ]),
528
- o("div", Je, [
529
- o("nav", Ke, [
530
- o("ul", Qe, [
531
- (s(!0), i(O, null, W(N.value, (r) => (s(), i("li", {
532
- key: r.id,
533
- class: "rs-sidebar__list-item"
658
+ return (_ctx, _cache) => {
659
+ return openBlock(), createElementBlock("aside", {
660
+ ref_key: "rootElement",
661
+ ref: rootElement,
662
+ "aria-label": __props.ariaLabel,
663
+ class: normalizeClass(rootClass.value),
664
+ onMouseenter: _cache[1] || (_cache[1] = ($event) => setHovered(true)),
665
+ onMouseleave: _cache[2] || (_cache[2] = ($event) => setHovered(false))
666
+ }, [
667
+ renderSlot(_ctx.$slots, "header", {
668
+ expanded: isExpanded.value,
669
+ activeParent: activeParent.value,
670
+ closeMobile,
671
+ goBack
672
+ }, () => [
673
+ createElementVNode("header", _hoisted_2, [
674
+ createElementVNode("div", {
675
+ class: normalizeClass([
676
+ "rs-sidebar__brand",
677
+ {
678
+ "rs-sidebar__brand--trigger": hasModuleSelector.value
679
+ }
680
+ ])
534
681
  }, [
535
- o("button", {
536
- class: A([
537
- "rs-sidebar__item",
538
- {
539
- "rs-sidebar__item--active": r.active,
540
- "rs-sidebar__item--disabled": r.disabled,
541
- "rs-sidebar__item--parent": E(r)
542
- }
543
- ]),
682
+ hasModuleSelector.value ? (openBlock(), createElementBlock("button", {
683
+ key: 0,
684
+ class: "rs-sidebar__module-trigger",
544
685
  type: "button",
545
- disabled: r.disabled,
546
- onClick: (a) => G(r)
686
+ "aria-expanded": isModuleMenuOpen.value,
687
+ "aria-haspopup": "menu",
688
+ onClick: toggleModuleMenu
547
689
  }, [
548
- y(t.$slots, "item", {
549
- item: r,
550
- expanded: $.value
551
- }, () => [
552
- r.icon ? (s(), k(v(h), {
553
- key: 0,
554
- class: "rs-sidebar__item-icon",
555
- name: r.icon
556
- }, null, 8, ["name"])) : b("", !0),
557
- o("span", Ye, m(r.label), 1),
558
- E(r) ? (s(), k(v(h), {
559
- key: 1,
560
- class: "rs-sidebar__item-chevron",
561
- name: "chevron_right",
562
- size: "sm"
563
- })) : b("", !0)
564
- ])
565
- ], 10, Xe)
566
- ]))), 128))
567
- ])
568
- ]),
569
- y(t.$slots, "footer", {
570
- items: S.value,
571
- expanded: $.value
572
- }, () => [
573
- S.value.length > 0 ? (s(), i("nav", Ze, [
574
- o("ul", et, [
575
- (s(!0), i(O, null, W(S.value, (r) => (s(), i("li", {
576
- key: r.id,
577
- class: "rs-sidebar__list-item"
690
+ createVNode(unref(_sfc_main$2), { name: __props.icon }, null, 8, ["name"]),
691
+ createElementVNode("span", _hoisted_4, toDisplayString(displayedHeaderTitle.value), 1),
692
+ createVNode(unref(_sfc_main$2), {
693
+ class: "rs-sidebar__module-chevron",
694
+ name: isModuleMenuOpen.value ? "arrow_drop_up" : "arrow_drop_down",
695
+ size: "sm"
696
+ }, null, 8, ["name"])
697
+ ], 8, _hoisted_3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
698
+ createVNode(unref(_sfc_main$2), { name: __props.icon }, null, 8, ["name"]),
699
+ createElementVNode("span", _hoisted_5, toDisplayString(displayedHeaderTitle.value), 1)
700
+ ], 64))
701
+ ], 2),
702
+ renderSlot(_ctx.$slots, "header-action", {
703
+ activeParent: activeParent.value,
704
+ closeMobile,
705
+ goBack
706
+ }, () => [
707
+ hasHeaderAction.value ? (openBlock(), createElementBlock("button", {
708
+ key: 0,
709
+ class: "rs-sidebar__header-button",
710
+ type: "button",
711
+ "aria-label": activeParent.value ? "Volver" : "Cerrar menu",
712
+ onClick: _cache[0] || (_cache[0] = ($event) => activeParent.value ? goBack() : closeMobile())
578
713
  }, [
579
- o("button", {
580
- class: A([
581
- "rs-sidebar__item",
582
- "rs-sidebar__item--footer",
583
- {
584
- "rs-sidebar__item--active": r.active,
585
- "rs-sidebar__item--disabled": r.disabled
586
- }
587
- ]),
588
- type: "button",
589
- disabled: r.disabled,
590
- onClick: (a) => G(r)
714
+ createVNode(unref(_sfc_main$2), {
715
+ name: activeParent.value ? "arrow_left" : "close"
716
+ }, null, 8, ["name"])
717
+ ], 8, _hoisted_6)) : createCommentVNode("", true)
718
+ ])
719
+ ]),
720
+ hasModuleSelector.value && isModuleMenuOpen.value ? (openBlock(), createBlock(unref(Menu), {
721
+ key: 0,
722
+ class: "rs-sidebar__module-menu",
723
+ model: moduleMenuItems.value,
724
+ pt: {
725
+ root: { role: "menu" }
726
+ }
727
+ }, null, 8, ["model"])) : createCommentVNode("", true)
728
+ ]),
729
+ createElementVNode("div", _hoisted_7, [
730
+ createElementVNode("nav", _hoisted_8, [
731
+ createElementVNode("ul", _hoisted_9, [
732
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayedItems.value, (item) => {
733
+ return openBlock(), createElementBlock("li", {
734
+ key: item.id,
735
+ class: "rs-sidebar__list-item"
591
736
  }, [
592
- r.icon ? (s(), k(v(h), {
593
- key: 0,
594
- class: "rs-sidebar__item-icon",
595
- name: r.icon
596
- }, null, 8, ["name"])) : b("", !0),
597
- o("span", at, m(r.label), 1)
598
- ], 10, tt)
599
- ]))), 128))
737
+ createElementVNode("button", {
738
+ class: normalizeClass([
739
+ "rs-sidebar__item",
740
+ {
741
+ "rs-sidebar__item--active": item.active,
742
+ "rs-sidebar__item--disabled": item.disabled,
743
+ "rs-sidebar__item--parent": hasVisibleChildren(item)
744
+ }
745
+ ]),
746
+ type: "button",
747
+ disabled: item.disabled,
748
+ onClick: ($event) => handleItemClick(item)
749
+ }, [
750
+ renderSlot(_ctx.$slots, "item", {
751
+ item,
752
+ expanded: isExpanded.value
753
+ }, () => [
754
+ item.icon ? (openBlock(), createBlock(unref(_sfc_main$2), {
755
+ key: 0,
756
+ class: "rs-sidebar__item-icon",
757
+ name: item.icon
758
+ }, null, 8, ["name"])) : createCommentVNode("", true),
759
+ createElementVNode("span", _hoisted_11, toDisplayString(item.label), 1),
760
+ hasVisibleChildren(item) ? (openBlock(), createBlock(unref(_sfc_main$2), {
761
+ key: 1,
762
+ class: "rs-sidebar__item-chevron",
763
+ name: "chevron_right",
764
+ size: "sm"
765
+ })) : createCommentVNode("", true)
766
+ ])
767
+ ], 10, _hoisted_10)
768
+ ]);
769
+ }), 128))
600
770
  ])
601
- ])) : b("", !0)
771
+ ]),
772
+ renderSlot(_ctx.$slots, "footer", {
773
+ items: visibleFooterItems.value,
774
+ expanded: isExpanded.value
775
+ }, () => [
776
+ visibleFooterItems.value.length > 0 ? (openBlock(), createElementBlock("nav", _hoisted_12, [
777
+ createElementVNode("ul", _hoisted_13, [
778
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFooterItems.value, (item) => {
779
+ return openBlock(), createElementBlock("li", {
780
+ key: item.id,
781
+ class: "rs-sidebar__list-item"
782
+ }, [
783
+ createElementVNode("button", {
784
+ class: normalizeClass([
785
+ "rs-sidebar__item",
786
+ "rs-sidebar__item--footer",
787
+ {
788
+ "rs-sidebar__item--active": item.active,
789
+ "rs-sidebar__item--disabled": item.disabled
790
+ }
791
+ ]),
792
+ type: "button",
793
+ disabled: item.disabled,
794
+ onClick: ($event) => handleItemClick(item)
795
+ }, [
796
+ item.icon ? (openBlock(), createBlock(unref(_sfc_main$2), {
797
+ key: 0,
798
+ class: "rs-sidebar__item-icon",
799
+ name: item.icon
800
+ }, null, 8, ["name"])) : createCommentVNode("", true),
801
+ createElementVNode("span", _hoisted_15, toDisplayString(item.label), 1)
802
+ ], 10, _hoisted_14)
803
+ ]);
804
+ }), 128))
805
+ ])
806
+ ])) : createCommentVNode("", true)
807
+ ])
602
808
  ])
603
- ])
604
- ], 42, De));
809
+ ], 42, _hoisted_1);
810
+ };
605
811
  }
606
- }), lt = [He, h, st], ct = {
607
- install(e) {
608
- for (const c of lt)
609
- e.component(c.name ?? "", c);
812
+ });
813
+ const components = [_sfc_main$1, _sfc_main$2, _sfc_main];
814
+ const RobosophyUiVue = {
815
+ install(app) {
816
+ for (const component of components) {
817
+ app.component(component.name ?? "", component);
818
+ }
610
819
  }
611
820
  };
612
821
  export {
613
- ct as RobosophyUiVue,
614
- He as RsAccountSelector,
615
- h as RsIcon,
616
- st as RsSidebar,
617
- lt as components,
618
- ct as default,
619
- it as rsPrimeIcon
822
+ RobosophyUiVue,
823
+ _sfc_main$1 as RsAccountSelector,
824
+ _sfc_main$2 as RsIcon,
825
+ _sfc_main as RsSidebar,
826
+ components,
827
+ RobosophyUiVue as default,
828
+ rsPrimeIcon
620
829
  };
621
830
  //# sourceMappingURL=index.js.map