@widergy/mobile-ui 1.11.4 → 1.11.6
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/CHANGELOG.md +14 -0
- package/lib/components/UTButton/index.js +12 -3
- package/lib/components/UTIcon/README.md +22 -8
- package/lib/components/UTIcon/constants.js +24 -0
- package/lib/components/UTIcon/index.js +15 -5
- package/lib/components/UTIcon/theme.js +18 -0
- package/lib/components/UTLabel/README.md +74 -0
- package/lib/components/UTLabel/theme.js +11 -2
- package/lib/components/UTTextArea/constants.js +1 -0
- package/lib/components/UTTextArea/index.js +14 -0
- package/lib/components/UTTextInput/index.js +9 -60
- package/lib/components/UTTextInput/{components → versions/V0/components}/BaseInput/index.js +3 -3
- package/lib/components/UTTextInput/{components → versions/V0/components}/InputAnimatedBorder/index.js +1 -1
- package/lib/components/UTTextInput/{components → versions/V0/components}/InputLabel/index.js +1 -1
- package/lib/components/UTTextInput/{flavors → versions/V0/flavors}/FilledInput/index.js +6 -6
- package/lib/components/UTTextInput/{flavors → versions/V0/flavors}/OutlinedInput/index.js +6 -6
- package/lib/components/UTTextInput/{flavors → versions/V0/flavors}/StandardInput/index.js +6 -6
- package/lib/components/UTTextInput/versions/V0/index.js +67 -0
- package/lib/components/UTTextInput/versions/V1/components/TextInputField/constants.js +12 -0
- package/lib/components/UTTextInput/versions/V1/components/TextInputField/index.js +202 -0
- package/lib/components/UTTextInput/versions/V1/components/TextInputField/theme.js +124 -0
- package/lib/components/UTTextInput/versions/V1/components/TextInputField/utils.js +11 -0
- package/lib/components/UTTextInput/versions/V1/constants.js +8 -0
- package/lib/components/UTTextInput/versions/V1/index.js +94 -0
- package/lib/components/UTTextInput/versions/V1/proptypes.js +36 -0
- package/lib/components/UTTextInput/versions/V1/styles.js +10 -0
- package/lib/components/UTTextInput/versions/V1/utils.js +1 -0
- package/lib/components/UTValidation/README.md +56 -0
- package/lib/components/UTValidation/constants.js +39 -0
- package/lib/components/UTValidation/index.js +69 -0
- package/lib/components/UTValidation/styles.js +25 -0
- package/lib/components/UTValidation/theme.js +17 -0
- package/lib/components/UTValidation/utils.js +8 -0
- package/lib/index.js +5 -2
- package/lib/theming/README.md +10 -18
- package/package.json +1 -1
- package/lib/components/UTTextInput/flavors/FilledInput/constants.js +0 -1
- package/lib/components/UTTextInput/flavors/FilledInput/utils.js +0 -35
- package/lib/components/UTTextInput/flavors/OutlinedInput/constants.js +0 -1
- package/lib/components/UTTextInput/flavors/OutlinedInput/utils.js +0 -37
- package/lib/components/UTTextInput/flavors/StandardInput/constants.js +0 -1
- /package/lib/components/UTTextInput/{components → versions/V0/components}/BaseInput/constants.js +0 -0
- /package/lib/components/UTTextInput/{components → versions/V0/components}/BaseInput/styles.js +0 -0
- /package/lib/components/UTTextInput/{components → versions/V0/components}/InputAnimatedBorder/styles.js +0 -0
- /package/lib/components/UTTextInput/{components → versions/V0/components}/InputAnimatedBorder/utils.js +0 -0
- /package/lib/components/UTTextInput/{components → versions/V0/components}/InputLabel/styles.js +0 -0
- /package/lib/components/UTTextInput/{flavors → versions/V0/flavors}/FilledInput/styles.js +0 -0
- /package/lib/components/UTTextInput/{flavors → versions/V0/flavors}/OutlinedInput/styles.js +0 -0
- /package/lib/components/UTTextInput/{flavors → versions/V0/flavors}/StandardInput/styles.js +0 -0
- /package/lib/components/UTTextInput/{proptypes.js → versions/V0/proptypes.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.11.6](https://github.com/widergy/mobile-ui/compare/v1.11.5...v1.11.6) (2024-06-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add utvalidation and integrate palette in uticon ([#294](https://github.com/widergy/mobile-ui/issues/294)) ([fbb09a0](https://github.com/widergy/mobile-ui/commit/fbb09a08c3c70beb537f2b8652c754531a9f0586))
|
|
7
|
+
|
|
8
|
+
## [1.11.5](https://github.com/widergy/mobile-ui/compare/v1.11.4...v1.11.5) (2024-06-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* font weights ([#292](https://github.com/widergy/mobile-ui/issues/292)) ([27744fd](https://github.com/widergy/mobile-ui/commit/27744fd3ed185d4ef1d1d2201be300b31d088740))
|
|
14
|
+
|
|
1
15
|
## [1.11.4](https://github.com/widergy/mobile-ui/compare/v1.11.3...v1.11.4) (2024-06-18)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { bool, func, elementType, string } from 'prop-types';
|
|
2
|
+
import { bool, func, elementType, string, shape } from 'prop-types';
|
|
3
3
|
import { Pressable, View } from 'react-native';
|
|
4
4
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
5
5
|
|
|
@@ -51,7 +51,12 @@ const UTButton = ({
|
|
|
51
51
|
const IconToShow =
|
|
52
52
|
Icon &&
|
|
53
53
|
(isUTIcon(Icon) ? (
|
|
54
|
-
|
|
54
|
+
(() => {
|
|
55
|
+
const { fontSize, color, ...remainingIconStyles } = iconStyles;
|
|
56
|
+
return (
|
|
57
|
+
<UTIcon color={textStyles.colorTheme} style={remainingIconStyles} size={fontSize} name={Icon} />
|
|
58
|
+
);
|
|
59
|
+
})()
|
|
55
60
|
) : (
|
|
56
61
|
<Icon style={iconStyles} fill={iconStyles.color} />
|
|
57
62
|
));
|
|
@@ -87,7 +92,11 @@ UTButton.propTypes = {
|
|
|
87
92
|
loading: bool,
|
|
88
93
|
onPress: func,
|
|
89
94
|
size: string,
|
|
90
|
-
style:
|
|
95
|
+
style: shape({
|
|
96
|
+
childrenContainer: ViewPropTypes.style,
|
|
97
|
+
icon: ViewPropTypes.style,
|
|
98
|
+
root: ViewPropTypes.style
|
|
99
|
+
}),
|
|
91
100
|
theme: themeType,
|
|
92
101
|
variant: string
|
|
93
102
|
};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Icon component using Tabler Icons library.
|
|
6
6
|
|
|
7
7
|
### UX/UI Icon Lists
|
|
8
|
+
|
|
8
9
|
- [Figma](https://www.figma.com/file/upiqGm1l10mBTbV9gn35Fh/Icons---Stylesheet?type=design&node-id=3-5&mode=design)
|
|
9
10
|
- [Zeroheight](https://zeroheight.com/6d447f9f5/p/87aa21-resources)
|
|
10
11
|
|
|
@@ -31,16 +32,29 @@ Exceptions may exists to these rules.
|
|
|
31
32
|
|
|
32
33
|
### Color
|
|
33
34
|
|
|
34
|
-
Android always requires a color value, so the prop defaults to
|
|
35
|
+
Android always requires a color value, so the prop defaults to "dark".
|
|
36
|
+
|
|
37
|
+
It must be one of these:
|
|
38
|
+
|
|
39
|
+
- "accent",
|
|
40
|
+
- "dark",
|
|
41
|
+
- "error",
|
|
42
|
+
- "gray",
|
|
43
|
+
- "information",
|
|
44
|
+
- "light",
|
|
45
|
+
- "negative",
|
|
46
|
+
- "neutral",
|
|
47
|
+
- "success",
|
|
48
|
+
- "warning"
|
|
35
49
|
|
|
36
50
|
### Props
|
|
37
51
|
|
|
38
|
-
| Name
|
|
39
|
-
|
|
|
40
|
-
| color
|
|
41
|
-
| name
|
|
42
|
-
| size
|
|
43
|
-
| style
|
|
52
|
+
| Name | Description | Default |
|
|
53
|
+
| ----- | ---------------------------------------- | ------- |
|
|
54
|
+
| color | The icon color, must be from the Palette | 'dark' |
|
|
55
|
+
| name | The name of the icon in TablerIcons | ------- |
|
|
56
|
+
| size | The icon size | ------- |
|
|
57
|
+
| style | The style to be aplied to the Icon | ------- |
|
|
44
58
|
|
|
45
59
|
### Usage
|
|
46
60
|
|
|
@@ -60,4 +74,4 @@ const MyComponent = () => {
|
|
|
60
74
|
};
|
|
61
75
|
|
|
62
76
|
export default MyComponent;
|
|
63
|
-
```
|
|
77
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const SHADES = {
|
|
2
|
+
shade01: '01',
|
|
3
|
+
shade02: '02',
|
|
4
|
+
shade03: '03',
|
|
5
|
+
shade04: '04',
|
|
6
|
+
shade05: '05'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const COLOR_THEMES = {
|
|
10
|
+
accent: 'accent',
|
|
11
|
+
dark: 'dark',
|
|
12
|
+
error: 'error',
|
|
13
|
+
gray: 'gray',
|
|
14
|
+
information: 'information',
|
|
15
|
+
light: 'light',
|
|
16
|
+
negative: 'negative',
|
|
17
|
+
neutral: 'neutral',
|
|
18
|
+
success: 'success',
|
|
19
|
+
warning: 'warning'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const DEFAULT_PROPS = {
|
|
23
|
+
color: 'dark'
|
|
24
|
+
};
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import * as TablerIcons from '@tabler/icons-react-native';
|
|
3
2
|
import { number, string } from 'prop-types';
|
|
4
3
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
4
|
+
import * as TablerIcons from '@tabler/icons-react-native';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const IconComponent = TablerIcons[name];
|
|
6
|
+
import { withTheme } from '../../theming';
|
|
8
7
|
|
|
8
|
+
import { retrieveStyle } from './theme';
|
|
9
|
+
|
|
10
|
+
const UTIcon = ({ color = 'dark', name, shade, size, style, theme }) => {
|
|
11
|
+
const IconComponent = TablerIcons[name];
|
|
9
12
|
if (!IconComponent) return null;
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
const themeStyles = retrieveStyle({ color, theme, shade });
|
|
15
|
+
const filled = name.endsWith('Filled');
|
|
16
|
+
const iconColor = filled ? 'transparent' : themeStyles.color;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<IconComponent color={iconColor} size={size} style={[filled && { color: themeStyles.color }, style]} />
|
|
20
|
+
);
|
|
12
21
|
};
|
|
13
22
|
|
|
14
23
|
UTIcon.propTypes = {
|
|
15
24
|
color: string,
|
|
16
25
|
name: string,
|
|
26
|
+
shade: string,
|
|
17
27
|
size: number,
|
|
18
28
|
style: ViewPropTypes.style
|
|
19
29
|
};
|
|
20
30
|
|
|
21
|
-
export default UTIcon;
|
|
31
|
+
export default withTheme(UTIcon);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { COLOR_THEMES, DEFAULT_PROPS, SHADES } from './constants';
|
|
2
|
+
|
|
3
|
+
const getDefaultColorShade = colorTheme =>
|
|
4
|
+
colorTheme === COLOR_THEMES.gray
|
|
5
|
+
? SHADES.shade04
|
|
6
|
+
: colorTheme === COLOR_THEMES.light
|
|
7
|
+
? SHADES.shade01
|
|
8
|
+
: SHADES.shade05;
|
|
9
|
+
|
|
10
|
+
const variantsColorTheme = (colorTheme, shade, theme) => {
|
|
11
|
+
const colorThemeDefinition = theme.Palette[colorTheme] || theme.Palette[DEFAULT_PROPS.color];
|
|
12
|
+
const colorShade = shade || getDefaultColorShade(colorTheme);
|
|
13
|
+
return colorThemeDefinition[colorShade] || '#000';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const retrieveStyle = ({ color: colorTheme, shade, theme }) => ({
|
|
17
|
+
color: variantsColorTheme(colorTheme, shade, theme)
|
|
18
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# UTLabel
|
|
2
|
+
|
|
3
|
+
Component used for displaying text values and markdown.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Name | Type | Default | Description |
|
|
8
|
+
| ----------------- | ------ | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| colorTheme | string | 'primary' | Color theme to style the UTLabel. Has to be defined in the proyect theme. [Example](#colortheme). |
|
|
10
|
+
| markdownRenderers | object | [MARKDOWN_RENDERERS](./constants.js#L36) | ⚠️ Requires `withMarkdown` to be set to `true` <br />Object mapping tag names to React components. The keys in components are HTML equivalents for the things you write with markdown [List of tags](#markdown-renderers). |
|
|
11
|
+
| shade | string | | The colorTheme shade |
|
|
12
|
+
| style | object | | Additional style. |
|
|
13
|
+
| title | string | | [Title global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title). |
|
|
14
|
+
| variant | string | 'body' | Defines html component to use. For a list of available variants, check [here](#variants). Font sizes can be overwritten (⚠️ for the entire proyect) through the proyect's theme. |
|
|
15
|
+
| weight | string | 'regular' | Defines font-weight to be used. For a list of available options, check [here](#font-weights). |
|
|
16
|
+
| withMarkdown | bool | false | Tells the component whether or not to render text inside as markdown. |
|
|
17
|
+
|
|
18
|
+
### colorTheme
|
|
19
|
+
|
|
20
|
+
It must be one of these:
|
|
21
|
+
|
|
22
|
+
- "accent",
|
|
23
|
+
- "dark",
|
|
24
|
+
- "error",
|
|
25
|
+
- "gray",
|
|
26
|
+
- "information",
|
|
27
|
+
- "light",
|
|
28
|
+
- "negative",
|
|
29
|
+
- "neutral",
|
|
30
|
+
- "success",
|
|
31
|
+
- "warning"
|
|
32
|
+
|
|
33
|
+
```JSX
|
|
34
|
+
<UTLabel colorTheme='error'>Your text here</UTLabel>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### shade
|
|
38
|
+
|
|
39
|
+
It must be one of these:
|
|
40
|
+
|
|
41
|
+
- "01",
|
|
42
|
+
- "02",
|
|
43
|
+
- "03",
|
|
44
|
+
- "04",
|
|
45
|
+
- "05"
|
|
46
|
+
|
|
47
|
+
### variants
|
|
48
|
+
|
|
49
|
+
| Variant | Component | Default font size |
|
|
50
|
+
| --------- | --------- | ----------------- |
|
|
51
|
+
| title1 | h1 | 30px |
|
|
52
|
+
| title2 | h2 | 24px |
|
|
53
|
+
| title3 | h3 | 22px |
|
|
54
|
+
| subtitle1 | h4 | 18px |
|
|
55
|
+
| subtitle2 | h5 | 16px |
|
|
56
|
+
| body | span | 16px |
|
|
57
|
+
| small | span | 14px |
|
|
58
|
+
| xsmall | span | 13px |
|
|
59
|
+
| th | th | 16px |
|
|
60
|
+
| td | td | 16px |
|
|
61
|
+
|
|
62
|
+
### weights
|
|
63
|
+
|
|
64
|
+
| Name | Weight |
|
|
65
|
+
| ---------- | ------ |
|
|
66
|
+
| thin | 100 |
|
|
67
|
+
| extralight | 200 |
|
|
68
|
+
| light | 300 |
|
|
69
|
+
| regular | 400 |
|
|
70
|
+
| medium | 500 |
|
|
71
|
+
| semibold | 600 |
|
|
72
|
+
| bold | 700 |
|
|
73
|
+
| extrabold | 800 |
|
|
74
|
+
| black | 900 |
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IS_IOS } from '../../utils/platformUtils/constants';
|
|
2
|
+
|
|
1
3
|
import { COLOR_THEMES, DEFAULT_PROPS, SHADES, VARIANTS_SIZES, WEIGHTS } from './constants';
|
|
2
4
|
|
|
3
5
|
const getDefaultColorShade = colorTheme =>
|
|
@@ -13,14 +15,21 @@ const variantsColorTheme = (colorTheme, shade, theme) => {
|
|
|
13
15
|
return colorThemeDefinition[colorShade] || '#000';
|
|
14
16
|
};
|
|
15
17
|
|
|
18
|
+
const getFontFamily = (theme, weight) => {
|
|
19
|
+
if (weight === WEIGHTS[DEFAULT_PROPS.weight] || IS_IOS) return theme.fonts.fontFamily;
|
|
20
|
+
return theme.fonts?.customVariants?.[weight];
|
|
21
|
+
};
|
|
22
|
+
|
|
16
23
|
export const retrieveStyle = ({ colorTheme, field, shade, theme, variant, weight }) => ({
|
|
17
24
|
color: variantsColorTheme(
|
|
18
25
|
field?.configuration?.colorTheme ?? colorTheme,
|
|
19
26
|
field?.configuration?.shade ?? shade,
|
|
20
27
|
theme
|
|
21
28
|
),
|
|
22
|
-
fontFamily: theme
|
|
29
|
+
fontFamily: getFontFamily(theme, field?.configuration?.weight ?? weight),
|
|
23
30
|
fontSize: VARIANTS_SIZES[field?.configuration?.variant ?? variant] || VARIANTS_SIZES[DEFAULT_PROPS.variant],
|
|
24
|
-
fontWeight:
|
|
31
|
+
fontWeight: IS_IOS
|
|
32
|
+
? WEIGHTS[field?.configuration?.weight ?? weight] || WEIGHTS[DEFAULT_PROPS.weight]
|
|
33
|
+
: null,
|
|
25
34
|
margin: 0
|
|
26
35
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_MAX_ROWS = 4;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import UTTextInput from '../UTTextInput';
|
|
4
|
+
import propTypes from '../UTTextInput/versions/V1/proptypes';
|
|
5
|
+
|
|
6
|
+
import { DEFAULT_MAX_ROWS } from './constants';
|
|
7
|
+
|
|
8
|
+
const UTTextArea = ({ maxRows = DEFAULT_MAX_ROWS, ...props }) => (
|
|
9
|
+
<UTTextInput maxRows={maxRows} version="V1" {...props} />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
UTTextArea.propTypes = propTypes;
|
|
13
|
+
|
|
14
|
+
export default UTTextArea;
|
|
@@ -1,67 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { string } from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import V0 from './versions/V0';
|
|
5
|
+
import V1 from './versions/V1';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import InputTypes from './proptypes';
|
|
10
|
-
|
|
11
|
-
const variants = {
|
|
12
|
-
filled: FilledInput,
|
|
13
|
-
standard: StandardInput,
|
|
14
|
-
outlined: OutlinedInput
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const UTTextInput = ({
|
|
18
|
-
variant = 'standard',
|
|
19
|
-
theme,
|
|
20
|
-
onFocus,
|
|
21
|
-
onBlur,
|
|
22
|
-
controlledFocus,
|
|
23
|
-
select,
|
|
24
|
-
errorTextProps,
|
|
25
|
-
...props
|
|
26
|
-
}) => {
|
|
27
|
-
const [inputHeight, setInputHeight] = useState(0);
|
|
28
|
-
const [focused, setFocused] = useState(false);
|
|
29
|
-
|
|
30
|
-
const { UTTextInput: UTTextInputStyles, UTSelect } = theme;
|
|
31
|
-
const themeStyles = (select && UTSelect?.[variant]) || UTTextInputStyles?.[variant];
|
|
32
|
-
|
|
33
|
-
const handleFocus = event => {
|
|
34
|
-
setFocused(true);
|
|
35
|
-
if (onFocus) onFocus(event);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const handleBlur = event => {
|
|
39
|
-
setFocused(false);
|
|
40
|
-
if (onBlur) onBlur(event);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const handleLayout = e => setInputHeight(e.nativeEvent.layout.height);
|
|
44
|
-
|
|
45
|
-
const InputComponent = variants[variant];
|
|
46
|
-
return (
|
|
47
|
-
<InputComponent
|
|
48
|
-
{...props}
|
|
49
|
-
onLayout={handleLayout}
|
|
50
|
-
onBlur={handleBlur}
|
|
51
|
-
onFocus={handleFocus}
|
|
52
|
-
focused={focused || controlledFocus}
|
|
53
|
-
themeStyles={themeStyles}
|
|
54
|
-
inputHeight={inputHeight}
|
|
55
|
-
select={select}
|
|
56
|
-
overflowControl={props?.configuration?.overflowControl}
|
|
57
|
-
errorTextProps={errorTextProps}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
7
|
+
const UTTextInput = ({ version = 'V0', ...props }) => {
|
|
8
|
+
const Component = { V0, V1 }[version];
|
|
9
|
+
return <Component {...props} />;
|
|
60
10
|
};
|
|
61
11
|
|
|
62
12
|
UTTextInput.propTypes = {
|
|
63
|
-
|
|
64
|
-
...InputTypes
|
|
13
|
+
version: string
|
|
65
14
|
};
|
|
66
15
|
|
|
67
|
-
export default
|
|
16
|
+
export default UTTextInput;
|
|
@@ -4,9 +4,9 @@ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
|
4
4
|
import { TextInput } from 'react-native';
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
|
|
7
|
-
import { withTheme } from '
|
|
8
|
-
import Icon from '
|
|
9
|
-
import Touchable from '
|
|
7
|
+
import { withTheme } from '../../../../../../theming';
|
|
8
|
+
import Icon from '../../../../../Icon';
|
|
9
|
+
import Touchable from '../../../../../Touchable';
|
|
10
10
|
|
|
11
11
|
import { DEBOUNCE_DELAY, DEBOUNCE_CONFIG, VISIBILITY, VISIBILITY_OFF } from './constants';
|
|
12
12
|
import styles from './styles';
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useRef } from 'react';
|
|
|
2
2
|
import { Animated, View } from 'react-native';
|
|
3
3
|
import { bool, oneOf, string } from 'prop-types';
|
|
4
4
|
|
|
5
|
-
import { withTheme } from '
|
|
5
|
+
import { withTheme } from '../../../../../../theming';
|
|
6
6
|
|
|
7
7
|
import styles from './styles';
|
|
8
8
|
import { createBorderAnimations } from './utils';
|
package/lib/components/UTTextInput/{components → versions/V0/components}/InputLabel/index.js
RENAMED
|
@@ -2,7 +2,7 @@ import { bool, number, oneOf, shape, string } from 'prop-types';
|
|
|
2
2
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { Animated } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import { withTheme } from '
|
|
5
|
+
import { withTheme } from '../../../../../../theming';
|
|
6
6
|
|
|
7
7
|
import styles, { ANIM_DURATION } from './styles';
|
|
8
8
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { withTheme } from '
|
|
5
|
-
import CaptionLabel from '
|
|
4
|
+
import { withTheme } from '../../../../../../theming';
|
|
5
|
+
import CaptionLabel from '../../../../../CaptionLabel';
|
|
6
|
+
import InputTypes from '../../proptypes';
|
|
7
|
+
import UTTooltip from '../../../../../UTTooltip';
|
|
6
8
|
import BaseInput from '../../components/BaseInput';
|
|
7
|
-
import InputAnimatedBorder from '../../components/InputAnimatedBorder';
|
|
8
9
|
import InputLabel from '../../components/InputLabel';
|
|
9
|
-
import
|
|
10
|
-
import Icon from '
|
|
11
|
-
import UTTooltip from '../../../UTTooltip';
|
|
10
|
+
import InputAnimatedBorder from '../../components/InputAnimatedBorder';
|
|
11
|
+
import Icon from '../../../../../Icon';
|
|
12
12
|
|
|
13
13
|
import ownStyles, { CONTAINER_PADDINGS } from './styles';
|
|
14
14
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { withTheme } from '
|
|
5
|
-
import CaptionLabel from '
|
|
4
|
+
import { withTheme } from '../../../../../../theming';
|
|
5
|
+
import CaptionLabel from '../../../../../CaptionLabel';
|
|
6
|
+
import InputTypes from '../../proptypes';
|
|
7
|
+
import Label from '../../../../../Label';
|
|
8
|
+
import UTTooltip from '../../../../../UTTooltip';
|
|
6
9
|
import BaseInput from '../../components/BaseInput';
|
|
7
10
|
import InputLabel from '../../components/InputLabel';
|
|
8
|
-
import
|
|
9
|
-
import Icon from '../../../Icon';
|
|
10
|
-
import UTTooltip from '../../../UTTooltip';
|
|
11
|
-
import Label from '../../../Label';
|
|
11
|
+
import Icon from '../../../../../Icon';
|
|
12
12
|
|
|
13
13
|
import ownStyles, { CONTAINER_PADDINGS } from './styles';
|
|
14
14
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { withTheme } from '
|
|
5
|
-
import
|
|
6
|
-
import InputLabel from '../../components/InputLabel';
|
|
4
|
+
import { withTheme } from '../../../../../../theming';
|
|
5
|
+
import CaptionLabel from '../../../../../CaptionLabel';
|
|
7
6
|
import InputTypes from '../../proptypes';
|
|
7
|
+
import UTTooltip from '../../../../../UTTooltip';
|
|
8
8
|
import BaseInput from '../../components/BaseInput';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import InputLabel from '../../components/InputLabel';
|
|
10
|
+
import InputAnimatedBorder from '../../components/InputAnimatedBorder';
|
|
11
|
+
import Icon from '../../../../../Icon';
|
|
12
12
|
|
|
13
13
|
import ownStyles, { CONTAINER_PADDINGS } from './styles';
|
|
14
14
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { oneOf } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { withTheme } from '../../../../theming';
|
|
5
|
+
|
|
6
|
+
import FilledInput from './flavors/FilledInput';
|
|
7
|
+
import StandardInput from './flavors/StandardInput';
|
|
8
|
+
import OutlinedInput from './flavors/OutlinedInput';
|
|
9
|
+
import InputTypes from './proptypes';
|
|
10
|
+
|
|
11
|
+
const variants = {
|
|
12
|
+
filled: FilledInput,
|
|
13
|
+
standard: StandardInput,
|
|
14
|
+
outlined: OutlinedInput
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const UTTextInput = ({
|
|
18
|
+
variant = 'standard',
|
|
19
|
+
theme,
|
|
20
|
+
onFocus,
|
|
21
|
+
onBlur,
|
|
22
|
+
controlledFocus,
|
|
23
|
+
select,
|
|
24
|
+
errorTextProps,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
27
|
+
const [inputHeight, setInputHeight] = useState(0);
|
|
28
|
+
const [focused, setFocused] = useState(false);
|
|
29
|
+
|
|
30
|
+
const { UTTextInput: UTTextInputStyles, UTSelect } = theme;
|
|
31
|
+
const themeStyles = (select && UTSelect?.[variant]) || UTTextInputStyles?.[variant];
|
|
32
|
+
|
|
33
|
+
const handleFocus = event => {
|
|
34
|
+
setFocused(true);
|
|
35
|
+
if (onFocus) onFocus(event);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleBlur = event => {
|
|
39
|
+
setFocused(false);
|
|
40
|
+
if (onBlur) onBlur(event);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handleLayout = e => setInputHeight(e.nativeEvent.layout.height);
|
|
44
|
+
|
|
45
|
+
const InputComponent = variants[variant];
|
|
46
|
+
return (
|
|
47
|
+
<InputComponent
|
|
48
|
+
{...props}
|
|
49
|
+
onLayout={handleLayout}
|
|
50
|
+
onBlur={handleBlur}
|
|
51
|
+
onFocus={handleFocus}
|
|
52
|
+
focused={focused || controlledFocus}
|
|
53
|
+
themeStyles={themeStyles}
|
|
54
|
+
inputHeight={inputHeight}
|
|
55
|
+
select={select}
|
|
56
|
+
overflowControl={props?.configuration?.overflowControl}
|
|
57
|
+
errorTextProps={errorTextProps}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
UTTextInput.propTypes = {
|
|
63
|
+
variant: oneOf(['standard', 'outlined', 'filled']),
|
|
64
|
+
...InputTypes
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default withTheme(UTTextInput);
|