@codecavepro/brand 2.7.0 → 2.7.2

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.
@@ -0,0 +1,131 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import { type MenuItem } from '../lib/menus/menuTypes.ts';
4
+
5
+ interface Props {
6
+ section?: string;
7
+ current?: string;
8
+ subMenu: Record<string, MenuItem[]>;
9
+ }
10
+
11
+ const props = defineProps<Props>();
12
+
13
+ const items = computed<MenuItem[]>(() => {
14
+ return props.section ? props.subMenu[props.section] ?? [] : [];
15
+ });
16
+
17
+ if (
18
+ props.current &&
19
+ props.section &&
20
+ !(props.subMenu[props.section] ?? []).some(i => i.name === props.current)
21
+ ) {
22
+ throw new Error(
23
+ `SubNav: no item named "${props.current}" in SUB["${props.section}"]`
24
+ );
25
+ }
26
+ </script>
27
+
28
+ <template>
29
+ <nav
30
+ v-if="items.length"
31
+ class="ds-subnav"
32
+ aria-label="Section"
33
+ >
34
+ <div class="ds-subnav-inner">
35
+ <ul>
36
+ <li
37
+ v-for="item in items"
38
+ :key="item.name"
39
+ >
40
+ <a
41
+ class="ds-subnav-link"
42
+ :href="item.href"
43
+ :aria-current="item.name === current ? 'page' : undefined"
44
+ >
45
+ {{ item.label }}
46
+ </a>
47
+ </li>
48
+ </ul>
49
+ </div>
50
+ </nav>
51
+ </template>
52
+
53
+ <style>
54
+ .ds-subnav {
55
+ border-bottom: 1px solid var(--color-surface-quaternary);
56
+ background: var(--color-surface-primary-transparent);
57
+ -webkit-backdrop-filter: blur(24px);
58
+ backdrop-filter: blur(24px);
59
+ }
60
+
61
+ .ds-subnav-inner {
62
+ box-sizing: border-box;
63
+ max-width: var(--max-width-desktop);
64
+ margin: 0 auto;
65
+
66
+ overflow-x: auto;
67
+ overflow-y: hidden;
68
+ }
69
+
70
+ @media (min-width: 768px) {
71
+ .ds-subnav-inner {
72
+ padding-left: var(--gutter-md);
73
+ padding-right: var(--gutter-md);
74
+ }
75
+ }
76
+
77
+ @media (min-width: 1280px) {
78
+ .ds-subnav-inner {
79
+ padding-left: var(--gutter-xl);
80
+ padding-right: var(--gutter-xl);
81
+ }
82
+ }
83
+
84
+ /* center links when there is enough space */
85
+ .ds-subnav ul {
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: center;
89
+
90
+ margin: 0;
91
+ padding: 0;
92
+ list-style: none;
93
+
94
+ /* allow overflow while staying centered */
95
+ width: max-content;
96
+ min-width: 100%;
97
+
98
+ /* prevents wrapping */
99
+ flex-wrap: nowrap;
100
+ }
101
+
102
+ .ds-subnav li {
103
+ margin: 0;
104
+ flex-shrink: 0;
105
+ }
106
+
107
+ .ds-subnav-link {
108
+ box-sizing: border-box;
109
+ display: inline-flex;
110
+ align-items: center;
111
+ justify-content: center;
112
+ min-height: var(--control-height);
113
+ padding: 0.5rem 1.5rem;
114
+ border-radius: var(--radius-pill);
115
+ color: var(--color-body-primary);
116
+ font-family: var(--font-sans);
117
+ font-size: var(--text-body);
118
+ font-weight: var(--font-weight-bold);
119
+ line-height: var(--leading-body);
120
+ text-decoration: none;
121
+ white-space: nowrap;
122
+ cursor: pointer;
123
+ transition: color var(--transition-colors);
124
+ }
125
+
126
+ .ds-subnav-link:hover,
127
+ .ds-subnav-link:active,
128
+ .ds-subnav-link[aria-current="page"] {
129
+ color: var(--color-hovered);
130
+ }
131
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codecavepro/brand",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
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",
@@ -1,51 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue';
3
- import { type MenuItem } from '../lib/menus/menuTypes.ts';
4
-
5
- interface Props {
6
- section?: string;
7
- current?: string;
8
- subMenu: Record<string, MenuItem[]>;
9
- }
10
-
11
- const props = defineProps<Props>();
12
-
13
- const items = computed<MenuItem[]>(() => {
14
- return props.section ? props.subMenu[props.section] ?? [] : [];
15
- });
16
-
17
- if (
18
- props.current &&
19
- props.section &&
20
- !(props.subMenu[props.section] ?? []).some(i => i.name === props.current)
21
- ) {
22
- throw new Error(
23
- `SubNav: no item named "${props.current}" in SUB["${props.section}"]`
24
- );
25
- }
26
- </script>
27
-
28
- <template>
29
- <nav
30
- v-if="items.length"
31
- class="ds-subnav"
32
- aria-label="Section"
33
- >
34
- <div class="ds-subnav-inner">
35
- <ul class="flex w-max min-w-full flex-nowrap">
36
- <li
37
- v-for="item in items"
38
- :key="item.name"
39
- >
40
- <a
41
- class="btn btn-ghost whitespace-nowrap"
42
- :href="item.href"
43
- :aria-current="item.name === current ? 'page' : undefined"
44
- >
45
- {{ item.label }}
46
- </a>
47
- </li>
48
- </ul>
49
- </div>
50
- </nav>
51
- </template>