@apptegy/nuxt-navigation 0.1.44 → 0.1.45

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.44",
4
+ "version": "0.1.45",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "unknown"
@@ -1,22 +1,4 @@
1
1
  export declare function useBranding(clientId?: number): Promise<{
2
- brand: import("vue").Ref<null, null>;
3
- getBrandingStyles: import("vue").ComputedRef<{
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,10 +1,11 @@
1
1
  import type { Ref } from "#imports";
2
- export declare function useDropdown(options: Array<unknown>, dropdownOptionsRef: Ref<Array<HTMLElement>>, dropdownTriggerRef: Ref<HTMLElement>, config?: {
2
+ type OptionItem = string | Record<string, string | number | boolean>;
3
+ export declare function useDropdown(options: Array<OptionItem>, dropdownOptionsRef: Ref<Array<HTMLElement>>, dropdownTriggerRef: Ref<HTMLElement>, config?: {
3
4
  searchable: boolean;
4
5
  trackBy?: string;
5
6
  }): {
6
- active: Ref<boolean, boolean>;
7
- searchQuery: Ref<string, string>;
7
+ active: any;
8
+ searchQuery: any;
8
9
  toggleDropdown: ($event: KeyboardEvent | MouseEvent) => Promise<void>;
9
10
  openDropdown: () => void;
10
11
  closeDropdown: () => void;
@@ -12,5 +13,6 @@ export declare function useDropdown(options: Array<unknown>, dropdownOptionsRef:
12
13
  keydownActionsOnTrigger: (event: KeyboardEvent) => void;
13
14
  handleKeydown: (event: KeyboardEvent, index: number) => number | undefined;
14
15
  handleDropdownSearch: (inputValue: KeyboardEvent & InputEvent) => void;
15
- debouncedFocus: any;
16
+ debouncedFocus: import("@vueuse/core").PromisifyFn<(idx: number) => void>;
16
17
  };
18
+ export {};
@@ -1,4 +1,4 @@
1
- import debounce from "lodash/debounce";
1
+ import { useDebounceFn } from "@vueuse/core";
2
2
  import { ref, nextTick } from "#imports";
3
3
  export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, config = { searchable: false, trackBy: "name" }) {
4
4
  const active = ref(false);
@@ -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) return;
21
+ if (!active.value)
22
+ return;
22
23
  closeDropdown();
23
24
  }
24
25
  function keydownActionsOnTrigger(event) {
25
- if (event.ctrlKey || event.metaKey || event.shiftKey) return;
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) return;
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) return;
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) break;
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) break;
141
+ if (index === 0)
142
+ break;
137
143
  nextTick(() => {
138
144
  dropdownOptionsRef.value[index - 1].focus();
139
145
  });
@@ -166,11 +172,12 @@ export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, con
166
172
  break;
167
173
  }
168
174
  }
169
- const debouncedFocus = debounce((idx) => {
175
+ const debouncedFocus = useDebounceFn((idx) => {
170
176
  dropdownOptionsRef.value[idx].focus();
171
177
  }, 500);
172
178
  function handleDropdownSearch(inputValue) {
173
- if (!config.searchable) return;
179
+ if (!config.searchable)
180
+ return;
174
181
  if (inputValue.key == "Backspace") {
175
182
  searchQuery.value = searchQuery.value.slice(0, -1);
176
183
  return;
@@ -179,10 +186,16 @@ export function useDropdown(options, dropdownOptionsRef, dropdownTriggerRef, con
179
186
  searchQuery.value = `${searchQuery.value}${pressedKey}`;
180
187
  const searchIndex = options.findIndex((option) => {
181
188
  if (!config.trackBy) {
182
- return option.includes(searchQuery.value);
183
- } else {
184
- return option[config.trackBy].toLowerCase().includes(searchQuery.value.toLowerCase());
189
+ return typeof option === "string" && option.includes(searchQuery.value);
190
+ } else if (typeof option === "object" && option !== null && config.trackBy in option) {
191
+ const value = option[config.trackBy];
192
+ if (typeof value === "string") {
193
+ return value.toLowerCase().includes(searchQuery.value.toLowerCase());
194
+ } else if (value !== null && value !== void 0) {
195
+ return String(value).includes(searchQuery.value);
196
+ }
185
197
  }
198
+ return false;
186
199
  });
187
200
  if (searchIndex !== -1) {
188
201
  debouncedFocus(searchIndex);
@@ -1,5 +1,5 @@
1
1
  export declare function useSidebar(): {
2
- state: import("vue").Ref<boolean, boolean>;
2
+ state: any;
3
3
  toggleSidebar: () => void;
4
- sidebarWidth: import("vue").ComputedRef<"264px" | "0px">;
4
+ sidebarWidth: any;
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apptegy/nuxt-navigation",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -27,25 +27,25 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@apptegy/nuxt-intl": "2.1.2",
30
- "@nuxt/kit": "^3.16.1",
30
+ "@nuxt/kit": "^3.17.0",
31
31
  "@vueuse/components": "12.8.2",
32
- "lodash": "^4.17.21"
32
+ "@vueuse/core": "^12.8.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@nuxt/devtools": "^2.3.1",
36
- "@nuxt/eslint-config": "^1.2.0",
35
+ "@nuxt/devtools": "^2.4.0",
36
+ "@nuxt/eslint-config": "^1.3.0",
37
37
  "@nuxt/module-builder": "^0.8.4",
38
- "@nuxt/schema": "^3.16.1",
38
+ "@nuxt/schema": "^3.17.0",
39
39
  "@nuxt/test-utils": "^3.17.2",
40
- "@types/node": "^20.17.24",
40
+ "@types/node": "^20.17.32",
41
41
  "changelogen": "^0.5.7",
42
- "eslint": "^9.22.0",
43
- "nuxt": "^3.16.1",
44
- "sass": "^1.86.0",
45
- "typescript": "^5.8.2",
46
- "vitest": "^3.0.9",
42
+ "eslint": "^9.25.1",
43
+ "nuxt": "^3.17.0",
44
+ "sass": "^1.87.0",
45
+ "typescript": "^5.8.3",
46
+ "vitest": "^3.1.2",
47
47
  "vue": "^3.5.13",
48
- "vue-tsc": "^2.2.8"
48
+ "vue-tsc": "^2.2.10"
49
49
  },
50
- "gitHead": "875f0f01ddc64d6eaad53d38b9313f3a69ec3227"
50
+ "gitHead": "98fbfe464f87cbffa62256a493274fbdb7237ef2"
51
51
  }