@bobbykim/manguito-theme 0.17.0 → 0.19.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/LICENSE.md +1 -1
- package/README.md +3 -2
- package/dist/core.cjs +2 -0
- package/dist/core.d.ts +676 -0
- package/dist/core.js +2088 -0
- package/dist/mcl-theme.cjs +1 -0
- package/dist/mcl-theme.d.ts +12 -0
- package/dist/mcl-theme.js +608 -0
- package/package.json +28 -7
- package/CHANGELOG.md +0 -137
- package/index.d.ts +0 -13
- package/index.js +0 -18
- package/index.ts +0 -29
- package/lib/collapse/Collapse.vue +0 -126
- package/lib/collapse/Collapse.vue.d.ts +0 -55
- package/lib/composables/index.d.ts +0 -1
- package/lib/composables/index.js +0 -1
- package/lib/composables/index.ts +0 -1
- package/lib/composables/observeVisible.d.ts +0 -1
- package/lib/composables/observeVisible.js +0 -24
- package/lib/composables/observeVisible.ts +0 -24
- package/lib/directives/index.d.ts +0 -6
- package/lib/directives/index.js +0 -186
- package/lib/directives/index.ts +0 -211
- package/lib/directives/index.types.d.ts +0 -14
- package/lib/directives/index.types.js +0 -1
- package/lib/directives/index.types.ts +0 -15
- package/lib/dropdown/DropdownContainer.vue +0 -50
- package/lib/dropdown/DropdownContainer.vue.d.ts +0 -19
- package/lib/dropdown/DropdownContent.vue +0 -69
- package/lib/dropdown/DropdownContent.vue.d.ts +0 -42
- package/lib/dropdown/index.types.d.ts +0 -4
- package/lib/dropdown/index.types.js +0 -1
- package/lib/dropdown/index.types.ts +0 -4
- package/lib/header/HeaderHorizontal.vue +0 -158
- package/lib/header/HeaderHorizontal.vue.d.ts +0 -84
- package/lib/header/HeaderVertical.vue +0 -116
- package/lib/header/HeaderVertical.vue.d.ts +0 -70
- package/lib/header/NavDrawer.vue +0 -121
- package/lib/header/NavDrawer.vue.d.ts +0 -43
- package/lib/header/index.types.d.ts +0 -1
- package/lib/header/index.types.js +0 -1
- package/lib/header/index.types.ts +0 -1
- package/lib/modal/Modal.vue +0 -227
- package/lib/modal/Modal.vue.d.ts +0 -108
- package/lib/sidebar/Sidebar.vue +0 -256
- package/lib/sidebar/Sidebar.vue.d.ts +0 -113
- package/lib/theme/generateClass.d.ts +0 -2
- package/lib/theme/generateClass.js +0 -18
- package/lib/theme/generateClass.ts +0 -25
- package/lib/theme/index.d.ts +0 -95
- package/lib/theme/index.js +0 -642
- package/lib/theme/index.ts +0 -676
- package/lib/theme/theme.d.ts +0 -89
- package/lib/theme/theme.js +0 -851
- package/lib/theme/theme.ts +0 -893
- package/lib/theme/theme.types.d.ts +0 -21
- package/lib/theme/theme.types.js +0 -1
- package/lib/theme/theme.types.ts +0 -68
- package/lib/tooltip/index.d.ts +0 -62
- package/lib/tooltip/index.js +0 -71
- package/lib/tooltip/index.ts +0 -76
- package/themeVariables.cjs +0 -607
- package/tsconfig.json +0 -5
- package/tsconfig.ts.json +0 -9
- package/tsconfig.vue.json +0 -9
package/lib/modal/Modal.vue
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
Transition,
|
|
4
|
-
computed,
|
|
5
|
-
onBeforeUnmount,
|
|
6
|
-
onMounted,
|
|
7
|
-
ref,
|
|
8
|
-
watch,
|
|
9
|
-
} from 'vue'
|
|
10
|
-
import type { ColorPalette, VerticalAlignment } from '../../'
|
|
11
|
-
import generateClass, { vClickOutside } from '../../'
|
|
12
|
-
import { observeVisibleAttr } from '../composables'
|
|
13
|
-
|
|
14
|
-
const props = withDefaults(
|
|
15
|
-
defineProps<{
|
|
16
|
-
title?: string
|
|
17
|
-
titleColor?: ColorPalette
|
|
18
|
-
className?: string
|
|
19
|
-
visible?: boolean
|
|
20
|
-
noBackdrop?: boolean
|
|
21
|
-
noHeader?: boolean
|
|
22
|
-
color?: ColorPalette
|
|
23
|
-
backdropColor?: ColorPalette
|
|
24
|
-
placement?: VerticalAlignment
|
|
25
|
-
}>(),
|
|
26
|
-
{
|
|
27
|
-
titleColor: 'dark-3',
|
|
28
|
-
className: '',
|
|
29
|
-
visible: false,
|
|
30
|
-
noBackdrop: false,
|
|
31
|
-
noHeader: false,
|
|
32
|
-
color: 'light-1',
|
|
33
|
-
backdropColor: 'dark-4',
|
|
34
|
-
placement: 'center',
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
|
|
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
|
-
}>()
|
|
47
|
-
const modalRef = ref<HTMLElement | undefined>()
|
|
48
|
-
const toggle = ref<boolean>(props.visible)
|
|
49
|
-
const toggleComplete = ref<boolean>(false)
|
|
50
|
-
|
|
51
|
-
const toggleModal = (): void => {
|
|
52
|
-
toggle.value = !toggle.value
|
|
53
|
-
}
|
|
54
|
-
const openModal = (): void => {
|
|
55
|
-
toggle.value = true
|
|
56
|
-
}
|
|
57
|
-
const closeModal = (): void => {
|
|
58
|
-
if (toggleComplete.value === true) {
|
|
59
|
-
toggle.value = false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const emitOpenEvent = () => {
|
|
63
|
-
emit('open', true)
|
|
64
|
-
}
|
|
65
|
-
const emitCloseEvent = () => {
|
|
66
|
-
emit('close', false)
|
|
67
|
-
}
|
|
68
|
-
const handlePlacementVar = computed(() => {
|
|
69
|
-
let placementVariable: number
|
|
70
|
-
if (props.placement === 'top') {
|
|
71
|
-
placementVariable = 25
|
|
72
|
-
} else if (props.placement === 'bottom') {
|
|
73
|
-
placementVariable = 75
|
|
74
|
-
} else {
|
|
75
|
-
placementVariable = 50
|
|
76
|
-
}
|
|
77
|
-
return { '--vertical-placement': placementVariable + '%' }
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @TransitionFunctions
|
|
82
|
-
* Handle toggleComplete value after completion of animation
|
|
83
|
-
*/
|
|
84
|
-
const onAfterEnter = () => {
|
|
85
|
-
toggleComplete.value = true
|
|
86
|
-
}
|
|
87
|
-
const onAfterLeave = () => {
|
|
88
|
-
toggleComplete.value = false
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// set nutation observer watching `visible` attribute in element
|
|
92
|
-
const handleVisibility = (visible: boolean = false) => {
|
|
93
|
-
toggle.value = visible
|
|
94
|
-
}
|
|
95
|
-
const observer = observeVisibleAttr(handleVisibility)
|
|
96
|
-
|
|
97
|
-
watch(
|
|
98
|
-
() => props.visible,
|
|
99
|
-
(newValue) => {
|
|
100
|
-
toggle.value = newValue
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
watch(toggle, (newValue) => {
|
|
104
|
-
if (newValue === true) {
|
|
105
|
-
emitOpenEvent()
|
|
106
|
-
} else if (newValue === false && toggleComplete.value === true) {
|
|
107
|
-
emitCloseEvent()
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
defineExpose({
|
|
111
|
-
toggle: toggleModal,
|
|
112
|
-
close: closeModal,
|
|
113
|
-
open: openModal,
|
|
114
|
-
})
|
|
115
|
-
onMounted(() => {
|
|
116
|
-
if (modalRef.value) {
|
|
117
|
-
observer.observe(modalRef.value, { attributes: true })
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
onBeforeUnmount(() => {
|
|
121
|
-
observer.disconnect()
|
|
122
|
-
})
|
|
123
|
-
</script>
|
|
124
|
-
|
|
125
|
-
<template>
|
|
126
|
-
<div :style="handlePlacementVar" :visible="toggle" ref="modalRef">
|
|
127
|
-
<!-- <button :id="modalId" @click="handleToggleEvent" class="hidden"></button> -->
|
|
128
|
-
<Transition name="fade" appear tag="div" v-if="!noBackdrop">
|
|
129
|
-
<section
|
|
130
|
-
v-if="toggle"
|
|
131
|
-
@click="closeModal"
|
|
132
|
-
class="fixed inset-0 overflow-y-auto bg-opacity-70 backdrop-blur z-[100]"
|
|
133
|
-
:class="generateClass('BGCOLOR', backdropColor)"
|
|
134
|
-
></section>
|
|
135
|
-
</Transition>
|
|
136
|
-
<Transition
|
|
137
|
-
name="slide-down"
|
|
138
|
-
tag="div"
|
|
139
|
-
@after-enter="onAfterEnter"
|
|
140
|
-
@after-leave="onAfterLeave"
|
|
141
|
-
appear
|
|
142
|
-
>
|
|
143
|
-
<div
|
|
144
|
-
v-if="toggle"
|
|
145
|
-
class="vertical-placement fixed w-full max-w-md z-[110] px-xs"
|
|
146
|
-
>
|
|
147
|
-
<div
|
|
148
|
-
v-click-outside="closeModal"
|
|
149
|
-
:class="[generateClass('BGCOLOR', color), className]"
|
|
150
|
-
class="relative overscroll-contain overflow-y-scroll max-h-[80vh] md:max-h-[60vh]"
|
|
151
|
-
>
|
|
152
|
-
<div v-if="!noHeader" class="sticky top-0">
|
|
153
|
-
<slot name="header" :close="closeModal" :status="toggle">
|
|
154
|
-
<div
|
|
155
|
-
class="flex justify-between items-center p-xs border-b-2"
|
|
156
|
-
:class="generateClass('BGCOLOR', color)"
|
|
157
|
-
>
|
|
158
|
-
<h3
|
|
159
|
-
v-if="title"
|
|
160
|
-
class="h3-md"
|
|
161
|
-
:class="generateClass('TEXTCOLOR', titleColor)"
|
|
162
|
-
>
|
|
163
|
-
{{ title }}
|
|
164
|
-
</h3>
|
|
165
|
-
<button @click="closeModal">
|
|
166
|
-
<svg
|
|
167
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
168
|
-
height="1em"
|
|
169
|
-
viewBox="0 0 384 512"
|
|
170
|
-
class="hover:opacity-75 focus:opacity-75 transition-opacity duration-300 ease-in h-sm"
|
|
171
|
-
:class="[generateClass('SVGFILL', titleColor)]"
|
|
172
|
-
>
|
|
173
|
-
<!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
|
|
174
|
-
<path
|
|
175
|
-
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
|
|
176
|
-
/>
|
|
177
|
-
</svg>
|
|
178
|
-
</button>
|
|
179
|
-
</div>
|
|
180
|
-
</slot>
|
|
181
|
-
</div>
|
|
182
|
-
<slot name="body" :close="closeModal" :status="toggle" />
|
|
183
|
-
<div class="sticky bottom-0" v-if="slots['footer']">
|
|
184
|
-
<slot name="footer" :close="closeModal" :status="toggle" />
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
</Transition>
|
|
189
|
-
</div>
|
|
190
|
-
</template>
|
|
191
|
-
|
|
192
|
-
<style scoped lang="scss">
|
|
193
|
-
.vertical-placement {
|
|
194
|
-
top: var(--vertical-placement);
|
|
195
|
-
left: 50%;
|
|
196
|
-
transform: translateY(calc(-1 * var(--vertical-placement))) translateX(-50%);
|
|
197
|
-
}
|
|
198
|
-
.fade-enter-active,
|
|
199
|
-
.fade-leave-active {
|
|
200
|
-
transition-property: opacity;
|
|
201
|
-
transition-duration: 300ms;
|
|
202
|
-
transition-timing-function: linear;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.fade-enter-from,
|
|
206
|
-
.fade-leave-to {
|
|
207
|
-
opacity: 0;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.slide-down-enter-active {
|
|
211
|
-
animation: slide-down 300ms ease;
|
|
212
|
-
}
|
|
213
|
-
.slide-down-leave-active {
|
|
214
|
-
animation: slide-down reverse 300ms ease;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
@keyframes slide-down {
|
|
218
|
-
0% {
|
|
219
|
-
opacity: 0;
|
|
220
|
-
transform: translateY(-100%) translateX(-50%);
|
|
221
|
-
}
|
|
222
|
-
100% {
|
|
223
|
-
opacity: 1;
|
|
224
|
-
transform: translateY(calc(-1 * var(--vertical-placement))) translateX(-50%);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
</style>
|
package/lib/modal/Modal.vue.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette, VerticalAlignment } from '../../';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
title?: string | undefined;
|
|
4
|
-
titleColor?: ColorPalette | undefined;
|
|
5
|
-
className?: string | undefined;
|
|
6
|
-
visible?: boolean | undefined;
|
|
7
|
-
noBackdrop?: boolean | undefined;
|
|
8
|
-
noHeader?: boolean | undefined;
|
|
9
|
-
color?: ColorPalette | undefined;
|
|
10
|
-
backdropColor?: ColorPalette | undefined;
|
|
11
|
-
placement?: VerticalAlignment | undefined;
|
|
12
|
-
}>, {
|
|
13
|
-
titleColor: string;
|
|
14
|
-
className: string;
|
|
15
|
-
visible: boolean;
|
|
16
|
-
noBackdrop: boolean;
|
|
17
|
-
noHeader: boolean;
|
|
18
|
-
color: string;
|
|
19
|
-
backdropColor: string;
|
|
20
|
-
placement: string;
|
|
21
|
-
}>, {
|
|
22
|
-
toggle: () => void;
|
|
23
|
-
close: () => void;
|
|
24
|
-
open: () => void;
|
|
25
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
-
open: (visible: boolean) => void;
|
|
27
|
-
close: (visible: boolean) => void;
|
|
28
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
29
|
-
title?: string | undefined;
|
|
30
|
-
titleColor?: ColorPalette | undefined;
|
|
31
|
-
className?: string | undefined;
|
|
32
|
-
visible?: boolean | undefined;
|
|
33
|
-
noBackdrop?: boolean | undefined;
|
|
34
|
-
noHeader?: boolean | undefined;
|
|
35
|
-
color?: ColorPalette | undefined;
|
|
36
|
-
backdropColor?: ColorPalette | undefined;
|
|
37
|
-
placement?: VerticalAlignment | undefined;
|
|
38
|
-
}>, {
|
|
39
|
-
titleColor: string;
|
|
40
|
-
className: string;
|
|
41
|
-
visible: boolean;
|
|
42
|
-
noBackdrop: boolean;
|
|
43
|
-
noHeader: boolean;
|
|
44
|
-
color: string;
|
|
45
|
-
backdropColor: string;
|
|
46
|
-
placement: string;
|
|
47
|
-
}>>> & {
|
|
48
|
-
onOpen?: ((visible: boolean) => any) | undefined;
|
|
49
|
-
onClose?: ((visible: boolean) => any) | undefined;
|
|
50
|
-
}, {
|
|
51
|
-
visible: boolean;
|
|
52
|
-
className: string;
|
|
53
|
-
color: ColorPalette;
|
|
54
|
-
titleColor: ColorPalette;
|
|
55
|
-
noBackdrop: boolean;
|
|
56
|
-
noHeader: boolean;
|
|
57
|
-
backdropColor: ColorPalette;
|
|
58
|
-
placement: VerticalAlignment;
|
|
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: {
|
|
74
|
-
close: () => void;
|
|
75
|
-
status: boolean;
|
|
76
|
-
}): any;
|
|
77
|
-
body(props: {
|
|
78
|
-
close: () => void;
|
|
79
|
-
status: boolean;
|
|
80
|
-
}): any;
|
|
81
|
-
footer(props: {
|
|
82
|
-
close: () => void;
|
|
83
|
-
status: boolean;
|
|
84
|
-
}): any;
|
|
85
|
-
}>;
|
|
86
|
-
export default _default;
|
|
87
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
88
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
89
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
90
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
91
|
-
} : {
|
|
92
|
-
type: import('vue').PropType<T[K]>;
|
|
93
|
-
required: true;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
type __VLS_WithDefaults<P, D> = {
|
|
97
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
98
|
-
default: D[K];
|
|
99
|
-
}> : P[K];
|
|
100
|
-
};
|
|
101
|
-
type __VLS_Prettify<T> = {
|
|
102
|
-
[K in keyof T]: T[K];
|
|
103
|
-
} & {};
|
|
104
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
105
|
-
new (): {
|
|
106
|
-
$slots: S;
|
|
107
|
-
};
|
|
108
|
-
};
|
package/lib/sidebar/Sidebar.vue
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
Transition,
|
|
4
|
-
computed,
|
|
5
|
-
onBeforeUnmount,
|
|
6
|
-
onMounted,
|
|
7
|
-
ref,
|
|
8
|
-
watch,
|
|
9
|
-
} from 'vue'
|
|
10
|
-
import type { ColorPalette, DirectionX } from '../../'
|
|
11
|
-
import generateClass, { vClickOutside } from '../../'
|
|
12
|
-
import { observeVisibleAttr } from '../composables'
|
|
13
|
-
|
|
14
|
-
const props = withDefaults(
|
|
15
|
-
defineProps<{
|
|
16
|
-
title?: string
|
|
17
|
-
titleColor?: ColorPalette
|
|
18
|
-
className?: string
|
|
19
|
-
visible?: boolean
|
|
20
|
-
noBackdrop?: boolean
|
|
21
|
-
noHeader?: boolean
|
|
22
|
-
color?: ColorPalette
|
|
23
|
-
backdropColor?: ColorPalette
|
|
24
|
-
placement?: DirectionX
|
|
25
|
-
width?: string | number
|
|
26
|
-
}>(),
|
|
27
|
-
{
|
|
28
|
-
titleColor: 'dark-3',
|
|
29
|
-
className: '',
|
|
30
|
-
visible: false,
|
|
31
|
-
noBackdrop: false,
|
|
32
|
-
noHeader: false,
|
|
33
|
-
color: 'light-1',
|
|
34
|
-
backdropColor: 'dark-4',
|
|
35
|
-
placement: 'left',
|
|
36
|
-
width: 300,
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
|
|
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
|
-
}>()
|
|
49
|
-
const toggle = ref<boolean>(props.visible)
|
|
50
|
-
const toggleComplete = ref<boolean>(false)
|
|
51
|
-
const sidebarRef = ref<HTMLElement | undefined>()
|
|
52
|
-
const headerRef = ref<HTMLElement>()
|
|
53
|
-
const footerRef = ref<HTMLElement>()
|
|
54
|
-
|
|
55
|
-
const toggleSidebar = (): void => {
|
|
56
|
-
toggle.value = !toggle.value
|
|
57
|
-
}
|
|
58
|
-
const openSidebar = (): void => {
|
|
59
|
-
toggle.value = true
|
|
60
|
-
}
|
|
61
|
-
const closeSidebar = (): void => {
|
|
62
|
-
if (toggleComplete.value === true) {
|
|
63
|
-
toggle.value = false
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const emitOpenEvent = () => {
|
|
67
|
-
emit('open', true)
|
|
68
|
-
}
|
|
69
|
-
const emitCloseEvent = () => {
|
|
70
|
-
emit('close', false)
|
|
71
|
-
}
|
|
72
|
-
const handleStyleVariables = computed(() => {
|
|
73
|
-
return {
|
|
74
|
-
'--sidebar-width': `${props.width}px`,
|
|
75
|
-
'--header-height':
|
|
76
|
-
headerRef.value && toggle.value
|
|
77
|
-
? headerRef.value.scrollHeight + 'px'
|
|
78
|
-
: '0px',
|
|
79
|
-
'--footer-height':
|
|
80
|
-
footerRef.value && toggle.value
|
|
81
|
-
? footerRef.value.scrollHeight + 'px'
|
|
82
|
-
: '0px',
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
const sidebarClass = computed(() => {
|
|
86
|
-
return props.placement === 'left' ? 'sidebar-left' : 'sidebar-right'
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @TransitionFunctions
|
|
91
|
-
* Handle toggleComplete value after completion of animation
|
|
92
|
-
*/
|
|
93
|
-
const onAfterEnter = () => {
|
|
94
|
-
toggleComplete.value = true
|
|
95
|
-
}
|
|
96
|
-
const onAfterLeave = () => {
|
|
97
|
-
toggleComplete.value = false
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// set nutation observer watching `visible` attribute in element
|
|
101
|
-
const handleVisibility = (visible: boolean = false) => {
|
|
102
|
-
toggle.value = visible
|
|
103
|
-
}
|
|
104
|
-
const observer = observeVisibleAttr(handleVisibility)
|
|
105
|
-
|
|
106
|
-
watch(
|
|
107
|
-
() => props.visible,
|
|
108
|
-
(newValue) => {
|
|
109
|
-
toggle.value = newValue
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
watch(toggle, (newValue) => {
|
|
113
|
-
if (newValue === true) {
|
|
114
|
-
emitOpenEvent()
|
|
115
|
-
} else if (newValue === false && toggleComplete.value === true) {
|
|
116
|
-
emitCloseEvent()
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
defineExpose({
|
|
120
|
-
toggle: toggleSidebar,
|
|
121
|
-
open: openSidebar,
|
|
122
|
-
close: closeSidebar,
|
|
123
|
-
})
|
|
124
|
-
onMounted(() => {
|
|
125
|
-
if (sidebarRef.value) {
|
|
126
|
-
observer.observe(sidebarRef.value, { attributes: true })
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
onBeforeUnmount(() => {
|
|
130
|
-
observer.disconnect()
|
|
131
|
-
})
|
|
132
|
-
</script>
|
|
133
|
-
|
|
134
|
-
<template>
|
|
135
|
-
<div :style="handleStyleVariables" :visible="toggle" ref="sidebarRef">
|
|
136
|
-
<!-- <button :id="sidebarId" @click="handleToggleEvent" class="hidden"></button> -->
|
|
137
|
-
<Transition name="fade" appear tag="div" v-if="!noBackdrop">
|
|
138
|
-
<section
|
|
139
|
-
v-if="toggle"
|
|
140
|
-
@click="closeSidebar"
|
|
141
|
-
class="fixed inset-0 overflow-y-auto bg-opacity-70 backdrop-blur z-[100]"
|
|
142
|
-
:class="generateClass('BGCOLOR', backdropColor)"
|
|
143
|
-
></section>
|
|
144
|
-
</Transition>
|
|
145
|
-
<Transition
|
|
146
|
-
:name="sidebarClass"
|
|
147
|
-
@after-enter="onAfterEnter"
|
|
148
|
-
@after-leave="onAfterLeave"
|
|
149
|
-
appear
|
|
150
|
-
>
|
|
151
|
-
<div
|
|
152
|
-
v-if="toggle"
|
|
153
|
-
v-click-outside="closeSidebar"
|
|
154
|
-
class="sidebar-body fixed h-full overflow-hidden inset-y-0 shadow z-[110]"
|
|
155
|
-
:class="[placement === 'left' ? 'left-0' : 'right-0']"
|
|
156
|
-
>
|
|
157
|
-
<div
|
|
158
|
-
class="relative h-full overscroll-contain overflow-y-scroll"
|
|
159
|
-
:class="[generateClass('BGCOLOR', color), className]"
|
|
160
|
-
>
|
|
161
|
-
<div v-if="!noHeader" class="sticky top-0" ref="headerRef">
|
|
162
|
-
<slot name="header" :close="closeSidebar" :status="toggle">
|
|
163
|
-
<div
|
|
164
|
-
class="flex justify-between items-center p-xs"
|
|
165
|
-
:class="generateClass('BGCOLOR', color)"
|
|
166
|
-
>
|
|
167
|
-
<h3
|
|
168
|
-
v-if="title"
|
|
169
|
-
class="h3-md"
|
|
170
|
-
:class="generateClass('TEXTCOLOR', titleColor)"
|
|
171
|
-
>
|
|
172
|
-
{{ title }}
|
|
173
|
-
</h3>
|
|
174
|
-
<button @click="closeSidebar">
|
|
175
|
-
<svg
|
|
176
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
177
|
-
height="1em"
|
|
178
|
-
viewBox="0 0 384 512"
|
|
179
|
-
class="hover:opacity-75 focus:opacity-75 transition-opacity duration-300 ease-in h-sm"
|
|
180
|
-
:class="[generateClass('SVGFILL', titleColor)]"
|
|
181
|
-
>
|
|
182
|
-
<!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
|
|
183
|
-
<path
|
|
184
|
-
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
|
|
185
|
-
/>
|
|
186
|
-
</svg>
|
|
187
|
-
</button>
|
|
188
|
-
</div>
|
|
189
|
-
</slot>
|
|
190
|
-
</div>
|
|
191
|
-
|
|
192
|
-
<div class="sidebar-body-height">
|
|
193
|
-
<slot name="body" :close="closeSidebar" :status="toggle" />
|
|
194
|
-
</div>
|
|
195
|
-
|
|
196
|
-
<div class="sticky bottom-0" ref="footerRef" v-if="slots['footer']">
|
|
197
|
-
<slot name="footer" :close="closeSidebar" :status="toggle" />
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
</Transition>
|
|
202
|
-
</div>
|
|
203
|
-
</template>
|
|
204
|
-
|
|
205
|
-
<style scoped lang="scss">
|
|
206
|
-
.sidebar-body {
|
|
207
|
-
width: 100%;
|
|
208
|
-
}
|
|
209
|
-
.sidebar-body-height {
|
|
210
|
-
min-height: calc(100vh - var(--header-height) - var(--footer-height));
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.fade-enter-active,
|
|
214
|
-
.fade-leave-active {
|
|
215
|
-
transition-property: opacity;
|
|
216
|
-
transition-duration: 300ms;
|
|
217
|
-
transition-timing-function: linear;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.fade-enter-from,
|
|
221
|
-
.fade-leave-to {
|
|
222
|
-
opacity: 0;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.sidebar-left-enter-active,
|
|
226
|
-
.sidebar-left-leave-active,
|
|
227
|
-
.sidebar-right-enter-active,
|
|
228
|
-
.sidebar-right-leave-active {
|
|
229
|
-
transition-property: transform, opacity;
|
|
230
|
-
transition-duration: 300ms;
|
|
231
|
-
transition-timing-function: linear;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.sidebar-left-enter-from,
|
|
235
|
-
.sidebar-left-leave-to {
|
|
236
|
-
transform: translateX(-100%);
|
|
237
|
-
}
|
|
238
|
-
.sidebar-right-enter-from,
|
|
239
|
-
.sidebar-right-leave-to {
|
|
240
|
-
transform: translateX(100%);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@media screen and (min-width: 768px) {
|
|
244
|
-
.sidebar-body {
|
|
245
|
-
width: var(--sidebar-width);
|
|
246
|
-
}
|
|
247
|
-
.sidebar-left-enter-from,
|
|
248
|
-
.sidebar-left-leave-to {
|
|
249
|
-
transform: translateX(calc(-1 * var(--sidebar-width)));
|
|
250
|
-
}
|
|
251
|
-
.sidebar-right-enter-from,
|
|
252
|
-
.sidebar-right-leave-to {
|
|
253
|
-
transform: translateX(var(--sidebar-width));
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
</style>
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette, DirectionX } from '../../';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
title?: string | undefined;
|
|
4
|
-
titleColor?: ColorPalette | undefined;
|
|
5
|
-
className?: string | undefined;
|
|
6
|
-
visible?: boolean | undefined;
|
|
7
|
-
noBackdrop?: boolean | undefined;
|
|
8
|
-
noHeader?: boolean | undefined;
|
|
9
|
-
color?: ColorPalette | undefined;
|
|
10
|
-
backdropColor?: ColorPalette | undefined;
|
|
11
|
-
placement?: DirectionX | undefined;
|
|
12
|
-
width?: string | number | undefined;
|
|
13
|
-
}>, {
|
|
14
|
-
titleColor: string;
|
|
15
|
-
className: string;
|
|
16
|
-
visible: boolean;
|
|
17
|
-
noBackdrop: boolean;
|
|
18
|
-
noHeader: boolean;
|
|
19
|
-
color: string;
|
|
20
|
-
backdropColor: string;
|
|
21
|
-
placement: string;
|
|
22
|
-
width: number;
|
|
23
|
-
}>, {
|
|
24
|
-
toggle: () => void;
|
|
25
|
-
open: () => void;
|
|
26
|
-
close: () => void;
|
|
27
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
open: (visible: boolean) => void;
|
|
29
|
-
close: (visible: boolean) => void;
|
|
30
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
31
|
-
title?: string | undefined;
|
|
32
|
-
titleColor?: ColorPalette | undefined;
|
|
33
|
-
className?: string | undefined;
|
|
34
|
-
visible?: boolean | undefined;
|
|
35
|
-
noBackdrop?: boolean | undefined;
|
|
36
|
-
noHeader?: boolean | undefined;
|
|
37
|
-
color?: ColorPalette | undefined;
|
|
38
|
-
backdropColor?: ColorPalette | undefined;
|
|
39
|
-
placement?: DirectionX | undefined;
|
|
40
|
-
width?: string | number | undefined;
|
|
41
|
-
}>, {
|
|
42
|
-
titleColor: string;
|
|
43
|
-
className: string;
|
|
44
|
-
visible: boolean;
|
|
45
|
-
noBackdrop: boolean;
|
|
46
|
-
noHeader: boolean;
|
|
47
|
-
color: string;
|
|
48
|
-
backdropColor: string;
|
|
49
|
-
placement: string;
|
|
50
|
-
width: number;
|
|
51
|
-
}>>> & {
|
|
52
|
-
onOpen?: ((visible: boolean) => any) | undefined;
|
|
53
|
-
onClose?: ((visible: boolean) => any) | undefined;
|
|
54
|
-
}, {
|
|
55
|
-
visible: boolean;
|
|
56
|
-
className: string;
|
|
57
|
-
color: ColorPalette;
|
|
58
|
-
titleColor: ColorPalette;
|
|
59
|
-
noBackdrop: boolean;
|
|
60
|
-
noHeader: boolean;
|
|
61
|
-
backdropColor: ColorPalette;
|
|
62
|
-
placement: DirectionX;
|
|
63
|
-
width: string | number;
|
|
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;
|
|
81
|
-
}): any;
|
|
82
|
-
body(props: {
|
|
83
|
-
close: () => void;
|
|
84
|
-
status: boolean;
|
|
85
|
-
}): any;
|
|
86
|
-
footer(props: {
|
|
87
|
-
close: () => void;
|
|
88
|
-
status: boolean;
|
|
89
|
-
}): any;
|
|
90
|
-
}>;
|
|
91
|
-
export default _default;
|
|
92
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
93
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
94
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
95
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
96
|
-
} : {
|
|
97
|
-
type: import('vue').PropType<T[K]>;
|
|
98
|
-
required: true;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
type __VLS_WithDefaults<P, D> = {
|
|
102
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
103
|
-
default: D[K];
|
|
104
|
-
}> : P[K];
|
|
105
|
-
};
|
|
106
|
-
type __VLS_Prettify<T> = {
|
|
107
|
-
[K in keyof T]: T[K];
|
|
108
|
-
} & {};
|
|
109
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
110
|
-
new (): {
|
|
111
|
-
$slots: S;
|
|
112
|
-
};
|
|
113
|
-
};
|