srcdev-nuxt-components 2.1.3 → 2.1.5
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/assets/styles/variables/components/deep-expanding-menu/_scaffolding.css +144 -0
- package/assets/styles/variables/components/deep-expanding-menu/index.css +1 -0
- package/assets/styles/variables/components/index.css +1 -0
- package/components/deep-expanding-menu/DeepExpandingMenu.vue +4 -151
- package/components/deep-expanding-menu/DeepExpandingMenuOld.vue +25 -10
- package/package.json +4 -3
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
@layer deep-expanding-menu-setup {
|
|
2
|
+
@position-try --anchor-left {
|
|
3
|
+
inset: auto;
|
|
4
|
+
top: calc(anchor(bottom) + 10px);
|
|
5
|
+
left: calc(anchor(left) + 10px);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@position-try-fallbacks --anchor-right {
|
|
9
|
+
inset: auto;
|
|
10
|
+
top: calc(anchor(bottom) + 10px);
|
|
11
|
+
right: calc(anchor(right) + 10px);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.deep-expanding-menu {
|
|
15
|
+
--_gap-between-top-level-items: 24px;
|
|
16
|
+
|
|
17
|
+
container-type: inline-size;
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-areas: 'element-stack';
|
|
20
|
+
|
|
21
|
+
.inner {
|
|
22
|
+
grid-area: element-stack;
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: var(--_gap-between-top-level-items);
|
|
25
|
+
align-items: center;
|
|
26
|
+
|
|
27
|
+
.navigation-link,
|
|
28
|
+
.navigation-group-toggle {
|
|
29
|
+
all: unset;
|
|
30
|
+
border-bottom: 2px solid transparent;
|
|
31
|
+
padding-block: 8px;
|
|
32
|
+
|
|
33
|
+
transition: border-color 200ms;
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
border-color: light-dark(var(--blue-12), var(--gray-0));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:focus {
|
|
41
|
+
border-color: light-dark(var(--blue-12), var(--gray-0));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus-visible {
|
|
45
|
+
border-color: light-dark(var(--blue-12), var(--gray-0));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.navigation-group {
|
|
50
|
+
--_icon-transform: scaleY(1);
|
|
51
|
+
position: relative;
|
|
52
|
+
|
|
53
|
+
.navigation-group-toggle {
|
|
54
|
+
anchor-name: var(--_anchor-name);
|
|
55
|
+
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
|
|
60
|
+
.icon {
|
|
61
|
+
display: block;
|
|
62
|
+
font-size: 1.2rem;
|
|
63
|
+
|
|
64
|
+
transform: var(--_icon-transform);
|
|
65
|
+
transition: transform 200ms;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.navigation-group-panel {
|
|
70
|
+
display: none;
|
|
71
|
+
position: absolute;
|
|
72
|
+
position-anchor: var(--_anchor-name);
|
|
73
|
+
margin: 0;
|
|
74
|
+
/* inset: auto; */
|
|
75
|
+
top: calc(anchor(bottom) + 10px);
|
|
76
|
+
left: calc(anchor(left) + 0px);
|
|
77
|
+
|
|
78
|
+
opacity: 0;
|
|
79
|
+
transition: opacity 200ms, display 200ms, overlay 200ms;
|
|
80
|
+
transition-behavior: allow-discrete;
|
|
81
|
+
|
|
82
|
+
width: min(100%, 50vw);
|
|
83
|
+
|
|
84
|
+
background-color: white;
|
|
85
|
+
border: 1px solid black;
|
|
86
|
+
border-radius: 12px;
|
|
87
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
88
|
+
padding: 12px;
|
|
89
|
+
overflow: clip;
|
|
90
|
+
|
|
91
|
+
&:popover-open {
|
|
92
|
+
display: block;
|
|
93
|
+
opacity: 1;
|
|
94
|
+
|
|
95
|
+
@starting-style {
|
|
96
|
+
display: block;
|
|
97
|
+
opacity: 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
h4 {
|
|
102
|
+
color: var(--gray-12);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.navigation-group-list {
|
|
106
|
+
display: grid;
|
|
107
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
108
|
+
gap: 12px;
|
|
109
|
+
padding-inline-start: 0;
|
|
110
|
+
margin-block-end: 8px;
|
|
111
|
+
|
|
112
|
+
.navigation-group-item {
|
|
113
|
+
display: block;
|
|
114
|
+
|
|
115
|
+
a.navigation-group-link {
|
|
116
|
+
display: inline-block;
|
|
117
|
+
color: var(--gray-12);
|
|
118
|
+
text-decoration: none;
|
|
119
|
+
padding-block: 8px;
|
|
120
|
+
|
|
121
|
+
border-bottom: 2px solid transparent;
|
|
122
|
+
|
|
123
|
+
transition: border-color 200ms;
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
border-color: var(--gray-12);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&:focus-visible {
|
|
131
|
+
border-color: var(--gray-12);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&:has(.navigation-group-panel:popover-open) {
|
|
139
|
+
--_icon-transform: scaleY(-1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './_scaffolding.css';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<Icon name="bi:caret-down-fill" class="icon" />
|
|
11
11
|
</button>
|
|
12
12
|
|
|
13
|
-
<div class="navigation-group-panel" popover role="
|
|
13
|
+
<div class="navigation-group-panel" popover role="menu" :id="`popovertarget-nav-1-${key}`">
|
|
14
14
|
<h4 class="heading-4 mb-6">{{ link.childLinksTitle }}</h4>
|
|
15
15
|
<ul class="navigation-group-list">
|
|
16
16
|
<li class="navigation-group-item" v-for="childLink in link.childLinks" :key="childLink.name">
|
|
@@ -65,154 +65,7 @@ watch(
|
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
console.log('DeepExpandingMenu');
|
|
70
|
+
});
|
|
71
71
|
</script>
|
|
72
|
-
|
|
73
|
-
<style lang="css">
|
|
74
|
-
@layer deep-expanding-menu-setup {
|
|
75
|
-
@position-try --anchor-left {
|
|
76
|
-
inset: auto;
|
|
77
|
-
top: calc(anchor(bottom) + 10px);
|
|
78
|
-
left: calc(anchor(left) + 10px);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@position-try-fallbacks --anchor-right {
|
|
82
|
-
inset: auto;
|
|
83
|
-
top: calc(anchor(bottom) + 10px);
|
|
84
|
-
right: calc(anchor(right) + 10px);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.deep-expanding-menu {
|
|
88
|
-
--_gap-between-top-level-items: 24px;
|
|
89
|
-
|
|
90
|
-
container-type: inline-size;
|
|
91
|
-
display: grid;
|
|
92
|
-
grid-template-areas: 'element-stack';
|
|
93
|
-
|
|
94
|
-
.inner {
|
|
95
|
-
grid-area: element-stack;
|
|
96
|
-
display: flex;
|
|
97
|
-
gap: var(--_gap-between-top-level-items);
|
|
98
|
-
align-items: center;
|
|
99
|
-
|
|
100
|
-
.navigation-link,
|
|
101
|
-
.navigation-group-toggle {
|
|
102
|
-
all: unset;
|
|
103
|
-
border-bottom: 2px solid transparent;
|
|
104
|
-
padding-block: 8px;
|
|
105
|
-
|
|
106
|
-
transition: border-color 200ms;
|
|
107
|
-
|
|
108
|
-
&:hover {
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
border-color: light-dark(var(--blue-12), var(--gray-0));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&:focus {
|
|
114
|
-
border-color: light-dark(var(--blue-12), var(--gray-0));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&:focus-visible {
|
|
118
|
-
border-color: light-dark(var(--blue-12), var(--gray-0));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.navigation-group {
|
|
123
|
-
--_icon-transform: scaleY(1);
|
|
124
|
-
position: relative;
|
|
125
|
-
|
|
126
|
-
.navigation-group-toggle {
|
|
127
|
-
anchor-name: var(--_anchor-name);
|
|
128
|
-
|
|
129
|
-
display: flex;
|
|
130
|
-
align-items: center;
|
|
131
|
-
gap: 12px;
|
|
132
|
-
|
|
133
|
-
.icon {
|
|
134
|
-
display: block;
|
|
135
|
-
font-size: 1.2rem;
|
|
136
|
-
|
|
137
|
-
transform: var(--_icon-transform);
|
|
138
|
-
transition: transform 200ms;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.navigation-group-panel {
|
|
143
|
-
display: none;
|
|
144
|
-
position: absolute;
|
|
145
|
-
position-anchor: var(--_anchor-name);
|
|
146
|
-
margin: 0;
|
|
147
|
-
/* inset: auto; */
|
|
148
|
-
top: calc(anchor(bottom) + 10px);
|
|
149
|
-
left: calc(anchor(left) + 0px);
|
|
150
|
-
|
|
151
|
-
opacity: 0;
|
|
152
|
-
transition: opacity 200ms, display 200ms, overlay 200ms;
|
|
153
|
-
transition-behavior: allow-discrete;
|
|
154
|
-
|
|
155
|
-
width: min(100%, 50vw);
|
|
156
|
-
|
|
157
|
-
background-color: white;
|
|
158
|
-
border: 1px solid black;
|
|
159
|
-
border-radius: 12px;
|
|
160
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
161
|
-
padding: 12px;
|
|
162
|
-
overflow: clip;
|
|
163
|
-
|
|
164
|
-
&:popover-open {
|
|
165
|
-
display: block;
|
|
166
|
-
opacity: 1;
|
|
167
|
-
|
|
168
|
-
@starting-style {
|
|
169
|
-
display: block;
|
|
170
|
-
opacity: 0;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
h4 {
|
|
175
|
-
color: var(--gray-12);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.navigation-group-list {
|
|
179
|
-
display: grid;
|
|
180
|
-
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
181
|
-
gap: 12px;
|
|
182
|
-
padding-inline-start: 0;
|
|
183
|
-
margin-block-end: 8px;
|
|
184
|
-
|
|
185
|
-
.navigation-group-item {
|
|
186
|
-
display: block;
|
|
187
|
-
|
|
188
|
-
a.navigation-group-link {
|
|
189
|
-
display: inline-block;
|
|
190
|
-
color: var(--gray-12);
|
|
191
|
-
text-decoration: none;
|
|
192
|
-
padding-block: 8px;
|
|
193
|
-
|
|
194
|
-
border-bottom: 2px solid transparent;
|
|
195
|
-
|
|
196
|
-
transition: border-color 200ms;
|
|
197
|
-
|
|
198
|
-
&:hover {
|
|
199
|
-
cursor: pointer;
|
|
200
|
-
border-color: var(--gray-12);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&:focus-visible {
|
|
204
|
-
border-color: var(--gray-12);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
&:has(.navigation-group-panel:popover-open) {
|
|
212
|
-
--_icon-transform: scaleY(-1);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
</style>
|
|
@@ -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
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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,23 @@ 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
|
+
console.log('DeepExpandingMenuOld');
|
|
61
|
+
navigationGroupRef.value?.forEach((element, index) => {
|
|
62
|
+
onClickOutside(element, () => {
|
|
63
|
+
navigationGroupRef.value?.[index]?.removeAttribute('open');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
52
67
|
</script>
|
|
53
68
|
|
|
54
69
|
<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.
|
|
4
|
+
"version": "2.1.5",
|
|
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",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@iconify-json/akar-icons": "1.2.2",
|
|
29
29
|
"@iconify-json/bitcoin-icons": "1.2.2",
|
|
30
|
-
"@nuxt/eslint-config": "1.
|
|
31
|
-
"@nuxt/icon": "1.
|
|
30
|
+
"@nuxt/eslint-config": "1.2.0",
|
|
31
|
+
"@nuxt/icon": "1.11.0",
|
|
32
32
|
"@nuxt/image": "^1.9.0",
|
|
33
33
|
"eslint": "9.22.0",
|
|
34
34
|
"happy-dom": "16.8.1",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"typescript": "5.8.2"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@oddbird/css-anchor-positioning": "^0.4.0",
|
|
40
41
|
"@vueuse/core": "13.0.0",
|
|
41
42
|
"focus-trap-vue": "4.0.3",
|
|
42
43
|
"modern-normalize": "3.0.1"
|