@dotss/tictoccroc 0.1.0 → 0.1.2

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.
@@ -7,5 +7,5 @@ export interface CalendarProps extends Omit<FlexboxProps, 'onChange' | 'value'>,
7
7
  weekHeadInlineCSS?: FlexboxProps['inlineCSS'];
8
8
  datePickerProps?: Omit<DatePickerProps, 'onChange' | 'value' | 'date'>;
9
9
  }
10
- declare const Calendar: import('react').ForwardRefExoticComponent<Omit<CalendarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
10
+ declare const Calendar: any;
11
11
  export default Calendar;
@@ -20,5 +20,5 @@ export interface ImageProps extends Omit<HTMLProps<HTMLImageElement>, 'onError'>
20
20
  enableErrorFallback?: boolean;
21
21
  renderErrorFallback?: () => ReactNode;
22
22
  }
23
- declare const Image: import('react').ForwardRefExoticComponent<Omit<ImageProps, "ref"> & import('react').RefAttributes<HTMLImageElement>>;
23
+ declare const Image: any;
24
24
  export default Image;
@@ -7,7 +7,7 @@ export declare function getHorizontalLayoutRows(images: {
7
7
  originalWidth?: number;
8
8
  width: number;
9
9
  height: number;
10
- }[], blocks: ReactElement<MasonryBlockProps>[], rowCount: number, fallbackWidth: number): ReactElement<MasonryBlockProps, string | import('react').JSXElementConstructor<any>>[][];
10
+ }[], blocks: ReactElement<MasonryBlockProps>[], rowCount: number, fallbackWidth: number): ReactElement<MasonryBlockProps>[][];
11
11
  export declare function findNextFocusableElement(currentElement: HTMLDivElement, keyDirection: 'left' | 'right' | 'up' | 'down', candidates: (HTMLDivElement | null)[]): HTMLDivElement | null;
12
12
  export declare function getNextIndexHorizontalFromRows(rows: HTMLDivElement[][], currentIndex: number, keyDirection: 'up' | 'down' | 'left' | 'right'): number | null;
13
13
  export declare function findImageInChildren(children: ReactNode): ReactElement<ImageProps> | null;
@@ -17,5 +17,5 @@ export interface MasonryBlockProps extends FlexboxProps {
17
17
  }>;
18
18
  setInnerRef?: (ref: HTMLDivElement | null) => void;
19
19
  }
20
- declare const MasonryBlock: import('react').ForwardRefExoticComponent<Omit<MasonryBlockProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
20
+ declare const MasonryBlock: any;
21
21
  export default MasonryBlock;
@@ -1,15 +1,15 @@
1
1
  import { jsxs as S } from "react/jsx-runtime";
2
- import { useState as w, useRef as d, Children as W, isValidElement as G, useCallback as mr, useEffect as M, cloneElement as vr } from "react";
2
+ import { useState as w, useRef as m, Children as X, isValidElement as G, useCallback as dr, useEffect as M, cloneElement as vr } from "react";
3
3
  import { Flexbox as rr } from "@dotss/ui";
4
4
  import U from "../MediaDialog/MediaBlock/MediaBlock.mjs";
5
- import { createSwipeEvent as R } from "./Swiper.utils.mjs";
5
+ import { createSwipeEvent as C } from "./Swiper.utils.mjs";
6
6
  import j from "./SwiperBlock/SwiperBlock.mjs";
7
7
  function Pr({
8
8
  children: B,
9
9
  initialPage: T = 0,
10
10
  onSwipe: s,
11
- onSwiping: x,
12
- loop: v = !1,
11
+ onSwiping: W,
12
+ loop: h = !1,
13
13
  disableSwipe: tr = !1,
14
14
  renderPagination: q,
15
15
  inlineCSS: er,
@@ -18,20 +18,20 @@ function Pr({
18
18
  autoSwipeDuration: Q = 1e3,
19
19
  ...nr
20
20
  }) {
21
- const [C, $] = w(T), [c, cr] = w(1), t = d(null), X = d(0), Y = d(0), V = d(0), N = d(0), u = d(!1), f = d(!0), F = d(""), n = d(T), Z = d(!1), l = d(null), k = W.count(B), m = W.toArray(B).filter(G).filter((r) => r.type === j || r.type === U), A = k > 1 && !tr, sr = W.toArray(m == null ? void 0 : m[0]).filter(G).filter((r) => r.type === j || r.type === U), ur = W.toArray(m == null ? void 0 : m[(m == null ? void 0 : m.length) - 1]).filter(G).filter((r) => r.type === j || r.type === U), _ = (r, e, i) => {
22
- !t.current || !A || (F.current = t.current.style.transform, Y.current = r, X.current = r + t.current.offsetWidth * (i + 1), V.current = e);
23
- }, L = mr(
21
+ const [k, $] = w(T), [c, cr] = w(1), t = m(null), A = m(0), Y = m(0), V = m(0), N = m(0), u = m(!1), f = m(!0), F = m(""), n = m(T), Z = m(!1), l = m(null), p = X.count(B), d = X.toArray(B).filter(G).filter((r) => r.type === j || r.type === U), D = p > 1 && !tr, sr = X.toArray(d == null ? void 0 : d[0]).filter(G).filter((r) => r.type === j || r.type === U), ur = X.toArray(d == null ? void 0 : d[(d == null ? void 0 : d.length) - 1]).filter(G).filter((r) => r.type === j || r.type === U), _ = (r, e, i) => {
22
+ !t.current || !D || (F.current = t.current.style.transform, Y.current = r, A.current = r + t.current.offsetWidth * (i + 1), V.current = e);
23
+ }, P = dr(
24
24
  (r, e, i, {
25
- isAutoSwiped: P = !1,
25
+ isAutoSwiped: v = !1,
26
26
  shouldFocus: a = !1
27
27
  } = {}) => {
28
- if (!t.current || !A || !u.current || !f.current)
28
+ if (!t.current || !D || !u.current || !f.current)
29
29
  return;
30
- f.current = !1, t.current.style.transition = P ? `transform ${Q}ms` : "transform 0.2s", t.current.style.cursor = "grab", l.current && (t.current.removeEventListener("transitionend", l.current), l.current = null);
31
- const o = e || C, h = i || X.current - t.current.offsetWidth * (o + 1) - r, y = t.current.offsetWidth * 0.1;
32
- if (Math.abs(h) < y && !e) {
30
+ f.current = !1, t.current.style.transition = v ? `transform ${Q}ms` : "transform 0.2s", t.current.style.cursor = "grab", l.current && (t.current.removeEventListener("transitionend", l.current), l.current = null);
31
+ const o = e || k, y = i || A.current - t.current.offsetWidth * (o + 1) - r, g = t.current.offsetWidth * 0.1;
32
+ if (Math.abs(y) < g && !e) {
33
33
  t.current.style.transform = F.current, u.current = !1, f.current = !0, s == null || s(
34
- R({
34
+ C({
35
35
  realPage: n.current,
36
36
  totalPages: c,
37
37
  lastPage: n.current,
@@ -40,85 +40,100 @@ function Pr({
40
40
  );
41
41
  return;
42
42
  }
43
- const I = h <= -y && o - 1 < 0, z = h >= y && o + 1 === c, fr = h >= y && o + 1 < c, dr = h <= -y && o - 1 >= 0;
43
+ const I = y <= -g && o - 1 < 0, z = y >= g && o + 1 === c, fr = y >= g && o + 1 < c, mr = y <= -g && o - 1 >= 0;
44
44
  if (I) {
45
45
  n.current = c - 1, s == null || s(
46
- R({ realPage: n.current, totalPages: c, lastPage: 0, isLoop: !0 })
47
- ), t.current.style.transform = "translate3d(0, 0, 0)", l.current = (D) => {
48
- var g, b, E, p;
49
- if (D.propertyName === "transform") {
46
+ C({ realPage: n.current, totalPages: c, lastPage: 0, isLoop: !0 })
47
+ ), t.current.style.transform = "translate3d(0, 0, 0)", l.current = (x) => {
48
+ var b, E, L, R;
49
+ if (x.propertyName === "transform") {
50
50
  if (!t.current) return;
51
- t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${c}), 0, 0)`, $(c - 1), u.current = !1, f.current = !0, a ? (E = (b = (g = t.current) == null ? void 0 : g.children) == null ? void 0 : b[c]) == null || E.focus() : (p = document.activeElement) == null || p.blur();
51
+ if (t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${c}), 0, 0)`, $(c - 1), u.current = !1, f.current = !0, a)
52
+ (L = (E = (b = t.current) == null ? void 0 : b.children) == null ? void 0 : E[c]) == null || L.focus();
53
+ else {
54
+ if (v) return;
55
+ (R = document.activeElement) == null || R.blur();
56
+ }
52
57
  }
53
58
  }, t.current.addEventListener("transitionend", l.current);
54
59
  return;
55
60
  } else if (z) {
56
61
  n.current = 0, s == null || s(
57
- R({
62
+ C({
58
63
  realPage: n.current,
59
64
  totalPages: c,
60
65
  lastPage: c - 1,
61
66
  isLoop: !0
62
67
  })
63
- ), t.current.style.transform = `translate3d(calc(-100% * ${o + 2}), 0, 0)`, l.current = (D) => {
64
- var g, b, E, p;
65
- if (D.propertyName === "transform") {
68
+ ), t.current.style.transform = `translate3d(calc(-100% * ${o + 2}), 0, 0)`, l.current = (x) => {
69
+ var b, E, L, R;
70
+ if (x.propertyName === "transform") {
66
71
  if (!t.current) return;
67
- t.current.style.transition = "none", t.current.style.transform = "translate3d(-100%, 0, 0)", $(0), u.current = !1, f.current = !0, a ? (E = (b = (g = t.current) == null ? void 0 : g.children) == null ? void 0 : b[1]) == null || E.focus() : (p = document.activeElement) == null || p.blur();
72
+ if (t.current.style.transition = "none", t.current.style.transform = "translate3d(-100%, 0, 0)", $(0), u.current = !1, f.current = !0, a)
73
+ (L = (E = (b = t.current) == null ? void 0 : b.children) == null ? void 0 : E[1]) == null || L.focus();
74
+ else {
75
+ if (v) return;
76
+ (R = document.activeElement) == null || R.blur();
77
+ }
68
78
  }
69
79
  }, t.current.addEventListener("transitionend", l.current);
70
80
  return;
71
81
  }
72
82
  fr ? (n.current = o + 1, s == null || s(
73
- R({
83
+ C({
74
84
  realPage: n.current,
75
85
  totalPages: c,
76
86
  lastPage: o,
77
87
  isLoop: !0
78
88
  })
79
- ), $(n.current), t.current.style.transform = `translate3d(calc(-100% * ${o + 2}), 0, 0)`) : dr ? (n.current = o - 1, s == null || s(
80
- R({
89
+ ), $(n.current), t.current.style.transform = `translate3d(calc(-100% * ${o + 2}), 0, 0)`) : mr ? (n.current = o - 1, s == null || s(
90
+ C({
81
91
  realPage: n.current,
82
92
  totalPages: c,
83
93
  lastPage: o,
84
94
  isLoop: !1
85
95
  })
86
96
  ), $(n.current), t.current.style.transform = `translate3d(calc(-100% * ${o}), 0, 0)`) : (s == null || s(
87
- R({
97
+ C({
88
98
  realPage: n.current,
89
99
  totalPages: c,
90
100
  lastPage: n.current,
91
101
  isLoop: !1
92
102
  })
93
- ), t.current.style.transform = F.current), l.current = (D) => {
94
- var g, b;
95
- if (D.propertyName === "transform") {
103
+ ), t.current.style.transform = F.current), l.current = (x) => {
104
+ var b, E;
105
+ if (x.propertyName === "transform") {
96
106
  u.current = !1, f.current = !0;
97
- const E = Array.from(((g = t.current) == null ? void 0 : g.children) ?? []).find(
98
- (p) => p.getAttribute("aria-current") === "page"
107
+ const L = Array.from(((b = t.current) == null ? void 0 : b.children) ?? []).find(
108
+ (R) => R.getAttribute("aria-current") === "page"
99
109
  );
100
- a && E ? E.focus() : (b = document.activeElement) == null || b.blur();
110
+ if (a && L)
111
+ L.focus();
112
+ else {
113
+ if (v) return;
114
+ (E = document.activeElement) == null || E.blur();
115
+ }
101
116
  }
102
117
  }, t.current.addEventListener("transitionend", l.current);
103
118
  },
104
- [C, c, s, A, Q]
119
+ [k, c, s, D, Q]
105
120
  ), ar = (r) => {
106
121
  u.current = !0, _(r.clientX, r.clientY, n.current);
107
- }, K = (r) => L(r.clientX), or = (r) => {
122
+ }, K = (r) => P(r.clientX), or = (r) => {
108
123
  _(r.touches[0].clientX, r.touches[0].clientY, n.current);
109
- }, O = (r) => L(r.changedTouches[0].clientX), lr = (r) => {
124
+ }, O = (r) => P(r.changedTouches[0].clientX), lr = (r) => {
110
125
  u.current = !0;
111
126
  const e = r - 1;
112
- $(e <= 0 ? 0 : e), L(0, r);
127
+ $(e <= 0 ? 0 : e), P(0, r);
113
128
  }, ir = (r) => (e) => {
114
- var i, P;
129
+ var i, v;
115
130
  switch (e.key) {
116
131
  case "ArrowRight": {
117
132
  if (e.preventDefault(), u.current || !f.current) return;
118
133
  const a = n.current === c - 1;
119
- if (!v && a)
134
+ if (!h && a)
120
135
  return;
121
- u.current = !0, L(0, n.current, (((i = t.current) == null ? void 0 : i.offsetWidth) ?? 0) * 0.1, {
136
+ u.current = !0, P(0, n.current, (((i = t.current) == null ? void 0 : i.offsetWidth) ?? 0) * 0.1, {
122
137
  shouldFocus: !0
123
138
  });
124
139
  break;
@@ -126,9 +141,9 @@ function Pr({
126
141
  case "ArrowLeft": {
127
142
  if (e.preventDefault(), u.current || !f.current) return;
128
143
  const a = n.current === 0;
129
- if (!v && a)
144
+ if (!h && a)
130
145
  return;
131
- u.current = !0, L(0, n.current, -((((P = t.current) == null ? void 0 : P.offsetWidth) ?? 0) * 0.1), {
146
+ u.current = !0, P(0, n.current, -((((v = t.current) == null ? void 0 : v.offsetWidth) ?? 0) * 0.1), {
132
147
  shouldFocus: !0
133
148
  });
134
149
  break;
@@ -145,22 +160,22 @@ function Pr({
145
160
  r == null || r(e);
146
161
  };
147
162
  return M(() => {
148
- const r = t.current, e = (a, o, h) => {
149
- if (!t.current || !A || !f.current) return;
150
- N.current = a - X.current;
151
- const y = 5;
152
- if (u.current = u.current || Math.abs(N.current) > y && Math.abs(o - V.current) < y, u.current) {
163
+ const r = t.current, e = (a, o, y) => {
164
+ if (!t.current || !D || !f.current) return;
165
+ N.current = a - A.current;
166
+ const g = 5;
167
+ if (u.current = u.current || Math.abs(N.current) > g && Math.abs(o - V.current) < g, u.current) {
153
168
  const I = Y.current < a, z = Y.current > a;
154
- if (!v && I && n.current === 0) {
169
+ if (!h && I && n.current === 0) {
155
170
  u.current = !1;
156
171
  return;
157
172
  }
158
- if (!v && z && n.current === c - 1) {
173
+ if (!h && z && n.current === c - 1) {
159
174
  u.current = !1;
160
175
  return;
161
176
  }
162
- h.cancelable && h.preventDefault(), x == null || x(
163
- R({
177
+ y.cancelable && y.preventDefault(), W == null || W(
178
+ C({
164
179
  realPage: n.current,
165
180
  totalPages: c,
166
181
  lastPage: n.current,
@@ -170,11 +185,11 @@ function Pr({
170
185
  }
171
186
  }, i = (a) => {
172
187
  u.current && e(a.clientX, a.clientY, a);
173
- }, P = (a) => e(a.touches[0].clientX, a.touches[0].clientY, a);
174
- return r && (r.addEventListener("mousemove", i), r.addEventListener("touchmove", P)), () => {
175
- r && (r.removeEventListener("mousemove", i), r.removeEventListener("touchmove", P));
188
+ }, v = (a) => e(a.touches[0].clientX, a.touches[0].clientY, a);
189
+ return r && (r.addEventListener("mousemove", i), r.addEventListener("touchmove", v)), () => {
190
+ r && (r.removeEventListener("mousemove", i), r.removeEventListener("touchmove", v));
176
191
  };
177
- }, [A, x, v, c]), M(() => {
192
+ }, [D, W, h, c]), M(() => {
178
193
  const r = t.current, e = (i) => {
179
194
  f.current || (i.stopPropagation(), i.preventDefault());
180
195
  };
@@ -187,13 +202,13 @@ function Pr({
187
202
  l.current && r && (r.removeEventListener("transitionend", l.current), l.current = null);
188
203
  };
189
204
  }, []), M(() => {
190
- cr(k);
191
- }, [k]), M(() => {
192
- t.current && !Z.current && (Z.current = !0, t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${k < T + 1 ? k : T + 1}), 0, 0)`);
193
- }, [T, k]), M(() => {
205
+ cr(p);
206
+ }, [p]), M(() => {
207
+ t.current && !Z.current && (Z.current = !0, t.current.style.transition = "none", t.current.style.transform = `translate3d(calc(-100% * ${p < T + 1 ? p : T + 1}), 0, 0)`);
208
+ }, [T, p]), M(() => {
194
209
  if (H) {
195
210
  const r = setInterval(() => {
196
- u.current || !f.current || t.current && (!v && n.current === c - 1 || document.activeElement && t.current && t.current.contains(document.activeElement) || (u.current = !0, L(0, n.current, (t.current.offsetWidth ?? 0) * 0.1, {
211
+ u.current || !f.current || t.current && (!h && n.current === c - 1 || document.activeElement && t.current && t.current.contains(document.activeElement) || (u.current = !0, P(0, n.current, (t.current.offsetWidth ?? 0) * 0.1, {
197
212
  isAutoSwiped: !0
198
213
  })));
199
214
  }, J);
@@ -201,7 +216,7 @@ function Pr({
201
216
  clearInterval(r);
202
217
  };
203
218
  }
204
- }, [H, J, v, c, L]), /* @__PURE__ */ S(
219
+ }, [H, J, h, c, P]), /* @__PURE__ */ S(
205
220
  rr,
206
221
  {
207
222
  flexGrow: 1,
@@ -228,10 +243,10 @@ function Pr({
228
243
  onTouchCancel: O,
229
244
  inlineCSS: {
230
245
  "& > div:first-of-type": {
231
- visibility: v ? "visible" : "hidden"
246
+ visibility: h ? "visible" : "hidden"
232
247
  },
233
248
  "& > div:last-of-type": {
234
- visibility: v ? "visible" : "hidden"
249
+ visibility: h ? "visible" : "hidden"
235
250
  }
236
251
  },
237
252
  style: {
@@ -241,14 +256,14 @@ function Pr({
241
256
  },
242
257
  children: [
243
258
  ur,
244
- m.map(
259
+ d.map(
245
260
  (r, e) => vr(r, {
246
261
  role: "listitem",
247
- tabIndex: e === C ? 0 : -1,
262
+ tabIndex: e === k ? 0 : -1,
248
263
  onKeyDown: ir(r.props.onKeyDown),
249
264
  "aria-roledescription": "slide",
250
- "aria-hidden": e !== C,
251
- "aria-current": e === C ? "page" : void 0,
265
+ "aria-hidden": e !== k,
266
+ "aria-current": e === k ? "page" : void 0,
252
267
  "aria-label": `${c}개 중 ${e + 1}번째 슬라이드`,
253
268
  "aria-posinset": e + 1,
254
269
  "aria-setsize": c,
@@ -259,7 +274,7 @@ function Pr({
259
274
  ]
260
275
  }
261
276
  ),
262
- typeof q == "function" && q({ page: C, totalPages: c, onChange: lr })
277
+ typeof q == "function" && q({ page: k, totalPages: c, onChange: lr })
263
278
  ]
264
279
  }
265
280
  );
@@ -19,5 +19,5 @@ export interface TimePickerProps extends Omit<FlexboxProps, 'onChange'> {
19
19
  renderStartTimeLabel?: (item: TimePickerItem, isSelected: boolean) => ReactNode;
20
20
  renderEndTimeLabel?: (item: TimePickerItem, isSelected: boolean) => ReactNode;
21
21
  }
22
- declare const TimePicker: import('react').ForwardRefExoticComponent<Omit<TimePickerProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
22
+ declare const TimePicker: any;
23
23
  export default TimePicker;
@@ -1,4 +1,4 @@
1
1
  import { RefObject } from 'react';
2
2
  export default function useInView(targetRef: RefObject<HTMLElement | null>, options?: IntersectionObserverInit): {
3
- isInView: boolean;
3
+ isInView: any;
4
4
  };
@@ -1,3 +1,2 @@
1
- import { useEffect } from 'react';
2
- declare const useIsomorphicLayoutEffect: typeof useEffect;
1
+ declare const useIsomorphicLayoutEffect: any;
3
2
  export default useIsomorphicLayoutEffect;
@@ -18,5 +18,5 @@ export interface AvailableScheduleSectionProps extends FlexboxProps {
18
18
  };
19
19
  };
20
20
  }
21
- declare const AvailableScheduleSection: import('react').ForwardRefExoticComponent<Omit<AvailableScheduleSectionProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
21
+ declare const AvailableScheduleSection: any;
22
22
  export default AvailableScheduleSection;
@@ -3,5 +3,5 @@ export interface CareNoteSectionProps extends FlexboxProps {
3
3
  totalCount: number;
4
4
  onClickViewAll?: () => void;
5
5
  }
6
- declare const CareNoteSection: import('react').ForwardRefExoticComponent<Omit<CareNoteSectionProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
6
+ declare const CareNoteSection: any;
7
7
  export default CareNoteSection;
@@ -3,5 +3,5 @@ export interface ParentReviewSectionProps extends FlexboxProps {
3
3
  totalCount: number;
4
4
  onClickViewAll?: () => void;
5
5
  }
6
- declare const ParentReviewSection: import('react').ForwardRefExoticComponent<Omit<ParentReviewSectionProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
6
+ declare const ParentReviewSection: any;
7
7
  export default ParentReviewSection;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dotss/tictoccroc",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "description": "Tictoccroc shared components, hooks, utils, and APIs for Dotss",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",