@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
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Transition, computed, ref } from 'vue'
|
|
3
|
+
import type { ColorPalette } from '../../'
|
|
4
|
+
import generateClass from '../../'
|
|
5
|
+
import NavDrawer from './NavDrawer.vue'
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
bgColor?: ColorPalette
|
|
9
|
+
drawerBtnColor?: ColorPalette
|
|
10
|
+
drawerBtnBorder?: boolean
|
|
11
|
+
headerWidth?: number
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
bgColor: 'light-1',
|
|
15
|
+
drawerBtnColor: 'dark-1',
|
|
16
|
+
drawerBtnBorder: true,
|
|
17
|
+
headerWidth: 160,
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const slots = defineSlots<{
|
|
22
|
+
default: any
|
|
23
|
+
content: any
|
|
24
|
+
'content-bottom': any
|
|
25
|
+
'mobile-content'(props: { headerClose: () => void }): any
|
|
26
|
+
}>()
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
(e: 'toggle-drawer', event: Event, open: boolean): void
|
|
29
|
+
}>()
|
|
30
|
+
const navOpen = ref<boolean>(false)
|
|
31
|
+
|
|
32
|
+
const toggleNavButton = (e: Event): void => {
|
|
33
|
+
navOpen.value = !navOpen.value
|
|
34
|
+
emit('toggle-drawer', e, navOpen.value)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const closeNav = (): void => {
|
|
38
|
+
navOpen.value = false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const componentWidth = computed(() => {
|
|
42
|
+
return { '--header-width': `${props.headerWidth}px` }
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
defineExpose({
|
|
46
|
+
headerClose: closeNav,
|
|
47
|
+
})
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<section class="lg:flex">
|
|
52
|
+
<header class="relative" :style="componentWidth">
|
|
53
|
+
<nav
|
|
54
|
+
class="hidden lg:block lg:sticky lg:top-0 lg:left-0 lg:h-[100vh] py-sm header-desktop overscroll-contain overflow-y-scroll"
|
|
55
|
+
:class="[generateClass('BGCOLOR', bgColor)]"
|
|
56
|
+
>
|
|
57
|
+
<div class="flex flex-col justify-between h-full">
|
|
58
|
+
<div>
|
|
59
|
+
<slot name="content" />
|
|
60
|
+
</div>
|
|
61
|
+
<div v-if="slots['content-bottom']">
|
|
62
|
+
<slot name="content-bottom" />
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</nav>
|
|
66
|
+
|
|
67
|
+
<div class="block fixed lg:hidden top-0 right-0 mr-xs mt-xs z-20">
|
|
68
|
+
<NavDrawer
|
|
69
|
+
:color="drawerBtnColor"
|
|
70
|
+
:display-border="drawerBtnBorder"
|
|
71
|
+
class="block lg:hidden relative"
|
|
72
|
+
@hbg-click="toggleNavButton"
|
|
73
|
+
:toggle="navOpen"
|
|
74
|
+
:nav-color="bgColor"
|
|
75
|
+
></NavDrawer>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<!-- mobile menu -->
|
|
79
|
+
|
|
80
|
+
<div class="block lg:hidden relative">
|
|
81
|
+
<Transition name="slide-down" appear>
|
|
82
|
+
<div
|
|
83
|
+
class="fixed inset-0 overflow-y-scroll overscroll-contain py-lg px-sm"
|
|
84
|
+
v-if="navOpen"
|
|
85
|
+
:class="generateClass('BGCOLOR', bgColor)"
|
|
86
|
+
>
|
|
87
|
+
<div v-if="slots['mobile-content']" class="h-full">
|
|
88
|
+
<slot name="mobile-content" :header-close="closeNav" />
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</Transition>
|
|
92
|
+
</div>
|
|
93
|
+
</header>
|
|
94
|
+
<div class="w-full">
|
|
95
|
+
<slot />
|
|
96
|
+
</div>
|
|
97
|
+
</section>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<style scoped lang="scss">
|
|
101
|
+
.header-desktop {
|
|
102
|
+
width: 100%;
|
|
103
|
+
@media screen and (min-width: 1024px) {
|
|
104
|
+
width: var(--header-width);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.slide-down-enter-active,
|
|
108
|
+
.slide-down-leave-active {
|
|
109
|
+
transition: transform 0.5s ease-in, opacity 0.5s ease-in;
|
|
110
|
+
}
|
|
111
|
+
.slide-down-enter-from,
|
|
112
|
+
.slide-down-leave-to {
|
|
113
|
+
opacity: 0;
|
|
114
|
+
transform: translateY(-100%);
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ColorPalette } from '../../';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
bgColor?: ColorPalette | undefined;
|
|
4
|
+
drawerBtnColor?: ColorPalette | undefined;
|
|
5
|
+
drawerBtnBorder?: boolean | undefined;
|
|
6
|
+
headerWidth?: number | undefined;
|
|
7
|
+
}>, {
|
|
8
|
+
bgColor: string;
|
|
9
|
+
drawerBtnColor: string;
|
|
10
|
+
drawerBtnBorder: boolean;
|
|
11
|
+
headerWidth: number;
|
|
12
|
+
}>, {
|
|
13
|
+
headerClose: () => void;
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"toggle-drawer": (event: Event, open: boolean) => void;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
17
|
+
bgColor?: ColorPalette | undefined;
|
|
18
|
+
drawerBtnColor?: ColorPalette | undefined;
|
|
19
|
+
drawerBtnBorder?: boolean | undefined;
|
|
20
|
+
headerWidth?: number | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
bgColor: string;
|
|
23
|
+
drawerBtnColor: string;
|
|
24
|
+
drawerBtnBorder: boolean;
|
|
25
|
+
headerWidth: number;
|
|
26
|
+
}>>> & {
|
|
27
|
+
"onToggle-drawer"?: ((event: Event, open: boolean) => any) | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
bgColor: ColorPalette;
|
|
30
|
+
drawerBtnColor: ColorPalette;
|
|
31
|
+
drawerBtnBorder: boolean;
|
|
32
|
+
headerWidth: number;
|
|
33
|
+
}, {}>, Readonly<{
|
|
34
|
+
default: any;
|
|
35
|
+
content: any;
|
|
36
|
+
'content-bottom': any;
|
|
37
|
+
'mobile-content'(props: {
|
|
38
|
+
headerClose: () => void;
|
|
39
|
+
}): any;
|
|
40
|
+
}> & {
|
|
41
|
+
default: any;
|
|
42
|
+
content: any;
|
|
43
|
+
'content-bottom': any;
|
|
44
|
+
'mobile-content'(props: {
|
|
45
|
+
headerClose: () => void;
|
|
46
|
+
}): any;
|
|
47
|
+
}>;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
50
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
51
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
52
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
53
|
+
} : {
|
|
54
|
+
type: import('vue').PropType<T[K]>;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
type __VLS_WithDefaults<P, D> = {
|
|
59
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
60
|
+
default: D[K];
|
|
61
|
+
}> : P[K];
|
|
62
|
+
};
|
|
63
|
+
type __VLS_Prettify<T> = {
|
|
64
|
+
[K in keyof T]: T[K];
|
|
65
|
+
} & {};
|
|
66
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
67
|
+
new (): {
|
|
68
|
+
$slots: S;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import type { ColorPalette } from '../../'
|
|
4
|
+
import generateClass from '../../'
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
color?: ColorPalette
|
|
9
|
+
displayBorder?: boolean
|
|
10
|
+
toggle: boolean
|
|
11
|
+
navColor: ColorPalette
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
color: 'dark-2',
|
|
15
|
+
displayBorder: true,
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits(['hbg-click'])
|
|
20
|
+
|
|
21
|
+
const handleButtonToggle = (e: Event): void => {
|
|
22
|
+
emit('hbg-click', e)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const hamburgetButtonState = computed({
|
|
26
|
+
get() {
|
|
27
|
+
return props.toggle
|
|
28
|
+
},
|
|
29
|
+
set(value) {
|
|
30
|
+
return value
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const getBorderClass = (
|
|
35
|
+
bColor: ColorPalette,
|
|
36
|
+
border: boolean,
|
|
37
|
+
nColor: ColorPalette
|
|
38
|
+
): string => {
|
|
39
|
+
/**
|
|
40
|
+
* @bColor - color
|
|
41
|
+
* @border - displayBorder
|
|
42
|
+
* @nColor - navColor
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
const classArray: string[] = [
|
|
46
|
+
generateClass('RINGCOLOR', bColor),
|
|
47
|
+
generateClass('OFFSETRING', nColor),
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
if (border) {
|
|
51
|
+
classArray.push(generateClass('BORDER', bColor))
|
|
52
|
+
classArray.push('border')
|
|
53
|
+
}
|
|
54
|
+
return classArray.join(' ')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const getHamburgerButtonClass = (color: ColorPalette): string => {
|
|
58
|
+
/**
|
|
59
|
+
* @color - color
|
|
60
|
+
*/
|
|
61
|
+
const classArray: string[] = [
|
|
62
|
+
generateClass('BGCOLOR', color),
|
|
63
|
+
generateClass('BEFOREBG', color),
|
|
64
|
+
generateClass('AFTERBG', color),
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
return classArray.join(' ')
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<button
|
|
73
|
+
class="p-3xs rounded-md aspect-square outline-none focus:ring-4 ring-offset-2 transition-all duration-300 ease-linear hover:opacity-70 focus:opacity-70 hamburger__button"
|
|
74
|
+
:class="getBorderClass(color, displayBorder, navColor)"
|
|
75
|
+
@click="handleButtonToggle"
|
|
76
|
+
>
|
|
77
|
+
<input
|
|
78
|
+
type="checkbox"
|
|
79
|
+
v-model="hamburgetButtonState"
|
|
80
|
+
class="hidden hamburger__checkbox"
|
|
81
|
+
/>
|
|
82
|
+
<div
|
|
83
|
+
class="relative h-[3px] w-sm hamburger__icon before:w-sm after:w-sm before:h-[3px] after:h-[3px] transition-all duration-300 ease-linear"
|
|
84
|
+
:class="getHamburgerButtonClass(color)"
|
|
85
|
+
></div>
|
|
86
|
+
</button>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<style lang="scss" scoped>
|
|
90
|
+
.hamburger__icon {
|
|
91
|
+
&::before,
|
|
92
|
+
&::after {
|
|
93
|
+
position: absolute;
|
|
94
|
+
left: 0;
|
|
95
|
+
transition: all 0.3s linear;
|
|
96
|
+
}
|
|
97
|
+
&::before {
|
|
98
|
+
top: -0.5rem;
|
|
99
|
+
}
|
|
100
|
+
&::after {
|
|
101
|
+
top: 0.5rem;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
.hamburger__button {
|
|
105
|
+
&:focus .hamburger__icon,
|
|
106
|
+
&:hover .hamburger__icon {
|
|
107
|
+
scale: 1.05;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
.hamburger__checkbox:checked + .hamburger__icon {
|
|
111
|
+
background-color: transparent;
|
|
112
|
+
}
|
|
113
|
+
.hamburger__checkbox:checked + .hamburger__icon::before {
|
|
114
|
+
top: 0;
|
|
115
|
+
transform: rotate(135deg);
|
|
116
|
+
}
|
|
117
|
+
.hamburger__checkbox:checked + .hamburger__icon::after {
|
|
118
|
+
top: 0;
|
|
119
|
+
transform: rotate(-135deg);
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ColorPalette } from '../../';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
color?: ColorPalette | undefined;
|
|
4
|
+
displayBorder?: boolean | undefined;
|
|
5
|
+
toggle: boolean;
|
|
6
|
+
navColor: ColorPalette;
|
|
7
|
+
}>, {
|
|
8
|
+
color: string;
|
|
9
|
+
displayBorder: boolean;
|
|
10
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"hbg-click": (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
13
|
+
color?: ColorPalette | undefined;
|
|
14
|
+
displayBorder?: boolean | undefined;
|
|
15
|
+
toggle: boolean;
|
|
16
|
+
navColor: ColorPalette;
|
|
17
|
+
}>, {
|
|
18
|
+
color: string;
|
|
19
|
+
displayBorder: boolean;
|
|
20
|
+
}>>> & {
|
|
21
|
+
"onHbg-click"?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
color: ColorPalette;
|
|
24
|
+
displayBorder: boolean;
|
|
25
|
+
}, {}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
28
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
29
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
30
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
31
|
+
} : {
|
|
32
|
+
type: import('vue').PropType<T[K]>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type __VLS_WithDefaults<P, D> = {
|
|
37
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
38
|
+
default: D[K];
|
|
39
|
+
}> : P[K];
|
|
40
|
+
};
|
|
41
|
+
type __VLS_Prettify<T> = {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} & {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type HeaderStickyOptionType = 'none' | 'tablet' | 'pc' | 'all';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type HeaderStickyOptionType = 'none' | 'tablet' | 'pc' | 'all'
|
package/lib/modal/Modal.vue
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
ref,
|
|
4
|
-
computed,
|
|
5
|
-
watch,
|
|
6
3
|
Transition,
|
|
7
|
-
|
|
4
|
+
computed,
|
|
8
5
|
onBeforeUnmount,
|
|
6
|
+
onMounted,
|
|
7
|
+
ref,
|
|
8
|
+
watch,
|
|
9
9
|
} from 'vue'
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { observeVisibleAttr } from '../composables
|
|
10
|
+
import type { ColorPalette, VerticalAlignment } from '../../'
|
|
11
|
+
import generateClass, { vClickOutside } from '../../'
|
|
12
|
+
import { observeVisibleAttr } from '../composables'
|
|
13
13
|
|
|
14
14
|
const props = withDefaults(
|
|
15
15
|
defineProps<{
|
|
@@ -35,7 +35,15 @@ const props = withDefaults(
|
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const slots = defineSlots<{
|
|
39
|
+
header(props: { close: () => void; status: boolean }): any
|
|
40
|
+
body(props: { close: () => void; status: boolean }): any
|
|
41
|
+
footer(props: { close: () => void; status: boolean }): any
|
|
42
|
+
}>()
|
|
43
|
+
const emit = defineEmits<{
|
|
44
|
+
(e: 'open', visible: boolean): void
|
|
45
|
+
(e: 'close', visible: boolean): void
|
|
46
|
+
}>()
|
|
39
47
|
const modalRef = ref<HTMLElement | undefined>()
|
|
40
48
|
const toggle = ref<boolean>(props.visible)
|
|
41
49
|
const toggleComplete = ref<boolean>(false)
|
|
@@ -52,10 +60,10 @@ const closeModal = (): void => {
|
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
const emitOpenEvent = () => {
|
|
55
|
-
emit('open',
|
|
63
|
+
emit('open', true)
|
|
56
64
|
}
|
|
57
65
|
const emitCloseEvent = () => {
|
|
58
|
-
emit('close',
|
|
66
|
+
emit('close', false)
|
|
59
67
|
}
|
|
60
68
|
const handlePlacementVar = computed(() => {
|
|
61
69
|
let placementVariable: number
|
|
@@ -172,7 +180,7 @@ onBeforeUnmount(() => {
|
|
|
172
180
|
</slot>
|
|
173
181
|
</div>
|
|
174
182
|
<slot name="body" :close="closeModal" :status="toggle" />
|
|
175
|
-
<div class="sticky bottom-0">
|
|
183
|
+
<div class="sticky bottom-0" v-if="slots['footer']">
|
|
176
184
|
<slot name="footer" :close="closeModal" :status="toggle" />
|
|
177
185
|
</div>
|
|
178
186
|
</div>
|
package/lib/modal/Modal.vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColorPalette, VerticalAlignment } from '../../
|
|
1
|
+
import type { ColorPalette, VerticalAlignment } from '../../';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
title?: string | undefined;
|
|
4
4
|
titleColor?: ColorPalette | undefined;
|
|
@@ -23,9 +23,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
23
23
|
close: () => void;
|
|
24
24
|
open: () => void;
|
|
25
25
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
-
open: (
|
|
27
|
-
close: (
|
|
28
|
-
}, string, import("vue").
|
|
26
|
+
open: (visible: boolean) => void;
|
|
27
|
+
close: (visible: boolean) => void;
|
|
28
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
29
29
|
title?: string | undefined;
|
|
30
30
|
titleColor?: ColorPalette | undefined;
|
|
31
31
|
className?: string | undefined;
|
|
@@ -45,29 +45,42 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
45
45
|
backdropColor: string;
|
|
46
46
|
placement: string;
|
|
47
47
|
}>>> & {
|
|
48
|
-
onOpen?: ((
|
|
49
|
-
onClose?: ((
|
|
48
|
+
onOpen?: ((visible: boolean) => any) | undefined;
|
|
49
|
+
onClose?: ((visible: boolean) => any) | undefined;
|
|
50
50
|
}, {
|
|
51
51
|
visible: boolean;
|
|
52
52
|
className: string;
|
|
53
|
+
color: ColorPalette;
|
|
53
54
|
titleColor: ColorPalette;
|
|
54
55
|
noBackdrop: boolean;
|
|
55
56
|
noHeader: boolean;
|
|
56
|
-
color: ColorPalette;
|
|
57
57
|
backdropColor: ColorPalette;
|
|
58
58
|
placement: VerticalAlignment;
|
|
59
|
-
}, {}>, {
|
|
60
|
-
header
|
|
59
|
+
}, {}>, Readonly<{
|
|
60
|
+
header(props: {
|
|
61
|
+
close: () => void;
|
|
62
|
+
status: boolean;
|
|
63
|
+
}): any;
|
|
64
|
+
body(props: {
|
|
65
|
+
close: () => void;
|
|
66
|
+
status: boolean;
|
|
67
|
+
}): any;
|
|
68
|
+
footer(props: {
|
|
69
|
+
close: () => void;
|
|
70
|
+
status: boolean;
|
|
71
|
+
}): any;
|
|
72
|
+
}> & {
|
|
73
|
+
header(props: {
|
|
61
74
|
close: () => void;
|
|
62
|
-
status:
|
|
75
|
+
status: boolean;
|
|
63
76
|
}): any;
|
|
64
|
-
body
|
|
77
|
+
body(props: {
|
|
65
78
|
close: () => void;
|
|
66
|
-
status:
|
|
79
|
+
status: boolean;
|
|
67
80
|
}): any;
|
|
68
|
-
footer
|
|
81
|
+
footer(props: {
|
|
69
82
|
close: () => void;
|
|
70
|
-
status:
|
|
83
|
+
status: boolean;
|
|
71
84
|
}): any;
|
|
72
85
|
}>;
|
|
73
86
|
export default _default;
|
package/lib/sidebar/Sidebar.vue
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
ref,
|
|
4
|
-
computed,
|
|
5
|
-
watch,
|
|
6
3
|
Transition,
|
|
7
|
-
|
|
4
|
+
computed,
|
|
8
5
|
onBeforeUnmount,
|
|
6
|
+
onMounted,
|
|
7
|
+
ref,
|
|
8
|
+
watch,
|
|
9
9
|
} from 'vue'
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { observeVisibleAttr } from '../composables
|
|
10
|
+
import type { ColorPalette, DirectionX } from '../../'
|
|
11
|
+
import generateClass, { vClickOutside } from '../../'
|
|
12
|
+
import { observeVisibleAttr } from '../composables'
|
|
13
13
|
|
|
14
14
|
const props = withDefaults(
|
|
15
15
|
defineProps<{
|
|
@@ -37,7 +37,15 @@ const props = withDefaults(
|
|
|
37
37
|
}
|
|
38
38
|
)
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const slots = defineSlots<{
|
|
41
|
+
header(props: { close: () => void; status: boolean }): any
|
|
42
|
+
body(props: { close: () => void; status: boolean }): any
|
|
43
|
+
footer(props: { close: () => void; status: boolean }): any
|
|
44
|
+
}>()
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
(e: 'open', visible: boolean): void
|
|
47
|
+
(e: 'close', visible: boolean): void
|
|
48
|
+
}>()
|
|
41
49
|
const toggle = ref<boolean>(props.visible)
|
|
42
50
|
const toggleComplete = ref<boolean>(false)
|
|
43
51
|
const sidebarRef = ref<HTMLElement | undefined>()
|
|
@@ -50,16 +58,16 @@ const toggleSidebar = (): void => {
|
|
|
50
58
|
const openSidebar = (): void => {
|
|
51
59
|
toggle.value = true
|
|
52
60
|
}
|
|
53
|
-
const closeSidebar = (
|
|
61
|
+
const closeSidebar = (): void => {
|
|
54
62
|
if (toggleComplete.value === true) {
|
|
55
63
|
toggle.value = false
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
const emitOpenEvent = () => {
|
|
59
|
-
emit('open',
|
|
67
|
+
emit('open', true)
|
|
60
68
|
}
|
|
61
69
|
const emitCloseEvent = () => {
|
|
62
|
-
emit('close',
|
|
70
|
+
emit('close', false)
|
|
63
71
|
}
|
|
64
72
|
const handleStyleVariables = computed(() => {
|
|
65
73
|
return {
|
|
@@ -185,7 +193,7 @@ onBeforeUnmount(() => {
|
|
|
185
193
|
<slot name="body" :close="closeSidebar" :status="toggle" />
|
|
186
194
|
</div>
|
|
187
195
|
|
|
188
|
-
<div class="sticky bottom-0" ref="footerRef">
|
|
196
|
+
<div class="sticky bottom-0" ref="footerRef" v-if="slots['footer']">
|
|
189
197
|
<slot name="footer" :close="closeSidebar" :status="toggle" />
|
|
190
198
|
</div>
|
|
191
199
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColorPalette, DirectionX } from '../../
|
|
1
|
+
import type { ColorPalette, DirectionX } from '../../';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
3
|
title?: string | undefined;
|
|
4
4
|
titleColor?: ColorPalette | undefined;
|
|
@@ -23,11 +23,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
23
23
|
}>, {
|
|
24
24
|
toggle: () => void;
|
|
25
25
|
open: () => void;
|
|
26
|
-
close: (
|
|
26
|
+
close: () => void;
|
|
27
27
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
open: (
|
|
29
|
-
close: (
|
|
30
|
-
}, string, import("vue").
|
|
28
|
+
open: (visible: boolean) => void;
|
|
29
|
+
close: (visible: boolean) => void;
|
|
30
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
31
31
|
title?: string | undefined;
|
|
32
32
|
titleColor?: ColorPalette | undefined;
|
|
33
33
|
className?: string | undefined;
|
|
@@ -49,30 +49,43 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
49
49
|
placement: string;
|
|
50
50
|
width: number;
|
|
51
51
|
}>>> & {
|
|
52
|
-
onOpen?: ((
|
|
53
|
-
onClose?: ((
|
|
52
|
+
onOpen?: ((visible: boolean) => any) | undefined;
|
|
53
|
+
onClose?: ((visible: boolean) => any) | undefined;
|
|
54
54
|
}, {
|
|
55
55
|
visible: boolean;
|
|
56
56
|
className: string;
|
|
57
|
+
color: ColorPalette;
|
|
57
58
|
titleColor: ColorPalette;
|
|
58
59
|
noBackdrop: boolean;
|
|
59
60
|
noHeader: boolean;
|
|
60
|
-
color: ColorPalette;
|
|
61
61
|
backdropColor: ColorPalette;
|
|
62
62
|
placement: DirectionX;
|
|
63
63
|
width: string | number;
|
|
64
|
-
}, {}>, {
|
|
65
|
-
header
|
|
66
|
-
close: (
|
|
67
|
-
status:
|
|
64
|
+
}, {}>, Readonly<{
|
|
65
|
+
header(props: {
|
|
66
|
+
close: () => void;
|
|
67
|
+
status: boolean;
|
|
68
|
+
}): any;
|
|
69
|
+
body(props: {
|
|
70
|
+
close: () => void;
|
|
71
|
+
status: boolean;
|
|
72
|
+
}): any;
|
|
73
|
+
footer(props: {
|
|
74
|
+
close: () => void;
|
|
75
|
+
status: boolean;
|
|
76
|
+
}): any;
|
|
77
|
+
}> & {
|
|
78
|
+
header(props: {
|
|
79
|
+
close: () => void;
|
|
80
|
+
status: boolean;
|
|
68
81
|
}): any;
|
|
69
|
-
body
|
|
70
|
-
close: (
|
|
71
|
-
status:
|
|
82
|
+
body(props: {
|
|
83
|
+
close: () => void;
|
|
84
|
+
status: boolean;
|
|
72
85
|
}): any;
|
|
73
|
-
footer
|
|
74
|
-
close: (
|
|
75
|
-
status:
|
|
86
|
+
footer(props: {
|
|
87
|
+
close: () => void;
|
|
88
|
+
status: boolean;
|
|
76
89
|
}): any;
|
|
77
90
|
}>;
|
|
78
91
|
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import GenerateMCLClass, { borderWidthType, colorType, scaleType, textType, } from '.';
|
|
2
|
+
export const generateClass = (type, value) => {
|
|
3
|
+
const mclGenerate = new GenerateMCLClass(type, value);
|
|
4
|
+
if (colorType.includes(type)) {
|
|
5
|
+
return mclGenerate.generateColorClass();
|
|
6
|
+
}
|
|
7
|
+
if (textType.includes(type)) {
|
|
8
|
+
return mclGenerate.generateTextClass();
|
|
9
|
+
}
|
|
10
|
+
if (borderWidthType.includes(type)) {
|
|
11
|
+
return mclGenerate.generateBorderWidthClass();
|
|
12
|
+
}
|
|
13
|
+
if (scaleType.includes(type)) {
|
|
14
|
+
return mclGenerate.generateScaleClass();
|
|
15
|
+
}
|
|
16
|
+
// return spacing type if all of above is false
|
|
17
|
+
return mclGenerate.generateSpacingClass();
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ClassType, InputType } from '.'
|
|
2
|
+
import GenerateMCLClass, {
|
|
3
|
+
borderWidthType,
|
|
4
|
+
colorType,
|
|
5
|
+
scaleType,
|
|
6
|
+
textType,
|
|
7
|
+
} from '.'
|
|
8
|
+
|
|
9
|
+
export const generateClass = (type: ClassType, value: InputType): string => {
|
|
10
|
+
const mclGenerate = new GenerateMCLClass(type, value)
|
|
11
|
+
if ((<string[]>(<unknown>colorType)).includes(type)) {
|
|
12
|
+
return mclGenerate.generateColorClass()
|
|
13
|
+
}
|
|
14
|
+
if ((<string[]>(<unknown>textType)).includes(type)) {
|
|
15
|
+
return mclGenerate.generateTextClass()
|
|
16
|
+
}
|
|
17
|
+
if ((<string[]>(<unknown>borderWidthType)).includes(type)) {
|
|
18
|
+
return mclGenerate.generateBorderWidthClass()
|
|
19
|
+
}
|
|
20
|
+
if ((<string[]>(<unknown>scaleType)).includes(type)) {
|
|
21
|
+
return mclGenerate.generateScaleClass()
|
|
22
|
+
}
|
|
23
|
+
// return spacing type if all of above is false
|
|
24
|
+
return mclGenerate.generateSpacingClass()
|
|
25
|
+
}
|