@bobbykim/mcl-header 0.5.0 → 0.6.0
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/dist/index.d.ts +314 -0
- package/dist/mcl-header.js +793 -0
- package/dist/mcl-header.umd.cjs +2 -0
- package/package.json +28 -6
- package/CHANGELOG.md +0 -67
- package/index.d.ts +0 -4
- package/index.js +0 -4
- package/index.ts +0 -5
- package/lib/common/index.types.d.ts +0 -10
- package/lib/common/index.types.js +0 -1
- package/lib/common/index.types.ts +0 -12
- package/lib/mcl-header-a/MclHeaderA.vue +0 -251
- package/lib/mcl-header-a/MclHeaderA.vue.d.ts +0 -148
- package/lib/mcl-header-a/NavCollapse.vue +0 -165
- package/lib/mcl-header-a/NavCollapse.vue.d.ts +0 -78
- package/lib/mcl-header-a/NavDropdown.vue +0 -165
- package/lib/mcl-header-a/NavDropdown.vue.d.ts +0 -69
- package/lib/mcl-header-a/NavLink.vue +0 -91
- package/lib/mcl-header-a/NavLink.vue.d.ts +0 -62
- package/lib/mcl-header-b/MclHeaderB.vue +0 -270
- package/lib/mcl-header-b/MclHeaderB.vue.d.ts +0 -138
- package/lib/mcl-header-b/NavCollapseVertical.vue +0 -211
- package/lib/mcl-header-b/NavCollapseVertical.vue.d.ts +0 -73
- package/lib/mcl-header-b/NavLinkVertical.vue +0 -78
- package/lib/mcl-header-b/NavLinkVertical.vue.d.ts +0 -62
- package/tsconfig.json +0 -5
- package/tsconfig.ts.json +0 -9
- package/tsconfig.vue.json +0 -9
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme'
|
|
3
|
-
import generateClass, { Collapse, vCollapse } from '@bobbykim/manguito-theme'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
-
import type { MenuCollapseType, MenuItemType } from '../common/index.types'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<{
|
|
9
|
-
navId: string
|
|
10
|
-
navAccordionGroup: string
|
|
11
|
-
navItem: MenuCollapseType
|
|
12
|
-
bgColor?: ColorPalette
|
|
13
|
-
hoverBgColor?: ColorPalette
|
|
14
|
-
menuTextSize?: BodyText
|
|
15
|
-
menuTextColor?: ColorPalette
|
|
16
|
-
menuTextBold?: boolean
|
|
17
|
-
displayHighlight?: boolean
|
|
18
|
-
highlightColor?: ColorPalette
|
|
19
|
-
asLink?: boolean
|
|
20
|
-
}>(),
|
|
21
|
-
{
|
|
22
|
-
menuTextSize: 'md',
|
|
23
|
-
bgColor: 'light-2',
|
|
24
|
-
hoverBgColor: 'dark-1',
|
|
25
|
-
menuTextColor: 'dark-3',
|
|
26
|
-
menuTextBold: false,
|
|
27
|
-
displayHighlight: true,
|
|
28
|
-
highlightColor: 'primary',
|
|
29
|
-
asLink: true,
|
|
30
|
-
}
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
const emit = defineEmits<{
|
|
34
|
-
(e: 'child-click', event: Event, item: MenuItemType): void
|
|
35
|
-
(e: 'label-click', event: Event, title: string, open: boolean): void
|
|
36
|
-
}>()
|
|
37
|
-
const toggle = ref<boolean>(false)
|
|
38
|
-
const handleNavId = computed<string>(() => {
|
|
39
|
-
const { navId } = props
|
|
40
|
-
const navLower = navId.toLowerCase()
|
|
41
|
-
const navKebab = navLower.replaceAll(' ', '-')
|
|
42
|
-
return `nav-${navKebab}`
|
|
43
|
-
})
|
|
44
|
-
const handleNavAccordionGroupName = computed<string>(() => {
|
|
45
|
-
const { navAccordionGroup } = props
|
|
46
|
-
const toLowerCase = navAccordionGroup.toLocaleLowerCase()
|
|
47
|
-
const toKebabCase = toLowerCase.replaceAll(' ', '-')
|
|
48
|
-
return `accordion-${toKebabCase}`
|
|
49
|
-
})
|
|
50
|
-
const toggleAction = (visible: boolean): void => {
|
|
51
|
-
toggle.value = visible
|
|
52
|
-
}
|
|
53
|
-
const handleCollapseLabelClick = (e: Event, title: string) => {
|
|
54
|
-
emit('label-click', e, title, toggle.value)
|
|
55
|
-
}
|
|
56
|
-
const navItemClick = (e: Event, item: MenuItemType) => {
|
|
57
|
-
const { asLink } = props
|
|
58
|
-
!asLink && e.preventDefault()
|
|
59
|
-
emit('child-click', e, item)
|
|
60
|
-
}
|
|
61
|
-
const getMenuItemClass = (
|
|
62
|
-
size: BodyText,
|
|
63
|
-
color: ColorPalette,
|
|
64
|
-
bold: boolean
|
|
65
|
-
): string => {
|
|
66
|
-
/**
|
|
67
|
-
* @param {BodyText} size - menuTextSize
|
|
68
|
-
* @param {ColorPalette} color - menuTextColor
|
|
69
|
-
* @param {boolean} bold - menuTextBold
|
|
70
|
-
*/
|
|
71
|
-
const classArray: string[] = [
|
|
72
|
-
generateClass('BODYTEXT', size),
|
|
73
|
-
generateClass('TEXTCOLOR', color),
|
|
74
|
-
]
|
|
75
|
-
if (bold) {
|
|
76
|
-
classArray.push('font-bold')
|
|
77
|
-
}
|
|
78
|
-
return classArray.join(' ')
|
|
79
|
-
}
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
<template>
|
|
83
|
-
<div class="flex flex-col w-full">
|
|
84
|
-
<div class="self-center">
|
|
85
|
-
<button
|
|
86
|
-
class="tracking-wider align-middle outline-none nav__text flex items-center gap-3xs"
|
|
87
|
-
:class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
|
|
88
|
-
v-collapse:[handleNavId]
|
|
89
|
-
@click=""
|
|
90
|
-
>
|
|
91
|
-
<span>
|
|
92
|
-
{{ navItem.title }}
|
|
93
|
-
</span>
|
|
94
|
-
<svg
|
|
95
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
96
|
-
viewBox="0 0 448 512"
|
|
97
|
-
class="h-[0.8rem] fill-current"
|
|
98
|
-
:class="[
|
|
99
|
-
toggle ? 'rotate-180' : 'rotate-0',
|
|
100
|
-
'transition-transform duration-300 ease-in',
|
|
101
|
-
]"
|
|
102
|
-
>
|
|
103
|
-
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
|
|
104
|
-
<path
|
|
105
|
-
d="M224 416c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L224 338.8l169.4-169.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-192 192C240.4 412.9 232.2 416 224 416z"
|
|
106
|
-
/>
|
|
107
|
-
</svg>
|
|
108
|
-
</button>
|
|
109
|
-
<div
|
|
110
|
-
v-if="displayHighlight"
|
|
111
|
-
class="relative -top-[2px] h-[6px] nav__decorator"
|
|
112
|
-
:class="generateClass('BEFOREBG', highlightColor)"
|
|
113
|
-
></div>
|
|
114
|
-
</div>
|
|
115
|
-
<collapse
|
|
116
|
-
:id="handleNavId"
|
|
117
|
-
:visible="false"
|
|
118
|
-
:accordion="handleNavAccordionGroupName"
|
|
119
|
-
@open="toggleAction"
|
|
120
|
-
@close="toggleAction"
|
|
121
|
-
>
|
|
122
|
-
<div class="relative pt-2xs">
|
|
123
|
-
<div
|
|
124
|
-
v-if="displayHighlight"
|
|
125
|
-
class="absolute w-md bg-opacity-25 -left-4 h-full"
|
|
126
|
-
:class="generateClass('BGCOLOR', highlightColor)"
|
|
127
|
-
></div>
|
|
128
|
-
<div class="relative flex flex-col">
|
|
129
|
-
<a
|
|
130
|
-
v-for="(item, idx) in navItem.children"
|
|
131
|
-
:href="item.url"
|
|
132
|
-
:target="item.target"
|
|
133
|
-
class="w-full pb-2xs last:pb-0"
|
|
134
|
-
:key="idx"
|
|
135
|
-
:class="[
|
|
136
|
-
generateClass('TEXTCOLOR', menuTextColor),
|
|
137
|
-
generateClass('BODYTEXT', menuTextSize),
|
|
138
|
-
]"
|
|
139
|
-
@click="navItemClick($event, item)"
|
|
140
|
-
>
|
|
141
|
-
{{ item.title }}
|
|
142
|
-
</a>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
</collapse>
|
|
146
|
-
</div>
|
|
147
|
-
</template>
|
|
148
|
-
|
|
149
|
-
<style scoped lang="scss">
|
|
150
|
-
.nav__decorator {
|
|
151
|
-
&::before {
|
|
152
|
-
content: '';
|
|
153
|
-
position: absolute;
|
|
154
|
-
bottom: 0;
|
|
155
|
-
left: 0;
|
|
156
|
-
height: 100%;
|
|
157
|
-
width: 0;
|
|
158
|
-
transition: width 0.3s linear;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
.nav__text:focus + .nav__decorator::before,
|
|
162
|
-
.nav__text:hover + .nav__decorator::before {
|
|
163
|
-
width: 100%;
|
|
164
|
-
}
|
|
165
|
-
</style>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuCollapseType, MenuItemType } from '../common/index.types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
navId: string;
|
|
5
|
-
navAccordionGroup: string;
|
|
6
|
-
navItem: MenuCollapseType;
|
|
7
|
-
bgColor?: ColorPalette | undefined;
|
|
8
|
-
hoverBgColor?: ColorPalette | undefined;
|
|
9
|
-
menuTextSize?: BodyText | undefined;
|
|
10
|
-
menuTextColor?: ColorPalette | undefined;
|
|
11
|
-
menuTextBold?: boolean | undefined;
|
|
12
|
-
displayHighlight?: boolean | undefined;
|
|
13
|
-
highlightColor?: ColorPalette | undefined;
|
|
14
|
-
asLink?: boolean | undefined;
|
|
15
|
-
}>, {
|
|
16
|
-
menuTextSize: string;
|
|
17
|
-
bgColor: string;
|
|
18
|
-
hoverBgColor: string;
|
|
19
|
-
menuTextColor: string;
|
|
20
|
-
menuTextBold: boolean;
|
|
21
|
-
displayHighlight: boolean;
|
|
22
|
-
highlightColor: string;
|
|
23
|
-
asLink: boolean;
|
|
24
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
-
"child-click": (event: Event, item: MenuItemType) => void;
|
|
26
|
-
"label-click": (event: Event, title: string, open: boolean) => void;
|
|
27
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
28
|
-
navId: string;
|
|
29
|
-
navAccordionGroup: string;
|
|
30
|
-
navItem: MenuCollapseType;
|
|
31
|
-
bgColor?: ColorPalette | undefined;
|
|
32
|
-
hoverBgColor?: ColorPalette | undefined;
|
|
33
|
-
menuTextSize?: BodyText | undefined;
|
|
34
|
-
menuTextColor?: ColorPalette | undefined;
|
|
35
|
-
menuTextBold?: boolean | undefined;
|
|
36
|
-
displayHighlight?: boolean | undefined;
|
|
37
|
-
highlightColor?: ColorPalette | undefined;
|
|
38
|
-
asLink?: boolean | undefined;
|
|
39
|
-
}>, {
|
|
40
|
-
menuTextSize: string;
|
|
41
|
-
bgColor: string;
|
|
42
|
-
hoverBgColor: string;
|
|
43
|
-
menuTextColor: string;
|
|
44
|
-
menuTextBold: boolean;
|
|
45
|
-
displayHighlight: boolean;
|
|
46
|
-
highlightColor: string;
|
|
47
|
-
asLink: boolean;
|
|
48
|
-
}>>> & {
|
|
49
|
-
"onChild-click"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
50
|
-
"onLabel-click"?: ((event: Event, title: string, open: boolean) => any) | undefined;
|
|
51
|
-
}, {
|
|
52
|
-
bgColor: ColorPalette;
|
|
53
|
-
hoverBgColor: ColorPalette;
|
|
54
|
-
menuTextSize: BodyText;
|
|
55
|
-
menuTextColor: ColorPalette;
|
|
56
|
-
menuTextBold: boolean;
|
|
57
|
-
displayHighlight: boolean;
|
|
58
|
-
highlightColor: ColorPalette;
|
|
59
|
-
asLink: boolean;
|
|
60
|
-
}, {}>;
|
|
61
|
-
export default _default;
|
|
62
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
63
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
64
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
65
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
66
|
-
} : {
|
|
67
|
-
type: import('vue').PropType<T[K]>;
|
|
68
|
-
required: true;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
type __VLS_WithDefaults<P, D> = {
|
|
72
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
73
|
-
default: D[K];
|
|
74
|
-
}> : P[K];
|
|
75
|
-
};
|
|
76
|
-
type __VLS_Prettify<T> = {
|
|
77
|
-
[K in keyof T]: T[K];
|
|
78
|
-
} & {};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme'
|
|
3
|
-
import generateClass, {
|
|
4
|
-
DropdownContainer,
|
|
5
|
-
DropdownContent,
|
|
6
|
-
} from '@bobbykim/manguito-theme'
|
|
7
|
-
import { ref } from 'vue'
|
|
8
|
-
import type { MenuCollapseType, MenuItemType } from '../common/index.types'
|
|
9
|
-
|
|
10
|
-
const props = withDefaults(
|
|
11
|
-
defineProps<{
|
|
12
|
-
navItem: MenuCollapseType
|
|
13
|
-
bgColor?: ColorPalette
|
|
14
|
-
menuTextSize?: BodyText
|
|
15
|
-
menuTextColor?: ColorPalette
|
|
16
|
-
menuTextBold?: boolean
|
|
17
|
-
displayHighlight?: boolean
|
|
18
|
-
highlightColor?: ColorPalette
|
|
19
|
-
asLink?: boolean
|
|
20
|
-
}>(),
|
|
21
|
-
{
|
|
22
|
-
menuTextSize: 'md',
|
|
23
|
-
bgColor: 'light-1',
|
|
24
|
-
menuTextColor: 'dark-3',
|
|
25
|
-
menuTextBold: false,
|
|
26
|
-
displayHighlight: true,
|
|
27
|
-
highlightColor: 'primary',
|
|
28
|
-
asLink: true,
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
const emit = defineEmits<{
|
|
33
|
-
(e: 'label-click', event: Event, title: string, open: boolean): void
|
|
34
|
-
(e: 'child-click', event: Event, item: MenuItemType): void
|
|
35
|
-
}>()
|
|
36
|
-
const navIndexRef = ref<number>(-1)
|
|
37
|
-
const navItemRef = ref<HTMLButtonElement[]>()
|
|
38
|
-
|
|
39
|
-
const getMenuItemClass = (
|
|
40
|
-
size: BodyText,
|
|
41
|
-
color: ColorPalette,
|
|
42
|
-
bold: boolean
|
|
43
|
-
): string => {
|
|
44
|
-
/**
|
|
45
|
-
* @param {BodyText} size - menuTextSize
|
|
46
|
-
* @param {ColorPalette} color - menuTextColor
|
|
47
|
-
* @param {boolean} bold - menuTextBold
|
|
48
|
-
*/
|
|
49
|
-
const classArray: string[] = [
|
|
50
|
-
generateClass('BODYTEXT', size),
|
|
51
|
-
generateClass('TEXTCOLOR', color),
|
|
52
|
-
]
|
|
53
|
-
if (bold) {
|
|
54
|
-
classArray.push('font-bold')
|
|
55
|
-
}
|
|
56
|
-
return classArray.join(' ')
|
|
57
|
-
}
|
|
58
|
-
type KeyDirection = 'up' | 'down'
|
|
59
|
-
const navKeyUp = (direction: KeyDirection): void => {
|
|
60
|
-
const itemLength: number = props.navItem.children.length
|
|
61
|
-
if (navItemRef.value === undefined) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
if (direction === 'down' && navIndexRef.value < itemLength - 1) {
|
|
65
|
-
navIndexRef.value++
|
|
66
|
-
}
|
|
67
|
-
if (direction === 'up' && navIndexRef.value > 0) {
|
|
68
|
-
navIndexRef.value--
|
|
69
|
-
}
|
|
70
|
-
navItemRef.value[navIndexRef.value].focus()
|
|
71
|
-
}
|
|
72
|
-
const dropdownButtonClick = (e: Event, title: string, state: boolean): void => {
|
|
73
|
-
// resets index
|
|
74
|
-
navIndexRef.value = -1
|
|
75
|
-
emit('label-click', e, title, state)
|
|
76
|
-
}
|
|
77
|
-
const navItemClick = (e: Event, item: MenuItemType) => {
|
|
78
|
-
const { asLink } = props
|
|
79
|
-
!asLink && e.preventDefault()
|
|
80
|
-
emit('child-click', e, item)
|
|
81
|
-
}
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<template>
|
|
85
|
-
<div @keyup.down="navKeyUp('down')" @keyup.up="navKeyUp('up')">
|
|
86
|
-
<dropdown-container>
|
|
87
|
-
<template #toggler="{ toggle, dropdownState }">
|
|
88
|
-
<div>
|
|
89
|
-
<button
|
|
90
|
-
class="tracking-wider align-middle outline-none nav__text flex items-center gap-3xs"
|
|
91
|
-
:class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
|
|
92
|
-
@click="
|
|
93
|
-
toggle($event),
|
|
94
|
-
dropdownButtonClick($event, navItem.title, dropdownState)
|
|
95
|
-
"
|
|
96
|
-
>
|
|
97
|
-
<span>
|
|
98
|
-
{{ navItem.title }}
|
|
99
|
-
</span>
|
|
100
|
-
<svg
|
|
101
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
102
|
-
viewBox="0 0 448 512"
|
|
103
|
-
class="h-[0.8rem] fill-current"
|
|
104
|
-
:class="[
|
|
105
|
-
dropdownState ? 'rotate-180' : 'rotate-0',
|
|
106
|
-
'transition-transform duration-300 ease-in',
|
|
107
|
-
]"
|
|
108
|
-
>
|
|
109
|
-
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
|
|
110
|
-
<path
|
|
111
|
-
d="M224 416c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L224 338.8l169.4-169.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-192 192C240.4 412.9 232.2 416 224 416z"
|
|
112
|
-
/>
|
|
113
|
-
</svg>
|
|
114
|
-
</button>
|
|
115
|
-
<div
|
|
116
|
-
v-if="displayHighlight"
|
|
117
|
-
class="relative -top-[2px] h-[6px] nav__decorator"
|
|
118
|
-
:class="generateClass('BEFOREBG', highlightColor)"
|
|
119
|
-
></div>
|
|
120
|
-
</div>
|
|
121
|
-
</template>
|
|
122
|
-
<dropdown-content
|
|
123
|
-
v-slot="{ itemClick }"
|
|
124
|
-
className="border drop-shadow-sm"
|
|
125
|
-
>
|
|
126
|
-
<a
|
|
127
|
-
v-for="(item, idx) in navItem.children"
|
|
128
|
-
:href="item.url"
|
|
129
|
-
:target="item.target"
|
|
130
|
-
:key="idx"
|
|
131
|
-
ref="navItemRef"
|
|
132
|
-
class="px-xs py-2xs block w-full hover:bg-opacity-50 focus:bg-opacity-50 transition-all duration-200 ease-linear"
|
|
133
|
-
:class="[
|
|
134
|
-
generateClass('BGCOLOR', bgColor),
|
|
135
|
-
generateClass('HVBGCOLOR', highlightColor),
|
|
136
|
-
generateClass('FCBGCOLOR', highlightColor),
|
|
137
|
-
generateClass('TEXTCOLOR', menuTextColor),
|
|
138
|
-
generateClass('BODYTEXT', menuTextSize),
|
|
139
|
-
]"
|
|
140
|
-
@click="itemClick(), navItemClick($event, item)"
|
|
141
|
-
>
|
|
142
|
-
{{ item.title }}
|
|
143
|
-
</a>
|
|
144
|
-
</dropdown-content>
|
|
145
|
-
</dropdown-container>
|
|
146
|
-
</div>
|
|
147
|
-
</template>
|
|
148
|
-
|
|
149
|
-
<style scoped lang="scss">
|
|
150
|
-
.nav__decorator {
|
|
151
|
-
&::before {
|
|
152
|
-
content: '';
|
|
153
|
-
position: absolute;
|
|
154
|
-
bottom: 0;
|
|
155
|
-
left: 0;
|
|
156
|
-
height: 100%;
|
|
157
|
-
width: 0;
|
|
158
|
-
transition: width 0.3s linear;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
.nav__text:focus + .nav__decorator::before,
|
|
162
|
-
.nav__text:hover + .nav__decorator::before {
|
|
163
|
-
width: 100%;
|
|
164
|
-
}
|
|
165
|
-
</style>
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuCollapseType, MenuItemType } from '../common/index.types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
navItem: MenuCollapseType;
|
|
5
|
-
bgColor?: ColorPalette | undefined;
|
|
6
|
-
menuTextSize?: BodyText | undefined;
|
|
7
|
-
menuTextColor?: ColorPalette | undefined;
|
|
8
|
-
menuTextBold?: boolean | undefined;
|
|
9
|
-
displayHighlight?: boolean | undefined;
|
|
10
|
-
highlightColor?: ColorPalette | undefined;
|
|
11
|
-
asLink?: boolean | undefined;
|
|
12
|
-
}>, {
|
|
13
|
-
menuTextSize: string;
|
|
14
|
-
bgColor: string;
|
|
15
|
-
menuTextColor: string;
|
|
16
|
-
menuTextBold: boolean;
|
|
17
|
-
displayHighlight: boolean;
|
|
18
|
-
highlightColor: string;
|
|
19
|
-
asLink: boolean;
|
|
20
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
-
"label-click": (event: Event, title: string, open: boolean) => void;
|
|
22
|
-
"child-click": (event: Event, item: MenuItemType) => void;
|
|
23
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
24
|
-
navItem: MenuCollapseType;
|
|
25
|
-
bgColor?: ColorPalette | undefined;
|
|
26
|
-
menuTextSize?: BodyText | undefined;
|
|
27
|
-
menuTextColor?: ColorPalette | undefined;
|
|
28
|
-
menuTextBold?: boolean | undefined;
|
|
29
|
-
displayHighlight?: boolean | undefined;
|
|
30
|
-
highlightColor?: ColorPalette | undefined;
|
|
31
|
-
asLink?: boolean | undefined;
|
|
32
|
-
}>, {
|
|
33
|
-
menuTextSize: string;
|
|
34
|
-
bgColor: string;
|
|
35
|
-
menuTextColor: string;
|
|
36
|
-
menuTextBold: boolean;
|
|
37
|
-
displayHighlight: boolean;
|
|
38
|
-
highlightColor: string;
|
|
39
|
-
asLink: boolean;
|
|
40
|
-
}>>> & {
|
|
41
|
-
"onChild-click"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
42
|
-
"onLabel-click"?: ((event: Event, title: string, open: boolean) => any) | undefined;
|
|
43
|
-
}, {
|
|
44
|
-
bgColor: ColorPalette;
|
|
45
|
-
menuTextSize: BodyText;
|
|
46
|
-
menuTextColor: ColorPalette;
|
|
47
|
-
menuTextBold: boolean;
|
|
48
|
-
displayHighlight: boolean;
|
|
49
|
-
highlightColor: ColorPalette;
|
|
50
|
-
asLink: boolean;
|
|
51
|
-
}, {}>;
|
|
52
|
-
export default _default;
|
|
53
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
54
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
55
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
56
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
57
|
-
} : {
|
|
58
|
-
type: import('vue').PropType<T[K]>;
|
|
59
|
-
required: true;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
type __VLS_WithDefaults<P, D> = {
|
|
63
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
64
|
-
default: D[K];
|
|
65
|
-
}> : P[K];
|
|
66
|
-
};
|
|
67
|
-
type __VLS_Prettify<T> = {
|
|
68
|
-
[K in keyof T]: T[K];
|
|
69
|
-
} & {};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme'
|
|
3
|
-
import generateClass from '@bobbykim/manguito-theme'
|
|
4
|
-
import type { MenuItemType } from '../common/index.types'
|
|
5
|
-
|
|
6
|
-
const props = withDefaults(
|
|
7
|
-
defineProps<{
|
|
8
|
-
navItem: MenuItemType
|
|
9
|
-
menuTextSize?: BodyText
|
|
10
|
-
menuTextColor?: ColorPalette
|
|
11
|
-
menuTextBold?: boolean
|
|
12
|
-
displayHighlight?: boolean
|
|
13
|
-
highlightColor?: ColorPalette
|
|
14
|
-
asLink?: boolean
|
|
15
|
-
}>(),
|
|
16
|
-
{
|
|
17
|
-
menuTextSize: 'md',
|
|
18
|
-
menuTextColor: 'dark-3',
|
|
19
|
-
menuTextBold: false,
|
|
20
|
-
displayHighlight: true,
|
|
21
|
-
highlightColor: 'primary',
|
|
22
|
-
asLink: true,
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
const emit = defineEmits<{
|
|
27
|
-
(e: 'nav-link', event: Event, item: MenuItemType): void
|
|
28
|
-
}>()
|
|
29
|
-
|
|
30
|
-
const getMenuItemClass = (
|
|
31
|
-
size: BodyText,
|
|
32
|
-
color: ColorPalette,
|
|
33
|
-
bold: boolean
|
|
34
|
-
): string => {
|
|
35
|
-
/**
|
|
36
|
-
* @param {BodyText} size - menuTextSize
|
|
37
|
-
* @param {ColorPalette} color - menuTextColor
|
|
38
|
-
* @param {boolean} bold - menuTextBold
|
|
39
|
-
*/
|
|
40
|
-
const classArray: string[] = [
|
|
41
|
-
generateClass('BODYTEXT', size),
|
|
42
|
-
generateClass('TEXTCOLOR', color),
|
|
43
|
-
]
|
|
44
|
-
if (bold) {
|
|
45
|
-
classArray.push('font-bold')
|
|
46
|
-
}
|
|
47
|
-
return classArray.join(' ')
|
|
48
|
-
}
|
|
49
|
-
const handleNavLinkClick = (e: Event, item: MenuItemType) => {
|
|
50
|
-
const { asLink } = props
|
|
51
|
-
!asLink && e.preventDefault()
|
|
52
|
-
emit('nav-link', e, item)
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<template>
|
|
57
|
-
<div>
|
|
58
|
-
<a
|
|
59
|
-
:href="navItem.url"
|
|
60
|
-
:target="navItem.target"
|
|
61
|
-
v-html="navItem.title"
|
|
62
|
-
class="tracking-wider outline-none nav__text"
|
|
63
|
-
:class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
|
|
64
|
-
@click="handleNavLinkClick($event, navItem)"
|
|
65
|
-
></a>
|
|
66
|
-
<div
|
|
67
|
-
v-if="displayHighlight"
|
|
68
|
-
class="relative -top-[2px] h-[6px] nav__decorator"
|
|
69
|
-
:class="generateClass('BEFOREBG', highlightColor)"
|
|
70
|
-
></div>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<style scoped lang="scss">
|
|
75
|
-
.nav__decorator {
|
|
76
|
-
&::before {
|
|
77
|
-
content: '';
|
|
78
|
-
position: absolute;
|
|
79
|
-
bottom: 0;
|
|
80
|
-
left: 0;
|
|
81
|
-
height: 100%;
|
|
82
|
-
width: 0;
|
|
83
|
-
transition: width 0.3s linear;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.nav__text:focus + .nav__decorator::before,
|
|
88
|
-
.nav__text:hover + .nav__decorator::before {
|
|
89
|
-
width: 100%;
|
|
90
|
-
}
|
|
91
|
-
</style>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuItemType } from '../common/index.types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
navItem: MenuItemType;
|
|
5
|
-
menuTextSize?: BodyText | undefined;
|
|
6
|
-
menuTextColor?: ColorPalette | undefined;
|
|
7
|
-
menuTextBold?: boolean | undefined;
|
|
8
|
-
displayHighlight?: boolean | undefined;
|
|
9
|
-
highlightColor?: ColorPalette | undefined;
|
|
10
|
-
asLink?: boolean | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
menuTextSize: string;
|
|
13
|
-
menuTextColor: string;
|
|
14
|
-
menuTextBold: boolean;
|
|
15
|
-
displayHighlight: boolean;
|
|
16
|
-
highlightColor: string;
|
|
17
|
-
asLink: boolean;
|
|
18
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
-
"nav-link": (event: Event, item: MenuItemType) => void;
|
|
20
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
21
|
-
navItem: MenuItemType;
|
|
22
|
-
menuTextSize?: BodyText | undefined;
|
|
23
|
-
menuTextColor?: ColorPalette | undefined;
|
|
24
|
-
menuTextBold?: boolean | undefined;
|
|
25
|
-
displayHighlight?: boolean | undefined;
|
|
26
|
-
highlightColor?: ColorPalette | undefined;
|
|
27
|
-
asLink?: boolean | undefined;
|
|
28
|
-
}>, {
|
|
29
|
-
menuTextSize: string;
|
|
30
|
-
menuTextColor: string;
|
|
31
|
-
menuTextBold: boolean;
|
|
32
|
-
displayHighlight: boolean;
|
|
33
|
-
highlightColor: string;
|
|
34
|
-
asLink: boolean;
|
|
35
|
-
}>>> & {
|
|
36
|
-
"onNav-link"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
menuTextSize: BodyText;
|
|
39
|
-
menuTextColor: ColorPalette;
|
|
40
|
-
menuTextBold: boolean;
|
|
41
|
-
displayHighlight: boolean;
|
|
42
|
-
highlightColor: ColorPalette;
|
|
43
|
-
asLink: boolean;
|
|
44
|
-
}, {}>;
|
|
45
|
-
export default _default;
|
|
46
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
47
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
48
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
49
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
50
|
-
} : {
|
|
51
|
-
type: import('vue').PropType<T[K]>;
|
|
52
|
-
required: true;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
type __VLS_WithDefaults<P, D> = {
|
|
56
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
57
|
-
default: D[K];
|
|
58
|
-
}> : P[K];
|
|
59
|
-
};
|
|
60
|
-
type __VLS_Prettify<T> = {
|
|
61
|
-
[K in keyof T]: T[K];
|
|
62
|
-
} & {};
|