react-native-ui-lib 7.41.0 → 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/chip/chip.driver.d.ts +33 -0
- package/src/components/chip/chip.driver.js +56 -0
- package/src/components/index.js +3 -0
- package/src/components/picker/index.js +8 -5
- 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/tabController/apis/tabController.api.json +21 -5
- package/src/components/wizard/wizard.api.json +7 -7
- package/src/index.d.ts +1 -0
- package/src/index.js +28 -0
- package/src/testkit/index.d.ts +1 -0
- package/src/testkit/index.js +2 -1
package/package.json
CHANGED
package/searchInput.d.ts
ADDED
package/searchInput.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./src/components/searchInput').default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
+
export declare const ChipDriver: (props: ComponentProps) => {
|
|
3
|
+
getLabel: () => {
|
|
4
|
+
getText: () => string | (string | import("react-test-renderer").ReactTestInstance)[];
|
|
5
|
+
getStyle: () => import("react-native").TextStyle;
|
|
6
|
+
press: () => void;
|
|
7
|
+
hasOnPress: () => boolean;
|
|
8
|
+
onPressIn: () => void;
|
|
9
|
+
hasOnPressIn: () => boolean;
|
|
10
|
+
onPressOut: () => void;
|
|
11
|
+
hasOnPressOut: () => boolean;
|
|
12
|
+
onLongPress: () => void;
|
|
13
|
+
hasOnLongPress: () => boolean;
|
|
14
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
15
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
16
|
+
exists: () => boolean;
|
|
17
|
+
};
|
|
18
|
+
getDismissIcon: () => {
|
|
19
|
+
exists: () => boolean;
|
|
20
|
+
getStyle: () => any;
|
|
21
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
22
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
23
|
+
};
|
|
24
|
+
getIcon: () => {
|
|
25
|
+
exists: () => boolean;
|
|
26
|
+
getStyle: () => any;
|
|
27
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
28
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
29
|
+
};
|
|
30
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
31
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
32
|
+
exists: () => boolean;
|
|
33
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { useComponentDriver } from "../../testkit/new/Component.driver";
|
|
3
|
+
import { TextDriver } from "../text/Text.driver.new";
|
|
4
|
+
import { ImageDriver } from "../image/Image.driver.new";
|
|
5
|
+
export const ChipDriver = props => {
|
|
6
|
+
const driver = useComponentDriver(props);
|
|
7
|
+
const labelDriver = TextDriver({
|
|
8
|
+
renderTree: props.renderTree,
|
|
9
|
+
testID: `${props.testID}.label`
|
|
10
|
+
});
|
|
11
|
+
const dismissIconDriver = ImageDriver({
|
|
12
|
+
renderTree: props.renderTree,
|
|
13
|
+
testID: `${props.testID}.dismissIcon`
|
|
14
|
+
});
|
|
15
|
+
const iconDriver = ImageDriver({
|
|
16
|
+
renderTree: props.renderTree,
|
|
17
|
+
testID: `${props.testID}.icon`
|
|
18
|
+
});
|
|
19
|
+
const getLabel = () => {
|
|
20
|
+
return {
|
|
21
|
+
...labelDriver
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const getDismissIcon = () => {
|
|
25
|
+
const exists = () => {
|
|
26
|
+
return dismissIconDriver.exists();
|
|
27
|
+
};
|
|
28
|
+
const getStyle = () => {
|
|
29
|
+
return StyleSheet.flatten(dismissIconDriver.getElement().props.style);
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
...dismissIconDriver,
|
|
33
|
+
exists,
|
|
34
|
+
getStyle
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const getIcon = () => {
|
|
38
|
+
const exists = () => {
|
|
39
|
+
return iconDriver.exists();
|
|
40
|
+
};
|
|
41
|
+
const getStyle = () => {
|
|
42
|
+
return StyleSheet.flatten(iconDriver.getElement().props.style);
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
...iconDriver,
|
|
46
|
+
exists,
|
|
47
|
+
getStyle
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
...driver,
|
|
52
|
+
getLabel,
|
|
53
|
+
getDismissIcon,
|
|
54
|
+
getIcon
|
|
55
|
+
};
|
|
56
|
+
};
|
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
|
},
|
|
@@ -118,11 +118,14 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
118
118
|
items
|
|
119
119
|
});
|
|
120
120
|
const accessibleFilteredItems = useMemo(() => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
if (propItems) {
|
|
122
|
+
return filteredItems.map(item => ({
|
|
123
|
+
...item,
|
|
124
|
+
onPress: useWheelPicker && Constants.accessibility.isScreenReaderEnabled ? () => onDoneSelecting(item.value) : undefined
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
return filteredItems;
|
|
128
|
+
}, [propItems, useWheelPicker, filteredItems, onDoneSelecting]);
|
|
126
129
|
const {
|
|
127
130
|
label,
|
|
128
131
|
accessibilityInfo
|
|
@@ -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
|
+
};
|
|
@@ -5,8 +5,17 @@
|
|
|
5
5
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.tsx",
|
|
6
6
|
"images": [],
|
|
7
7
|
"props": [
|
|
8
|
-
{
|
|
9
|
-
|
|
8
|
+
{
|
|
9
|
+
"name": "items",
|
|
10
|
+
"type": "TabControllerItemProps[]",
|
|
11
|
+
"description": "The list of tab bar items"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "initialIndex",
|
|
15
|
+
"type": "number",
|
|
16
|
+
"description": "Initial selected index",
|
|
17
|
+
"default": "0"
|
|
18
|
+
},
|
|
10
19
|
{
|
|
11
20
|
"name": "onChangeIndex",
|
|
12
21
|
"type": "(index: number, prevIndex: number | null) => void",
|
|
@@ -25,7 +34,11 @@
|
|
|
25
34
|
"note": "Does not work with asCarousel",
|
|
26
35
|
"default": "false"
|
|
27
36
|
},
|
|
28
|
-
{
|
|
37
|
+
{
|
|
38
|
+
"name": "carouselPageWidth;",
|
|
39
|
+
"type": "number",
|
|
40
|
+
"description": "Pass for custom carousel page width"
|
|
41
|
+
}
|
|
29
42
|
],
|
|
30
43
|
"snippet": [
|
|
31
44
|
"<TabController items={[{label: 'First'}, {label: 'Second'}, {label: 'Third'}]$1}>",
|
|
@@ -75,7 +88,7 @@
|
|
|
75
88
|
"items": [
|
|
76
89
|
{
|
|
77
90
|
"title": "",
|
|
78
|
-
"description": "**Inactive Tab**\nText: BodySmall $textDefault\nBackground: $backgroundElevated \n\n**Active Tab**\nText: BodySmallBold $textPrimary\nBackground: $backgroundElevated\nIndicator: $outlinePrimary \n\n**Shadow**\nsh10\n\n**Dark Skin**\nText: BodySmall, System White\nBackground: System Grey10\nDivider: System Grey20",
|
|
91
|
+
"description": "markdown: **Inactive Tab**\nText: BodySmall $textDefault\nBackground: $backgroundElevated \n\n**Active Tab**\nText: BodySmallBold $textPrimary\nBackground: $backgroundElevated\nIndicator: $outlinePrimary \n\n**Shadow**\nsh10\n\n**Dark Skin**\nText: BodySmall, System White\nBackground: System Grey10\nDivider: System Grey20",
|
|
79
92
|
"content": [
|
|
80
93
|
{
|
|
81
94
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/TabBar/tabBar_overview_styling.png"
|
|
@@ -88,7 +101,10 @@
|
|
|
88
101
|
},
|
|
89
102
|
{
|
|
90
103
|
"type": "table",
|
|
91
|
-
"columns": [
|
|
104
|
+
"columns": [
|
|
105
|
+
"Property",
|
|
106
|
+
"Component"
|
|
107
|
+
],
|
|
92
108
|
"items": [
|
|
93
109
|
{
|
|
94
110
|
"title": "Counter Badge",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
],
|
|
130
130
|
"items": [
|
|
131
131
|
{
|
|
132
|
-
"title": "
|
|
132
|
+
"title": "Active",
|
|
133
133
|
"description": "Border: $outlinePrimary \nNumber: subtext, $textPrimary \nStep label: bodySmallBold, $textNuetralHeavy ",
|
|
134
134
|
"content": [
|
|
135
135
|
{
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
]
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
|
-
"title": "
|
|
141
|
+
"title": "Next (enabled)",
|
|
142
142
|
"description": "Border: $outlineDisabled \nNumber: subtext, $textNuetralHeavy ",
|
|
143
143
|
"content": [
|
|
144
144
|
{
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
]
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
|
-
"title": "
|
|
150
|
+
"title": "Next (disabled)",
|
|
151
151
|
"description": "Border: $outlineDisabled \nNumber: subtext, $textDisabled ",
|
|
152
152
|
"content": [
|
|
153
153
|
{
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
]
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
"title": "
|
|
159
|
+
"title": "Completed",
|
|
160
160
|
"description": "Border: $outlineDisabled \nIcon: $iconNuetral ",
|
|
161
161
|
"content": [
|
|
162
162
|
{
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
]
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
|
-
"title": "
|
|
168
|
+
"title": "Skipped",
|
|
169
169
|
"description": "Border: $outlineDanger \nNumber: subtext, $textDangerLight ",
|
|
170
170
|
"content": [
|
|
171
171
|
{
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
]
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
|
-
"title": "
|
|
177
|
+
"title": "Error",
|
|
178
178
|
"description": "Border: $outlineDanger \nIcon: $iconDangerLight",
|
|
179
179
|
"content": [
|
|
180
180
|
{
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Wizard/wizard_overview_section_spec.png"
|
|
193
193
|
}
|
|
194
194
|
],
|
|
195
|
-
"description": "**Spacing Between Steps** \nAll steps are distributed evenly, leaving S5 margins. \nMin spacing between steps: S3 \n\n**Maximum Step Width** \nCurrent step’s text box shouldnt be larger than 40% of the screen’s width. \nIf the label will be larger it will get ellipsis. \ne.g. : For 375px screen : 40% = 150px"
|
|
195
|
+
"description": "markdown: **Spacing Between Steps** \nAll steps are distributed evenly, leaving S5 margins. \nMin spacing between steps: S3 \n\n**Maximum Step Width** \nCurrent step’s text box shouldnt be larger than 40% of the screen’s width. \nIf the label will be larger it will get ellipsis. \ne.g. : For 375px screen : 40% = 150px"
|
|
196
196
|
},
|
|
197
197
|
{
|
|
198
198
|
"type": "section",
|
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,3 +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 { ChipDriver } from '../components/chip/chip.driver';
|
package/src/testkit/index.js
CHANGED
|
@@ -20,4 +20,5 @@ export { WheelPickerItemDriver } from "../components/WheelPicker/WheelPickerItem
|
|
|
20
20
|
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
|
-
export { DateTimePickerDriver } from "../components/dateTimePicker/DateTimePicker.driver";
|
|
23
|
+
export { DateTimePickerDriver } from "../components/dateTimePicker/DateTimePicker.driver";
|
|
24
|
+
export { ChipDriver } from "../components/chip/chip.driver";
|