@impulse-ui-native/toast 9.1.1 → 10.0.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.
@@ -1,4 +1,3 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as react from 'react';
3
2
  import { ToastProps, ToastRootProps, ToastContentProps, ToastTitleProps, ToastDescriptionProps, ToastIconProps, ToastActionProps, ToastCloseProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
@@ -6,15 +5,15 @@ import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
7
  declare const Toast: react.NamedExoticComponent<ToastProps> & {
9
- readonly type: ({ children, title, description, action, actionProps, tone, hideIcon, hideClose, ...props }: ToastProps) => react_jsx_runtime.JSX.Element;
8
+ readonly type: ({ children, title, description, action, actionProps, tone, hideIcon, hideClose, ...props }: ToastProps) => react.JSX.Element;
10
9
  } & {
11
- Root: react.MemoExoticComponent<(props: ToastRootProps) => react_jsx_runtime.JSX.Element | null>;
12
- Content: react.MemoExoticComponent<({ style, ...props }: ToastContentProps) => react_jsx_runtime.JSX.Element>;
13
- Title: react.MemoExoticComponent<(props: ToastTitleProps) => react_jsx_runtime.JSX.Element>;
14
- Description: react.MemoExoticComponent<(props: ToastDescriptionProps) => react_jsx_runtime.JSX.Element>;
15
- Icon: react.MemoExoticComponent<({ children, style, ...props }: ToastIconProps) => react_jsx_runtime.JSX.Element>;
16
- Action: react.MemoExoticComponent<({ children, closeOnPress, onPress, disabled, loading, style, ...props }: ToastActionProps) => react_jsx_runtime.JSX.Element>;
17
- Close: react.MemoExoticComponent<({ children, ...props }: ToastCloseProps) => react_jsx_runtime.JSX.Element>;
10
+ Root: react.MemoExoticComponent<(props: ToastRootProps) => react.JSX.Element | null>;
11
+ Content: react.MemoExoticComponent<({ style, ...props }: ToastContentProps) => react.JSX.Element>;
12
+ Title: react.MemoExoticComponent<(props: ToastTitleProps) => react.JSX.Element>;
13
+ Description: react.MemoExoticComponent<(props: ToastDescriptionProps) => react.JSX.Element>;
14
+ Icon: react.MemoExoticComponent<({ children, style, ...props }: ToastIconProps) => react.JSX.Element>;
15
+ Action: react.MemoExoticComponent<({ children, closeOnPress, onPress, disabled, loading, style, ...props }: ToastActionProps) => react.JSX.Element>;
16
+ Close: react.MemoExoticComponent<({ children, ...props }: ToastCloseProps) => react.JSX.Element>;
18
17
  };
19
18
 
20
19
  export { Toast };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastActionProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastAction: react.MemoExoticComponent<({ children, closeOnPress, onPress, disabled, loading, style, ...props }: ToastActionProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastAction: react.MemoExoticComponent<({ children, closeOnPress, onPress, disabled, loading, style, ...props }: ToastActionProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastAction };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastCloseProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastClose: react.MemoExoticComponent<({ children, ...props }: ToastCloseProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastClose: react.MemoExoticComponent<({ children, ...props }: ToastCloseProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastClose };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastContentProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastContent: react.MemoExoticComponent<({ style, ...props }: ToastContentProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastContent: react.MemoExoticComponent<({ style, ...props }: ToastContentProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastContent };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastDescriptionProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastDescription: react.MemoExoticComponent<(props: ToastDescriptionProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastDescription: react.MemoExoticComponent<(props: ToastDescriptionProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastDescription };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastIconProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastIcon: react.MemoExoticComponent<({ children, style, ...props }: ToastIconProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastIcon: react.MemoExoticComponent<({ children, style, ...props }: ToastIconProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastIcon };
@@ -1,18 +1,17 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastRootProps, ToastContentProps, ToastTitleProps, ToastDescriptionProps, ToastIconProps, ToastActionProps, ToastCloseProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
7
  declare const Toast: {
9
- Root: react.MemoExoticComponent<(props: ToastRootProps) => react_jsx_runtime.JSX.Element | null>;
10
- Content: react.MemoExoticComponent<({ style, ...props }: ToastContentProps) => react_jsx_runtime.JSX.Element>;
11
- Title: react.MemoExoticComponent<(props: ToastTitleProps) => react_jsx_runtime.JSX.Element>;
12
- Description: react.MemoExoticComponent<(props: ToastDescriptionProps) => react_jsx_runtime.JSX.Element>;
13
- Icon: react.MemoExoticComponent<({ children, style, ...props }: ToastIconProps) => react_jsx_runtime.JSX.Element>;
14
- Action: react.MemoExoticComponent<({ children, closeOnPress, onPress, disabled, loading, style, ...props }: ToastActionProps) => react_jsx_runtime.JSX.Element>;
15
- Close: react.MemoExoticComponent<({ children, ...props }: ToastCloseProps) => react_jsx_runtime.JSX.Element>;
8
+ Root: react.MemoExoticComponent<(props: ToastRootProps) => react.JSX.Element | null>;
9
+ Content: react.MemoExoticComponent<({ style, ...props }: ToastContentProps) => react.JSX.Element>;
10
+ Title: react.MemoExoticComponent<(props: ToastTitleProps) => react.JSX.Element>;
11
+ Description: react.MemoExoticComponent<(props: ToastDescriptionProps) => react.JSX.Element>;
12
+ Icon: react.MemoExoticComponent<({ children, style, ...props }: ToastIconProps) => react.JSX.Element>;
13
+ Action: react.MemoExoticComponent<({ children, closeOnPress, onPress, disabled, loading, style, ...props }: ToastActionProps) => react.JSX.Element>;
14
+ Close: react.MemoExoticComponent<({ children, ...props }: ToastCloseProps) => react.JSX.Element>;
16
15
  };
17
16
 
18
17
  export { Toast };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastRootProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastRoot: react.MemoExoticComponent<(props: ToastRootProps) => react_jsx_runtime.JSX.Element | null>;
7
+ declare const ToastRoot: react.MemoExoticComponent<(props: ToastRootProps) => react.JSX.Element | null>;
9
8
 
10
9
  export { ToastRoot };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastTitleProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastTitle: react.MemoExoticComponent<(props: ToastTitleProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastTitle: react.MemoExoticComponent<(props: ToastTitleProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastTitle };
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { ToastProps } from '../types/toast.types.mjs';
4
3
  import '@impulse-ui-native/overlay';
5
4
  import '@impulse-ui-native/primitives';
6
5
  import '@impulse-ui-native/theme';
7
6
 
8
- declare const ToastComponent: react.MemoExoticComponent<({ children, title, description, action, actionProps, tone, hideIcon, hideClose, ...props }: ToastProps) => react_jsx_runtime.JSX.Element>;
7
+ declare const ToastComponent: react.MemoExoticComponent<({ children, title, description, action, actionProps, tone, hideIcon, hideClose, ...props }: ToastProps) => react.JSX.Element>;
9
8
 
10
9
  export { ToastComponent };
@@ -17,6 +17,8 @@ const ToastComponent = memo(function ToastComponent2({
17
17
  ...props
18
18
  }) {
19
19
  const tokens = useComponentsTokens().toast;
20
+ const hasDescription = description !== null && description !== void 0;
21
+ const hasAction = action !== null && action !== void 0;
20
22
  return /* @__PURE__ */ jsxs(Toast.Root, { ...props, tone, children: [
21
23
  !hideIcon ? /* @__PURE__ */ jsx(Toast.Icon, { children: /* @__PURE__ */ jsx(
22
24
  Icon,
@@ -28,10 +30,10 @@ const ToastComponent = memo(function ToastComponent2({
28
30
  ) }) : null,
29
31
  /* @__PURE__ */ jsxs(Toast.Content, { children: [
30
32
  title ? /* @__PURE__ */ jsx(Toast.Title, { children: title }) : null,
31
- description !== null && description !== void 0 ? /* @__PURE__ */ jsx(Toast.Description, { children: description }) : null,
33
+ hasDescription ? /* @__PURE__ */ jsx(Toast.Description, { children: description }) : null,
32
34
  children
33
35
  ] }),
34
- action !== null && action !== void 0 ? /* @__PURE__ */ jsx(Toast.Action, { ...actionProps, children: action }) : null,
36
+ hasAction ? /* @__PURE__ */ jsx(Toast.Action, { ...actionProps, children: action }) : null,
35
37
  !hideClose ? /* @__PURE__ */ jsx(Toast.Close, { children: /* @__PURE__ */ jsx(
36
38
  Icon,
37
39
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/toast.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { Icon } from \"@impulse-ui-native/icon\";\nimport { XIcon } from \"@impulse-ui-native/icon/icons/x\";\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { ToastProps } from \"../types\";\nimport { ToastIcons } from \"../constants/toast-icons.constants\";\nimport { Toast } from \"./toast-parts\";\n\nexport const ToastComponent = memo(function ToastComponent({\n children,\n title,\n description,\n action,\n actionProps,\n tone = \"success\",\n hideIcon = false,\n hideClose = false,\n ...props\n}: ToastProps) {\n const tokens = useComponentsTokens().toast;\n\n return (\n <Toast.Root {...props} tone={tone}>\n {!hideIcon ? (\n <Toast.Icon>\n <Icon\n icon={ToastIcons[tone]}\n size={tokens.iconSize}\n color={tokens.tones[tone].value}\n />\n </Toast.Icon>\n ) : null}\n <Toast.Content>\n {title ? <Toast.Title>{title}</Toast.Title> : null}\n {description !== null && description !== undefined ? (\n <Toast.Description>{description}</Toast.Description>\n ) : null}\n {children}\n </Toast.Content>\n {action !== null && action !== undefined ? (\n <Toast.Action {...actionProps}>{action}</Toast.Action>\n ) : null}\n {!hideClose ? (\n <Toast.Close>\n <Icon\n icon={XIcon}\n size={tokens.closeIconSize}\n color={tokens.closeColor}\n />\n </Toast.Close>\n ) : null}\n </Toast.Root>\n );\n});\n"],"mappings":"AA2BU,cAOJ,YAPI;AA3BV,SAAS,YAAY;AAErB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,2BAA2B;AAGpC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAEf,MAAM,iBAAiB,KAAK,SAASA,gBAAe;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,GAAe;AACb,QAAM,SAAS,oBAAoB,EAAE;AAErC,SACE,qBAAC,MAAM,MAAN,EAAY,GAAG,OAAO,MACpB;AAAA,KAAC,WACA,oBAAC,MAAM,MAAN,EACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,WAAW,IAAI;AAAA,QACrB,MAAM,OAAO;AAAA,QACb,OAAO,OAAO,MAAM,IAAI,EAAE;AAAA;AAAA,IAC5B,GACF,IACE;AAAA,IACJ,qBAAC,MAAM,SAAN,EACE;AAAA,cAAQ,oBAAC,MAAM,OAAN,EAAa,iBAAM,IAAiB;AAAA,MAC7C,gBAAgB,QAAQ,gBAAgB,SACvC,oBAAC,MAAM,aAAN,EAAmB,uBAAY,IAC9B;AAAA,MACH;AAAA,OACH;AAAA,IACC,WAAW,QAAQ,WAAW,SAC7B,oBAAC,MAAM,QAAN,EAAc,GAAG,aAAc,kBAAO,IACrC;AAAA,IACH,CAAC,YACA,oBAAC,MAAM,OAAN,EACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAM,OAAO;AAAA,QACb,OAAO,OAAO;AAAA;AAAA,IAChB,GACF,IACE;AAAA,KACN;AAEJ,CAAC;","names":["ToastComponent"]}
1
+ {"version":3,"sources":["../../src/components/toast.tsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { Icon } from \"@impulse-ui-native/icon\";\nimport { XIcon } from \"@impulse-ui-native/icon/icons/x\";\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { ToastProps } from \"../types\";\nimport { ToastIcons } from \"../constants/toast-icons.constants\";\nimport { Toast } from \"./toast-parts\";\n\nexport const ToastComponent = memo(function ToastComponent({\n children,\n title,\n description,\n action,\n actionProps,\n tone = \"success\",\n hideIcon = false,\n hideClose = false,\n ...props\n}: ToastProps) {\n const tokens = useComponentsTokens().toast;\n\n const hasDescription = description !== null && description !== undefined;\n const hasAction = action !== null && action !== undefined;\n\n return (\n <Toast.Root {...props} tone={tone}>\n {!hideIcon ? (\n <Toast.Icon>\n <Icon\n icon={ToastIcons[tone]}\n size={tokens.iconSize}\n color={tokens.tones[tone].value}\n />\n </Toast.Icon>\n ) : null}\n <Toast.Content>\n {title ? <Toast.Title>{title}</Toast.Title> : null}\n {hasDescription ? (\n <Toast.Description>{description}</Toast.Description>\n ) : null}\n {children}\n </Toast.Content>\n {hasAction ? (\n <Toast.Action {...actionProps}>{action}</Toast.Action>\n ) : null}\n {!hideClose ? (\n <Toast.Close>\n <Icon\n icon={XIcon}\n size={tokens.closeIconSize}\n color={tokens.closeColor}\n />\n </Toast.Close>\n ) : null}\n </Toast.Root>\n );\n});\n"],"mappings":"AA8BU,cAOJ,YAPI;AA9BV,SAAS,YAAY;AAErB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,2BAA2B;AAGpC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAEf,MAAM,iBAAiB,KAAK,SAASA,gBAAe;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,GAAe;AACb,QAAM,SAAS,oBAAoB,EAAE;AAErC,QAAM,iBAAiB,gBAAgB,QAAQ,gBAAgB;AAC/D,QAAM,YAAY,WAAW,QAAQ,WAAW;AAEhD,SACE,qBAAC,MAAM,MAAN,EAAY,GAAG,OAAO,MACpB;AAAA,KAAC,WACA,oBAAC,MAAM,MAAN,EACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,WAAW,IAAI;AAAA,QACrB,MAAM,OAAO;AAAA,QACb,OAAO,OAAO,MAAM,IAAI,EAAE;AAAA;AAAA,IAC5B,GACF,IACE;AAAA,IACJ,qBAAC,MAAM,SAAN,EACE;AAAA,cAAQ,oBAAC,MAAM,OAAN,EAAa,iBAAM,IAAiB;AAAA,MAC7C,iBACC,oBAAC,MAAM,aAAN,EAAmB,uBAAY,IAC9B;AAAA,MACH;AAAA,OACH;AAAA,IACC,YACC,oBAAC,MAAM,QAAN,EAAc,GAAG,aAAc,kBAAO,IACrC;AAAA,IACH,CAAC,YACA,oBAAC,MAAM,OAAN,EACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAM,OAAO;AAAA,QACb,OAAO,OAAO;AAAA;AAAA,IAChB,GACF,IACE;AAAA,KACN;AAEJ,CAAC;","names":["ToastComponent"]}
@@ -1,5 +1,4 @@
1
1
  import * as react from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { SvgProps } from 'react-native-svg';
4
3
 
5
4
  type IconVariant = "bold" | "duotone" | "fill" | "light" | "regular" | "thin";
@@ -8,10 +7,10 @@ interface IconWrapperProps extends SvgProps {
8
7
  }
9
8
 
10
9
  declare const ToastIcons: {
11
- info: react.MemoExoticComponent<(props: IconWrapperProps) => react_jsx_runtime.JSX.Element>;
12
- success: react.MemoExoticComponent<(props: IconWrapperProps) => react_jsx_runtime.JSX.Element>;
13
- warning: react.MemoExoticComponent<(props: IconWrapperProps) => react_jsx_runtime.JSX.Element>;
14
- error: react.MemoExoticComponent<(props: IconWrapperProps) => react_jsx_runtime.JSX.Element>;
10
+ info: react.MemoExoticComponent<(props: IconWrapperProps) => react.JSX.Element>;
11
+ success: react.MemoExoticComponent<(props: IconWrapperProps) => react.JSX.Element>;
12
+ warning: react.MemoExoticComponent<(props: IconWrapperProps) => react.JSX.Element>;
13
+ error: react.MemoExoticComponent<(props: IconWrapperProps) => react.JSX.Element>;
15
14
  };
16
15
 
17
16
  export { ToastIcons };
@@ -1,49 +1,17 @@
1
- import { useEffect, useMemo } from "react";
2
- import {
3
- cancelAnimation,
4
- useSharedValue,
5
- withTiming
6
- } from "react-native-reanimated";
7
- import { scheduleOnRN } from "react-native-worklets";
1
+ import { useMemo } from "react";
8
2
  import { useEventCallback, useTimer } from "@impulse-ui-native/core";
9
3
  import {
10
4
  useOverlayContext,
11
- useOverlayLifecycle
5
+ useOverlayLifecycle,
6
+ useOverlayTiming
12
7
  } from "@impulse-ui-native/overlay";
13
8
  import { useComponentsTokens } from "@impulse-ui-native/theme";
14
9
  function useToastLifecycle(props, duration) {
15
10
  const { id, open = true } = props;
16
11
  const { store } = useOverlayContext();
17
12
  const tokens = useComponentsTokens().toast;
18
- const progress = useSharedValue(0);
19
- const enter = useEventCallback(
20
- (transitionId, complete) => {
21
- progress.set(
22
- withTiming(1, { duration: tokens.enterDuration }, (finished) => {
23
- if (finished) {
24
- scheduleOnRN(complete, transitionId);
25
- }
26
- })
27
- );
28
- }
29
- );
30
- const exit = useEventCallback(
31
- (transitionId, complete) => {
32
- progress.set(
33
- withTiming(0, { duration: tokens.exitDuration }, (finished) => {
34
- if (finished) {
35
- scheduleOnRN(complete, transitionId);
36
- }
37
- })
38
- );
39
- }
40
- );
41
- const options = useMemo(
42
- () => ({ onEnter: enter, onExit: exit }),
43
- [enter, exit]
44
- );
45
- const lifecycleProps = useMemo(() => ({ ...props, open }), [props, open]);
46
- const lifecycle = useOverlayLifecycle(lifecycleProps, options);
13
+ const { options, progress } = useOverlayTiming(tokens);
14
+ const lifecycle = useOverlayLifecycle({ ...props, open }, options);
47
15
  const close = useEventCallback(() => store.close(id));
48
16
  useTimer({
49
17
  enabled: lifecycle.status === "open" && open,
@@ -51,7 +19,6 @@ function useToastLifecycle(props, duration) {
51
19
  callback: close,
52
20
  pauseOnBackground: true
53
21
  });
54
- useEffect(() => () => cancelAnimation(progress), [progress]);
55
22
  return useMemo(
56
23
  () => ({ ...lifecycle, progress, close }),
57
24
  [lifecycle, progress, close]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks/use-toast-lifecycle.hook.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport {\n cancelAnimation,\n useSharedValue,\n withTiming,\n} from \"react-native-reanimated\";\nimport { scheduleOnRN } from \"react-native-worklets\";\n\nimport type { OverlayTransitionHandler } from \"@impulse-ui-native/overlay\";\nimport { useEventCallback, useTimer } from \"@impulse-ui-native/core\";\nimport {\n useOverlayContext,\n useOverlayLifecycle,\n} from \"@impulse-ui-native/overlay\";\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { ToastRootProps } from \"../types\";\n\nexport function useToastLifecycle(props: ToastRootProps, duration: number) {\n const { id, open = true } = props;\n const { store } = useOverlayContext();\n const tokens = useComponentsTokens().toast;\n\n const progress = useSharedValue(0);\n\n const enter = useEventCallback<OverlayTransitionHandler>(\n (transitionId, complete) => {\n progress.set(\n withTiming(1, { duration: tokens.enterDuration }, (finished) => {\n if (finished) {\n scheduleOnRN(complete, transitionId);\n }\n }),\n );\n },\n );\n const exit = useEventCallback<OverlayTransitionHandler>(\n (transitionId, complete) => {\n progress.set(\n withTiming(0, { duration: tokens.exitDuration }, (finished) => {\n if (finished) {\n scheduleOnRN(complete, transitionId);\n }\n }),\n );\n },\n );\n\n const options = useMemo(\n () => ({ onEnter: enter, onExit: exit }),\n [enter, exit],\n );\n const lifecycleProps = useMemo(() => ({ ...props, open }), [props, open]);\n const lifecycle = useOverlayLifecycle(lifecycleProps, options);\n const close = useEventCallback(() => store.close(id));\n\n useTimer({\n enabled: lifecycle.status === \"open\" && open,\n duration,\n callback: close,\n pauseOnBackground: true,\n });\n\n useEffect(() => () => cancelAnimation(progress), [progress]);\n\n return useMemo(\n () => ({ ...lifecycle, progress, close }),\n [lifecycle, progress, close],\n );\n}\n"],"mappings":"AAAA,SAAS,WAAW,eAAe;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAG7B,SAAS,kBAAkB,gBAAgB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AAI7B,SAAS,kBAAkB,OAAuB,UAAkB;AACzE,QAAM,EAAE,IAAI,OAAO,KAAK,IAAI;AAC5B,QAAM,EAAE,MAAM,IAAI,kBAAkB;AACpC,QAAM,SAAS,oBAAoB,EAAE;AAErC,QAAM,WAAW,eAAe,CAAC;AAEjC,QAAM,QAAQ;AAAA,IACZ,CAAC,cAAc,aAAa;AAC1B,eAAS;AAAA,QACP,WAAW,GAAG,EAAE,UAAU,OAAO,cAAc,GAAG,CAAC,aAAa;AAC9D,cAAI,UAAU;AACZ,yBAAa,UAAU,YAAY;AAAA,UACrC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,QAAM,OAAO;AAAA,IACX,CAAC,cAAc,aAAa;AAC1B,eAAS;AAAA,QACP,WAAW,GAAG,EAAE,UAAU,OAAO,aAAa,GAAG,CAAC,aAAa;AAC7D,cAAI,UAAU;AACZ,yBAAa,UAAU,YAAY;AAAA,UACrC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU;AAAA,IACd,OAAO,EAAE,SAAS,OAAO,QAAQ,KAAK;AAAA,IACtC,CAAC,OAAO,IAAI;AAAA,EACd;AACA,QAAM,iBAAiB,QAAQ,OAAO,EAAE,GAAG,OAAO,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC;AACxE,QAAM,YAAY,oBAAoB,gBAAgB,OAAO;AAC7D,QAAM,QAAQ,iBAAiB,MAAM,MAAM,MAAM,EAAE,CAAC;AAEpD,WAAS;AAAA,IACP,SAAS,UAAU,WAAW,UAAU;AAAA,IACxC;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA,EACrB,CAAC;AAED,YAAU,MAAM,MAAM,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAE3D,SAAO;AAAA,IACL,OAAO,EAAE,GAAG,WAAW,UAAU,MAAM;AAAA,IACvC,CAAC,WAAW,UAAU,KAAK;AAAA,EAC7B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks/use-toast-lifecycle.hook.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { useEventCallback, useTimer } from \"@impulse-ui-native/core\";\nimport {\n useOverlayContext,\n useOverlayLifecycle,\n useOverlayTiming,\n} from \"@impulse-ui-native/overlay\";\nimport { useComponentsTokens } from \"@impulse-ui-native/theme\";\n\nimport type { ToastRootProps } from \"../types\";\n\nexport function useToastLifecycle(props: ToastRootProps, duration: number) {\n const { id, open = true } = props;\n const { store } = useOverlayContext();\n const tokens = useComponentsTokens().toast;\n const { options, progress } = useOverlayTiming(tokens);\n const lifecycle = useOverlayLifecycle({ ...props, open }, options);\n const close = useEventCallback(() => store.close(id));\n\n useTimer({\n enabled: lifecycle.status === \"open\" && open,\n duration,\n callback: close,\n pauseOnBackground: true,\n });\n\n return useMemo(\n () => ({ ...lifecycle, progress, close }),\n [lifecycle, progress, close],\n );\n}\n"],"mappings":"AAAA,SAAS,eAAe;AAExB,SAAS,kBAAkB,gBAAgB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AAI7B,SAAS,kBAAkB,OAAuB,UAAkB;AACzE,QAAM,EAAE,IAAI,OAAO,KAAK,IAAI;AAC5B,QAAM,EAAE,MAAM,IAAI,kBAAkB;AACpC,QAAM,SAAS,oBAAoB,EAAE;AACrC,QAAM,EAAE,SAAS,SAAS,IAAI,iBAAiB,MAAM;AACrD,QAAM,YAAY,oBAAoB,EAAE,GAAG,OAAO,KAAK,GAAG,OAAO;AACjE,QAAM,QAAQ,iBAAiB,MAAM,MAAM,MAAM,EAAE,CAAC;AAEpD,WAAS;AAAA,IACP,SAAS,UAAU,WAAW,UAAU;AAAA,IACxC;AAAA,IACA,UAAU;AAAA,IACV,mBAAmB;AAAA,EACrB,CAAC;AAED,SAAO;AAAA,IACL,OAAO,EAAE,GAAG,WAAW,UAAU,MAAM;AAAA,IACvC,CAAC,WAAW,UAAU,KAAK;AAAA,EAC7B;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { Toast } from './components/index.mjs';
2
2
  export { ToastActionProps, ToastCloseProps, ToastContentProps, ToastContextValue, ToastDescriptionProps, ToastIconProps, ToastPlacement, ToastProps, ToastRootProps, ToastTitleProps } from './types/toast.types.mjs';
3
- import 'react/jsx-runtime';
4
3
  import 'react';
5
4
  import '@impulse-ui-native/overlay';
6
5
  import '@impulse-ui-native/primitives';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impulse-ui-native/toast",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Compound toast notifications for ImpulseUI Native.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -12,11 +12,11 @@
12
12
  "source": "src/index.ts",
13
13
  "module": "dist/index.js",
14
14
  "types": "dist/index.d.mts",
15
- "react-native": "src/index.ts",
15
+ "react-native": "dist/index.js",
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./dist/index.d.mts",
19
- "react-native": "./src/index.ts",
19
+ "react-native": "./dist/index.js",
20
20
  "import": "./dist/index.js"
21
21
  }
22
22
  },
@@ -27,23 +27,23 @@
27
27
  ],
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@impulse-ui-native/theme": "9.1.1",
31
- "@impulse-ui-native/primitives": "9.1.1",
32
- "@impulse-ui-native/overlay": "9.1.1",
33
- "@impulse-ui-native/core": "9.1.1",
34
- "@impulse-ui-native/icon": "9.1.1"
30
+ "@impulse-ui-native/icon": "10.0.0",
31
+ "@impulse-ui-native/theme": "10.0.0",
32
+ "@impulse-ui-native/primitives": "10.0.0",
33
+ "@impulse-ui-native/overlay": "10.0.0",
34
+ "@impulse-ui-native/core": "10.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/react": "~19.2.14",
37
+ "@types/react": "~19.3.0",
38
38
  "eslint": "^9.38.0",
39
39
  "prettier": "^3.6.2",
40
- "react": "19.2.3",
41
- "react-native": "0.86.2",
42
- "react-native-reanimated": "4.5.1",
43
- "react-native-worklets": "0.10.1",
44
- "react-native-safe-area-context": "~5.7.0",
40
+ "react": "19.3.0",
41
+ "react-native": "0.88.0",
42
+ "react-native-reanimated": "4.7.1",
43
+ "react-native-worklets": "0.13.0",
44
+ "react-native-safe-area-context": "~5.10.1",
45
45
  "typescript": "~6.0.3",
46
- "react-native-svg": "15.15.4",
46
+ "react-native-svg": "15.16.0",
47
47
  "@impulse-ui-native/eslint-config": "1.0.0",
48
48
  "@impulse-ui-native/prettier-config": "1.0.0",
49
49
  "@impulse-ui-native/tsconfig": "1.0.0"