@dotss/tictoccroc 0.0.2 → 0.0.3
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 +157 -139
- 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 +5 -0
- package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.mjs +93 -59
- 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 +327 -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/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/ScheduleEvent/ScheduleEvent.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 +53 -62
- 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
- /package/dist/shared/components/{ImageZoomDialog/ImageZoomDialogFooter/ImageZoomDialogFooter.mjs → MediaDialog/MediaDialogFooter/MediaDialogFooter.mjs} +0 -0
|
@@ -1,134 +1,149 @@
|
|
|
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 T } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as i, Children as x, isValidElement as G, useEffect as g, cloneElement as j } from "react";
|
|
3
|
+
import { Box as q, Flexbox as ct } from "@dotss/ui";
|
|
4
|
+
import ut from "@dotss/ui/core/useTheme";
|
|
5
|
+
import { findImageInChildren as z, getHorizontalLayoutRows as lt, getNextIndexHorizontalFromRows as ft, findNextFocusableElement as L } from "./Masonry.utils.mjs";
|
|
6
|
+
import V from "./MasonryBlock/MasonryBlock.mjs";
|
|
7
|
+
import $ from "../../../teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs";
|
|
8
|
+
function bt({
|
|
9
|
+
children: y,
|
|
10
|
+
columnCount: S = 2,
|
|
11
|
+
rowCount: F = 2,
|
|
12
|
+
spacing: u = 2,
|
|
13
|
+
edgeSpacing: d = 0,
|
|
14
|
+
direction: v = "vertical",
|
|
15
|
+
defaultContainerWidth: J = 360,
|
|
16
|
+
defaultContainerHeight: Q = 0,
|
|
17
|
+
...a
|
|
18
18
|
}) {
|
|
19
|
-
const { spacing:
|
|
20
|
-
|
|
21
|
-
), [W,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
const { spacing: A } = ut(), [Y, Z] = p(J), [_, K] = p(Q), [H, O] = p(0), w = 4 / 3, l = (Y - u) / S, f = v === "horizontal" ? (_ - u) / F : l * w, o = i(null), c = i([]), b = i([]), E = i(!1), k = i(!0), B = i(0), I = i(0), m = i(0), [h, tt] = p(
|
|
20
|
+
x.toArray(y).filter(G).filter((e) => e.type === V || e.type === $)
|
|
21
|
+
), [W, et] = p(
|
|
22
|
+
h.map((e) => {
|
|
23
|
+
var t;
|
|
24
|
+
return ((t = z(e.props.children)) == null ? void 0 : t.props.src) ?? "";
|
|
25
|
+
})
|
|
26
|
+
), [C, rt] = p(
|
|
27
|
+
h.map((e) => {
|
|
28
|
+
var t;
|
|
29
|
+
return {
|
|
30
|
+
src: ((t = z(e.props.children)) == null ? void 0 : t.props.src) ?? "",
|
|
31
|
+
width: e.props.width ?? l,
|
|
32
|
+
height: e.props.height ?? f
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
), N = h.length, P = (e) => {
|
|
36
|
+
var t, r;
|
|
37
|
+
E.current = !0, B.current = e.clientX - (((t = o.current) == null ? void 0 : t.offsetLeft) || 0), I.current = ((r = o.current) == null ? void 0 : r.scrollLeft) || 0;
|
|
38
|
+
}, U = (e) => {
|
|
39
|
+
E.current && (e.currentTarget.style.cursor = "grabbing", o.current && (o.current.scrollLeft = I.current - (e.clientX - o.current.offsetLeft - B.current)));
|
|
40
|
+
}, M = (e) => {
|
|
41
|
+
var r;
|
|
42
|
+
E.current = !1, I.current !== ((r = o.current) == null ? void 0 : r.scrollLeft) ? (e.currentTarget.style.cursor = "grab", k.current = !1, m.current && cancelAnimationFrame(m.current), m.current = requestAnimationFrame(() => {
|
|
43
|
+
k.current = !0;
|
|
44
|
+
})) : k.current = !0;
|
|
45
|
+
}, nt = (e) => (t) => {
|
|
46
|
+
t.stopPropagation();
|
|
47
|
+
let r = null;
|
|
48
|
+
switch (t.key) {
|
|
35
49
|
case "ArrowRight":
|
|
36
|
-
|
|
50
|
+
t.preventDefault(), r = L(t.currentTarget, "right", c.current);
|
|
37
51
|
break;
|
|
38
52
|
case "ArrowLeft":
|
|
39
|
-
|
|
53
|
+
t.preventDefault(), r = L(t.currentTarget, "left", c.current);
|
|
40
54
|
break;
|
|
41
55
|
case "ArrowDown":
|
|
42
|
-
|
|
56
|
+
t.preventDefault(), r = L(t.currentTarget, "down", c.current);
|
|
43
57
|
break;
|
|
44
58
|
case "ArrowUp":
|
|
45
|
-
|
|
59
|
+
t.preventDefault(), r = L(t.currentTarget, "up", c.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
|
+
}, ot = (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
|
|
80
|
+
t.preventDefault();
|
|
81
|
+
const R = ft(
|
|
68
82
|
b.current,
|
|
69
|
-
|
|
83
|
+
r,
|
|
70
84
|
n
|
|
71
|
-
), s =
|
|
72
|
-
s == null || s.focus(),
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
b.current[
|
|
77
|
-
}, X = (
|
|
78
|
-
|
|
85
|
+
), s = c.current[R ?? -1];
|
|
86
|
+
s == null || s.focus(), e == null || e(t);
|
|
87
|
+
}, st = (e) => (t) => {
|
|
88
|
+
c.current[e] = t;
|
|
89
|
+
}, at = (e, t, r) => (n) => {
|
|
90
|
+
b.current[t] || (b.current[t] = []), c.current[e] = n, b.current[t][r] = n;
|
|
91
|
+
}, X = (e) => (t) => {
|
|
92
|
+
O(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
|
+
k.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 = x.toArray(y).filter(G).filter((r) => r.type === V || r.type === $), t = e.map((r) => {
|
|
96
110
|
var n;
|
|
97
|
-
return ((n =
|
|
111
|
+
return ((n = z(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
|
+
tt(e), et(t);
|
|
114
|
+
}, [y]), g(() => {
|
|
115
|
+
f <= 0 || W.forEach((e) => {
|
|
116
|
+
const t = new window.Image();
|
|
117
|
+
t.src = e, t.onload = () => {
|
|
118
|
+
rt(
|
|
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
|
+
}, [W, f]), g(() => {
|
|
126
|
+
const e = () => {
|
|
127
|
+
var t, r, n;
|
|
128
|
+
Z(((r = (t = o.current) == null ? void 0 : t.parentElement) == null ? void 0 : r.offsetWidth) ?? 0), K(((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
|
+
}, []), v === "horizontal") {
|
|
136
|
+
const e = lt(
|
|
137
|
+
C,
|
|
138
|
+
h,
|
|
139
|
+
F,
|
|
140
|
+
l * w / 2
|
|
141
|
+
);
|
|
142
|
+
let t = l * w / 2;
|
|
143
|
+
t = t <= 0 ? 120 : t;
|
|
144
|
+
let r = 0;
|
|
145
|
+
return /* @__PURE__ */ T(
|
|
146
|
+
q,
|
|
132
147
|
{
|
|
133
148
|
ref: o,
|
|
134
149
|
role: "list",
|
|
@@ -136,11 +151,13 @@ function wt({
|
|
|
136
151
|
"aria-orientation": "horizontal",
|
|
137
152
|
onMouseDown: P,
|
|
138
153
|
onMouseMove: U,
|
|
139
|
-
onMouseUp:
|
|
140
|
-
onMouseLeave:
|
|
141
|
-
pl:
|
|
142
|
-
pr:
|
|
154
|
+
onMouseUp: M,
|
|
155
|
+
onMouseLeave: M,
|
|
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,31 +168,31 @@ 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
|
-
tabIndex: C === F ? 0 : -1,
|
|
173
|
+
children: e.map((n, R) => /* @__PURE__ */ T(ct, { gap: u, children: n.map((s, it) => {
|
|
174
|
+
const D = r++;
|
|
175
|
+
return j(s, {
|
|
176
|
+
setInnerRef: at(D, R, it),
|
|
177
|
+
tabIndex: D === H ? 0 : -1,
|
|
162
178
|
role: "listitem",
|
|
163
|
-
"aria-posinset":
|
|
179
|
+
"aria-posinset": D + 1,
|
|
164
180
|
"aria-setsize": N,
|
|
165
|
-
width: s.props.width ??
|
|
166
|
-
height: s.props.height ??
|
|
167
|
-
spacing:
|
|
168
|
-
direction:
|
|
169
|
-
|
|
181
|
+
width: s.props.width ?? t,
|
|
182
|
+
height: s.props.height ?? f,
|
|
183
|
+
spacing: A.content(u),
|
|
184
|
+
direction: v,
|
|
185
|
+
sourceMetadata: C,
|
|
186
|
+
onKeyDown: ot(s.props.onKeyDown),
|
|
170
187
|
onFocus: X(s.props.onFocus),
|
|
171
188
|
...s.props
|
|
172
189
|
});
|
|
173
|
-
}) }, `masonry-row-${
|
|
190
|
+
}) }, `masonry-row-${R}`))
|
|
174
191
|
}
|
|
175
192
|
);
|
|
176
193
|
}
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
|
|
194
|
+
return /* @__PURE__ */ T(
|
|
195
|
+
q,
|
|
179
196
|
{
|
|
180
197
|
ref: o,
|
|
181
198
|
role: "list",
|
|
@@ -183,38 +200,39 @@ function wt({
|
|
|
183
200
|
"aria-orientation": "vertical",
|
|
184
201
|
onMouseDown: P,
|
|
185
202
|
onMouseMove: U,
|
|
186
|
-
onMouseUp:
|
|
187
|
-
onMouseLeave:
|
|
188
|
-
pt:
|
|
189
|
-
pb:
|
|
203
|
+
onMouseUp: M,
|
|
204
|
+
onMouseLeave: M,
|
|
205
|
+
pt: d,
|
|
206
|
+
pb: d,
|
|
207
|
+
...a,
|
|
190
208
|
inlineCSS: {
|
|
191
209
|
width: "100%",
|
|
192
210
|
position: "relative",
|
|
193
|
-
columnCount:
|
|
194
|
-
columnGap:
|
|
195
|
-
...
|
|
211
|
+
columnCount: S,
|
|
212
|
+
columnGap: A.content(u),
|
|
213
|
+
...a == null ? void 0 : a.inlineCSS
|
|
196
214
|
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
setInnerRef: et(r),
|
|
215
|
+
children: x.map(
|
|
216
|
+
h,
|
|
217
|
+
(e, t) => j(e, {
|
|
218
|
+
setInnerRef: st(t),
|
|
202
219
|
role: "listitem",
|
|
203
|
-
tabIndex:
|
|
204
|
-
"aria-posinset":
|
|
220
|
+
tabIndex: t === H ? 0 : -1,
|
|
221
|
+
"aria-posinset": t + 1,
|
|
205
222
|
"aria-setsize": N,
|
|
206
|
-
width:
|
|
207
|
-
height:
|
|
208
|
-
spacing:
|
|
209
|
-
direction:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
223
|
+
width: e.props.width ?? l,
|
|
224
|
+
height: e.props.height ?? l * w / 2,
|
|
225
|
+
spacing: A.content(u),
|
|
226
|
+
direction: v,
|
|
227
|
+
sourceMetadata: C,
|
|
228
|
+
onKeyDown: nt(e.props.onKeyDown),
|
|
229
|
+
onFocus: X(e.props.onFocus),
|
|
230
|
+
...e.props
|
|
213
231
|
})
|
|
214
232
|
)
|
|
215
233
|
}
|
|
216
234
|
);
|
|
217
235
|
}
|
|
218
236
|
export {
|
|
219
|
-
|
|
237
|
+
bt as default
|
|
220
238
|
};
|
|
@@ -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
|
};
|
|
@@ -5,6 +5,11 @@ export interface MasonryBlockProps extends FlexboxProps {
|
|
|
5
5
|
height?: 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>>;
|