@apptegy/nuxt-navigation 0.1.126 → 0.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/Nav/Avatar.vue +64 -8
- package/dist/runtime/components/Nav/Avatar.vue.d.ts +4 -0
- package/dist/runtime/components/Nav/Header.vue +234 -156
- package/dist/runtime/components/Nav/Header.vue.d.ts +1 -17
- package/dist/runtime/components/Nav/HelpArticles.vue +107 -16
- package/dist/runtime/components/Nav/NotificationItem.vue +81 -150
- package/dist/runtime/components/Nav/NotificationItem.vue.d.ts +2 -2
- package/dist/runtime/components/Nav/NotificationsPanel.vue.d.ts +9 -9
- package/dist/runtime/components/Nav/OrgSelect.vue +152 -29
- package/dist/runtime/components/Nav/Sidebar.vue +386 -109
- package/dist/runtime/components/Nav/Sidebar.vue.d.ts +5 -5
- package/dist/runtime/components/Nav/SidebarItem.vue +86 -24
- package/dist/runtime/components/Nav/SidebarSection.vue +131 -20
- package/dist/runtime/components/Nav/SidebarSection.vue.d.ts +4 -2
- package/dist/runtime/components/Nav/UserDropdown.vue +145 -46
- package/dist/runtime/types/index.d.ts +1 -1
- package/dist/runtime/types/notifications.d.ts +1 -19
- package/dist/runtime/utils/constants.d.ts +49 -0
- package/dist/runtime/utils/constants.js +53 -0
- package/dist/runtime/utils/notification-api.d.ts +0 -10
- package/dist/runtime/utils/notification-api.js +1 -42
- package/locale/en.json +0 -1
- package/package.json +16 -15
|
@@ -1,26 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="component"
|
|
4
|
+
:class="['a-navbar-item', isBeaconNavEnabled ? 'beacon' : 'classic', { expanded, active, collapsed: !expanded }]"
|
|
5
|
+
>
|
|
6
|
+
<span class="icon-container">
|
|
7
|
+
<slot name="icon">
|
|
8
|
+
<a-icon
|
|
9
|
+
class="icon"
|
|
10
|
+
:icon="icon"
|
|
11
|
+
/>
|
|
12
|
+
</slot>
|
|
13
|
+
</span>
|
|
14
|
+
<slot v-if="expanded" />
|
|
15
|
+
</component>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
1
18
|
<script setup>
|
|
2
|
-
import { useSidebar, computed, resolveComponent } from "#imports";
|
|
19
|
+
import { useSidebar, computed, resolveComponent, useNuxtApp } from "#imports";
|
|
3
20
|
const props = defineProps({
|
|
4
21
|
icon: { type: String, required: false },
|
|
5
22
|
active: { type: Boolean, required: false },
|
|
6
23
|
as: { type: String, required: false },
|
|
7
24
|
name: { type: String, required: false }
|
|
8
25
|
});
|
|
26
|
+
const { $ld } = useNuxtApp();
|
|
9
27
|
const { state: expanded } = useSidebar();
|
|
10
28
|
const component = computed(() => props.as || resolveComponent("NuxtLink"));
|
|
29
|
+
const isBeaconNavEnabled = computed(() => {
|
|
30
|
+
return Boolean($ld?.flags?.beaconNavEnabled);
|
|
31
|
+
});
|
|
11
32
|
</script>
|
|
12
33
|
|
|
13
|
-
<template>
|
|
14
|
-
<component :is="component" class="a-navbar-item" :class="{ expanded, active, collapsed: !expanded }">
|
|
15
|
-
<slot name="icon">
|
|
16
|
-
<a-icon class="icon" :icon="icon" font-size="24px"/>
|
|
17
|
-
</slot>
|
|
18
|
-
<slot v-if="expanded" />
|
|
19
|
-
</component>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
34
|
<style scoped>
|
|
23
|
-
.a-navbar-item {
|
|
35
|
+
.a-navbar-item.classic {
|
|
24
36
|
background-color: transparent;
|
|
25
37
|
color: inherit;
|
|
26
38
|
margin: 2px 12px;
|
|
@@ -33,38 +45,88 @@ const component = computed(() => props.as || resolveComponent("NuxtLink"));
|
|
|
33
45
|
border-radius: 8px;
|
|
34
46
|
user-select: none;
|
|
35
47
|
}
|
|
36
|
-
.a-navbar-item.collapsed {
|
|
48
|
+
.a-navbar-item.classic.collapsed {
|
|
37
49
|
justify-content: center;
|
|
38
50
|
margin: 8px;
|
|
39
51
|
cursor: pointer;
|
|
40
52
|
}
|
|
41
|
-
.a-navbar-item:focus-visible {
|
|
53
|
+
.a-navbar-item.classic:focus-visible {
|
|
42
54
|
outline: var(--orange) auto 2px;
|
|
43
55
|
outline-offset: 0px;
|
|
44
56
|
box-shadow: inset 0 0 0px 4px var(--primary-white);
|
|
45
57
|
}
|
|
46
|
-
.a-navbar-item.active, .a-navbar-item.nuxt-link-exact-active, .a-navbar-item.router-link-exact-active {
|
|
47
|
-
background-color: var(--nav-icon-background, #
|
|
58
|
+
.a-navbar-item.classic.active, .a-navbar-item.classic.nuxt-link-exact-active, .a-navbar-item.classic.router-link-exact-active {
|
|
59
|
+
background-color: var(--nav-icon-background, #f7f5f9);
|
|
48
60
|
font-weight: 500;
|
|
49
|
-
color: #
|
|
61
|
+
color: #2d2d2d;
|
|
50
62
|
}
|
|
51
|
-
.a-navbar-item.active svg path, .a-navbar-item.nuxt-link-exact-active svg path, .a-navbar-item.router-link-exact-active svg path {
|
|
63
|
+
.a-navbar-item.classic.active svg path, .a-navbar-item.classic.nuxt-link-exact-active svg path, .a-navbar-item.classic.router-link-exact-active svg path {
|
|
52
64
|
stroke-width: 1.5px;
|
|
53
65
|
}
|
|
54
|
-
.a-navbar-item:hover {
|
|
55
|
-
background-color: var(--nav-icon-background, #
|
|
66
|
+
.a-navbar-item.classic:hover {
|
|
67
|
+
background-color: var(--nav-icon-background, #f7f5f9);
|
|
56
68
|
}
|
|
57
|
-
.a-navbar-item:focus-visible {
|
|
69
|
+
.a-navbar-item.classic:focus-visible {
|
|
58
70
|
outline: var(--orange) auto 2px;
|
|
59
71
|
outline-offset: 0px;
|
|
60
72
|
box-shadow: inset 0 0 0px 4px var(--primary-white);
|
|
61
73
|
}
|
|
62
|
-
.a-navbar-item:last-child {
|
|
74
|
+
.a-navbar-item.classic:last-child {
|
|
63
75
|
margin-bottom: 8px;
|
|
64
76
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
.a-navbar-item.classic .icon-container {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
}
|
|
82
|
+
.a-navbar-item.classic .icon-container .icon {
|
|
83
|
+
font-size: 24px;
|
|
84
|
+
margin-right: 24px;
|
|
68
85
|
margin-left: 8px;
|
|
69
86
|
}
|
|
87
|
+
.a-navbar-item.beacon {
|
|
88
|
+
background-color: transparent;
|
|
89
|
+
color: inherit;
|
|
90
|
+
padding: 10px 12px;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
text-decoration: none;
|
|
94
|
+
text-transform: capitalize;
|
|
95
|
+
border: none;
|
|
96
|
+
border-radius: 8px;
|
|
97
|
+
user-select: none;
|
|
98
|
+
}
|
|
99
|
+
.a-navbar-item.beacon.collapsed {
|
|
100
|
+
justify-content: center;
|
|
101
|
+
margin: 8px;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
.a-navbar-item.beacon:focus-visible {
|
|
105
|
+
outline: var(--orange) auto 2px;
|
|
106
|
+
outline-offset: 0px;
|
|
107
|
+
box-shadow: inset 0 0 0px 4px var(--primary-white);
|
|
108
|
+
}
|
|
109
|
+
.a-navbar-item.beacon.active, .a-navbar-item.beacon.nuxt-link-exact-active, .a-navbar-item.beacon.router-link-exact-active {
|
|
110
|
+
background-color: #662e80;
|
|
111
|
+
font-weight: 500;
|
|
112
|
+
color: #ffffff;
|
|
113
|
+
}
|
|
114
|
+
.a-navbar-item.beacon.active svg path, .a-navbar-item.beacon.nuxt-link-exact-active svg path, .a-navbar-item.beacon.router-link-exact-active svg path {
|
|
115
|
+
stroke-width: 1.5px;
|
|
116
|
+
}
|
|
117
|
+
.a-navbar-item.beacon:hover:not(.active):not(.nuxt-link-exact-active):not(.router-link-exact-active) {
|
|
118
|
+
background-color: #e9e9e9;
|
|
119
|
+
color: inherit;
|
|
120
|
+
}
|
|
121
|
+
.a-navbar-item.beacon:focus-visible {
|
|
122
|
+
outline: var(--orange) auto 2px;
|
|
123
|
+
outline-offset: -1px;
|
|
124
|
+
box-shadow: inset 0 0 0px 4px var(--primary-white);
|
|
125
|
+
}
|
|
126
|
+
.a-navbar-item.beacon:last-child {
|
|
127
|
+
margin-bottom: 8px;
|
|
128
|
+
}
|
|
129
|
+
.a-navbar-item.beacon .icon-container {
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
70
132
|
</style>
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="a-nav-section"
|
|
4
|
-
:class="{ active }"
|
|
5
|
-
>
|
|
2
|
+
<div :class="['a-nav-section', isBeaconNavEnabled ? 'beacon' : 'classic', { active, collapsed }]">
|
|
6
3
|
<NuxtLink
|
|
7
|
-
v-if="!collapsed"
|
|
4
|
+
v-if="isBeaconNavEnabled || !collapsed"
|
|
8
5
|
class="a-nav-section--link"
|
|
9
6
|
:to="applicationUrl"
|
|
10
7
|
:target="application.target"
|
|
11
8
|
:aria-label="appText"
|
|
12
9
|
>
|
|
13
|
-
<
|
|
10
|
+
<slot
|
|
11
|
+
v-if="isBeaconNavEnabled"
|
|
12
|
+
name="icon"
|
|
13
|
+
>
|
|
14
|
+
<Icon
|
|
15
|
+
class="app-icon"
|
|
16
|
+
:name="getApplicationIcon(application.text)"
|
|
17
|
+
size="16"
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
/>
|
|
20
|
+
</slot>
|
|
21
|
+
<span
|
|
22
|
+
v-if="expanded"
|
|
23
|
+
:class="['app-name', { uppercase: isUpperCaseAppName(appText) }]"
|
|
24
|
+
>{{ appText }}</span
|
|
25
|
+
>
|
|
14
26
|
<a-icon
|
|
15
27
|
v-if="expanded && active"
|
|
16
28
|
:class="['caret-icon', { collapse: !isOpen }]"
|
|
@@ -31,9 +43,11 @@
|
|
|
31
43
|
</template>
|
|
32
44
|
|
|
33
45
|
<script setup>
|
|
34
|
-
import { useSidebar, computed, ref } from "#imports";
|
|
46
|
+
import { useSidebar, computed, ref, useNuxtApp } from "#imports";
|
|
35
47
|
import { isEngageApplication, rewriteEngageUrl } from "../../utils/application";
|
|
48
|
+
import { APPLICATION_ICONS } from "../../utils/constants";
|
|
36
49
|
const NEWSLETTERS_APP_TEXT = "Newsletters";
|
|
50
|
+
const { $ld } = useNuxtApp();
|
|
37
51
|
const props = defineProps({
|
|
38
52
|
application: { type: Object, required: true },
|
|
39
53
|
active: { type: Boolean, required: true },
|
|
@@ -42,6 +56,9 @@ const props = defineProps({
|
|
|
42
56
|
const { state: expanded } = useSidebar();
|
|
43
57
|
const isOpen = ref(true);
|
|
44
58
|
const isEngageApp = computed(() => isEngageApplication(props.application?.text, props.application?.id));
|
|
59
|
+
const isBeaconNavEnabled = computed(() => {
|
|
60
|
+
return Boolean($ld?.flags?.beaconNavEnabled);
|
|
61
|
+
});
|
|
45
62
|
const appText = computed(() => {
|
|
46
63
|
const { text } = props.application || {};
|
|
47
64
|
if (isEngageApp.value) {
|
|
@@ -59,27 +76,38 @@ const applicationUrl = computed(() => {
|
|
|
59
76
|
}
|
|
60
77
|
return url;
|
|
61
78
|
});
|
|
79
|
+
const isUpperCaseAppName = (appText2) => {
|
|
80
|
+
switch (appText2) {
|
|
81
|
+
case "cms":
|
|
82
|
+
return true;
|
|
83
|
+
default:
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const getApplicationIcon = (applicationText) => {
|
|
88
|
+
return APPLICATION_ICONS[applicationText.toLowerCase()] || "lucide:square-menu";
|
|
89
|
+
};
|
|
62
90
|
</script>
|
|
63
91
|
|
|
64
92
|
<style scoped>
|
|
65
|
-
.a-nav-section {
|
|
66
|
-
box-shadow: inset 0px -1px 0px 0px var(--nav-icon-background, #dfdfdf);
|
|
93
|
+
.a-nav-section.classic {
|
|
67
94
|
min-height: 48px;
|
|
95
|
+
box-shadow: inset 0px -1px 0px 0px var(--nav-icon-background, #dfdfdf);
|
|
68
96
|
}
|
|
69
|
-
.a-nav-section.active {
|
|
97
|
+
.a-nav-section.classic.active {
|
|
70
98
|
box-shadow: inset 0px -1px 0px 0px var(--nav-icon-background, #dfdfdf);
|
|
71
99
|
}
|
|
72
|
-
.a-nav-section--content {
|
|
100
|
+
.a-nav-section.classic .a-nav-section--content {
|
|
73
101
|
display: flex;
|
|
74
102
|
flex-direction: column;
|
|
75
103
|
max-height: 100vh;
|
|
76
104
|
overflow: auto;
|
|
77
105
|
transition: max-height 0.3s ease;
|
|
78
106
|
}
|
|
79
|
-
.a-nav-section--content.collapse {
|
|
107
|
+
.a-nav-section.classic .a-nav-section--content.collapse {
|
|
80
108
|
max-height: 0;
|
|
81
109
|
}
|
|
82
|
-
.a-nav-section--link {
|
|
110
|
+
.a-nav-section.classic .a-nav-section--link {
|
|
83
111
|
display: flex;
|
|
84
112
|
color: inherit;
|
|
85
113
|
text-decoration: none;
|
|
@@ -92,37 +120,120 @@ const applicationUrl = computed(() => {
|
|
|
92
120
|
width: 100%;
|
|
93
121
|
user-select: none;
|
|
94
122
|
}
|
|
95
|
-
.a-nav-section--link svg:first-child {
|
|
123
|
+
.a-nav-section.classic .a-nav-section--link svg:first-child {
|
|
96
124
|
background: var(--nav-icon-background, #dfdfdf);
|
|
97
125
|
color: var(--nav-icon-color, var(--eggplant-30));
|
|
98
126
|
border-radius: 4px;
|
|
99
127
|
min-width: 32px;
|
|
100
128
|
min-height: 32px;
|
|
101
129
|
}
|
|
102
|
-
.a-nav-section--link svg:first-child.active {
|
|
130
|
+
.a-nav-section.classic .a-nav-section--link svg:first-child.active {
|
|
103
131
|
background: var(--nav-active-icon-background, var(--orange-40));
|
|
104
132
|
color: var(--nav-active-icon-color, var(--primary-white));
|
|
105
133
|
}
|
|
106
|
-
.a-nav-section--link:not([href]) {
|
|
134
|
+
.a-nav-section.classic .a-nav-section--link:not([href]) {
|
|
107
135
|
cursor: default;
|
|
108
136
|
}
|
|
109
|
-
.a-nav-section--link:focus-visible {
|
|
137
|
+
.a-nav-section.classic .a-nav-section--link:focus-visible {
|
|
110
138
|
outline: var(--orange) auto 2px;
|
|
111
139
|
outline-offset: 0px;
|
|
112
140
|
box-shadow: inset 0 0 0px 4px var(--primary-white);
|
|
113
141
|
}
|
|
114
|
-
.a-nav-section--link
|
|
142
|
+
.a-nav-section.classic .a-nav-section--link .app-name {
|
|
115
143
|
margin: 0 8px;
|
|
116
144
|
white-space: nowrap;
|
|
117
145
|
text-transform: uppercase;
|
|
118
146
|
width: inherit;
|
|
119
147
|
}
|
|
120
|
-
.a-nav-section--link .caret-icon {
|
|
148
|
+
.a-nav-section.classic .a-nav-section--link .caret-icon {
|
|
121
149
|
cursor: pointer;
|
|
122
150
|
font-size: 24px;
|
|
123
151
|
transition: transform 0.2s ease-in-out;
|
|
124
152
|
}
|
|
125
|
-
.a-nav-section--link .caret-icon.collapse {
|
|
153
|
+
.a-nav-section.classic .a-nav-section--link .caret-icon.collapse {
|
|
154
|
+
transform: rotate(0.5turn);
|
|
155
|
+
}
|
|
156
|
+
.a-nav-section.beacon.collapsed .a-nav-section--content {
|
|
157
|
+
display: none;
|
|
158
|
+
}
|
|
159
|
+
.a-nav-section.beacon.collapsed .a-nav-section--link {
|
|
160
|
+
justify-content: center;
|
|
161
|
+
gap: 0;
|
|
162
|
+
padding: 8px 0;
|
|
163
|
+
}
|
|
164
|
+
.a-nav-section.beacon.collapsed .a-nav-section--link .app-icon {
|
|
165
|
+
margin-right: 0;
|
|
166
|
+
}
|
|
167
|
+
.a-nav-section.beacon.collapsed.active .a-nav-section--link {
|
|
168
|
+
background-color: #662e80;
|
|
169
|
+
color: var(--primary-white, #ffffff);
|
|
170
|
+
border-radius: 8px;
|
|
171
|
+
}
|
|
172
|
+
.a-nav-section.beacon .a-nav-section--content {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
gap: 2px;
|
|
176
|
+
max-height: 100vh;
|
|
177
|
+
overflow: auto;
|
|
178
|
+
transition: max-height 0.3s ease;
|
|
179
|
+
padding-left: 24px;
|
|
180
|
+
}
|
|
181
|
+
.a-nav-section.beacon .a-nav-section--content.collapse {
|
|
182
|
+
max-height: 0;
|
|
183
|
+
}
|
|
184
|
+
.a-nav-section.beacon .a-nav-section--link {
|
|
185
|
+
display: flex;
|
|
186
|
+
gap: 8px;
|
|
187
|
+
align-items: center;
|
|
188
|
+
padding: 8px 12px;
|
|
189
|
+
color: inherit;
|
|
190
|
+
text-decoration: none;
|
|
191
|
+
width: 100%;
|
|
192
|
+
min-height: 40px;
|
|
193
|
+
max-height: 40px;
|
|
194
|
+
}
|
|
195
|
+
.a-nav-section.beacon .a-nav-section--link:hover {
|
|
196
|
+
background-color: #e9e9e9;
|
|
197
|
+
color: inherit;
|
|
198
|
+
border-radius: 8px;
|
|
199
|
+
}
|
|
200
|
+
.a-nav-section.beacon .a-nav-section--link .app-icon {
|
|
201
|
+
margin-right: 4px;
|
|
202
|
+
min-width: 16px;
|
|
203
|
+
min-height: 16px;
|
|
204
|
+
max-width: 16px;
|
|
205
|
+
max-height: 16px;
|
|
206
|
+
}
|
|
207
|
+
.a-nav-section.beacon .a-nav-section--link svg:first-child {
|
|
208
|
+
color: inherit;
|
|
209
|
+
border-radius: 4px;
|
|
210
|
+
}
|
|
211
|
+
.a-nav-section.beacon .a-nav-section--link:not([href]) {
|
|
212
|
+
cursor: default;
|
|
213
|
+
}
|
|
214
|
+
.a-nav-section.beacon .a-nav-section--link:focus-visible {
|
|
215
|
+
outline: var(--orange) auto 2px;
|
|
216
|
+
outline-offset: 0px;
|
|
217
|
+
box-shadow: inset 0 0 0px 4px var(--primary-white);
|
|
218
|
+
}
|
|
219
|
+
.a-nav-section.beacon .a-nav-section--link .app-name {
|
|
220
|
+
white-space: nowrap;
|
|
221
|
+
text-transform: capitalize;
|
|
222
|
+
width: fit-content;
|
|
223
|
+
line-height: normal;
|
|
224
|
+
}
|
|
225
|
+
.a-nav-section.beacon .a-nav-section--link .app-name.uppercase {
|
|
226
|
+
text-transform: uppercase;
|
|
227
|
+
}
|
|
228
|
+
.a-nav-section.beacon .a-nav-section--link .caret-icon {
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
min-height: 12px;
|
|
231
|
+
min-width: 12px;
|
|
232
|
+
max-height: 12px;
|
|
233
|
+
max-width: 12px;
|
|
234
|
+
transition: transform 0.2s ease-in-out;
|
|
235
|
+
}
|
|
236
|
+
.a-nav-section.beacon .a-nav-section--link .caret-icon.collapse {
|
|
126
237
|
transform: rotate(0.5turn);
|
|
127
238
|
}
|
|
128
239
|
</style>
|
|
@@ -4,9 +4,11 @@ type __VLS_Props = {
|
|
|
4
4
|
active: boolean;
|
|
5
5
|
collapsed: boolean;
|
|
6
6
|
};
|
|
7
|
-
declare var
|
|
7
|
+
declare var __VLS_6: {}, __VLS_29: {};
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
9
|
-
|
|
9
|
+
icon?: (props: typeof __VLS_6) => any;
|
|
10
|
+
} & {
|
|
11
|
+
default?: (props: typeof __VLS_29) => any;
|
|
10
12
|
};
|
|
11
13
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
14
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useDropdown, useAppConfig, computed, ref } from "#imports";
|
|
2
|
+
import { useDropdown, useAppConfig, computed, ref, useNuxtApp } from "#imports";
|
|
3
3
|
import { vOnClickOutside } from "@vueuse/components";
|
|
4
4
|
const appConfig = useAppConfig();
|
|
5
|
+
const { $ld } = useNuxtApp();
|
|
5
6
|
const zIndex = computed(() => appConfig?.navigation?.zIndex || 100);
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
user: { type: Object, required: true },
|
|
@@ -10,19 +11,11 @@ const props = defineProps({
|
|
|
10
11
|
});
|
|
11
12
|
const dropdownTriggerRef = ref();
|
|
12
13
|
const dropdownOptionsRef = ref();
|
|
13
|
-
const {
|
|
14
|
-
active,
|
|
15
|
-
toggleDropdown,
|
|
16
|
-
closeDropdown,
|
|
17
|
-
keydownActionsOnTrigger,
|
|
18
|
-
handleKeydown,
|
|
19
|
-
onClickOutsideHandler
|
|
20
|
-
} = useDropdown(
|
|
21
|
-
props.userDropdownOptions,
|
|
22
|
-
dropdownOptionsRef,
|
|
23
|
-
dropdownTriggerRef
|
|
24
|
-
);
|
|
14
|
+
const { active, toggleDropdown, closeDropdown, keydownActionsOnTrigger, handleKeydown, onClickOutsideHandler } = useDropdown(props.userDropdownOptions, dropdownOptionsRef, dropdownTriggerRef);
|
|
25
15
|
const emit = defineEmits(["select-option"]);
|
|
16
|
+
const isBeaconNavEnabled = computed(() => {
|
|
17
|
+
return Boolean($ld?.flags?.beaconNavEnabled);
|
|
18
|
+
});
|
|
26
19
|
function handleSelectedClick(index) {
|
|
27
20
|
emit("select-option", index);
|
|
28
21
|
closeDropdown();
|
|
@@ -44,31 +37,41 @@ function handleKeydownAction($event, index) {
|
|
|
44
37
|
aria-haspopup="listbox"
|
|
45
38
|
role="combobox"
|
|
46
39
|
tabindex="0"
|
|
47
|
-
class="header__dropdown"
|
|
40
|
+
:class="['header__dropdown', isBeaconNavEnabled ? 'beacon' : 'classic']"
|
|
48
41
|
@keydown="keydownActionsOnTrigger"
|
|
49
42
|
@click.prevent="toggleDropdown"
|
|
50
43
|
>
|
|
51
|
-
<NavAvatar
|
|
52
|
-
|
|
44
|
+
<NavAvatar
|
|
45
|
+
:name="user.name"
|
|
46
|
+
:src="user.avatar"
|
|
47
|
+
:is-beacon-nav-enabled="isBeaconNavEnabled"
|
|
48
|
+
/>
|
|
49
|
+
<NavIconsUserDropdownMenu v-if="!isBeaconNavEnabled" />
|
|
53
50
|
<span class="sr-only">{{ $t("navigation.userDropdown") }}</span>
|
|
54
51
|
</div>
|
|
55
52
|
<div
|
|
56
53
|
v-show="active"
|
|
57
54
|
id="user-dropdown"
|
|
58
|
-
class="options-dropdown"
|
|
55
|
+
:class="['options-dropdown', isBeaconNavEnabled ? 'beacon' : 'classic']"
|
|
59
56
|
role="listbox"
|
|
60
57
|
>
|
|
61
58
|
<div class="user-info">
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
<span class="user-info-title">{{ $t("navigation.userDropdown") }}</span>
|
|
60
|
+
<div class="user-info-details">
|
|
61
|
+
<NavAvatar
|
|
62
|
+
:name="user.name"
|
|
63
|
+
:src="user.avatar"
|
|
64
|
+
:is-impersonated="impersonatedUser?.show"
|
|
65
|
+
:is-beacon-nav-enabled="isBeaconNavEnabled"
|
|
66
|
+
style="--size: 40px"
|
|
67
|
+
/>
|
|
68
|
+
<div class="user-info-details-container">
|
|
69
|
+
<span class="user-info-name"> {{ user.name }} </span>
|
|
70
|
+
<span class="user-info-email"> {{ user.email }} </span>
|
|
69
71
|
</div>
|
|
72
|
+
</div>
|
|
70
73
|
</div>
|
|
71
|
-
<hr
|
|
74
|
+
<hr />
|
|
72
75
|
<div
|
|
73
76
|
v-for="(option, idx) in userDropdownOptions"
|
|
74
77
|
:key="option.label"
|
|
@@ -81,7 +84,10 @@ function handleKeydownAction($event, index) {
|
|
|
81
84
|
@click="handleSelectedClick(idx)"
|
|
82
85
|
>
|
|
83
86
|
<!-- because of the the above handler, this component is never treated as a link and can't redirect natively? -->
|
|
84
|
-
<NuxtLink
|
|
87
|
+
<NuxtLink
|
|
88
|
+
class="option"
|
|
89
|
+
:to="option.url"
|
|
90
|
+
>
|
|
85
91
|
{{ option.label }}
|
|
86
92
|
</NuxtLink>
|
|
87
93
|
</div>
|
|
@@ -89,7 +95,7 @@ function handleKeydownAction($event, index) {
|
|
|
89
95
|
</template>
|
|
90
96
|
|
|
91
97
|
<style scoped>
|
|
92
|
-
.header__dropdown {
|
|
98
|
+
.header__dropdown.classic {
|
|
93
99
|
font-size: 24px;
|
|
94
100
|
min-width: 64px;
|
|
95
101
|
width: 64px;
|
|
@@ -106,62 +112,123 @@ function handleKeydownAction($event, index) {
|
|
|
106
112
|
align-items: center;
|
|
107
113
|
cursor: pointer;
|
|
108
114
|
}
|
|
109
|
-
.header__dropdown:focus-visible {
|
|
115
|
+
.header__dropdown.classic:focus-visible {
|
|
116
|
+
box-shadow: 0 0 0 2px var(--primary-white), 0 0 0 3px var(--purple);
|
|
117
|
+
}
|
|
118
|
+
.header__dropdown.classic .avatar-container:focus-visible {
|
|
119
|
+
outline: none;
|
|
120
|
+
}
|
|
121
|
+
.header__dropdown.beacon {
|
|
122
|
+
width: fit-content;
|
|
123
|
+
border: none;
|
|
124
|
+
padding: 0;
|
|
125
|
+
outline: none;
|
|
126
|
+
color: var(--purple);
|
|
127
|
+
background: var(--purple-20);
|
|
128
|
+
border-radius: 16px;
|
|
129
|
+
text-align: left;
|
|
130
|
+
position: relative;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
}
|
|
136
|
+
.header__dropdown.beacon:focus-visible {
|
|
110
137
|
box-shadow: 0 0 0 2px var(--primary-white), 0 0 0 3px var(--purple);
|
|
111
138
|
}
|
|
112
|
-
.header__dropdown .avatar-container:focus-visible {
|
|
139
|
+
.header__dropdown.beacon .avatar-container:focus-visible {
|
|
113
140
|
outline: none;
|
|
114
141
|
}
|
|
115
142
|
|
|
116
|
-
|
|
143
|
+
.options-dropdown.classic {
|
|
144
|
+
min-height: 100px;
|
|
145
|
+
position: absolute;
|
|
146
|
+
max-width: 512px;
|
|
147
|
+
right: 65px;
|
|
148
|
+
top: 72px;
|
|
149
|
+
background-color: var(--primary-white);
|
|
150
|
+
border-radius: 4px;
|
|
151
|
+
box-shadow: 0px 6px 20px 0px rgba(0, 0, 0, 0.06);
|
|
152
|
+
padding: 8px;
|
|
153
|
+
z-index: v-bind(zIndex);
|
|
154
|
+
}
|
|
155
|
+
.options-dropdown.classic hr {
|
|
117
156
|
border: 0;
|
|
118
157
|
border-top: 1px solid var(--grey-20);
|
|
119
158
|
margin: 8px 0;
|
|
120
159
|
}
|
|
121
|
-
|
|
122
|
-
|
|
160
|
+
.options-dropdown.classic .option-wrapper {
|
|
161
|
+
padding: 8px;
|
|
162
|
+
border-radius: 4px;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
.options-dropdown.classic .option-wrapper .option {
|
|
166
|
+
display: flex;
|
|
167
|
+
gap: 8px;
|
|
168
|
+
justify-content: space-between;
|
|
169
|
+
align-items: center;
|
|
170
|
+
color: var(--primary-dark);
|
|
171
|
+
text-decoration: none;
|
|
172
|
+
}
|
|
173
|
+
.options-dropdown.classic .option-wrapper:focus-visible, .options-dropdown.classic .option-wrapper:hover {
|
|
174
|
+
background-color: var(--purple-20);
|
|
175
|
+
}
|
|
176
|
+
.options-dropdown.classic .option-wrapper:focus-visible .option, .options-dropdown.classic .option-wrapper:hover .option {
|
|
177
|
+
color: var(--purple);
|
|
178
|
+
}
|
|
179
|
+
.options-dropdown.classic .user-info {
|
|
123
180
|
display: flex;
|
|
124
181
|
flex-direction: column;
|
|
125
182
|
gap: 12px;
|
|
126
183
|
padding: 8px;
|
|
127
184
|
}
|
|
128
|
-
.user-info .user-info-title {
|
|
185
|
+
.options-dropdown.classic .user-info .user-info-title {
|
|
129
186
|
font-weight: bold;
|
|
130
187
|
font-size: 12px;
|
|
131
188
|
color: var(--grey-60);
|
|
132
189
|
text-transform: uppercase;
|
|
133
190
|
}
|
|
134
|
-
.user-info .user-info-details {
|
|
191
|
+
.options-dropdown.classic .user-info .user-info-details {
|
|
135
192
|
display: flex;
|
|
136
193
|
gap: 4px;
|
|
137
194
|
}
|
|
138
|
-
.user-info .user-info-details .user-info-details-container {
|
|
195
|
+
.options-dropdown.classic .user-info .user-info-details .user-info-details-container {
|
|
139
196
|
display: flex;
|
|
140
197
|
flex-direction: column;
|
|
141
198
|
}
|
|
142
|
-
.user-info .user-info-details .user-info-details-container .user-info-email {
|
|
199
|
+
.options-dropdown.classic .user-info .user-info-details .user-info-details-container .user-info-email {
|
|
143
200
|
font-size: 12px;
|
|
144
201
|
color: var(--grey-50);
|
|
145
202
|
}
|
|
146
|
-
|
|
147
|
-
.options-dropdown {
|
|
148
|
-
min-height: 100px;
|
|
203
|
+
.options-dropdown.beacon {
|
|
149
204
|
position: absolute;
|
|
205
|
+
min-height: 100px;
|
|
206
|
+
min-width: 200px;
|
|
150
207
|
max-width: 512px;
|
|
151
|
-
right:
|
|
152
|
-
top:
|
|
208
|
+
right: 0;
|
|
209
|
+
top: 36px;
|
|
153
210
|
background-color: var(--primary-white);
|
|
154
|
-
border-radius:
|
|
211
|
+
border-radius: 8px;
|
|
155
212
|
box-shadow: 0px 6px 20px 0px rgba(0, 0, 0, 0.06);
|
|
156
213
|
padding: 8px;
|
|
157
214
|
z-index: v-bind(zIndex);
|
|
215
|
+
border: 1px solid #d3d3d3;
|
|
158
216
|
}
|
|
159
|
-
.options-dropdown
|
|
217
|
+
.options-dropdown.beacon hr {
|
|
218
|
+
border: 0;
|
|
219
|
+
border-top: 1px solid #d3d3d3;
|
|
220
|
+
margin: 8px 0;
|
|
221
|
+
}
|
|
222
|
+
.options-dropdown.beacon .option-wrapper {
|
|
160
223
|
padding: 8px;
|
|
161
224
|
border-radius: 4px;
|
|
162
225
|
cursor: pointer;
|
|
226
|
+
font-weight: 400;
|
|
227
|
+
font-size: 14px;
|
|
228
|
+
line-height: 140%;
|
|
229
|
+
letter-spacing: 0.5px;
|
|
163
230
|
}
|
|
164
|
-
.options-dropdown .option-wrapper .option {
|
|
231
|
+
.options-dropdown.beacon .option-wrapper .option {
|
|
165
232
|
display: flex;
|
|
166
233
|
gap: 8px;
|
|
167
234
|
justify-content: space-between;
|
|
@@ -169,10 +236,42 @@ hr {
|
|
|
169
236
|
color: var(--primary-dark);
|
|
170
237
|
text-decoration: none;
|
|
171
238
|
}
|
|
172
|
-
.options-dropdown .option-wrapper:focus-visible, .options-dropdown .option-wrapper:hover {
|
|
239
|
+
.options-dropdown.beacon .option-wrapper:focus-visible, .options-dropdown.beacon .option-wrapper:hover {
|
|
173
240
|
background-color: var(--purple-20);
|
|
174
241
|
}
|
|
175
|
-
.options-dropdown .option-wrapper:focus-visible .option, .options-dropdown .option-wrapper:hover .option {
|
|
242
|
+
.options-dropdown.beacon .option-wrapper:focus-visible .option, .options-dropdown.beacon .option-wrapper:hover .option {
|
|
176
243
|
color: var(--purple);
|
|
177
244
|
}
|
|
245
|
+
.options-dropdown.beacon .user-info {
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-direction: column;
|
|
248
|
+
gap: 12px;
|
|
249
|
+
padding: 8px;
|
|
250
|
+
}
|
|
251
|
+
.options-dropdown.beacon .user-info .user-info-title {
|
|
252
|
+
display: none;
|
|
253
|
+
}
|
|
254
|
+
.options-dropdown.beacon .user-info .user-info-details {
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: flex-start;
|
|
257
|
+
gap: 8px;
|
|
258
|
+
}
|
|
259
|
+
.options-dropdown.beacon .user-info .user-info-details .user-info-details-container {
|
|
260
|
+
display: flex;
|
|
261
|
+
flex-direction: column;
|
|
262
|
+
}
|
|
263
|
+
.options-dropdown.beacon .user-info .user-info-details .user-info-details-container .user-info-name {
|
|
264
|
+
font-weight: 500;
|
|
265
|
+
font-size: 14px;
|
|
266
|
+
line-height: 140%;
|
|
267
|
+
letter-spacing: 0.5px;
|
|
268
|
+
}
|
|
269
|
+
.options-dropdown.beacon .user-info .user-info-details .user-info-details-container .user-info-email {
|
|
270
|
+
color: #757575;
|
|
271
|
+
font-family: font/body;
|
|
272
|
+
font-weight: 400;
|
|
273
|
+
font-size: 14px;
|
|
274
|
+
line-height: 140%;
|
|
275
|
+
letter-spacing: 0.5px;
|
|
276
|
+
}
|
|
178
277
|
</style>
|
|
@@ -12,4 +12,4 @@ export interface IUser {
|
|
|
12
12
|
client: string;
|
|
13
13
|
admin_email: string;
|
|
14
14
|
}
|
|
15
|
-
export type { NotificationType, NotificationApiState, INotificationApiActor,
|
|
15
|
+
export type { NotificationType, NotificationApiState, INotificationApiActor, INotificationApiRecord, INotificationsPagination, INotificationsApiResponse, INotificationActor, INotificationItem, INotificationGroup, INotificationTab, INotificationFilter, INotificationsPanelData, INotificationsHeaderModel, } from './notifications.js';
|