srcdev-nuxt-components 2.1.5 → 2.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.
@@ -64,8 +64,4 @@ watch(
64
64
  resetElementClasses(props.styleClassPassthrough);
65
65
  }
66
66
  );
67
-
68
- onMounted(() => {
69
- console.log('DeepExpandingMenu');
70
- });
71
67
  </script>
@@ -1,23 +1,21 @@
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, index) in navLinks" :key="key">
4
+ <template v-for="(link, key) 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};`" ref="navigationGroupRef">
6
+ <details v-else class="navigation-group" name="navigation-group" 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
- <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>
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>
21
19
  </details>
22
20
  </template>
23
21
  </div>
@@ -57,7 +55,6 @@ watch(
57
55
  );
58
56
 
59
57
  onMounted(() => {
60
- console.log('DeepExpandingMenuOld');
61
58
  navigationGroupRef.value?.forEach((element, index) => {
62
59
  onClickOutside(element, () => {
63
60
  navigationGroupRef.value?.[index]?.removeAttribute('open');
@@ -73,6 +70,7 @@ interface INavLink {
73
70
  name: string;
74
71
  path?: string;
75
72
  isExternal?: boolean;
73
+ childLinksTitle?: string;
76
74
  childLinks?: INavLink[];
77
75
  }
78
76
  </script>
@@ -89,7 +87,7 @@ interface INavLink {
89
87
  .inner {
90
88
  grid-area: element-stack;
91
89
  display: flex;
92
- gap: 12px;
90
+ gap: 24px;
93
91
  align-items: center;
94
92
  z-index: 1;
95
93
 
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
  <div class="display-accordian" :class="[elementClasses]" ref="accordianRef">
3
- <template v-for="(item, key) in data" :key="key">
4
- <div class="accordion-panel">
5
- <button class="accordion-trigger" :id="`accordian-${key}-trigger`" aria-expanded="false" :aria-controls="`accordian-${key}-content`" ref="triggerRefs" @click.stop.prevent="handleSummary(key)">
3
+ <details v-for="(item, key) in data" :key="key" class="accordion-panel" name="navigation-group">
4
+ <summary class="accordion-trigger" :id="`accordian-${key}-trigger`" :aria-controls="`accordian-${key}-content`" ref="triggerRefs">
5
+ <span class="label">
6
6
  <slot :name="`accordian-${key}-trigger`"></slot>
7
- </button>
8
-
9
- <div class="accordion-content" :aria-labelledby="`accordian-${key}-trigger`" :id="`accordian-${key}-content`" role="region" aria-hidden="true" ref="contentRefs">
10
- <div>
11
- <slot :name="`accordian-${key}-content`"></slot>
12
- </div>
7
+ </span>
8
+ <Icon name="bi:caret-down-fill" class="icon mi-12" />
9
+ </summary>
10
+ <div class="accordion-content" :aria-labelledby="`accordian-${key}-trigger`" :id="`accordian-${key}-content`" role="region" ref="contentRefs">
11
+ <div class="accordion-content-inner">
12
+ <slot :name="`accordian-${key}-content`"></slot>
13
13
  </div>
14
14
  </div>
15
- </template>
15
+ </details>
16
16
  </div>
17
17
  </template>
18
18
 
@@ -34,31 +34,6 @@ const props = defineProps({
34
34
  });
35
35
 
36
36
  const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
37
-
38
- const accordianRef = ref<HTMLElement>();
39
- const triggerRefs = ref<HTMLElement[]>([]);
40
- const contentRefs = ref<HTMLElement[]>([]);
41
-
42
- onMounted(() => {
43
- if (accordianRef.value) {
44
- triggerRefs.value = Array.from(accordianRef.value.querySelectorAll('.accordion-trigger'));
45
- contentRefs.value = Array.from(accordianRef.value.querySelectorAll('.accordion-content'));
46
- }
47
- });
48
-
49
- const handleSummary = (clickedIndex: number) => {
50
- triggerRefs.value.forEach((element, index) => {
51
- if (clickedIndex === index) {
52
- const currentState = element.getAttribute('aria-expanded');
53
- const newState = currentState !== 'true';
54
- triggerRefs.value[index].setAttribute('aria-expanded', String(newState));
55
- contentRefs.value[index].setAttribute('aria-hidden', String(currentState));
56
- } else {
57
- triggerRefs.value[index].setAttribute('aria-expanded', 'false');
58
- contentRefs.value[index].setAttribute('aria-hidden', 'true');
59
- }
60
- });
61
- };
62
37
  </script>
63
38
 
64
39
  <style lang="css">
@@ -68,46 +43,58 @@ const handleSummary = (clickedIndex: number) => {
68
43
  }
69
44
 
70
45
  .accordion-panel {
46
+ @property --_grid-template-rows {
47
+ syntax: '<length-percentage> | auto | min-content | max-content | minmax( <length-percentage> , <length-percentage> ) | fit-content( <length-percentage> ) | <flex>';
48
+ inherits: true;
49
+ initial-value: 0fr;
50
+ }
51
+
52
+ --_grid-template-rows: 0fr;
53
+ --_icon-transform: scaleY(1);
54
+
71
55
  border: var(--accordian-panel-border);
72
56
  border-radius: var(--accordian-panel-border-radius);
73
57
  margin-block-end: var(--accordian-panel-mbe);
74
- }
75
58
 
76
- .accordion-trigger {
77
- display: block;
78
- width: 100%;
79
- padding: 1rem;
80
- background: var(--accordion-trigger-bg);
81
- border: none;
82
- text-align: left;
83
- cursor: pointer;
84
- }
59
+ &[open] {
60
+ --_grid-template-rows: 1fr;
61
+ --_icon-transform: scaleY(-1);
62
+ }
63
+
64
+ summary::-webkit-details-marker,
65
+ summary::marker {
66
+ display: none;
67
+ }
68
+
69
+ .accordion-trigger {
70
+ display: flex !important;
71
+ align-items: center;
72
+ gap: 12px;
73
+ list-style: none;
74
+ padding: 1rem;
85
75
 
86
- .accordion-content {
87
- display: grid;
88
- grid-template-rows: 0fr;
89
- transition: grid-template-rows ease-in-out 500ms;
76
+ .label {
77
+ display: block;
78
+ flex-grow: 1;
79
+ }
90
80
 
91
- > div {
92
- overflow: hidden;
93
- /* transform: translateY(-1rem);
94
- transition: all ease-in-out 500ms;
81
+ .icon {
82
+ display: block;
83
+ font-size: 1.2rem;
95
84
 
96
- > p {
97
- padding-block: 0;
98
- transition: all ease-in-out 500ms;
99
- } */
85
+ transform: var(--_icon-transform);
86
+ transition: transform 200ms;
87
+ }
100
88
  }
101
- }
102
89
 
103
- .accordion-content[aria-hidden='false'] {
104
- grid-template-rows: 1fr;
90
+ .accordion-content {
91
+ display: grid;
92
+ grid-template-rows: var(--_grid-template-rows);
93
+ transition: all 2000ms;
105
94
 
106
- /* > div {
107
- transform: translateY(0);
108
- > p {
109
- padding-block: 3.2rem;
110
- }
111
- } */
95
+ .accordion-content-inner {
96
+ overflow: hidden;
97
+ }
98
+ }
112
99
  }
113
100
  </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "2.1.5",
4
+ "version": "2.1.6",
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",
@@ -29,7 +29,7 @@
29
29
  "@iconify-json/bitcoin-icons": "1.2.2",
30
30
  "@nuxt/eslint-config": "1.2.0",
31
31
  "@nuxt/icon": "1.11.0",
32
- "@nuxt/image": "^1.9.0",
32
+ "@nuxt/image": "1.10.0",
33
33
  "eslint": "9.22.0",
34
34
  "happy-dom": "16.8.1",
35
35
  "nuxt": "3.16.0",
@@ -37,7 +37,7 @@
37
37
  "typescript": "5.8.2"
38
38
  },
39
39
  "dependencies": {
40
- "@oddbird/css-anchor-positioning": "^0.4.0",
40
+ "@oddbird/css-anchor-positioning": "0.4.0",
41
41
  "@vueuse/core": "13.0.0",
42
42
  "focus-trap-vue": "4.0.3",
43
43
  "modern-normalize": "3.0.1"