react-native-molecules 0.5.0-beta.0 → 0.5.0-beta.2
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/AccordionItem.tsx +3 -2
- package/components/Accordion/AccordionItemContent.tsx +1 -0
- package/components/Accordion/AccordionItemHeader.tsx +6 -5
- package/components/Accordion/index.tsx +8 -14
- package/components/Accordion/utils.ts +17 -14
- package/components/ActivityIndicator/ActivityIndicator.tsx +6 -5
- 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 +3 -1
- package/components/Button/index.tsx +1 -5
- package/components/Button/utils.ts +5 -8
- 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 +1 -0
- package/components/Checkbox/index.tsx +1 -5
- package/components/Checkbox/utils.ts +6 -6
- package/components/Chip/index.tsx +1 -5
- package/components/Chip/utils.ts +2 -6
- 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/index.tsx +2 -6
- package/components/DatePickerInput/utils.ts +5 -6
- 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/index.tsx +1 -5
- package/components/ElementGroup/utils.ts +5 -6
- package/components/FAB/index.tsx +1 -5
- package/components/FAB/utils.ts +3 -7
- package/components/FilePicker/index.tsx +1 -5
- package/components/FilePicker/utils.ts +5 -6
- 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 +3 -14
- package/components/Icon/index.tsx +1 -5
- package/components/IconButton/IconButton.tsx +3 -1
- package/components/IconButton/index.tsx +1 -5
- package/components/IconButton/utils.ts +11 -16
- 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 +7 -9
- package/components/ListItem/index.tsx +1 -5
- package/components/ListItem/utils.ts +13 -11
- 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/NavigationRailItem.tsx +2 -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 +5 -10
- package/components/RadioButton/utils.ts +9 -8
- package/components/Rating/RatingItem.tsx +2 -1
- package/components/Rating/index.tsx +1 -5
- package/components/Rating/utils.ts +6 -8
- package/components/StateLayer/index.tsx +1 -5
- package/components/StateLayer/utils.ts +5 -6
- package/components/Surface/index.tsx +1 -5
- package/components/Surface/utils.ts +5 -6
- package/components/Switch/index.tsx +1 -5
- package/components/Switch/utils.ts +2 -6
- package/components/Tabs/Tabs.tsx +14 -13
- package/components/Tabs/index.tsx +1 -5
- package/components/Tabs/utils.ts +10 -10
- package/components/Text/Text.tsx +2 -8
- package/components/TextInput/TextInput.tsx +1 -0
- package/components/TextInput/index.tsx +1 -5
- package/components/TextInput/utils.ts +8 -15
- 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/index.tsx +1 -5
- package/components/TimePickerField/utils.ts +5 -6
- package/components/TimePickerModal/index.tsx +1 -5
- package/components/TimePickerModal/utils.ts +5 -6
- package/components/Tooltip/index.tsx +5 -9
- package/components/Tooltip/utils.ts +5 -6
- 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/hooks/index.tsx +0 -1
- package/package.json +1 -3
- package/shortcuts-manager/ShortcutsManager/utils.tsx +3 -2
- package/shortcuts-manager/useShortcut/index.tsx +1 -1
- package/shortcuts-manager/useShortcut/useShortcut.tsx +1 -1
- package/utils/lodash.ts +0 -1
- package/utils/repository.ts +2 -52
- package/utils/tokenStylesParser.ts +3 -1
- package/hooks/useBreakpoints.tsx +0 -7
|
@@ -128,7 +128,8 @@ const NavigationRailItem = memo(
|
|
|
128
128
|
iconContainerStyle: [
|
|
129
129
|
navigationRailItemStyles.iconContainer,
|
|
130
130
|
!label && {
|
|
131
|
-
|
|
131
|
+
// TODO - remove this. We cannot do it like this
|
|
132
|
+
height: (navigationRailItemStyles.iconContainer as any).width,
|
|
132
133
|
},
|
|
133
134
|
iconContainerProps.style,
|
|
134
135
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import NavigationRailComponent from './NavigationRail';
|
|
3
3
|
import NavigationRailContent from './NavigationRailContent';
|
|
4
4
|
import NavigationRailFooter from './NavigationRailFooter';
|
|
@@ -12,10 +12,6 @@ export const NavigationRailDefault = Object.assign(NavigationRailComponent, {
|
|
|
12
12
|
Footer: NavigationRailFooter,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
registerMoleculesComponents({
|
|
16
|
-
NavigationRail: NavigationRailDefault,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
15
|
export const NavigationRail = getRegisteredComponentWithFallback(
|
|
20
16
|
'NavigationRail',
|
|
21
17
|
NavigationRailDefault,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
const navigationRailStylesDefault = StyleSheet.create(theme => ({
|
|
6
6
|
root: {
|
|
@@ -152,19 +152,23 @@ const navigationRailItemStylesDefault = StyleSheet.create(theme => ({
|
|
|
152
152
|
},
|
|
153
153
|
}));
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
NavigationRail
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
export const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
155
|
+
export const navigationRailStyles = getRegisteredComponentStylesWithFallback(
|
|
156
|
+
'NavigationRail',
|
|
157
|
+
navigationRailStylesDefault,
|
|
158
|
+
);
|
|
159
|
+
export const navigationRailHeaderStyles = getRegisteredComponentStylesWithFallback(
|
|
160
|
+
'NavigationRail_Header',
|
|
161
|
+
navigationRailHeaderStylesDefault,
|
|
162
|
+
);
|
|
163
|
+
export const navigationRailContentStyles = getRegisteredComponentStylesWithFallback(
|
|
164
|
+
'NavigationRail_Content',
|
|
165
|
+
navigationRailContentStylesDefault,
|
|
166
|
+
);
|
|
167
|
+
export const navigationRailFooterStyles = getRegisteredComponentStylesWithFallback(
|
|
168
|
+
'NavigationRail_Footer',
|
|
169
|
+
navigationRailFooterStylesDefault,
|
|
170
|
+
);
|
|
171
|
+
export const navigationRailItemStyles = getRegisteredComponentStylesWithFallback(
|
|
172
|
+
'NavigationRail_Item',
|
|
173
|
+
navigationRailItemStylesDefault,
|
|
174
|
+
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import NavigationStackComponent from './NavigationStack';
|
|
3
3
|
import NavigationStackItem from './NavigationStackItem';
|
|
4
4
|
|
|
@@ -6,10 +6,6 @@ export const NavigationStackDefault = Object.assign(NavigationStackComponent, {
|
|
|
6
6
|
Item: NavigationStackItem,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
registerMoleculesComponents({
|
|
10
|
-
NavigationStack: NavigationStackDefault,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
9
|
export const NavigationStack = getRegisteredComponentWithFallback(
|
|
14
10
|
'NavigationStack',
|
|
15
11
|
NavigationStackDefault,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
|
|
4
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
5
|
import { NavigationStackContext } from './NavigationStack';
|
|
5
6
|
|
|
6
7
|
export const useNavigation = () => {
|
|
@@ -11,6 +12,11 @@ export const useRoute = () => {
|
|
|
11
12
|
return useContext(NavigationStackContext).currentRoute;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
export const
|
|
15
|
+
export const navigationStackItemStylesDefault = StyleSheet.create({
|
|
15
16
|
root: {},
|
|
16
17
|
});
|
|
18
|
+
|
|
19
|
+
export const navigationStackItemStyles = getRegisteredComponentStylesWithFallback(
|
|
20
|
+
'NavigationStack_Item',
|
|
21
|
+
navigationStackItemStylesDefault,
|
|
22
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import PortalDefault from './Portal';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Portal: PortalDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
// @ts-ignore TODO - fix this error
|
|
9
5
|
export const Portal = getRegisteredComponentWithFallback('Portal', PortalDefault);
|
|
10
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import RadioButtonComponent from './RadioButton';
|
|
3
3
|
import RadioButtonGroup from './RadioButtonGroup';
|
|
4
4
|
import RadioButtonItem from './RadioButtonItem';
|
|
@@ -14,14 +14,9 @@ const RadioButtonDefault = Object.assign(
|
|
|
14
14
|
},
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
registerMoleculesComponents({
|
|
18
|
-
RadioButton: RadioButtonDefault,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
17
|
export const RadioButton = getRegisteredComponentWithFallback('RadioButton', RadioButtonDefault);
|
|
22
18
|
|
|
23
|
-
export { Props as RadioButtonProps } from './RadioButton';
|
|
24
|
-
export { Props as RadioButtonGroupProps } from './RadioButtonGroup';
|
|
25
|
-
export { Props as RadioButtonItemProps } from './RadioButtonItem';
|
|
26
|
-
|
|
27
|
-
export { radioButtonStyles, radioButtonItemStyles } from './utils';
|
|
19
|
+
export type { Props as RadioButtonProps } from './RadioButton';
|
|
20
|
+
export type { Props as RadioButtonGroupProps } from './RadioButtonGroup';
|
|
21
|
+
export type { Props as RadioButtonItemProps } from './RadioButtonItem';
|
|
22
|
+
export { radioButtonItemStyles, radioButtonStyles } from './utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
// type States = 'disabled' | 'checked' | 'hovered' | 'checkedAndHovered';
|
|
6
6
|
|
|
@@ -121,13 +121,14 @@ const radioButtonItemStylesDefault = StyleSheet.create(theme => ({
|
|
|
121
121
|
},
|
|
122
122
|
}));
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
RadioButton
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
export const radioButtonStyles = getRegisteredComponentStylesWithFallback(
|
|
125
|
+
'RadioButton',
|
|
126
|
+
radioButtonStylesDefault,
|
|
127
|
+
);
|
|
128
|
+
export const radioButtonItemStyles = getRegisteredComponentStylesWithFallback(
|
|
129
|
+
'RadioButton_Item',
|
|
130
|
+
radioButtonItemStylesDefault,
|
|
131
|
+
);
|
|
131
132
|
|
|
132
133
|
export const handlePress = ({
|
|
133
134
|
onPress,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { forwardRef, memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import { Pressable, type ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { resolveStateVariant } from '../../utils';
|
|
3
5
|
import { Icon, type IconProps, type IconType } from '../Icon';
|
|
4
6
|
import { Tooltip, type TooltipProps } from '../Tooltip';
|
|
5
|
-
import { resolveStateVariant } from '../../utils';
|
|
6
7
|
import { ratingItemStyles } from './utils';
|
|
7
8
|
|
|
8
9
|
export type Props = Omit<IconProps, 'ref'> & {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import RatingDefault from './Rating';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Rating: RatingDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Rating = getRegisteredComponentWithFallback('Rating', RatingDefault);
|
|
9
5
|
|
|
10
6
|
export type { Props as RatingProps } from './Rating';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
export type States = 'activeAndDisabled' | 'active' | 'disabled' | 'readonly' | 'activeAndReadonly';
|
|
6
6
|
|
|
@@ -29,10 +29,8 @@ const ratingItemStylesDefault = StyleSheet.create(theme => ({
|
|
|
29
29
|
},
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Rating_Item
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export const ratingStyles = getRegisteredMoleculesComponentStyles('Rating');
|
|
38
|
-
export const ratingItemStyles = getRegisteredMoleculesComponentStyles('Rating_Item');
|
|
32
|
+
export const ratingStyles = getRegisteredComponentStylesWithFallback('Rating', ratingStylesDefault);
|
|
33
|
+
export const ratingItemStyles = getRegisteredComponentStylesWithFallback(
|
|
34
|
+
'Rating_Item',
|
|
35
|
+
ratingItemStylesDefault,
|
|
36
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import StateLayerDefault from './StateLayer';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
StateLayer: StateLayerDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const StateLayer = getRegisteredComponentWithFallback('StateLayer', StateLayerDefault);
|
|
9
5
|
|
|
10
6
|
export type { Props as StateLayerProps } from './StateLayer';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
const stateLayerStylesDefault = StyleSheet.create({
|
|
6
6
|
root: {
|
|
@@ -10,8 +10,7 @@ const stateLayerStylesDefault = StyleSheet.create({
|
|
|
10
10
|
},
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
StateLayer
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const stateLayerStyles = getRegisteredMoleculesComponentStyles('StateLayer');
|
|
13
|
+
export const stateLayerStyles = getRegisteredComponentStylesWithFallback(
|
|
14
|
+
'StateLayer',
|
|
15
|
+
stateLayerStylesDefault,
|
|
16
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import SurfaceDefault from './Surface';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Surface: SurfaceDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Surface = getRegisteredComponentWithFallback('Surface', SurfaceDefault);
|
|
9
5
|
|
|
10
6
|
export * from './BackgroundContextWrapper';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Animated } from 'react-native';
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
5
5
|
import { inputRange } from '../../styles/shadow';
|
|
6
6
|
|
|
7
7
|
const defaultStylesDefault = StyleSheet.create(theme => ({
|
|
@@ -10,11 +10,10 @@ const defaultStylesDefault = StyleSheet.create(theme => ({
|
|
|
10
10
|
},
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
Surface
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const defaultStyles = getRegisteredMoleculesComponentStyles('Surface');
|
|
13
|
+
export const defaultStyles = getRegisteredComponentStylesWithFallback(
|
|
14
|
+
'Surface',
|
|
15
|
+
defaultStylesDefault,
|
|
16
|
+
);
|
|
18
17
|
|
|
19
18
|
// TODO - abstract this
|
|
20
19
|
export function extractProperties(
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import SwitchDefault from './Switch';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Switch: SwitchDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Switch = getRegisteredComponentWithFallback('Switch', SwitchDefault);
|
|
9
5
|
|
|
10
6
|
export { type Props as SwitchProps } from './Switch';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
type States =
|
|
6
6
|
| 'selected'
|
|
@@ -276,8 +276,4 @@ const switchStylesDefault = StyleSheet.create(theme => ({
|
|
|
276
276
|
},
|
|
277
277
|
}));
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
Switch: switchStylesDefault,
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
export const switchStyles = getRegisteredMoleculesComponentStyles('Switch');
|
|
279
|
+
export const switchStyles = getRegisteredComponentStylesWithFallback('Switch', switchStylesDefault);
|
package/components/Tabs/Tabs.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
3
|
cloneElement,
|
|
4
|
-
FC,
|
|
4
|
+
type FC,
|
|
5
5
|
isValidElement,
|
|
6
6
|
memo,
|
|
7
|
-
ReactElement,
|
|
7
|
+
type ReactElement,
|
|
8
8
|
useCallback,
|
|
9
9
|
useEffect,
|
|
10
10
|
useMemo,
|
|
@@ -13,20 +13,21 @@ import {
|
|
|
13
13
|
} from 'react';
|
|
14
14
|
import {
|
|
15
15
|
Animated,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
type LayoutChangeEvent,
|
|
17
|
+
type NativeScrollEvent,
|
|
18
|
+
type NativeSyntheticEvent,
|
|
19
19
|
ScrollView as RNScrollView,
|
|
20
|
-
LayoutChangeEvent,
|
|
21
|
-
NativeSyntheticEvent,
|
|
22
|
-
NativeScrollEvent,
|
|
23
|
-
View,
|
|
24
20
|
ScrollView,
|
|
21
|
+
type StyleProp,
|
|
22
|
+
View,
|
|
23
|
+
type ViewProps,
|
|
24
|
+
type ViewStyle,
|
|
25
25
|
} from 'react-native';
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
import { useControlledValue } from '../../hooks';
|
|
28
28
|
import { noop } from '../../utils/lodash';
|
|
29
29
|
import { HorizontalDivider, type HorizontalDividerProps } from '../HorizontalDivider';
|
|
30
|
+
import type { TabItemProps } from './TabItem';
|
|
30
31
|
import { tabsStyles } from './utils';
|
|
31
32
|
|
|
32
33
|
export type TabsProps = ViewProps & {
|
|
@@ -100,7 +101,7 @@ export const TabBase = ({
|
|
|
100
101
|
const nameToIndexMap = useMemo(
|
|
101
102
|
() =>
|
|
102
103
|
validChildren.reduce((acc, child, currentIndex) => {
|
|
103
|
-
acc[(child as ReactElement).props?.name] = currentIndex;
|
|
104
|
+
acc[(child as ReactElement<TabItemProps>).props?.name] = currentIndex;
|
|
104
105
|
|
|
105
106
|
return acc;
|
|
106
107
|
}, {} as Record<string, number>),
|
|
@@ -110,7 +111,7 @@ export const TabBase = ({
|
|
|
110
111
|
const [value, onChange] = useControlledValue({
|
|
111
112
|
value: valueProp,
|
|
112
113
|
onChange: onChangeProp,
|
|
113
|
-
defaultValue: defaultValue || (validChildren[0] as ReactElement)?.props?.name,
|
|
114
|
+
defaultValue: defaultValue || (validChildren[0] as ReactElement<TabItemProps>)?.props?.name,
|
|
114
115
|
});
|
|
115
116
|
|
|
116
117
|
const valueIndex = nameToIndexMap[value];
|
|
@@ -311,7 +312,7 @@ export const TabBase = ({
|
|
|
311
312
|
style={itemsContainerStyle}>
|
|
312
313
|
{validChildren.map((child, index) => (
|
|
313
314
|
<ChildItem
|
|
314
|
-
key={(child as ReactElement).props?.name}
|
|
315
|
+
key={(child as ReactElement<TabItemProps>).props?.name}
|
|
315
316
|
testID={testID && `${testID}--tab-item`}
|
|
316
317
|
index={index}
|
|
317
318
|
value={value}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import type { TabItemProps } from './TabItem';
|
|
3
3
|
import { default as TabItem } from './TabItem';
|
|
4
4
|
import type { TabLabelProps } from './TabLabel';
|
|
@@ -11,10 +11,6 @@ export const TabsDefault = Object.assign(TabBase, {
|
|
|
11
11
|
Label: TabLabel,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
registerMoleculesComponents({
|
|
15
|
-
Tabs: TabsDefault,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
14
|
export const Tabs = getRegisteredComponentWithFallback('Tabs', TabsDefault);
|
|
19
15
|
|
|
20
16
|
export type { TabItemProps, TabLabelProps, TabsProps };
|
package/components/Tabs/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
const tabsStylesDefault = StyleSheet.create(theme => ({
|
|
6
6
|
root: {
|
|
@@ -113,14 +113,14 @@ const tabsLabelStylesDefault = StyleSheet.create(theme => ({
|
|
|
113
113
|
},
|
|
114
114
|
}));
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Tabs_Item
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
export const tabsStyles = getRegisteredComponentStylesWithFallback('Tabs', tabsStylesDefault);
|
|
117
|
+
export const tabsItemStyles = getRegisteredComponentStylesWithFallback(
|
|
118
|
+
'Tabs_Item',
|
|
119
|
+
tabsItemStylesDefault,
|
|
120
|
+
);
|
|
121
|
+
export const tabsLabelStyles = getRegisteredComponentStylesWithFallback(
|
|
122
|
+
'Tabs_Label',
|
|
123
|
+
tabsLabelStylesDefault,
|
|
124
|
+
);
|
|
125
125
|
|
|
126
126
|
export type States = 'hovered' | 'active' | 'activeAndHovered' | 'disabled';
|
package/components/Text/Text.tsx
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
getRegisteredComponentStylesWithFallback,
|
|
4
5
|
getRegisteredComponentWithFallback,
|
|
5
|
-
getRegisteredMoleculesComponentStyles,
|
|
6
|
-
registerComponentStyles,
|
|
7
|
-
registerMoleculesComponent,
|
|
8
6
|
} from '../../core';
|
|
9
7
|
import { textFactory } from './textFactory';
|
|
10
8
|
|
|
@@ -12,12 +10,8 @@ const defaultStyles = StyleSheet.create(theme => ({
|
|
|
12
10
|
root: { color: theme.colors.onSurface, ...theme.typescale.bodyMedium },
|
|
13
11
|
}));
|
|
14
12
|
|
|
15
|
-
registerComponentStyles('Text', defaultStyles);
|
|
16
|
-
|
|
17
13
|
const TextDefault = textFactory(
|
|
18
|
-
(
|
|
14
|
+
getRegisteredComponentStylesWithFallback('Text', defaultStyles) as any,
|
|
19
15
|
);
|
|
20
16
|
|
|
21
|
-
registerMoleculesComponent('Text', TextDefault);
|
|
22
|
-
|
|
23
17
|
export default getRegisteredComponentWithFallback('Text', TextDefault);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import TextInputDefault from './TextInput';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
TextInput: TextInputDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const TextInput = getRegisteredComponentWithFallback('TextInput', TextInputDefault);
|
|
9
5
|
|
|
10
6
|
export {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
registerComponentsStyles,
|
|
7
|
-
registerComponentUtils,
|
|
4
|
+
getRegisteredComponentStylesWithFallback,
|
|
5
|
+
getRegisteredComponentUtilsWithFallback,
|
|
8
6
|
} from '../../core';
|
|
9
7
|
|
|
10
8
|
export type States =
|
|
@@ -37,12 +35,11 @@ const getInputMinHeightDefault = (variant: string, size: string) => {
|
|
|
37
35
|
}
|
|
38
36
|
};
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
getRegisteredComponentUtils('TextInput').getInputMinHeight ?? getInputMinHeightDefault;
|
|
38
|
+
export const getInputMinHeight = getRegisteredComponentUtilsWithFallback(
|
|
39
|
+
'TextInput',
|
|
40
|
+
getInputMinHeightDefault,
|
|
41
|
+
'getInputMinHeight',
|
|
42
|
+
);
|
|
46
43
|
|
|
47
44
|
const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
48
45
|
root: {
|
|
@@ -530,11 +527,7 @@ const textInputStylesDefault = StyleSheet.create(theme => ({
|
|
|
530
527
|
},
|
|
531
528
|
}));
|
|
532
529
|
|
|
533
|
-
|
|
534
|
-
TextInput: textInputStylesDefault,
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
export const styles = getRegisteredMoleculesComponentStyles('TextInput');
|
|
530
|
+
export const styles = getRegisteredComponentStylesWithFallback('TextInput', textInputStylesDefault);
|
|
538
531
|
|
|
539
532
|
export const inputLabelStyles = StyleSheet.create({
|
|
540
533
|
labelContainer: {
|
|
@@ -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,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import TimePickerDefault from './TimePicker';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
TimePicker: TimePickerDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const TimePicker = getRegisteredComponentWithFallback('TimePicker', TimePickerDefault);
|
|
9
5
|
|
|
10
6
|
export type { Props as TimePickerProps } from './TimePicker';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
import { circleSize } from './timeUtils';
|
|
5
5
|
|
|
6
6
|
const timePickerStylesDefault = StyleSheet.create(theme => ({
|
|
@@ -263,23 +263,31 @@ const timePickerAmPmSwitcherStylesDefault = StyleSheet.create(theme => ({
|
|
|
263
263
|
},
|
|
264
264
|
}));
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
TimePicker
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
export const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
export const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
266
|
+
export const timePickerStyles = getRegisteredComponentStylesWithFallback(
|
|
267
|
+
'TimePicker',
|
|
268
|
+
timePickerStylesDefault,
|
|
269
|
+
);
|
|
270
|
+
export const timePickerInputsStyles = getRegisteredComponentStylesWithFallback(
|
|
271
|
+
'TimePicker_Inputs',
|
|
272
|
+
timePickerInputsStylesDefault,
|
|
273
|
+
);
|
|
274
|
+
export const timePickerInputStyles = getRegisteredComponentStylesWithFallback(
|
|
275
|
+
'TimePicker_Input',
|
|
276
|
+
timePickerInputStylesDefault,
|
|
277
|
+
);
|
|
278
|
+
export const timePickerClockStyles = getRegisteredComponentStylesWithFallback(
|
|
279
|
+
'TimePicker_Clock',
|
|
280
|
+
timePickerClockStylesDefault,
|
|
281
|
+
);
|
|
282
|
+
export const timePickerClockHoursStyles = getRegisteredComponentStylesWithFallback(
|
|
283
|
+
'TimePicker_ClockHours',
|
|
284
|
+
timePickerClockHoursStylesDefault,
|
|
285
|
+
);
|
|
286
|
+
export const timePickerClockMinutesStyles = getRegisteredComponentStylesWithFallback(
|
|
287
|
+
'TimePicker_ClockMinutes',
|
|
288
|
+
timePickerClockMinutesStylesDefault,
|
|
289
|
+
);
|
|
290
|
+
export const timePickerAmPmSwitcherStyles = getRegisteredComponentStylesWithFallback(
|
|
291
|
+
'TimePicker_AmPmSwitcher',
|
|
292
|
+
timePickerAmPmSwitcherStylesDefault,
|
|
293
|
+
);
|