@bobbykim/manguito-theme 0.15.0 → 0.17.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 +43 -0
- package/README.md +2 -0
- package/index.d.ts +9 -8
- package/index.js +13 -24
- package/index.ts +21 -30
- package/lib/collapse/Collapse.vue +10 -4
- package/lib/collapse/Collapse.vue.d.ts +9 -7
- package/lib/dropdown/DropdownContainer.vue +10 -5
- package/lib/dropdown/DropdownContainer.vue.d.ts +11 -11
- package/lib/dropdown/DropdownContent.vue +4 -1
- package/lib/dropdown/DropdownContent.vue.d.ts +7 -3
- package/lib/header/HeaderHorizontal.vue +158 -0
- package/lib/header/HeaderHorizontal.vue.d.ts +84 -0
- package/lib/header/HeaderVertical.vue +116 -0
- package/lib/header/HeaderVertical.vue.d.ts +70 -0
- package/lib/header/NavDrawer.vue +121 -0
- package/lib/header/NavDrawer.vue.d.ts +43 -0
- package/lib/header/index.types.d.ts +1 -0
- package/lib/header/index.types.ts +1 -0
- package/lib/modal/Modal.vue +19 -11
- package/lib/modal/Modal.vue.d.ts +27 -14
- package/lib/sidebar/Sidebar.vue +20 -12
- package/lib/sidebar/Sidebar.vue.d.ts +31 -18
- package/lib/theme/generateClass.d.ts +2 -0
- package/lib/theme/generateClass.js +18 -0
- package/lib/theme/generateClass.ts +25 -0
- package/{theme → lib/theme}/index.d.ts +4 -3
- package/{theme → lib/theme}/index.js +9 -0
- package/{theme → lib/theme}/index.ts +13 -4
- package/{theme → lib/theme}/theme.d.ts +2 -1
- package/{theme → lib/theme}/theme.js +20 -0
- package/{theme → lib/theme}/theme.ts +24 -4
- package/lib/tooltip/index.d.ts +1 -1
- package/package.json +3 -3
- package/tsconfig.json +2 -6
- package/tsconfig.ts.json +9 -0
- package/lib/collapse/index.types.d.ts +0 -3
- package/lib/collapse/index.types.ts +0 -3
- /package/lib/{collapse → header}/index.types.js +0 -0
- /package/{theme → lib/theme}/theme.types.d.ts +0 -0
- /package/{theme → lib/theme}/theme.types.js +0 -0
- /package/{theme → lib/theme}/theme.types.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.17.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.15.0...@bobbykim/manguito-theme@0.17.0) (2024-03-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* build and release ([a372086](https://github.com/bobbykim89/manguito-component-library/commit/a3720861fb40dd6ec1d0e3dda1f06e2479967432))
|
|
12
|
+
* code refactor ([8a025e7](https://github.com/bobbykim89/manguito-component-library/commit/8a025e7cf870ff3dd0cb35878a08793e99ec5cef))
|
|
13
|
+
* **components/*:** prepublish build ([c8eb95a](https://github.com/bobbykim89/manguito-component-library/commit/c8eb95a0ede6727bf183d2e9ad634ae64af1411d))
|
|
14
|
+
* **manguito-theme:** add header-vertical component ([05c339d](https://github.com/bobbykim89/manguito-component-library/commit/05c339d77cdded35d2e45a5c22c3833329e41532))
|
|
15
|
+
* **manguito-theme:** add new base component header-horizontal ([d3826ee](https://github.com/bobbykim89/manguito-component-library/commit/d3826ee1da15ea0edd2fa7f959269704f22008b3))
|
|
16
|
+
* **manguito-theme:** code refactor ([d310131](https://github.com/bobbykim89/manguito-component-library/commit/d31013189fa5e1c4f8085de63a08ee2932652f55))
|
|
17
|
+
* **mcl-header-a:** wip) update mcl-header-a ([344a13f](https://github.com/bobbykim89/manguito-component-library/commit/344a13f3cd25c6b02fc99866f19ae65bc89d9ec5))
|
|
18
|
+
* **mcl-header-b:** add mobile layout for mcl-header-b ([ca961ec](https://github.com/bobbykim89/manguito-component-library/commit/ca961ecbaecab1d2e879cb62e905e713878539c0))
|
|
19
|
+
* **mcl-header-b:** add more layouts for desktop screen ([bfd1c7e](https://github.com/bobbykim89/manguito-component-library/commit/bfd1c7e8ed3d9b839bea0dd1a7c3b5740a345c41))
|
|
20
|
+
* **mcl-header-b:** fix minor issues with mcl closing collapses in menu item click, update text color of menu items ([1ecfcf3](https://github.com/bobbykim89/manguito-component-library/commit/1ecfcf3ec474e6a6097a34bb9861cbb680280530))
|
|
21
|
+
* **mcl-header-b:** wip) adding story file for mcl-header-b ([2a80675](https://github.com/bobbykim89/manguito-component-library/commit/2a8067553df9a138398aef2a898ebdf3b4a9a268))
|
|
22
|
+
* **mcl-header:** move deprecated items to deprecated folder in root dir, update configs, init mcl-header-b component ([19aa842](https://github.com/bobbykim89/manguito-component-library/commit/19aa842faa7f1594f7be030b97d5093014efe7cb))
|
|
23
|
+
* tsconfig update, slots and emits update ([c30ff80](https://github.com/bobbykim89/manguito-component-library/commit/c30ff804c961d205ac097e20cd51285a15ca8966))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [0.16.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.15.0...@bobbykim/manguito-theme@0.16.0) (2024-03-21)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* code refactor ([8a025e7](https://github.com/bobbykim89/manguito-component-library/commit/8a025e7cf870ff3dd0cb35878a08793e99ec5cef))
|
|
35
|
+
* **manguito-theme:** add header-vertical component ([05c339d](https://github.com/bobbykim89/manguito-component-library/commit/05c339d77cdded35d2e45a5c22c3833329e41532))
|
|
36
|
+
* **manguito-theme:** add new base component header-horizontal ([d3826ee](https://github.com/bobbykim89/manguito-component-library/commit/d3826ee1da15ea0edd2fa7f959269704f22008b3))
|
|
37
|
+
* **mcl-header-a:** wip) update mcl-header-a ([344a13f](https://github.com/bobbykim89/manguito-component-library/commit/344a13f3cd25c6b02fc99866f19ae65bc89d9ec5))
|
|
38
|
+
* **mcl-header-b:** add mobile layout for mcl-header-b ([ca961ec](https://github.com/bobbykim89/manguito-component-library/commit/ca961ecbaecab1d2e879cb62e905e713878539c0))
|
|
39
|
+
* **mcl-header-b:** add more layouts for desktop screen ([bfd1c7e](https://github.com/bobbykim89/manguito-component-library/commit/bfd1c7e8ed3d9b839bea0dd1a7c3b5740a345c41))
|
|
40
|
+
* **mcl-header-b:** fix minor issues with mcl closing collapses in menu item click, update text color of menu items ([1ecfcf3](https://github.com/bobbykim89/manguito-component-library/commit/1ecfcf3ec474e6a6097a34bb9861cbb680280530))
|
|
41
|
+
* **mcl-header-b:** wip) adding story file for mcl-header-b ([2a80675](https://github.com/bobbykim89/manguito-component-library/commit/2a8067553df9a138398aef2a898ebdf3b4a9a268))
|
|
42
|
+
* **mcl-header:** move deprecated items to deprecated folder in root dir, update configs, init mcl-header-b component ([19aa842](https://github.com/bobbykim89/manguito-component-library/commit/19aa842faa7f1594f7be030b97d5093014efe7cb))
|
|
43
|
+
* tsconfig update, slots and emits update ([c30ff80](https://github.com/bobbykim89/manguito-component-library/commit/c30ff804c961d205ac097e20cd51285a15ca8966))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
# [0.15.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.14.0...@bobbykim/manguito-theme@0.15.0) (2024-02-27)
|
|
7
50
|
|
|
8
51
|
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ manguito-theme includes basic config for MCL, including type definitions for the
|
|
|
13
13
|
- [Modal](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-modal-component--modal)
|
|
14
14
|
- [Sidebar](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-sidebar-component--sidebar)
|
|
15
15
|
- [Tooltip](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-tooltip-component--tooltip)
|
|
16
|
+
- [Header (Horizontal)](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-header-horizontal--headerhorizontal)
|
|
17
|
+
- [Header (Vertical)](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-header-vertical--headervertical)
|
|
16
18
|
- Utility Class
|
|
17
19
|
- [Button Class](https://manguito-component-library.vercel.app/?path=/docs/base-utility-class-button-class--button)
|
|
18
20
|
- [Link Class](https://manguito-component-library.vercel.app/?path=/docs/base-utility-class-link-class--link)
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { generateClass } from './lib/theme/generateClass';
|
|
2
|
+
import Collapse from './lib/collapse/Collapse.vue';
|
|
2
3
|
import DropdownContainer from './lib/dropdown/DropdownContainer.vue';
|
|
3
4
|
import DropdownContent from './lib/dropdown/DropdownContent.vue';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import HeaderHorizontal from './lib/header/HeaderHorizontal.vue';
|
|
6
|
+
import HeaderVertical from './lib/header/HeaderVertical.vue';
|
|
6
7
|
import Modal from './lib/modal/Modal.vue';
|
|
7
|
-
|
|
8
|
+
import Sidebar from './lib/sidebar/Sidebar.vue';
|
|
9
|
+
export * from './lib/directives';
|
|
10
|
+
export * from './lib/header/index.types';
|
|
11
|
+
export * from './lib/theme/theme.types';
|
|
12
|
+
export { Collapse, DropdownContainer, DropdownContent, HeaderHorizontal, HeaderVertical, Modal, Sidebar, };
|
|
8
13
|
export default generateClass;
|
|
9
|
-
export { DropdownContainer, DropdownContent, Collapse, Sidebar, Modal };
|
|
10
|
-
export * from './lib/directives/index.js';
|
|
11
|
-
export * from './theme/theme.types.js';
|
|
12
|
-
export * from './lib/collapse/index.types.js';
|
package/index.js
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
// generate class function
|
|
2
|
+
import { generateClass } from './lib/theme/generateClass';
|
|
2
3
|
// base components
|
|
4
|
+
import Collapse from './lib/collapse/Collapse.vue';
|
|
3
5
|
import DropdownContainer from './lib/dropdown/DropdownContainer.vue';
|
|
4
6
|
import DropdownContent from './lib/dropdown/DropdownContent.vue';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
+
import HeaderHorizontal from './lib/header/HeaderHorizontal.vue';
|
|
8
|
+
import HeaderVertical from './lib/header/HeaderVertical.vue';
|
|
7
9
|
import Modal from './lib/modal/Modal.vue';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (borderWidthType.includes(type)) {
|
|
17
|
-
return mclGenerate.generateBorderWidthClass();
|
|
18
|
-
}
|
|
19
|
-
if (scaleType.includes(type)) {
|
|
20
|
-
return mclGenerate.generateScaleClass();
|
|
21
|
-
}
|
|
22
|
-
// return spacing type if all of above is false
|
|
23
|
-
return mclGenerate.generateSpacingClass();
|
|
24
|
-
};
|
|
10
|
+
import Sidebar from './lib/sidebar/Sidebar.vue';
|
|
11
|
+
// directives
|
|
12
|
+
export * from './lib/directives';
|
|
13
|
+
// types
|
|
14
|
+
export * from './lib/header/index.types';
|
|
15
|
+
export * from './lib/theme/theme.types';
|
|
16
|
+
// export components
|
|
17
|
+
export { Collapse, DropdownContainer, DropdownContent, HeaderHorizontal, HeaderVertical, Modal, Sidebar, };
|
|
25
18
|
export default generateClass;
|
|
26
|
-
export { DropdownContainer, DropdownContent, Collapse, Sidebar, Modal };
|
|
27
|
-
export * from './lib/directives/index.js';
|
|
28
|
-
export * from './theme/theme.types.js';
|
|
29
|
-
export * from './lib/collapse/index.types.js';
|
package/index.ts
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
textType,
|
|
4
|
-
borderWidthType,
|
|
5
|
-
scaleType,
|
|
6
|
-
} from './theme/index.js'
|
|
7
|
-
import type { ClassType, InputType } from './theme/index.js'
|
|
1
|
+
// generate class function
|
|
2
|
+
import { generateClass } from './lib/theme/generateClass'
|
|
8
3
|
// base components
|
|
4
|
+
import Collapse from './lib/collapse/Collapse.vue'
|
|
9
5
|
import DropdownContainer from './lib/dropdown/DropdownContainer.vue'
|
|
10
6
|
import DropdownContent from './lib/dropdown/DropdownContent.vue'
|
|
11
|
-
import
|
|
12
|
-
import
|
|
7
|
+
import HeaderHorizontal from './lib/header/HeaderHorizontal.vue'
|
|
8
|
+
import HeaderVertical from './lib/header/HeaderVertical.vue'
|
|
13
9
|
import Modal from './lib/modal/Modal.vue'
|
|
10
|
+
import Sidebar from './lib/sidebar/Sidebar.vue'
|
|
11
|
+
|
|
12
|
+
// directives
|
|
13
|
+
export * from './lib/directives'
|
|
14
|
+
// types
|
|
15
|
+
export * from './lib/header/index.types'
|
|
16
|
+
export * from './lib/theme/theme.types'
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return mclGenerate.generateBorderWidthClass()
|
|
25
|
-
}
|
|
26
|
-
if ((<string[]>(<unknown>scaleType)).includes(type)) {
|
|
27
|
-
return mclGenerate.generateScaleClass()
|
|
28
|
-
}
|
|
29
|
-
// return spacing type if all of above is false
|
|
30
|
-
return mclGenerate.generateSpacingClass()
|
|
18
|
+
// export components
|
|
19
|
+
export {
|
|
20
|
+
Collapse,
|
|
21
|
+
DropdownContainer,
|
|
22
|
+
DropdownContent,
|
|
23
|
+
HeaderHorizontal,
|
|
24
|
+
HeaderVertical,
|
|
25
|
+
Modal,
|
|
26
|
+
Sidebar,
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
export default generateClass
|
|
34
|
-
|
|
35
|
-
export { DropdownContainer, DropdownContent, Collapse, Sidebar, Modal }
|
|
36
|
-
export * from './lib/directives/index.js'
|
|
37
|
-
export * from './theme/theme.types.js'
|
|
38
|
-
export * from './lib/collapse/index.types.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Transition, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
3
|
-
import { observeVisibleAttr } from '../composables
|
|
3
|
+
import { observeVisibleAttr } from '../composables'
|
|
4
4
|
|
|
5
5
|
const props = withDefaults(
|
|
6
6
|
defineProps<{
|
|
@@ -13,7 +13,13 @@ const props = withDefaults(
|
|
|
13
13
|
visible: false,
|
|
14
14
|
}
|
|
15
15
|
)
|
|
16
|
-
const
|
|
16
|
+
const slots = defineSlots<{
|
|
17
|
+
default: any
|
|
18
|
+
}>()
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
(e: 'open', visible: boolean): void
|
|
21
|
+
(e: 'close', visible: boolean): void
|
|
22
|
+
}>()
|
|
17
23
|
const collapseRef = ref<HTMLElement | undefined>()
|
|
18
24
|
const toggle = ref<boolean>(props.visible)
|
|
19
25
|
|
|
@@ -27,10 +33,10 @@ const closeCollapse = (): void => {
|
|
|
27
33
|
toggle.value = false
|
|
28
34
|
}
|
|
29
35
|
const emitOpenEvent = () => {
|
|
30
|
-
emit('open',
|
|
36
|
+
emit('open', true)
|
|
31
37
|
}
|
|
32
38
|
const emitCloseEvent = () => {
|
|
33
|
-
emit('close',
|
|
39
|
+
emit('close', false)
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
/**
|
|
@@ -10,9 +10,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
10
10
|
close: () => void;
|
|
11
11
|
open: () => void;
|
|
12
12
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
-
open: (
|
|
14
|
-
close: (
|
|
15
|
-
}, string, import("vue").
|
|
13
|
+
open: (visible: boolean) => void;
|
|
14
|
+
close: (visible: boolean) => void;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
16
16
|
accordion?: string | undefined;
|
|
17
17
|
className?: string | undefined;
|
|
18
18
|
visible?: boolean | undefined;
|
|
@@ -20,13 +20,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
20
20
|
className: string;
|
|
21
21
|
visible: boolean;
|
|
22
22
|
}>>> & {
|
|
23
|
-
onOpen?: ((
|
|
24
|
-
onClose?: ((
|
|
23
|
+
onOpen?: ((visible: boolean) => any) | undefined;
|
|
24
|
+
onClose?: ((visible: boolean) => any) | undefined;
|
|
25
25
|
}, {
|
|
26
26
|
visible: boolean;
|
|
27
27
|
className: string;
|
|
28
|
-
}, {}>, {
|
|
29
|
-
default
|
|
28
|
+
}, {}>, Readonly<{
|
|
29
|
+
default: any;
|
|
30
|
+
}> & {
|
|
31
|
+
default: any;
|
|
30
32
|
}>;
|
|
31
33
|
export default _default;
|
|
32
34
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { onMounted, provide, reactive, ref } from 'vue'
|
|
3
|
-
import { vClickOutside } from '../directives
|
|
4
|
-
import type { InjectType } from './index.types
|
|
3
|
+
import { vClickOutside } from '../directives'
|
|
4
|
+
import type { InjectType } from './index.types'
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const slots = defineSlots<{
|
|
7
|
+
default: any
|
|
8
|
+
toggler: any
|
|
9
|
+
}>()
|
|
10
|
+
const emit = defineEmits<{
|
|
11
|
+
(e: 'click-outside', event: Event): void
|
|
12
|
+
(e: 'toggle', event: Event): void
|
|
13
|
+
}>()
|
|
7
14
|
const dropdownTarget = ref()
|
|
8
15
|
const dropdownState = reactive<InjectType>({
|
|
9
16
|
active: false,
|
|
@@ -41,5 +48,3 @@ onMounted(() => {
|
|
|
41
48
|
<slot></slot>
|
|
42
49
|
</div>
|
|
43
50
|
</template>
|
|
44
|
-
|
|
45
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}, string, import("vue").
|
|
5
|
-
onToggle?: ((
|
|
6
|
-
"onClick-outside"?: ((
|
|
7
|
-
}, {}, {}>, {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"click-outside": (event: Event) => void;
|
|
3
|
+
toggle: (event: Event) => void;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
|
5
|
+
onToggle?: ((event: Event) => any) | undefined;
|
|
6
|
+
"onClick-outside"?: ((event: Event) => any) | undefined;
|
|
7
|
+
}, {}, {}>, Readonly<{
|
|
8
|
+
default: any;
|
|
9
|
+
toggler: any;
|
|
10
|
+
}> & {
|
|
11
|
+
default: any;
|
|
12
|
+
toggler: any;
|
|
13
13
|
}>;
|
|
14
14
|
export default _default;
|
|
15
15
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useWindowSize } from '@vueuse/core'
|
|
3
3
|
import { Transition, computed, inject, ref } from 'vue'
|
|
4
|
-
import type { InjectType } from './index.types
|
|
4
|
+
import type { InjectType } from './index.types'
|
|
5
5
|
|
|
6
6
|
withDefaults(
|
|
7
7
|
defineProps<{
|
|
@@ -12,6 +12,9 @@ withDefaults(
|
|
|
12
12
|
}
|
|
13
13
|
)
|
|
14
14
|
const { height } = useWindowSize()
|
|
15
|
+
const slots = defineSlots<{
|
|
16
|
+
default(props: { itemClick: () => void }): any
|
|
17
|
+
}>()
|
|
15
18
|
const contentRef = ref<HTMLAreaElement>()
|
|
16
19
|
const dropdownState = inject<InjectType>('dropdownState', {
|
|
17
20
|
active: false,
|
|
@@ -2,14 +2,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
2
2
|
className?: string | undefined;
|
|
3
3
|
}>, {
|
|
4
4
|
className: string;
|
|
5
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").
|
|
5
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
6
|
className?: string | undefined;
|
|
7
7
|
}>, {
|
|
8
8
|
className: string;
|
|
9
9
|
}>>>, {
|
|
10
10
|
className: string;
|
|
11
|
-
}, {}>, {
|
|
12
|
-
default
|
|
11
|
+
}, {}>, Readonly<{
|
|
12
|
+
default(props: {
|
|
13
|
+
itemClick: () => void;
|
|
14
|
+
}): any;
|
|
15
|
+
}> & {
|
|
16
|
+
default(props: {
|
|
13
17
|
itemClick: () => void;
|
|
14
18
|
}): any;
|
|
15
19
|
}>;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useWindowScroll } from '@vueuse/core'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
|
+
import type { ColorPalette } from '../../'
|
|
5
|
+
import generateClass from '../../'
|
|
6
|
+
import NavDrawer from './NavDrawer.vue'
|
|
7
|
+
import type { HeaderStickyOptionType } from './index.types'
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
bgColor?: ColorPalette
|
|
12
|
+
mobileMenuBgColor?: ColorPalette
|
|
13
|
+
drawerBtnColor?: ColorPalette
|
|
14
|
+
drawerBtnBorder?: boolean
|
|
15
|
+
fadeInOnScroll?: boolean
|
|
16
|
+
scrollDistance?: number
|
|
17
|
+
sticky?: HeaderStickyOptionType
|
|
18
|
+
}>(),
|
|
19
|
+
{
|
|
20
|
+
bgColor: 'light-1',
|
|
21
|
+
mobileMenuBgColor: 'light-2',
|
|
22
|
+
drawerBtnColor: 'dark-1',
|
|
23
|
+
drawerBtnBorder: true,
|
|
24
|
+
fadeInOnScroll: true,
|
|
25
|
+
scrollDistance: 50,
|
|
26
|
+
sticky: 'all',
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const slots = defineSlots<{
|
|
31
|
+
content: any
|
|
32
|
+
'content-right': any
|
|
33
|
+
'mobile-content'(props: { headerClose: () => void }): any
|
|
34
|
+
}>()
|
|
35
|
+
const navOpen = ref<boolean>(false)
|
|
36
|
+
const { y } = useWindowScroll()
|
|
37
|
+
const emit = defineEmits<{
|
|
38
|
+
(e: 'toggle-drawer', event: Event, open: boolean): void
|
|
39
|
+
}>()
|
|
40
|
+
|
|
41
|
+
const closeNav = (): void => {
|
|
42
|
+
navOpen.value = false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const toggleNavButton = (e: Event): void => {
|
|
46
|
+
navOpen.value = !navOpen.value
|
|
47
|
+
emit('toggle-drawer', e, navOpen.value)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @TransitionFunctions
|
|
52
|
+
* @param {HTMLElement} el - passed any since transition handlers don't accept HTMLElement (accepts Element)
|
|
53
|
+
*/
|
|
54
|
+
const onEnter = (el: any) => {
|
|
55
|
+
el.style.height = 'auto'
|
|
56
|
+
const endWidth = getComputedStyle(el).height
|
|
57
|
+
el.style.height = '0px'
|
|
58
|
+
el.offsetHeight // force repaint
|
|
59
|
+
el.style.height = endWidth
|
|
60
|
+
}
|
|
61
|
+
const onAfterEnter = (el: any) => {
|
|
62
|
+
el.style.height = 'auto'
|
|
63
|
+
}
|
|
64
|
+
const onLeave = (el: any) => {
|
|
65
|
+
el.style.height = getComputedStyle(el).height
|
|
66
|
+
el.offsetHeight // force repaint
|
|
67
|
+
el.style.height = '0px'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const handleHeaderClass = computed<string>(() => {
|
|
71
|
+
const { bgColor, sticky } = props
|
|
72
|
+
const classArray: string[] = [generateClass('BGCOLOR', bgColor)]
|
|
73
|
+
if (sticky === 'all') {
|
|
74
|
+
classArray.push('sticky top-0')
|
|
75
|
+
return classArray.join(' ')
|
|
76
|
+
}
|
|
77
|
+
if (sticky === 'tablet') {
|
|
78
|
+
classArray.push('md:sticky top-0')
|
|
79
|
+
return classArray.join(' ')
|
|
80
|
+
}
|
|
81
|
+
if (sticky === 'pc') {
|
|
82
|
+
classArray.push('lg:sticky top-0')
|
|
83
|
+
return classArray.join(' ')
|
|
84
|
+
}
|
|
85
|
+
return classArray.join(' ')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const handleFadeInOnScroll = computed(() => {
|
|
89
|
+
const { fadeInOnScroll, scrollDistance } = props
|
|
90
|
+
if (!fadeInOnScroll) {
|
|
91
|
+
return ''
|
|
92
|
+
}
|
|
93
|
+
return y.value >= scrollDistance
|
|
94
|
+
? 'lg:shadow-md bg-opacity-70'
|
|
95
|
+
: 'bg-opacity-100'
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
defineExpose({
|
|
99
|
+
headerClose: closeNav,
|
|
100
|
+
})
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<header
|
|
105
|
+
class="w-full items-center z-50 transition ease-in duration-500 delay-150"
|
|
106
|
+
:class="[handleFadeInOnScroll, handleHeaderClass]"
|
|
107
|
+
>
|
|
108
|
+
<nav
|
|
109
|
+
class="flex flex-wrap items-center py-xs md:py-2xs mx-xs md:mx-sm align-middle justify-between sm:max-w-[640px] md:max-w-[768px] lg:max-w-[1024px] xl:max-w-[1280px] 2xl:max-w-[1536px]"
|
|
110
|
+
>
|
|
111
|
+
<div class="min-h-[24px]">
|
|
112
|
+
<slot name="content"></slot>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="ml-auto">
|
|
115
|
+
<NavDrawer
|
|
116
|
+
:color="drawerBtnColor"
|
|
117
|
+
:display-border="drawerBtnBorder"
|
|
118
|
+
class="block lg:hidden"
|
|
119
|
+
@hbg-click="toggleNavButton"
|
|
120
|
+
:toggle="navOpen"
|
|
121
|
+
:nav-color="bgColor"
|
|
122
|
+
></NavDrawer>
|
|
123
|
+
<div v-if="slots['content-right']" class="hidden lg:block">
|
|
124
|
+
<slot name="content-right"></slot>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</nav>
|
|
128
|
+
<!-- mobile menu -->
|
|
129
|
+
|
|
130
|
+
<div class="overflow-hidden lg:hidden">
|
|
131
|
+
<transition
|
|
132
|
+
name="collapse"
|
|
133
|
+
@enter="onEnter"
|
|
134
|
+
@after-enter="onAfterEnter"
|
|
135
|
+
@leave="onLeave"
|
|
136
|
+
>
|
|
137
|
+
<div
|
|
138
|
+
class="bg-opacity-80 rounded-md my-2xs mx-xs overflow-hidden"
|
|
139
|
+
v-if="navOpen"
|
|
140
|
+
:class="generateClass('BGCOLOR', mobileMenuBgColor)"
|
|
141
|
+
>
|
|
142
|
+
<div v-if="slots['mobile-content']">
|
|
143
|
+
<slot name="mobile-content" :header-close="closeNav"></slot>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</transition>
|
|
147
|
+
</div>
|
|
148
|
+
</header>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<style scoped lang="scss">
|
|
152
|
+
.collapse-enter-active {
|
|
153
|
+
transition: height 0.5s ease-in;
|
|
154
|
+
}
|
|
155
|
+
.collapse-leave-active {
|
|
156
|
+
transition: height 0.5s ease-out;
|
|
157
|
+
}
|
|
158
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ColorPalette } from '../../';
|
|
2
|
+
import type { HeaderStickyOptionType } from './index.types';
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
bgColor?: ColorPalette | undefined;
|
|
5
|
+
mobileMenuBgColor?: ColorPalette | undefined;
|
|
6
|
+
drawerBtnColor?: ColorPalette | undefined;
|
|
7
|
+
drawerBtnBorder?: boolean | undefined;
|
|
8
|
+
fadeInOnScroll?: boolean | undefined;
|
|
9
|
+
scrollDistance?: number | undefined;
|
|
10
|
+
sticky?: HeaderStickyOptionType | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
bgColor: string;
|
|
13
|
+
mobileMenuBgColor: string;
|
|
14
|
+
drawerBtnColor: string;
|
|
15
|
+
drawerBtnBorder: boolean;
|
|
16
|
+
fadeInOnScroll: boolean;
|
|
17
|
+
scrollDistance: number;
|
|
18
|
+
sticky: string;
|
|
19
|
+
}>, {
|
|
20
|
+
headerClose: () => void;
|
|
21
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
+
"toggle-drawer": (event: Event, open: boolean) => void;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
24
|
+
bgColor?: ColorPalette | undefined;
|
|
25
|
+
mobileMenuBgColor?: ColorPalette | undefined;
|
|
26
|
+
drawerBtnColor?: ColorPalette | undefined;
|
|
27
|
+
drawerBtnBorder?: boolean | undefined;
|
|
28
|
+
fadeInOnScroll?: boolean | undefined;
|
|
29
|
+
scrollDistance?: number | undefined;
|
|
30
|
+
sticky?: HeaderStickyOptionType | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
bgColor: string;
|
|
33
|
+
mobileMenuBgColor: string;
|
|
34
|
+
drawerBtnColor: string;
|
|
35
|
+
drawerBtnBorder: boolean;
|
|
36
|
+
fadeInOnScroll: boolean;
|
|
37
|
+
scrollDistance: number;
|
|
38
|
+
sticky: string;
|
|
39
|
+
}>>> & {
|
|
40
|
+
"onToggle-drawer"?: ((event: Event, open: boolean) => any) | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
bgColor: ColorPalette;
|
|
43
|
+
mobileMenuBgColor: ColorPalette;
|
|
44
|
+
drawerBtnColor: ColorPalette;
|
|
45
|
+
drawerBtnBorder: boolean;
|
|
46
|
+
fadeInOnScroll: boolean;
|
|
47
|
+
scrollDistance: number;
|
|
48
|
+
sticky: HeaderStickyOptionType;
|
|
49
|
+
}, {}>, Readonly<{
|
|
50
|
+
content: any;
|
|
51
|
+
'content-right': any;
|
|
52
|
+
'mobile-content'(props: {
|
|
53
|
+
headerClose: () => void;
|
|
54
|
+
}): any;
|
|
55
|
+
}> & {
|
|
56
|
+
content: any;
|
|
57
|
+
'content-right': any;
|
|
58
|
+
'mobile-content'(props: {
|
|
59
|
+
headerClose: () => void;
|
|
60
|
+
}): any;
|
|
61
|
+
}>;
|
|
62
|
+
export default _default;
|
|
63
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
64
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
65
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
66
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
67
|
+
} : {
|
|
68
|
+
type: import('vue').PropType<T[K]>;
|
|
69
|
+
required: true;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type __VLS_WithDefaults<P, D> = {
|
|
73
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
74
|
+
default: D[K];
|
|
75
|
+
}> : P[K];
|
|
76
|
+
};
|
|
77
|
+
type __VLS_Prettify<T> = {
|
|
78
|
+
[K in keyof T]: T[K];
|
|
79
|
+
} & {};
|
|
80
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
81
|
+
new (): {
|
|
82
|
+
$slots: S;
|
|
83
|
+
};
|
|
84
|
+
};
|