@dotss/tictoccroc 0.0.34 → 0.0.36

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.
@@ -1,6 +1,6 @@
1
1
  import { FlexboxProps } from 'node_modules/@dotss/ui/Flexbox/Flexbox';
2
2
  export type BotMessageType = 'MATCHING_SUCCEEDED' | 'TEACHER_INQUIRED' | 'PARENT_CHANGED_OFFER_SCHEDULE' | 'PARENT_CHANGED_MATCHING_SCHEDULE' | 'TEACHER_APPLIED' | 'PARENT_SENT_OFFER' | 'KOK_MATCHING_SUCCEEDED' | 'APPLICATION_MATCHING_SUCCEEDED' | 'ASSIGNMENT_MATCHING_SUCCEEDED' | 'PARENT_REJECTED_APPLICATION' | 'TEACHER_REFUSED_OFFER' | 'PARENT_CANCELED_MATCHING' | 'TEACHER_CANCELED_MATCHING' | 'TEACHER_COMPLETED_CARE' | 'ADMIN_CANCELED_MATCHING';
3
- export type BotMessageCtaType = 'MY_CLASS_CHECK' | 'OFFER_CHECK' | 'CHANGE_INFO_CHECK' | 'MY_APPLICATION_INFO_VIEW' | 'CARE_NOTE_CHECK' | 'TEACHER_SELECTION';
3
+ export type BotMessageCtaType = 'MY_CLASS_CHECK' | 'OFFER_CHECK' | 'CHANGE_INFO_CHECK' | 'MY_APPLICATION_INFO_VIEW' | 'CARE_NOTE_CHECK' | 'TEACHER_SELECTION' | 'PLAY_CONTENT_EXPLORE';
4
4
  export type BotMessageCtaTargetTable = 'OFFER' | 'MATCHING';
5
5
  export type BotMessageSubCtaTargetTable = 'OFFER' | 'MATCHING';
6
6
  export interface BotMessageOffer {
@@ -2,11 +2,11 @@ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
2
  import { useRef as F, useEffect as L } from "react";
3
3
  import { Flexbox as n, Typography as e, Button as $ } from "@dotss/ui";
4
4
  import q from "@dotss/ui/core/useTheme";
5
- import z from "dayjs";
6
- import { getClassInfo as G, getCtaButtonText as J } from "./BotMessage.utils.mjs";
7
- import K from "../../Image/Image.mjs";
8
- import N from "../../../hooks/useInView/useInView.mjs";
5
+ import { getClassInfo as z, getCtaButtonText as G } from "./BotMessage.utils.mjs";
6
+ import J from "../../Image/Image.mjs";
7
+ import K from "../../../hooks/useInView/useInView.mjs";
9
8
  import S from "../../../utils/getCareTypeLabel/getCareTypeLabel.mjs";
9
+ import N from "dayjs";
10
10
  function V({
11
11
  id: P,
12
12
  botMessageType: y,
@@ -30,10 +30,10 @@ function V({
30
30
  const {
31
31
  palette: { brand: D, grey: m, background: k },
32
32
  spacing: d
33
- } = q(), f = F(null), { isInView: u } = N(f), x = J(s), i = w, H = [
33
+ } = q(), f = F(null), { isInView: u } = K(f), x = G(s), i = w, H = [
34
34
  S(i == null ? void 0 : i.firstCareType),
35
35
  S(i == null ? void 0 : i.secondCareType)
36
- ].filter(Boolean).filter((E) => E !== "-").join("+"), c = G(i), M = () => o == null ? void 0 : o({
36
+ ].filter(Boolean).filter((E) => E !== "-").join("+"), c = z(i), M = () => o == null ? void 0 : o({
37
37
  botMessageType: y,
38
38
  ctaType: s,
39
39
  ctaTargetId: C,
@@ -91,7 +91,7 @@ function V({
91
91
  inlineCSS: {
92
92
  whiteSpace: "nowrap"
93
93
  },
94
- children: z(I).format("A h:mm")
94
+ children: N(I).format("A h:mm")
95
95
  }
96
96
  )
97
97
  ]
@@ -112,7 +112,7 @@ function V({
112
112
  },
113
113
  children: [
114
114
  g && /* @__PURE__ */ r(
115
- K,
115
+ J,
116
116
  {
117
117
  src: g,
118
118
  width: 32,
@@ -1,5 +1,5 @@
1
1
  import { BotMessageCtaType, BotMessageProps } from '.';
2
- export declare function getCtaButtonText(ctaType?: BotMessageCtaType | null): "" | "내 수업 확인하기" | "공고 확인하기" | "변경내용 확인하기" | "나의 지원 내역 보러가기" | "돌봄노트 확인하기" | "선생님 선택하러 가기";
2
+ export declare function getCtaButtonText(ctaType?: BotMessageCtaType | null): "" | "내 수업 확인하기" | "공고 확인하기" | "변경내용 확인하기" | "나의 지원 내역 보러가기" | "돌봄노트 확인하기" | "선생님 선택하러 가기" | "놀이콘텐츠 둘러보기";
3
3
  export declare function getClassInfo(offer: object): {
4
4
  dateRangeText: string;
5
5
  timeRangeText: string;
@@ -1,5 +1,5 @@
1
+ import o from "../../../utils/getCareTypeLabel/getCareTypeLabel.mjs";
1
2
  import n from "dayjs";
2
- import c from "../../../utils/getCareTypeLabel/getCareTypeLabel.mjs";
3
3
  function u(r) {
4
4
  switch (r) {
5
5
  case "MY_CLASS_CHECK":
@@ -14,6 +14,8 @@ function u(r) {
14
14
  return "돌봄노트 확인하기";
15
15
  case "TEACHER_SELECTION":
16
16
  return "선생님 선택하러 가기";
17
+ case "PLAY_CONTENT_EXPLORE":
18
+ return "놀이콘텐츠 둘러보기";
17
19
  default:
18
20
  return "";
19
21
  }
@@ -24,28 +26,28 @@ function C(r) {
24
26
  return null;
25
27
  let a;
26
28
  e.totalCareCount > 1 ? a = `${n(e.careStartDate).format("M월 D일(ddd)")}부터 / 총 ${e.totalCareCount}회` : a = n(e.careStartDate).format("M월 D일(ddd)");
27
- const o = n(`${e.careStartDate} ${e.careStartTime}`).format(
29
+ const c = n(`${e.careStartDate} ${e.careStartTime}`).format(
28
30
  "A h:mm"
29
31
  ), t = n(`${e.careStartDate} ${e.careEndTime}`).format(
30
32
  "A h:mm"
31
33
  );
32
34
  return {
33
35
  dateRangeText: a,
34
- timeRangeText: `${o} ~ ${t}`,
35
- careType: c(e.firstCareType)
36
+ timeRangeText: `${c} ~ ${t}`,
37
+ careType: o(e.firstCareType)
36
38
  };
37
39
  }
38
- function f({
40
+ function T({
39
41
  title: r,
40
42
  content: e,
41
43
  offer: a,
42
- regDatetime: o
44
+ regDatetime: c
43
45
  }) {
44
46
  const t = C(a);
45
- return `안내, ${r}, ${e ? `${e}, ` : ""}${t ? `${t.dateRangeText}, ${t.timeRangeText}, ${t.careType}, ` : ""}${n(o).format("YYYY년 MM월 DD일 A h:mm")}`;
47
+ return `안내, ${r}, ${e ? `${e}, ` : ""}${t ? `${t.dateRangeText}, ${t.timeRangeText}, ${t.careType}, ` : ""}${n(c).format("YYYY년 MM월 DD일 A h:mm")}`;
46
48
  }
47
49
  export {
48
- f as getBotMessageLabel,
50
+ T as getBotMessageLabel,
49
51
  C as getClassInfo,
50
52
  u as getCtaButtonText
51
53
  };
@@ -1,119 +1,121 @@
1
- import { jsxs as T, jsx as s, Fragment as tt } from "react/jsx-runtime";
2
- import { forwardRef as et, useRef as U, useImperativeHandle as nt, useState as g, useEffect as V } from "react";
1
+ import { jsxs as H, jsx as l, Fragment as nt } from "react/jsx-runtime";
2
+ import { forwardRef as ot, useRef as U, useImperativeHandle as it, useState as S, useEffect as V } from "react";
3
3
  import { Flexbox as _, Skeleton as z } from "@dotss/ui";
4
- import ot from "../../hooks/useInView/useInView.mjs";
5
- import it from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
4
+ import st from "../../hooks/useInView/useInView.mjs";
5
+ import lt from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
6
6
  import O from "../../utils/getImageUrl/getImageUrl.mjs";
7
7
  import B from "./Image.error.mjs";
8
- const mt = et(
8
+ const rt = ot(
9
9
  ({
10
- src: l,
10
+ src: s,
11
11
  width: e,
12
12
  height: o,
13
- fit: m = "cover",
14
- position: y = "center",
15
- alt: b,
16
- scale: W = 2,
17
- onLoad: q,
18
- onLazyLoad: j,
19
- lazy: A = !1,
20
- borderRadius: u,
21
- disabledResizing: S = !1,
22
- withIntrinsicRatio: D = !1,
13
+ fit: y = "cover",
14
+ position: m = "center",
15
+ alt: q,
16
+ scale: T = 2,
17
+ onLoad: A,
18
+ onLazyLoad: $,
19
+ lazy: D = !1,
20
+ borderRadius: c,
21
+ disabledResizing: L = !1,
22
+ withIntrinsicRatio: G = !1,
23
23
  enableBlurPlaceholder: r = !1,
24
- enableFallback: G = !1,
25
- enableErrorFallback: J = !0,
26
- renderErrorFallback: c,
24
+ enableFallback: J = !1,
25
+ enableErrorFallback: K = !0,
26
+ renderErrorFallback: u,
27
27
  wrapperProps: n = {},
28
- onError: K,
29
- ...L
28
+ onError: M,
29
+ ...g
30
30
  }, w) => {
31
- const C = U(null), M = U(!1), i = U(null);
32
- nt(w, () => i.current);
33
- const { isInView: F } = ot(C, {
31
+ const C = U(null), N = U(!1), I = U(null);
32
+ it(w, () => I.current);
33
+ const { isInView: p } = st(C, {
34
34
  threshold: 0.4
35
- }), [v, k] = g(!1), [I, d] = g(!1), [h, a] = g(!1), [x, p] = g(!1), [N, Q] = g(
35
+ }), [v, F] = S(!1), [h, d] = S(!1), [x, a] = S(!1), [W, k] = S(!1), [Q, R] = S(
36
36
  O({
37
37
  mode: "original",
38
- src: l,
38
+ src: s,
39
39
  width: e,
40
40
  height: o,
41
- fit: m,
42
- position: y,
43
- scale: W,
44
- disabledResizing: S
41
+ fit: y,
42
+ position: m,
43
+ scale: T,
44
+ disabledResizing: L
45
45
  })
46
- ), R = l == null ? void 0 : l.endsWith(".heic"), E = r ? O({
46
+ ), b = s == null ? void 0 : s.endsWith(".heic"), E = r ? O({
47
47
  mode: "blur",
48
- src: l,
48
+ src: s,
49
49
  width: e,
50
- fit: m,
51
- position: y,
50
+ fit: y,
51
+ position: m,
52
52
  scale: 1 / 3,
53
- disabledResizing: S
53
+ disabledResizing: L
54
54
  }) : null, X = (t) => {
55
- d(!0), a(!1), typeof q == "function" && q(t);
55
+ d(!0), a(!1), typeof A == "function" && A(t);
56
56
  }, Y = (t) => {
57
- typeof K == "function" && K(t.nativeEvent), a(!0), d(!1);
58
- }, Z = () => p(!0);
57
+ typeof M == "function" && M(t.nativeEvent), a(!0), d(!1);
58
+ }, Z = () => k(!0);
59
59
  return V(() => {
60
- if (A && C.current) {
60
+ if (D && C.current) {
61
61
  const t = () => {
62
- F && k(!0);
63
- }, $ = () => {
62
+ p && F(!0);
63
+ }, j = () => {
64
64
  var f;
65
65
  (f = window.appScreenContent) == null || f.addEventListener("scroll", t), window.addEventListener("resize", t), window.addEventListener("orientationchange", t);
66
- }, H = () => {
66
+ }, i = () => {
67
67
  var f;
68
68
  (f = window.appScreenContent) == null || f.removeEventListener("scroll", t), window.removeEventListener("resize", t), window.removeEventListener("orientationchange", t);
69
69
  };
70
- return t(), $(), H;
70
+ return t(), j(), i;
71
71
  }
72
72
  }), V(() => {
73
- typeof j == "function" && v && !M.current && (M.current = !0, j());
74
- }, [j, v]), it(() => {
75
- const t = i.current;
76
- return t != null && t.complete ? t.naturalWidth > 0 ? (t.style.transition = "none", t.style.opacity = "1", d(!0)) : (t.style.opacity = "0", a(!0)) : t && (t.style.transition = "opacity 0.3s", t.style.opacity = "0", t.onload = () => {
73
+ typeof $ == "function" && v && !N.current && (N.current = !0, $());
74
+ }, [$, v]), lt(() => {
75
+ const t = I.current, j = (i) => {
76
+ window.fetch(s).then(async (f) => {
77
+ const P = await f.blob(), tt = (await import("heic2any")).default, et = await tt({ blob: P, toType: "image/png" });
78
+ R(URL.createObjectURL(et)), i.onload = () => {
79
+ i.style.opacity = "1", d(!0), a(!1), i.onload = null, i.onerror = null;
80
+ }, i.onerror = () => {
81
+ a(!0), d(!1), i.onload = null, i.onerror = null;
82
+ };
83
+ });
84
+ };
85
+ return t != null && t.complete ? b ? t.src.startsWith("blob:") || (t.style.transition = "opacity 0.3s", t.style.opacity = "0", j(t)) : t.naturalWidth > 0 ? (t.style.transition = "none", t.style.opacity = "1", d(!0)) : (t.style.opacity = "0", a(!0)) : t && (t.style.transition = "opacity 0.3s", t.style.opacity = "0", t.onload = () => {
77
86
  t.style.opacity = "1", d(!0), t.onload = null;
78
87
  }, t.onerror = () => {
79
- if (!R) {
88
+ if (!b) {
80
89
  a(!0), t.onerror = null;
81
90
  return;
82
91
  }
83
- a(!1), window.fetch(l).then(async ($) => {
84
- const H = await $.blob(), f = (await import("heic2any")).default, P = await f({ blob: H, toType: "image/png" });
85
- Q(URL.createObjectURL(P)), i.current.onload = () => {
86
- t.style.opacity = "1", d(!0), a(!1), i.current.onload = null, i.current.onerror = null;
87
- }, i.current.onerror = () => {
88
- a(!0), d(!1), i.current.onload = null, i.current.onerror = null;
89
- };
90
- });
92
+ a(!1), t.style.transition = "opacity 0.3s", t.style.opacity = "0", j(t);
91
93
  }), () => {
92
94
  t && (t.onload = null, t.onerror = null);
93
95
  };
94
- }, [v, l, R]), V(() => {
95
- Q(
96
+ }, [v, s, b]), V(() => {
97
+ R(
96
98
  O({
97
99
  mode: "original",
98
- src: l,
100
+ src: s,
99
101
  width: e,
100
102
  height: o,
101
- fit: m,
102
- position: y,
103
- scale: W,
104
- disabledResizing: S
103
+ fit: y,
104
+ position: m,
105
+ scale: T,
106
+ disabledResizing: L
105
107
  })
106
108
  );
107
- }, [l, e, o, m, y, W, S]), A ? /* @__PURE__ */ T(
109
+ }, [s, e, o, y, m, T, L]), D ? /* @__PURE__ */ H(
108
110
  _,
109
111
  {
110
112
  ...n,
111
113
  ref: C,
112
- inlineCSS: D ? {
114
+ inlineCSS: G ? {
113
115
  position: "relative",
114
116
  paddingTop: `calc(100% / ${e} * ${o})`,
115
117
  minWidth: "100%",
116
- borderRadius: u,
118
+ borderRadius: c,
117
119
  overflow: "hidden",
118
120
  ...n == null ? void 0 : n.inlineCSS
119
121
  } : {
@@ -121,27 +123,27 @@ const mt = et(
121
123
  width: e,
122
124
  minWidth: e,
123
125
  height: o,
124
- borderRadius: u,
126
+ borderRadius: c,
125
127
  overflow: "hidden",
126
128
  ...n == null ? void 0 : n.inlineCSS
127
129
  },
128
130
  children: [
129
- G && /* @__PURE__ */ s(
131
+ J && /* @__PURE__ */ l(
130
132
  z,
131
133
  {
132
134
  width: "100%",
133
135
  height: "100%",
134
- borderRadius: u || 0,
136
+ borderRadius: c || 0,
135
137
  inlineCSS: {
136
138
  position: "absolute",
137
139
  top: 0,
138
140
  left: 0,
139
- opacity: I || r && x ? 0 : 1,
141
+ opacity: h || r && W ? 0 : 1,
140
142
  transition: "opacity 0.3s"
141
143
  }
142
144
  }
143
145
  ),
144
- r && E && v && /* @__PURE__ */ s(
146
+ r && E && v && /* @__PURE__ */ l(
145
147
  "img",
146
148
  {
147
149
  src: E,
@@ -157,27 +159,27 @@ const mt = et(
157
159
  width: "100%",
158
160
  height: "100%",
159
161
  filter: "blur(5px)",
160
- opacity: x && !I ? 1 : 0,
162
+ opacity: W && !h ? 1 : 0,
161
163
  transition: "opacity 0.3s",
162
- objectFit: m,
163
- objectPosition: y
164
+ objectFit: y,
165
+ objectPosition: m
164
166
  }
165
167
  }
166
168
  ),
167
- v && /* @__PURE__ */ T(tt, { children: [
168
- /* @__PURE__ */ s(
169
+ v && /* @__PURE__ */ H(nt, { children: [
170
+ /* @__PURE__ */ l(
169
171
  "img",
170
172
  {
171
- ref: i,
172
- src: N,
173
- alt: b,
173
+ ref: I,
174
+ src: Q,
175
+ alt: q,
174
176
  width: e,
175
177
  height: o,
176
178
  onLoad: X,
177
179
  onError: Y,
178
- "aria-hidden": h,
180
+ "aria-hidden": x,
179
181
  draggable: !1,
180
- ...L,
182
+ ...g,
181
183
  style: {
182
184
  position: "absolute",
183
185
  top: 0,
@@ -185,25 +187,25 @@ const mt = et(
185
187
  width: "100%",
186
188
  height: "100%",
187
189
  transition: "opacity 0.3s",
188
- ...L.style
190
+ ...g.style
189
191
  }
190
192
  }
191
193
  ),
192
- J && h && ((c == null ? void 0 : c()) || /* @__PURE__ */ s(B, {}))
194
+ K && x && ((u == null ? void 0 : u()) || /* @__PURE__ */ l(B, {}))
193
195
  ] })
194
196
  ]
195
197
  }
196
- ) : /* @__PURE__ */ T(
198
+ ) : /* @__PURE__ */ H(
197
199
  _,
198
200
  {
199
201
  ...n,
200
202
  ref: C,
201
- inlineCSS: D ? {
203
+ inlineCSS: G ? {
202
204
  position: "relative",
203
205
  paddingTop: `calc(100% / ${e} * ${o})`,
204
206
  minWidth: "100%",
205
207
  transition: "padding-top 0.2s",
206
- borderRadius: u,
208
+ borderRadius: c,
207
209
  overflow: "hidden",
208
210
  ...n == null ? void 0 : n.inlineCSS
209
211
  } : {
@@ -211,27 +213,27 @@ const mt = et(
211
213
  width: e,
212
214
  minWidth: e,
213
215
  height: o,
214
- borderRadius: u,
216
+ borderRadius: c,
215
217
  overflow: "hidden",
216
218
  ...n == null ? void 0 : n.inlineCSS
217
219
  },
218
220
  children: [
219
- G && /* @__PURE__ */ s(
221
+ J && /* @__PURE__ */ l(
220
222
  z,
221
223
  {
222
224
  width: "100%",
223
225
  height: "100%",
224
- borderRadius: u || 0,
226
+ borderRadius: c || 0,
225
227
  inlineCSS: {
226
228
  position: "absolute",
227
229
  top: 0,
228
230
  left: 0,
229
- opacity: I || r && x ? 0 : 1,
231
+ opacity: h || r && W ? 0 : 1,
230
232
  transition: "opacity 0.3s"
231
233
  }
232
234
  }
233
235
  ),
234
- r && E && /* @__PURE__ */ s(
236
+ r && E && /* @__PURE__ */ l(
235
237
  "img",
236
238
  {
237
239
  src: E,
@@ -247,24 +249,24 @@ const mt = et(
247
249
  width: "100%",
248
250
  height: "100%",
249
251
  filter: "blur(5px)",
250
- opacity: x && !I ? 1 : 0,
252
+ opacity: W && !h ? 1 : 0,
251
253
  transition: "opacity 0.3s"
252
254
  }
253
255
  }
254
256
  ),
255
- /* @__PURE__ */ s(
257
+ /* @__PURE__ */ l(
256
258
  "img",
257
259
  {
258
- ref: i,
259
- src: N,
260
- alt: b,
260
+ ref: I,
261
+ src: Q,
262
+ alt: q,
261
263
  width: e,
262
264
  height: o,
263
265
  onLoad: X,
264
266
  onError: Y,
265
- "aria-hidden": h,
267
+ "aria-hidden": x,
266
268
  draggable: !1,
267
- ...L,
269
+ ...g,
268
270
  style: {
269
271
  position: "absolute",
270
272
  top: 0,
@@ -272,16 +274,16 @@ const mt = et(
272
274
  width: "100%",
273
275
  height: "100%",
274
276
  transition: "opacity 0.3s",
275
- ...L.style
277
+ ...g.style
276
278
  }
277
279
  }
278
280
  ),
279
- J && h && ((c == null ? void 0 : c()) || /* @__PURE__ */ s(B, {}))
281
+ K && x && ((u == null ? void 0 : u()) || /* @__PURE__ */ l(B, {}))
280
282
  ]
281
283
  }
282
284
  );
283
285
  }
284
286
  );
285
287
  export {
286
- mt as default
288
+ rt as default
287
289
  };
@@ -18,7 +18,7 @@ function zt({
18
18
  defaultContainerHeight: tt = 0,
19
19
  ...l
20
20
  }) {
21
- const { spacing: H } = gt(), [rt, B] = v(O), [et, U] = v(tt), [N, nt] = v(0), b = 4 / 3, g = (rt - c) / x, p = L === "horizontal" ? (et - c) / F : g * b, s = u(null), f = u([]), R = u([]), I = u(!1), k = u(!0), P = u(0), C = u(0), m = u(0), h = u(
21
+ const { spacing: H } = gt(), [rt, B] = v(O), [et, U] = v(tt), [N, nt] = v(0), b = 4 / 3, f = (rt - c) / x, p = L === "horizontal" ? (et - c) / F : f * b, s = u(null), g = u([]), R = u([]), I = u(!1), k = u(!0), P = u(0), C = u(0), m = u(0), h = u(
22
22
  /* @__PURE__ */ new Map()
23
23
  ), [y, ot] = v(
24
24
  S.toArray(A).filter(Q).filter((t) => t.type === _ || t.type === K)
@@ -27,7 +27,7 @@ function zt({
27
27
  var o;
28
28
  const r = ((o = pt(t.props.children)) == null ? void 0 : o.props.src) || "";
29
29
  if (!r) return null;
30
- const e = t.props.width ?? g, n = t.props.height ?? p;
30
+ const e = t.props.width ?? f, n = t.props.height ?? p;
31
31
  return {
32
32
  originalSrc: r,
33
33
  originWidth: e,
@@ -56,16 +56,16 @@ function zt({
56
56
  let e = null;
57
57
  switch (r.key) {
58
58
  case "ArrowRight":
59
- r.preventDefault(), e = z(r.currentTarget, "right", f.current);
59
+ r.preventDefault(), e = z(r.currentTarget, "right", g.current);
60
60
  break;
61
61
  case "ArrowLeft":
62
- r.preventDefault(), e = z(r.currentTarget, "left", f.current);
62
+ r.preventDefault(), e = z(r.currentTarget, "left", g.current);
63
63
  break;
64
64
  case "ArrowDown":
65
- r.preventDefault(), e = z(r.currentTarget, "down", f.current);
65
+ r.preventDefault(), e = z(r.currentTarget, "down", g.current);
66
66
  break;
67
67
  case "ArrowUp":
68
- r.preventDefault(), e = z(r.currentTarget, "up", f.current);
68
+ r.preventDefault(), e = z(r.currentTarget, "up", g.current);
69
69
  break;
70
70
  case "Enter":
71
71
  case " ": {
@@ -91,12 +91,12 @@ function zt({
91
91
  R.current,
92
92
  e,
93
93
  n
94
- ), a = f.current[o ?? -1];
94
+ ), a = g.current[o ?? -1];
95
95
  a == null || a.focus(), t == null || t(r);
96
96
  }, it = (t) => (r) => {
97
- f.current[t] = r;
97
+ g.current[t] = r;
98
98
  }, ut = (t, r, e) => (n) => {
99
- R.current[r] || (R.current[r] = []), f.current[t] = n, R.current[r][e] = n;
99
+ R.current[r] || (R.current[r] = []), g.current[t] = n, R.current[r][e] = n;
100
100
  }, $ = (t) => (r) => {
101
101
  nt(Number(r.currentTarget.getAttribute("aria-posinset")) - 1), t == null || t(r);
102
102
  }, T = (t) => {
@@ -106,7 +106,7 @@ function zt({
106
106
  const i = h.current.get(a.src);
107
107
  return i ? {
108
108
  ...a,
109
- width: i.naturalWidth / i.naturalHeight * (a.height ?? p),
109
+ width: i.naturalWidth / i.naturalHeight * (a.height ?? p) || f,
110
110
  height: a.height ?? p,
111
111
  loaded: !0
112
112
  } : a;
@@ -118,7 +118,7 @@ function zt({
118
118
  const a = h.current.get(o.src);
119
119
  return a ? {
120
120
  ...o,
121
- width: a.naturalWidth / a.naturalHeight * (o.height ?? p),
121
+ width: a.naturalWidth / a.naturalHeight * (o.height ?? p) || f,
122
122
  height: o.height ?? p,
123
123
  loaded: !0
124
124
  } : o;
@@ -161,9 +161,9 @@ function zt({
161
161
  d,
162
162
  y,
163
163
  F,
164
- g * b / 2
164
+ f * b / 2
165
165
  );
166
- let r = g * b / 2;
166
+ let r = f * b / 2;
167
167
  r = r <= 0 ? 120 : r;
168
168
  let e = 0;
169
169
  return /* @__PURE__ */ W(
@@ -256,8 +256,8 @@ function zt({
256
256
  tabIndex: r === N ? 0 : -1,
257
257
  "aria-posinset": r + 1,
258
258
  "aria-setsize": G,
259
- width: t.props.width ?? g,
260
- height: t.props.height ?? g * b / 2,
259
+ width: t.props.width ?? f,
260
+ height: t.props.height ?? f * b / 2,
261
261
  direction: L,
262
262
  spacing: c,
263
263
  sourceMetadataMap: j ?? void 0,
@@ -3,6 +3,8 @@ import { ImageProps } from '../Image';
3
3
  import { MasonryBlockProps } from './MasonryBlock';
4
4
  export declare function getHorizontalLayoutRows(images: {
5
5
  src: string;
6
+ originalSrc?: string;
7
+ originalWidth?: number;
6
8
  width: number;
7
9
  height: number;
8
10
  }[], blocks: ReactElement<MasonryBlockProps>[], rowCount: number, fallbackWidth: number): ReactElement<MasonryBlockProps, string | import('react').JSXElementConstructor<any>>[][];
@@ -3,69 +3,69 @@ import I from "../Image/Image.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "@dotss/ui";
5
5
  import "@dotss/ui/core/useTheme";
6
- function Y(n, l, e, f) {
7
- const t = Array.from({ length: e }, () => []), g = new Map(n.map((i) => [i.src, i])), m = Array(e).fill(0), a = Array.from({ length: e }, (i, c) => c);
8
- return l.forEach((i) => {
9
- var o;
10
- const c = ((o = E(i.props.children)) == null ? void 0 : o.props.src) ?? "", h = g.get(c), d = a[0];
11
- t[d].push(i), m[d] += (h == null ? void 0 : h.width) ?? f;
6
+ function S(n, l, e, f) {
7
+ const t = Array.from({ length: e }, () => []), g = new Map(n.map((o) => [o.originalSrc ?? o.src, o])), h = Array(e).fill(0), a = Array.from({ length: e }, (o, c) => c);
8
+ return l.forEach((o) => {
9
+ var i;
10
+ const c = ((i = w(o.props.children)) == null ? void 0 : i.props.src) || "", p = g.get(c), d = a[0];
11
+ t[d].push(o), h[d] += (p == null ? void 0 : p.width) ?? o.props.width ?? f;
12
12
  let s = 1;
13
- const r = m[d];
14
- for (; s < a.length && r >= m[a[s]]; )
13
+ const r = h[d];
14
+ for (; s < a.length && h[a[s]] < r; )
15
15
  a[s - 1] = a[s], s += 1;
16
16
  a[s - 1] = d;
17
17
  }), t;
18
18
  }
19
- function z(n, l, e) {
19
+ function Y(n, l, e) {
20
20
  const f = n.getBoundingClientRect(), t = (f.left + f.right) / 2, g = (f.top + f.bottom) / 2;
21
- let m = null, a = 1 / 0;
22
- for (const i of e) {
23
- if (!i || i === n) continue;
24
- const c = i.getBoundingClientRect(), h = (c.left + c.right) / 2, d = (c.top + c.bottom) / 2, s = h - t, r = d - g, o = Math.abs(r) < c.height * 0.75, u = Math.abs(s) < c.width * 0.75, p = l === "right" && s > 0 && o || l === "left" && s < 0 && o || l === "down" && r > 0 && u || l === "up" && r < 0 && u, b = Math.hypot(s, r);
25
- p && b < a && (a = b, m = i);
21
+ let h = null, a = 1 / 0;
22
+ for (const o of e) {
23
+ if (!o || o === n) continue;
24
+ const c = o.getBoundingClientRect(), p = (c.left + c.right) / 2, d = (c.top + c.bottom) / 2, s = p - t, r = d - g, i = Math.abs(r) < c.height * 0.75, u = Math.abs(s) < c.width * 0.75, m = l === "right" && s > 0 && i || l === "left" && s < 0 && i || l === "down" && r > 0 && u || l === "up" && r < 0 && u, b = Math.hypot(s, r);
25
+ m && b < a && (a = b, h = o);
26
26
  }
27
- return m;
27
+ return h;
28
28
  }
29
- function F(n, l, e) {
30
- var c, h, d, s;
29
+ function z(n, l, e) {
30
+ var c, p, d, s;
31
31
  if (!n.length || l < 0) return null;
32
32
  const f = n.length;
33
33
  let t = -1, g = -1;
34
34
  for (let r = 0; r < f; r++) {
35
- for (let o = 0; o < n[r].length; o++) {
36
- const u = n[r][o];
35
+ for (let i = 0; i < n[r].length; i++) {
36
+ const u = n[r][i];
37
37
  if (Number(u == null ? void 0 : u.getAttribute("aria-posinset")) - 1 === l) {
38
- t = r, g = o;
38
+ t = r, g = i;
39
39
  break;
40
40
  }
41
41
  }
42
42
  if (t !== -1) break;
43
43
  }
44
44
  if (t === -1 || g === -1) return null;
45
- const a = n[t][g].getBoundingClientRect(), i = (a.left + a.right) / 2;
45
+ const a = n[t][g].getBoundingClientRect(), o = (a.left + a.right) / 2;
46
46
  if (e === "left" && g > 0)
47
47
  return Number((c = n[t][g - 1]) == null ? void 0 : c.getAttribute("aria-posinset")) - 1;
48
48
  if (e === "right" && g < n[t].length - 1)
49
- return Number((h = n[t][g + 1]) == null ? void 0 : h.getAttribute("aria-posinset")) - 1;
49
+ return Number((p = n[t][g + 1]) == null ? void 0 : p.getAttribute("aria-posinset")) - 1;
50
50
  if (e === "up" && t > 0) {
51
51
  const r = n[t - 1];
52
- let o = 0, u = 1 / 0;
53
- return r.forEach((p, b) => {
54
- const R = p.getBoundingClientRect(), C = (R.left + R.right) / 2, A = Math.abs(i - C);
55
- A < u && (u = A, o = b);
56
- }), Number((d = r[o]) == null ? void 0 : d.getAttribute("aria-posinset")) - 1;
52
+ let i = 0, u = 1 / 0;
53
+ return r.forEach((m, b) => {
54
+ const R = m.getBoundingClientRect(), C = (R.left + R.right) / 2, A = Math.abs(o - C);
55
+ A < u && (u = A, i = b);
56
+ }), Number((d = r[i]) == null ? void 0 : d.getAttribute("aria-posinset")) - 1;
57
57
  }
58
58
  if (e === "down" && t < f - 1) {
59
59
  const r = n[t + 1];
60
- let o = 0, u = 1 / 0;
61
- return r.forEach((p, b) => {
62
- const R = p.getBoundingClientRect(), C = (R.left + R.right) / 2, A = Math.abs(i - C);
63
- A < u && (u = A, o = b);
64
- }), Number((s = r[o]) == null ? void 0 : s.getAttribute("aria-posinset")) - 1;
60
+ let i = 0, u = 1 / 0;
61
+ return r.forEach((m, b) => {
62
+ const R = m.getBoundingClientRect(), C = (R.left + R.right) / 2, A = Math.abs(o - C);
63
+ A < u && (u = A, i = b);
64
+ }), Number((s = r[i]) == null ? void 0 : s.getAttribute("aria-posinset")) - 1;
65
65
  }
66
66
  return null;
67
67
  }
68
- function E(n) {
68
+ function w(n) {
69
69
  const l = M.toArray(n).filter(y).find((e) => e.type === I || e.type === "img");
70
70
  if (l)
71
71
  return l;
@@ -78,8 +78,8 @@ function E(n) {
78
78
  return null;
79
79
  }
80
80
  export {
81
- E as findImageInChildren,
82
- z as findNextFocusableElement,
83
- Y as getHorizontalLayoutRows,
84
- F as getNextIndexHorizontalFromRows
81
+ w as findImageInChildren,
82
+ Y as findNextFocusableElement,
83
+ S as getHorizontalLayoutRows,
84
+ z as getNextIndexHorizontalFromRows
85
85
  };
@@ -1,51 +1,51 @@
1
- import { jsxs as w, jsx as m } from "react/jsx-runtime";
2
- import { forwardRef as N, useMemo as q, useState as b, useRef as D, useImperativeHandle as V, useEffect as v, Children as $, isValidElement as z, cloneElement as G } from "react";
3
- import { Flexbox as g, Skeleton as J } from "@dotss/ui";
4
- import K from "@dotss/ui/core/useTheme";
5
- import O from "../../Image/Image.mjs";
6
- import { findImageInChildren as P } from "../Masonry.utils.mjs";
7
- import Q from "../../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
8
- const M = N(
1
+ import { jsxs as E, jsx as b } from "react/jsx-runtime";
2
+ import { forwardRef as q, useMemo as D, useState as v, useRef as V, useImperativeHandle as $, useEffect as k, Children as z, isValidElement as G, cloneElement as J } from "react";
3
+ import { Flexbox as g, Skeleton as K } from "@dotss/ui";
4
+ import O from "@dotss/ui/core/useTheme";
5
+ import P from "../../Image/Image.mjs";
6
+ import { findImageInChildren as Q } from "../Masonry.utils.mjs";
7
+ import U from "../../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
8
+ const a = q(
9
9
  ({
10
- children: p,
11
- width: u = 0,
12
- height: h = 0,
13
- spacing: E = 2,
14
- borderRadius: S = 0,
10
+ children: u,
11
+ width: h = 0,
12
+ height: p = 0,
13
+ spacing: w = 2,
14
+ borderRadius: d = 0,
15
15
  direction: C = "vertical",
16
- setInnerRef: r,
17
- sourceMetadataMap: d,
16
+ setInnerRef: t,
17
+ sourceMetadataMap: S,
18
18
  onLoad: T,
19
- onManualLoad: s,
19
+ onManualLoad: l,
20
20
  ...e
21
21
  }, x) => {
22
- const { spacing: j } = K(), o = q(() => {
22
+ const { spacing: j } = O(), r = D(() => {
23
23
  var n, f;
24
- return ((f = (n = P(p)) == null ? void 0 : n.props) == null ? void 0 : f.src) ?? "";
25
- }, [p]), i = d == null ? void 0 : d.get(o), [l, H] = b((i == null ? void 0 : i.width) ?? u ?? 0), [c, W] = b((i == null ? void 0 : i.height) ?? h ?? 0), [A, k] = b(!1), t = D(null), y = !o || !!o && A;
26
- V(x, () => t.current);
24
+ return ((f = (n = Q(u)) == null ? void 0 : n.props) == null ? void 0 : f.src) ?? "";
25
+ }, [u]), i = S == null ? void 0 : S.get(r), [s, H] = v((i == null ? void 0 : i.width) ?? h ?? 0), [c, W] = v((i == null ? void 0 : i.height) ?? p ?? 0), [A, y] = v(!1), o = V(null), m = !r || !!r && A;
26
+ $(x, () => o.current);
27
27
  const B = (n) => {
28
- n.propertyName !== "padding-top" && n.propertyName !== "padding-left" || k(!0);
29
- };
30
- return Q(() => {
31
- if (!(i != null && i.loaded) && t.current && o) {
32
- const n = t.current.querySelector("img");
28
+ n.propertyName !== "padding-top" && n.propertyName !== "padding-left" || y(!0);
29
+ }, F = () => y(!0);
30
+ return U(() => {
31
+ if (!(i != null && i.loaded) && o.current && r) {
32
+ const n = o.current.querySelector("img");
33
33
  if (!n || !n.complete) return;
34
- const { naturalWidth: f, naturalHeight: F, src: I } = n;
35
- s == null || s(f, F, I);
34
+ const { naturalWidth: f, naturalHeight: I, src: N } = n;
35
+ l == null || l(f, I, N);
36
36
  }
37
- }, [o, i == null ? void 0 : i.loaded, s]), v(() => {
38
- H((i == null ? void 0 : i.width) ?? u ?? 0), W((i == null ? void 0 : i.height) ?? h ?? 0);
39
- }, [u, h, i == null ? void 0 : i.width, i == null ? void 0 : i.height]), v(() => {
40
- if (!(i != null && i.loaded) || (i == null ? void 0 : i.width) !== l || (i == null ? void 0 : i.height) !== c) return;
41
- const n = setTimeout(() => k(!0), 300);
37
+ }, [r, i == null ? void 0 : i.loaded, l]), k(() => {
38
+ H((i == null ? void 0 : i.width) ?? h ?? 0), W((i == null ? void 0 : i.height) ?? p ?? 0);
39
+ }, [h, p, i == null ? void 0 : i.width, i == null ? void 0 : i.height]), k(() => {
40
+ if (!(i != null && i.loaded) || (i == null ? void 0 : i.width) !== s || (i == null ? void 0 : i.height) !== c) return;
41
+ const n = setTimeout(() => y(!0), 300);
42
42
  return () => clearTimeout(n);
43
- }, [i, l, c]), v(() => {
44
- r == null || r(t.current);
45
- }, [r]), /* @__PURE__ */ w(
43
+ }, [i, s, c]), k(() => {
44
+ t == null || t(o.current);
45
+ }, [t]), /* @__PURE__ */ E(
46
46
  g,
47
47
  {
48
- ref: t,
48
+ ref: o,
49
49
  flexDirection: "column",
50
50
  ...e,
51
51
  inlineCSS: {
@@ -55,15 +55,15 @@ const M = N(
55
55
  ...e == null ? void 0 : e.inlineCSS
56
56
  },
57
57
  children: [
58
- C === "vertical" && /* @__PURE__ */ m(
58
+ C === "vertical" && /* @__PURE__ */ b(
59
59
  g,
60
60
  {
61
61
  inlineCSS: {
62
- minHeight: j.content(E)
62
+ minHeight: j.content(w)
63
63
  }
64
64
  }
65
65
  ),
66
- /* @__PURE__ */ w(
66
+ /* @__PURE__ */ E(
67
67
  g,
68
68
  {
69
69
  onTransitionEnd: B,
@@ -71,22 +71,22 @@ const M = N(
71
71
  position: "relative",
72
72
  overflow: "hidden",
73
73
  scrollbarWidth: "none",
74
- borderRadius: S,
74
+ borderRadius: d,
75
75
  "&::-webkit-scrollbar": {
76
76
  display: "none"
77
77
  },
78
78
  ...e == null ? void 0 : e.inlineCSS
79
79
  },
80
80
  style: C === "vertical" ? {
81
- paddingTop: `calc(${c / l} * 100%)`,
81
+ paddingTop: `calc(${c / s} * 100%)`,
82
82
  transition: "padding-top 0.3s"
83
83
  } : {
84
- paddingLeft: l,
84
+ paddingLeft: s,
85
85
  paddingTop: c,
86
86
  transition: "padding-top 0.3s, padding-left 0.3s"
87
87
  },
88
88
  children: [
89
- /* @__PURE__ */ m(
89
+ /* @__PURE__ */ b(
90
90
  g,
91
91
  {
92
92
  inlineCSS: {
@@ -95,13 +95,13 @@ const M = N(
95
95
  left: 0,
96
96
  width: "100%",
97
97
  height: "100%",
98
- opacity: y ? 1 : 0,
98
+ opacity: m ? 1 : 0,
99
99
  transition: "opacity 0.3s"
100
100
  },
101
101
  style: {
102
- borderRadius: S > 0 ? S : 0
102
+ borderRadius: d > 0 ? d : 0
103
103
  },
104
- children: $.toArray(p).filter(z).map((n) => n.type === O || n.type === "img" ? G(n, {
104
+ children: z.toArray(u).filter(G).map((n) => n.type === P || n.type === "img" ? J(n, {
105
105
  width: i == null ? void 0 : i.originWidth,
106
106
  draggable: !1,
107
107
  style: {
@@ -109,12 +109,14 @@ const M = N(
109
109
  ...n.props.style
110
110
  },
111
111
  ...n.props,
112
- onLoad: T
112
+ enableFallback: !0,
113
+ onLoad: T,
114
+ onError: F
113
115
  }) : n)
114
116
  }
115
117
  ),
116
- /* @__PURE__ */ m(
117
- J,
118
+ /* @__PURE__ */ b(
119
+ K,
118
120
  {
119
121
  borderRadius: 0,
120
122
  inlineCSS: {
@@ -123,9 +125,9 @@ const M = N(
123
125
  left: 0,
124
126
  width: "100%",
125
127
  height: "100%",
126
- opacity: y ? 0 : 1,
128
+ opacity: m ? 0 : 1,
127
129
  transition: "opacity 0.3s",
128
- pointerEvents: y ? "none" : void 0
130
+ pointerEvents: m ? "none" : void 0
129
131
  }
130
132
  }
131
133
  )
@@ -138,5 +140,5 @@ const M = N(
138
140
  }
139
141
  );
140
142
  export {
141
- M as default
143
+ a as default
142
144
  };
@@ -515,7 +515,7 @@ function je({
515
515
  }),
516
516
  $.map(
517
517
  ({ children: c, startDate: a, endDate: t, totalColumns: r, columnIndex: l }) => {
518
- const u = be(a), f = be(t), H = Math.floor((u - 7 * 60) / 30), Ae = (u - 7 * 60) / 30 * (Number(X) || E), Fe = (f - u) / 30 * (Number(X) || E), pe = 100 / r, xe = l * pe, te = c;
518
+ const u = be(a), f = be(t), H = Math.floor((u - 420) / 30), Ae = (u - 420) / 30 * (Number(X) || E), Fe = (f - u) / 30 * (Number(X) || E), pe = 100 / r, xe = l * pe, te = c;
519
519
  return /* @__PURE__ */ h(
520
520
  m,
521
521
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dotss/tictoccroc",
3
3
  "type": "module",
4
- "version": "0.0.34",
4
+ "version": "0.0.36",
5
5
  "description": "Tictoccroc shared components, hooks, utils, and APIs for Dotss",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",