@hero-design/rn 7.17.0 → 7.18.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/.turbo/turbo-build.log +2 -2
- package/es/index.js +3712 -3473
- package/lib/index.js +3716 -3475
- package/package.json +2 -2
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +12 -12
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +18 -18
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +26 -26
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -3
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +1 -1
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -2
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/BottomNavigation/index.tsx +1 -1
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +2 -2
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/Button/UtilityButton/{styled.tsx → StyledUtilityButton.tsx} +2 -2
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
- package/src/components/Button/UtilityButton/index.tsx +5 -1
- package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +1 -1
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +69 -69
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +12 -12
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -1
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +6 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +13 -12
- package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +12 -12
- package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +99 -0
- package/src/components/Drawer/DragableDrawer/__tests__/helpers.spec.ts +39 -0
- package/src/components/Drawer/DragableDrawer/__tests__/index.spec.tsx +24 -0
- package/src/components/Drawer/DragableDrawer/helpers.ts +43 -0
- package/src/components/Drawer/DragableDrawer/index.tsx +205 -0
- package/src/components/Drawer/StyledDrawer.tsx +70 -26
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/Drawer/index.tsx +4 -1
- package/src/components/Empty/StyledEmpty.tsx +4 -3
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +4 -3
- package/src/components/Empty/index.tsx +2 -2
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +28 -28
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -2
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +3 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/List/ListItem.tsx +1 -1
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +3 -3
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +20 -20
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +6 -6
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +12 -12
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +4 -4
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +22 -22
- package/src/components/Progress/ProgressCircle.tsx +25 -22
- package/src/components/Progress/StyledProgressCircle.tsx +33 -28
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +102 -92
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +5 -5
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +6 -6
- package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +3 -3
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +11 -11
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -6
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +3 -3
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +42 -42
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +126 -121
- package/src/components/Select/MultiSelect/index.tsx +1 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +2 -2
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +36 -36
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +99 -94
- package/src/components/Select/SingleSelect/index.tsx +2 -6
- package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +2 -2
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +4 -4
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +8 -8
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
- package/src/components/Switch/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Tabs/ScrollableTabs.tsx +1 -1
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +8 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +85 -6
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +87 -8
- package/src/components/Tabs/__tests__/index.spec.tsx +8 -0
- package/src/components/Tabs/index.tsx +8 -3
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +9 -9
- package/src/components/TextInput/StyledTextInput.tsx +1 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +50 -50
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +100 -87
- package/src/components/TextInput/index.tsx +2 -2
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +6 -5
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +13 -12
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +22 -22
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -12
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +8 -8
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +13 -13
- package/src/index.ts +9 -1
- package/src/theme/ThemeProvider.ts +19 -0
- package/src/theme/ThemeSwitcher.tsx +27 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +161 -149
- package/src/theme/components/alert.ts +3 -3
- package/src/theme/components/badge.ts +1 -1
- package/src/theme/components/button.ts +9 -8
- package/src/theme/components/card.ts +4 -4
- package/src/theme/components/drawer.ts +14 -2
- package/src/theme/components/empty.ts +3 -2
- package/src/theme/components/list.ts +4 -4
- package/src/theme/components/pinInput.ts +2 -2
- package/src/theme/components/progress.ts +5 -5
- package/src/theme/components/toast.ts +3 -3
- package/src/theme/getTheme.ts +129 -0
- package/src/theme/global/colors/swag.ts +54 -0
- package/src/theme/global/colors/types.ts +45 -0
- package/src/theme/global/colors/work.ts +14 -0
- package/src/theme/global/index.ts +6 -2
- package/src/theme/index.ts +16 -143
- package/src/utils/scale.ts +4 -1
- package/types/components/Button/Button.d.ts +1 -0
- package/types/components/Button/UtilityButton/{styled.d.ts → StyledUtilityButton.d.ts} +0 -0
- package/types/components/Drawer/DragableDrawer/__tests__/helpers.spec.d.ts +1 -0
- package/types/components/Drawer/DragableDrawer/__tests__/index.spec.d.ts +1 -0
- package/types/components/Drawer/DragableDrawer/helpers.d.ts +8 -0
- package/types/components/Drawer/DragableDrawer/index.d.ts +33 -0
- package/types/components/Drawer/StyledDrawer.d.ts +34 -4
- package/types/components/Drawer/index.d.ts +4 -2
- package/types/components/Empty/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/Progress/StyledProgressCircle.d.ts +12 -6
- package/types/index.d.ts +2 -2
- package/types/theme/ThemeProvider.d.ts +12 -0
- package/types/theme/ThemeSwitcher.d.ts +7 -0
- package/types/theme/components/button.d.ts +1 -1
- package/types/theme/components/drawer.d.ts +9 -0
- package/types/theme/components/empty.d.ts +3 -2
- package/types/theme/components/progress.d.ts +1 -2
- package/types/theme/getTheme.d.ts +74 -0
- package/types/theme/global/colors/swag.d.ts +3 -0
- package/types/theme/global/{colors.d.ts → colors/types.d.ts} +4 -3
- package/types/theme/global/colors/work.d.ts +3 -0
- package/types/theme/global/index.d.ts +7 -2
- package/types/theme/index.d.ts +7 -84
- package/src/theme/global/colors.ts +0 -50
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, PanResponder, Easing } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
StyledDragableContainer,
|
|
6
|
+
StyledDragableDrawerContainer,
|
|
7
|
+
StyledHandler,
|
|
8
|
+
StyledHandlerContainer,
|
|
9
|
+
} from '../StyledDrawer';
|
|
10
|
+
import {
|
|
11
|
+
calculateAnimatedToValue,
|
|
12
|
+
calculateSnapPointsData,
|
|
13
|
+
getOffset,
|
|
14
|
+
SnapPointsData,
|
|
15
|
+
} from './helpers';
|
|
16
|
+
|
|
17
|
+
export interface DragableDrawerProps {
|
|
18
|
+
/**
|
|
19
|
+
* Drawer's content.
|
|
20
|
+
*/
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Initial visible height percentage of the drawer. Can be used to programmatically control the drawer height. Range: [0,100].
|
|
24
|
+
*/
|
|
25
|
+
initialHeightPercentage?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Mininum visible height percentage of the drawer. This will be the lowest point in snap points list. Range: [0,100].
|
|
28
|
+
*/
|
|
29
|
+
minimumHeightPercentage?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Callback function is called when the drawer expand to max position.
|
|
32
|
+
*/
|
|
33
|
+
onExpanded?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Callback function is called when the drawer collapsed to min position.
|
|
36
|
+
*/
|
|
37
|
+
onCollapsed?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Testing id of the component.
|
|
40
|
+
*/
|
|
41
|
+
testID?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Nearest height snap points that the drawer will attach to on release gesture. Range: [0,100]
|
|
44
|
+
*/
|
|
45
|
+
snapPoints?: number[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const DragableDrawer = ({
|
|
49
|
+
children,
|
|
50
|
+
initialHeightPercentage,
|
|
51
|
+
minimumHeightPercentage = 10,
|
|
52
|
+
snapPoints = [],
|
|
53
|
+
onExpanded,
|
|
54
|
+
onCollapsed,
|
|
55
|
+
testID,
|
|
56
|
+
}: DragableDrawerProps): JSX.Element => {
|
|
57
|
+
const [height, setHeight] = useState(0);
|
|
58
|
+
const baseHeightForMeasure = useRef(0);
|
|
59
|
+
const snapPointsData = useRef<SnapPointsData>({
|
|
60
|
+
list: [],
|
|
61
|
+
minHeightOffset: 0,
|
|
62
|
+
maxHeightOffset: 0,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Track drag
|
|
66
|
+
const pan = useRef(new Animated.Value(0)).current;
|
|
67
|
+
const offset = useRef(0);
|
|
68
|
+
const offsetBeforePan = useRef(0);
|
|
69
|
+
const [animatedToValue, setAnimatedToValue] = useState<number>(-1);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const id = pan.addListener(({ value }) => {
|
|
73
|
+
offset.current = value;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return () => pan.removeListener(id);
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (height > 0) {
|
|
81
|
+
const initialOffset = getOffset(
|
|
82
|
+
height,
|
|
83
|
+
initialHeightPercentage || minimumHeightPercentage
|
|
84
|
+
);
|
|
85
|
+
setAnimatedToValue(initialOffset);
|
|
86
|
+
}
|
|
87
|
+
}, [height]);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (height > 0) {
|
|
91
|
+
pan.setValue(height);
|
|
92
|
+
offset.current = height;
|
|
93
|
+
|
|
94
|
+
baseHeightForMeasure.current = height;
|
|
95
|
+
|
|
96
|
+
// Calculate snap points information
|
|
97
|
+
snapPointsData.current = calculateSnapPointsData(
|
|
98
|
+
minimumHeightPercentage,
|
|
99
|
+
height,
|
|
100
|
+
snapPoints
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}, [height, minimumHeightPercentage]);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (animatedToValue >= 0) {
|
|
107
|
+
const animation = Animated.timing(pan, {
|
|
108
|
+
toValue: animatedToValue,
|
|
109
|
+
useNativeDriver: true,
|
|
110
|
+
easing: Easing.inOut(Easing.cubic),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
animation.start(() => {
|
|
114
|
+
if (animatedToValue === 0) {
|
|
115
|
+
onExpanded?.();
|
|
116
|
+
} else if (
|
|
117
|
+
animatedToValue === getOffset(height, minimumHeightPercentage)
|
|
118
|
+
) {
|
|
119
|
+
onCollapsed?.();
|
|
120
|
+
}
|
|
121
|
+
setAnimatedToValue(-1);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return () => animation.stop();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return () => {};
|
|
128
|
+
}, [animatedToValue]);
|
|
129
|
+
|
|
130
|
+
const panResponder = useRef(
|
|
131
|
+
PanResponder.create({
|
|
132
|
+
onMoveShouldSetPanResponder: () => true,
|
|
133
|
+
onPanResponderGrant: () => {
|
|
134
|
+
offsetBeforePan.current = offset.current;
|
|
135
|
+
pan.setOffset(offset.current);
|
|
136
|
+
pan.setValue(0);
|
|
137
|
+
},
|
|
138
|
+
onPanResponderMove: (_, gesture) => {
|
|
139
|
+
const panDistance = gesture.dy;
|
|
140
|
+
|
|
141
|
+
// Moving toward top, stop at highest snap point
|
|
142
|
+
if (offsetBeforePan.current + panDistance < 0) {
|
|
143
|
+
pan.setValue(-offsetBeforePan.current);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Moving toward bottom, stop at lowest snap point
|
|
148
|
+
if (
|
|
149
|
+
offsetBeforePan.current + panDistance >
|
|
150
|
+
snapPointsData.current?.minHeightOffset
|
|
151
|
+
) {
|
|
152
|
+
pan.setValue(
|
|
153
|
+
baseHeightForMeasure.current -
|
|
154
|
+
baseHeightForMeasure.current * (minimumHeightPercentage / 100) -
|
|
155
|
+
offsetBeforePan.current
|
|
156
|
+
);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
pan.setValue(panDistance);
|
|
161
|
+
},
|
|
162
|
+
onPanResponderRelease: (_, gesture) => {
|
|
163
|
+
pan.flattenOffset();
|
|
164
|
+
|
|
165
|
+
// Attach to nearest snappoint
|
|
166
|
+
const panDistance = gesture.dy;
|
|
167
|
+
const offsetAfterPan = offsetBeforePan.current + panDistance;
|
|
168
|
+
const animatedValue = calculateAnimatedToValue(
|
|
169
|
+
offsetAfterPan,
|
|
170
|
+
snapPointsData.current.list
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
setAnimatedToValue(animatedValue);
|
|
174
|
+
},
|
|
175
|
+
})
|
|
176
|
+
).current;
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<StyledDragableContainer
|
|
180
|
+
testID={testID}
|
|
181
|
+
enableShadow
|
|
182
|
+
pointerEvents="box-none"
|
|
183
|
+
>
|
|
184
|
+
<StyledDragableDrawerContainer
|
|
185
|
+
enableShadow
|
|
186
|
+
style={{
|
|
187
|
+
transform: [
|
|
188
|
+
{ scaleY: baseHeightForMeasure.current > 0 ? 1 : 0 },
|
|
189
|
+
{ translateY: pan },
|
|
190
|
+
],
|
|
191
|
+
}}
|
|
192
|
+
onLayout={({ nativeEvent }) => {
|
|
193
|
+
setHeight(nativeEvent.layout.height);
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<StyledHandlerContainer {...panResponder.panHandlers}>
|
|
197
|
+
<StyledHandler />
|
|
198
|
+
</StyledHandlerContainer>
|
|
199
|
+
{children}
|
|
200
|
+
</StyledDragableDrawerContainer>
|
|
201
|
+
</StyledDragableContainer>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default DragableDrawer;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
|
-
import { Animated, Pressable, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Animated, Pressable, StyleSheet, View, ViewProps } from 'react-native';
|
|
4
4
|
|
|
5
5
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
6
6
|
|
|
7
|
-
const StyledContainer = styled(View)<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
7
|
+
const StyledContainer = styled(View)<{
|
|
8
|
+
enableShadow: boolean;
|
|
9
|
+
}>(({ theme, enableShadow }) => ({
|
|
10
|
+
...StyleSheet.absoluteFillObject,
|
|
11
|
+
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
12
|
+
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
13
|
+
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
14
|
+
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
zIndex: 9999,
|
|
17
|
+
elevation: 9999,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const StyledDragableContainer = styled(View)<{
|
|
21
|
+
enableShadow: boolean;
|
|
22
|
+
}>(({ theme, enableShadow }) => ({
|
|
23
|
+
...StyleSheet.absoluteFillObject,
|
|
24
|
+
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
25
|
+
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
26
|
+
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
27
|
+
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
zIndex: 9999,
|
|
30
|
+
elevation: 9999,
|
|
31
|
+
flexDirection: 'column-reverse',
|
|
32
|
+
}));
|
|
21
33
|
|
|
22
34
|
const StyledBackdrop = styled(AnimatedPressable)<
|
|
23
35
|
ComponentProps<typeof AnimatedPressable>
|
|
@@ -26,14 +38,46 @@ const StyledBackdrop = styled(AnimatedPressable)<
|
|
|
26
38
|
backgroundColor: theme.__hd__.drawer.colors.backdrop,
|
|
27
39
|
}));
|
|
28
40
|
|
|
29
|
-
const StyledDrawerContainer = styled(Animated.View)<{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
const StyledDrawerContainer = styled(Animated.View)<{
|
|
42
|
+
enableShadow: boolean;
|
|
43
|
+
}>(({ theme, enableShadow }) => ({
|
|
44
|
+
borderBottomLeftRadius: theme.__hd__.drawer.radii.default,
|
|
45
|
+
borderBottomRightRadius: theme.__hd__.drawer.radii.default,
|
|
46
|
+
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
47
|
+
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
const StyledDragableDrawerContainer = styled(Animated.View)<{
|
|
52
|
+
enableShadow: boolean;
|
|
53
|
+
}>(({ theme, enableShadow }) => ({
|
|
54
|
+
borderTopLeftRadius: theme.__hd__.drawer.radii.default,
|
|
55
|
+
borderTopRightRadius: theme.__hd__.drawer.radii.default,
|
|
56
|
+
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
57
|
+
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
58
|
+
overflow: 'hidden',
|
|
59
|
+
maxHeight: '100%',
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
const StyledHandlerContainer = styled(View)<ViewProps>(({ theme }) => ({
|
|
63
|
+
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
64
|
+
paddingVertical: theme.__hd__.drawer.space.handlerPaddingVertical,
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
const StyledHandler = styled(View)<{ active?: boolean }>(({ theme }) => ({
|
|
69
|
+
width: theme.__hd__.drawer.sizes.handlerWidth,
|
|
70
|
+
height: theme.__hd__.drawer.sizes.handlerHeight,
|
|
71
|
+
backgroundColor: theme.__hd__.drawer.colors.handler,
|
|
72
|
+
borderRadius: theme.__hd__.drawer.radii.handler,
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
StyledBackdrop,
|
|
77
|
+
StyledContainer,
|
|
78
|
+
StyledDrawerContainer,
|
|
79
|
+
StyledHandlerContainer,
|
|
80
|
+
StyledHandler,
|
|
81
|
+
StyledDragableContainer,
|
|
82
|
+
StyledDragableDrawerContainer,
|
|
83
|
+
};
|
|
@@ -44,7 +44,7 @@ exports[`Drawer renders correctly in invisible state 1`] = `
|
|
|
44
44
|
pointerEvents="box-none"
|
|
45
45
|
style={
|
|
46
46
|
Object {
|
|
47
|
-
"backgroundColor": "#
|
|
47
|
+
"backgroundColor": "#001f23",
|
|
48
48
|
"bottom": 0,
|
|
49
49
|
"left": 0,
|
|
50
50
|
"opacity": 0,
|
|
@@ -125,7 +125,7 @@ exports[`Drawer renders correctly in visible state 1`] = `
|
|
|
125
125
|
pointerEvents="auto"
|
|
126
126
|
style={
|
|
127
127
|
Object {
|
|
128
|
-
"backgroundColor": "#
|
|
128
|
+
"backgroundColor": "#001f23",
|
|
129
129
|
"bottom": 0,
|
|
130
130
|
"left": 0,
|
|
131
131
|
"opacity": 0.35,
|
|
@@ -206,7 +206,7 @@ exports[`Drawer renders correctly with no backdrop 1`] = `
|
|
|
206
206
|
pointerEvents="box-none"
|
|
207
207
|
style={
|
|
208
208
|
Object {
|
|
209
|
-
"backgroundColor": "#
|
|
209
|
+
"backgroundColor": "#001f23",
|
|
210
210
|
"bottom": 0,
|
|
211
211
|
"left": 0,
|
|
212
212
|
"opacity": 0,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Animated, Easing } from 'react-native';
|
|
3
|
+
import DragableDrawer from './DragableDrawer';
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
StyledBackdrop,
|
|
@@ -90,4 +91,6 @@ const Drawer = ({
|
|
|
90
91
|
);
|
|
91
92
|
};
|
|
92
93
|
|
|
93
|
-
export default Drawer
|
|
94
|
+
export default Object.assign(Drawer, {
|
|
95
|
+
Dragable: DragableDrawer,
|
|
96
|
+
});
|
|
@@ -3,12 +3,13 @@ import styled from '@emotion/native';
|
|
|
3
3
|
|
|
4
4
|
type ThemeVariant = 'light' | 'dark';
|
|
5
5
|
|
|
6
|
-
const StyledWrapper = styled(View)(() => ({
|
|
6
|
+
const StyledWrapper = styled(View)(({ theme }) => ({
|
|
7
7
|
display: 'flex',
|
|
8
8
|
flex: 1,
|
|
9
9
|
flexDirection: 'column',
|
|
10
10
|
alignItems: 'center',
|
|
11
11
|
justifyContent: 'center',
|
|
12
|
+
padding: theme.__hd__.empty.space.wrapperPadding,
|
|
12
13
|
}));
|
|
13
14
|
|
|
14
15
|
const StyledIllustration = styled(View)(({ theme }) => ({
|
|
@@ -16,7 +17,7 @@ const StyledIllustration = styled(View)(({ theme }) => ({
|
|
|
16
17
|
width: theme.__hd__.empty.sizes.illustration,
|
|
17
18
|
borderRadius: theme.__hd__.empty.radii.illustration,
|
|
18
19
|
backgroundColor: theme.__hd__.empty.colors.illustrationBackground,
|
|
19
|
-
marginBottom: theme.__hd__.empty.space.
|
|
20
|
+
marginBottom: theme.__hd__.empty.space.illustrationMargin,
|
|
20
21
|
}));
|
|
21
22
|
|
|
22
23
|
const StyledTitle = styled(Text)<{ themeVariant: ThemeVariant }>(
|
|
@@ -24,7 +25,7 @@ const StyledTitle = styled(Text)<{ themeVariant: ThemeVariant }>(
|
|
|
24
25
|
fontFamily: theme.__hd__.empty.fonts.title,
|
|
25
26
|
fontSize: theme.__hd__.empty.fontSizes.title,
|
|
26
27
|
textAlign: 'center',
|
|
27
|
-
marginBottom: theme.__hd__.empty.space.
|
|
28
|
+
marginBottom: theme.__hd__.empty.space.titleMargin,
|
|
28
29
|
color:
|
|
29
30
|
themeVariant === 'dark'
|
|
30
31
|
? theme.__hd__.empty.colors.invertedText
|
|
@@ -10,6 +10,7 @@ exports[`Empty renders empty state content correctly 1`] = `
|
|
|
10
10
|
"flex": 1,
|
|
11
11
|
"flexDirection": "column",
|
|
12
12
|
"justifyContent": "center",
|
|
13
|
+
"padding": 16,
|
|
13
14
|
},
|
|
14
15
|
undefined,
|
|
15
16
|
]
|
|
@@ -19,7 +20,7 @@ exports[`Empty renders empty state content correctly 1`] = `
|
|
|
19
20
|
style={
|
|
20
21
|
Array [
|
|
21
22
|
Object {
|
|
22
|
-
"backgroundColor": "#
|
|
23
|
+
"backgroundColor": "#ccced1",
|
|
23
24
|
"borderRadius": 999,
|
|
24
25
|
"height": 168,
|
|
25
26
|
"marginBottom": 24,
|
|
@@ -33,7 +34,7 @@ exports[`Empty renders empty state content correctly 1`] = `
|
|
|
33
34
|
style={
|
|
34
35
|
Array [
|
|
35
36
|
Object {
|
|
36
|
-
"color": "#
|
|
37
|
+
"color": "#001f23",
|
|
37
38
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
38
39
|
"fontSize": 28,
|
|
39
40
|
"marginBottom": 16,
|
|
@@ -50,7 +51,7 @@ exports[`Empty renders empty state content correctly 1`] = `
|
|
|
50
51
|
style={
|
|
51
52
|
Array [
|
|
52
53
|
Object {
|
|
53
|
-
"color": "#
|
|
54
|
+
"color": "#4d6265",
|
|
54
55
|
"fontFamily": "BeVietnamPro-Light",
|
|
55
56
|
"fontSize": 16,
|
|
56
57
|
"textAlign": "center",
|
|
@@ -19,7 +19,7 @@ interface EmptyProps {
|
|
|
19
19
|
description?: string;
|
|
20
20
|
/**
|
|
21
21
|
* Empty's variant
|
|
22
|
-
* 'dark' if rendered on a dark background and '
|
|
22
|
+
* 'dark' if rendered on a dark background and 'light' otherwise
|
|
23
23
|
*/
|
|
24
24
|
variant?: 'light' | 'dark';
|
|
25
25
|
/**
|
|
@@ -42,7 +42,7 @@ const Empty = ({
|
|
|
42
42
|
<StyledWrapper style={style} testID={testID}>
|
|
43
43
|
<StyledIllustration />
|
|
44
44
|
<StyledTitle themeVariant={variant}>{title}</StyledTitle>
|
|
45
|
-
{description && (
|
|
45
|
+
{!!description && (
|
|
46
46
|
<StyledDescription themeVariant={variant}>
|
|
47
47
|
{description}
|
|
48
48
|
</StyledDescription>
|
|
@@ -24,7 +24,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
24
24
|
pointerEvents="box-none"
|
|
25
25
|
style={
|
|
26
26
|
Object {
|
|
27
|
-
"backgroundColor": "#
|
|
27
|
+
"backgroundColor": "#001f23",
|
|
28
28
|
"bottom": 0,
|
|
29
29
|
"left": 0,
|
|
30
30
|
"opacity": 0,
|
|
@@ -58,7 +58,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
58
58
|
style={
|
|
59
59
|
Array [
|
|
60
60
|
Object {
|
|
61
|
-
"color": "#
|
|
61
|
+
"color": "#001f23",
|
|
62
62
|
"fontFamily": "BeVietnamPro-Regular",
|
|
63
63
|
"fontSize": 14,
|
|
64
64
|
"letterSpacing": 0.42,
|
|
@@ -122,7 +122,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
122
122
|
style={
|
|
123
123
|
Array [
|
|
124
124
|
Object {
|
|
125
|
-
"color": "#
|
|
125
|
+
"color": "#001f23",
|
|
126
126
|
"fontSize": 24,
|
|
127
127
|
},
|
|
128
128
|
Array [
|
|
@@ -140,7 +140,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
140
140
|
style={
|
|
141
141
|
Array [
|
|
142
142
|
Object {
|
|
143
|
-
"color": "#
|
|
143
|
+
"color": "#001f23",
|
|
144
144
|
"fontFamily": "BeVietnamPro-Regular",
|
|
145
145
|
"fontSize": 14,
|
|
146
146
|
"letterSpacing": 0.42,
|
|
@@ -201,7 +201,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
201
201
|
style={
|
|
202
202
|
Array [
|
|
203
203
|
Object {
|
|
204
|
-
"color": "#
|
|
204
|
+
"color": "#001f23",
|
|
205
205
|
"fontSize": 24,
|
|
206
206
|
},
|
|
207
207
|
Array [
|
|
@@ -219,7 +219,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
219
219
|
style={
|
|
220
220
|
Array [
|
|
221
221
|
Object {
|
|
222
|
-
"color": "#
|
|
222
|
+
"color": "#001f23",
|
|
223
223
|
"fontFamily": "BeVietnamPro-Regular",
|
|
224
224
|
"fontSize": 14,
|
|
225
225
|
"letterSpacing": 0.42,
|
|
@@ -280,7 +280,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
280
280
|
style={
|
|
281
281
|
Array [
|
|
282
282
|
Object {
|
|
283
|
-
"color": "#
|
|
283
|
+
"color": "#001f23",
|
|
284
284
|
"fontSize": 24,
|
|
285
285
|
},
|
|
286
286
|
Array [
|
|
@@ -298,7 +298,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
298
298
|
style={
|
|
299
299
|
Array [
|
|
300
300
|
Object {
|
|
301
|
-
"color": "#
|
|
301
|
+
"color": "#001f23",
|
|
302
302
|
"fontFamily": "BeVietnamPro-Regular",
|
|
303
303
|
"fontSize": 14,
|
|
304
304
|
"letterSpacing": 0.42,
|
|
@@ -359,7 +359,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
359
359
|
style={
|
|
360
360
|
Array [
|
|
361
361
|
Object {
|
|
362
|
-
"color": "#
|
|
362
|
+
"color": "#001f23",
|
|
363
363
|
"fontSize": 24,
|
|
364
364
|
},
|
|
365
365
|
Array [
|
|
@@ -377,7 +377,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
377
377
|
style={
|
|
378
378
|
Array [
|
|
379
379
|
Object {
|
|
380
|
-
"color": "#
|
|
380
|
+
"color": "#001f23",
|
|
381
381
|
"fontFamily": "BeVietnamPro-Regular",
|
|
382
382
|
"fontSize": 14,
|
|
383
383
|
"letterSpacing": 0.42,
|
|
@@ -438,7 +438,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
438
438
|
style={
|
|
439
439
|
Array [
|
|
440
440
|
Object {
|
|
441
|
-
"color": "#
|
|
441
|
+
"color": "#001f23",
|
|
442
442
|
"fontSize": 24,
|
|
443
443
|
},
|
|
444
444
|
Array [
|
|
@@ -456,7 +456,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
456
456
|
style={
|
|
457
457
|
Array [
|
|
458
458
|
Object {
|
|
459
|
-
"color": "#
|
|
459
|
+
"color": "#001f23",
|
|
460
460
|
"fontFamily": "BeVietnamPro-Regular",
|
|
461
461
|
"fontSize": 14,
|
|
462
462
|
"letterSpacing": 0.42,
|
|
@@ -498,7 +498,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
498
498
|
Object {
|
|
499
499
|
"alignItems": "center",
|
|
500
500
|
"alignSelf": "flex-start",
|
|
501
|
-
"backgroundColor": "#
|
|
501
|
+
"backgroundColor": "#001f23",
|
|
502
502
|
"borderRadius": 999,
|
|
503
503
|
"flexDirection": "row",
|
|
504
504
|
"justifyContent": "center",
|
|
@@ -523,7 +523,7 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
523
523
|
style={
|
|
524
524
|
Array [
|
|
525
525
|
Object {
|
|
526
|
-
"color": "#
|
|
526
|
+
"color": "#001f23",
|
|
527
527
|
"fontSize": 16,
|
|
528
528
|
},
|
|
529
529
|
Array [
|
|
@@ -587,7 +587,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
587
587
|
pointerEvents="auto"
|
|
588
588
|
style={
|
|
589
589
|
Object {
|
|
590
|
-
"backgroundColor": "#
|
|
590
|
+
"backgroundColor": "#001f23",
|
|
591
591
|
"bottom": 0,
|
|
592
592
|
"left": 0,
|
|
593
593
|
"opacity": 0.9,
|
|
@@ -621,7 +621,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
621
621
|
style={
|
|
622
622
|
Array [
|
|
623
623
|
Object {
|
|
624
|
-
"color": "#
|
|
624
|
+
"color": "#001f23",
|
|
625
625
|
"fontFamily": "BeVietnamPro-Regular",
|
|
626
626
|
"fontSize": 14,
|
|
627
627
|
"letterSpacing": 0.42,
|
|
@@ -685,7 +685,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
685
685
|
style={
|
|
686
686
|
Array [
|
|
687
687
|
Object {
|
|
688
|
-
"color": "#
|
|
688
|
+
"color": "#001f23",
|
|
689
689
|
"fontSize": 24,
|
|
690
690
|
},
|
|
691
691
|
Array [
|
|
@@ -703,7 +703,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
703
703
|
style={
|
|
704
704
|
Array [
|
|
705
705
|
Object {
|
|
706
|
-
"color": "#
|
|
706
|
+
"color": "#001f23",
|
|
707
707
|
"fontFamily": "BeVietnamPro-Regular",
|
|
708
708
|
"fontSize": 14,
|
|
709
709
|
"letterSpacing": 0.42,
|
|
@@ -764,7 +764,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
764
764
|
style={
|
|
765
765
|
Array [
|
|
766
766
|
Object {
|
|
767
|
-
"color": "#
|
|
767
|
+
"color": "#001f23",
|
|
768
768
|
"fontSize": 24,
|
|
769
769
|
},
|
|
770
770
|
Array [
|
|
@@ -782,7 +782,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
782
782
|
style={
|
|
783
783
|
Array [
|
|
784
784
|
Object {
|
|
785
|
-
"color": "#
|
|
785
|
+
"color": "#001f23",
|
|
786
786
|
"fontFamily": "BeVietnamPro-Regular",
|
|
787
787
|
"fontSize": 14,
|
|
788
788
|
"letterSpacing": 0.42,
|
|
@@ -843,7 +843,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
843
843
|
style={
|
|
844
844
|
Array [
|
|
845
845
|
Object {
|
|
846
|
-
"color": "#
|
|
846
|
+
"color": "#001f23",
|
|
847
847
|
"fontSize": 24,
|
|
848
848
|
},
|
|
849
849
|
Array [
|
|
@@ -861,7 +861,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
861
861
|
style={
|
|
862
862
|
Array [
|
|
863
863
|
Object {
|
|
864
|
-
"color": "#
|
|
864
|
+
"color": "#001f23",
|
|
865
865
|
"fontFamily": "BeVietnamPro-Regular",
|
|
866
866
|
"fontSize": 14,
|
|
867
867
|
"letterSpacing": 0.42,
|
|
@@ -922,7 +922,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
922
922
|
style={
|
|
923
923
|
Array [
|
|
924
924
|
Object {
|
|
925
|
-
"color": "#
|
|
925
|
+
"color": "#001f23",
|
|
926
926
|
"fontSize": 24,
|
|
927
927
|
},
|
|
928
928
|
Array [
|
|
@@ -940,7 +940,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
940
940
|
style={
|
|
941
941
|
Array [
|
|
942
942
|
Object {
|
|
943
|
-
"color": "#
|
|
943
|
+
"color": "#001f23",
|
|
944
944
|
"fontFamily": "BeVietnamPro-Regular",
|
|
945
945
|
"fontSize": 14,
|
|
946
946
|
"letterSpacing": 0.42,
|
|
@@ -1001,7 +1001,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
1001
1001
|
style={
|
|
1002
1002
|
Array [
|
|
1003
1003
|
Object {
|
|
1004
|
-
"color": "#
|
|
1004
|
+
"color": "#001f23",
|
|
1005
1005
|
"fontSize": 24,
|
|
1006
1006
|
},
|
|
1007
1007
|
Array [
|
|
@@ -1019,7 +1019,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
1019
1019
|
style={
|
|
1020
1020
|
Array [
|
|
1021
1021
|
Object {
|
|
1022
|
-
"color": "#
|
|
1022
|
+
"color": "#001f23",
|
|
1023
1023
|
"fontFamily": "BeVietnamPro-Regular",
|
|
1024
1024
|
"fontSize": 14,
|
|
1025
1025
|
"letterSpacing": 0.42,
|
|
@@ -1061,7 +1061,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
1061
1061
|
Object {
|
|
1062
1062
|
"alignItems": "center",
|
|
1063
1063
|
"alignSelf": "flex-start",
|
|
1064
|
-
"backgroundColor": "#
|
|
1064
|
+
"backgroundColor": "#001f23",
|
|
1065
1065
|
"borderRadius": 999,
|
|
1066
1066
|
"flexDirection": "row",
|
|
1067
1067
|
"justifyContent": "center",
|
|
@@ -1086,7 +1086,7 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
1086
1086
|
style={
|
|
1087
1087
|
Array [
|
|
1088
1088
|
Object {
|
|
1089
|
-
"color": "#
|
|
1089
|
+
"color": "#001f23",
|
|
1090
1090
|
"fontSize": 16,
|
|
1091
1091
|
},
|
|
1092
1092
|
Array [
|