srcdev-nuxt-components 2.1.2 → 2.1.3

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,12 +1,20 @@
1
1
  <template>
2
- <component :is="tag" class="deep-expanding-menu" :class="[elementClasses]">
2
+ <component :is="tag" class="deep-expanding-menu-old" :class="[elementClasses]">
3
3
  <div class="inner">
4
4
  <template v-for="(link, key) in navLinks" :key="key">
5
- <NuxtLink v-if="link.path" :to="link.path" class="">{{ link.name }}</NuxtLink>
6
- <details v-else name="top-level-nav" :style="`--_position-anchor: --anchor-nav-1-${key};, --_anchor-name: --anchor-nav-1-${key};`" ref="detailsRef">
7
- <summary>{{ link.name }}</summary>
8
- <div popver>
9
- <NuxtLink v-for="childLink in link.childLinks" :key="childLink.name" :to="childLink.path" class="">{{ childLink.name }}</NuxtLink>
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};`">
7
+ <summary class="navigation-group-toggle">
8
+ <span>{{ link.name }}</span>
9
+ <Icon name="bi:caret-down-fill" class="icon" />
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>
10
18
  </div>
11
19
  </details>
12
20
  </template>
@@ -23,6 +31,10 @@ const props = defineProps({
23
31
  return TAGS_ALLOWED.includes(value);
24
32
  },
25
33
  },
34
+ navLinks: {
35
+ type: Array as PropType<INavLink[]>,
36
+ default: () => [],
37
+ },
26
38
  styleClassPassthrough: {
27
39
  type: Array as PropType<string[]>,
28
40
  default: () => [],
@@ -30,7 +42,6 @@ const props = defineProps({
30
42
  });
31
43
 
32
44
  const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
33
- const detailsRef = useTemplateRef('detailsRef');
34
45
 
35
46
  watch(
36
47
  () => props.styleClassPassthrough,
@@ -38,10 +49,6 @@ watch(
38
49
  resetElementClasses(props.styleClassPassthrough);
39
50
  }
40
51
  );
41
-
42
- onMounted(() => {
43
- console.log(detailsRef.value);
44
- });
45
52
  </script>
46
53
 
47
54
  <script lang="ts">
@@ -53,54 +60,11 @@ interface INavLink {
53
60
  isExternal?: boolean;
54
61
  childLinks?: INavLink[];
55
62
  }
56
-
57
- const navLinks = <INavLink[]>[
58
- { name: 'Home', path: '/' },
59
- {
60
- name: 'Components',
61
- childLinks: [
62
- { name: 'Container Glow', path: '/ui/container-glow' },
63
- { name: 'Accordian', path: '/ui/accordian' },
64
- { name: 'Dialogs', path: '/ui/dialog' },
65
- { name: 'Tabs X', path: '/ui/tabs' },
66
- { name: 'Tabs Y', path: '/ui/tabs-y' },
67
- { name: 'Prompts', path: '/ui/display-prompt' },
68
- { name: 'Rotating Carousel', path: '/ui/rotating-carousel' },
69
- { name: 'Clipped Panels', path: '/ui/clipped-panels' },
70
- ],
71
- },
72
- {
73
- name: 'Layouts',
74
- childLinks: [
75
- { name: 'Layout Row', path: '/ui/layout-row' },
76
- { name: 'Layout Grid A', path: '/ui/layout-grid-a' },
77
- { name: 'Layout Grid B', path: '/ui/layout-grid-b' },
78
- { name: 'Simple Grid', path: '/ui/simple-grid' },
79
- { name: 'Masonry Grid Simple', path: '/ui/masonry-grid' },
80
- { name: 'Masonry Grid Sorted', path: '/ui/masonry-grid-sorted' },
81
- { name: 'Masonry Grid Ordered', path: '/ui/masonry-grid-ordered' },
82
- { name: 'Masonry Columns', path: '/ui/masonry-columns' },
83
- ],
84
- },
85
- { name: 'About', path: '/' },
86
- ];
87
63
  </script>
88
64
 
89
65
  <style lang="css">
90
66
  @layer popover-setup {
91
- @position-try --anchor-left {
92
- inset: auto;
93
- top: anchor(top);
94
- right: calc(anchor(left) + 10px);
95
- }
96
-
97
- @position-try-fallbacks --anchor-right {
98
- inset: auto;
99
- top: anchor(top);
100
- left: calc(anchor(right) + 10px);
101
- }
102
-
103
- .deep-expanding-menu {
67
+ .deep-expanding-menu-old {
104
68
  container-type: inline-size;
105
69
  display: grid;
106
70
  grid-template-areas: 'element-stack';
@@ -114,64 +78,125 @@ const navLinks = <INavLink[]>[
114
78
  align-items: center;
115
79
  z-index: 1;
116
80
 
117
- a,
118
- summary {
81
+ .navigation-link,
82
+ .navigation-group-toggle {
83
+ all: unset;
84
+ border-bottom: 2px solid transparent;
85
+ padding-block: 8px;
86
+
87
+ transition: border-color 200ms;
88
+
119
89
  &:hover {
120
90
  cursor: pointer;
91
+ border-color: light-dark(var(--blue-12), var(--gray-0));
121
92
  }
122
- }
123
93
 
124
- a {
125
- all: unset;
126
- border: 1px solid red;
127
- padding: 6px 12px;
94
+ &:focus {
95
+ border-color: light-dark(var(--blue-12), var(--gray-0));
96
+ }
128
97
 
129
98
  &:focus-visible {
130
- outline: 2px solid red;
99
+ border-color: light-dark(var(--blue-12), var(--gray-0));
131
100
  }
132
101
  }
133
102
 
134
- details {
135
- all: unset;
136
- border: 1px solid red;
137
- padding: 6px 12px;
138
- }
103
+ .navigation-group {
104
+ --_icon-transform: scaleY(1);
139
105
 
140
- details {
141
106
  display: grid;
142
107
  grid-template-areas: 'details-stack';
143
108
  z-index: 1;
109
+ position: relative;
144
110
 
145
- summary {
111
+ summary::-webkit-details-marker,
112
+ summary::marker {
113
+ display: none;
114
+ }
115
+
116
+ &[open] {
117
+ --_icon-transform: scaleY(-1);
118
+ }
119
+
120
+ .navigation-group-toggle {
146
121
  grid-area: details-stack;
147
- /* position: relative; */
148
- anchor-name: var(--_anchor-name);
149
122
 
150
- &:focus {
151
- outline: 2px solid green;
152
- }
123
+ display: flex !important;
124
+ align-items: center;
125
+ gap: 12px;
126
+ list-style: none;
153
127
 
154
- &:focus-visible {
155
- outline: 2px solid red;
128
+ .icon {
129
+ display: block;
130
+ font-size: 1.2rem;
131
+
132
+ transform: var(--_icon-transform);
133
+ transition: transform 200ms;
156
134
  }
157
135
  }
158
136
 
159
- div {
160
- position-anchor: var(--_position-anchor);
137
+ .navigation-group-panel {
161
138
  background-color: black;
162
139
  display: grid;
163
140
  grid-area: details-stack;
164
141
  z-index: 2;
165
142
  position: absolute;
166
143
  inset: auto;
167
- top: calc(anchor(bottom) + 20px);
168
- left: calc(anchor(left) + 0px);
169
- /* translate: 0 20px; */
170
- padding: 12px;
144
+ top: 40px;
145
+ left: 0px;
171
146
  gap: 12px;
172
147
 
173
- /* position-try: --anchor-left;
174
- position-try-fallbacks: --anchor-right; */
148
+ width: 200px;
149
+
150
+ @media screen and (min-width: 768px) {
151
+ width: 400px;
152
+ }
153
+
154
+ @media screen and (min-width: 1024px) {
155
+ width: 600px;
156
+ }
157
+
158
+ background-color: white;
159
+ border: 1px solid black;
160
+ border-radius: 12px;
161
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
162
+ padding: 12px;
163
+ overflow: clip;
164
+
165
+ h4 {
166
+ color: var(--gray-12);
167
+ }
168
+
169
+ .navigation-group-list {
170
+ display: grid;
171
+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
172
+ gap: 12px;
173
+ padding-inline-start: 0;
174
+ margin-block-end: 8px;
175
+
176
+ .navigation-group-item {
177
+ display: block;
178
+
179
+ a.navigation-group-link {
180
+ display: inline-block;
181
+ color: var(--gray-12);
182
+ text-decoration: none;
183
+ padding-block: 8px;
184
+
185
+ border-bottom: 2px solid transparent;
186
+
187
+ transition: border-color 200ms;
188
+
189
+ &:hover {
190
+ cursor: pointer;
191
+ border-color: var(--gray-12);
192
+ }
193
+
194
+ &:focus-visible {
195
+ border-color: var(--gray-12);
196
+ }
197
+ }
198
+ }
199
+ }
175
200
  }
176
201
  }
177
202
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "2.1.2",
4
+ "version": "2.1.3",
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",