react-native-terra-ui 0.10.0 → 0.10.2
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/CHANGELOG.md +13 -0
- package/lib/module/components/button/Button.js +21 -13
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/divider/Divider.js +127 -0
- package/lib/module/components/divider/Divider.js.map +1 -0
- package/lib/module/components/divider/index.js +4 -0
- package/lib/module/components/divider/index.js.map +1 -0
- package/lib/module/components/index.js +2 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/pressable/index.js +4 -0
- package/lib/module/components/pressable/index.js.map +1 -0
- package/lib/module/components/pressable/variants/PressableScale/index.js +110 -0
- package/lib/module/components/pressable/variants/PressableScale/index.js.map +1 -0
- package/lib/module/components/toast/ToastProvider.js +9 -236
- package/lib/module/components/toast/ToastProvider.js.map +1 -1
- package/lib/module/components/toast/hooks/use-toast-manager.js +96 -0
- package/lib/module/components/toast/hooks/use-toast-manager.js.map +1 -0
- package/lib/module/components/toast/parts/ToastAnimatedItem.js +34 -50
- package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -1
- package/lib/module/components/toast/parts/ToastOverlay.ios.js +36 -0
- package/lib/module/components/toast/parts/ToastOverlay.ios.js.map +1 -0
- package/lib/module/components/toast/parts/ToastOverlay.js +34 -0
- package/lib/module/components/toast/parts/ToastOverlay.js.map +1 -0
- package/lib/module/components/toast/parts/ToastViewport.js +91 -0
- package/lib/module/components/toast/parts/ToastViewport.js.map +1 -0
- package/lib/typescript/src/components/button/Button.d.ts +7 -0
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +1 -1
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/divider/Divider.d.ts +49 -0
- package/lib/typescript/src/components/divider/Divider.d.ts.map +1 -0
- package/lib/typescript/src/components/divider/index.d.ts +3 -0
- package/lib/typescript/src/components/divider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +2 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/pressable/index.d.ts +3 -0
- package/lib/typescript/src/components/pressable/index.d.ts.map +1 -0
- package/lib/typescript/src/components/pressable/variants/PressableScale/index.d.ts +47 -0
- package/lib/typescript/src/components/pressable/variants/PressableScale/index.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/hooks/use-toast-manager.d.ts +6 -0
- package/lib/typescript/src/components/toast/hooks/use-toast-manager.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +3 -2
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/parts/ToastOverlay.d.ts +28 -0
- package/lib/typescript/src/components/toast/parts/ToastOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/parts/ToastOverlay.ios.d.ts +28 -0
- package/lib/typescript/src/components/toast/parts/ToastOverlay.ios.d.ts.map +1 -0
- package/lib/typescript/src/components/toast/parts/ToastViewport.d.ts +11 -0
- package/lib/typescript/src/components/toast/parts/ToastViewport.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/button/Button.tsx +32 -13
- package/src/components/button/index.ts +1 -0
- package/src/components/divider/Divider.tsx +164 -0
- package/src/components/divider/index.ts +7 -0
- package/src/components/index.ts +2 -0
- package/src/components/pressable/index.ts +5 -0
- package/src/components/pressable/variants/PressableScale/index.tsx +166 -0
- package/src/components/toast/ToastProvider.tsx +7 -288
- package/src/components/toast/hooks/use-toast-manager.tsx +114 -0
- package/src/components/toast/parts/ToastAnimatedItem.tsx +32 -50
- package/src/components/toast/parts/ToastOverlay.ios.tsx +30 -0
- package/src/components/toast/parts/ToastOverlay.tsx +28 -0
- package/src/components/toast/parts/ToastViewport.tsx +104 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ToastOverlay","children","_jsx","_Fragment"],"sourceRoot":"../../../../../src","sources":["components/toast/parts/ToastOverlay.tsx"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAAC;EAAEC;AAAkC,CAAC,EAAE;EAClE,oBAAOC,IAAA,CAAAC,SAAA;IAAAF,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Keyboard, Platform } from "react-native";
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
6
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
|
+
import { ToastAnimatedItem } from "./ToastAnimatedItem.js";
|
|
8
|
+
import { ToastOverlay } from "./ToastOverlay";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export function ToastViewport({
|
|
11
|
+
placement,
|
|
12
|
+
toasts,
|
|
13
|
+
manager,
|
|
14
|
+
maxVisibleToasts,
|
|
15
|
+
offset
|
|
16
|
+
}) {
|
|
17
|
+
const safeAreaInsets = useSafeAreaInsets();
|
|
18
|
+
const heights = useSharedValue({});
|
|
19
|
+
const keyboardHeight = useSharedValue(0);
|
|
20
|
+
const baseBottom = offset?.bottom ?? safeAreaInsets.bottom + (Platform.OS === "ios" ? 6 : 12);
|
|
21
|
+
const baseTop = offset?.top ?? safeAreaInsets.top + (Platform.OS === "ios" ? 0 : 12);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (placement !== "bottom") return;
|
|
24
|
+
const showEvent = Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
25
|
+
const hideEvent = Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
26
|
+
const showSub = Keyboard.addListener(showEvent, e => {
|
|
27
|
+
keyboardHeight.value = withTiming(e.endCoordinates.height);
|
|
28
|
+
});
|
|
29
|
+
const hideSub = Keyboard.addListener(hideEvent, () => {
|
|
30
|
+
keyboardHeight.value = withTiming(0);
|
|
31
|
+
});
|
|
32
|
+
return () => {
|
|
33
|
+
showSub.remove();
|
|
34
|
+
hideSub.remove();
|
|
35
|
+
};
|
|
36
|
+
}, [keyboardHeight, placement]);
|
|
37
|
+
const gap = Platform.OS === "ios" ? 6 : 12;
|
|
38
|
+
const keyboardStyle = useAnimatedStyle(() => {
|
|
39
|
+
if (placement === "top") return {
|
|
40
|
+
top: baseTop
|
|
41
|
+
};
|
|
42
|
+
if (keyboardHeight.value > 0) {
|
|
43
|
+
return {
|
|
44
|
+
bottom: keyboardHeight.value + gap
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
bottom: baseBottom
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const activeIds = new Set(toasts.map(toast => toast.id));
|
|
53
|
+
const nextHeights = {};
|
|
54
|
+
for (const [id, height] of Object.entries(heights.value)) {
|
|
55
|
+
if (activeIds.has(id)) {
|
|
56
|
+
nextHeights[id] = height;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
heights.value = nextHeights;
|
|
60
|
+
}, [heights, toasts]);
|
|
61
|
+
const frontToast = toasts[toasts.length - 1];
|
|
62
|
+
if (!frontToast) return null;
|
|
63
|
+
return /*#__PURE__*/_jsx(ToastOverlay, {
|
|
64
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
65
|
+
pointerEvents: "box-none",
|
|
66
|
+
style: [{
|
|
67
|
+
position: "absolute",
|
|
68
|
+
zIndex: 9999,
|
|
69
|
+
elevation: 9999,
|
|
70
|
+
left: offset?.left ?? safeAreaInsets.left + 12,
|
|
71
|
+
right: offset?.right ?? safeAreaInsets.right + 12
|
|
72
|
+
}, keyboardStyle],
|
|
73
|
+
children: toasts.map((toast, index) => /*#__PURE__*/_jsx(ToastAnimatedItem, {
|
|
74
|
+
heights: heights,
|
|
75
|
+
id: toast.id,
|
|
76
|
+
index: index,
|
|
77
|
+
maxVisibleToasts: maxVisibleToasts,
|
|
78
|
+
placement: placement,
|
|
79
|
+
total: toasts.length,
|
|
80
|
+
frontId: frontToast.id,
|
|
81
|
+
children: toast.component({
|
|
82
|
+
id: toast.id,
|
|
83
|
+
index,
|
|
84
|
+
hide: manager.hide,
|
|
85
|
+
show: manager.show
|
|
86
|
+
})
|
|
87
|
+
}, toast.id))
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=ToastViewport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","Keyboard","Platform","Animated","useAnimatedStyle","useSharedValue","withTiming","useSafeAreaInsets","ToastAnimatedItem","ToastOverlay","jsx","_jsx","ToastViewport","placement","toasts","manager","maxVisibleToasts","offset","safeAreaInsets","heights","keyboardHeight","baseBottom","bottom","OS","baseTop","top","showEvent","hideEvent","showSub","addListener","e","value","endCoordinates","height","hideSub","remove","gap","keyboardStyle","activeIds","Set","map","toast","id","nextHeights","Object","entries","has","frontToast","length","children","View","pointerEvents","style","position","zIndex","elevation","left","right","index","total","frontId","component","hide","show"],"sourceRoot":"../../../../../src","sources":["components/toast/parts/ToastViewport.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAEjD,OAAOC,QAAQ,IAAIC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,QAAQ,yBAAyB;AAChG,SAASC,iBAAiB,QAAQ,gCAAgC;AAGlE,SAASC,iBAAiB;AAC1B,SAASC,YAAY;AAAyB,SAAAC,GAAA,IAAA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,CACL;QACEC,QAAQ,EAAE,UAAU;QACpBC,MAAM,EAAE,IAAI;QACZC,SAAS,EAAE,IAAI;QACfC,IAAI,EAAEvC,MAAM,EAAEuC,IAAI,IAAItC,cAAc,CAACsC,IAAI,GAAG,EAAE;QAC9CC,KAAK,EAAExC,MAAM,EAAEwC,KAAK,IAAIvC,cAAc,CAACuC,KAAK,GAAG;MACjD,CAAC,EACDpB,aAAa,CACb;MAAAY,QAAA,EAEDnC,MAAM,CAAC0B,GAAG,CAAC,CAACC,KAAK,EAAEiB,KAAK,kBACvB/C,IAAA,CAACH,iBAAiB;QAEhBW,OAAO,EAAEA,OAAQ;QACjBuB,EAAE,EAAED,KAAK,CAACC,EAAG;QACbgB,KAAK,EAAEA,KAAM;QACb1C,gBAAgB,EAAEA,gBAAiB;QACnCH,SAAS,EAAEA,SAAU;QACrB8C,KAAK,EAAE7C,MAAM,CAACkC,MAAO;QACrBY,OAAO,EAAEb,UAAU,CAACL,EAAG;QAAAO,QAAA,EAEtBR,KAAK,CAACoB,SAAS,CAAC;UACfnB,EAAE,EAAED,KAAK,CAACC,EAAE;UACZgB,KAAK;UACLI,IAAI,EAAE/C,OAAO,CAAC+C,IAAI;UAClBC,IAAI,EAAEhD,OAAO,CAACgD;QAChB,CAAC;MAAC,GAdGtB,KAAK,CAACC,EAeM,CACpB;IAAC,CACW;EAAC,CACJ,CAAC;AAEnB","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import type { ColorToken, TerraIconName } from "../../theme/types";
|
|
|
4
4
|
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
5
5
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
6
6
|
export type ButtonRadius = "none" | "sm" | "md" | "lg" | "xl" | "full";
|
|
7
|
+
export type ButtonAnimation = "scale" | "opacity" | "none";
|
|
7
8
|
export interface ButtonProps extends Omit<PressableProps, "style" | "children" | "disabled"> {
|
|
8
9
|
variant?: ButtonVariant;
|
|
9
10
|
size?: ButtonSize;
|
|
@@ -19,6 +20,12 @@ export interface ButtonProps extends Omit<PressableProps, "style" | "children" |
|
|
|
19
20
|
fullWidth?: boolean;
|
|
20
21
|
/** Remove the button's built-in horizontal padding. */
|
|
21
22
|
compact?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Press feedback. `'scale'` shrinks the button to 0.96, `'opacity'` dims it
|
|
25
|
+
* to `opacity.pressed`, `'none'` leaves it static. The two are mutually
|
|
26
|
+
* exclusive. Defaults to `'scale'`.
|
|
27
|
+
*/
|
|
28
|
+
animation?: ButtonAnimation;
|
|
22
29
|
/**
|
|
23
30
|
* Overrides the variant's resolved background color (theme token or raw
|
|
24
31
|
* CSS color). The label/icon/spinner foreground automatically switches to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC3G,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0D,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC3G,OAAO,KAAK,EAAa,cAAc,EAA8B,MAAM,cAAc,CAAC;AAK1F,OAAO,KAAK,EAAE,UAAU,EAAmB,aAAa,EAA2B,MAAM,cAAc,CAAC;AAQxG,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AACrF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AACvE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAK3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MAAM,MAAM,EAAiB,eAAe,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { ButtonIconProps, ButtonProps, ButtonRadius, ButtonSize, ButtonVariant, } from "./Button.js";
|
|
1
|
+
export type { ButtonAnimation, ButtonIconProps, ButtonProps, ButtonRadius, ButtonSize, ButtonVariant, } from "./Button.js";
|
|
2
2
|
export { Button, useButtonContext } from "./Button.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ViewProps } from "react-native";
|
|
3
|
+
import type { ColorToken, SpacingKey } from "../../theme/types";
|
|
4
|
+
export type DividerOrientation = "horizontal" | "vertical";
|
|
5
|
+
export type DividerLabelAlign = "start" | "center" | "end";
|
|
6
|
+
/** `number | 'hairline'`, mirroring `Box`'s `borderWidth`. */
|
|
7
|
+
export type DividerThickness = number | "hairline";
|
|
8
|
+
export interface DividerProps extends ViewProps {
|
|
9
|
+
/** Rule direction. Defaults to `'horizontal'`. */
|
|
10
|
+
orientation?: DividerOrientation;
|
|
11
|
+
/** Rule color. Defaults to `'border.default'`. */
|
|
12
|
+
color?: ColorToken;
|
|
13
|
+
/**
|
|
14
|
+
* Rule weight. `'hairline'` is the thinnest line the display can draw —
|
|
15
|
+
* a true 1px rule at any density. Defaults to `'hairline'`.
|
|
16
|
+
*/
|
|
17
|
+
thickness?: DividerThickness;
|
|
18
|
+
/**
|
|
19
|
+
* Symmetric margin on the cross axis — above and below a horizontal rule,
|
|
20
|
+
* either side of a vertical one. Defaults to `undefined` (no margin).
|
|
21
|
+
*/
|
|
22
|
+
spacing?: SpacingKey;
|
|
23
|
+
/**
|
|
24
|
+
* Where the label sits along the rule. Ignored without `children`.
|
|
25
|
+
* Defaults to `'center'`.
|
|
26
|
+
*/
|
|
27
|
+
labelAlign?: DividerLabelAlign;
|
|
28
|
+
/**
|
|
29
|
+
* An optional label, drawn with the rule running either side of it. Strings
|
|
30
|
+
* and numbers are wrapped in `Text` automatically. Horizontal only — a
|
|
31
|
+
* vertical divider ignores children.
|
|
32
|
+
*/
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A rule that separates content.
|
|
37
|
+
*
|
|
38
|
+
* Decorative by default — screen readers skip it, because the separation it
|
|
39
|
+
* expresses is already carried by the content either side. A labelled divider
|
|
40
|
+
* keeps its label readable.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <Divider />
|
|
44
|
+
* <Divider spacing="4" />
|
|
45
|
+
* <Divider orientation="vertical" />
|
|
46
|
+
* <Divider>OR</Divider>
|
|
47
|
+
*/
|
|
48
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
49
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../../../src/components/divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIhF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE3D,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,kDAAkD;IAClD,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,kDAAkD;IAClD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA0BD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,0LAgElB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/divider/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,GACjB,MAAM,cAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAW,CAAC"}
|
|
@@ -2,12 +2,14 @@ export * from "./avatar/index.js";
|
|
|
2
2
|
export * from "./box/index.js";
|
|
3
3
|
export * from "./button/index.js";
|
|
4
4
|
export * from "./chip/index.js";
|
|
5
|
+
export * from "./divider/index.js";
|
|
5
6
|
export * from "./empty-state/index.js";
|
|
6
7
|
export * from "./header/index.js";
|
|
7
8
|
export * from "./icon/index.js";
|
|
8
9
|
export * from "./image/index.js";
|
|
9
10
|
export * from "./page-indicator/index.js";
|
|
10
11
|
export * from "./portal/index.js";
|
|
12
|
+
export * from "./pressable/index.js";
|
|
11
13
|
export * from "./screen/index.js";
|
|
12
14
|
export * from "./slot/index.js";
|
|
13
15
|
export * from "./spinner/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAU,CAAC;AACzB,cAAc,gBAAO,CAAC;AACtB,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,wBAAe,CAAC;AAC9B,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,2BAAkB,CAAC;AACjC,cAAc,mBAAU,CAAC;AACzB,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,oBAAW,CAAC;AAC1B,cAAc,oBAAW,CAAC;AAC1B,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,oBAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAU,CAAC;AACzB,cAAc,gBAAO,CAAC;AACtB,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,oBAAW,CAAC;AAC1B,cAAc,wBAAe,CAAC;AAC9B,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,2BAAkB,CAAC;AACjC,cAAc,mBAAU,CAAC;AACzB,cAAc,sBAAa,CAAC;AAC5B,cAAc,mBAAU,CAAC;AACzB,cAAc,iBAAQ,CAAC;AACvB,cAAc,oBAAW,CAAC;AAC1B,cAAc,oBAAW,CAAC;AAC1B,cAAc,iBAAQ,CAAC;AACvB,cAAc,kBAAS,CAAC;AACxB,cAAc,oBAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/pressable/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,oCAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAA2B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { PressableProps, PressableStateCallbackType, StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
import { type WithSpringConfig, type WithTimingConfig } from "react-native-reanimated";
|
|
3
|
+
export type PressableScaleAnimationConfig = {
|
|
4
|
+
type: "timing";
|
|
5
|
+
config?: WithTimingConfig;
|
|
6
|
+
} | {
|
|
7
|
+
type: "spring";
|
|
8
|
+
config?: WithSpringConfig;
|
|
9
|
+
};
|
|
10
|
+
export interface PressableScaleProps extends Omit<PressableProps, "style" | "disabled"> {
|
|
11
|
+
/** Scale held at rest. Defaults to `1`. */
|
|
12
|
+
baseScale?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Scale held while pressed. Values below `baseScale` shrink, above it grow.
|
|
15
|
+
* Defaults to `0.96`.
|
|
16
|
+
*/
|
|
17
|
+
minScale?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Opacity held while pressed, animated on the same curve as the scale.
|
|
20
|
+
* Defaults to `undefined` — opacity is left untouched so `style` keeps
|
|
21
|
+
* ownership of it.
|
|
22
|
+
*/
|
|
23
|
+
pressedOpacity?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Drives the press animation. Defaults to `{ type: 'timing' }` with a 250ms
|
|
26
|
+
* ease; pass `{ type: 'spring' }` for a springy release.
|
|
27
|
+
*/
|
|
28
|
+
animationConfig?: PressableScaleAnimationConfig;
|
|
29
|
+
/** Blocks presses and holds the resting scale. Defaults to `false`. */
|
|
30
|
+
isDisabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Styles for the pressable itself. The function form receives `pressed`
|
|
33
|
+
* only — `hovered` and `focused` are not tracked, because the animated
|
|
34
|
+
* style has to be merged outside of `Pressable`'s own callback.
|
|
35
|
+
*/
|
|
36
|
+
style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A `Pressable` that animates a scale (and optionally an opacity) between its
|
|
40
|
+
* resting and pressed states, driven by a single shared `progress` value on the
|
|
41
|
+
* UI thread.
|
|
42
|
+
*
|
|
43
|
+
* Use it anywhere a press deserves physical feedback — cards, list rows, custom
|
|
44
|
+
* controls. `Button` renders one internally via its `animation` prop.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PressableScale: import("react").ForwardRefExoticComponent<PressableScaleProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/pressable/variants/PressableScale/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,cAAc,EACd,0BAA0B,EAC1B,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAiB,EAKf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAGtB,MAAM,yBAAyB,CAAC;AAWjC,MAAM,MAAM,6BAA6B,GACrC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAElD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC;IACrF,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,6BAA6B,CAAC;IAChD,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9F;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,iMAsF1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAS,CAAC;AAIhE,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAwB,EACxB,eAAsB,EACtB,gBAAoB,EACpB,MAAM,GACP,EAAE,kBAAkB,+BAwBpB;AAED,wBAAgB,QAAQ,IAAI,YAAY,CAMvC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ToastItem, ToastManager, ToastPlacement } from "../types.js";
|
|
2
|
+
export declare function useToastManager(defaultPlacement: ToastPlacement, defaultDuration: number): {
|
|
3
|
+
toasts: ToastItem[];
|
|
4
|
+
manager: ToastManager;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=use-toast-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/components/toast/hooks/use-toast-manager.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,SAAS,EACT,YAAY,EACZ,cAAc,EAEf,MAAM,aAAU,CAAC;AAmBlB,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM;;;EAoFxF"}
|
|
@@ -8,11 +8,12 @@ export interface ToastAnimatedItemProps {
|
|
|
8
8
|
index: number;
|
|
9
9
|
maxVisibleToasts: number;
|
|
10
10
|
placement: ToastPlacement;
|
|
11
|
-
total:
|
|
11
|
+
total: number;
|
|
12
|
+
frontId: ToastId;
|
|
12
13
|
}
|
|
13
14
|
export declare const enteringTop: import("react-native-reanimated").ReanimatedKeyframe;
|
|
14
15
|
export declare const exitingTop: import("react-native-reanimated").ReanimatedKeyframe;
|
|
15
16
|
export declare const enteringBottom: import("react-native-reanimated").ReanimatedKeyframe;
|
|
16
17
|
export declare const exitingBottom: import("react-native-reanimated").ReanimatedKeyframe;
|
|
17
|
-
export declare function ToastAnimatedItem({ children, heights, id, index, maxVisibleToasts, placement, total, }: ToastAnimatedItemProps): import("react").JSX.Element;
|
|
18
|
+
export declare function ToastAnimatedItem({ children, heights, id, index, maxVisibleToasts, placement, total, frontId, }: ToastAnimatedItemProps): import("react").JSX.Element;
|
|
18
19
|
//# sourceMappingURL=ToastAnimatedItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastAnimatedItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/toast/parts/ToastAnimatedItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAiB,
|
|
1
|
+
{"version":3,"file":"ToastAnimatedItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/toast/parts/ToastAnimatedItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAiB,EAGf,KAAK,WAAW,EAIjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAU,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,sDAUR,CAAC;AAEjB,eAAO,MAAM,UAAU,sDAUP,CAAC;AAEjB,eAAO,MAAM,cAAc,sDAUX,CAAC;AAEjB,eAAO,MAAM,aAAa,sDAUV,CAAC;AAIjB,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,OAAO,EACP,EAAE,EACF,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,OAAO,GACR,EAAE,sBAAsB,+BAqDxB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Hosts the toast viewport where it already is, because on Android it is
|
|
4
|
+
* already in the right place.
|
|
5
|
+
*
|
|
6
|
+
* The iOS variant explains the problem: a sheet there is a separate view
|
|
7
|
+
* controller, so a toast in the root tree paints underneath it. Android does
|
|
8
|
+
* not have that problem for these screens. `react-native-screens` handles
|
|
9
|
+
* `formSheet` as a `StackPresentation` inside the screen stack (see
|
|
10
|
+
* `Screen.kt`), which lives in the Activity's own window — the same window as
|
|
11
|
+
* this provider — so the viewport's `elevation: 9999` puts it on top the
|
|
12
|
+
* ordinary way. Verified on an API 36 emulator: a toast raised from a
|
|
13
|
+
* `formSheet` route renders over that sheet.
|
|
14
|
+
*
|
|
15
|
+
* Not to be confused with `ScreenModalFragment`, which *is* a
|
|
16
|
+
* `BottomSheetDialogFragment` and so does carry its own `Window`. It backs a
|
|
17
|
+
* different presentation, not the `formSheet` route above. A toast raised from
|
|
18
|
+
* something hosted in a real `Dialog` — that fragment, or React Native's own
|
|
19
|
+
* `Modal` — would still be behind it, and `elevation` cannot cross windows.
|
|
20
|
+
* Untested, and left alone: `FullWindowOverlay` is iOS-only (elsewhere it warns
|
|
21
|
+
* and renders a plain `View`), so the remedy there would be to own a window
|
|
22
|
+
* too, via a React Native `Modal`, which brings its own back-button and
|
|
23
|
+
* touch-capture behaviour.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ToastOverlay({ children }: {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=ToastOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastOverlay.d.ts","sourceRoot":"","sources":["../../../../../../src/components/toast/parts/ToastOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAEjE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Lifts the toast viewport into a window of its own, above every presented
|
|
4
|
+
* view controller.
|
|
5
|
+
*
|
|
6
|
+
* Without this, a toast raised from a screen presented as `modal` or
|
|
7
|
+
* `formSheet` is invisible. `ToastProvider` sits above the app's navigator, so
|
|
8
|
+
* its viewport belongs to the root view controller's view; UIKit presents a
|
|
9
|
+
* sheet as a *separate* view controller on top of that one. They are different
|
|
10
|
+
* presentation layers, so no `zIndex` or `elevation` can lift the viewport over
|
|
11
|
+
* the sheet — the toast is mounted and animating, just underneath. The reader
|
|
12
|
+
* presses something, the app reports the result, and nothing appears.
|
|
13
|
+
*
|
|
14
|
+
* `FullWindowOverlay` hosts its children in its own `UIWindow`, which sits
|
|
15
|
+
* above presented controllers, so the viewport paints over a sheet the same way
|
|
16
|
+
* it paints over an ordinary screen.
|
|
17
|
+
*
|
|
18
|
+
* It covers the whole window, but it does not swallow the app's touches:
|
|
19
|
+
* `RNSFullWindowOverlay`'s `pointInside:` walks its subviews and answers NO
|
|
20
|
+
* anywhere they are not, so presses fall through to whatever is underneath.
|
|
21
|
+
*
|
|
22
|
+
* Mounted only alongside a non-empty viewport — `ToastViewport` returns `null`
|
|
23
|
+
* before reaching this — so an idle app carries no extra window.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ToastOverlay({ children }: {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=ToastOverlay.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastOverlay.ios.d.ts","sourceRoot":"","sources":["../../../../../../src/components/toast/parts/ToastOverlay.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAEjE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToastItem, ToastManager, ToastPlacement, ToastProviderProps } from "../types.js";
|
|
2
|
+
interface ToastViewportProps {
|
|
3
|
+
placement: ToastPlacement;
|
|
4
|
+
toasts: ToastItem[];
|
|
5
|
+
manager: ToastManager;
|
|
6
|
+
maxVisibleToasts: number;
|
|
7
|
+
offset?: ToastProviderProps["offset"];
|
|
8
|
+
}
|
|
9
|
+
export declare function ToastViewport({ placement, toasts, manager, maxVisibleToasts, offset }: ToastViewportProps): import("react").JSX.Element | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ToastViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastViewport.d.ts","sourceRoot":"","sources":["../../../../../../src/components/toast/parts/ToastViewport.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAW,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAU,CAAC;AAIrG,UAAU,kBAAkB;IAC1B,SAAS,EAAE,cAAc,CAAC;IAC1B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,kBAAkB,sCAqFzG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Children, type ComponentRef, createContext, forwardRef, type ReactNode, useContext } from "react";
|
|
2
|
-
import type { PressableProps } from "react-native";
|
|
3
|
-
import { Pressable } from "react-native";
|
|
2
|
+
import type { Pressable, PressableProps, PressableStateCallbackType } from "react-native";
|
|
4
3
|
|
|
5
4
|
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
6
5
|
|
|
@@ -9,12 +8,17 @@ import type { ColorToken, FontWeightToken, TerraIconName, TerraTheme, TextVarian
|
|
|
9
8
|
import { readableOn } from "#utils/color-utils";
|
|
10
9
|
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
11
10
|
import { Icon } from "../icon";
|
|
11
|
+
import { PressableScale } from "../pressable";
|
|
12
12
|
import { Spinner } from "../spinner";
|
|
13
13
|
import { Text } from "../text";
|
|
14
14
|
|
|
15
15
|
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
16
16
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
17
17
|
export type ButtonRadius = "none" | "sm" | "md" | "lg" | "xl" | "full";
|
|
18
|
+
export type ButtonAnimation = "scale" | "opacity" | "none";
|
|
19
|
+
|
|
20
|
+
/** Matches pressto's `minScale` default — enough to feel, not enough to distract. */
|
|
21
|
+
const PRESSED_SCALE = 0.96;
|
|
18
22
|
|
|
19
23
|
export interface ButtonProps extends Omit<PressableProps, "style" | "children" | "disabled"> {
|
|
20
24
|
variant?: ButtonVariant;
|
|
@@ -31,6 +35,12 @@ export interface ButtonProps extends Omit<PressableProps, "style" | "children" |
|
|
|
31
35
|
fullWidth?: boolean;
|
|
32
36
|
/** Remove the button's built-in horizontal padding. */
|
|
33
37
|
compact?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Press feedback. `'scale'` shrinks the button to 0.96, `'opacity'` dims it
|
|
40
|
+
* to `opacity.pressed`, `'none'` leaves it static. The two are mutually
|
|
41
|
+
* exclusive. Defaults to `'scale'`.
|
|
42
|
+
*/
|
|
43
|
+
animation?: ButtonAnimation;
|
|
34
44
|
/**
|
|
35
45
|
* Overrides the variant's resolved background color (theme token or raw
|
|
36
46
|
* CSS color). The label/icon/spinner foreground automatically switches to
|
|
@@ -182,6 +192,7 @@ const ButtonRoot = forwardRef<ComponentRef<typeof Pressable>, ButtonProps>(funct
|
|
|
182
192
|
isIconOnly = false,
|
|
183
193
|
fullWidth = true,
|
|
184
194
|
compact = false,
|
|
195
|
+
animation = "scale",
|
|
185
196
|
background,
|
|
186
197
|
children,
|
|
187
198
|
onPress,
|
|
@@ -206,27 +217,35 @@ const ButtonRoot = forwardRef<ComponentRef<typeof Pressable>, ButtonProps>(funct
|
|
|
206
217
|
style?: PressableProps["style"];
|
|
207
218
|
};
|
|
208
219
|
|
|
220
|
+
const ownStyles = [
|
|
221
|
+
styles.base,
|
|
222
|
+
{ backgroundColor: bg, borderColor: border, borderWidth },
|
|
223
|
+
compact ? styles.compact : null,
|
|
224
|
+
isDisabled ? { opacity: theme.opacity.disabled } : null,
|
|
225
|
+
];
|
|
226
|
+
// Only the function form forces a re-render per touch, so keep the array form
|
|
227
|
+
// whenever the caller's style doesn't need the pressed state.
|
|
228
|
+
const style =
|
|
229
|
+
typeof externalStyle === "function"
|
|
230
|
+
? (state: PressableStateCallbackType) => [...ownStyles, externalStyle(state)]
|
|
231
|
+
: [...ownStyles, externalStyle];
|
|
232
|
+
|
|
209
233
|
return (
|
|
210
234
|
<ButtonContext.Provider value={{ color: fg, size }}>
|
|
211
|
-
<
|
|
235
|
+
<PressableScale
|
|
212
236
|
ref={ref}
|
|
213
237
|
onPress={blocked ? undefined : onPress}
|
|
214
|
-
|
|
238
|
+
isDisabled={blocked}
|
|
239
|
+
minScale={animation === "scale" ? PRESSED_SCALE : 1}
|
|
240
|
+
pressedOpacity={animation === "opacity" ? theme.opacity.pressed : undefined}
|
|
215
241
|
accessibilityRole="button"
|
|
216
242
|
accessibilityState={{ disabled: blocked, busy: isLoading }}
|
|
217
243
|
{...pressableRest}
|
|
218
|
-
style={
|
|
219
|
-
styles.base,
|
|
220
|
-
{ backgroundColor: bg, borderColor: border, borderWidth },
|
|
221
|
-
compact ? styles.compact : null,
|
|
222
|
-
state.pressed && !blocked ? { opacity: theme.opacity.pressed } : null,
|
|
223
|
-
isDisabled ? { opacity: theme.opacity.disabled } : null,
|
|
224
|
-
typeof externalStyle === "function" ? externalStyle(state) : externalStyle,
|
|
225
|
-
]}
|
|
244
|
+
style={style}
|
|
226
245
|
>
|
|
227
246
|
{isLoading && <Spinner size="sm" color={fg} />}
|
|
228
247
|
{renderChildren(children)}
|
|
229
|
-
</
|
|
248
|
+
</PressableScale>
|
|
230
249
|
</ButtonContext.Provider>
|
|
231
250
|
);
|
|
232
251
|
});
|