@metamask-previews/design-system-react-native 0.46.0-preview.36f0cd7 → 0.46.0-preview.fa32350
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/components/ButtonBase/ButtonBase.cjs +4 -2
- package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.cjs +14 -9
- package/dist/components/ButtonBase/ButtonBase.constants.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.cts +3 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.mts +3 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.mjs +12 -8
- package/dist/components/ButtonBase/ButtonBase.constants.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.mjs +5 -3
- package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.cjs +2 -1
- package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.cts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.mts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.mjs +2 -1
- package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.cjs +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.cjs.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.mjs +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.mjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.cjs +2 -1
- package/dist/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.constants.cjs +12 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.cjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.d.cts +4 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.d.cts.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.d.mts +4 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.d.mts.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.mjs +8 -0
- package/dist/components/SegmentedControl/SegmentedControl.constants.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.cts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.mts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.mjs +2 -1
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.d.cts +3 -3
- package/dist/components/TextArea/TextArea.d.mts +3 -3
- package/dist/components/TextField/TextField.d.cts +3 -3
- package/dist/components/TextField/TextField.d.mts +3 -3
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +3 -3
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +3 -3
- package/dist/components/Toast/Toaster.cjs +1 -4
- package/dist/components/Toast/Toaster.cjs.map +1 -1
- package/dist/components/Toast/Toaster.d.cts.map +1 -1
- package/dist/components/Toast/Toaster.d.mts.map +1 -1
- package/dist/components/Toast/Toaster.mjs +1 -4
- package/dist/components/Toast/Toaster.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SegmentedControlSize } from "@metamask-previews/design-system-shared";
|
|
2
|
+
export declare const TWCLASSMAP_SEGMENTEDCONTROL_BORDER_RADIUS: Record<SegmentedControlSize, string>;
|
|
3
|
+
export declare const getSegmentedControlBorderRadiusTwClass: (size: SegmentedControlSize) => string;
|
|
4
|
+
//# sourceMappingURL=SegmentedControl.constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.constants.d.cts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gDAAgD;AAE/E,eAAO,MAAM,yCAAyC,EAAE,MAAM,CAC5D,oBAAoB,EACpB,MAAM,CAKP,CAAC;AAEF,eAAO,MAAM,sCAAsC,SAC3C,oBAAoB,KACzB,MAAyD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SegmentedControlSize } from "@metamask-previews/design-system-shared";
|
|
2
|
+
export declare const TWCLASSMAP_SEGMENTEDCONTROL_BORDER_RADIUS: Record<SegmentedControlSize, string>;
|
|
3
|
+
export declare const getSegmentedControlBorderRadiusTwClass: (size: SegmentedControlSize) => string;
|
|
4
|
+
//# sourceMappingURL=SegmentedControl.constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.constants.d.mts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gDAAgD;AAE/E,eAAO,MAAM,yCAAyC,EAAE,MAAM,CAC5D,oBAAoB,EACpB,MAAM,CAKP,CAAC;AAEF,eAAO,MAAM,sCAAsC,SAC3C,oBAAoB,KACzB,MAAyD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SegmentedControlSize } from "@metamask-previews/design-system-shared";
|
|
2
|
+
export const TWCLASSMAP_SEGMENTEDCONTROL_BORDER_RADIUS = {
|
|
3
|
+
[SegmentedControlSize.Sm]: 'rounded-xl',
|
|
4
|
+
[SegmentedControlSize.Md]: 'rounded-2xl',
|
|
5
|
+
[SegmentedControlSize.Lg]: 'rounded-2xl',
|
|
6
|
+
};
|
|
7
|
+
export const getSegmentedControlBorderRadiusTwClass = (size) => TWCLASSMAP_SEGMENTEDCONTROL_BORDER_RADIUS[size];
|
|
8
|
+
//# sourceMappingURL=SegmentedControl.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.constants.mjs","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gDAAgD;AAE/E,MAAM,CAAC,MAAM,yCAAyC,GAGlD;IACF,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,YAAY;IACvC,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,aAAa;IACxC,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,aAAa;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,CACpD,IAA0B,EAClB,EAAE,CAAC,yCAAyC,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { SegmentedControlSize } from '@metamask-previews/design-system-shared';\n\nexport const TWCLASSMAP_SEGMENTEDCONTROL_BORDER_RADIUS: Record<\n SegmentedControlSize,\n string\n> = {\n [SegmentedControlSize.Sm]: 'rounded-xl',\n [SegmentedControlSize.Md]: 'rounded-2xl',\n [SegmentedControlSize.Lg]: 'rounded-2xl',\n};\n\nexport const getSegmentedControlBorderRadiusTwClass = (\n size: SegmentedControlSize,\n): string => TWCLASSMAP_SEGMENTEDCONTROL_BORDER_RADIUS[size];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.d.cts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4B,cAAc;
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.cts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4B,cAAc;AAKjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qCAAiC;AAEtE,eAAO,MAAM,gBAAgB;oFAS1B,qBAAqB;;CAwCvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.d.mts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4B,cAAc;
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.mts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4B,cAAc;AAKjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qCAAiC;AAEtE,eAAO,MAAM,gBAAgB;oFAS1B,qBAAqB;;CAwCvB,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { FilterButtonGroupContext, FilterButtonVariant, SegmentedControlSize, me
|
|
|
8
8
|
import $React, { Children, useMemo } from "react";
|
|
9
9
|
const React = $importDefault($React);
|
|
10
10
|
import { Box } from "../Box/index.mjs";
|
|
11
|
+
import { getSegmentedControlBorderRadiusTwClass } from "./SegmentedControl.constants.mjs";
|
|
11
12
|
export const SegmentedControl = ({ value, onChange, size = SegmentedControlSize.Sm, isFullWidth = false, children, twClassName, style, ...rest }) => {
|
|
12
13
|
const contextValue = useMemo(() => ({
|
|
13
14
|
value,
|
|
@@ -18,7 +19,7 @@ export const SegmentedControl = ({ value, onChange, size = SegmentedControlSize.
|
|
|
18
19
|
}), [value, onChange, size, isFullWidth]);
|
|
19
20
|
const widthClass = isFullWidth ? 'self-stretch' : 'self-start';
|
|
20
21
|
return (<FilterButtonGroupContext.Provider value={contextValue}>
|
|
21
|
-
<Box {...rest} accessibilityRole="tablist" twClassName={mergeTwClassName(`${widthClass} flex-row items-center gap-1
|
|
22
|
+
<Box {...rest} accessibilityRole="tablist" twClassName={mergeTwClassName(mergeTwClassName(`${widthClass} flex-row items-center gap-1 border border-muted p-1`, getSegmentedControlBorderRadiusTwClass(size)), twClassName)} style={style}>
|
|
22
23
|
{Children.map(children, (child, index) => isFullWidth ? (<Box key={index} twClassName="flex-1">
|
|
23
24
|
{child}
|
|
24
25
|
</Box>) : (<React.Fragment key={index}>{child}</React.Fragment>))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.mjs","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EACjB,gDAAgD;AACjD,OAAO,QAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc;;AAEjD,OAAO,EAAE,GAAG,EAAE,yBAAe;
|
|
1
|
+
{"version":3,"file":"SegmentedControl.mjs","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EACjB,gDAAgD;AACjD,OAAO,QAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc;;AAEjD,OAAO,EAAE,GAAG,EAAE,yBAAe;AAE7B,OAAO,EAAE,sCAAsC,EAAE,yCAAqC;AAGtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,IAAI,GAAG,oBAAoB,CAAC,EAAE,EAC9B,WAAW,GAAG,KAAK,EACnB,QAAQ,EACR,WAAW,EACX,KAAK,EACL,GAAG,IAAI,EACe,EAAE,EAAE;IAC1B,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC;QACL,KAAK;QACL,QAAQ;QACR,OAAO,EAAE,mBAAmB,CAAC,SAAS;QACtC,IAAI;QACJ,YAAY,EAAE,WAAW;KAC1B,CAAC,EACF,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CACrC,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;IAE/D,OAAO,CACL,CAAC,wBAAwB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CACrD;MAAA,CAAC,GAAG,CACF,IAAI,IAAI,CAAC,CACT,iBAAiB,CAAC,SAAS,CAC3B,WAAW,CAAC,CAAC,gBAAgB,CAC3B,gBAAgB,CACd,GAAG,UAAU,sDAAsD,EACnE,sCAAsC,CAAC,IAAI,CAAC,CAC7C,EACD,WAAW,CACZ,CAAC,CACF,KAAK,CAAC,CAAC,KAAK,CAAC,CAEb;QAAA,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACvC,WAAW,CAAC,CAAC,CAAC,CACZ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,QAAQ,CACnC;cAAA,CAAC,KAAK,CACR;YAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,CACF,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CACrD,CACF,CACH;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CACrC,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC","sourcesContent":["import {\n FilterButtonGroupContext,\n FilterButtonVariant,\n SegmentedControlSize,\n mergeTwClassName,\n} from '@metamask-previews/design-system-shared';\nimport React, { Children, useMemo } from 'react';\n\nimport { Box } from '../Box';\n\nimport { getSegmentedControlBorderRadiusTwClass } from './SegmentedControl.constants';\nimport type { SegmentedControlProps } from './SegmentedControl.types';\n\nexport const SegmentedControl = ({\n value,\n onChange,\n size = SegmentedControlSize.Sm,\n isFullWidth = false,\n children,\n twClassName,\n style,\n ...rest\n}: SegmentedControlProps) => {\n const contextValue = useMemo(\n () => ({\n value,\n onChange,\n variant: FilterButtonVariant.Secondary,\n size,\n isEqualWidth: isFullWidth,\n }),\n [value, onChange, size, isFullWidth],\n );\n\n const widthClass = isFullWidth ? 'self-stretch' : 'self-start';\n\n return (\n <FilterButtonGroupContext.Provider value={contextValue}>\n <Box\n {...rest}\n accessibilityRole=\"tablist\"\n twClassName={mergeTwClassName(\n mergeTwClassName(\n `${widthClass} flex-row items-center gap-1 border border-muted p-1`,\n getSegmentedControlBorderRadiusTwClass(size),\n ),\n twClassName,\n )}\n style={style}\n >\n {Children.map(children, (child, index) =>\n isFullWidth ? (\n <Box key={index} twClassName=\"flex-1\">\n {child}\n </Box>\n ) : (\n <React.Fragment key={index}>{child}</React.Fragment>\n ),\n )}\n </Box>\n </FilterButtonGroupContext.Provider>\n );\n};\n\nSegmentedControl.displayName = 'SegmentedControl';\n"]}
|
|
@@ -103,9 +103,6 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
103
103
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
104
104
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
105
105
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
106
|
-
textAlign?: "center" | "left" | "right" | undefined;
|
|
107
|
-
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
108
|
-
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
109
106
|
rejectResponderTermination?: boolean | null | undefined;
|
|
110
107
|
onChange?: ((e: import("react-native").TextInputChangeEvent) => void) | undefined;
|
|
111
108
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -133,6 +130,7 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
133
130
|
start: number;
|
|
134
131
|
end?: number | undefined;
|
|
135
132
|
} | undefined;
|
|
133
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
136
134
|
inputAccessoryViewID?: string | undefined;
|
|
137
135
|
inputAccessoryViewButtonLabel?: string | undefined;
|
|
138
136
|
disableKeyboardShortcuts?: boolean | undefined;
|
|
@@ -156,7 +154,9 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
156
154
|
inlineImagePadding?: number | undefined;
|
|
157
155
|
returnKeyLabel?: string | undefined;
|
|
158
156
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
157
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
159
158
|
showSoftInputOnFocus?: boolean | undefined;
|
|
159
|
+
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
160
160
|
} & {
|
|
161
161
|
onChangeText?: ((text: string) => void) | undefined;
|
|
162
162
|
onFocus?: ((e: import("react-native").FocusEvent) => void) | undefined;
|
|
@@ -103,9 +103,6 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
103
103
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
104
104
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
105
105
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
106
|
-
textAlign?: "center" | "left" | "right" | undefined;
|
|
107
|
-
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
108
|
-
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
109
106
|
rejectResponderTermination?: boolean | null | undefined;
|
|
110
107
|
onChange?: ((e: import("react-native").TextInputChangeEvent) => void) | undefined;
|
|
111
108
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -133,6 +130,7 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
133
130
|
start: number;
|
|
134
131
|
end?: number | undefined;
|
|
135
132
|
} | undefined;
|
|
133
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
136
134
|
inputAccessoryViewID?: string | undefined;
|
|
137
135
|
inputAccessoryViewButtonLabel?: string | undefined;
|
|
138
136
|
disableKeyboardShortcuts?: boolean | undefined;
|
|
@@ -156,7 +154,9 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
156
154
|
inlineImagePadding?: number | undefined;
|
|
157
155
|
returnKeyLabel?: string | undefined;
|
|
158
156
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
157
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
159
158
|
showSoftInputOnFocus?: boolean | undefined;
|
|
159
|
+
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
160
160
|
} & {
|
|
161
161
|
onChangeText?: ((text: string) => void) | undefined;
|
|
162
162
|
onFocus?: ((e: import("react-native").FocusEvent) => void) | undefined;
|
|
@@ -109,9 +109,6 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
109
109
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
110
110
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
111
111
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
112
|
-
textAlign?: "center" | "left" | "right" | undefined;
|
|
113
|
-
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
114
|
-
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
115
112
|
rejectResponderTermination?: boolean | null | undefined;
|
|
116
113
|
onChange?: ((e: import("react-native").TextInputChangeEvent) => void) | undefined;
|
|
117
114
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -140,6 +137,7 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
140
137
|
start: number;
|
|
141
138
|
end?: number | undefined;
|
|
142
139
|
} | undefined;
|
|
140
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
143
141
|
inputAccessoryViewID?: string | undefined;
|
|
144
142
|
inputAccessoryViewButtonLabel?: string | undefined;
|
|
145
143
|
disableKeyboardShortcuts?: boolean | undefined;
|
|
@@ -163,7 +161,9 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
163
161
|
inlineImagePadding?: number | undefined;
|
|
164
162
|
returnKeyLabel?: string | undefined;
|
|
165
163
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
164
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
166
165
|
showSoftInputOnFocus?: boolean | undefined;
|
|
166
|
+
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
167
167
|
} | undefined;
|
|
168
168
|
inputRef?: import("react").Ref<import("react-native").TextInput> | undefined;
|
|
169
169
|
twClassName?: string | undefined;
|
|
@@ -109,9 +109,6 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
109
109
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
110
110
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
111
111
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
112
|
-
textAlign?: "center" | "left" | "right" | undefined;
|
|
113
|
-
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
114
|
-
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
115
112
|
rejectResponderTermination?: boolean | null | undefined;
|
|
116
113
|
onChange?: ((e: import("react-native").TextInputChangeEvent) => void) | undefined;
|
|
117
114
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -140,6 +137,7 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
140
137
|
start: number;
|
|
141
138
|
end?: number | undefined;
|
|
142
139
|
} | undefined;
|
|
140
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
143
141
|
inputAccessoryViewID?: string | undefined;
|
|
144
142
|
inputAccessoryViewButtonLabel?: string | undefined;
|
|
145
143
|
disableKeyboardShortcuts?: boolean | undefined;
|
|
@@ -163,7 +161,9 @@ export declare const TextField: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
163
161
|
inlineImagePadding?: number | undefined;
|
|
164
162
|
returnKeyLabel?: string | undefined;
|
|
165
163
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
164
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
166
165
|
showSoftInputOnFocus?: boolean | undefined;
|
|
166
|
+
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
167
167
|
} | undefined;
|
|
168
168
|
inputRef?: import("react").Ref<import("react-native").TextInput> | undefined;
|
|
169
169
|
twClassName?: string | undefined;
|
|
@@ -110,9 +110,6 @@ export declare const TextFieldSearch: React.ForwardRefExoticComponent<Omit<impor
|
|
|
110
110
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
111
111
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
112
112
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
113
|
-
textAlign?: "center" | "left" | "right" | undefined;
|
|
114
|
-
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
115
|
-
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
116
113
|
rejectResponderTermination?: boolean | null | undefined;
|
|
117
114
|
onChange?: ((e: import("react-native").TextInputChangeEvent) => void) | undefined;
|
|
118
115
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -141,6 +138,7 @@ export declare const TextFieldSearch: React.ForwardRefExoticComponent<Omit<impor
|
|
|
141
138
|
start: number;
|
|
142
139
|
end?: number | undefined;
|
|
143
140
|
} | undefined;
|
|
141
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
144
142
|
inputAccessoryViewID?: string | undefined;
|
|
145
143
|
inputAccessoryViewButtonLabel?: string | undefined;
|
|
146
144
|
disableKeyboardShortcuts?: boolean | undefined;
|
|
@@ -164,7 +162,9 @@ export declare const TextFieldSearch: React.ForwardRefExoticComponent<Omit<impor
|
|
|
164
162
|
inlineImagePadding?: number | undefined;
|
|
165
163
|
returnKeyLabel?: string | undefined;
|
|
166
164
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
165
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
167
166
|
showSoftInputOnFocus?: boolean | undefined;
|
|
167
|
+
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
168
168
|
} | undefined;
|
|
169
169
|
inputRef?: React.Ref<import("react-native").TextInput> | undefined;
|
|
170
170
|
twClassName?: string | undefined;
|
|
@@ -110,9 +110,6 @@ export declare const TextFieldSearch: React.ForwardRefExoticComponent<Omit<impor
|
|
|
110
110
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
111
111
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
112
112
|
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
113
|
-
textAlign?: "center" | "left" | "right" | undefined;
|
|
114
|
-
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
115
|
-
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
116
113
|
rejectResponderTermination?: boolean | null | undefined;
|
|
117
114
|
onChange?: ((e: import("react-native").TextInputChangeEvent) => void) | undefined;
|
|
118
115
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -141,6 +138,7 @@ export declare const TextFieldSearch: React.ForwardRefExoticComponent<Omit<impor
|
|
|
141
138
|
start: number;
|
|
142
139
|
end?: number | undefined;
|
|
143
140
|
} | undefined;
|
|
141
|
+
textAlign?: "center" | "left" | "right" | undefined;
|
|
144
142
|
inputAccessoryViewID?: string | undefined;
|
|
145
143
|
inputAccessoryViewButtonLabel?: string | undefined;
|
|
146
144
|
disableKeyboardShortcuts?: boolean | undefined;
|
|
@@ -164,7 +162,9 @@ export declare const TextFieldSearch: React.ForwardRefExoticComponent<Omit<impor
|
|
|
164
162
|
inlineImagePadding?: number | undefined;
|
|
165
163
|
returnKeyLabel?: string | undefined;
|
|
166
164
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
165
|
+
textAlignVertical?: "auto" | "center" | "bottom" | "top" | undefined;
|
|
167
166
|
showSoftInputOnFocus?: boolean | undefined;
|
|
167
|
+
verticalAlign?: "auto" | "bottom" | "top" | "middle" | undefined;
|
|
168
168
|
} | undefined;
|
|
169
169
|
inputRef?: React.Ref<import("react-native").TextInput> | undefined;
|
|
170
170
|
twClassName?: string | undefined;
|
|
@@ -73,10 +73,7 @@ const ToasterComponent = (0, react_1.forwardRef)(({ twClassName, ...props }, ref
|
|
|
73
73
|
const animatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
74
74
|
transform: [{ translateY: translateYProgress.value + topOffset }],
|
|
75
75
|
}));
|
|
76
|
-
const baseStyle = (0, react_1.useMemo)(() => [
|
|
77
|
-
tw.style('absolute left-4 right-4 top-0'),
|
|
78
|
-
animatedStyle,
|
|
79
|
-
], [tw, animatedStyle]);
|
|
76
|
+
const baseStyle = (0, react_1.useMemo)(() => [tw.style('absolute left-4 right-4 top-0'), animatedStyle], [tw, animatedStyle]);
|
|
80
77
|
const innerRef = (0, react_1.useRef)(null);
|
|
81
78
|
const clearScheduledAutoDismiss = () => {
|
|
82
79
|
if (autoDismissTimeoutRef.current !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.cjs","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B,8FAA4E;AAC5E,+CAOe;AAEf,+CAA0C;AAE1C,+EAAwE;AACxE,mFAKiC;AACjC,mFAAmE;AACnE,iEAAqD;AAErD,yBAAyB;AACzB,uCAAgC;AAChC,2DAS2B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ACrC,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CACzC,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CAAC,CAAC,CAAC,CACF,CAAC,aAAK,CACJ,IAAI,cAAc,CAAC,CACnB,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CACH;QAAA,EAAE,iCAAQ,CAAC,IAAI,CACjB;MAAA,EAAE,8CAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,SAAS,CAAC;AAM5B,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAE3B,QAAA,KAAK,GAAG,CAAC,CAAC,OAAqB,EAAE,EAAE;IAC9C,mBAAmB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,CAAkB,CAAC;AAEpB,aAAK,CAAC,OAAO,GAAG,GAAG,EAAE;IACnB,mBAAmB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { RefObject } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n cancelAnimation,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { scheduleOnRN } from 'react-native-worklets';\n\n// Internal dependencies.\nimport { Toast } from './Toast';\nimport {\n TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n TOAST_DISMISS_VELOCITY_THRESHOLD,\n TOAST_SPRING_CONFIG,\n TOAST_SWIPE_ACTIVE_OFFSET_Y,\n TOAST_SWIPE_FAIL_OFFSET_X,\n TOAST_TOP_PADDING,\n TOAST_VISIBILITY_DURATION,\n} from './Toast.constants';\nimport type {\n ToastOptions,\n ToastProps,\n ToasterProps,\n ToasterRef,\n} from './Toast.types';\n\nconst screenHeight = Dimensions.get('window').height;\n\nlet registeredRef: RefObject<ToasterRef | null> | null = null;\n\nconst assertRegisteredRef = (method: 'dismiss' | 'toast'): ToasterRef => {\n if (!registeredRef?.current) {\n const invocation = method === 'toast' ? 'toast()' : `toast.${method}()`;\n throw new Error(\n `${invocation} called before <Toaster /> mounted. Render <Toaster /> once at the root of your app.`,\n );\n }\n return registeredRef.current;\n};\n\nconst getToastProps = ({\n hasNoTimeout: _hasNoTimeout,\n onClose: _onClose,\n topOffset: _topOffset,\n twClassName: _twClassName,\n showCloseButton: _showCloseButton,\n ...toastProps\n}: ToastOptions): Omit<ToastProps, 'twClassName'> => toastProps;\n\nconst getHiddenTranslateY = (height: number, offset: number) =>\n -(height + offset);\n\nconst ToasterComponent = forwardRef<ToasterRef, ToasterProps>(\n ({ twClassName, ...props }, ref) => {\n const tw = useTailwind();\n const [toastOptions, setToastOptions] = useState<ToastOptions | undefined>(\n undefined,\n );\n const replacementTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const autoDismissTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const animationStartedRef = useRef(false);\n const visibleAtRef = useRef<number | null>(null);\n const hasNoTimeoutRef = useRef(false);\n // Invalidates queued spring-back resumes after replace/dismiss. A completed\n // spring cannot be cancelled, so scheduleOnRN(resume) can still run later.\n const toastGenerationRef = useRef(0);\n const { top: topInset } = useSafeAreaInsets();\n const toastHeight = useSharedValue(screenHeight);\n const hiddenTranslateY = useSharedValue(-screenHeight);\n const visibleTranslateY = useSharedValue(0);\n const gestureStartY = useSharedValue(0);\n const translateYProgress = useSharedValue(-screenHeight);\n const isDismissing = useSharedValue(false);\n // True after onStart until onEnd/onFinalize recovers. Used so a failed pan\n // (e.g. failOffsetX after activation) still springs back and resumes dismiss.\n const isSwipeActive = useSharedValue(false);\n const toastGeneration = useSharedValue(0);\n const topOffset = toastOptions?.topOffset ?? 0;\n hasNoTimeoutRef.current = Boolean(toastOptions?.hasNoTimeout);\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: translateYProgress.value + topOffset }],\n }));\n const baseStyle = useMemo(\n () =>\n [\n tw.style('absolute left-4 right-4 top-0'),\n animatedStyle,\n ] as StyleProp<ViewStyle>,\n [tw, animatedStyle],\n );\n const innerRef = useRef<ToasterRef | null>(null);\n\n const clearScheduledAutoDismiss = () => {\n if (autoDismissTimeoutRef.current !== null) {\n clearTimeout(autoDismissTimeoutRef.current);\n autoDismissTimeoutRef.current = null;\n }\n };\n\n const bumpToastGeneration = () => {\n toastGenerationRef.current += 1;\n toastGeneration.value = toastGenerationRef.current;\n };\n\n const resetState = () => {\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n clearScheduledAutoDismiss();\n setToastOptions(undefined);\n };\n\n const startDismissAnimation = () => {\n bumpToastGeneration();\n clearScheduledAutoDismiss();\n isDismissing.value = true;\n visibleAtRef.current = null;\n translateYProgress.value = withSpring(\n hiddenTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(resetState);\n }\n },\n );\n };\n\n const scheduleAutoDismiss = (delayMs: number) => {\n clearScheduledAutoDismiss();\n autoDismissTimeoutRef.current = setTimeout(() => {\n autoDismissTimeoutRef.current = null;\n startDismissAnimation();\n }, delayMs);\n };\n\n const beginAutoDismiss = () => {\n visibleAtRef.current = Date.now();\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION);\n };\n\n const resumeAutoDismissAfterSwipe = () => {\n if (hasNoTimeoutRef.current || isDismissing.value) {\n return;\n }\n\n // Entrance was interrupted before auto-dismiss started — start a full timer.\n if (visibleAtRef.current === null) {\n beginAutoDismiss();\n return;\n }\n\n const elapsed = Date.now() - visibleAtRef.current;\n if (elapsed >= TOAST_VISIBILITY_DURATION) {\n startDismissAnimation();\n return;\n }\n\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION - elapsed);\n };\n\n const showToast = (options: ToastOptions) => {\n bumpToastGeneration();\n let timeoutDuration = 0;\n const normalizedOptions = {\n hasNoTimeout: false,\n ...options,\n };\n if (toastOptions) {\n // Always clear any pending auto-dismiss from the previous toast, including\n // when the replacement is persistent (hasNoTimeout). Otherwise the old\n // timer can fire and dismiss the new toast.\n clearScheduledAutoDismiss();\n cancelAnimation(translateYProgress);\n timeoutDuration = 100;\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n setToastOptions(undefined);\n }\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n }\n replacementTimerRef.current = setTimeout(() => {\n replacementTimerRef.current = null;\n setToastOptions(normalizedOptions);\n }, timeoutDuration);\n };\n\n const closeToast = () => {\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n replacementTimerRef.current = null;\n }\n startDismissAnimation();\n };\n\n const closeToastRef = useRef(closeToast);\n const resumeAutoDismissAfterSwipeRef = useRef(resumeAutoDismissAfterSwipe);\n const clearScheduledAutoDismissRef = useRef(clearScheduledAutoDismiss);\n closeToastRef.current = closeToast;\n resumeAutoDismissAfterSwipeRef.current = resumeAutoDismissAfterSwipe;\n clearScheduledAutoDismissRef.current = clearScheduledAutoDismiss;\n\n const dismissToastFromSwipe = () => {\n closeToastRef.current();\n };\n\n const resumeAutoDismissFromSwipe = (generation: number) => {\n // Ignore resumes from a toast that was replaced or dismissed after the\n // spring-back started (completed springs cannot be cancelled).\n if (generation !== toastGenerationRef.current) {\n return;\n }\n resumeAutoDismissAfterSwipeRef.current();\n };\n\n const clearScheduledAutoDismissFromSwipe = () => {\n clearScheduledAutoDismissRef.current();\n };\n\n const swipeGesture = useMemo(() => {\n // These gesture callbacks need explicit 'worklet' directives because this\n // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the\n // gesture chain as a namespaced call (react_native_gesture_handler_1.Gesture).\n // The consumer's Reanimated/Worklets Babel plugin does run over dist, but its\n // gesture auto-detection doesn't recognize that compiled namespaced form.\n const springBackAfterSwipe = () => {\n 'worklet';\n\n const generationAtSpringStart = toastGeneration.value;\n translateYProgress.value = withSpring(\n visibleTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n // A new pan cancels this spring via cancelAnimation; only resume\n // auto-dismiss when the spring-back completed naturally.\n if (finished) {\n scheduleOnRN(resumeAutoDismissFromSwipe, generationAtSpringStart);\n }\n },\n );\n };\n\n return Gesture.Pan()\n .activeOffsetY(TOAST_SWIPE_ACTIVE_OFFSET_Y)\n .failOffsetX([-TOAST_SWIPE_FAIL_OFFSET_X, TOAST_SWIPE_FAIL_OFFSET_X])\n .onStart(() => {\n 'worklet';\n\n // Don't interrupt an in-progress dismiss animation.\n if (isDismissing.value) {\n return;\n }\n isSwipeActive.value = true;\n scheduleOnRN(clearScheduledAutoDismissFromSwipe);\n cancelAnimation(translateYProgress);\n gestureStartY.value = translateYProgress.value;\n })\n .onUpdate((event) => {\n 'worklet';\n\n if (isDismissing.value || !isSwipeActive.value) {\n return;\n }\n const nextTranslateY = gestureStartY.value + event.translationY;\n // Toast sits at the top; only allow dragging upward (more negative).\n translateYProgress.value = Math.min(\n nextTranslateY,\n visibleTranslateY.value,\n );\n })\n .onEnd((event) => {\n 'worklet';\n\n if (!isSwipeActive.value) {\n return;\n }\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n const { translationY, velocityY } = event;\n const dismissDistance = Math.max(\n toastHeight.value * TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n );\n const hasReachedDismissOffset = translationY <= -dismissDistance;\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) > TOAST_DISMISS_VELOCITY_THRESHOLD;\n const isQuickDismissing = velocityY < 0;\n\n const shouldDismiss =\n hasReachedDismissOffset ||\n (hasReachedSwipeThreshold && isQuickDismissing);\n\n if (shouldDismiss) {\n scheduleOnRN(dismissToastFromSwipe);\n return;\n }\n\n springBackAfterSwipe();\n })\n .onFinalize(() => {\n 'worklet';\n\n // onEnd is skipped when the pan fails/cancels after activation\n // (e.g. horizontal travel past failOffsetX). Recover position and\n // auto-dismiss so the toast is not left stuck mid-offset.\n if (!isSwipeActive.value) {\n return;\n }\n // Clear before the dismiss check — same order as onEnd — so a pan\n // cancelled mid-dismiss cannot leave isSwipeActive stuck true for a\n // later toast (resetState alone is not enough if finalize races it).\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n springBackAfterSwipe();\n });\n // Shared values and swipe JS wrappers are stable for the component lifetime.\n }, []);\n\n innerRef.current = {\n closeToast,\n showToast,\n };\n\n useImperativeHandle(ref, () => innerRef.current as ToasterRef);\n\n useLayoutEffect(() => {\n registeredRef = innerRef;\n return () => {\n if (registeredRef === innerRef) {\n registeredRef = null;\n }\n };\n }, []);\n\n if (!toastOptions) {\n return null;\n }\n\n const {\n onClose: toastOnClose,\n showCloseButton = true,\n twClassName: toastTwClassName,\n } = toastOptions;\n const toastProps = getToastProps(toastOptions);\n const { actionButtonLabel, actionButtonOnPress, ...restToastProps } =\n toastProps;\n const toastTwClassNames = [twClassName, toastTwClassName]\n .filter(Boolean)\n .join(' ');\n const handleClose = showCloseButton\n ? () => {\n closeToast();\n toastOnClose?.();\n }\n : undefined;\n\n const onAnimatedViewLayout = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n const nextHiddenTranslateY = getHiddenTranslateY(height, topOffset);\n const nextVisibleTranslateY = topInset + TOAST_TOP_PADDING;\n\n hiddenTranslateY.value = nextHiddenTranslateY;\n visibleTranslateY.value = nextVisibleTranslateY;\n toastHeight.value = height;\n\n if (animationStartedRef.current) {\n return;\n }\n\n animationStartedRef.current = true;\n translateYProgress.value = nextHiddenTranslateY;\n\n if (toastOptions.hasNoTimeout) {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n );\n } else {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(beginAutoDismiss);\n }\n },\n );\n }\n };\n\n return (\n <GestureDetector gesture={swipeGesture}>\n <Animated.View\n onLayout={onAnimatedViewLayout}\n style={baseStyle}\n {...props}\n >\n {actionButtonLabel && actionButtonOnPress ? (\n <Toast\n {...toastProps}\n actionButtonLabel={actionButtonLabel}\n actionButtonOnPress={actionButtonOnPress}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n ) : (\n <Toast\n {...restToastProps}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n )}\n </Animated.View>\n </GestureDetector>\n );\n },\n);\n\nToasterComponent.displayName = 'Toaster';\n\ntype ToastFunction = ((options: ToastOptions) => void) & {\n dismiss: () => void;\n};\n\nexport const Toaster = ToasterComponent;\n\nexport const toast = ((options: ToastOptions) => {\n assertRegisteredRef('toast').showToast(options);\n}) as ToastFunction;\n\ntoast.dismiss = () => {\n assertRegisteredRef('dismiss').closeToast();\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Toaster.cjs","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA4B;AAC5B,8FAA4E;AAC5E,+CAOe;AAEf,+CAA0C;AAE1C,+EAAwE;AACxE,mFAKiC;AACjC,mFAAmE;AACnE,iEAAqD;AAErD,yBAAyB;AACzB,uCAAgC;AAChC,2DAS2B;AAQ3B,MAAM,YAAY,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;AAErD,IAAI,aAA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C,iBAAiB,CAAC,EAC/B,CACH,CAAC,CAAC,CAAC,CACF,CAAC,aAAK,CACJ,IAAI,cAAc,CAAC,CACnB,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CACH;QAAA,EAAE,iCAAQ,CAAC,IAAI,CACjB;MAAA,EAAE,8CAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,SAAS,CAAC;AAM5B,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAE3B,QAAA,KAAK,GAAG,CAAC,CAAC,OAAqB,EAAE,EAAE;IAC9C,mBAAmB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,CAAkB,CAAC;AAEpB,aAAK,CAAC,OAAO,GAAG,GAAG,EAAE;IACnB,mBAAmB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { RefObject } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n cancelAnimation,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { scheduleOnRN } from 'react-native-worklets';\n\n// Internal dependencies.\nimport { Toast } from './Toast';\nimport {\n TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n TOAST_DISMISS_VELOCITY_THRESHOLD,\n TOAST_SPRING_CONFIG,\n TOAST_SWIPE_ACTIVE_OFFSET_Y,\n TOAST_SWIPE_FAIL_OFFSET_X,\n TOAST_TOP_PADDING,\n TOAST_VISIBILITY_DURATION,\n} from './Toast.constants';\nimport type {\n ToastOptions,\n ToastProps,\n ToasterProps,\n ToasterRef,\n} from './Toast.types';\n\nconst screenHeight = Dimensions.get('window').height;\n\nlet registeredRef: RefObject<ToasterRef | null> | null = null;\n\nconst assertRegisteredRef = (method: 'dismiss' | 'toast'): ToasterRef => {\n if (!registeredRef?.current) {\n const invocation = method === 'toast' ? 'toast()' : `toast.${method}()`;\n throw new Error(\n `${invocation} called before <Toaster /> mounted. Render <Toaster /> once at the root of your app.`,\n );\n }\n return registeredRef.current;\n};\n\nconst getToastProps = ({\n hasNoTimeout: _hasNoTimeout,\n onClose: _onClose,\n topOffset: _topOffset,\n twClassName: _twClassName,\n showCloseButton: _showCloseButton,\n ...toastProps\n}: ToastOptions): Omit<ToastProps, 'twClassName'> => toastProps;\n\nconst getHiddenTranslateY = (height: number, offset: number) =>\n -(height + offset);\n\nconst ToasterComponent = forwardRef<ToasterRef, ToasterProps>(\n ({ twClassName, ...props }, ref) => {\n const tw = useTailwind();\n const [toastOptions, setToastOptions] = useState<ToastOptions | undefined>(\n undefined,\n );\n const replacementTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const autoDismissTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const animationStartedRef = useRef(false);\n const visibleAtRef = useRef<number | null>(null);\n const hasNoTimeoutRef = useRef(false);\n // Invalidates queued spring-back resumes after replace/dismiss. A completed\n // spring cannot be cancelled, so scheduleOnRN(resume) can still run later.\n const toastGenerationRef = useRef(0);\n const { top: topInset } = useSafeAreaInsets();\n const toastHeight = useSharedValue(screenHeight);\n const hiddenTranslateY = useSharedValue(-screenHeight);\n const visibleTranslateY = useSharedValue(0);\n const gestureStartY = useSharedValue(0);\n const translateYProgress = useSharedValue(-screenHeight);\n const isDismissing = useSharedValue(false);\n // True after onStart until onEnd/onFinalize recovers. Used so a failed pan\n // (e.g. failOffsetX after activation) still springs back and resumes dismiss.\n const isSwipeActive = useSharedValue(false);\n const toastGeneration = useSharedValue(0);\n const topOffset = toastOptions?.topOffset ?? 0;\n hasNoTimeoutRef.current = Boolean(toastOptions?.hasNoTimeout);\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: translateYProgress.value + topOffset }],\n }));\n const baseStyle = useMemo(\n () => [tw.style('absolute left-4 right-4 top-0'), animatedStyle],\n [tw, animatedStyle],\n );\n const innerRef = useRef<ToasterRef | null>(null);\n\n const clearScheduledAutoDismiss = () => {\n if (autoDismissTimeoutRef.current !== null) {\n clearTimeout(autoDismissTimeoutRef.current);\n autoDismissTimeoutRef.current = null;\n }\n };\n\n const bumpToastGeneration = () => {\n toastGenerationRef.current += 1;\n toastGeneration.value = toastGenerationRef.current;\n };\n\n const resetState = () => {\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n clearScheduledAutoDismiss();\n setToastOptions(undefined);\n };\n\n const startDismissAnimation = () => {\n bumpToastGeneration();\n clearScheduledAutoDismiss();\n isDismissing.value = true;\n visibleAtRef.current = null;\n translateYProgress.value = withSpring(\n hiddenTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(resetState);\n }\n },\n );\n };\n\n const scheduleAutoDismiss = (delayMs: number) => {\n clearScheduledAutoDismiss();\n autoDismissTimeoutRef.current = setTimeout(() => {\n autoDismissTimeoutRef.current = null;\n startDismissAnimation();\n }, delayMs);\n };\n\n const beginAutoDismiss = () => {\n visibleAtRef.current = Date.now();\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION);\n };\n\n const resumeAutoDismissAfterSwipe = () => {\n if (hasNoTimeoutRef.current || isDismissing.value) {\n return;\n }\n\n // Entrance was interrupted before auto-dismiss started — start a full timer.\n if (visibleAtRef.current === null) {\n beginAutoDismiss();\n return;\n }\n\n const elapsed = Date.now() - visibleAtRef.current;\n if (elapsed >= TOAST_VISIBILITY_DURATION) {\n startDismissAnimation();\n return;\n }\n\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION - elapsed);\n };\n\n const showToast = (options: ToastOptions) => {\n bumpToastGeneration();\n let timeoutDuration = 0;\n const normalizedOptions = {\n hasNoTimeout: false,\n ...options,\n };\n if (toastOptions) {\n // Always clear any pending auto-dismiss from the previous toast, including\n // when the replacement is persistent (hasNoTimeout). Otherwise the old\n // timer can fire and dismiss the new toast.\n clearScheduledAutoDismiss();\n cancelAnimation(translateYProgress);\n timeoutDuration = 100;\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n setToastOptions(undefined);\n }\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n }\n replacementTimerRef.current = setTimeout(() => {\n replacementTimerRef.current = null;\n setToastOptions(normalizedOptions);\n }, timeoutDuration);\n };\n\n const closeToast = () => {\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n replacementTimerRef.current = null;\n }\n startDismissAnimation();\n };\n\n const closeToastRef = useRef(closeToast);\n const resumeAutoDismissAfterSwipeRef = useRef(resumeAutoDismissAfterSwipe);\n const clearScheduledAutoDismissRef = useRef(clearScheduledAutoDismiss);\n closeToastRef.current = closeToast;\n resumeAutoDismissAfterSwipeRef.current = resumeAutoDismissAfterSwipe;\n clearScheduledAutoDismissRef.current = clearScheduledAutoDismiss;\n\n const dismissToastFromSwipe = () => {\n closeToastRef.current();\n };\n\n const resumeAutoDismissFromSwipe = (generation: number) => {\n // Ignore resumes from a toast that was replaced or dismissed after the\n // spring-back started (completed springs cannot be cancelled).\n if (generation !== toastGenerationRef.current) {\n return;\n }\n resumeAutoDismissAfterSwipeRef.current();\n };\n\n const clearScheduledAutoDismissFromSwipe = () => {\n clearScheduledAutoDismissRef.current();\n };\n\n const swipeGesture = useMemo(() => {\n // These gesture callbacks need explicit 'worklet' directives because this\n // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the\n // gesture chain as a namespaced call (react_native_gesture_handler_1.Gesture).\n // The consumer's Reanimated/Worklets Babel plugin does run over dist, but its\n // gesture auto-detection doesn't recognize that compiled namespaced form.\n const springBackAfterSwipe = () => {\n 'worklet';\n\n const generationAtSpringStart = toastGeneration.value;\n translateYProgress.value = withSpring(\n visibleTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n // A new pan cancels this spring via cancelAnimation; only resume\n // auto-dismiss when the spring-back completed naturally.\n if (finished) {\n scheduleOnRN(resumeAutoDismissFromSwipe, generationAtSpringStart);\n }\n },\n );\n };\n\n return Gesture.Pan()\n .activeOffsetY(TOAST_SWIPE_ACTIVE_OFFSET_Y)\n .failOffsetX([-TOAST_SWIPE_FAIL_OFFSET_X, TOAST_SWIPE_FAIL_OFFSET_X])\n .onStart(() => {\n 'worklet';\n\n // Don't interrupt an in-progress dismiss animation.\n if (isDismissing.value) {\n return;\n }\n isSwipeActive.value = true;\n scheduleOnRN(clearScheduledAutoDismissFromSwipe);\n cancelAnimation(translateYProgress);\n gestureStartY.value = translateYProgress.value;\n })\n .onUpdate((event) => {\n 'worklet';\n\n if (isDismissing.value || !isSwipeActive.value) {\n return;\n }\n const nextTranslateY = gestureStartY.value + event.translationY;\n // Toast sits at the top; only allow dragging upward (more negative).\n translateYProgress.value = Math.min(\n nextTranslateY,\n visibleTranslateY.value,\n );\n })\n .onEnd((event) => {\n 'worklet';\n\n if (!isSwipeActive.value) {\n return;\n }\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n const { translationY, velocityY } = event;\n const dismissDistance = Math.max(\n toastHeight.value * TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n );\n const hasReachedDismissOffset = translationY <= -dismissDistance;\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) > TOAST_DISMISS_VELOCITY_THRESHOLD;\n const isQuickDismissing = velocityY < 0;\n\n const shouldDismiss =\n hasReachedDismissOffset ||\n (hasReachedSwipeThreshold && isQuickDismissing);\n\n if (shouldDismiss) {\n scheduleOnRN(dismissToastFromSwipe);\n return;\n }\n\n springBackAfterSwipe();\n })\n .onFinalize(() => {\n 'worklet';\n\n // onEnd is skipped when the pan fails/cancels after activation\n // (e.g. horizontal travel past failOffsetX). Recover position and\n // auto-dismiss so the toast is not left stuck mid-offset.\n if (!isSwipeActive.value) {\n return;\n }\n // Clear before the dismiss check — same order as onEnd — so a pan\n // cancelled mid-dismiss cannot leave isSwipeActive stuck true for a\n // later toast (resetState alone is not enough if finalize races it).\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n springBackAfterSwipe();\n });\n // Shared values and swipe JS wrappers are stable for the component lifetime.\n }, []);\n\n innerRef.current = {\n closeToast,\n showToast,\n };\n\n useImperativeHandle(ref, () => innerRef.current as ToasterRef);\n\n useLayoutEffect(() => {\n registeredRef = innerRef;\n return () => {\n if (registeredRef === innerRef) {\n registeredRef = null;\n }\n };\n }, []);\n\n if (!toastOptions) {\n return null;\n }\n\n const {\n onClose: toastOnClose,\n showCloseButton = true,\n twClassName: toastTwClassName,\n } = toastOptions;\n const toastProps = getToastProps(toastOptions);\n const { actionButtonLabel, actionButtonOnPress, ...restToastProps } =\n toastProps;\n const toastTwClassNames = [twClassName, toastTwClassName]\n .filter(Boolean)\n .join(' ');\n const handleClose = showCloseButton\n ? () => {\n closeToast();\n toastOnClose?.();\n }\n : undefined;\n\n const onAnimatedViewLayout = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n const nextHiddenTranslateY = getHiddenTranslateY(height, topOffset);\n const nextVisibleTranslateY = topInset + TOAST_TOP_PADDING;\n\n hiddenTranslateY.value = nextHiddenTranslateY;\n visibleTranslateY.value = nextVisibleTranslateY;\n toastHeight.value = height;\n\n if (animationStartedRef.current) {\n return;\n }\n\n animationStartedRef.current = true;\n translateYProgress.value = nextHiddenTranslateY;\n\n if (toastOptions.hasNoTimeout) {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n );\n } else {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(beginAutoDismiss);\n }\n },\n );\n }\n };\n\n return (\n <GestureDetector gesture={swipeGesture}>\n <Animated.View\n onLayout={onAnimatedViewLayout}\n style={baseStyle}\n {...props}\n >\n {actionButtonLabel && actionButtonOnPress ? (\n <Toast\n {...toastProps}\n actionButtonLabel={actionButtonLabel}\n actionButtonOnPress={actionButtonOnPress}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n ) : (\n <Toast\n {...restToastProps}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n )}\n </Animated.View>\n </GestureDetector>\n );\n },\n);\n\nToasterComponent.displayName = 'Toaster';\n\ntype ToastFunction = ((options: ToastOptions) => void) & {\n dismiss: () => void;\n};\n\nexport const Toaster = ToasterComponent;\n\nexport const toast = ((options: ToastOptions) => {\n assertRegisteredRef('toast').showToast(options);\n}) as ToastFunction;\n\ntoast.dismiss = () => {\n assertRegisteredRef('dismiss').closeToast();\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,cAAc;AA0Bf,OAAO,KAAK,EACV,YAAY,EAGZ,UAAU,EACX,0BAAsB;
|
|
1
|
+
{"version":3,"file":"Toaster.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,cAAc;AA0Bf,OAAO,KAAK,EACV,YAAY,EAGZ,UAAU,EACX,0BAAsB;AAsZvB,KAAK,aAAa,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG;IACvD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,OAAO;;sFAAmB,CAAC;AAExC,eAAO,MAAM,KAAK,eAEC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,cAAc;AA0Bf,OAAO,KAAK,EACV,YAAY,EAGZ,UAAU,EACX,0BAAsB;
|
|
1
|
+
{"version":3,"file":"Toaster.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,cAAc;AA0Bf,OAAO,KAAK,EACV,YAAY,EAGZ,UAAU,EACX,0BAAsB;AAsZvB,KAAK,aAAa,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG;IACvD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,OAAO;;sFAAmB,CAAC;AAExC,eAAO,MAAM,KAAK,eAEC,CAAC"}
|
|
@@ -54,10 +54,7 @@ const ToasterComponent = forwardRef(({ twClassName, ...props }, ref) => {
|
|
|
54
54
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
55
55
|
transform: [{ translateY: translateYProgress.value + topOffset }],
|
|
56
56
|
}));
|
|
57
|
-
const baseStyle = useMemo(() => [
|
|
58
|
-
tw.style('absolute left-4 right-4 top-0'),
|
|
59
|
-
animatedStyle,
|
|
60
|
-
], [tw, animatedStyle]);
|
|
57
|
+
const baseStyle = useMemo(() => [tw.style('absolute left-4 right-4 top-0'), animatedStyle], [tw, animatedStyle]);
|
|
61
58
|
const innerRef = useRef(null);
|
|
62
59
|
const clearScheduledAutoDismiss = () => {
|
|
63
60
|
if (autoDismissTimeoutRef.current !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.mjs","sourceRoot":"","sources":["../../../src/components/Toast/Toaster.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EA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AAC,OAAO,CAAC,CAAC,YAAY,CAAC,CACrC;QAAA,CAAC,QAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAC/B,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,IAAI,KAAK,CAAC,CAEV;UAAA,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAC1C,CAAC,KAAK,CACJ,IAAI,UAAU,CAAC,CACf,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CACzC,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CAAC,CAAC,CAAC,CACF,CAAC,KAAK,CACJ,IAAI,cAAc,CAAC,CACnB,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CACH;QAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;MAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,SAAS,CAAC;AAMzC,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,OAAqB,EAAE,EAAE;IAC9C,mBAAmB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,CAAkB,CAAC;AAEpB,KAAK,CAAC,OAAO,GAAG,GAAG,EAAE;IACnB,mBAAmB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { RefObject } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n cancelAnimation,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { scheduleOnRN } from 'react-native-worklets';\n\n// Internal dependencies.\nimport { Toast } from './Toast';\nimport {\n TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n TOAST_DISMISS_VELOCITY_THRESHOLD,\n TOAST_SPRING_CONFIG,\n TOAST_SWIPE_ACTIVE_OFFSET_Y,\n TOAST_SWIPE_FAIL_OFFSET_X,\n TOAST_TOP_PADDING,\n TOAST_VISIBILITY_DURATION,\n} from './Toast.constants';\nimport type {\n ToastOptions,\n ToastProps,\n ToasterProps,\n ToasterRef,\n} from './Toast.types';\n\nconst screenHeight = Dimensions.get('window').height;\n\nlet registeredRef: RefObject<ToasterRef | null> | null = null;\n\nconst assertRegisteredRef = (method: 'dismiss' | 'toast'): ToasterRef => {\n if (!registeredRef?.current) {\n const invocation = method === 'toast' ? 'toast()' : `toast.${method}()`;\n throw new Error(\n `${invocation} called before <Toaster /> mounted. Render <Toaster /> once at the root of your app.`,\n );\n }\n return registeredRef.current;\n};\n\nconst getToastProps = ({\n hasNoTimeout: _hasNoTimeout,\n onClose: _onClose,\n topOffset: _topOffset,\n twClassName: _twClassName,\n showCloseButton: _showCloseButton,\n ...toastProps\n}: ToastOptions): Omit<ToastProps, 'twClassName'> => toastProps;\n\nconst getHiddenTranslateY = (height: number, offset: number) =>\n -(height + offset);\n\nconst ToasterComponent = forwardRef<ToasterRef, ToasterProps>(\n ({ twClassName, ...props }, ref) => {\n const tw = useTailwind();\n const [toastOptions, setToastOptions] = useState<ToastOptions | undefined>(\n undefined,\n );\n const replacementTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const autoDismissTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const animationStartedRef = useRef(false);\n const visibleAtRef = useRef<number | null>(null);\n const hasNoTimeoutRef = useRef(false);\n // Invalidates queued spring-back resumes after replace/dismiss. A completed\n // spring cannot be cancelled, so scheduleOnRN(resume) can still run later.\n const toastGenerationRef = useRef(0);\n const { top: topInset } = useSafeAreaInsets();\n const toastHeight = useSharedValue(screenHeight);\n const hiddenTranslateY = useSharedValue(-screenHeight);\n const visibleTranslateY = useSharedValue(0);\n const gestureStartY = useSharedValue(0);\n const translateYProgress = useSharedValue(-screenHeight);\n const isDismissing = useSharedValue(false);\n // True after onStart until onEnd/onFinalize recovers. Used so a failed pan\n // (e.g. failOffsetX after activation) still springs back and resumes dismiss.\n const isSwipeActive = useSharedValue(false);\n const toastGeneration = useSharedValue(0);\n const topOffset = toastOptions?.topOffset ?? 0;\n hasNoTimeoutRef.current = Boolean(toastOptions?.hasNoTimeout);\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: translateYProgress.value + topOffset }],\n }));\n const baseStyle = useMemo(\n () =>\n [\n tw.style('absolute left-4 right-4 top-0'),\n animatedStyle,\n ] as StyleProp<ViewStyle>,\n [tw, animatedStyle],\n );\n const innerRef = useRef<ToasterRef | null>(null);\n\n const clearScheduledAutoDismiss = () => {\n if (autoDismissTimeoutRef.current !== null) {\n clearTimeout(autoDismissTimeoutRef.current);\n autoDismissTimeoutRef.current = null;\n }\n };\n\n const bumpToastGeneration = () => {\n toastGenerationRef.current += 1;\n toastGeneration.value = toastGenerationRef.current;\n };\n\n const resetState = () => {\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n clearScheduledAutoDismiss();\n setToastOptions(undefined);\n };\n\n const startDismissAnimation = () => {\n bumpToastGeneration();\n clearScheduledAutoDismiss();\n isDismissing.value = true;\n visibleAtRef.current = null;\n translateYProgress.value = withSpring(\n hiddenTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(resetState);\n }\n },\n );\n };\n\n const scheduleAutoDismiss = (delayMs: number) => {\n clearScheduledAutoDismiss();\n autoDismissTimeoutRef.current = setTimeout(() => {\n autoDismissTimeoutRef.current = null;\n startDismissAnimation();\n }, delayMs);\n };\n\n const beginAutoDismiss = () => {\n visibleAtRef.current = Date.now();\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION);\n };\n\n const resumeAutoDismissAfterSwipe = () => {\n if (hasNoTimeoutRef.current || isDismissing.value) {\n return;\n }\n\n // Entrance was interrupted before auto-dismiss started — start a full timer.\n if (visibleAtRef.current === null) {\n beginAutoDismiss();\n return;\n }\n\n const elapsed = Date.now() - visibleAtRef.current;\n if (elapsed >= TOAST_VISIBILITY_DURATION) {\n startDismissAnimation();\n return;\n }\n\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION - elapsed);\n };\n\n const showToast = (options: ToastOptions) => {\n bumpToastGeneration();\n let timeoutDuration = 0;\n const normalizedOptions = {\n hasNoTimeout: false,\n ...options,\n };\n if (toastOptions) {\n // Always clear any pending auto-dismiss from the previous toast, including\n // when the replacement is persistent (hasNoTimeout). Otherwise the old\n // timer can fire and dismiss the new toast.\n clearScheduledAutoDismiss();\n cancelAnimation(translateYProgress);\n timeoutDuration = 100;\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n setToastOptions(undefined);\n }\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n }\n replacementTimerRef.current = setTimeout(() => {\n replacementTimerRef.current = null;\n setToastOptions(normalizedOptions);\n }, timeoutDuration);\n };\n\n const closeToast = () => {\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n replacementTimerRef.current = null;\n }\n startDismissAnimation();\n };\n\n const closeToastRef = useRef(closeToast);\n const resumeAutoDismissAfterSwipeRef = useRef(resumeAutoDismissAfterSwipe);\n const clearScheduledAutoDismissRef = useRef(clearScheduledAutoDismiss);\n closeToastRef.current = closeToast;\n resumeAutoDismissAfterSwipeRef.current = resumeAutoDismissAfterSwipe;\n clearScheduledAutoDismissRef.current = clearScheduledAutoDismiss;\n\n const dismissToastFromSwipe = () => {\n closeToastRef.current();\n };\n\n const resumeAutoDismissFromSwipe = (generation: number) => {\n // Ignore resumes from a toast that was replaced or dismissed after the\n // spring-back started (completed springs cannot be cancelled).\n if (generation !== toastGenerationRef.current) {\n return;\n }\n resumeAutoDismissAfterSwipeRef.current();\n };\n\n const clearScheduledAutoDismissFromSwipe = () => {\n clearScheduledAutoDismissRef.current();\n };\n\n const swipeGesture = useMemo(() => {\n // These gesture callbacks need explicit 'worklet' directives because this\n // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the\n // gesture chain as a namespaced call (react_native_gesture_handler_1.Gesture).\n // The consumer's Reanimated/Worklets Babel plugin does run over dist, but its\n // gesture auto-detection doesn't recognize that compiled namespaced form.\n const springBackAfterSwipe = () => {\n 'worklet';\n\n const generationAtSpringStart = toastGeneration.value;\n translateYProgress.value = withSpring(\n visibleTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n // A new pan cancels this spring via cancelAnimation; only resume\n // auto-dismiss when the spring-back completed naturally.\n if (finished) {\n scheduleOnRN(resumeAutoDismissFromSwipe, generationAtSpringStart);\n }\n },\n );\n };\n\n return Gesture.Pan()\n .activeOffsetY(TOAST_SWIPE_ACTIVE_OFFSET_Y)\n .failOffsetX([-TOAST_SWIPE_FAIL_OFFSET_X, TOAST_SWIPE_FAIL_OFFSET_X])\n .onStart(() => {\n 'worklet';\n\n // Don't interrupt an in-progress dismiss animation.\n if (isDismissing.value) {\n return;\n }\n isSwipeActive.value = true;\n scheduleOnRN(clearScheduledAutoDismissFromSwipe);\n cancelAnimation(translateYProgress);\n gestureStartY.value = translateYProgress.value;\n })\n .onUpdate((event) => {\n 'worklet';\n\n if (isDismissing.value || !isSwipeActive.value) {\n return;\n }\n const nextTranslateY = gestureStartY.value + event.translationY;\n // Toast sits at the top; only allow dragging upward (more negative).\n translateYProgress.value = Math.min(\n nextTranslateY,\n visibleTranslateY.value,\n );\n })\n .onEnd((event) => {\n 'worklet';\n\n if (!isSwipeActive.value) {\n return;\n }\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n const { translationY, velocityY } = event;\n const dismissDistance = Math.max(\n toastHeight.value * TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n );\n const hasReachedDismissOffset = translationY <= -dismissDistance;\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) > TOAST_DISMISS_VELOCITY_THRESHOLD;\n const isQuickDismissing = velocityY < 0;\n\n const shouldDismiss =\n hasReachedDismissOffset ||\n (hasReachedSwipeThreshold && isQuickDismissing);\n\n if (shouldDismiss) {\n scheduleOnRN(dismissToastFromSwipe);\n return;\n }\n\n springBackAfterSwipe();\n })\n .onFinalize(() => {\n 'worklet';\n\n // onEnd is skipped when the pan fails/cancels after activation\n // (e.g. horizontal travel past failOffsetX). Recover position and\n // auto-dismiss so the toast is not left stuck mid-offset.\n if (!isSwipeActive.value) {\n return;\n }\n // Clear before the dismiss check — same order as onEnd — so a pan\n // cancelled mid-dismiss cannot leave isSwipeActive stuck true for a\n // later toast (resetState alone is not enough if finalize races it).\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n springBackAfterSwipe();\n });\n // Shared values and swipe JS wrappers are stable for the component lifetime.\n }, []);\n\n innerRef.current = {\n closeToast,\n showToast,\n };\n\n useImperativeHandle(ref, () => innerRef.current as ToasterRef);\n\n useLayoutEffect(() => {\n registeredRef = innerRef;\n return () => {\n if (registeredRef === innerRef) {\n registeredRef = null;\n }\n };\n }, []);\n\n if (!toastOptions) {\n return null;\n }\n\n const {\n onClose: toastOnClose,\n showCloseButton = true,\n twClassName: toastTwClassName,\n } = toastOptions;\n const toastProps = getToastProps(toastOptions);\n const { actionButtonLabel, actionButtonOnPress, ...restToastProps } =\n toastProps;\n const toastTwClassNames = [twClassName, toastTwClassName]\n .filter(Boolean)\n .join(' ');\n const handleClose = showCloseButton\n ? () => {\n closeToast();\n toastOnClose?.();\n }\n : undefined;\n\n const onAnimatedViewLayout = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n const nextHiddenTranslateY = getHiddenTranslateY(height, topOffset);\n const nextVisibleTranslateY = topInset + TOAST_TOP_PADDING;\n\n hiddenTranslateY.value = nextHiddenTranslateY;\n visibleTranslateY.value = nextVisibleTranslateY;\n toastHeight.value = height;\n\n if (animationStartedRef.current) {\n return;\n }\n\n animationStartedRef.current = true;\n translateYProgress.value = nextHiddenTranslateY;\n\n if (toastOptions.hasNoTimeout) {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n );\n } else {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(beginAutoDismiss);\n }\n },\n );\n }\n };\n\n return (\n <GestureDetector gesture={swipeGesture}>\n <Animated.View\n onLayout={onAnimatedViewLayout}\n style={baseStyle}\n {...props}\n >\n {actionButtonLabel && actionButtonOnPress ? (\n <Toast\n {...toastProps}\n actionButtonLabel={actionButtonLabel}\n actionButtonOnPress={actionButtonOnPress}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n ) : (\n <Toast\n {...restToastProps}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n )}\n </Animated.View>\n </GestureDetector>\n );\n },\n);\n\nToasterComponent.displayName = 'Toaster';\n\ntype ToastFunction = ((options: ToastOptions) => void) & {\n dismiss: () => void;\n};\n\nexport const Toaster = ToasterComponent;\n\nexport const toast = ((options: ToastOptions) => {\n assertRegisteredRef('toast').showToast(options);\n}) as ToastFunction;\n\ntoast.dismiss = () => {\n assertRegisteredRef('dismiss').closeToast();\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Toaster.mjs","sourceRoot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AAC;iBAChC;YACH,CAAC,CACF,CAAC;SACH;IACH,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CACrC;QAAA,CAAC,QAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAC/B,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,IAAI,KAAK,CAAC,CAEV;UAAA,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAC1C,CAAC,KAAK,CACJ,IAAI,UAAU,CAAC,CACf,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CACzC,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CAAC,CAAC,CAAC,CACF,CAAC,KAAK,CACJ,IAAI,cAAc,CAAC,CACnB,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,WAAW,CAAC,CAAC,iBAAiB,CAAC,EAC/B,CACH,CACH;QAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;MAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,SAAS,CAAC;AAMzC,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,OAAqB,EAAE,EAAE;IAC9C,mBAAmB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,CAAkB,CAAC;AAEpB,KAAK,CAAC,OAAO,GAAG,GAAG,EAAE;IACnB,mBAAmB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { RefObject } from 'react';\nimport { Dimensions } from 'react-native';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n cancelAnimation,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { scheduleOnRN } from 'react-native-worklets';\n\n// Internal dependencies.\nimport { Toast } from './Toast';\nimport {\n TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n TOAST_DISMISS_VELOCITY_THRESHOLD,\n TOAST_SPRING_CONFIG,\n TOAST_SWIPE_ACTIVE_OFFSET_Y,\n TOAST_SWIPE_FAIL_OFFSET_X,\n TOAST_TOP_PADDING,\n TOAST_VISIBILITY_DURATION,\n} from './Toast.constants';\nimport type {\n ToastOptions,\n ToastProps,\n ToasterProps,\n ToasterRef,\n} from './Toast.types';\n\nconst screenHeight = Dimensions.get('window').height;\n\nlet registeredRef: RefObject<ToasterRef | null> | null = null;\n\nconst assertRegisteredRef = (method: 'dismiss' | 'toast'): ToasterRef => {\n if (!registeredRef?.current) {\n const invocation = method === 'toast' ? 'toast()' : `toast.${method}()`;\n throw new Error(\n `${invocation} called before <Toaster /> mounted. Render <Toaster /> once at the root of your app.`,\n );\n }\n return registeredRef.current;\n};\n\nconst getToastProps = ({\n hasNoTimeout: _hasNoTimeout,\n onClose: _onClose,\n topOffset: _topOffset,\n twClassName: _twClassName,\n showCloseButton: _showCloseButton,\n ...toastProps\n}: ToastOptions): Omit<ToastProps, 'twClassName'> => toastProps;\n\nconst getHiddenTranslateY = (height: number, offset: number) =>\n -(height + offset);\n\nconst ToasterComponent = forwardRef<ToasterRef, ToasterProps>(\n ({ twClassName, ...props }, ref) => {\n const tw = useTailwind();\n const [toastOptions, setToastOptions] = useState<ToastOptions | undefined>(\n undefined,\n );\n const replacementTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const autoDismissTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const animationStartedRef = useRef(false);\n const visibleAtRef = useRef<number | null>(null);\n const hasNoTimeoutRef = useRef(false);\n // Invalidates queued spring-back resumes after replace/dismiss. A completed\n // spring cannot be cancelled, so scheduleOnRN(resume) can still run later.\n const toastGenerationRef = useRef(0);\n const { top: topInset } = useSafeAreaInsets();\n const toastHeight = useSharedValue(screenHeight);\n const hiddenTranslateY = useSharedValue(-screenHeight);\n const visibleTranslateY = useSharedValue(0);\n const gestureStartY = useSharedValue(0);\n const translateYProgress = useSharedValue(-screenHeight);\n const isDismissing = useSharedValue(false);\n // True after onStart until onEnd/onFinalize recovers. Used so a failed pan\n // (e.g. failOffsetX after activation) still springs back and resumes dismiss.\n const isSwipeActive = useSharedValue(false);\n const toastGeneration = useSharedValue(0);\n const topOffset = toastOptions?.topOffset ?? 0;\n hasNoTimeoutRef.current = Boolean(toastOptions?.hasNoTimeout);\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: translateYProgress.value + topOffset }],\n }));\n const baseStyle = useMemo(\n () => [tw.style('absolute left-4 right-4 top-0'), animatedStyle],\n [tw, animatedStyle],\n );\n const innerRef = useRef<ToasterRef | null>(null);\n\n const clearScheduledAutoDismiss = () => {\n if (autoDismissTimeoutRef.current !== null) {\n clearTimeout(autoDismissTimeoutRef.current);\n autoDismissTimeoutRef.current = null;\n }\n };\n\n const bumpToastGeneration = () => {\n toastGenerationRef.current += 1;\n toastGeneration.value = toastGenerationRef.current;\n };\n\n const resetState = () => {\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n clearScheduledAutoDismiss();\n setToastOptions(undefined);\n };\n\n const startDismissAnimation = () => {\n bumpToastGeneration();\n clearScheduledAutoDismiss();\n isDismissing.value = true;\n visibleAtRef.current = null;\n translateYProgress.value = withSpring(\n hiddenTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(resetState);\n }\n },\n );\n };\n\n const scheduleAutoDismiss = (delayMs: number) => {\n clearScheduledAutoDismiss();\n autoDismissTimeoutRef.current = setTimeout(() => {\n autoDismissTimeoutRef.current = null;\n startDismissAnimation();\n }, delayMs);\n };\n\n const beginAutoDismiss = () => {\n visibleAtRef.current = Date.now();\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION);\n };\n\n const resumeAutoDismissAfterSwipe = () => {\n if (hasNoTimeoutRef.current || isDismissing.value) {\n return;\n }\n\n // Entrance was interrupted before auto-dismiss started — start a full timer.\n if (visibleAtRef.current === null) {\n beginAutoDismiss();\n return;\n }\n\n const elapsed = Date.now() - visibleAtRef.current;\n if (elapsed >= TOAST_VISIBILITY_DURATION) {\n startDismissAnimation();\n return;\n }\n\n scheduleAutoDismiss(TOAST_VISIBILITY_DURATION - elapsed);\n };\n\n const showToast = (options: ToastOptions) => {\n bumpToastGeneration();\n let timeoutDuration = 0;\n const normalizedOptions = {\n hasNoTimeout: false,\n ...options,\n };\n if (toastOptions) {\n // Always clear any pending auto-dismiss from the previous toast, including\n // when the replacement is persistent (hasNoTimeout). Otherwise the old\n // timer can fire and dismiss the new toast.\n clearScheduledAutoDismiss();\n cancelAnimation(translateYProgress);\n timeoutDuration = 100;\n animationStartedRef.current = false;\n visibleAtRef.current = null;\n isDismissing.value = false;\n isSwipeActive.value = false;\n setToastOptions(undefined);\n }\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n }\n replacementTimerRef.current = setTimeout(() => {\n replacementTimerRef.current = null;\n setToastOptions(normalizedOptions);\n }, timeoutDuration);\n };\n\n const closeToast = () => {\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n replacementTimerRef.current = null;\n }\n startDismissAnimation();\n };\n\n const closeToastRef = useRef(closeToast);\n const resumeAutoDismissAfterSwipeRef = useRef(resumeAutoDismissAfterSwipe);\n const clearScheduledAutoDismissRef = useRef(clearScheduledAutoDismiss);\n closeToastRef.current = closeToast;\n resumeAutoDismissAfterSwipeRef.current = resumeAutoDismissAfterSwipe;\n clearScheduledAutoDismissRef.current = clearScheduledAutoDismiss;\n\n const dismissToastFromSwipe = () => {\n closeToastRef.current();\n };\n\n const resumeAutoDismissFromSwipe = (generation: number) => {\n // Ignore resumes from a toast that was replaced or dismissed after the\n // spring-back started (completed springs cannot be cancelled).\n if (generation !== toastGenerationRef.current) {\n return;\n }\n resumeAutoDismissAfterSwipeRef.current();\n };\n\n const clearScheduledAutoDismissFromSwipe = () => {\n clearScheduledAutoDismissRef.current();\n };\n\n const swipeGesture = useMemo(() => {\n // These gesture callbacks need explicit 'worklet' directives because this\n // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the\n // gesture chain as a namespaced call (react_native_gesture_handler_1.Gesture).\n // The consumer's Reanimated/Worklets Babel plugin does run over dist, but its\n // gesture auto-detection doesn't recognize that compiled namespaced form.\n const springBackAfterSwipe = () => {\n 'worklet';\n\n const generationAtSpringStart = toastGeneration.value;\n translateYProgress.value = withSpring(\n visibleTranslateY.value,\n TOAST_SPRING_CONFIG,\n (finished) => {\n // A new pan cancels this spring via cancelAnimation; only resume\n // auto-dismiss when the spring-back completed naturally.\n if (finished) {\n scheduleOnRN(resumeAutoDismissFromSwipe, generationAtSpringStart);\n }\n },\n );\n };\n\n return Gesture.Pan()\n .activeOffsetY(TOAST_SWIPE_ACTIVE_OFFSET_Y)\n .failOffsetX([-TOAST_SWIPE_FAIL_OFFSET_X, TOAST_SWIPE_FAIL_OFFSET_X])\n .onStart(() => {\n 'worklet';\n\n // Don't interrupt an in-progress dismiss animation.\n if (isDismissing.value) {\n return;\n }\n isSwipeActive.value = true;\n scheduleOnRN(clearScheduledAutoDismissFromSwipe);\n cancelAnimation(translateYProgress);\n gestureStartY.value = translateYProgress.value;\n })\n .onUpdate((event) => {\n 'worklet';\n\n if (isDismissing.value || !isSwipeActive.value) {\n return;\n }\n const nextTranslateY = gestureStartY.value + event.translationY;\n // Toast sits at the top; only allow dragging upward (more negative).\n translateYProgress.value = Math.min(\n nextTranslateY,\n visibleTranslateY.value,\n );\n })\n .onEnd((event) => {\n 'worklet';\n\n if (!isSwipeActive.value) {\n return;\n }\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n const { translationY, velocityY } = event;\n const dismissDistance = Math.max(\n toastHeight.value * TOAST_DISMISS_DISTANCE_THRESHOLD,\n TOAST_DISMISS_MIN_DISTANCE,\n );\n const hasReachedDismissOffset = translationY <= -dismissDistance;\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) > TOAST_DISMISS_VELOCITY_THRESHOLD;\n const isQuickDismissing = velocityY < 0;\n\n const shouldDismiss =\n hasReachedDismissOffset ||\n (hasReachedSwipeThreshold && isQuickDismissing);\n\n if (shouldDismiss) {\n scheduleOnRN(dismissToastFromSwipe);\n return;\n }\n\n springBackAfterSwipe();\n })\n .onFinalize(() => {\n 'worklet';\n\n // onEnd is skipped when the pan fails/cancels after activation\n // (e.g. horizontal travel past failOffsetX). Recover position and\n // auto-dismiss so the toast is not left stuck mid-offset.\n if (!isSwipeActive.value) {\n return;\n }\n // Clear before the dismiss check — same order as onEnd — so a pan\n // cancelled mid-dismiss cannot leave isSwipeActive stuck true for a\n // later toast (resetState alone is not enough if finalize races it).\n isSwipeActive.value = false;\n\n if (isDismissing.value) {\n return;\n }\n springBackAfterSwipe();\n });\n // Shared values and swipe JS wrappers are stable for the component lifetime.\n }, []);\n\n innerRef.current = {\n closeToast,\n showToast,\n };\n\n useImperativeHandle(ref, () => innerRef.current as ToasterRef);\n\n useLayoutEffect(() => {\n registeredRef = innerRef;\n return () => {\n if (registeredRef === innerRef) {\n registeredRef = null;\n }\n };\n }, []);\n\n if (!toastOptions) {\n return null;\n }\n\n const {\n onClose: toastOnClose,\n showCloseButton = true,\n twClassName: toastTwClassName,\n } = toastOptions;\n const toastProps = getToastProps(toastOptions);\n const { actionButtonLabel, actionButtonOnPress, ...restToastProps } =\n toastProps;\n const toastTwClassNames = [twClassName, toastTwClassName]\n .filter(Boolean)\n .join(' ');\n const handleClose = showCloseButton\n ? () => {\n closeToast();\n toastOnClose?.();\n }\n : undefined;\n\n const onAnimatedViewLayout = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n const nextHiddenTranslateY = getHiddenTranslateY(height, topOffset);\n const nextVisibleTranslateY = topInset + TOAST_TOP_PADDING;\n\n hiddenTranslateY.value = nextHiddenTranslateY;\n visibleTranslateY.value = nextVisibleTranslateY;\n toastHeight.value = height;\n\n if (animationStartedRef.current) {\n return;\n }\n\n animationStartedRef.current = true;\n translateYProgress.value = nextHiddenTranslateY;\n\n if (toastOptions.hasNoTimeout) {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n );\n } else {\n translateYProgress.value = withSpring(\n nextVisibleTranslateY,\n TOAST_SPRING_CONFIG,\n (finished) => {\n if (finished) {\n scheduleOnRN(beginAutoDismiss);\n }\n },\n );\n }\n };\n\n return (\n <GestureDetector gesture={swipeGesture}>\n <Animated.View\n onLayout={onAnimatedViewLayout}\n style={baseStyle}\n {...props}\n >\n {actionButtonLabel && actionButtonOnPress ? (\n <Toast\n {...toastProps}\n actionButtonLabel={actionButtonLabel}\n actionButtonOnPress={actionButtonOnPress}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n ) : (\n <Toast\n {...restToastProps}\n onClose={handleClose}\n twClassName={toastTwClassNames}\n />\n )}\n </Animated.View>\n </GestureDetector>\n );\n },\n);\n\nToasterComponent.displayName = 'Toaster';\n\ntype ToastFunction = ((options: ToastOptions) => void) & {\n dismiss: () => void;\n};\n\nexport const Toaster = ToasterComponent;\n\nexport const toast = ((options: ToastOptions) => {\n assertRegisteredRef('toast').showToast(options);\n}) as ToastFunction;\n\ntoast.dismiss = () => {\n assertRegisteredRef('dismiss').closeToast();\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/design-system-react-native",
|
|
3
|
-
"version": "0.46.0-preview.
|
|
3
|
+
"version": "0.46.0-preview.fa32350",
|
|
4
4
|
"description": "Design System React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@metamask-previews/design-system-shared": "0.37.0-preview.
|
|
50
|
+
"@metamask-previews/design-system-shared": "0.37.0-preview.fa32350",
|
|
51
51
|
"react-native-jazzicon": "^0.1.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@babel/preset-typescript": "^7.23.3",
|
|
58
58
|
"@figma/code-connect": "^1.4.9",
|
|
59
59
|
"@gorhom/bottom-sheet": "^5.1.3",
|
|
60
|
-
"@metamask-previews/design-system-twrnc-preset": "0.11.0-preview.
|
|
61
|
-
"@metamask-previews/design-tokens": "11.0.0-preview.
|
|
60
|
+
"@metamask-previews/design-system-twrnc-preset": "0.11.0-preview.fa32350",
|
|
61
|
+
"@metamask-previews/design-tokens": "11.0.0-preview.fa32350",
|
|
62
62
|
"@metamask/auto-changelog": "^6.2.1",
|
|
63
63
|
"@metamask/utils": "^11.12.1",
|
|
64
64
|
"@react-native/babel-preset": "0.81.5",
|
|
@@ -77,12 +77,12 @@
|
|
|
77
77
|
"jest": "^29.7.0",
|
|
78
78
|
"react": "19.1.0",
|
|
79
79
|
"react-native": "0.81.5",
|
|
80
|
-
"react-native-gesture-handler": "~2.
|
|
81
|
-
"react-native-reanimated": "
|
|
80
|
+
"react-native-gesture-handler": "~2.32.0",
|
|
81
|
+
"react-native-reanimated": "4.5.3",
|
|
82
82
|
"react-native-safe-area-context": "~5.6.0",
|
|
83
83
|
"react-native-svg": "15.12.1",
|
|
84
84
|
"react-native-svg-transformer": "^1.5.3",
|
|
85
|
-
"react-native-worklets": "0.
|
|
85
|
+
"react-native-worklets": "0.10.4",
|
|
86
86
|
"react-test-renderer": "19.1.0",
|
|
87
87
|
"storybook": "10.4.6",
|
|
88
88
|
"ts-jest": "^29.2.5",
|