react-native-molecules 0.5.0-beta.1 → 0.5.0-beta.3

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.
Files changed (123) hide show
  1. package/README.md +87 -0
  2. package/components/Accordion/index.tsx +1 -6
  3. package/components/Accordion/utils.ts +17 -14
  4. package/components/ActivityIndicator/ActivityIndicator.tsx +6 -5
  5. package/components/ActivityIndicator/index.tsx +1 -5
  6. package/components/Appbar/index.tsx +1 -4
  7. package/components/Appbar/utils.ts +33 -21
  8. package/components/Avatar/index.tsx +1 -5
  9. package/components/Avatar/utils.ts +2 -6
  10. package/components/Backdrop/Backdrop.tsx +2 -2
  11. package/components/Backdrop/index.tsx +1 -5
  12. package/components/Backdrop/utils.ts +5 -6
  13. package/components/Badge/index.tsx +1 -5
  14. package/components/Badge/utils.ts +2 -6
  15. package/components/Button/Button.tsx +5 -3
  16. package/components/Button/index.tsx +1 -5
  17. package/components/Button/utils.ts +5 -6
  18. package/components/Card/Card.tsx +8 -4
  19. package/components/Card/CardContent.tsx +5 -4
  20. package/components/Card/CardHeader.tsx +5 -3
  21. package/components/Card/CardMedia.tsx +5 -3
  22. package/components/Card/CardTypography.tsx +5 -3
  23. package/components/Card/index.tsx +1 -5
  24. package/components/Card/utils.ts +5 -6
  25. package/components/Checkbox/Checkbox.tsx +1 -0
  26. package/components/Checkbox/CheckboxBase.ios.tsx +1 -0
  27. package/components/Checkbox/CheckboxBase.tsx +1 -0
  28. package/components/Checkbox/index.tsx +1 -5
  29. package/components/Checkbox/utils.ts +6 -6
  30. package/components/Chip/index.tsx +1 -5
  31. package/components/Chip/utils.ts +2 -6
  32. package/components/DatePickerDocked/index.tsx +1 -5
  33. package/components/DatePickerDocked/utils.ts +21 -19
  34. package/components/DatePickerInline/index.tsx +1 -5
  35. package/components/DatePickerInline/utils.ts +41 -28
  36. package/components/DatePickerInput/index.tsx +1 -5
  37. package/components/DatePickerInput/utils.ts +5 -6
  38. package/components/DatePickerModal/index.tsx +1 -5
  39. package/components/DatePickerModal/utils.ts +17 -16
  40. package/components/DateTimePicker/index.tsx +1 -5
  41. package/components/DateTimePicker/utils.ts +5 -6
  42. package/components/Dialog/index.tsx +1 -5
  43. package/components/Dialog/utils.ts +22 -16
  44. package/components/Drawer/Collapsible/utils.ts +13 -13
  45. package/components/Drawer/Drawer.tsx +2 -3
  46. package/components/Drawer/DrawerContent.tsx +5 -3
  47. package/components/Drawer/DrawerFooter.tsx +5 -4
  48. package/components/Drawer/DrawerHeader.tsx +5 -4
  49. package/components/Drawer/DrawerItem.tsx +5 -3
  50. package/components/Drawer/DrawerItemGroup.tsx +5 -4
  51. package/components/Drawer/index.tsx +1 -5
  52. package/components/Drawer/utils.ts +7 -7
  53. package/components/ElementGroup/ElementGroup.tsx +16 -14
  54. package/components/ElementGroup/index.tsx +1 -5
  55. package/components/ElementGroup/utils.ts +5 -6
  56. package/components/FAB/index.tsx +1 -5
  57. package/components/FAB/utils.ts +2 -6
  58. package/components/FilePicker/index.tsx +1 -5
  59. package/components/FilePicker/utils.ts +5 -6
  60. package/components/HelperText/index.tsx +1 -5
  61. package/components/HelperText/utils.ts +5 -7
  62. package/components/HorizontalDivider/HorizontalDivider.tsx +5 -3
  63. package/components/HorizontalDivider/index.tsx +1 -5
  64. package/components/Icon/CrossFadeIcon.tsx +3 -5
  65. package/components/Icon/Icon.tsx +2 -4
  66. package/components/Icon/index.tsx +1 -5
  67. package/components/IconButton/IconButton.tsx +3 -1
  68. package/components/IconButton/index.tsx +1 -5
  69. package/components/IconButton/utils.ts +11 -16
  70. package/components/If/index.tsx +1 -5
  71. package/components/InputAddon/index.tsx +1 -5
  72. package/components/InputAddon/utils.ts +5 -6
  73. package/components/Link/index.tsx +1 -5
  74. package/components/Link/utils.ts +2 -6
  75. package/components/ListItem/index.tsx +1 -5
  76. package/components/ListItem/utils.ts +13 -11
  77. package/components/Menu/index.tsx +1 -5
  78. package/components/Menu/utils.ts +6 -8
  79. package/components/Modal/index.tsx +1 -5
  80. package/components/Modal/utils.ts +2 -6
  81. package/components/NavigationRail/NavigationRailHeader.tsx +1 -1
  82. package/components/NavigationRail/index.tsx +1 -5
  83. package/components/NavigationRail/utils.ts +21 -17
  84. package/components/NavigationStack/index.tsx +1 -5
  85. package/components/NavigationStack/utils.tsx +7 -1
  86. package/components/Portal/index.tsx +1 -5
  87. package/components/RadioButton/index.ts +1 -5
  88. package/components/RadioButton/utils.ts +9 -8
  89. package/components/Rating/index.tsx +1 -5
  90. package/components/Rating/utils.ts +6 -8
  91. package/components/StateLayer/index.tsx +1 -5
  92. package/components/StateLayer/utils.ts +5 -6
  93. package/components/Surface/Surface.android.tsx +3 -2
  94. package/components/Surface/Surface.ios.tsx +8 -6
  95. package/components/Surface/index.tsx +1 -5
  96. package/components/Surface/utils.ts +5 -30
  97. package/components/Switch/index.tsx +1 -5
  98. package/components/Switch/utils.ts +2 -6
  99. package/components/Tabs/index.tsx +1 -5
  100. package/components/Tabs/utils.ts +10 -10
  101. package/components/Text/Text.tsx +2 -8
  102. package/components/TextInput/TextInput.tsx +1 -0
  103. package/components/TextInput/index.tsx +1 -5
  104. package/components/TextInput/utils.ts +8 -15
  105. package/components/TextInputWithMask/index.tsx +1 -5
  106. package/components/TimePicker/AmPmSwitcher.tsx +1 -1
  107. package/components/TimePicker/index.tsx +1 -5
  108. package/components/TimePicker/utils.ts +29 -21
  109. package/components/TimePickerField/index.tsx +1 -5
  110. package/components/TimePickerField/utils.ts +5 -6
  111. package/components/TimePickerModal/index.tsx +1 -5
  112. package/components/TimePickerModal/utils.ts +5 -6
  113. package/components/Tooltip/index.tsx +1 -5
  114. package/components/Tooltip/utils.ts +5 -6
  115. package/components/TouchableRipple/index.tsx +1 -5
  116. package/components/TouchableRipple/utils.ts +5 -6
  117. package/components/VerticalDivider/VerticalDivider.tsx +9 -8
  118. package/components/VerticalDivider/index.tsx +1 -5
  119. package/core/componentsRegistry.ts +31 -19
  120. package/package.json +1 -3
  121. package/utils/extractPropertiesFromStyles.ts +25 -0
  122. package/utils/lodash.ts +0 -1
  123. package/utils/repository.ts +2 -52
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
2
 
3
- import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
156
- NavigationRail: navigationRailStylesDefault,
157
- NavigationRail_Header: navigationRailHeaderStylesDefault,
158
- NavigationRail_Content: navigationRailContentStylesDefault,
159
- NavigationRail_Footer: navigationRailFooterStylesDefault,
160
- NavigationRail_Item: navigationRailItemStylesDefault,
161
- });
162
-
163
- export const navigationRailStyles = getRegisteredMoleculesComponentStyles('NavigationRail');
164
- export const navigationRailHeaderStyles =
165
- getRegisteredMoleculesComponentStyles('NavigationRail_Header');
166
- export const navigationRailContentStyles =
167
- getRegisteredMoleculesComponentStyles('NavigationRail_Content');
168
- export const navigationRailFooterStyles =
169
- getRegisteredMoleculesComponentStyles('NavigationRail_Footer');
170
- export const navigationRailItemStyles = navigationRailItemStylesDefault;
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, registerMoleculesComponents } from '../../core';
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 navigationStackItemStyles = StyleSheet.create({
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, registerMoleculesComponents } from '../../core';
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, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import RadioButtonComponent from './RadioButton';
3
3
  import RadioButtonGroup from './RadioButtonGroup';
4
4
  import RadioButtonItem from './RadioButtonItem';
@@ -14,10 +14,6 @@ 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
19
  export type { Props as RadioButtonProps } from './RadioButton';
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
2
 
3
- import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
125
- RadioButton: radioButtonStylesDefault,
126
- RadioButton_Item: radioButtonItemStylesDefault,
127
- });
128
-
129
- export const radioButtonStyles = getRegisteredMoleculesComponentStyles('RadioButton');
130
- export const radioButtonItemStyles = getRegisteredMoleculesComponentStyles('RadioButton_Item');
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,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
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 { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
33
- Rating: ratingStylesDefault,
34
- Rating_Item: ratingItemStylesDefault,
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, registerMoleculesComponents } from '../../core';
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 { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
14
- StateLayer: stateLayerStylesDefault,
15
- });
16
-
17
- export const stateLayerStyles = getRegisteredMoleculesComponentStyles('StateLayer');
13
+ export const stateLayerStyles = getRegisteredComponentStylesWithFallback(
14
+ 'StateLayer',
15
+ stateLayerStylesDefault,
16
+ );
@@ -4,8 +4,9 @@ import { useUnistyles } from 'react-native-unistyles';
4
4
 
5
5
  import { inputRange } from '../../styles/shadow';
6
6
  import type { MD3Elevation } from '../../types/theme';
7
+ import { extractPropertiesFromStyles } from '../../utils/extractPropertiesFromStyles';
7
8
  import { BackgroundContextWrapper } from './BackgroundContextWrapper';
8
- import { defaultStyles, extractProperties, getElevationAndroid } from './utils';
9
+ import { defaultStyles, getElevationAndroid } from './utils';
9
10
 
10
11
  export type Props = ViewProps & {
11
12
  /**
@@ -43,7 +44,7 @@ const Surface = ({ elevation = 1, style, children, testID, ...props }: Props, re
43
44
  elevation: getElevationAndroid(elevation, inputRange, elevationLevel),
44
45
  },
45
46
  ] as StyleProp<ViewStyle>,
46
- surfaceBackground: extractProperties(
47
+ surfaceBackground: extractPropertiesFromStyles(
47
48
  [defaultStyles.root as ViewStyle, style],
48
49
  ['backgroundColor'],
49
50
  ).backgroundColor,
@@ -3,8 +3,9 @@ import { Animated, type StyleProp, View, type ViewStyle } from 'react-native';
3
3
  import { useUnistyles } from 'react-native-unistyles';
4
4
 
5
5
  import type { MD3Elevation } from '../../types/theme';
6
+ import { extractPropertiesFromStyles } from '../../utils/extractPropertiesFromStyles';
6
7
  import { BackgroundContextWrapper } from './BackgroundContextWrapper';
7
- import { defaultStyles, extractProperties, getStyleForShadowLayer } from './utils';
8
+ import { defaultStyles, getStyleForShadowLayer } from './utils';
8
9
 
9
10
  export type Props = ComponentPropsWithRef<typeof View> & {
10
11
  /**
@@ -78,14 +79,15 @@ const Surface = ({ elevation = 1, style, children, testID, ...props }: Props, re
78
79
  })();
79
80
 
80
81
  const { surfaceBackground, sharedStyle, layer0Style, layer1Style } = useMemo(() => {
81
- const { position, alignSelf, top, left, right, bottom, borderRadius } = extractProperties(
82
- [defaultStyles.root as ViewStyle, style],
83
- ['position', 'alignSelf', 'top', 'left', 'right', 'bottom', 'borderRadius'],
84
- );
82
+ const { position, alignSelf, top, left, right, bottom, borderRadius } =
83
+ extractPropertiesFromStyles(
84
+ [defaultStyles.root as ViewStyle, style],
85
+ ['position', 'alignSelf', 'top', 'left', 'right', 'bottom', 'borderRadius'],
86
+ );
85
87
  const absoluteStyle = { position, alignSelf, top, right, bottom, left };
86
88
 
87
89
  return {
88
- surfaceBackground: extractProperties(
90
+ surfaceBackground: extractPropertiesFromStyles(
89
91
  [defaultStyles.root as ViewStyle, style],
90
92
  ['backgroundColor'],
91
93
  ).backgroundColor,
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
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 { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
4
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
5
5
  import { inputRange } from '../../styles/shadow';
6
6
 
7
7
  const defaultStylesDefault = StyleSheet.create(theme => ({
@@ -10,35 +10,10 @@ const defaultStylesDefault = StyleSheet.create(theme => ({
10
10
  },
11
11
  }));
12
12
 
13
- registerComponentsStyles({
14
- Surface: defaultStylesDefault,
15
- });
16
-
17
- export const defaultStyles = getRegisteredMoleculesComponentStyles('Surface');
18
-
19
- // TODO - abstract this
20
- export function extractProperties(
21
- _objectsArray: Record<string, any>,
22
- propertiesToExtract: string[],
23
- ) {
24
- const extracted: Record<string, any> = {};
25
-
26
- const objectsArray = _objectsArray.flat();
27
-
28
- for (let i = objectsArray.length - 1; i >= 0; i--) {
29
- const obj = objectsArray[i];
30
-
31
- for (const prop of propertiesToExtract) {
32
- if (!obj) continue;
33
- if (prop in obj) {
34
- // @ts-ignore
35
- extracted[prop] = obj[prop];
36
- }
37
- }
38
- }
39
-
40
- return extracted;
41
- }
13
+ export const defaultStyles = getRegisteredComponentStylesWithFallback(
14
+ 'Surface',
15
+ defaultStylesDefault,
16
+ );
42
17
 
43
18
  const _shadowColor = '#000';
44
19
 
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
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 { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
280
- Switch: switchStylesDefault,
281
- });
282
-
283
- export const switchStyles = getRegisteredMoleculesComponentStyles('Switch');
279
+ export const switchStyles = getRegisteredComponentStylesWithFallback('Switch', switchStylesDefault);
@@ -1,4 +1,4 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
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 };
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
2
 
3
- import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
117
- Tabs: tabsStylesDefault,
118
- Tabs_Item: tabsItemStylesDefault,
119
- Tabs_Label: tabsLabelStylesDefault,
120
- });
121
-
122
- export const tabsStyles = getRegisteredMoleculesComponentStyles('Tabs');
123
- export const tabsItemStyles = getRegisteredMoleculesComponentStyles('Tabs_Item');
124
- export const tabsLabelStyles = getRegisteredMoleculesComponentStyles('Tabs_Label');
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';
@@ -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
- (getRegisteredMoleculesComponentStyles('Text') as any) ?? defaultStyles,
14
+ getRegisteredComponentStylesWithFallback('Text', defaultStyles) as any,
19
15
  );
20
16
 
21
- registerMoleculesComponent('Text', TextDefault);
22
-
23
17
  export default getRegisteredComponentWithFallback('Text', TextDefault);
@@ -432,6 +432,7 @@ const TextInput = forwardRef<TextInputHandles, Props>(
432
432
  };
433
433
  }, [onBlurRef]);
434
434
 
435
+ // @ts-ignore // TODO - fix this
435
436
  const componentStyles = styles.root;
436
437
 
437
438
  const labelWidth = labelLayout.width;
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
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
- getRegisteredComponentUtils,
5
- getRegisteredMoleculesComponentStyles,
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
- registerComponentUtils('TextInput', {
41
- getInputMinHeight: getInputMinHeightDefault,
42
- });
43
-
44
- export const getInputMinHeight =
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
- registerComponentsStyles({
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, registerMoleculesComponents } from '../../core';
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,
@@ -71,7 +71,7 @@ function SwitchButton({
71
71
  disabled: boolean;
72
72
  }) {
73
73
  timePickerAmPmSwitcherStyles.useVariants({
74
- // TODO - fix ts issues
74
+ // @ts-ignore // TODO - fix this
75
75
  state: resolveStateVariant({
76
76
  selected,
77
77
  }),
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
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 { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
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
- registerComponentsStyles({
267
- TimePicker: timePickerStylesDefault,
268
- TimePicker_Inputs: timePickerInputsStylesDefault,
269
- TimePicker_Input: timePickerInputStylesDefault,
270
- TimePicker_Clock: timePickerClockStylesDefault,
271
- TimePicker_ClockHours: timePickerClockHoursStylesDefault,
272
- TimePicker_ClockMinutes: timePickerClockMinutesStylesDefault,
273
- TimePicker_AmPmSwitcher: timePickerAmPmSwitcherStylesDefault,
274
- });
275
-
276
- export const timePickerStyles = getRegisteredMoleculesComponentStyles('TimePicker');
277
- export const timePickerInputsStyles = getRegisteredMoleculesComponentStyles('TimePicker_Inputs');
278
- export const timePickerInputStyles = getRegisteredMoleculesComponentStyles('TimePicker_Input');
279
- export const timePickerClockStyles = getRegisteredMoleculesComponentStyles('TimePicker_Clock');
280
- export const timePickerClockHoursStyles =
281
- getRegisteredMoleculesComponentStyles('TimePicker_ClockHours');
282
- export const timePickerClockMinutesStyles =
283
- getRegisteredMoleculesComponentStyles('TimePicker_ClockMinutes');
284
- export const timePickerAmPmSwitcherStyles =
285
- getRegisteredMoleculesComponentStyles('TimePicker_AmPmSwitcher');
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
+ );
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import TimePickerFieldDefault from './TimePickerField';
3
3
 
4
- registerMoleculesComponents({
5
- TimePickerField: TimePickerFieldDefault,
6
- });
7
-
8
4
  export const TimePickerField = getRegisteredComponentWithFallback(
9
5
  'TimePickerField',
10
6
  TimePickerFieldDefault,
@@ -5,17 +5,16 @@ export declare type MaskItem = string | RegExp | [RegExp];
5
5
  export declare type MaskArray = Array<MaskItem>;
6
6
  export declare type Mask = MaskArray | ((value?: string) => MaskArray);
7
7
 
8
- import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
8
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
9
9
 
10
10
  const timepickerFieldStylesDefault = StyleSheet.create({
11
11
  root: {},
12
12
  });
13
13
 
14
- registerComponentsStyles({
15
- TimePickerField: timepickerFieldStylesDefault,
16
- });
17
-
18
- export const styles = getRegisteredMoleculesComponentStyles('TimePickerField');
14
+ export const styles = getRegisteredComponentStylesWithFallback(
15
+ 'TimePickerField',
16
+ timepickerFieldStylesDefault,
17
+ );
19
18
 
20
19
  export const timeMask24Hour: Mask = (text: string = '') => {
21
20
  const cleanTime = text.replace(/\D+/g, '');