@robosophy/ui-vue 1.0.10 → 1.0.11
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/components/RsAccountSelector/RsAccountSelector.vue.d.ts.map +1 -1
- package/dist/index.css +752 -1
- package/dist/index.js +696 -487
- package/dist/index.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +279 -207
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
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:
|
|
17
|
+
fill: { type: Boolean, default: false },
|
|
15
18
|
weight: { default: 400 },
|
|
16
19
|
grade: { default: 0 },
|
|
17
20
|
opticalSize: {},
|
|
18
|
-
interactive: { type: Boolean, default:
|
|
21
|
+
interactive: { type: Boolean, default: false },
|
|
19
22
|
ariaLabel: {}
|
|
20
23
|
},
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const rootClass = computed(() => [
|
|
23
27
|
"rs-icon",
|
|
24
|
-
`rs-icon--${
|
|
25
|
-
`rs-icon--${
|
|
28
|
+
`rs-icon--${props.family}`,
|
|
29
|
+
`rs-icon--${props.color}`,
|
|
26
30
|
{
|
|
27
|
-
"rs-icon--interactive":
|
|
28
|
-
"rs-icon--sm":
|
|
29
|
-
"rs-icon--md":
|
|
30
|
-
"rs-icon--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
|
-
])
|
|
33
|
-
|
|
34
|
-
"--rs-icon-
|
|
35
|
-
"--rs-icon-
|
|
36
|
-
"--rs-icon-size":
|
|
37
|
-
"--rs-icon-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
82
|
-
|
|
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:
|
|
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(
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
|
115
|
-
return
|
|
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
|
|
118
|
-
return
|
|
184
|
+
function footerButtonProps(action) {
|
|
185
|
+
return action.variant === "danger" ? { severity: "danger", text: true } : { severity: "secondary", text: true };
|
|
119
186
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
187
|
+
function emitAction(action) {
|
|
188
|
+
if (!action.disabled) {
|
|
189
|
+
emit("action", action);
|
|
190
|
+
closeSelector();
|
|
191
|
+
}
|
|
122
192
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
193
|
+
function emitFooterAction(action) {
|
|
194
|
+
if (!action.disabled) {
|
|
195
|
+
emit("footer-action", action);
|
|
196
|
+
closeSelector();
|
|
197
|
+
}
|
|
125
198
|
}
|
|
126
|
-
function
|
|
127
|
-
!
|
|
199
|
+
function selectAccount(account) {
|
|
200
|
+
if (!account.active && !account.disabled) {
|
|
201
|
+
emit("select-account", account);
|
|
202
|
+
closeSelector();
|
|
203
|
+
}
|
|
128
204
|
}
|
|
129
|
-
function
|
|
130
|
-
return (
|
|
205
|
+
function getInitials(initials) {
|
|
206
|
+
return (initials?.trim() || "?").slice(0, 3);
|
|
131
207
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
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
|
|
136
|
-
|
|
219
|
+
function toggleSelector() {
|
|
220
|
+
setOpen(!isOpen.value);
|
|
137
221
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
222
|
+
function closeSelector() {
|
|
223
|
+
if (isOpen.value) {
|
|
224
|
+
setOpen(false);
|
|
225
|
+
}
|
|
140
226
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
143
|
-
|
|
227
|
+
function updatePanelPosition() {
|
|
228
|
+
const root = rootRef.value;
|
|
229
|
+
const panel = panelRef.value;
|
|
230
|
+
if (!root || !panel) {
|
|
144
231
|
return;
|
|
145
|
-
|
|
146
|
-
|
|
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: `${
|
|
149
|
-
left:
|
|
150
|
-
"--rs-account-selector-width": l.width
|
|
252
|
+
top: `${rootRect.bottom + 8}px`,
|
|
253
|
+
left: `${left}px`
|
|
151
254
|
};
|
|
152
255
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
256
|
+
function handleWindowResize() {
|
|
257
|
+
if (isOpen.value) {
|
|
258
|
+
void updatePanelPosition();
|
|
259
|
+
}
|
|
155
260
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
-
|
|
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
|
|
162
|
-
const
|
|
163
|
-
|
|
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
|
-
|
|
166
|
-
document.addEventListener("pointerdown",
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"aria-
|
|
216
|
-
class:
|
|
217
|
-
"rs-account-
|
|
218
|
-
|
|
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
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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:
|
|
307
|
-
alt:
|
|
308
|
-
}, null, 8,
|
|
309
|
-
])
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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
|
-
})
|
|
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
|
-
}
|
|
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
|
-
}
|
|
365
|
-
|
|
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:
|
|
521
|
+
navigateOnModuleSelect: { type: Boolean, default: false },
|
|
372
522
|
title: { default: "" },
|
|
373
523
|
icon: { default: "nest_eco_leaf" },
|
|
374
|
-
expanded: { type: Boolean, default:
|
|
375
|
-
expandOnHover: { type: Boolean, default:
|
|
376
|
-
mobileOpen: { type: Boolean, default:
|
|
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(
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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":
|
|
390
|
-
"rs-sidebar__module-option--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: () =>
|
|
394
|
-
disabled:
|
|
395
|
-
label:
|
|
554
|
+
command: () => selectModule(module),
|
|
555
|
+
disabled: module.disabled,
|
|
556
|
+
label: module.text
|
|
396
557
|
}))
|
|
397
|
-
)
|
|
398
|
-
|
|
399
|
-
|
|
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--${
|
|
567
|
+
`rs-sidebar--${props.variant}`,
|
|
402
568
|
{
|
|
403
|
-
"rs-sidebar--expanded":
|
|
404
|
-
"rs-sidebar--mobile-open":
|
|
405
|
-
"rs-sidebar--submenu": !!
|
|
569
|
+
"rs-sidebar--expanded": isExpanded.value,
|
|
570
|
+
"rs-sidebar--mobile-open": props.mobileOpen,
|
|
571
|
+
"rs-sidebar--submenu": !!activeParent.value
|
|
406
572
|
}
|
|
407
573
|
]);
|
|
408
|
-
|
|
409
|
-
() =>
|
|
410
|
-
(
|
|
411
|
-
|
|
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
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
() =>
|
|
587
|
+
emit("expanded-change", expanded);
|
|
588
|
+
});
|
|
589
|
+
watch(
|
|
590
|
+
() => activeParent.value,
|
|
417
591
|
() => {
|
|
418
|
-
|
|
592
|
+
isModuleMenuOpen.value = false;
|
|
419
593
|
}
|
|
420
|
-
)
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
594
|
+
);
|
|
595
|
+
onMounted(() => {
|
|
596
|
+
document.addEventListener("pointerdown", handleDocumentPointerDown);
|
|
597
|
+
});
|
|
598
|
+
onBeforeUnmount(() => {
|
|
599
|
+
document.removeEventListener("pointerdown", handleDocumentPointerDown);
|
|
424
600
|
});
|
|
425
|
-
function
|
|
426
|
-
return
|
|
601
|
+
function isVisible(item) {
|
|
602
|
+
return item.visible !== false;
|
|
427
603
|
}
|
|
428
|
-
function
|
|
429
|
-
return (
|
|
604
|
+
function hasVisibleChildren(item) {
|
|
605
|
+
return (item.children ?? []).some(isVisible);
|
|
430
606
|
}
|
|
431
|
-
function
|
|
432
|
-
!
|
|
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
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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
|
|
444
|
-
|
|
626
|
+
function goBack() {
|
|
627
|
+
activeParent.value = null;
|
|
445
628
|
}
|
|
446
|
-
function
|
|
447
|
-
|
|
629
|
+
function closeMobile() {
|
|
630
|
+
activeParent.value = null;
|
|
631
|
+
isModuleMenuOpen.value = false;
|
|
632
|
+
emit("close-mobile");
|
|
448
633
|
}
|
|
449
|
-
function
|
|
450
|
-
!
|
|
634
|
+
function toggleModuleMenu() {
|
|
635
|
+
if (!hasModuleSelector.value || !isExpanded.value) {
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
isModuleMenuOpen.value = !isModuleMenuOpen.value;
|
|
451
639
|
}
|
|
452
|
-
function
|
|
453
|
-
|
|
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
|
|
456
|
-
!
|
|
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 (
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
-
|
|
536
|
-
|
|
537
|
-
|
|
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
|
-
|
|
546
|
-
|
|
686
|
+
"aria-expanded": isModuleMenuOpen.value,
|
|
687
|
+
"aria-haspopup": "menu",
|
|
688
|
+
onClick: toggleModuleMenu
|
|
547
689
|
}, [
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
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
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
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
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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
|
-
])
|
|
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
|
-
|
|
809
|
+
], 42, _hoisted_1);
|
|
810
|
+
};
|
|
605
811
|
}
|
|
606
|
-
})
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
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
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
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
|