react-native-molecules 0.5.0-beta.3 → 0.5.0-beta.31
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/components/Accordion/Accordion.tsx +2 -6
- package/components/Accordion/AccordionItem.tsx +16 -12
- package/components/Accordion/AccordionItemContent.tsx +6 -1
- package/components/Accordion/AccordionItemHeader.tsx +1 -1
- package/components/Accordion/utils.ts +6 -0
- package/components/ActivityIndicator/ActivityIndicator.tsx +6 -15
- package/components/Appbar/AppbarBase.tsx +18 -13
- package/components/Button/Button.tsx +211 -264
- package/components/Button/index.tsx +9 -3
- package/components/Button/types.ts +16 -2
- package/components/Button/utils.ts +230 -208
- package/components/Card/Card.tsx +1 -1
- package/components/Checkbox/Checkbox.tsx +125 -88
- package/components/Checkbox/CheckboxBase.ios.tsx +14 -23
- package/components/Checkbox/CheckboxBase.tsx +21 -137
- package/components/Checkbox/context.tsx +14 -0
- package/components/Checkbox/index.tsx +11 -4
- package/components/Checkbox/types.ts +63 -29
- package/components/Checkbox/utils.ts +25 -108
- package/components/Chip/Chip.tsx +41 -52
- package/components/Chip/utils.ts +3 -7
- package/components/DateField/DateField.tsx +111 -0
- package/components/DateField/index.tsx +6 -0
- package/components/{DatePickerInput/inputUtils.ts → DateField/useDateFieldState.ts} +19 -51
- package/components/DatePicker/DateCalendar.tsx +83 -0
- package/components/DatePicker/DatePickerActions.tsx +73 -0
- package/components/DatePicker/DatePickerModal.tsx +246 -0
- package/components/DatePicker/DatePickerPopover.tsx +79 -0
- package/components/DatePicker/DatePickerProvider.tsx +158 -0
- package/components/DatePicker/DatePickerTrigger.tsx +23 -0
- package/components/DatePicker/context.tsx +83 -0
- package/components/DatePicker/index.tsx +45 -0
- package/components/DatePicker/utils.ts +295 -0
- package/components/DatePickerInline/DatePickerDockedHeader.tsx +117 -0
- package/components/DatePickerInline/DatePickerInline.tsx +17 -16
- package/components/DatePickerInline/DatePickerInlineBase.tsx +11 -5
- package/components/DatePickerInline/DatePickerInlineHeader.tsx +50 -20
- package/components/DatePickerInline/Day.tsx +25 -1
- package/components/DatePickerInline/DayNames.tsx +13 -10
- package/components/DatePickerInline/DayRange.tsx +2 -4
- package/components/DatePickerInline/HeaderItem.tsx +44 -29
- package/components/DatePickerInline/Month.tsx +48 -67
- package/components/DatePickerInline/MonthPicker.tsx +80 -92
- package/components/DatePickerInline/Swiper.native.tsx +21 -4
- package/components/DatePickerInline/Swiper.tsx +169 -14
- package/components/DatePickerInline/SwiperUtils.ts +1 -1
- package/components/DatePickerInline/Week.tsx +6 -1
- package/components/DatePickerInline/YearPicker.tsx +220 -78
- package/components/DatePickerInline/dateUtils.tsx +18 -13
- package/components/DatePickerInline/store.tsx +27 -0
- package/components/DatePickerInline/types.ts +6 -2
- package/components/DatePickerInline/utils.ts +66 -29
- package/components/Divider/Divider.tsx +192 -0
- package/components/Divider/index.tsx +10 -0
- package/components/Drawer/Drawer.tsx +17 -6
- package/components/Drawer/DrawerItemGroup.tsx +3 -7
- package/components/ElementGroup/ElementGroup.tsx +1 -1
- package/components/FilePicker/FilePicker.tsx +48 -78
- package/components/FilePicker/index.tsx +2 -1
- package/components/FilePicker/utils.ts +9 -0
- package/components/HelperText/HelperText.tsx +0 -35
- package/components/Icon/iconFactory.tsx +5 -4
- package/components/Icon/index.tsx +1 -1
- package/components/Icon/types.ts +17 -6
- package/components/IconButton/IconButton.tsx +84 -84
- package/components/IconButton/index.tsx +1 -0
- package/components/IconButton/types.ts +10 -0
- package/components/IconButton/utils.ts +167 -33
- package/components/List/List.tsx +276 -0
- package/components/List/context.tsx +27 -0
- package/components/List/index.ts +8 -0
- package/components/List/types.ts +117 -0
- package/components/List/utils.ts +79 -0
- 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/Menu.tsx +162 -39
- package/components/Menu/index.tsx +10 -7
- package/components/Menu/utils.ts +21 -70
- package/components/NavigationRail/NavigationRail.tsx +15 -9
- package/components/Popover/Popover.tsx +119 -145
- package/components/Popover/PopoverRoot.tsx +60 -0
- package/components/Popover/common.ts +54 -34
- package/components/Popover/index.ts +12 -1
- package/components/Popover/usePlatformMeasure.native.ts +90 -0
- package/components/Popover/usePlatformMeasure.ts +120 -0
- package/components/Popover/utils.ts +34 -0
- package/components/Portal/Portal.tsx +1 -2
- package/components/Radio/Radio.tsx +188 -0
- package/components/Radio/RadioBase.ios.tsx +69 -0
- package/components/Radio/RadioBase.tsx +136 -0
- package/components/Radio/context.tsx +23 -0
- package/components/Radio/index.tsx +20 -0
- package/components/Radio/types.ts +101 -0
- package/components/Radio/utils.ts +115 -0
- package/components/Rating/Rating.tsx +1 -1
- package/components/Select/Select.tsx +521 -785
- package/components/Select/context.tsx +81 -0
- package/components/Select/index.ts +26 -14
- package/components/Select/types.ts +65 -58
- package/components/Select/utils.ts +126 -0
- package/components/Slot/Slot.tsx +224 -0
- package/components/Slot/compose-refs.tsx +62 -0
- package/components/Slot/index.tsx +8 -0
- package/components/Surface/Surface.android.tsx +32 -7
- package/components/Surface/Surface.ios.tsx +34 -29
- package/components/Surface/Surface.tsx +31 -4
- package/components/Surface/utils.ts +44 -6
- package/components/Switch/Switch.ios.tsx +1 -1
- package/components/Switch/Switch.tsx +10 -3
- package/components/Tabs/TabItem.tsx +35 -58
- package/components/Tabs/TabLabel.tsx +5 -9
- package/components/Tabs/Tabs.tsx +156 -150
- package/components/Tabs/utils.ts +15 -2
- package/components/Text/textFactory.tsx +17 -5
- package/components/TextInput/TextInput.tsx +663 -579
- package/components/TextInput/index.tsx +19 -3
- package/components/TextInput/types.ts +77 -28
- package/components/TextInput/utils.ts +235 -145
- package/components/TimeField/TimeField.tsx +75 -0
- package/components/TimeField/index.tsx +6 -0
- package/components/TimeField/useTimeFieldState.ts +70 -0
- package/components/{TimePickerField/sanitizeTime.ts → TimeField/utils.ts} +77 -10
- package/components/TimePicker/AnalogClock.tsx +1 -1
- package/components/TimePicker/TimeInput.tsx +87 -42
- package/components/TimePicker/TimeInputs.tsx +138 -50
- package/components/TimePicker/TimePicker.tsx +74 -11
- package/components/TimePicker/TimePickerModal.tsx +186 -0
- package/components/TimePicker/context.tsx +17 -0
- package/components/TimePicker/index.tsx +15 -3
- package/components/TimePicker/utils.ts +93 -4
- package/components/Tooltip/Tooltip.tsx +42 -67
- package/components/Tooltip/TooltipContent.tsx +32 -5
- package/components/Tooltip/TooltipTrigger.tsx +21 -24
- package/components/Tooltip/index.tsx +1 -1
- package/components/TouchableRipple/TouchableRipple.native.tsx +83 -16
- package/components/TouchableRipple/TouchableRipple.tsx +150 -102
- package/components/TouchableRipple/rippleFromForegroundColor.ts +21 -0
- package/hocs/index.tsx +1 -1
- package/hocs/withKeyboardAccessibility.tsx +2 -3
- package/hocs/withPortal.tsx +1 -1
- package/hooks/index.tsx +2 -12
- package/hooks/useActionState.tsx +19 -8
- package/hooks/useContrastColor.ts +1 -2
- package/hooks/useFilePicker.tsx +7 -17
- package/hooks/useHandleNumberFormat.tsx +2 -2
- package/hooks/useMediaQuery.tsx +1 -2
- package/package.json +95 -111
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +6 -3
- package/shortcuts-manager/ShortcutsManager/utils.tsx +1 -1
- package/shortcuts-manager/useSetScopes/useSetScopes.tsx +1 -1
- package/shortcuts-manager/useShortcut/useShortcut.tsx +1 -1
- package/styles/shadow.ts +2 -1
- package/styles/themes/LightTheme.tsx +1 -1
- package/utils/DocumentPicker/documentPicker.ts +78 -27
- package/utils/DocumentPicker/types.ts +0 -1
- package/utils/extractSubcomponents.ts +89 -0
- package/utils/extractTextStyles.ts +1 -2
- package/utils/formatNumberWithMask/formatNumberWithMask.ts +2 -1
- package/utils/index.ts +0 -3
- package/utils/normalizeToNumberString/normalizeToNumberString.ts +1 -1
- package/components/DatePickerDocked/DatePickerDocked.tsx +0 -30
- package/components/DatePickerDocked/DatePickerDockedHeader.tsx +0 -129
- package/components/DatePickerDocked/index.tsx +0 -17
- package/components/DatePickerDocked/types.ts +0 -11
- package/components/DatePickerDocked/utils.ts +0 -157
- package/components/DatePickerInline/DatePickerContext.tsx +0 -21
- package/components/DatePickerInput/DatePickerInput.tsx +0 -139
- package/components/DatePickerInput/DatePickerInputModal.tsx +0 -48
- package/components/DatePickerInput/DatePickerInputWithoutModal.tsx +0 -77
- package/components/DatePickerInput/DateRangeInput.tsx +0 -88
- package/components/DatePickerInput/index.tsx +0 -10
- package/components/DatePickerInput/types.ts +0 -28
- package/components/DatePickerInput/utils.ts +0 -15
- package/components/DatePickerModal/AnimatedCrossView.tsx +0 -94
- package/components/DatePickerModal/CalendarEdit.tsx +0 -139
- package/components/DatePickerModal/DatePickerModal.tsx +0 -85
- package/components/DatePickerModal/DatePickerModalContent.tsx +0 -155
- package/components/DatePickerModal/DatePickerModalContentHeader.tsx +0 -213
- package/components/DatePickerModal/DatePickerModalHeader.tsx +0 -74
- package/components/DatePickerModal/DatePickerModalHeaderBackground.tsx +0 -13
- package/components/DatePickerModal/index.tsx +0 -16
- package/components/DatePickerModal/types.ts +0 -92
- package/components/DatePickerModal/utils.ts +0 -122
- package/components/DateTimePicker/DateTimePicker.tsx +0 -172
- package/components/DateTimePicker/index.tsx +0 -10
- package/components/DateTimePicker/utils.ts +0 -12
- package/components/HorizontalDivider/HorizontalDivider.tsx +0 -103
- package/components/HorizontalDivider/index.tsx +0 -9
- package/components/ListItem/ListItem.tsx +0 -136
- package/components/ListItem/ListItemDescription.tsx +0 -25
- package/components/ListItem/ListItemTitle.tsx +0 -25
- package/components/ListItem/index.tsx +0 -14
- package/components/ListItem/utils.ts +0 -115
- package/components/Menu/MenuDivider.tsx +0 -13
- package/components/Menu/MenuItem.tsx +0 -128
- package/components/Popover/Popover.native.tsx +0 -185
- package/components/RadioButton/RadioButton.tsx +0 -138
- package/components/RadioButton/RadioButtonAndroid.tsx +0 -188
- package/components/RadioButton/RadioButtonGroup.tsx +0 -98
- package/components/RadioButton/RadioButtonIOS.tsx +0 -106
- package/components/RadioButton/RadioButtonItem.tsx +0 -232
- package/components/RadioButton/index.ts +0 -22
- package/components/RadioButton/utils.ts +0 -165
- package/components/TimePickerField/TimePickerField.tsx +0 -152
- package/components/TimePickerField/index.tsx +0 -10
- package/components/TimePickerField/utils.ts +0 -94
- package/components/TimePickerModal/TimePickerModal.tsx +0 -115
- package/components/TimePickerModal/index.tsx +0 -10
- package/components/TimePickerModal/utils.ts +0 -47
- package/components/VerticalDivider/VerticalDivider.tsx +0 -100
- package/components/VerticalDivider/index.tsx +0 -9
- package/context-bridge/index.tsx +0 -87
- package/fast-context/index.tsx +0 -190
- package/hocs/typedMemo.tsx +0 -5
- package/hooks/useControlledValue.tsx +0 -68
- package/hooks/useLatest.tsx +0 -9
- package/hooks/useMergedRefs.ts +0 -14
- package/hooks/usePrevious.ts +0 -13
- package/hooks/useSearchable.tsx +0 -74
- package/hooks/useSubcomponents.tsx +0 -59
- package/hooks/useToggle.tsx +0 -24
- package/utils/color.ts +0 -22
- package/utils/compare/index.ts +0 -54
- package/utils/lodash.ts +0 -49
- package/utils/repository.ts +0 -53
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
|
-
import TextInputDefault
|
|
2
|
+
import TextInputDefault, {
|
|
3
|
+
TextInputIcon,
|
|
4
|
+
TextInputLabel,
|
|
5
|
+
TextInputLeft,
|
|
6
|
+
TextInputOutline,
|
|
7
|
+
TextInputRight,
|
|
8
|
+
TextInputSupportingText,
|
|
9
|
+
} from './TextInput';
|
|
10
|
+
|
|
11
|
+
const TextInputBase = getRegisteredComponentWithFallback('TextInput', TextInputDefault);
|
|
3
12
|
|
|
4
|
-
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
|
+
});
|
|
5
21
|
|
|
6
22
|
export {
|
|
7
23
|
type ElementProps as TextInputElementProps,
|
|
@@ -9,4 +25,4 @@ export {
|
|
|
9
25
|
type Props as TextInputProps,
|
|
10
26
|
} from './TextInput';
|
|
11
27
|
export type * from './types';
|
|
12
|
-
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
|
|
|
16
|
-
|
|
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
|
+
|
|
86
|
+
export type TextInputSize = 'xs' | '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,9 +1,30 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
1
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
getRegisteredComponentStylesWithFallback,
|
|
5
6
|
getRegisteredComponentUtilsWithFallback,
|
|
6
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
|
+
});
|
|
7
28
|
|
|
8
29
|
export type States =
|
|
9
30
|
| 'disabled'
|
|
@@ -24,12 +45,16 @@ const getInputMinHeightDefault = (variant: string, size: string) => {
|
|
|
24
45
|
return 56;
|
|
25
46
|
case variant === 'outlined' && size === 'sm':
|
|
26
47
|
return 48;
|
|
48
|
+
case variant === 'outlined' && size === 'xs':
|
|
49
|
+
return 40;
|
|
27
50
|
case variant === 'flat' && size === 'lg':
|
|
28
51
|
return 64;
|
|
29
52
|
case variant === 'flat' && size === 'md':
|
|
30
53
|
return 56;
|
|
31
54
|
case variant === 'flat' && size === 'sm':
|
|
32
55
|
return 52;
|
|
56
|
+
case variant === 'flat' && size === 'xs':
|
|
57
|
+
return 48;
|
|
33
58
|
default:
|
|
34
59
|
return 0;
|
|
35
60
|
}
|
|
@@ -41,58 +66,12 @@ export const getInputMinHeight = getRegisteredComponentUtilsWithFallback(
|
|
|
41
66
|
'getInputMinHeight',
|
|
42
67
|
);
|
|
43
68
|
|
|
69
|
+
// Main TextInput component styles
|
|
44
70
|
const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
45
71
|
root: {
|
|
46
|
-
variants: {
|
|
47
|
-
variant: {
|
|
48
|
-
outlined: {},
|
|
49
|
-
},
|
|
50
|
-
state: {
|
|
51
|
-
focused: {
|
|
52
|
-
...({
|
|
53
|
-
activeColor: theme.colors.primary,
|
|
54
|
-
} as Record<string, any>),
|
|
55
|
-
},
|
|
56
|
-
hovered: {},
|
|
57
|
-
hoveredAndFocused: {
|
|
58
|
-
...({
|
|
59
|
-
activeColor: theme.colors.primary,
|
|
60
|
-
} as Record<string, any>),
|
|
61
|
-
},
|
|
62
|
-
disabled: {},
|
|
63
|
-
error: {
|
|
64
|
-
...({
|
|
65
|
-
activeColor: theme.colors.error,
|
|
66
|
-
} as Record<string, any>),
|
|
67
|
-
},
|
|
68
|
-
errorFocused: {
|
|
69
|
-
...({
|
|
70
|
-
activeColor: theme.colors.error,
|
|
71
|
-
} as Record<string, any>),
|
|
72
|
-
},
|
|
73
|
-
errorFocusedAndHovered: {
|
|
74
|
-
...({
|
|
75
|
-
activeColor: theme.colors.error,
|
|
76
|
-
} as Record<string, any>),
|
|
77
|
-
},
|
|
78
|
-
errorDisabled: {
|
|
79
|
-
...({
|
|
80
|
-
activeColor: theme.colors.error,
|
|
81
|
-
} as Record<string, any>),
|
|
82
|
-
},
|
|
83
|
-
errorHovered: {},
|
|
84
|
-
},
|
|
85
|
-
size: {
|
|
86
|
-
lg: {},
|
|
87
|
-
md: {},
|
|
88
|
-
sm: {},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
container: {
|
|
94
72
|
flexDirection: 'row',
|
|
95
73
|
paddingHorizontal: theme.spacings['4'],
|
|
74
|
+
|
|
96
75
|
variants: {
|
|
97
76
|
variant: {
|
|
98
77
|
outlined: {
|
|
@@ -116,68 +95,103 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
116
95
|
},
|
|
117
96
|
],
|
|
118
97
|
},
|
|
119
|
-
leftElement: {
|
|
120
|
-
color: theme.colors.onSurfaceVariant,
|
|
121
|
-
iconSize: 20,
|
|
122
|
-
marginRight: theme.spacings['3'],
|
|
123
|
-
marginLeft: theme.spacings._1,
|
|
124
|
-
justifyContent: 'center',
|
|
125
98
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
errorFocused: {
|
|
135
|
-
color: theme.colors.onSurfaceVariant,
|
|
136
|
-
},
|
|
137
|
-
errorFocusedAndHovered: {
|
|
138
|
-
color: theme.colors.onSurfaceVariant,
|
|
139
|
-
},
|
|
140
|
-
errorDisabled: {
|
|
141
|
-
color: theme.colors.onSurfaceVariant,
|
|
142
|
-
opacity: 0.38,
|
|
143
|
-
},
|
|
144
|
-
errorHovered: {
|
|
145
|
-
color: theme.colors.onSurfaceVariant,
|
|
146
|
-
},
|
|
99
|
+
input: {
|
|
100
|
+
color: theme.colors.onSurface,
|
|
101
|
+
...theme.typescale.bodyLarge,
|
|
102
|
+
flexGrow: 1,
|
|
103
|
+
|
|
104
|
+
_web: {
|
|
105
|
+
outline: 'none',
|
|
147
106
|
},
|
|
148
|
-
},
|
|
149
|
-
rightElement: {
|
|
150
|
-
color: theme.colors.onSurfaceVariant,
|
|
151
|
-
iconSize: 24,
|
|
152
|
-
marginRight: theme.spacings._1,
|
|
153
|
-
marginLeft: theme.spacings['3'],
|
|
154
|
-
justifyContent: 'center',
|
|
155
107
|
|
|
156
108
|
variants: {
|
|
109
|
+
size: {
|
|
110
|
+
lg: {
|
|
111
|
+
...theme.typescale.bodyExtraLarge,
|
|
112
|
+
},
|
|
113
|
+
md: {
|
|
114
|
+
...theme.typescale.bodyLarge,
|
|
115
|
+
},
|
|
116
|
+
sm: {
|
|
117
|
+
...theme.typescale.bodyMedium,
|
|
118
|
+
},
|
|
119
|
+
xs: {
|
|
120
|
+
...theme.typescale.bodyMedium,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
variant: {
|
|
124
|
+
flat: {
|
|
125
|
+
paddingTop: 12,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
|
|
157
129
|
state: {
|
|
158
130
|
disabled: {
|
|
159
131
|
color: theme.colors.onSurface,
|
|
160
132
|
opacity: 0.38,
|
|
161
133
|
},
|
|
162
134
|
error: {
|
|
163
|
-
color: theme.colors.
|
|
135
|
+
color: theme.colors.onSurface,
|
|
164
136
|
},
|
|
165
137
|
errorFocused: {
|
|
166
|
-
color: theme.colors.
|
|
138
|
+
color: theme.colors.onSurface,
|
|
167
139
|
},
|
|
168
140
|
errorFocusedAndHovered: {
|
|
169
|
-
color: theme.colors.
|
|
141
|
+
color: theme.colors.onSurface,
|
|
170
142
|
},
|
|
171
143
|
errorDisabled: {
|
|
172
|
-
color: theme.colors.
|
|
144
|
+
color: theme.colors.onSurface,
|
|
173
145
|
opacity: 0.38,
|
|
174
146
|
},
|
|
175
147
|
errorHovered: {
|
|
176
|
-
color: theme.colors.
|
|
148
|
+
color: theme.colors.onSurface,
|
|
177
149
|
},
|
|
178
150
|
},
|
|
179
151
|
},
|
|
180
152
|
},
|
|
153
|
+
|
|
154
|
+
placeholder: {
|
|
155
|
+
color: theme.colors.onSurfaceVariant,
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
stateLayer: {
|
|
159
|
+
borderTopLeftRadius: theme.shapes.corner.extraSmall,
|
|
160
|
+
borderTopRightRadius: theme.shapes.corner.extraSmall,
|
|
161
|
+
variants: {
|
|
162
|
+
variant: {},
|
|
163
|
+
state: {},
|
|
164
|
+
},
|
|
165
|
+
compoundVariants: [
|
|
166
|
+
{
|
|
167
|
+
variant: 'flat',
|
|
168
|
+
state: 'hovered',
|
|
169
|
+
styles: {
|
|
170
|
+
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
variant: 'flat',
|
|
175
|
+
state: 'errorHovered',
|
|
176
|
+
styles: {
|
|
177
|
+
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
inputWrapper: {
|
|
184
|
+
paddingTop: 0,
|
|
185
|
+
paddingBottom: 0,
|
|
186
|
+
flexGrow: 1,
|
|
187
|
+
flexShrink: 1,
|
|
188
|
+
},
|
|
189
|
+
}));
|
|
190
|
+
|
|
191
|
+
export const styles = getRegisteredComponentStylesWithFallback('TextInput', textInputStylesDefault);
|
|
192
|
+
|
|
193
|
+
// TextInput.Label styles
|
|
194
|
+
const textInputLabelStylesDefault = StyleSheet.create(theme => ({
|
|
181
195
|
floatingLabel: {
|
|
182
196
|
variants: {
|
|
183
197
|
variant: {
|
|
@@ -187,11 +201,12 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
187
201
|
},
|
|
188
202
|
},
|
|
189
203
|
},
|
|
204
|
+
|
|
190
205
|
labelText: {
|
|
191
206
|
position: 'absolute',
|
|
192
207
|
left: 0,
|
|
193
208
|
color: theme.colors.onSurfaceVariant,
|
|
194
|
-
|
|
209
|
+
...theme.typescale.bodyLarge,
|
|
195
210
|
|
|
196
211
|
variants: {
|
|
197
212
|
size: {
|
|
@@ -204,6 +219,9 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
204
219
|
sm: {
|
|
205
220
|
...theme.typescale.bodyMedium,
|
|
206
221
|
},
|
|
222
|
+
xs: {
|
|
223
|
+
...theme.typescale.bodyMedium,
|
|
224
|
+
},
|
|
207
225
|
},
|
|
208
226
|
|
|
209
227
|
variant: {
|
|
@@ -250,51 +268,95 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
250
268
|
},
|
|
251
269
|
},
|
|
252
270
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
271
|
+
}));
|
|
272
|
+
|
|
273
|
+
export const textInputLabelStyles = getRegisteredComponentStylesWithFallback(
|
|
274
|
+
'TextInputLabel',
|
|
275
|
+
textInputLabelStylesDefault,
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
// TextInput.Left styles
|
|
279
|
+
const textInputLeftStylesDefault = StyleSheet.create(theme => ({
|
|
280
|
+
leftElement: {
|
|
281
|
+
color: theme.colors.onSurfaceVariant,
|
|
282
|
+
marginRight: theme.spacings['3'],
|
|
283
|
+
marginLeft: theme.spacings._1,
|
|
284
|
+
justifyContent: 'center',
|
|
257
285
|
|
|
258
286
|
variants: {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
287
|
+
state: {
|
|
288
|
+
disabled: {
|
|
289
|
+
color: theme.colors.onSurface,
|
|
290
|
+
opacity: 0.38,
|
|
262
291
|
},
|
|
263
|
-
|
|
264
|
-
|
|
292
|
+
error: {
|
|
293
|
+
color: theme.colors.onSurfaceVariant,
|
|
265
294
|
},
|
|
266
|
-
|
|
267
|
-
|
|
295
|
+
errorFocused: {
|
|
296
|
+
color: theme.colors.onSurfaceVariant,
|
|
297
|
+
},
|
|
298
|
+
errorFocusedAndHovered: {
|
|
299
|
+
color: theme.colors.onSurfaceVariant,
|
|
300
|
+
},
|
|
301
|
+
errorDisabled: {
|
|
302
|
+
color: theme.colors.onSurfaceVariant,
|
|
303
|
+
opacity: 0.38,
|
|
304
|
+
},
|
|
305
|
+
errorHovered: {
|
|
306
|
+
color: theme.colors.onSurfaceVariant,
|
|
268
307
|
},
|
|
269
308
|
},
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
}));
|
|
312
|
+
|
|
313
|
+
export const textInputLeftStyles = getRegisteredComponentStylesWithFallback(
|
|
314
|
+
'TextInputLeft',
|
|
315
|
+
textInputLeftStylesDefault,
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
// TextInput.Right styles
|
|
319
|
+
const textInputRightStylesDefault = StyleSheet.create(theme => ({
|
|
320
|
+
rightElement: {
|
|
321
|
+
color: theme.colors.onSurfaceVariant,
|
|
322
|
+
marginRight: theme.spacings._1,
|
|
323
|
+
marginLeft: theme.spacings['3'],
|
|
324
|
+
justifyContent: 'center',
|
|
273
325
|
|
|
326
|
+
variants: {
|
|
274
327
|
state: {
|
|
275
328
|
disabled: {
|
|
276
329
|
color: theme.colors.onSurface,
|
|
277
330
|
opacity: 0.38,
|
|
278
331
|
},
|
|
279
332
|
error: {
|
|
280
|
-
color: theme.colors.
|
|
333
|
+
color: theme.colors.error,
|
|
281
334
|
},
|
|
282
335
|
errorFocused: {
|
|
283
|
-
color: theme.colors.
|
|
336
|
+
color: theme.colors.error,
|
|
284
337
|
},
|
|
285
338
|
errorFocusedAndHovered: {
|
|
286
|
-
color: theme.colors.
|
|
339
|
+
color: theme.colors.error,
|
|
287
340
|
},
|
|
288
341
|
errorDisabled: {
|
|
289
|
-
color: theme.colors.
|
|
342
|
+
color: theme.colors.error,
|
|
290
343
|
opacity: 0.38,
|
|
291
344
|
},
|
|
292
345
|
errorHovered: {
|
|
293
|
-
color: theme.colors.
|
|
346
|
+
color: theme.colors.onErrorContainer,
|
|
294
347
|
},
|
|
295
348
|
},
|
|
296
349
|
},
|
|
297
350
|
},
|
|
351
|
+
}));
|
|
352
|
+
|
|
353
|
+
export const textInputRightStyles = getRegisteredComponentStylesWithFallback(
|
|
354
|
+
'TextInputRight',
|
|
355
|
+
textInputRightStylesDefault,
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
// TextInput.SupportingText styles
|
|
359
|
+
const textInputSupportingTextStylesDefault = StyleSheet.create({
|
|
298
360
|
supportingText: {
|
|
299
361
|
variants: {
|
|
300
362
|
state: {
|
|
@@ -307,9 +369,15 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
307
369
|
},
|
|
308
370
|
},
|
|
309
371
|
},
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
export const textInputSupportingTextStyles = getRegisteredComponentStylesWithFallback(
|
|
375
|
+
'TextInputSupportingText',
|
|
376
|
+
textInputSupportingTextStylesDefault,
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
// TextInput.Outline styles
|
|
380
|
+
const textInputOutlineStylesDefault = StyleSheet.create(theme => ({
|
|
313
381
|
outline: {
|
|
314
382
|
position: 'absolute',
|
|
315
383
|
left: 0,
|
|
@@ -322,7 +390,8 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
322
390
|
variants: {
|
|
323
391
|
variant: {
|
|
324
392
|
outlined: {
|
|
325
|
-
|
|
393
|
+
// this will be inherited from root
|
|
394
|
+
// borderRadius: theme.shapes.corner.extraSmall,
|
|
326
395
|
borderColor: theme.colors.outline,
|
|
327
396
|
borderWidth: 1,
|
|
328
397
|
},
|
|
@@ -399,6 +468,7 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
399
468
|
},
|
|
400
469
|
],
|
|
401
470
|
},
|
|
471
|
+
|
|
402
472
|
activeIndicator: {
|
|
403
473
|
variants: {
|
|
404
474
|
variant: {
|
|
@@ -489,24 +559,7 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
489
559
|
},
|
|
490
560
|
],
|
|
491
561
|
},
|
|
492
|
-
|
|
493
|
-
compoundVariants: [
|
|
494
|
-
{
|
|
495
|
-
variant: 'flat',
|
|
496
|
-
state: 'hovered',
|
|
497
|
-
styles: {
|
|
498
|
-
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
499
|
-
},
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
variant: 'flat',
|
|
503
|
-
state: 'errorHovered',
|
|
504
|
-
styles: {
|
|
505
|
-
backgroundColor: theme.colors.stateLayer.hover.onSurface,
|
|
506
|
-
},
|
|
507
|
-
},
|
|
508
|
-
],
|
|
509
|
-
},
|
|
562
|
+
|
|
510
563
|
underline: {
|
|
511
564
|
position: 'absolute',
|
|
512
565
|
left: 0,
|
|
@@ -515,23 +568,60 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
515
568
|
height: 1,
|
|
516
569
|
zIndex: 1,
|
|
517
570
|
},
|
|
518
|
-
labelContainer: {
|
|
519
|
-
paddingTop: 0,
|
|
520
|
-
paddingBottom: 0,
|
|
521
|
-
flexGrow: 1,
|
|
522
|
-
flexShrink: 1,
|
|
523
|
-
},
|
|
524
|
-
patchContainer: {
|
|
525
|
-
height: 24,
|
|
526
|
-
zIndex: 2,
|
|
527
|
-
},
|
|
528
571
|
}));
|
|
529
572
|
|
|
530
|
-
export const
|
|
573
|
+
export const textInputOutlineStyles = getRegisteredComponentStylesWithFallback(
|
|
574
|
+
'TextInputOutline',
|
|
575
|
+
textInputOutlineStylesDefault,
|
|
576
|
+
);
|
|
531
577
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
578
|
+
// TextInput.Icon styles
|
|
579
|
+
const textInputIconStylesDefault = StyleSheet.create(theme => ({
|
|
580
|
+
root: {
|
|
581
|
+
variants: {
|
|
582
|
+
state: {
|
|
583
|
+
default: {
|
|
584
|
+
color: theme.colors.onSurfaceVariant,
|
|
585
|
+
},
|
|
586
|
+
focused: {
|
|
587
|
+
color: theme.colors.onSurfaceVariant,
|
|
588
|
+
},
|
|
589
|
+
hovered: {
|
|
590
|
+
color: theme.colors.onSurfaceVariant,
|
|
591
|
+
},
|
|
592
|
+
hoveredAndFocused: {
|
|
593
|
+
color: theme.colors.onSurfaceVariant,
|
|
594
|
+
},
|
|
595
|
+
disabled: {
|
|
596
|
+
color: theme.colors.onSurface,
|
|
597
|
+
opacity: 0.38,
|
|
598
|
+
},
|
|
599
|
+
error: {
|
|
600
|
+
color: theme.colors.error,
|
|
601
|
+
},
|
|
602
|
+
errorFocused: {
|
|
603
|
+
color: theme.colors.error,
|
|
604
|
+
},
|
|
605
|
+
errorFocusedAndHovered: {
|
|
606
|
+
color: theme.colors.error,
|
|
607
|
+
},
|
|
608
|
+
errorDisabled: {
|
|
609
|
+
color: theme.colors.error,
|
|
610
|
+
opacity: 0.38,
|
|
611
|
+
},
|
|
612
|
+
errorHovered: {
|
|
613
|
+
color: theme.colors.onErrorContainer,
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
position: {
|
|
617
|
+
left: {},
|
|
618
|
+
right: {},
|
|
619
|
+
},
|
|
620
|
+
},
|
|
536
621
|
},
|
|
537
|
-
});
|
|
622
|
+
}));
|
|
623
|
+
|
|
624
|
+
export const textInputIconStyles = getRegisteredComponentStylesWithFallback(
|
|
625
|
+
'TextInputIcon',
|
|
626
|
+
textInputIconStylesDefault,
|
|
627
|
+
);
|