@bobbykim/mcl-header 0.2.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.
@@ -0,0 +1,89 @@
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 './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(['nav-link'])
27
+
28
+ const getMenuItemClass = (
29
+ size: BodyText,
30
+ color: ColorPalette,
31
+ bold: boolean
32
+ ): string => {
33
+ /**
34
+ * @param {BodyText} size - menuTextSize
35
+ * @param {ColorPalette} color - menuTextColor
36
+ * @param {boolean} bold - menuTextBold
37
+ */
38
+ const classArray: string[] = [
39
+ generateClass('BODYTEXT', size),
40
+ generateClass('TEXTCOLOR', color),
41
+ ]
42
+ if (bold) {
43
+ classArray.push('font-bold')
44
+ }
45
+ return classArray.join(' ')
46
+ }
47
+ const handleNavLinkClick = (e: Event) => {
48
+ const { asLink } = props
49
+ !asLink && e.preventDefault()
50
+ emit('nav-link', e)
51
+ }
52
+ </script>
53
+
54
+ <template>
55
+ <div>
56
+ <a
57
+ :href="navItem.url"
58
+ :target="navItem.target"
59
+ v-html="navItem.title"
60
+ class="tracking-wider outline-none nav__text"
61
+ :class="getMenuItemClass(menuTextSize, menuTextColor, menuTextBold)"
62
+ @click="handleNavLinkClick"
63
+ ></a>
64
+ <div
65
+ v-if="displayHighlight"
66
+ class="relative -top-[2px] h-[6px] nav__decorator"
67
+ :class="generateClass('BEFOREBG', highlightColor)"
68
+ ></div>
69
+ </div>
70
+ </template>
71
+
72
+ <style scoped lang="scss">
73
+ .nav__decorator {
74
+ &::before {
75
+ content: '';
76
+ position: absolute;
77
+ bottom: 0;
78
+ left: 0;
79
+ height: 100%;
80
+ width: 0;
81
+ transition: width 0.3s linear;
82
+ }
83
+ }
84
+
85
+ .nav__text:focus + .nav__decorator::before,
86
+ .nav__text:hover + .nav__decorator::before {
87
+ width: 100%;
88
+ }
89
+ </style>
@@ -0,0 +1,62 @@
1
+ import type { BodyText, ColorPalette } from '@bobbykim/manguito-theme';
2
+ import type { MenuItemType } from './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": (...args: any[]) => void;
20
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, 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"?: ((...args: any[]) => 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
+ } & {};
@@ -0,0 +1,20 @@
1
+ import type { CtaTarget } from '@bobbykim/manguito-theme';
2
+ export interface MenuItemType {
3
+ title: string;
4
+ url: string;
5
+ target?: CtaTarget;
6
+ }
7
+ export interface MenuCollapseType {
8
+ title: string;
9
+ children: MenuItemType[];
10
+ }
11
+ export interface NavChildClickEventType {
12
+ event: Event;
13
+ item: MenuItemType;
14
+ }
15
+ export interface MenuEventType {
16
+ event: Event;
17
+ title: string;
18
+ link: string;
19
+ target?: CtaTarget;
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { CtaTarget } from '@bobbykim/manguito-theme'
2
+
3
+ export interface MenuItemType {
4
+ title: string
5
+ url: string
6
+ target?: CtaTarget
7
+ }
8
+
9
+ export interface MenuCollapseType {
10
+ title: string
11
+ children: MenuItemType[]
12
+ }
13
+
14
+ export interface NavChildClickEventType {
15
+ event: Event
16
+ item: MenuItemType
17
+ }
18
+
19
+ export interface MenuEventType {
20
+ event: Event
21
+ title: string
22
+ link: string
23
+ target?: CtaTarget
24
+ }
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"@bobbykim/mcl-header","version":"0.2.0","description":"","type":"module","main":"index.ts","scripts":{"build":"vue-tsc --project tsconfig.vue.json && tsc"},"author":{"name":"Bobby Kim","url":"https://www.devbobbykim.com/"},"homepage":"https://manguito-component-library.vercel.app/","repository":{"type":"git","url":"https://github.com/bobbykim89/manguito-component-library.git"},"publishConfig":{"access":"public"},"license":"MIT","dependencies":{"@bobbykim/manguito-theme":"^0.14.0"},"gitHead":"4d94a8d34988d926c8d465891fd7aa535cffdf33"}
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["./**/*.ts"],
4
+ "exclude": ["node_modules", "./**/*.vue.d.ts", "./**/*.vue"],
5
+ "compilerOptions": {
6
+ "skipLibCheck": true,
7
+ "declaration": true
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["./**/*.vue"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "declaration": true,
7
+ "emitDeclarationOnly": true
8
+ }
9
+ }