@apptegy/nuxt-navigation 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apptegy/nuxt-navigation",
3
3
  "configKey": "@apptegy/nuxt-navigation",
4
- "version": "0.1.5",
4
+ "version": "0.1.6",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.3",
7
7
  "unbuild": "unknown"
@@ -4,18 +4,17 @@
4
4
  :class="{ sticky }"
5
5
  role="banner"
6
6
  >
7
- <NavSidebarToggle @toggle-sidebar="$emit('toggle-sidebar')"/>
7
+ <NavSidebarToggle />
8
8
  <div class="header__breadcrumbs">
9
9
  <slot name="breadcrumbs" />
10
10
  </div>
11
11
  <slot name="org-select" />
12
12
  <slot name="user-controls" />
13
- <NavUserDropdown :user="user" :user-dropdown-options="userDropdownOptions" :selected-option="selectedOptions" @select-option="$emit('selectedOption')"/>
13
+ <NavUserDropdown :user="user" :user-dropdown-options="userDropdownOptions" @select-option="(index) => $emit('selected-option', index)"/>
14
14
  </header>
15
15
  </template>
16
16
 
17
17
  <script setup lang="ts">
18
-
19
18
  interface IHeaderProps {
20
19
  sticky?: boolean;
21
20
  }
@@ -26,13 +25,10 @@ interface IUserDropdown {
26
25
  avatar?: string;
27
26
  };
28
27
  userDropdownOptions: Array<unknown>;
29
- selectedOption?: unknown
30
28
  }
31
29
 
32
-
33
30
  defineProps<IHeaderProps & IUserDropdown>();
34
- defineEmits(['toggle-sidebar', 'selectedOption']);
35
-
31
+ defineEmits(['selected-option']);
36
32
  </script>
37
33
 
38
34
  <style scoped>
@@ -54,8 +54,11 @@
54
54
  </template>
55
55
 
56
56
  <script setup lang="ts">
57
- import { useNuxtApp } from '#imports';
57
+ import { useNuxtApp, useSidebar, ref } from '#imports';
58
58
  const { $t } = useNuxtApp();
59
+ const { state } = useSidebar();
60
+
61
+ const expanded = ref(state);
59
62
 
60
63
  interface IApplications {
61
64
  id: number;
@@ -81,7 +84,6 @@ interface ILogo {
81
84
  interface ISidebarProps {
82
85
  applications: Array<IApplications>;
83
86
  currentApplication?: IApplications['text'];
84
- expanded?: boolean;
85
87
  homepageUrl?: string;
86
88
  showHelpArticles?: boolean;
87
89
  helpArticleOptions?: Array<unknown>;
@@ -94,7 +96,6 @@ withDefaults(defineProps<ISidebarProps>(), {
94
96
  currentApplication: 'media',
95
97
  homepageUrl: '/',
96
98
  showHelpArticles: true,
97
- expanded: true,
98
99
  helpArticleOptions: () => [],
99
100
  impersonatedUser: () => ({
100
101
  show: false,
@@ -109,6 +110,8 @@ withDefaults(defineProps<ISidebarProps>(), {
109
110
  iconSrc: 'logo.svg',
110
111
  })
111
112
  })
113
+
114
+
112
115
  </script>
113
116
 
114
117
  <style scoped>
@@ -17,7 +17,6 @@ import { computed } from 'vue';
17
17
  const props = defineProps<{
18
18
  application: IApplication;
19
19
  active: boolean;
20
- navbarExpanded: boolean;
21
20
  }>();
22
21
 
23
22
  const iconUrl = computed(() =>
@@ -5,12 +5,10 @@
5
5
  </button>
6
6
  </template>
7
7
 
8
- <script setup>
9
- const emit = defineEmits(["toggle-sidebar"]);
8
+ <script setup lang="ts">
9
+ import { useSidebar } from '#imports';
10
10
 
11
- function toggleSidebar() {
12
- emit("toggle-sidebar");
13
- }
11
+ const { toggleSidebar } = useSidebar();
14
12
  </script>
15
13
 
16
14
  <style scoped>
@@ -0,0 +1,5 @@
1
+ export declare function useSidebar(): {
2
+ state: any;
3
+ toggleSidebar: () => void;
4
+ sidebarWidth: any;
5
+ };
@@ -0,0 +1,13 @@
1
+ import { useState, ref, computed } from "#imports";
2
+ export function useSidebar() {
3
+ const state = useState("navigation:sidebar", () => ref(true));
4
+ function toggleSidebar() {
5
+ state.value = !state.value;
6
+ }
7
+ const sidebarWidth = computed(() => state.value ? "256px" : "0px");
8
+ return {
9
+ state,
10
+ toggleSidebar,
11
+ sidebarWidth
12
+ };
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apptegy/nuxt-navigation",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {