@bigbinary/neetoui-rn 0.0.124 → 0.0.127
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/assets/fonts/SFProText-Bold.ttf +0 -0
- package/assets/fonts/SFProText-Medium.ttf +0 -0
- package/assets/fonts/SFProText-Regular.ttf +0 -0
- package/assets/fonts/SFProText-Semibold.ttf +0 -0
- package/assets/icons/apple-logo.svg +3 -0
- package/assets/icons/error.svg +4 -0
- package/assets/icons/google-logo.svg +6 -0
- package/assets/icons/info.svg +7 -0
- package/assets/icons/success.svg +3 -0
- package/assets/icons/warning.svg +5 -0
- package/lib/components/Alert.js +1 -1
- package/lib/components/Avatar.js +1 -1
- package/lib/components/Badge.js +1 -1
- package/lib/components/BottomSheet.js +1 -1
- package/lib/components/Button.js +1 -1
- package/lib/components/Carousel.js +1 -0
- package/lib/components/CheckBox.js +1 -1
- package/lib/components/Chip.js +1 -1
- package/lib/components/Input.js +1 -1
- package/lib/components/ListItem.js +1 -0
- package/lib/components/MultiSelect.js +1 -1
- package/lib/components/OnBoarding.js +1 -0
- package/lib/components/OtpInputs.js +1 -1
- package/lib/components/Popover.js +1 -1
- package/lib/components/RadioButton.js +1 -1
- package/lib/components/SearchBar.js +1 -0
- package/lib/components/SegmentPicker.js +1 -0
- package/lib/components/Select.js +1 -1
- package/lib/components/SocialButton.js +1 -0
- package/lib/components/Toast.js +1 -1
- package/lib/components/ToggleSwitch.js +1 -1
- package/lib/components/index.js +1 -1
- package/lib/config/toasterConfig.js +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/useDebounce.js +1 -0
- package/lib/theme/index.js +1 -1
- package/package.json +5 -3
- package/src/components/Alert.js +5 -5
- package/src/components/Avatar.js +1 -1
- package/src/components/Badge.js +1 -1
- package/src/components/BottomSheet.js +113 -74
- package/src/components/Button.js +66 -64
- package/src/components/Carousel.js +112 -0
- package/src/components/CheckBox.js +87 -81
- package/src/components/Chip.js +1 -1
- package/src/components/Input.js +147 -241
- package/src/components/ListItem.js +66 -0
- package/src/components/MultiSelect.js +10 -8
- package/src/components/OnBoarding.js +116 -0
- package/src/components/OtpInputs.js +1 -1
- package/src/components/Popover.js +13 -1
- package/src/components/RadioButton.js +88 -114
- package/src/components/SearchBar.js +134 -0
- package/src/components/SegmentPicker.js +210 -0
- package/src/components/Select.js +9 -7
- package/src/components/SocialButton.js +89 -0
- package/src/components/Toast.js +85 -30
- package/src/components/ToggleSwitch.js +49 -97
- package/src/components/Typography.js +2 -2
- package/src/components/index.js +6 -0
- package/src/config/toasterConfig.js +2 -2
- package/src/hooks/index.js +1 -0
- package/src/hooks/useDebounce.js +16 -0
- package/src/theme/index.js +65 -34
- package/assets/fonts/Inter-Bold.ttf +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
package/src/components/Input.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
|
-
import React, { useContext,
|
|
2
|
+
import React, { useCallback, useContext, useEffect, useRef } from "react";
|
|
3
3
|
import {
|
|
4
4
|
flexbox,
|
|
5
5
|
space,
|
|
6
6
|
border,
|
|
7
7
|
buttonStyle,
|
|
8
8
|
typography,
|
|
9
|
+
textStyle,
|
|
9
10
|
color,
|
|
10
11
|
layout,
|
|
12
|
+
system,
|
|
13
|
+
position,
|
|
11
14
|
} from "styled-system";
|
|
12
|
-
import
|
|
13
|
-
import { Platform } from "react-native";
|
|
15
|
+
import { Animated } from "react-native";
|
|
14
16
|
import styled, { ThemeContext } from "styled-components/native";
|
|
15
|
-
import propTypes from "@styled-system/prop-types";
|
|
16
17
|
import PropTypes from "prop-types";
|
|
17
|
-
import { Typography, Container } from "@components";
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const TextInput = styled.TextInput`
|
|
20
20
|
${flexbox}
|
|
21
21
|
${space}
|
|
22
22
|
${border}
|
|
@@ -33,6 +33,23 @@ const View = styled.View`
|
|
|
33
33
|
${layout}
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
|
+
const Typography = styled.Text`
|
|
37
|
+
${textStyle}
|
|
38
|
+
${space}
|
|
39
|
+
${layout}
|
|
40
|
+
${flexbox}
|
|
41
|
+
${typography}
|
|
42
|
+
${color}
|
|
43
|
+
${position}
|
|
44
|
+
${system({
|
|
45
|
+
textDecoration: {
|
|
46
|
+
property: "textDecoration",
|
|
47
|
+
cssProperty: "textDecoration",
|
|
48
|
+
},
|
|
49
|
+
textTransform: { property: "textTransform", cssProperty: "textTransform" },
|
|
50
|
+
})}
|
|
51
|
+
`;
|
|
52
|
+
|
|
36
53
|
/**
|
|
37
54
|
*
|
|
38
55
|
* This component supports below props categories from [styled-system ](/styled-system).
|
|
@@ -53,7 +70,7 @@ const View = styled.View`
|
|
|
53
70
|
* export default function Main() {
|
|
54
71
|
* return (
|
|
55
72
|
* <Container>
|
|
56
|
-
* <Input
|
|
73
|
+
* <Input value="Oliver Smith" onChangeHandle={()=>{}} label="Name" />
|
|
57
74
|
* </Container>
|
|
58
75
|
* );
|
|
59
76
|
* }
|
|
@@ -61,282 +78,171 @@ const View = styled.View`
|
|
|
61
78
|
*
|
|
62
79
|
*/
|
|
63
80
|
|
|
64
|
-
|
|
81
|
+
const AnimatedLabel = Animated.createAnimatedComponent(Typography);
|
|
82
|
+
|
|
83
|
+
export const Input = props => {
|
|
65
84
|
const {
|
|
66
|
-
label
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
inline = false,
|
|
74
|
-
LeftIcon,
|
|
75
|
-
RightIcon,
|
|
76
|
-
brandRight,
|
|
77
|
-
brandLeft,
|
|
78
|
-
brandColor = "font.grey600",
|
|
79
|
-
brandBackground = "background.menubackground",
|
|
85
|
+
label,
|
|
86
|
+
value = "",
|
|
87
|
+
onChangeHandle = () => {},
|
|
88
|
+
errorMessage = null,
|
|
89
|
+
PrefixIcon,
|
|
90
|
+
SuffixIcon,
|
|
91
|
+
autoFocus = false,
|
|
80
92
|
disabled = false,
|
|
81
|
-
secureTextEntry = false,
|
|
82
|
-
textAlignVertical = "top",
|
|
83
|
-
enableFocusStyle = false,
|
|
84
93
|
...rest
|
|
85
94
|
} = props;
|
|
86
95
|
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const colors = useContext(ThemeContext).colors;
|
|
97
|
+
const inputRef = useRef();
|
|
98
|
+
const containerRef = useRef();
|
|
99
|
+
const animatedController = new Animated.Value(0);
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (autoFocus || value) {
|
|
103
|
+
handleLabelAnimation(true);
|
|
104
|
+
} else {
|
|
105
|
+
handleLabelAnimation(false);
|
|
106
|
+
}
|
|
107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
const handleLabelAnimation = isFocused => {
|
|
111
|
+
Animated.timing(animatedController, {
|
|
112
|
+
toValue: !!isFocused || !!value ? 1 : 0,
|
|
113
|
+
duration: 300,
|
|
114
|
+
useNativeDriver: false,
|
|
115
|
+
}).start();
|
|
116
|
+
|
|
117
|
+
inputRef.current &&
|
|
118
|
+
inputRef.current.setNativeProps({
|
|
119
|
+
style: {
|
|
120
|
+
top: isFocused ? 10 : 0,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
98
123
|
};
|
|
99
124
|
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
125
|
+
const handleStyles = useCallback(isFocused => {
|
|
126
|
+
containerRef.current &&
|
|
127
|
+
containerRef.current.setNativeProps({
|
|
128
|
+
borderColor: errorMessage
|
|
129
|
+
? colors.border.danger
|
|
130
|
+
: isFocused
|
|
131
|
+
? colors.border.purple700
|
|
132
|
+
: colors.border.grey300,
|
|
133
|
+
borderWidth: errorMessage || isFocused ? 2 : 1,
|
|
134
|
+
});
|
|
135
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
136
|
+
}, []);
|
|
137
|
+
|
|
138
|
+
const labelStyles = {
|
|
139
|
+
fontSize: animatedController.interpolate({
|
|
140
|
+
inputRange: [0, 1],
|
|
141
|
+
outputRange: [18, 14],
|
|
142
|
+
}),
|
|
143
|
+
top: animatedController.interpolate({
|
|
144
|
+
inputRange: [0, 1],
|
|
145
|
+
outputRange: [16, 6],
|
|
146
|
+
}),
|
|
103
147
|
};
|
|
104
148
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
borderColor: error
|
|
109
|
-
? "rgba(255, 105, 105, 0.3)"
|
|
110
|
-
: theme.colors.border.grey400,
|
|
111
|
-
borderWidth: inline ? "0px" : "3px",
|
|
112
|
-
borderStyle: "solid",
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const disabledStyles = disabled && {
|
|
116
|
-
opacity: 0.5,
|
|
117
|
-
bg: theme.colors.background.secondary,
|
|
149
|
+
const handleFocusBlur = isFocused => {
|
|
150
|
+
if (!value) handleLabelAnimation(isFocused);
|
|
151
|
+
handleStyles(isFocused);
|
|
118
152
|
};
|
|
119
153
|
|
|
120
|
-
const inlineInputStyles = enableFocusStyle &&
|
|
121
|
-
isFocus && {
|
|
122
|
-
backgroundColor: error
|
|
123
|
-
? theme.colors.border.danger
|
|
124
|
-
: theme.colors.border.base,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
154
|
return (
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
{...disabledStyles}
|
|
138
|
-
flexDirection={inline ? "row" : "column"}
|
|
139
|
-
onBlur={handleBlur}
|
|
140
|
-
onFocus={handleFocus}
|
|
141
|
-
position="relative"
|
|
142
|
-
{...containerStyles}
|
|
155
|
+
<View>
|
|
156
|
+
<View
|
|
157
|
+
borderRadius={5}
|
|
158
|
+
borderWidth={1}
|
|
159
|
+
borderColor={errorMessage ? "border.danger" : "border.grey300"}
|
|
160
|
+
ref={containerRef}
|
|
161
|
+
alignItems="center"
|
|
162
|
+
flexDirection="row"
|
|
163
|
+
justifyContent="space-between"
|
|
143
164
|
>
|
|
144
|
-
{
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
inline={inline}
|
|
149
|
-
label={label}
|
|
150
|
-
/>
|
|
151
|
-
</Container>
|
|
165
|
+
{!!PrefixIcon && (
|
|
166
|
+
<View pl={2}>
|
|
167
|
+
<PrefixIcon />
|
|
168
|
+
</View>
|
|
152
169
|
)}
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
brandColor={brandColor}
|
|
163
|
-
brandBackground={brandBackground}
|
|
164
|
-
/>
|
|
165
|
-
)}
|
|
170
|
+
<View flex={1} left={10}>
|
|
171
|
+
<AnimatedLabel
|
|
172
|
+
color={disabled ? "font.grey400" : "font.grey600"}
|
|
173
|
+
position="absolute"
|
|
174
|
+
zIndex={1}
|
|
175
|
+
style={labelStyles}
|
|
176
|
+
>
|
|
177
|
+
{label}
|
|
178
|
+
</AnimatedLabel>
|
|
166
179
|
<TextInput
|
|
167
|
-
ref={
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
android: {
|
|
172
|
-
height,
|
|
173
|
-
onContentSizeChange: event => {
|
|
174
|
-
setHeight(event.nativeEvent.contentSize.height);
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
})}
|
|
178
|
-
textStyle="subtext"
|
|
180
|
+
ref={inputRef}
|
|
181
|
+
value={value}
|
|
182
|
+
onChangeText={onChangeHandle}
|
|
183
|
+
autoFocus={autoFocus}
|
|
179
184
|
editable={!disabled}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
{
|
|
185
|
+
onFocus={() => {
|
|
186
|
+
handleFocusBlur(true);
|
|
187
|
+
}}
|
|
188
|
+
onBlur={() => {
|
|
189
|
+
handleFocusBlur(false);
|
|
190
|
+
}}
|
|
191
|
+
color={disabled ? "font.grey500" : "font.grey800"}
|
|
192
|
+
fontSize={18}
|
|
193
|
+
py={3}
|
|
194
|
+
px={0}
|
|
195
|
+
top={0}
|
|
196
|
+
zIndex={2}
|
|
197
|
+
{...rest.inputProps}
|
|
184
198
|
/>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
<RightIcon />
|
|
197
|
-
</Container>
|
|
198
|
-
)}
|
|
199
|
-
|
|
200
|
-
{secureTextEntry && (
|
|
201
|
-
<Container justifyContent="center" mx="4px">
|
|
202
|
-
<Icon
|
|
203
|
-
name={isPasswordVisible ? "eye-line" : "eye-off-line"}
|
|
204
|
-
color={theme.colors.background.grey500}
|
|
205
|
-
onPress={() => setIsPasswordVisible(!isPasswordVisible)}
|
|
206
|
-
/>
|
|
207
|
-
</Container>
|
|
208
|
-
)}
|
|
209
|
-
</Container>
|
|
210
|
-
</Container>
|
|
211
|
-
{inline && (
|
|
212
|
-
<View
|
|
213
|
-
backgroundColor={theme.colors.border.primary}
|
|
214
|
-
height={1}
|
|
215
|
-
{...inlineInputStyles}
|
|
216
|
-
/>
|
|
199
|
+
</View>
|
|
200
|
+
{!!SuffixIcon && (
|
|
201
|
+
<View px={2}>
|
|
202
|
+
<SuffixIcon />
|
|
203
|
+
</View>
|
|
204
|
+
)}
|
|
205
|
+
</View>
|
|
206
|
+
{!!errorMessage && (
|
|
207
|
+
<Typography py={2} color="font.danger">
|
|
208
|
+
{errorMessage}
|
|
209
|
+
</Typography>
|
|
217
210
|
)}
|
|
218
|
-
|
|
219
|
-
</Container>
|
|
211
|
+
</View>
|
|
220
212
|
);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const InputText = ({ text, brandColor, brandBackground }) => (
|
|
224
|
-
<Container bg={brandBackground} justifyContent="center" px={2}>
|
|
225
|
-
{text && <Typography color={brandColor}>{text}</Typography>}
|
|
226
|
-
</Container>
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
const LabelText = ({ inline, label, labelStyles }) => (
|
|
230
|
-
<Typography
|
|
231
|
-
numberOfLines={1}
|
|
232
|
-
textStyle="subtext"
|
|
233
|
-
mb={inline ? "12px" : "7px"}
|
|
234
|
-
{...labelStyles}
|
|
235
|
-
>
|
|
236
|
-
{label}
|
|
237
|
-
</Typography>
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
const ErrorMessage = ({ error, message, theme }) => {
|
|
241
|
-
if (error) {
|
|
242
|
-
return (
|
|
243
|
-
<Typography textStyle="subtext" color={theme.colors.font.danger}>
|
|
244
|
-
{message}
|
|
245
|
-
</Typography>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
return null;
|
|
249
213
|
};
|
|
250
214
|
|
|
251
215
|
Input.propTypes = {
|
|
252
|
-
...propTypes.flexbox,
|
|
253
|
-
...propTypes.space,
|
|
254
|
-
...propTypes.border,
|
|
255
|
-
...propTypes.buttonStyle,
|
|
256
216
|
/**
|
|
257
217
|
* The text to use for the floating label.
|
|
258
218
|
*/
|
|
259
219
|
label: PropTypes.string,
|
|
260
220
|
/**
|
|
261
|
-
*
|
|
221
|
+
* Holds the current value of the Input.
|
|
262
222
|
*/
|
|
263
|
-
|
|
223
|
+
value: PropTypes.string.isRequired,
|
|
264
224
|
/**
|
|
265
|
-
*
|
|
225
|
+
* Func to set the current value.
|
|
266
226
|
*/
|
|
267
|
-
|
|
227
|
+
onChangeHandle: PropTypes.func.isRequired,
|
|
268
228
|
/**
|
|
269
229
|
* To display error/info messages
|
|
270
230
|
*/
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Whether to style the TextInput with error style.
|
|
274
|
-
*/
|
|
275
|
-
error: PropTypes.bool,
|
|
276
|
-
/**
|
|
277
|
-
* Changes input layout to inline.
|
|
278
|
-
*/
|
|
279
|
-
inline: PropTypes.bool,
|
|
280
|
-
/**
|
|
281
|
-
* Display brand to the right of input.
|
|
282
|
-
*/
|
|
283
|
-
brandRight: PropTypes.string,
|
|
284
|
-
/**
|
|
285
|
-
* Display brand to the left of input.
|
|
286
|
-
*/
|
|
287
|
-
brandLeft: PropTypes.string,
|
|
231
|
+
errorMessage: PropTypes.string,
|
|
288
232
|
/**
|
|
289
233
|
* If true, user won't be able to interact with the component.
|
|
290
234
|
*/
|
|
291
235
|
disabled: PropTypes.bool,
|
|
292
|
-
/**
|
|
293
|
-
* To change the color of brand text.
|
|
294
|
-
*/
|
|
295
|
-
brandColor: PropTypes.string,
|
|
296
|
-
/**
|
|
297
|
-
* To change the color of brand text.
|
|
298
|
-
*/
|
|
299
|
-
brandBackground: PropTypes.string,
|
|
300
|
-
/**
|
|
301
|
-
* To hide and show password and enable secure text entry.
|
|
302
|
-
*/
|
|
303
|
-
secureTextEntry: PropTypes.bool,
|
|
304
236
|
/**
|
|
305
237
|
* If true, shows border on focus.
|
|
306
238
|
*/
|
|
307
|
-
|
|
239
|
+
autoFocus: PropTypes.bool,
|
|
308
240
|
/**
|
|
309
|
-
* Display Icon to the left of input.
|
|
241
|
+
* Display Icon component to the left of input.
|
|
310
242
|
*/
|
|
311
|
-
|
|
243
|
+
PrefixIcon: PropTypes.elementType,
|
|
312
244
|
/**
|
|
313
|
-
* Display Icon to the Right of input.
|
|
245
|
+
* Display Icon component to the Right of input.
|
|
314
246
|
*/
|
|
315
|
-
|
|
316
|
-
children: PropTypes.node,
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
InputText.propTypes = {
|
|
320
|
-
text: PropTypes.string,
|
|
321
|
-
borderColor: PropTypes.string,
|
|
322
|
-
brandColor: PropTypes.string,
|
|
323
|
-
brandBackground: PropTypes.string,
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
LabelText.propTypes = {
|
|
327
|
-
inline: PropTypes.bool,
|
|
328
|
-
label: PropTypes.string,
|
|
329
|
-
labelStyles: PropTypes.object,
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
ErrorMessage.propTypes = {
|
|
333
|
-
error: PropTypes.bool,
|
|
334
|
-
message: PropTypes.string,
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
TextInput.defaultProps = {
|
|
338
|
-
px: 2,
|
|
339
|
-
minHeight: 45,
|
|
340
|
-
fontFamily: "inter400",
|
|
341
|
-
fontSize: "16px",
|
|
247
|
+
SuffixIcon: PropTypes.elementType,
|
|
342
248
|
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import propTypes from "@styled-system/prop-types";
|
|
4
|
+
|
|
5
|
+
import { Typography, Container } from "@components";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ListItems are components that displays a label with different values like string, toggle, button etc.
|
|
9
|
+
*
|
|
10
|
+
* <div class="screenshots">
|
|
11
|
+
* <img src="screenshots/listitem/listItemStyles.png" />
|
|
12
|
+
* </div>
|
|
13
|
+
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
* ```js
|
|
16
|
+
* import * as React from 'react';
|
|
17
|
+
* import { Container, ListItem, Typography } from '@bigbinary/neetoui-rn';
|
|
18
|
+
*
|
|
19
|
+
* export default function Main() {
|
|
20
|
+
* return (
|
|
21
|
+
* <Container>
|
|
22
|
+
* <ListItem
|
|
23
|
+
* LeftComponent={() => <Typography mr={2}>📣</Typography>}
|
|
24
|
+
* label="Organization"
|
|
25
|
+
* value={() => <Typography>Bigbinary</Typography>}
|
|
26
|
+
* />
|
|
27
|
+
* </Container>
|
|
28
|
+
* );
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export const ListItem = ({ LeftComponent, label, RightComponent, ...rest }) => {
|
|
34
|
+
return (
|
|
35
|
+
<Container
|
|
36
|
+
flexDirection="row"
|
|
37
|
+
bg="background.secondary"
|
|
38
|
+
width="100%"
|
|
39
|
+
px={12}
|
|
40
|
+
height={52}
|
|
41
|
+
borderRadius={6}
|
|
42
|
+
alignItems="center"
|
|
43
|
+
justifyContent="space-between"
|
|
44
|
+
{...rest}
|
|
45
|
+
>
|
|
46
|
+
<Container flexDirection="row" alignItems="center">
|
|
47
|
+
{LeftComponent && <LeftComponent />}
|
|
48
|
+
<Typography color="font.grey800" fontSize="l" fontFamily="sf400">
|
|
49
|
+
{label}
|
|
50
|
+
</Typography>
|
|
51
|
+
</Container>
|
|
52
|
+
<RightComponent />
|
|
53
|
+
</Container>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
ListItem.propTypes = {
|
|
58
|
+
...propTypes.flexbox,
|
|
59
|
+
...propTypes.space,
|
|
60
|
+
...propTypes.border,
|
|
61
|
+
...propTypes.color,
|
|
62
|
+
...propTypes.layout,
|
|
63
|
+
LeftComponent: PropTypes.elementType,
|
|
64
|
+
label: PropTypes.string.isRequired,
|
|
65
|
+
RightComponent: PropTypes.elementType.isRequired,
|
|
66
|
+
};
|
|
@@ -37,7 +37,7 @@ const MultiSelectItem = ({
|
|
|
37
37
|
{...multiSelectedItemContainerStyle}
|
|
38
38
|
>
|
|
39
39
|
<Typography
|
|
40
|
-
fontFamily="
|
|
40
|
+
fontFamily="sf400"
|
|
41
41
|
fontSize="s"
|
|
42
42
|
mr={2}
|
|
43
43
|
maxWidth="90%"
|
|
@@ -73,7 +73,7 @@ const DropdownItem = ({
|
|
|
73
73
|
{...itemContainerStyle}
|
|
74
74
|
>
|
|
75
75
|
<Typography
|
|
76
|
-
fontFamily="
|
|
76
|
+
fontFamily="sf400"
|
|
77
77
|
fontSize="s"
|
|
78
78
|
color="font.grey"
|
|
79
79
|
{...itemLabelStyle}
|
|
@@ -203,7 +203,9 @@ export const MultiSelect = ({
|
|
|
203
203
|
dropdownContainerStyle?.maxHeight ||
|
|
204
204
|
defaultDropdownItemHeight * Math.min(filteredOptions?.length, 6) +
|
|
205
205
|
(isSearchable ? searchInputHeight + 10 : 0) +
|
|
206
|
-
(isOptionsEmpty
|
|
206
|
+
(isOptionsEmpty && !(isSearchedOptionsEmpty && showCreateOption)
|
|
207
|
+
? emptyOptionsPlaceholderHeight
|
|
208
|
+
: 0) +
|
|
207
209
|
(isSearchedOptionsEmpty && showCreateOption
|
|
208
210
|
? emptySearchedOptionsHeight
|
|
209
211
|
: 0);
|
|
@@ -259,7 +261,7 @@ export const MultiSelect = ({
|
|
|
259
261
|
return (
|
|
260
262
|
<Container {...containerStyle}>
|
|
261
263
|
<Typography
|
|
262
|
-
fontFamily="
|
|
264
|
+
fontFamily="sf400"
|
|
263
265
|
mb={1}
|
|
264
266
|
fontSize="s"
|
|
265
267
|
color="font.base"
|
|
@@ -284,7 +286,7 @@ export const MultiSelect = ({
|
|
|
284
286
|
{...rest}
|
|
285
287
|
>
|
|
286
288
|
{!multipleOptionsSelected && (
|
|
287
|
-
<Typography fontFamily="
|
|
289
|
+
<Typography fontFamily="sf400" fontSize="s" color="font.grey">
|
|
288
290
|
{!multipleOptionsSelected && placeholder}
|
|
289
291
|
</Typography>
|
|
290
292
|
)}
|
|
@@ -352,7 +354,7 @@ export const MultiSelect = ({
|
|
|
352
354
|
/>
|
|
353
355
|
</Container>
|
|
354
356
|
)}
|
|
355
|
-
{isOptionsEmpty && (
|
|
357
|
+
{isOptionsEmpty && !(isSearchedOptionsEmpty && showCreateOption) && (
|
|
356
358
|
<Container
|
|
357
359
|
height={emptyOptionsPlaceholderHeight}
|
|
358
360
|
justifyContent="center"
|
|
@@ -360,7 +362,7 @@ export const MultiSelect = ({
|
|
|
360
362
|
{...emptyOptionsContainerStyle}
|
|
361
363
|
>
|
|
362
364
|
<Typography
|
|
363
|
-
fontFamily="
|
|
365
|
+
fontFamily="sf400"
|
|
364
366
|
fontSize="s"
|
|
365
367
|
color="font.grey"
|
|
366
368
|
{...emptyOptionsLabelStyle}
|
|
@@ -385,7 +387,7 @@ export const MultiSelect = ({
|
|
|
385
387
|
/>
|
|
386
388
|
) : (
|
|
387
389
|
<Typography
|
|
388
|
-
fontFamily="
|
|
390
|
+
fontFamily="sf400"
|
|
389
391
|
fontSize="s"
|
|
390
392
|
color="font.grey"
|
|
391
393
|
{...createSearchedOptionLabelStyle}
|