@dotss/tictoccroc 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/Calendar-BOLCHnjh.js +97 -0
  2. package/dist/TimePicker-BwACyeBR.js +120 -0
  3. package/dist/convertMdToHtml-Bmk0brLK.js +1431 -0
  4. package/dist/index.mjs +105 -200
  5. package/dist/parent/b2b/components/ActionButtons/ActionButtons.mjs +26 -29
  6. package/dist/parent/b2b/components/ActionButtons/index.mjs +5 -4
  7. package/dist/parent/b2b/components/BottomNotes/BottomNotes.mjs +37 -35
  8. package/dist/parent/b2b/components/BottomNotes/index.mjs +5 -4
  9. package/dist/parent/b2b/components/EmployeeNumberField/EmployeeNumberField.mjs +12 -15
  10. package/dist/parent/b2b/components/EmployeeNumberField/index.mjs +5 -4
  11. package/dist/parent/b2b/components/NameField/NameField.mjs +12 -7
  12. package/dist/parent/b2b/components/NameField/index.mjs +5 -4
  13. package/dist/parent/b2b/components/PhoneNumberField/PhoneNumberField.mjs +27 -30
  14. package/dist/parent/b2b/components/PhoneNumberField/PhoneNumberField.utils.mjs +7 -8
  15. package/dist/parent/b2b/components/PhoneNumberField/index.mjs +6 -7
  16. package/dist/parent/b2b/components/Title/Title.mjs +22 -16
  17. package/dist/parent/b2b/components/Title/index.mjs +4 -3
  18. package/dist/parent/b2b/components/TopLogo/TopLogo.mjs +55 -93
  19. package/dist/parent/b2b/components/TopLogo/index.mjs +5 -4
  20. package/dist/parent/b2b/components/index.mjs +9 -19
  21. package/dist/parent/b2b/utils/convertMdToHtml/convertMdToHtml.mjs +2 -1143
  22. package/dist/parent/b2b/utils/index.mjs +2 -4
  23. package/dist/parent/notification/components/NotificationCard/NotificationCard.d.ts +3 -1
  24. package/dist/parent/notification/components/NotificationCard/NotificationCard.mjs +90 -105
  25. package/dist/parent/notification/components/NotificationCard/index.mjs +5 -4
  26. package/dist/parent/notification/components/index.mjs +2 -4
  27. package/dist/parent/notification/utils/index.mjs +2 -4
  28. package/dist/parent/notification/utils/sanitize/sanitize.mjs +6 -6
  29. package/dist/purify.es-D3W4zDrg.js +549 -0
  30. package/dist/shared/components/Calendar/Calendar.mjs +2 -80
  31. package/dist/shared/components/Calendar/index.mjs +5 -4
  32. package/dist/shared/components/Carousel/Carousel.mjs +184 -210
  33. package/dist/shared/components/Carousel/CarouselSlide/CarouselSlide.mjs +10 -7
  34. package/dist/shared/components/Carousel/CarouselSlide/index.mjs +5 -4
  35. package/dist/shared/components/Carousel/index.mjs +6 -6
  36. package/dist/shared/components/ChatKit/BotMessage/BotMessage.mjs +151 -183
  37. package/dist/shared/components/ChatKit/BotMessage/BotMessage.utils.mjs +30 -50
  38. package/dist/shared/components/ChatKit/BotMessage/index.mjs +6 -8
  39. package/dist/shared/components/ChatKit/InputBar/InputBar.fallback.mjs +64 -84
  40. package/dist/shared/components/ChatKit/InputBar/InputBar.mjs +105 -130
  41. package/dist/shared/components/ChatKit/InputBar/index.mjs +6 -6
  42. package/dist/shared/components/ChatKit/Message/Message.fallback.mjs +50 -66
  43. package/dist/shared/components/ChatKit/Message/Message.mjs +178 -276
  44. package/dist/shared/components/ChatKit/Message/Message.utils.mjs +20 -31
  45. package/dist/shared/components/ChatKit/Message/index.mjs +7 -9
  46. package/dist/shared/components/ChatKit/Seperator/Seperator.mjs +31 -27
  47. package/dist/shared/components/ChatKit/Seperator/index.mjs +4 -3
  48. package/dist/shared/components/ChatKit/SystemMessage/(Actions)/DirectTrageRiskInfoBottomSheet/DirectTrageRiskInfoBottomSheet.mjs +183 -153
  49. package/dist/shared/components/ChatKit/SystemMessage/SystemMessage.mjs +83 -108
  50. package/dist/shared/components/ChatKit/SystemMessage/SystemMessage.utils.mjs +5 -5
  51. package/dist/shared/components/ChatKit/SystemMessage/index.mjs +7 -8
  52. package/dist/shared/components/ChatKit/UnreadMessagePill/UnreadMessagePill.mjs +49 -54
  53. package/dist/shared/components/ChatKit/UnreadMessagePill/index.mjs +5 -4
  54. package/dist/shared/components/ChatKit/index.mjs +13 -29
  55. package/dist/shared/components/Image/Image.d.ts +2 -0
  56. package/dist/shared/components/Image/Image.error.mjs +34 -40
  57. package/dist/shared/components/Image/Image.mjs +247 -289
  58. package/dist/shared/components/Image/index.mjs +6 -6
  59. package/dist/shared/components/LoadingAnnouncer/LoadingAnnouncer.mjs +19 -18
  60. package/dist/shared/components/LoadingAnnouncer/index.mjs +5 -4
  61. package/dist/shared/components/Masonry/Masonry.mjs +240 -276
  62. package/dist/shared/components/Masonry/Masonry.utils.mjs +62 -81
  63. package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.mjs +111 -144
  64. package/dist/shared/components/Masonry/MasonryBlock/index.mjs +5 -4
  65. package/dist/shared/components/Masonry/index.mjs +6 -6
  66. package/dist/shared/components/MediaDialog/MediaBlock/MediaBlock.mjs +54 -69
  67. package/dist/shared/components/MediaDialog/MediaBlock/index.mjs +5 -4
  68. package/dist/shared/components/MediaDialog/MediaDialog.mjs +216 -330
  69. package/dist/shared/components/MediaDialog/MediaDialogContent/MediaDialogContent.mjs +18 -21
  70. package/dist/shared/components/MediaDialog/MediaDialogContent/index.mjs +5 -4
  71. package/dist/shared/components/MediaDialog/MediaDialogFooter/MediaDialogFooter.mjs +22 -27
  72. package/dist/shared/components/MediaDialog/MediaDialogFooter/index.mjs +5 -4
  73. package/dist/shared/components/MediaDialog/MediaDialogToolbar/MediaDialogToolbar.mjs +15 -21
  74. package/dist/shared/components/MediaDialog/MediaDialogToolbar/index.mjs +5 -4
  75. package/dist/shared/components/MediaDialog/index.mjs +9 -12
  76. package/dist/shared/components/Roller/Roller.mjs +99 -132
  77. package/dist/shared/components/Roller/RollerBlock/RollerBlock.mjs +9 -6
  78. package/dist/shared/components/Roller/RollerBlock/index.mjs +5 -4
  79. package/dist/shared/components/Roller/index.mjs +6 -6
  80. package/dist/shared/components/Scheduler/ScheduleBlock/ScheduleBlock.mjs +22 -30
  81. package/dist/shared/components/Scheduler/ScheduleBlock/index.mjs +5 -4
  82. package/dist/shared/components/Scheduler/ScheduleEvent/ScheduleEvent.mjs +25 -35
  83. package/dist/shared/components/Scheduler/ScheduleEvent/index.mjs +5 -4
  84. package/dist/shared/components/Scheduler/Scheduler.mjs +472 -567
  85. package/dist/shared/components/Scheduler/Scheduler.utils.mjs +78 -101
  86. package/dist/shared/components/Scheduler/index.mjs +8 -10
  87. package/dist/shared/components/Swiper/Swiper.mjs +238 -283
  88. package/dist/shared/components/Swiper/Swiper.utils.mjs +19 -24
  89. package/dist/shared/components/Swiper/SwiperBlock/SwiperBlock.mjs +14 -17
  90. package/dist/shared/components/Swiper/SwiperBlock/index.mjs +5 -4
  91. package/dist/shared/components/Swiper/index.mjs +6 -6
  92. package/dist/shared/components/TextField/TextField.mjs +44 -55
  93. package/dist/shared/components/TextField/index.mjs +5 -4
  94. package/dist/shared/components/TimePicker/TimePicker.mjs +2 -120
  95. package/dist/shared/components/TimePicker/index.mjs +5 -4
  96. package/dist/shared/components/index.mjs +36 -75
  97. package/dist/shared/hooks/index.mjs +4 -8
  98. package/dist/shared/hooks/useCombineRef/index.mjs +5 -4
  99. package/dist/shared/hooks/useCombineRef/useCombineRef.mjs +7 -7
  100. package/dist/shared/hooks/useInView/index.mjs +5 -4
  101. package/dist/shared/hooks/useInView/useInView.d.ts +2 -1
  102. package/dist/shared/hooks/useInView/useInView.mjs +37 -47
  103. package/dist/shared/hooks/useIsomorphicLayoutEffect/index.mjs +5 -4
  104. package/dist/shared/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +6 -6
  105. package/dist/shared/typings/common.mjs +6 -4
  106. package/dist/shared/typings/index.mjs +2 -4
  107. package/dist/shared/utils/ageToBirthDate/ageToBirthDate.mjs +17 -9
  108. package/dist/shared/utils/ageToBirthDate/index.mjs +5 -4
  109. package/dist/shared/utils/birthDateToAge/birthDateToAge.mjs +9 -10
  110. package/dist/shared/utils/birthDateToAge/index.mjs +4 -3
  111. package/dist/shared/utils/combineRef/combineRef.mjs +20 -23
  112. package/dist/shared/utils/combineRef/index.mjs +5 -4
  113. package/dist/shared/utils/dayFlagToDay/dayFlagToDay.mjs +15 -23
  114. package/dist/shared/utils/dayFlagToDay/index.mjs +5 -4
  115. package/dist/shared/utils/getCareTypeLabel/getCareTypeLabel.mjs +13 -20
  116. package/dist/shared/utils/getCareTypeLabel/index.mjs +5 -4
  117. package/dist/shared/utils/getDateRange/getDateRange.mjs +15 -20
  118. package/dist/shared/utils/getDateRange/index.mjs +5 -4
  119. package/dist/shared/utils/getImageUrl/getImageUrl.mjs +7 -17
  120. package/dist/shared/utils/getImageUrl/index.mjs +5 -6
  121. package/dist/shared/utils/getTimeRange/getTimeRange.mjs +19 -21
  122. package/dist/shared/utils/getTimeRange/index.mjs +5 -4
  123. package/dist/shared/utils/getVimeoId/getVimeoId.mjs +11 -11
  124. package/dist/shared/utils/getVimeoId/index.mjs +5 -4
  125. package/dist/shared/utils/index.mjs +18 -36
  126. package/dist/shared/utils/isAndroid/index.mjs +5 -4
  127. package/dist/shared/utils/isAndroid/isAndroid.mjs +5 -5
  128. package/dist/shared/utils/isApp/index.mjs +5 -4
  129. package/dist/shared/utils/isApp/isApp.mjs +4 -4
  130. package/dist/shared/utils/isDesktop/index.mjs +5 -4
  131. package/dist/shared/utils/isDesktop/isDesktop.mjs +15 -15
  132. package/dist/shared/utils/isIos/index.mjs +5 -4
  133. package/dist/shared/utils/isIos/isIos.mjs +5 -5
  134. package/dist/shared/utils/isServer/index.mjs +4 -3
  135. package/dist/shared/utils/isServer/isServer.mjs +4 -4
  136. package/dist/shared/utils/objectToQueryString/index.mjs +5 -4
  137. package/dist/shared/utils/objectToQueryString/objectToQueryString.mjs +7 -8
  138. package/dist/shared/utils/parseQueryString/index.mjs +4 -3
  139. package/dist/shared/utils/parseQueryString/parseQueryString.mjs +5 -5
  140. package/dist/shared/utils/share/index.mjs +5 -4
  141. package/dist/shared/utils/share/share.mjs +12 -14
  142. package/dist/teacher/home/components/BannerAccount/BannerAccount.fallback.mjs +19 -11
  143. package/dist/teacher/home/components/BannerAccount/BannerAccount.mjs +83 -99
  144. package/dist/teacher/home/components/BannerAccount/index.mjs +6 -7
  145. package/dist/teacher/home/components/Carousel1Account/Carousel1Account.fallback.mjs +127 -67
  146. package/dist/teacher/home/components/Carousel1Account/Carousel1Account.mjs +68 -82
  147. package/dist/teacher/home/components/Carousel1Account/index.mjs +6 -7
  148. package/dist/teacher/home/components/Carousel2Account/Carousel2Account.fallback.mjs +112 -94
  149. package/dist/teacher/home/components/Carousel2Account/Carousel2Account.mjs +79 -85
  150. package/dist/teacher/home/components/Carousel2Account/index.mjs +6 -7
  151. package/dist/teacher/home/components/TextAccount/TextAccount.fallback.mjs +119 -108
  152. package/dist/teacher/home/components/TextAccount/TextAccount.mjs +91 -111
  153. package/dist/teacher/home/components/TextAccount/index.mjs +6 -7
  154. package/dist/teacher/home/components/index.mjs +9 -18
  155. package/dist/teacher/profile/components/AbilityCollection/AbilityBadge/AbilityBadge.mjs +345 -442
  156. package/dist/teacher/profile/components/AbilityCollection/AbilityBadge/index.mjs +5 -5
  157. package/dist/teacher/profile/components/AbilityCollection/AbilityCollection.mjs +106 -109
  158. package/dist/teacher/profile/components/AbilityCollection/AbilityCollection.utils.mjs +54 -58
  159. package/dist/teacher/profile/components/AbilityCollection/index.mjs +7 -8
  160. package/dist/teacher/profile/components/ActivityGallery/ActivityGallery.mjs +73 -104
  161. package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs +81 -95
  162. package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/index.mjs +4 -3
  163. package/dist/teacher/profile/components/ActivityGallery/index.mjs +6 -6
  164. package/dist/teacher/profile/components/AvailableScheduleSection/AvailableScheduleSection.mjs +148 -194
  165. package/dist/teacher/profile/components/AvailableScheduleSection/index.mjs +5 -4
  166. package/dist/teacher/profile/components/CareNoteSection/CareNote/CareNote.mjs +61 -53
  167. package/dist/teacher/profile/components/CareNoteSection/CareNote/index.mjs +5 -4
  168. package/dist/teacher/profile/components/CareNoteSection/CareNoteSection.mjs +72 -81
  169. package/dist/teacher/profile/components/CareNoteSection/CareNoteSection.utils.mjs +17 -12
  170. package/dist/teacher/profile/components/CareNoteSection/index.mjs +6 -6
  171. package/dist/teacher/profile/components/CareerSection/CareerItem/CareerItem.mjs +108 -134
  172. package/dist/teacher/profile/components/CareerSection/CareerItem/index.mjs +5 -4
  173. package/dist/teacher/profile/components/CareerSection/CareerSection.mjs +133 -176
  174. package/dist/teacher/profile/components/CareerSection/index.mjs +6 -6
  175. package/dist/teacher/profile/components/CertificateSection/CertificateItem/CertificateItem.mjs +82 -88
  176. package/dist/teacher/profile/components/CertificateSection/CertificateItem/index.mjs +4 -3
  177. package/dist/teacher/profile/components/CertificateSection/CertificateSection.mjs +112 -141
  178. package/dist/teacher/profile/components/CertificateSection/index.mjs +6 -6
  179. package/dist/teacher/profile/components/EducationSection/EducationItem/EducationItem.mjs +96 -111
  180. package/dist/teacher/profile/components/EducationSection/EducationItem/index.mjs +5 -4
  181. package/dist/teacher/profile/components/EducationSection/EducationSection.mjs +112 -141
  182. package/dist/teacher/profile/components/EducationSection/index.mjs +6 -6
  183. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewCard/ParentReviewCard.mjs +107 -102
  184. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewCard/index.mjs +5 -4
  185. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewSection.mjs +85 -81
  186. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewSection.utils.mjs +17 -12
  187. package/dist/teacher/profile/components/ParentReviewSection/index.mjs +7 -8
  188. package/dist/teacher/profile/components/PreferredActivityKeywordGroup/PreferredActivityKeywordGroup.mjs +43 -36
  189. package/dist/teacher/profile/components/PreferredActivityKeywordGroup/index.mjs +4 -3
  190. package/dist/teacher/profile/components/PreferredAgeGroup/PreferredAgeGroup.mjs +44 -31
  191. package/dist/teacher/profile/components/PreferredAgeGroup/PreferredAgeGroup.utils.mjs +11 -12
  192. package/dist/teacher/profile/components/PreferredAgeGroup/index.mjs +5 -5
  193. package/dist/teacher/profile/components/ProfileSummary/ProfileSummary.mjs +348 -433
  194. package/dist/teacher/profile/components/ProfileSummary/ProfileSummary.utils.mjs +7 -7
  195. package/dist/teacher/profile/components/ProfileSummary/index.mjs +5 -4
  196. package/dist/teacher/profile/components/StatBadgeCollection/StatBadge/StatBadge.mjs +80 -105
  197. package/dist/teacher/profile/components/StatBadgeCollection/StatBadge/index.mjs +5 -4
  198. package/dist/teacher/profile/components/StatBadgeCollection/StatBadgeCollection.mjs +34 -27
  199. package/dist/teacher/profile/components/StatBadgeCollection/index.mjs +6 -6
  200. package/dist/teacher/profile/components/index.mjs +24 -48
  201. package/dist/teacher/profile/utils/index.mjs +2 -4
  202. package/dist/teacher/profile/utils/sortItems/index.mjs +5 -4
  203. package/dist/teacher/profile/utils/sortItems/sortItems.mjs +48 -48
  204. package/package.json +1 -1
  205. package/dist/purify.es-BGaRrCfO.js +0 -553
@@ -1,277 +1,241 @@
1
- import { jsx as W } from "react/jsx-runtime";
2
- import { useState as v, useRef as u, Children as S, isValidElement as Q, useMemo as lt, useEffect as M, cloneElement as Y } from "react";
3
- import { Box as Z, Flexbox as ft } from "@dotss/ui";
4
- import gt from "@dotss/ui/core/useTheme";
5
- import { findImageInChildren as pt, getHorizontalLayoutRows as ht, getNextIndexHorizontalFromRows as dt, findNextFocusableElement as z } from "./Masonry.utils.mjs";
6
- import _ from "./MasonryBlock/MasonryBlock.mjs";
7
- import mt from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
8
- import vt from "../../utils/getImageUrl/getImageUrl.mjs";
9
- import K from "../../../teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs";
10
- function zt({
11
- children: A,
12
- columnCount: x = 2,
13
- rowCount: F = 2,
14
- spacing: c = 2,
15
- edgeSpacing: w = 0,
16
- direction: L = "vertical",
17
- defaultContainerWidth: O = 360,
18
- defaultContainerHeight: tt = 0,
19
- ...l
20
- }) {
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
- /* @__PURE__ */ new Map()
23
- ), [y, ot] = v(
24
- S.toArray(A).filter(Q).filter((t) => t.type === _ || t.type === K)
25
- ), [d, X] = v(
26
- y.map((t) => {
27
- var o;
28
- const r = ((o = pt(t.props.children)) == null ? void 0 : o.props.src) || "";
29
- if (!r) return null;
30
- const e = t.props.width ?? f, n = t.props.height ?? p;
31
- return {
32
- originalSrc: r,
33
- originWidth: e,
34
- originHeight: n,
35
- src: vt({
36
- src: r,
37
- width: e
38
- }),
39
- width: e,
40
- height: n,
41
- loaded: !1
42
- };
43
- }).filter((t) => t !== null)
44
- ), G = y.length, j = lt(() => d.length ? new Map(d.map((t) => [t.originalSrc, t])) : null, [d]), q = (t) => {
45
- var r, e;
46
- I.current = !0, P.current = t.clientX - (((r = s.current) == null ? void 0 : r.offsetLeft) || 0), C.current = ((e = s.current) == null ? void 0 : e.scrollLeft) || 0;
47
- }, V = (t) => {
48
- I.current && (t.currentTarget.style.cursor = "grabbing", s.current && (s.current.scrollLeft = C.current - (t.clientX - s.current.offsetLeft - P.current)));
49
- }, E = (t) => {
50
- var e;
51
- I.current = !1, C.current !== ((e = s.current) == null ? void 0 : e.scrollLeft) ? (t.currentTarget.style.cursor = "grab", k.current = !1, m.current && cancelAnimationFrame(m.current), m.current = requestAnimationFrame(() => {
52
- k.current = !0;
53
- })) : k.current = !0;
54
- }, at = (t) => (r) => {
55
- r.stopPropagation();
56
- let e = null;
57
- switch (r.key) {
58
- case "ArrowRight":
59
- r.preventDefault(), e = z(r.currentTarget, "right", g.current);
60
- break;
61
- case "ArrowLeft":
62
- r.preventDefault(), e = z(r.currentTarget, "left", g.current);
63
- break;
64
- case "ArrowDown":
65
- r.preventDefault(), e = z(r.currentTarget, "down", g.current);
66
- break;
67
- case "ArrowUp":
68
- r.preventDefault(), e = z(r.currentTarget, "up", g.current);
69
- break;
70
- case "Enter":
71
- case " ": {
72
- r.preventDefault(), r.currentTarget.click();
73
- return;
74
- }
75
- default:
76
- return;
77
- }
78
- e == null || e.focus(), t == null || t(r);
79
- }, st = (t) => (r) => {
80
- if (r.stopPropagation(), r.key === "Enter" || r.key === " ") {
81
- r.preventDefault(), r.currentTarget.click();
82
- return;
83
- }
84
- const e = Number(r.currentTarget.getAttribute("aria-posinset")) - 1, n = r.key.replace("Arrow", "").toLowerCase();
85
- if (!["left", "right", "up", "down"].includes(n)) {
86
- t == null || t(r);
87
- return;
88
- }
89
- r.preventDefault();
90
- const o = dt(
91
- R.current,
92
- e,
93
- n
94
- ), a = g.current[o ?? -1];
95
- a == null || a.focus(), t == null || t(r);
96
- }, it = (t) => (r) => {
97
- g.current[t] = r;
98
- }, ut = (t, r, e) => (n) => {
99
- R.current[r] || (R.current[r] = []), g.current[t] = n, R.current[r][e] = n;
100
- }, $ = (t) => (r) => {
101
- nt(Number(r.currentTarget.getAttribute("aria-posinset")) - 1), t == null || t(r);
102
- }, T = (t) => {
103
- const { naturalWidth: r, naturalHeight: e, src: n } = t.currentTarget;
104
- h.current.set(n, { naturalWidth: r, naturalHeight: e }), h.current.size === d.length && X(
105
- (o) => o.map((a) => {
106
- const i = h.current.get(a.src);
107
- return i ? {
108
- ...a,
109
- width: i.naturalWidth / i.naturalHeight * (a.height ?? p) || f,
110
- height: a.height ?? p,
111
- loaded: !0
112
- } : a;
113
- })
114
- );
115
- }, J = (t, r, e) => {
116
- h.current.set(e, { naturalWidth: t, naturalHeight: r }), h.current.size === d.length && X(
117
- (n) => n.map((o) => {
118
- const a = h.current.get(o.src);
119
- return a ? {
120
- ...o,
121
- width: a.naturalWidth / a.naturalHeight * (o.height ?? p) || f,
122
- height: o.height ?? p,
123
- loaded: !0
124
- } : o;
125
- })
126
- );
127
- };
128
- if (M(() => {
129
- const t = s.current, r = (e) => {
130
- k.current || e.stopPropagation();
131
- };
132
- return t == null || t.addEventListener("click", r), () => {
133
- t == null || t.removeEventListener("click", r);
134
- };
135
- }, []), M(() => {
136
- const t = s.current, r = (e) => {
137
- e.stopPropagation();
138
- };
139
- return t == null || t.addEventListener("touchmove", r), () => {
140
- t == null || t.removeEventListener("touchmove", r);
141
- };
142
- }, []), M(() => {
143
- ot(
144
- S.toArray(A).filter(Q).filter((t) => t.type === _ || t.type === K)
145
- );
146
- }, [A]), mt(() => {
147
- var t, r, e;
148
- B(((r = (t = s.current) == null ? void 0 : t.parentElement) == null ? void 0 : r.offsetWidth) ?? 0), U(((e = s.current) == null ? void 0 : e.offsetHeight) ?? 0);
149
- }, []), M(() => {
150
- const t = () => {
151
- var r, e, n;
152
- B(((e = (r = s.current) == null ? void 0 : r.parentElement) == null ? void 0 : e.offsetWidth) ?? 0), U(((n = s.current) == null ? void 0 : n.offsetHeight) ?? 0);
153
- };
154
- return t(), window.addEventListener("resize", t), () => {
155
- window.removeEventListener("resize", t);
156
- };
157
- }, []), M(() => () => {
158
- m.current && cancelAnimationFrame(m.current);
159
- }, []), L === "horizontal") {
160
- const t = ht(
161
- d,
162
- y,
163
- F,
164
- f * b / 2
165
- );
166
- let r = f * b / 2;
167
- r = r <= 0 ? 120 : r;
168
- let e = 0;
169
- return /* @__PURE__ */ W(
170
- Z,
171
- {
172
- ref: s,
173
- role: "list",
174
- "aria-label": "콘텐츠",
175
- "aria-orientation": "horizontal",
176
- onMouseDown: q,
177
- onMouseMove: V,
178
- onMouseUp: E,
179
- onMouseLeave: E,
180
- pl: w,
181
- pr: w,
182
- ...l,
183
- inlineCSS: {
184
- display: "grid",
185
- position: "relative",
186
- width: "100%",
187
- height: "100%",
188
- overflowX: "auto",
189
- scrollbarWidth: "none",
190
- cursor: "grab",
191
- transform: "translate3d(0, 0, 0)",
192
- "&::-webkit-scrollbar": {
193
- display: "none"
194
- },
195
- ...l == null ? void 0 : l.inlineCSS
196
- },
197
- children: t.map((n, o) => {
198
- const a = o === t.length - 1;
199
- return /* @__PURE__ */ W(ft, { gap: c, children: n.map((i, ct) => {
200
- const D = e++;
201
- return Y(i, {
202
- setInnerRef: ut(D, o, ct),
203
- tabIndex: D === N ? 0 : -1,
204
- role: "listitem",
205
- "aria-posinset": D + 1,
206
- "aria-setsize": G,
207
- width: i.props.width ?? r,
208
- height: i.props.height ?? p,
209
- direction: L,
210
- spacing: c,
211
- sourceMetadataMap: j ?? void 0,
212
- onLoad: T,
213
- onManualLoad: J,
214
- onError: T,
215
- onKeyDown: st(i.props.onKeyDown),
216
- onFocus: $(i.props.onFocus),
217
- style: {
218
- marginBottom: a ? 0 : H.content(c),
219
- ...i.props.style
220
- },
221
- ...i.props
222
- });
223
- }) }, `masonry-row-${o}`);
224
- })
225
- }
226
- );
227
- }
228
- return /* @__PURE__ */ W(
229
- Z,
230
- {
231
- ref: s,
232
- role: "list",
233
- "aria-label": "콘텐츠",
234
- "aria-orientation": "vertical",
235
- onMouseDown: q,
236
- onMouseMove: V,
237
- onMouseUp: E,
238
- onMouseLeave: E,
239
- pt: w,
240
- pb: w,
241
- ...l,
242
- inlineCSS: {
243
- width: "100%",
244
- position: "relative",
245
- transform: "translate3d(0, 0, 0)",
246
- columnCount: x,
247
- columnGap: H.content(c),
248
- marginTop: -H.content(c),
249
- ...l == null ? void 0 : l.inlineCSS
250
- },
251
- children: S.map(
252
- y,
253
- (t, r) => Y(t, {
254
- setInnerRef: it(r),
255
- role: "listitem",
256
- tabIndex: r === N ? 0 : -1,
257
- "aria-posinset": r + 1,
258
- "aria-setsize": G,
259
- width: t.props.width ?? f,
260
- height: t.props.height ?? f * b / 2,
261
- direction: L,
262
- spacing: c,
263
- sourceMetadataMap: j ?? void 0,
264
- onLoad: T,
265
- onManualLoad: J,
266
- onError: T,
267
- onKeyDown: at(t.props.onKeyDown),
268
- onFocus: $(t.props.onFocus),
269
- ...t.props
270
- })
271
- )
272
- }
273
- );
1
+ import e from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
2
+ import t from "../../utils/getImageUrl/index.mjs";
3
+ import { findImageInChildren as n, findNextFocusableElement as r, getHorizontalLayoutRows as i, getNextIndexHorizontalFromRows as a } from "./Masonry.utils.mjs";
4
+ import o from "./MasonryBlock/index.mjs";
5
+ import s from "../../../teacher/profile/components/ActivityGallery/ActivityGalleryItem/index.mjs";
6
+ import { Children as c, cloneElement as l, isValidElement as u, useEffect as d, useMemo as ee, useRef as f, useState as p } from "react";
7
+ import { Box as m, Flexbox as h } from "@dotss/ui";
8
+ import te from "@dotss/ui/core/useTheme";
9
+ import { jsx as g } from "react/jsx-runtime";
10
+ //#region shared/components/Masonry/Masonry.tsx
11
+ function _({ children: _, columnCount: v = 2, rowCount: y = 2, spacing: b = 2, edgeSpacing: x = 0, direction: S = "vertical", defaultContainerWidth: C = 360, defaultContainerHeight: w = 0, ...T }) {
12
+ let { spacing: E } = te(), [ne, D] = p(C), [re, O] = p(w), [k, A] = p(0), j = 4 / 3, M = (ne - b) / v, N = S === "horizontal" ? (re - b) / y : M * j, P = f(null), F = f([]), I = f([]), L = f(!1), R = f(!0), z = f(0), B = f(0), V = f(0), H = f(/* @__PURE__ */ new Map()), [U, ie] = p(c.toArray(_).filter(u).filter((e) => e.type === o || e.type === s)), [W, G] = p(U.map((e) => {
13
+ let r = n(e.props.children)?.props.src || "";
14
+ if (!r) return null;
15
+ let i = e.props.width ?? M, a = e.props.height ?? N;
16
+ return {
17
+ originalSrc: r,
18
+ originWidth: i,
19
+ originHeight: a,
20
+ src: t({
21
+ src: r,
22
+ width: i
23
+ }),
24
+ width: i,
25
+ height: a,
26
+ loaded: !1
27
+ };
28
+ }).filter((e) => e !== null)), K = U.length, q = ee(() => W.length ? new Map(W.map((e) => [e.originalSrc, e])) : null, [W]), J = (e) => {
29
+ L.current = !0, z.current = e.clientX - (P.current?.offsetLeft || 0), B.current = P.current?.scrollLeft || 0;
30
+ }, Y = (e) => {
31
+ L.current && (e.currentTarget.style.cursor = "grabbing", P.current && (P.current.scrollLeft = B.current - (e.clientX - P.current.offsetLeft - z.current)));
32
+ }, X = (e) => {
33
+ L.current = !1, B.current === P.current?.scrollLeft ? R.current = !0 : (e.currentTarget.style.cursor = "grab", R.current = !1, V.current && cancelAnimationFrame(V.current), V.current = requestAnimationFrame(() => {
34
+ R.current = !0;
35
+ }));
36
+ }, ae = (e) => (t) => {
37
+ t.stopPropagation();
38
+ let n = null;
39
+ switch (t.key) {
40
+ case "ArrowRight":
41
+ t.preventDefault(), n = r(t.currentTarget, "right", F.current);
42
+ break;
43
+ case "ArrowLeft":
44
+ t.preventDefault(), n = r(t.currentTarget, "left", F.current);
45
+ break;
46
+ case "ArrowDown":
47
+ t.preventDefault(), n = r(t.currentTarget, "down", F.current);
48
+ break;
49
+ case "ArrowUp":
50
+ t.preventDefault(), n = r(t.currentTarget, "up", F.current);
51
+ break;
52
+ case "Enter":
53
+ case " ":
54
+ t.preventDefault(), t.currentTarget.click();
55
+ return;
56
+ default: return;
57
+ }
58
+ n?.focus(), e?.(t);
59
+ }, oe = (e) => (t) => {
60
+ if (t.stopPropagation(), t.key === "Enter" || t.key === " ") {
61
+ t.preventDefault(), t.currentTarget.click();
62
+ return;
63
+ }
64
+ let n = Number(t.currentTarget.getAttribute("aria-posinset")) - 1, r = t.key.replace("Arrow", "").toLowerCase();
65
+ if (![
66
+ "left",
67
+ "right",
68
+ "up",
69
+ "down"
70
+ ].includes(r)) {
71
+ e?.(t);
72
+ return;
73
+ }
74
+ t.preventDefault();
75
+ let i = a(I.current, n, r);
76
+ F.current[i ?? -1]?.focus(), e?.(t);
77
+ }, se = (e) => (t) => {
78
+ F.current[e] = t;
79
+ }, ce = (e, t, n) => (r) => {
80
+ I.current[t] || (I.current[t] = []), F.current[e] = r, I.current[t][n] = r;
81
+ }, Z = (e) => (t) => {
82
+ A(Number(t.currentTarget.getAttribute("aria-posinset")) - 1), e?.(t);
83
+ }, Q = (e) => {
84
+ let { naturalWidth: t, naturalHeight: n, src: r } = e.currentTarget;
85
+ H.current.set(r, {
86
+ naturalWidth: t,
87
+ naturalHeight: n
88
+ }), H.current.size === W.length && G((e) => e.map((e) => {
89
+ let t = H.current.get(e.src);
90
+ return t ? {
91
+ ...e,
92
+ width: t.naturalWidth / t.naturalHeight * (e.height ?? N) || M,
93
+ height: e.height ?? N,
94
+ loaded: !0
95
+ } : e;
96
+ }));
97
+ }, $ = (e, t, n) => {
98
+ H.current.set(n, {
99
+ naturalWidth: e,
100
+ naturalHeight: t
101
+ }), H.current.size === W.length && G((e) => e.map((e) => {
102
+ let t = H.current.get(e.src);
103
+ return t ? {
104
+ ...e,
105
+ width: t.naturalWidth / t.naturalHeight * (e.height ?? N) || M,
106
+ height: e.height ?? N,
107
+ loaded: !0
108
+ } : e;
109
+ }));
110
+ };
111
+ if (d(() => {
112
+ let e = P.current, t = (e) => {
113
+ R.current || e.stopPropagation();
114
+ };
115
+ return e?.addEventListener("click", t), () => {
116
+ e?.removeEventListener("click", t);
117
+ };
118
+ }, []), d(() => {
119
+ let e = P.current, t = (e) => {
120
+ e.stopPropagation();
121
+ };
122
+ return e?.addEventListener("touchmove", t), () => {
123
+ e?.removeEventListener("touchmove", t);
124
+ };
125
+ }, []), d(() => {
126
+ ie(c.toArray(_).filter(u).filter((e) => e.type === o || e.type === s));
127
+ }, [_]), e(() => {
128
+ D(P.current?.parentElement?.offsetWidth ?? 0), O(P.current?.offsetHeight ?? 0);
129
+ }, []), d(() => {
130
+ let e = () => {
131
+ D(P.current?.parentElement?.offsetWidth ?? 0), O(P.current?.offsetHeight ?? 0);
132
+ };
133
+ return e(), window.addEventListener("resize", e), () => {
134
+ window.removeEventListener("resize", e);
135
+ };
136
+ }, []), d(() => () => {
137
+ V.current && cancelAnimationFrame(V.current);
138
+ }, []), S === "horizontal") {
139
+ let e = i(W, U, y, M * j / 2), t = M * j / 2;
140
+ t = t <= 0 ? 120 : t;
141
+ let n = 0;
142
+ return /* @__PURE__ */ g(m, {
143
+ ref: P,
144
+ role: "list",
145
+ "aria-label": "콘텐츠",
146
+ "aria-orientation": "horizontal",
147
+ onMouseDown: J,
148
+ onMouseMove: Y,
149
+ onMouseUp: X,
150
+ onMouseLeave: X,
151
+ pl: x,
152
+ pr: x,
153
+ ...T,
154
+ inlineCSS: {
155
+ display: "grid",
156
+ position: "relative",
157
+ width: "100%",
158
+ height: "100%",
159
+ overflowX: "auto",
160
+ scrollbarWidth: "none",
161
+ cursor: "grab",
162
+ transform: "translate3d(0, 0, 0)",
163
+ "&::-webkit-scrollbar": { display: "none" },
164
+ ...T?.inlineCSS
165
+ },
166
+ children: e.map((r, i) => {
167
+ let a = i === e.length - 1;
168
+ return /* @__PURE__ */ g(h, {
169
+ gap: b,
170
+ children: r.map((e, r) => {
171
+ let o = n++;
172
+ return l(e, {
173
+ setInnerRef: ce(o, i, r),
174
+ tabIndex: o === k ? 0 : -1,
175
+ role: "listitem",
176
+ "aria-posinset": o + 1,
177
+ "aria-setsize": K,
178
+ width: e.props.width ?? t,
179
+ height: e.props.height ?? N,
180
+ direction: S,
181
+ spacing: b,
182
+ sourceMetadataMap: q ?? void 0,
183
+ onLoad: Q,
184
+ onManualLoad: $,
185
+ onError: Q,
186
+ onKeyDown: oe(e.props.onKeyDown),
187
+ onFocus: Z(e.props.onFocus),
188
+ style: {
189
+ marginBottom: a ? 0 : E.content(b),
190
+ ...e.props.style
191
+ },
192
+ ...e.props
193
+ });
194
+ })
195
+ }, `masonry-row-${i}`);
196
+ })
197
+ });
198
+ }
199
+ return /* @__PURE__ */ g(m, {
200
+ ref: P,
201
+ role: "list",
202
+ "aria-label": "콘텐츠",
203
+ "aria-orientation": "vertical",
204
+ onMouseDown: J,
205
+ onMouseMove: Y,
206
+ onMouseUp: X,
207
+ onMouseLeave: X,
208
+ pt: x,
209
+ pb: x,
210
+ ...T,
211
+ inlineCSS: {
212
+ width: "100%",
213
+ position: "relative",
214
+ transform: "translate3d(0, 0, 0)",
215
+ columnCount: v,
216
+ columnGap: E.content(b),
217
+ marginTop: -E.content(b),
218
+ ...T?.inlineCSS
219
+ },
220
+ children: c.map(U, (e, t) => l(e, {
221
+ setInnerRef: se(t),
222
+ role: "listitem",
223
+ tabIndex: t === k ? 0 : -1,
224
+ "aria-posinset": t + 1,
225
+ "aria-setsize": K,
226
+ width: e.props.width ?? M,
227
+ height: e.props.height ?? M * j / 2,
228
+ direction: S,
229
+ spacing: b,
230
+ sourceMetadataMap: q ?? void 0,
231
+ onLoad: Q,
232
+ onManualLoad: $,
233
+ onError: Q,
234
+ onKeyDown: ae(e.props.onKeyDown),
235
+ onFocus: Z(e.props.onFocus),
236
+ ...e.props
237
+ }))
238
+ });
274
239
  }
275
- export {
276
- zt as default
277
- };
240
+ //#endregion
241
+ export { _ as default };