@bobbykim/mcl-carousel 0.9.5 → 0.10.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 +4 -4
- package/dist/mcl-carousel.js +67 -67
- package/dist/mcl-carousel.umd.cjs +1 -1
- package/package.json +7 -8
package/dist/index.d.ts
CHANGED
|
@@ -18,11 +18,11 @@ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, Comp
|
|
|
18
18
|
titleSize: HeadingSize;
|
|
19
19
|
titleColor: ColorPalette;
|
|
20
20
|
bgColor: ColorPalette;
|
|
21
|
-
|
|
21
|
+
showTagLine: boolean;
|
|
22
22
|
tagLineUpperCase: boolean;
|
|
23
23
|
tagLineSize: BodyText;
|
|
24
24
|
tagLineColor: ColorPalette;
|
|
25
|
-
|
|
25
|
+
showHighlight: boolean;
|
|
26
26
|
highlightColor: ColorPalette;
|
|
27
27
|
btnColor: ColorPalette;
|
|
28
28
|
btnBgColor: ColorPalette;
|
|
@@ -36,12 +36,12 @@ declare type __VLS_Props = {
|
|
|
36
36
|
titleSize?: HeadingSize;
|
|
37
37
|
titleColor?: ColorPalette;
|
|
38
38
|
bgColor?: ColorPalette;
|
|
39
|
-
|
|
39
|
+
showTagLine?: boolean;
|
|
40
40
|
tagLineUpperCase?: boolean;
|
|
41
41
|
tagLine?: string;
|
|
42
42
|
tagLineSize?: BodyText;
|
|
43
43
|
tagLineColor?: ColorPalette;
|
|
44
|
-
|
|
44
|
+
showHighlight?: boolean;
|
|
45
45
|
highlightColor?: ColorPalette;
|
|
46
46
|
btnColor?: ColorPalette;
|
|
47
47
|
btnBgColor?: ColorPalette;
|
package/dist/mcl-carousel.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useEventListener as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as E, ref as i, onMounted as H, openBlock as f, createElementBlock as v, normalizeClass as r, unref as x, createElementVNode as n, createCommentVNode as w, renderSlot as y } from "vue";
|
|
2
|
+
import { generateClass as l } from "@bobbykim/manguito-theme";
|
|
3
|
+
import { useEventListener as L, useIntersectionObserver as j } from "@vueuse/core";
|
|
4
|
+
const $ = { class: "px-xs sm:px-md container text-center sm:text-left" }, G = { class: "relative" }, I = { class: "relative" }, N = ["innerHTML"], R = ["innerHTML"], U = { class: "relative flex flex-wrap items-center justify-center space-x-4 space-y-4 sm:flex-nowrap sm:justify-start" }, D = { class: "max-w-144" }, O = { class: "flex space-x-4" }, W = ["disabled"], X = ["disabled"], q = { class: "mt-md sm:mt-lg lg:mt-xl container" }, P = /* @__PURE__ */ E({
|
|
5
5
|
__name: "MclCarouselA",
|
|
6
6
|
props: {
|
|
7
7
|
title: {},
|
|
8
8
|
titleSize: { default: "md" },
|
|
9
9
|
titleColor: { default: "dark-3" },
|
|
10
10
|
bgColor: { default: "light-1" },
|
|
11
|
-
|
|
11
|
+
showTagLine: { type: Boolean, default: !0 },
|
|
12
12
|
tagLineUpperCase: { type: Boolean, default: !0 },
|
|
13
13
|
tagLine: {},
|
|
14
14
|
tagLineSize: { default: "md" },
|
|
15
15
|
tagLineColor: { default: "dark-1" },
|
|
16
|
-
|
|
16
|
+
showHighlight: { type: Boolean, default: !0 },
|
|
17
17
|
highlightColor: { default: "primary" },
|
|
18
18
|
btnColor: { default: "dark-3" },
|
|
19
19
|
btnBgColor: { default: "light-4" },
|
|
@@ -21,10 +21,10 @@ const H = { class: "px-xs sm:px-md container text-center sm:text-left" }, j = {
|
|
|
21
21
|
cardsGap: { default: "xs" }
|
|
22
22
|
},
|
|
23
23
|
emits: ["btn-prev", "btn-next"],
|
|
24
|
-
setup(e, { emit:
|
|
25
|
-
const
|
|
26
|
-
let
|
|
27
|
-
const
|
|
24
|
+
setup(e, { emit: k }) {
|
|
25
|
+
const B = e, o = i(null), c = i([]), h = i(), m = k, d = i(0), u = i(!1);
|
|
26
|
+
let g = !1;
|
|
27
|
+
const M = (s) => {
|
|
28
28
|
switch (s) {
|
|
29
29
|
case "0":
|
|
30
30
|
return 0;
|
|
@@ -47,107 +47,107 @@ const H = { class: "px-xs sm:px-md container text-center sm:text-left" }, j = {
|
|
|
47
47
|
case "3xl":
|
|
48
48
|
return 128;
|
|
49
49
|
}
|
|
50
|
-
},
|
|
50
|
+
}, V = (s) => {
|
|
51
51
|
c.value.push(s);
|
|
52
52
|
}, C = (s, t) => {
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
].join(" "),
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
g || (g = !0, t === "prev" && (d.value--, m("btn-prev", s)), t === "next" && (d.value++, m("btn-next", s)), o.value?.dispatchEvent(new Event("sliderMove")));
|
|
54
|
+
}, T = (s, t) => [
|
|
55
|
+
l.h2Variant({ size: s }),
|
|
56
|
+
l.textColorVariant({ color: t })
|
|
57
|
+
].join(" "), S = (s, t, a) => {
|
|
58
|
+
const p = [
|
|
59
|
+
l.bodyTextVariant({ size: s }),
|
|
60
|
+
l.textColorVariant({ color: t })
|
|
61
61
|
];
|
|
62
|
-
return a &&
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
].join(" "),
|
|
68
|
-
|
|
62
|
+
return a && p.push("uppercase"), p.join(" ");
|
|
63
|
+
}, b = (s, t) => [
|
|
64
|
+
l.textColorVariant({ color: s }),
|
|
65
|
+
l.bgColorVariant({ color: t }),
|
|
66
|
+
l.ringColorVariant({ color: t })
|
|
67
|
+
].join(" "), z = () => {
|
|
68
|
+
o.value.style.transform = `translateX(-${d.value * (c.value[0].$el.clientWidth + M(B.cardsGap) + 2)}px)`, u.value = !1;
|
|
69
69
|
}, A = () => {
|
|
70
|
-
|
|
70
|
+
g = !1;
|
|
71
71
|
};
|
|
72
|
-
return
|
|
73
|
-
|
|
72
|
+
return L(o, "sliderMove", z), L(o, "transitionend", A), j(
|
|
73
|
+
h,
|
|
74
74
|
(s) => {
|
|
75
75
|
s[0].isIntersecting && (u.value = !0);
|
|
76
76
|
},
|
|
77
77
|
{ threshold: 0.75 }
|
|
78
|
-
),
|
|
79
|
-
|
|
80
|
-
}), (s, t) => (
|
|
81
|
-
class:
|
|
78
|
+
), H(() => {
|
|
79
|
+
h.value = c.value[c.value.length - 1].$el;
|
|
80
|
+
}), (s, t) => (f(), v("section", {
|
|
81
|
+
class: r(["py-lg lg:py-xl overflow-hidden", x(l).bgColorVariant({ color: e.bgColor })])
|
|
82
82
|
}, [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
e.
|
|
83
|
+
n("div", $, [
|
|
84
|
+
n("div", G, [
|
|
85
|
+
e.showHighlight ? (f(), v("div", {
|
|
86
86
|
key: 0,
|
|
87
|
-
class:
|
|
88
|
-
}, null, 2)) :
|
|
89
|
-
|
|
90
|
-
e.
|
|
87
|
+
class: r(["w-md absolute -left-4 hidden h-full bg-opacity-25 sm:block", x(l).bgColorVariant({ color: e.highlightColor })])
|
|
88
|
+
}, null, 2)) : w("", !0),
|
|
89
|
+
n("div", I, [
|
|
90
|
+
e.showTagLine ? (f(), v("span", {
|
|
91
91
|
key: 0,
|
|
92
|
-
class:
|
|
92
|
+
class: r([
|
|
93
93
|
"tracking-widest",
|
|
94
|
-
|
|
94
|
+
S(e.tagLineSize, e.tagLineColor, e.tagLineUpperCase)
|
|
95
95
|
]),
|
|
96
96
|
innerHTML: e.tagLine
|
|
97
|
-
}, null, 10,
|
|
98
|
-
|
|
99
|
-
class:
|
|
97
|
+
}, null, 10, N)) : w("", !0),
|
|
98
|
+
n("h2", {
|
|
99
|
+
class: r(["tracking-wide", T(e.titleSize, e.titleColor)]),
|
|
100
100
|
innerHTML: e.title
|
|
101
|
-
}, null, 10,
|
|
101
|
+
}, null, 10, R)
|
|
102
102
|
]),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
n("div", U, [
|
|
104
|
+
n("div", D, [
|
|
105
|
+
y(s.$slots, "description")
|
|
106
106
|
]),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class:
|
|
107
|
+
n("div", O, [
|
|
108
|
+
n("button", {
|
|
109
|
+
class: r(["p-xs grid place-items-center rounded-full ring-offset-2 ring-offset-inherit transition-all duration-200 hover:bg-opacity-80 focus:outline-none focus:ring-4 disabled:opacity-50", b(e.btnColor, e.btnBgColor)]),
|
|
110
110
|
disabled: d.value === 0,
|
|
111
111
|
onClick: t[0] || (t[0] = (a) => C(a, "prev")),
|
|
112
112
|
"aria-label": "previous"
|
|
113
113
|
}, [...t[2] || (t[2] = [
|
|
114
|
-
|
|
114
|
+
n("svg", {
|
|
115
115
|
class: "w-xs h-xs",
|
|
116
116
|
xmlns: "http://www.w3.org/2000/svg",
|
|
117
117
|
viewBox: "0 0 384 512",
|
|
118
118
|
fill: "currentColor"
|
|
119
119
|
}, [
|
|
120
|
-
|
|
120
|
+
n("path", { d: "M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z" })
|
|
121
121
|
], -1)
|
|
122
|
-
])], 10,
|
|
123
|
-
|
|
124
|
-
class:
|
|
122
|
+
])], 10, W),
|
|
123
|
+
n("button", {
|
|
124
|
+
class: r(["p-xs grid place-items-center rounded-full ring-offset-2 ring-offset-inherit transition-all duration-200 hover:bg-opacity-80 focus:outline-none focus:ring-4 disabled:opacity-50", b(e.btnColor, e.btnBgColor)]),
|
|
125
125
|
disabled: u.value,
|
|
126
126
|
onClick: t[1] || (t[1] = (a) => C(a, "next")),
|
|
127
127
|
"aria-label": "next"
|
|
128
128
|
}, [...t[3] || (t[3] = [
|
|
129
|
-
|
|
129
|
+
n("svg", {
|
|
130
130
|
class: "w-xs h-xs",
|
|
131
131
|
xmlns: "http://www.w3.org/2000/svg",
|
|
132
132
|
viewBox: "0 0 384 512",
|
|
133
133
|
fill: "currentColor"
|
|
134
134
|
}, [
|
|
135
|
-
|
|
135
|
+
n("path", { d: "M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z" })
|
|
136
136
|
], -1)
|
|
137
|
-
])], 10,
|
|
137
|
+
])], 10, X)
|
|
138
138
|
])
|
|
139
139
|
])
|
|
140
140
|
])
|
|
141
141
|
]),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
class:
|
|
142
|
+
n("div", q, [
|
|
143
|
+
n("div", {
|
|
144
|
+
class: r(["px-xs gap-xs flex transition-transform duration-500", x(l).gapVariant({ spacing: e.cardsGap })]),
|
|
145
145
|
ref_key: "slideContainer",
|
|
146
|
-
ref:
|
|
146
|
+
ref: o
|
|
147
147
|
}, [
|
|
148
|
-
|
|
148
|
+
y(s.$slots, "carousel", {
|
|
149
149
|
cards: e.content,
|
|
150
|
-
setRef:
|
|
150
|
+
setRef: V
|
|
151
151
|
})
|
|
152
152
|
], 2)
|
|
153
153
|
])
|
|
@@ -155,5 +155,5 @@ const H = { class: "px-xs sm:px-md container text-center sm:text-left" }, j = {
|
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
export {
|
|
158
|
-
|
|
158
|
+
P as MclCarouselA
|
|
159
159
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@bobbykim/manguito-theme"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@bobbykim/manguito-theme","@vueuse/core"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.MclCarousel={},a.Vue,a.ManguitoTheme,a.core))})(this,(function(a,e,l,d){"use strict";const b={class:"px-xs sm:px-md container text-center sm:text-left"},p={class:"relative"},y={class:"relative"},V=["innerHTML"],w=["innerHTML"],E={class:"relative flex flex-wrap items-center justify-center space-x-4 space-y-4 sm:flex-nowrap sm:justify-start"},k={class:"max-w-144"},L={class:"flex space-x-4"},N=["disabled"],B=["disabled"],M={class:"mt-md sm:mt-lg lg:mt-xl container"},z=e.defineComponent({__name:"MclCarouselA",props:{title:{},titleSize:{default:"md"},titleColor:{default:"dark-3"},bgColor:{default:"light-1"},showTagLine:{type:Boolean,default:!0},tagLineUpperCase:{type:Boolean,default:!0},tagLine:{},tagLineSize:{default:"md"},tagLineColor:{default:"dark-1"},showHighlight:{type:Boolean,default:!0},highlightColor:{default:"primary"},btnColor:{default:"dark-3"},btnBgColor:{default:"light-4"},content:{},cardsGap:{default:"xs"}},emits:["btn-prev","btn-next"],setup(t,{emit:v}){const S=t,o=e.ref(null),i=e.ref([]),g=e.ref(),C=v,c=e.ref(0),f=e.ref(!1);let u=!1;const j=s=>{switch(s){case"0":return 0;case"3xs":return 4;case"2xs":return 8;case"xs":return 16;case"sm":return 24;case"md":return 32;case"lg":return 48;case"xl":return 64;case"2xl":return 96;case"3xl":return 128}},A=s=>{i.value.push(s)},m=(s,n)=>{u||(u=!0,n==="prev"&&(c.value--,C("btn-prev",s)),n==="next"&&(c.value++,C("btn-next",s)),o.value?.dispatchEvent(new Event("sliderMove")))},H=(s,n)=>[l.generateClass.h2Variant({size:s}),l.generateClass.textColorVariant({color:n})].join(" "),T=(s,n,r)=>{const h=[l.generateClass.bodyTextVariant({size:s}),l.generateClass.textColorVariant({color:n})];return r&&h.push("uppercase"),h.join(" ")},x=(s,n)=>[l.generateClass.textColorVariant({color:s}),l.generateClass.bgColorVariant({color:n}),l.generateClass.ringColorVariant({color:n})].join(" "),$=()=>{o.value.style.transform=`translateX(-${c.value*(i.value[0].$el.clientWidth+j(S.cardsGap)+2)}px)`,f.value=!1},q=()=>{u=!1};return d.useEventListener(o,"sliderMove",$),d.useEventListener(o,"transitionend",q),d.useIntersectionObserver(g,s=>{s[0].isIntersecting&&(f.value=!0)},{threshold:.75}),e.onMounted(()=>{g.value=i.value[i.value.length-1].$el}),(s,n)=>(e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["py-lg lg:py-xl overflow-hidden",e.unref(l.generateClass).bgColorVariant({color:t.bgColor})])},[e.createElementVNode("div",b,[e.createElementVNode("div",p,[t.showHighlight?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["w-md absolute -left-4 hidden h-full bg-opacity-25 sm:block",e.unref(l.generateClass).bgColorVariant({color:t.highlightColor})])},null,2)):e.createCommentVNode("",!0),e.createElementVNode("div",y,[t.showTagLine?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["tracking-widest",T(t.tagLineSize,t.tagLineColor,t.tagLineUpperCase)]),innerHTML:t.tagLine},null,10,V)):e.createCommentVNode("",!0),e.createElementVNode("h2",{class:e.normalizeClass(["tracking-wide",H(t.titleSize,t.titleColor)]),innerHTML:t.title},null,10,w)]),e.createElementVNode("div",E,[e.createElementVNode("div",k,[e.renderSlot(s.$slots,"description")]),e.createElementVNode("div",L,[e.createElementVNode("button",{class:e.normalizeClass(["p-xs grid place-items-center rounded-full ring-offset-2 ring-offset-inherit transition-all duration-200 hover:bg-opacity-80 focus:outline-none focus:ring-4 disabled:opacity-50",x(t.btnColor,t.btnBgColor)]),disabled:c.value===0,onClick:n[0]||(n[0]=r=>m(r,"prev")),"aria-label":"previous"},[...n[2]||(n[2]=[e.createElementVNode("svg",{class:"w-xs h-xs",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor"},[e.createElementVNode("path",{d:"M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"})],-1)])],10,N),e.createElementVNode("button",{class:e.normalizeClass(["p-xs grid place-items-center rounded-full ring-offset-2 ring-offset-inherit transition-all duration-200 hover:bg-opacity-80 focus:outline-none focus:ring-4 disabled:opacity-50",x(t.btnColor,t.btnBgColor)]),disabled:f.value,onClick:n[1]||(n[1]=r=>m(r,"next")),"aria-label":"next"},[...n[3]||(n[3]=[e.createElementVNode("svg",{class:"w-xs h-xs",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor"},[e.createElementVNode("path",{d:"M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"})],-1)])],10,B)])])])]),e.createElementVNode("div",M,[e.createElementVNode("div",{class:e.normalizeClass(["px-xs gap-xs flex transition-transform duration-500",e.unref(l.generateClass).gapVariant({spacing:t.cardsGap})]),ref_key:"slideContainer",ref:o},[e.renderSlot(s.$slots,"carousel",{cards:t.content,setRef:A})],2)])],2))}});a.MclCarouselA=z,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobbykim/mcl-carousel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "carousel component based on @bobbykim/manguito-theme",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
"require": "./dist/mcl-carousel.umd.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "vite build"
|
|
21
|
-
},
|
|
22
19
|
"author": {
|
|
23
20
|
"name": "Bobby Kim",
|
|
24
21
|
"url": "https://www.devbobbykim.com/"
|
|
@@ -33,9 +30,9 @@
|
|
|
33
30
|
},
|
|
34
31
|
"license": "MIT",
|
|
35
32
|
"dependencies": {
|
|
36
|
-
"@bobbykim/manguito-theme": "0.28.3",
|
|
37
33
|
"@vueuse/core": "^12.0.0",
|
|
38
|
-
"vue": "^3.5.13"
|
|
34
|
+
"vue": "^3.5.13",
|
|
35
|
+
"@bobbykim/manguito-theme": "1.0.0"
|
|
39
36
|
},
|
|
40
37
|
"devDependencies": {
|
|
41
38
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
@@ -45,5 +42,7 @@
|
|
|
45
42
|
"vite-plugin-dts": "^4.3.0",
|
|
46
43
|
"vue-tsc": "^2.1.10"
|
|
47
44
|
},
|
|
48
|
-
"
|
|
49
|
-
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "vite build"
|
|
47
|
+
}
|
|
48
|
+
}
|