@dotss/tictoccroc 0.0.36 → 0.1.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.
|
@@ -20,6 +20,9 @@ export interface SwiperProps extends FlexboxProps {
|
|
|
20
20
|
loop?: boolean;
|
|
21
21
|
disableSwipe?: boolean;
|
|
22
22
|
renderPagination?: (props: SwiperPaginationProps) => ReactNode;
|
|
23
|
+
autoSwipe?: boolean;
|
|
24
|
+
autoSwipeInterval?: number;
|
|
25
|
+
autoSwipeDuration?: number;
|
|
23
26
|
}
|
|
24
|
-
declare function Swiper({ children, initialPage, onSwipe, onSwiping, loop, disableSwipe, renderPagination, inlineCSS, ...props }: SwiperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
27
|
+
declare function Swiper({ children, initialPage, onSwipe, onSwiping, loop, disableSwipe, renderPagination, inlineCSS, autoSwipe, autoSwipeInterval, autoSwipeDuration, ...props }: SwiperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
25
28
|
export default Swiper;
|
|
@@ -1,123 +1,136 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Flexbox as
|
|
4
|
-
import
|
|
5
|
-
import { createSwipeEvent as
|
|
6
|
-
import
|
|
7
|
-
function
|
|
8
|
-
children:
|
|
9
|
-
initialPage:
|
|
10
|
-
onSwipe:
|
|
11
|
-
onSwiping:
|
|
12
|
-
loop:
|
|
13
|
-
disableSwipe:
|
|
14
|
-
renderPagination:
|
|
15
|
-
inlineCSS:
|
|
16
|
-
|
|
1
|
+
import { jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as d, Children as W, isValidElement as G, useCallback as mr, useEffect as M, cloneElement as vr } from "react";
|
|
3
|
+
import { Flexbox as rr } from "@dotss/ui";
|
|
4
|
+
import U from "../MediaDialog/MediaBlock/MediaBlock.mjs";
|
|
5
|
+
import { createSwipeEvent as R } from "./Swiper.utils.mjs";
|
|
6
|
+
import j from "./SwiperBlock/SwiperBlock.mjs";
|
|
7
|
+
function Pr({
|
|
8
|
+
children: B,
|
|
9
|
+
initialPage: T = 0,
|
|
10
|
+
onSwipe: s,
|
|
11
|
+
onSwiping: x,
|
|
12
|
+
loop: v = !1,
|
|
13
|
+
disableSwipe: tr = !1,
|
|
14
|
+
renderPagination: q,
|
|
15
|
+
inlineCSS: er,
|
|
16
|
+
autoSwipe: H = !1,
|
|
17
|
+
autoSwipeInterval: J = 3e3,
|
|
18
|
+
autoSwipeDuration: Q = 1e3,
|
|
19
|
+
...nr
|
|
17
20
|
}) {
|
|
18
|
-
const [
|
|
19
|
-
!t.current || !
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const [C, $] = w(T), [c, cr] = w(1), t = d(null), X = d(0), Y = d(0), V = d(0), N = d(0), u = d(!1), f = d(!0), F = d(""), n = d(T), Z = d(!1), l = d(null), k = W.count(B), m = W.toArray(B).filter(G).filter((r) => r.type === j || r.type === U), A = k > 1 && !tr, sr = W.toArray(m == null ? void 0 : m[0]).filter(G).filter((r) => r.type === j || r.type === U), ur = W.toArray(m == null ? void 0 : m[(m == null ? void 0 : m.length) - 1]).filter(G).filter((r) => r.type === j || r.type === U), _ = (r, e, i) => {
|
|
22
|
+
!t.current || !A || (F.current = t.current.style.transform, Y.current = r, X.current = r + t.current.offsetWidth * (i + 1), V.current = e);
|
|
23
|
+
}, L = mr(
|
|
24
|
+
(r, e, i, {
|
|
25
|
+
isAutoSwiped: P = !1,
|
|
26
|
+
shouldFocus: a = !1
|
|
27
|
+
} = {}) => {
|
|
28
|
+
if (!t.current || !A || !u.current || !f.current)
|
|
29
|
+
return;
|
|
30
|
+
f.current = !1, t.current.style.transition = P ? `transform ${Q}ms` : "transform 0.2s", t.current.style.cursor = "grab", l.current && (t.current.removeEventListener("transitionend", l.current), l.current = null);
|
|
31
|
+
const o = e || C, h = i || X.current - t.current.offsetWidth * (o + 1) - r, y = t.current.offsetWidth * 0.1;
|
|
32
|
+
if (Math.abs(h) < y && !e) {
|
|
33
|
+
t.current.style.transform = F.current, u.current = !1, f.current = !0, s == null || s(
|
|
34
|
+
R({
|
|
35
|
+
realPage: n.current,
|
|
36
|
+
totalPages: c,
|
|
37
|
+
lastPage: n.current,
|
|
38
|
+
isLoop: !1
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const I = h <= -y && o - 1 < 0, z = h >= y && o + 1 === c, fr = h >= y && o + 1 < c, dr = h <= -y && o - 1 >= 0;
|
|
44
|
+
if (I) {
|
|
45
|
+
n.current = c - 1, s == null || s(
|
|
46
|
+
R({ realPage: n.current, totalPages: c, lastPage: 0, isLoop: !0 })
|
|
47
|
+
), t.current.style.transform = "translate3d(0, 0, 0)", l.current = (D) => {
|
|
48
|
+
var g, b, E, p;
|
|
49
|
+
if (D.propertyName === "transform") {
|
|
50
|
+
if (!t.current) return;
|
|
51
|
+
t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${c}), 0, 0)`, $(c - 1), u.current = !1, f.current = !0, a ? (E = (b = (g = t.current) == null ? void 0 : g.children) == null ? void 0 : b[c]) == null || E.focus() : (p = document.activeElement) == null || p.blur();
|
|
52
|
+
}
|
|
53
|
+
}, t.current.addEventListener("transitionend", l.current);
|
|
54
|
+
return;
|
|
55
|
+
} else if (z) {
|
|
56
|
+
n.current = 0, s == null || s(
|
|
57
|
+
R({
|
|
58
|
+
realPage: n.current,
|
|
59
|
+
totalPages: c,
|
|
60
|
+
lastPage: c - 1,
|
|
61
|
+
isLoop: !0
|
|
62
|
+
})
|
|
63
|
+
), t.current.style.transform = `translate3d(calc(-100% * ${o + 2}), 0, 0)`, l.current = (D) => {
|
|
64
|
+
var g, b, E, p;
|
|
65
|
+
if (D.propertyName === "transform") {
|
|
66
|
+
if (!t.current) return;
|
|
67
|
+
t.current.style.transition = "none", t.current.style.transform = "translate3d(-100%, 0, 0)", $(0), u.current = !1, f.current = !0, a ? (E = (b = (g = t.current) == null ? void 0 : g.children) == null ? void 0 : b[1]) == null || E.focus() : (p = document.activeElement) == null || p.blur();
|
|
68
|
+
}
|
|
69
|
+
}, t.current.addEventListener("transitionend", l.current);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
fr ? (n.current = o + 1, s == null || s(
|
|
73
|
+
R({
|
|
28
74
|
realPage: n.current,
|
|
29
|
-
totalPages:
|
|
30
|
-
lastPage:
|
|
75
|
+
totalPages: c,
|
|
76
|
+
lastPage: o,
|
|
77
|
+
isLoop: !0
|
|
78
|
+
})
|
|
79
|
+
), $(n.current), t.current.style.transform = `translate3d(calc(-100% * ${o + 2}), 0, 0)`) : dr ? (n.current = o - 1, s == null || s(
|
|
80
|
+
R({
|
|
81
|
+
realPage: n.current,
|
|
82
|
+
totalPages: c,
|
|
83
|
+
lastPage: o,
|
|
31
84
|
isLoop: !1
|
|
32
85
|
})
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
const $ = c <= -g && a - 1 < 0, A = c >= g && a + 1 === s, F = c >= g && a + 1 < s, z = c <= -g && a - 1 >= 0;
|
|
37
|
-
if ($) {
|
|
38
|
-
n.current = s - 1, u == null || u(
|
|
39
|
-
b({ realPage: n.current, totalPages: s, lastPage: 0, isLoop: !0 })
|
|
40
|
-
), t.current.style.transform = "translate3d(0, 0, 0)", l.current = (M) => {
|
|
41
|
-
var v, h, L;
|
|
42
|
-
if (M.propertyName === "transform") {
|
|
43
|
-
if (!t.current) return;
|
|
44
|
-
t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${s}), 0, 0)`, R(s - 1), o.current = !1, d.current = !0, (L = (h = (v = t.current) == null ? void 0 : v.children) == null ? void 0 : h[s]) == null || L.focus();
|
|
45
|
-
}
|
|
46
|
-
}, t.current.addEventListener("transitionend", l.current);
|
|
47
|
-
return;
|
|
48
|
-
} else if (A) {
|
|
49
|
-
n.current = 0, u == null || u(
|
|
50
|
-
b({
|
|
86
|
+
), $(n.current), t.current.style.transform = `translate3d(calc(-100% * ${o}), 0, 0)`) : (s == null || s(
|
|
87
|
+
R({
|
|
51
88
|
realPage: n.current,
|
|
52
|
-
totalPages:
|
|
53
|
-
lastPage:
|
|
54
|
-
isLoop: !
|
|
89
|
+
totalPages: c,
|
|
90
|
+
lastPage: n.current,
|
|
91
|
+
isLoop: !1
|
|
55
92
|
})
|
|
56
|
-
), t.current.style.transform =
|
|
57
|
-
var
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
), t.current.style.transform = F.current), l.current = (D) => {
|
|
94
|
+
var g, b;
|
|
95
|
+
if (D.propertyName === "transform") {
|
|
96
|
+
u.current = !1, f.current = !0;
|
|
97
|
+
const E = Array.from(((g = t.current) == null ? void 0 : g.children) ?? []).find(
|
|
98
|
+
(p) => p.getAttribute("aria-current") === "page"
|
|
99
|
+
);
|
|
100
|
+
a && E ? E.focus() : (b = document.activeElement) == null || b.blur();
|
|
61
101
|
}
|
|
62
102
|
}, t.current.addEventListener("transitionend", l.current);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
), R(n.current), t.current.style.transform = `translate3d(calc(-100% * ${a + 2}), 0, 0)`) : z ? (n.current = a - 1, u == null || u(
|
|
73
|
-
b({
|
|
74
|
-
realPage: n.current,
|
|
75
|
-
totalPages: s,
|
|
76
|
-
lastPage: a,
|
|
77
|
-
isLoop: !1
|
|
78
|
-
})
|
|
79
|
-
), R(n.current), t.current.style.transform = `translate3d(calc(-100% * ${a}), 0, 0)`) : (u == null || u(
|
|
80
|
-
b({
|
|
81
|
-
realPage: n.current,
|
|
82
|
-
totalPages: s,
|
|
83
|
-
lastPage: n.current,
|
|
84
|
-
isLoop: !1
|
|
85
|
-
})
|
|
86
|
-
), t.current.style.transform = N.current), l.current = (M) => {
|
|
87
|
-
var v;
|
|
88
|
-
if (M.propertyName === "transform") {
|
|
89
|
-
o.current = !1, d.current = !0;
|
|
90
|
-
const h = Array.from(((v = t.current) == null ? void 0 : v.children) ?? []).find(
|
|
91
|
-
(L) => L.getAttribute("aria-current") === "page"
|
|
92
|
-
);
|
|
93
|
-
h && h.focus();
|
|
94
|
-
}
|
|
95
|
-
}, t.current.addEventListener("transitionend", l.current);
|
|
96
|
-
}, nr = (r) => {
|
|
97
|
-
o.current = !0, J(r.clientX, r.clientY, n.current);
|
|
98
|
-
}, Q = (r) => C(r.clientX), cr = (r) => {
|
|
99
|
-
J(r.touches[0].clientX, r.touches[0].clientY, n.current);
|
|
100
|
-
}, V = (r) => C(r.changedTouches[0].clientX), sr = (r) => {
|
|
101
|
-
o.current = !0;
|
|
103
|
+
},
|
|
104
|
+
[C, c, s, A, Q]
|
|
105
|
+
), ar = (r) => {
|
|
106
|
+
u.current = !0, _(r.clientX, r.clientY, n.current);
|
|
107
|
+
}, K = (r) => L(r.clientX), or = (r) => {
|
|
108
|
+
_(r.touches[0].clientX, r.touches[0].clientY, n.current);
|
|
109
|
+
}, O = (r) => L(r.changedTouches[0].clientX), lr = (r) => {
|
|
110
|
+
u.current = !0;
|
|
102
111
|
const e = r - 1;
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
var i,
|
|
112
|
+
$(e <= 0 ? 0 : e), L(0, r);
|
|
113
|
+
}, ir = (r) => (e) => {
|
|
114
|
+
var i, P;
|
|
106
115
|
switch (e.key) {
|
|
107
116
|
case "ArrowRight": {
|
|
108
|
-
if (e.preventDefault(),
|
|
109
|
-
const
|
|
110
|
-
if (!
|
|
117
|
+
if (e.preventDefault(), u.current || !f.current) return;
|
|
118
|
+
const a = n.current === c - 1;
|
|
119
|
+
if (!v && a)
|
|
111
120
|
return;
|
|
112
|
-
|
|
121
|
+
u.current = !0, L(0, n.current, (((i = t.current) == null ? void 0 : i.offsetWidth) ?? 0) * 0.1, {
|
|
122
|
+
shouldFocus: !0
|
|
123
|
+
});
|
|
113
124
|
break;
|
|
114
125
|
}
|
|
115
126
|
case "ArrowLeft": {
|
|
116
|
-
if (e.preventDefault(),
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
127
|
+
if (e.preventDefault(), u.current || !f.current) return;
|
|
128
|
+
const a = n.current === 0;
|
|
129
|
+
if (!v && a)
|
|
119
130
|
return;
|
|
120
|
-
|
|
131
|
+
u.current = !0, L(0, n.current, -((((P = t.current) == null ? void 0 : P.offsetWidth) ?? 0) * 0.1), {
|
|
132
|
+
shouldFocus: !0
|
|
133
|
+
});
|
|
121
134
|
break;
|
|
122
135
|
}
|
|
123
136
|
case "Enter": {
|
|
@@ -131,83 +144,94 @@ function vr({
|
|
|
131
144
|
}
|
|
132
145
|
r == null || r(e);
|
|
133
146
|
};
|
|
134
|
-
return
|
|
135
|
-
const r = t.current, e = (
|
|
136
|
-
if (!t.current || !
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
142
|
-
|
|
147
|
+
return M(() => {
|
|
148
|
+
const r = t.current, e = (a, o, h) => {
|
|
149
|
+
if (!t.current || !A || !f.current) return;
|
|
150
|
+
N.current = a - X.current;
|
|
151
|
+
const y = 5;
|
|
152
|
+
if (u.current = u.current || Math.abs(N.current) > y && Math.abs(o - V.current) < y, u.current) {
|
|
153
|
+
const I = Y.current < a, z = Y.current > a;
|
|
154
|
+
if (!v && I && n.current === 0) {
|
|
155
|
+
u.current = !1;
|
|
143
156
|
return;
|
|
144
157
|
}
|
|
145
|
-
if (!
|
|
146
|
-
|
|
158
|
+
if (!v && z && n.current === c - 1) {
|
|
159
|
+
u.current = !1;
|
|
147
160
|
return;
|
|
148
161
|
}
|
|
149
|
-
|
|
150
|
-
|
|
162
|
+
h.cancelable && h.preventDefault(), x == null || x(
|
|
163
|
+
R({
|
|
151
164
|
realPage: n.current,
|
|
152
|
-
totalPages:
|
|
165
|
+
totalPages: c,
|
|
153
166
|
lastPage: n.current,
|
|
154
167
|
isLoop: !1
|
|
155
168
|
})
|
|
156
|
-
), t.current.style.transition = "none", t.current.style.cursor = "grabbing", t.current.style.transform = `translate3d(${
|
|
169
|
+
), t.current.style.transition = "none", t.current.style.cursor = "grabbing", t.current.style.transform = `translate3d(${N.current}px, 0, 0)`;
|
|
157
170
|
}
|
|
158
|
-
}, i = (
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
return r && (r.addEventListener("mousemove", i), r.addEventListener("touchmove",
|
|
162
|
-
r && (r.removeEventListener("mousemove", i), r.removeEventListener("touchmove",
|
|
171
|
+
}, i = (a) => {
|
|
172
|
+
u.current && e(a.clientX, a.clientY, a);
|
|
173
|
+
}, P = (a) => e(a.touches[0].clientX, a.touches[0].clientY, a);
|
|
174
|
+
return r && (r.addEventListener("mousemove", i), r.addEventListener("touchmove", P)), () => {
|
|
175
|
+
r && (r.removeEventListener("mousemove", i), r.removeEventListener("touchmove", P));
|
|
163
176
|
};
|
|
164
|
-
}, [
|
|
177
|
+
}, [A, x, v, c]), M(() => {
|
|
165
178
|
const r = t.current, e = (i) => {
|
|
166
|
-
|
|
179
|
+
f.current || (i.stopPropagation(), i.preventDefault());
|
|
167
180
|
};
|
|
168
181
|
return r == null || r.addEventListener("click", e), () => {
|
|
169
182
|
r == null || r.removeEventListener("click", e);
|
|
170
183
|
};
|
|
171
|
-
}, []),
|
|
184
|
+
}, []), M(() => {
|
|
172
185
|
const r = t.current;
|
|
173
186
|
return () => {
|
|
174
187
|
l.current && r && (r.removeEventListener("transitionend", l.current), l.current = null);
|
|
175
188
|
};
|
|
176
|
-
}, []),
|
|
177
|
-
|
|
178
|
-
}, [
|
|
179
|
-
t.current && !
|
|
180
|
-
}, [
|
|
181
|
-
|
|
189
|
+
}, []), M(() => {
|
|
190
|
+
cr(k);
|
|
191
|
+
}, [k]), M(() => {
|
|
192
|
+
t.current && !Z.current && (Z.current = !0, t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${k < T + 1 ? k : T + 1}), 0, 0)`);
|
|
193
|
+
}, [T, k]), M(() => {
|
|
194
|
+
if (H) {
|
|
195
|
+
const r = setInterval(() => {
|
|
196
|
+
u.current || !f.current || t.current && (!v && n.current === c - 1 || document.activeElement && t.current && t.current.contains(document.activeElement) || (u.current = !0, L(0, n.current, (t.current.offsetWidth ?? 0) * 0.1, {
|
|
197
|
+
isAutoSwiped: !0
|
|
198
|
+
})));
|
|
199
|
+
}, J);
|
|
200
|
+
return () => {
|
|
201
|
+
clearInterval(r);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}, [H, J, v, c, L]), /* @__PURE__ */ S(
|
|
205
|
+
rr,
|
|
182
206
|
{
|
|
183
207
|
flexGrow: 1,
|
|
184
208
|
role: "list",
|
|
185
209
|
"aria-roledescription": "carousel",
|
|
186
210
|
"aria-label": "슬라이더",
|
|
187
|
-
...
|
|
211
|
+
...nr,
|
|
188
212
|
inlineCSS: {
|
|
189
213
|
width: "100%",
|
|
190
214
|
position: "relative",
|
|
191
|
-
...
|
|
215
|
+
...er
|
|
192
216
|
},
|
|
193
217
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
|
|
218
|
+
/* @__PURE__ */ S(
|
|
219
|
+
rr,
|
|
196
220
|
{
|
|
197
221
|
ref: t,
|
|
198
222
|
flexGrow: 1,
|
|
199
|
-
onMouseDown:
|
|
200
|
-
onMouseUp:
|
|
201
|
-
onMouseLeave:
|
|
202
|
-
onTouchStart:
|
|
203
|
-
onTouchEnd:
|
|
204
|
-
onTouchCancel:
|
|
223
|
+
onMouseDown: ar,
|
|
224
|
+
onMouseUp: K,
|
|
225
|
+
onMouseLeave: K,
|
|
226
|
+
onTouchStart: or,
|
|
227
|
+
onTouchEnd: O,
|
|
228
|
+
onTouchCancel: O,
|
|
205
229
|
inlineCSS: {
|
|
206
230
|
"& > div:first-of-type": {
|
|
207
|
-
visibility:
|
|
231
|
+
visibility: v ? "visible" : "hidden"
|
|
208
232
|
},
|
|
209
233
|
"& > div:last-of-type": {
|
|
210
|
-
visibility:
|
|
234
|
+
visibility: v ? "visible" : "hidden"
|
|
211
235
|
}
|
|
212
236
|
},
|
|
213
237
|
style: {
|
|
@@ -216,30 +240,30 @@ function vr({
|
|
|
216
240
|
cursor: "grab"
|
|
217
241
|
},
|
|
218
242
|
children: [
|
|
219
|
-
|
|
243
|
+
ur,
|
|
220
244
|
m.map(
|
|
221
|
-
(r, e) =>
|
|
245
|
+
(r, e) => vr(r, {
|
|
222
246
|
role: "listitem",
|
|
223
|
-
tabIndex: e ===
|
|
224
|
-
onKeyDown:
|
|
247
|
+
tabIndex: e === C ? 0 : -1,
|
|
248
|
+
onKeyDown: ir(r.props.onKeyDown),
|
|
225
249
|
"aria-roledescription": "slide",
|
|
226
|
-
"aria-hidden": e !==
|
|
227
|
-
"aria-current": e ===
|
|
228
|
-
"aria-label": `${
|
|
250
|
+
"aria-hidden": e !== C,
|
|
251
|
+
"aria-current": e === C ? "page" : void 0,
|
|
252
|
+
"aria-label": `${c}개 중 ${e + 1}번째 슬라이드`,
|
|
229
253
|
"aria-posinset": e + 1,
|
|
230
|
-
"aria-setsize":
|
|
254
|
+
"aria-setsize": c,
|
|
231
255
|
...r.props
|
|
232
256
|
})
|
|
233
257
|
),
|
|
234
|
-
|
|
258
|
+
sr
|
|
235
259
|
]
|
|
236
260
|
}
|
|
237
261
|
),
|
|
238
|
-
typeof
|
|
262
|
+
typeof q == "function" && q({ page: C, totalPages: c, onChange: lr })
|
|
239
263
|
]
|
|
240
264
|
}
|
|
241
265
|
);
|
|
242
266
|
}
|
|
243
267
|
export {
|
|
244
|
-
|
|
268
|
+
Pr as default
|
|
245
269
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
|
-
import { ImageProps } from '../../../../shared/components/Image';
|
|
3
2
|
import { FlexboxProps } from 'node_modules/@dotss/ui/Flexbox/Flexbox';
|
|
3
|
+
import { ImageProps } from '../../../../shared/components/Image';
|
|
4
|
+
import { SwiperProps } from '../../../../shared/components/Swiper';
|
|
4
5
|
import { BannerProps } from '..';
|
|
5
6
|
export interface BannerAccountProps extends Omit<FlexboxProps, 'title' | 'id'> {
|
|
6
7
|
id: number;
|
|
@@ -9,6 +10,7 @@ export interface BannerAccountProps extends Omit<FlexboxProps, 'title' | 'id'> {
|
|
|
9
10
|
}>;
|
|
10
11
|
onClickBanner?: (url: string, bannerId: number, e: SyntheticEvent) => void;
|
|
11
12
|
imageProps?: Partial<ImageProps>;
|
|
13
|
+
swiperProps?: Partial<SwiperProps>;
|
|
12
14
|
}
|
|
13
|
-
declare function BannerAccount({ id, banners, onClickBanner, imageProps, ...props }: BannerAccountProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function BannerAccount({ id, banners, onClickBanner, imageProps, swiperProps, ...props }: BannerAccountProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
16
|
export default BannerAccount;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import n from "@dotss/ui/Flexbox";
|
|
3
|
-
import
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import
|
|
3
|
+
import f from "@dotss/ui/Typography";
|
|
4
|
+
import { useTheme as g } from "@emotion/react";
|
|
5
|
+
import S from "../../../../shared/components/Image/Image.mjs";
|
|
6
6
|
import "@dotss/ui";
|
|
7
7
|
import "@dotss/ui/core/useTheme";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
11
|
-
|
|
8
|
+
import w from "../../../../shared/components/Swiper/Swiper.mjs";
|
|
9
|
+
import y from "../../../../shared/components/Swiper/SwiperBlock/SwiperBlock.mjs";
|
|
10
|
+
function H({
|
|
11
|
+
id: a,
|
|
12
|
+
banners: l,
|
|
13
|
+
onClickBanner: o,
|
|
14
|
+
imageProps: d,
|
|
15
|
+
swiperProps: p,
|
|
16
|
+
...h
|
|
17
|
+
}) {
|
|
18
|
+
const { palette: m } = g(), s = (e, r) => (t) => {
|
|
12
19
|
o && typeof o == "function" && (t.stopPropagation(), t.preventDefault(), o(e, r, t));
|
|
13
|
-
},
|
|
20
|
+
}, u = ({ page: e, totalPages: r }) => r <= 1 ? null : /* @__PURE__ */ i(
|
|
14
21
|
n,
|
|
15
22
|
{
|
|
16
23
|
alignItems: "center",
|
|
@@ -26,10 +33,10 @@ function I({ id: a, banners: l, onClickBanner: o, imageProps: d, ...p }) {
|
|
|
26
33
|
minWidth: 36,
|
|
27
34
|
minHeight: 20,
|
|
28
35
|
borderRadius: 24,
|
|
29
|
-
backgroundColor:
|
|
36
|
+
backgroundColor: m.etc.dimmed02
|
|
30
37
|
},
|
|
31
38
|
children: /* @__PURE__ */ c(
|
|
32
|
-
|
|
39
|
+
f,
|
|
33
40
|
{
|
|
34
41
|
tag: "p",
|
|
35
42
|
variant: "c5R",
|
|
@@ -49,28 +56,29 @@ function I({ id: a, banners: l, onClickBanner: o, imageProps: d, ...p }) {
|
|
|
49
56
|
)
|
|
50
57
|
}
|
|
51
58
|
);
|
|
52
|
-
return /* @__PURE__ */ c(n, { inlineCSS: { width: "100%" }, ...
|
|
59
|
+
return /* @__PURE__ */ c(n, { inlineCSS: { width: "100%" }, ...h, children: [
|
|
53
60
|
/* @__PURE__ */ i(n, { id: `tictoccroc-banner-${a}`, visuallyHidden: !0, children: "배너" }),
|
|
54
61
|
/* @__PURE__ */ i(
|
|
55
|
-
|
|
62
|
+
w,
|
|
56
63
|
{
|
|
57
|
-
renderPagination:
|
|
64
|
+
renderPagination: u,
|
|
58
65
|
loop: !0,
|
|
59
66
|
inlineCSS: { borderRadius: 12, overflow: "hidden" },
|
|
60
67
|
"aria-describedby": `tictoccroc-banner-${a}`,
|
|
61
|
-
|
|
68
|
+
...p,
|
|
69
|
+
children: l.map(({ id: e, url: r, image: t }, b) => /* @__PURE__ */ i(y, { children: /* @__PURE__ */ i(
|
|
62
70
|
n,
|
|
63
71
|
{
|
|
64
72
|
tag: "a",
|
|
65
73
|
href: r,
|
|
66
74
|
draggable: !1,
|
|
67
|
-
onClick:
|
|
75
|
+
onClick: s(r, e),
|
|
68
76
|
inlineCSS: { width: "100%" },
|
|
69
77
|
children: /* @__PURE__ */ i(
|
|
70
|
-
|
|
78
|
+
S,
|
|
71
79
|
{
|
|
72
80
|
src: t || "",
|
|
73
|
-
alt: `배너 ${
|
|
81
|
+
alt: `배너 ${b + 1}`,
|
|
74
82
|
width: 328,
|
|
75
83
|
height: 100,
|
|
76
84
|
draggable: !1,
|
|
@@ -89,5 +97,5 @@ function I({ id: a, banners: l, onClickBanner: o, imageProps: d, ...p }) {
|
|
|
89
97
|
] });
|
|
90
98
|
}
|
|
91
99
|
export {
|
|
92
|
-
|
|
100
|
+
H as default
|
|
93
101
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotss/tictoccroc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"description": "Tictoccroc shared components, hooks, utils, and APIs for Dotss",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -90,13 +90,9 @@
|
|
|
90
90
|
"@storybook/addon-onboarding": "^9.0.4",
|
|
91
91
|
"@storybook/react-vite": "^9.0.4",
|
|
92
92
|
"@types/node": "^22.15.29",
|
|
93
|
-
"@types/react": "^19.1.6",
|
|
94
|
-
"@types/react-dom": "^19.1.5",
|
|
95
93
|
"@vitejs/plugin-react-swc": "^3.10.0",
|
|
96
94
|
"eslint-plugin-storybook": "^9.0.4",
|
|
97
95
|
"glob": "^10.4.2",
|
|
98
|
-
"react": "^19.0.0",
|
|
99
|
-
"react-dom": "^19.0.0",
|
|
100
96
|
"storybook": "^9.0.4",
|
|
101
97
|
"vite-plugin-dts": "^4.5.4",
|
|
102
98
|
"vitest": "^1.6.0"
|