@dotss/tictoccroc 0.0.2 → 0.0.4
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/LessonNotesSection-Bg1DHFxg.js +208 -0
- package/dist/index.mjs +102 -100
- package/dist/shared/components/Carousel/Carousel.mjs +87 -82
- package/dist/shared/components/Masonry/Masonry.mjs +172 -146
- package/dist/shared/components/Masonry/Masonry.utils.d.ts +5 -1
- package/dist/shared/components/Masonry/Masonry.utils.mjs +53 -52
- package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.d.ts +6 -1
- package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.mjs +117 -66
- package/dist/shared/components/MediaDialog/MediaBlock/MediaBlock.d.ts +9 -0
- package/dist/shared/components/MediaDialog/MediaBlock/MediaBlock.mjs +70 -0
- package/dist/shared/components/MediaDialog/MediaBlock/index.d.ts +2 -0
- package/dist/shared/components/MediaDialog/MediaBlock/index.mjs +4 -0
- package/dist/shared/components/MediaDialog/MediaDialog.d.ts +13 -0
- package/dist/shared/components/MediaDialog/MediaDialog.mjs +330 -0
- package/dist/shared/components/MediaDialog/MediaDialogContent/MediaDialogContent.d.ts +3 -0
- package/dist/shared/components/{ImageZoomDialog/ImageZoomDialogContent/ImageZoomDialogContent.mjs → MediaDialog/MediaDialogContent/MediaDialogContent.mjs} +2 -2
- package/dist/shared/components/MediaDialog/MediaDialogContent/index.d.ts +2 -0
- package/dist/shared/components/MediaDialog/MediaDialogContent/index.mjs +4 -0
- package/dist/shared/components/MediaDialog/MediaDialogFooter/MediaDialogFooter.d.ts +3 -0
- package/dist/shared/components/{ImageZoomDialog/ImageZoomDialogFooter/ImageZoomDialogFooter.mjs → MediaDialog/MediaDialogFooter/MediaDialogFooter.mjs} +1 -1
- package/dist/shared/components/MediaDialog/MediaDialogFooter/index.d.ts +2 -0
- package/dist/shared/components/MediaDialog/MediaDialogFooter/index.mjs +4 -0
- package/dist/shared/components/MediaDialog/MediaDialogToolbar/MediaDialogToolbar.d.ts +3 -0
- package/dist/shared/components/{ImageZoomDialog/ImageZoomDialogToolbar/ImageZoomDialogToolbar.mjs → MediaDialog/MediaDialogToolbar/MediaDialogToolbar.mjs} +6 -6
- package/dist/shared/components/MediaDialog/MediaDialogToolbar/index.d.ts +2 -0
- package/dist/shared/components/MediaDialog/MediaDialogToolbar/index.mjs +4 -0
- package/dist/shared/components/MediaDialog/index.d.ts +7 -0
- package/dist/shared/components/MediaDialog/index.mjs +12 -0
- package/dist/shared/components/Roller/Roller.d.ts +1 -1
- package/dist/shared/components/Roller/Roller.mjs +1 -1
- package/dist/shared/components/Roller/index.mjs +1 -1
- package/dist/shared/components/Scheduler/Scheduler.d.ts +2 -1
- package/dist/shared/components/Scheduler/Scheduler.mjs +224 -220
- package/dist/shared/components/Swiper/Swiper.mjs +54 -63
- package/dist/shared/components/index.d.ts +2 -2
- package/dist/shared/components/index.mjs +36 -34
- package/dist/teacher/profile/components/AbilityCollection/AbilityBadge/AbilityBadge.mjs +49 -47
- package/dist/teacher/profile/components/AbilityCollection/AbilityCollection.mjs +27 -28
- package/dist/teacher/profile/components/AbilityCollection/AbilityCollection.utils.mjs +2 -2
- package/dist/teacher/profile/components/ActivityGallery/ActivityGallery.mjs +52 -47
- package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.d.ts +3 -2
- package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs +33 -61
- package/dist/teacher/profile/components/AvailableScheduleSection/AvailableScheduleSection.mjs +38 -24
- package/dist/teacher/profile/components/CareerSection/CareerSection.d.ts +2 -2
- package/dist/teacher/profile/components/CareerSection/CareerSection.mjs +2 -2
- package/dist/teacher/profile/components/CertificationSection/CertificationSection.d.ts +2 -2
- package/dist/teacher/profile/components/CertificationSection/CertificationSection.mjs +2 -2
- package/dist/teacher/profile/components/EducationSection/EducationSection.d.ts +2 -2
- package/dist/teacher/profile/components/EducationSection/EducationSection.mjs +2 -2
- package/dist/teacher/profile/components/LessonNotesSection/LessonNotesSection.mjs +1 -1
- package/dist/teacher/profile/components/LessonNotesSection/index.mjs +1 -1
- package/dist/teacher/profile/components/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/LessonNotesSection-a2QNdQtj.js +0 -196
- package/dist/shared/components/ImageZoomDialog/ImageBlock/ImageBlock.d.ts +0 -8
- package/dist/shared/components/ImageZoomDialog/ImageBlock/ImageBlock.mjs +0 -36
- package/dist/shared/components/ImageZoomDialog/ImageBlock/index.d.ts +0 -2
- package/dist/shared/components/ImageZoomDialog/ImageBlock/index.mjs +0 -4
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialog.d.ts +0 -16
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialog.mjs +0 -323
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/ImageZoomDialogContent.d.ts +0 -3
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/index.d.ts +0 -2
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/index.mjs +0 -4
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/ImageZoomDialogFooter.d.ts +0 -3
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/index.d.ts +0 -2
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/index.mjs +0 -4
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/ImageZoomDialogToolbar.d.ts +0 -3
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/index.d.ts +0 -2
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/index.mjs +0 -4
- package/dist/shared/components/ImageZoomDialog/index.d.ts +0 -6
- package/dist/shared/components/ImageZoomDialog/index.mjs +0 -10
|
@@ -1,146 +1,163 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
import { findImageInChildren as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
function
|
|
9
|
-
children:
|
|
10
|
-
columnCount:
|
|
11
|
-
rowCount:
|
|
12
|
-
spacing:
|
|
13
|
-
edgeSpacing:
|
|
14
|
-
direction:
|
|
15
|
-
defaultContainerWidth:
|
|
16
|
-
defaultContainerHeight:
|
|
17
|
-
...
|
|
1
|
+
import { jsx as z } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as i, Children as S, isValidElement as j, useEffect as g, cloneElement as q } from "react";
|
|
3
|
+
import { Box as V, Flexbox as ct } from "@dotss/ui";
|
|
4
|
+
import lt from "@dotss/ui/core/useTheme";
|
|
5
|
+
import { findImageInChildren as x, getHorizontalLayoutRows as ft, getNextIndexHorizontalFromRows as pt, findNextFocusableElement as y } from "./Masonry.utils.mjs";
|
|
6
|
+
import $ from "./MasonryBlock/MasonryBlock.mjs";
|
|
7
|
+
import J from "../../../teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs";
|
|
8
|
+
function kt({
|
|
9
|
+
children: A,
|
|
10
|
+
columnCount: F = 2,
|
|
11
|
+
rowCount: B = 2,
|
|
12
|
+
spacing: s = 2,
|
|
13
|
+
edgeSpacing: d = 0,
|
|
14
|
+
direction: b = "vertical",
|
|
15
|
+
defaultContainerWidth: Q = 360,
|
|
16
|
+
defaultContainerHeight: Y = 0,
|
|
17
|
+
...a
|
|
18
18
|
}) {
|
|
19
|
-
const { spacing:
|
|
20
|
-
|
|
21
|
-
), [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
const { spacing: E } = lt(), [Z, _] = p(Q), [K, O] = p(Y), [H, tt] = p(0), k = 4 / 3, l = (Z - s) / F, f = b === "horizontal" ? (K - s) / B : l * k, o = i(null), u = i([]), R = i([]), T = i(!1), M = i(!0), W = i(0), C = i(0), m = i(0), [h, et] = p(
|
|
20
|
+
S.toArray(A).filter(j).filter((e) => e.type === $ || e.type === J)
|
|
21
|
+
), [N, rt] = p(
|
|
22
|
+
h.map((e) => {
|
|
23
|
+
var t;
|
|
24
|
+
return ((t = x(e.props.children)) == null ? void 0 : t.props.src) ?? "";
|
|
25
|
+
})
|
|
26
|
+
), [D, nt] = p(
|
|
27
|
+
h.map((e) => {
|
|
28
|
+
var t;
|
|
29
|
+
return {
|
|
30
|
+
src: ((t = x(e.props.children)) == null ? void 0 : t.props.src) ?? "",
|
|
31
|
+
width: e.props.width ?? l,
|
|
32
|
+
height: e.props.height ?? f
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
), P = h.length, U = (e) => {
|
|
36
|
+
var t, r;
|
|
37
|
+
T.current = !0, W.current = e.clientX - (((t = o.current) == null ? void 0 : t.offsetLeft) || 0), C.current = ((r = o.current) == null ? void 0 : r.scrollLeft) || 0;
|
|
38
|
+
}, X = (e) => {
|
|
39
|
+
T.current && (e.currentTarget.style.cursor = "grabbing", o.current && (o.current.scrollLeft = C.current - (e.clientX - o.current.offsetLeft - W.current)));
|
|
40
|
+
}, L = (e) => {
|
|
41
|
+
var r;
|
|
42
|
+
T.current = !1, C.current !== ((r = o.current) == null ? void 0 : r.scrollLeft) ? (e.currentTarget.style.cursor = "grab", M.current = !1, m.current && cancelAnimationFrame(m.current), m.current = requestAnimationFrame(() => {
|
|
43
|
+
M.current = !0;
|
|
44
|
+
})) : M.current = !0;
|
|
45
|
+
}, ot = (e) => (t) => {
|
|
46
|
+
t.stopPropagation();
|
|
47
|
+
let r = null;
|
|
48
|
+
switch (t.key) {
|
|
35
49
|
case "ArrowRight":
|
|
36
|
-
|
|
50
|
+
t.preventDefault(), r = y(t.currentTarget, "right", u.current);
|
|
37
51
|
break;
|
|
38
52
|
case "ArrowLeft":
|
|
39
|
-
|
|
53
|
+
t.preventDefault(), r = y(t.currentTarget, "left", u.current);
|
|
40
54
|
break;
|
|
41
55
|
case "ArrowDown":
|
|
42
|
-
|
|
56
|
+
t.preventDefault(), r = y(t.currentTarget, "down", u.current);
|
|
43
57
|
break;
|
|
44
58
|
case "ArrowUp":
|
|
45
|
-
|
|
59
|
+
t.preventDefault(), r = y(t.currentTarget, "up", u.current);
|
|
46
60
|
break;
|
|
47
61
|
case "Enter":
|
|
48
62
|
case " ": {
|
|
49
|
-
|
|
63
|
+
t.preventDefault(), t.currentTarget.click();
|
|
50
64
|
return;
|
|
51
65
|
}
|
|
52
66
|
default:
|
|
53
67
|
return;
|
|
54
68
|
}
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
if (
|
|
58
|
-
|
|
69
|
+
r == null || r.focus(), e == null || e(t);
|
|
70
|
+
}, st = (e) => (t) => {
|
|
71
|
+
if (t.stopPropagation(), t.key === "Enter" || t.key === " ") {
|
|
72
|
+
t.preventDefault(), t.currentTarget.click();
|
|
59
73
|
return;
|
|
60
74
|
}
|
|
61
|
-
const
|
|
75
|
+
const r = Number(t.currentTarget.getAttribute("aria-posinset")) - 1, n = t.key.replace("Arrow", "").toLowerCase();
|
|
62
76
|
if (!["left", "right", "up", "down"].includes(n)) {
|
|
63
|
-
|
|
77
|
+
e == null || e(t);
|
|
64
78
|
return;
|
|
65
79
|
}
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
t.preventDefault();
|
|
81
|
+
const v = pt(
|
|
82
|
+
R.current,
|
|
83
|
+
r,
|
|
70
84
|
n
|
|
71
|
-
),
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
85
|
+
), w = u.current[v ?? -1];
|
|
86
|
+
w == null || w.focus(), e == null || e(t);
|
|
87
|
+
}, at = (e) => (t) => {
|
|
88
|
+
u.current[e] = t;
|
|
89
|
+
}, it = (e, t, r) => (n) => {
|
|
90
|
+
R.current[t] || (R.current[t] = []), u.current[e] = n, R.current[t][r] = n;
|
|
91
|
+
}, G = (e) => (t) => {
|
|
92
|
+
tt(Number(t.currentTarget.getAttribute("aria-posinset")) - 1), e == null || e(t);
|
|
79
93
|
};
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
|
|
94
|
+
if (g(() => {
|
|
95
|
+
const e = o.current, t = (r) => {
|
|
96
|
+
M.current || r.stopPropagation();
|
|
83
97
|
};
|
|
84
|
-
return
|
|
85
|
-
|
|
98
|
+
return e == null || e.addEventListener("click", t), () => {
|
|
99
|
+
e == null || e.removeEventListener("click", t);
|
|
86
100
|
};
|
|
87
|
-
}, []),
|
|
88
|
-
const
|
|
89
|
-
|
|
101
|
+
}, []), g(() => {
|
|
102
|
+
const e = o.current, t = (r) => {
|
|
103
|
+
r.stopPropagation();
|
|
90
104
|
};
|
|
91
|
-
return
|
|
92
|
-
|
|
105
|
+
return e == null || e.addEventListener("touchmove", t), () => {
|
|
106
|
+
e == null || e.removeEventListener("touchmove", t);
|
|
93
107
|
};
|
|
94
|
-
}, []),
|
|
95
|
-
const
|
|
108
|
+
}, []), g(() => {
|
|
109
|
+
const e = S.toArray(A).filter(j).filter((r) => r.type === $ || r.type === J), t = e.map((r) => {
|
|
96
110
|
var n;
|
|
97
|
-
return ((n =
|
|
111
|
+
return ((n = x(r.props.children)) == null ? void 0 : n.props.src) ?? "";
|
|
98
112
|
}).filter(Boolean);
|
|
99
|
-
|
|
100
|
-
}, [
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}) : a)
|
|
110
|
-
), e.onload = null;
|
|
111
|
-
}, e.onerror = () => {
|
|
112
|
-
e.onload = null;
|
|
113
|
+
et(e), rt(t);
|
|
114
|
+
}, [A]), g(() => {
|
|
115
|
+
f <= 0 || N.forEach((e) => {
|
|
116
|
+
const t = new window.Image();
|
|
117
|
+
t.src = e, t.onload = () => {
|
|
118
|
+
nt(
|
|
119
|
+
(r) => r.map((n) => (n.src === e && (n.width = t.width / t.height * (n.height ?? f), n.height = n.height ?? f), n))
|
|
120
|
+
), t.onload = null;
|
|
121
|
+
}, t.onerror = () => {
|
|
122
|
+
t.onload = null;
|
|
113
123
|
};
|
|
114
124
|
});
|
|
115
|
-
}, [
|
|
116
|
-
const
|
|
117
|
-
var
|
|
118
|
-
|
|
125
|
+
}, [N, f]), g(() => {
|
|
126
|
+
const e = () => {
|
|
127
|
+
var t, r, n;
|
|
128
|
+
_(((r = (t = o.current) == null ? void 0 : t.parentElement) == null ? void 0 : r.offsetWidth) ?? 0), O(((n = o.current) == null ? void 0 : n.offsetHeight) ?? 0);
|
|
119
129
|
};
|
|
120
|
-
return
|
|
121
|
-
window.removeEventListener("resize",
|
|
130
|
+
return e(), window.addEventListener("resize", e), () => {
|
|
131
|
+
window.removeEventListener("resize", e);
|
|
122
132
|
};
|
|
123
|
-
}, []),
|
|
124
|
-
|
|
125
|
-
}, []),
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
}, []), g(() => () => {
|
|
134
|
+
m.current && cancelAnimationFrame(m.current);
|
|
135
|
+
}, []), b === "horizontal") {
|
|
136
|
+
const e = ft(
|
|
137
|
+
D,
|
|
138
|
+
h,
|
|
139
|
+
B,
|
|
140
|
+
l * k / 2
|
|
141
|
+
);
|
|
142
|
+
let t = l * k / 2;
|
|
143
|
+
t = t <= 0 ? 120 : t;
|
|
144
|
+
let r = 0;
|
|
145
|
+
return /* @__PURE__ */ z(
|
|
146
|
+
V,
|
|
132
147
|
{
|
|
133
148
|
ref: o,
|
|
134
149
|
role: "list",
|
|
135
150
|
"aria-label": "콘텐츠",
|
|
136
151
|
"aria-orientation": "horizontal",
|
|
137
|
-
onMouseDown:
|
|
138
|
-
onMouseMove:
|
|
152
|
+
onMouseDown: U,
|
|
153
|
+
onMouseMove: X,
|
|
139
154
|
onMouseUp: L,
|
|
140
155
|
onMouseLeave: L,
|
|
141
|
-
pl:
|
|
142
|
-
pr:
|
|
156
|
+
pl: d,
|
|
157
|
+
pr: d,
|
|
158
|
+
...a,
|
|
143
159
|
inlineCSS: {
|
|
160
|
+
display: "grid",
|
|
144
161
|
position: "relative",
|
|
145
162
|
width: "100%",
|
|
146
163
|
height: "100%",
|
|
@@ -151,70 +168,79 @@ function wt({
|
|
|
151
168
|
"&::-webkit-scrollbar": {
|
|
152
169
|
display: "none"
|
|
153
170
|
},
|
|
154
|
-
...
|
|
171
|
+
...a == null ? void 0 : a.inlineCSS
|
|
155
172
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
children: e.map((n, v) => {
|
|
174
|
+
const w = v === e.length - 1;
|
|
175
|
+
return /* @__PURE__ */ z(ct, { gap: s, children: n.map((c, ut) => {
|
|
176
|
+
const I = r++;
|
|
177
|
+
return q(c, {
|
|
178
|
+
setInnerRef: it(I, v, ut),
|
|
179
|
+
tabIndex: I === H ? 0 : -1,
|
|
180
|
+
role: "listitem",
|
|
181
|
+
"aria-posinset": I + 1,
|
|
182
|
+
"aria-setsize": P,
|
|
183
|
+
width: c.props.width ?? t,
|
|
184
|
+
height: c.props.height ?? f,
|
|
185
|
+
direction: b,
|
|
186
|
+
spacing: s,
|
|
187
|
+
sourceMetadata: D,
|
|
188
|
+
onKeyDown: st(c.props.onKeyDown),
|
|
189
|
+
onFocus: G(c.props.onFocus),
|
|
190
|
+
style: {
|
|
191
|
+
marginBottom: w ? 0 : E.content(s),
|
|
192
|
+
...c.props.style
|
|
193
|
+
},
|
|
194
|
+
...c.props
|
|
195
|
+
});
|
|
196
|
+
}) }, `masonry-row-${v}`);
|
|
197
|
+
})
|
|
174
198
|
}
|
|
175
199
|
);
|
|
176
200
|
}
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
|
|
201
|
+
return /* @__PURE__ */ z(
|
|
202
|
+
V,
|
|
179
203
|
{
|
|
180
204
|
ref: o,
|
|
181
205
|
role: "list",
|
|
182
206
|
"aria-label": "콘텐츠",
|
|
183
207
|
"aria-orientation": "vertical",
|
|
184
|
-
onMouseDown:
|
|
185
|
-
onMouseMove:
|
|
208
|
+
onMouseDown: U,
|
|
209
|
+
onMouseMove: X,
|
|
186
210
|
onMouseUp: L,
|
|
187
211
|
onMouseLeave: L,
|
|
188
|
-
pt:
|
|
189
|
-
pb:
|
|
212
|
+
pt: d,
|
|
213
|
+
pb: d,
|
|
214
|
+
...a,
|
|
190
215
|
inlineCSS: {
|
|
191
216
|
width: "100%",
|
|
192
217
|
position: "relative",
|
|
193
|
-
columnCount:
|
|
194
|
-
columnGap:
|
|
195
|
-
|
|
218
|
+
columnCount: F,
|
|
219
|
+
columnGap: E.content(s),
|
|
220
|
+
marginTop: -E.content(s),
|
|
221
|
+
...a == null ? void 0 : a.inlineCSS
|
|
196
222
|
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
setInnerRef: et(r),
|
|
223
|
+
children: S.map(
|
|
224
|
+
h,
|
|
225
|
+
(e, t) => q(e, {
|
|
226
|
+
setInnerRef: at(t),
|
|
202
227
|
role: "listitem",
|
|
203
|
-
tabIndex:
|
|
204
|
-
"aria-posinset":
|
|
205
|
-
"aria-setsize":
|
|
206
|
-
width:
|
|
207
|
-
height:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
228
|
+
tabIndex: t === H ? 0 : -1,
|
|
229
|
+
"aria-posinset": t + 1,
|
|
230
|
+
"aria-setsize": P,
|
|
231
|
+
width: e.props.width ?? l,
|
|
232
|
+
height: e.props.height ?? l * k / 2,
|
|
233
|
+
direction: b,
|
|
234
|
+
spacing: s,
|
|
235
|
+
sourceMetadata: D,
|
|
236
|
+
onKeyDown: ot(e.props.onKeyDown),
|
|
237
|
+
onFocus: G(e.props.onFocus),
|
|
238
|
+
...e.props
|
|
213
239
|
})
|
|
214
240
|
)
|
|
215
241
|
}
|
|
216
242
|
);
|
|
217
243
|
}
|
|
218
244
|
export {
|
|
219
|
-
|
|
245
|
+
kt as default
|
|
220
246
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { ImageProps } from '../Image';
|
|
3
3
|
import { MasonryBlockProps } from './MasonryBlock';
|
|
4
|
-
export declare function getHorizontalLayoutRows(
|
|
4
|
+
export declare function getHorizontalLayoutRows(images: {
|
|
5
|
+
src: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}[], blocks: ReactElement<MasonryBlockProps>[], rowCount: number, fallbackWidth: number): ReactElement<MasonryBlockProps, string | import('react').JSXElementConstructor<any>>[][];
|
|
5
9
|
export declare function findNextFocusableElement(currentElement: HTMLDivElement, keyDirection: 'left' | 'right' | 'up' | 'down', candidates: (HTMLDivElement | null)[]): HTMLDivElement | null;
|
|
6
10
|
export declare function getNextIndexHorizontalFromRows(rows: HTMLDivElement[][], currentIndex: number, keyDirection: 'up' | 'down' | 'left' | 'right'): number | null;
|
|
7
11
|
export declare function findImageInChildren(children: ReactNode): ReactElement<ImageProps> | null;
|
|
@@ -1,76 +1,77 @@
|
|
|
1
1
|
import { Children as M, isValidElement as y } from "react";
|
|
2
2
|
import E from "../Image/Image.mjs";
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
function B(n, c, e, s) {
|
|
4
|
+
const t = Array.from({ length: e }, () => []), o = Array(e).fill(0);
|
|
5
|
+
return c.forEach((h) => {
|
|
6
|
+
var g;
|
|
7
|
+
const a = ((g = I(h.props.children)) == null ? void 0 : g.props.src) ?? "", u = n.find((m) => m.src === a), l = o.indexOf(Math.min(...o));
|
|
8
|
+
t[l].push(h), o[l] += (u == null ? void 0 : u.width) ?? s;
|
|
9
|
+
}), t;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
let
|
|
11
|
+
function w(n, c, e) {
|
|
12
|
+
const s = n.getBoundingClientRect(), t = (s.left + s.right) / 2, o = (s.top + s.bottom) / 2;
|
|
13
|
+
let h = null, a = 1 / 0;
|
|
13
14
|
for (const u of e) {
|
|
14
15
|
if (!u || u === n) continue;
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const l = u.getBoundingClientRect(), g = (l.left + l.right) / 2, m = (l.top + l.bottom) / 2, d = g - t, r = m - o, i = Math.abs(r) < l.height * 0.75, f = Math.abs(d) < l.width * 0.75, p = c === "right" && d > 0 && i || c === "left" && d < 0 && i || c === "down" && r > 0 && f || c === "up" && r < 0 && f, b = Math.hypot(d, r);
|
|
17
|
+
p && b < a && (a = b, h = u);
|
|
17
18
|
}
|
|
18
|
-
return
|
|
19
|
+
return h;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
if (!n.length ||
|
|
23
|
-
const
|
|
24
|
-
let t = -1,
|
|
25
|
-
for (let
|
|
26
|
-
for (let
|
|
27
|
-
const f = n[
|
|
28
|
-
if (Number(f == null ? void 0 : f.getAttribute("aria-posinset")) - 1 ===
|
|
29
|
-
t =
|
|
21
|
+
function x(n, c, e) {
|
|
22
|
+
var l, g, m, d;
|
|
23
|
+
if (!n.length || c < 0) return null;
|
|
24
|
+
const s = n.length;
|
|
25
|
+
let t = -1, o = -1;
|
|
26
|
+
for (let r = 0; r < s; r++) {
|
|
27
|
+
for (let i = 0; i < n[r].length; i++) {
|
|
28
|
+
const f = n[r][i];
|
|
29
|
+
if (Number(f == null ? void 0 : f.getAttribute("aria-posinset")) - 1 === c) {
|
|
30
|
+
t = r, o = i;
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
if (t !== -1) break;
|
|
34
35
|
}
|
|
35
|
-
if (t === -1 ||
|
|
36
|
-
const
|
|
37
|
-
if (e === "left" &&
|
|
38
|
-
return Number((
|
|
39
|
-
if (e === "right" &&
|
|
40
|
-
return Number((
|
|
36
|
+
if (t === -1 || o === -1) return null;
|
|
37
|
+
const a = n[t][o].getBoundingClientRect(), u = (a.left + a.right) / 2;
|
|
38
|
+
if (e === "left" && o > 0)
|
|
39
|
+
return Number((l = n[t][o - 1]) == null ? void 0 : l.getAttribute("aria-posinset")) - 1;
|
|
40
|
+
if (e === "right" && o < n[t].length - 1)
|
|
41
|
+
return Number((g = n[t][o + 1]) == null ? void 0 : g.getAttribute("aria-posinset")) - 1;
|
|
41
42
|
if (e === "up" && t > 0) {
|
|
42
|
-
const
|
|
43
|
-
let
|
|
44
|
-
return
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
}), Number((
|
|
43
|
+
const r = n[t - 1];
|
|
44
|
+
let i = 0, f = 1 / 0;
|
|
45
|
+
return r.forEach((p, b) => {
|
|
46
|
+
const R = p.getBoundingClientRect(), A = (R.left + R.right) / 2, C = Math.abs(u - A);
|
|
47
|
+
C < f && (f = C, i = b);
|
|
48
|
+
}), Number((m = r[i]) == null ? void 0 : m.getAttribute("aria-posinset")) - 1;
|
|
48
49
|
}
|
|
49
|
-
if (e === "down" && t <
|
|
50
|
-
const
|
|
51
|
-
let
|
|
52
|
-
return
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
}), Number((
|
|
50
|
+
if (e === "down" && t < s - 1) {
|
|
51
|
+
const r = n[t + 1];
|
|
52
|
+
let i = 0, f = 1 / 0;
|
|
53
|
+
return r.forEach((p, b) => {
|
|
54
|
+
const R = p.getBoundingClientRect(), A = (R.left + R.right) / 2, C = Math.abs(u - A);
|
|
55
|
+
C < f && (f = C, i = b);
|
|
56
|
+
}), Number((d = r[i]) == null ? void 0 : d.getAttribute("aria-posinset")) - 1;
|
|
56
57
|
}
|
|
57
58
|
return null;
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
60
|
+
function I(n) {
|
|
61
|
+
const c = M.toArray(n).filter(y).find((e) => e.type === E || e.type === "img");
|
|
62
|
+
if (c)
|
|
63
|
+
return c;
|
|
63
64
|
for (const e of M.toArray(n))
|
|
64
65
|
if (y(e) && e.props && e.props.children) {
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
66
|
+
const s = M.toArray(e.props.children).filter(y).find((t) => t.type === E || t.type === "img");
|
|
67
|
+
if (s)
|
|
68
|
+
return s;
|
|
68
69
|
}
|
|
69
70
|
return null;
|
|
70
71
|
}
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
I as findImageInChildren,
|
|
74
|
+
w as findNextFocusableElement,
|
|
75
|
+
B as getHorizontalLayoutRows,
|
|
76
|
+
x as getNextIndexHorizontalFromRows
|
|
76
77
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { FlexboxProps } from 'node_modules/@dotss/ui/Flexbox/Flexbox';
|
|
2
2
|
export interface MasonryBlockProps extends FlexboxProps {
|
|
3
|
-
spacing?: number;
|
|
4
3
|
width?: number;
|
|
5
4
|
height?: number;
|
|
5
|
+
spacing?: number;
|
|
6
6
|
borderRadius?: number | string;
|
|
7
7
|
direction?: 'horizontal' | 'vertical';
|
|
8
|
+
sourceMetadata?: {
|
|
9
|
+
src: string;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}[];
|
|
8
13
|
setInnerRef?: (ref: HTMLDivElement | null) => void;
|
|
9
14
|
}
|
|
10
15
|
declare const MasonryBlock: import('react').ForwardRefExoticComponent<Omit<MasonryBlockProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|