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