@codecavepro/brand 3.4.0 → 3.5.1

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,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref, onMounted, nextTick } from 'vue';
2
+ import { computed, ref, onMounted, onBeforeUnmount, nextTick } from 'vue';
3
3
  import Shevron from '../assets/icons/shevron.vue';
4
4
  import { type MenuItem } from '../lib/menus/menuTypes.ts';
5
5
  import { useBrandMessages } from '../lib/i18n/messages.ts';
@@ -97,17 +97,31 @@ async function initSubmenu() {
97
97
  openItem.value = activeItem.name;
98
98
  }
99
99
 
100
+ const subnavRef = ref<HTMLElement | null>(null);
101
+
102
+ function handleClickOutside(event: MouseEvent) {
103
+ const target = event.target as Node;
104
+
105
+ if (!subnavRef.value?.contains(target)) {
106
+ openItem.value = null;
107
+ }
108
+ }
109
+
100
110
  onMounted(async () => {
101
111
  await initSubmenu();
112
+ document.addEventListener('click', handleClickOutside);
113
+ });
114
+ onBeforeUnmount(() => {
115
+ document.removeEventListener('click', handleClickOutside);
102
116
  });
103
117
 
104
118
  </script>
105
119
 
106
120
  <template>
107
- <nav v-if="items.length" class="ds-subnav" :aria-label="messages.subNavbar.label">
121
+ <nav v-if="items.length" class="ds-subnav" ref="subnavRef" :aria-label="messages.subNavbar.label">
108
122
  <div class="ds-subnav-inner" :class="{ 'is-submenu-open': openItem }">
109
- <ul>
110
- <li v-for="item in items" :key="item.name" :ref="el => setItemRef(item.name, el)">
123
+ <ul class="ds-subnav-list">
124
+ <li v-for="item in items" :key="item.name" :ref="el => setItemRef(item.name, el)" class="ds-subnav-item">
111
125
  <div class="ds-subnav-item" @click="item.subMenu?.length ? openSubmenu(item) : closeSubmenu()">
112
126
  <component :is="item.href ? 'a' : 'span'" class="ds-subnav-link" :href="item.href" :aria-current="item.name === current ? 'page' : undefined">
113
127
  {{ item.label }}
@@ -171,9 +185,9 @@ onMounted(async () => {
171
185
  }
172
186
  }
173
187
 
174
- .ds-subnav ul {
188
+ .ds-subnav-list {
175
189
  display: flex;
176
- align-items: center;
190
+ align-items: start;
177
191
  justify-content: center;
178
192
 
179
193
  margin: 0;
@@ -186,7 +200,7 @@ onMounted(async () => {
186
200
  flex-wrap: nowrap;
187
201
  }
188
202
 
189
- .ds-subnav li {
203
+ .ds-subnav-item{
190
204
  margin: 0;
191
205
  flex-shrink: 0;
192
206
  }
@@ -310,10 +324,8 @@ onMounted(async () => {
310
324
 
311
325
  font-family: var(--font-sans);
312
326
  font-size: var(--text-body);
313
- font-weight: var(--font-weight-bold);
314
- line-height: var(--leading-body);
315
327
 
316
- text-align: center;
328
+ text-align: start;
317
329
  text-decoration: none;
318
330
 
319
331
  opacity: 0;
@@ -43,9 +43,9 @@ watch(() => [props.text1, props.text2],
43
43
 
44
44
  <template>
45
45
  <div ref="typingEffectContainer" class="flex flex-col items-center leading-[130%] text-heading-md md:text-heading-lg font-bold">
46
- <h2 :key="text1" class="split-text">
46
+ <h1 :key="text1" class="split-text text-heading text-[36px] md:text-[44px] xl:text-5xl ">
47
47
  <span class="block text-heading">{{ text1 }}</span>
48
48
  <span class="block text-action">{{ text2 }}</span>
49
- </h2>
49
+ </h1>
50
50
  </div>
51
51
  </template>
@@ -79,7 +79,7 @@ const handleCloseMenu = () => {
79
79
  <template>
80
80
  <div>
81
81
  <div class="fixed z-50 top-0 w-full bg-surface-primary-transparent backdrop-blur-3xl border-b border-surface-quaternary">
82
- <div :class="['px-5 flex flex-col gap-2 transition-all', isMenuOpen ? 'pb-5 h-dvh' : 'pb-0']">
82
+ <div :class="['px-5 flex flex-col gap-2 transition-all', isMenuOpen ? 'pb-5 h-dvh max-h-140' : 'pb-0']">
83
83
  <div class="flex justify-between items-center py-1.5 shrink-0">
84
84
  <a :href="homeHref" class="px-1.5 hover:opacity-80 transition-opacity">
85
85
  <img :src="logo" alt="CODECAVE" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codecavepro/brand",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "CODECAVE design system — colour, typography and layout tokens as CSS custom properties and as a typed module.",
5
5
  "license": "Unlicense",
6
6
  "type": "module",