react-native-molecules 0.5.0-beta.0 → 0.5.0-beta.10

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 (164) hide show
  1. package/README.md +87 -0
  2. package/components/Accordion/AccordionItem.tsx +3 -2
  3. package/components/Accordion/AccordionItemContent.tsx +1 -0
  4. package/components/Accordion/AccordionItemHeader.tsx +6 -5
  5. package/components/Accordion/index.tsx +8 -14
  6. package/components/Accordion/utils.ts +17 -14
  7. package/components/ActivityIndicator/ActivityIndicator.tsx +12 -20
  8. package/components/ActivityIndicator/index.tsx +1 -5
  9. package/components/Appbar/index.tsx +1 -4
  10. package/components/Appbar/utils.ts +33 -21
  11. package/components/Avatar/index.tsx +1 -5
  12. package/components/Avatar/utils.ts +2 -6
  13. package/components/Backdrop/Backdrop.tsx +2 -2
  14. package/components/Backdrop/index.tsx +1 -5
  15. package/components/Backdrop/utils.ts +5 -6
  16. package/components/Badge/index.tsx +1 -5
  17. package/components/Badge/utils.ts +2 -6
  18. package/components/Button/Button.tsx +211 -264
  19. package/components/Button/index.tsx +9 -7
  20. package/components/Button/types.ts +16 -2
  21. package/components/Button/utils.ts +231 -212
  22. package/components/Card/Card.tsx +8 -4
  23. package/components/Card/CardContent.tsx +5 -4
  24. package/components/Card/CardHeader.tsx +5 -3
  25. package/components/Card/CardMedia.tsx +5 -3
  26. package/components/Card/CardTypography.tsx +5 -3
  27. package/components/Card/index.tsx +1 -5
  28. package/components/Card/utils.ts +5 -6
  29. package/components/Checkbox/Checkbox.tsx +1 -0
  30. package/components/Checkbox/CheckboxBase.ios.tsx +1 -0
  31. package/components/Checkbox/CheckboxBase.tsx +1 -0
  32. package/components/Checkbox/index.tsx +1 -5
  33. package/components/Checkbox/utils.ts +6 -6
  34. package/components/Chip/Chip.tsx +40 -52
  35. package/components/Chip/index.tsx +1 -5
  36. package/components/Chip/utils.ts +5 -13
  37. package/components/DatePickerDocked/index.tsx +1 -5
  38. package/components/DatePickerDocked/utils.ts +21 -19
  39. package/components/DatePickerInline/index.tsx +1 -5
  40. package/components/DatePickerInline/utils.ts +41 -28
  41. package/components/DatePickerInput/index.tsx +2 -6
  42. package/components/DatePickerInput/utils.ts +5 -6
  43. package/components/DatePickerModal/DatePickerModalHeader.tsx +1 -1
  44. package/components/DatePickerModal/index.tsx +1 -5
  45. package/components/DatePickerModal/utils.ts +17 -16
  46. package/components/DateTimePicker/index.tsx +1 -5
  47. package/components/DateTimePicker/utils.ts +5 -6
  48. package/components/Dialog/index.tsx +1 -5
  49. package/components/Dialog/utils.ts +22 -16
  50. package/components/Drawer/Collapsible/utils.ts +13 -13
  51. package/components/Drawer/Drawer.tsx +2 -3
  52. package/components/Drawer/DrawerContent.tsx +5 -3
  53. package/components/Drawer/DrawerFooter.tsx +5 -4
  54. package/components/Drawer/DrawerHeader.tsx +5 -4
  55. package/components/Drawer/DrawerItem.tsx +5 -3
  56. package/components/Drawer/DrawerItemGroup.tsx +5 -4
  57. package/components/Drawer/index.tsx +1 -5
  58. package/components/Drawer/utils.ts +7 -7
  59. package/components/ElementGroup/ElementGroup.tsx +16 -14
  60. package/components/ElementGroup/index.tsx +1 -5
  61. package/components/ElementGroup/utils.ts +5 -6
  62. package/components/FAB/index.tsx +1 -5
  63. package/components/FAB/utils.ts +3 -7
  64. package/components/FilePicker/index.tsx +1 -5
  65. package/components/FilePicker/utils.ts +5 -6
  66. package/components/HelperText/index.tsx +1 -5
  67. package/components/HelperText/utils.ts +5 -7
  68. package/components/HorizontalDivider/HorizontalDivider.tsx +5 -3
  69. package/components/HorizontalDivider/index.tsx +1 -5
  70. package/components/Icon/CrossFadeIcon.tsx +3 -5
  71. package/components/Icon/Icon.tsx +3 -14
  72. package/components/Icon/iconFactory.tsx +3 -3
  73. package/components/Icon/index.tsx +2 -6
  74. package/components/Icon/types.ts +17 -6
  75. package/components/IconButton/IconButton.tsx +45 -58
  76. package/components/IconButton/index.tsx +1 -5
  77. package/components/IconButton/utils.ts +15 -26
  78. package/components/If/index.tsx +1 -5
  79. package/components/InputAddon/index.tsx +1 -5
  80. package/components/InputAddon/utils.ts +5 -6
  81. package/components/Link/index.tsx +1 -5
  82. package/components/Link/utils.ts +7 -9
  83. package/components/ListItem/index.tsx +1 -5
  84. package/components/ListItem/utils.ts +13 -11
  85. package/components/LoadingIndicator/LoadingIndicator.tsx +253 -0
  86. package/components/LoadingIndicator/LoadingIndicator.web.tsx +136 -0
  87. package/components/LoadingIndicator/index.tsx +13 -0
  88. package/components/LoadingIndicator/utils.ts +117 -0
  89. package/components/Menu/index.tsx +1 -5
  90. package/components/Menu/utils.ts +6 -8
  91. package/components/Modal/index.tsx +1 -5
  92. package/components/Modal/utils.ts +2 -6
  93. package/components/NavigationRail/NavigationRailHeader.tsx +1 -1
  94. package/components/NavigationRail/NavigationRailItem.tsx +2 -1
  95. package/components/NavigationRail/index.tsx +1 -5
  96. package/components/NavigationRail/utils.ts +21 -17
  97. package/components/NavigationStack/index.tsx +1 -5
  98. package/components/NavigationStack/utils.tsx +7 -1
  99. package/components/Portal/index.tsx +1 -5
  100. package/components/RadioButton/index.ts +5 -10
  101. package/components/RadioButton/utils.ts +9 -8
  102. package/components/Rating/RatingItem.tsx +2 -1
  103. package/components/Rating/index.tsx +1 -5
  104. package/components/Rating/utils.ts +6 -8
  105. package/components/Select/Select.tsx +360 -501
  106. package/components/Select/index.ts +7 -14
  107. package/components/Select/types.ts +2 -4
  108. package/components/Select/utils.ts +215 -0
  109. package/components/Slot/Slot.tsx +244 -0
  110. package/components/Slot/compose-refs.tsx +60 -0
  111. package/components/Slot/index.tsx +8 -0
  112. package/components/StateLayer/index.tsx +1 -5
  113. package/components/StateLayer/utils.ts +5 -6
  114. package/components/Surface/Surface.android.tsx +34 -8
  115. package/components/Surface/Surface.ios.tsx +36 -29
  116. package/components/Surface/Surface.tsx +31 -4
  117. package/components/Surface/index.tsx +1 -5
  118. package/components/Surface/utils.ts +49 -36
  119. package/components/Switch/Switch.tsx +8 -2
  120. package/components/Switch/index.tsx +1 -5
  121. package/components/Switch/utils.ts +2 -6
  122. package/components/Tabs/Tabs.tsx +14 -13
  123. package/components/Tabs/index.tsx +1 -5
  124. package/components/Tabs/utils.ts +10 -10
  125. package/components/Text/Text.tsx +2 -8
  126. package/components/TextInput/TextInput.tsx +5 -4
  127. package/components/TextInput/index.tsx +1 -5
  128. package/components/TextInput/utils.ts +8 -15
  129. package/components/TextInputWithMask/index.tsx +1 -5
  130. package/components/TimePicker/AmPmSwitcher.tsx +1 -1
  131. package/components/TimePicker/index.tsx +1 -5
  132. package/components/TimePicker/utils.ts +29 -21
  133. package/components/TimePickerField/index.tsx +1 -5
  134. package/components/TimePickerField/utils.ts +5 -6
  135. package/components/TimePickerModal/TimePickerModal.tsx +6 -2
  136. package/components/TimePickerModal/index.tsx +1 -5
  137. package/components/TimePickerModal/utils.ts +5 -6
  138. package/components/Tooltip/TooltipTrigger.tsx +25 -16
  139. package/components/Tooltip/index.tsx +5 -9
  140. package/components/Tooltip/utils.ts +5 -6
  141. package/components/TouchableRipple/TouchableRipple.native.tsx +49 -13
  142. package/components/TouchableRipple/TouchableRipple.tsx +136 -46
  143. package/components/TouchableRipple/index.tsx +1 -5
  144. package/components/TouchableRipple/utils.ts +5 -6
  145. package/components/VerticalDivider/VerticalDivider.tsx +9 -8
  146. package/components/VerticalDivider/index.tsx +1 -5
  147. package/core/componentsRegistry.ts +31 -19
  148. package/hocs/withPortal.tsx +1 -1
  149. package/hooks/index.tsx +0 -1
  150. package/hooks/useControlledValue.tsx +20 -4
  151. package/hooks/useSubcomponents.tsx +56 -22
  152. package/hooks/useWhatHasUpdated.tsx +48 -0
  153. package/package.json +10 -13
  154. package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +5 -2
  155. package/shortcuts-manager/ShortcutsManager/utils.tsx +3 -2
  156. package/shortcuts-manager/useShortcut/index.tsx +1 -1
  157. package/shortcuts-manager/useShortcut/useShortcut.tsx +1 -1
  158. package/styles/shadow.ts +2 -1
  159. package/styles/themes/LightTheme.tsx +1 -1
  160. package/utils/extractPropertiesFromStyles.ts +25 -0
  161. package/utils/lodash.ts +77 -6
  162. package/utils/repository.ts +2 -52
  163. package/utils/tokenStylesParser.ts +3 -1
  164. package/hooks/useBreakpoints.tsx +0 -7
@@ -33,6 +33,7 @@ const CheckboxIOS = (
33
33
 
34
34
  styles.useVariants({
35
35
  variant: 'ios',
36
+ // @ts-ignore // TODO - fix this
36
37
  state: state as States,
37
38
  size,
38
39
  });
@@ -58,6 +58,7 @@ const CheckboxAndroid = (
58
58
 
59
59
  styles.useVariants({
60
60
  variant: 'android',
61
+ // @ts-ignore // TODO - fix this
61
62
  state: state as States,
62
63
  size,
63
64
  });
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import CheckboxComponent from './Checkbox';
3
3
 
4
- registerMoleculesComponents({
5
- Checkbox: CheckboxComponent,
6
- });
7
-
8
4
  export const Checkbox = getRegisteredComponentWithFallback('Checkbox', CheckboxComponent);
9
5
 
10
6
  export type { Props as CheckboxProps } from './Checkbox';
@@ -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 PADDING = 6;
6
6
 
@@ -13,6 +13,10 @@ export const iconSizeMap = {
13
13
  const checkboxStylesDefault = StyleSheet.create(theme => ({
14
14
  root: {
15
15
  variants: {
16
+ variant: {
17
+ android: {},
18
+ ios: {},
19
+ },
16
20
  size: {
17
21
  sm: {
18
22
  padding: PADDING,
@@ -203,8 +207,4 @@ const checkboxStylesDefault = StyleSheet.create(theme => ({
203
207
  // },
204
208
  }));
205
209
 
206
- registerComponentsStyles({
207
- Checkbox: checkboxStylesDefault,
208
- });
209
-
210
- export const styles = getRegisteredMoleculesComponentStyles('Checkbox') ?? checkboxStylesDefault;
210
+ export const styles = getRegisteredComponentStylesWithFallback('Checkbox', checkboxStylesDefault);
@@ -97,10 +97,6 @@ export type Props = Omit<TouchableRippleProps, 'children'> &
97
97
  * Whether to show the ActivityIndicator or not
98
98
  */
99
99
  loading?: boolean;
100
- /**
101
- * container style
102
- */
103
- containerStyle?: ViewStyle;
104
100
  /**
105
101
  * left element container style
106
102
  */
@@ -132,7 +128,6 @@ export type Props = Omit<TouchableRippleProps, 'children'> &
132
128
  const Chip = (
133
129
  {
134
130
  style,
135
- containerStyle: containerStyleProp,
136
131
  label: _label,
137
132
  labelCharacterLimit = 20,
138
133
  variant = 'outlined',
@@ -158,11 +153,13 @@ const Chip = (
158
153
  leftElementIconProps,
159
154
  invertLabelColor,
160
155
  backgroundColor,
156
+ onPress,
161
157
  ...rest
162
158
  }: Props,
163
159
  ref: any,
164
160
  ) => {
165
161
  const { hovered, actionsRef } = useActionState({ ref, actionsToListen: ['hover'] });
162
+ const Wrapper = onPress ? TouchableRipple : View;
166
163
 
167
164
  const state = resolveStateVariant({
168
165
  disabled: !!disabled,
@@ -192,47 +189,39 @@ const Chip = (
192
189
  // selectedColorProp ? { selectedColor: selectedColorProp } : {},
193
190
  // ]);
194
191
 
195
- const {
196
- containerStyle,
197
- touchableRippleStyle,
198
- leftElementStyle,
199
- rightElementStyle,
200
- labelStyle,
201
- stateLayerStyle,
202
- } = useMemo(() => {
203
- return {
204
- containerStyle: [
205
- styles.container,
206
- selected && selectionBackgroundColor
207
- ? { backgroundColor: selectionBackgroundColor }
208
- : {},
209
- containerStyleProp,
210
- ],
211
- touchableRippleStyle: [styles.touchableRippleContainer, style],
212
- leftElementStyle: [styles.leftElement, leftElementContainerStyle],
213
- rightElementStyle: [styles.rightElement, rightElementContainerStyle],
214
- labelStyle: [
215
- styles.label,
216
- selected && selectedColor ? { color: selectedColor } : {},
217
- labelStyleProp,
218
- ],
219
- stateLayerStyle: [styles.stateLayer, stateLayerProps?.style],
220
- };
221
- // eslint-disable-next-line react-hooks/exhaustive-deps
222
- }, [
223
- leftElementContainerStyle,
224
- rightElementContainerStyle,
225
- selected,
226
- selectedColor,
227
- selectionBackgroundColor,
228
- stateLayerProps?.style,
229
- style,
230
- containerStyleProp,
231
- labelStyleProp,
232
- state,
233
- size,
234
- variant,
235
- ]);
192
+ const { containerStyle, leftElementStyle, rightElementStyle, labelStyle, stateLayerStyle } =
193
+ useMemo(() => {
194
+ return {
195
+ containerStyle: [
196
+ styles.container,
197
+ selected && selectionBackgroundColor
198
+ ? { backgroundColor: selectionBackgroundColor }
199
+ : {},
200
+ style,
201
+ ],
202
+ leftElementStyle: [styles.leftElement, leftElementContainerStyle],
203
+ rightElementStyle: [styles.rightElement, rightElementContainerStyle],
204
+ labelStyle: [
205
+ styles.label,
206
+ selected && selectedColor ? { color: selectedColor } : {},
207
+ labelStyleProp,
208
+ ],
209
+ stateLayerStyle: [styles.stateLayer, stateLayerProps?.style],
210
+ };
211
+ // eslint-disable-next-line react-hooks/exhaustive-deps
212
+ }, [
213
+ leftElementContainerStyle,
214
+ rightElementContainerStyle,
215
+ selected,
216
+ selectedColor,
217
+ selectionBackgroundColor,
218
+ stateLayerProps?.style,
219
+ style,
220
+ labelStyleProp,
221
+ state,
222
+ size,
223
+ variant,
224
+ ]);
236
225
 
237
226
  const { accessibilityState, elevation } = useMemo(
238
227
  () => ({
@@ -251,14 +240,13 @@ const Chip = (
251
240
  {...containerProps}
252
241
  elevation={elevation}
253
242
  style={containerStyle}
254
- backgroundColor={backgroundColor}>
255
- <TouchableRipple
243
+ backgroundColor={backgroundColor}
244
+ asChild>
245
+ <Wrapper
256
246
  borderless
257
247
  {...rest}
258
248
  disabled={disabled}
259
- style={touchableRippleStyle}
260
249
  accessibilityLabel={accessibilityLabel}
261
- accessibilityRole="button"
262
250
  accessibilityState={accessibilityState}
263
251
  ref={actionsRef}
264
252
  testID={testID}>
@@ -297,7 +285,7 @@ const Chip = (
297
285
  style={stateLayerStyle}
298
286
  />
299
287
  </>
300
- </TouchableRipple>
288
+ </Wrapper>
301
289
  </Surface>
302
290
  );
303
291
  };
@@ -362,7 +350,7 @@ const RightElement = memo(
362
350
  {onClose ? (
363
351
  <IconButtonWithContrastColor
364
352
  name="close"
365
- size={18}
353
+ size={14}
366
354
  accessibilityLabel="Close"
367
355
  disabled={disabled}
368
356
  onPress={onClose}
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType } from 'react';
2
2
 
3
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
3
+ import { getRegisteredComponentWithFallback } from '../../core';
4
4
  import { default as ChipComponent, type Props as ChipProps } from './Chip';
5
5
 
6
6
  export const ChipDefault = Object.assign(
@@ -40,10 +40,6 @@ export const ChipDefault = Object.assign(
40
40
  },
41
41
  );
42
42
 
43
- registerMoleculesComponents({
44
- Chip: ChipDefault,
45
- });
46
-
47
43
  export const Chip = getRegisteredComponentWithFallback('Chip', ChipDefault);
48
44
 
49
45
  export type { Props as ChipProps } from './Chip';
@@ -1,11 +1,14 @@
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 chipStylesDefault = StyleSheet.create(theme => ({
6
6
  container: {
7
7
  borderRadius: theme.shapes.corner.small,
8
8
  backgroundColor: theme.colors.surface,
9
+ paddingHorizontal: theme.spacings['2'],
10
+ flexDirection: 'row',
11
+ alignItems: 'center',
9
12
 
10
13
  variants: {
11
14
  variant: {
@@ -47,13 +50,6 @@ const chipStylesDefault = StyleSheet.create(theme => ({
47
50
  },
48
51
  },
49
52
  },
50
- touchableRippleContainer: {
51
- flex: 1,
52
- paddingHorizontal: theme.spacings['2'],
53
- borderRadius: theme.shapes.corner.small,
54
- flexDirection: 'row',
55
- alignItems: 'center',
56
- },
57
53
  label: {
58
54
  display: 'flex',
59
55
  color: theme.colors.onSurfaceVariant,
@@ -91,10 +87,6 @@ const chipStylesDefault = StyleSheet.create(theme => ({
91
87
  },
92
88
  }));
93
89
 
94
- registerComponentsStyles({
95
- Chip: chipStylesDefault,
96
- });
97
-
98
- export const styles = getRegisteredMoleculesComponentStyles('Chip');
90
+ export const styles = getRegisteredComponentStylesWithFallback('Chip', chipStylesDefault);
99
91
 
100
92
  export type States = 'hovered' | 'selectedAndHovered' | 'selected' | 'disabled';
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import DatePickerDockedDefault from './DatePickerDocked';
3
3
 
4
- registerMoleculesComponents({
5
- DatePickerDocked: DatePickerDockedDefault,
6
- });
7
-
8
4
  export const DatePickerDocked = getRegisteredComponentWithFallback(
9
5
  'DatePickerDocked',
10
6
  DatePickerDockedDefault,
@@ -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 datePickerDockedStylesDefault = StyleSheet.create(theme => ({
6
6
  root: {
@@ -131,25 +131,27 @@ const datePickerDockedMonthStylesDefault = StyleSheet.create(theme => ({
131
131
  },
132
132
  }));
133
133
 
134
- registerComponentsStyles({
135
- DatePickerDocked: datePickerDockedStylesDefault,
136
- DatePickerDocked_Header: datePickerDockedHeaderStylesDefault,
137
- DatePicker_HeaderItem: datePickerHeaderItemStylesDefault,
138
- DatePickerDocked_MonthPicker: datePickerMonthPickerStylesDefault,
139
- DatePickerDocked_MonthItem: datePickerDockedMonthItemStylesDefault,
140
- DatePickerDocked_Month: datePickerDockedMonthStylesDefault,
141
- });
142
-
143
- export const datePickerDockedStyles = getRegisteredMoleculesComponentStyles('DatePickerDocked');
144
- export const datePickerDockedHeaderStyles =
145
- getRegisteredMoleculesComponentStyles('DatePickerDocked_Header');
146
- export const datePickerHeaderItemStyles =
147
- getRegisteredMoleculesComponentStyles('DatePicker_HeaderItem');
148
- export const datePickerMonthPickerStyles = getRegisteredMoleculesComponentStyles(
134
+ export const datePickerDockedStyles = getRegisteredComponentStylesWithFallback(
135
+ 'DatePickerDocked',
136
+ datePickerDockedStylesDefault,
137
+ );
138
+ export const datePickerDockedHeaderStyles = getRegisteredComponentStylesWithFallback(
139
+ 'DatePickerDocked_Header',
140
+ datePickerDockedHeaderStylesDefault,
141
+ );
142
+ export const datePickerHeaderItemStyles = getRegisteredComponentStylesWithFallback(
143
+ 'DatePicker_HeaderItem',
144
+ datePickerHeaderItemStylesDefault,
145
+ );
146
+ export const datePickerMonthPickerStyles = getRegisteredComponentStylesWithFallback(
149
147
  'DatePickerDocked_MonthPicker',
148
+ datePickerMonthPickerStylesDefault,
150
149
  );
151
- export const datePickerDockedMonthItemStyles = getRegisteredMoleculesComponentStyles(
150
+ export const datePickerDockedMonthItemStyles = getRegisteredComponentStylesWithFallback(
152
151
  'DatePickerDocked_MonthItem',
152
+ datePickerDockedMonthItemStylesDefault,
153
+ );
154
+ export const datePickerDockedMonthStyles = getRegisteredComponentStylesWithFallback(
155
+ 'DatePickerDocked_Month',
156
+ datePickerDockedMonthStylesDefault,
153
157
  );
154
- export const datePickerDockedMonthStyles =
155
- getRegisteredMoleculesComponentStyles('DatePickerDocked_Month');
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import DatePickerInlineDefault from './DatePickerInline';
3
3
 
4
- registerMoleculesComponents({
5
- DatePickerInline: DatePickerInlineDefault,
6
- });
7
-
8
4
  export const DatePickerInline = getRegisteredComponentWithFallback(
9
5
  'DatePickerInline',
10
6
  DatePickerInlineDefault,
@@ -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 { daySize } from './dateUtils';
5
5
 
6
6
  export const dayNamesHeight = 44;
@@ -338,30 +338,43 @@ const datePickerYearItemStylesDefault = StyleSheet.create(theme => ({
338
338
  },
339
339
  }));
340
340
 
341
- registerComponentsStyles({
342
- DatePickerInline: datePickerStylesDefault,
343
- DatePicker_Month: datePickerMonthStylesDefault,
344
- DatePicker_YearPicker: datePickerYearPickerStylesDefault,
345
- DatePicker_Day: datePickerDayStylesDefault,
346
- DatePicker_DayEmpty: datePickerDayEmptyStylesDefault,
347
- DatePicker_Week: datePickerWeekStylesDefault,
348
- DatePicker_Header: datePickerHeaderStylesDefault,
349
- DatePicker_DayName: dateDayNameStylesDefault,
350
- DatePicker_DayRange: datePickerDayRangeStylesDefault,
351
- DatePicker_YearItem: datePickerYearItemStylesDefault,
352
- });
353
-
354
- export const datePickerStyles = getRegisteredMoleculesComponentStyles('DatePickerInline');
355
- export const datePickerMonthStyles = getRegisteredMoleculesComponentStyles('DatePicker_Month');
356
- export const datePickerYearPickerStyles =
357
- getRegisteredMoleculesComponentStyles('DatePicker_YearPicker');
358
- export const datePickerDayStyles = getRegisteredMoleculesComponentStyles('DatePicker_Day');
359
- export const datePickerDayEmptyStyles =
360
- getRegisteredMoleculesComponentStyles('DatePicker_DayEmpty');
361
- export const datePickerWeekStyles = getRegisteredMoleculesComponentStyles('DatePicker_Week');
362
- export const datePickerHeaderStyles = getRegisteredMoleculesComponentStyles('DatePicker_Header');
363
- export const dateDayNameStyles = getRegisteredMoleculesComponentStyles('DatePicker_DayName');
364
- export const datePickerDayRangeStyles =
365
- getRegisteredMoleculesComponentStyles('DatePicker_DayRange');
366
- export const datePickerYearItemStyles =
367
- getRegisteredMoleculesComponentStyles('DatePicker_YearItem');
341
+ export const datePickerStyles = getRegisteredComponentStylesWithFallback(
342
+ 'DatePickerInline',
343
+ datePickerStylesDefault,
344
+ );
345
+ export const datePickerMonthStyles = getRegisteredComponentStylesWithFallback(
346
+ 'DatePicker_Month',
347
+ datePickerMonthStylesDefault,
348
+ );
349
+ export const datePickerYearPickerStyles = getRegisteredComponentStylesWithFallback(
350
+ 'DatePicker_YearPicker',
351
+ datePickerYearPickerStylesDefault,
352
+ );
353
+ export const datePickerDayStyles = getRegisteredComponentStylesWithFallback(
354
+ 'DatePicker_Day',
355
+ datePickerDayStylesDefault,
356
+ );
357
+ export const datePickerDayEmptyStyles = getRegisteredComponentStylesWithFallback(
358
+ 'DatePicker_DayEmpty',
359
+ datePickerDayEmptyStylesDefault,
360
+ );
361
+ export const datePickerWeekStyles = getRegisteredComponentStylesWithFallback(
362
+ 'DatePicker_Week',
363
+ datePickerWeekStylesDefault,
364
+ );
365
+ export const datePickerHeaderStyles = getRegisteredComponentStylesWithFallback(
366
+ 'DatePicker_Header',
367
+ datePickerHeaderStylesDefault,
368
+ );
369
+ export const dateDayNameStyles = getRegisteredComponentStylesWithFallback(
370
+ 'DatePicker_DayName',
371
+ dateDayNameStylesDefault,
372
+ );
373
+ export const datePickerDayRangeStyles = getRegisteredComponentStylesWithFallback(
374
+ 'DatePicker_DayRange',
375
+ datePickerDayRangeStylesDefault,
376
+ );
377
+ export const datePickerYearItemStyles = getRegisteredComponentStylesWithFallback(
378
+ 'DatePicker_YearItem',
379
+ datePickerYearItemStylesDefault,
380
+ );
@@ -1,14 +1,10 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import DatePickerInputDefault from './DatePickerInput';
3
3
 
4
- registerMoleculesComponents({
5
- DatePickerInput: DatePickerInputDefault,
6
- });
7
-
8
4
  export const DatePickerInput = getRegisteredComponentWithFallback(
9
5
  'DatePickerInput',
10
6
  DatePickerInputDefault,
11
7
  );
12
8
 
13
- export { DatePickerInputProps } from './types';
9
+ export type { DatePickerInputProps } from './types';
14
10
  export { datePickerInputStyles } from './utils';
@@ -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 datePickerInputStylesDefault = StyleSheet.create({
6
6
  root: {
@@ -9,8 +9,7 @@ const datePickerInputStylesDefault = StyleSheet.create({
9
9
  },
10
10
  });
11
11
 
12
- registerComponentsStyles({
13
- DatePickerInput: datePickerInputStylesDefault,
14
- });
15
-
16
- export const datePickerInputStyles = getRegisteredMoleculesComponentStyles('DatePickerInput');
12
+ export const datePickerInputStyles = getRegisteredComponentStylesWithFallback(
13
+ 'DatePickerInput',
14
+ datePickerInputStylesDefault,
15
+ );
@@ -64,7 +64,7 @@ export default function DatePickerModalHeader(props: DatePickerModalHeaderProps)
64
64
  onPress={props.onSave}
65
65
  disabled={props.saveLabelDisabled || false}
66
66
  testID="dates-save">
67
- {saveLabel}
67
+ <Button.Text>{saveLabel}</Button.Text>
68
68
  </Button>
69
69
  </View>
70
70
  </SafeAreaView>
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import DatePickerModalDefault from './DatePickerModal';
3
3
 
4
- registerMoleculesComponents({
5
- DatePickerModal: DatePickerModalDefault,
6
- });
7
-
8
4
  export const DatePickerModal = getRegisteredComponentWithFallback(
9
5
  'DatePickerModal',
10
6
  DatePickerModalDefault,
@@ -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 datePickerModalStylesDefault = StyleSheet.create(theme => ({
6
6
  header: {
@@ -100,22 +100,23 @@ const datePickerModalEditStylesDefault = StyleSheet.create(theme => ({
100
100
  separator: { width: 12 },
101
101
  }));
102
102
 
103
- registerComponentsStyles({
104
- DatePickerModal: datePickerModalStylesDefault,
105
- DatePickerModal_Header: datePickerModalHeaderStylesDefault,
106
- DatePickerModal_ContentHeader: datePickerModalContentHeaderStylesDefault,
107
- DatePickerModal_HeaderBackground: datePickerModalHeaderBackgroundStylesDefault,
108
- DatePickerModal_Edit: datePickerModalEditStylesDefault,
109
- });
110
-
111
- export const datePickerModalStyles = getRegisteredMoleculesComponentStyles('DatePickerModal');
112
- export const datePickerModalHeaderStyles =
113
- getRegisteredMoleculesComponentStyles('DatePickerModal_Header');
114
- export const datePickerModalContentHeaderStyles = getRegisteredMoleculesComponentStyles(
103
+ export const datePickerModalStyles = getRegisteredComponentStylesWithFallback(
104
+ 'DatePickerModal',
105
+ datePickerModalStylesDefault,
106
+ );
107
+ export const datePickerModalHeaderStyles = getRegisteredComponentStylesWithFallback(
108
+ 'DatePickerModal_Header',
109
+ datePickerModalHeaderStylesDefault,
110
+ );
111
+ export const datePickerModalContentHeaderStyles = getRegisteredComponentStylesWithFallback(
115
112
  'DatePickerModal_ContentHeader',
113
+ datePickerModalContentHeaderStylesDefault,
116
114
  );
117
- export const datePickerModalHeaderBackgroundStyles = getRegisteredMoleculesComponentStyles(
115
+ export const datePickerModalHeaderBackgroundStyles = getRegisteredComponentStylesWithFallback(
118
116
  'DatePickerModal_HeaderBackground',
117
+ datePickerModalHeaderBackgroundStylesDefault,
118
+ );
119
+ export const datePickerModalEditStyles = getRegisteredComponentStylesWithFallback(
120
+ 'DatePickerModal_Edit',
121
+ datePickerModalEditStylesDefault,
119
122
  );
120
- export const datePickerModalEditStyles =
121
- getRegisteredMoleculesComponentStyles('DatePickerModal_Edit');
@@ -1,10 +1,6 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import DateTimePickerDefault from './DateTimePicker';
3
3
 
4
- registerMoleculesComponents({
5
- DateTimePicker: DateTimePickerDefault,
6
- });
7
-
8
4
  export const DateTimePicker = getRegisteredComponentWithFallback(
9
5
  'DateTimePicker',
10
6
  DateTimePickerDefault,
@@ -1,13 +1,12 @@
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 dateTimePickerStylesDefault = StyleSheet.create({
6
6
  container: {},
7
7
  });
8
8
 
9
- registerComponentsStyles({
10
- DateTimePicker: dateTimePickerStylesDefault,
11
- });
12
-
13
- export const dateTimePickerStyles = getRegisteredMoleculesComponentStyles('DateTimePicker');
9
+ export const dateTimePickerStyles = getRegisteredComponentStylesWithFallback(
10
+ 'DateTimePicker',
11
+ dateTimePickerStylesDefault,
12
+ );
@@ -1,4 +1,4 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import DialogComponent from './Dialog';
3
3
  import DialogActions from './DialogActions';
4
4
  import DialogContent from './DialogContent';
@@ -17,10 +17,6 @@ export const DialogDefault = Object.assign(
17
17
  },
18
18
  );
19
19
 
20
- registerMoleculesComponents({
21
- Dialog: DialogDefault,
22
- });
23
-
24
20
  export const Dialog = getRegisteredComponentWithFallback('Dialog', DialogDefault);
25
21
 
26
22
  export type { Props as DialogProps } from './Dialog';
@@ -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 dialogStylesDefault = StyleSheet.create(theme => ({
6
6
  root: {
@@ -63,18 +63,24 @@ const dialogActionsStylesDefault = StyleSheet.create(theme => ({
63
63
  },
64
64
  }));
65
65
 
66
- registerComponentsStyles({
67
- Dialog: dialogStylesDefault,
68
- Dialog_Title: dialogTitleStylesDefault,
69
- Dialog_ScrollArea: dialogScrollAreaStylesDefault,
70
- Dialog_Icon: dialogIconStylesDefault,
71
- Dialog_Content: dialogContentStylesDefault,
72
- Dialog_Actions: dialogActionsStylesDefault,
73
- });
74
-
75
- export const dialogStyles = getRegisteredMoleculesComponentStyles('Dialog');
76
- export const dialogTitleStyles = getRegisteredMoleculesComponentStyles('Dialog_Title');
77
- export const dialogScrollAreaStyles = getRegisteredMoleculesComponentStyles('Dialog_ScrollArea');
78
- export const dialogIconStyles = getRegisteredMoleculesComponentStyles('Dialog_Icon');
79
- export const dialogContentStyles = getRegisteredMoleculesComponentStyles('Dialog_Content');
80
- export const dialogActionsStyles = getRegisteredMoleculesComponentStyles('Dialog_Actions');
66
+ export const dialogStyles = getRegisteredComponentStylesWithFallback('Dialog', dialogStylesDefault);
67
+ export const dialogTitleStyles = getRegisteredComponentStylesWithFallback(
68
+ 'Dialog_Title',
69
+ dialogTitleStylesDefault,
70
+ );
71
+ export const dialogScrollAreaStyles = getRegisteredComponentStylesWithFallback(
72
+ 'Dialog_ScrollArea',
73
+ dialogScrollAreaStylesDefault,
74
+ );
75
+ export const dialogIconStyles = getRegisteredComponentStylesWithFallback(
76
+ 'Dialog_Icon',
77
+ dialogIconStylesDefault,
78
+ );
79
+ export const dialogContentStyles = getRegisteredComponentStylesWithFallback(
80
+ 'Dialog_Content',
81
+ dialogContentStylesDefault,
82
+ );
83
+ export const dialogActionsStyles = getRegisteredComponentStylesWithFallback(
84
+ 'Dialog_Actions',
85
+ dialogActionsStylesDefault,
86
+ );