@arthurzakharov/ui-kit 1.8.9 → 1.9.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.
- package/dist/animations/fade-grow/fade-grow.component.js +15 -14
- package/dist/animations/fade-scale/fade-scale.component.js +16 -15
- package/dist/animations/fade-slide/fade-slide.component.js +12 -11
- package/dist/animations/hooks/use-animation-lifecycle/use-animation-lifecycle.hook.d.ts +2 -1
- package/dist/animations/hooks/use-animation-lifecycle/use-animation-lifecycle.hook.js +16 -16
- package/dist/animations/rotate/rotate.component.js +11 -10
- package/dist/animations/utils/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import m from "clsx";
|
|
3
3
|
import { withBaseAnimationDefaults as r } from "../utils/default-props.js";
|
|
4
|
-
import { useAnimationLifecycle as
|
|
5
|
-
import { c as
|
|
4
|
+
import { useAnimationLifecycle as d } from "../hooks/use-animation-lifecycle/use-animation-lifecycle.hook.js";
|
|
5
|
+
import { c as s } from "../../animation.module-DQXuL9kR.js";
|
|
6
6
|
import { m as c } from "../../proxy-CmTphuYR.js";
|
|
7
|
-
const
|
|
8
|
-
const t = r(o), i =
|
|
7
|
+
const y = (o) => {
|
|
8
|
+
const t = r(o), i = d({
|
|
9
9
|
condition: t.condition,
|
|
10
|
-
animateOnStart: t.animateOnStart
|
|
11
|
-
|
|
10
|
+
animateOnStart: t.animateOnStart,
|
|
11
|
+
onAnimationEnd: t.onAnimationEnd
|
|
12
|
+
}), n = {
|
|
12
13
|
height: 0,
|
|
13
14
|
opacity: 0
|
|
14
|
-
},
|
|
15
|
-
return !i.shouldRender && !t.keepMount ? null : /* @__PURE__ */
|
|
15
|
+
}, a = { height: "auto", opacity: 1 };
|
|
16
|
+
return !i.shouldRender && !t.keepMount ? null : /* @__PURE__ */ e(
|
|
16
17
|
"div",
|
|
17
18
|
{
|
|
18
19
|
"data-testid": t["data-testid"] || "animation-fade-grow",
|
|
19
|
-
className: m(
|
|
20
|
-
children: /* @__PURE__ */
|
|
20
|
+
className: m(s.Animation, t.className),
|
|
21
|
+
children: /* @__PURE__ */ e(
|
|
21
22
|
c.div,
|
|
22
23
|
{
|
|
23
|
-
initial: i.getInitialState(
|
|
24
|
-
animate: i.getAnimateState(
|
|
24
|
+
initial: i.getInitialState(n, a),
|
|
25
|
+
animate: i.getAnimateState(n, a),
|
|
25
26
|
transition: {
|
|
26
27
|
ease: t.ease,
|
|
27
28
|
duration: t.duration,
|
|
@@ -37,5 +38,5 @@ const A = (o) => {
|
|
|
37
38
|
);
|
|
38
39
|
};
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
y as FadeGrow
|
|
41
42
|
};
|
|
@@ -2,33 +2,34 @@ import { jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import m from "clsx";
|
|
3
3
|
import { withBaseAnimationDefaults as r } from "../utils/default-props.js";
|
|
4
4
|
import { useAnimationLifecycle as s } from "../hooks/use-animation-lifecycle/use-animation-lifecycle.hook.js";
|
|
5
|
-
import { c } from "../../animation.module-DQXuL9kR.js";
|
|
6
|
-
import { m as
|
|
7
|
-
const
|
|
8
|
-
const t = r(
|
|
9
|
-
condition:
|
|
10
|
-
animateOnStart: t.animateOnStart
|
|
11
|
-
|
|
5
|
+
import { c as d } from "../../animation.module-DQXuL9kR.js";
|
|
6
|
+
import { m as c } from "../../proxy-CmTphuYR.js";
|
|
7
|
+
const S = (n) => {
|
|
8
|
+
const t = r(n), i = s({
|
|
9
|
+
condition: n.condition,
|
|
10
|
+
animateOnStart: t.animateOnStart,
|
|
11
|
+
onAnimationEnd: t.onAnimationEnd
|
|
12
|
+
}), a = {
|
|
12
13
|
opacity: 0,
|
|
13
14
|
scale: 0.95
|
|
14
|
-
},
|
|
15
|
-
return !
|
|
15
|
+
}, e = { opacity: 1, scale: 1 };
|
|
16
|
+
return !i.shouldRender && !t.keepMount ? null : /* @__PURE__ */ o(
|
|
16
17
|
"div",
|
|
17
18
|
{
|
|
18
19
|
"data-testid": t["data-testid"] || "animation-fade-scale",
|
|
19
|
-
className: m(
|
|
20
|
+
className: m(d.Animation, t.className),
|
|
20
21
|
children: /* @__PURE__ */ o(
|
|
21
|
-
|
|
22
|
+
c.div,
|
|
22
23
|
{
|
|
23
|
-
initial:
|
|
24
|
-
animate:
|
|
24
|
+
initial: i.getInitialState(a, e),
|
|
25
|
+
animate: i.getAnimateState(a, e),
|
|
25
26
|
transition: {
|
|
26
27
|
ease: t.ease,
|
|
27
28
|
duration: t.duration,
|
|
28
29
|
delay: t.delay,
|
|
29
30
|
type: t.type
|
|
30
31
|
},
|
|
31
|
-
onAnimationComplete:
|
|
32
|
+
onAnimationComplete: i.onAnimationComplete,
|
|
32
33
|
children: t.children
|
|
33
34
|
},
|
|
34
35
|
t.name
|
|
@@ -37,5 +38,5 @@ const h = (i) => {
|
|
|
37
38
|
);
|
|
38
39
|
};
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
S as FadeScale
|
|
41
42
|
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { withBaseAnimationDefaults as
|
|
2
|
+
import m from "clsx";
|
|
3
|
+
import { withBaseAnimationDefaults as r } from "../utils/default-props.js";
|
|
4
4
|
import { useAnimationLifecycle as d } from "../hooks/use-animation-lifecycle/use-animation-lifecycle.hook.js";
|
|
5
5
|
import { c as s } from "../../animation.module-DQXuL9kR.js";
|
|
6
6
|
import { m as l } from "../../proxy-CmTphuYR.js";
|
|
7
|
-
const
|
|
8
|
-
const t =
|
|
7
|
+
const h = (o) => {
|
|
8
|
+
const t = r(o), i = d({
|
|
9
9
|
condition: t.condition,
|
|
10
|
-
animateOnStart: t.animateOnStart
|
|
11
|
-
|
|
10
|
+
animateOnStart: t.animateOnStart,
|
|
11
|
+
onAnimationEnd: t.onAnimationEnd
|
|
12
|
+
}), n = {
|
|
12
13
|
x: (t.direction ?? "ltr") === "ltr" ? "-100%" : "100%",
|
|
13
14
|
opacity: 0
|
|
14
|
-
},
|
|
15
|
+
}, e = { x: 0, opacity: 1 };
|
|
15
16
|
return !i.shouldRender && !t.keepMount ? null : /* @__PURE__ */ a(
|
|
16
17
|
"div",
|
|
17
18
|
{
|
|
18
19
|
"data-testid": t["data-testid"] || "animation-fade-slide",
|
|
19
|
-
className:
|
|
20
|
+
className: m(s.Animation, t.className),
|
|
20
21
|
children: /* @__PURE__ */ a(
|
|
21
22
|
l.div,
|
|
22
23
|
{
|
|
23
|
-
initial: i.getInitialState(
|
|
24
|
-
animate: i.getAnimateState(
|
|
24
|
+
initial: i.getInitialState(n, e),
|
|
25
|
+
animate: i.getAnimateState(n, e),
|
|
25
26
|
transition: {
|
|
26
27
|
ease: t.ease,
|
|
27
28
|
duration: t.duration,
|
|
@@ -38,5 +39,5 @@ const S = (o) => {
|
|
|
38
39
|
);
|
|
39
40
|
};
|
|
40
41
|
export {
|
|
41
|
-
|
|
42
|
+
h as FadeSlide
|
|
42
43
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
type UseAnimationLifecycleOptions = {
|
|
2
2
|
condition: boolean;
|
|
3
3
|
animateOnStart: boolean;
|
|
4
|
+
onAnimationEnd?: (condition: boolean) => void;
|
|
4
5
|
};
|
|
5
6
|
type AnimationState<T, U> = T | U | false;
|
|
6
|
-
export declare const useAnimationLifecycle: ({ condition, animateOnStart }: UseAnimationLifecycleOptions) => {
|
|
7
|
+
export declare const useAnimationLifecycle: ({ condition, animateOnStart, onAnimationEnd }: UseAnimationLifecycleOptions) => {
|
|
7
8
|
shouldRender: boolean;
|
|
8
9
|
getInitialState: <T, U>(hiddenState: T, visibleState: U) => AnimationState<T, U>;
|
|
9
10
|
getAnimateState: <T, U>(hiddenState: T, visibleState: U) => T | U;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
3
|
-
const [
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
}, [e]),
|
|
7
|
-
if (!
|
|
1
|
+
import { useState as f, useRef as l, useEffect as m } from "react";
|
|
2
|
+
const g = ({ condition: e, animateOnStart: u, onAnimationEnd: i }) => {
|
|
3
|
+
const [r, o] = f(u), [a, c] = f(e || u), n = l(e);
|
|
4
|
+
return m(() => {
|
|
5
|
+
n.current = e;
|
|
6
|
+
}, [e]), m(() => {
|
|
7
|
+
if (!r) {
|
|
8
8
|
const t = requestAnimationFrame(() => {
|
|
9
9
|
o(!0);
|
|
10
10
|
});
|
|
11
11
|
return () => cancelAnimationFrame(t);
|
|
12
12
|
}
|
|
13
|
-
}, [
|
|
14
|
-
if (e && !
|
|
13
|
+
}, [r]), m(() => {
|
|
14
|
+
if (e && !a) {
|
|
15
15
|
const t = requestAnimationFrame(() => {
|
|
16
|
-
|
|
16
|
+
c(!0);
|
|
17
17
|
});
|
|
18
18
|
return () => cancelAnimationFrame(t);
|
|
19
19
|
}
|
|
20
|
-
}, [e,
|
|
21
|
-
shouldRender:
|
|
22
|
-
getInitialState: (t,
|
|
23
|
-
getAnimateState: (t,
|
|
20
|
+
}, [e, a]), {
|
|
21
|
+
shouldRender: a,
|
|
22
|
+
getInitialState: (t, s) => r ? e ? t : s : !1,
|
|
23
|
+
getAnimateState: (t, s) => e ? s : t,
|
|
24
24
|
onAnimationComplete: () => {
|
|
25
|
-
|
|
25
|
+
n.current || c(!1), i?.(n.current);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
g as useAnimationLifecycle
|
|
31
31
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as f, useState as l, useEffect as u } from "react";
|
|
3
3
|
import { withBaseAnimationDefaults as p } from "../utils/default-props.js";
|
|
4
4
|
import { m as R } from "../../proxy-CmTphuYR.js";
|
|
5
|
-
const
|
|
5
|
+
const i = {
|
|
6
6
|
top: 0,
|
|
7
7
|
right: 90,
|
|
8
8
|
bottom: 180,
|
|
9
9
|
left: 270
|
|
10
|
-
},
|
|
11
|
-
const t = p(a),
|
|
10
|
+
}, y = (a) => {
|
|
11
|
+
const t = p(a), e = f(t.condition), [o, r] = l(t.animateOnStart), n = `${i[t.from ?? "left"]}deg`, s = `${i[t.to ?? "top"]}deg`, c = (o ? t.condition : !1) ? s : n;
|
|
12
12
|
return u(() => {
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
13
|
+
if (e.current !== t.condition && (e.current = t.condition, !o)) {
|
|
14
|
+
const m = requestAnimationFrame(() => {
|
|
15
15
|
r(!0);
|
|
16
16
|
});
|
|
17
|
-
return () => cancelAnimationFrame(
|
|
17
|
+
return () => cancelAnimationFrame(m);
|
|
18
18
|
}
|
|
19
|
-
}, [t.condition,
|
|
19
|
+
}, [t.condition, o]), /* @__PURE__ */ d(
|
|
20
20
|
R.div,
|
|
21
21
|
{
|
|
22
22
|
"data-testid": t["data-testid"] || "animation-rotate",
|
|
23
|
-
initial: { rotate:
|
|
23
|
+
initial: { rotate: n },
|
|
24
24
|
animate: { rotate: c },
|
|
25
25
|
transition: {
|
|
26
26
|
ease: t.ease,
|
|
@@ -29,11 +29,12 @@ const n = {
|
|
|
29
29
|
type: t.type
|
|
30
30
|
},
|
|
31
31
|
className: t.className,
|
|
32
|
+
onAnimationComplete: () => t.onAnimationEnd?.(t.condition),
|
|
32
33
|
children: t.children
|
|
33
34
|
},
|
|
34
35
|
t.name
|
|
35
36
|
);
|
|
36
37
|
};
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
y as Rotate
|
|
39
40
|
};
|
|
@@ -9,6 +9,7 @@ export interface BaseAnimationProps extends PropsWithChildren<Base> {
|
|
|
9
9
|
ease?: EasingDefinition;
|
|
10
10
|
duration?: number;
|
|
11
11
|
delay?: number;
|
|
12
|
+
onAnimationEnd?: (condition: boolean) => void;
|
|
12
13
|
}
|
|
13
14
|
export interface BaseFadeAnimationProps extends BaseAnimationProps {
|
|
14
15
|
keepMount?: boolean;
|