@swan-io/lake 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -5
- package/src/components/AppOpeningAnimation.js +13 -13
- package/src/components/AutoWidthImage.d.ts +1 -0
- package/src/components/AutoWidthImage.js +3 -4
- package/src/components/Avatar.js +3 -2
- package/src/components/BorderedButton.d.ts +1 -1
- package/src/components/BorderedButton.js +6 -4
- package/src/components/BottomPanel.js +2 -2
- package/src/components/Box.js +1 -1
- package/src/components/Breadcrumbs.js +7 -7
- package/src/components/ChoicePicker.js +6 -6
- package/src/components/Fill.js +2 -1
- package/src/components/FilterChooser.js +2 -2
- package/src/components/Filters.js +9 -9
- package/src/components/FixedListView.js +15 -12
- package/src/components/FixedListViewCells.js +2 -2
- package/src/components/Form.d.ts +1 -1
- package/src/components/FullViewportLayer.js +10 -7
- package/src/components/Heading.d.ts +1 -1
- package/src/components/Heading.js +1 -1
- package/src/components/Icon.d.ts +2 -4
- package/src/components/Icon.js +7 -1
- package/src/components/Input.d.ts +6 -6
- package/src/components/Input.js +5 -10
- package/src/components/Label.d.ts +1 -1
- package/src/components/Label.js +1 -1
- package/src/components/LakeButton.d.ts +3 -3
- package/src/components/LakeButton.js +4 -4
- package/src/components/LakeCheckbox.js +2 -2
- package/src/components/LakeCombobox.d.ts +2 -2
- package/src/components/LakeCombobox.js +6 -10
- package/src/components/LakeDownloadButton.js +1 -1
- package/src/components/LakeHeading.d.ts +3 -2
- package/src/components/LakeHeading.js +7 -1
- package/src/components/LakeLabel.d.ts +0 -1
- package/src/components/LakeLabel.js +3 -3
- package/src/components/LakeModal.js +6 -3
- package/src/components/LakeRadio.js +3 -3
- package/src/components/LakeScrollView.js +2 -1
- package/src/components/LakeSearchField.js +3 -3
- package/src/components/LakeSelect.d.ts +2 -2
- package/src/components/LakeSelect.js +14 -23
- package/src/components/LakeSlider.js +1 -1
- package/src/components/LakeStepper.js +4 -4
- package/src/components/LakeText.d.ts +9 -8
- package/src/components/LakeText.js +7 -1
- package/src/components/LakeTextInput.d.ts +10 -5
- package/src/components/LakeTextInput.js +4 -4
- package/src/components/LakeTooltip.js +7 -12
- package/src/components/Link.d.ts +52 -49
- package/src/components/Link.js +2 -2
- package/src/components/ListRightPanel.js +2 -2
- package/src/components/Modal.js +15 -5
- package/src/components/MultiSelect.d.ts +1 -1
- package/src/components/MultiSelect.js +9 -6
- package/src/components/PlainListView.js +4 -3
- package/src/components/Popover.js +9 -5
- package/src/components/Portal.js +2 -2
- package/src/components/Pressable.d.ts +112 -101
- package/src/components/Pressable.js +16 -6
- package/src/components/RightPanel.js +10 -7
- package/src/components/Separator.js +1 -1
- package/src/components/SidebarNavigationTracker.js +4 -3
- package/src/components/Slider.js +28 -12
- package/src/components/SmsOpeningAnimation.js +15 -15
- package/src/components/Stack.d.ts +4 -4
- package/src/components/Stack.js +1 -1
- package/src/components/Stepper.js +1 -1
- package/src/components/Svg.d.ts +6 -7
- package/src/components/Switch.js +18 -6
- package/src/components/TabView.js +8 -7
- package/src/components/Tag.d.ts +2 -2
- package/src/components/Tag.js +6 -3
- package/src/components/Tile.js +2 -2
- package/src/components/ToastStack.js +16 -7
- package/src/components/Tooltip.js +3 -6
- package/src/components/TransitionGroupView.d.ts +2 -3
- package/src/components/TransitionGroupView.js +2 -2
- package/src/components/TransitionView.d.ts +2 -3
- package/src/components/TransitionView.js +2 -2
- package/src/components/WithCurrentColor.d.ts +1 -1
- package/src/constants/design.d.ts +4 -12
- package/src/constants/design.js +12 -12
- package/src/hooks/useAnimatedValue.js +9 -2
- package/src/hooks/useForceableState.js +1 -1
- package/src/hooks/useHover.js +1 -1
- package/src/hooks/useMergeRefs.js +1 -1
- package/src/hooks/usePressEvents.js +1 -1
- package/src/components/Alert.d.ts +0 -10
- package/src/components/Alert.js +0 -36
- package/src/components/Button.d.ts +0 -15
- package/src/components/Button.js +0 -83
- package/src/components/Checkbox.d.ts +0 -12
- package/src/components/Checkbox.js +0 -83
- package/src/components/Combobox.d.ts +0 -29
- package/src/components/Combobox.js +0 -182
- package/src/components/MultilineInput.d.ts +0 -15
- package/src/components/MultilineInput.js +0 -55
- package/src/components/Picker.d.ts +0 -26
- package/src/components/Picker.js +0 -116
- package/src/components/ProgressBar.d.ts +0 -11
- package/src/components/ProgressBar.js +0 -46
- package/src/components/SegmentedControl.d.ts +0 -19
- package/src/components/SegmentedControl.js +0 -74
- package/src/components/Table.d.ts +0 -34
- package/src/components/Table.js +0 -79
- package/src/hooks/useLazyRef.d.ts +0 -2
- package/src/hooks/useLazyRef.js +0 -9
package/src/components/Slider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useEffect, useRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { PanResponder, StyleSheet, View } from "react-native";
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
5
|
import { colors } from "../constants/colors";
|
|
6
6
|
import { useAnimatedValue } from "../hooks/useAnimatedValue";
|
|
@@ -51,16 +51,32 @@ export const Slider = memo(({ value, step, minimum, maximum, disabled = false, o
|
|
|
51
51
|
const interacting = useRef(false);
|
|
52
52
|
const left = useRef(0);
|
|
53
53
|
const width = useRef(0);
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const animation = useAnimatedValue(value);
|
|
55
|
+
const barRef = useRef(null);
|
|
56
|
+
const buttonRef = useRef(null);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const interpolateValue = interpolate({
|
|
59
|
+
inputRange: [minimum, maximum],
|
|
60
|
+
clamp: true,
|
|
61
|
+
outputRange: [0, 100],
|
|
62
|
+
});
|
|
63
|
+
const id = animation.addListener(({ value }) => {
|
|
64
|
+
const interpolated = interpolateValue(value);
|
|
65
|
+
if (barRef.current instanceof HTMLElement) {
|
|
66
|
+
barRef.current.style.transform = `scaleX(${interpolated})`;
|
|
67
|
+
}
|
|
68
|
+
if (buttonRef.current instanceof HTMLElement) {
|
|
69
|
+
buttonRef.current.style.left = `${interpolated}%`;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return () => {
|
|
73
|
+
animation.removeListener(id);
|
|
74
|
+
};
|
|
75
|
+
}, [animation, minimum, maximum]);
|
|
60
76
|
// Update position on value change
|
|
61
77
|
useEffect(() => {
|
|
62
|
-
!interacting.current &&
|
|
63
|
-
}, [
|
|
78
|
+
!interacting.current && animation.setValue(value);
|
|
79
|
+
}, [animation, value]);
|
|
64
80
|
// Update disabled ref for pan responder
|
|
65
81
|
useEffect(() => {
|
|
66
82
|
disabledRef.current = disabled;
|
|
@@ -95,7 +111,7 @@ export const Slider = memo(({ value, step, minimum, maximum, disabled = false, o
|
|
|
95
111
|
width: width.current,
|
|
96
112
|
});
|
|
97
113
|
onValueChange(nextValue);
|
|
98
|
-
|
|
114
|
+
animation.setValue(nextValue);
|
|
99
115
|
}
|
|
100
116
|
},
|
|
101
117
|
onPanResponderRelease: event => {
|
|
@@ -111,9 +127,9 @@ export const Slider = memo(({ value, step, minimum, maximum, disabled = false, o
|
|
|
111
127
|
width: width.current,
|
|
112
128
|
});
|
|
113
129
|
onValueChange(nextValue);
|
|
114
|
-
|
|
130
|
+
animation.setValue(nextValue);
|
|
115
131
|
}
|
|
116
132
|
},
|
|
117
133
|
})).current;
|
|
118
|
-
return (_jsxs(View, {
|
|
134
|
+
return (_jsxs(View, { tabIndex: disabled ? -1 : 0, style: [styles.container, disabled && styles.disabled], onLayout: handleLayout, onKeyDown: handleKeyDown, ...panResponder.panHandlers, children: [_jsx(View, { style: styles.bar, children: _jsx(View, { ref: barRef, style: styles.barFill }) }), _jsx(View, { ref: buttonRef, style: styles.button })] }));
|
|
119
135
|
});
|
|
@@ -7,11 +7,11 @@ const styles = StyleSheet.create({
|
|
|
7
7
|
circle: {
|
|
8
8
|
opacity: 0,
|
|
9
9
|
animationKeyframes: {
|
|
10
|
-
"0%": { opacity: 0, transform:
|
|
11
|
-
"30%": { opacity: 0, transform:
|
|
10
|
+
"0%": { opacity: 0, transform: "scale(0.4)" },
|
|
11
|
+
"30%": { opacity: 0, transform: "scale(0.4)" },
|
|
12
12
|
"40%": { opacity: 1 },
|
|
13
|
-
"75%": { opacity: 0, transform:
|
|
14
|
-
"100%": { opacity: 0, transform:
|
|
13
|
+
"75%": { opacity: 0, transform: "scale(1.5)" },
|
|
14
|
+
"100%": { opacity: 0, transform: "scale(1.5)" },
|
|
15
15
|
},
|
|
16
16
|
animationDuration: "5000ms",
|
|
17
17
|
animationTimingFunction: "ease-in-out",
|
|
@@ -19,11 +19,11 @@ const styles = StyleSheet.create({
|
|
|
19
19
|
},
|
|
20
20
|
icon: {
|
|
21
21
|
animationKeyframes: {
|
|
22
|
-
"0%": { opacity: 0, transform:
|
|
23
|
-
"10%": { opacity: 1, transform:
|
|
24
|
-
"25%": { transform:
|
|
25
|
-
"35%": { transform:
|
|
26
|
-
"100%": { opacity: 1, transform:
|
|
22
|
+
"0%": { opacity: 0, transform: "translateY(-20px) scale(1)" },
|
|
23
|
+
"10%": { opacity: 1, transform: "scale(1)" },
|
|
24
|
+
"25%": { transform: "scale(1)" },
|
|
25
|
+
"35%": { transform: "translateY(60px) scale(10)" },
|
|
26
|
+
"100%": { opacity: 1, transform: "translateY(60px) scale(10)" },
|
|
27
27
|
},
|
|
28
28
|
animationDuration: "5000ms",
|
|
29
29
|
animationTimingFunction: "ease-in-out",
|
|
@@ -31,11 +31,11 @@ const styles = StyleSheet.create({
|
|
|
31
31
|
},
|
|
32
32
|
logo: {
|
|
33
33
|
animationKeyframes: {
|
|
34
|
-
"0%": { opacity: 0, transform:
|
|
35
|
-
"10%": { opacity: 1, transform:
|
|
36
|
-
"25%": { transform:
|
|
37
|
-
"35%": { transform:
|
|
38
|
-
"100%": { opacity: 1, transform:
|
|
34
|
+
"0%": { opacity: 0, transform: "translateY(-20px) scale(1)" },
|
|
35
|
+
"10%": { opacity: 1, transform: "translateY(0px) scale(1)" },
|
|
36
|
+
"25%": { transform: "translateY(0px) scale(1)" },
|
|
37
|
+
"35%": { transform: "translateY(270px) scale(2)" },
|
|
38
|
+
"100%": { opacity: 1, transform: "translateY(270px) scale(2)" },
|
|
39
39
|
},
|
|
40
40
|
animationDuration: "5000ms",
|
|
41
41
|
animationTimingFunction: "ease-in-out",
|
|
@@ -48,5 +48,5 @@ export const SmsOpeningAnimation = ({ playing = true, style }) => {
|
|
|
48
48
|
animationPlayState: playing ? "running" : "paused",
|
|
49
49
|
};
|
|
50
50
|
}, [playing]);
|
|
51
|
-
return (_jsxs(Svg, { viewBox: "0 0 442 860", style: style, children: [_jsxs(Mask, {
|
|
51
|
+
return (_jsxs(Svg, { viewBox: "0 0 442 860", style: style, children: [_jsxs(Mask, { id: "phoneScreen", children: [_jsx(Rect, { x: 0, y: 0, width: 442, height: 860, fill: "#000" }), _jsx(Rect, { fill: "#fff", x: 25, y: 21, width: 392, height: 817, rx: 45 })] }), _jsxs(G, { children: [_jsx(Rect, { fill: colors.swan[400], x: 25, y: 21, width: 392, height: 817, rx: 45 }), _jsx(G, { mask: "url(#phoneScreen)", children: _jsx(Rect, { fill: backgroundColor.default, fillRule: "nonzero", x: 43, y: 80, width: 355, height: 149, rx: 32, style: [styles.icon, animationStyle], "transform-origin": "221.2 150" }) }), _jsx(Path, { d: "M221.000028,125 C237.569013,125 251,138.429348 251,154.996311 C251,171.563274 237.569013,184.992622 221.000028,184.992622 C216.146713,184.999037 211.364882,183.823286 207.068041,181.567043 L194.198053,184.917631 C193.323041,185.145499 192.392776,184.893009 191.7531,184.254027 C191.113423,183.615046 190.860005,182.685139 191.087056,181.810013 L194.435053,168.944596 C192.172455,164.643731 190.993369,159.855888 191.000028,154.996311 C191.000028,138.429348 204.431044,125 221.000028,125 Z M224.756025,157.995942 L211.250037,157.995942 L210.944038,158.01694 C209.830402,158.170147 209.00073,159.121675 209.00073,160.245665 C209.00073,161.369656 209.830402,162.321184 210.944038,162.474391 L211.250037,162.495389 L224.756025,162.495389 L225.059024,162.474391 C226.17266,162.321184 227.002332,161.369656 227.002332,160.245665 C227.002332,159.121675 226.17266,158.170147 225.059024,158.01694 L224.756025,157.995942 Z M230.750019,147.497233 L211.250037,147.497233 L210.944038,147.518231 C209.830402,147.671438 209.00073,148.622966 209.00073,149.746957 C209.00073,150.870947 209.830402,151.822475 210.944038,151.975683 L211.250037,151.99668 L230.750019,151.99668 L231.056019,151.975683 C232.169654,151.822475 232.999327,150.870947 232.999327,149.746957 C232.999327,148.622966 232.169654,147.671438 231.056019,147.518231 L230.750019,147.497233 Z", fill: colors.swan[400], fillRule: "nonzero", style: [styles.logo, animationStyle], "transform-origin": "221.2 150" }), _jsx(Circle, { stroke: colors.swan[100], strokeWidth: 2, cx: 219.5, cy: 439.5, r: 157.5, fill: "none", style: [styles.circle, animationStyle], "transform-origin": "219.5 439.5" }), _jsx(Path, { d: "M369 0a67.998 67.998 0 0168 68v177c1.326 0 2.598.527 3.536 1.464A5.004 5.004 0 01442 250v96a5.004 5.004 0 01-1.464 3.536A5.004 5.004 0 01437 351v441a67.996 67.996 0 01-19.917 48.083A67.996 67.996 0 01369 860H71a67.998 67.998 0 01-68-68V365.6a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-16.8a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-30.8a5 5 0 01-3-4.6v-24a5.002 5.002 0 013-4.6V68A68 68 0 0171 0h298zm0 21H71a46 46 0 00-46 45.2V792a45.999 45.999 0 0045.2 46H369a46 46 0 0046-45.2V67a45.998 45.998 0 00-46-46z", fill: "#000" })] })] }));
|
|
52
52
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
export declare const Stack: import("react").ForwardRefExoticComponent<import("react-native").ViewProps & {
|
|
4
|
-
alignItems?: ("
|
|
4
|
+
alignItems?: ("end" | "start" | "center" | "stretch" | "baseline") | undefined;
|
|
5
5
|
children?: import("react").ReactNode;
|
|
6
|
-
direction?: ("
|
|
7
|
-
justifyContent?: ("
|
|
6
|
+
direction?: ("row" | "column" | "columnReverse" | "rowReverse") | undefined;
|
|
7
|
+
justifyContent?: ("end" | "start" | "normal" | "center" | "spaceBetween" | "spaceAround" | "spaceEvenly") | undefined;
|
|
8
8
|
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
9
9
|
} & {
|
|
10
|
-
space?:
|
|
10
|
+
space?: 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 72 | 96 | undefined;
|
|
11
11
|
wrap?: boolean | undefined;
|
|
12
12
|
} & import("react").RefAttributes<View>>;
|
package/src/components/Stack.js
CHANGED
|
@@ -10,7 +10,7 @@ const styles = StyleSheet.create({
|
|
|
10
10
|
},
|
|
11
11
|
});
|
|
12
12
|
export const Stack = forwardRef(
|
|
13
|
-
// Default <View /> styles https://github.com/necolas/react-native-web/blob/0.
|
|
13
|
+
// Default <View /> styles https://github.com/necolas/react-native-web/blob/0.19.1/packages/react-native-web/src/exports/View/index.js#L146
|
|
14
14
|
({ children, space, wrap = false, ...props }, forwardedRef) => {
|
|
15
15
|
const { direction = "column" } = props;
|
|
16
16
|
const horizontal = direction === "row" || direction === "rowReverse";
|
package/src/components/Svg.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ type ChildrenProp = {
|
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
};
|
|
6
6
|
type FillRule = "evenodd" | "nonzero";
|
|
7
|
-
type CommonProps = Pick<ViewProps, "
|
|
7
|
+
type CommonProps = Pick<ViewProps, "id" | "role" | "style" | "tabIndex" | "testID"> & ChildrenProp;
|
|
8
8
|
type SvgProps = CommonProps & {
|
|
9
9
|
height?: number;
|
|
10
10
|
title?: string;
|
|
@@ -111,17 +111,16 @@ type TspanProps = CommonProps & {
|
|
|
111
111
|
y?: number;
|
|
112
112
|
};
|
|
113
113
|
export declare const Svg: ({ style, ...props }: SvgProps) => import("react").ReactElement<{
|
|
114
|
-
style: (
|
|
114
|
+
style: ({
|
|
115
115
|
display: "flex";
|
|
116
116
|
flexBasis: string;
|
|
117
117
|
flexGrow: number;
|
|
118
118
|
flexShrink: number;
|
|
119
|
-
})[];
|
|
119
|
+
} | import("react-native").StyleProp<import("react-native").ViewStyle>)[];
|
|
120
120
|
testID?: string | undefined;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
focusable?: boolean | undefined;
|
|
121
|
+
id?: string | undefined;
|
|
122
|
+
role?: import("react-native").WebRole | undefined;
|
|
123
|
+
tabIndex?: 0 | -1 | undefined;
|
|
125
124
|
children?: ReactNode;
|
|
126
125
|
height?: number | undefined;
|
|
127
126
|
title?: string | undefined;
|
package/src/components/Switch.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, memo, useEffect } from "react";
|
|
2
|
+
import { forwardRef, memo, useEffect, useRef } from "react";
|
|
3
3
|
import { Animated, Pressable, StyleSheet, View } from "react-native";
|
|
4
4
|
import { backgroundColor, colors, shadows } from "../constants/design";
|
|
5
5
|
import { useAnimatedValue } from "../hooks/useAnimatedValue";
|
|
6
|
+
import { interpolate } from "../utils/math";
|
|
6
7
|
import { Icon } from "./Icon";
|
|
7
8
|
const WIDTH = 36;
|
|
8
9
|
const BUTTON_SIZE = 16;
|
|
@@ -58,6 +59,21 @@ const styles = StyleSheet.create({
|
|
|
58
59
|
export const Switch = memo(forwardRef(({ value, disabled = false, onValueChange }, ref) => {
|
|
59
60
|
const animatedValue = value ? 1 : 0;
|
|
60
61
|
const animation = useAnimatedValue(animatedValue);
|
|
62
|
+
const buttonRef = useRef(null);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const interpolateValue = interpolate({
|
|
65
|
+
inputRange: [0, 1],
|
|
66
|
+
outputRange: [PADDING, WIDTH - BUTTON_SIZE - PADDING],
|
|
67
|
+
});
|
|
68
|
+
const id = animation.addListener(({ value }) => {
|
|
69
|
+
if (buttonRef.current instanceof HTMLElement) {
|
|
70
|
+
buttonRef.current.style.transform = `translateX(${interpolateValue(value)}px)`;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return () => {
|
|
74
|
+
animation.removeListener(id);
|
|
75
|
+
};
|
|
76
|
+
}, [animation]);
|
|
61
77
|
useEffect(() => {
|
|
62
78
|
Animated.spring(animation, {
|
|
63
79
|
bounciness: 6,
|
|
@@ -66,9 +82,5 @@ export const Switch = memo(forwardRef(({ value, disabled = false, onValueChange
|
|
|
66
82
|
useNativeDriver: false,
|
|
67
83
|
}).start();
|
|
68
84
|
}, [animation, animatedValue]);
|
|
69
|
-
|
|
70
|
-
inputRange: [0, 1],
|
|
71
|
-
outputRange: [PADDING, WIDTH - BUTTON_SIZE - PADDING],
|
|
72
|
-
});
|
|
73
|
-
return (_jsx(Pressable, { ref: ref, accessibilityRole: "switch", disabled: disabled, onPress: () => onValueChange?.(!value), children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.shadow, hovered && styles.opaque] }), _jsx(View, { style: [styles.base, value && styles.active, disabled && styles.disabled], children: _jsx(Animated.View, { style: [styles.button, { transform: [{ translateX }] }], children: _jsx(Icon, { color: colors.positive[400], name: "checkmark-filled", size: 10, style: [styles.icon, value && styles.opaque] }) }) })] })) }));
|
|
85
|
+
return (_jsx(Pressable, { ref: ref, role: "switch", disabled: disabled, onPress: () => onValueChange?.(!value), children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.shadow, hovered && styles.opaque] }), _jsx(View, { style: [styles.base, value && styles.active, disabled && styles.disabled], children: _jsx(View, { ref: buttonRef, style: styles.button, children: _jsx(Icon, { color: colors.positive[400], name: "checkmark-filled", size: 10, style: [styles.icon, value && styles.opaque] }) }) })] })) }));
|
|
74
86
|
}));
|
|
@@ -62,6 +62,7 @@ const styles = StyleSheet.create({
|
|
|
62
62
|
flexDirection: "row",
|
|
63
63
|
alignItems: "flex-end",
|
|
64
64
|
overflow: "hidden",
|
|
65
|
+
pointerEvents: "none",
|
|
65
66
|
},
|
|
66
67
|
count: {
|
|
67
68
|
...texts.smallRegular,
|
|
@@ -126,8 +127,8 @@ const Dropdown = ({ tabs, onHoverStart, onHoverEnd, onLinkFocus, onLinkBlur, onL
|
|
|
126
127
|
onHoverStart,
|
|
127
128
|
onHoverEnd,
|
|
128
129
|
});
|
|
129
|
-
return (_jsx(View, {
|
|
130
|
-
return (_jsx(Link, { to: url, onFocus: onLinkFocus, onBlur: onLinkBlur, onPress: onLinkPress,
|
|
130
|
+
return (_jsx(View, { role: "menu", style: styles.dropdown, ref: containerRef, children: tabs.map(({ url, label }) => {
|
|
131
|
+
return (_jsx(Link, { to: url, onFocus: onLinkFocus, onBlur: onLinkBlur, onPress: onLinkPress, role: "menuitem", ariaCurrentValue: "location", style: ({ active, hovered }) => [
|
|
131
132
|
styles.dropdownLink,
|
|
132
133
|
active && styles.dropdownLinkTextActive,
|
|
133
134
|
hovered && styles.dropdownLinkTextHovered,
|
|
@@ -251,7 +252,7 @@ const DropdownItems = forwardRef(({ tabs, otherLabel, currentUrl }, ref) => {
|
|
|
251
252
|
});
|
|
252
253
|
const mergedRef = useMergeRefs(containerRef, ref);
|
|
253
254
|
const activeTab = tabs.find(({ url }) => url === currentUrl);
|
|
254
|
-
return (_jsxs(View, { style: styles.dropdownHandleContainer, ref: mergedRef, children: [_jsxs(PressableText, { ref: handleRef,
|
|
255
|
+
return (_jsxs(View, { style: styles.dropdownHandleContainer, ref: mergedRef, children: [_jsxs(PressableText, { ref: handleRef, role: "button", "aria-expanded": shouldOpen, "aria-haspopup": "true", onFocus: onHandleFocus, onBlur: onAnyBlur, onPress: onPress, style: ({ hovered }) => [
|
|
255
256
|
styles.link,
|
|
256
257
|
isNotNullish(activeTab) ? styles.activeLink : hovered ? styles.hoveredLink : null,
|
|
257
258
|
], children: [_jsx(Text, { children: otherLabel }), _jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: tabs.length }), _jsx(Space, { width: 4 }), _jsx(Icon, { name: "chevron-down-filled", size: 12 })] }), _jsx(TransitionView, { ...animations.fadeAndSlideInFromBottom, style: styles.dropdownPlacement, children: shouldOpen ? (_jsx(FocusTrap, { autoFocus: shouldAutoFocus, focusLock: shouldLockFocus, returnFocus: shouldLockFocus, onClickOutside: onPressOutside, onEscapeKey: shouldLockFocus ? onEscapeKey : undefined, children: _jsx(Dropdown, { tabs: tabs, onHoverStart: onHoverStart, onHoverEnd: onHoverEnd, onLinkFocus: onLinkFocus, onLinkBlur: onAnyBlur, onLinkPress: onEscapeKey }) })) : null })] }));
|
|
@@ -378,21 +379,21 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
378
379
|
if (tabs.length <= 1 && hideIfSingleItem) {
|
|
379
380
|
return null;
|
|
380
381
|
}
|
|
381
|
-
return (_jsxs(Box, { alignItems: "center", direction: "row",
|
|
382
|
+
return (_jsxs(Box, { alignItems: "center", direction: "row", role: "tablist", ref: containerRef, style: [styles.container, sticky && styles.sticky, { paddingHorizontal: padding }], children: [_jsxs(View, { style: styles.placeholder, "aria-hidden": true, ref: placeholderRef, onLayout: onLayout, children: [tabs.map(({ label, url, icon, count }) => (_jsxs(Fragment, { children: [_jsxs(Link, { ref: ref => {
|
|
382
383
|
if (placeholderLinkRef.current) {
|
|
383
384
|
placeholderLinkRef.current[url] = ref;
|
|
384
385
|
}
|
|
385
386
|
}, to: url, style: ({ active, hovered }) => [
|
|
386
387
|
styles.link,
|
|
387
388
|
active ? styles.activeLink : hovered ? styles.hoveredLink : null,
|
|
388
|
-
], children: [isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, url))), _jsxs(LakeText, { ref: otherPlaceholderRef, style: styles.link, children: [_jsx(Text, { children: otherLabel }), _jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: tabs.length }), _jsx(Space, { width: 4 }), _jsx(Icon, { name: "chevron-down-filled", size: 12 })] })] }), kept.map(({ label, url, icon, withSeparator, count }) => (_jsxs(Fragment, { children: [_jsxs(Link, {
|
|
389
|
+
], children: [isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, url))), _jsxs(LakeText, { ref: otherPlaceholderRef, style: styles.link, children: [_jsx(Text, { children: otherLabel }), _jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: tabs.length }), _jsx(Space, { width: 4 }), _jsx(Icon, { name: "chevron-down-filled", size: 12 })] })] }), kept.map(({ label, url, icon, withSeparator, count }) => (_jsxs(Fragment, { children: [_jsxs(Link, { role: "tab", ref: ref => {
|
|
389
390
|
if (linksRefs.current) {
|
|
390
391
|
linksRefs.current[url] = ref;
|
|
391
392
|
}
|
|
392
393
|
}, to: url, style: ({ active, hovered }) => [
|
|
393
394
|
styles.link,
|
|
394
395
|
active ? styles.activeLink : hovered ? styles.hoveredLink : null,
|
|
395
|
-
], children: [withSeparator === true && _jsx(View, { style: styles.separator,
|
|
396
|
+
], children: [withSeparator === true && _jsx(View, { style: styles.separator, role: "none" }), isNotNullish(icon) && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, size: 16, color: "currentColor" }), _jsx(Space, { width: 8 })] })), _jsx(Text, { children: label }), count != null ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), _jsx(Text, { style: styles.count, children: count })] })) : null] }), _jsx(Space, { width: 32 })] }, url))), collapsed.length > 0 ? (_jsx(DropdownItems, { ref: ref => {
|
|
396
397
|
collapsed.forEach(item => {
|
|
397
398
|
if (linksRefs.current) {
|
|
398
399
|
linksRefs.current[item.url] = ref;
|
|
@@ -401,6 +402,6 @@ export const TabView = ({ tabs, otherLabel, hideIfSingleItem = true, sticky = fa
|
|
|
401
402
|
}, tabs: collapsed, currentUrl: currentLocationURL, otherLabel: otherLabel })) : null, hasRendered && (_jsx(View, { style: [
|
|
402
403
|
styles.underline,
|
|
403
404
|
styles.animatedUnderline,
|
|
404
|
-
{ transform:
|
|
405
|
+
{ transform: `translateX(${left}px) scaleX(${width})` },
|
|
405
406
|
] }))] }));
|
|
406
407
|
};
|
package/src/components/Tag.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type Props = {
|
|
|
11
11
|
color?: ColorVariants;
|
|
12
12
|
onPressRemove?: () => void;
|
|
13
13
|
style?: StyleProp<ViewStyle>;
|
|
14
|
-
|
|
14
|
+
ariaLabel?: string;
|
|
15
15
|
};
|
|
16
|
-
export declare const Tag: ({ children, label, color, size, icon, iconSize,
|
|
16
|
+
export declare const Tag: ({ children, label, color, size, icon, iconSize, ariaLabel, onPressRemove, style, }: Props) => JSX.Element;
|
|
17
17
|
export {};
|
package/src/components/Tag.js
CHANGED
|
@@ -33,6 +33,9 @@ const styles = StyleSheet.create({
|
|
|
33
33
|
justifyContent: "center",
|
|
34
34
|
paddingHorizontal: 8,
|
|
35
35
|
},
|
|
36
|
+
unselectable: {
|
|
37
|
+
userSelect: "none",
|
|
38
|
+
},
|
|
36
39
|
dismiss: {
|
|
37
40
|
justifyContent: "center",
|
|
38
41
|
height: "100%",
|
|
@@ -40,7 +43,7 @@ const styles = StyleSheet.create({
|
|
|
40
43
|
borderLeftWidth: 1,
|
|
41
44
|
},
|
|
42
45
|
});
|
|
43
|
-
export const Tag = ({ children, label, color = "gray", size = "small", icon, iconSize = 16,
|
|
46
|
+
export const Tag = ({ children, label, color = "gray", size = "small", icon, iconSize = 16, ariaLabel, onPressRemove, style, }) => {
|
|
44
47
|
const hasRemoveButton = isNotNullish(onPressRemove);
|
|
45
48
|
const hasLabel = isNotNullishOrEmpty(label);
|
|
46
49
|
const hasOnlyIcon = isNullish(children) && isNotNullish(icon);
|
|
@@ -53,7 +56,7 @@ export const Tag = ({ children, label, color = "gray", size = "small", icon, ico
|
|
|
53
56
|
styles.label,
|
|
54
57
|
size === "large" && styles.larger,
|
|
55
58
|
{ backgroundColor: tint100, borderColor: tint200 },
|
|
56
|
-
], children: _jsx(Text, { numberOfLines: 1,
|
|
59
|
+
], children: _jsx(Text, { numberOfLines: 1, style: [styles.text, styles.unselectable, { color: primary }], children: label }) })), _jsxs(Box, { alignItems: "center", direction: "row", "aria-label": ariaLabel, style: [
|
|
57
60
|
styles.base,
|
|
58
61
|
size === "large" && styles.larger,
|
|
59
62
|
hasOnlyIcon && styles.onlyIcon,
|
|
@@ -67,7 +70,7 @@ export const Tag = ({ children, label, color = "gray", size = "small", icon, ico
|
|
|
67
70
|
}),
|
|
68
71
|
},
|
|
69
72
|
style,
|
|
70
|
-
], children: [_jsxs(Text, { numberOfLines: 1, style: [styles.text, hasOnlyIcon && styles.onlyIcon, { color: primary }], children: [icon && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, color: primary, size: iconSize }), isNotNullish(children) && _jsx(Space, { width: 8 })] })), children] }), hasRemoveButton && (_jsx(Pressable, {
|
|
73
|
+
], children: [_jsxs(Text, { numberOfLines: 1, style: [styles.text, hasOnlyIcon && styles.onlyIcon, { color: primary }], children: [icon && (_jsxs(_Fragment, { children: [_jsx(Icon, { name: icon, color: primary, size: iconSize }), isNotNullish(children) && _jsx(Space, { width: 8 })] })), children] }), hasRemoveButton && (_jsx(Pressable, { role: "button", onPress: onPressRemove, style: ({ hovered, pressed }) => [
|
|
71
74
|
styles.dismiss,
|
|
72
75
|
{ color: primary, borderColor: tint100 },
|
|
73
76
|
hovered && { backgroundColor: tint100 },
|
package/src/components/Tile.js
CHANGED
|
@@ -76,7 +76,7 @@ const styles = StyleSheet.create({
|
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
export const Tile = ({ icon, title, description, headerEnd, footer, flexBasis, children, numberOfLines, paddingVertical = 32, paddingHorizontal = 32, hovered = false, flexGrow = 0, flexShrink = 0, disabled = false, selected, style, }) => {
|
|
79
|
-
return (_jsxs(View, {
|
|
79
|
+
return (_jsxs(View, { role: "region", style: [
|
|
80
80
|
styles.container,
|
|
81
81
|
selected === false && styles.unselectedContainer,
|
|
82
82
|
{
|
|
@@ -90,7 +90,7 @@ export const Tile = ({ icon, title, description, headerEnd, footer, flexBasis, c
|
|
|
90
90
|
selected === false && hovered && styles.unselectedHoveredContainer,
|
|
91
91
|
disabled && styles.disabled,
|
|
92
92
|
style,
|
|
93
|
-
], children: [(isNotNullish(title) || isNotNullish(headerEnd) || isNotNullish(description)) && (_jsxs(View, { style: styles.headerContainer, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTitleIcon, children: [isNotNullish(icon) && (_jsxs(_Fragment, { children: [icon, _jsx(Space, { height: 12 })] })), isNotNullish(title) && (_jsx(Text, { style: styles.title,
|
|
93
|
+
], children: [(isNotNullish(title) || isNotNullish(headerEnd) || isNotNullish(description)) && (_jsxs(View, { style: styles.headerContainer, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTitleIcon, children: [isNotNullish(icon) && (_jsxs(_Fragment, { children: [icon, _jsx(Space, { height: 12 })] })), isNotNullish(title) && (_jsx(Text, { style: styles.title, role: "heading", "aria-level": 3, children: title }))] }), isNotNullish(headerEnd) ? _jsx(View, { children: headerEnd }) : null] }), isNotNullish(description) && (_jsxs(_Fragment, { children: [isNotNullish(title) && _jsx(Space, { height: 12 }), _jsx(View, { style: styles.descriptionContainer, children: _jsx(LakeText, { numberOfLines: numberOfLines, style: styles.description, children: description }) })] })), isNotNullish(children) && _jsx(Space, { height: 24 })] })), children, isNotNullish(footer) && (_jsx(View, { style: [styles.footer, { marginTop: paddingVertical, marginBottom: -paddingVertical }], children: footer }))] }));
|
|
94
94
|
};
|
|
95
95
|
export const TileFullWidthContent = ({ children, flexGrow, fitToBottom = false, }) => {
|
|
96
96
|
return (_jsx(View, { style: [styles.fullWidthContent, fitToBottom && styles.fitToBottom, { flexGrow }], children: children }));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useEffect, useState } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { memo, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { match } from "ts-pattern";
|
|
5
5
|
import { animations, colors, shadows } from "../constants/design";
|
|
6
6
|
import { hideToast, useToasts } from "../state/toasts";
|
|
7
|
+
import { isNullish } from "../utils/nullish";
|
|
7
8
|
import { Box } from "./Box";
|
|
8
9
|
import { Icon } from "./Icon";
|
|
9
10
|
import { LakeText } from "./LakeText";
|
|
@@ -53,12 +54,24 @@ const styles = StyleSheet.create({
|
|
|
53
54
|
},
|
|
54
55
|
});
|
|
55
56
|
const Toast = memo(({ variant, uid, title, description, progress, onClose }) => {
|
|
57
|
+
const progressBarRef = useRef(null);
|
|
56
58
|
const colorVariation = match(variant)
|
|
57
59
|
.with("success", () => "positive")
|
|
58
60
|
.with("error", () => "negative")
|
|
59
61
|
.with("info", () => "shakespear")
|
|
60
62
|
.with("warning", () => "warning")
|
|
61
63
|
.exhaustive();
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (isNullish(progress)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const id = progress.addListener(({ value }) => {
|
|
69
|
+
if (progressBarRef.current instanceof HTMLElement) {
|
|
70
|
+
progressBarRef.current.style.transform = `scaleX(${value})`;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return () => progress.removeListener(id);
|
|
74
|
+
}, [progress]);
|
|
62
75
|
return (_jsx(View, { style: styles.toastWrapper, children: _jsxs(View, { style: [
|
|
63
76
|
styles.toast,
|
|
64
77
|
{
|
|
@@ -71,11 +84,7 @@ const Toast = memo(({ variant, uid, title, description, progress, onClose }) =>
|
|
|
71
84
|
.with("error", () => (_jsx(Icon, { name: "dismiss-circle-regular", size: 20, color: colors[colorVariation][700] })))
|
|
72
85
|
.with("info", () => (_jsx(Icon, { name: "info-regular", size: 20, color: colors[colorVariation][700] })))
|
|
73
86
|
.with("warning", () => (_jsx(Icon, { name: "warning-regular", size: 20, color: colors[colorVariation][700] })))
|
|
74
|
-
.exhaustive(), _jsx(Space, { width: 12 }), _jsx(LakeText, { variant: "regular", color: colors[colorVariation][700], children: title })] }), description != null && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 8 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[700], children: description })] }))] }), _jsx(Pressable, { onPress: () => onClose(uid), style: styles.closeButton, children: _jsx(Icon, { name: "lake-close", size: 24, color: colors.gray[500] }) }), progress != null && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), _jsx(
|
|
75
|
-
styles.progressBar,
|
|
76
|
-
{ backgroundColor: colors[colorVariation][500] },
|
|
77
|
-
{ transform: [{ scaleX: progress }] },
|
|
78
|
-
] })] }))] }) }));
|
|
87
|
+
.exhaustive(), _jsx(Space, { width: 12 }), _jsx(LakeText, { variant: "regular", color: colors[colorVariation][700], children: title })] }), description != null && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 8 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[700], children: description })] }))] }), _jsx(Pressable, { onPress: () => onClose(uid), style: styles.closeButton, children: _jsx(Icon, { name: "lake-close", size: 24, color: colors.gray[500] }) }), progress != null && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), _jsx(View, { ref: progressBarRef, role: "progressbar", style: [styles.progressBar, { backgroundColor: colors[colorVariation][500] }] })] }))] }) }));
|
|
79
88
|
});
|
|
80
89
|
export const ToastStack = () => {
|
|
81
90
|
const toasts = useToasts();
|
|
@@ -59,7 +59,7 @@ const styles = StyleSheet.create({
|
|
|
59
59
|
backgroundColor: colors.white,
|
|
60
60
|
borderWidth: 1,
|
|
61
61
|
borderColor: colors.gray[10],
|
|
62
|
-
transform:
|
|
62
|
+
transform: "rotate(45deg)",
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
const isReactText = (node) => ["string", "number"].includes(typeof node);
|
|
@@ -148,15 +148,12 @@ export const Tooltip = memo(forwardRef(({ children, describedBy, matchReferenceW
|
|
|
148
148
|
styles.base,
|
|
149
149
|
state?.placement === "top" && styles.baseTop,
|
|
150
150
|
state?.placement === "bottom" && styles.baseBottom,
|
|
151
|
-
], children: [_jsx(View, { style: [styles.content, { width }], children: isReactText(children) ? _jsx(Text, { style: styles.text, children: children }) : children }), _jsx(View, {
|
|
151
|
+
], children: [_jsx(View, { style: [styles.content, { width }], children: isReactText(children) ? _jsx(Text, { style: styles.text, children: children }) : children }), _jsx(View, { role: "none", style: [
|
|
152
152
|
styles.arrowContainer,
|
|
153
153
|
state?.placement === "top" && styles.arrowContainerTop,
|
|
154
154
|
state?.placement === "bottom" && styles.arrowContainerBottom,
|
|
155
155
|
{
|
|
156
|
-
transform:
|
|
157
|
-
{ translateX: -overflowOffset },
|
|
158
|
-
{ rotate: state?.placement === "bottom" ? "180deg" : "0deg" },
|
|
159
|
-
],
|
|
156
|
+
transform: `translateX(${-overflowOffset}px) rotate(${state?.placement === "bottom" ? "180deg" : "0deg"})`,
|
|
160
157
|
},
|
|
161
158
|
], children: _jsx(View, { style: styles.arrow }) })] }) }) }));
|
|
162
159
|
}));
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { AnimationStyles, StyleProp,
|
|
2
|
+
import { AnimationStyles, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
type Props = {
|
|
4
4
|
enter?: AnimationStyles;
|
|
5
5
|
leave?: AnimationStyles;
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
7
|
childStyle?: StyleProp<ViewStyle>;
|
|
8
|
-
pointerEvents?: ViewProps["pointerEvents"];
|
|
9
8
|
children: ReactNode;
|
|
10
9
|
};
|
|
11
|
-
export declare const TransitionGroupView: ({ children, enter, leave, style, childStyle
|
|
10
|
+
export declare const TransitionGroupView: ({ children, enter, leave, style, childStyle }: Props) => JSX.Element;
|
|
12
11
|
export {};
|
|
@@ -5,7 +5,7 @@ import { View } from "react-native";
|
|
|
5
5
|
import { P, match } from "ts-pattern";
|
|
6
6
|
import { usePreviousValue } from "../hooks/usePreviousValue";
|
|
7
7
|
import { TransitionView } from "./TransitionView";
|
|
8
|
-
export const TransitionGroupView = ({ children, enter, leave, style, childStyle
|
|
8
|
+
export const TransitionGroupView = ({ children, enter, leave, style, childStyle }) => {
|
|
9
9
|
const leavingKeysAndIndicesRef = useRef([]);
|
|
10
10
|
const [, forceUpdate] = useReducer(() => [], []);
|
|
11
11
|
const onLeave = (key) => {
|
|
@@ -38,6 +38,6 @@ export const TransitionGroupView = ({ children, enter, leave, style, childStyle,
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
return (_jsx(View, { style: style, children: childrenToRender.map(({ key, child }) => {
|
|
41
|
-
return (_jsx(TransitionView, { enter: enter, leave: leave, style: childStyle,
|
|
41
|
+
return (_jsx(TransitionView, { enter: enter, leave: leave, style: childStyle, onLeave: () => onLeave(key), children: child }, key));
|
|
42
42
|
}) }));
|
|
43
43
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { AnimationStyles, StyleProp,
|
|
2
|
+
import { AnimationStyles, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
type Props = {
|
|
4
4
|
enter?: AnimationStyles;
|
|
5
5
|
leave?: AnimationStyles;
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
|
-
pointerEvents?: ViewProps["pointerEvents"];
|
|
8
7
|
children: ReactNode | null;
|
|
9
8
|
onLeave?: () => void;
|
|
10
9
|
};
|
|
11
|
-
export declare const TransitionView: ({ enter, leave, style, children,
|
|
10
|
+
export declare const TransitionView: ({ enter, leave, style, children, onLeave }: Props) => JSX.Element | null;
|
|
12
11
|
export {};
|
|
@@ -8,7 +8,7 @@ const styles = StyleSheet.create({
|
|
|
8
8
|
animationFillMode: "forwards",
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
|
-
export const TransitionView = ({ enter, leave, style, children,
|
|
11
|
+
export const TransitionView = ({ enter, leave, style, children, onLeave }) => {
|
|
12
12
|
const viewRef = useRef(null);
|
|
13
13
|
const childrenForLeaveAnimationRef = useRef(null);
|
|
14
14
|
const [, forceUpdate] = useReducer(() => [], []);
|
|
@@ -34,7 +34,7 @@ export const TransitionView = ({ enter, leave, style, children, pointerEvents, o
|
|
|
34
34
|
}
|
|
35
35
|
}, [children, leave, onLeave]);
|
|
36
36
|
const hasChildrenToDisplay = isNotNullish(children) || isNotNullish(childrenForLeaveAnimationRef.current);
|
|
37
|
-
return hasChildrenToDisplay ? (_jsx(View, {
|
|
37
|
+
return hasChildrenToDisplay ? (_jsx(View, { ref: viewRef, style: [
|
|
38
38
|
styles.base,
|
|
39
39
|
style,
|
|
40
40
|
enter,
|
|
@@ -6,7 +6,7 @@ type Props = {
|
|
|
6
6
|
style?: ViewProps["style"];
|
|
7
7
|
children: ReactElement;
|
|
8
8
|
};
|
|
9
|
-
export declare const CurrentColorContext: import("react").Context<"
|
|
9
|
+
export declare const CurrentColorContext: import("react").Context<"gray" | "live" | "sandbox" | "positive" | "warning" | "negative" | "current" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined>;
|
|
10
10
|
export declare const useCurrentColor: (containerRef: MutableRefObject<HTMLElement | null>, variant: ColorVariants | undefined) => void;
|
|
11
11
|
export declare const WithCurrentColor: ({ variant, style, children }: Props) => JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -135,24 +135,16 @@ export declare const animations: {
|
|
|
135
135
|
enter: {
|
|
136
136
|
animationKeyframes: {
|
|
137
137
|
"10%, 90%": {
|
|
138
|
-
transform:
|
|
139
|
-
translateX: number;
|
|
140
|
-
}[];
|
|
138
|
+
transform: string;
|
|
141
139
|
};
|
|
142
140
|
"20%, 80%": {
|
|
143
|
-
transform:
|
|
144
|
-
translateX: number;
|
|
145
|
-
}[];
|
|
141
|
+
transform: string;
|
|
146
142
|
};
|
|
147
143
|
"30%, 50%, 70%": {
|
|
148
|
-
transform:
|
|
149
|
-
translateX: number;
|
|
150
|
-
}[];
|
|
144
|
+
transform: string;
|
|
151
145
|
};
|
|
152
146
|
"40%, 60%": {
|
|
153
|
-
transform:
|
|
154
|
-
translateX: number;
|
|
155
|
-
}[];
|
|
147
|
+
transform: string;
|
|
156
148
|
};
|
|
157
149
|
}[];
|
|
158
150
|
animationDuration: string;
|