@dotss/tictoccroc 0.0.23 → 0.0.24

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,116 +1,158 @@
1
- import { jsxs as L, jsx as c, Fragment as Y } from "react/jsx-runtime";
2
- import { forwardRef as Z, useRef as h, useImperativeHandle as w, useState as C, useEffect as R } from "react";
3
- import { Flexbox as M, Skeleton as U } from "@dotss/ui";
4
- import F from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
5
- import b from "../../utils/getImageUrl/getImageUrl.mjs";
6
- import V from "./Image.error.mjs";
7
- const k = 100, ot = Z(
1
+ import { jsxs as T, jsx as s, Fragment as p } from "react/jsx-runtime";
2
+ import { forwardRef as P, useRef as W, useImperativeHandle as tt, useState as I, useEffect as G } from "react";
3
+ import { Flexbox as J, Skeleton as K } from "@dotss/ui";
4
+ import et from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
5
+ import N from "../../utils/getImageUrl/getImageUrl.mjs";
6
+ import Q from "./Image.error.mjs";
7
+ const nt = 100, ct = P(
8
8
  ({
9
- src: _,
9
+ src: j,
10
10
  width: n,
11
- height: o,
12
- fit: q = "cover",
13
- position: A = "center",
14
- alt: E,
15
- scale: D = 2,
16
- onLoad: r,
17
- onLazyLoad: g,
18
- lazy: I = !1,
19
- borderRadius: l,
20
- disabledResizing: G = !1,
21
- withIntrinsicRatio: x = !1,
22
- enableFallback: T = !1,
23
- enableErrorFallback: W = !0,
24
- renderErrorFallback: f,
11
+ height: i,
12
+ fit: h = "cover",
13
+ position: E = "center",
14
+ alt: H,
15
+ scale: X = 2,
16
+ onLoad: $,
17
+ onLazyLoad: x,
18
+ lazy: O = !1,
19
+ borderRadius: f,
20
+ disabledResizing: z = !1,
21
+ withIntrinsicRatio: M = !1,
22
+ enableBlurPlaceholder: c = !1,
23
+ enableFallback: R = !1,
24
+ enableErrorFallback: U = !0,
25
+ renderErrorFallback: a,
25
26
  wrapperProps: e = {},
26
- onError: H,
27
- ...d
28
- }, J) => {
29
- const u = h(null), $ = h(!1), m = h(null);
30
- w(J, () => m.current);
31
- const [a, K] = C(!1), [O, y] = C(!1), [v, S] = C(!1), j = b({ src: _, width: n, height: o, fit: q, position: A, scale: D, disabledResizing: G }), z = (t) => {
32
- y(!0), S(!1), typeof r == "function" && r(t);
27
+ onError: V,
28
+ ...u
29
+ }, Y) => {
30
+ const m = W(null), _ = W(!1), y = W(null);
31
+ tt(Y, () => y.current);
32
+ const [d, Z] = I(!1), [g, v] = I(!1), [S, r] = I(!1), [L, b] = I(!1), q = N({
33
+ mode: "original",
34
+ src: j,
35
+ width: n,
36
+ height: i,
37
+ fit: h,
38
+ position: E,
39
+ scale: X,
40
+ disabledResizing: z
41
+ }), C = c ? N({
42
+ mode: "blur",
43
+ src: j,
44
+ width: n,
45
+ fit: h,
46
+ position: E,
47
+ scale: 1 / 3,
48
+ disabledResizing: z
49
+ }) : null, A = (t) => {
50
+ v(!0), r(!1), typeof $ == "function" && $(t);
33
51
  }, B = (t) => {
34
- S(!0), y(!1), typeof H == "function" && H(t.nativeEvent);
35
- };
36
- return R(() => {
37
- if (I && u.current) {
38
- const t = u.current, N = () => {
52
+ r(!0), v(!1), typeof V == "function" && V(t.nativeEvent);
53
+ }, D = () => b(!0);
54
+ return G(() => {
55
+ if (O && m.current) {
56
+ const t = m.current, F = () => {
39
57
  if (!t) return !1;
40
- const i = t.getBoundingClientRect();
41
- return i.bottom >= 0 && i.top <= (window.innerHeight || document.documentElement.clientHeight) + k;
42
- }, s = () => {
43
- N() && K(!0);
44
- }, Q = () => {
45
- var i;
46
- (i = window.appScreenContent) == null || i.addEventListener("scroll", s), window.addEventListener("resize", s), window.addEventListener("orientationchange", s);
47
- }, X = () => {
48
- var i;
49
- (i = window.appScreenContent) == null || i.removeEventListener("scroll", s), window.removeEventListener("resize", s), window.removeEventListener("orientationchange", s);
58
+ const o = t.getBoundingClientRect();
59
+ return o.bottom >= 0 && o.top <= (window.innerHeight || document.documentElement.clientHeight) + nt;
60
+ }, l = () => {
61
+ F() && Z(!0);
62
+ }, w = () => {
63
+ var o;
64
+ (o = window.appScreenContent) == null || o.addEventListener("scroll", l), window.addEventListener("resize", l), window.addEventListener("orientationchange", l);
65
+ }, k = () => {
66
+ var o;
67
+ (o = window.appScreenContent) == null || o.removeEventListener("scroll", l), window.removeEventListener("resize", l), window.removeEventListener("orientationchange", l);
50
68
  };
51
- return s(), Q(), X;
69
+ return l(), w(), k;
52
70
  }
53
- }), R(() => {
54
- typeof g == "function" && a && !$.current && ($.current = !0, g());
55
- }, [g, a]), F(() => {
56
- const t = m.current;
57
- return t != null && t.complete ? t.naturalWidth > 0 ? (t.style.transition = "none", t.style.opacity = "1", y(!0)) : (t.style.opacity = "0", S(!0)) : t && (t.style.transition = "opacity 0.3s", t.style.opacity = "0", t.onload = () => {
58
- t.style.opacity = "1", y(!0), t.onload = null;
71
+ }), G(() => {
72
+ typeof x == "function" && d && !_.current && (_.current = !0, x());
73
+ }, [x, d]), et(() => {
74
+ const t = y.current;
75
+ return t != null && t.complete ? t.naturalWidth > 0 ? (t.style.transition = "none", t.style.opacity = "1", v(!0)) : (t.style.opacity = "0", r(!0)) : t && (t.style.transition = "opacity 0.3s", t.style.opacity = "0", t.onload = () => {
76
+ t.style.opacity = "1", v(!0), t.onload = null;
59
77
  }, t.onerror = () => {
60
- S(!0), t.onerror = null;
78
+ r(!0), t.onerror = null;
61
79
  }), () => {
62
80
  t && (t.onload = null, t.onerror = null);
63
81
  };
64
- }, [a]), I ? /* @__PURE__ */ L(
65
- M,
82
+ }, [d]), O ? /* @__PURE__ */ T(
83
+ J,
66
84
  {
67
85
  ...e,
68
- ref: u,
69
- inlineCSS: x ? {
86
+ ref: m,
87
+ inlineCSS: M ? {
70
88
  position: "relative",
71
- paddingTop: `calc(100% / ${n} * ${o})`,
89
+ paddingTop: `calc(100% / ${n} * ${i})`,
72
90
  minWidth: "100%",
73
- borderRadius: l,
91
+ borderRadius: f,
74
92
  overflow: "hidden",
75
93
  ...e == null ? void 0 : e.inlineCSS
76
94
  } : {
77
95
  position: "relative",
78
96
  width: n,
79
97
  minWidth: n,
80
- height: o,
81
- borderRadius: l,
98
+ height: i,
99
+ borderRadius: f,
82
100
  overflow: "hidden",
83
101
  ...e == null ? void 0 : e.inlineCSS
84
102
  },
85
103
  children: [
86
- T && /* @__PURE__ */ c(
87
- U,
104
+ R && /* @__PURE__ */ s(
105
+ K,
88
106
  {
89
107
  width: "100%",
90
108
  height: "100%",
91
- borderRadius: l || 0,
109
+ borderRadius: f || 0,
92
110
  inlineCSS: {
93
111
  position: "absolute",
94
112
  top: 0,
95
113
  left: 0,
96
- opacity: O ? 0 : 1,
114
+ opacity: g || c && L ? 0 : 1,
97
115
  transition: "opacity 0.3s"
98
116
  }
99
117
  }
100
118
  ),
101
- a && /* @__PURE__ */ L(Y, { children: [
102
- /* @__PURE__ */ c(
119
+ c && C && d && /* @__PURE__ */ s(
120
+ "img",
121
+ {
122
+ src: C,
123
+ alt: "",
124
+ width: n,
125
+ height: i,
126
+ onLoad: D,
127
+ draggable: !1,
128
+ style: {
129
+ position: "absolute",
130
+ top: 0,
131
+ left: 0,
132
+ width: "100%",
133
+ height: "100%",
134
+ filter: "blur(5px)",
135
+ opacity: L && !g ? 1 : 0,
136
+ transition: "opacity 0.3s",
137
+ objectFit: h,
138
+ objectPosition: E
139
+ }
140
+ }
141
+ ),
142
+ d && /* @__PURE__ */ T(p, { children: [
143
+ /* @__PURE__ */ s(
103
144
  "img",
104
145
  {
105
- ref: m,
106
- src: j,
107
- alt: E,
146
+ ref: y,
147
+ src: q,
148
+ alt: H,
108
149
  width: n,
109
- height: o,
110
- onLoad: z,
150
+ height: i,
151
+ onLoad: A,
111
152
  onError: B,
112
- "aria-hidden": v,
113
- ...d,
153
+ "aria-hidden": S,
154
+ draggable: !1,
155
+ ...u,
114
156
  style: {
115
157
  position: "absolute",
116
158
  top: 0,
@@ -118,64 +160,86 @@ const k = 100, ot = Z(
118
160
  width: "100%",
119
161
  height: "100%",
120
162
  transition: "opacity 0.3s",
121
- ...d.style
163
+ ...u.style
122
164
  }
123
165
  }
124
166
  ),
125
- W && v && ((f == null ? void 0 : f()) || /* @__PURE__ */ c(V, {}))
167
+ U && S && ((a == null ? void 0 : a()) || /* @__PURE__ */ s(Q, {}))
126
168
  ] })
127
169
  ]
128
170
  }
129
- ) : /* @__PURE__ */ L(
130
- M,
171
+ ) : /* @__PURE__ */ T(
172
+ J,
131
173
  {
132
174
  ...e,
133
- ref: u,
134
- inlineCSS: x ? {
175
+ ref: m,
176
+ inlineCSS: M ? {
135
177
  position: "relative",
136
- paddingTop: `calc(100% / ${n} * ${o})`,
178
+ paddingTop: `calc(100% / ${n} * ${i})`,
137
179
  minWidth: "100%",
138
180
  transition: "padding-top 0.2s",
139
- borderRadius: l,
181
+ borderRadius: f,
140
182
  overflow: "hidden",
141
183
  ...e == null ? void 0 : e.inlineCSS
142
184
  } : {
143
185
  position: "relative",
144
186
  width: n,
145
187
  minWidth: n,
146
- height: o,
147
- borderRadius: l,
188
+ height: i,
189
+ borderRadius: f,
148
190
  overflow: "hidden",
149
191
  ...e == null ? void 0 : e.inlineCSS
150
192
  },
151
193
  children: [
152
- T && /* @__PURE__ */ c(
153
- U,
194
+ R && /* @__PURE__ */ s(
195
+ K,
154
196
  {
155
197
  width: "100%",
156
198
  height: "100%",
157
- borderRadius: l || 0,
199
+ borderRadius: f || 0,
158
200
  inlineCSS: {
159
201
  position: "absolute",
160
202
  top: 0,
161
203
  left: 0,
162
- opacity: O ? 0 : 1,
204
+ opacity: g || c && L ? 0 : 1,
205
+ transition: "opacity 0.3s"
206
+ }
207
+ }
208
+ ),
209
+ c && C && /* @__PURE__ */ s(
210
+ "img",
211
+ {
212
+ src: C,
213
+ alt: "",
214
+ width: n,
215
+ height: i,
216
+ onLoad: D,
217
+ draggable: !1,
218
+ style: {
219
+ position: "absolute",
220
+ top: 0,
221
+ left: 0,
222
+ width: "100%",
223
+ height: "100%",
224
+ filter: "blur(5px)",
225
+ opacity: L && !g ? 1 : 0,
163
226
  transition: "opacity 0.3s"
164
227
  }
165
228
  }
166
229
  ),
167
- /* @__PURE__ */ c(
230
+ /* @__PURE__ */ s(
168
231
  "img",
169
232
  {
170
- ref: m,
171
- src: j,
172
- alt: E,
233
+ ref: y,
234
+ src: q,
235
+ alt: H,
173
236
  width: n,
174
- height: o,
175
- onLoad: z,
237
+ height: i,
238
+ onLoad: A,
176
239
  onError: B,
177
- "aria-hidden": v,
178
- ...d,
240
+ "aria-hidden": S,
241
+ draggable: !1,
242
+ ...u,
179
243
  style: {
180
244
  position: "absolute",
181
245
  top: 0,
@@ -183,16 +247,16 @@ const k = 100, ot = Z(
183
247
  width: "100%",
184
248
  height: "100%",
185
249
  transition: "opacity 0.3s",
186
- ...d.style
250
+ ...u.style
187
251
  }
188
252
  }
189
253
  ),
190
- W && v && ((f == null ? void 0 : f()) || /* @__PURE__ */ c(V, {}))
254
+ U && S && ((a == null ? void 0 : a()) || /* @__PURE__ */ s(Q, {}))
191
255
  ]
192
256
  }
193
257
  );
194
258
  }
195
259
  );
196
260
  export {
197
- ot as default
261
+ ct as default
198
262
  };
@@ -1,40 +1,38 @@
1
- import { jsxs as C, jsx as b } from "react/jsx-runtime";
2
- import { forwardRef as W, useState as s, useRef as z, useImperativeHandle as L, useEffect as v, Children as D, isValidElement as V, cloneElement as $ } from "react";
3
- import { Flexbox as r, Skeleton as q } from "@dotss/ui";
4
- import G from "@dotss/ui/core/useTheme";
5
- import J from "../../Image/Image.mjs";
6
- import { findImageInChildren as K } from "../Masonry.utils.mjs";
7
- const Z = W(
1
+ import { jsxs as w, jsx as u } from "react/jsx-runtime";
2
+ import { forwardRef as H, useState as S, useRef as I, useImperativeHandle as A, useEffect as m, Children as B, isValidElement as F, cloneElement as W } from "react";
3
+ import { Flexbox as s, Skeleton as z } from "@dotss/ui";
4
+ import D from "@dotss/ui/core/useTheme";
5
+ import L from "../../Image/Image.mjs";
6
+ import { findImageInChildren as V } from "../Masonry.utils.mjs";
7
+ const O = H(
8
8
  ({
9
- children: y,
10
- width: l = 0,
11
- height: c = 0,
12
- spacing: x = 2,
13
- borderRadius: o = 0,
14
- direction: a = "vertical",
15
- setInnerRef: t,
16
- sourceMetadata: d,
9
+ children: b,
10
+ width: c = 0,
11
+ height: d = 0,
12
+ spacing: C = 2,
13
+ borderRadius: t = 0,
14
+ direction: v = "vertical",
15
+ setInnerRef: o,
16
+ sourceMetadata: f,
17
17
  ...e
18
- }, T) => {
19
- var w;
20
- const { spacing: E } = G(), f = K(y), p = (w = f == null ? void 0 : f.props) == null ? void 0 : w.src, n = d == null ? void 0 : d.find((i) => i.src === p), [g, j] = s((n == null ? void 0 : n.width) ?? l ?? 0), [h, I] = s((n == null ? void 0 : n.height) ?? c ?? 0), [u, k] = s(!p), [m, H] = s(!p), S = z(null), A = () => k(!0), B = (i) => (F) => {
21
- H(!0), i == null || i(F);
22
- };
23
- return L(T, () => S.current), v(() => {
24
- j((n == null ? void 0 : n.width) ?? l ?? 0), I((n == null ? void 0 : n.height) ?? c ?? 0);
25
- }, [l, c, n == null ? void 0 : n.width, n == null ? void 0 : n.height]), v(() => {
26
- const i = setTimeout(() => {
27
- k(!0);
18
+ }, x) => {
19
+ var k;
20
+ const { spacing: a } = D(), h = V(b), y = (k = h == null ? void 0 : h.props) == null ? void 0 : k.src, i = f == null ? void 0 : f.find((n) => n.src === y), [l, j] = S((i == null ? void 0 : i.width) ?? c ?? 0), [r, T] = S((i == null ? void 0 : i.height) ?? d ?? 0), [g, E] = S(!1), p = I(null);
21
+ return A(x, () => p.current), m(() => {
22
+ j((i == null ? void 0 : i.width) ?? c ?? 0), T((i == null ? void 0 : i.height) ?? d ?? 0);
23
+ }, [c, d, i == null ? void 0 : i.width, i == null ? void 0 : i.height]), m(() => {
24
+ const n = setTimeout(() => {
25
+ E(!0);
28
26
  }, 500);
29
27
  return () => {
30
- clearTimeout(i);
28
+ clearTimeout(n);
31
29
  };
32
- }, []), v(() => {
33
- t == null || t(S.current);
34
- }, [t]), /* @__PURE__ */ C(
35
- r,
30
+ }, [l, r]), m(() => {
31
+ o == null || o(p.current);
32
+ }, [o]), /* @__PURE__ */ w(
33
+ s,
36
34
  {
37
- ref: S,
35
+ ref: p,
38
36
  flexDirection: "column",
39
37
  ...e,
40
38
  inlineCSS: {
@@ -42,18 +40,17 @@ const Z = W(
42
40
  ...e == null ? void 0 : e.inlineCSS
43
41
  },
44
42
  children: [
45
- a === "vertical" && /* @__PURE__ */ b(
46
- r,
43
+ v === "vertical" && /* @__PURE__ */ u(
44
+ s,
47
45
  {
48
46
  inlineCSS: {
49
- minHeight: E.content(x)
47
+ minHeight: a.content(C)
50
48
  }
51
49
  }
52
50
  ),
53
- /* @__PURE__ */ C(
54
- r,
51
+ /* @__PURE__ */ u(
52
+ s,
55
53
  {
56
- onTransitionEnd: A,
57
54
  inlineCSS: {
58
55
  position: "relative",
59
56
  overflow: "hidden",
@@ -64,64 +61,64 @@ const Z = W(
64
61
  },
65
62
  ...e == null ? void 0 : e.inlineCSS
66
63
  },
67
- style: a === "vertical" ? {
68
- borderRadius: o,
69
- paddingTop: `calc(${h / g} * 100%)`,
70
- transition: "transform 0.3s 0.1s, padding-top 0.3s 0.1s"
64
+ style: v === "vertical" ? {
65
+ borderRadius: t,
66
+ paddingTop: `calc(${r / l} * 100%)`,
67
+ transition: "padding-top 0.3s 0.1s"
71
68
  } : {
72
- borderRadius: o,
73
- paddingLeft: g,
74
- paddingTop: h,
75
- transition: "transform 0.3s 0.1s, padding-top 0.3s 0.1s, padding-left 0.3s 0.1s"
69
+ borderRadius: t,
70
+ paddingLeft: l,
71
+ paddingTop: r,
72
+ transition: "padding-top 0.3s 0.1s, padding-left 0.3s 0.1s"
76
73
  },
77
- children: [
78
- /* @__PURE__ */ b(
79
- r,
80
- {
81
- inlineCSS: {
82
- position: "absolute",
83
- top: 0,
84
- left: 0,
85
- width: "100%",
86
- height: "100%",
87
- overflow: "hidden",
88
- borderRadius: o + (m && u ? 0 : 2),
89
- transition: "border-radius 0.3s 0.1s",
90
- zIndex: 1
91
- },
92
- children: D.toArray(y).filter(V).map((i) => i.type === J || i.type === "img" ? $(i, {
93
- width: g,
94
- height: h,
74
+ children: /* @__PURE__ */ w(
75
+ s,
76
+ {
77
+ inlineCSS: {
78
+ position: "absolute",
79
+ top: 0,
80
+ left: 0,
81
+ width: "100%",
82
+ height: "100%",
83
+ overflow: "hidden",
84
+ transform: "translate3d(0, 0, 0)",
85
+ borderRadius: t + (g ? 0 : 2),
86
+ transition: "border-radius 0.3s 0.1s",
87
+ zIndex: 1
88
+ },
89
+ children: [
90
+ /* @__PURE__ */ u(
91
+ z,
92
+ {
93
+ borderRadius: t,
94
+ inlineCSS: {
95
+ position: "absolute",
96
+ top: 0,
97
+ left: 0,
98
+ width: "100%",
99
+ height: "100%",
100
+ opacity: !y || g ? 0 : 1,
101
+ transition: "opacity 0.3s 0.1s",
102
+ pointerEvents: g ? "none" : void 0,
103
+ zIndex: 2
104
+ }
105
+ }
106
+ ),
107
+ B.toArray(b).filter(F).map((n) => n.type === L || n.type === "img" ? W(n, {
108
+ width: l,
109
+ height: r,
95
110
  draggable: !1,
96
111
  style: {
97
112
  overflow: "hidden",
98
113
  objectFit: "cover",
99
- ...i.props.style
114
+ ...n.props.style
100
115
  },
101
- ...i.props,
102
- onLoad: B(i.props.onLoad),
103
- enableFallback: !1
104
- }) : i)
105
- }
106
- ),
107
- /* @__PURE__ */ b(
108
- q,
109
- {
110
- borderRadius: o,
111
- inlineCSS: {
112
- position: "absolute",
113
- top: 0,
114
- left: 0,
115
- width: "100%",
116
- height: "100%",
117
- zIndex: 2,
118
- opacity: m && u ? 0 : 1,
119
- transition: "opacity 0.3s 0.1s",
120
- pointerEvents: m && u ? "none" : void 0
121
- }
122
- }
123
- )
124
- ]
116
+ ...n.props,
117
+ enableFallback: !0
118
+ }) : n)
119
+ ]
120
+ }
121
+ )
125
122
  }
126
123
  )
127
124
  ]
@@ -130,5 +127,5 @@ const Z = W(
130
127
  }
131
128
  );
132
129
  export {
133
- Z as default
130
+ O as default
134
131
  };
@@ -7,10 +7,13 @@ export interface SchedulerProps extends FlexboxProps {
7
7
  text: string;
8
8
  color?: string;
9
9
  }[];
10
+ minDate?: Dayjs;
11
+ maxDate?: Dayjs;
10
12
  minScheduleBlockHeight?: number;
11
13
  maxScheduleBlockHeight?: number;
12
14
  renderScheduleBlock?: (date: string, time: string) => ReactNode;
13
15
  onDateChange?: (date: Dayjs) => void;
16
+ onDateChangeCanceled?: (date: Dayjs, direction: 'prev' | 'next') => void;
14
17
  }
15
- declare function Scheduler({ children, date, legend, minScheduleBlockHeight, maxScheduleBlockHeight, renderScheduleBlock, onDateChange, ...props }: SchedulerProps): import("@emotion/react/jsx-runtime").JSX.Element;
18
+ declare function Scheduler({ children, date, legend, minDate, maxDate, minScheduleBlockHeight, maxScheduleBlockHeight, renderScheduleBlock, onDateChange, onDateChangeCanceled, ...props }: SchedulerProps): import("@emotion/react/jsx-runtime").JSX.Element;
16
19
  export default Scheduler;