@widergy/mobile-ui 1.27.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/components/CheckList/index.js +4 -0
  3. package/lib/components/Checkbox/index.js +4 -0
  4. package/lib/components/MultipleFilePicker/components/Picker/index.js +66 -74
  5. package/lib/components/MultipleFilePicker/components/Picker/styles.js +26 -34
  6. package/lib/components/MultipleFilePicker/components/UploadedFiles/index.js +27 -129
  7. package/lib/components/MultipleFilePicker/components/UploadedFiles/styles.js +8 -57
  8. package/lib/components/MultipleFilePicker/constants.js +0 -14
  9. package/lib/components/MultipleFilePicker/index.js +196 -147
  10. package/lib/components/MultipleFilePicker/propTypes.js +15 -11
  11. package/lib/components/MultipleFilePicker/styles.js +9 -0
  12. package/lib/components/MultipleFilePicker/utils.js +22 -51
  13. package/lib/components/UTBaseInputField/components/IconAdornment/utils.js +2 -3
  14. package/lib/components/UTCheckBox/constants.js +2 -0
  15. package/lib/components/UTCheckBox/index.js +25 -16
  16. package/lib/components/UTCheckBox/theme.js +1 -3
  17. package/lib/components/UTCheckList/constants.js +0 -2
  18. package/lib/components/UTCheckList/index.js +7 -6
  19. package/lib/components/UTCheckList/styles.js +2 -1
  20. package/lib/components/UTCheckList/utils.js +2 -2
  21. package/lib/components/UTFieldLabel/index.js +4 -3
  22. package/package.json +1 -1
  23. package/lib/components/MultipleFilePicker/components/Input/README.md +0 -77
  24. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/constants.js +0 -2
  25. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/index.js +0 -19
  26. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/propTypes.js +0 -8
  27. package/lib/components/MultipleFilePicker/components/Input/components/ShowPassword/styles.js +0 -11
  28. package/lib/components/MultipleFilePicker/components/Input/components/Title/index.js +0 -78
  29. package/lib/components/MultipleFilePicker/components/Input/components/Title/propTypes.js +0 -14
  30. package/lib/components/MultipleFilePicker/components/Input/components/Title/styles.js +0 -42
  31. package/lib/components/MultipleFilePicker/components/Input/components/Underline/index.js +0 -80
  32. package/lib/components/MultipleFilePicker/components/Input/components/Underline/styles.js +0 -39
  33. package/lib/components/MultipleFilePicker/components/Input/constants.js +0 -2
  34. package/lib/components/MultipleFilePicker/components/Input/index.js +0 -299
  35. package/lib/components/MultipleFilePicker/components/Input/propTypes.js +0 -43
  36. package/lib/components/MultipleFilePicker/components/Input/styles.js +0 -47
@@ -1,299 +0,0 @@
1
- import React, { PureComponent, createRef } from 'react';
2
- import { TextInput, Text, TouchableWithoutFeedback, View } from 'react-native';
3
-
4
- import CaptionLabel from '../../../CaptionLabel';
5
- import Icon from '../../../Icon';
6
- import IconButton from '../../../IconButton';
7
- import { DEFAULT_ICON_SIZE } from '../../../Icon/constants';
8
- import { withTheme } from '../../../../theming';
9
- import UTTooltip from '../../../UTTooltip';
10
- import { ICON_MARGIN } from '../../../IconButton/styles';
11
-
12
- import ShowPassword from './components/ShowPassword';
13
- import Title from './components/Title';
14
- import Underline from './components/Underline';
15
- import propTypes from './propTypes';
16
- import styles, { INPUT_ICON_MARGIN } from './styles';
17
- import { RATIO } from './constants';
18
-
19
- class Input extends PureComponent {
20
- constructor(props) {
21
- super(props);
22
-
23
- this.state = {
24
- focused: false,
25
- passwordVisible: false,
26
- showPlaceholder: false
27
- };
28
-
29
- this.textInput = createRef();
30
- }
31
-
32
- getContainerStyle() {
33
- const { backgroundColor, theme, containerButtonPadding, containerPadding, maxWidth, minHeight } =
34
- this.props;
35
- return {
36
- backgroundColor: backgroundColor || theme.colors.inputBackground,
37
- paddingHorizontal: containerButtonPadding || containerPadding,
38
- paddingVertical: containerPadding,
39
- maxWidth,
40
- minHeight
41
- };
42
- }
43
-
44
- getCaptionStyle = () => {
45
- const { iconSize, leadingIcon, trailingIcon } = this.props;
46
- const marginLeft = leadingIcon ? 2 * INPUT_ICON_MARGIN + iconSize : INPUT_ICON_MARGIN;
47
- const marginRight = trailingIcon ? 2 * INPUT_ICON_MARGIN + iconSize : INPUT_ICON_MARGIN;
48
-
49
- return {
50
- marginLeft,
51
- marginRight
52
- };
53
- };
54
-
55
- getInputStyle() {
56
- const { textStyles, theme, disabledTextStyles } = this.props;
57
- const additionalStyle = { flex: 1 };
58
-
59
- return [
60
- {
61
- fontSize: theme.fonts.fontSizes.base,
62
- fontFamily: theme.fonts.fontFamily,
63
- color: theme.fonts.fontColor
64
- },
65
- textStyles,
66
- this.isDisabled() && disabledTextStyles,
67
- additionalStyle
68
- ];
69
- }
70
-
71
- getPaddingStyle() {
72
- const { theme } = this.props;
73
-
74
- return {
75
- paddingBottom: theme.fonts.fontSizes.base * (1 - RATIO),
76
- paddingTop: theme.fonts.fontSizes.base * RATIO
77
- };
78
- }
79
-
80
- isDisabled = () => {
81
- const { disabled, editable } = this.props;
82
-
83
- return !editable || disabled;
84
- };
85
-
86
- composeRefs = ref => {
87
- const { inputRef } = this.props;
88
- if (inputRef) {
89
- if (typeof inputRef === 'function') inputRef(ref);
90
- else inputRef.current = ref;
91
- }
92
- this.textInput.current = ref;
93
- };
94
-
95
- handleFocus = event => {
96
- const { onFocus } = this.props;
97
- this.setState({ focused: true });
98
- if (onFocus) {
99
- onFocus(event);
100
- }
101
- };
102
-
103
- focus = () => {
104
- if (this.textInput && this.textInput.current) {
105
- this.textInput.current.focus();
106
- }
107
- };
108
-
109
- togglePasswordVisibility = () =>
110
- this.setState(state => ({
111
- passwordVisible: !state.passwordVisible
112
- }));
113
-
114
- toggleShowPlaceholder = () =>
115
- this.setState(state => ({
116
- showPlaceholder: !state.showPlaceholder
117
- }));
118
-
119
- handleBlur = event => {
120
- const { onBlur } = this.props;
121
-
122
- this.setState({ focused: false });
123
- if (onBlur) {
124
- onBlur(event);
125
- }
126
- };
127
-
128
- render() {
129
- const { focused, passwordVisible, showPlaceholder } = this.state;
130
- const {
131
- activeColor,
132
- backgroundColor,
133
- caption,
134
- captionProps,
135
- containerStyle,
136
- error,
137
- errorColor,
138
- fileSize,
139
- iconColor,
140
- iconSize,
141
- inactiveColor,
142
- leadingIcon,
143
- multiline,
144
- onChange,
145
- onSubmit,
146
- placeholder,
147
- placeholderTextColor,
148
- secureTextEntry,
149
- showEye,
150
- textStyles,
151
- theme,
152
- title,
153
- trailingIcon,
154
- underlineHeight,
155
- value,
156
- withValueColor,
157
- textColor,
158
- titleActiveColor,
159
- tooltip,
160
- tooltipProps,
161
- tooltipIconProps,
162
- ...textInputProps
163
- } = this.props;
164
-
165
- const placeholderText = !title || (focused && showPlaceholder) ? placeholder : '';
166
- const hasError = !!error;
167
- const hasValue = !!value;
168
- const active = hasError || focused;
169
- const finalActiveColor = activeColor || theme.colors.primary;
170
- const finalTitleActiveColor = titleActiveColor || finalActiveColor;
171
- const finalInactiveColor = inactiveColor || theme.fonts.fontColor;
172
- const paddingStyle = this.getPaddingStyle();
173
- const inputStyle = !textStyles ? styles.input : {};
174
-
175
- return (
176
- <View style={[styles.root, { minHeight: theme.fonts.fontSizes.base * (2 + RATIO) }, containerStyle]}>
177
- <View style={styles.withTooltipContainer}>
178
- <TouchableWithoutFeedback disabled={this.isDisabled()} onPress={this.focus}>
179
- <View style={[styles.container, this.getContainerStyle(), containerStyle]}>
180
- <View>
181
- {trailingIcon && (
182
- <Icon
183
- color={iconColor}
184
- size={iconSize}
185
- width={iconSize}
186
- height={iconSize}
187
- style={[styles.trailingIcon, paddingStyle.paddingTop]}
188
- {...trailingIcon}
189
- />
190
- )}
191
- </View>
192
- <View style={[styles.innerContainer]}>
193
- <TextInput
194
- {...textInputProps}
195
- allowFontScaling={false}
196
- editable={!this.isDisabled()}
197
- multiline={multiline}
198
- onBlur={this.handleBlur}
199
- onFocus={this.handleFocus}
200
- onSubmitEditing={onSubmit}
201
- onChangeText={onChange}
202
- placeholder={placeholderText}
203
- placeholderTextColor={placeholderTextColor}
204
- ref={this.composeRefs}
205
- secureTextEntry={secureTextEntry && !passwordVisible}
206
- underlineColorAndroid="transparent"
207
- style={[inputStyle, this.getInputStyle(), { color: textColor }]}
208
- value={value}
209
- />
210
- {fileSize && <Text style={styles.sizeText}>{fileSize}</Text>}
211
- <Title
212
- active={focused || hasValue}
213
- activeColor={finalTitleActiveColor}
214
- disabled={this.isDisabled()}
215
- error={hasError}
216
- errorColor={errorColor}
217
- focused={focused}
218
- fontSize={theme.fonts.fontSizes.base}
219
- inactiveColor={finalInactiveColor}
220
- onAnimationEnd={this.toggleShowPlaceholder}
221
- withValueColor={withValueColor}
222
- >
223
- {title}
224
- </Title>
225
- </View>
226
- <View style={{ paddingBottom: paddingStyle.paddingBottom }}>
227
- {secureTextEntry && showEye && (
228
- <ShowPassword
229
- color={iconColor}
230
- onShowPassword={this.togglePasswordVisibility}
231
- passwordVisible={passwordVisible}
232
- size={iconSize}
233
- />
234
- )}
235
- </View>
236
- <View>
237
- {leadingIcon && (
238
- <IconButton
239
- color={iconColor}
240
- size={iconSize}
241
- width={iconSize}
242
- height={iconSize}
243
- style={paddingStyle.paddingTop}
244
- {...leadingIcon}
245
- />
246
- )}
247
- </View>
248
- <Underline
249
- active={active}
250
- activeColor={activeColor}
251
- disabled={this.isDisabled()}
252
- error={hasError}
253
- errorColor={errorColor}
254
- height={underlineHeight}
255
- inactiveColor={(hasValue && withValueColor) || finalInactiveColor}
256
- />
257
- </View>
258
- </TouchableWithoutFeedback>
259
- {!!tooltip && (
260
- <View
261
- style={{
262
- ...styles.tooltipContainer,
263
- height: ICON_MARGIN + iconSize,
264
- paddingBottom: paddingStyle.paddingBottom,
265
- marginBottom: underlineHeight
266
- }}
267
- >
268
- <UTTooltip content={tooltip} position="left" {...tooltipProps}>
269
- <Icon name="questioncircleo" type="antdesign" size={25} {...tooltipIconProps} />
270
- </UTTooltip>
271
- </View>
272
- )}
273
- </View>
274
-
275
- <CaptionLabel
276
- color={activeColor}
277
- error={error}
278
- errorColor={errorColor}
279
- style={this.getCaptionStyle()}
280
- {...captionProps}
281
- >
282
- {caption}
283
- </CaptionLabel>
284
- </View>
285
- );
286
- }
287
- }
288
-
289
- Input.propTypes = propTypes;
290
-
291
- Input.defaultProps = {
292
- autoCorrect: false,
293
- editable: true,
294
- iconSize: DEFAULT_ICON_SIZE,
295
- underlineHeight: 1,
296
- defaultContainerPadding: INPUT_ICON_MARGIN
297
- };
298
-
299
- export default withTheme(Input);
@@ -1,43 +0,0 @@
1
- import { ViewPropTypes } from 'deprecated-react-native-prop-types';
2
- import { bool, func, instanceOf, number, oneOfType, shape, string } from 'prop-types';
3
-
4
- import captionPropTypes from '../../../CaptionLabel/propTypes';
5
- import iconPropTypes from '../../../Icon/propTypes';
6
- import iconButtonPropTypes from '../../../IconButton/propTypes';
7
- import { themeType } from '../../../../theming';
8
-
9
- export default {
10
- activeColor: string,
11
- autoCorrect: bool,
12
- backgroundColor: string,
13
- caption: string,
14
- captionProps: shape(captionPropTypes),
15
- containerStyle: ViewPropTypes.style,
16
- containerPadding: number,
17
- disabled: bool,
18
- editable: bool,
19
- disabledTextStyles: ViewPropTypes.style,
20
- titleActiveColor: string,
21
- error: oneOfType([bool, string]),
22
- errorColor: string,
23
- iconColor: string,
24
- iconSize: number,
25
- inactiveColor: string,
26
- inputRef: oneOfType([func, instanceOf(Object)]),
27
- leadingIcon: shape(iconPropTypes),
28
- multiline: bool,
29
- onBlur: func,
30
- onChange: func,
31
- onFocus: func,
32
- onSubmit: func,
33
- placeholder: string,
34
- secureTextEntry: bool,
35
- showEye: bool,
36
- textStyles: ViewPropTypes.style,
37
- title: string,
38
- theme: themeType,
39
- trailingIcon: shape(iconButtonPropTypes),
40
- underlineHeight: number,
41
- value: string,
42
- withValueColor: string
43
- };
@@ -1,47 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- import {
4
- portraitModerateHorizontalScale,
5
- portraitModerateVerticalScale
6
- } from '../../../../utils/portraitScalingUtils';
7
-
8
- export const INPUT_ICON_MARGIN = portraitModerateHorizontalScale(5);
9
-
10
- export default StyleSheet.create({
11
- root: {
12
- flex: 1
13
- },
14
- container: {
15
- flex: 1,
16
- alignItems: 'center',
17
- borderTopLeftRadius: 3,
18
- borderTopRightRadius: 3,
19
- flexDirection: 'row',
20
- paddingTop: portraitModerateVerticalScale(4)
21
- },
22
- innerContainer: {
23
- flex: 1,
24
- justifyContent: 'flex-start'
25
- },
26
- input: {
27
- flex: 1,
28
- padding: 0,
29
- textAlignVertical: 'top'
30
- },
31
- leadingIcon: {
32
- paddingBottom: INPUT_ICON_MARGIN
33
- },
34
- sizeText: { paddingHorizontal: 8, paddingVertical: 0 },
35
- trailingIcon: {
36
- marginBottom: 1 / INPUT_ICON_MARGIN,
37
- marginRight: 1 / INPUT_ICON_MARGIN
38
- },
39
- withTooltipContainer: {
40
- flexDirection: 'row'
41
- },
42
- tooltipContainer: {
43
- alignSelf: 'flex-end',
44
- justifyContent: 'center',
45
- paddingLeft: 10
46
- }
47
- });