@arthurzakharov/ui-kit 1.8.9 → 1.9.1

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,27 +1,28 @@
1
- import { jsx as n } from "react/jsx-runtime";
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 s } from "../hooks/use-animation-lifecycle/use-animation-lifecycle.hook.js";
5
- import { c as d } from "../../animation.module-DQXuL9kR.js";
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 A = (o) => {
8
- const t = r(o), i = s({
7
+ const y = (o) => {
8
+ const t = r(o), i = d({
9
9
  condition: t.condition,
10
- animateOnStart: t.animateOnStart
11
- }), a = {
10
+ animateOnStart: t.animateOnStart,
11
+ onAnimationEnd: t.onAnimationEnd
12
+ }), n = {
12
13
  height: 0,
13
14
  opacity: 0
14
- }, e = { height: "auto", opacity: 1 };
15
- return !i.shouldRender && !t.keepMount ? null : /* @__PURE__ */ n(
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(d.Animation, t.className),
20
- children: /* @__PURE__ */ n(
20
+ className: m(s.Animation, t.className),
21
+ children: /* @__PURE__ */ e(
21
22
  c.div,
22
23
  {
23
- initial: i.getInitialState(a, e),
24
- animate: i.getAnimateState(a, e),
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
- A as FadeGrow
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 d } from "../../proxy-CmTphuYR.js";
7
- const h = (i) => {
8
- const t = r(i), a = s({
9
- condition: i.condition,
10
- animateOnStart: t.animateOnStart
11
- }), e = {
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
- }, n = { opacity: 1, scale: 1 };
15
- return !a.shouldRender && !t.keepMount ? null : /* @__PURE__ */ o(
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(c.Animation, t.className),
20
+ className: m(d.Animation, t.className),
20
21
  children: /* @__PURE__ */ o(
21
- d.div,
22
+ c.div,
22
23
  {
23
- initial: a.getInitialState(e, n),
24
- animate: a.getAnimateState(e, n),
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: a.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
- h as FadeScale
41
+ S as FadeScale
41
42
  };
@@ -1,27 +1,28 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import r from "clsx";
3
- import { withBaseAnimationDefaults as m } from "../utils/default-props.js";
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 S = (o) => {
8
- const t = m(o), i = d({
7
+ const h = (o) => {
8
+ const t = r(o), i = d({
9
9
  condition: t.condition,
10
- animateOnStart: t.animateOnStart
11
- }), e = {
10
+ animateOnStart: t.animateOnStart,
11
+ onAnimationEnd: t.onAnimationEnd
12
+ }), n = {
12
13
  x: (t.direction ?? "ltr") === "ltr" ? "-100%" : "100%",
13
14
  opacity: 0
14
- }, n = { x: 0, opacity: 1 };
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: r(s.Animation, t.className),
20
+ className: m(s.Animation, t.className),
20
21
  children: /* @__PURE__ */ a(
21
22
  l.div,
22
23
  {
23
- initial: i.getInitialState(e, n),
24
- animate: i.getAnimateState(e, n),
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
- S as FadeSlide
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 i, useRef as c, useEffect as s } from "react";
2
- const S = ({ condition: e, animateOnStart: m }) => {
3
- const [a, o] = i(m), [n, u] = i(e || m), f = c(e);
4
- return s(() => {
5
- f.current = e;
6
- }, [e]), s(() => {
7
- if (!a) {
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
- }, [a]), s(() => {
14
- if (e && !n) {
13
+ }, [r]), m(() => {
14
+ if (e && !a) {
15
15
  const t = requestAnimationFrame(() => {
16
- u(!0);
16
+ c(!0);
17
17
  });
18
18
  return () => cancelAnimationFrame(t);
19
19
  }
20
- }, [e, n]), {
21
- shouldRender: n,
22
- getInitialState: (t, r) => a ? e ? t : r : !1,
23
- getAnimateState: (t, r) => e ? r : 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
- f.current || u(!1);
25
+ n.current || c(!1), i?.(n.current);
26
26
  }
27
27
  };
28
28
  };
29
29
  export {
30
- S as useAnimationLifecycle
30
+ g as useAnimationLifecycle
31
31
  };
@@ -1,26 +1,26 @@
1
- import { jsx as m } from "react/jsx-runtime";
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 n = {
5
+ const i = {
6
6
  top: 0,
7
7
  right: 90,
8
8
  bottom: 180,
9
9
  left: 270
10
- }, C = (a) => {
11
- const t = p(a), o = f(t.condition), [e, r] = l(t.animateOnStart), i = `${n[t.from ?? "left"]}deg`, s = `${n[t.to ?? "top"]}deg`, c = (e ? t.condition : !1) ? s : i;
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 (o.current !== t.condition && (o.current = t.condition, !e)) {
14
- const d = requestAnimationFrame(() => {
13
+ if (e.current !== t.condition && (e.current = t.condition, !o)) {
14
+ const m = requestAnimationFrame(() => {
15
15
  r(!0);
16
16
  });
17
- return () => cancelAnimationFrame(d);
17
+ return () => cancelAnimationFrame(m);
18
18
  }
19
- }, [t.condition, e]), /* @__PURE__ */ m(
19
+ }, [t.condition, o]), /* @__PURE__ */ d(
20
20
  R.div,
21
21
  {
22
22
  "data-testid": t["data-testid"] || "animation-rotate",
23
- initial: { rotate: i },
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
- C as Rotate
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;
@@ -7,5 +7,8 @@ export interface SignatureProps extends Base {
7
7
  }>;
8
8
  onChangeManual: (value: string) => void;
9
9
  onChangeAuto: (value: string) => void;
10
+ onSwitchToManual?: () => void;
11
+ onSwitchToAuto?: () => void;
12
+ onSwitchToPreview?: () => void;
10
13
  }
11
- export declare const Signature: ({ auto, manual, getSignature, onChangeManual, onChangeAuto, ...base }: SignatureProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const Signature: ({ auto, manual, getSignature, onChangeManual, onChangeAuto, onSwitchToManual, onSwitchToAuto, onSwitchToPreview, ...base }: SignatureProps) => import("react/jsx-runtime").JSX.Element;