@dotss/tictoccroc 0.4.2 → 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 (204) 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.mjs +90 -108
  24. package/dist/parent/notification/components/NotificationCard/index.mjs +5 -4
  25. package/dist/parent/notification/components/index.mjs +2 -4
  26. package/dist/parent/notification/utils/index.mjs +2 -4
  27. package/dist/parent/notification/utils/sanitize/sanitize.mjs +6 -6
  28. package/dist/purify.es-D3W4zDrg.js +549 -0
  29. package/dist/shared/components/Calendar/Calendar.mjs +2 -80
  30. package/dist/shared/components/Calendar/index.mjs +5 -4
  31. package/dist/shared/components/Carousel/Carousel.mjs +184 -210
  32. package/dist/shared/components/Carousel/CarouselSlide/CarouselSlide.mjs +10 -7
  33. package/dist/shared/components/Carousel/CarouselSlide/index.mjs +5 -4
  34. package/dist/shared/components/Carousel/index.mjs +6 -6
  35. package/dist/shared/components/ChatKit/BotMessage/BotMessage.mjs +151 -183
  36. package/dist/shared/components/ChatKit/BotMessage/BotMessage.utils.mjs +30 -50
  37. package/dist/shared/components/ChatKit/BotMessage/index.mjs +6 -8
  38. package/dist/shared/components/ChatKit/InputBar/InputBar.fallback.mjs +64 -84
  39. package/dist/shared/components/ChatKit/InputBar/InputBar.mjs +105 -130
  40. package/dist/shared/components/ChatKit/InputBar/index.mjs +6 -6
  41. package/dist/shared/components/ChatKit/Message/Message.fallback.mjs +50 -66
  42. package/dist/shared/components/ChatKit/Message/Message.mjs +178 -276
  43. package/dist/shared/components/ChatKit/Message/Message.utils.mjs +20 -31
  44. package/dist/shared/components/ChatKit/Message/index.mjs +7 -9
  45. package/dist/shared/components/ChatKit/Seperator/Seperator.mjs +31 -27
  46. package/dist/shared/components/ChatKit/Seperator/index.mjs +4 -3
  47. package/dist/shared/components/ChatKit/SystemMessage/(Actions)/DirectTrageRiskInfoBottomSheet/DirectTrageRiskInfoBottomSheet.mjs +183 -153
  48. package/dist/shared/components/ChatKit/SystemMessage/SystemMessage.mjs +83 -108
  49. package/dist/shared/components/ChatKit/SystemMessage/SystemMessage.utils.mjs +5 -5
  50. package/dist/shared/components/ChatKit/SystemMessage/index.mjs +7 -8
  51. package/dist/shared/components/ChatKit/UnreadMessagePill/UnreadMessagePill.mjs +49 -54
  52. package/dist/shared/components/ChatKit/UnreadMessagePill/index.mjs +5 -4
  53. package/dist/shared/components/ChatKit/index.mjs +13 -29
  54. package/dist/shared/components/Image/Image.d.ts +2 -0
  55. package/dist/shared/components/Image/Image.error.mjs +34 -40
  56. package/dist/shared/components/Image/Image.mjs +247 -289
  57. package/dist/shared/components/Image/index.mjs +6 -6
  58. package/dist/shared/components/LoadingAnnouncer/LoadingAnnouncer.mjs +19 -18
  59. package/dist/shared/components/LoadingAnnouncer/index.mjs +5 -4
  60. package/dist/shared/components/Masonry/Masonry.mjs +240 -276
  61. package/dist/shared/components/Masonry/Masonry.utils.mjs +62 -81
  62. package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.mjs +111 -144
  63. package/dist/shared/components/Masonry/MasonryBlock/index.mjs +5 -4
  64. package/dist/shared/components/Masonry/index.mjs +6 -6
  65. package/dist/shared/components/MediaDialog/MediaBlock/MediaBlock.mjs +54 -69
  66. package/dist/shared/components/MediaDialog/MediaBlock/index.mjs +5 -4
  67. package/dist/shared/components/MediaDialog/MediaDialog.mjs +216 -330
  68. package/dist/shared/components/MediaDialog/MediaDialogContent/MediaDialogContent.mjs +18 -21
  69. package/dist/shared/components/MediaDialog/MediaDialogContent/index.mjs +5 -4
  70. package/dist/shared/components/MediaDialog/MediaDialogFooter/MediaDialogFooter.mjs +22 -27
  71. package/dist/shared/components/MediaDialog/MediaDialogFooter/index.mjs +5 -4
  72. package/dist/shared/components/MediaDialog/MediaDialogToolbar/MediaDialogToolbar.mjs +15 -21
  73. package/dist/shared/components/MediaDialog/MediaDialogToolbar/index.mjs +5 -4
  74. package/dist/shared/components/MediaDialog/index.mjs +9 -12
  75. package/dist/shared/components/Roller/Roller.mjs +99 -132
  76. package/dist/shared/components/Roller/RollerBlock/RollerBlock.mjs +9 -6
  77. package/dist/shared/components/Roller/RollerBlock/index.mjs +5 -4
  78. package/dist/shared/components/Roller/index.mjs +6 -6
  79. package/dist/shared/components/Scheduler/ScheduleBlock/ScheduleBlock.mjs +22 -30
  80. package/dist/shared/components/Scheduler/ScheduleBlock/index.mjs +5 -4
  81. package/dist/shared/components/Scheduler/ScheduleEvent/ScheduleEvent.mjs +25 -35
  82. package/dist/shared/components/Scheduler/ScheduleEvent/index.mjs +5 -4
  83. package/dist/shared/components/Scheduler/Scheduler.mjs +472 -567
  84. package/dist/shared/components/Scheduler/Scheduler.utils.mjs +78 -101
  85. package/dist/shared/components/Scheduler/index.mjs +8 -10
  86. package/dist/shared/components/Swiper/Swiper.mjs +238 -283
  87. package/dist/shared/components/Swiper/Swiper.utils.mjs +19 -24
  88. package/dist/shared/components/Swiper/SwiperBlock/SwiperBlock.mjs +14 -17
  89. package/dist/shared/components/Swiper/SwiperBlock/index.mjs +5 -4
  90. package/dist/shared/components/Swiper/index.mjs +6 -6
  91. package/dist/shared/components/TextField/TextField.mjs +44 -55
  92. package/dist/shared/components/TextField/index.mjs +5 -4
  93. package/dist/shared/components/TimePicker/TimePicker.mjs +2 -120
  94. package/dist/shared/components/TimePicker/index.mjs +5 -4
  95. package/dist/shared/components/index.mjs +36 -75
  96. package/dist/shared/hooks/index.mjs +4 -8
  97. package/dist/shared/hooks/useCombineRef/index.mjs +5 -4
  98. package/dist/shared/hooks/useCombineRef/useCombineRef.mjs +7 -7
  99. package/dist/shared/hooks/useInView/index.mjs +5 -4
  100. package/dist/shared/hooks/useInView/useInView.d.ts +2 -1
  101. package/dist/shared/hooks/useInView/useInView.mjs +37 -47
  102. package/dist/shared/hooks/useIsomorphicLayoutEffect/index.mjs +5 -4
  103. package/dist/shared/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +6 -6
  104. package/dist/shared/typings/common.mjs +6 -4
  105. package/dist/shared/typings/index.mjs +2 -4
  106. package/dist/shared/utils/ageToBirthDate/ageToBirthDate.mjs +17 -9
  107. package/dist/shared/utils/ageToBirthDate/index.mjs +5 -4
  108. package/dist/shared/utils/birthDateToAge/birthDateToAge.mjs +9 -10
  109. package/dist/shared/utils/birthDateToAge/index.mjs +4 -3
  110. package/dist/shared/utils/combineRef/combineRef.mjs +20 -23
  111. package/dist/shared/utils/combineRef/index.mjs +5 -4
  112. package/dist/shared/utils/dayFlagToDay/dayFlagToDay.mjs +15 -23
  113. package/dist/shared/utils/dayFlagToDay/index.mjs +5 -4
  114. package/dist/shared/utils/getCareTypeLabel/getCareTypeLabel.mjs +13 -20
  115. package/dist/shared/utils/getCareTypeLabel/index.mjs +5 -4
  116. package/dist/shared/utils/getDateRange/getDateRange.mjs +15 -20
  117. package/dist/shared/utils/getDateRange/index.mjs +5 -4
  118. package/dist/shared/utils/getImageUrl/getImageUrl.mjs +7 -17
  119. package/dist/shared/utils/getImageUrl/index.mjs +5 -6
  120. package/dist/shared/utils/getTimeRange/getTimeRange.mjs +19 -21
  121. package/dist/shared/utils/getTimeRange/index.mjs +5 -4
  122. package/dist/shared/utils/getVimeoId/getVimeoId.mjs +11 -11
  123. package/dist/shared/utils/getVimeoId/index.mjs +5 -4
  124. package/dist/shared/utils/index.mjs +18 -36
  125. package/dist/shared/utils/isAndroid/index.mjs +5 -4
  126. package/dist/shared/utils/isAndroid/isAndroid.mjs +5 -5
  127. package/dist/shared/utils/isApp/index.mjs +5 -4
  128. package/dist/shared/utils/isApp/isApp.mjs +4 -4
  129. package/dist/shared/utils/isDesktop/index.mjs +5 -4
  130. package/dist/shared/utils/isDesktop/isDesktop.mjs +15 -15
  131. package/dist/shared/utils/isIos/index.mjs +5 -4
  132. package/dist/shared/utils/isIos/isIos.mjs +5 -5
  133. package/dist/shared/utils/isServer/index.mjs +4 -3
  134. package/dist/shared/utils/isServer/isServer.mjs +4 -4
  135. package/dist/shared/utils/objectToQueryString/index.mjs +5 -4
  136. package/dist/shared/utils/objectToQueryString/objectToQueryString.mjs +7 -8
  137. package/dist/shared/utils/parseQueryString/index.mjs +4 -3
  138. package/dist/shared/utils/parseQueryString/parseQueryString.mjs +5 -5
  139. package/dist/shared/utils/share/index.mjs +5 -4
  140. package/dist/shared/utils/share/share.mjs +12 -14
  141. package/dist/teacher/home/components/BannerAccount/BannerAccount.fallback.mjs +19 -11
  142. package/dist/teacher/home/components/BannerAccount/BannerAccount.mjs +83 -99
  143. package/dist/teacher/home/components/BannerAccount/index.mjs +6 -7
  144. package/dist/teacher/home/components/Carousel1Account/Carousel1Account.fallback.mjs +127 -67
  145. package/dist/teacher/home/components/Carousel1Account/Carousel1Account.mjs +68 -82
  146. package/dist/teacher/home/components/Carousel1Account/index.mjs +6 -7
  147. package/dist/teacher/home/components/Carousel2Account/Carousel2Account.fallback.mjs +112 -94
  148. package/dist/teacher/home/components/Carousel2Account/Carousel2Account.mjs +79 -85
  149. package/dist/teacher/home/components/Carousel2Account/index.mjs +6 -7
  150. package/dist/teacher/home/components/TextAccount/TextAccount.fallback.mjs +119 -108
  151. package/dist/teacher/home/components/TextAccount/TextAccount.mjs +91 -111
  152. package/dist/teacher/home/components/TextAccount/index.mjs +6 -7
  153. package/dist/teacher/home/components/index.mjs +9 -18
  154. package/dist/teacher/profile/components/AbilityCollection/AbilityBadge/AbilityBadge.mjs +345 -442
  155. package/dist/teacher/profile/components/AbilityCollection/AbilityBadge/index.mjs +5 -5
  156. package/dist/teacher/profile/components/AbilityCollection/AbilityCollection.mjs +106 -109
  157. package/dist/teacher/profile/components/AbilityCollection/AbilityCollection.utils.mjs +54 -58
  158. package/dist/teacher/profile/components/AbilityCollection/index.mjs +7 -8
  159. package/dist/teacher/profile/components/ActivityGallery/ActivityGallery.mjs +73 -104
  160. package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/ActivityGalleryItem.mjs +81 -95
  161. package/dist/teacher/profile/components/ActivityGallery/ActivityGalleryItem/index.mjs +4 -3
  162. package/dist/teacher/profile/components/ActivityGallery/index.mjs +6 -6
  163. package/dist/teacher/profile/components/AvailableScheduleSection/AvailableScheduleSection.mjs +148 -194
  164. package/dist/teacher/profile/components/AvailableScheduleSection/index.mjs +5 -4
  165. package/dist/teacher/profile/components/CareNoteSection/CareNote/CareNote.mjs +61 -53
  166. package/dist/teacher/profile/components/CareNoteSection/CareNote/index.mjs +5 -4
  167. package/dist/teacher/profile/components/CareNoteSection/CareNoteSection.mjs +72 -81
  168. package/dist/teacher/profile/components/CareNoteSection/CareNoteSection.utils.mjs +17 -12
  169. package/dist/teacher/profile/components/CareNoteSection/index.mjs +6 -6
  170. package/dist/teacher/profile/components/CareerSection/CareerItem/CareerItem.mjs +108 -134
  171. package/dist/teacher/profile/components/CareerSection/CareerItem/index.mjs +5 -4
  172. package/dist/teacher/profile/components/CareerSection/CareerSection.mjs +133 -176
  173. package/dist/teacher/profile/components/CareerSection/index.mjs +6 -6
  174. package/dist/teacher/profile/components/CertificateSection/CertificateItem/CertificateItem.mjs +82 -88
  175. package/dist/teacher/profile/components/CertificateSection/CertificateItem/index.mjs +4 -3
  176. package/dist/teacher/profile/components/CertificateSection/CertificateSection.mjs +112 -141
  177. package/dist/teacher/profile/components/CertificateSection/index.mjs +6 -6
  178. package/dist/teacher/profile/components/EducationSection/EducationItem/EducationItem.mjs +96 -111
  179. package/dist/teacher/profile/components/EducationSection/EducationItem/index.mjs +5 -4
  180. package/dist/teacher/profile/components/EducationSection/EducationSection.mjs +112 -141
  181. package/dist/teacher/profile/components/EducationSection/index.mjs +6 -6
  182. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewCard/ParentReviewCard.mjs +107 -102
  183. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewCard/index.mjs +5 -4
  184. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewSection.mjs +85 -81
  185. package/dist/teacher/profile/components/ParentReviewSection/ParentReviewSection.utils.mjs +17 -12
  186. package/dist/teacher/profile/components/ParentReviewSection/index.mjs +7 -8
  187. package/dist/teacher/profile/components/PreferredActivityKeywordGroup/PreferredActivityKeywordGroup.mjs +43 -36
  188. package/dist/teacher/profile/components/PreferredActivityKeywordGroup/index.mjs +4 -3
  189. package/dist/teacher/profile/components/PreferredAgeGroup/PreferredAgeGroup.mjs +44 -31
  190. package/dist/teacher/profile/components/PreferredAgeGroup/PreferredAgeGroup.utils.mjs +11 -12
  191. package/dist/teacher/profile/components/PreferredAgeGroup/index.mjs +5 -5
  192. package/dist/teacher/profile/components/ProfileSummary/ProfileSummary.mjs +348 -433
  193. package/dist/teacher/profile/components/ProfileSummary/ProfileSummary.utils.mjs +7 -7
  194. package/dist/teacher/profile/components/ProfileSummary/index.mjs +5 -4
  195. package/dist/teacher/profile/components/StatBadgeCollection/StatBadge/StatBadge.mjs +80 -105
  196. package/dist/teacher/profile/components/StatBadgeCollection/StatBadge/index.mjs +5 -4
  197. package/dist/teacher/profile/components/StatBadgeCollection/StatBadgeCollection.mjs +34 -27
  198. package/dist/teacher/profile/components/StatBadgeCollection/index.mjs +6 -6
  199. package/dist/teacher/profile/components/index.mjs +24 -48
  200. package/dist/teacher/profile/utils/index.mjs +2 -4
  201. package/dist/teacher/profile/utils/sortItems/index.mjs +5 -4
  202. package/dist/teacher/profile/utils/sortItems/sortItems.mjs +48 -48
  203. package/package.json +1 -1
  204. package/dist/purify.es-BGaRrCfO.js +0 -553
@@ -1,211 +1,185 @@
1
- import { jsxs as le, jsx as A } from "react/jsx-runtime";
2
- import { useState as I, useRef as p, Children as Z, isValidElement as ue, useCallback as fe, useEffect as T, cloneElement as de } from "react";
3
- import { Flexbox as P } from "@dotss/ui";
4
- import he from "@dotss/ui/core/useTheme";
5
- import me from "./CarouselSlide/CarouselSlide.mjs";
6
- const ge = 5;
7
- function ye({
8
- children: z,
9
- spacing: K = 2,
10
- edgeSpacing: O = 4,
11
- rowCount: a = 2,
12
- step: W = 1,
13
- renderPagination: $,
14
- ...C
15
- }) {
16
- const { spacing: Y } = he(), [l, X] = I(1), [w, ee] = I(1), [te, ne] = I(0), L = p(null), c = p(null), u = p(null), F = p(0), N = p(0), b = p(0), S = p(!1), D = p(!0), k = p(0), v = Y.content(K), E = Y.content(O), j = Z.toArray(z).filter(ue).filter((e) => e.type === me), x = j.length, H = (e, t) => {
17
- F.current = e, N.current = t;
18
- }, M = () => {
19
- var o;
20
- if (!c.current || !S.current) return;
21
- const e = (((o = u.current) == null ? void 0 : o.offsetWidth) || 0) * 0.01, t = -b.current >= e && l + 1 <= w, n = -b.current <= -e && l - 1 >= 1, f = Math.abs(b.current) >= ge;
22
- S.current = !1, D.current = !f, b.current = 0;
23
- let s = l;
24
- t ? s = l + 1 : n && (s = l - 1), c.current.style.transition = "transform 0.2s", c.current.style.cursor = "grab", R(s);
25
- }, R = fe(
26
- (e, t = 0) => {
27
- var h, g, y;
28
- if (!c.current) return;
29
- X(e);
30
- const n = e === 1, f = e === w, s = (((h = L.current) == null ? void 0 : h.offsetWidth) || 0) - E, o = (((y = (g = u.current) == null ? void 0 : g.children[0]) == null ? void 0 : y.clientWidth) || 0) + v, i = (s - o * Math.floor(s / o) - v) / 2, d = o * (e - 1) - i;
31
- n ? c.current.style.transform = `translate3d(${t}px, 0, 0)` : f ? c.current.style.transform = `translate3d(${-(d - i) + t}px, 0, 0)` : c.current.style.transform = `translate3d(${-d + t}px, 0, 0)`;
32
- },
33
- [E, v, w]
34
- ), re = (e) => H(e.touches[0].clientX, e.touches[0].clientY), se = (e) => {
35
- S.current = !0, H(e.clientX, e.clientY);
36
- }, oe = (e) => {
37
- c.current && (c.current.style.transition = "transform 0.2s", c.current.style.cursor = "grab", R(e));
38
- }, ce = (e) => (t) => {
39
- var q, G, V, _, B, J;
40
- t.stopPropagation();
41
- const n = Array.from(((q = u.current) == null ? void 0 : q.children) || []).indexOf(t.currentTarget), f = (((G = L.current) == null ? void 0 : G.offsetWidth) || 0) - E * 2, s = (((_ = (V = u.current) == null ? void 0 : V.children[0]) == null ? void 0 : _.clientWidth) || 0) + v, i = Math.floor(f / (s / W)) * a, d = (l - 1) * i, h = d + i - 1, g = ((B = u.current) == null ? void 0 : B.children.length) || 0, y = n % a, U = Math.floor(n / a);
42
- let m = n;
43
- switch (t.key) {
44
- case "ArrowRight": {
45
- t.preventDefault();
46
- const r = (U + 1) * a + y;
47
- r < g && (m = r);
48
- break;
49
- }
50
- case "ArrowLeft": {
51
- t.preventDefault();
52
- const r = (U - 1) * a + y;
53
- r >= 0 && (m = r);
54
- break;
55
- }
56
- case "ArrowDown": {
57
- t.preventDefault();
58
- const r = n + 1;
59
- r < g && r % a > y && (m = r);
60
- break;
61
- }
62
- case "ArrowUp": {
63
- t.preventDefault();
64
- const r = n - 1;
65
- r >= 0 && r % a < y && (m = r);
66
- break;
67
- }
68
- case "Enter":
69
- case " ": {
70
- t.preventDefault(), t.currentTarget.click();
71
- return;
72
- }
73
- default:
74
- return;
75
- }
76
- if (m >= d && m <= h) {
77
- const r = (J = u.current) == null ? void 0 : J.children[m];
78
- r == null || r.focus();
79
- return;
80
- }
81
- m >= 0 && m < g && (k.current = requestAnimationFrame(() => {
82
- var Q;
83
- const r = (Q = u.current) == null ? void 0 : Q.children[m];
84
- r == null || r.focus();
85
- })), e == null || e(t);
86
- }, ie = (e) => {
87
- e.propertyName === "transform" && (D.current = !0);
88
- }, ae = (e) => (t) => {
89
- const n = Number(t.currentTarget.getAttribute("aria-posinset")) - 1;
90
- ne(n), e == null || e(t);
91
- };
92
- return T(() => {
93
- const e = () => R(l);
94
- return e(), window.addEventListener("resize", e), () => {
95
- window.removeEventListener("resize", e);
96
- };
97
- }, [R, l]), T(() => {
98
- const e = () => {
99
- var i, d, h;
100
- const t = (((i = L.current) == null ? void 0 : i.offsetWidth) || 0) - E * 2, n = (((h = (d = u.current) == null ? void 0 : d.children[0]) == null ? void 0 : h.clientWidth) || 0) + v, f = Math.floor(t / (n / W)), s = Math.ceil(x / (a || 1)), o = Math.max(s - (f - 1), 1);
101
- X((g) => g > o ? o : g), ee(o);
102
- };
103
- return e(), window.addEventListener("resize", e), () => {
104
- window.removeEventListener("resize", e);
105
- };
106
- }, [E, v, x, W, a, z]), T(() => {
107
- const e = c.current, t = (s, o, i) => {
108
- if (!e || w <= 1) return;
109
- e.style.transition = "none", e.style.cursor = "grabbing", b.current = s - F.current;
110
- const d = o - N.current, h = 5;
111
- S.current = S.current || Math.abs(b.current) > h && Math.abs(d) < h * 2, S.current && (i.cancelable && (i.stopPropagation(), i.preventDefault()), e.style.transition = "none", e.style.cursor = "grabbing", R(l, b.current));
112
- }, n = (s) => t(s.touches[0].clientX, s.touches[0].clientY, s), f = (s) => {
113
- S.current && t(s.clientX, s.clientY, s);
114
- };
115
- return e && (e.addEventListener("mousemove", f), e.addEventListener("touchmove", n)), () => {
116
- e && (e.removeEventListener("mousemove", f), e.removeEventListener("touchmove", n));
117
- };
118
- }, [R, l, w]), T(() => () => {
119
- k.current && cancelAnimationFrame(k.current);
120
- }, []), T(() => {
121
- const e = u.current, t = (n) => {
122
- D.current || (n.stopPropagation(), n.preventDefault());
123
- };
124
- return e == null || e.addEventListener("click", t), () => {
125
- e == null || e.removeEventListener("click", t);
126
- };
127
- }, []), /* @__PURE__ */ le(
128
- P,
129
- {
130
- flexDirection: "column",
131
- role: "list",
132
- "aria-roledescription": "carousel",
133
- "aria-label": "슬라이더",
134
- flexGrow: 1,
135
- ...C,
136
- inlineCSS: {
137
- width: "100%",
138
- ...C == null ? void 0 : C.inlineCSS
139
- },
140
- children: [
141
- /* @__PURE__ */ A(
142
- P,
143
- {
144
- ref: L,
145
- inlineCSS: {
146
- overflow: "hidden"
147
- },
148
- children: /* @__PURE__ */ A(
149
- P,
150
- {
151
- ref: c,
152
- onMouseDown: se,
153
- onMouseUp: M,
154
- onMouseLeave: M,
155
- onTouchStart: re,
156
- onTouchEnd: M,
157
- onTouchCancel: M,
158
- onTransitionEnd: ie,
159
- inlineCSS: {
160
- gap: v,
161
- paddingLeft: E,
162
- paddingRight: E,
163
- transition: "transform 0.2s",
164
- transform: "translate3d(0, 0, 0)",
165
- cursor: "grab"
166
- },
167
- children: /* @__PURE__ */ A(
168
- P,
169
- {
170
- ref: u,
171
- inlineCSS: {
172
- gap: v,
173
- display: "grid",
174
- gridTemplateRows: "min-content",
175
- transform: "translate3d(0, 0, 0)"
176
- },
177
- children: Z.map(
178
- j,
179
- (e, t) => {
180
- var n;
181
- return de(e, {
182
- role: "listitem",
183
- tabIndex: t === te ? 0 : -1,
184
- "aria-roledescription": "slide",
185
- "aria-label": `${x}개 중 ${t + 1}번째 슬라이드`,
186
- "aria-posinset": t + 1,
187
- "aria-setsize": x,
188
- onKeyDown: ce(e.props.onKeyDown),
189
- onFocus: ae(e.props.onFocus),
190
- ...e.props,
191
- style: {
192
- ...(n = e.props) == null ? void 0 : n.style,
193
- gridRow: `${t % a + 1} / ${t % a + 1}`
194
- }
195
- });
196
- }
197
- )
198
- }
199
- )
200
- }
201
- )
202
- }
203
- ),
204
- typeof $ == "function" && $({ page: l, totalPages: w, onChange: oe })
205
- ]
206
- }
207
- );
1
+ import e from "./CarouselSlide/index.mjs";
2
+ import { Children as t, cloneElement as n, isValidElement as r, useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
3
+ import { Flexbox as c } from "@dotss/ui";
4
+ import l from "@dotss/ui/core/useTheme";
5
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
6
+ //#region shared/components/Carousel/Carousel.tsx
7
+ var f = 5;
8
+ function p({ children: p, spacing: m = 2, edgeSpacing: h = 4, rowCount: g = 2, step: _ = 1, renderPagination: v, ...y }) {
9
+ let { spacing: b } = l(), [x, S] = s(1), [C, w] = s(1), [T, E] = s(0), D = o(null), O = o(null), k = o(null), A = o(0), j = o(0), M = o(0), N = o(!1), P = o(!0), F = o(0), I = b.content(m), L = b.content(h), R = t.toArray(p).filter(r).filter((t) => t.type === e), z = R.length, B = (e, t) => {
10
+ A.current = e, j.current = t;
11
+ }, V = () => {
12
+ if (!O.current || !N.current) return;
13
+ let e = (k.current?.offsetWidth || 0) * .01, t = -M.current >= e && x + 1 <= C, n = -M.current <= -e && x - 1 >= 1, r = Math.abs(M.current) >= f;
14
+ N.current = !1, P.current = !r, M.current = 0;
15
+ let i = x;
16
+ t ? i = x + 1 : n && (i = x - 1), O.current.style.transition = "transform 0.2s", O.current.style.cursor = "grab", H(i);
17
+ }, H = i((e, t = 0) => {
18
+ if (!O.current) return;
19
+ S(e);
20
+ let n = e === 1, r = e === C, i = (D.current?.offsetWidth || 0) - L, a = (k.current?.children[0]?.clientWidth || 0) + I, o = (i - a * Math.floor(i / a) - I) / 2, s = a * (e - 1) - o;
21
+ n ? O.current.style.transform = `translate3d(${t}px, 0, 0)` : r ? O.current.style.transform = `translate3d(${-(s - o) + t}px, 0, 0)` : O.current.style.transform = `translate3d(${-s + t}px, 0, 0)`;
22
+ }, [
23
+ L,
24
+ I,
25
+ C
26
+ ]), U = (e) => B(e.touches[0].clientX, e.touches[0].clientY), W = (e) => {
27
+ N.current = !0, B(e.clientX, e.clientY);
28
+ }, G = (e) => {
29
+ O.current && (O.current.style.transition = "transform 0.2s", O.current.style.cursor = "grab", H(e));
30
+ }, K = (e) => (t) => {
31
+ t.stopPropagation();
32
+ let n = Array.from(k.current?.children || []).indexOf(t.currentTarget), r = (D.current?.offsetWidth || 0) - L * 2, i = (k.current?.children[0]?.clientWidth || 0) + I, a = Math.floor(r / (i / _)) * g, o = (x - 1) * a, s = o + a - 1, c = k.current?.children.length || 0, l = n % g, u = Math.floor(n / g), d = n;
33
+ switch (t.key) {
34
+ case "ArrowRight": {
35
+ t.preventDefault();
36
+ let e = (u + 1) * g + l;
37
+ e < c && (d = e);
38
+ break;
39
+ }
40
+ case "ArrowLeft": {
41
+ t.preventDefault();
42
+ let e = (u - 1) * g + l;
43
+ e >= 0 && (d = e);
44
+ break;
45
+ }
46
+ case "ArrowDown": {
47
+ t.preventDefault();
48
+ let e = n + 1;
49
+ e < c && e % g > l && (d = e);
50
+ break;
51
+ }
52
+ case "ArrowUp": {
53
+ t.preventDefault();
54
+ let e = n - 1;
55
+ e >= 0 && e % g < l && (d = e);
56
+ break;
57
+ }
58
+ case "Enter":
59
+ case " ":
60
+ t.preventDefault(), t.currentTarget.click();
61
+ return;
62
+ default: return;
63
+ }
64
+ if (d >= o && d <= s) {
65
+ (k.current?.children[d])?.focus();
66
+ return;
67
+ }
68
+ d >= 0 && d < c && (F.current = requestAnimationFrame(() => {
69
+ (k.current?.children[d])?.focus();
70
+ })), e?.(t);
71
+ }, q = (e) => {
72
+ e.propertyName === "transform" && (P.current = !0);
73
+ }, J = (e) => (t) => {
74
+ E(Number(t.currentTarget.getAttribute("aria-posinset")) - 1), e?.(t);
75
+ };
76
+ return a(() => {
77
+ let e = () => H(x);
78
+ return e(), window.addEventListener("resize", e), () => {
79
+ window.removeEventListener("resize", e);
80
+ };
81
+ }, [H, x]), a(() => {
82
+ let e = () => {
83
+ let e = (D.current?.offsetWidth || 0) - L * 2, t = (k.current?.children[0]?.clientWidth || 0) + I, n = Math.floor(e / (t / _)), r = Math.ceil(z / (g || 1)), i = Math.max(r - (n - 1), 1);
84
+ S((e) => e > i ? i : e), w(i);
85
+ };
86
+ return e(), window.addEventListener("resize", e), () => {
87
+ window.removeEventListener("resize", e);
88
+ };
89
+ }, [
90
+ L,
91
+ I,
92
+ z,
93
+ _,
94
+ g,
95
+ p
96
+ ]), a(() => {
97
+ let e = O.current, t = (t, n, r) => {
98
+ if (!e || C <= 1) return;
99
+ e.style.transition = "none", e.style.cursor = "grabbing", M.current = t - A.current;
100
+ let i = n - j.current;
101
+ N.current = N.current || Math.abs(M.current) > 5 && Math.abs(i) < 10, N.current && (r.cancelable && (r.stopPropagation(), r.preventDefault()), e.style.transition = "none", e.style.cursor = "grabbing", H(x, M.current));
102
+ }, n = (e) => t(e.touches[0].clientX, e.touches[0].clientY, e), r = (e) => {
103
+ N.current && t(e.clientX, e.clientY, e);
104
+ };
105
+ return e && (e.addEventListener("mousemove", r), e.addEventListener("touchmove", n)), () => {
106
+ e && (e.removeEventListener("mousemove", r), e.removeEventListener("touchmove", n));
107
+ };
108
+ }, [
109
+ H,
110
+ x,
111
+ C
112
+ ]), a(() => () => {
113
+ F.current && cancelAnimationFrame(F.current);
114
+ }, []), a(() => {
115
+ let e = k.current, t = (e) => {
116
+ P.current || (e.stopPropagation(), e.preventDefault());
117
+ };
118
+ return e?.addEventListener("click", t), () => {
119
+ e?.removeEventListener("click", t);
120
+ };
121
+ }, []), /* @__PURE__ */ d(c, {
122
+ flexDirection: "column",
123
+ role: "list",
124
+ "aria-roledescription": "carousel",
125
+ "aria-label": "슬라이더",
126
+ flexGrow: 1,
127
+ ...y,
128
+ inlineCSS: {
129
+ width: "100%",
130
+ ...y?.inlineCSS
131
+ },
132
+ children: [/* @__PURE__ */ u(c, {
133
+ ref: D,
134
+ inlineCSS: { overflow: "hidden" },
135
+ children: /* @__PURE__ */ u(c, {
136
+ ref: O,
137
+ onMouseDown: W,
138
+ onMouseUp: V,
139
+ onMouseLeave: V,
140
+ onTouchStart: U,
141
+ onTouchEnd: V,
142
+ onTouchCancel: V,
143
+ onTransitionEnd: q,
144
+ inlineCSS: {
145
+ gap: I,
146
+ paddingLeft: L,
147
+ paddingRight: L,
148
+ transition: "transform 0.2s",
149
+ transform: "translate3d(0, 0, 0)",
150
+ cursor: "grab"
151
+ },
152
+ children: /* @__PURE__ */ u(c, {
153
+ ref: k,
154
+ inlineCSS: {
155
+ gap: I,
156
+ display: "grid",
157
+ gridTemplateRows: "min-content",
158
+ transform: "translate3d(0, 0, 0)"
159
+ },
160
+ children: t.map(R, (e, t) => n(e, {
161
+ role: "listitem",
162
+ tabIndex: t === T ? 0 : -1,
163
+ "aria-roledescription": "slide",
164
+ "aria-label": `${z}개 중 ${t + 1}번째 슬라이드`,
165
+ "aria-posinset": t + 1,
166
+ "aria-setsize": z,
167
+ onKeyDown: K(e.props.onKeyDown),
168
+ onFocus: J(e.props.onFocus),
169
+ ...e.props,
170
+ style: {
171
+ ...e.props?.style,
172
+ gridRow: `${t % g + 1} / ${t % g + 1}`
173
+ }
174
+ }))
175
+ })
176
+ })
177
+ }), typeof v == "function" && v({
178
+ page: x,
179
+ totalPages: C,
180
+ onChange: G
181
+ })]
182
+ });
208
183
  }
209
- export {
210
- ye as default
211
- };
184
+ //#endregion
185
+ export { p as default };
@@ -1,8 +1,11 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Flexbox as t } from "@dotss/ui";
3
- function l({ children: o, ...r }) {
4
- return /* @__PURE__ */ e(t, { ...r, children: o });
1
+ import { Flexbox as e } from "@dotss/ui";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region shared/components/Carousel/CarouselSlide/CarouselSlide.tsx
4
+ function n({ children: n, ...r }) {
5
+ return /* @__PURE__ */ t(e, {
6
+ ...r,
7
+ children: n
8
+ });
5
9
  }
6
- export {
7
- l as default
8
- };
10
+ //#endregion
11
+ export { n as default };
@@ -1,4 +1,5 @@
1
- import o from "./CarouselSlide.mjs";
2
- export {
3
- o as default
4
- };
1
+ import e from "./CarouselSlide.mjs";
2
+ //#region shared/components/Carousel/CarouselSlide/index.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -1,6 +1,6 @@
1
- import o from "./Carousel.mjs";
2
- import { default as l } from "./CarouselSlide/CarouselSlide.mjs";
3
- export {
4
- l as CarouselSlide,
5
- o as default
6
- };
1
+ import e from "./CarouselSlide/index.mjs";
2
+ import t from "./Carousel.mjs";
3
+ //#region shared/components/Carousel/index.ts
4
+ var n = t;
5
+ //#endregion
6
+ export { e as CarouselSlide, n as default };