react-native-ui-lib 7.41.0-snapshot.6926 → 7.41.1-snapshot.6934
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 +1 -1
- package/searchInput.d.ts +2 -0
- package/searchInput.js +1 -0
- package/src/components/index.js +3 -0
- package/src/components/searchInput/index.d.ts +37 -0
- package/src/components/searchInput/index.js +218 -0
- package/src/components/searchInput/searchInput.api.json +57 -0
- package/src/components/searchInput/types.d.ts +66 -0
- package/src/components/searchInput/types.js +5 -0
- package/src/components/timeline/Line.d.ts +0 -1
- package/src/components/timeline/Line.js +4 -5
- package/src/components/timeline/Point.d.ts +0 -1
- package/src/components/timeline/Point.js +4 -5
- package/src/components/timeline/index.js +5 -6
- package/src/index.d.ts +1 -0
- package/src/index.js +28 -0
- package/src/testkit/index.d.ts +0 -1
- package/src/testkit/index.js +0 -1
- package/src/components/timeline/line.driver.d.ts +0 -9
- package/src/components/timeline/line.driver.js +0 -35
- package/src/components/timeline/point.driver.d.ts +0 -8
- package/src/components/timeline/point.driver.js +0 -55
- package/src/components/timeline/timeline.driver.d.ts +0 -23
- package/src/components/timeline/timeline.driver.js +0 -39
package/package.json
CHANGED
package/searchInput.d.ts
ADDED
package/searchInput.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./src/components/searchInput').default;
|
package/src/components/index.js
CHANGED
|
@@ -137,6 +137,9 @@ export default {
|
|
|
137
137
|
get ProgressiveImage() {
|
|
138
138
|
return require('./progressiveImage').default;
|
|
139
139
|
},
|
|
140
|
+
get SearchInput() {
|
|
141
|
+
return require('./searchInput').default;
|
|
142
|
+
},
|
|
140
143
|
get StateScreen() {
|
|
141
144
|
return require('./stateScreen').default;
|
|
142
145
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchInputPresets, SearchInputProps, SearchInputRef } from './types';
|
|
3
|
+
declare const SearchInput: React.ForwardRefExoticComponent<import("react-native").TextInputProps & {
|
|
4
|
+
onClear?: (() => void) | undefined;
|
|
5
|
+
onDismiss?: (() => void) | undefined;
|
|
6
|
+
cancelButtonProps?: import("../button").ButtonProps | undefined;
|
|
7
|
+
customRightElement?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
8
|
+
showLoader?: boolean | undefined;
|
|
9
|
+
loaderProps?: import("react-native").ActivityIndicatorProps | undefined;
|
|
10
|
+
customLoader?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
11
|
+
invertColors?: boolean | undefined;
|
|
12
|
+
inaccessible?: boolean | undefined;
|
|
13
|
+
useSafeArea?: boolean | undefined;
|
|
14
|
+
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
15
|
+
containerStyle?: import("react-native").StyleProp<import("react-native").TextStyle | import("react-native").ViewStyle>;
|
|
16
|
+
preset?: "default" | "prominent" | SearchInputPresets | undefined;
|
|
17
|
+
} & React.RefAttributes<any>>;
|
|
18
|
+
interface StaticMembers {
|
|
19
|
+
presets: typeof SearchInputPresets;
|
|
20
|
+
}
|
|
21
|
+
export { SearchInput, SearchInputProps, SearchInputRef, SearchInputPresets };
|
|
22
|
+
declare const _default: React.ForwardRefExoticComponent<import("react-native").TextInputProps & {
|
|
23
|
+
onClear?: (() => void) | undefined;
|
|
24
|
+
onDismiss?: (() => void) | undefined;
|
|
25
|
+
cancelButtonProps?: import("../button").ButtonProps | undefined;
|
|
26
|
+
customRightElement?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
27
|
+
showLoader?: boolean | undefined;
|
|
28
|
+
loaderProps?: import("react-native").ActivityIndicatorProps | undefined;
|
|
29
|
+
customLoader?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
30
|
+
invertColors?: boolean | undefined;
|
|
31
|
+
inaccessible?: boolean | undefined;
|
|
32
|
+
useSafeArea?: boolean | undefined;
|
|
33
|
+
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
34
|
+
containerStyle?: import("react-native").StyleProp<import("react-native").TextStyle | import("react-native").ViewStyle>;
|
|
35
|
+
preset?: "default" | "prominent" | SearchInputPresets | undefined;
|
|
36
|
+
} & React.RefAttributes<any>> & StaticMembers;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import _isEmpty from "lodash/isEmpty";
|
|
2
|
+
import React, { useImperativeHandle, forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { StyleSheet, Animated, TextInput, ActivityIndicator } from 'react-native';
|
|
4
|
+
import { SearchInputPresets, SearchInputProps, SearchInputRef } from "./types";
|
|
5
|
+
import { Colors, BorderRadiuses, Spacings, Typography } from "../../style";
|
|
6
|
+
import { Constants, asBaseComponent } from "../../commons/new";
|
|
7
|
+
import Button from "../button";
|
|
8
|
+
import Icon from "../icon";
|
|
9
|
+
import View from "../view";
|
|
10
|
+
import Assets from "../../assets";
|
|
11
|
+
const ICON_SIZE = 24;
|
|
12
|
+
const INPUT_HEIGHT = 60;
|
|
13
|
+
const TOP_INPUT_HEIGHT = Constants.isIOS ? 40 : 56;
|
|
14
|
+
const PROMINENT_INPUT_HEIGHT = 48;
|
|
15
|
+
const INVERTED_TEXT_COLOR = Colors.$textDefaultLight;
|
|
16
|
+
const INVERTED_ICON_COLOR = Colors.$iconDefaultLight;
|
|
17
|
+
const HIT_SLOP_VALUE = 20;
|
|
18
|
+
const SearchInput = forwardRef((props, ref) => {
|
|
19
|
+
const {
|
|
20
|
+
preset = SearchInputPresets.DEFAULT,
|
|
21
|
+
onDismiss,
|
|
22
|
+
useSafeArea,
|
|
23
|
+
invertColors,
|
|
24
|
+
testID,
|
|
25
|
+
showLoader,
|
|
26
|
+
loaderProps,
|
|
27
|
+
value: controlledValue,
|
|
28
|
+
onChangeText,
|
|
29
|
+
onClear,
|
|
30
|
+
containerStyle,
|
|
31
|
+
customRightElement,
|
|
32
|
+
style,
|
|
33
|
+
inaccessible
|
|
34
|
+
} = props;
|
|
35
|
+
const currentAnimatedValue = useRef();
|
|
36
|
+
const searchInputRef = useRef(null);
|
|
37
|
+
const [hasValue, setHasValue] = useState(Boolean(controlledValue));
|
|
38
|
+
const [value, setValue] = useState(controlledValue);
|
|
39
|
+
const [valueState] = useState(new Animated.Value(_isEmpty(controlledValue) ? 0 : 1));
|
|
40
|
+
const [isAnimatingClearButton, setIsAnimatingClearButton] = useState(!_isEmpty(controlledValue));
|
|
41
|
+
useImperativeHandle(ref, () => {
|
|
42
|
+
return {
|
|
43
|
+
blur: () => searchInputRef.current?.blur(),
|
|
44
|
+
focus: () => searchInputRef.current?.focus(),
|
|
45
|
+
clear: () => {
|
|
46
|
+
searchInputRef.current?.clear();
|
|
47
|
+
onChangeText?.('');
|
|
48
|
+
onClear?.();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (controlledValue !== value) {
|
|
54
|
+
setValue(controlledValue);
|
|
55
|
+
setHasValue(Boolean(controlledValue));
|
|
56
|
+
}
|
|
57
|
+
}, [controlledValue]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (hasValue) {
|
|
60
|
+
animatedValueState(1);
|
|
61
|
+
} else {
|
|
62
|
+
animatedValueState(0);
|
|
63
|
+
}
|
|
64
|
+
}, [hasValue]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
return () => {
|
|
67
|
+
currentAnimatedValue.current?.stop();
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
const animatedValueState = value => {
|
|
71
|
+
setIsAnimatingClearButton(true);
|
|
72
|
+
if (currentAnimatedValue.current) {
|
|
73
|
+
currentAnimatedValue.current.stop();
|
|
74
|
+
}
|
|
75
|
+
currentAnimatedValue.current = Animated.timing(valueState, {
|
|
76
|
+
toValue: value,
|
|
77
|
+
duration: 160,
|
|
78
|
+
useNativeDriver: true
|
|
79
|
+
});
|
|
80
|
+
currentAnimatedValue.current.start(() => {
|
|
81
|
+
if (!hasValue) {
|
|
82
|
+
setIsAnimatingClearButton(false);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const getHeight = () => {
|
|
87
|
+
const isProminent = preset === SearchInputPresets.PROMINENT;
|
|
88
|
+
if (isProminent) {
|
|
89
|
+
return PROMINENT_INPUT_HEIGHT;
|
|
90
|
+
}
|
|
91
|
+
return useSafeArea ? TOP_INPUT_HEIGHT : INPUT_HEIGHT;
|
|
92
|
+
};
|
|
93
|
+
const onChangeTextHandler = text => {
|
|
94
|
+
console.log(`onChangeTextHandler, text:`, text);
|
|
95
|
+
onChangeText?.(text);
|
|
96
|
+
setValue(text);
|
|
97
|
+
setHasValue(!_isEmpty(text));
|
|
98
|
+
};
|
|
99
|
+
const clearInput = () => {
|
|
100
|
+
searchInputRef?.current?.clear();
|
|
101
|
+
onChangeTextHandler('');
|
|
102
|
+
onClear?.();
|
|
103
|
+
};
|
|
104
|
+
const renderClearButton = () => {
|
|
105
|
+
const transform = [{
|
|
106
|
+
translateY: valueState.interpolate({
|
|
107
|
+
inputRange: [0, 1],
|
|
108
|
+
outputRange: [50, 1]
|
|
109
|
+
})
|
|
110
|
+
}];
|
|
111
|
+
const clearButtonStyle = !isDismissible() && isAnimatingClearButton && styles.clearButton;
|
|
112
|
+
const iconStyle = {
|
|
113
|
+
tintColor: invertColors ? INVERTED_ICON_COLOR : Colors.grey40,
|
|
114
|
+
width: 12,
|
|
115
|
+
height: 12
|
|
116
|
+
};
|
|
117
|
+
return <Animated.View style={[{
|
|
118
|
+
transform
|
|
119
|
+
}, clearButtonStyle]}>
|
|
120
|
+
<Button link grey10 text80 iconSource={Assets.internal.icons.x} iconStyle={iconStyle} onPress={clearInput} hitSlop={HIT_SLOP_VALUE} accessible={Boolean(hasValue)} accessibilityLabel={'clear'} testID={`${testID}.clearButton`} />
|
|
121
|
+
</Animated.View>;
|
|
122
|
+
};
|
|
123
|
+
const renderCancelButton = () => {
|
|
124
|
+
const {
|
|
125
|
+
cancelButtonProps
|
|
126
|
+
} = props;
|
|
127
|
+
if (onDismiss) {
|
|
128
|
+
return <Button style={styles.cancelButton} link color={invertColors ? INVERTED_TEXT_COLOR : undefined} $textDefault text65M {...cancelButtonProps} onPress={onDismiss} testID={`${testID}.cancelButton`} />;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const renderTextInput = () => {
|
|
132
|
+
const {
|
|
133
|
+
placeholder
|
|
134
|
+
} = props;
|
|
135
|
+
const height = getHeight();
|
|
136
|
+
const placeholderTextColor = invertColors ? INVERTED_TEXT_COLOR : Colors.$textDefault;
|
|
137
|
+
const selectionColor = invertColors ? INVERTED_TEXT_COLOR : Colors.$textDefault;
|
|
138
|
+
return <View style={[styles.inputContainer, {
|
|
139
|
+
height
|
|
140
|
+
}]}>
|
|
141
|
+
<TextInput accessibilityRole={'search'} placeholder={placeholder} placeholderTextColor={placeholderTextColor} underlineColorAndroid="transparent" selectionColor={selectionColor} ref={searchInputRef} value={value} allowFontScaling={false} style={[styles.input, containerStyle, invertColors && {
|
|
142
|
+
color: INVERTED_TEXT_COLOR
|
|
143
|
+
}, (!isDismissible() || isAnimatingClearButton) && styles.emptyInput]} onChangeText={onChangeTextHandler} testID={testID} />
|
|
144
|
+
{isAnimatingClearButton && renderClearButton()}
|
|
145
|
+
{isDismissible() && renderCancelButton()}
|
|
146
|
+
{!isDismissible() && customRightElement}
|
|
147
|
+
</View>;
|
|
148
|
+
};
|
|
149
|
+
const isDismissible = () => {
|
|
150
|
+
return typeof onDismiss !== 'undefined';
|
|
151
|
+
};
|
|
152
|
+
const renderIcon = (icon, left = true) => {
|
|
153
|
+
const invertedColor = invertColors ? {
|
|
154
|
+
tintColor: INVERTED_ICON_COLOR
|
|
155
|
+
} : undefined;
|
|
156
|
+
return <View>
|
|
157
|
+
<Icon tintColor={invertedColor?.tintColor} style={[styles.icon, invertedColor, left && styles.leftIcon]} source={icon} size={ICON_SIZE} />
|
|
158
|
+
</View>;
|
|
159
|
+
};
|
|
160
|
+
const renderLoader = () => {
|
|
161
|
+
const {
|
|
162
|
+
customLoader
|
|
163
|
+
} = props;
|
|
164
|
+
return <View>{customLoader ? customLoader : <ActivityIndicator style={styles.loader} {...loaderProps} />}</View>;
|
|
165
|
+
};
|
|
166
|
+
const topInputTopMargin = useSafeArea && {
|
|
167
|
+
marginTop: Constants.isIOS ? Constants.statusBarHeight : 0
|
|
168
|
+
};
|
|
169
|
+
const isProminent = preset === SearchInputPresets.PROMINENT;
|
|
170
|
+
return <View inaccessible={inaccessible} row centerV style={[style, isProminent && styles.prominentContainer, topInputTopMargin]} testID={`${testID}.searchBox`}>
|
|
171
|
+
{showLoader ? renderLoader() : renderIcon(Assets.internal.icons.search)}
|
|
172
|
+
{renderTextInput()}
|
|
173
|
+
</View>;
|
|
174
|
+
});
|
|
175
|
+
const styles = StyleSheet.create({
|
|
176
|
+
inputContainer: {
|
|
177
|
+
height: INPUT_HEIGHT,
|
|
178
|
+
flex: 1,
|
|
179
|
+
flexDirection: 'row',
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
overflow: 'hidden'
|
|
182
|
+
},
|
|
183
|
+
prominentContainer: {
|
|
184
|
+
borderWidth: 1,
|
|
185
|
+
borderColor: Colors.$outlineDefault,
|
|
186
|
+
borderRadius: BorderRadiuses.br20,
|
|
187
|
+
marginHorizontal: Spacings.s5
|
|
188
|
+
},
|
|
189
|
+
input: {
|
|
190
|
+
flex: 1,
|
|
191
|
+
...Typography.body,
|
|
192
|
+
lineHeight: undefined,
|
|
193
|
+
color: Colors.$textDefault,
|
|
194
|
+
textAlign: Constants.isRTL ? 'right' : 'left'
|
|
195
|
+
},
|
|
196
|
+
emptyInput: {
|
|
197
|
+
marginRight: Spacings.s4
|
|
198
|
+
},
|
|
199
|
+
cancelButton: {
|
|
200
|
+
marginLeft: Spacings.s4,
|
|
201
|
+
marginRight: Spacings.s4
|
|
202
|
+
},
|
|
203
|
+
clearButton: {
|
|
204
|
+
marginRight: Spacings.s4
|
|
205
|
+
},
|
|
206
|
+
icon: {
|
|
207
|
+
marginRight: Spacings.s4
|
|
208
|
+
},
|
|
209
|
+
leftIcon: {
|
|
210
|
+
marginLeft: Spacings.s4
|
|
211
|
+
},
|
|
212
|
+
loader: {
|
|
213
|
+
marginHorizontal: Spacings.s4
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
SearchInput.displayName = 'SearchInput';
|
|
217
|
+
export { SearchInput, SearchInputProps, SearchInputRef, SearchInputPresets };
|
|
218
|
+
export default asBaseComponent(SearchInput);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SearchInput",
|
|
3
|
+
"category": "form",
|
|
4
|
+
"description": "Search input for filtering purpose",
|
|
5
|
+
"example": "https://github.com/wix-private/wix-react-native-ui-lib/blob/master/example/screens/components/SearchInputScreen.tsx",
|
|
6
|
+
"extends": ["TextInput"],
|
|
7
|
+
"extendsLink": "https://reactnative.dev/docs/textinput",
|
|
8
|
+
"props": [
|
|
9
|
+
{"name": "onDismiss", "type": "() => void", "description": "callback for dismiss action"},
|
|
10
|
+
{"name": "onClear", "type": "() => void", "description": "On clear button callback."},
|
|
11
|
+
{
|
|
12
|
+
"name": "showLoader",
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Whether to show a loader instead of the left search icon."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "customLoader",
|
|
18
|
+
"type": "React.ReactElement",
|
|
19
|
+
"description": "custom loader element to render instead of the default loader"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "customRightElement",
|
|
23
|
+
"type": "React.ReactElement",
|
|
24
|
+
"description": "Custom right element"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "cancelButtonProps",
|
|
28
|
+
"type": "ButtonProps",
|
|
29
|
+
"description": "Props for the cancel button"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "schemeColor",
|
|
33
|
+
"type": "string | null",
|
|
34
|
+
"description": "The SearchInput colors (affects the search icon color and the cancel button color)"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "inaccessible",
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "Turn off accessibility for this view and its nested children"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "useSafeArea",
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "in case the SearchInput is rendered in a safe area (top of the screen)"
|
|
45
|
+
},
|
|
46
|
+
{"name": "containerStyle", "type": "ViewStyle", "description": "Override styles for the input"},
|
|
47
|
+
{"name": "style", "type": "ViewStyle", "description": "Override styles for container"}
|
|
48
|
+
],
|
|
49
|
+
"snippet": [
|
|
50
|
+
"<SearchInput",
|
|
51
|
+
" ref={searchInputRef$1}",
|
|
52
|
+
" testID={'searchInput'$2}",
|
|
53
|
+
" placeholder={'Search'$3}",
|
|
54
|
+
" onDismiss={onDismiss$4}",
|
|
55
|
+
"/>"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextInputProps, StyleProp, ViewStyle, TextStyle, ActivityIndicatorProps } from 'react-native';
|
|
3
|
+
import { ButtonProps } from '../button';
|
|
4
|
+
export declare enum SearchInputPresets {
|
|
5
|
+
DEFAULT = "default",
|
|
6
|
+
PROMINENT = "prominent"
|
|
7
|
+
}
|
|
8
|
+
export interface SearchInputRef {
|
|
9
|
+
blur: () => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
focus: () => void;
|
|
12
|
+
}
|
|
13
|
+
export type SearchInputProps = TextInputProps & {
|
|
14
|
+
/**
|
|
15
|
+
* On clear button callback.
|
|
16
|
+
*/
|
|
17
|
+
onClear?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* callback for dismiss action
|
|
20
|
+
*/
|
|
21
|
+
onDismiss?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Props for the cancel button
|
|
24
|
+
*/
|
|
25
|
+
cancelButtonProps?: ButtonProps;
|
|
26
|
+
/**
|
|
27
|
+
* Custom right element
|
|
28
|
+
*/
|
|
29
|
+
customRightElement?: React.ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to show a loader instead of the left search icon
|
|
32
|
+
*/
|
|
33
|
+
showLoader?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Loader props
|
|
36
|
+
*/
|
|
37
|
+
loaderProps?: ActivityIndicatorProps;
|
|
38
|
+
/**
|
|
39
|
+
* custom loader element
|
|
40
|
+
*/
|
|
41
|
+
customLoader?: React.ReactElement;
|
|
42
|
+
/**
|
|
43
|
+
* converts the colors of the search's input elements, icons and button to white
|
|
44
|
+
*/
|
|
45
|
+
invertColors?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Turn off accessibility for this view and its nested children
|
|
48
|
+
*/
|
|
49
|
+
inaccessible?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* in case the SearchInput is rendered in a safe area (top of the screen)
|
|
52
|
+
*/
|
|
53
|
+
useSafeArea?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Override styles for container
|
|
56
|
+
*/
|
|
57
|
+
style?: StyleProp<ViewStyle>;
|
|
58
|
+
/**
|
|
59
|
+
* Override styles for the input
|
|
60
|
+
*/
|
|
61
|
+
containerStyle?: StyleProp<ViewStyle | TextStyle>;
|
|
62
|
+
/**
|
|
63
|
+
* The preset for the search input: default or prominent
|
|
64
|
+
*/
|
|
65
|
+
preset?: SearchInputPresets | `${SearchInputPresets}`;
|
|
66
|
+
};
|
|
@@ -12,8 +12,7 @@ const Line = React.memo(props => {
|
|
|
12
12
|
entry,
|
|
13
13
|
top,
|
|
14
14
|
style,
|
|
15
|
-
width = LINE_WIDTH
|
|
16
|
-
testID
|
|
15
|
+
width = LINE_WIDTH
|
|
17
16
|
} = props;
|
|
18
17
|
const solidLineStyle = useMemo(() => {
|
|
19
18
|
return [style, styles.line, {
|
|
@@ -28,14 +27,14 @@ const Line = React.memo(props => {
|
|
|
28
27
|
if (entry) {
|
|
29
28
|
return <View style={[styles.entryPoint, {
|
|
30
29
|
backgroundColor: color
|
|
31
|
-
}]}
|
|
30
|
+
}]} />;
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
33
|
const renderLine = () => {
|
|
35
34
|
if (type === LineTypes.DASHED) {
|
|
36
|
-
return <Dash vertical color={color} containerStyle={dashedLineStyle}
|
|
35
|
+
return <Dash vertical color={color} containerStyle={dashedLineStyle} />;
|
|
37
36
|
}
|
|
38
|
-
return <View style={solidLineStyle}
|
|
37
|
+
return <View style={solidLineStyle} />;
|
|
39
38
|
};
|
|
40
39
|
return <>
|
|
41
40
|
{top && renderStartPoint()}
|
|
@@ -3,7 +3,6 @@ import { LayoutChangeEvent } from 'react-native';
|
|
|
3
3
|
import { PointProps } from './types';
|
|
4
4
|
type PointPropsInternal = PointProps & {
|
|
5
5
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
6
|
-
testID?: string;
|
|
7
6
|
};
|
|
8
7
|
declare const Point: (props: PointPropsInternal) => React.JSX.Element;
|
|
9
8
|
export default Point;
|
|
@@ -20,8 +20,7 @@ const Point = props => {
|
|
|
20
20
|
label,
|
|
21
21
|
type,
|
|
22
22
|
color,
|
|
23
|
-
onLayout
|
|
24
|
-
testID
|
|
23
|
+
onLayout
|
|
25
24
|
} = props;
|
|
26
25
|
const pointStyle = useMemo(() => {
|
|
27
26
|
const hasOutline = type === PointTypes.OUTLINE;
|
|
@@ -56,14 +55,14 @@ const Point = props => {
|
|
|
56
55
|
const tintColor = removeIconBackground ? Colors.$iconDefault : Colors.$iconDefaultLight;
|
|
57
56
|
const iconSize = removeIconBackground ? undefined : ICON_SIZE;
|
|
58
57
|
if (icon) {
|
|
59
|
-
return <Icon
|
|
58
|
+
return <Icon tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
|
|
60
59
|
} else if (label) {
|
|
61
|
-
return <Text
|
|
60
|
+
return <Text recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
|
|
62
61
|
{label}
|
|
63
62
|
</Text>;
|
|
64
63
|
}
|
|
65
64
|
};
|
|
66
|
-
return <View center style={pointStyle} onLayout={onLayout}
|
|
65
|
+
return <View center style={pointStyle} onLayout={onLayout}>
|
|
67
66
|
{renderPointContent()}
|
|
68
67
|
</View>;
|
|
69
68
|
};
|
|
@@ -15,8 +15,7 @@ const Timeline = props => {
|
|
|
15
15
|
topLine,
|
|
16
16
|
bottomLine,
|
|
17
17
|
point,
|
|
18
|
-
children
|
|
19
|
-
testID
|
|
18
|
+
children
|
|
20
19
|
} = themeProps;
|
|
21
20
|
const [anchorMeasurements, setAnchorMeasurements] = useState();
|
|
22
21
|
const [contentContainerMeasurements, setContentContainerMeasurements] = useState();
|
|
@@ -108,17 +107,17 @@ const Timeline = props => {
|
|
|
108
107
|
});
|
|
109
108
|
}, []);
|
|
110
109
|
const renderTopLine = () => {
|
|
111
|
-
return <Line
|
|
110
|
+
return <Line {...topLine} top style={topLineStyle} color={topLine ? topLine?.color || getStateColor(topLine?.state) : undefined} />;
|
|
112
111
|
};
|
|
113
112
|
const renderBottomLine = () => {
|
|
114
113
|
if (bottomLine) {
|
|
115
|
-
return <Line
|
|
114
|
+
return <Line {...bottomLine} style={styles.bottomLine} color={bottomLine?.color || getStateColor(bottomLine?.state)} />;
|
|
116
115
|
}
|
|
117
116
|
};
|
|
118
|
-
return <View row style={containerStyle}
|
|
117
|
+
return <View row style={containerStyle}>
|
|
119
118
|
<View style={styles.timelineContainer}>
|
|
120
119
|
{renderTopLine()}
|
|
121
|
-
<Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)}
|
|
120
|
+
<Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)} />
|
|
122
121
|
{renderBottomLine()}
|
|
123
122
|
</View>
|
|
124
123
|
<View style={styles.contentContainer} onLayout={onContentContainerLayout} ref={contentContainerRef}>
|
package/src/index.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export { default as RadioGroup, RadioGroupProps } from './components/radioGroup'
|
|
|
76
76
|
export type { RecorderProps } from './typings/recorderTypes';
|
|
77
77
|
export type { ComponentStatics } from './typings/common';
|
|
78
78
|
export { default as ScrollBar, ScrollBarProps } from './components/scrollBar';
|
|
79
|
+
export { default as SearchInput, SearchInputProps, SearchInputRef } from './components/searchInput';
|
|
79
80
|
export { default as SectionsWheelPicker, SectionsWheelPickerProps } from './components/sectionsWheelPicker';
|
|
80
81
|
export { default as SegmentedControl, SegmentedControlProps, SegmentedControlItemProps, SegmentedControlPreset } from './components/segmentedControl';
|
|
81
82
|
export { default as SharedTransition } from './components/sharedTransition';
|
package/src/index.js
CHANGED
|
@@ -179,6 +179,9 @@ var _exportNames = {
|
|
|
179
179
|
RadioGroupProps: true,
|
|
180
180
|
ScrollBar: true,
|
|
181
181
|
ScrollBarProps: true,
|
|
182
|
+
SearchInput: true,
|
|
183
|
+
SearchInputProps: true,
|
|
184
|
+
SearchInputRef: true,
|
|
182
185
|
SectionsWheelPicker: true,
|
|
183
186
|
SectionsWheelPickerProps: true,
|
|
184
187
|
SegmentedControl: true,
|
|
@@ -1213,6 +1216,24 @@ Object.defineProperty(exports, "ScrollBarProps", {
|
|
|
1213
1216
|
return _scrollBar().ScrollBarProps;
|
|
1214
1217
|
}
|
|
1215
1218
|
});
|
|
1219
|
+
Object.defineProperty(exports, "SearchInput", {
|
|
1220
|
+
enumerable: true,
|
|
1221
|
+
get: function () {
|
|
1222
|
+
return _searchInput().default;
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
Object.defineProperty(exports, "SearchInputProps", {
|
|
1226
|
+
enumerable: true,
|
|
1227
|
+
get: function () {
|
|
1228
|
+
return _searchInput().SearchInputProps;
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
Object.defineProperty(exports, "SearchInputRef", {
|
|
1232
|
+
enumerable: true,
|
|
1233
|
+
get: function () {
|
|
1234
|
+
return _searchInput().SearchInputRef;
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1216
1237
|
Object.defineProperty(exports, "SectionsWheelPicker", {
|
|
1217
1238
|
enumerable: true,
|
|
1218
1239
|
get: function () {
|
|
@@ -2200,6 +2221,13 @@ function _scrollBar() {
|
|
|
2200
2221
|
};
|
|
2201
2222
|
return data;
|
|
2202
2223
|
}
|
|
2224
|
+
function _searchInput() {
|
|
2225
|
+
const data = _interopRequireWildcard(require("./components/searchInput"));
|
|
2226
|
+
_searchInput = function () {
|
|
2227
|
+
return data;
|
|
2228
|
+
};
|
|
2229
|
+
return data;
|
|
2230
|
+
}
|
|
2203
2231
|
function _sectionsWheelPicker() {
|
|
2204
2232
|
const data = _interopRequireWildcard(require("./components/sectionsWheelPicker"));
|
|
2205
2233
|
_sectionsWheelPicker = function () {
|
package/src/testkit/index.d.ts
CHANGED
|
@@ -21,5 +21,4 @@ export { PickerDriver } from '../components/picker/Picker.driver.new';
|
|
|
21
21
|
export { ExpandableOverlayDriver } from '../incubator/expandableOverlay/ExpandableOverlay.driver';
|
|
22
22
|
export { ToastDriver } from '../incubator/toast/Toast.driver.new';
|
|
23
23
|
export { DateTimePickerDriver } from '../components/dateTimePicker/DateTimePicker.driver';
|
|
24
|
-
export { TimelineDriver } from '../components/timeline/timeline.driver';
|
|
25
24
|
export { ChipDriver } from '../components/chip/chip.driver';
|
package/src/testkit/index.js
CHANGED
|
@@ -21,5 +21,4 @@ export { PickerDriver } from "../components/picker/Picker.driver.new";
|
|
|
21
21
|
export { ExpandableOverlayDriver } from "../incubator/expandableOverlay/ExpandableOverlay.driver";
|
|
22
22
|
export { ToastDriver } from "../incubator/toast/Toast.driver.new";
|
|
23
23
|
export { DateTimePickerDriver } from "../components/dateTimePicker/DateTimePicker.driver";
|
|
24
|
-
export { TimelineDriver } from "../components/timeline/timeline.driver";
|
|
25
24
|
export { ChipDriver } from "../components/chip/chip.driver";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
-
export declare const LineDriver: (props: ComponentProps) => {
|
|
3
|
-
getLine: () => {
|
|
4
|
-
exists: () => boolean;
|
|
5
|
-
getStyle: () => any;
|
|
6
|
-
isEntryPointExists: () => boolean;
|
|
7
|
-
getEntryPointStyle: () => any;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { ViewDriver } from "../view/View.driver.new";
|
|
3
|
-
export const LineDriver = props => {
|
|
4
|
-
const lineDriver = ViewDriver({
|
|
5
|
-
renderTree: props.renderTree,
|
|
6
|
-
testID: `${props.testID}`
|
|
7
|
-
});
|
|
8
|
-
const entryPointDriver = ViewDriver({
|
|
9
|
-
renderTree: props.renderTree,
|
|
10
|
-
testID: `${props.testID}.entryPoint`
|
|
11
|
-
});
|
|
12
|
-
const getLine = () => {
|
|
13
|
-
const exists = () => {
|
|
14
|
-
return lineDriver.exists();
|
|
15
|
-
};
|
|
16
|
-
const getStyle = () => {
|
|
17
|
-
return StyleSheet.flatten(lineDriver.getElement().props.style);
|
|
18
|
-
};
|
|
19
|
-
const isEntryPointExists = () => {
|
|
20
|
-
return entryPointDriver.exists();
|
|
21
|
-
};
|
|
22
|
-
const getEntryPointStyle = () => {
|
|
23
|
-
return entryPointDriver.getStyle();
|
|
24
|
-
};
|
|
25
|
-
return {
|
|
26
|
-
exists,
|
|
27
|
-
getStyle,
|
|
28
|
-
isEntryPointExists,
|
|
29
|
-
getEntryPointStyle
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
getLine
|
|
34
|
-
};
|
|
35
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { TextDriver } from "../text/Text.driver.new";
|
|
3
|
-
import { ImageDriver } from "../image/Image.driver.new";
|
|
4
|
-
import { ViewDriver } from "../view/View.driver.new";
|
|
5
|
-
export const PointDriver = props => {
|
|
6
|
-
const pointDriver = ViewDriver({
|
|
7
|
-
renderTree: props.renderTree,
|
|
8
|
-
testID: `${props.testID}`
|
|
9
|
-
});
|
|
10
|
-
const labelDriver = TextDriver({
|
|
11
|
-
renderTree: props.renderTree,
|
|
12
|
-
testID: `${props.testID}.label`
|
|
13
|
-
});
|
|
14
|
-
const iconDriver = ImageDriver({
|
|
15
|
-
renderTree: props.renderTree,
|
|
16
|
-
testID: `${props.testID}.icon`
|
|
17
|
-
});
|
|
18
|
-
const getLabel = () => {
|
|
19
|
-
const exists = () => {
|
|
20
|
-
return labelDriver.exists();
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
...labelDriver,
|
|
24
|
-
exists
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const getIcon = () => {
|
|
28
|
-
const exists = () => {
|
|
29
|
-
return iconDriver.exists();
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
...iconDriver,
|
|
33
|
-
exists
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const getPoint = () => {
|
|
37
|
-
const exists = () => {
|
|
38
|
-
return pointDriver.exists();
|
|
39
|
-
};
|
|
40
|
-
const getStyle = () => {
|
|
41
|
-
return StyleSheet.flatten(pointDriver.getElement().props.style);
|
|
42
|
-
};
|
|
43
|
-
const getContentStyle = () => {
|
|
44
|
-
return getIcon().exists() ? StyleSheet.flatten(getIcon().getElement().props.style) : getLabel().exists() && StyleSheet.flatten(getLabel().getElement().props.style);
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
exists,
|
|
48
|
-
getStyle,
|
|
49
|
-
getContentStyle
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
getPoint
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
-
export declare const TimelineDriver: (props: ComponentProps) => {
|
|
3
|
-
getPoint: () => {
|
|
4
|
-
exists: () => boolean;
|
|
5
|
-
getStyle: () => any;
|
|
6
|
-
getContentStyle: () => any;
|
|
7
|
-
};
|
|
8
|
-
getTopLine: () => {
|
|
9
|
-
exists: () => boolean;
|
|
10
|
-
getStyle: () => any;
|
|
11
|
-
isEntryPointExists: () => boolean;
|
|
12
|
-
getEntryPointStyle: () => any;
|
|
13
|
-
};
|
|
14
|
-
getBottomLine: () => {
|
|
15
|
-
exists: () => boolean;
|
|
16
|
-
getStyle: () => any;
|
|
17
|
-
isEntryPointExists: () => boolean;
|
|
18
|
-
getEntryPointStyle: () => any;
|
|
19
|
-
};
|
|
20
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
21
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
22
|
-
exists: () => boolean;
|
|
23
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useComponentDriver } from "../../testkit/new/Component.driver";
|
|
2
|
-
import { LineDriver } from "./line.driver";
|
|
3
|
-
import { PointDriver } from "./point.driver";
|
|
4
|
-
export const TimelineDriver = props => {
|
|
5
|
-
const driver = useComponentDriver(props);
|
|
6
|
-
const pointDriver = PointDriver({
|
|
7
|
-
renderTree: props.renderTree,
|
|
8
|
-
testID: `${props.testID}.point`
|
|
9
|
-
});
|
|
10
|
-
const topLineDriver = LineDriver({
|
|
11
|
-
renderTree: props.renderTree,
|
|
12
|
-
testID: `${props.testID}.topLine`
|
|
13
|
-
});
|
|
14
|
-
const bottomLineDriver = LineDriver({
|
|
15
|
-
renderTree: props.renderTree,
|
|
16
|
-
testID: `${props.testID}.bottomLine`
|
|
17
|
-
});
|
|
18
|
-
const getPoint = () => {
|
|
19
|
-
return {
|
|
20
|
-
...pointDriver.getPoint()
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const getTopLine = () => {
|
|
24
|
-
return {
|
|
25
|
-
...topLineDriver.getLine()
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const getBottomLine = () => {
|
|
29
|
-
return {
|
|
30
|
-
...bottomLineDriver.getLine()
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
...driver,
|
|
35
|
-
getPoint,
|
|
36
|
-
getTopLine,
|
|
37
|
-
getBottomLine
|
|
38
|
-
};
|
|
39
|
-
};
|