react-native-molecules 0.5.0-beta.2 → 0.5.0-beta.20
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 +1 -1
- 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 +209 -264
- package/components/Button/index.tsx +9 -3
- package/components/Button/types.ts +16 -2
- package/components/Button/utils.ts +230 -208
- package/components/Checkbox/CheckboxBase.tsx +23 -128
- package/components/Checkbox/utils.ts +0 -25
- package/components/Chip/Chip.tsx +40 -52
- package/components/Chip/utils.ts +3 -7
- package/components/DateField/DateField.tsx +110 -0
- package/components/DateField/index.tsx +6 -0
- package/components/{DatePickerInput/inputUtils.ts → DateField/useDateFieldState.ts} +17 -49
- package/components/DatePicker/DateCalendar.tsx +83 -0
- package/components/DatePicker/DatePickerActions.tsx +73 -0
- package/components/DatePicker/DatePickerModal.tsx +234 -0
- package/components/DatePicker/DatePickerPopover.tsx +79 -0
- package/components/DatePicker/DatePickerProvider.tsx +152 -0
- package/components/DatePicker/DatePickerTrigger.tsx +23 -0
- package/components/DatePicker/context.tsx +82 -0
- package/components/DatePicker/index.tsx +44 -0
- package/components/DatePicker/utils.ts +293 -0
- package/components/DatePickerInline/DatePickerContext.tsx +1 -0
- package/components/DatePickerInline/DatePickerDockedHeader.tsx +113 -0
- package/components/DatePickerInline/DatePickerInline.tsx +16 -15
- package/components/DatePickerInline/DatePickerInlineBase.tsx +7 -1
- package/components/DatePickerInline/Day.tsx +25 -1
- package/components/DatePickerInline/DayRange.tsx +2 -4
- package/components/DatePickerInline/HeaderItem.tsx +42 -27
- package/components/DatePickerInline/Month.tsx +45 -65
- package/components/DatePickerInline/MonthPicker.tsx +25 -41
- package/components/DatePickerInline/Swiper.native.tsx +21 -4
- package/components/DatePickerInline/Swiper.tsx +168 -13
- package/components/DatePickerInline/Week.tsx +6 -1
- package/components/DatePickerInline/YearPicker.tsx +206 -53
- package/components/DatePickerInline/dateUtils.tsx +17 -12
- package/components/DatePickerInline/types.ts +3 -0
- package/components/DatePickerInline/utils.ts +66 -29
- package/components/Drawer/Drawer.tsx +17 -6
- package/components/ElementGroup/ElementGroup.tsx +16 -14
- 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 +3 -3
- package/components/Icon/index.tsx +1 -1
- package/components/Icon/types.ts +17 -6
- package/components/IconButton/IconButton.tsx +42 -57
- package/components/IconButton/utils.ts +142 -33
- package/components/ListItem/ListItem.tsx +3 -1
- package/components/ListItem/utils.ts +1 -1
- 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 +3 -18
- package/components/NavigationRail/NavigationRail.tsx +15 -9
- package/components/Popover/Popover.tsx +122 -145
- package/components/Popover/PopoverRoot.tsx +74 -0
- package/components/Popover/common.ts +50 -34
- package/components/Popover/index.ts +18 -1
- package/components/Popover/usePlatformMeasure.native.ts +90 -0
- package/components/Popover/usePlatformMeasure.ts +118 -0
- package/components/Popover/utils.ts +34 -0
- package/components/Select/Select.tsx +368 -507
- package/components/Select/context.tsx +72 -0
- package/components/Select/index.ts +8 -14
- package/components/Select/types.ts +2 -4
- package/components/Select/utils.ts +144 -0
- package/components/Slot/Slot.tsx +244 -0
- package/components/Slot/compose-refs.tsx +62 -0
- package/components/Slot/index.tsx +8 -0
- 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/utils.ts +44 -30
- package/components/Switch/Switch.tsx +8 -2
- package/components/Tabs/TabItem.tsx +35 -58
- package/components/Tabs/TabLabel.tsx +5 -9
- package/components/Tabs/Tabs.tsx +154 -148
- package/components/Tabs/utils.ts +15 -2
- package/components/TextInput/TextInput.tsx +658 -575
- package/components/TextInput/index.tsx +19 -3
- package/components/TextInput/types.ts +76 -27
- package/components/TextInput/utils.ts +225 -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/TimeInput.tsx +87 -37
- package/components/TimePicker/TimeInputs.tsx +137 -49
- package/components/TimePicker/TimePicker.tsx +73 -10
- 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 -0
- package/components/Tooltip/Tooltip.tsx +42 -67
- package/components/Tooltip/TooltipContent.tsx +32 -5
- package/components/Tooltip/TooltipTrigger.tsx +20 -20
- package/components/Tooltip/index.tsx +1 -1
- package/components/TouchableRipple/TouchableRipple.native.tsx +50 -14
- package/components/TouchableRipple/TouchableRipple.tsx +137 -47
- package/hocs/withPortal.tsx +1 -1
- package/hooks/index.tsx +0 -6
- package/hooks/useActionState.tsx +19 -8
- package/hooks/useControlledValue.tsx +20 -4
- package/hooks/useFilePicker.tsx +6 -16
- package/hooks/useWhatHasUpdated.tsx +48 -0
- package/package.json +17 -13
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +5 -2
- 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/extractPropertiesFromStyles.ts +25 -0
- package/utils/extractSubcomponents.ts +89 -0
- package/utils/lodash.ts +77 -5
- 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/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/Popover/Popover.native.tsx +0 -185
- 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/hooks/useSearchable.tsx +0 -74
- package/hooks/useSubcomponents.tsx +0 -59
|
@@ -5,15 +5,13 @@ import {
|
|
|
5
5
|
type StyleProp,
|
|
6
6
|
type TextStyle,
|
|
7
7
|
type ViewProps,
|
|
8
|
-
type ViewStyle,
|
|
9
8
|
} from 'react-native';
|
|
10
9
|
|
|
11
10
|
import { useActionState } from '../../hooks/useActionState';
|
|
12
11
|
import { resolveStateVariant } from '../../utils';
|
|
13
|
-
import { Icon, type IconType } from '../Icon';
|
|
12
|
+
import { Icon, type IconProps, type IconType } from '../Icon';
|
|
14
13
|
import CrossFadeIcon from '../Icon/CrossFadeIcon';
|
|
15
14
|
import { StateLayer } from '../StateLayer';
|
|
16
|
-
import { Surface } from '../Surface';
|
|
17
15
|
import { TouchableRipple, type TouchableRippleProps } from '../TouchableRipple';
|
|
18
16
|
import type { IconButtonVariant } from './types';
|
|
19
17
|
import { defaultStyles, iconButtonSizeToIconSizeMap } from './utils';
|
|
@@ -63,14 +61,11 @@ export type Props = Omit<TouchableRippleProps, 'children' | 'style'> & {
|
|
|
63
61
|
*/
|
|
64
62
|
style?: StyleProp<TextStyle>;
|
|
65
63
|
iconStyle?: StyleProp<TextStyle>;
|
|
64
|
+
iconProps?: Omit<IconProps, 'name' | 'type' | 'style' | 'color' | 'size'>;
|
|
66
65
|
/**
|
|
67
66
|
* color of the icon
|
|
68
67
|
*/
|
|
69
68
|
color?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Style of the innerContainer
|
|
72
|
-
*/
|
|
73
|
-
innerContainerStyle?: ViewStyle;
|
|
74
69
|
/**
|
|
75
70
|
* Props for the state layer
|
|
76
71
|
* */
|
|
@@ -92,10 +87,10 @@ const IconButton = (
|
|
|
92
87
|
animated = false,
|
|
93
88
|
variant = 'default',
|
|
94
89
|
style,
|
|
95
|
-
innerContainerStyle: innerContainerStyleProp = emptyObject,
|
|
96
90
|
testID,
|
|
97
91
|
stateLayerProps = emptyObject,
|
|
98
|
-
iconStyle,
|
|
92
|
+
iconStyle: iconStyleProp,
|
|
93
|
+
iconProps,
|
|
99
94
|
...rest
|
|
100
95
|
}: Props,
|
|
101
96
|
ref: any,
|
|
@@ -126,9 +121,9 @@ const IconButton = (
|
|
|
126
121
|
rippleColor,
|
|
127
122
|
containerStyle,
|
|
128
123
|
accessibilityState,
|
|
129
|
-
innerContainerStyle,
|
|
130
124
|
// accessibilityTraits,
|
|
131
125
|
stateLayerStyle,
|
|
126
|
+
iconStyle,
|
|
132
127
|
} = useMemo(() => {
|
|
133
128
|
const iconSizeInNum =
|
|
134
129
|
iconButtonSizeToIconSizeMap[size as keyof typeof iconButtonSizeToIconSizeMap] ??
|
|
@@ -146,7 +141,6 @@ const IconButton = (
|
|
|
146
141
|
iconColor: _iconColor,
|
|
147
142
|
iconSize: iconSizeInNum,
|
|
148
143
|
rippleColor: _rippleColor,
|
|
149
|
-
innerContainerStyle: [defaultStyles.innerContainer, innerContainerStyleProp],
|
|
150
144
|
containerStyle: [
|
|
151
145
|
iconSizeInNum
|
|
152
146
|
? {
|
|
@@ -157,60 +151,51 @@ const IconButton = (
|
|
|
157
151
|
defaultStyles.root,
|
|
158
152
|
style,
|
|
159
153
|
],
|
|
154
|
+
iconStyle: [defaultStyles.icon, iconStyleProp],
|
|
160
155
|
// accessibilityTraits: disabled ? ['button', 'disabled'] : 'button',
|
|
161
156
|
accessibilityState: { disabled },
|
|
162
157
|
stateLayerStyle: [defaultStyles.stateLayer, stateLayerProps?.style],
|
|
163
158
|
};
|
|
164
159
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
165
|
-
}, [
|
|
166
|
-
_iconColor,
|
|
167
|
-
disabled,
|
|
168
|
-
innerContainerStyleProp,
|
|
169
|
-
size,
|
|
170
|
-
stateLayerProps?.style,
|
|
171
|
-
style,
|
|
172
|
-
state,
|
|
173
|
-
variant,
|
|
174
|
-
]);
|
|
160
|
+
}, [_iconColor, disabled, size, stateLayerProps?.style, style, state, variant]);
|
|
175
161
|
|
|
176
162
|
return (
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
hitSlop={
|
|
191
|
-
// @ts-ignore
|
|
192
|
-
TouchableRipple?.supported ? rippleSupportedHitSlop : rippleUnsupportedHitSlop
|
|
193
|
-
}
|
|
163
|
+
<TouchableRipple
|
|
164
|
+
borderless
|
|
165
|
+
centered
|
|
166
|
+
onPress={onPress}
|
|
167
|
+
rippleColor={rippleColor}
|
|
168
|
+
accessibilityLabel={accessibilityLabel}
|
|
169
|
+
style={containerStyle}
|
|
170
|
+
// accessibilityTraits={accessibilityTraits}
|
|
171
|
+
// accessibilityComponentType="button"
|
|
172
|
+
accessibilityRole="button"
|
|
173
|
+
accessibilityState={accessibilityState}
|
|
174
|
+
disabled={disabled}
|
|
175
|
+
hitSlop={
|
|
194
176
|
// @ts-ignore
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
177
|
+
TouchableRipple?.supported ? rippleSupportedHitSlop : rippleUnsupportedHitSlop
|
|
178
|
+
}
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
ref={actionsRef}
|
|
181
|
+
testID={testID}
|
|
182
|
+
{...rest}>
|
|
183
|
+
<>
|
|
184
|
+
<IconComponent
|
|
185
|
+
color={iconColor}
|
|
186
|
+
name={name}
|
|
187
|
+
size={iconSize}
|
|
188
|
+
type={type}
|
|
189
|
+
style={iconStyle}
|
|
190
|
+
{...iconProps}
|
|
191
|
+
/>
|
|
192
|
+
<StateLayer
|
|
193
|
+
testID={testID ? `${testID}-stateLayer` : ''}
|
|
194
|
+
{...stateLayerProps}
|
|
195
|
+
style={stateLayerStyle}
|
|
196
|
+
/>
|
|
197
|
+
</>
|
|
198
|
+
</TouchableRipple>
|
|
214
199
|
);
|
|
215
200
|
};
|
|
216
201
|
|
|
@@ -22,11 +22,12 @@ const iconButtonSizeToIconSizeMapDefault = {
|
|
|
22
22
|
const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
23
23
|
root: {
|
|
24
24
|
borderColor: theme.colors.outline,
|
|
25
|
-
color: theme.colors.onSurfaceVariant,
|
|
26
25
|
borderRadius: theme.shapes.corner.full,
|
|
27
26
|
overflow: 'hidden',
|
|
28
27
|
borderWidth: 0,
|
|
29
28
|
backgroundColor: 'transparent',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
alignItems: 'center',
|
|
30
31
|
|
|
31
32
|
variants: {
|
|
32
33
|
size: {
|
|
@@ -71,16 +72,13 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
71
72
|
|
|
72
73
|
contained: {
|
|
73
74
|
backgroundColor: theme.colors.surfaceVariant,
|
|
74
|
-
color: theme.colors.primary,
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
'contained-tonal': {
|
|
78
78
|
backgroundColor: theme.colors.surfaceVariant,
|
|
79
|
-
color: theme.colors.onSurfaceVariant,
|
|
80
79
|
},
|
|
81
80
|
|
|
82
81
|
outlined: {
|
|
83
|
-
color: theme.colors.onSurfaceVariant,
|
|
84
82
|
borderWidth: 1,
|
|
85
83
|
},
|
|
86
84
|
},
|
|
@@ -90,30 +88,23 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
90
88
|
{
|
|
91
89
|
variant: 'default',
|
|
92
90
|
state: 'selectedAndDisabled',
|
|
93
|
-
styles: {
|
|
94
|
-
color: theme.colors.primary,
|
|
95
|
-
},
|
|
91
|
+
styles: {},
|
|
96
92
|
},
|
|
97
93
|
{
|
|
98
94
|
variant: 'default',
|
|
99
95
|
state: 'selected',
|
|
100
|
-
styles: {
|
|
101
|
-
color: theme.colors.primary,
|
|
102
|
-
},
|
|
96
|
+
styles: {},
|
|
103
97
|
},
|
|
104
98
|
{
|
|
105
99
|
variant: 'default',
|
|
106
100
|
state: 'selectedAndHovered',
|
|
107
|
-
styles: {
|
|
108
|
-
color: theme.colors.primary,
|
|
109
|
-
},
|
|
101
|
+
styles: {},
|
|
110
102
|
},
|
|
111
103
|
{
|
|
112
104
|
variant: 'contained',
|
|
113
105
|
state: 'selectedAndDisabled',
|
|
114
106
|
styles: {
|
|
115
107
|
backgroundColor: theme.colors.primary,
|
|
116
|
-
color: theme.colors.onPrimary,
|
|
117
108
|
},
|
|
118
109
|
},
|
|
119
110
|
{
|
|
@@ -128,14 +119,13 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
128
119
|
state: 'selected',
|
|
129
120
|
styles: {
|
|
130
121
|
backgroundColor: theme.colors.primary,
|
|
131
|
-
color: theme.colors.onPrimary,
|
|
132
122
|
},
|
|
133
123
|
},
|
|
134
124
|
{
|
|
135
125
|
variant: 'contained',
|
|
136
126
|
state: 'selectedAndHovered',
|
|
137
127
|
styles: {
|
|
138
|
-
|
|
128
|
+
backgroundColor: theme.colors.primary,
|
|
139
129
|
},
|
|
140
130
|
},
|
|
141
131
|
{
|
|
@@ -143,7 +133,6 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
143
133
|
state: 'hovered',
|
|
144
134
|
styles: {
|
|
145
135
|
backgroundColor: theme.colors.primary,
|
|
146
|
-
color: theme.colors.onPrimary,
|
|
147
136
|
},
|
|
148
137
|
},
|
|
149
138
|
{
|
|
@@ -151,7 +140,6 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
151
140
|
state: 'selectedAndDisabled',
|
|
152
141
|
styles: {
|
|
153
142
|
backgroundColor: theme.colors.secondaryContainer,
|
|
154
|
-
color: theme.colors.onSecondaryContainer,
|
|
155
143
|
},
|
|
156
144
|
},
|
|
157
145
|
{
|
|
@@ -166,7 +154,6 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
166
154
|
state: 'selected',
|
|
167
155
|
styles: {
|
|
168
156
|
backgroundColor: theme.colors.secondaryContainer,
|
|
169
|
-
color: theme.colors.onSecondaryContainer,
|
|
170
157
|
},
|
|
171
158
|
},
|
|
172
159
|
{
|
|
@@ -174,7 +161,6 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
174
161
|
state: 'selectedAndHovered',
|
|
175
162
|
styles: {
|
|
176
163
|
backgroundColor: theme.colors.secondaryContainer,
|
|
177
|
-
color: theme.colors.onSecondaryContainer,
|
|
178
164
|
},
|
|
179
165
|
},
|
|
180
166
|
{
|
|
@@ -182,7 +168,6 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
182
168
|
state: 'selectedAndDisabled',
|
|
183
169
|
styles: {
|
|
184
170
|
backgroundColor: theme.colors.inverseSurface,
|
|
185
|
-
color: theme.colors.inverseOnSurface,
|
|
186
171
|
borderWidth: 0,
|
|
187
172
|
},
|
|
188
173
|
},
|
|
@@ -198,7 +183,6 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
198
183
|
state: 'selected',
|
|
199
184
|
styles: {
|
|
200
185
|
backgroundColor: theme.colors.inverseSurface,
|
|
201
|
-
color: theme.colors.inverseOnSurface,
|
|
202
186
|
borderWidth: 0,
|
|
203
187
|
},
|
|
204
188
|
},
|
|
@@ -207,17 +191,12 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
207
191
|
state: 'selectedAndHovered',
|
|
208
192
|
styles: {
|
|
209
193
|
backgroundColor: theme.colors.secondaryContainer,
|
|
210
|
-
color: theme.colors.onSecondaryContainer,
|
|
211
194
|
},
|
|
212
195
|
},
|
|
213
196
|
{
|
|
214
197
|
variant: 'outlined',
|
|
215
198
|
state: 'hovered',
|
|
216
|
-
styles: {
|
|
217
|
-
backgroundColor: theme.colors.inverseSurface,
|
|
218
|
-
color: theme.colors.inverseOnSurface,
|
|
219
|
-
borderWidth: 0,
|
|
220
|
-
},
|
|
199
|
+
styles: {},
|
|
221
200
|
},
|
|
222
201
|
],
|
|
223
202
|
},
|
|
@@ -296,16 +275,146 @@ const iconButtonStylesDefault = StyleSheet.create(theme => ({
|
|
|
296
275
|
variant: 'outlined',
|
|
297
276
|
state: 'hovered',
|
|
298
277
|
styles: {
|
|
299
|
-
backgroundColor: theme.colors.stateLayer.hover.
|
|
278
|
+
backgroundColor: theme.colors.stateLayer.hover.onSurfaceVariant,
|
|
300
279
|
},
|
|
301
280
|
},
|
|
302
281
|
],
|
|
303
282
|
},
|
|
304
283
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
284
|
+
icon: {
|
|
285
|
+
color: theme.colors.onSurfaceVariant,
|
|
286
|
+
|
|
287
|
+
variants: {
|
|
288
|
+
variant: {
|
|
289
|
+
default: {},
|
|
290
|
+
|
|
291
|
+
contained: {
|
|
292
|
+
color: theme.colors.primary,
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
'contained-tonal': {
|
|
296
|
+
color: theme.colors.onSurfaceVariant,
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
outlined: {
|
|
300
|
+
color: theme.colors.onSurfaceVariant,
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
compoundVariants: [
|
|
306
|
+
{
|
|
307
|
+
variant: 'default',
|
|
308
|
+
state: 'selectedAndDisabled',
|
|
309
|
+
styles: {
|
|
310
|
+
color: theme.colors.primary,
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
variant: 'default',
|
|
315
|
+
state: 'selected',
|
|
316
|
+
styles: {
|
|
317
|
+
color: theme.colors.primary,
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
variant: 'default',
|
|
322
|
+
state: 'selectedAndHovered',
|
|
323
|
+
styles: {
|
|
324
|
+
color: theme.colors.primary,
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
variant: 'contained',
|
|
329
|
+
state: 'selectedAndDisabled',
|
|
330
|
+
styles: {
|
|
331
|
+
color: theme.colors.onPrimary,
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
variant: 'contained',
|
|
336
|
+
state: 'disabled',
|
|
337
|
+
styles: {},
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
variant: 'contained',
|
|
341
|
+
state: 'selected',
|
|
342
|
+
styles: {
|
|
343
|
+
color: theme.colors.onPrimary,
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
variant: 'contained',
|
|
348
|
+
state: 'selectedAndHovered',
|
|
349
|
+
styles: {
|
|
350
|
+
color: theme.colors.onPrimary,
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
variant: 'contained',
|
|
355
|
+
state: 'hovered',
|
|
356
|
+
styles: {
|
|
357
|
+
color: theme.colors.onPrimary,
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
variant: 'contained-tonal',
|
|
362
|
+
state: 'selectedAndDisabled',
|
|
363
|
+
styles: {
|
|
364
|
+
color: theme.colors.onSecondaryContainer,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
variant: 'contained-tonal',
|
|
369
|
+
state: 'disabled',
|
|
370
|
+
styles: {},
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
variant: 'contained-tonal',
|
|
374
|
+
state: 'selected',
|
|
375
|
+
styles: {
|
|
376
|
+
color: theme.colors.onSecondaryContainer,
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
variant: 'contained-tonal',
|
|
381
|
+
state: 'selectedAndHovered',
|
|
382
|
+
styles: {
|
|
383
|
+
color: theme.colors.onSecondaryContainer,
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
variant: 'outlined',
|
|
388
|
+
state: 'selectedAndDisabled',
|
|
389
|
+
styles: {
|
|
390
|
+
color: theme.colors.inverseOnSurface,
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
variant: 'outlined',
|
|
395
|
+
state: 'disabled',
|
|
396
|
+
styles: {},
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
variant: 'outlined',
|
|
400
|
+
state: 'selected',
|
|
401
|
+
styles: {
|
|
402
|
+
color: theme.colors.inverseOnSurface,
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
variant: 'outlined',
|
|
407
|
+
state: 'selectedAndHovered',
|
|
408
|
+
styles: {
|
|
409
|
+
color: theme.colors.onSecondaryContainer,
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
variant: 'outlined',
|
|
414
|
+
state: 'hovered',
|
|
415
|
+
styles: {},
|
|
416
|
+
},
|
|
417
|
+
],
|
|
309
418
|
},
|
|
310
419
|
}));
|
|
311
420
|
|
|
@@ -37,6 +37,7 @@ export type Props = Omit<TouchableRippleProps, 'children'> &
|
|
|
37
37
|
* @default true if onPress is passed
|
|
38
38
|
*/
|
|
39
39
|
hoverable?: boolean;
|
|
40
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
const ListItem = (
|
|
@@ -52,6 +53,7 @@ const ListItem = (
|
|
|
52
53
|
onPress,
|
|
53
54
|
hoverable: hoverableProp = false,
|
|
54
55
|
hovered: hoveredProp = false,
|
|
56
|
+
contentStyle: contentStyleProp,
|
|
55
57
|
...props
|
|
56
58
|
}: Props,
|
|
57
59
|
ref: any,
|
|
@@ -108,7 +110,7 @@ const ListItem = (
|
|
|
108
110
|
{typeof left === 'function' ? left({ hovered }) : left}
|
|
109
111
|
</View>
|
|
110
112
|
) : null}
|
|
111
|
-
<View style={contentStyle}>
|
|
113
|
+
<View style={[contentStyle, contentStyleProp]}>
|
|
112
114
|
<ListItemContext.Provider value={contextValue}>
|
|
113
115
|
<>{children}</>
|
|
114
116
|
</ListItemContext.Provider>
|