srcdev-nuxt-components 2.1.3 → 2.1.4

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.
@@ -1,21 +1,23 @@
1
1
  <template>
2
2
  <component :is="tag" class="deep-expanding-menu-old" :class="[elementClasses]">
3
3
  <div class="inner">
4
- <template v-for="(link, key) in navLinks" :key="key">
4
+ <template v-for="(link, key, index) in navLinks" :key="key">
5
5
  <NuxtLink v-if="link.path" :to="link.path" class="navigation-link">{{ link.name }}</NuxtLink>
6
- <details v-else class="navigation-group" name="navigation-group" :style="`--_position-anchor: --anchor-nav-1-${key};, --_anchor-name: --anchor-nav-1-${key};`">
6
+ <details v-else class="navigation-group" name="navigation-group" :style="`--_position-anchor: --anchor-nav-1-${key};, --_anchor-name: --anchor-nav-1-${key};`" ref="navigationGroupRef">
7
7
  <summary class="navigation-group-toggle">
8
8
  <span>{{ link.name }}</span>
9
9
  <Icon name="bi:caret-down-fill" class="icon" />
10
10
  </summary>
11
- <div class="navigation-group-panel" :id="`popovertarget-nav-1-${key}`">
12
- <h4 class="heading-4 mb-6">{{ link.childLinksTitle }}</h4>
13
- <ul class="navigation-group-list">
14
- <li class="navigation-group-item" v-for="childLink in link.childLinks" :key="childLink.name">
15
- <NuxtLink :to="childLink.path" class="navigation-group-link">{{ childLink.name }}</NuxtLink>
16
- </li>
17
- </ul>
18
- </div>
11
+ <ClientOnly>
12
+ <div class="navigation-group-panel" :id="`popovertarget-nav-1-${key}`">
13
+ <h4 class="heading-4 mb-6">{{ link.childLinksTitle }}</h4>
14
+ <ul class="navigation-group-list">
15
+ <li class="navigation-group-item" v-for="childLink in link.childLinks" :key="childLink.name">
16
+ <NuxtLink :to="childLink.path" class="navigation-group-link">{{ childLink.name }}</NuxtLink>
17
+ </li>
18
+ </ul>
19
+ </div>
20
+ </ClientOnly>
19
21
  </details>
20
22
  </template>
21
23
  </div>
@@ -23,6 +25,8 @@
23
25
  </template>
24
26
 
25
27
  <script setup lang="ts">
28
+ import { onClickOutside } from '@vueuse/core';
29
+
26
30
  const props = defineProps({
27
31
  tag: {
28
32
  type: String,
@@ -43,12 +47,22 @@ const props = defineProps({
43
47
 
44
48
  const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
45
49
 
50
+ const navigationGroupRef = useTemplateRef<HTMLElement[]>('navigationGroupRef');
51
+
46
52
  watch(
47
53
  () => props.styleClassPassthrough,
48
54
  () => {
49
55
  resetElementClasses(props.styleClassPassthrough);
50
56
  }
51
57
  );
58
+
59
+ onMounted(() => {
60
+ navigationGroupRef.value?.forEach((element, index) => {
61
+ onClickOutside(element, () => {
62
+ navigationGroupRef.value?.[index]?.removeAttribute('open');
63
+ });
64
+ });
65
+ });
52
66
  </script>
53
67
 
54
68
  <script lang="ts">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "2.1.3",
4
+ "version": "2.1.4",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",