react-native-molecules 0.5.0-beta.1 → 0.5.0-beta.11
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/README.md +87 -0
- package/components/Accordion/index.tsx +1 -6
- package/components/Accordion/utils.ts +17 -14
- package/components/ActivityIndicator/ActivityIndicator.tsx +12 -20
- package/components/ActivityIndicator/index.tsx +1 -5
- package/components/Appbar/index.tsx +1 -4
- package/components/Appbar/utils.ts +33 -21
- package/components/Avatar/index.tsx +1 -5
- package/components/Avatar/utils.ts +2 -6
- package/components/Backdrop/Backdrop.tsx +2 -2
- package/components/Backdrop/index.tsx +1 -5
- package/components/Backdrop/utils.ts +5 -6
- package/components/Badge/index.tsx +1 -5
- package/components/Badge/utils.ts +2 -6
- package/components/Button/Button.tsx +211 -264
- package/components/Button/index.tsx +9 -7
- package/components/Button/types.ts +16 -2
- package/components/Button/utils.ts +231 -210
- package/components/Card/Card.tsx +8 -4
- package/components/Card/CardContent.tsx +5 -4
- package/components/Card/CardHeader.tsx +5 -3
- package/components/Card/CardMedia.tsx +5 -3
- package/components/Card/CardTypography.tsx +5 -3
- package/components/Card/index.tsx +1 -5
- package/components/Card/utils.ts +5 -6
- package/components/Checkbox/Checkbox.tsx +1 -0
- package/components/Checkbox/CheckboxBase.ios.tsx +1 -0
- package/components/Checkbox/CheckboxBase.tsx +24 -128
- package/components/Checkbox/index.tsx +1 -5
- package/components/Checkbox/utils.ts +6 -31
- package/components/Chip/Chip.tsx +40 -52
- package/components/Chip/index.tsx +1 -5
- package/components/Chip/utils.ts +5 -13
- package/components/DatePickerDocked/index.tsx +1 -5
- package/components/DatePickerDocked/utils.ts +21 -19
- package/components/DatePickerInline/index.tsx +1 -5
- package/components/DatePickerInline/utils.ts +41 -28
- package/components/DatePickerInput/DatePickerInput.tsx +4 -2
- package/components/DatePickerInput/DatePickerInputWithoutModal.tsx +0 -4
- package/components/DatePickerInput/index.tsx +1 -5
- package/components/DatePickerInput/types.ts +1 -3
- package/components/DatePickerInput/utils.ts +5 -6
- package/components/DatePickerModal/CalendarEdit.tsx +10 -9
- package/components/DatePickerModal/DatePickerModalHeader.tsx +1 -1
- package/components/DatePickerModal/index.tsx +1 -5
- package/components/DatePickerModal/utils.ts +17 -16
- package/components/DateTimePicker/index.tsx +1 -5
- package/components/DateTimePicker/utils.ts +5 -6
- package/components/Dialog/index.tsx +1 -5
- package/components/Dialog/utils.ts +22 -16
- package/components/Drawer/Collapsible/utils.ts +13 -13
- package/components/Drawer/Drawer.tsx +2 -3
- package/components/Drawer/DrawerContent.tsx +5 -3
- package/components/Drawer/DrawerFooter.tsx +5 -4
- package/components/Drawer/DrawerHeader.tsx +5 -4
- package/components/Drawer/DrawerItem.tsx +5 -3
- package/components/Drawer/DrawerItemGroup.tsx +5 -4
- package/components/Drawer/index.tsx +1 -5
- package/components/Drawer/utils.ts +7 -7
- package/components/ElementGroup/ElementGroup.tsx +16 -14
- package/components/ElementGroup/index.tsx +1 -5
- package/components/ElementGroup/utils.ts +5 -6
- package/components/FAB/index.tsx +1 -5
- package/components/FAB/utils.ts +2 -6
- package/components/FilePicker/FilePicker.tsx +47 -76
- package/components/FilePicker/index.tsx +1 -5
- package/components/FilePicker/utils.ts +5 -6
- package/components/HelperText/HelperText.tsx +0 -35
- package/components/HelperText/index.tsx +1 -5
- package/components/HelperText/utils.ts +5 -7
- package/components/HorizontalDivider/HorizontalDivider.tsx +5 -3
- package/components/HorizontalDivider/index.tsx +1 -5
- package/components/Icon/CrossFadeIcon.tsx +3 -5
- package/components/Icon/Icon.tsx +2 -4
- package/components/Icon/iconFactory.tsx +3 -3
- package/components/Icon/index.tsx +2 -6
- package/components/Icon/types.ts +17 -6
- package/components/IconButton/IconButton.tsx +45 -58
- package/components/IconButton/index.tsx +1 -5
- package/components/IconButton/utils.ts +153 -49
- package/components/If/index.tsx +1 -5
- package/components/InputAddon/index.tsx +1 -5
- package/components/InputAddon/utils.ts +5 -6
- package/components/Link/index.tsx +1 -5
- package/components/Link/utils.ts +2 -6
- package/components/ListItem/index.tsx +1 -5
- package/components/ListItem/utils.ts +13 -11
- package/components/LoadingIndicator/LoadingIndicator.tsx +253 -0
- package/components/LoadingIndicator/LoadingIndicator.web.tsx +136 -0
- package/components/LoadingIndicator/index.tsx +13 -0
- package/components/LoadingIndicator/utils.ts +117 -0
- package/components/Menu/index.tsx +1 -5
- package/components/Menu/utils.ts +6 -8
- package/components/Modal/index.tsx +1 -5
- package/components/Modal/utils.ts +2 -6
- package/components/NavigationRail/NavigationRailHeader.tsx +1 -1
- package/components/NavigationRail/index.tsx +1 -5
- package/components/NavigationRail/utils.ts +21 -17
- package/components/NavigationStack/index.tsx +1 -5
- package/components/NavigationStack/utils.tsx +7 -1
- package/components/Portal/index.tsx +1 -5
- package/components/RadioButton/index.ts +1 -5
- package/components/RadioButton/utils.ts +9 -8
- package/components/Rating/index.tsx +1 -5
- package/components/Rating/utils.ts +6 -8
- package/components/Select/Select.tsx +369 -507
- package/components/Select/index.ts +7 -14
- package/components/Select/types.ts +2 -4
- package/components/Select/utils.ts +215 -0
- package/components/Slot/Slot.tsx +244 -0
- package/components/Slot/compose-refs.tsx +60 -0
- package/components/Slot/index.tsx +8 -0
- package/components/StateLayer/index.tsx +1 -5
- package/components/StateLayer/utils.ts +5 -6
- package/components/Surface/Surface.android.tsx +34 -8
- package/components/Surface/Surface.ios.tsx +36 -29
- package/components/Surface/Surface.tsx +31 -4
- package/components/Surface/index.tsx +1 -5
- package/components/Surface/utils.ts +49 -36
- package/components/Switch/Switch.tsx +8 -2
- package/components/Switch/index.tsx +1 -5
- package/components/Switch/utils.ts +2 -6
- package/components/Tabs/TabItem.tsx +35 -58
- package/components/Tabs/TabLabel.tsx +5 -9
- package/components/Tabs/Tabs.tsx +154 -149
- package/components/Tabs/index.tsx +1 -5
- package/components/Tabs/utils.ts +25 -12
- package/components/Text/Text.tsx +2 -8
- package/components/TextInput/TextInput.tsx +655 -571
- package/components/TextInput/index.tsx +19 -7
- package/components/TextInput/types.ts +76 -27
- package/components/TextInput/utils.ts +232 -159
- package/components/TextInputWithMask/index.tsx +1 -5
- package/components/TimePicker/AmPmSwitcher.tsx +1 -1
- package/components/TimePicker/index.tsx +1 -5
- package/components/TimePicker/utils.ts +29 -21
- package/components/TimePickerField/TimePickerField.tsx +7 -5
- package/components/TimePickerField/index.tsx +1 -5
- package/components/TimePickerField/utils.ts +5 -6
- package/components/TimePickerModal/TimePickerModal.tsx +6 -2
- package/components/TimePickerModal/index.tsx +1 -5
- package/components/TimePickerModal/utils.ts +5 -6
- package/components/Tooltip/TooltipTrigger.tsx +25 -16
- package/components/Tooltip/index.tsx +1 -5
- package/components/Tooltip/utils.ts +5 -6
- package/components/TouchableRipple/TouchableRipple.native.tsx +50 -14
- package/components/TouchableRipple/TouchableRipple.tsx +137 -47
- package/components/TouchableRipple/index.tsx +1 -5
- package/components/TouchableRipple/utils.ts +5 -6
- package/components/VerticalDivider/VerticalDivider.tsx +9 -8
- package/components/VerticalDivider/index.tsx +1 -5
- package/core/componentsRegistry.ts +31 -19
- package/hocs/withPortal.tsx +1 -1
- package/hooks/index.tsx +0 -5
- package/hooks/useControlledValue.tsx +20 -4
- package/hooks/useSubcomponents.tsx +63 -31
- package/hooks/useWhatHasUpdated.tsx +48 -0
- package/package.json +12 -15
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +5 -2
- package/styles/shadow.ts +2 -1
- package/styles/themes/LightTheme.tsx +1 -1
- package/utils/extractPropertiesFromStyles.ts +25 -0
- package/utils/lodash.ts +77 -6
- package/utils/repository.ts +2 -52
- package/hooks/useSearchable.tsx +0 -74
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
2
|
-
import TextInputDefault
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
|
+
import TextInputDefault, {
|
|
3
|
+
TextInputIcon,
|
|
4
|
+
TextInputLabel,
|
|
5
|
+
TextInputLeft,
|
|
6
|
+
TextInputOutline,
|
|
7
|
+
TextInputRight,
|
|
8
|
+
TextInputSupportingText,
|
|
9
|
+
} from './TextInput';
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
TextInput: TextInputDefault,
|
|
6
|
-
});
|
|
11
|
+
const TextInputBase = getRegisteredComponentWithFallback('TextInput', TextInputDefault);
|
|
7
12
|
|
|
8
|
-
export const TextInput =
|
|
13
|
+
export const TextInput = Object.assign(TextInputBase, {
|
|
14
|
+
Label: TextInputLabel,
|
|
15
|
+
Left: TextInputLeft,
|
|
16
|
+
Right: TextInputRight,
|
|
17
|
+
Icon: TextInputIcon,
|
|
18
|
+
Outline: TextInputOutline,
|
|
19
|
+
SupportingText: TextInputSupportingText,
|
|
20
|
+
});
|
|
9
21
|
|
|
10
22
|
export {
|
|
11
23
|
type ElementProps as TextInputElementProps,
|
|
@@ -13,4 +25,4 @@ export {
|
|
|
13
25
|
type Props as TextInputProps,
|
|
14
26
|
} from './TextInput';
|
|
15
27
|
export type * from './types';
|
|
16
|
-
export {
|
|
28
|
+
export { TextInputContext } from './utils';
|
|
@@ -1,37 +1,96 @@
|
|
|
1
|
-
import type { ReactElement, RefObject } from 'react';
|
|
1
|
+
import type { ReactElement, ReactNode, RefObject } from 'react';
|
|
2
2
|
import type {
|
|
3
3
|
Animated,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
GestureResponderEvent,
|
|
5
|
+
LayoutChangeEvent,
|
|
6
|
+
PressableProps,
|
|
7
7
|
StyleProp,
|
|
8
8
|
TextInput as NativeTextInput,
|
|
9
|
+
TextProps,
|
|
9
10
|
TextStyle,
|
|
11
|
+
ViewStyle,
|
|
10
12
|
} from 'react-native';
|
|
11
13
|
|
|
14
|
+
import type { IconProps } from '../Icon';
|
|
12
15
|
import type { Props as TextInputProps } from './TextInput';
|
|
13
16
|
|
|
14
17
|
export type TextInputLabelProp = string | ReactElement;
|
|
15
18
|
|
|
19
|
+
// States for compound component context
|
|
20
|
+
export type TextInputStates =
|
|
21
|
+
| 'disabled'
|
|
22
|
+
| 'focused'
|
|
23
|
+
| 'hovered'
|
|
24
|
+
| 'hoveredAndFocused'
|
|
25
|
+
| 'errorFocusedAndHovered'
|
|
26
|
+
| 'error'
|
|
27
|
+
| 'errorFocused'
|
|
28
|
+
| 'errorHovered'
|
|
29
|
+
| 'errorDisabled'
|
|
30
|
+
| 'default';
|
|
31
|
+
|
|
32
|
+
// Context type for compound components
|
|
33
|
+
export type TextInputContextType = {
|
|
34
|
+
// Variants
|
|
35
|
+
variant: TextInputVariant;
|
|
36
|
+
size: TextInputSize;
|
|
37
|
+
state: TextInputStates;
|
|
38
|
+
|
|
39
|
+
// State flags
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
error: boolean;
|
|
42
|
+
focused: boolean;
|
|
43
|
+
hovered: boolean;
|
|
44
|
+
hasValue: boolean;
|
|
45
|
+
hasLabel: boolean;
|
|
46
|
+
required: boolean;
|
|
47
|
+
multiline: boolean;
|
|
48
|
+
|
|
49
|
+
// Layout
|
|
50
|
+
labelLayout: { measured: boolean; width: number; height: number };
|
|
51
|
+
leftElementLayout: { measured: boolean; width: number; height: number };
|
|
52
|
+
onLayoutLabel: (e: LayoutChangeEvent) => void;
|
|
53
|
+
onLayoutLeftElement: (e: LayoutChangeEvent) => void;
|
|
54
|
+
|
|
55
|
+
// Refs and handlers
|
|
56
|
+
forceFocus: () => void;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Compound component props
|
|
60
|
+
export type TextInputLabelCompoundProps = TextProps & {
|
|
61
|
+
children: TextInputLabelProp;
|
|
62
|
+
floatingStyle?: StyleProp<TextStyle>;
|
|
63
|
+
maxFontSizeMultiplier?: number;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type TextInputElementCompoundProps = Omit<PressableProps, 'onPress'> & {
|
|
67
|
+
onPress?: null | ((event: GestureResponderEvent, forceFocus: () => void) => void) | undefined;
|
|
68
|
+
children: ReactNode;
|
|
69
|
+
style?: StyleProp<ViewStyle>;
|
|
70
|
+
onLayout?: (e: LayoutChangeEvent) => void;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type TextInputIconCompoundProps = Omit<IconProps, 'color'> & {
|
|
74
|
+
color?: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type TextInputSupportingTextCompoundProps = {
|
|
78
|
+
children: string;
|
|
79
|
+
style?: StyleProp<TextStyle>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type TextInputOutlineCompoundProps = {
|
|
83
|
+
style?: StyleProp<ViewStyle>;
|
|
84
|
+
};
|
|
85
|
+
|
|
16
86
|
export type TextInputSize = 'lg' | 'md' | 'sm';
|
|
17
87
|
|
|
18
88
|
export type TextInputVariant = 'flat' | 'outlined' | 'plain';
|
|
19
89
|
|
|
20
|
-
export type RenderProps = {
|
|
90
|
+
export type RenderProps = Omit<TextInputProps, 'ref'> & {
|
|
21
91
|
ref: RefObject<NativeTextInput | null>;
|
|
22
|
-
onChangeText?: (a: string) => void;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
placeholderTextColor?: ColorValue;
|
|
25
|
-
editable?: boolean;
|
|
26
|
-
selectionColor?: string;
|
|
27
|
-
onFocus?: (args: FocusEvent) => void;
|
|
28
|
-
onBlur?: (args: BlurEvent) => void;
|
|
29
|
-
underlineColorAndroid?: string;
|
|
30
|
-
style: any;
|
|
31
|
-
multiline?: boolean;
|
|
32
92
|
size?: TextInputSize;
|
|
33
93
|
numberOfLines?: number;
|
|
34
|
-
value?: string;
|
|
35
94
|
adjustsFontSizeToFit?: boolean;
|
|
36
95
|
testID?: string;
|
|
37
96
|
};
|
|
@@ -54,17 +113,7 @@ export type InputBaseProps = {
|
|
|
54
113
|
onChangeText?: (value: string) => void;
|
|
55
114
|
onLayoutAnimatedText: (args: any) => void;
|
|
56
115
|
componentStyles: Record<string, any>;
|
|
57
|
-
} & Omit<
|
|
58
|
-
TextInputProps,
|
|
59
|
-
| 'style'
|
|
60
|
-
| 'activeOutlineColor'
|
|
61
|
-
| 'activeUnderlineColor'
|
|
62
|
-
| 'underlineColor'
|
|
63
|
-
| 'outlineColor'
|
|
64
|
-
| 'placeholderTextColor'
|
|
65
|
-
| 'selectionColor'
|
|
66
|
-
| 'containerStyle'
|
|
67
|
-
>;
|
|
116
|
+
} & Omit<TextInputProps, 'style' | 'placeholderTextColor' | 'selectionColor' | 'containerStyle'>;
|
|
68
117
|
|
|
69
118
|
export type InputLabelProps = {
|
|
70
119
|
baseLabelTranslateX: number;
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
1
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
registerComponentsStyles,
|
|
7
|
-
registerComponentUtils,
|
|
5
|
+
getRegisteredComponentStylesWithFallback,
|
|
6
|
+
getRegisteredComponentUtilsWithFallback,
|
|
8
7
|
} from '../../core';
|
|
8
|
+
import type { TextInputContextType, TextInputStates } from './types';
|
|
9
|
+
|
|
10
|
+
export const TextInputContext = createContext<TextInputContextType>({
|
|
11
|
+
variant: 'outlined',
|
|
12
|
+
size: 'sm',
|
|
13
|
+
state: 'default' as TextInputStates,
|
|
14
|
+
disabled: false,
|
|
15
|
+
error: false,
|
|
16
|
+
focused: false,
|
|
17
|
+
hovered: false,
|
|
18
|
+
hasValue: false,
|
|
19
|
+
hasLabel: false,
|
|
20
|
+
required: false,
|
|
21
|
+
multiline: false,
|
|
22
|
+
labelLayout: { measured: false, width: 0, height: 0 },
|
|
23
|
+
leftElementLayout: { measured: false, width: 0, height: 0 },
|
|
24
|
+
onLayoutLabel: () => {},
|
|
25
|
+
onLayoutLeftElement: () => {},
|
|
26
|
+
forceFocus: () => {},
|
|
27
|
+
});
|
|
9
28
|
|
|
10
29
|
export type States =
|
|
11
30
|
| 'disabled'
|
|
@@ -37,65 +56,18 @@ const getInputMinHeightDefault = (variant: string, size: string) => {
|
|
|
37
56
|
}
|
|
38
57
|
};
|
|
39
58
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
getRegisteredComponentUtils('TextInput').getInputMinHeight ?? getInputMinHeightDefault;
|
|
59
|
+
export const getInputMinHeight = getRegisteredComponentUtilsWithFallback(
|
|
60
|
+
'TextInput',
|
|
61
|
+
getInputMinHeightDefault,
|
|
62
|
+
'getInputMinHeight',
|
|
63
|
+
);
|
|
46
64
|
|
|
65
|
+
// Main TextInput component styles
|
|
47
66
|
const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
48
67
|
root: {
|
|
49
|
-
variants: {
|
|
50
|
-
variant: {
|
|
51
|
-
outlined: {},
|
|
52
|
-
},
|
|
53
|
-
state: {
|
|
54
|
-
focused: {
|
|
55
|
-
...({
|
|
56
|
-
activeColor: theme.colors.primary,
|
|
57
|
-
} as Record<string, any>),
|
|
58
|
-
},
|
|
59
|
-
hovered: {},
|
|
60
|
-
hoveredAndFocused: {
|
|
61
|
-
...({
|
|
62
|
-
activeColor: theme.colors.primary,
|
|
63
|
-
} as Record<string, any>),
|
|
64
|
-
},
|
|
65
|
-
disabled: {},
|
|
66
|
-
error: {
|
|
67
|
-
...({
|
|
68
|
-
activeColor: theme.colors.error,
|
|
69
|
-
} as Record<string, any>),
|
|
70
|
-
},
|
|
71
|
-
errorFocused: {
|
|
72
|
-
...({
|
|
73
|
-
activeColor: theme.colors.error,
|
|
74
|
-
} as Record<string, any>),
|
|
75
|
-
},
|
|
76
|
-
errorFocusedAndHovered: {
|
|
77
|
-
...({
|
|
78
|
-
activeColor: theme.colors.error,
|
|
79
|
-
} as Record<string, any>),
|
|
80
|
-
},
|
|
81
|
-
errorDisabled: {
|
|
82
|
-
...({
|
|
83
|
-
activeColor: theme.colors.error,
|
|
84
|
-
} as Record<string, any>),
|
|
85
|
-
},
|
|
86
|
-
errorHovered: {},
|
|
87
|
-
},
|
|
88
|
-
size: {
|
|
89
|
-
lg: {},
|
|
90
|
-
md: {},
|
|
91
|
-
sm: {},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
container: {
|
|
97
68
|
flexDirection: 'row',
|
|
98
69
|
paddingHorizontal: theme.spacings['4'],
|
|
70
|
+
|
|
99
71
|
variants: {
|
|
100
72
|
variant: {
|
|
101
73
|
outlined: {
|
|
@@ -119,68 +91,100 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
119
91
|
},
|
|
120
92
|
],
|
|
121
93
|
},
|
|
122
|
-
leftElement: {
|
|
123
|
-
color: theme.colors.onSurfaceVariant,
|
|
124
|
-
iconSize: 20,
|
|
125
|
-
marginRight: theme.spacings['3'],
|
|
126
|
-
marginLeft: theme.spacings._1,
|
|
127
|
-
justifyContent: 'center',
|
|
128
94
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
errorFocused: {
|
|
138
|
-
color: theme.colors.onSurfaceVariant,
|
|
139
|
-
},
|
|
140
|
-
errorFocusedAndHovered: {
|
|
141
|
-
color: theme.colors.onSurfaceVariant,
|
|
142
|
-
},
|
|
143
|
-
errorDisabled: {
|
|
144
|
-
color: theme.colors.onSurfaceVariant,
|
|
145
|
-
opacity: 0.38,
|
|
146
|
-
},
|
|
147
|
-
errorHovered: {
|
|
148
|
-
color: theme.colors.onSurfaceVariant,
|
|
149
|
-
},
|
|
95
|
+
input: {
|
|
96
|
+
color: theme.colors.onSurface,
|
|
97
|
+
...theme.typescale.bodyLarge,
|
|
98
|
+
flexGrow: 1,
|
|
99
|
+
|
|
100
|
+
_web: {
|
|
101
|
+
outline: 'none',
|
|
150
102
|
},
|
|
151
|
-
},
|
|
152
|
-
rightElement: {
|
|
153
|
-
color: theme.colors.onSurfaceVariant,
|
|
154
|
-
iconSize: 24,
|
|
155
|
-
marginRight: theme.spacings._1,
|
|
156
|
-
marginLeft: theme.spacings['3'],
|
|
157
|
-
justifyContent: 'center',
|
|
158
103
|
|
|
159
104
|
variants: {
|
|
105
|
+
size: {
|
|
106
|
+
lg: {
|
|
107
|
+
...theme.typescale.bodyExtraLarge,
|
|
108
|
+
},
|
|
109
|
+
md: {
|
|
110
|
+
...theme.typescale.bodyLarge,
|
|
111
|
+
},
|
|
112
|
+
sm: {
|
|
113
|
+
...theme.typescale.bodyMedium,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
variant: {
|
|
117
|
+
flat: {
|
|
118
|
+
paddingTop: 12,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
|
|
160
122
|
state: {
|
|
161
123
|
disabled: {
|
|
162
124
|
color: theme.colors.onSurface,
|
|
163
125
|
opacity: 0.38,
|
|
164
126
|
},
|
|
165
127
|
error: {
|
|
166
|
-
color: theme.colors.
|
|
128
|
+
color: theme.colors.onSurface,
|
|
167
129
|
},
|
|
168
130
|
errorFocused: {
|
|
169
|
-
color: theme.colors.
|
|
131
|
+
color: theme.colors.onSurface,
|
|
170
132
|
},
|
|
171
133
|
errorFocusedAndHovered: {
|
|
172
|
-
color: theme.colors.
|
|
134
|
+
color: theme.colors.onSurface,
|
|
173
135
|
},
|
|
174
136
|
errorDisabled: {
|
|
175
|
-
color: theme.colors.
|
|
137
|
+
color: theme.colors.onSurface,
|
|
176
138
|
opacity: 0.38,
|
|
177
139
|
},
|
|
178
140
|
errorHovered: {
|
|
179
|
-
color: theme.colors.
|
|
141
|
+
color: theme.colors.onSurface,
|
|
180
142
|
},
|
|
181
143
|
},
|
|
182
144
|
},
|
|
183
145
|
},
|
|
146
|
+
|
|
147
|
+
placeholder: {
|
|
148
|
+
color: theme.colors.onSurfaceVariant,
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
stateLayer: {
|
|
152
|
+
borderTopLeftRadius: theme.shapes.corner.extraSmall,
|
|
153
|
+
borderTopRightRadius: theme.shapes.corner.extraSmall,
|
|
154
|
+
variants: {
|
|
155
|
+
variant: {},
|
|
156
|
+
state: {},
|
|
157
|
+
},
|
|
158
|
+
compoundVariants: [
|
|
159
|
+
{
|
|
160
|
+
variant: 'flat',
|
|
161
|
+
state: 'hovered',
|
|
162
|
+
styles: {
|
|
163
|
+
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
variant: 'flat',
|
|
168
|
+
state: 'errorHovered',
|
|
169
|
+
styles: {
|
|
170
|
+
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
inputWrapper: {
|
|
177
|
+
paddingTop: 0,
|
|
178
|
+
paddingBottom: 0,
|
|
179
|
+
flexGrow: 1,
|
|
180
|
+
flexShrink: 1,
|
|
181
|
+
},
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
export const styles = getRegisteredComponentStylesWithFallback('TextInput', textInputStylesDefault);
|
|
185
|
+
|
|
186
|
+
// TextInput.Label styles
|
|
187
|
+
const textInputLabelStylesDefault = StyleSheet.create(theme => ({
|
|
184
188
|
floatingLabel: {
|
|
185
189
|
variants: {
|
|
186
190
|
variant: {
|
|
@@ -190,11 +194,12 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
190
194
|
},
|
|
191
195
|
},
|
|
192
196
|
},
|
|
197
|
+
|
|
193
198
|
labelText: {
|
|
194
199
|
position: 'absolute',
|
|
195
200
|
left: 0,
|
|
196
201
|
color: theme.colors.onSurfaceVariant,
|
|
197
|
-
|
|
202
|
+
...theme.typescale.bodyLarge,
|
|
198
203
|
|
|
199
204
|
variants: {
|
|
200
205
|
size: {
|
|
@@ -253,51 +258,95 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
253
258
|
},
|
|
254
259
|
},
|
|
255
260
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
}));
|
|
262
|
+
|
|
263
|
+
export const textInputLabelStyles = getRegisteredComponentStylesWithFallback(
|
|
264
|
+
'TextInputLabel',
|
|
265
|
+
textInputLabelStylesDefault,
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
// TextInput.Left styles
|
|
269
|
+
const textInputLeftStylesDefault = StyleSheet.create(theme => ({
|
|
270
|
+
leftElement: {
|
|
271
|
+
color: theme.colors.onSurfaceVariant,
|
|
272
|
+
marginRight: theme.spacings['3'],
|
|
273
|
+
marginLeft: theme.spacings._1,
|
|
274
|
+
justifyContent: 'center',
|
|
260
275
|
|
|
261
276
|
variants: {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
277
|
+
state: {
|
|
278
|
+
disabled: {
|
|
279
|
+
color: theme.colors.onSurface,
|
|
280
|
+
opacity: 0.38,
|
|
265
281
|
},
|
|
266
|
-
|
|
267
|
-
|
|
282
|
+
error: {
|
|
283
|
+
color: theme.colors.onSurfaceVariant,
|
|
268
284
|
},
|
|
269
|
-
|
|
270
|
-
|
|
285
|
+
errorFocused: {
|
|
286
|
+
color: theme.colors.onSurfaceVariant,
|
|
287
|
+
},
|
|
288
|
+
errorFocusedAndHovered: {
|
|
289
|
+
color: theme.colors.onSurfaceVariant,
|
|
290
|
+
},
|
|
291
|
+
errorDisabled: {
|
|
292
|
+
color: theme.colors.onSurfaceVariant,
|
|
293
|
+
opacity: 0.38,
|
|
294
|
+
},
|
|
295
|
+
errorHovered: {
|
|
296
|
+
color: theme.colors.onSurfaceVariant,
|
|
271
297
|
},
|
|
272
298
|
},
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
}));
|
|
302
|
+
|
|
303
|
+
export const textInputLeftStyles = getRegisteredComponentStylesWithFallback(
|
|
304
|
+
'TextInputLeft',
|
|
305
|
+
textInputLeftStylesDefault,
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
// TextInput.Right styles
|
|
309
|
+
const textInputRightStylesDefault = StyleSheet.create(theme => ({
|
|
310
|
+
rightElement: {
|
|
311
|
+
color: theme.colors.onSurfaceVariant,
|
|
312
|
+
marginRight: theme.spacings._1,
|
|
313
|
+
marginLeft: theme.spacings['3'],
|
|
314
|
+
justifyContent: 'center',
|
|
276
315
|
|
|
316
|
+
variants: {
|
|
277
317
|
state: {
|
|
278
318
|
disabled: {
|
|
279
319
|
color: theme.colors.onSurface,
|
|
280
320
|
opacity: 0.38,
|
|
281
321
|
},
|
|
282
322
|
error: {
|
|
283
|
-
color: theme.colors.
|
|
323
|
+
color: theme.colors.error,
|
|
284
324
|
},
|
|
285
325
|
errorFocused: {
|
|
286
|
-
color: theme.colors.
|
|
326
|
+
color: theme.colors.error,
|
|
287
327
|
},
|
|
288
328
|
errorFocusedAndHovered: {
|
|
289
|
-
color: theme.colors.
|
|
329
|
+
color: theme.colors.error,
|
|
290
330
|
},
|
|
291
331
|
errorDisabled: {
|
|
292
|
-
color: theme.colors.
|
|
332
|
+
color: theme.colors.error,
|
|
293
333
|
opacity: 0.38,
|
|
294
334
|
},
|
|
295
335
|
errorHovered: {
|
|
296
|
-
color: theme.colors.
|
|
336
|
+
color: theme.colors.onErrorContainer,
|
|
297
337
|
},
|
|
298
338
|
},
|
|
299
339
|
},
|
|
300
340
|
},
|
|
341
|
+
}));
|
|
342
|
+
|
|
343
|
+
export const textInputRightStyles = getRegisteredComponentStylesWithFallback(
|
|
344
|
+
'TextInputRight',
|
|
345
|
+
textInputRightStylesDefault,
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
// TextInput.SupportingText styles
|
|
349
|
+
const textInputSupportingTextStylesDefault = StyleSheet.create({
|
|
301
350
|
supportingText: {
|
|
302
351
|
variants: {
|
|
303
352
|
state: {
|
|
@@ -310,9 +359,15 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
310
359
|
},
|
|
311
360
|
},
|
|
312
361
|
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
export const textInputSupportingTextStyles = getRegisteredComponentStylesWithFallback(
|
|
365
|
+
'TextInputSupportingText',
|
|
366
|
+
textInputSupportingTextStylesDefault,
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
// TextInput.Outline styles
|
|
370
|
+
const textInputOutlineStylesDefault = StyleSheet.create(theme => ({
|
|
316
371
|
outline: {
|
|
317
372
|
position: 'absolute',
|
|
318
373
|
left: 0,
|
|
@@ -325,7 +380,8 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
325
380
|
variants: {
|
|
326
381
|
variant: {
|
|
327
382
|
outlined: {
|
|
328
|
-
|
|
383
|
+
// this will be inherited from root
|
|
384
|
+
// borderRadius: theme.shapes.corner.extraSmall,
|
|
329
385
|
borderColor: theme.colors.outline,
|
|
330
386
|
borderWidth: 1,
|
|
331
387
|
},
|
|
@@ -402,6 +458,7 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
402
458
|
},
|
|
403
459
|
],
|
|
404
460
|
},
|
|
461
|
+
|
|
405
462
|
activeIndicator: {
|
|
406
463
|
variants: {
|
|
407
464
|
variant: {
|
|
@@ -492,24 +549,7 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
492
549
|
},
|
|
493
550
|
],
|
|
494
551
|
},
|
|
495
|
-
|
|
496
|
-
compoundVariants: [
|
|
497
|
-
{
|
|
498
|
-
variant: 'flat',
|
|
499
|
-
state: 'hovered',
|
|
500
|
-
styles: {
|
|
501
|
-
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
502
|
-
},
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
variant: 'flat',
|
|
506
|
-
state: 'errorHovered',
|
|
507
|
-
styles: {
|
|
508
|
-
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
509
|
-
},
|
|
510
|
-
},
|
|
511
|
-
],
|
|
512
|
-
},
|
|
552
|
+
|
|
513
553
|
underline: {
|
|
514
554
|
position: 'absolute',
|
|
515
555
|
left: 0,
|
|
@@ -518,27 +558,60 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
518
558
|
height: 1,
|
|
519
559
|
zIndex: 1,
|
|
520
560
|
},
|
|
521
|
-
labelContainer: {
|
|
522
|
-
paddingTop: 0,
|
|
523
|
-
paddingBottom: 0,
|
|
524
|
-
flexGrow: 1,
|
|
525
|
-
flexShrink: 1,
|
|
526
|
-
},
|
|
527
|
-
patchContainer: {
|
|
528
|
-
height: 24,
|
|
529
|
-
zIndex: 2,
|
|
530
|
-
},
|
|
531
561
|
}));
|
|
532
562
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
export const styles = getRegisteredMoleculesComponentStyles('TextInput');
|
|
563
|
+
export const textInputOutlineStyles = getRegisteredComponentStylesWithFallback(
|
|
564
|
+
'TextInputOutline',
|
|
565
|
+
textInputOutlineStylesDefault,
|
|
566
|
+
);
|
|
538
567
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
568
|
+
// TextInput.Icon styles
|
|
569
|
+
const textInputIconStylesDefault = StyleSheet.create(theme => ({
|
|
570
|
+
root: {
|
|
571
|
+
variants: {
|
|
572
|
+
state: {
|
|
573
|
+
default: {
|
|
574
|
+
color: theme.colors.onSurfaceVariant,
|
|
575
|
+
},
|
|
576
|
+
focused: {
|
|
577
|
+
color: theme.colors.onSurfaceVariant,
|
|
578
|
+
},
|
|
579
|
+
hovered: {
|
|
580
|
+
color: theme.colors.onSurfaceVariant,
|
|
581
|
+
},
|
|
582
|
+
hoveredAndFocused: {
|
|
583
|
+
color: theme.colors.onSurfaceVariant,
|
|
584
|
+
},
|
|
585
|
+
disabled: {
|
|
586
|
+
color: theme.colors.onSurface,
|
|
587
|
+
opacity: 0.38,
|
|
588
|
+
},
|
|
589
|
+
error: {
|
|
590
|
+
color: theme.colors.error,
|
|
591
|
+
},
|
|
592
|
+
errorFocused: {
|
|
593
|
+
color: theme.colors.error,
|
|
594
|
+
},
|
|
595
|
+
errorFocusedAndHovered: {
|
|
596
|
+
color: theme.colors.error,
|
|
597
|
+
},
|
|
598
|
+
errorDisabled: {
|
|
599
|
+
color: theme.colors.error,
|
|
600
|
+
opacity: 0.38,
|
|
601
|
+
},
|
|
602
|
+
errorHovered: {
|
|
603
|
+
color: theme.colors.onErrorContainer,
|
|
604
|
+
},
|
|
605
|
+
},
|
|
606
|
+
position: {
|
|
607
|
+
left: {},
|
|
608
|
+
right: {},
|
|
609
|
+
},
|
|
610
|
+
},
|
|
543
611
|
},
|
|
544
|
-
});
|
|
612
|
+
}));
|
|
613
|
+
|
|
614
|
+
export const textInputIconStyles = getRegisteredComponentStylesWithFallback(
|
|
615
|
+
'TextInputIcon',
|
|
616
|
+
textInputIconStylesDefault,
|
|
617
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import TextInputWithMaskDefault from './TextInputMask';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
TextInputWithMask: TextInputWithMaskDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const TextInputWithMask = getRegisteredComponentWithFallback(
|
|
9
5
|
'TextInputWithMask',
|
|
10
6
|
TextInputWithMaskDefault,
|