@apptegy/nuxt-navigation 0.1.25 → 0.1.27
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/Sidebar.vue +10 -1
- package/dist/runtime/composables/useBranding.d.ts +2 -20
- package/dist/runtime/composables/useBranding.js +5 -2
- package/dist/runtime/composables/useDropdown.d.ts +3 -3
- package/dist/runtime/composables/useDropdown.js +14 -7
- package/dist/runtime/composables/useSidebar.d.ts +1 -1
- package/package.json +10 -8
package/dist/module.json
CHANGED
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</template>
|
|
71
71
|
|
|
72
72
|
<script setup lang="ts">
|
|
73
|
-
import { useSidebar, useBranding, ref } from '#imports';
|
|
73
|
+
import { useSidebar, useBranding, ref, watch } from '#imports';
|
|
74
74
|
import type { IApplication, IUser } from "../../types";
|
|
75
75
|
import tsBrandLogo from '../../assets/thrillshare-logo-white.svg';
|
|
76
76
|
|
|
@@ -114,11 +114,20 @@ const props = withDefaults(defineProps<ISidebarProps>(), {
|
|
|
114
114
|
clientId: undefined,
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
+
const emit = defineEmits<{
|
|
118
|
+
(e: 'toggle-expand', width: number): void
|
|
119
|
+
}>();
|
|
120
|
+
|
|
117
121
|
const { state: expanded } = useSidebar();
|
|
118
122
|
const { brand, getBrandingStyles } = await useBranding(props.clientId);
|
|
119
123
|
|
|
120
124
|
const brandLogo = ref(brand.value?.logo_light || tsBrandLogo);
|
|
121
125
|
|
|
126
|
+
// Emit event when expanded changes with the
|
|
127
|
+
// width of the component.
|
|
128
|
+
watch(expanded, (value) => {
|
|
129
|
+
emit('toggle-expand', value ? 264 : 64);
|
|
130
|
+
})
|
|
122
131
|
|
|
123
132
|
// Debounced Expand on Hover
|
|
124
133
|
let expandedTimer = null;
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
export declare function useBranding(clientId?: number): Promise<{
|
|
2
|
-
brand:
|
|
3
|
-
getBrandingStyles:
|
|
4
|
-
'--brand-color'?: undefined;
|
|
5
|
-
'--nav-background-color'?: undefined;
|
|
6
|
-
'--nav-text-color'?: undefined;
|
|
7
|
-
'--nav-border-colors'?: undefined;
|
|
8
|
-
'--nav-icon-background'?: undefined;
|
|
9
|
-
'--nav-icon-color'?: undefined;
|
|
10
|
-
'--nav-active-icon-background'?: undefined;
|
|
11
|
-
'--nav-active-icon-color'?: undefined;
|
|
12
|
-
} | {
|
|
13
|
-
'--brand-color': any;
|
|
14
|
-
'--nav-background-color': string;
|
|
15
|
-
'--nav-text-color': string;
|
|
16
|
-
'--nav-border-colors': string;
|
|
17
|
-
'--nav-icon-background': string;
|
|
18
|
-
'--nav-icon-color': string;
|
|
19
|
-
'--nav-active-icon-background': string;
|
|
20
|
-
'--nav-active-icon-color': string;
|
|
21
|
-
}>;
|
|
2
|
+
brand: any;
|
|
3
|
+
getBrandingStyles: any;
|
|
22
4
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, ref, useRuntimeConfig } from "#imports";
|
|
2
|
-
|
|
2
|
+
const brand = ref(null);
|
|
3
3
|
export async function useBranding(clientId) {
|
|
4
4
|
if (clientId !== void 0) {
|
|
5
5
|
const config = useRuntimeConfig();
|
|
@@ -13,7 +13,10 @@ export async function useBranding(clientId) {
|
|
|
13
13
|
}
|
|
14
14
|
const brandPrimaryColor = computed(() => brand.value?.colors?.primary_color.hex || "#000000");
|
|
15
15
|
const getBrandingStyles = computed(() => {
|
|
16
|
-
if (!brand.value)
|
|
16
|
+
if (!brand.value?.logo_dark && !brand.value?.logo_light || !brand.value) {
|
|
17
|
+
brand.value = null;
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
17
20
|
return {
|
|
18
21
|
"--brand-color": brandPrimaryColor.value,
|
|
19
22
|
"--nav-background-color": "#f6f6f6",
|
|
@@ -3,8 +3,8 @@ export declare function useDropdown(options: Array<unknown>, dropdownOptionsRef:
|
|
|
3
3
|
searchable: boolean;
|
|
4
4
|
trackBy?: string;
|
|
5
5
|
}): {
|
|
6
|
-
active:
|
|
7
|
-
searchQuery:
|
|
6
|
+
active: any;
|
|
7
|
+
searchQuery: any;
|
|
8
8
|
toggleDropdown: ($event: KeyboardEvent | MouseEvent) => Promise<void>;
|
|
9
9
|
openDropdown: () => void;
|
|
10
10
|
closeDropdown: () => void;
|
|
@@ -12,5 +12,5 @@ export declare function useDropdown(options: Array<unknown>, dropdownOptionsRef:
|
|
|
12
12
|
keydownActionsOnTrigger: (event: KeyboardEvent) => void;
|
|
13
13
|
handleKeydown: (event: KeyboardEvent, index: number) => number | undefined;
|
|
14
14
|
handleDropdownSearch: (inputValue: KeyboardEvent & InputEvent) => void;
|
|
15
|
-
debouncedFocus:
|
|
15
|
+
debouncedFocus: any;
|
|
16
16
|
};
|
|
@@ -18,17 +18,20 @@ export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, con
|
|
|
18
18
|
active.value = false;
|
|
19
19
|
}
|
|
20
20
|
function onClickOutsideHandler() {
|
|
21
|
-
if (!active.value)
|
|
21
|
+
if (!active.value)
|
|
22
|
+
return;
|
|
22
23
|
closeDropdown();
|
|
23
24
|
}
|
|
24
25
|
function keydownActionsOnTrigger(event) {
|
|
25
|
-
if (event.ctrlKey || event.metaKey || event.shiftKey)
|
|
26
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey)
|
|
27
|
+
return;
|
|
26
28
|
if (event.key !== "Tab") {
|
|
27
29
|
event.preventDefault();
|
|
28
30
|
}
|
|
29
31
|
switch (event.key) {
|
|
30
32
|
case "Tab":
|
|
31
|
-
if (!active.value)
|
|
33
|
+
if (!active.value)
|
|
34
|
+
return;
|
|
32
35
|
closeDropdown();
|
|
33
36
|
break;
|
|
34
37
|
case "ArrowDown":
|
|
@@ -93,7 +96,8 @@ export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, con
|
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
function handleKeydown(event, index) {
|
|
96
|
-
if (event.ctrlKey || event.metaKey || event.shiftKey)
|
|
99
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey)
|
|
100
|
+
return;
|
|
97
101
|
if (event.altKey && event.key === "ArrowUp") {
|
|
98
102
|
closeDropdown();
|
|
99
103
|
dropdownTriggerRef.value.focus();
|
|
@@ -127,13 +131,15 @@ export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, con
|
|
|
127
131
|
});
|
|
128
132
|
break;
|
|
129
133
|
case "ArrowDown":
|
|
130
|
-
if (index === options.length - 1)
|
|
134
|
+
if (index === options.length - 1)
|
|
135
|
+
break;
|
|
131
136
|
nextTick(() => {
|
|
132
137
|
dropdownOptionsRef.value[index + 1].focus();
|
|
133
138
|
});
|
|
134
139
|
return index;
|
|
135
140
|
case "ArrowUp":
|
|
136
|
-
if (index === 0)
|
|
141
|
+
if (index === 0)
|
|
142
|
+
break;
|
|
137
143
|
nextTick(() => {
|
|
138
144
|
dropdownOptionsRef.value[index - 1].focus();
|
|
139
145
|
});
|
|
@@ -170,7 +176,8 @@ export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, con
|
|
|
170
176
|
dropdownOptionsRef.value[idx].focus();
|
|
171
177
|
}, 500);
|
|
172
178
|
function handleDropdownSearch(inputValue) {
|
|
173
|
-
if (!config.searchable)
|
|
179
|
+
if (!config.searchable)
|
|
180
|
+
return;
|
|
174
181
|
if (inputValue.key == "Backspace") {
|
|
175
182
|
searchQuery.value = searchQuery.value.slice(0, -1);
|
|
176
183
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apptegy/nuxt-navigation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -26,24 +26,26 @@
|
|
|
26
26
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@nuxt
|
|
29
|
+
"@apptegy/nuxt-intl": "2.0.0-next.9",
|
|
30
|
+
"@nuxt/kit": "^3.15.4",
|
|
30
31
|
"@vueuse/components": "11.3.0",
|
|
31
32
|
"lodash": "^4.17.21"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@nuxt/devtools": "^1.
|
|
35
|
-
"@nuxt/eslint-config": "^0.7.
|
|
35
|
+
"@nuxt/devtools": "^1.7.0",
|
|
36
|
+
"@nuxt/eslint-config": "^0.7.6",
|
|
36
37
|
"@nuxt/module-builder": "^0.8.4",
|
|
37
|
-
"@nuxt/schema": "^3.
|
|
38
|
-
"@nuxt/test-utils": "^3.
|
|
38
|
+
"@nuxt/schema": "^3.15.4",
|
|
39
|
+
"@nuxt/test-utils": "^3.15.4",
|
|
39
40
|
"@types/node": "^20.17.9",
|
|
40
41
|
"changelogen": "^0.5.7",
|
|
41
42
|
"eslint": "^9.15.0",
|
|
42
|
-
"nuxt": "^3.
|
|
43
|
+
"nuxt": "^3.15.4",
|
|
43
44
|
"sass": "^1.81.0",
|
|
44
45
|
"typescript": "^5.7.2",
|
|
45
46
|
"vitest": "^2.1.6",
|
|
46
47
|
"vue": "^3.5.13",
|
|
47
48
|
"vue-tsc": "^2.1.10"
|
|
48
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "3f80f24cbe3b00bc1c234dd31484dd28d35f42a9"
|
|
49
51
|
}
|