@bobbykim/mcl-header 0.2.0 → 0.4.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/CHANGELOG.md +31 -0
- package/README.md +25 -4
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/index.ts +3 -2
- package/lib/{mcl-header-a → common}/index.types.d.ts +0 -10
- package/lib/{mcl-header-a → common}/index.types.ts +0 -12
- package/lib/mcl-header-a/MclHeaderA.vue +107 -238
- package/lib/mcl-header-a/MclHeaderA.vue.d.ts +46 -53
- package/lib/mcl-header-a/NavCollapse.vue +13 -21
- package/lib/mcl-header-a/NavCollapse.vue.d.ts +5 -3
- package/lib/mcl-header-a/NavDropdown.vue +15 -18
- package/lib/mcl-header-a/NavDropdown.vue.d.ts +5 -8
- package/lib/mcl-header-a/NavLink.vue +7 -5
- package/lib/mcl-header-a/NavLink.vue.d.ts +3 -3
- package/lib/mcl-header-b/MclHeaderB.vue +270 -0
- package/lib/mcl-header-b/MclHeaderB.vue.d.ts +132 -0
- package/lib/mcl-header-b/NavCollapseVertical.vue +211 -0
- package/lib/mcl-header-b/NavCollapseVertical.vue.d.ts +73 -0
- package/lib/mcl-header-b/NavLinkVertical.vue +78 -0
- package/lib/mcl-header-b/NavLinkVertical.vue.d.ts +62 -0
- package/package.json +27 -1
- package/tsconfig.json +2 -6
- package/tsconfig.ts.json +9 -0
- package/lib/common/HamburgerMenu.vue +0 -121
- package/lib/common/HamburgerMenu.vue.d.ts +0 -43
- /package/lib/{mcl-header-a → common}/index.types.js +0 -0
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import type { BodyText, ColorPalette, CtaTarget, HeadingSize } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuCollapseType, MenuItemType } from '
|
|
2
|
+
import type { MenuCollapseType, MenuItemType } from '../common/index.types';
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
logo: string;
|
|
5
5
|
logoSmall?: string | undefined;
|
|
6
6
|
logoAlt?: string | undefined;
|
|
7
|
-
logoAsLink?: boolean | undefined;
|
|
8
|
-
logoLink: string;
|
|
9
|
-
logoLinkTarget?: CtaTarget | undefined;
|
|
10
7
|
title: string;
|
|
11
8
|
titleSize?: HeadingSize | undefined;
|
|
12
9
|
titleColor?: ColorPalette | undefined;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
titleBlockAsLink?: boolean | undefined;
|
|
11
|
+
titleBlockLinkTarget?: CtaTarget | undefined;
|
|
12
|
+
titleBlockLink: string;
|
|
16
13
|
menuItems: (MenuItemType | MenuCollapseType)[];
|
|
17
14
|
menuItemAsLink?: boolean | undefined;
|
|
18
15
|
menuTextSize?: BodyText | undefined;
|
|
@@ -22,17 +19,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
22
19
|
highlightColor?: ColorPalette | undefined;
|
|
23
20
|
bgColor?: ColorPalette | undefined;
|
|
24
21
|
mobileMenuBgColor?: ColorPalette | undefined;
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
drawerBtnColor?: ColorPalette | undefined;
|
|
23
|
+
drawerBtnBorder?: boolean | undefined;
|
|
27
24
|
fadeInOnScroll?: boolean | undefined;
|
|
28
25
|
scrollDistance?: number | undefined;
|
|
29
26
|
}>, {
|
|
30
|
-
|
|
31
|
-
logoLinkTarget: string;
|
|
27
|
+
logoAlt: string;
|
|
32
28
|
titleSize: string;
|
|
33
29
|
titleColor: string;
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
titleBlockAsLink: boolean;
|
|
31
|
+
titleBlockLinkTarget: string;
|
|
36
32
|
menuItemAsLink: boolean;
|
|
37
33
|
menuTextSize: string;
|
|
38
34
|
menuTextColor: string;
|
|
@@ -41,28 +37,27 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
41
37
|
highlightColor: string;
|
|
42
38
|
bgColor: string;
|
|
43
39
|
mobileMenuBgColor: string;
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
drawerBtnColor: string;
|
|
41
|
+
drawerBtnBorder: boolean;
|
|
46
42
|
fadeInOnScroll: boolean;
|
|
47
43
|
scrollDistance: number;
|
|
48
|
-
}>, {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
44
|
+
}>, {
|
|
45
|
+
headerClose: () => void;
|
|
46
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
47
|
+
"toggle-drawer": (event: Event, open: boolean) => void;
|
|
48
|
+
"title-click": (event: Event, url: string, target: CtaTarget) => void;
|
|
49
|
+
"menu-click": (event: Event, item: MenuItemType) => void;
|
|
50
|
+
"collapse-click": (event: Event, title: string, visible: boolean) => void;
|
|
53
51
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
54
52
|
logo: string;
|
|
55
53
|
logoSmall?: string | undefined;
|
|
56
54
|
logoAlt?: string | undefined;
|
|
57
|
-
logoAsLink?: boolean | undefined;
|
|
58
|
-
logoLink: string;
|
|
59
|
-
logoLinkTarget?: CtaTarget | undefined;
|
|
60
55
|
title: string;
|
|
61
56
|
titleSize?: HeadingSize | undefined;
|
|
62
57
|
titleColor?: ColorPalette | undefined;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
titleBlockAsLink?: boolean | undefined;
|
|
59
|
+
titleBlockLinkTarget?: CtaTarget | undefined;
|
|
60
|
+
titleBlockLink: string;
|
|
66
61
|
menuItems: (MenuItemType | MenuCollapseType)[];
|
|
67
62
|
menuItemAsLink?: boolean | undefined;
|
|
68
63
|
menuTextSize?: BodyText | undefined;
|
|
@@ -72,17 +67,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
72
67
|
highlightColor?: ColorPalette | undefined;
|
|
73
68
|
bgColor?: ColorPalette | undefined;
|
|
74
69
|
mobileMenuBgColor?: ColorPalette | undefined;
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
drawerBtnColor?: ColorPalette | undefined;
|
|
71
|
+
drawerBtnBorder?: boolean | undefined;
|
|
77
72
|
fadeInOnScroll?: boolean | undefined;
|
|
78
73
|
scrollDistance?: number | undefined;
|
|
79
74
|
}>, {
|
|
80
|
-
|
|
81
|
-
logoLinkTarget: string;
|
|
75
|
+
logoAlt: string;
|
|
82
76
|
titleSize: string;
|
|
83
77
|
titleColor: string;
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
titleBlockAsLink: boolean;
|
|
79
|
+
titleBlockLinkTarget: string;
|
|
86
80
|
menuItemAsLink: boolean;
|
|
87
81
|
menuTextSize: string;
|
|
88
82
|
menuTextColor: string;
|
|
@@ -91,40 +85,39 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
91
85
|
highlightColor: string;
|
|
92
86
|
bgColor: string;
|
|
93
87
|
mobileMenuBgColor: string;
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
drawerBtnColor: string;
|
|
89
|
+
drawerBtnBorder: boolean;
|
|
96
90
|
fadeInOnScroll: boolean;
|
|
97
91
|
scrollDistance: number;
|
|
98
92
|
}>>> & {
|
|
99
|
-
"onToggle-
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
93
|
+
"onToggle-drawer"?: ((event: Event, open: boolean) => any) | undefined;
|
|
94
|
+
"onTitle-click"?: ((event: Event, url: string, target: CtaTarget) => any) | undefined;
|
|
95
|
+
"onMenu-click"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
96
|
+
"onCollapse-click"?: ((event: Event, title: string, visible: boolean) => any) | undefined;
|
|
103
97
|
}, {
|
|
104
|
-
titleColor: ColorPalette;
|
|
105
98
|
bgColor: ColorPalette;
|
|
99
|
+
mobileMenuBgColor: ColorPalette;
|
|
100
|
+
drawerBtnColor: ColorPalette;
|
|
101
|
+
drawerBtnBorder: boolean;
|
|
102
|
+
fadeInOnScroll: boolean;
|
|
103
|
+
scrollDistance: number;
|
|
104
|
+
titleColor: ColorPalette;
|
|
106
105
|
menuTextSize: BodyText;
|
|
107
106
|
menuTextColor: ColorPalette;
|
|
108
107
|
menuTextBold: boolean;
|
|
109
108
|
displayHighlight: boolean;
|
|
110
109
|
highlightColor: ColorPalette;
|
|
111
|
-
|
|
112
|
-
logoLinkTarget: CtaTarget;
|
|
110
|
+
logoAlt: string;
|
|
113
111
|
titleSize: HeadingSize;
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
titleBlockAsLink: boolean;
|
|
113
|
+
titleBlockLinkTarget: CtaTarget;
|
|
116
114
|
menuItemAsLink: boolean;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
scrollDistance: number;
|
|
122
|
-
}, {}>, {
|
|
123
|
-
"nav-slot"?(_: {}): any;
|
|
124
|
-
"mobile-slot"?(_: {
|
|
125
|
-
closeNav: () => void;
|
|
115
|
+
}, {}>, Readonly<{
|
|
116
|
+
'content-right': any;
|
|
117
|
+
'mobile-bottom'(props: {
|
|
118
|
+
headerClose: () => void;
|
|
126
119
|
}): any;
|
|
127
|
-
}
|
|
120
|
+
}>>;
|
|
128
121
|
export default _default;
|
|
129
122
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
130
123
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
BodyText,
|
|
4
|
-
CollapseEvent,
|
|
5
|
-
ColorPalette,
|
|
6
|
-
} from '@bobbykim/manguito-theme'
|
|
2
|
+
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme'
|
|
7
3
|
import generateClass, { Collapse, vCollapse } from '@bobbykim/manguito-theme'
|
|
8
4
|
import { computed, ref } from 'vue'
|
|
9
|
-
import type {
|
|
10
|
-
MenuCollapseType,
|
|
11
|
-
MenuItemType,
|
|
12
|
-
NavChildClickEventType,
|
|
13
|
-
} from './index.types'
|
|
5
|
+
import type { MenuCollapseType, MenuItemType } from '../common/index.types'
|
|
14
6
|
|
|
15
7
|
const props = withDefaults(
|
|
16
8
|
defineProps<{
|
|
@@ -38,34 +30,33 @@ const props = withDefaults(
|
|
|
38
30
|
}
|
|
39
31
|
)
|
|
40
32
|
|
|
41
|
-
const emit = defineEmits
|
|
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
|
+
}>()
|
|
42
37
|
const toggle = ref<boolean>(false)
|
|
43
38
|
const handleNavId = computed<string>(() => {
|
|
44
39
|
const { navId } = props
|
|
45
40
|
const navLower = navId.toLowerCase()
|
|
46
|
-
// @ts-ignore: Unreachable code error
|
|
47
41
|
const navKebab = navLower.replaceAll(' ', '-')
|
|
48
42
|
return `nav-${navKebab}`
|
|
49
43
|
})
|
|
50
44
|
const handleNavAccordionGroupName = computed<string>(() => {
|
|
51
45
|
const { navAccordionGroup } = props
|
|
52
46
|
const toLowerCase = navAccordionGroup.toLocaleLowerCase()
|
|
53
|
-
// @ts-ignore: Unreachable code error
|
|
54
47
|
const toKebabCase = toLowerCase.replaceAll(' ', '-')
|
|
55
48
|
return `accordion-${toKebabCase}`
|
|
56
49
|
})
|
|
57
|
-
const toggleAction = (
|
|
58
|
-
toggle.value =
|
|
59
|
-
|
|
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)
|
|
60
55
|
}
|
|
61
56
|
const navItemClick = (e: Event, item: MenuItemType) => {
|
|
62
57
|
const { asLink } = props
|
|
63
58
|
!asLink && e.preventDefault()
|
|
64
|
-
|
|
65
|
-
event: e,
|
|
66
|
-
item,
|
|
67
|
-
}
|
|
68
|
-
emit('nav-link', customEvent)
|
|
59
|
+
emit('child-click', e, item)
|
|
69
60
|
}
|
|
70
61
|
const getMenuItemClass = (
|
|
71
62
|
size: BodyText,
|
|
@@ -95,6 +86,7 @@ const getMenuItemClass = (
|
|
|
95
86
|
class="tracking-wider align-middle outline-none nav__text flex items-center gap-3xs"
|
|
96
87
|
:class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
|
|
97
88
|
v-collapse:[handleNavId]
|
|
89
|
+
@click=""
|
|
98
90
|
>
|
|
99
91
|
<span>
|
|
100
92
|
{{ navItem.title }}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuCollapseType } from '
|
|
2
|
+
import type { MenuCollapseType, MenuItemType } from '../common/index.types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
navId: string;
|
|
5
5
|
navAccordionGroup: string;
|
|
@@ -22,7 +22,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
22
22
|
highlightColor: string;
|
|
23
23
|
asLink: boolean;
|
|
24
24
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
-
"
|
|
25
|
+
"child-click": (event: Event, item: MenuItemType) => void;
|
|
26
|
+
"label-click": (event: Event, title: string, open: boolean) => void;
|
|
26
27
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
27
28
|
navId: string;
|
|
28
29
|
navAccordionGroup: string;
|
|
@@ -45,7 +46,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
45
46
|
highlightColor: string;
|
|
46
47
|
asLink: boolean;
|
|
47
48
|
}>>> & {
|
|
48
|
-
"
|
|
49
|
+
"onChild-click"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
50
|
+
"onLabel-click"?: ((event: Event, title: string, open: boolean) => any) | undefined;
|
|
49
51
|
}, {
|
|
50
52
|
bgColor: ColorPalette;
|
|
51
53
|
hoverBgColor: ColorPalette;
|
|
@@ -5,17 +5,12 @@ import generateClass, {
|
|
|
5
5
|
DropdownContent,
|
|
6
6
|
} from '@bobbykim/manguito-theme'
|
|
7
7
|
import { ref } from 'vue'
|
|
8
|
-
import type {
|
|
9
|
-
MenuCollapseType,
|
|
10
|
-
MenuItemType,
|
|
11
|
-
NavChildClickEventType,
|
|
12
|
-
} from './index.types'
|
|
8
|
+
import type { MenuCollapseType, MenuItemType } from '../common/index.types'
|
|
13
9
|
|
|
14
10
|
const props = withDefaults(
|
|
15
11
|
defineProps<{
|
|
16
12
|
navItem: MenuCollapseType
|
|
17
13
|
bgColor?: ColorPalette
|
|
18
|
-
hoverBgColor?: ColorPalette
|
|
19
14
|
menuTextSize?: BodyText
|
|
20
15
|
menuTextColor?: ColorPalette
|
|
21
16
|
menuTextBold?: boolean
|
|
@@ -26,7 +21,6 @@ const props = withDefaults(
|
|
|
26
21
|
{
|
|
27
22
|
menuTextSize: 'md',
|
|
28
23
|
bgColor: 'light-1',
|
|
29
|
-
hoverBgColor: 'dark-1',
|
|
30
24
|
menuTextColor: 'dark-3',
|
|
31
25
|
menuTextBold: false,
|
|
32
26
|
displayHighlight: true,
|
|
@@ -35,7 +29,10 @@ const props = withDefaults(
|
|
|
35
29
|
}
|
|
36
30
|
)
|
|
37
31
|
|
|
38
|
-
const emit = defineEmits
|
|
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
|
+
}>()
|
|
39
36
|
const navIndexRef = ref<number>(-1)
|
|
40
37
|
const navItemRef = ref<HTMLButtonElement[]>()
|
|
41
38
|
|
|
@@ -72,18 +69,15 @@ const navKeyUp = (direction: KeyDirection): void => {
|
|
|
72
69
|
}
|
|
73
70
|
navItemRef.value[navIndexRef.value].focus()
|
|
74
71
|
}
|
|
75
|
-
const dropdownButtonClick = (e: Event): void => {
|
|
72
|
+
const dropdownButtonClick = (e: Event, title: string, state: boolean): void => {
|
|
76
73
|
// resets index
|
|
77
74
|
navIndexRef.value = -1
|
|
75
|
+
emit('label-click', e, title, state)
|
|
78
76
|
}
|
|
79
77
|
const navItemClick = (e: Event, item: MenuItemType) => {
|
|
80
78
|
const { asLink } = props
|
|
81
79
|
!asLink && e.preventDefault()
|
|
82
|
-
|
|
83
|
-
event: e,
|
|
84
|
-
item,
|
|
85
|
-
}
|
|
86
|
-
emit('nav-link', customEvent)
|
|
80
|
+
emit('child-click', e, item)
|
|
87
81
|
}
|
|
88
82
|
</script>
|
|
89
83
|
|
|
@@ -95,7 +89,10 @@ const navItemClick = (e: Event, item: MenuItemType) => {
|
|
|
95
89
|
<button
|
|
96
90
|
class="tracking-wider align-middle outline-none nav__text flex items-center gap-3xs"
|
|
97
91
|
:class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
|
|
98
|
-
@click="
|
|
92
|
+
@click="
|
|
93
|
+
toggle($event),
|
|
94
|
+
dropdownButtonClick($event, navItem.title, dropdownState)
|
|
95
|
+
"
|
|
99
96
|
>
|
|
100
97
|
<span>
|
|
101
98
|
{{ navItem.title }}
|
|
@@ -132,11 +129,11 @@ const navItemClick = (e: Event, item: MenuItemType) => {
|
|
|
132
129
|
:target="item.target"
|
|
133
130
|
:key="idx"
|
|
134
131
|
ref="navItemRef"
|
|
135
|
-
class="px-xs py-2xs block w-full hover:bg-opacity-50 focus:bg-opacity-50"
|
|
132
|
+
class="px-xs py-2xs block w-full hover:bg-opacity-50 focus:bg-opacity-50 transition-all duration-200 ease-linear"
|
|
136
133
|
:class="[
|
|
137
134
|
generateClass('BGCOLOR', bgColor),
|
|
138
|
-
generateClass('HVBGCOLOR',
|
|
139
|
-
generateClass('FCBGCOLOR',
|
|
135
|
+
generateClass('HVBGCOLOR', highlightColor),
|
|
136
|
+
generateClass('FCBGCOLOR', highlightColor),
|
|
140
137
|
generateClass('TEXTCOLOR', menuTextColor),
|
|
141
138
|
generateClass('BODYTEXT', menuTextSize),
|
|
142
139
|
]"
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuCollapseType } from '
|
|
2
|
+
import type { MenuCollapseType, MenuItemType } from '../common/index.types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
navItem: MenuCollapseType;
|
|
5
5
|
bgColor?: ColorPalette | undefined;
|
|
6
|
-
hoverBgColor?: ColorPalette | undefined;
|
|
7
6
|
menuTextSize?: BodyText | undefined;
|
|
8
7
|
menuTextColor?: ColorPalette | undefined;
|
|
9
8
|
menuTextBold?: boolean | undefined;
|
|
@@ -13,18 +12,17 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
13
12
|
}>, {
|
|
14
13
|
menuTextSize: string;
|
|
15
14
|
bgColor: string;
|
|
16
|
-
hoverBgColor: string;
|
|
17
15
|
menuTextColor: string;
|
|
18
16
|
menuTextBold: boolean;
|
|
19
17
|
displayHighlight: boolean;
|
|
20
18
|
highlightColor: string;
|
|
21
19
|
asLink: boolean;
|
|
22
20
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
|
-
"
|
|
21
|
+
"label-click": (event: Event, title: string, open: boolean) => void;
|
|
22
|
+
"child-click": (event: Event, item: MenuItemType) => void;
|
|
24
23
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
25
24
|
navItem: MenuCollapseType;
|
|
26
25
|
bgColor?: ColorPalette | undefined;
|
|
27
|
-
hoverBgColor?: ColorPalette | undefined;
|
|
28
26
|
menuTextSize?: BodyText | undefined;
|
|
29
27
|
menuTextColor?: ColorPalette | undefined;
|
|
30
28
|
menuTextBold?: boolean | undefined;
|
|
@@ -34,17 +32,16 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
34
32
|
}>, {
|
|
35
33
|
menuTextSize: string;
|
|
36
34
|
bgColor: string;
|
|
37
|
-
hoverBgColor: string;
|
|
38
35
|
menuTextColor: string;
|
|
39
36
|
menuTextBold: boolean;
|
|
40
37
|
displayHighlight: boolean;
|
|
41
38
|
highlightColor: string;
|
|
42
39
|
asLink: boolean;
|
|
43
40
|
}>>> & {
|
|
44
|
-
"
|
|
41
|
+
"onChild-click"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
42
|
+
"onLabel-click"?: ((event: Event, title: string, open: boolean) => any) | undefined;
|
|
45
43
|
}, {
|
|
46
44
|
bgColor: ColorPalette;
|
|
47
|
-
hoverBgColor: ColorPalette;
|
|
48
45
|
menuTextSize: BodyText;
|
|
49
46
|
menuTextColor: ColorPalette;
|
|
50
47
|
menuTextBold: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme'
|
|
3
3
|
import generateClass from '@bobbykim/manguito-theme'
|
|
4
|
-
import type { MenuItemType } from '
|
|
4
|
+
import type { MenuItemType } from '../common/index.types'
|
|
5
5
|
|
|
6
6
|
const props = withDefaults(
|
|
7
7
|
defineProps<{
|
|
@@ -23,7 +23,9 @@ const props = withDefaults(
|
|
|
23
23
|
}
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
const emit = defineEmits
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
(e: 'nav-link', event: Event, item: MenuItemType): void
|
|
28
|
+
}>()
|
|
27
29
|
|
|
28
30
|
const getMenuItemClass = (
|
|
29
31
|
size: BodyText,
|
|
@@ -44,10 +46,10 @@ const getMenuItemClass = (
|
|
|
44
46
|
}
|
|
45
47
|
return classArray.join(' ')
|
|
46
48
|
}
|
|
47
|
-
const handleNavLinkClick = (e: Event) => {
|
|
49
|
+
const handleNavLinkClick = (e: Event, item: MenuItemType) => {
|
|
48
50
|
const { asLink } = props
|
|
49
51
|
!asLink && e.preventDefault()
|
|
50
|
-
emit('nav-link', e)
|
|
52
|
+
emit('nav-link', e, item)
|
|
51
53
|
}
|
|
52
54
|
</script>
|
|
53
55
|
|
|
@@ -59,7 +61,7 @@ const handleNavLinkClick = (e: Event) => {
|
|
|
59
61
|
v-html="navItem.title"
|
|
60
62
|
class="tracking-wider outline-none nav__text"
|
|
61
63
|
:class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
|
|
62
|
-
@click="handleNavLinkClick"
|
|
64
|
+
@click="handleNavLinkClick($event, navItem)"
|
|
63
65
|
></a>
|
|
64
66
|
<div
|
|
65
67
|
v-if="displayHighlight"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { MenuItemType } from '
|
|
2
|
+
import type { MenuItemType } from '../common/index.types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
4
|
navItem: MenuItemType;
|
|
5
5
|
menuTextSize?: BodyText | undefined;
|
|
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
16
16
|
highlightColor: string;
|
|
17
17
|
asLink: boolean;
|
|
18
18
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
-
"nav-link": (
|
|
19
|
+
"nav-link": (event: Event, item: MenuItemType) => void;
|
|
20
20
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
21
21
|
navItem: MenuItemType;
|
|
22
22
|
menuTextSize?: BodyText | undefined;
|
|
@@ -33,7 +33,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
33
33
|
highlightColor: string;
|
|
34
34
|
asLink: boolean;
|
|
35
35
|
}>>> & {
|
|
36
|
-
"onNav-link"?: ((
|
|
36
|
+
"onNav-link"?: ((event: Event, item: MenuItemType) => any) | undefined;
|
|
37
37
|
}, {
|
|
38
38
|
menuTextSize: BodyText;
|
|
39
39
|
menuTextColor: ColorPalette;
|