react-native-ui-lib 7.41.1 → 7.42.0-snapshot.6974
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/lib/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +1 -1
- package/lib/package.json +1 -1
- 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/Picker.driver.new.d.ts +32 -0
- package/src/components/picker/Picker.driver.new.js +7 -5
- package/src/components/picker/helpers/useNewPickerProps.js +11 -7
- 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/textField/useImperativeInputHandle.js +2 -0
- package/src/components/timeline/Line.d.ts +1 -0
- package/src/components/timeline/Line.js +5 -4
- package/src/components/timeline/Point.d.ts +1 -0
- package/src/components/timeline/Point.js +5 -4
- package/src/components/timeline/index.js +6 -5
- package/src/components/timeline/line.driver.d.ts +10 -0
- package/src/components/timeline/line.driver.js +40 -0
- package/src/components/timeline/point.driver.d.ts +8 -0
- package/src/components/timeline/point.driver.js +55 -0
- package/src/components/timeline/timeline.driver.d.ts +25 -0
- package/src/components/timeline/timeline.driver.js +39 -0
- 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 +2 -0
- package/src/testkit/index.js +3 -1
|
@@ -45,7 +45,7 @@ export default class TextInputKeyboardManager {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function findNodeHandle(ref) {
|
|
48
|
-
return ReactNative.findNodeHandle(ref.current || ref);
|
|
48
|
+
return ref.current?.getNodeHandle?.() || ref?.getNodeHandle?.() || ReactNative.findNodeHandle(ref.current || ref);
|
|
49
49
|
}
|
|
50
50
|
const springAnimation = {
|
|
51
51
|
duration: 400,
|
package/lib/package.json
CHANGED
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
|
},
|
|
@@ -7,5 +7,37 @@ export declare const PickerDriver: (props: ComponentProps, useDialog: boolean) =
|
|
|
7
7
|
done: () => void;
|
|
8
8
|
isOpen: () => boolean;
|
|
9
9
|
dismissDialog: () => void;
|
|
10
|
+
itemDriver: (testID: string) => {
|
|
11
|
+
press: () => void;
|
|
12
|
+
hasOnPress: () => boolean;
|
|
13
|
+
onPressIn: () => void;
|
|
14
|
+
hasOnPressIn: () => boolean;
|
|
15
|
+
onPressOut: () => void;
|
|
16
|
+
hasOnPressOut: () => boolean;
|
|
17
|
+
onLongPress: () => void;
|
|
18
|
+
hasOnLongPress: () => boolean;
|
|
19
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
20
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
21
|
+
exists: () => boolean;
|
|
22
|
+
getStyle: () => any;
|
|
23
|
+
getLabel: () => {
|
|
24
|
+
getText: () => string | (string | import("react-test-renderer").ReactTestInstance)[];
|
|
25
|
+
getStyle: () => import("react-native/types").TextStyle;
|
|
26
|
+
press: () => void;
|
|
27
|
+
hasOnPress: () => boolean;
|
|
28
|
+
onPressIn: () => void;
|
|
29
|
+
hasOnPressIn: () => boolean;
|
|
30
|
+
onPressOut: () => void;
|
|
31
|
+
hasOnPressOut: () => boolean;
|
|
32
|
+
onLongPress: () => void;
|
|
33
|
+
hasOnLongPress: () => boolean;
|
|
34
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
35
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
36
|
+
exists: () => boolean;
|
|
37
|
+
};
|
|
38
|
+
getLabelStyle: () => import("react-native/types").TextStyle;
|
|
39
|
+
getIconStyle: () => any;
|
|
40
|
+
getIcon: () => import("../../testkit/new/Component.driver").ComponentDriverResult;
|
|
41
|
+
};
|
|
10
42
|
selectItem: (testID: string) => void;
|
|
11
43
|
};
|
|
@@ -54,12 +54,13 @@ export const PickerDriver = (props, useDialog) => {
|
|
|
54
54
|
dialogDriver.pressOnBackground();
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
+
const itemDriver = testID => ButtonDriver({
|
|
58
|
+
renderTree: props.renderTree,
|
|
59
|
+
testID
|
|
60
|
+
});
|
|
57
61
|
const selectItem = testID => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
testID
|
|
61
|
-
});
|
|
62
|
-
itemDriver.press();
|
|
62
|
+
const driver = itemDriver(testID);
|
|
63
|
+
driver.press();
|
|
63
64
|
};
|
|
64
65
|
return {
|
|
65
66
|
exists,
|
|
@@ -69,6 +70,7 @@ export const PickerDriver = (props, useDialog) => {
|
|
|
69
70
|
done,
|
|
70
71
|
isOpen,
|
|
71
72
|
dismissDialog,
|
|
73
|
+
itemDriver,
|
|
72
74
|
selectItem
|
|
73
75
|
};
|
|
74
76
|
};
|
|
@@ -13,23 +13,27 @@ const useNewPickerProps = props => {
|
|
|
13
13
|
renderHeader,
|
|
14
14
|
renderOverlay
|
|
15
15
|
} = props;
|
|
16
|
-
const
|
|
16
|
+
const defaultModalProps = {
|
|
17
17
|
animationType: 'slide',
|
|
18
18
|
transparent: Constants.isIOS && enableModalBlur,
|
|
19
19
|
enableModalBlur: Constants.isIOS && enableModalBlur,
|
|
20
20
|
onRequestClose: topBarProps?.onCancel
|
|
21
21
|
};
|
|
22
|
+
const mergedModalProps = {
|
|
23
|
+
...defaultModalProps,
|
|
24
|
+
...(onShow && {
|
|
25
|
+
onShow
|
|
26
|
+
}),
|
|
27
|
+
...pickerModalProps,
|
|
28
|
+
...customPickerProps?.modalProps
|
|
29
|
+
};
|
|
22
30
|
const newProps = {
|
|
23
31
|
renderHeader: renderCustomDialogHeader || renderHeader,
|
|
24
32
|
renderInput: renderPicker || renderInput,
|
|
25
33
|
renderOverlay: renderCustomModal || renderOverlay,
|
|
26
34
|
customPickerProps: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...modalProps,
|
|
30
|
-
...pickerModalProps
|
|
31
|
-
},
|
|
32
|
-
...customPickerProps
|
|
35
|
+
...customPickerProps,
|
|
36
|
+
modalProps: mergedModalProps
|
|
33
37
|
}
|
|
34
38
|
};
|
|
35
39
|
return newProps;
|
|
@@ -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",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { useContext, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import { findNodeHandle } from 'react-native';
|
|
2
3
|
import FieldContext from "./FieldContext";
|
|
3
4
|
const useImperativeInputHandle = (ref, props) => {
|
|
4
5
|
const inputRef = useRef();
|
|
5
6
|
const context = useContext(FieldContext);
|
|
6
7
|
useImperativeHandle(ref, () => {
|
|
7
8
|
return {
|
|
9
|
+
getNodeHandle: () => inputRef.current ? findNodeHandle(inputRef.current) : null,
|
|
8
10
|
isFocused: () => inputRef.current?.isFocused(),
|
|
9
11
|
focus: () => inputRef.current?.focus(),
|
|
10
12
|
blur: () => inputRef.current?.blur(),
|
|
@@ -12,7 +12,8 @@ const Line = React.memo(props => {
|
|
|
12
12
|
entry,
|
|
13
13
|
top,
|
|
14
14
|
style,
|
|
15
|
-
width = LINE_WIDTH
|
|
15
|
+
width = LINE_WIDTH,
|
|
16
|
+
testID
|
|
16
17
|
} = props;
|
|
17
18
|
const solidLineStyle = useMemo(() => {
|
|
18
19
|
return [style, styles.line, {
|
|
@@ -27,14 +28,14 @@ const Line = React.memo(props => {
|
|
|
27
28
|
if (entry) {
|
|
28
29
|
return <View style={[styles.entryPoint, {
|
|
29
30
|
backgroundColor: color
|
|
30
|
-
}]} />;
|
|
31
|
+
}]} testID={`${testID}.entryPoint`} />;
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
const renderLine = () => {
|
|
34
35
|
if (type === LineTypes.DASHED) {
|
|
35
|
-
return <Dash vertical color={color} containerStyle={dashedLineStyle} />;
|
|
36
|
+
return <Dash vertical color={color} containerStyle={dashedLineStyle} testID={testID} />;
|
|
36
37
|
}
|
|
37
|
-
return <View style={solidLineStyle} />;
|
|
38
|
+
return <View style={solidLineStyle} testID={testID} />;
|
|
38
39
|
};
|
|
39
40
|
return <>
|
|
40
41
|
{top && renderStartPoint()}
|
|
@@ -3,6 +3,7 @@ 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;
|
|
6
7
|
};
|
|
7
8
|
declare const Point: (props: PointPropsInternal) => React.JSX.Element;
|
|
8
9
|
export default Point;
|
|
@@ -20,7 +20,8 @@ const Point = props => {
|
|
|
20
20
|
label,
|
|
21
21
|
type,
|
|
22
22
|
color,
|
|
23
|
-
onLayout
|
|
23
|
+
onLayout,
|
|
24
|
+
testID
|
|
24
25
|
} = props;
|
|
25
26
|
const pointStyle = useMemo(() => {
|
|
26
27
|
const hasOutline = type === PointTypes.OUTLINE;
|
|
@@ -55,14 +56,14 @@ const Point = props => {
|
|
|
55
56
|
const tintColor = removeIconBackground ? Colors.$iconDefault : Colors.$iconDefaultLight;
|
|
56
57
|
const iconSize = removeIconBackground ? undefined : ICON_SIZE;
|
|
57
58
|
if (icon) {
|
|
58
|
-
return <Icon tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
|
|
59
|
+
return <Icon testID={`${testID}.icon`} tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
|
|
59
60
|
} else if (label) {
|
|
60
|
-
return <Text recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
|
|
61
|
+
return <Text testID={`${testID}.label`} recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
|
|
61
62
|
{label}
|
|
62
63
|
</Text>;
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
return <View center style={pointStyle} onLayout={onLayout}>
|
|
66
|
+
return <View center style={pointStyle} onLayout={onLayout} testID={testID}>
|
|
66
67
|
{renderPointContent()}
|
|
67
68
|
</View>;
|
|
68
69
|
};
|
|
@@ -15,7 +15,8 @@ const Timeline = props => {
|
|
|
15
15
|
topLine,
|
|
16
16
|
bottomLine,
|
|
17
17
|
point,
|
|
18
|
-
children
|
|
18
|
+
children,
|
|
19
|
+
testID
|
|
19
20
|
} = themeProps;
|
|
20
21
|
const [anchorMeasurements, setAnchorMeasurements] = useState();
|
|
21
22
|
const [contentContainerMeasurements, setContentContainerMeasurements] = useState();
|
|
@@ -107,17 +108,17 @@ const Timeline = props => {
|
|
|
107
108
|
});
|
|
108
109
|
}, []);
|
|
109
110
|
const renderTopLine = () => {
|
|
110
|
-
return <Line {...topLine} top style={topLineStyle} color={topLine ? topLine?.color || getStateColor(topLine?.state) : undefined} />;
|
|
111
|
+
return <Line testID={`${testID}.topLine`} {...topLine} top style={topLineStyle} color={topLine ? topLine?.color || getStateColor(topLine?.state) : undefined} />;
|
|
111
112
|
};
|
|
112
113
|
const renderBottomLine = () => {
|
|
113
114
|
if (bottomLine) {
|
|
114
|
-
return <Line {...bottomLine} style={styles.bottomLine} color={bottomLine?.color || getStateColor(bottomLine?.state)} />;
|
|
115
|
+
return <Line testID={`${testID}.bottomLine`} {...bottomLine} style={styles.bottomLine} color={bottomLine?.color || getStateColor(bottomLine?.state)} />;
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
|
-
return <View row style={containerStyle}>
|
|
118
|
+
return <View row style={containerStyle} testID={testID}>
|
|
118
119
|
<View style={styles.timelineContainer}>
|
|
119
120
|
{renderTopLine()}
|
|
120
|
-
<Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)} />
|
|
121
|
+
<Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)} testID={`${testID}.point`} />
|
|
121
122
|
{renderBottomLine()}
|
|
122
123
|
</View>
|
|
123
124
|
<View style={styles.contentContainer} onLayout={onContentContainerLayout} ref={contentContainerRef}>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
+
export declare const LineDriver: (props: ComponentProps) => {
|
|
3
|
+
getLine: () => {
|
|
4
|
+
exists: () => boolean;
|
|
5
|
+
getStyle: () => any;
|
|
6
|
+
isVisible: () => boolean;
|
|
7
|
+
isEntryPointExists: () => boolean;
|
|
8
|
+
getEntryPointStyle: () => any;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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 isVisible = () => {
|
|
20
|
+
const height = getStyle().height;
|
|
21
|
+
return exists() && (height ?? 0) > 0;
|
|
22
|
+
};
|
|
23
|
+
const isEntryPointExists = () => {
|
|
24
|
+
return entryPointDriver.exists();
|
|
25
|
+
};
|
|
26
|
+
const getEntryPointStyle = () => {
|
|
27
|
+
return entryPointDriver.getStyle();
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
exists,
|
|
31
|
+
getStyle,
|
|
32
|
+
isVisible,
|
|
33
|
+
isEntryPointExists,
|
|
34
|
+
getEntryPointStyle
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
getLine
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
isVisible: () => boolean;
|
|
12
|
+
isEntryPointExists: () => boolean;
|
|
13
|
+
getEntryPointStyle: () => any;
|
|
14
|
+
};
|
|
15
|
+
getBottomLine: () => {
|
|
16
|
+
exists: () => boolean;
|
|
17
|
+
getStyle: () => any;
|
|
18
|
+
isVisible: () => boolean;
|
|
19
|
+
isEntryPointExists: () => boolean;
|
|
20
|
+
getEntryPointStyle: () => any;
|
|
21
|
+
};
|
|
22
|
+
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
23
|
+
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
24
|
+
exists: () => boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
};
|
|
@@ -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,5 @@ 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
|
+
export { ChipDriver } from '../components/chip/chip.driver';
|
package/src/testkit/index.js
CHANGED
|
@@ -20,4 +20,6 @@ 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 { TimelineDriver } from "../components/timeline/timeline.driver";
|
|
25
|
+
export { ChipDriver } from "../components/chip/chip.driver";
|