@bobbykim/manguito-theme 0.13.0 → 0.15.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 +26 -0
- package/README.md +28 -4
- package/index.d.ts +1 -2
- package/index.js +1 -2
- package/index.ts +1 -10
- package/lib/collapse/Collapse.vue +1 -1
- package/lib/directives/index.js +5 -34
- package/lib/directives/index.ts +5 -34
- package/lib/dropdown/DropdownContainer.vue +3 -5
- package/lib/dropdown/DropdownContent.vue +5 -9
- package/package.json +12 -2
- package/lib/nav/HamburgerMenu.vue +0 -121
- package/lib/nav/HamburgerMenu.vue.d.ts +0 -43
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.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
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **/components/**/README.md,/deprecated:** update readme files, move deprecated packages to deprecated folder ([c0f8f7d](https://github.com/bobbykim89/manguito-component-library/commit/c0f8f7df158b8fcd99b4e3d191e02e3c8a9c144d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.14.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.13.0...@bobbykim/manguito-theme@0.14.0) (2024-02-27)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **components/*:** run package:build ([fcc2d09](https://github.com/bobbykim89/manguito-component-library/commit/fcc2d0953d77ecaa317be27eb212c927dec33b17))
|
|
23
|
+
* **manguito-theme,mcl-cards,mcl-header,mcl-footer,mcl-carousel:** add vueuse as one of dependencies, update code to make them ssr friendly ([119a327](https://github.com/bobbykim89/manguito-component-library/commit/119a327adf1ca9866e6ac063bce5acd4790db612))
|
|
24
|
+
* **mcl-collapse:** add mcl-collapse component library and add story for mcl-collapse-a ([397b63e](https://github.com/bobbykim89/manguito-component-library/commit/397b63e00b83801bdf1cd2c6710d0ba876c6bf87))
|
|
25
|
+
* **stories/*:** ran package:build to build type declaration, move deprecated story files into deprecated folder ([ffc487d](https://github.com/bobbykim89/manguito-component-library/commit/ffc487dbcc093be7a3ccfeae98c5e10e8372a0e3))
|
|
26
|
+
* **stories:** add basic addons, add stories for theme and base component ([841d8db](https://github.com/bobbykim89/manguito-component-library/commit/841d8db015d3d861f567ae3d19cf0033b28bac7c))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
# [0.13.0](https://github.com/bobbykim89/manguito-component-library/compare/@bobbykim/manguito-theme@0.12.0...@bobbykim/manguito-theme@0.13.0) (2023-12-06)
|
|
7
33
|
|
|
8
34
|
|
package/README.md
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
# @bobbykim/manguito-theme
|
|
2
2
|
|
|
3
|
-
manguito-theme includes basic config for MCL, including theme
|
|
3
|
+
manguito-theme includes basic config for MCL, including type definitions for theme and base components, and generateClass function that returns tailwindCSS style classes.
|
|
4
4
|
|
|
5
5
|
## Demo
|
|
6
6
|
|
|
7
|
-
[MCL
|
|
7
|
+
[MCL Storybook Page](https://manguito-component-library.vercel.app/)
|
|
8
|
+
|
|
9
|
+
- [Installation](https://manguito-component-library.vercel.app/?path=/docs/introduction-installation--docs)
|
|
10
|
+
- Base Components
|
|
11
|
+
- [Collapse](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-collapse-component--collapse)
|
|
12
|
+
- [Dropdown](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-dropdown-component--dropdown)
|
|
13
|
+
- [Modal](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-modal-component--modal)
|
|
14
|
+
- [Sidebar](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-sidebar-component--sidebar)
|
|
15
|
+
- [Tooltip](https://manguito-component-library.vercel.app/?path=/docs/base-base-component-tooltip-component--tooltip)
|
|
16
|
+
- Utility Class
|
|
17
|
+
- [Button Class](https://manguito-component-library.vercel.app/?path=/docs/base-utility-class-button-class--button)
|
|
18
|
+
- [Link Class](https://manguito-component-library.vercel.app/?path=/docs/base-utility-class-link-class--link)
|
|
19
|
+
- [List Class](https://manguito-component-library.vercel.app/?path=/docs/base-utility-class-list-class--list)
|
|
8
20
|
|
|
9
21
|
## Install
|
|
10
22
|
|
|
11
23
|
```sh
|
|
12
|
-
npm i -D tailwindcss postcss autoprefixer sass
|
|
24
|
+
npm i -D tailwindcss postcss autoprefixer sass @vueuse/core
|
|
13
25
|
npm i @bobbykim/manguito-theme
|
|
14
26
|
npx tailwindcss init -p
|
|
15
27
|
```
|
|
@@ -83,13 +95,25 @@ in Vue component file.
|
|
|
83
95
|
<script setup lang="ts">
|
|
84
96
|
...
|
|
85
97
|
import generateClass from '@bobbykim/manguito-theme'
|
|
86
|
-
import type { <Type you need> } from '@bobbykim/manguito-theme
|
|
98
|
+
import type { <Type you need> } from '@bobbykim/manguito-theme'
|
|
87
99
|
...
|
|
88
100
|
</script>
|
|
89
101
|
|
|
90
102
|
<template>...</template>
|
|
91
103
|
```
|
|
92
104
|
|
|
105
|
+
## Dependencies
|
|
106
|
+
|
|
107
|
+
- @vueuse/core
|
|
108
|
+
- vue
|
|
109
|
+
|
|
110
|
+
## Dev Dependencies
|
|
111
|
+
|
|
112
|
+
- autoprefixer
|
|
113
|
+
- postcss
|
|
114
|
+
- sass
|
|
115
|
+
- tailwindcss
|
|
116
|
+
|
|
93
117
|
## Maintainers
|
|
94
118
|
|
|
95
119
|
- **Bobby Kim** - _Initial work_
|
package/index.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ import DropdownContent from './lib/dropdown/DropdownContent.vue';
|
|
|
4
4
|
import Collapse from './lib/collapse/Collapse.vue';
|
|
5
5
|
import Sidebar from './lib/sidebar/Sidebar.vue';
|
|
6
6
|
import Modal from './lib/modal/Modal.vue';
|
|
7
|
-
import HamburgerMenu from './lib/nav/HamburgerMenu.vue';
|
|
8
7
|
declare const generateClass: (type: ClassType, value: InputType) => string;
|
|
9
8
|
export default generateClass;
|
|
10
|
-
export { DropdownContainer, DropdownContent, Collapse,
|
|
9
|
+
export { DropdownContainer, DropdownContent, Collapse, Sidebar, Modal };
|
|
11
10
|
export * from './lib/directives/index.js';
|
|
12
11
|
export * from './theme/theme.types.js';
|
|
13
12
|
export * from './lib/collapse/index.types.js';
|
package/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import DropdownContent from './lib/dropdown/DropdownContent.vue';
|
|
|
5
5
|
import Collapse from './lib/collapse/Collapse.vue';
|
|
6
6
|
import Sidebar from './lib/sidebar/Sidebar.vue';
|
|
7
7
|
import Modal from './lib/modal/Modal.vue';
|
|
8
|
-
import HamburgerMenu from './lib/nav/HamburgerMenu.vue';
|
|
9
8
|
const generateClass = (type, value) => {
|
|
10
9
|
const mclGenerate = new GenerateMCLClass(type, value);
|
|
11
10
|
if (colorType.includes(type)) {
|
|
@@ -24,7 +23,7 @@ const generateClass = (type, value) => {
|
|
|
24
23
|
return mclGenerate.generateSpacingClass();
|
|
25
24
|
};
|
|
26
25
|
export default generateClass;
|
|
27
|
-
export { DropdownContainer, DropdownContent, Collapse,
|
|
26
|
+
export { DropdownContainer, DropdownContent, Collapse, Sidebar, Modal };
|
|
28
27
|
export * from './lib/directives/index.js';
|
|
29
28
|
export * from './theme/theme.types.js';
|
|
30
29
|
export * from './lib/collapse/index.types.js';
|
package/index.ts
CHANGED
|
@@ -12,8 +12,6 @@ import Collapse from './lib/collapse/Collapse.vue'
|
|
|
12
12
|
import Sidebar from './lib/sidebar/Sidebar.vue'
|
|
13
13
|
import Modal from './lib/modal/Modal.vue'
|
|
14
14
|
|
|
15
|
-
import HamburgerMenu from './lib/nav/HamburgerMenu.vue'
|
|
16
|
-
|
|
17
15
|
const generateClass = (type: ClassType, value: InputType): string => {
|
|
18
16
|
const mclGenerate = new GenerateMCLClass(type, value)
|
|
19
17
|
if ((<string[]>(<unknown>colorType)).includes(type)) {
|
|
@@ -34,14 +32,7 @@ const generateClass = (type: ClassType, value: InputType): string => {
|
|
|
34
32
|
|
|
35
33
|
export default generateClass
|
|
36
34
|
|
|
37
|
-
export {
|
|
38
|
-
DropdownContainer,
|
|
39
|
-
DropdownContent,
|
|
40
|
-
Collapse,
|
|
41
|
-
HamburgerMenu,
|
|
42
|
-
Sidebar,
|
|
43
|
-
Modal,
|
|
44
|
-
}
|
|
35
|
+
export { DropdownContainer, DropdownContent, Collapse, Sidebar, Modal }
|
|
45
36
|
export * from './lib/directives/index.js'
|
|
46
37
|
export * from './theme/theme.types.js'
|
|
47
38
|
export * from './lib/collapse/index.types.js'
|
package/lib/directives/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export const vClickOutside = {
|
|
|
16
16
|
export const vToggle = {
|
|
17
17
|
mounted(el, binding) {
|
|
18
18
|
el.__ClickToggleHandler = (e) => {
|
|
19
|
+
e.preventDefault();
|
|
19
20
|
const eTarget = e.target;
|
|
20
21
|
let target;
|
|
21
22
|
if (eTarget.tagName === 'A') {
|
|
@@ -45,38 +46,8 @@ export const vToggle = {
|
|
|
45
46
|
};
|
|
46
47
|
export const vCollapse = {
|
|
47
48
|
mounted(el, binding) {
|
|
48
|
-
// el.__HandleToggler = (event: Event): void => {
|
|
49
|
-
// const eTarget = event.target as HTMLElement
|
|
50
|
-
// let target: HTMLElement
|
|
51
|
-
// if (eTarget.tagName === 'A') {
|
|
52
|
-
// const targetId = eTarget.getAttribute('href')
|
|
53
|
-
// const formattedTargetId =
|
|
54
|
-
// targetId?.charAt(0) === '#' ? targetId.substring(1) : targetId
|
|
55
|
-
// target = document.getElementById(formattedTargetId as string)!
|
|
56
|
-
// } else {
|
|
57
|
-
// target = document.getElementById(binding.arg as string) as HTMLElement
|
|
58
|
-
// }
|
|
59
|
-
// if (!target.hasAttribute('accordion')) {
|
|
60
|
-
// // run when it is not accordion component case
|
|
61
|
-
// target.click()
|
|
62
|
-
// return
|
|
63
|
-
// }
|
|
64
|
-
// const accordionName = target.getAttribute('accordion')
|
|
65
|
-
// const accordionList: NodeListOf<HTMLElement> = document.querySelectorAll(
|
|
66
|
-
// `button[accordion="${accordionName}"]`
|
|
67
|
-
// )
|
|
68
|
-
// // loop through each accordion items and handle reaction for each case
|
|
69
|
-
// for (let i = 0; i < accordionList.length; i++) {
|
|
70
|
-
// const isVisible = accordionList[i].getAttribute('visible')
|
|
71
|
-
// if (accordionList[i].id !== target.id && isVisible === 'true') {
|
|
72
|
-
// accordionList[i].click()
|
|
73
|
-
// }
|
|
74
|
-
// if (accordionList[i].id === target.id) {
|
|
75
|
-
// accordionList[i].click()
|
|
76
|
-
// }
|
|
77
|
-
// }
|
|
78
|
-
// }
|
|
79
49
|
el.__HandleToggler = (event) => {
|
|
50
|
+
event.preventDefault();
|
|
80
51
|
const eTarget = event.target;
|
|
81
52
|
let target;
|
|
82
53
|
if (eTarget.tagName === 'A') {
|
|
@@ -169,10 +140,10 @@ export const vTooltip = {
|
|
|
169
140
|
}
|
|
170
141
|
// handle tooltip width
|
|
171
142
|
let tooltipWidth;
|
|
172
|
-
if (el.hasAttribute('width')) {
|
|
173
|
-
tooltipWidth = el.getAttribute('width');
|
|
143
|
+
if (el.hasAttribute('tooltip-width')) {
|
|
144
|
+
tooltipWidth = el.getAttribute('tooltip-width');
|
|
174
145
|
}
|
|
175
|
-
if (!el.hasAttribute('width') &&
|
|
146
|
+
if (!el.hasAttribute('tooltip-width') &&
|
|
176
147
|
typeof binding.value !== 'undefined' &&
|
|
177
148
|
typeof binding.value !== 'string' &&
|
|
178
149
|
typeof binding.value.width === ('number' || 'string')) {
|
package/lib/directives/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export const vClickOutside: Directive = {
|
|
|
21
21
|
export const vToggle: Directive = {
|
|
22
22
|
mounted(el, binding) {
|
|
23
23
|
el.__ClickToggleHandler = (e: Event): void => {
|
|
24
|
+
e.preventDefault()
|
|
24
25
|
const eTarget = e.target as HTMLElement
|
|
25
26
|
let target: HTMLElement
|
|
26
27
|
if (eTarget.tagName === 'A') {
|
|
@@ -51,38 +52,8 @@ export const vToggle: Directive = {
|
|
|
51
52
|
|
|
52
53
|
export const vCollapse: Directive = {
|
|
53
54
|
mounted(el, binding) {
|
|
54
|
-
// el.__HandleToggler = (event: Event): void => {
|
|
55
|
-
// const eTarget = event.target as HTMLElement
|
|
56
|
-
// let target: HTMLElement
|
|
57
|
-
// if (eTarget.tagName === 'A') {
|
|
58
|
-
// const targetId = eTarget.getAttribute('href')
|
|
59
|
-
// const formattedTargetId =
|
|
60
|
-
// targetId?.charAt(0) === '#' ? targetId.substring(1) : targetId
|
|
61
|
-
// target = document.getElementById(formattedTargetId as string)!
|
|
62
|
-
// } else {
|
|
63
|
-
// target = document.getElementById(binding.arg as string) as HTMLElement
|
|
64
|
-
// }
|
|
65
|
-
// if (!target.hasAttribute('accordion')) {
|
|
66
|
-
// // run when it is not accordion component case
|
|
67
|
-
// target.click()
|
|
68
|
-
// return
|
|
69
|
-
// }
|
|
70
|
-
// const accordionName = target.getAttribute('accordion')
|
|
71
|
-
// const accordionList: NodeListOf<HTMLElement> = document.querySelectorAll(
|
|
72
|
-
// `button[accordion="${accordionName}"]`
|
|
73
|
-
// )
|
|
74
|
-
// // loop through each accordion items and handle reaction for each case
|
|
75
|
-
// for (let i = 0; i < accordionList.length; i++) {
|
|
76
|
-
// const isVisible = accordionList[i].getAttribute('visible')
|
|
77
|
-
// if (accordionList[i].id !== target.id && isVisible === 'true') {
|
|
78
|
-
// accordionList[i].click()
|
|
79
|
-
// }
|
|
80
|
-
// if (accordionList[i].id === target.id) {
|
|
81
|
-
// accordionList[i].click()
|
|
82
|
-
// }
|
|
83
|
-
// }
|
|
84
|
-
// }
|
|
85
55
|
el.__HandleToggler = (event: Event): void => {
|
|
56
|
+
event.preventDefault()
|
|
86
57
|
const eTarget = event.target as HTMLElement
|
|
87
58
|
let target: HTMLElement
|
|
88
59
|
if (eTarget.tagName === 'A') {
|
|
@@ -190,11 +161,11 @@ export const vTooltip: Directive<TooltipElementType, TooltipValueType> = {
|
|
|
190
161
|
}
|
|
191
162
|
// handle tooltip width
|
|
192
163
|
let tooltipWidth: string | number | null | undefined
|
|
193
|
-
if (el.hasAttribute('width')) {
|
|
194
|
-
tooltipWidth = el.getAttribute('width')
|
|
164
|
+
if (el.hasAttribute('tooltip-width')) {
|
|
165
|
+
tooltipWidth = el.getAttribute('tooltip-width')
|
|
195
166
|
}
|
|
196
167
|
if (
|
|
197
|
-
!el.hasAttribute('width') &&
|
|
168
|
+
!el.hasAttribute('tooltip-width') &&
|
|
198
169
|
typeof binding.value !== 'undefined' &&
|
|
199
170
|
typeof binding.value !== 'string' &&
|
|
200
171
|
typeof binding.value.width === ('number' || 'string')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { InjectType } from './index.types.js'
|
|
2
|
+
import { onMounted, provide, reactive, ref } from 'vue'
|
|
4
3
|
import { vClickOutside } from '../directives/index.js'
|
|
4
|
+
import type { InjectType } from './index.types.js'
|
|
5
5
|
|
|
6
6
|
const emit = defineEmits(['click-outside', 'toggle'])
|
|
7
7
|
const dropdownTarget = ref()
|
|
@@ -22,9 +22,7 @@ const onEscape = (): void => {
|
|
|
22
22
|
dropdownState.active = false
|
|
23
23
|
}
|
|
24
24
|
onMounted(() => {
|
|
25
|
-
|
|
26
|
-
dropdownState.buttonHeight = dropdownTarget.value.scrollHeight
|
|
27
|
-
}
|
|
25
|
+
dropdownState.buttonHeight = dropdownTarget.value.scrollHeight
|
|
28
26
|
})
|
|
29
27
|
</script>
|
|
30
28
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useWindowSize } from '@vueuse/core'
|
|
3
|
+
import { Transition, computed, inject, ref } from 'vue'
|
|
3
4
|
import type { InjectType } from './index.types.js'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
withDefaults(
|
|
6
7
|
defineProps<{
|
|
7
8
|
className?: string
|
|
8
9
|
}>(),
|
|
@@ -10,6 +11,7 @@ const props = withDefaults(
|
|
|
10
11
|
className: '',
|
|
11
12
|
}
|
|
12
13
|
)
|
|
14
|
+
const { height } = useWindowSize()
|
|
13
15
|
const contentRef = ref<HTMLAreaElement>()
|
|
14
16
|
const dropdownState = inject<InjectType>('dropdownState', {
|
|
15
17
|
active: false,
|
|
@@ -25,16 +27,10 @@ const buttonHeight = computed(() => {
|
|
|
25
27
|
return { '--button-height': `${dropdownState.buttonHeight}px` }
|
|
26
28
|
})
|
|
27
29
|
const dropdownDirection = computed<string | undefined>(() => {
|
|
28
|
-
if (typeof window === undefined) {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
30
|
if (!dropdownState.active || !contentRef.value) {
|
|
32
31
|
return
|
|
33
32
|
}
|
|
34
|
-
if (
|
|
35
|
-
window.innerHeight - contentRef.value.getBoundingClientRect().bottom <
|
|
36
|
-
0
|
|
37
|
-
) {
|
|
33
|
+
if (height.value - contentRef.value.getBoundingClientRect().bottom < 0) {
|
|
38
34
|
return 'dropup-bottom'
|
|
39
35
|
}
|
|
40
36
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobbykim/manguito-theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "main theme file for manguito components library. Other MCL components will need to import this file to run.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "vue-tsc --project tsconfig.vue.json && tsc"
|
|
12
12
|
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@vueuse/core": "^10.8.0",
|
|
15
|
+
"vue": "^3.3.10"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"autoprefixer": "^10.4.16",
|
|
19
|
+
"postcss": "^8.4.32",
|
|
20
|
+
"sass": "^1.69.5",
|
|
21
|
+
"tailwindcss": "^3.3.6"
|
|
22
|
+
},
|
|
13
23
|
"author": {
|
|
14
24
|
"name": "Bobby Kim",
|
|
15
25
|
"url": "https://www.devbobbykim.com/"
|
|
@@ -20,5 +30,5 @@
|
|
|
20
30
|
"url": "https://github.com/bobbykim89/manguito-component-library.git"
|
|
21
31
|
},
|
|
22
32
|
"license": "MIT",
|
|
23
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "69d6ee1c4f91a74b226cb46182845201141805fa"
|
|
24
34
|
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import type { ColorPalette } from '../../index.js'
|
|
4
|
-
import generateClass from '../../index.js'
|
|
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>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette } from '../../index.js';
|
|
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").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, 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
|
-
} & {};
|