@bobbykim/mcl-cards 0.5.0 → 0.7.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/dist/index.d.ts +503 -0
- package/dist/mcl-cards.js +434 -0
- package/dist/mcl-cards.umd.cjs +2 -0
- package/package.json +28 -6
- package/CHANGELOG.md +0 -56
- package/index.d.ts +0 -6
- package/index.js +0 -6
- package/index.ts +0 -7
- package/lib/common/index.types.d.ts +0 -6
- package/lib/common/index.types.js +0 -1
- package/lib/common/index.types.ts +0 -7
- package/lib/mcl-card-a/MclCardA.vue +0 -251
- package/lib/mcl-card-a/MclCardA.vue.d.ts +0 -152
- package/lib/mcl-card-b/MclCardB.vue +0 -134
- package/lib/mcl-card-b/MclCardB.vue.d.ts +0 -95
- package/lib/mcl-card-c/MclCardC.vue +0 -147
- package/lib/mcl-card-c/MclCardC.vue.d.ts +0 -84
- package/lib/mcl-card-d/MclCardD.vue +0 -268
- package/lib/mcl-card-d/MclCardD.vue.d.ts +0 -138
- package/lib/mcl-card-d/index.types.d.ts +0 -4
- package/lib/mcl-card-d/index.types.js +0 -1
- package/lib/mcl-card-d/index.types.ts +0 -5
- package/tsconfig.json +0 -5
- package/tsconfig.ts.json +0 -9
- package/tsconfig.vue.json +0 -9
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
ColorPalette,
|
|
4
|
-
CrossOrigin,
|
|
5
|
-
CtaTarget,
|
|
6
|
-
HeadingSize,
|
|
7
|
-
} from '@bobbykim/manguito-theme'
|
|
8
|
-
import generateClass from '@bobbykim/manguito-theme'
|
|
9
|
-
import type { CardClickEvent } from '../common/index.types'
|
|
10
|
-
|
|
11
|
-
const props = withDefaults(
|
|
12
|
-
defineProps<{
|
|
13
|
-
title: string
|
|
14
|
-
titleSize?: HeadingSize
|
|
15
|
-
titleColor?: ColorPalette
|
|
16
|
-
borderColor?: ColorPalette
|
|
17
|
-
bgColor?: ColorPalette
|
|
18
|
-
displayImage?: boolean
|
|
19
|
-
imageSource?: string
|
|
20
|
-
imageAlt?: string
|
|
21
|
-
imageCors?: CrossOrigin
|
|
22
|
-
displayCta?: boolean
|
|
23
|
-
ctaAsLink?: boolean
|
|
24
|
-
ctaText?: string
|
|
25
|
-
ctaColor?: ColorPalette
|
|
26
|
-
ctaLink?: string
|
|
27
|
-
ctaTarget?: CtaTarget
|
|
28
|
-
displayLabel?: boolean
|
|
29
|
-
labelText?: string
|
|
30
|
-
labelTextColor?: ColorPalette
|
|
31
|
-
labelColor?: ColorPalette
|
|
32
|
-
enlargeOnHover?: boolean
|
|
33
|
-
displayHighlight?: boolean
|
|
34
|
-
highlightColor?: ColorPalette
|
|
35
|
-
rounded?: boolean
|
|
36
|
-
displayShadow?: boolean
|
|
37
|
-
}>(),
|
|
38
|
-
{
|
|
39
|
-
titleSize: 'md',
|
|
40
|
-
titleColor: 'dark-3',
|
|
41
|
-
borderColor: 'light-3',
|
|
42
|
-
bgColor: 'light-1',
|
|
43
|
-
displayImage: true,
|
|
44
|
-
imageCors: 'anonymous',
|
|
45
|
-
displayCta: true,
|
|
46
|
-
ctaAsLink: true,
|
|
47
|
-
ctaColor: 'primary',
|
|
48
|
-
ctaLink: '#',
|
|
49
|
-
ctaTarget: '_self',
|
|
50
|
-
ctaText: 'cta text',
|
|
51
|
-
displayLabel: true,
|
|
52
|
-
labelText: 'Lorem ipsum',
|
|
53
|
-
labelTextColor: 'light-1',
|
|
54
|
-
labelColor: 'dark-4',
|
|
55
|
-
displayHighlight: true,
|
|
56
|
-
highlightColor: 'primary',
|
|
57
|
-
enlargeOnHover: false,
|
|
58
|
-
rounded: true,
|
|
59
|
-
displayShadow: true,
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
const slots = defineSlots<{
|
|
64
|
-
default: any
|
|
65
|
-
}>()
|
|
66
|
-
const emit = defineEmits<{
|
|
67
|
-
(e: 'card-click', event: Event, item: CardClickEvent): void
|
|
68
|
-
(e: 'card-btn-click', event: Event, item: CardClickEvent): void
|
|
69
|
-
}>()
|
|
70
|
-
|
|
71
|
-
const getBorderClass = (
|
|
72
|
-
border: ColorPalette,
|
|
73
|
-
bg: ColorPalette,
|
|
74
|
-
rounded: boolean,
|
|
75
|
-
enlarge: boolean,
|
|
76
|
-
shadow: boolean
|
|
77
|
-
): string => {
|
|
78
|
-
/**
|
|
79
|
-
* @border - borderColor
|
|
80
|
-
* @bg - bgColor
|
|
81
|
-
* @rounded - rounded
|
|
82
|
-
* @enlarge - enlargeOnHover
|
|
83
|
-
* @shadow - displayShadow
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
const classArray = [
|
|
87
|
-
generateClass('BORDER', border),
|
|
88
|
-
generateClass('BGCOLOR', bg),
|
|
89
|
-
]
|
|
90
|
-
|
|
91
|
-
if (rounded) {
|
|
92
|
-
classArray.push('rounded-md')
|
|
93
|
-
} else {
|
|
94
|
-
classArray.push('rounded-sm')
|
|
95
|
-
}
|
|
96
|
-
if (enlarge) {
|
|
97
|
-
classArray.push('hover:scale-105 transition ease-in duration-300')
|
|
98
|
-
}
|
|
99
|
-
if (shadow) {
|
|
100
|
-
classArray.push('drop-shadow-md')
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return classArray.join(' ')
|
|
104
|
-
}
|
|
105
|
-
const getTitleClass = (
|
|
106
|
-
size: HeadingSize,
|
|
107
|
-
color: ColorPalette,
|
|
108
|
-
hl: boolean
|
|
109
|
-
): string => {
|
|
110
|
-
/**
|
|
111
|
-
* @size - titleSize
|
|
112
|
-
* @color - titleColor
|
|
113
|
-
* @hl - displayHighlight
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
const classArray = [
|
|
117
|
-
generateClass('H3', size),
|
|
118
|
-
generateClass('TEXTCOLOR', color),
|
|
119
|
-
]
|
|
120
|
-
|
|
121
|
-
if (hl) {
|
|
122
|
-
classArray.push('mb-2xs')
|
|
123
|
-
} else {
|
|
124
|
-
classArray.push('mb-xs')
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return classArray.join(' ')
|
|
128
|
-
}
|
|
129
|
-
const getLabelClass = (tColor: ColorPalette, bColor: ColorPalette): string => {
|
|
130
|
-
/**
|
|
131
|
-
* @tColor - labelTextColor
|
|
132
|
-
* @bColor - labelColor
|
|
133
|
-
*/
|
|
134
|
-
const classArray = [
|
|
135
|
-
generateClass('TEXTCOLOR', tColor),
|
|
136
|
-
generateClass('BGCOLOR', bColor),
|
|
137
|
-
]
|
|
138
|
-
return classArray.join(' ')
|
|
139
|
-
}
|
|
140
|
-
const getCtaClass = (color: ColorPalette, round: boolean): string => {
|
|
141
|
-
/**
|
|
142
|
-
* @color - ctaColor
|
|
143
|
-
* @round - rounded
|
|
144
|
-
*/
|
|
145
|
-
const classArray: string[] = [generateClass('BTNCOLOR', color)]
|
|
146
|
-
|
|
147
|
-
const lightColor: string[] = ['light-1', 'light-2', 'light-3', 'light-4']
|
|
148
|
-
|
|
149
|
-
let textColor = lightColor.includes(color) ? 'text-black' : 'text-white'
|
|
150
|
-
|
|
151
|
-
classArray.push(textColor)
|
|
152
|
-
|
|
153
|
-
if (round) {
|
|
154
|
-
classArray.push('btn-round')
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return classArray.join(' ')
|
|
158
|
-
}
|
|
159
|
-
const handleButtonClick = (e: Event): void => {
|
|
160
|
-
const { title, ctaLink, ctaTarget, ctaAsLink } = props
|
|
161
|
-
const cardEvent: CardClickEvent = {
|
|
162
|
-
title,
|
|
163
|
-
url: ctaLink,
|
|
164
|
-
target: ctaTarget ? ctaTarget : '_self',
|
|
165
|
-
}
|
|
166
|
-
!ctaAsLink && e.preventDefault()
|
|
167
|
-
emit('card-btn-click', e, cardEvent)
|
|
168
|
-
}
|
|
169
|
-
const handleCardClick = (e: Event): void => {
|
|
170
|
-
const { title, ctaLink, ctaTarget } = props
|
|
171
|
-
const cardEvent: CardClickEvent = {
|
|
172
|
-
title,
|
|
173
|
-
url: ctaLink,
|
|
174
|
-
target: ctaTarget ? ctaTarget : '_self',
|
|
175
|
-
}
|
|
176
|
-
emit('card-click', e, cardEvent)
|
|
177
|
-
}
|
|
178
|
-
</script>
|
|
179
|
-
|
|
180
|
-
<template>
|
|
181
|
-
<div
|
|
182
|
-
class="overflow-hidden border max-w-[450px] sm:max-w-[350px] w-full xs:w-auto flex-grow flex-shrink-0 cursor-pointer"
|
|
183
|
-
:class="
|
|
184
|
-
getBorderClass(
|
|
185
|
-
borderColor,
|
|
186
|
-
bgColor,
|
|
187
|
-
rounded,
|
|
188
|
-
enlargeOnHover,
|
|
189
|
-
displayShadow
|
|
190
|
-
)
|
|
191
|
-
"
|
|
192
|
-
@click="handleCardClick"
|
|
193
|
-
>
|
|
194
|
-
<div class="relative" v-if="displayImage">
|
|
195
|
-
<img
|
|
196
|
-
:src="imageSource"
|
|
197
|
-
:alt="imageAlt"
|
|
198
|
-
:crossorigin="imageCors"
|
|
199
|
-
class="object-cover object-top h-[220px] min-w-full"
|
|
200
|
-
/>
|
|
201
|
-
<span
|
|
202
|
-
v-if="displayLabel"
|
|
203
|
-
class="py-3xs px-2xs ml-xs inline-block font-bold text-xs absolute bottom-0 translate-y-[50%]"
|
|
204
|
-
:class="getLabelClass(labelTextColor, labelColor)"
|
|
205
|
-
v-html="labelText"
|
|
206
|
-
></span>
|
|
207
|
-
</div>
|
|
208
|
-
<div class="content-height flex flex-col justify-between">
|
|
209
|
-
<div class="min-h-[100px] p-0">
|
|
210
|
-
<div class="px-xs pt-sm">
|
|
211
|
-
<span
|
|
212
|
-
v-if="!displayImage && displayLabel"
|
|
213
|
-
class="py-3xs px-2xs mb-2xs inline-block font-bold text-xs"
|
|
214
|
-
:class="getLabelClass(labelTextColor, labelColor)"
|
|
215
|
-
v-html="labelText"
|
|
216
|
-
></span>
|
|
217
|
-
<h3
|
|
218
|
-
:class="getTitleClass(titleSize, titleColor, displayHighlight)"
|
|
219
|
-
v-html="title"
|
|
220
|
-
></h3>
|
|
221
|
-
<div
|
|
222
|
-
v-if="displayHighlight"
|
|
223
|
-
class="mb-xs h-3xs w-md"
|
|
224
|
-
:class="generateClass('BGCOLOR', highlightColor)"
|
|
225
|
-
></div>
|
|
226
|
-
<div class="mb-sm cursor-default" @click.stop>
|
|
227
|
-
<slot></slot>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
<div class="pb-sm border-0 cursor-default" v-if="displayCta" @click.stop>
|
|
232
|
-
<div class="w-full px-xs">
|
|
233
|
-
<a
|
|
234
|
-
:href="ctaLink"
|
|
235
|
-
:target="ctaTarget"
|
|
236
|
-
class="btn btn-full"
|
|
237
|
-
:class="getCtaClass(ctaColor, rounded)"
|
|
238
|
-
@click="handleButtonClick($event)"
|
|
239
|
-
>{{ ctaText }}</a
|
|
240
|
-
>
|
|
241
|
-
</div>
|
|
242
|
-
</div>
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
</template>
|
|
246
|
-
|
|
247
|
-
<style lang="scss" scoped>
|
|
248
|
-
.content-height {
|
|
249
|
-
height: calc(100% - 200px);
|
|
250
|
-
}
|
|
251
|
-
</style>
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette, CrossOrigin, CtaTarget, HeadingSize } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { CardClickEvent } from '../common/index.types';
|
|
3
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
title: string;
|
|
5
|
-
titleSize?: HeadingSize | undefined;
|
|
6
|
-
titleColor?: ColorPalette | undefined;
|
|
7
|
-
borderColor?: ColorPalette | undefined;
|
|
8
|
-
bgColor?: ColorPalette | undefined;
|
|
9
|
-
displayImage?: boolean | undefined;
|
|
10
|
-
imageSource?: string | undefined;
|
|
11
|
-
imageAlt?: string | undefined;
|
|
12
|
-
imageCors?: CrossOrigin | undefined;
|
|
13
|
-
displayCta?: boolean | undefined;
|
|
14
|
-
ctaAsLink?: boolean | undefined;
|
|
15
|
-
ctaText?: string | undefined;
|
|
16
|
-
ctaColor?: ColorPalette | undefined;
|
|
17
|
-
ctaLink?: string | undefined;
|
|
18
|
-
ctaTarget?: CtaTarget | undefined;
|
|
19
|
-
displayLabel?: boolean | undefined;
|
|
20
|
-
labelText?: string | undefined;
|
|
21
|
-
labelTextColor?: ColorPalette | undefined;
|
|
22
|
-
labelColor?: ColorPalette | undefined;
|
|
23
|
-
enlargeOnHover?: boolean | undefined;
|
|
24
|
-
displayHighlight?: boolean | undefined;
|
|
25
|
-
highlightColor?: ColorPalette | undefined;
|
|
26
|
-
rounded?: boolean | undefined;
|
|
27
|
-
displayShadow?: boolean | undefined;
|
|
28
|
-
}>, {
|
|
29
|
-
titleSize: string;
|
|
30
|
-
titleColor: string;
|
|
31
|
-
borderColor: string;
|
|
32
|
-
bgColor: string;
|
|
33
|
-
displayImage: boolean;
|
|
34
|
-
imageCors: string;
|
|
35
|
-
displayCta: boolean;
|
|
36
|
-
ctaAsLink: boolean;
|
|
37
|
-
ctaColor: string;
|
|
38
|
-
ctaLink: string;
|
|
39
|
-
ctaTarget: string;
|
|
40
|
-
ctaText: string;
|
|
41
|
-
displayLabel: boolean;
|
|
42
|
-
labelText: string;
|
|
43
|
-
labelTextColor: string;
|
|
44
|
-
labelColor: string;
|
|
45
|
-
displayHighlight: boolean;
|
|
46
|
-
highlightColor: string;
|
|
47
|
-
enlargeOnHover: boolean;
|
|
48
|
-
rounded: boolean;
|
|
49
|
-
displayShadow: boolean;
|
|
50
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
|
-
"card-click": (event: Event, item: CardClickEvent) => void;
|
|
52
|
-
"card-btn-click": (event: Event, item: CardClickEvent) => void;
|
|
53
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
54
|
-
title: string;
|
|
55
|
-
titleSize?: HeadingSize | undefined;
|
|
56
|
-
titleColor?: ColorPalette | undefined;
|
|
57
|
-
borderColor?: ColorPalette | undefined;
|
|
58
|
-
bgColor?: ColorPalette | undefined;
|
|
59
|
-
displayImage?: boolean | undefined;
|
|
60
|
-
imageSource?: string | undefined;
|
|
61
|
-
imageAlt?: string | undefined;
|
|
62
|
-
imageCors?: CrossOrigin | undefined;
|
|
63
|
-
displayCta?: boolean | undefined;
|
|
64
|
-
ctaAsLink?: boolean | undefined;
|
|
65
|
-
ctaText?: string | undefined;
|
|
66
|
-
ctaColor?: ColorPalette | undefined;
|
|
67
|
-
ctaLink?: string | undefined;
|
|
68
|
-
ctaTarget?: CtaTarget | undefined;
|
|
69
|
-
displayLabel?: boolean | undefined;
|
|
70
|
-
labelText?: string | undefined;
|
|
71
|
-
labelTextColor?: ColorPalette | undefined;
|
|
72
|
-
labelColor?: ColorPalette | undefined;
|
|
73
|
-
enlargeOnHover?: boolean | undefined;
|
|
74
|
-
displayHighlight?: boolean | undefined;
|
|
75
|
-
highlightColor?: ColorPalette | undefined;
|
|
76
|
-
rounded?: boolean | undefined;
|
|
77
|
-
displayShadow?: boolean | undefined;
|
|
78
|
-
}>, {
|
|
79
|
-
titleSize: string;
|
|
80
|
-
titleColor: string;
|
|
81
|
-
borderColor: string;
|
|
82
|
-
bgColor: string;
|
|
83
|
-
displayImage: boolean;
|
|
84
|
-
imageCors: string;
|
|
85
|
-
displayCta: boolean;
|
|
86
|
-
ctaAsLink: boolean;
|
|
87
|
-
ctaColor: string;
|
|
88
|
-
ctaLink: string;
|
|
89
|
-
ctaTarget: string;
|
|
90
|
-
ctaText: string;
|
|
91
|
-
displayLabel: boolean;
|
|
92
|
-
labelText: string;
|
|
93
|
-
labelTextColor: string;
|
|
94
|
-
labelColor: string;
|
|
95
|
-
displayHighlight: boolean;
|
|
96
|
-
highlightColor: string;
|
|
97
|
-
enlargeOnHover: boolean;
|
|
98
|
-
rounded: boolean;
|
|
99
|
-
displayShadow: boolean;
|
|
100
|
-
}>>> & {
|
|
101
|
-
"onCard-click"?: ((event: Event, item: CardClickEvent) => any) | undefined;
|
|
102
|
-
"onCard-btn-click"?: ((event: Event, item: CardClickEvent) => any) | undefined;
|
|
103
|
-
}, {
|
|
104
|
-
bgColor: ColorPalette;
|
|
105
|
-
titleColor: ColorPalette;
|
|
106
|
-
titleSize: HeadingSize;
|
|
107
|
-
borderColor: ColorPalette;
|
|
108
|
-
displayImage: boolean;
|
|
109
|
-
imageCors: CrossOrigin;
|
|
110
|
-
displayCta: boolean;
|
|
111
|
-
ctaAsLink: boolean;
|
|
112
|
-
ctaText: string;
|
|
113
|
-
ctaColor: ColorPalette;
|
|
114
|
-
ctaLink: string;
|
|
115
|
-
ctaTarget: CtaTarget;
|
|
116
|
-
displayLabel: boolean;
|
|
117
|
-
labelText: string;
|
|
118
|
-
labelTextColor: ColorPalette;
|
|
119
|
-
labelColor: ColorPalette;
|
|
120
|
-
enlargeOnHover: boolean;
|
|
121
|
-
displayHighlight: boolean;
|
|
122
|
-
highlightColor: ColorPalette;
|
|
123
|
-
rounded: boolean;
|
|
124
|
-
displayShadow: boolean;
|
|
125
|
-
}, {}>, Readonly<{
|
|
126
|
-
default: any;
|
|
127
|
-
}> & {
|
|
128
|
-
default: any;
|
|
129
|
-
}>;
|
|
130
|
-
export default _default;
|
|
131
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
132
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
133
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
134
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
135
|
-
} : {
|
|
136
|
-
type: import('vue').PropType<T[K]>;
|
|
137
|
-
required: true;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
type __VLS_WithDefaults<P, D> = {
|
|
141
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
142
|
-
default: D[K];
|
|
143
|
-
}> : P[K];
|
|
144
|
-
};
|
|
145
|
-
type __VLS_Prettify<T> = {
|
|
146
|
-
[K in keyof T]: T[K];
|
|
147
|
-
} & {};
|
|
148
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
149
|
-
new (): {
|
|
150
|
-
$slots: S;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
ColorPalette,
|
|
4
|
-
CrossOrigin,
|
|
5
|
-
CtaTarget,
|
|
6
|
-
HeadingSize,
|
|
7
|
-
} from '@bobbykim/manguito-theme'
|
|
8
|
-
import generateClass from '@bobbykim/manguito-theme'
|
|
9
|
-
import type { CardClickEvent } from '../common/index.types'
|
|
10
|
-
|
|
11
|
-
const props = withDefaults(
|
|
12
|
-
defineProps<{
|
|
13
|
-
title: string
|
|
14
|
-
titleSize?: HeadingSize
|
|
15
|
-
titleColor?: ColorPalette
|
|
16
|
-
titleBlockColor?: ColorPalette
|
|
17
|
-
borderColor?: ColorPalette
|
|
18
|
-
imageSource?: string
|
|
19
|
-
imageAlt?: string
|
|
20
|
-
imageCors?: CrossOrigin
|
|
21
|
-
displayGrayScale?: boolean
|
|
22
|
-
ctaAsLink?: boolean
|
|
23
|
-
ctaLink?: string
|
|
24
|
-
ctaTarget?: CtaTarget
|
|
25
|
-
rounded?: boolean
|
|
26
|
-
}>(),
|
|
27
|
-
{
|
|
28
|
-
titleSize: 'md',
|
|
29
|
-
titleColor: 'light-1',
|
|
30
|
-
titleBlockColor: 'dark-4',
|
|
31
|
-
borderColor: 'light-3',
|
|
32
|
-
displayGrayScale: true,
|
|
33
|
-
imageCors: 'anonymous',
|
|
34
|
-
ctaAsLink: false,
|
|
35
|
-
ctaLink: '#',
|
|
36
|
-
ctaTarget: '_self',
|
|
37
|
-
rounded: false,
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
const slots = defineSlots<{
|
|
42
|
-
default: any
|
|
43
|
-
}>()
|
|
44
|
-
const emit = defineEmits<{
|
|
45
|
-
(e: 'card-click', event: Event, item: CardClickEvent): void
|
|
46
|
-
}>()
|
|
47
|
-
|
|
48
|
-
const getBorderClass = (bColor: ColorPalette, rounded: boolean): string => {
|
|
49
|
-
/**
|
|
50
|
-
* @bColor - borderColor
|
|
51
|
-
* @rounded - rounded
|
|
52
|
-
*/
|
|
53
|
-
const classArray = [generateClass('BORDER', bColor)]
|
|
54
|
-
if (rounded) {
|
|
55
|
-
classArray.push('rounded-md')
|
|
56
|
-
} else {
|
|
57
|
-
classArray.push('rounded-sm')
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return classArray.join(' ')
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const handleHoverEffect = (dGray: boolean): string => {
|
|
64
|
-
/**
|
|
65
|
-
* @dgray - displayGrayScale
|
|
66
|
-
*/
|
|
67
|
-
if (dGray) {
|
|
68
|
-
return '[@media(hover:hover)]:grayscale peer-hover:grayscale-0'
|
|
69
|
-
}
|
|
70
|
-
return ''
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const handleTitleClass = (
|
|
74
|
-
tSize: HeadingSize,
|
|
75
|
-
tColor: ColorPalette,
|
|
76
|
-
tBgColor: ColorPalette
|
|
77
|
-
): string => {
|
|
78
|
-
/**
|
|
79
|
-
* @tSize - titleSize
|
|
80
|
-
* @tColor - titleColor
|
|
81
|
-
* @tBgColor - titleBlockColor
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
const classArray = [
|
|
85
|
-
generateClass('H3', tSize),
|
|
86
|
-
generateClass('TEXTCOLOR', tColor),
|
|
87
|
-
generateClass('BGCOLOR', tBgColor),
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
return classArray.join(' ')
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const handleCardClick = (e: Event): void => {
|
|
94
|
-
/**
|
|
95
|
-
* @e - Event
|
|
96
|
-
*/
|
|
97
|
-
const { title, ctaLink, ctaTarget, ctaAsLink } = props
|
|
98
|
-
!ctaAsLink && e.preventDefault()
|
|
99
|
-
const cardEvent: CardClickEvent = {
|
|
100
|
-
title,
|
|
101
|
-
url: ctaLink,
|
|
102
|
-
target: ctaTarget ? ctaTarget : '_self',
|
|
103
|
-
}
|
|
104
|
-
console.log(cardEvent)
|
|
105
|
-
emit('card-click', e, cardEvent)
|
|
106
|
-
}
|
|
107
|
-
</script>
|
|
108
|
-
|
|
109
|
-
<template>
|
|
110
|
-
<div
|
|
111
|
-
class="relative max-w-[450px] sm:max-w-[350px] w-full xs:w-auto flex-grow flex-shrink-0 cursor-pointer overflow-hidden border border-light-3"
|
|
112
|
-
:class="getBorderClass(borderColor, rounded)"
|
|
113
|
-
>
|
|
114
|
-
<a :href="ctaLink" :target="ctaTarget" @click="handleCardClick($event)">
|
|
115
|
-
<div
|
|
116
|
-
class="absolute z-[15] flex flex-col justify-end items-start inset-0 p-xs [@media(hover:hover)]:opacity-0 hover:opacity-100 peer transition-opacity duration-200"
|
|
117
|
-
>
|
|
118
|
-
<h3
|
|
119
|
-
v-html="title"
|
|
120
|
-
class="inline-block px-xs py-2xs mb-2xs pointer-events-none tracking-wide"
|
|
121
|
-
:class="handleTitleClass(titleSize, titleColor, titleBlockColor)"
|
|
122
|
-
></h3>
|
|
123
|
-
<slot></slot>
|
|
124
|
-
</div>
|
|
125
|
-
<img
|
|
126
|
-
:src="imageSource"
|
|
127
|
-
:alt="imageAlt"
|
|
128
|
-
:crossorigin="imageCors"
|
|
129
|
-
class="relative z-10 object-cover aspect-[3/4] transition-all duration-200"
|
|
130
|
-
:class="handleHoverEffect(displayGrayScale)"
|
|
131
|
-
/>
|
|
132
|
-
</a>
|
|
133
|
-
</div>
|
|
134
|
-
</template>
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette, CrossOrigin, CtaTarget, HeadingSize } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { CardClickEvent } from '../common/index.types';
|
|
3
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
title: string;
|
|
5
|
-
titleSize?: HeadingSize | undefined;
|
|
6
|
-
titleColor?: ColorPalette | undefined;
|
|
7
|
-
titleBlockColor?: ColorPalette | undefined;
|
|
8
|
-
borderColor?: ColorPalette | undefined;
|
|
9
|
-
imageSource?: string | undefined;
|
|
10
|
-
imageAlt?: string | undefined;
|
|
11
|
-
imageCors?: CrossOrigin | undefined;
|
|
12
|
-
displayGrayScale?: boolean | undefined;
|
|
13
|
-
ctaAsLink?: boolean | undefined;
|
|
14
|
-
ctaLink?: string | undefined;
|
|
15
|
-
ctaTarget?: CtaTarget | undefined;
|
|
16
|
-
rounded?: boolean | undefined;
|
|
17
|
-
}>, {
|
|
18
|
-
titleSize: string;
|
|
19
|
-
titleColor: string;
|
|
20
|
-
titleBlockColor: string;
|
|
21
|
-
borderColor: string;
|
|
22
|
-
displayGrayScale: boolean;
|
|
23
|
-
imageCors: string;
|
|
24
|
-
ctaAsLink: boolean;
|
|
25
|
-
ctaLink: string;
|
|
26
|
-
ctaTarget: string;
|
|
27
|
-
rounded: boolean;
|
|
28
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
"card-click": (event: Event, item: CardClickEvent) => void;
|
|
30
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
31
|
-
title: string;
|
|
32
|
-
titleSize?: HeadingSize | undefined;
|
|
33
|
-
titleColor?: ColorPalette | undefined;
|
|
34
|
-
titleBlockColor?: ColorPalette | undefined;
|
|
35
|
-
borderColor?: ColorPalette | undefined;
|
|
36
|
-
imageSource?: string | undefined;
|
|
37
|
-
imageAlt?: string | undefined;
|
|
38
|
-
imageCors?: CrossOrigin | undefined;
|
|
39
|
-
displayGrayScale?: boolean | undefined;
|
|
40
|
-
ctaAsLink?: boolean | undefined;
|
|
41
|
-
ctaLink?: string | undefined;
|
|
42
|
-
ctaTarget?: CtaTarget | undefined;
|
|
43
|
-
rounded?: boolean | undefined;
|
|
44
|
-
}>, {
|
|
45
|
-
titleSize: string;
|
|
46
|
-
titleColor: string;
|
|
47
|
-
titleBlockColor: string;
|
|
48
|
-
borderColor: string;
|
|
49
|
-
displayGrayScale: boolean;
|
|
50
|
-
imageCors: string;
|
|
51
|
-
ctaAsLink: boolean;
|
|
52
|
-
ctaLink: string;
|
|
53
|
-
ctaTarget: string;
|
|
54
|
-
rounded: boolean;
|
|
55
|
-
}>>> & {
|
|
56
|
-
"onCard-click"?: ((event: Event, item: CardClickEvent) => any) | undefined;
|
|
57
|
-
}, {
|
|
58
|
-
titleColor: ColorPalette;
|
|
59
|
-
titleSize: HeadingSize;
|
|
60
|
-
borderColor: ColorPalette;
|
|
61
|
-
imageCors: CrossOrigin;
|
|
62
|
-
ctaAsLink: boolean;
|
|
63
|
-
ctaLink: string;
|
|
64
|
-
ctaTarget: CtaTarget;
|
|
65
|
-
rounded: boolean;
|
|
66
|
-
titleBlockColor: ColorPalette;
|
|
67
|
-
displayGrayScale: boolean;
|
|
68
|
-
}, {}>, Readonly<{
|
|
69
|
-
default: any;
|
|
70
|
-
}> & {
|
|
71
|
-
default: any;
|
|
72
|
-
}>;
|
|
73
|
-
export default _default;
|
|
74
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
75
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
76
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
77
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
78
|
-
} : {
|
|
79
|
-
type: import('vue').PropType<T[K]>;
|
|
80
|
-
required: true;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
type __VLS_WithDefaults<P, D> = {
|
|
84
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
85
|
-
default: D[K];
|
|
86
|
-
}> : P[K];
|
|
87
|
-
};
|
|
88
|
-
type __VLS_Prettify<T> = {
|
|
89
|
-
[K in keyof T]: T[K];
|
|
90
|
-
} & {};
|
|
91
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
92
|
-
new (): {
|
|
93
|
-
$slots: S;
|
|
94
|
-
};
|
|
95
|
-
};
|