@bobbykim/mcl-container 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # 0.2.0 (2024-02-27)
7
+
8
+
9
+ ### Features
10
+
11
+ * **mcl-container:** add mcl-container-b with story page ([95b522d](https://github.com/bobbykim89/manguito-component-library/commit/95b522d61a9a86422c5fbb8105a27a3957d453ac))
12
+ * **mcl-header:** init mcl-header package and add mcl-header-a component ([29fe8d7](https://github.com/bobbykim89/manguito-component-library/commit/29fe8d7b62bed93d307f340e9a378f1dfe58a03a))
13
+ * **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))
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Bobby Kim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @bobbykim/mcl-container
2
+
3
+ Add description
4
+
5
+ ## Demo
6
+
7
+ [MCL Histoire Page](https://manguito-component-library.vercel.app/story/{%story-link%})
8
+
9
+ ## Install
10
+
11
+ ## Usage
12
+
13
+ `import MclContainer from "@bobbykim/mcl-container"`;
14
+
15
+ ## Maintainer
16
+
17
+ - **Bobby Kim** - _Initial work_
18
+
19
+ ## License
20
+
21
+ This project is licensed under the MIT License - see the [LICENSE.md](./LICENSE.md) file for details
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import MclContainerA from './lib/mcl-container-a/MclContainerA.vue';
2
+ import MclContainerB from './lib/mcl-container-b/MclContainerB.vue';
3
+ export { MclContainerA, MclContainerB };
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import MclContainerA from './lib/mcl-container-a/MclContainerA.vue';
2
+ import MclContainerB from './lib/mcl-container-b/MclContainerB.vue';
3
+ export { MclContainerA, MclContainerB };
package/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ import MclContainerA from './lib/mcl-container-a/MclContainerA.vue'
2
+ import MclContainerB from './lib/mcl-container-b/MclContainerB.vue'
3
+
4
+ export { MclContainerA, MclContainerB }
@@ -0,0 +1,129 @@
1
+ <script setup lang="ts">
2
+ import type {
3
+ ColorPalette,
4
+ DirectionX,
5
+ ColumnWidth,
6
+ DirectionY,
7
+ } from '@bobbykim/manguito-theme'
8
+ import generateClass from '@bobbykim/manguito-theme'
9
+
10
+ const props = withDefaults(
11
+ defineProps<{
12
+ sectionBg?: ColorPalette
13
+ containerBg?: ColorPalette
14
+ topDirection?: DirectionX
15
+ bottomDirection?: DirectionX
16
+ twoColumns?: boolean
17
+ leftColumnWidth?: ColumnWidth
18
+ }>(),
19
+ {
20
+ sectionBg: 'light-1',
21
+ containerBg: 'primary',
22
+ topDirection: 'left',
23
+ bottomDirection: 'left',
24
+ twoColumns: true,
25
+ leftColumnWidth: 50,
26
+ }
27
+ )
28
+ const generatePoints = (
29
+ location: DirectionY,
30
+ direction: DirectionX
31
+ ): string => {
32
+ /**
33
+ * @location - 'top'||'bottom'
34
+ * @direction - topDirection || bottomDirection
35
+ */
36
+ if (location === 'top') {
37
+ return direction === 'left' ? '0,0 100,100 0,100' : '100,0 100,100 0,100'
38
+ }
39
+ return direction === 'left' ? '0,0 100,0 0,100' : '0,0 100,0 100,100'
40
+ }
41
+ const getLeftColumnWidth = (
42
+ dRightCol: boolean,
43
+ lColWidth: ColumnWidth
44
+ ): string => {
45
+ /**
46
+ * @drightCol - twoColumns
47
+ * @lColWidth - leftColumnWidth
48
+ */
49
+ if (!dRightCol) {
50
+ return 'md:col-span-4'
51
+ }
52
+ switch (lColWidth) {
53
+ case 25:
54
+ return 'md:col-span-1'
55
+ case 50:
56
+ return 'md:col-span-2'
57
+ case 75:
58
+ return 'md:col-span-3'
59
+ case 100:
60
+ return 'md:col-span-4'
61
+ default:
62
+ return ''
63
+ }
64
+ }
65
+ const getRightColumnWIdth = (
66
+ dRightCol: boolean,
67
+ lColWidth: ColumnWidth
68
+ ): string => {
69
+ if (!dRightCol) {
70
+ return ''
71
+ }
72
+ switch (lColWidth) {
73
+ case 25:
74
+ return 'md:col-span-3'
75
+ case 50:
76
+ return 'md:col-span-2'
77
+ case 75:
78
+ return 'md:col-span-1'
79
+ case 100:
80
+ default:
81
+ return ''
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <template>
87
+ <section class="py-lg lg:py-xl" :class="generateClass('BGCOLOR', sectionBg)">
88
+ <div class="relative min-h-[36px] md:min-h-[48px] lg:min-h-[60px]">
89
+ <svg
90
+ class="block absolute left-0 inset-x-0 h-full w-full"
91
+ :class="generateClass('SVGFILL', containerBg)"
92
+ viewBox="0 0 100 100"
93
+ preserveAspectRatio="none"
94
+ aria-hidden="true"
95
+ >
96
+ <polygon :points="generatePoints('top', topDirection)" />
97
+ </svg>
98
+ </div>
99
+ <div
100
+ class="py-md md:py-lg lg:py-xl px-sm md:px-md lg:px-lg"
101
+ :class="generateClass('BGCOLOR', containerBg)"
102
+ >
103
+ <div class="container grid md:grid-cols-4 gap-4">
104
+ <div :class="getLeftColumnWidth(twoColumns, leftColumnWidth)">
105
+ <slot name="left-column"></slot>
106
+ </div>
107
+ <div
108
+ v-if="twoColumns && leftColumnWidth !== 100"
109
+ :class="getRightColumnWIdth(twoColumns, leftColumnWidth)"
110
+ >
111
+ <slot name="right-column"></slot>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ <div class="relative min-h-[36px] md:min-h-[48px] lg:min-h-[60px]">
116
+ <svg
117
+ class="block absolute left-0 inset-x-0 h-full w-full"
118
+ :class="generateClass('SVGFILL', containerBg)"
119
+ viewBox="0 0 100 100"
120
+ preserveAspectRatio="none"
121
+ aria-hidden="true"
122
+ >
123
+ <polygon :points="generatePoints('bottom', bottomDirection)" />
124
+ </svg>
125
+ </div>
126
+ </section>
127
+ </template>
128
+
129
+ <style lang="scss" scoped></style>
@@ -0,0 +1,63 @@
1
+ import type { ColorPalette, DirectionX, ColumnWidth } from '@bobbykim/manguito-theme';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ sectionBg?: ColorPalette | undefined;
4
+ containerBg?: ColorPalette | undefined;
5
+ topDirection?: DirectionX | undefined;
6
+ bottomDirection?: DirectionX | undefined;
7
+ twoColumns?: boolean | undefined;
8
+ leftColumnWidth?: ColumnWidth | undefined;
9
+ }>, {
10
+ sectionBg: string;
11
+ containerBg: string;
12
+ topDirection: string;
13
+ bottomDirection: string;
14
+ twoColumns: boolean;
15
+ leftColumnWidth: number;
16
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
17
+ sectionBg?: ColorPalette | undefined;
18
+ containerBg?: ColorPalette | undefined;
19
+ topDirection?: DirectionX | undefined;
20
+ bottomDirection?: DirectionX | undefined;
21
+ twoColumns?: boolean | undefined;
22
+ leftColumnWidth?: ColumnWidth | undefined;
23
+ }>, {
24
+ sectionBg: string;
25
+ containerBg: string;
26
+ topDirection: string;
27
+ bottomDirection: string;
28
+ twoColumns: boolean;
29
+ leftColumnWidth: number;
30
+ }>>>, {
31
+ sectionBg: ColorPalette;
32
+ containerBg: ColorPalette;
33
+ topDirection: DirectionX;
34
+ bottomDirection: DirectionX;
35
+ twoColumns: boolean;
36
+ leftColumnWidth: ColumnWidth;
37
+ }, {}>, {
38
+ "left-column"?(_: {}): any;
39
+ "right-column"?(_: {}): any;
40
+ }>;
41
+ export default _default;
42
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
43
+ type __VLS_TypePropsToRuntimeProps<T> = {
44
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
45
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
46
+ } : {
47
+ type: import('vue').PropType<T[K]>;
48
+ required: true;
49
+ };
50
+ };
51
+ type __VLS_WithDefaults<P, D> = {
52
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
53
+ default: D[K];
54
+ }> : P[K];
55
+ };
56
+ type __VLS_Prettify<T> = {
57
+ [K in keyof T]: T[K];
58
+ } & {};
59
+ type __VLS_WithTemplateSlots<T, S> = T & {
60
+ new (): {
61
+ $slots: S;
62
+ };
63
+ };
@@ -0,0 +1,121 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import generateClass from '@bobbykim/manguito-theme'
4
+ import type {
5
+ ColorPalette,
6
+ HeadingLevel,
7
+ HeadingSize,
8
+ } from '@bobbykim/manguito-theme'
9
+
10
+ const props = withDefaults(
11
+ defineProps<{
12
+ sectionBgColor?: ColorPalette
13
+ containerBgColor?: ColorPalette
14
+ imageSource: string
15
+ imgHeightMobile?: number
16
+ imgHeightDesktop?: number
17
+ title: string
18
+ titleLevel?: HeadingLevel
19
+ titleSize?: HeadingSize
20
+ titleColor?: ColorPalette
21
+ }>(),
22
+ {
23
+ sectionBgColor: 'transparent',
24
+ containerBgColor: 'light-2',
25
+ imgHeightMobile: 256,
26
+ imgHeightDesktop: 384,
27
+ titleLevel: 'h2',
28
+ titleSize: 'md',
29
+ titleColor: 'dark-3',
30
+ }
31
+ )
32
+
33
+ const getTitleClass = (
34
+ level: HeadingLevel,
35
+ size: HeadingSize,
36
+ color: ColorPalette
37
+ ): string => {
38
+ /**
39
+ * @level - titleLevel
40
+ * @size - titleSize
41
+ * @Color - titleColor
42
+ */
43
+ let heading: string
44
+ // let textColor: string = textColorClass[Color]
45
+ if (level === 'h1') {
46
+ // heading = h1Class[size]
47
+ heading = generateClass('H1', size)
48
+ } else if (level === 'h2') {
49
+ // heading = h2Class[size]
50
+ heading = generateClass('H2', size)
51
+ } else {
52
+ // heading = h3Class[size]
53
+ heading = generateClass('H3', size)
54
+ }
55
+ return `${heading} ${generateClass('TEXTCOLOR', color)}`
56
+ }
57
+
58
+ const parallaxImage = computed(() => {
59
+ return {
60
+ '--bg-image': `url('${props.imageSource}')`,
61
+ '--container-height-mobile': `${props.imgHeightMobile}px`,
62
+ '--container-height-desktop': `${
63
+ props.imgHeightDesktop > props.imgHeightMobile
64
+ ? props.imgHeightDesktop
65
+ : props.imgHeightMobile
66
+ }px`,
67
+ }
68
+ })
69
+ </script>
70
+
71
+ <template>
72
+ <section
73
+ class="relative pt-xl md:pt-3xl"
74
+ :class="generateClass('BGCOLOR', sectionBgColor)"
75
+ >
76
+ <div class="relative parallax-container" :style="parallaxImage">
77
+ <div
78
+ class="absolute parallax-image bg-fixed bg-cover w-full top-0 left-0 bg-no-repeat"
79
+ ></div>
80
+ <div
81
+ class="container relative z-[10] px-xs top-[-48px] md:top-[-96px] max-w-[1140px]"
82
+ >
83
+ <div
84
+ :class="generateClass('BGCOLOR', containerBgColor)"
85
+ class="py-md md:py-lg px-xs md:px-md lg:p-xl"
86
+ >
87
+ <div class="w-full">
88
+ <compoenent :is="titleLevel">
89
+ <span
90
+ :class="getTitleClass(titleLevel, titleSize, titleColor)"
91
+ v-html="title"
92
+ ></span>
93
+ </compoenent>
94
+ <div class="mt-sm">
95
+ <slot name="content" />
96
+ </div>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </section>
102
+ </template>
103
+
104
+ <style lang="scss" scoped>
105
+ .parallax-container {
106
+ height: var(--container-height-mobile, 256px);
107
+ }
108
+ .parallax-image {
109
+ height: var(--container-height-mobile, 256px);
110
+ background-image: var(--bg-image);
111
+ background-position: center top;
112
+ }
113
+ @media screen and (min-width: 768px) {
114
+ .parallax-container {
115
+ height: var(--container-height-desktop, 384px);
116
+ }
117
+ .parallax-image {
118
+ height: var(--container-height-desktop, 384px);
119
+ }
120
+ }
121
+ </style>
@@ -0,0 +1,71 @@
1
+ import type { ColorPalette, HeadingLevel, HeadingSize } from '@bobbykim/manguito-theme';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ sectionBgColor?: ColorPalette | undefined;
4
+ containerBgColor?: ColorPalette | undefined;
5
+ imageSource: string;
6
+ imgHeightMobile?: number | undefined;
7
+ imgHeightDesktop?: number | undefined;
8
+ title: string;
9
+ titleLevel?: HeadingLevel | undefined;
10
+ titleSize?: HeadingSize | undefined;
11
+ titleColor?: ColorPalette | undefined;
12
+ }>, {
13
+ sectionBgColor: string;
14
+ containerBgColor: string;
15
+ imgHeightMobile: number;
16
+ imgHeightDesktop: number;
17
+ titleLevel: string;
18
+ titleSize: string;
19
+ titleColor: string;
20
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
21
+ sectionBgColor?: ColorPalette | undefined;
22
+ containerBgColor?: ColorPalette | undefined;
23
+ imageSource: string;
24
+ imgHeightMobile?: number | undefined;
25
+ imgHeightDesktop?: number | undefined;
26
+ title: string;
27
+ titleLevel?: HeadingLevel | undefined;
28
+ titleSize?: HeadingSize | undefined;
29
+ titleColor?: ColorPalette | undefined;
30
+ }>, {
31
+ sectionBgColor: string;
32
+ containerBgColor: string;
33
+ imgHeightMobile: number;
34
+ imgHeightDesktop: number;
35
+ titleLevel: string;
36
+ titleSize: string;
37
+ titleColor: string;
38
+ }>>>, {
39
+ titleColor: ColorPalette;
40
+ sectionBgColor: ColorPalette;
41
+ containerBgColor: ColorPalette;
42
+ imgHeightMobile: number;
43
+ imgHeightDesktop: number;
44
+ titleLevel: HeadingLevel;
45
+ titleSize: HeadingSize;
46
+ }, {}>, {
47
+ content?(_: {}): any;
48
+ }>;
49
+ export default _default;
50
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
51
+ type __VLS_TypePropsToRuntimeProps<T> = {
52
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
53
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
54
+ } : {
55
+ type: import('vue').PropType<T[K]>;
56
+ required: true;
57
+ };
58
+ };
59
+ type __VLS_WithDefaults<P, D> = {
60
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
61
+ default: D[K];
62
+ }> : P[K];
63
+ };
64
+ type __VLS_Prettify<T> = {
65
+ [K in keyof T]: T[K];
66
+ } & {};
67
+ type __VLS_WithTemplateSlots<T, S> = T & {
68
+ new (): {
69
+ $slots: S;
70
+ };
71
+ };
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"@bobbykim/mcl-container","version":"0.2.0","description":"","type":"module","main":"index.ts","scripts":{"build":"vue-tsc --project tsconfig.vue.json && tsc"},"author":{"name":"Bobby Kim","url":"https://www.devbobbykim.com/"},"homepage":"https://manguito-component-library.vercel.app/","repository":{"type":"git","url":"https://github.com/bobbykim89/manguito-component-library.git"},"publishConfig":{"access":"public"},"license":"MIT","dependencies":{"@bobbykim/manguito-theme":"^0.14.0"},"gitHead":"4d94a8d34988d926c8d465891fd7aa535cffdf33"}
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["./**/*.ts"],
4
+ "exclude": ["node_modules", "./**/*.vue.d.ts", "./**/*.vue"],
5
+ "compilerOptions": {
6
+ "skipLibCheck": true,
7
+ "declaration": true
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["./**/*.vue"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "declaration": true,
7
+ "emitDeclarationOnly": true
8
+ }
9
+ }